本文整理汇总了C#中GameClient.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.SendMessage方法的具体用法?C# GameClient.SendMessage怎么用?C# GameClient.SendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameClient
的用法示例。
在下文中一共展示了GameClient.SendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public void Handle(GameClient client)
{
if (this.Position != null)
client.Player.Position = this.Position;
// looking for gold to pick up
// TODO: Need to consider items on the ground globally as well (and this doesn't belong here)
var actorList = client.Player.World.GetActorsInRange(this.Position.X, this.Position.Y, this.Position.Z, 20f);
foreach (var actor in actorList)
{
Item item;
if (client.Player.GroundItems.TryGetValue(actor.DynamicID, out item) && item.ItemType == ItemType.Gold)
{
client.SendMessage(new FloatingAmountMessage() {
Place = new WorldPlace() {
Position = this.Position,
WorldID = client.Player.World.DynamicID,
},
Amount = item.Attributes[GameAttribute.Gold],
Type = FloatingAmountMessage.FloatType.Gold,
});
// NOTE: ANNDataMessage6 is probably "AddToInventory"
client.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage6)
{
ActorID = actor.DynamicID,
});
client.Player.Inventory.PickUpGold(actor.DynamicID);
client.Player.GroundItems.Remove(actor.DynamicID);
// should delete from World also
}
}
}
示例2: Handle
public override void Handle(GameClient client)
{
if (this.Id != 0x000A)
throw new NotImplementedException();
// a hackish way to get client.BnetClient in context -- pretends games has only one client in. when we're done with implementing bnet completely, will get this sorted out. /raist
client.BnetClient = Core.Games.GameManager.AvailableGames[(ulong)this.Field2].Clients.FirstOrDefault();
if (client.BnetClient != null)
{
client.Toon = client.BnetClient.CurrentToon;
client.BnetClient.InGameClient = client;
}
client.SendMessageNow(new VersionsMessage()
{
Id = 0x000D,
SNOPackHash = this.SNOPackHash,
ProtocolHash = GameMessage.ImplementedProtocolHash,
Version = "0.3.0.7333",
});
client.SendMessage(new ConnectionEstablishedMessage()
{
Id = 0x002E,
Field0 = 0x00000000,
Field1 = 0x4BB91A16,
Field2 = this.SNOPackHash,
});
client.SendMessage(new GameSetupMessage()
{
Id = 0x002F,
Field0 = 0x00000077,
});
client.SendMessage(new SavePointInfoMessage()
{
Id = 0x0045,
snoLevelArea = -1,
});
client.SendMessage(new HearthPortalInfoMessage()
{
Id = 0x0046,
snoLevelArea = -1,
Field1 = -1,
});
client.SendMessage(new ActTransitionMessage()
{
Id = 0x00A8,
Field0 = 0x00000000,
Field1 = true,
});
client.GameUniverse.EnterPlayer(client);
client.FlushOutgoingBuffer();
}
示例3: SendMessage
public void SendMessage(GameClient client, uint actorID)
{
var list = GetMessageList(actorID);
foreach (var msg in list)
client.SendMessage(msg);
client.FlushOutgoingBuffer();
}
示例4: SendChangedMessage
/// <summary>
/// Send only the changed attributes. How nice is that?
/// </summary>
/// <param name="client">the client we send it to</param>
/// <param name="actorID">the actor this attribs belong to</param>
public void SendChangedMessage(GameClient client, uint actorID)
{
var list = GetChangedMessageList(actorID);
foreach (var msg in list)
client.SendMessage(msg);
_changedAttributes.Clear();
}
示例5: CompleteUserTalent
/// <summary>
/// Completes the user talent.
/// </summary>
/// <param name="Session">The session.</param>
/// <param name="Talent">The talent.</param>
internal void CompleteUserTalent(GameClient Session, Talent Talent)
{
if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentTalentLevel < Talent.Level || Session.GetHabbo().Talents.ContainsKey(Talent.Id))
return;
if (!LevelIsCompleted(Session, Talent.Type, Talent.Level))
return;
if (!string.IsNullOrEmpty(Talent.Prize) && Talent.PrizeBaseItem > 0u)
{
Item item = AzureEmulator.GetGame().GetItemManager().GetItem(Talent.PrizeBaseItem);
AzureEmulator.GetGame().GetCatalog().DeliverItems(Session, item, 1, "", 0, 0, "");
}
var value = new UserTalent(Talent.Id, 1);
Session.GetHabbo().Talents.Add(Talent.Id, value);
using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
queryReactor.RunFastQuery(string.Concat("REPLACE INTO users_talents VALUES (", Session.GetHabbo().Id, ", ", Talent.Id, ", ", 1, ");"));
}
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("TalentLevelUpMessageComposer"));
serverMessage.AppendString(Talent.Type);
serverMessage.AppendInteger(Talent.Level);
serverMessage.AppendInteger(0);
if (Talent.Type == "citizenship" && Talent.Level == 4)
{
serverMessage.AppendInteger(2);
serverMessage.AppendString("HABBO_CLUB_VIP_7_DAYS");
serverMessage.AppendInteger(7);
serverMessage.AppendString(Talent.Prize);
serverMessage.AppendInteger(0);
}
else
{
serverMessage.AppendInteger(1);
serverMessage.AppendString(Talent.Prize);
serverMessage.AppendInteger(0);
}
Session.SendMessage(serverMessage);
if (Talent.Type == "citizenship")
{
if (Talent.Level == 3)
AzureEmulator.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Citizenship", 1);
else if (Talent.Level == 4)
{
Session.GetHabbo().GetSubscriptionManager().AddSubscription(7);
using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
queryReactor.RunFastQuery(string.Concat(new object[]
{
"UPDATE users SET talent_status = 'helper' WHERE id = ",
Session.GetHabbo().Id,
";"
}));
}
}
}
}
示例6: OnUserWalk
public void OnUserWalk(GameClient session, RoomItem item, RoomUser user)
{
if (item == null || user == null) return;
var data = item.ExtraData.Split(Convert.ToChar(9));
if (item.ExtraData == "" || data.Length < 4) return;
var message = new ServerMessage(LibraryParser.OutgoingRequest("InternalLinkMessageComposer"));
message.AppendString(data[3]);
session.SendMessage(message);
}
示例7: Handle
public void Handle(GameClient client)
{
if (this.Position != null)
client.Player.Hero.Position = this.Position;
// looking for gold to pick up
var actorList = client.Player.Hero.CurrentWorld.GetActorsInRange(0x00000178, this.Position.X, this.Position.Y, this.Position.Z, 20f);
foreach (var actor in actorList)
{
Item item;
if (client.items.TryGetValue(actor.DynamicId, out item) && item.Type == ItemType.Gold)
{
client.SendMessage(new FloatingAmountMessage() {
Field0 = new WorldPlace() {
Field0 = this.Position,
Field1 = client.Player.Hero.CurrentWorld.WorldID,
},
Field1 = item.Count,
Field3 = 0x1c,
});
client.SendMessage(new ANNDataMessage()
{
Id = 0x003C,
Field0 = actor.DynamicId,
});
client.Player.Hero.Inventory.PickUpGold(actor.DynamicId);
client.PacketId += 10 * 2;
client.SendMessage(new DWordDataMessage()
{
Id = 0x89,
Field0 = client.PacketId,
});
client.FlushOutgoingBuffer();
client.items.Remove(actor.DynamicId);
// should delete from World also
}
}
}
示例8: Handle
public void Handle(GameClient client)
{
if (client.IsLoggingOut)
{
client.SendMessage(new QuitGameMessage() // should be sent to all players i guess /raist.
{
PlayerIndex = client.Player.PlayerIndex,
});
GameManager.RemovePlayerFromGame(client);
}
}
示例9: Execute
public override void Execute(GameClient session, string[] pms)
{
var room = session.GetHabbo().CurrentRoom;
foreach (
var pet in
room.GetRoomUserManager().GetPets().Where(pet => pet.OwnerId == session.GetHabbo().Id))
{
session.GetHabbo().GetInventoryComponent().AddPet(pet);
room.GetRoomUserManager().RemoveBot(pet.VirtualId, false);
}
session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializePetInventory());
}
示例10: Execute
public override bool Execute(GameClient session, string[] pms)
{
session.GetHabbo().NewNavigator = !session.GetHabbo().NewNavigator;
var msg = new ServerMessage(LibraryParser.OutgoingRequest("SendPerkAllowancesMessageComposer"));
msg.AppendInteger(1);
msg.AppendString("NAVIGATOR_PHASE_TWO_2014");
msg.AppendString("");
msg.AppendBool(session.GetHabbo().NewNavigator);
session.SendMessage(msg);
return true;
}
示例11: Handle
public void Handle(GameClient client)
{
client.IsLoggingOut = !client.IsLoggingOut;
if (client.IsLoggingOut)
{
client.SendMessage(new LogoutTickTimeMessage()
{
Field0 = false, // true - logout with party?
Ticks = 0, // delay 1, make this equal to 0 for instant logout
Field2 = 0, // delay 2
});
}
}
示例12: Execute
public override void Execute(GameClient session, string[] pms)
{
var client = AzureEmulator.GetGame().GetClientManager().GetClientByUserName(pms[0]);
if (client == null || client.GetHabbo() == null)
{
session.SendWhisper(TextManager.GetText("user_not_found"));
return;
}
if (client.GetHabbo().CurrentRoom == null ||
client.GetHabbo().CurrentRoom == session.GetHabbo().CurrentRoom)
return;
var roomFwd =
new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));
roomFwd.AppendInteger(client.GetHabbo().CurrentRoom.RoomId);
session.SendMessage(roomFwd);
}
示例13: OnTrigger
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
var message = new ServerMessage(LibraryParser.OutgoingRequest("CraftableProductsMessageComposer"));
var crafting = AzureEmulator.GetGame().GetCraftingManager();
message.AppendInteger(crafting.CraftingRecipes.Count);
foreach(var recipe in crafting.CraftingRecipes.Values)
{
message.AppendString(recipe.Result);
message.AppendString(recipe.Result);
}
message.AppendInteger(crafting.CraftableItems.Count);
foreach (var itemName in crafting.CraftableItems)
{
message.AppendString(itemName);
}
session.SendMessage(message);
}
示例14: OnTrigger
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
{
var user = session.GetHabbo();
var ishc = user.VIP;
if (!ishc)
{
var message = new ServerMessage(LibraryParser.OutgoingRequest("CustomUserNotificationMessageComposer"));
message.AppendInteger(3);
session.SendMessage(message);
return;
}
if (item == null || item.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.HCGate)
return;
var modes = item.GetBaseItem().Modes - 1;
if (modes <= 0)
item.UpdateState(false, true);
int currentMode;
int.TryParse(item.ExtraData, out currentMode);
int newMode;
if (currentMode <= 0)
newMode = 1;
else if (currentMode >= modes)
newMode = 0;
else
newMode = currentMode + 1;
if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
return;
item.ExtraData = newMode.ToString();
item.UpdateState();
item.GetRoom().GetGameMap().UpdateMapForItem(item);
item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item);
}
}
示例15: GiveBadge
/// <summary>
/// Gives the badge.
/// </summary>
/// <param name="badge">The badge.</param>
/// <param name="inDatabase">if set to <c>true</c> [in database].</param>
/// <param name="session">The session.</param>
/// <param name="wiredReward">if set to <c>true</c> [wired reward].</param>
internal void GiveBadge(string badge, bool inDatabase, GameClient session, bool wiredReward = false)
{
if (wiredReward)
session.SendMessage(SerializeBadgeReward(!HasBadge(badge)));
if (HasBadge(badge))
return;
if (inDatabase)
using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
{
queryReactor.SetQuery(string.Concat("INSERT INTO users_badges (user_id,badge_id,badge_slot) VALUES (", _userId, ",@badge,", 0, ")"));
queryReactor.AddParameter("badge", badge);
queryReactor.RunQuery();
}
BadgeList.Add(badge, new Badge(badge, 0));
session.SendMessage(SerializeBadge(badge));
session.SendMessage(Update(badge));
}