public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights) { RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (User.CurrentEffect == 172 || User.CurrentEffect == 5 || User.CurrentEffect == 173) { if (Item.ExtraData != "5") { if (!Item.VikingCotieBurning) { Item.ExtraData = "1"; Item.UpdateState(); Item.VikingCotieBurning = true; GameClient clientByUsername = CyberEnvironment.GetGame().GetClientManager().GetClientByUsername(Item.GetRoom().Owner); if (clientByUsername != null ) { if (clientByUsername.GetHabbo().Username != Item.GetRoom().Owner) { clientByUsername.SendNotif("" + User.GetUsername() + " ha empezado a quemar una cabaña vikingo de tu Sala!"); } } this.mItem = Item; Timer Timer = new Timer(5000); Timer.Elapsed += OnElapse; Timer.Enabled = true; return; } } else { Session.SendNotif("¡Lo sentimos! Esta cabaña Vikingo ya ha sido quemada y no hay marcha atrás!"); } } }
internal void HandlePurchase(GameClient Session, int PageId, int ItemId, string ExtraData, int priceAmount, bool IsGift, string GiftUser, string GiftMessage, int GiftSpriteId, int GiftLazo, int GiftColor, bool undef, uint Group) { if (priceAmount < 1 || priceAmount > 100) { priceAmount = 1; } int num = priceAmount; int num2 = 0; int limtot = 0; CatalogPage catalogPage; CatalogItem item; uint num3; checked { if (priceAmount >= 6) { num--; } if (priceAmount >= 12) { num -= 2; } if (priceAmount >= 18) { num -= 2; } if (priceAmount >= 24) { num -= 2; } if (priceAmount >= 30) { num -= 2; } if (priceAmount >= 36) { num -= 2; } if (priceAmount >= 42) { num -= 2; } if (priceAmount >= 48) { num -= 2; } if (priceAmount >= 54) { num -= 2; } if (priceAmount >= 60) { num -= 2; } if (priceAmount >= 66) { num -= 2; } if (priceAmount >= 72) { num -= 2; } if (priceAmount >= 78) { num -= 2; } if (priceAmount >= 84) { num -= 2; } if (priceAmount >= 90) { num -= 2; } if (priceAmount >= 96) { num -= 2; } if (priceAmount >= 99) { num -= 2; } if (!this.Categories.Contains(PageId) && PageId != -12345678) { return; } if (PageId == -12345678) { item = GetItemFromOffer(ItemId); if (item == null) { return; } } else { catalogPage = (CatalogPage)Categories[PageId]; if (catalogPage == null || !catalogPage.Enabled || !catalogPage.Visible || Session == null || Session.GetHabbo() == null) { return; } if (catalogPage.MinRank > Session.GetHabbo().Rank || catalogPage.Layout == "sold_ltd_items") { return; } item = catalogPage.GetItem(ItemId); if (item == null) { return; } if (catalogPage.Layout == "vip_buy" || catalogPage.Layout == "club_buy" || HabboClubItems.Contains(item)) { string[] array = item.Name.Split(new char[] { '_' }); double dayLength; if (item.Name.Contains("DAY")) { dayLength = double.Parse(array[3]); } else { if (item.Name.Contains("MONTH")) { double num4 = double.Parse(array[3]); dayLength = Math.Ceiling((num4 * 31) - 0.205); } else { if (item.Name.Contains("YEAR")) { double num5 = double.Parse(array[3]); dayLength = (num5 * 31 * 12); } else { dayLength = 31; } } } Session.GetHabbo().GetSubscriptionManager().AddSubscription(dayLength); return; } } if (item.Name == "room_ad_plus_badge") { return; } if (item.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription) { ServerMessage serverMessage = new ServerMessage(Outgoing.CatalogPurchaseNotAllowedMessageComposer); serverMessage.AppendInt32(1); Session.SendMessage(serverMessage); return; } else if (item.Name.Contains("guild_forum")) { uint GroupId; if (!uint.TryParse(ExtraData, out GroupId)) { Session.SendNotif("Your group forum couldn't be created by an unknown error. Please report it."); return; } else { Guild Grap = CyberEnvironment.GetGame().GetGroupManager().GetGroup(GroupId); if (Grap == null) { Session.SendNotif("Your group forum couldn't be created by an unknown error. Please report it"); return; } else if (!Grap.HasForum && Grap.CreatorId == Session.GetHabbo().Id) { Grap.HasForum = true; CyberEnvironment.GetGame().GetClientManager().SendSuperNotif("Congratulations!", "You successfully purchased a Forum for your group.", "admin", Session, "event:groupforum/" + Grap.Id, "Enter my new Group Forum", false, false); Grap.UpdateForum(); } else if (Grap.CreatorId != Session.GetHabbo().Id && !Grap.HasForum) { Session.SendNotif("Uhm, looks like you're not the owner of the group. Anyway, you received a Group Forum Terminal, which would work only when the owner of the group buys a forum."); } } } bool flag = false; foreach (uint current in item.Items.Keys) { if (item.GetBaseItem(current).InteractionType == InteractionType.pet1 || item.GetBaseItem(current).InteractionType == InteractionType.pet2 || item.GetBaseItem(current).InteractionType == InteractionType.pet3 || item.GetBaseItem(current).InteractionType == InteractionType.pet4 || item.GetBaseItem(current).InteractionType == InteractionType.pet5 || item.GetBaseItem(current).InteractionType == InteractionType.pet6 || item.GetBaseItem(current).InteractionType == InteractionType.pet7 || item.GetBaseItem(current).InteractionType == InteractionType.pet8 || item.GetBaseItem(current).InteractionType == InteractionType.pet9 || item.GetBaseItem(current).InteractionType == InteractionType.pet10 || item.GetBaseItem(current).InteractionType == InteractionType.pet11 || item.GetBaseItem(current).InteractionType == InteractionType.pet12 || item.GetBaseItem(current).InteractionType == InteractionType.pet13 || item.GetBaseItem(current).InteractionType == InteractionType.pet14 || item.GetBaseItem(current).InteractionType == InteractionType.pet15 || item.GetBaseItem(current).InteractionType == InteractionType.pet16 || item.GetBaseItem(current).InteractionType == InteractionType.pet17 || item.GetBaseItem(current).InteractionType == InteractionType.pet18 || item.GetBaseItem(current).InteractionType == InteractionType.pet19 || item.GetBaseItem(current).InteractionType == InteractionType.pet20 || item.GetBaseItem(current).InteractionType == InteractionType.pet21 || item.GetBaseItem(current).InteractionType == InteractionType.pet22 || item.GetBaseItem(current).InteractionType == InteractionType.pet23 || item.GetBaseItem(current).InteractionType == InteractionType.pet24 || item.GetBaseItem(current).InteractionType == InteractionType.pet25 || item.GetBaseItem(current).InteractionType == InteractionType.pet26) { flag = true; } } if (!flag && (item.CreditsCost * num < 0 || item.DucketsCost * num < 0 || item.BelCreditsCost * num < 0 || item.LoyaltyCost * num < 0)) { return; } if (item.IsLimited) { num = 1; priceAmount = 1; if (item.LimitedSelled >= item.LimitedStack) { Session.SendMessage(new ServerMessage(Outgoing.CatalogLimitedItemSoldOutMessageComposer)); return; } item.LimitedSelled++; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery(string.Concat(new object[] { "UPDATE catalog_items SET limited_sells = ", item.LimitedSelled, " WHERE id = ", item.Id })); num2 = item.LimitedSelled; limtot = item.LimitedStack; } } else { if (IsGift & priceAmount > 1) { num = 1; priceAmount = 1; } } num3 = 0u; if (Session.GetHabbo().Credits < item.CreditsCost * num) { return; } if (Session.GetHabbo().ActivityPoints < item.DucketsCost * num) { return; } if (Session.GetHabbo().BelCredits < item.BelCreditsCost * num) { return; } if (Session.GetHabbo().BelCredits < item.LoyaltyCost * num) { return; } if (item.CreditsCost > 0 && !IsGift) { Session.GetHabbo().Credits -= item.CreditsCost * num; Session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0 && !IsGift) { Session.GetHabbo().ActivityPoints -= item.DucketsCost * num; Session.GetHabbo().UpdateActivityPointsBalance(); } if (item.BelCreditsCost > 0 && !IsGift) { Session.GetHabbo().BelCredits -= item.BelCreditsCost * num; Session.GetHabbo().UpdateSeasonalCurrencyBalance(); } if (item.LoyaltyCost > 0 && !IsGift) { Session.GetHabbo().BelCredits -= item.LoyaltyCost * num; Session.GetHabbo().UpdateSeasonalCurrencyBalance(); } } checked { foreach (uint current2 in item.Items.Keys) { if (IsGift) { if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { Session.SendNotif("You're purchasing gifts too fast! Please wait 15 seconds, then you purchase another gift."); return; } if (!item.GetBaseItem(current2).AllowGift) { return; } DataRow row; using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor3.setQuery("SELECT id FROM users WHERE username = @gift_user"); queryreactor3.addParameter("gift_user", GiftUser); row = queryreactor3.getRow(); } if (row == null) { Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftErrorMessageComposer); Session.GetMessageHandler().GetResponse().AppendString(GiftUser); Session.GetMessageHandler().SendResponse(); return; } num3 = Convert.ToUInt32(row["id"]); if (num3 == 0u) { Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftErrorMessageComposer); Session.GetMessageHandler().GetResponse().AppendString(GiftUser); Session.GetMessageHandler().SendResponse(); return; } if (item.CreditsCost > 0 && IsGift) { Session.GetHabbo().Credits -= item.CreditsCost * num; Session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0 && IsGift) { Session.GetHabbo().ActivityPoints -= item.DucketsCost * num; Session.GetHabbo().UpdateActivityPointsBalance(); } if (item.BelCreditsCost > 0 && IsGift) { Session.GetHabbo().BelCredits -= item.BelCreditsCost * num; Session.GetHabbo().UpdateSeasonalCurrencyBalance(); } if (item.LoyaltyCost > 0 && IsGift) { Session.GetHabbo().BelCredits -= item.LoyaltyCost * num; Session.GetHabbo().UpdateSeasonalCurrencyBalance(); } } if (IsGift && item.GetBaseItem(current2).Type == 'e') { Session.SendNotif("You can't send effects as gifts."); return; } string text = ""; InteractionType interactionType = item.GetBaseItem(current2).InteractionType; switch (interactionType) { case InteractionType.none: ExtraData = ""; break; case InteractionType.gate: case InteractionType.bed: case InteractionType.scoreboard: case InteractionType.vendingmachine: case InteractionType.alert: case InteractionType.onewaygate: case InteractionType.loveshuffler: case InteractionType.habbowheel: case InteractionType.dice: case InteractionType.bottle: case InteractionType.hopper: case InteractionType.teleport: case InteractionType.pet: case InteractionType.pool: case InteractionType.roller: case InteractionType.fbgate: goto IL_DF5; case InteractionType.postit: ExtraData = "FFFF33"; break; case InteractionType.roomeffect: { double num6 = 0.0; try { if (string.IsNullOrEmpty(ExtraData)) { num6 = 0.0; } else { num6 = double.Parse(ExtraData, CyberEnvironment.cultureInfo); } } catch (Exception pException) { Logging.HandleException(pException, "Catalog.HandlePurchase: " + ExtraData); } ExtraData = TextHandling.GetString(num6); break; } case InteractionType.dimmer: ExtraData = "1,1,1,#000000,255"; break; case InteractionType.trophy: ExtraData = string.Concat(new object[] { Session.GetHabbo().Username, Convert.ToChar(9), DateTime.Now.Day, "-", DateTime.Now.Month, "-", DateTime.Now.Year, Convert.ToChar(9), ExtraData }); break; case InteractionType.rentals: goto IL_C41; 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: case InteractionType.pet14: case InteractionType.pet15: case InteractionType.pet16: case InteractionType.pet17: case InteractionType.pet18: case InteractionType.pet19: case InteractionType.pet20: case InteractionType.pet21: case InteractionType.pet22: case InteractionType.pet23: case InteractionType.pet24: case InteractionType.pet25: case InteractionType.pet26: try { string[] array2 = ExtraData.Split(new char[] { '\n' }); string petName = array2[0]; string text2 = array2[1]; string text3 = array2[2]; int.Parse(text2); if (!Catalog.CheckPetName(petName)) { return; } if (text2.Length != 1) { return; } if (text3.Length != 6) { return; } CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_PetLover", 1, false); break; } catch (Exception ex) { Logging.WriteLine(ex.ToString(), ConsoleColor.Gray); Logging.HandleException(ex, "Catalog.HandlePurchase"); return; } default: switch (interactionType) { case InteractionType.mannequin: ExtraData = string.Concat(new object[] { "m", Convert.ToChar(5), "ch-215-92.lg-3202-1322-73", Convert.ToChar(5), "Mannequin" }); break; case InteractionType.vip_gate: case InteractionType.mystery_box: case InteractionType.youtubetv: case InteractionType.tilestackmagic: case InteractionType.tent: case InteractionType.bedtent: goto IL_DF5; case InteractionType.badge_display: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(ExtraData)) ExtraData = "UMAD"; break; case InteractionType.fbgate: ExtraData = "hd-99999-99999.lg-270-62;hd-99999-99999.ch-630-62.lg-695-62"; break; case InteractionType.pinata: case InteractionType.runwaysage: case InteractionType.shower: ExtraData = "0"; break; case InteractionType.groupforumterminal: case InteractionType.gld_item: case InteractionType.gld_gate: case InteractionType.poster: break; case InteractionType.moplaseed: ExtraData = new Random().Next(0, 12).ToString(); break; case InteractionType.musicdisc: text = SongManager.GetCodeById((uint)item.songID); SongData song = SongManager.GetSongById((uint)item.songID); ExtraData = string.Concat(new object[] { Session.GetHabbo().Username, '\n', DateTime.Now.Year, '\n', DateTime.Now.Month, '\n', DateTime.Now.Day, '\n', song.LengthSeconds, '\n', song.Name }); break; default: goto IL_DF5; } break; } IL_DFC: Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateInventoryMessageComposer); Session.GetMessageHandler().SendResponse(); Session.SendMessage(CatalogPacket.PurchaseOK()); if (IsGift) { Item itemBySprite = CyberEnvironment.GetGame().GetItemManager().GetItemBySprite(GiftSpriteId, 's'); if (itemBySprite == null) { return; } GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(num3); uint num7; using (IQueryAdapter queryreactor4 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor4.setQuery(string.Concat(new object[] { "INSERT INTO items (base_item,user_id) VALUES (", itemBySprite.ItemId, ", ", num3, ")" })); num7 = (uint)queryreactor4.insertQuery(); queryreactor4.setQuery(string.Concat(new object[] { "INSERT INTO user_gifts (gift_id,item_id,extradata,giver_name,message,ribbon,color,gift_sprite,show_sender,rare_id) VALUES (", num7, ", ", item.GetBaseItem(current2).ItemId, ",@extradata, @name, @message,", GiftLazo, ",", GiftColor, ",", GiftSpriteId, ",", undef ? 1 : 0, ",", num2, ")" })); queryreactor4.addParameter("extradata", ExtraData); queryreactor4.addParameter("name", GiftUser); queryreactor4.addParameter("message", GiftMessage); queryreactor4.runQuery(); if (Session.GetHabbo().Id != num3) { queryreactor4.runFastQuery(string.Concat(new object[] { "UPDATE user_stats SET gifts_given = gifts_given + 1 WHERE id = ", Session.GetHabbo().Id, " LIMIT 1;UPDATE user_stats SET gifts_received = gifts_received + 1 WHERE id = ", num3, " LIMIT 1" })); } } if (clientByUserID.GetHabbo().Id != Session.GetHabbo().Id) { CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_GiftGiver", 1, false); CyberEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS, 0u); } if (clientByUserID != null) { UserItem userItem = clientByUserID.GetHabbo().GetInventoryComponent().AddNewItem(num7, itemBySprite.ItemId, string.Concat(new object[] { Session.GetHabbo().Id, (char)9, GiftMessage, (char)9, GiftLazo, (char)9, GiftColor, (char)9, ((undef) ? "1" : "0"), (char)9, Session.GetHabbo().Username, (char)9, Session.GetHabbo().Look, (char)9, item.Name }), 0u, false, false, 0, 0, ""); if (clientByUserID.GetHabbo().Id != Session.GetHabbo().Id) { CyberEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(clientByUserID, "ACH_GiftReceiver", 1, false); } } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; continue; } Session.GetMessageHandler().GetResponse().Init(Outgoing.NewInventoryObjectMessageComposer); Session.GetMessageHandler().GetResponse().AppendInt32(1); int i = 1; if (item.GetBaseItem(current2).Type.ToString().ToLower().Equals("s")) { if (item.GetBaseItem(current2).InteractionType == InteractionType.pet1 || item.GetBaseItem(current2).InteractionType == InteractionType.pet2 || item.GetBaseItem(current2).InteractionType == InteractionType.pet3 || item.GetBaseItem(current2).InteractionType == InteractionType.pet4 || item.GetBaseItem(current2).InteractionType == InteractionType.pet5 || item.GetBaseItem(current2).InteractionType == InteractionType.pet6 || item.GetBaseItem(current2).InteractionType == InteractionType.pet7 || item.GetBaseItem(current2).InteractionType == InteractionType.pet8 || item.GetBaseItem(current2).InteractionType == InteractionType.pet9 || item.GetBaseItem(current2).InteractionType == InteractionType.pet10 || item.GetBaseItem(current2).InteractionType == InteractionType.pet11 || item.GetBaseItem(current2).InteractionType == InteractionType.pet12 || item.GetBaseItem(current2).InteractionType == InteractionType.pet13 || item.GetBaseItem(current2).InteractionType == InteractionType.pet14 || item.GetBaseItem(current2).InteractionType == InteractionType.pet15 || item.GetBaseItem(current2).InteractionType == InteractionType.pet16 || item.GetBaseItem(current2).InteractionType == InteractionType.pet17 || item.GetBaseItem(current2).InteractionType == InteractionType.pet18) { i = 3; } else { i = 1; } } Session.GetMessageHandler().GetResponse().AppendInt32(i); List<UserItem> list = this.DeliverItems(Session, item.GetBaseItem(current2), priceAmount * item.Items[current2], ExtraData, num2, limtot, text); Session.GetMessageHandler().GetResponse().AppendInt32(list.Count); foreach (UserItem current3 in list) { Session.GetMessageHandler().GetResponse().AppendUInt(current3.Id); } Session.GetMessageHandler().SendResponse(); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); if (item.GetBaseItem(current2).InteractionType == InteractionType.pet1 || item.GetBaseItem(current2).InteractionType == InteractionType.pet2 || item.GetBaseItem(current2).InteractionType == InteractionType.pet3 || item.GetBaseItem(current2).InteractionType == InteractionType.pet4 || item.GetBaseItem(current2).InteractionType == InteractionType.pet5 || item.GetBaseItem(current2).InteractionType == InteractionType.pet6 || item.GetBaseItem(current2).InteractionType == InteractionType.pet7 || item.GetBaseItem(current2).InteractionType == InteractionType.pet8 || item.GetBaseItem(current2).InteractionType == InteractionType.pet9 || item.GetBaseItem(current2).InteractionType == InteractionType.pet10 || item.GetBaseItem(current2).InteractionType == InteractionType.pet11 || item.GetBaseItem(current2).InteractionType == InteractionType.pet12 || item.GetBaseItem(current2).InteractionType == InteractionType.pet13 || item.GetBaseItem(current2).InteractionType == InteractionType.pet14 || item.GetBaseItem(current2).InteractionType == InteractionType.pet15 || item.GetBaseItem(current2).InteractionType == InteractionType.pet16 || item.GetBaseItem(current2).InteractionType == InteractionType.pet17 || item.GetBaseItem(current2).InteractionType == InteractionType.pet18) { Session.SendMessage(Session.GetHabbo().GetInventoryComponent().SerializePetInventory()); continue; } continue; IL_C41: ExtraData = item.ExtraData; goto IL_DFC; IL_DF5: ExtraData = ""; goto IL_DFC; } if (item.Badge.Length >= 1) { Session.GetHabbo().GetBadgeComponent().GiveBadge(item.Badge, true, Session, false); } } }
internal static void BanUser(GameClient ModSession, uint UserId, int Length, string Message) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (clientByUserID == null || clientByUserID.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (clientByUserID.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif("No tienes los permisos para banear"); return; } double lengthSeconds = (double)Length; CyberEnvironment.GetGame().GetBanManager().BanUser(clientByUserID, ModSession.GetHabbo().Username, lengthSeconds, Message, false, false); }
internal static void KickUser(GameClient ModSession, uint UserId, string Message, bool Soft) { GameClient clientByUserID = CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (clientByUserID == null || clientByUserID.GetHabbo().CurrentRoomId < 1u || clientByUserID.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (clientByUserID.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif("You are not allowed to kick him/her."); return; } Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(clientByUserID.GetHabbo().CurrentRoomId); if (room == null) { return; } room.GetRoomUserManager().RemoveUserFromRoom(clientByUserID, true, false); clientByUserID.CurrentRoomUserID = -1; if (!Soft) { clientByUserID.SendNotif(Message); using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId); } } }
internal RoomData CreateRoom(GameClient Session, string Name, string Desc, string Model, int Category, int MaxVisitors, int TradeState) { if (!this.roomModels.Contains(Model)) { Session.SendNotif("I can't create your room with that model!"); return null; } uint RoomId = 0; using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { dbClient.setQuery("INSERT INTO rooms (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@username,@model,@cat,@usmax,@tstate)"); dbClient.addParameter("caption", Name); dbClient.addParameter("desc", Desc); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.addParameter("model", Model); dbClient.addParameter("cat", Category); dbClient.addParameter("usmax", MaxVisitors); dbClient.addParameter("tstate", TradeState.ToString()); RoomId = (uint)dbClient.insertQuery(); } RoomData Data = this.GenerateRoomData(RoomId); Session.GetHabbo().UsersRooms.Add(Data); return Data; }
public static void SaveWired(GameClient Session, RoomItem Item, ClientMessage Request) { if (!Item.IsWired) { return; } Room room = Item.GetRoom(); WiredHandler wiredHandler = room.GetWiredHandler(); checked { switch (Item.GetBaseItem().InteractionType) { case InteractionType.triggerroomenter: { Request.PopWiredInt32(); string otherString = Request.PopFixedString(); WiredItem wired = wiredHandler.GetWired(Item); wired.OtherString = otherString; wiredHandler.ReloadWired(wired); break; } case InteractionType.triggerlongrepeater: { Request.PopWiredInt32(); int delay = Request.PopWiredInt32() * 5000; WiredItem wired2 = wiredHandler.GetWired(Item); wired2.Delay = delay; wiredHandler.ReloadWired(wired2); break; } case InteractionType.triggerrepeater: { Request.PopWiredInt32(); int delay = Request.PopWiredInt32() * 500; WiredItem wired2 = wiredHandler.GetWired(Item); wired2.Delay = delay; wiredHandler.ReloadWired(wired2); break; } case InteractionType.triggeronusersay: { Request.PopWiredInt32(); int num = Request.PopWiredInt32(); string otherString2 = Request.PopFixedString(); WiredItem wired3 = wiredHandler.GetWired(Item); wired3.OtherString = otherString2; wired3.OtherBool = (num == 1); wiredHandler.ReloadWired(wired3); break; } case InteractionType.triggerstatechanged: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems = WiredSaver.GetFurniItems(Request, room); int num2 = Request.PopWiredInt32(); WiredItem wired4 = wiredHandler.GetWired(Item); wired4.Delay = num2 * 500; wired4.Items = furniItems; wiredHandler.ReloadWired(wired4); break; } case InteractionType.triggerwalkonfurni: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems2 = WiredSaver.GetFurniItems(Request, room); int num3 = Request.PopWiredInt32(); WiredItem wired5 = wiredHandler.GetWired(Item); wired5.Delay = num3 * 500; wired5.Items = furniItems2; wiredHandler.ReloadWired(wired5); break; } case InteractionType.triggerwalkofffurni: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems3 = WiredSaver.GetFurniItems(Request, room); int num4 = Request.PopWiredInt32(); WiredItem wired6 = wiredHandler.GetWired(Item); wired6.Delay = num4 * 500; wired6.Items = furniItems3; wiredHandler.ReloadWired(wired6); break; } case InteractionType.actionmoverotate: { Request.PopWiredInt32(); int num5 = Request.PopWiredInt32(); int num6 = Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems4 = WiredSaver.GetFurniItems(Request, room); int num7 = Request.PopWiredInt32(); WiredItem wired7 = wiredHandler.GetWired(Item); wired7.Items = furniItems4; wired7.Delay = num7 * 500; wired7.OtherString = num6 + ";" + num5; wiredHandler.ReloadWired(wired7); break; } case InteractionType.actionshowmessage: case InteractionType.actionkickuser: { Request.PopWiredInt32(); string otherString3 = Request.PopFixedString(); WiredItem wired8 = wiredHandler.GetWired(Item); wired8.OtherString = otherString3; wiredHandler.ReloadWired(wired8); break; } case InteractionType.actionteleportto: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems5 = WiredSaver.GetFurniItems(Request, room); int num8 = Request.PopWiredInt32(); WiredItem wired9 = wiredHandler.GetWired(Item); wired9.Items = furniItems5; wired9.Delay = num8 * 500; wiredHandler.ReloadWired(wired9); break; } case InteractionType.actiontogglestate: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems6 = WiredSaver.GetFurniItems(Request, room); int num9 = Request.PopWiredInt32(); WiredItem wired10 = wiredHandler.GetWired(Item); wired10.Items = furniItems6; wired10.Delay = num9 * 500; wiredHandler.ReloadWired(wired10); break; } case InteractionType.actiongivereward: { Request.PopWiredInt32(); int num10 = Request.PopWiredInt32(); bool otherBool = Request.PopWiredInt32() == 1; int num11 = Request.PopWiredInt32(); Request.PopWiredInt32(); string otherString4 = Request.PopFixedString(); List<RoomItem> furniItems7 = WiredSaver.GetFurniItems(Request, room); WiredItem wired11 = wiredHandler.GetWired(Item); wired11.Items = furniItems7; wired11.Delay = 0; wired11.OtherBool = otherBool; wired11.OtherString = otherString4; wired11.OtherExtraString = num10.ToString(); wired11.OtherExtraString2 = num11.ToString(); wiredHandler.ReloadWired(wired11); break; } case InteractionType.actionmuteuser: { Request.PopWiredInt32(); int minutes = Request.PopWiredInt32() * 500; string Message = Request.PopFixedString(); List<RoomItem> furniItems7 = WiredSaver.GetFurniItems(Request, room); WiredItem wired11 = wiredHandler.GetWired(Item); wired11.Items = furniItems7; wired11.Delay = minutes; wired11.OtherBool = false; wired11.OtherString = Message; wiredHandler.ReloadWired(wired11); break; } case InteractionType.triggerscoreachieved: { Request.PopWiredInt32(); int pointsRequired = Request.PopWiredInt32(); WiredItem wired11 = wiredHandler.GetWired(Item); wired11.Delay = 0; wired11.OtherString = pointsRequired.ToString(); wiredHandler.ReloadWired(wired11); break; } case InteractionType.conditionitemsmatches: case InteractionType.conditionitemsdontmatch: case InteractionType.actionposreset: { // Coded by Finn for Cyber Emulator Request.PopWiredInt32(); bool ActualExtraData = Request.PopWiredInt32() == 1; bool ActualRot = Request.PopWiredInt32() == 1; bool ActualPosition = Request.PopWiredInt32() == 1; string Booleans = (ActualExtraData.ToString() + "," + ActualRot.ToString() + "," + ActualPosition.ToString()).ToLower(); Request.PopFixedString(); List<RoomItem> Items = WiredSaver.GetFurniItems(Request, room); int Delay = Request.PopWiredInt32() * 500; WiredItem Wiry = wiredHandler.GetWired(Item); string DataToSave = ""; string ExtraStringForWI = ""; foreach (RoomItem AItem in Items) { DataToSave += (AItem.Id + "|" + AItem.ExtraData + "|" + AItem.Rot + "|" + AItem.GetX + "," + AItem.GetY + "," + AItem.GetZ.ToString()); ExtraStringForWI += (AItem.Id + "," + ((ActualExtraData) ? AItem.ExtraData : "N") + "," + ((ActualRot) ? AItem.Rot.ToString() : "N") + "," + ((ActualPosition) ? AItem.GetX.ToString() : "N") + "," + ((ActualPosition) ? AItem.GetY.ToString() : "N")); if (AItem != Items.Last()) { DataToSave += "/"; ExtraStringForWI += ";"; } } Wiry.Items = Items; Wiry.Delay = Delay; Wiry.OtherBool = true; Wiry.OtherString = Booleans; Wiry.OtherExtraString = DataToSave; Wiry.OtherExtraString2 = ExtraStringForWI; wiredHandler.ReloadWired(Wiry); break; } case InteractionType.conditiongroupmember: case InteractionType.conditionnotgroupmember: { // Nothing is needed. break; } case InteractionType.conditionhowmanyusersinroom: case InteractionType.conditionnegativehowmanyusers: { Request.PopWiredInt32(); int Minimum = Request.PopWiredInt32(); int Maximum = Request.PopWiredInt32(); string EI = Minimum + "," + Maximum; WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = new List<RoomItem>(); wired12.OtherString = EI; wiredHandler.ReloadWired(wired12); break; } case InteractionType.conditionusernotwearingeffect: case InteractionType.conditionuserwearingeffect: { Request.PopWiredInt32(); int Effect = Request.PopWiredInt32(); WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = new List<RoomItem>(); wired12.OtherString = Effect.ToString(); wiredHandler.ReloadWired(wired12); break; } case InteractionType.conditionuserwearingbadge: case InteractionType.conditionusernotwearingbadge: { Request.PopWiredInt32(); string badge = Request.PopFixedString(); WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = new List<RoomItem>(); wired12.OtherString = badge; wiredHandler.ReloadWired(wired12); break; } case InteractionType.conditiondaterangeactive: { Request.PopWiredInt32(); int startDate = Request.PopWiredInt32(); int endDate = Request.PopWiredInt32();//timestamps WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = new List<RoomItem>(); wired12.OtherString = startDate + "," + endDate; if (startDate == 0) { wired12.OtherString = ""; Session.SendNotif(@"Para poder guardar la fecha debes introducirlo así: <b>YYYY/MM/dd hh:mm</b> o bien <b>dd/MM/YYYY hh:mm</b><br />No especifiques fecha de término si no hay. La hora y los minutos son opcionales. Anímate a arreglarlo.<br /><br /><br />Con cariño,<br /><b>Finn</b>"); } wiredHandler.ReloadWired(wired12); break; } case InteractionType.conditionfurnishaveusers: case InteractionType.conditiontriggeronfurni: case InteractionType.conditionfurnihasfurni: case InteractionType.conditionfurnitypematches: case InteractionType.conditionfurnishavenotusers: case InteractionType.conditiontriggerernotonfurni: case InteractionType.conditionfurnihasnotfurni: case InteractionType.conditionfurnitypedontmatch: { Request.PopWiredInt32(); Request.PopFixedString(); List<RoomItem> furniItems8 = WiredSaver.GetFurniItems(Request, room); WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = furniItems8; wiredHandler.ReloadWired(wired12); break; } case InteractionType.actiongivescore: { Request.PopWiredInt32(); int ScoreToGive = Request.PopWiredInt32(); int MaxTimesPerGame = Request.PopWiredInt32(); string NewExtraInfo = (ScoreToGive + "," + MaxTimesPerGame); List<RoomItem> furniItems8 = WiredSaver.GetFurniItems(Request, room); WiredItem wired12 = wiredHandler.GetWired(Item); wired12.Items = furniItems8; wired12.OtherString = NewExtraInfo; wiredHandler.ReloadWired(wired12); break; } } Session.SendMessage(new ServerMessage(Outgoing.SaveWiredMessageComposer)); } }
internal bool CheckGroupRights(GameClient Session) { try { if (this.Group == null) { bool result = false; return result; } if (this.Group.AdminOnlyDeco == 0u && this.Group.Members.ContainsKey(Session.GetHabbo().Id)) { bool result = true; return result; } if (this.Group.Admins.ContainsKey(Session.GetHabbo().Id)) { Session.SendNotif("Group Admin"); bool result = true; return result; } if (Session.GetHabbo().Username == this.Owner) { bool result = true; return result; } if (Session.GetHabbo().HasFuse("fuse_admin") || Session.GetHabbo().HasFuse("fuse_any_room_controller")) { bool result = true; return result; } } catch (Exception pException) { Logging.HandleException(pException, "Room.CheckGroupRights"); } return false; }