本文整理汇总了C#中ClientPacket类的典型用法代码示例。如果您正苦于以下问题:C# ClientPacket类的具体用法?C# ClientPacket怎么用?C# ClientPacket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientPacket类属于命名空间,在下文中一共展示了ClientPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
Room Room;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
User.UnIdle();
int DanceId = Packet.PopInt();
if (DanceId < 0 || DanceId > 4)
DanceId = 0;
if (DanceId > 0 && User.CarryItemID > 0)
User.CarryItem(0);
if (Session.GetHabbo().Effects().CurrentEffect > 0)
Room.SendMessage(new AvatarEffectComposer(User.VirtualId, 0));
User.DanceId = DanceId;
Room.SendMessage(new DanceComposer(User, DanceId));
PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_DANCE);
if (Room.GetRoomUserManager().GetRoomUsers().Count > 19)
PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.MASS_DANCE);
}
示例2: Send
public void Send()
{
ClientPacket clientPacket = new ClientPacket(PacketType.Telnet);
clientPacket.telnet = new ClientPacket.Telnet(cmd.Text);
handler.packetStream.Send(clientPacket);
cmd.Text = "";
}
示例3: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int CreditsOwed = 0;
DataTable Table = null;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT `asking_price` FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND state = '2'");
Table = dbClient.getTable();
}
if (Table != null)
{
foreach (DataRow row in Table.Rows)
{
CreditsOwed += Convert.ToInt32(row["asking_price"]);
}
if (CreditsOwed >= 1)
{
Session.GetHabbo().Credits += CreditsOwed;
Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("DELETE FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `state` = '2'");
}
}
}
示例4: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
int BotId = Packet.PopInt();
int ActionId = Packet.PopInt();
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser BotUser = null;
if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser))
return;
string BotSpeech = "";
foreach (RandomSpeech Speech in BotUser.BotData.RandomSpeech.ToList())
{
BotSpeech += (Speech.Message + "\n");
}
BotSpeech += ";#;";
BotSpeech += BotUser.BotData.AutomaticChat;
BotSpeech += ";#;";
BotSpeech += BotUser.BotData.SpeakingInterval;
BotSpeech += ";#;";
BotSpeech += BotUser.BotData.MixSentences;
if (ActionId == 2 || ActionId == 5)
Session.SendMessage(new OpenBotActionComposer(BotUser, ActionId, BotSpeech));
}
示例5: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int SlotId = Packet.PopInt();
string Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Packet.PopString());
string Gender = Packet.PopString();
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT null FROM `user_wardrobe` WHERE `user_id` = " + Session.GetHabbo().Id + " AND `slot_id` = @slot");
dbClient.AddParameter("slot", SlotId);
if (dbClient.getRow() != null)
{
dbClient.SetQuery("UPDATE `user_wardrobe` SET `look` = @look, `gender` = @gender WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `slot_id` = @slot LIMIT 1");
dbClient.AddParameter("slot", SlotId);
dbClient.AddParameter("look", Look);
dbClient.AddParameter("gender", Gender.ToUpper());
dbClient.RunQuery();
}
else
{
dbClient.SetQuery("INSERT INTO `user_wardrobe` (`user_id`,`slot_id`,`look`,`gender`) VALUES ('" + Session.GetHabbo().Id + "',@slot,@look,@gender)");
dbClient.AddParameter("slot", SlotId);
dbClient.AddParameter("look", Look);
dbClient.AddParameter("gender", Gender.ToUpper());
dbClient.RunQuery();
}
}
}
示例6: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int itemId = Packet.PopInt();
string locationData = Packet.PopString();
if (!Session.GetHabbo().InRoom)
return;
Room Room;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
if (!Room.CheckRights(Session))
return;
Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(itemId);
if (Item == null)
return;
try
{
string WallPossition = WallPositionCheck(":" + locationData.Split(':')[1]);
Item RoomItem = new Item(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, Session.GetHabbo().Id, Item.GroupId, 0, 0, WallPossition, Room);
if (Room.GetRoomItemHandler().SetWallItem(Session, RoomItem))
Session.GetHabbo().GetInventoryComponent().RemoveItem(itemId);
}
catch
{
//TODO: Send a packet
return;
}
}
示例7: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int RoomId = Packet.PopInt();
string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
RoomData Data = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);
if (Data == null)
return;
if (Data.OwnerId != Session.GetHabbo().Id)
return;//HAX
if (Data.Promotion == null)
{
Session.SendNotification("Oops, it looks like there isn't a room promotion in this room?");
return;
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `room_promotions` SET `title` = @title, `description` = @desc WHERE `room_id` = " + RoomId + " LIMIT 1");
dbClient.AddParameter("title", Name);
dbClient.AddParameter("desc", Desc);
dbClient.RunQuery();
}
Room Room;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Convert.ToInt32(RoomId), out Room))
return;
Data.Promotion.Name = Name;
Data.Promotion.Description = Desc;
Room.SendMessage(new RoomEventComposer(Data, Data.Promotion));
}
示例8: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int GroupId = Packet.PopInt();
string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
Group Group = null;
if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
return;
if (Group.CreatorId != Session.GetHabbo().Id)
return;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `groups` SET `name`= @name, `desc` = @desc WHERE `id` = '" + GroupId + "' LIMIT 1");
dbClient.AddParameter("name", Name);
dbClient.AddParameter("desc", Desc);
dbClient.RunQuery();
}
Group.Name = Name;
Group.Description = Desc;
Session.SendMessage(new GroupInfoComposer(Group, Session));
}
示例9: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (Session == null)
return;
int GroupId = Packet.PopInt();
if (GroupId == 0)
return;
Group Group = null;
if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
return;
Session.GetHabbo().GetStats().FavouriteGroupId = Group.Id;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("UPDATE `user_stats` SET `groupid` = " + Session.GetHabbo().GetStats().FavouriteGroupId + " WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
}
if (Session.GetHabbo().InRoom && Session.GetHabbo().CurrentRoom != null)
{
Session.GetHabbo().CurrentRoom.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id));
if (Group != null)
{
Session.GetHabbo().CurrentRoom.SendMessage(new HabboGroupBadgesComposer(Group));
RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User != null)
Session.GetHabbo().CurrentRoom.SendMessage(new UpdateFavouriteGroupComposer(Session.GetHabbo().Id, Group, User.VirtualId));
}
}
else
Session.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id));
}
示例10: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
Room Room = null;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
if (!Room.CheckRights(Session))
return;
Item Item = Room.GetRoomItemHandler().GetItem(Packet.PopInt());
if (Item == null)
return;
if (Item.GetBaseItem().InteractionType == InteractionType.POSTIT || Item.GetBaseItem().InteractionType == InteractionType.CAMERA_PICTURE)
{
Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
}
}
}
示例11: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (Session == null || Session.GetHabbo() == null)
return;
if (!Session.GetHabbo().InRoom)
return;
int ItemId = Packet.PopInt();
Session.SendMessage(new HideWiredConfigComposer());
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;
Item SelectedItem = Room.GetRoomItemHandler().GetItem(ItemId);
if (SelectedItem == null)
return;
IWiredItem Box = null;
if (!Session.GetHabbo().CurrentRoom.GetWired().TryGet(ItemId, out Box))
return;
if (Box.Type == WiredBoxType.EffectGiveUserBadge && !Session.GetHabbo().GetPermissions().HasRight("room_item_wired_rewards"))
{
Session.SendNotification("You don't have the correct permissions to do this.");
return;
}
Box.HandleSave(Packet);
Session.GetHabbo().CurrentRoom.GetWired().SaveBox(Box);
}
示例12: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
return;
Room Room = null;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
if (!Room.CanTradeInRoom)
return;
Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id);
if (Trade == null)
return;
int Amount = Packet.PopInt();
Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Packet.PopInt());
if (Item == null)
return;
List<Item> AllItems = Session.GetHabbo().GetInventoryComponent().GetItems.Where(x => x.Data.Id == Item.Data.Id).Take(Amount).ToList();
foreach (Item I in AllItems)
{
Trade.OfferItem(Session.GetHabbo().Id, I);
}
}
示例13: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null || !Room.CheckRights(Session, true))
return;
int ItemId = Packet.PopInt();
Item Item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(ItemId);
if (Item == null)
return;
string Gender = Session.GetHabbo().Gender.ToLower();
string Figure = "";
foreach (string Str in Session.GetHabbo().Look.Split('.'))
{
if (Str.Contains("hr") || Str.Contains("hd") || Str.Contains("he") || Str.Contains("ea") || Str.Contains("ha"))
continue;
Figure += Str + ".";
}
Figure = Figure.TrimEnd('.');
if (Item.ExtraData.Contains(Convert.ToChar(5)))
{
string[] Flags = Item.ExtraData.Split(Convert.ToChar(5));
Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + Flags[2];
}
else
Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + "Default";
Item.UpdateState(true, true);
}
示例14: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
Room Instance = PlusEnvironment.GetGame().GetRoomManager().TryGetRandomLoadedRoom();
if (Instance != null)
Session.SendMessage(new RoomForwardComposer(Instance.Id));
}
示例15: Parse
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
Room Room = null;
if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
return;
int PetId = Packet.PopInt();
RoomUser Pet = null;
if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet))
return;
if (Pet.PetData.AnyoneCanRide == 1)
Pet.PetData.AnyoneCanRide = 0;
else
Pet.PetData.AnyoneCanRide = 1;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("UPDATE `bots_petdata` SET `anyone_ride` = '" + Pet.PetData.AnyoneCanRide + "' WHERE `id` = '" + PetId + "' LIMIT 1");
}
Room.SendMessage(new PetInformationComposer(Pet.PetData));
}