本文整理汇总了C#中Butterfly.HabboHotel.GameClients.GameClient.GetHabboDataContainer方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.GetHabboDataContainer方法的具体用法?C# GameClient.GetHabboDataContainer怎么用?C# GameClient.GetHabboDataContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Butterfly.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.GetHabboDataContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SellItem
internal static void SellItem(GameClient Session, uint ItemId, int SellingPrice)
{
UserItem item = Session.GetHabboDataContainer().GetInventoryComponent().GetItem(ItemId);
if (item == null || SellingPrice > 10000 || !CanSellItem(item))
{
ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.MarketplaceMakeOfferResult);
message.AddInt32(0);
Session.SendMessage(message);
}
else
{
int comissionPrice = CalculateComissionPrice(SellingPrice);
int totalPrice = SellingPrice + comissionPrice;
int itemType = (item.GetBaseItem().Type == 'i') ? 2 : 1;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("INSERT INTO catalog_marketplace_offers (item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data) VALUES (" + item.BaseItemID + "," + Session.GetHabbo().Id + "," + SellingPrice + "," + totalPrice + ",@public_name," + item.GetBaseItem().SpriteId + "," + itemType + "," + ButterflyEnvironment.GetUnixTimestamp() + ",@extra_data)");
dbClient.addParameter("public_name", item.GetBaseItem().PublicName);
dbClient.addParameter("extra_data", item.extraData);
dbClient.runQuery();
}
Session.GetHabboDataContainer().GetInventoryComponent().RemoveItem(ItemId, true);
Session.GetHabboDataContainer().GetInventoryComponent().RunDBUpdate();
ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.MarketplaceMakeOfferResult);
message.AddInt32(1);
Session.SendMessage(message);
}
}
示例2: UserGotAuthorization
internal bool UserGotAuthorization(GameClient session)
{
foreach (string subsciption in this.clubsAllowed)
{
if (!session.GetHabboDataContainer().GetSubscriptionManager().HasSubscription(subsciption) && subsciption != string.Empty)
return false;
}
if (minrank == 0)
return true;
else if (minrank > 0)
{
if (minrank <= session.GetHabbo().Rank)
return true;
}
else if (minrank < 0)
{
if (minrank == -1)
{
if (session.GetHabbo().CurrentRoom.CheckRights(session, false))
return true;
}
else if (minrank == -2)
{
if (session.GetHabbo().CurrentRoom.CheckRights(session, true))
return true;
}
}
return false;
}
示例3: GivePixels
internal static void GivePixels(GameClient Client, int amount)
{
Double Timestamp = ButterflyEnvironment.GetUnixTimestamp();
Client.GetHabbo().LastActivityPointsUpdate = Timestamp;
Client.GetHabbo().ActivityPoints += amount;
Client.GetHabboDataContainer().UpdateActivityPointsBalance();
}
示例4: TryRedeemVoucher
internal static void TryRedeemVoucher(GameClient Session, string Code)
{
if (!IsValidCode(Code))
{
ServerMessage Error = PacketHandelingManager.GetRecycledItem(OutputCode.RedeeminvalidcodeErrorMessageComposer);
Error.AddString("1");
Session.SendMessage(Error);
return;
}
int Value = GetVoucherValue(Code);
TryDeleteVoucher(Code);
Session.GetHabbo().Diamonds += Value;
Session.GetHabboDataContainer().StoreDiamondsNow();
Session.GetHabboDataContainer().SynchronizeDiamondBalance();
Session.GetHabboDataContainer().UpdateActivityPointsBalance();
ServerMessage Succesfull = PacketHandelingManager.GetRecycledItem(OutputCode.RedeemSuccesfullMessageComposer);
Succesfull.AddInt32(0);
Session.SendMessage(Succesfull);
}
示例5: ProgressUserQuest
internal void ProgressUserQuest(GameClient Session, QuestType QuestType, uint EventData = 0)
{
if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentQuestId <= 0)
return;
Quest UserQuest = GetQuest(Session.GetHabbo().CurrentQuestId);
if (UserQuest == null || UserQuest.GoalType != QuestType)
return;
int CurrentProgress = Session.GetHabbo().GetQuestProgress(UserQuest.Id);
int NewProgress = CurrentProgress;
bool PassQuest = false;
switch (QuestType)
{
default:
NewProgress++;
if (NewProgress >= UserQuest.GoalData)
PassQuest = true;
break;
case QuestType.EXPLORE_FIND_ITEM:
if (EventData != UserQuest.GoalData)
return;
NewProgress = (int)UserQuest.GoalData;
PassQuest = true;
break;
}
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE user_quests SET progress = " + NewProgress + " WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id = " + UserQuest.Id);
if (PassQuest)
dbClient.runFastQuery("UPDATE users SET currentquestid = 0 WHERE id = " + Session.GetHabbo().Id);
}
Session.GetHabbo().quests[Session.GetHabbo().CurrentQuestId] = NewProgress;
Session.SendMessage(QuestStartedComposer.Compose(Session, UserQuest));
if (PassQuest)
{
Session.GetHabbo().CurrentQuestId = 0;
Session.GetHabbo().LastCompleted = UserQuest.Id;
Session.SendMessage(QuestCompletedComposer.Compose(Session, UserQuest));
Session.GetHabbo().ActivityPoints += UserQuest.Reward;
Session.GetHabboDataContainer().UpdateActivityPointsBalance();
GetList(Session, null);
}
}
示例6: CreateRoom
internal RoomData CreateRoom(GameClient Session, string Name, string Desc, string Model)
{
Name = ButterflyEnvironment.FilterInjectionChars(Name);
if (!roomModels.ContainsKey(Model))
{
Session.SendNotif("Oeps! Er is iets misgegaan, probeer het opnieuw.\r\r<b>Beschrijving:</b>\rDoor een fout in ons systeem kun je deze kamervorm tijdelijk niet gebruiken.");
return null;
}
if (((RoomModel)roomModels[Model]).ClubOnly && !Session.GetHabboDataContainer().GetSubscriptionManager().HasSubscription())
{
Session.SendNotif("Only for Habbo Club.");
return null;
}
if (Name.Length < 3)
{
Session.SendNotif("Name to short!");
return null;
}
UInt32 RoomId = 0;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("INSERT INTO rooms (roomtype,caption,description,owner,model_name) VALUES ('private',@caption,@desc,@username,@model)");
dbClient.addParameter("caption", Name);
dbClient.addParameter("desc", Desc);
dbClient.addParameter("model", Model);
dbClient.addParameter("username", Session.GetHabbo().Username);
RoomId = (UInt32)dbClient.insertQuery();
}
RoomData newRoomData = GenerateRoomData(RoomId);
Session.GetHabbo().UsersRooms.Add(newRoomData);
return newRoomData;
}
示例7: SerializeNavigator
internal ServerMessage SerializeNavigator(GameClient session, int mode)
{
if (mode > -1)
return SerializeActiveRooms(mode);
ServerMessage reply = PacketHandelingManager.GetRecycledItem(OutputCode.GuestRoomSearchResultEvent);
switch (mode)
{
case -5:
{
reply.AddInt32(mode);
List<RoomData> activeFriends = session.GetHabboDataContainer().GetChatMessenger().GetActiveFriendsRooms().OrderByDescending(p => p.UsersNow).ToList();
SerializeNavigatorRooms(ref reply, activeFriends);
return reply;
}
case -4:
{
reply.AddInt32(mode);
List<string> FriendsNames = session.GetHabboDataContainer().GetChatMessenger().GetFriendUsernames().ToList();
if (FriendsNames.Count == 0)
{
SerializeNavigatorRooms(ref reply, new List<RoomData>());
return reply;
}
QueryChunk Query = new QueryChunk("SELECT rooms.*, room_active.active_users FROM rooms LEFT JOIN room_active ON (room_active.roomid = rooms.id) WHERE");
int i = 0;
foreach (string Name in FriendsNames)
{
if (i > 0)
Query.AddSpecialRawQuery(" OR");
Query.AddSpecialRawQuery(" owner = '" + ButterflyEnvironment.FilterInjectionChars(Name, true) + "'");
i++;
}
Query.AddQuery(" ORDER BY room_active.active_users DESC LIMIT 40;");
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
Query.Execute(dbClient);
DataTable dTable = dbClient.getTable();
List<RoomData> parsedRoomData = new List<RoomData>();
foreach (DataRow dRow in dTable.Rows)
{
RoomData data = new RoomData();
data.Fill(dRow);
bool any = false;
foreach (RoomData p in parsedRoomData)
{
if (p.Id == data.Id)
{
any = true;
break;
}
if (p.Name == data.Name)
{
any = true;
break;
}
}
if (any)
continue;
parsedRoomData.Add(data);
}
SerializeNavigatorRooms(ref reply, parsedRoomData);
Query.Dispose();
}
FriendsNames = null;
return reply;
}
case -3:
{
reply.AddInt32(mode);
SerializeNavigatorRooms(ref reply, session.GetHabbo().UsersRooms);
return reply;
}
//.........这里部分代码省略.........
示例8: BanUser
// PENDING REWRITE
internal void BanUser(GameClient Client, string Moderator, Double LengthSeconds, string Reason, Boolean IpBan)
{
ModerationBanType Type = ModerationBanType.USERNAME;
string Var = Client.GetHabbo().Username;
string RawVar = "user";
Double Expire = ButterflyEnvironment.GetUnixTimestamp() + LengthSeconds;
if (IpBan)
{
Type = ModerationBanType.IP;
Var = Client.GetHabboDataContainer().getIP();
RawVar = "ip";
}
ModerationBan ban = new ModerationBan(Type, Var, Reason, Expire);
if (ban.Type == ModerationBanType.IP)
{
if (bannedIPs.ContainsKey(Var))
bannedIPs[Var] = ban;
else
bannedIPs.Add(Var, ban);
}
else
{
if (bannedUsernames.ContainsKey(Var))
bannedUsernames[Var] = ban;
else
bannedUsernames.Add(Var, ban);
}
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'" + Expire + "',@mod,'" + DateTime.Now.ToLongDateString() + "')");
dbClient.addParameter("rawvar", RawVar);
dbClient.addParameter("var", Var);
dbClient.addParameter("reason", Reason);
dbClient.addParameter("mod", Moderator);
dbClient.runQuery();
}
if (IpBan)
{
DataTable UsersAffected = null;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT id FROM users WHERE ip_last = @var");
dbClient.addParameter("var", Var);
UsersAffected = dbClient.getTable();
}
if (UsersAffected != null)
{
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
foreach (DataRow Row in UsersAffected.Rows)
{
dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Convert.ToUInt32(Row["id"]));
}
}
}
Client.Disconnect();
//BanUser(Client, Moderator, LengthSeconds, Reason, false);
}
else
{
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Client.GetHabbo().Id);
}
Client.SendBanMessage(LanguageLocale.GetValue("moderation.banned") + " " + Reason);
Client.Disconnect();
}
}
示例9: AddToPlaylist
private static void AddToPlaylist(GameClient Session, ClientMessage Message)
{
Room Instance = Session.GetHabbo().CurrentRoom;
if (Instance == null || !Instance.CheckRights(Session, true) || !Instance.GotMusicController() ||
Instance.GetRoomMusicController().PlaylistSize >= Instance.GetRoomMusicController().PlaylistCapacity)
{
return;
}
UserItem DiskUserItem = Session.GetHabboDataContainer().GetInventoryComponent().GetItem(Message.ReadUInt());
if (DiskUserItem == null || DiskUserItem.GetBaseItem().InteractionType != InteractionType.musicdisc)
{
return;
}
SongItem item = new SongItem(DiskUserItem);
int NewOrder = Instance.GetRoomMusicController().AddDisk(item);
if (NewOrder < 0)
{
return;
}
Session.GetHabboDataContainer().GetInventoryComponent().RemoveItem(item.itemID, true);
//Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
// Instance.GetRoomMusicController().Playlist.Values.ToList()));
}
示例10: ProgressUserAchievement
internal bool ProgressUserAchievement(GameClient Session, string AchievementGroup, int ProgressAmount)
{
if (!Achievements.ContainsKey(AchievementGroup))
{
return false;
}
Achievement AchievementData = null;
AchievementData = Achievements[AchievementGroup];
UserAchievement UserData = Session.GetHabbo().GetAchievementData(AchievementGroup);
if (UserData == null)
{
UserData = new UserAchievement(AchievementGroup, 0, 0);
Session.GetHabbo().Achievements.Add(AchievementGroup, UserData);
}
int TotalLevels = AchievementData.Levels.Count;
if (UserData != null && UserData.Level == TotalLevels)
{
return false; // done, no more.
}
int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
if (TargetLevel > TotalLevels)
{
TargetLevel = TotalLevels;
}
AchievementLevel TargetLevelData = AchievementData.Levels[TargetLevel];
int NewProgress = (UserData != null ? UserData.Progress + ProgressAmount : ProgressAmount);
int NewLevel = (UserData != null ? UserData.Level : 0);
int NewTarget = NewLevel + 1;
if (NewTarget > TotalLevels)
{
NewTarget = TotalLevels;
}
if (NewProgress >= TargetLevelData.Requirement)
{
NewLevel++;
NewTarget++;
int ProgressRemainder = NewProgress - TargetLevelData.Requirement;
NewProgress = 0;
Session.GetHabboDataContainer().GetBadgeComponent().GiveBadge(AchievementGroup + TargetLevel, true, Session);
if (NewTarget > TotalLevels)
{
NewTarget = TotalLevels;
}
Session.GetHabbo().ActivityPoints += TargetLevelData.RewardPixels;
Session.GetHabboDataContainer().UpdateActivityPointsBalance();
Session.SendMessage(AchievementUnlockedComposer.Compose(AchievementData, TargetLevel, TargetLevelData.RewardPoints,
TargetLevelData.RewardPixels));
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
//if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
dbClient.setQuery("REPLACE INTO user_achievement VALUES (" + Session.GetHabbo().Id + ", @group, " + NewLevel + ", " + NewProgress + ")");
//else
//{
// dbClient.setQuery("IF EXISTS (SELECT userid FROM user_achievement WHERE userid = " + Session.GetHabbo().Id + " AND group = @group) " +
// " UPDATE user_achievement SET level = " + NewLevel + ", progress = " + NewProgress + " WHERE userid = " + Session.GetHabbo().Id + " AND group = @group " +
// "ELSE" +
// " INSERT INTO user_achievement VALUES (" + Session.GetHabbo().Id + ",@group," + NewLevel + "," + NewProgress + ")");
//}
dbClient.addParameter("group", AchievementGroup);
dbClient.runQuery();
}
UserData.Level = NewLevel;
UserData.Progress = NewProgress;
Session.GetHabbo().AchievementPoints += TargetLevelData.RewardPoints;
Session.GetHabbo().ActivityPoints += TargetLevelData.RewardPixels;
Session.GetHabboDataContainer().UpdateActivityPointsBalance();
Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
AchievementLevel NewLevelData = AchievementData.Levels[NewTarget];
Session.SendMessage(AchievementProgressComposer.Compose(AchievementData, NewTarget, NewLevelData,
TotalLevels, Session.GetHabbo().GetAchievementData(AchievementGroup)));
return true;
}
else
{
UserData.Level = NewLevel;
UserData.Progress = NewProgress;
//.........这里部分代码省略.........
示例11: RemoveFromPlaylist
private static void RemoveFromPlaylist(GameClient Session, ClientMessage Message)
{
Room Instance = Session.GetHabbo().CurrentRoom;
if (Instance == null || !Instance.GotMusicController() || !Instance.CheckRights(Session, true))
{
return;
}
SongItem TakenItem = Instance.GetRoomMusicController().RemoveDisk(Message.ReadInt());
// playlist will skip to the next item automatically if it has to
if (TakenItem == null)
{
return;
}
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(TakenItem.itemID, TakenItem.baseItem.ItemId, TakenItem.songID.ToString(), true, true);
//Session.SendMessage(JukeboxComposer.Compose(Session));
//Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity,
// Instance.GetRoomMusicController().Playlist.Values.ToList()));
}
示例12: RemoveUserFromRoom
internal void RemoveUserFromRoom(GameClient Session, Boolean NotifyClient, Boolean NotifyKick)
{
try
{
if (Session == null)
return;
if (Session.GetHabbo() == null)
return;
if (room == null)
return;
if (Session.GetHabboDataContainer().GetAvatarEffectsInventoryComponent() != null)
Session.GetHabboDataContainer().GetAvatarEffectsInventoryComponent().OnRoomExit();
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
dbClient.runFastQuery("UPDATE user_roomvisits SET exit_timestamp = '" + ButterflyEnvironment.GetUnixTimestamp() + "' WHERE room_id = '" + room.RoomId + "' AND user_id = '" + Session.GetHabbo().Id + "' ORDER BY entry_timestamp DESC LIMIT 1");
RoomUser User = GetRoomUserByHabbo(Session.GetHabbo().Id);
if (NotifyClient)
{
if (NotifyKick)
{
ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.GenericErrorEvent);
message.AddInt32(4008);
Session.SendMessage(message);
}
ServerMessage message2 = PacketHandelingManager.GetRecycledItem(OutputCode.CloseConnectionMessageEvent);
Session.SendMessage(message2);
}
if (User != null)
{
RemoveRoomUser(User);
if (Session.GetHabbo() != null)
{
if (!User.IsSpectator)
{
if (User.CurrentItemEffect != ItemEffectType.None)
{
User.GetClient().GetHabboDataContainer().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
}
if (Session.GetHabbo() != null)
{
if (room.HasActiveTrade(Session.GetHabbo().Id))
room.TryStopTrade(Session.GetHabbo().Id);
Session.GetHabbo().CurrentRoomId = 0;
if (Session.GetHabboDataContainer().GetChatMessenger() != null)
Session.GetHabboDataContainer().GetChatMessenger().OnStatusChanged(true);
}
DateTime Start = DateTime.Now;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
TimeSpan TimeUsed1 = DateTime.Now - Start;
if (Session.GetHabbo() != null)
dbClient.runFastQuery("UPDATE user_roomvisits SET exit_timestamp = '" + ButterflyEnvironment.GetUnixTimestamp() + "' WHERE room_id = '" + room.RoomId + "' AND user_id = '" + Session.GetHabbo().Id + "' ORDER BY exit_timestamp DESC LIMIT 1");
}
}
}
usersByUserID.Remove(User.userID);
if (Session.GetHabbo() != null)
usersByUsername.Remove(Session.GetHabbo().Username.ToLower());
onGlobalMessageBroadcast -= User.SendMessage;
User.Dispose();
}
}
catch (Exception e)
{
Logging.LogCriticalException("Error during removing user from room:" + e.ToString());
}
}
示例13: CreateBotForUser
private void CreateBotForUser(GameClient Session, Item item, string looks)
{
DataRow botRow;
uint botID;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("INSERT INTO `bots` (`ai_type`, `look`, `owner_id`,rotation,walk_mode) VALUES ('generic', @looks, @uid,4,'freeroam')");
dbClient.addParameter("uid", Session.GetHabboDataContainer().data.Id);
dbClient.addParameter("looks", looks);
botID = (uint)dbClient.insertQuery();
dbClient.setQuery("SELECT * FROM bots WHERE id = " + botID);
botRow = dbClient.getRow();
}
RoomBot bot = ButterflyEnvironment.GetGame().GetBotManager().FetchBot(botRow);
Session.GetHabboDataContainer().GetInventoryComponent().AddBot(bot);
}
示例14: DeliverItems
internal void DeliverItems(GameClient Session, Item Item, int Amount, String ExtraData, uint songID = 0)
{
switch (Item.Type.ToString())
{
case "i":
case "s":
for (int i = 0; i < Amount; i++)
{
//uint GeneratedId = GenerateItemId();
switch (Item.InteractionType)
{
case InteractionType.pet0:
string[] PetData = ExtraData.Split('\n');
Pet GeneratedPet = CreatePet(Session.GetHabbo().Id, PetData[0], 0, PetData[1], PetData[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet1:
string[] PetData1 = ExtraData.Split('\n');
Pet GeneratedPet1 = CreatePet(Session.GetHabbo().Id, PetData1[0], 1, PetData1[1], PetData1[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet1);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet2:
string[] PetData5 = ExtraData.Split('\n');
Pet GeneratedPet5 = CreatePet(Session.GetHabbo().Id, PetData5[0], 2, PetData5[1], PetData5[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet5);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet3:
string[] PetData2 = ExtraData.Split('\n');
Pet GeneratedPet2 = CreatePet(Session.GetHabbo().Id, PetData2[0], 3, PetData2[1], PetData2[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet2);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet4:
string[] PetData3 = ExtraData.Split('\n');
Pet GeneratedPet3 = CreatePet(Session.GetHabbo().Id, PetData3[0], 4, PetData3[1], PetData3[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet3);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet5:
string[] PetData7 = ExtraData.Split('\n');
Pet GeneratedPet7 = CreatePet(Session.GetHabbo().Id, PetData7[0], 5, PetData7[1], PetData7[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet7);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet6:
string[] PetData4 = ExtraData.Split('\n');
Pet GeneratedPet4 = CreatePet(Session.GetHabbo().Id, PetData4[0], 6, PetData4[1], PetData4[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet4);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet7:
string[] PetData6 = ExtraData.Split('\n');
Pet GeneratedPet6 = CreatePet(Session.GetHabbo().Id, PetData6[0], 7, PetData6[1], PetData6[2]);
Session.GetHabboDataContainer().GetInventoryComponent().AddPet(GeneratedPet6);
Session.GetHabboDataContainer().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0);
break;
case InteractionType.pet8:
//.........这里部分代码省略.........
示例15: HandlePurchase
internal void HandlePurchase(GameClient Session, int PageId, uint ItemId, string ExtraData, int amount, GiftData giftData)
{
bool IsGift = giftData != null;
int discountCount = 0;
if (amount >= 6)
discountCount += 1;
if (amount >= 12)
discountCount += 2;
if (amount >= 18)
discountCount += 2;
if (amount >= 24)
discountCount += 2;
if (amount >= 30)
discountCount += 2;
if (amount >= 36)
discountCount += 2;
if (amount >= 42)
discountCount += 2;
if (amount >= 48)
discountCount += 2;
if (amount >= 54)
discountCount += 2;
if (amount >= 60)
discountCount += 2;
if (amount >= 66)
discountCount += 2;
if (amount >= 72)
discountCount += 2;
if (amount >= 78)
discountCount += 2;
if (amount >= 84)
discountCount += 2;
if (amount >= 90)
discountCount += 2;
if (amount >= 96)
discountCount += 2;
if (amount >= 99)
discountCount += 2;
CatalogPage Page;
if (!Pages.TryGetValue(PageId, out Page))
return;
if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible || Session == null || Session.GetHabbo() == null)
{
return;
}
if (Page.ClubOnly && !Session.GetHabboDataContainer().GetSubscriptionManager().HasSubscription(SubscriptionManager.SUBSCRIPTION_TYPE_VIP))
{
return;
}
if (Page.MinRank > Session.GetHabbo().Rank)
{
return;
}
CatalogItem Item = Page.GetItem(ItemId);
if (Item == null)
{
return;
}
uint GiftUserId = 0;
if (Item.isLimited)
{
amount = 1;
discountCount = 0;
if (Item.limitedInStock <= Item.limitedSold++)
return;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE catalog_items SET sold_amount = " + Item.limitedSold + " WHERE id = " + Item.ID);
}
Page.InitMsg();
}
Session.GetHabboDataContainer().SynchronizeDiamondBalance();
int total_cost_credits = Item.creditCost * (amount - discountCount);
int total_cost_pixels = Item.pixelCost * (amount - discountCount);
int total_cost_diamonds = Item.diamondCost * (amount - discountCount);
if (total_cost_diamonds > 0)
{
Session.GetHabbo().SynchronizeDiamondBalance();
}
if (IsGift)
{
if (!Item.GetBaseItem().AllowGift)
{
return;
}
DataRow dRow;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT id FROM users WHERE username = @gift_user");
//.........这里部分代码省略.........