本文整理汇总了C#中Uber.HabboHotel.GameClients.GameClient.SendPacket方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.SendPacket方法的具体用法?C# GameClient.SendPacket怎么用?C# GameClient.SendPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uber.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.SendPacket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse
public void parse(GameClient Session, ClientPacket Packet)
{
CatalogPage Page = UberEnvironment.GetGame().GetCatalog().GetPage(Packet.PopWiredInt32());
if (Page == null || !Page.Enabled || !Page.Visible || Page.ComingSoon || Page.MinRank > Session.GetHabbo().Rank)
{
return;
}
if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
{
Session.SendNotif("This page is for Club members only!");
return;
}
Session.SendPacket(UberEnvironment.GetGame().GetCatalog().SerializePage(Page));
if (Page.Layout == "recycler")
{
ServerPacket message = new ServerPacket(507);
message.AppendBoolean(true);
message.AppendBoolean(false);
Session.SendPacket(message);
}
}
示例2: parse
public void parse(GameClient Session, ClientPacket Packet)
{
uint Id = Packet.PopWiredUInt();
RoomData Data = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Id);
if (Data == null || Session.GetHabbo().FavoriteRooms.Count >= 30 || Session.GetHabbo().FavoriteRooms.Contains(Id) || Data.Type == "public")
{
ServerPacket packet = new ServerPacket(33);
packet.AppendInt32(-9001);
Session.SendPacket(packet);
return;
}
ServerPacket _packet = new ServerPacket(459);
_packet.AppendUInt(Id);
_packet.AppendBoolean(true);
Session.SendPacket(_packet);
Session.GetHabbo().FavoriteRooms.Add(Id);
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("INSERT INTO user_favorites (user_id,room_id) VALUES ('" + Session.GetHabbo().Id + "','" + Id + "')");
}
}
示例3: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session))
{
return;
}
string Name = Packet.PopFixedString();
byte[] Result = Packet.ReadBytes(1);
GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Name);
if (Client == null)
{
return;
}
if (Result[0] == Convert.ToByte(65))
{
Client.GetHabbo().LoadingChecksPassed = true;
Session.SendPacket(new ServerPacket(41));
}
else
{
Session.SendPacket(new ServerPacket(131));
}
}
示例4: SellItem
public void SellItem(GameClient Session, uint ItemId, int SellingPrice)
{
UserItem Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);
if (Item == null || SellingPrice > 10000 || !CanSellItem(Item))
{
ServerPacket packet = new ServerPacket(610);
packet.AppendBoolean(false);
Session.SendPacket(packet);
return;
}
int Comission = CalculateComissionPrice(SellingPrice);
int TotalPrice = SellingPrice + Comission;
int ItemType = 1;
if (Item.GetBaseItem().Type == "i")
{
ItemType++;
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("public_name", Item.GetBaseItem().PublicName);
dbClient.AddParamWithValue("extra_data", Item.ExtraData);
dbClient.ExecuteQuery("INSERT INTO catalog_marketplace_offers (item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data) VALUES ('" + Item.BaseItem + "','" + Session.GetHabbo().Id + "','" + SellingPrice + "','" + TotalPrice + "',@public_name,'" + Item.GetBaseItem().SpriteId + "','" + ItemType + "','" + UberEnvironment.GetUnixTimestamp() + "',@extra_data)");
}
Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);
ServerPacket p610 = new ServerPacket(610);
p610.AppendBoolean(true);
Session.SendPacket(p610);
}
示例5: parse
public void parse(GameClient Session, ClientPacket Packet)
{
if (Session.GetHabbo().LoadingRoom <= 0)
{
return;
}
RoomData Data = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Session.GetHabbo().LoadingRoom);
if (Data == null)
{
return;
}
if (Data.Model == null)
{
Session.SendNotif("Sorry, model data is missing from this room and therefore cannot be loaded.");
Session.SendPacket(new ServerPacket(18));
Session.ClearRoomLoading();
return;
}
Session.SendPacket(Data.Model.SerializeHeightmap());
Session.SendPacket(Data.Model.SerializeRelativeHeightmap());
}
示例6: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session, true))
{
return;
}
RoomItem Present = Room.GetItem(Packet.PopWiredUInt());
if (Present == null)
{
return;
}
DataRow Data = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Data = dbClient.ReadDataRow("SELECT base_id,amount,extra_data FROM user_presents WHERE item_id = '" + Present.Id + "' LIMIT 1");
}
if (Data == null)
{
return;
}
Item BaseItem = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Data["base_id"]);
if (BaseItem == null)
{
return;
}
Room.RemoveFurniture(Session, Present.Id);
ServerPacket packet = new ServerPacket(219);
packet.AppendUInt(Present.Id);
Session.SendPacket(packet);
packet = new ServerPacket(129);
packet.AppendStringWithBreak(BaseItem.Type);
packet.AppendInt32(BaseItem.SpriteId);
packet.AppendStringWithBreak(BaseItem.Name);
Session.SendPacket(packet);
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("DELETE FROM user_presents WHERE item_id = '" + Present.Id + "' LIMIT 1");
}
UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, BaseItem, (int)Data["amount"], (string)Data["extra_data"]);
}
示例7: parse
public void parse(GameClient Session, ClientPacket Packet)
{
uint ItemId = Packet.PopWiredUInt();
DataRow Row = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Row = dbClient.ReadDataRow("SELECT * FROM catalog_marketplace_offers WHERE offer_id = '" + ItemId + "' LIMIT 1");
}
if (Row == null || (string)Row["state"] != "1" || (double)Row["timestamp"] <= UberEnvironment.GetGame().GetCatalog().GetMarketplace().FormatTimestamp())
{
Session.SendNotif("Sorry, this offer has expired.");
return;
}
Item Item = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Row["item_id"]);
if (Item == null)
{
return;
}
if ((int)Row["total_price"] >= 1)
{
Session.GetHabbo().Credits -= (int)Row["total_price"];
Session.GetHabbo().UpdateCreditsBalance(true);
}
UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, (string)Row["extra_data"]);
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE catalog_marketplace_offers SET state = '2' WHERE offer_id = '" + ItemId + "' LIMIT 1");
}
ServerPacket packet = new ServerPacket(67);
packet.AppendUInt(Item.ItemId);
packet.AppendStringWithBreak(Item.Name);
packet.AppendInt32(0);
packet.AppendInt32(0);
packet.AppendInt32(1);
packet.AppendStringWithBreak(Item.Type.ToLower());
packet.AppendInt32(Item.SpriteId);
packet.AppendStringWithBreak("");
packet.AppendInt32(1);
packet.AppendInt32(-1);
packet.AppendStringWithBreak("");
Session.SendPacket(packet);
Session.SendPacket(UberEnvironment.GetGame().GetCatalog().GetMarketplace().SerializeOffers(-1, -1, "", 1));
}
示例8: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session, true))
{
return;
}
foreach (uint UserId in Room.UsersWithRights)
{
RoomUser User = Room.GetRoomUserByHabbo(UserId);
if (User != null && !User.IsBot)
{
User.GetClient().SendPacket(new ServerPacket(43));
}
ServerPacket packet = new ServerPacket(511);
packet.AppendUInt(Room.RoomId);
packet.AppendUInt(UserId);
Session.SendPacket(packet);
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("DELETE FROM room_rights WHERE room_id = '" + Room.RoomId + "'");
}
Room.UsersWithRights.Clear();
}
示例9: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || !Room.CheckRights(Session, true))
{
return;
}
RoomItem Exchange = Room.GetItem(Packet.PopWiredUInt());
if (Exchange == null)
{
return;
}
if (!Exchange.GetBaseItem().Name.StartsWith("CF_") && !Exchange.GetBaseItem().Name.StartsWith("CFC_"))
{
return;
}
string[] Split = Exchange.GetBaseItem().Name.Split('_');
int Value = int.Parse(Split[1]);
if (Value > 0)
{
Session.GetHabbo().Credits += Value;
Session.GetHabbo().UpdateCreditsBalance(true);
}
Room.RemoveFurniture(null, Exchange.Id);
Session.SendPacket(new ServerPacket(219));
}
示例10: parse
public void parse(GameClient Session, ClientPacket Packet)
{
uint _id = Packet.PopWiredUInt();
DataRow Row = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
Row = dbClient.ReadDataRow("SELECT * FROM catalog_marketplace_offers WHERE offer_id = '" + _id + "' LIMIT 1");
}
if (Row == null || (uint)Row["user_id"] != Session.GetHabbo().Id || (string)Row["state"] != "1")
{
return;
}
Item Item = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Row["item_id"]);
if (Item == null)
{
return;
}
UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, (string)Row["extra_data"]);
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("DELETE FROM catalog_marketplace_offers WHERE offer_id = '" + _id + "' LIMIT 1");
}
ServerPacket packet = new ServerPacket(614);
packet.AppendUInt((uint)Row["offer_id"]);
packet.AppendBoolean(true);
Session.SendPacket(packet);
}
示例11: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Session.GetHabbo().GetBadgeComponent().ResetSlots();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = '0' WHERE user_id = '" + Session.GetHabbo().Id + "'");
}
while (Packet.RemainingLength > 0)
{
int Slot = Packet.PopWiredInt32();
string Badge = Packet.PopFixedString();
if (Badge.Length == 0)
{
continue;
}
if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5)
{
// zomg haxx0r
return;
}
Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("slotid", Slot);
dbClient.AddParamWithValue("badge", Badge);
dbClient.AddParamWithValue("userid", Session.GetHabbo().Id);
dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = @slotid WHERE badge_id = @badge AND user_id = @userid LIMIT 1");
}
}
ServerPacket Message = new ServerPacket(228);
Message.AppendUInt(Session.GetHabbo().Id);
Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount);
foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList)
{
if (Badge.Slot <= 0)
{
continue;
}
Message.AppendInt32(Badge.Slot);
Message.AppendStringWithBreak(Badge.Code);
}
if (Session.GetHabbo().InRoom && UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
{
UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message);
}
else
{
Session.SendPacket(Message);
}
}
示例12: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null)
{
return;
}
RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());
if (User == null || User.IsBot)
{
return;
}
ServerPacket packet = new ServerPacket(350);
packet.AppendUInt(User.GetClient().GetHabbo().Id);
packet.AppendInt32(User.GetClient().GetHabbo().Tags.Count);
foreach (string Tag in User.GetClient().GetHabbo().Tags)
{
packet.AppendStringWithBreak(Tag);
}
Session.SendPacket(packet);
}
示例13: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null)
{
return;
}
RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());
if (User == null || User.IsBot)
{
return;
}
ServerPacket packet = new ServerPacket(228);
packet.AppendUInt(User.GetClient().GetHabbo().Id);
packet.AppendInt32(User.GetClient().GetHabbo().GetBadgeComponent().EquippedCount);
foreach (Badge Badge in User.GetClient().GetHabbo().GetBadgeComponent().BadgeList)
{
if (Badge.Slot <= 0)
{
continue;
}
packet.AppendInt32(Badge.Slot);
packet.AppendStringWithBreak(Badge.Code);
}
Session.SendPacket(packet);
}
示例14: parse
public void parse(GameClient Session, ClientPacket Packet)
{
ServerPacket packet = new ServerPacket(611);
packet.AppendBoolean(true);
packet.AppendInt32(99999);
Session.SendPacket(packet);
}
示例15: parse
public void parse(GameClient Session, ClientPacket Packet)
{
ServerPacket packet = new ServerPacket(267);
packet.AppendBoolean(Session.GetHabbo().HasFuse("fuse_use_wardrobe"));
if (Session.GetHabbo().HasFuse("fuse_use_wardrobe"))
{
DataTable WardrobeData = null;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("userid", Session.GetHabbo().Id);
WardrobeData = dbClient.ReadDataTable("SELECT * FROM user_wardrobe WHERE user_id = @userid");
}
if (WardrobeData == null)
{
packet.AppendInt32(0);
}
else
{
packet.AppendInt32(WardrobeData.Rows.Count);
foreach (DataRow Row in WardrobeData.Rows)
{
packet.AppendUInt((uint)Row["slot_id"]);
packet.AppendStringWithBreak((string)Row["look"]);
packet.AppendStringWithBreak((string)Row["gender"]);
}
}
}
Session.SendPacket(packet);
}