public void Init(ItemDataManager itemDataManager) { RocketEmulador.RocketData().data.TryGetValue("camera.path.preview", out this._previewPath); RocketEmulador.RocketData().data.TryGetValue("camera.path.purchased", out this._purchasedPath); if (RocketEmulador.RocketData().data.ContainsKey("camera.preview.maxcache")) { this._maxPreviewCacheCount = int.Parse(RocketEmulador.RocketData().data["camera.preview.maxcache"]); } if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.purchase.price.coins")) { this._purchaseCoinsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.purchase.price.coins"]); } if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.purchase.price.duckets")) { this._purchaseDucketsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.purchase.price.duckets"]); } if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.publish.price.duckets")) { this._publishDucketsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.publish.price.duckets"]); } int ItemId = int.Parse(RocketEmulador.GetDBConfig().DBData ["camera.photo.purchase.item_id"]); if (!itemDataManager.GetItem(ItemId, out this._photoPoster)) { log.Error("Couldn't load photo poster item " + ItemId + ", no furniture record found."); } //log.Info("Camera Photo Manager -> LOADED"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room; if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CheckRights(Session, true)) { return; } if (RocketEmulador.GetDBConfig().DBData["exchange_enabled"] != "1") { Session.SendNotification("The hotel managers have temporarilly disabled exchanging!"); return; } Item Exchange = Room.GetRoomItemHandler().GetItem(Packet.PopInt()); if (Exchange == null) { return; } if (!Exchange.GetBaseItem().ItemName.StartsWith("CF_") && !Exchange.GetBaseItem().ItemName.StartsWith("CFC_")) { return; } string[] Split = Exchange.GetBaseItem().ItemName.Split('_'); int Value = int.Parse(Split[1]); if (Value > 0) { Session.GetHabbo().Credits += Value; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Exchange.Id + "' LIMIT 1"); } Session.SendMessage(new FurniListUpdateComposer()); Room.GetRoomItemHandler().RemoveFurniture(null, Exchange.Id, false); Session.GetHabbo().GetInventoryComponent().RemoveItem(Exchange.Id); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } if (Session.GetHabbo().InRoom) { Room OldRoom; if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out OldRoom)) { return; } if (OldRoom.GetRoomUserManager() != null) { OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); } } if (!Room.GetRoomUserManager().AddAvatarToRoom(Session)) { Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); return;//TODO: Remove? } Room.SendObjects(Session); //Status updating for messenger, do later as buggy. try { if (Session.GetHabbo().GetMessenger() != null) { Session.GetHabbo().GetMessenger().OnStatusChanged(true); } } catch { } if (Session.GetHabbo().GetStats().QuestID > 0) { RocketEmulador.GetGame().GetQuestManager().QuestReminder(Session, Session.GetHabbo().GetStats().QuestID); } Session.SendMessage(new RoomEntryInfoComposer(Room.RoomId, Room.CheckRights(Session, true))); Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString()))); RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (ThisUser != null && Session.GetHabbo().PetId == 0) { Room.SendMessage(new UserChangeComposer(ThisUser, false)); } Session.SendMessage(new RoomEventComposer(Room.RoomData, Room.RoomData.Promotion)); if (Room.GetWired() != null) { Room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, Session.GetHabbo()); } if (RocketEmulador.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0) { Session.SendMessage(new FloodControlComposer((int)Session.GetHabbo().FloodTime - (int)RocketEmulador.GetUnixTimestamp())); } if (Room.OwnerId == Session.GetHabbo().Id) { DataRow dFrank = null; using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT bot_frank FROM users WHERE id = '" + Session.GetHabbo().Id + "'"); dFrank = dbClient.getRow(); } if (Convert.ToBoolean(dFrank["bot_frank"]) == false) { using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET bot_frank = 'true' WHERE id = " + Session.GetHabbo().Id + ";"); dbClient.RunQuery("UPDATE users SET bot_user = '******' WHERE id = " + Session.GetHabbo().Id + ";"); } string Chat1 = RocketEmulador.GetDBConfig().DBData["frank.chat.1"]; string Chat2 = RocketEmulador.GetDBConfig().DBData["frank.chat.2"]; string Chat3 = RocketEmulador.GetDBConfig().DBData["frank.chat.3"]; string Chat4 = RocketEmulador.GetDBConfig().DBData["frank.chat.4"]; string Chat5 = RocketEmulador.GetDBConfig().DBData["frank.chat.5"]; string Credits = RocketEmulador.GetDBConfig().DBData["frank.give.credits"]; string Diamonds = RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]; string Duckets = RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]; string Gotws = RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]; string Furni = RocketEmulador.GetDBConfig().DBData["frank.give.furni"]; List <RandomSpeech> BotSpeechList = new List <RandomSpeech>(); Console.WriteLine("Só se mostra bot e nuxs 1 vez por usuario."); int X = 0; int Y = 0; string hola = "false"; RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(0, Session.GetHabbo().CurrentRoomId, "generic", "freeroam", "Frank", "Gerente do hotel", "hr-3194-38-36.hd-180-1.ch-220-1408.lg-285-73.sh-906-90.ha-3129-73.fa-1206-73.cc-3039-73", X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, 0, false, 0, Convert.ToBoolean(hola), 1), null); System.Threading.Thread.Sleep(4000); // Mensagem de Boas vindas. BotUser.Chat(Chat1, false, 0); System.Threading.Thread.Sleep(3000); // Segunda mensagem BotUser.Chat(Chat2, false, 0); System.Threading.Thread.Sleep(2000); // Terceira mensagem e entrega das moedas if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws)) { BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets, " + Gotws + " estrelas e nubes!", false, 0); Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]); Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]); Session.GetHabbo().Duckets += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]); Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]); Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws)) { BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets e " + Gotws + " estrelas!", false, 0); Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]); Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]); Session.GetHabbo().Duckets += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]); Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]); Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints)); } else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets)) { BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes e " + Duckets + " duckets!", false, 0); Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]); Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]); Session.GetHabbo().Duckets += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]); Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints)); } else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds)) { BotUser.Chat("Você tem " + Credits + " créditos e " + Diamonds + " diamantes!", false, 0); Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]); Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]); Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints)); } else if (!string.IsNullOrWhiteSpace(Credits)) { BotUser.Chat("Você tem " + Credits + " créditos!", false, 0); Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]); Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } else { BotUser.Chat("Não iremos te dar nada por enquanto.", false, 0); } if (!string.IsNullOrWhiteSpace(Chat4) || !string.IsNullOrEmpty(Furni)) { System.Threading.Thread.Sleep(4000); // Quarta mensagen, entregando o raro. BotUser.Chat(Chat4, false, 0); DataRow dFurni = null; using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT public_name FROM furniture WHERE id = '" + Convert.ToInt32(Furni) + "'"); dFurni = dbClient.getRow(); } Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Convert.ToInt32(Furni), Convert.ToString(dFurni["public_name"]), 1, true, false, 0, 0); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); } System.Threading.Thread.Sleep(5000); // Quinta mensagem. BotUser.Chat(Chat5, false, 0); Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(0, 0)); Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false); } else { Console.WriteLine("O Bot não irá mais aparecer para esse usuário."); } } }
public void Parse(GameClient Session, ClientPacket Packet) { if (RocketEmulador.GetDBConfig().DBData["catalogue_enabled"] != "1") { Session.SendNotification("O catalago foi desativado em nosso hotel"); return; } int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string ExtraData = Packet.PopString(); int Amount = Packet.PopInt(); CatalogPage Page = null; if (!RocketEmulador.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (Amount < 1 || Amount > 100) { Amount = 1; } int AmountPurchase = Item.Amount > 1 ? Item.Amount : Amount; int TotalCreditsCost = Amount > 1 ? ((Item.CostCredits * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostCredits)) : Item.CostCredits; int TotalPixelCost = Amount > 1 ? ((Item.CostPixels * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostPixels)) : Item.CostPixels; int TotalDiamondCost = Amount > 1 ? ((Item.CostDiamonds * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostDiamonds)) : Item.CostDiamonds; int TotalGotwCost = Amount > 1 ? ((Item.CostGotw * Amount) - ((int)Math.Floor((double)Amount / 6) * Item.CostGotw)) : Item.CostGotw; if (Session.GetHabbo().Credits < TotalCreditsCost || Session.GetHabbo().Duckets < TotalPixelCost || Session.GetHabbo().Diamonds < TotalDiamondCost || Session.GetHabbo().GOTWPoints < TotalGotwCost) { return; } int LimitedEditionSells = 0; int LimitedEditionStack = 0; #region Create the extradata switch (Item.Data.InteractionType) { case InteractionType.NONE: ExtraData = ""; break; case InteractionType.GUILD_ITEM: case InteractionType.GUILD_GATE: break; #region Pet handling case InteractionType.pet0: case InteractionType.pet1: case InteractionType.pet2: case InteractionType.pet3: case InteractionType.pet4: case InteractionType.pet5: case InteractionType.pet6: case InteractionType.pet7: case InteractionType.pet8: case InteractionType.pet9: case InteractionType.pet10: case InteractionType.pet11: case InteractionType.pet12: case InteractionType.pet13: //Caballo case InteractionType.pet14: case InteractionType.pet15: case InteractionType.pet16: //Mascota agregada case InteractionType.pet17: //Mascota agregada case InteractionType.pet18: //Mascota agregada case InteractionType.pet19: //Mascota agregada case InteractionType.pet20: //Mascota agregada case InteractionType.pet21: //Mascota agregada case InteractionType.pet22: //Mascota agregada case InteractionType.pet28: case InteractionType.pet29: case InteractionType.pet30: try { string[] Bits = ExtraData.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (!PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch (Exception e) { Logging.LogException(e.ToString()); return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(ExtraData)) { Number = 0; } else { Number = Double.Parse(ExtraData, RocketEmulador.CultureInfo); } } catch (Exception e) { Logging.HandleException(e, "Catalog.HandlePurchase: " + ExtraData); } ExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + ExtraData; break; case InteractionType.MANNEQUIN: ExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(ExtraData)) { Session.SendMessage(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } ExtraData = ExtraData + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; case InteractionType.BADGE: { if (Session.GetHabbo().GetBadgeComponent().HasBadge(Item.Data.ItemName)) { Session.SendMessage(new PurchaseErrorComposer(1)); return; } break; } default: ExtraData = ""; break; } #endregion if (Item.IsLimited) { if (Item.LimitedEditionStack <= Item.LimitedEditionSells) { Session.SendNotification("This item has sold out!\n\n" + "Please note, you have not recieved another item (You have also not been charged for it!)"); Session.SendMessage(new CatalogUpdatedComposer()); Session.SendMessage(new PurchaseOKComposer()); return; } Item.LimitedEditionSells++; using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `catalog_items` SET `limited_sells` = '" + Item.LimitedEditionSells + "' WHERE `id` = '" + Item.Id + "' LIMIT 1"); LimitedEditionSells = Item.LimitedEditionSells; LimitedEditionStack = Item.LimitedEditionStack; } } if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= TotalCreditsCost; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= TotalPixelCost; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));//Love you, Tom. } if (Item.CostDiamonds > 0) { Session.GetHabbo().Diamonds -= TotalDiamondCost; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5)); } if (Item.CostGotw > 0) { Session.GetHabbo().GOTWPoints -= TotalGotwCost; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().GOTWPoints, 0, 103)); } Item NewItem = null; switch (Item.Data.Type.ToString().ToLower()) { default: List <Item> GeneratedGenericItems = new List <Item>(); switch (Item.Data.InteractionType) { default: if (AmountPurchase > 1) { List <Item> Items = ItemFactory.CreateMultipleItems(Item.Data, Session.GetHabbo(), ExtraData, AmountPurchase); if (Items != null) { GeneratedGenericItems.AddRange(Items); } } else { NewItem = ItemFactory.CreateSingleItemNullable(Item.Data, Session.GetHabbo(), ExtraData, ExtraData, 0, LimitedEditionSells, LimitedEditionStack); if (NewItem != null) { GeneratedGenericItems.Add(NewItem); } } break; case InteractionType.GUILD_GATE: case InteractionType.GUILD_ITEM: case InteractionType.GUILD_FORUM: Group thegroup1; if (!RocketEmulador.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(ExtraData), out thegroup1)) { return; } if (!(RocketEmulador.GetGame().GetGroupManager().GetGroupsForUser(Session.GetHabbo().Id).Contains(thegroup1))) { return; } int groupID1 = Convert.ToInt32(ExtraData); if (!thegroup1.ForumEnabled && thegroup1.CreatorId == Session.GetHabbo().Id) { RocketEmulador.GetGame().GetGroupForumManager().CreateGroupForum(thegroup1); Session.SendMessage(new Outgoing.Rooms.Notifications.RoomNotificationComposer("forums.delivered")); } else if (thegroup1.CreatorId != Session.GetHabbo().Id) { Session.SendNotification("Solo el dueño del grupo puede comprar esto."); return; } ExtraData = "" + groupID1; NewItem = ItemFactory.CreateSingleItemNullable(Item.Data, Session.GetHabbo(), ExtraData, ExtraData, Convert.ToInt32(ExtraData)); if (NewItem != null) { GeneratedGenericItems.Add(NewItem); } break; if (AmountPurchase > 1) { List <Item> Items = ItemFactory.CreateMultipleItems(Item.Data, Session.GetHabbo(), ExtraData, AmountPurchase, Convert.ToInt32(ExtraData)); if (Items != null) { GeneratedGenericItems.AddRange(Items); } } else { NewItem = ItemFactory.CreateSingleItemNullable(Item.Data, Session.GetHabbo(), ExtraData, ExtraData, Convert.ToInt32(ExtraData)); if (NewItem != null) { GeneratedGenericItems.Add(NewItem); } } break; case InteractionType.ARROW: case InteractionType.TELEPORT: for (int i = 0; i < AmountPurchase; i++) { List <Item> TeleItems = ItemFactory.CreateTeleporterItems(Item.Data, Session.GetHabbo()); if (TeleItems != null) { GeneratedGenericItems.AddRange(TeleItems); } } break; case InteractionType.MOODLIGHT: { if (AmountPurchase > 1) { List <Item> Items = ItemFactory.CreateMultipleItems(Item.Data, Session.GetHabbo(), ExtraData, AmountPurchase); if (Items != null) { GeneratedGenericItems.AddRange(Items); foreach (Item I in Items) { ItemFactory.CreateMoodlightData(I); } } } else { NewItem = ItemFactory.CreateSingleItemNullable(Item.Data, Session.GetHabbo(), ExtraData, ExtraData); if (NewItem != null) { GeneratedGenericItems.Add(NewItem); ItemFactory.CreateMoodlightData(NewItem); } } } break; case InteractionType.TONER: { if (AmountPurchase > 1) { List <Item> Items = ItemFactory.CreateMultipleItems(Item.Data, Session.GetHabbo(), ExtraData, AmountPurchase); if (Items != null) { GeneratedGenericItems.AddRange(Items); foreach (Item I in Items) { ItemFactory.CreateTonerData(I); } } } else { NewItem = ItemFactory.CreateSingleItemNullable(Item.Data, Session.GetHabbo(), ExtraData, ExtraData); if (NewItem != null) { GeneratedGenericItems.Add(NewItem); ItemFactory.CreateTonerData(NewItem); } } } break; case InteractionType.DEAL: { //Fetch the deal where the ID is this items ID. var DealItems = (from d in Page.Deals.Values.ToList() where d.Id == Item.Id select d); //This bit, iterating ONE item? How can I make this simpler foreach (CatalogDeal DealItem in DealItems) { //Here I loop the DealItems ItemDataList. foreach (CatalogItem CatalogItem in DealItem.ItemDataList.ToList()) { List <Item> Items = ItemFactory.CreateMultipleItems(CatalogItem.Data, Session.GetHabbo(), "", AmountPurchase); if (Items != null) { GeneratedGenericItems.AddRange(Items); } } } break; } } foreach (Item PurchasedItem in GeneratedGenericItems) { if (Session.GetHabbo().GetInventoryComponent().TryAddItem(PurchasedItem)) { //Session.SendMessage(new FurniListAddComposer(PurchasedItem)); Session.SendMessage(new FurniListNotificationComposer(PurchasedItem.Id, 1)); } } break; case "e": AvatarEffect Effect = null; if (Session.GetHabbo().Effects().HasEffect(Item.Data.SpriteId)) { Effect = Session.GetHabbo().Effects().GetEffectNullable(Item.Data.SpriteId); if (Effect != null) { Effect.AddToQuantity(); } } else { Effect = AvatarEffectFactory.CreateNullable(Session.GetHabbo(), Item.Data.SpriteId, 3600); } if (Effect != null) // && Session.GetHabbo().Effects().TryAdd(Effect)) { Session.SendMessage(new AvatarEffectAddedComposer(Item.Data.SpriteId, 3600)); } break; case "r": Bot Bot = BotUtility.CreateBot(Item.Data, Session.GetHabbo().Id); if (Bot != null) { Session.GetHabbo().GetInventoryComponent().TryAddBot(Bot); Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots())); Session.SendMessage(new FurniListNotificationComposer(Bot.Id, 5)); } else { Session.SendNotification("Oops! There was an error whilst purchasing this bot. It seems that there is no bot data for the bot!"); } break; case "b": { Session.GetHabbo().GetBadgeComponent().GiveBadge(Item.Data.ItemName, true, Session); Session.SendMessage(new FurniListNotificationComposer(0, 4)); break; } case "p": { switch (Item.Data.InteractionType) { #region Pets #region Pet 0 case InteractionType.pet0: string[] PetData = ExtraData.Split('\n'); Pet GeneratedPet = PetUtility.CreatePet(Session.GetHabbo().Id, PetData[0], 0, PetData[1], PetData[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet); break; #endregion #region Pet 1 case InteractionType.pet1: string[] PetData1 = ExtraData.Split('\n'); Pet GeneratedPet1 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData1[0], 1, PetData1[1], PetData1[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet1); break; #endregion #region Pet 2 case InteractionType.pet2: string[] PetData5 = ExtraData.Split('\n'); Pet GeneratedPet5 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData5[0], 2, PetData5[1], PetData5[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet5); break; #endregion #region Pet 3 case InteractionType.pet3: string[] PetData2 = ExtraData.Split('\n'); Pet GeneratedPet2 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData2[0], 3, PetData2[1], PetData2[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet2); break; #endregion #region Pet 4 case InteractionType.pet4: string[] PetData3 = ExtraData.Split('\n'); Pet GeneratedPet3 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData3[0], 4, PetData3[1], PetData3[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet3); break; #endregion #region Pet 5 case InteractionType.pet5: string[] PetData7 = ExtraData.Split('\n'); Pet GeneratedPet7 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData7[0], 5, PetData7[1], PetData7[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet7); break; #endregion #region Pet 6 (wrong?) case InteractionType.pet6: string[] PetData4 = ExtraData.Split('\n'); Pet GeneratedPet4 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData4[0], 6, PetData4[1], PetData4[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet4); break; #endregion #region Pet 7 (wrong?) case InteractionType.pet7: string[] PetData6 = ExtraData.Split('\n'); Pet GeneratedPet6 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData6[0], 7, PetData6[1], PetData6[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet6); break; #endregion #region Pet 8 case InteractionType.pet8: string[] PetData8 = ExtraData.Split('\n'); Pet GeneratedPet8 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData8[0], 8, PetData8[1], PetData8[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet8); break; #endregion #region Pet 8 case InteractionType.pet9: string[] PetData9 = ExtraData.Split('\n'); Pet GeneratedPet9 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData9[0], 9, PetData9[1], PetData9[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet9); break; #endregion #region Pet 10 case InteractionType.pet10: string[] PetData10 = ExtraData.Split('\n'); Pet GeneratedPet10 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData10[0], 10, PetData10[1], PetData10[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet10); break; #endregion #region Pet 11 case InteractionType.pet11: string[] PetData11 = ExtraData.Split('\n'); Pet GeneratedPet11 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData11[0], 11, PetData11[1], PetData11[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet11); break; #endregion #region Pet 12 case InteractionType.pet12: string[] PetData12 = ExtraData.Split('\n'); Pet GeneratedPet12 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData12[0], 12, PetData12[1], PetData12[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet12); break; #endregion #region Pet 13 case InteractionType.pet13: //Caballo - Horse string[] PetData13 = ExtraData.Split('\n'); Pet GeneratedPet13 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData13[0], 13, PetData13[1], PetData13[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet13); break; #endregion #region Pet 14 case InteractionType.pet14: string[] PetData14 = ExtraData.Split('\n'); Pet GeneratedPet14 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData14[0], 14, PetData14[1], PetData14[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet14); break; #endregion #region Pet 15 case InteractionType.pet15: string[] PetData15 = ExtraData.Split('\n'); Pet GeneratedPet15 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData15[0], 15, PetData15[1], PetData15[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet15); break; #endregion #region Pet 16 case InteractionType.pet16: // Mascota Agregada string[] PetData16 = ExtraData.Split('\n'); Pet GeneratedPet16 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData16[0], 16, PetData16[1], PetData16[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet16); break; #endregion #region Pet 17 case InteractionType.pet17: // Mascota Agregada string[] PetData17 = ExtraData.Split('\n'); Pet GeneratedPet17 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData17[0], 17, PetData17[1], PetData17[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet17); break; #endregion #region Pet 18 case InteractionType.pet18: // Mascota Agregada string[] PetData18 = ExtraData.Split('\n'); Pet GeneratedPet18 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData18[0], 18, PetData18[1], PetData18[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet18); break; #endregion #region Pet 19 case InteractionType.pet19: // Mascota Agregada string[] PetData19 = ExtraData.Split('\n'); Pet GeneratedPet19 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData19[0], 19, PetData19[1], PetData19[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet19); break; #endregion #region Pet 20 case InteractionType.pet20: // Mascota Agregada string[] PetData20 = ExtraData.Split('\n'); Pet GeneratedPet20 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData20[0], 20, PetData20[1], PetData20[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet20); break; #endregion #region Pet 21 case InteractionType.pet21: // Mascota Agregada string[] PetData21 = ExtraData.Split('\n'); Pet GeneratedPet21 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData21[0], 21, PetData21[1], PetData21[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet21); break; #endregion #region Pet 22 case InteractionType.pet22: // Mascota Agregada string[] PetData22 = ExtraData.Split('\n'); Pet GeneratedPet22 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData22[0], 22, PetData22[1], PetData22[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet22); break; #endregion #region Pet 28 case InteractionType.pet28: // Mascota Agregada string[] PetData28 = ExtraData.Split('\n'); Pet GeneratedPet28 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData28[0], 28, PetData28[1], PetData28[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet28); break; #endregion #region Pet 29 case InteractionType.pet29: string[] PetData29 = ExtraData.Split('\n'); Pet GeneratedPet29 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData29[0], 29, PetData29[1], PetData29[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet29); break; #endregion #region Pet 30 case InteractionType.pet30: string[] PetData30 = ExtraData.Split('\n'); Pet GeneratedPet30 = PetUtility.CreatePet(Session.GetHabbo().Id, PetData30[0], 30, PetData30[1], PetData30[2]); Session.GetHabbo().GetInventoryComponent().TryAddPet(GeneratedPet30); break; #endregion #endregion } Session.SendMessage(new FurniListNotificationComposer(0, 3)); Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); ItemData PetFood = null; if (RocketEmulador.GetGame().GetItemManager().GetItem(320, out PetFood)) { Item Food = ItemFactory.CreateSingleItemNullable(PetFood, Session.GetHabbo(), "", ""); if (Food != null) { Session.GetHabbo().GetInventoryComponent().TryAddItem(Food); Session.SendMessage(new FurniListNotificationComposer(Food.Id, 1)); } } break; } } Session.SendMessage(new PurchaseOKComposer(Item, Item.Data)); Session.SendMessage(new FurniListUpdateComposer()); }
public bool TryAuthenticate(string AuthTicket) { try { byte errorCode = 0; UserData userData = UserDataFactory.GetUserData(AuthTicket, out errorCode); if (errorCode == 1 || errorCode == 2) { Disconnect(); return(false); } #region Ban Checking ModerationBan BanRecord = null; if (!string.IsNullOrEmpty(MachineId)) { if (RocketEmulador.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord)) { if (RocketEmulador.GetGame().GetModerationManager().MachineBanCheck(MachineId)) { Disconnect(); return(false); } } } if (userData.user != null) { BanRecord = null; if (RocketEmulador.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord)) { if (RocketEmulador.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username)) { Disconnect(); return(false); } } } #endregion RocketEmulador.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); this._habbo = userData.user; bool flag8 = this._habbo != null; if (flag8) { userData.user.Init(this, userData); this.SendMessage(new AuthenticationOKComposer()); this.SendMessage(new AvatarEffectsComposer(this._habbo.Effects().GetAllEffects)); this.SendMessage(new NavigatorSettingsComposer(this._habbo.HomeRoom)); this.SendMessage(new FavouritesComposer(userData.user.FavoriteRooms)); this.SendMessage(new FigureSetIdsComposer(this._habbo.GetClothing().GetClothingAllParts)); this.SendMessage(new UserRightsComposer(this._habbo.Rank)); this.SendMessage(new AvailabilityStatusComposer()); this.SendMessage(new TalentTrackLevelComposer()); this.SendMessage(new TargetOfferMessageComposer()); this.SendMessage(new AchievementScoreComposer(this._habbo.GetStats().AchievementPoints)); ServerPacket serverPacket = new ServerPacket(879); serverPacket.WriteString("club_habbo"); serverPacket.WriteInteger(0); serverPacket.WriteInteger(0); serverPacket.WriteInteger(0); serverPacket.WriteInteger(2); serverPacket.WriteBoolean(false); serverPacket.WriteBoolean(false); serverPacket.WriteInteger(0); serverPacket.WriteInteger(0); serverPacket.WriteInteger(0); this.SendMessage(serverPacket); this.SendMessage(new BuildersClubMembershipComposer()); this.SendMessage(new CfhTopicsInitComposer()); this.SendMessage(new BadgeDefinitionsComposer(RocketEmulador.GetGame().GetAchievementManager()._achievements)); this.SendMessage(new SoundSettingsComposer(this._habbo.ClientVolume, this._habbo.ChatPreference, this._habbo.AllowMessengerInvites, this._habbo.FocusPreference, FriendBarStateUtility.GetInt(this._habbo.FriendbarState))); bool flag9 = this.GetHabbo().GetMessenger() != null; if (flag9) { this.GetHabbo().GetMessenger().OnStatusChanged(true); } bool flag10 = !string.IsNullOrEmpty(this.MachineId); if (flag10) { bool flag11 = this._habbo.MachineId != this.MachineId; if (flag11) { using (IQueryAdapter queryReactor = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1"); queryReactor.AddParameter("MachineId", this.MachineId); queryReactor.AddParameter("id", this._habbo.Id); queryReactor.RunQuery(); } } this._habbo.MachineId = this.MachineId; } PermissionGroup PermissionGroup = null; if (RocketEmulador.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup)) { if (!String.IsNullOrEmpty(PermissionGroup.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge)) { _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this); } } } SubscriptionData SubData = null; if (RocketEmulador.GetGame().GetSubscriptionManager().TryGetSubscriptionData(this._habbo.VIPRank, out SubData)) { if (!String.IsNullOrEmpty(SubData.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge)) { _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this); } } } if (!RocketEmulador.GetGame().GetCacheManager().ContainsUser(_habbo.Id)) { RocketEmulador.GetGame().GetCacheManager().GenerateUser(_habbo.Id); } _habbo.InitProcess(); if (userData.user.GetPermissions().HasRight("mod_tickets")) { SendMessage(new ModeratorInitComposer( RocketEmulador.GetGame().GetModerationManager().UserMessagePresets, RocketEmulador.GetGame().GetModerationManager().RoomMessagePresets, RocketEmulador.GetGame().GetModerationManager().UserActionPresets, RocketEmulador.GetGame().GetModerationTool().GetTickets)); } { string hotelName = RocketEmulador.RocketData().data["hotelname"]; if (!string.IsNullOrWhiteSpace(RocketEmulador.GetDBConfig().DBData["welcome_message"])) { SendMessage(new MOTDNotificationComposer(RocketEmulador.GetDBConfig().DBData["welcome_message"])); } SendMessage(new RoomNotificationComposer("entrar", "message", "Bem-vindo" + " " + userData.user.GetClient().GetHabbo().Username + " " + "ao " + hotelName + "!")); if (GetHabbo().Rank == 10) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O PROGRAMADOR" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 9) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O CEO" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 8) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O GERENTE" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 7) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O ADM" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 6) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O MOD" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 5) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O PROMOTOR" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 4) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O EMB" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 3) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O VIP" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } if (GetHabbo().Rank == 2) { RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O LOCUTOR" + " " + userData.user.GetClient().GetHabbo().Username + " " + "entrou no " + hotelName + "!")); } Console.WriteLine("Um novo usuário se conectou seu nick é: " + userData.user.GetClient().GetHabbo().Username + " e seu ip: " + userData.user.GetClient().GetConnection().getIp(), "Rocket.Users", ConsoleColor.DarkGreen); } } } catch (Exception e) { Logging.LogCriticalException("Bug during user login: " + e); } return(false); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (RocketEmulador.GetDBConfig().DBData["gifts_enabled"] != "1") { Session.SendNotification("The hotel managers have disabled gifting"); return; } /*if (RocketEmulador.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = RocketEmulador.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!RocketEmulador.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!RocketEmulador.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!RocketEmulador.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = RocketEmulador.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendMessage(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { Session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); Session.GetHabbo().GiftPurchasingWarnings += 1; if (Session.GetHabbo().GiftPurchasingWarnings >= 25) { Session.GetHabbo().SessionGiftBlocked = true; } return; } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.pet0: case InteractionType.pet1: case InteractionType.pet2: case InteractionType.pet3: case InteractionType.pet4: case InteractionType.pet5: case InteractionType.pet6: case InteractionType.pet7: case InteractionType.pet8: case InteractionType.pet9: case InteractionType.pet10: case InteractionType.pet11: case InteractionType.pet12: case InteractionType.pet13: //Caballo case InteractionType.pet14: case InteractionType.pet15: case InteractionType.pet16: //Mascota agregada case InteractionType.pet17: //Mascota agregada case InteractionType.pet18: //Mascota agregada case InteractionType.pet19: //Mascota agregada case InteractionType.pet20: //Mascota agregada case InteractionType.pet21: //Mascota agregada case InteractionType.pet22: //Mascota agregada case InteractionType.pet28: case InteractionType.pet29: case InteractionType.pet30: try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, RocketEmulador.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendMessage(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;"); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = RocketEmulador.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendMessage(new PurchaseOKComposer()); Receiver.SendMessage(new FurniListAddComposer(GiveItem)); Receiver.SendMessage(new FurniListUpdateComposer()); } if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage)) { RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); if (Receiver != null) { RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); } RocketEmulador.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); } } Session.SendMessage(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }