internal static void AlertUser(GameClient ModSession, uint UserId, String Message, Boolean Caution) { GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (Caution && Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif(LanguageLocale.GetValue("moderation.caution.missingrank")); Caution = false; } Client.SendNotif(Message, Caution); if (Caution) { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId + ""); } } }
internal static void BanUser(GameClient ModSession, uint UserId, int Length, String Message) { GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif(LanguageLocale.GetValue("moderation.ban.missingrank")); return; } Double dLength = Length; PiciEnvironment.GetGame().GetBanManager().BanUser(Client, ModSession.GetHabbo().Username, dLength, Message, false); }
internal bool SetWallItem(GameClient Session, RoomItem Item) { if (!Item.IsWallItem || mWallItems.ContainsKey(Item.Id)) return false; if (mFloorItems.ContainsKey(Item.Id)) { Session.SendNotif(LanguageLocale.GetValue("room.itemplaced")); return true; } Item.Interactor.OnPlace(Session, Item); if (Item.GetBaseItem().InteractionType == InteractionType.dimmer) { if (room.MoodlightData == null) { room.MoodlightData = new MoodlightData(Item.Id); Item.ExtraData = room.MoodlightData.GenerateExtraData(); } } mWallItems.Add(Item.Id, Item); AddItem(Item); ServerMessage Message = new ServerMessage(83); Item.Serialize(Message); room.SendMessage(Message); return true; }
internal bool SetFloorItem(GameClient Session, RoomItem Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses) { bool NeedsReAdd = false; if (!newItem) NeedsReAdd = room.GetGameMap().RemoveFromMap(Item); Dictionary<int, ThreeDCoord> AffectedTiles = Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot); if (!room.GetGameMap().ValidTile(newX, newY) || room.GetGameMap().SquareHasUsers(newX, newY)) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } foreach (ThreeDCoord Tile in AffectedTiles.Values) { if (!room.GetGameMap().ValidTile(Tile.X, Tile.Y) || room.GetGameMap().SquareHasUsers(Tile.X, Tile.Y)) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } } // Start calculating new Z coordinate Double newZ = room.GetGameMap().Model.SqFloorHeight[newX, newY]; if (!OnRoller) { // Is the item trying to stack on itself!? //if (Item.Rot == newRot && Item.GetX == newX && Item.GetY == newY && Item.GetZ != newZ) //{ // if (NeedsReAdd) // AddItem(Item); // return false; //} // Make sure this tile is open and there are no users here if (room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } foreach (ThreeDCoord Tile in AffectedTiles.Values) { if (room.GetGameMap().Model.SqState[Tile.X, Tile.Y] != SquareState.OPEN) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } } // And that we have no users if (!Item.GetBaseItem().IsSeat && !Item.IsRoller) { foreach (ThreeDCoord Tile in AffectedTiles.Values) { if (room.GetGameMap().GetRoomUsers(new Point(Tile.X, Tile.Y)).Count > 0) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } } } } // Find affected objects List<RoomItem> ItemsOnTile = GetFurniObjects(newX, newY); List<RoomItem> ItemsAffected = new List<RoomItem>(); List<RoomItem> ItemsComplete = new List<RoomItem>(); foreach (ThreeDCoord Tile in AffectedTiles.Values) { List<RoomItem> Temp = GetFurniObjects(Tile.X, Tile.Y); if (Temp != null) { ItemsAffected.AddRange(Temp); } } ItemsComplete.AddRange(ItemsOnTile); ItemsComplete.AddRange(ItemsAffected); if (!OnRoller) { // Check for items in the stack that do not allow stacking on top of them foreach (RoomItem I in ItemsComplete) { if (I == null) continue; if (I.Id == Item.Id) { continue; } if (I.GetBaseItem() == null) continue; if (!I.GetBaseItem().Stackable) { if (NeedsReAdd) { AddItem(Item); room.GetGameMap().AddToMap(Item); } return false; } } } //if (!Item.IsRoller) { // If this is a rotating action, maintain item at current height if (Item.Rot != newRot && Item.GetX == newX && Item.GetY == newY) { newZ = Item.GetZ; } // Are there any higher objects in the stack!? foreach (RoomItem I in ItemsComplete) { if (I.Id == Item.Id) { continue; // cannot stack on self } if (I.TotalHeight > newZ) { newZ = I.TotalHeight; } } } // Verify the rotation is correct if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8) { newRot = 0; } //Item.GetX = newX; //Item.GetY = newY; //Item.GetZ = newZ; Item.Rot = newRot; int oldX = Item.GetX; int oldY = Item.GetY; Item.SetState(newX, newY, newZ, AffectedTiles); if (!OnRoller && Session != null) Item.Interactor.OnPlace(Session, Item); if (newItem) { if (mFloorItems.ContainsKey(Item.Id)) { if (Session != null) Session.SendNotif(LanguageLocale.GetValue("room.itemplaced")); //Remove from map!!! return true; } //using (DatabaseClient dbClient = PiciEnvironment.GetDatabase().GetClient()) //{ // dbClient.addParameter("extra_data", Item.ExtraData); // dbClient.runFastQuery("INSERT INTO room_items (id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('" + Item.Id + "','" + RoomId + "','" + Item.BaseItem + "',@extra_data,'" + Item.GetX + "','" + Item.GetY + "','" + Item.GetZ + "','" + Item.Rot + "','')"); //} //if (mRemovedItems.ContainsKey(Item.Id)) // mRemovedItems.Remove(Item.Id); //if (mAddedItems.ContainsKey(Item.Id)) // return false; //mAddedItems.Add(Item.Id, Item); if (Item.IsFloorItem && !mFloorItems.ContainsKey(Item.Id)) mFloorItems.Add(Item.Id, Item); else if (Item.IsWallItem && !mWallItems.ContainsKey(Item.Id)) mWallItems.Add(Item.Id, Item); AddItem(Item); if (sendMessage) { ServerMessage Message = new ServerMessage(93); Item.Serialize(Message); room.SendMessage(Message); } } else { //using (DatabaseClient dbClient = PiciEnvironment.GetDatabase().GetClient()) //{ // dbClient.runFastQuery("UPDATE room_items SET x = '" + Item.GetX + "', y = '" + Item.GetY + "', z = '" + Item.GetZ + "', rot = '" + Item.Rot + "', wall_pos = '' WHERE id = '" + Item.Id + "' LIMIT 1"); //} UpdateItem(Item); if (!OnRoller && sendMessage) { ServerMessage Message = new ServerMessage(95); Item.Serialize(Message); room.SendMessage(Message); } } if (!newItem) { room.GetWiredHandler().RemoveWiredItem(new System.Drawing.Point(oldX, oldY)); if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType)) { room.GetWiredHandler().AddWire(Item, new System.Drawing.Point(newX, newY), newRot, Item.GetBaseItem().InteractionType); } } else { if (WiredHandler.TypeIsWire(Item.GetBaseItem().InteractionType)) { room.GetWiredHandler().AddWire(Item, Item.Coordinate, newRot, Item.GetBaseItem().InteractionType); } } //GenerateMaps(false); room.GetGameMap().AddToMap(Item); if (updateRoomUserStatuses) room.GetRoomUserManager().UpdateUserStatusses(); return true; }
internal RoomData CreateRoom(GameClient Session, string Name, string Model) { Name = PiciEnvironment.FilterInjectionChars(Name); if (!roomModels.ContainsKey(Model)) { Session.SendNotif(LanguageLocale.GetValue("room.modelmissing")); return null; } Console.WriteLine("ClubOnly: " + ((RoomModel)roomModels[Model]).ClubOnly + ""); if (((RoomModel)roomModels[Model]).ClubOnly == 1 && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) { Session.SendNotif(LanguageLocale.GetValue("room.missingclub")); return null; } if (Name.Length < 3) { Session.SendNotif(LanguageLocale.GetValue("room.namelengthshort")); return null; } UInt32 RoomId = 0; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == DatabaseType.MSSQL)//description,public_ccts,tags,password dbClient.setQuery("INSERT INTO rooms (roomtype,caption,owner,model_name,description,public_ccts,tags,password) OUTPUT INSERTED.* VALUES ('private',@caption,@username,@model,'','','','')"); else dbClient.setQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)"); dbClient.addParameter("caption", Name); dbClient.addParameter("model", Model); dbClient.addParameter("username", Session.GetHabbo().Username); RoomId = (UInt32)dbClient.insertQuery(); } RoomData newRoomData = GenerateRoomData(RoomId); Session.GetHabbo().UsersRooms.Add(newRoomData); return newRoomData; }
// PENDING REWRITE internal void BanUser(GameClient Client, string Moderator, Double LengthSeconds, string Reason, Boolean IpBan) { ModerationBanType Type = ModerationBanType.USERNAME; string Var = Client.GetHabbo().Username; string RawVar = "user"; Double Expire = PiciEnvironment.GetUnixTimestamp() + LengthSeconds; if (Reason == null) { Client.SendNotif("Please fill in a reason to ban a user."); return; } if (IpBan) { Type = ModerationBanType.IP; Var = Client.GetConnection().getIp(); RawVar = "ip"; } ModerationBan ban = new ModerationBan(Type, Var, Reason, Expire); if (ban.Type == ModerationBanType.IP) { if (bannedIPs.ContainsKey(Var)) bannedIPs[Var] = ban; else bannedIPs.Add(Var, ban); } else { if (bannedUsernames.ContainsKey(Var)) bannedUsernames[Var] = ban; else bannedUsernames.Add(Var, ban); } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'" + Expire + "',@mod,'" + DateTime.Now.ToLongDateString() + "')"); dbClient.addParameter("rawvar", RawVar); dbClient.addParameter("var", Var); dbClient.addParameter("reason", Reason); dbClient.addParameter("mod", Moderator); dbClient.runQuery(); } if (IpBan) { DataTable UsersAffected = null; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE ip_last = @var"); dbClient.addParameter("var", Var); UsersAffected = dbClient.getTable(); } if (UsersAffected != null) { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { foreach (DataRow Row in UsersAffected.Rows) { dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Convert.ToUInt32(Row["id"])); } } } BanUser(Client, Moderator, LengthSeconds, Reason, false); } else { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Client.GetHabbo().Id); } Client.SendBanMessage(LanguageLocale.GetValue("moderation.banned") + " " + Reason); Client.Disconnect(); } }
internal void HandleRowchase(GameClient Session, int PageId, uint ItemId, string ExtraData, Boolean IsGift, string GiftUser, string GiftMessage) { CatalogPage Page; if (!Pages.TryGetValue(PageId, out Page)) return; if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible || Session == null || Session.GetHabbo() == null) { return; } if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { return; } if (Page.MinRank > Session.GetHabbo().Rank) { return; } CatalogItem Item = Page.GetItem(ItemId); if (Item == null) { return; } uint GiftUserId = 0; if (IsGift) { if (!Item.GetBaseItem().AllowGift) { return; } DataRow dRow; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE username = @gift_user"); dbClient.addParameter("gift_user", GiftUser); dRow = dbClient.getRow(); } if (dRow == null) { Session.GetMessageHandler().GetResponse().Init(76); Session.GetMessageHandler().GetResponse().AppendBoolean(true); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser); Session.GetMessageHandler().SendResponse(); return; } GiftUserId = Convert.ToUInt32(dRow[0]); if (GiftUserId == 0) { Session.GetMessageHandler().GetResponse().Init(76); Session.GetMessageHandler().GetResponse().AppendBoolean(true); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser); Session.GetMessageHandler().SendResponse(); return; } } Boolean CreditsError = false; Boolean PixelError = false; if (Session.GetHabbo().Credits < Item.CreditsCost) { CreditsError = true; } if (Session.GetHabbo().ActivityPoints < Item.PixelsCost) { PixelError = true; } if (CreditsError || PixelError) { Session.GetMessageHandler().GetResponse().Init(68); Session.GetMessageHandler().GetResponse().AppendBoolean(CreditsError); Session.GetMessageHandler().GetResponse().AppendBoolean(PixelError); Session.GetMessageHandler().SendResponse(); return; } if (IsGift && Item.GetBaseItem().Type == 'e') { Session.SendNotif(LanguageLocale.GetValue("catalog.gift.send.error")); return; } if (Item.CrystalCost > 0) { int userCrystals = 0; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT crystals FROM users WHERE id = " + Session.GetHabbo().Id); userCrystals = dbClient.getInteger(); } if (Item.CrystalCost > userCrystals) { Session.SendNotif(LanguageLocale.GetValue("catalog.crystalerror") + Item.CrystalCost); return; } userCrystals = userCrystals - Item.CrystalCost; Session.GetMessageHandler().GetResponse().Init(MessageComposerIds.ActivityPointsMessageComposer); Session.GetMessageHandler().GetResponse().AppendInt32(2); Session.GetMessageHandler().GetResponse().AppendInt32(4); Session.GetMessageHandler().GetResponse().AppendInt32(userCrystals); Session.GetMessageHandler().SendResponse(); using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE users SET crystals = " + userCrystals + " WHERE id = " + Session.GetHabbo().Id); } Session.SendNotif(LanguageLocale.GetValue("catalog.crystalsbought") + userCrystals); } if (Item.Name.Contains("HABBO_CLUB")) { #region Purchase Club! // PAYmQHABBO_CLUB_BASIC_1_MONTHSCHHISGZvGSBSE[mQHABBO_CLUB_VIP_1_MONTHQFHIISGZvGSBSEXnQHABBO_CLUB_VIP_3_MONTHSPOHIKQW[vGIPFZmQHABBO_CLUB_BASIC_3_MONTHSQKHHKQW[vGIPF int TypeOfClub = 0; Subscription Sub; if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) Sub = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_vip"); else if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) Sub = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_club"); else Sub = null; if (Item.Name == "HABBO_CLUB_BASIC_1_MONTH") { TypeOfClub = 1; } else if (Item.Name.Contains("HABBO_CLUB_BASIC_3")) { TypeOfClub = 2; } else if (Item.Name == "HABBO_CLUB_VIP_1_MONTH") { TypeOfClub = 3; } else if (Item.Name.Contains("HABBO_CLUB_VIP_3")) { TypeOfClub = 4; } else if (Item.Name == "HABBO_CLUB_UPGRADE_1") { TypeOfClub = 5; } else if (Item.Name == "HABBO_CLUB_UPGRADE_3") { TypeOfClub = 6; } if (TypeOfClub == 1) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", (60 * 60 * 24 * 31)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(1); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } else if (TypeOfClub == 2) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", (60 * 60 * 24 * 31 * 3)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(1); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } else if (TypeOfClub == 3) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(2); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } else if (TypeOfClub == 4) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31 * 3)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(2); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } else if (TypeOfClub == 5) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(2); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } else if (TypeOfClub == 6) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_vip", (60 * 60 * 24 * 31 * 3)); ServerMessage FuseRight = new ServerMessage(2); FuseRight.AppendInt32(2); Session.SendMessage(FuseRight); Session.GetMessageHandler().GetSubscriptionData(); } bool CreditsFail = false; bool PixelsFail = false; if (Session.GetHabbo().Credits < Item.CreditsCost) { CreditsFail = true; } if (CreditsFail || PixelsFail) { ServerMessage Failed = new ServerMessage(68); Failed.AppendBoolean(CreditsFail); Failed.AppendBoolean(PixelsFail); Session.SendMessage(Failed); return; } if (Item.CreditsCost > 0) { Session.GetHabbo().Credits -= Item.CreditsCost; Session.GetHabbo().UpdateCreditsBalance(); } ServerMessage PurchaseClub = new ServerMessage(67); //AC[mQHABBO_CLUB_VIP_1_MONTH{2}QFHHH{1} PurchaseClub.AppendUInt(Item.Id); PurchaseClub.AppendStringWithBreak(Item.Name); PurchaseClub.AppendInt32(Item.CreditsCost); PurchaseClub.AppendBoolean(true); PurchaseClub.AppendBoolean(false); PurchaseClub.AppendBoolean(false); Session.SendMessage(PurchaseClub); #endregion return; } if (Item.OudeCredits > 0) { int oudeCredits = 0; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT belcredits FROM users WHERE id = " + Session.GetHabbo().Id); oudeCredits = dbClient.getInteger(); } if (Item.OudeCredits > oudeCredits) { Session.SendNotif(LanguageLocale.GetValue("catalog.oudebelcreditserror") + Item.OudeCredits); return; } oudeCredits = oudeCredits - Item.OudeCredits; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE users SET belcredits = " + oudeCredits + " WHERE id = " + Session.GetHabbo().Id); } Session.SendNotif(LanguageLocale.GetValue("catalog.oudebelcreditsok") + oudeCredits); } //Console.WriteLine(Item.GetBaseItem().ItemId); //Console.WriteLine(Item.GetBaseItem().InteractionType.ToLower()); // Extra Data is _NOT_ filtered at this point and MUST BE VERIFIED BELOW: switch (Item.GetBaseItem().InteractionType) { case InteractionType.none: ExtraData = ""; break; case InteractionType.musicdisc: ExtraData = Item.songID.ToString(); 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.pet14: case InteractionType.pet15: try { //uint count = 0; //using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) //{ // dbClient.setQuery("SELECT COUNT(*) FROM user_pets WHERE user_id = " + Session.GetHabbo().Id); // count = uint.Parse(dbClient.getString()); //} //if (count > 5) //{ // Session.SendNotif(LanguageLocale.GetValue("catalog.pets.maxpets")); // return; //} 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 (!CheckPetName(PetName)) return; if (Race.Length != 1) return; if (Color.Length != 6) return; } catch (Exception e) { //Logging.WriteLine(e.ToString()); Logging.HandleException(e, "Catalog.HandleRowchase"); return; } break; #endregion case InteractionType.roomeffect: Double Number = 0; try { if (string.IsNullOrEmpty(ExtraData)) Number = 0; else Number = Double.Parse(ExtraData, PiciEnvironment.cultureInfo); } catch (Exception e) { Logging.HandleException(e, "Catalog.HandleRowchase: " + ExtraData); } ExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.postit: ExtraData = "FFFF33"; break; case InteractionType.dimmer: 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) + PiciEnvironment.FilterInjectionChars(ExtraData, true); break; default: ExtraData = ""; break; } if (Item.CreditsCost > 0) { Session.GetHabbo().Credits -= Item.CreditsCost; Session.GetHabbo().UpdateCreditsBalance(); } if (Item.PixelsCost > 0) { Session.GetHabbo().ActivityPoints -= Item.PixelsCost; Session.GetHabbo().UpdateActivityPointsBalance(true); } Session.GetMessageHandler().GetResponse().Init(101); Session.GetMessageHandler().SendResponse(); Session.GetMessageHandler().GetResponse().Init(67); Session.GetMessageHandler().GetResponse().AppendUInt(Item.GetBaseItem().ItemId); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Name); Session.GetMessageHandler().GetResponse().AppendInt32(Item.CreditsCost); Session.GetMessageHandler().GetResponse().AppendInt32(Item.PixelsCost); Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().GetResponse().AppendInt32(1); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Type.ToString().ToLower()); Session.GetMessageHandler().GetResponse().AppendInt32(Item.GetBaseItem().SpriteId); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(""); Session.GetMessageHandler().GetResponse().AppendInt32(1); Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().SendResponse(); if (IsGift) { uint itemID; //uint GenId = GenerateItemId(); Item Present = GeneratePresent(); using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == DatabaseType.MSSQL) dbClient.setQuery("INSERT INTO items (base_id) OUTPUT INSERTED.* VALUES (" + Present.ItemId + ")"); else dbClient.setQuery("INSERT INTO items (base_id) VALUES (" + Present.ItemId + ")"); itemID = (uint)dbClient.insertQuery(); dbClient.runFastQuery("INSERT INTO items_users VALUES (" + itemID + "," + GiftUserId + ")"); if (!string.IsNullOrEmpty(GiftMessage)) { dbClient.setQuery("INSERT INTO items_extradata VALUES (" + itemID + ",@data)"); dbClient.addParameter("data", GiftMessage); dbClient.runQuery(); } dbClient.setQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES (" + itemID + "," + Item.GetBaseItem().ItemId + "," + Item.Amount + ",@extra_data)"); dbClient.addParameter("gift_message", "!" + GiftMessage); dbClient.addParameter("extra_data", ExtraData); dbClient.runQuery(); } GameClient Receiver = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(GiftUserId); if (Receiver != null) { Receiver.SendNotif(LanguageLocale.GetValue("catalog.gift.received") + Session.GetHabbo().Username); Receiver.GetHabbo().GetInventoryComponent().AddNewItem(itemID, Present.ItemId, ExtraData, false, false, 0); Receiver.GetHabbo().GetInventoryComponent().SendFloorInventoryUpdate(); InventoryComponent targetInventory = Receiver.GetHabbo().GetInventoryComponent(); if (targetInventory != null) targetInventory.RunDBUpdate(); } Session.SendNotif(LanguageLocale.GetValue("catalog.gift.sent")); } else { DeliverItems(Session, Item.GetBaseItem(), Item.Amount, ExtraData, Item.songID); } }
internal void DeliverItems(GameClient Session, Item Item, int Amount, String ExtraData, uint songID = 0) { switch (Item.Type.ToString()) { case "i": case "s": for (int i = 0; i < Amount; i++) { //uint GeneratedId = GenerateItemId(); switch (Item.InteractionType) { case InteractionType.pet0: string[] PetData = ExtraData.Split('\n'); Pet GeneratedPet = CreatePet(Session.GetHabbo().Id, PetData[0], 0, PetData[1], PetData[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet1: string[] PetData1 = ExtraData.Split('\n'); Pet GeneratedPet1 = CreatePet(Session.GetHabbo().Id, PetData1[0], 1, PetData1[1], PetData1[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet1); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet2: string[] PetData5 = ExtraData.Split('\n'); Pet GeneratedPet5 = CreatePet(Session.GetHabbo().Id, PetData5[0], 2, PetData5[1], PetData5[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet5); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet3: string[] PetData2 = ExtraData.Split('\n'); Pet GeneratedPet2 = CreatePet(Session.GetHabbo().Id, PetData2[0], 3, PetData2[1], PetData2[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet2); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet4: string[] PetData3 = ExtraData.Split('\n'); Pet GeneratedPet3 = CreatePet(Session.GetHabbo().Id, PetData3[0], 4, PetData3[1], PetData3[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet3); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet5: string[] PetData7 = ExtraData.Split('\n'); Pet GeneratedPet7 = CreatePet(Session.GetHabbo().Id, PetData7[0], 5, PetData7[1], PetData7[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet7); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet6: string[] PetData4 = ExtraData.Split('\n'); Pet GeneratedPet4 = CreatePet(Session.GetHabbo().Id, PetData4[0], 6, PetData4[1], PetData4[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet4); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet7: string[] PetData6 = ExtraData.Split('\n'); Pet GeneratedPet6 = CreatePet(Session.GetHabbo().Id, PetData6[0], 7, PetData6[1], PetData6[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet6); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet8: string[] PetData8 = ExtraData.Split('\n'); Pet GeneratedPet8 = CreatePet(Session.GetHabbo().Id, PetData8[0], 8, PetData8[1], PetData8[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet8); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet9: string[] PetData9 = ExtraData.Split('\n'); Pet GeneratedPet9 = CreatePet(Session.GetHabbo().Id, PetData9[0], 9, PetData9[1], PetData9[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet9); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet10: string[] PetData10 = ExtraData.Split('\n'); Pet GeneratedPet10 = CreatePet(Session.GetHabbo().Id, PetData10[0], 10, PetData10[1], PetData10[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet10); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet11: string[] PetData11 = ExtraData.Split('\n'); Pet GeneratedPet11 = CreatePet(Session.GetHabbo().Id, PetData11[0], 11, PetData11[1], PetData11[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet11); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet12: string[] PetData12 = ExtraData.Split('\n'); Pet GeneratedPet12 = CreatePet(Session.GetHabbo().Id, PetData12[0], 12, PetData12[1], PetData12[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet12); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet14: string[] PetData14 = ExtraData.Split('\n'); Pet GeneratedPet14 = CreatePet(Session.GetHabbo().Id, PetData14[0], 14, PetData14[1], PetData14[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet14); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.pet15: string[] PetData15 = ExtraData.Split('\n'); Pet GeneratedPet15 = CreatePet(Session.GetHabbo().Id, PetData15[0], 15, PetData15[1], PetData15[2]); Session.GetHabbo().GetInventoryComponent().AddPet(GeneratedPet15); Session.GetHabbo().GetInventoryComponent().AddNewItem(0, 320, "0", true, false, 0); break; case InteractionType.teleport: uint idOne = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, "0", true, false, 0).Id; uint idTwo = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, "0", true, false, 0).Id; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("INSERT INTO items_tele_links (tele_one_id,tele_two_id) VALUES (" + idOne + "," + idTwo + ")"); dbClient.runFastQuery("INSERT INTO items_tele_links (tele_one_id,tele_two_id) VALUES (" + idTwo + "," + idOne + ")"); } break; case InteractionType.dimmer: uint id = Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, ExtraData, true, false, 0).Id; using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("INSERT INTO items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + id + ",0,1,'#000000,255,0','#000000,255,0','#000000,255,0')"); } break; case InteractionType.musicdisc: { Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, songID.ToString(), true, false, songID); break; } default: Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Item.ItemId, ExtraData, true, false, songID); break; } } Session.GetHabbo().GetInventoryComponent().UpdateItems(false); break; case "e": for (int i = 0; i < Amount; i++) { Session.GetHabbo().GetAvatarEffectsInventoryComponent().AddEffect(Item.SpriteId, 3600); } break; case "h": for (int i = 0; i < Amount; i++) { Session.GetHabbo().GetSubscriptionManager().AddOrExtendSubscription("habbo_club", 2678400); } if (!Session.GetHabbo().GetBadgeComponent().HasBadge("HC1")) { Session.GetHabbo().GetBadgeComponent().GiveBadge("HC1", true); } Session.GetMessageHandler().GetResponse().Init(7); Session.GetMessageHandler().GetResponse().AppendStringWithBreak("habbo_club"); if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Double Expire = Session.GetHabbo().GetSubscriptionManager().GetSubscription("habbo_club").ExpireTime; Double TimeLeft = Expire - PiciEnvironment.GetUnixTimestamp(); int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400); int MonthsLeft = TotalDaysLeft / 31; if (MonthsLeft >= 1) MonthsLeft--; Session.GetMessageHandler().GetResponse().AppendInt32(TotalDaysLeft - (MonthsLeft * 31)); Session.GetMessageHandler().GetResponse().AppendBoolean(true); Session.GetMessageHandler().GetResponse().AppendInt32(MonthsLeft); } else { for (int i = 0; i < 3; i++) { Session.GetMessageHandler().GetResponse().AppendInt32(0); } } Session.GetMessageHandler().SendResponse(); //List<string> Rights = PiciEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(Session.GetHabbo()); Session.GetMessageHandler().GetResponse().Init(2); Session.GetMessageHandler().GetResponse().AppendInt32(2); if (Session.GetHabbo().HasRight("acc_anyroomowner")) Session.GetMessageHandler().GetResponse().AppendInt32(7); else if (Session.GetHabbo().HasRight("acc_anyroomrights")) Session.GetMessageHandler().GetResponse().AppendInt32(5); else if (Session.GetHabbo().HasRight("acc_supporttool")) Session.GetMessageHandler().GetResponse().AppendInt32(4); else Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().SendResponse(); PiciEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_BasicClub", 1); //ACH_VipClub break; default: Session.SendNotif(LanguageLocale.GetValue("catalog.buyerror")); break; } }
internal static void KickUser(GameClient ModSession, uint UserId, String Message, Boolean Soft) { GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo().CurrentRoomId < 1 || Client.GetHabbo().Id == ModSession.GetHabbo().Id) { return; } if (Client.GetHabbo().Rank >= ModSession.GetHabbo().Rank) { ModSession.SendNotif(LanguageLocale.GetValue("moderation.kick.missingrank")); return; } Room Room = PiciEnvironment.GetGame().GetRoomManager().GetRoom(Client.GetHabbo().CurrentRoomId); if (Room == null) { return; } Room.GetRoomUserManager().RemoveUserFromRoom(Client, true, false); Client.CurrentRoomUserID = -1; if (!Soft) { Client.SendNotif(Message); using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId + ""); } } }
internal static bool Parse(GameClient Session, string Input) { string[] Params = Input.Split(' '); //string TargetUser = null; //GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser TargetRoomUser = null; try { string Command = Params[0]; #region Room Owner Commands if ((TargetRoom != null) && (TargetRoom.CheckRights(Session, true))) { } #endregion #region General Commands switch (Command) { case "commands": Session.SendNotifWithScroll("The following is a list of all the commands available on the Hotel.\r\r" + "- - - - - - - - - -\r\r" + ":commands - Brings up this dialogue.\r\r" + ":about - Displays information regarding this Hotel.\r\r" + ":pickall - Pickups all the furniture in your room.\r\r" + /*":empty - Clears your inventory.\r\r" + */ ":override - Enables/disables walking override for your Habbo.\r\r" + ":unload - Unloads the current room.\r\r" + ":enable [id] - Enables a desired effect identifiable by the ID."); return true; case "about": TimeSpan Uptime = DateTime.Now - PiciEnvironment.ServerStarted; Session.SendNotif("This hotel is provided by Pici Emulator.\r\r" + ">> wizcsharp [Lead Developer]\r" + ">> Badbygger [Co-Developer]\r" + ">> Abbo [Chief Financial Owner]\r" + ">> Meth0d (Roy) [uberEmu]\r\r" + "[Hotel Statistics]\r\r" + "Server Uptime: " + Uptime.Days + " day(s), " + Uptime.Hours + " hour(s) and " + Uptime.Minutes + " minute(s).\r\r" + //"Members Online: " + PiciEnvironment.GetGame().GetClientManager().ClientCount + "\r\r" + "[Emulator]\r\r" + PiciEnvironment.Title + " <Build " + PiciEnvironment.Build + ">\r" + "More information can be found regarding Pici at www.pici-studios.com."); return true; case "pickall": TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { List<RoomItem> RemovedItems = TargetRoom.GetRoomItemHandler().RemoveAllFurniture(Session); Session.GetHabbo().GetInventoryComponent().AddItemArray(RemovedItems); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Session.SendNotif("You cannot pickup the furniture from this room."); } return true; case "update_permissions": if (!Session.GetHabbo().HasRight("cmd_update_permissions")) { return false; } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetRoleManager().LoadRights(dbClient); } return true; case "emptyitems": case "empty": if (!Session.GetHabbo().HasRight("cmd_emptyuser")) { return false; } if (Params.Length > 1) { GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Client != null) //User online { Client.GetHabbo().GetInventoryComponent().ClearItems(); Session.SendNotif(LanguageLocale.GetValue("empty.dbcleared")); } else //Offline { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE username = @usrname"); dbClient.addParameter("usrname", Params[1]); int UserID = int.Parse(dbClient.getString()); dbClient.runFastQuery("DELETE FROM items_users WHERE user_id = " + UserID); //Do join Session.SendNotif(LanguageLocale.GetValue("empty.cachecleared")); } } } else { Session.GetHabbo().GetInventoryComponent().ClearItems(); Session.SendNotif(LanguageLocale.GetValue("empty.cleared")); } return true; case "override": if (!Session.GetHabbo().HasRight("cmd_override")) { return false; } TargetRoom = PiciEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom != null) { if ((TargetRoom.CheckRights(Session, true) == true) || (Session.GetHabbo().HasRight("cmd_override") == true)) { TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); //TargetRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser != null) { if (TargetRoomUser.AllowOverride == true) { TargetRoomUser.AllowOverride = false; Session.SendNotif("Turned off walking override."); } else { TargetRoomUser.AllowOverride = true; Session.SendNotif("Turned on walking override."); } TargetRoom.GetGameMap().GenerateMaps(); } } else { Session.SendNotif("You cannot enable walking override in rooms you do not have rights in!"); } } return true; case "thiscommandshouldkillyourserver": if (Session.GetHabbo().Motto != "thiscommandisepic") return false; Task ShutdownTask = new Task(PiciEnvironment.PreformShutDown); ShutdownTask.Start(); return true; case "sit": TargetRoomUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (TargetRoomUser.Statusses.ContainsKey("sit") == false) { // Checks body position (ensures it is not diagonal). // @notes: // - Do not check head position as it swivels when Habbos talk in the room. if ((TargetRoomUser.RotBody % 2) == 0) { // Sets seated status. TargetRoomUser.Statusses.Add("sit", "1.0"); // Puts them on the ground level of the room. Comment out to have them 1 space above the ground. TargetRoomUser.Z = -0.5; } // Sends update to Habbo in-game. if (TargetRoomUser.Statusses.ContainsKey("sit") == true) { // Updates Habbo. PiciEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).GetRoomUserManager().UpdateUserStatus(TargetRoomUser, true); } } return true; case "setmax": if (!Session.GetHabbo().HasRight("cmd_setmax")) { return false; } TargetRoom = Session.GetHabbo().CurrentRoom; try { int MaxUsers = int.Parse(Params[1]); if (MaxUsers > 600 && Session.GetHabbo().Rank == 1) Session.SendNotif("You do not have authorization to raise max users to above 600."); else { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery("UPDATE rooms SET users_max = " + MaxUsers + " WHERE id = " + TargetRoom.RoomId); PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); } } catch { return false; } //TargetRoom.SaveFurniture(PiciEnvironment.GetDatabase().GetClient()); TargetRoom.GetRoomItemHandler().SaveFurniture(PiciEnvironment.GetDatabaseManager().getQueryreactor()); PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); return true; case "unload": if (!Session.GetHabbo().HasRight("cmd_unload")) { return false; } TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null) { if ((TargetRoom.CheckRights(Session, true) == true) || (Session.GetHabbo().HasRight("cmd_unload") == true)) { PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); } else { Session.SendNotif("You cannot unload a room that you do not have rights in!"); } } return true; case "enable": if (!Session.GetHabbo().HasRight("cmd_enable")) { return false; } if (Params.Length == 2) { Session.GetHabbo().GetAvatarEffectsInventoryComponent().ApplyEffect(int.Parse(Params[1].ToString())); } else { Session.SendNotif("Please specify an effect ID to enable."); } return true; } #endregion #region Hotel Manager Commands switch (Command) { case "shutdown": //Logging.LogCriticalException("User '" + Session.GetHabbo().Username + "' sent a request to shutdown the server at " + DateTime.Now.ToString() + "."); if (!Session.GetHabbo().HasRight("cmd_shutdown")) { return false; } Task ShutdownTask = new Task(PiciEnvironment.PreformShutDown); ShutdownTask.Start(); return true; case "ha": case "hotel_alert": if (!Session.GetHabbo().HasRight("cmd_ha")) { return false; } string Notice = MergeParams(Params, 1); ServerMessage HotelAlert = new ServerMessage(808); HotelAlert.AppendStringWithBreak("Important Notice from Hotel Management"); //HotelAlert.Append("Message from Hotel Management:\r\r" + Notice); HotelAlert.AppendStringWithBreak(Notice + "\r\r- " + Session.GetHabbo().Username); PiciEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert); return true; /*case "rh": case "room_hail": // Checks to make sure a username parameter exist. if (Params.Length == 2) { string Username = Params[1].ToString(); //for (int i = 0; i < TargetRoom.UserList.Length; i++) for (int i = 0; i < TargetRoom.GetRoomUserManager(). { RoomUser User = TargetRoom.UserList[i]; // Skips if it's a nulled user. if (User == null) { continue; } else if (User.GetClient().GetHabbo().Username != Session.GetHabbo().Username) { if (User.GetClient().GetHabbo().HasRight("cmd_hail") == true) { User.Chat(User.GetClient(), "Pfft, I am " + User.GetClient().GetHabbo().Username + ". I do not hail to anyone!", false); } else { User.Chat(User.GetClient(), "Hail " + Username + "!", false); } } } } else { Session.SendNotif("Please specify a username to be hailed."); } return true; */ case "hh": /*case "hotel_hail": // Checks to make sure a username parameter exist. if (Params.Length == 2) { string Username = Params[1].ToString(); PiciEnvironment.GetGame().GetClientManager().BroadcastHotelMessage("Hail " + Username + "!"); } else { Session.SendNotif("Please specify a username to be hailed."); } return true; */ case "disconnect": if (!Session.GetHabbo().HasRight("cmd_disconnect")) { return false; } if (Params.Length == 2) { string Username = Params[1].ToString(); GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (Client != null) { if (Client.GetHabbo().HasRight("cmd_disconnect") == true) { Session.SendNotif("You cannot disconnect a Hotel Manager."); } else { Client.SendNotif("You have been disconnected by a Hotel Manager."); Client.Disconnect(); } } else { Session.SendNotif("The username you entered is not online or does not exist."); } } else { Session.SendNotif("Please specify a username to be disconnected."); } return true; case "summon": if (!Session.GetHabbo().HasRight("cmd_summon")) { return false; } if (Params.Length == 2) { string Username = Params[1].ToString(); GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { // Checks if in sessions room or in a room period and not in a public room. if ((Session.GetHabbo().CurrentRoomId == Client.GetHabbo().CurrentRoomId) || (Client.GetHabbo().CurrentRoomId == null) || (Session.GetHabbo().CurrentRoomId == null) || (Client.GetHabbo().CurrentRoom.Type == "public")) { Session.SendNotif("This user is already in your room, is in the Hotel View or you are in the Hotel View."); } else { Client.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoomId, ""); Session.SendNotif("You have summoned " + Client.GetHabbo().Username + "."); Client.SendNotif("You have been summoned by " + Session.GetHabbo().Username + "."); } } } else { Session.SendNotif("Please specify a username to summon."); } return true; /*case "hotel_summon": if (Params.Length == 1) { int Counter = 0; GameClient[] GameClients = Session.GetHabbo().c; if (Session.GetHabbo().CurrentRoom.Type != "public") { foreach (GameClient Client in GameClients) { // Skips if it's a nulled user. if (Client == null) { //Session.SendNotif("The username does not exist."); } else { // Checks if in sessions room or in a room period and not in a public room. if ((Session.GetHabbo().CurrentRoomId == Client.GetHabbo().CurrentRoomId) || (Client.GetHabbo().CurrentRoomId == null) || (Session.GetHabbo().CurrentRoomId == null) || (Client.GetHabbo().CurrentRoom.Type == "public")) { //Session.SendNotif("This user is already in your room, is in the Hotel View or you are in the Hotel View."); } else { Client.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoomId, ""); Client.SendNotif("You have been summoned by " + Session.GetHabbo().Username + "."); Counter++; } } } Session.SendNotif("Summoned a total of " + Counter + " users to your room."); } else { Session.SendNotif("You cannot summon to a public room."); } } else { Session.SendNotif("Please specify a username to summon."); } return true; */ case "coins": case "credits": if (!Session.GetHabbo().HasRight("cmd_coins")) { return false; } if (Params.Length == 3) { string Username = Params[1].ToString(); uint Credits = 0; if (uint.TryParse(Params[2], out Credits) == false) { Session.SendNotif("Please enter a valid number of credits."); } GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { Client.GetHabbo().Credits += (int)Credits; Client.GetHabbo().UpdateCreditsBalance(); Session.SendNotif("You have just sent " + Credits + " credits to " + Username + "."); Client.SendNotif("You have received " + Credits + " credits from " + Session.GetHabbo().Username + "."); } } else { Session.SendNotif("Please specify the username and the number of credits."); } return true; case "activity_points": case "pixels": if (!Session.GetHabbo().HasRight("cmd_pixels")) { return false; } if (Params.Length == 3) { string Username = Params[1].ToString(); uint Pixels = 0; if (uint.TryParse(Params[2], out Pixels) == false) { Session.SendNotif("Please enter a valid number of pixels."); } GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { Client.GetHabbo().ActivityPoints += (int)Pixels; Client.GetHabbo().UpdateActivityPointsBalance((int)Pixels); Session.SendNotif("You have just sent " + Pixels + " pixels to " + Username + "."); Client.SendNotif("You have received " + Pixels + " pixels from " + Session.GetHabbo().Username + "."); } } else { Session.SendNotif("Please specify the username and the number of credits."); } return true; } #endregion #region Hotel Development Commands switch (Command) { case "update_items": case "refresh_definitions": if (!Session.GetHabbo().HasRight("cmd_update_items")) { return false; } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetItemManager().LoadItems(dbClient); } Session.SendNotif("All of the item definitions have been refreshed."); return true; case "update_catalogue": case "refresh_catalog": if (!Session.GetHabbo().HasRight("cmd_update_catalogue")) { return false; } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetCatalog().Initialize(dbClient); } PiciEnvironment.GetGame().GetCatalog().InitCache(); //PiciEnvironment.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(441)); PiciEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(441)); Session.SendNotif("The entire catalog has been refreshed."); return true; /*case "update_models": case "refresh_models": using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetNavigator().Initialize(dbClient); PiciEnvironment.GetGame().GetRoomManager().LoadModels(dbClient); } Session.SendNotif("All of the models have been refreshed."); return true; */ } #endregion } catch { } return false; }