本文整理汇总了C#中Uber.Messages.ServerPacket类的典型用法代码示例。如果您正苦于以下问题:C# ServerPacket类的具体用法?C# ServerPacket怎么用?C# ServerPacket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerPacket类属于Uber.Messages命名空间,在下文中一共展示了ServerPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 + "')");
}
}
示例2: DeliverInstantMessage
public void DeliverInstantMessage(string Message, uint ConversationId)
{
ServerPacket InstantMessage = new ServerPacket(134);
InstantMessage.AppendUInt(ConversationId);
InstantMessage.AppendString(Message);
GetClient().SendPacket(InstantMessage);
}
示例3: 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);
}
示例4: 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);
}
}
示例5: parse
public void parse(GameClient Session, ClientPacket Packet)
{
Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
if (Room == null || Session.GetHabbo().DailyRespectPoints <= 0)
{
return;
}
RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());
if (User == null || User.GetClient().GetHabbo().Id == Session.GetHabbo().Id || User.IsBot)
{
return;
}
Session.GetHabbo().DailyRespectPoints--;
User.GetClient().GetHabbo().Respect++;
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE users SET respect = respect + 1 WHERE id = '" + User.GetClient().GetHabbo().Id + "' LIMIT 1");
dbClient.ExecuteQuery("UPDATE users SET daily_respect_points = daily_respect_points - 1 WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
}
// FxkqUzYP_
ServerPacket Message = new ServerPacket(440);
Message.AppendUInt(User.GetClient().GetHabbo().Id);
Message.AppendInt32(User.GetClient().GetHabbo().Respect);
Room.SendMessage(Message);
}
示例6: 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);
}
}
示例7: 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);
}
示例8: 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);
}
示例9: Serialize
public void Serialize(ServerPacket Message)
{
// PMYoNktchn_stovesKHI[bKIM
if (IsDeal)
{
// 8 328 deal01 [] 5 0 2 s [] 26 [] 3 -1
// PBXRAdeal01QAHJsRFKMsQEIM
throw new NotImplementedException("Multipile item ids set for catalog item #" + Id + ", but this is usupported at this point");
}
else
{
Message.AppendUInt(Id);
Message.AppendStringWithBreak(Name);
Message.AppendInt32(CreditsCost);
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0); // R63 fix
Message.AppendInt32(1);
Message.AppendStringWithBreak(GetBaseItem().Type);
Message.AppendInt32(GetBaseItem().SpriteId);
Message.AppendStringWithBreak("");
Message.AppendInt32(Amount);
Message.AppendInt32(-1);
}
}
示例10: parse
public void parse(GameClient Session, ClientPacket Packet)
{
ServerPacket packet = new ServerPacket(611);
packet.AppendBoolean(true);
packet.AppendInt32(99999);
Session.SendPacket(packet);
}
示例11: Trade
public Trade(uint UserOneId, uint UserTwoId, uint RoomId)
{
this.oneId = UserOneId;
this.twoId = UserTwoId;
this.Users = new List<TradeUser>(2);
this.Users.Add(new TradeUser(UserOneId, RoomId));
this.Users.Add(new TradeUser(UserTwoId, RoomId));
this.TradeStage = 1;
this.RoomId = RoomId;
foreach (TradeUser User in Users)
{
if (!User.GetRoomUser().Statusses.ContainsKey("trd"))
{
User.GetRoomUser().AddStatus("trd", "");
User.GetRoomUser().UpdateNeeded = true;
}
}
ServerPacket Message = new ServerPacket(104);
Message.AppendUInt(UserOneId);
Message.AppendBoolean(true);
Message.AppendUInt(UserTwoId);
Message.AppendBoolean(true);
SendMessageToUsers(Message);
}
示例12: 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();
}
示例13: parse
public void parse(GameClient Session, ClientPacket Packet)
{
int count = Packet.PopWiredInt32();
List<uint> UserIds = new List<uint>();
for (int i = 0; i < count; i++)
{
UserIds.Add(Packet.PopWiredUInt());
}
string message = UberEnvironment.FilterInjectionChars(Packet.PopFixedString(), true);
ServerPacket Message = new ServerPacket(135);
Message.AppendUInt(Session.GetHabbo().Id);
Message.AppendStringWithBreak(message);
foreach (uint Id in UserIds)
{
if (!Session.GetHabbo().GetMessenger().FriendshipExists(Session.GetHabbo().Id, Id))
{
continue;
}
GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Id);
if (Client == null)
{
return;
}
Client.SendPacket(Message);
}
}
示例14: 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);
}
示例15: 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);
}