public override bool Execute(GameClient session, string[] pms) { GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]); if (client == null) { session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found")); return true; } uint amount; if (!uint.TryParse(pms[1], out amount)) { session.SendNotif(Yupi.GetLanguage().GetVar("enter_numbers")); return true; } client.GetHabbo().Duckets += amount; client.GetHabbo().UpdateActivityPointsBalance(); client.SendNotif(string.Format(Yupi.GetLanguage().GetVar("staff_gives_duckets"), session.GetHabbo().UserName, amount)); return true; }
public override bool Execute(GameClient session, string[] pms) { string userName = pms[0]; GameClient userSession = Yupi.GetGame().GetClientManager().GetClientByUserName(userName); if (userSession == null) { session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found")); return true; } if (session.GetHabbo().Rank <= userSession.GetHabbo().Rank) { session.SendNotif(Yupi.GetLanguage().GetVar("user_is_higher_rank")); return true; } if (userSession.GetHabbo().CurrentRoomId < 1) { session.SendNotif(Yupi.GetLanguage().GetVar("command_kick_user_not_in_room")); return true; } Room room = Yupi.GetGame().GetRoomManager().GetRoom(userSession.GetHabbo().CurrentRoomId); if (room == null) return true; room.GetRoomUserManager().RemoveUserFromRoom(userSession, true, false); userSession.CurrentRoomUserId = -1; if (pms.Length > 1) { userSession.SendNotif( string.Format(Yupi.GetLanguage().GetVar("command_kick_user_mod_default") + "{0}.", string.Join(" ", pms.Skip(1)))); } else userSession.SendNotif(Yupi.GetLanguage().GetVar("command_kick_user_mod_default")); return true; }
/// <summary> /// Determines whether this instance can talk the specified session. /// </summary> /// <param name="session">The session.</param> /// <param name="message">The message.</param> /// <returns><c>true</c> if this instance can talk the specified session; otherwise, <c>false</c>.</returns> internal static bool CanTalk(GameClient session, string message) { if (CheckForBannedPhrases(message) && session.GetHabbo().Rank < 4) { if (!Yupi.MutedUsersByFilter.ContainsKey(session.GetHabbo().Id)) session.GetHabbo().BobbaFiltered++; if (session.GetHabbo().BobbaFiltered < 3) session.SendNotif( "Your language is inappropriate. If you do not change this , measures are being taken by the automated system of Habbo."); else if (session.GetHabbo().BobbaFiltered >= 3) { if (session.GetHabbo().BobbaFiltered == 3) { session.GetHabbo().BobbaFiltered = 4; Yupi.MutedUsersByFilter.Add(session.GetHabbo().Id, uint.Parse((Yupi.GetUnixTimeStamp() + 300*60).ToString())); return false; } if (session.GetHabbo().BobbaFiltered == 4) session.SendNotif( "Now you can not talk for 5 minutes . This is because your exhibits inappropriate language in Habbo Hotel."); else if (session.GetHabbo().BobbaFiltered == 5) session.SendNotif("You risk a ban if you continue to scold it . This is your last warning"); else if (session.GetHabbo().BobbaFiltered >= 7) { session.GetHabbo().BobbaFiltered = 0; Yupi.GetGame().GetBanManager().BanUser(session, "Auto-system-ban", 3600, "ban.", false, false); } } } if (Yupi.MutedUsersByFilter.ContainsKey(session.GetHabbo().Id)) { if (Yupi.MutedUsersByFilter[session.GetHabbo().Id] < Yupi.GetUnixTimeStamp()) Yupi.MutedUsersByFilter.Remove(session.GetHabbo().Id); else { DateTime now = DateTime.Now; TimeSpan timeStillBanned = now - Yupi.UnixToDateTime(Yupi.MutedUsersByFilter[session.GetHabbo().Id]); session.SendNotif("Damn! you can't talk for " + timeStillBanned.Minutes.ToString().Replace("-", "") + " minutes and " + timeStillBanned.Seconds.ToString().Replace("-", "") + " seconds."); return false; } } return true; }
public override bool Execute(GameClient session, string[] pms) { try { session.GetHabbo().GetInventoryComponent().Redeemcredits(session); session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits")); } catch (Exception e) { Writer.LogException(e.ToString()); session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits")); } return true; }
public override bool Execute(GameClient session, string[] pms) { session.GetHabbo().GetInventoryComponent().Redeemcredits(session); session.SendNotif(Yupi.GetLanguage().GetVar("command_redeem_credits")); return true; }
public override bool Execute(GameClient session, string[] pms) { session.GetHabbo().SpectatorMode = true; session.SendNotif("In next room you enter you will be invisible."); return true; }
public override bool Execute(GameClient session, string[] pms) { if (pms.Length != 1) return true; if (string.IsNullOrEmpty(pms[0])) return true; string userName = Yupi.FilterInjectionChars(pms[0]); Habbo userCached = Yupi.GetHabboForName(userName); if (userCached == null) return true; StringBuilder builder = new StringBuilder(); if (userCached.CurrentRoom != null) { builder.Append($" - ROOM INFORMATION [{userCached.CurrentRoom.RoomId}] - \r"); builder.Append($"Owner: {userCached.CurrentRoom.RoomData.Owner}\r"); builder.Append($"Room Name: {userCached.CurrentRoom.RoomData.Name}\r"); builder.Append($"Current Users: {userCached.CurrentRoom.UserCount} / {userCached.CurrentRoom.RoomData.UsersMax}"); } session.SendNotif(string.Concat("User info for: ", userName, " \rUser ID: ", userCached.Id, ":\rRank: ", userCached.Rank, "\rCurrentTalentLevel: ", userCached.CurrentTalentLevel, " \rCurrent Room: ", userCached.CurrentRoomId, " \rCredits: ", userCached.Credits, "\rDuckets: ", userCached.Duckets, "\rDiamonds: ", userCached.Diamonds, "\rMuted: ", userCached.Muted.ToString(), "\r\r\r", builder.ToString())); return true; }
public override bool Execute(GameClient session, string[] pms) { using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor()) Yupi.ConfigData = new ServerDatabaseSettings(adapter); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_settings")); return true; }
public override bool Execute(GameClient session, string[] pms) { GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]); if (client == null) { session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found")); return true; } client.GetHabbo().GetBadgeComponent().GiveBadge(pms[1], true, client); session.SendNotif(Yupi.GetLanguage().GetVar("command_badge_give_done")); Yupi.GetGame() .GetModerationTool() .LogStaffEntry(session.GetHabbo().UserName, client.GetHabbo().UserName, "Badge", $"Badge given to user [{pms[1]}]"); return true; }
public override bool Execute(GameClient session, string[] pms) { using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor()) Yupi.GetGame().GetPollManager().Init(adapter); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_polls")); return true; }
public override bool Execute(GameClient session, string[] pms) { uint amount; if (!uint.TryParse(pms[0], out amount)) { session.SendNotif(Yupi.GetLanguage().GetVar("enter_numbers")); return true; } foreach (GameClient client in Yupi.GetGame().GetClientManager().Clients.Values) { if (client?.GetHabbo() == null) continue; Habbo habbo = client.GetHabbo(); habbo.Diamonds += amount; client.GetHabbo().UpdateSeasonalCurrencyBalance(); client.SendNotif(Yupi.GetLanguage().GetVar("command_diamonds_one_give") + amount + Yupi.GetLanguage().GetVar("command_diamonds_two_give")); } return true; }
public override bool Execute(GameClient session, string[] pms) { Room room = session.GetHabbo().CurrentRoom; room.MutedBots = !room.MutedBots; session.SendNotif(Yupi.GetLanguage().GetVar("user_room_mute_bots")); return true; }
public override bool Execute(GameClient session, string[] pms) { using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor()) Yupi.GetGame().GetRoleManager().LoadRights(adapter); CommandsManager.UpdateInfo(); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_ranks")); return true; }
public override bool Execute(GameClient session, string[] pms) { FurnitureDataManager.SetCache(); Yupi.GetGame().ReloadItems(); FurnitureDataManager.Clear(); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_items")); return true; }
public override bool Execute(GameClient session, string[] pms) { UserChatInputFilter.Reload(); BlackWordsManager.Reload(); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_banned_hotels")); return true; }
public override bool Execute(GameClient session, string[] pms) { Room room = session.GetHabbo().CurrentRoom; room.GetGameMap().DiagonalEnabled = !room.GetGameMap().DiagonalEnabled; session.SendNotif(Yupi.GetLanguage().GetVar("command_disable_diagonal")); return true; }
public override bool Execute(GameClient session, string[] pms) { using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor()) { Yupi.GetGame().GetNavigator().Initialize(adapter); Yupi.GetGame().GetRoomManager().LoadModels(adapter); } session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_navigator")); return true; }
public override bool Execute(GameClient session, string[] pms) { string userName = pms[0]; if (string.IsNullOrEmpty(userName)) return true; GameClient clientByUserName = Yupi.GetGame().GetClientManager().GetClientByUserName(userName); if (clientByUserName == null || clientByUserName.GetHabbo() == null) { using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor()) { adapter.SetQuery( "SELECT username, rank, id, credits, activity_points, diamonds FROM users WHERE username=@user LIMIT 1"); adapter.AddParameter("user", userName); DataRow row = adapter.GetRow(); if (row == null) { session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found")); return true; } session.SendNotif(string.Format(Yupi.GetLanguage().GetVar("user_info_all"), userName, row[1], row[3], row[4], row[5])); } return true; } Habbo habbo = clientByUserName.GetHabbo(); StringBuilder builder = new StringBuilder(); if (habbo.CurrentRoom != null) { builder.AppendFormat(" - ROOM INFORMATION [{0}] - \r", habbo.CurrentRoom.RoomId); builder.AppendFormat("Owner: {0}\r", habbo.CurrentRoom.RoomData.Owner); builder.AppendFormat("Room Name: {0}\r", habbo.CurrentRoom.RoomData.Name); builder.Append( string.Concat("Current Users: ", habbo.CurrentRoom.UserCount, "/", habbo.CurrentRoom.RoomData.UsersMax)); } session.SendNotif(string.Concat("User info for: ", userName, " \rUser ID: ", habbo.Id, ":\rRank: ", habbo.Rank, "\rCurrentTalentLevel: ", habbo.CurrentTalentLevel, " \rCurrent Room: ", habbo.CurrentRoomId, " \rCredits: ", habbo.Credits, "\rDuckets: ", habbo.ActivityPoints, "\rDiamonds: ", habbo.Diamonds, "\rMuted: ", habbo.Muted.ToString(), "\r\r\r", builder.ToString())); return true; }
public override bool Execute(GameClient session, string[] pms) { GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]); if (client == null) { session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found")); return true; } if (client.GetHabbo().Rank >= session.GetHabbo().Rank) { session.SendNotif(Yupi.GetLanguage().GetVar("user_is_higher_rank")); return true; } Yupi.GetGame().GetModerationTool().LogStaffEntry(session.GetHabbo().UserName, client.GetHabbo().UserName, "Ban", "User has received a Machine ban."); Yupi.GetGame().GetBanManager().BanUser(client, session.GetHabbo().UserName, 788922000.0, string.Join(" ", pms.Skip(1)), true, true); return true; }
public override bool Execute(GameClient session, string[] pms) { string userName = pms[0]; if (string.Equals(userName, session.GetHabbo().UserName, StringComparison.CurrentCultureIgnoreCase)) { session.SendNotif(Yupi.GetLanguage().GetVar("summon_yourself")); return true; } GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(userName); if (client == null) { session.SendNotif(Yupi.GetLanguage().GetVar("user_not_found")); return true; } if (session.GetHabbo().CurrentRoom != null && session.GetHabbo().CurrentRoomId != client.GetHabbo().CurrentRoomId) client.GetMessageHandler() .PrepareRoomForUser(session.GetHabbo().CurrentRoom.RoomId, session.GetHabbo().CurrentRoom.RoomData.PassWord); return true; }
public override bool Execute(GameClient session, string[] pms) { foreach ( GameClient client in Yupi.GetGame() .GetClientManager() .Clients.Values.Where(client => client != null && client.GetHabbo() != null)) client.GetHabbo().GetBadgeComponent().GiveBadge(pms[0], true, client); session.SendNotif(Yupi.GetLanguage().GetVar("command_badge_give_done")); Yupi.GetGame() .GetModerationTool() .LogStaffEntry(session.GetHabbo().UserName, "All", "Badge", "Badge [" + pms[0] + "] given to all online users ATM"); return true; }
public override bool Execute(GameClient session, string[] pms) { GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]); if (client == null || client.GetHabbo() == null) { session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found")); return true; } if (client.GetHabbo().Rank >= 4) { session.SendNotif(Yupi.GetLanguage().GetVar("user_is_higher_rank")); } Yupi.GetGame() .GetModerationTool().LogStaffEntry(session.GetHabbo().UserName, client.GetHabbo().UserName, "Mute", "Muted user"); client.GetHabbo().Mute(); return true; }
public override bool Execute(GameClient session, string[] pms) { Room targetRoom = session.GetHabbo().CurrentRoom; DataTable data; using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT question, answer FROM rooms_faq"); data = dbClient.GetTable(); } StringBuilder builder = new StringBuilder(); builder.Append(" - FAQ - \r\r"); foreach (DataRow row in data.Rows) { builder.Append("Q: " + (string) row["question"] + "\r"); builder.Append("A: " + (string) row["answer"] + "\r\r"); } session.SendNotif(builder.ToString()); return true; }
public override 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) return; if (item.ExtraData != "5") { if (item.VikingCotieBurning) return; item.ExtraData = "1"; item.UpdateState(); item.VikingCotieBurning = true; GameClient clientByUsername = Yupi.GetGame().GetClientManager().GetClientByUserName(item.GetRoom().RoomData.Owner); if (clientByUsername != null) { if (clientByUsername.GetHabbo().UserName != item.GetRoom().RoomData.Owner) clientByUsername.SendNotif(string.Format(Yupi.GetLanguage().GetVar("viking_burn_started"), user.GetUserName())); } _mItem = item; Timer timer = new Timer(5000); timer.Elapsed += OnElapse; timer.Enabled = true; } else session.SendNotif(Yupi.GetLanguage().GetVar("user_viking_error")); }
/// <summary> /// Delivers the items. /// </summary> /// <param name="session">The session.</param> /// <param name="item">The item.</param> /// <param name="amount">The amount.</param> /// <param name="extraData">The extra data.</param> /// <param name="limno">The limno.</param> /// <param name="limtot">The limtot.</param> /// <param name="songCode">The song code.</param> /// <returns>List<UserItem>.</returns> internal List<UserItem> DeliverItems(GameClient session, Item item, uint amount, string extraData, uint limno, uint limtot, string songCode) { List<UserItem> list = new List<UserItem>(); if (item.InteractionType == Interaction.PostIt) amount = amount*20; char a = item.Type; switch (a) { case 'i': case 's': int i = 0; while (i < amount) { Interaction interactionType = item.InteractionType; switch (interactionType) { case Interaction.Dimmer: UserItem userItem33 = session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, 0, 0); uint id33 = userItem33.Id; list.Add(userItem33); using (IQueryAdapter queryreactor2 = Yupi.GetDatabaseManager().GetQueryReactor()) queryreactor2.RunFastQuery( $"INSERT INTO items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES ({id33},'0',1,'#000000,255,0','#000000,255,0','#000000,255,0')"); break; case Interaction.Trophy: case Interaction.Bed: case Interaction.PressurePadBed: case Interaction.Guillotine: case Interaction.ScoreBoard: case Interaction.VendingMachine: case Interaction.Alert: case Interaction.OneWayGate: case Interaction.LoveShuffler: case Interaction.HabboWheel: case Interaction.Dice: case Interaction.Bottle: case Interaction.Hopper: case Interaction.Rentals: case Interaction.Pet: case Interaction.Pool: case Interaction.Roller: case Interaction.FootballGate: list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, limno, limtot)); break; case Interaction.Teleport: case Interaction.QuickTeleport: UserItem userItem = session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, "0", 0u, true, false, 0, 0); uint id = userItem.Id; UserItem userItem2 = session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, "0", 0u, true, false, 0, 0); uint id2 = userItem2.Id; list.Add(userItem); list.Add(userItem2); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) queryReactor.RunFastQuery( $"INSERT INTO items_teleports (tele_one_id,tele_two_id) VALUES ('{id}','{id2}');" + $"INSERT INTO items_teleports (tele_one_id,tele_two_id) VALUES ('{id2}','{id}')"); break; case Interaction.PetDog: case Interaction.PetCat: case Interaction.PetCrocodile: case Interaction.PetTerrier: case Interaction.PetBear: case Interaction.PetPig: case Interaction.PetLion: case Interaction.PetRhino: case Interaction.PetSpider: case Interaction.PetTurtle: case Interaction.PetChick: case Interaction.PetFrog: case Interaction.PetDragon: case Interaction.PetHorse: case Interaction.PetMonkey: case Interaction.PetGnomo: case Interaction.PetMonsterPlant: case Interaction.PetWhiteRabbit: case Interaction.PetEvilRabbit: case Interaction.PetLoveRabbit: case Interaction.PetPigeon: case Interaction.PetEvilPigeon: case Interaction.PetDemonMonkey: string[] petData = extraData.Split('\n'); Pet generatedPet = CreatePet(session.GetHabbo().Id, petData[0], item.Name, petData[1], petData[2]); session.GetHabbo().GetInventoryComponent().AddPet(generatedPet); break; case Interaction.MusicDisc: list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, 0, 0, songCode)); break; case Interaction.PuzzleBox: list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, limno, limtot)); break; case Interaction.RoomBg: UserItem userItem44 = session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, 0, 0, string.Empty); uint id44 = userItem44.Id; list.Add(userItem44); using (IQueryAdapter queryreactor3 = Yupi.GetDatabaseManager().GetQueryReactor()) queryreactor3.RunFastQuery($"INSERT INTO items_toners VALUES ({id44},'0',0,0,0)"); break; case Interaction.GuildItem: case Interaction.GuildGate: case Interaction.GroupForumTerminal: list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, "0", Convert.ToUInt32(extraData), true, false, 0, 0, string.Empty)); break; case Interaction.GuildForum: uint groupId; uint.TryParse(extraData, out groupId); Group group = Yupi.GetGame().GetGroupManager().GetGroup(groupId); if (group != null) { if (group.CreatorId == session.GetHabbo().Id) group.UpdateForum(true); else session.SendNotif(Yupi.GetLanguage().GetVar("user_group_owner_error")); } list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, "0", Convert.ToUInt32(extraData), true, false, 0, 0, string.Empty)); break; default: list.Add(session.GetHabbo() .GetInventoryComponent() .AddNewItem(0u, item.Name, extraData, 0u, true, false, limno, limtot)); break; } i++; } return list; case 'e': for (int j = 0; j < amount; j++) session.GetHabbo().GetAvatarEffectsInventoryComponent().AddNewEffect(item.SpriteId, 7200, 0); break; case 'r': RoomBot bot = BotManager.CreateBotFromCatalog(item.Name, session.GetHabbo().Id); session.GetHabbo().GetInventoryComponent().AddBot(bot); session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializeBotInventory()); break; } return list; }
/// <summary> /// Handles the purchase. /// </summary> /// <param name="session">The session.</param> /// <param name="pageId">The page identifier.</param> /// <param name="itemId">The item identifier.</param> /// <param name="extraData">The extra data.</param> /// <param name="priceAmount">The price amount.</param> /// <param name="isGift">if set to <c>true</c> [is gift].</param> /// <param name="giftUser">The gift user.</param> /// <param name="giftMessage">The gift message.</param> /// <param name="giftSpriteId">The gift sprite identifier.</param> /// <param name="giftLazo">The gift lazo.</param> /// <param name="giftColor">Color of the gift.</param> /// <param name="undef">if set to <c>true</c> [undef].</param> /// <param name="theGroup">The theGroup.</param> internal void HandlePurchase(GameClient session, uint pageId, uint itemId, string extraData, uint priceAmount, bool isGift, string giftUser, string giftMessage, int giftSpriteId, int giftLazo, int giftColor, bool undef, uint theGroup) { priceAmount = priceAmount < 1 || priceAmount > 100 ? 1 : priceAmount; uint totalPrice = priceAmount, limitedId = 0, limtot = 0; if (priceAmount >= 6) totalPrice -= Convert.ToUInt32(Math.Ceiling(Convert.ToDouble(priceAmount)/6))*2 - 1; if (!Categories.Contains(pageId)) return; CatalogPage catalogPage = GetPage(pageId); if (catalogPage == null || !catalogPage.Enabled || !catalogPage.Visible || session?.GetHabbo() == null || catalogPage.MinRank > session.GetHabbo().Rank || catalogPage.Layout == "sold_ltd_items") return; CatalogItem item = catalogPage.GetItem(itemId); if (item == null || session.GetHabbo().Credits < item.CreditsCost || session.GetHabbo().Duckets < item.DucketsCost || session.GetHabbo().Diamonds < item.DiamondsCost || item.Name == "room_ad_plus_badge") return; #region Habbo Club Purchase if (catalogPage.Layout == "vip_buy" || catalogPage.Layout == "club_buy" || HabboClubItems.Contains(item)) { string[] array = item.Name.Split('_'); double dayLength = 31; if (item.Name.Contains("DAY")) dayLength = double.Parse(array[3]); else if (item.Name.Contains("MONTH")) dayLength = Math.Ceiling(double.Parse(array[3])*31 - 0.205); else if (item.Name.Contains("YEAR")) dayLength = double.Parse(array[3])*31*12; session.GetHabbo().GetSubscriptionManager().AddSubscription(dayLength); if (item.CreditsCost > 0) { session.GetHabbo().Credits -= item.CreditsCost*totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0) { session.GetHabbo().Duckets -= item.DucketsCost*totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0) { session.GetHabbo().Diamonds -= item.DiamondsCost*totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } return; } #endregion #region Is Only for Habbo Club users Check if (item.ClubOnly && !session.GetHabbo().GetSubscriptionManager().HasSubscription) { ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("CatalogPurchaseNotAllowedMessageComposer")); serverMessage.AppendInteger(1); session.SendMessage(serverMessage); return; } #endregion #region Limited Items Purchase if (item.IsLimited) { totalPrice = 1; priceAmount = 1; if (item.LimitedSelled >= item.LimitedStack) { session.SendMessage(new ServerMessage(LibraryParser.OutgoingRequest("CatalogLimitedItemSoldOutMessageComposer"))); return; } item.LimitedSelled++; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.RunFastQuery(string.Concat("UPDATE catalog_items SET limited_sells = ", item.LimitedSelled, " WHERE id = ", item.Id)); limitedId = item.LimitedSelled; limtot = item.LimitedStack; } } else if (isGift && priceAmount > 1) { totalPrice = 1; priceAmount = 1; } #endregion uint toUserId = 0u; if (session.GetHabbo().Credits < item.CreditsCost*totalPrice || session.GetHabbo().Duckets < item.DucketsCost * totalPrice || session.GetHabbo().Diamonds < item.DiamondsCost * totalPrice) return; #region Decrease User Balance with Item Cost if (!isGift) { if (item.CreditsCost > 0) { session.GetHabbo().Credits -= item.CreditsCost*totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0) { session.GetHabbo().Duckets -= item.DucketsCost*totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0) { session.GetHabbo().Diamonds -= item.DiamondsCost*totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } } #endregion foreach (Item baseItem in item.Items.Keys) { #region Stack if Gift if (isGift) { if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { session.SendNotif(Yupi.GetLanguage().GetVar("user_send_gift")); return; } if (!baseItem.AllowGift) return; DataRow row; using (IQueryAdapter queryreactor3 = Yupi.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(LibraryParser.OutgoingRequest("GiftErrorMessageComposer")); session.GetMessageHandler().GetResponse().AppendString(giftUser); session.GetMessageHandler().SendResponse(); return; } toUserId = (uint) row["id"]; if (toUserId == 0u) { session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer")); session.GetMessageHandler().GetResponse().AppendString(giftUser); session.GetMessageHandler().SendResponse(); return; } if (item.CreditsCost > 0) { session.GetHabbo().Credits -= item.CreditsCost*totalPrice; session.GetHabbo().UpdateCreditsBalance(); } if (item.DucketsCost > 0) { session.GetHabbo().Duckets -= item.DucketsCost*totalPrice; session.GetHabbo().UpdateActivityPointsBalance(); } if (item.DiamondsCost > 0) { session.GetHabbo().Diamonds -= item.DiamondsCost*totalPrice; session.GetHabbo().UpdateSeasonalCurrencyBalance(); } if (baseItem.Type == 'e') { session.SendNotif(Yupi.GetLanguage().GetVar("user_send_gift_effect")); return; } } #endregion #region Item is Builders Club Addon if (item.Name.StartsWith("builders_club_addon_")) { int furniAmount = int.Parse(item.Name.Replace("builders_club_addon_", string.Empty).Replace("furnis", string.Empty)); session.GetHabbo().BuildersItemsMax += furniAmount; ServerMessage update = new ServerMessage(LibraryParser.OutgoingRequest("BuildersClubMembershipMessageComposer")); update.AppendInteger(session.GetHabbo().BuildersExpire); update.AppendInteger(session.GetHabbo().BuildersItemsMax); update.AppendInteger(2); session.SendMessage(update); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE users SET builders_items_max = @max WHERE id = @userId"); queryReactor.AddParameter("max", session.GetHabbo().BuildersItemsMax); queryReactor.AddParameter("userId", session.GetHabbo().Id); queryReactor.RunQuery(); } session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); session.SendNotif("${notification.builders_club.membership_extended.message}", "${notification.builders_club.membership_extended.title}", "builders_club_membership_extended"); return; } #endregion #region Item is Builders Club Upgrade if (item.Name.StartsWith("builders_club_time_")) { int timeAmount = int.Parse(item.Name.Replace("builders_club_time_", string.Empty).Replace("seconds", string.Empty)); session.GetHabbo().BuildersExpire += timeAmount; ServerMessage update = new ServerMessage(LibraryParser.OutgoingRequest("BuildersClubMembershipMessageComposer")); update.AppendInteger(session.GetHabbo().BuildersExpire); update.AppendInteger(session.GetHabbo().BuildersItemsMax); update.AppendInteger(2); session.SendMessage(update); using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE users SET builders_expire = @max WHERE id = @userId"); queryReactor.AddParameter("max", session.GetHabbo().BuildersExpire); queryReactor.AddParameter("userId", session.GetHabbo().Id); queryReactor.RunQuery(); } session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); session.SendNotif("${notification.builders_club.membership_extended.message}", "${notification.builders_club.membership_extended.title}", "builders_club_membership_extended"); return; } #endregion string text = string.Empty; #region Interaction Type Selection Interaction interactionType = baseItem.InteractionType; switch (interactionType) { case Interaction.None: case Interaction.Gate: case Interaction.Bed: case Interaction.PressurePadBed: case Interaction.Guillotine: case Interaction.HcGate: case Interaction.ScoreBoard: case Interaction.VendingMachine: case Interaction.Alert: case Interaction.OneWayGate: case Interaction.LoveShuffler: case Interaction.HabboWheel: case Interaction.Dice: case Interaction.Bottle: case Interaction.Hopper: case Interaction.Teleport: case Interaction.QuickTeleport: case Interaction.Pet: case Interaction.Pool: case Interaction.Roller: break; case Interaction.PostIt: extraData = "FFFF33"; break; case Interaction.RoomEffect: double number = string.IsNullOrEmpty(extraData) ? 0.0 : double.Parse(extraData, Yupi.CultureInfo); extraData = number.ToString(CultureInfo.InvariantCulture).Replace(',', '.'); break; case Interaction.Dimmer: extraData = "1,1,1,#000000,255"; break; case Interaction.Trophy: extraData = string.Concat(session.GetHabbo().UserName, Convert.ToChar(9), DateTime.Now.Day.ToString("00"), "-", DateTime.Now.Month.ToString("00"), "-", DateTime.Now.Year, Convert.ToChar(9), extraData); break; case Interaction.Rentals: extraData = item.ExtraData; break; case Interaction.PetDog: case Interaction.PetCat: case Interaction.PetCrocodile: case Interaction.PetTerrier: case Interaction.PetBear: case Interaction.PetPig: case Interaction.PetLion: case Interaction.PetRhino: case Interaction.PetSpider: case Interaction.PetTurtle: case Interaction.PetChick: case Interaction.PetFrog: case Interaction.PetDragon: case Interaction.PetHorse: case Interaction.PetMonkey: case Interaction.PetGnomo: case Interaction.PetMonsterPlant: case Interaction.PetWhiteRabbit: case Interaction.PetEvilRabbit: case Interaction.PetLoveRabbit: case Interaction.PetCafeRabbit: case Interaction.PetPigeon: case Interaction.PetEvilPigeon: case Interaction.PetDemonMonkey: string[] data = extraData.Split('\n'); string petName = data[0]; string race = data[1]; string color = data[2]; if (!CheckPetName(petName) || (race.Length != 1 && race.Length != 2) || color.Length != 6) return; break; case Interaction.Mannequin: extraData = string.Concat("m", Convert.ToChar(5), "lg-270-82.ch-210-66", Convert.ToChar(5), "Mannequin"); break; case Interaction.VipGate: case Interaction.MysteryBox: case Interaction.YoutubeTv: case Interaction.TileStackMagic: case Interaction.Tent: case Interaction.BedTent: break; case Interaction.BadgeDisplay: if (!session.GetHabbo().GetBadgeComponent().HasBadge(extraData)) extraData = "UMAD"; extraData = $"{extraData}|{session.GetHabbo().UserName}|{DateTime.Now.Day.ToString("00")}-{DateTime.Now.Month.ToString("00")}-{DateTime.Now.Year}"; break; case Interaction.FootballGate: extraData = "hd-99999-99999.lg-270-62;hd-99999-99999.ch-630-62.lg-695-62"; break; case Interaction.LoveLock: extraData = "0"; break; case Interaction.Pinata: case Interaction.RunWaySage: case Interaction.Shower: extraData = "0"; break; case Interaction.GroupForumTerminal: case Interaction.GuildItem: case Interaction.GuildGate: case Interaction.GuildForum: case Interaction.Poster: break; case Interaction.Moplaseed: extraData = new Random().Next(0, 12).ToString(); break; case Interaction.RareMoplaSeed: extraData = new Random().Next(10, 12).ToString(); break; case Interaction.MusicDisc: SongData song = SoundMachineSongManager.GetSongById(item.SongId); extraData = string.Empty; if (song == null) break; extraData = string.Concat(session.GetHabbo().UserName, '\n', DateTime.Now.Year, '\n', DateTime.Now.Month, '\n', DateTime.Now.Day, '\n', song.LengthSeconds, '\n', song.Name); text = song.CodeName; break; default: extraData = item.ExtraData; break; } #endregion session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateInventoryMessageComposer")); session.GetMessageHandler().SendResponse(); session.SendMessage(CatalogPageComposer.PurchaseOk(item, item.Items)); if (isGift) { Item itemBySprite = Yupi.GetGame().GetItemManager().GetItemBySpriteId(giftSpriteId); if (itemBySprite == null) return; uint insertId; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("INSERT INTO items_rooms (item_name,user_id) VALUES (" + itemBySprite.Name + ", " + toUserId + ")"); insertId = (uint) queryReactor.InsertQuery(); queryReactor.SetQuery( string.Concat( "INSERT INTO users_gifts (gift_id,item_id,extradata,giver_name,Message,ribbon,color,gift_sprite,show_sender,rare_id) VALUES (", insertId, ", ", baseItem.ItemId, ",@extradata, @name, @Message,", giftLazo, ",", giftColor, ",", giftSpriteId, ",", undef ? 1 : 0, ",", limitedId, ")")); queryReactor.AddParameter("extradata", extraData); queryReactor.AddParameter("name", giftUser); queryReactor.AddParameter("message", giftMessage); queryReactor.RunQuery(); if (session.GetHabbo().Id != toUserId) { Yupi.GetGame() .GetAchievementManager() .ProgressUserAchievement(session, "ACH_GiftGiver", 1, true); queryReactor.RunFastQuery( "UPDATE users_stats SET gifts_given = gifts_given + 1 WHERE id = " + session.GetHabbo().Id + ";UPDATE users_stats SET gifts_received = gifts_received + 1 WHERE id = " + toUserId); } } GameClient clientByUserId = Yupi.GetGame().GetClientManager().GetClientByUserId(toUserId); if (clientByUserId != null) { clientByUserId.GetHabbo() .GetInventoryComponent() .AddNewItem(insertId, itemBySprite.Name, string.Concat(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) Yupi.GetGame() .GetAchievementManager() .ProgressUserAchievement(clientByUserId, "ACH_GiftReceiver", 1, true); } session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; continue; } session.GetMessageHandler() .GetResponse() .Init(LibraryParser.OutgoingRequest("NewInventoryObjectMessageComposer")); session.GetMessageHandler().GetResponse().AppendInteger(1); int i = 1; if (baseItem.Type == 's') i = InteractionTypes.AreFamiliar(GlobalInteractions.Pet, baseItem.InteractionType) ? 3 : 1; session.GetMessageHandler().GetResponse().AppendInteger(i); List<UserItem> list = DeliverItems(session, baseItem, priceAmount*item.Items[baseItem], extraData, limitedId, limtot, text); session.GetMessageHandler().GetResponse().AppendInteger(list.Count); foreach (UserItem current3 in list) session.GetMessageHandler().GetResponse().AppendInteger(current3.Id); session.GetMessageHandler().SendResponse(); session.GetHabbo().GetInventoryComponent().UpdateItems(false); if (InteractionTypes.AreFamiliar(GlobalInteractions.Pet, baseItem.InteractionType)) session.SendMessage(session.GetHabbo().GetInventoryComponent().SerializePetInventory()); } if (item.Badge.Length >= 1) session.GetHabbo().GetBadgeComponent().GiveBadge(item.Badge, true, session); }
public override bool Execute(GameClient session, string[] pms) { Yupi.GetGame().GetAchievementManager().LoadAchievements(Yupi.GetDatabaseManager().GetQueryReactor()); session.SendNotif(Yupi.GetLanguage().GetVar("command_refresh_achievements")); return true; }
/// <summary> /// Creates the room. /// </summary> /// <param name="session">The session.</param> /// <param name="name">The name.</param> /// <param name="desc">The desc.</param> /// <param name="model">The model.</param> /// <param name="category">The category.</param> /// <param name="maxVisitors">The maximum visitors.</param> /// <param name="tradeState">State of the trade.</param> /// <returns>RoomData.</returns> internal RoomData CreateRoom(GameClient session, string name, string desc, string model, int category, int maxVisitors, int tradeState) { if (!_roomModels.Contains(model)) { session.SendNotif(Yupi.GetLanguage().GetVar("user_room_model_error")); return null; } uint roomId; using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO rooms_data (roomtype,caption,description,owner,model_name,category,users_max,trade_state) VALUES ('private',@caption,@desc,@UserId,@model,@cat,@usmax,@tstate)"); dbClient.AddParameter("caption", name); dbClient.AddParameter("desc", desc); dbClient.AddParameter("UserId", session.GetHabbo().Id); dbClient.AddParameter("model", model); dbClient.AddParameter("cat", category); dbClient.AddParameter("usmax", maxVisitors); dbClient.AddParameter("tstate", tradeState.ToString()); roomId = (uint) dbClient.InsertQuery(); } RoomData data = GenerateRoomData(roomId); if (data == null) return null; session.GetHabbo().UsersRooms.Add(data); return data; }
public static void SaveWired(GameClient session, RoomItem item, ClientMessage request) { if (item == null || !item.IsWired) return; Room room = item.GetRoom(); WiredHandler wiredHandler = room?.GetWiredHandler(); if (wiredHandler == null) return; switch (item.GetBaseItem().InteractionType) { case Interaction.TriggerTimer: { request.GetInteger(); IWiredItem wired = wiredHandler.GetWired(item); int delay = request.GetInteger()*500; wired.Delay = delay; wiredHandler.ReloadWired(wired); break; } case Interaction.TriggerRoomEnter: { request.GetInteger(); string otherString = request.GetString(); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherString = otherString; wiredHandler.ReloadWired(wired); break; } case Interaction.TriggerLongRepeater: { request.GetInteger(); int delay = request.GetInteger()*5000; IWiredItem wired2 = wiredHandler.GetWired(item); wired2.Delay = delay; wiredHandler.ReloadWired(wired2); break; } case Interaction.TriggerRepeater: { request.GetInteger(); int delay = request.GetInteger()*500; IWiredItem wired2 = wiredHandler.GetWired(item); wired2.Delay = delay; wiredHandler.ReloadWired(wired2); break; } case Interaction.TriggerOnUserSay: { request.GetInteger(); int num = request.GetInteger(); string otherString2 = request.GetString(); IWiredItem wired3 = wiredHandler.GetWired(item); wired3.OtherString = otherString2; wired3.OtherBool = num == 1; wiredHandler.ReloadWired(wired3); break; } case Interaction.TriggerStateChanged: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); int num2 = request.GetInteger(); IWiredItem wired4 = wiredHandler.GetWired(item); wired4.Delay = num2*500; wired4.Items = furniItems; wiredHandler.ReloadWired(wired4); break; } case Interaction.TriggerWalkOnFurni: case Interaction.ActionChase: case Interaction.ActionResetTimer: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems2 = GetFurniItems(request, room); int num3 = request.GetInteger(); IWiredItem wired5 = wiredHandler.GetWired(item); wired5.Delay = num3*500; wired5.Items = furniItems2; wiredHandler.ReloadWired(wired5); break; } case Interaction.TriggerWalkOffFurni: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems3 = GetFurniItems(request, room); int num4 = request.GetInteger(); IWiredItem wired6 = wiredHandler.GetWired(item); wired6.Delay = num4*500; wired6.Items = furniItems3; wiredHandler.ReloadWired(wired6); break; } case Interaction.ActionMoveRotate: case Interaction.ActionMoveToDir: { request.GetInteger(); int dir = request.GetInteger(); int rot = request.GetInteger(); request.GetString(); List<RoomItem> furniItems4 = GetFurniItems(request, room); int delay = request.GetInteger(); IWiredItem wired7 = wiredHandler.GetWired(item); wired7.Items = furniItems4; wired7.Delay = delay*500; wired7.OtherString = $"{dir};{rot}"; wiredHandler.ReloadWired(wired7); break; } case Interaction.ActionShowMessage: case Interaction.ActionKickUser: { request.GetInteger(); string otherString3 = request.GetString(); IWiredItem wired8 = wiredHandler.GetWired(item); wired8.OtherString = otherString3; wiredHandler.ReloadWired(wired8); break; } case Interaction.ActionTeleportTo: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems5 = GetFurniItems(request, room); int num8 = request.GetInteger(); IWiredItem wired9 = wiredHandler.GetWired(item); wired9.Items = furniItems5; wired9.Delay = num8*500; wiredHandler.ReloadWired(wired9); break; } case Interaction.ActionToggleState: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems6 = GetFurniItems(request, room); int num9 = request.GetInteger(); IWiredItem wired10 = wiredHandler.GetWired(item); wired10.Items = furniItems6; wired10.Delay = num9*500; wiredHandler.ReloadWired(wired10); break; } case Interaction.ActionGiveReward: { if (!session.GetHabbo().HasFuse("fuse_use_superwired")) return; request.GetInteger(); int often = request.GetInteger(); bool unique = request.GetIntegerAsBool(); int limit = request.GetInteger(); request.GetInteger(); string extrainfo = request.GetString(); List<RoomItem> furniItems7 = GetFurniItems(request, room); IWiredItem wired11 = wiredHandler.GetWired(item); wired11.Items = furniItems7; wired11.Delay = 0; wired11.OtherBool = unique; wired11.OtherString = extrainfo; wired11.OtherExtraString = often.ToString(); wired11.OtherExtraString2 = limit.ToString(); wiredHandler.ReloadWired(wired11); break; } case Interaction.ActionMuteUser: { request.GetInteger(); int minutes = request.GetInteger()*500; string message = request.GetString(); List<RoomItem> furniItems7 = GetFurniItems(request, room); IWiredItem wired11 = wiredHandler.GetWired(item); wired11.Items = furniItems7; wired11.Delay = minutes; wired11.OtherBool = false; wired11.OtherString = message; wiredHandler.ReloadWired(wired11); break; } case Interaction.TriggerScoreAchieved: { request.GetInteger(); int pointsRequired = request.GetInteger(); IWiredItem wired11 = wiredHandler.GetWired(item); wired11.Delay = 0; wired11.OtherString = pointsRequired.ToString(); wiredHandler.ReloadWired(wired11); break; } case Interaction.ConditionItemsMatches: case Interaction.ConditionItemsDontMatch: case Interaction.ActionPosReset: { request.GetInteger(); bool actualExtraData = request.GetIntegerAsBool(); bool actualRot = request.GetIntegerAsBool(); bool actualPosition = request.GetIntegerAsBool(); string booleans = $"{actualExtraData},{actualRot},{actualPosition}".ToLower(); request.GetString(); List<RoomItem> items = GetFurniItems(request, room); int delay = request.GetInteger()*500; IWiredItem wiry = wiredHandler.GetWired(item); string dataToSave = string.Empty; string extraStringForWi = string.Empty; foreach (RoomItem aItem in items) { if (aItem.GetBaseItem().InteractionType == Interaction.Dice) { // Why have a RETURN here? dataToSave += string.Format("0|0|0|0,0,0", aItem.Id, aItem.ExtraData, aItem.Rot, aItem.X, aItem.Y, aItem.Z); extraStringForWi += $"{aItem.Id},{(actualExtraData ? aItem.ExtraData : "N")},{(actualRot ? aItem.Rot.ToString() : "N")},{(actualPosition ? aItem.X.ToString() : "N")},{(actualPosition ? aItem.Y.ToString() : "N")}"; return; } dataToSave += $"{aItem.Id}|{aItem.ExtraData}|{aItem.Rot}|{aItem.X},{aItem.Y},{aItem.Z}"; extraStringForWi += $"{aItem.Id},{(actualExtraData ? aItem.ExtraData : "N")},{(actualRot ? aItem.Rot.ToString() : "N")},{(actualPosition ? aItem.X.ToString() : "N")},{(actualPosition ? aItem.Y.ToString() : "N")}"; if (aItem == items.Last()) continue; 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 Interaction.ConditionGroupMember: case Interaction.ConditionNotGroupMember: case Interaction.TriggerCollision: { break; } case Interaction.ConditionHowManyUsersInRoom: case Interaction.ConditionNegativeHowManyUsers: { request.GetInteger(); int minimum = request.GetInteger(); int maximum = request.GetInteger(); string ei = $"{minimum},{maximum}"; IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = new List<RoomItem>(); wired12.OtherString = ei; wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionUserNotWearingEffect: case Interaction.ConditionUserWearingEffect: { request.GetInteger(); int effect = request.GetInteger(); IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = new List<RoomItem>(); wired12.OtherString = effect.ToString(); wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionUserWearingBadge: case Interaction.ConditionUserNotWearingBadge: case Interaction.ConditionUserHasFurni: { request.GetInteger(); string badge = request.GetString(); IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = new List<RoomItem>(); wired12.OtherString = badge; wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionDateRangeActive: { request.GetInteger(); int startDate = request.GetInteger(); int endDate = request.GetInteger(); IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = new List<RoomItem>(); wired12.OtherString = $"{startDate},{endDate}"; if (startDate == 0) { wired12.OtherString = string.Empty; session.SendNotif(Yupi.GetLanguage().GetVar("user_wired_con_date_range")); } wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionFurnisHaveUsers: case Interaction.ConditionTriggerOnFurni: case Interaction.ConditionFurniTypeMatches: case Interaction.ConditionFurnisHaveNotUsers: case Interaction.ConditionTriggererNotOnFurni: case Interaction.ConditionFurniTypeDontMatch: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = furniItems; wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionFurniHasFurni: case Interaction.ConditionFurniHasNotFurni: { request.GetInteger(); bool allItems = request.GetIntegerAsBool(); request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherBool = allItems; wired.Items = furniItems; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionGiveScore: { request.GetInteger(); int scoreToGive = request.GetInteger(); int maxTimesPerGame = request.GetInteger(); string newExtraInfo = $"{scoreToGive},{maxTimesPerGame}"; List<RoomItem> furniItems8 = GetFurniItems(request, room); IWiredItem wired12 = wiredHandler.GetWired(item); wired12.Items = furniItems8; wired12.OtherString = newExtraInfo; wiredHandler.ReloadWired(wired12); break; } case Interaction.ActionJoinTeam: { request.GetInteger(); int team = request.GetInteger(); IWiredItem wired = wiredHandler.GetWired(item); wired.Delay = team*500; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotTalk: { request.GetInteger(); bool type = request.GetIntegerAsBool(); string[] data = request.GetString().Split((char) 9); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherBool = type; wired.OtherString = data[0]; wired.OtherExtraString = data[1]; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotClothes: { request.GetInteger(); string[] data = request.GetString().Split((char) 9); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherString = data[0]; wired.OtherExtraString = data[1]; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotTeleport: { request.GetInteger(); string botName = request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); IWiredItem wired = wiredHandler.GetWired(item); wired.Items = furniItems; wired.OtherString = botName; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotGiveHanditem: { request.GetInteger(); int handitem = request.GetInteger(); string botName = request.GetString(); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherString = botName; wired.Delay = handitem*500; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotMove: { request.GetInteger(); string botName = request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); IWiredItem wired = wiredHandler.GetWired(item); wired.Items = furniItems; wired.OtherString = botName; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionCallStacks: { request.GetInteger(); request.GetString(); List<RoomItem> furniItems = GetFurniItems(request, room); IWiredItem wired = wiredHandler.GetWired(item); int num = request.GetInteger(); wired.Items = furniItems; wired.Delay = num*500; wiredHandler.ReloadWired(wired); break; } case Interaction.ActionBotTalkToAvatar: { request.GetInteger(); bool type = request.GetIntegerAsBool(); string[] data = request.GetString().Split((char) 9); IWiredItem wired = wiredHandler.GetWired(item); wired.OtherBool = type; wired.OtherString = data[0]; wired.OtherExtraString = data[1]; wiredHandler.ReloadWired(wired); break; } case Interaction.ConditionTimeMoreThan: case Interaction.ConditionTimeLessThan: { request.GetInteger(); int time = request.GetInteger(); IWiredItem wired12 = wiredHandler.GetWired(item); Console.WriteLine(time); wired12.Delay = time*500; wiredHandler.ReloadWired(wired12); break; } case Interaction.ConditionUserHasHanditem: { request.GetInteger(); int handitem = request.GetInteger(); IWiredItem wired = wiredHandler.GetWired(item); wired.Delay = handitem*500; wiredHandler.ReloadWired(wired); break; } } session.SendMessage(new ServerMessage(LibraryParser.OutgoingRequest("SaveWiredMessageComposer"))); }
public void AddUserVideo(GameClient client, string video) { if (client != null) { Match youtubeMatch = YoutubeVideoRegex.Match(video); string id; string videoName; if (youtubeMatch.Success) { id = youtubeMatch.Groups[1].Value; videoName = GetTitleById(id); if (string.IsNullOrEmpty(videoName)) { client.SendWhisper("This Youtube Video doesn't Exists"); return; } } else { client.SendWhisper("This Youtube Url is Not Valid"); return; } UserId = client.GetHabbo().Id; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery( "INSERT INTO users_videos_youtube (user_id, video_id, name, description) VALUES (@user_id, @video_id, @name, @name)"); queryReactor.AddParameter("user_id", UserId); queryReactor.AddParameter("video_id", id); queryReactor.AddParameter("name", videoName); queryReactor.RunQuery(); } RefreshVideos(); client.SendNotif("Youtube Video Added Sucessfully!"); } }