internal void Unmute() { if (this.Muted) { GetClient().SendNotif(LanguageLocale.GetValue("moderation.unmuted")); this.Muted = false; } }
internal void Mute() { if (!this.Muted) { GetClient().SendNotif(LanguageLocale.GetValue("moderation.muted")); this.Muted = true; } }
internal void SendBanMessage(string Message) { var BanMessage = new ServerMessage(Outgoing.SendNotif); BanMessage.AppendString(LanguageLocale.GetValue("moderation.banmessage")); BanMessage.AppendString(Message); GetConnection().SendData(BanMessage.GetBytes()); }
internal override void OnUserEnterRoom(RoomUser User) { if (User == null || User.GetClient() == null) { return; } if (GetRoom() == null) { return; } if (GetRoom().RoomData.OwnerId == User.HabboId) { if (GetBotData().SoplonOnRoom.Count > 0 || GetBotData().SoplonLeaveRoom.Count > 0) { ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk); ChatMessage.AppendInt32(GetRoomUser().VirtualId); ChatMessage.AppendString(LanguageLocale.GetValue("bot.soplon.enter.owner")); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(-1); User.GetClient().SendMessage(ChatMessage); } else { ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk); ChatMessage.AppendInt32(GetRoomUser().VirtualId); ChatMessage.AppendString(LanguageLocale.GetValue("bot.soplon.enter.owner.nomessage")); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(-1); User.GetClient().SendMessage(ChatMessage); } return; } if (GetRoom().GetRoomUserManager().GetRoomUserByHabbo(GetRoom().RoomData.OwnerId) == null) { if (!GetBotData().SoplonOnRoom.Contains(User.HabboId)) { GetBotData().SoplonOnRoom.Add(User.HabboId); ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk); ChatMessage.AppendInt32(GetRoomUser().VirtualId); ChatMessage.AppendString(LanguageLocale.GetValue("bot.soplon.enter.keko")); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(-1); User.GetClient().SendMessage(ChatMessage); } } }
internal void MarketplacePurchase() { uint ItemId = Request.PopWiredUInt(); DataRow Row = null; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT state, timestamp, total_price, extra_data, item_id FROM catalog_marketplace_offers WHERE offer_id = " + ItemId + " "); Row = dbClient.getRow(); } if (Row == null || (string)Row["state"] != "1" || (double)Row["timestamp"] <= Marketplace.FormatTimestamp()) { Session.SendNotif(LanguageLocale.GetValue("catalog.offerexpired")); return; } Item Item = ButterflyEnvironment.GetGame().GetItemManager().GetItem(Convert.ToUInt32(Row["item_id"])); if (Item == null) { return; } int prize = (int)Row["total_price"]; if ((int)Row["total_price"] >= 1) { Session.GetHabbo().Credits -= prize; Session.GetHabbo().UpdateCreditsBalance(); } ButterflyEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, (String)Row["extra_data"]); Session.GetHabbo().GetInventoryComponent().RunDBUpdate(); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE catalog_marketplace_offers SET state = 2 WHERE offer_id = " + ItemId + ""); } Session.GetMessageHandler().GetResponse().Init(67); Session.GetMessageHandler().GetResponse().AppendUInt(Item.ItemId); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.Name); Session.GetMessageHandler().GetResponse().AppendInt32(prize); Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().GetResponse().AppendInt32(1); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.Type.ToString()); Session.GetMessageHandler().GetResponse().AppendInt32(Item.SpriteId); Session.GetMessageHandler().GetResponse().AppendStringWithBreak(""); Session.GetMessageHandler().GetResponse().AppendInt32(1); Session.GetMessageHandler().GetResponse().AppendInt32(0); Session.GetMessageHandler().SendResponse(); Session.SendMessage(Marketplace.SerializeOffers(-1, -1, "", 1)); }
internal void DeliverItems() { // List items List <UserItem> ItemsOne = GetTradeUser(oneId).OfferedItems; List <UserItem> ItemsTwo = GetTradeUser(twoId).OfferedItems; // Verify they are still in user inventory foreach (UserItem I in ItemsOne) { if (GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().GetItem(I.Id) == null) { GetTradeUser(oneId).GetClient().SendNotif(LanguageLocale.GetValue("trade.failed")); GetTradeUser(twoId).GetClient().SendNotif(LanguageLocale.GetValue("trade.failed")); return; } } foreach (UserItem I in ItemsTwo) { if (GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().GetItem(I.Id) == null) { GetTradeUser(oneId).GetClient().SendNotif(LanguageLocale.GetValue("trade.failed")); GetTradeUser(twoId).GetClient().SendNotif(LanguageLocale.GetValue("trade.failed")); return; } } GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); // Deliver them foreach (UserItem I in ItemsOne) { GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().RemoveItem(I.Id, false); GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().AddNewItem(I.Id, I.BaseItem, I.ExtraData, false, false, 0); GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); } foreach (UserItem I in ItemsTwo) { GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().RemoveItem(I.Id, false); GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().AddNewItem(I.Id, I.BaseItem, I.ExtraData, false, false, 0); GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().RunDBUpdate(); } // Update inventories GetTradeUser(oneId).GetClient().GetHabbo().GetInventoryComponent().UpdateItems(false); GetTradeUser(twoId).GetClient().GetHabbo().GetInventoryComponent().UpdateItems(false); }
public void Invoke(GameClient Session, ClientMessage Request) { if (Session.GetHabbo() == null) { Session.tryLogin(Request.PopFixedString()); } else { Session.SendNotif(LanguageLocale.GetValue("user.allreadylogedon")); } }
internal void CallGuideBot() { if (Session.GetHabbo().SpectatorMode) { Session.GetHabbo().SpectatorMode = false;// Only for disable Spectator Mode Session.SendNotif(LanguageLocale.GetValue("invisible.disabled")); } else { Room Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Room == null || !Room.CheckRights(Session, true)) { return; } if (Room.guideBotIsCalled) { Session.GetMessageHandler().GetResponse().Init(33); Session.GetMessageHandler().GetResponse().AppendInt32(4009); Session.GetMessageHandler().SendResponse(); return; } if (Session.GetHabbo().CalledGuideBot) { Session.GetMessageHandler().GetResponse().Init(33); Session.GetMessageHandler().GetResponse().AppendInt32(4010); Session.GetMessageHandler().SendResponse(); return; } RoomUser NewUser = Room.DeployBot(ButterflyEnvironment.GetGame().GetBotManager().GetBot(55)); NewUser.SetPos(Room.GetGameMap().Model.DoorX, Room.GetGameMap().Model.DoorY, Room.GetGameMap().Model.DoorZ); NewUser.UpdateNeeded = true; RoomUser RoomOwner = Room.GetRoomUserManager().GetRoomUserByHabbo(Room.Owner); if (RoomOwner != null) { NewUser.MoveTo(RoomOwner.Coordinate); NewUser.SetRot(Rotation.Calculate(NewUser.X, NewUser.Y, RoomOwner.X, RoomOwner.Y), false); } Session.GetHabbo().CalledGuideBot = 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); }
internal void GetPetInfo() { if (Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null) { return; } PetBot pet = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetPet(Request.ReadUInt32()); if (pet == null || pet.PetData == null) { Session.SendNotif(LanguageLocale.GetValue("user.petinfoerror")); return; } Session.SendMessage(pet.PetData.SerializeInfo()); }
internal static void BanUser(GameClient ModSession, uint UserId, int Length, String Message) { var Client = OtanixEnvironment.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; } OtanixEnvironment.GetGame().GetBanManager().BanUser(Client, Client.GetHabbo().Username, "", Message, Length, ModSession); }
internal static void Notifica(GameClient Session, bool outroQuarto = false) { ServerMessage newm = new ServerMessage(Outgoing.GeneratingNotification); newm.AppendString("info." + EmuSettings.HOTEL_LINK); newm.AppendInt32(5); newm.AppendString("image"); newm.AppendString(LanguageLocale.GetValue("bc.imagem")); newm.AppendString("title"); newm.AppendString(LanguageLocale.GetValue("bc.titulo.notificacao")); newm.AppendString("message"); newm.AppendString("<i>" + (outroQuarto ? LanguageLocale.GetValue("bc.mensagem1") : LanguageLocale.GetValue("bc.mensagem")) + "<br><br>• <b>" + Session.GetHabbo().Username + "</b></i>"); newm.AppendString("linkTitle"); newm.AppendString("OK"); newm.AppendString("linkUrl"); newm.AppendString("event:"); Session.SendMessage(newm); }
internal void ModGetUserInfo() { if (!Session.GetHabbo().HasRight("acc_supporttool")) { return; } uint UserId = Request.PopWiredUInt(); if (PiciEnvironment.GetGame().GetClientManager().GetNameById(UserId) != "Unknown User") { Session.SendMessage(ModerationTool.SerializeUserInfo(UserId)); } else { Session.SendNotif(LanguageLocale.GetValue("user.loadusererror")); } }
internal void ModGetUserInfo() { if (!Session.GetHabbo().HasFuse("fuse_mod")) { return; } int UserId = Request.ReadInt32(); if (FirewindEnvironment.GetGame().GetClientManager().GetNameById(UserId) != "Unknown User") { Session.SendMessage(ModerationTool.SerializeUserInfo(UserId)); } else { Session.SendNotif(LanguageLocale.GetValue("user.loadusererror")); } }
public StringBuilder gerarCorList(string MinhasCores, string Username) { StringBuilder minhasCores = new StringBuilder(); minhasCores.Append(LanguageLocale.GetValue("cor.disponiveis") + "\n\n"); foreach (string corAtual in MinhasCores.Split(';')) { int corIntAtual = Convert.ToInt32(corAtual); if (corIntAtual == 0) { continue; } string minhaCor = OtanixEnvironment.GetGame().GetCatalog().pegaCor(corIntAtual); minhasCores.Append(":" + LanguageLocale.GetValue("cor.comando") + " " + corAtual + ", ex: " + OtanixEnvironment.GetGame().CorManager().GenerateColorName(corIntAtual, Username) + "\n"); } return(minhasCores); }
internal void GetCatalogPage() { CatalogPage Page = FirewindEnvironment.GetGame().GetCatalog().GetPage(Request.ReadInt32()); if (Page == null || !Page.Enabled || !Page.Visible || Page.MinRank > Session.GetHabbo().Rank) { return; } if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) { Session.SendNotif(LanguageLocale.GetValue("catalog.missingclubmembership")); return; } if (Page.Layout == "recycler") { Session.SendNotif("Ecotron virker ikke enda, beklager!"); return; } Session.SendMessage(Page.GetMessage); if (Page.Layout.Equals("club_buy")) { ServerMessage clubBuy = new ServerMessage(Outgoing.ClubComposer); clubBuy.AppendInt32(Page.Items.Values.Count); foreach (CatalogItem Item in Page.Items.Values) { Item.SerializeClub(clubBuy, Session); } clubBuy.AppendInt32(1); // sorry don't know :(! Session.SendMessage(clubBuy); } /*if (Page.Layout == "recycler") * { * GetResponse().Init(507); * GetResponse().AppendBoolean(true); * GetResponse().AppendBoolean(false); * SendResponse(); * }*/ }
internal static void BanUser(GameClient ModSession, uint UserId, int Length, String Message) { GameClient Client = FirewindEnvironment.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; FirewindEnvironment.GetGame().GetBanManager().BanUser(Client, ModSession.GetHabbo().Username, dLength, Message, false); }
private void GivePixels() { try { DateTime startTaskTime; TimeSpan spentTime; startTaskTime = DateTime.Now; if (pixelQueuee.Count > 0) { lock (pixelQueuee.SyncRoot) { while (pixelQueuee.Count > 0) { int amount = (int)pixelQueuee.Dequeue(); foreach (GameClient client in clients.Values) { if (client.GetHabbo() == null) { continue; } try { client.GetHabbo().ActivityPoints += amount; client.GetHabbo().UpdateActivityPointsBalance(true); client.SendNotif(LanguageLocale.GetValue("user.pixelsreceived") + ": " + amount); } catch { } } } } } spentTime = DateTime.Now - startTaskTime; if (spentTime.TotalSeconds > 3) { Logging.WriteLine("GameClientManager.GivePixels spent: " + spentTime.TotalSeconds + " seconds in working."); } } catch (Exception e) { Logging.LogThreadException(e.ToString(), "GameClientManager.GiveCredits Exception --> Not inclusive"); } }
internal void SendInstantMessageOffline(UInt32 FromUserId, string Message, int timeSended) { if (GetClient() != null && GetClient().GetHabbo() != null && OtanixEnvironment.GetGame().GetPrisaoManager().estaPreso(GetClient().GetHabbo().Id)) { GetClient().SendNotif(LanguageLocale.GetValue("prisao.chatamigos")); return; } if (GetClient() != null && GetClient().GetHabbo() != null && !GetClient().GetHabbo().passouPin) { GetClient().SendNotif("Você precisa digitar o pin staff"); return; } if (!FriendshipExists(FromUserId)) { return; } DeliverInstantMessage(Message, FromUserId, timeSended); }
internal RoomData CreateRoom(GameClient Session, string Name, string Model) { Name = FirewindEnvironment.FilterInjectionChars(Name); if (!roomModels.ContainsKey(Model)) { Session.SendNotif(LanguageLocale.GetValue("room.modelmissing")); return(null); } if (((RoomModel)roomModels[Model]).ClubOnly && !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 = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("INSERT INTO rooms (caption,owner,model_name) VALUES (@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); }
internal RoomData CreateRoom(GameClient Session, string Name, string Description, string Model, int Type, int MaxUsers, int TradeSettings, uint roomID = 0) { Name = OtanixEnvironment.FilterInjectionChars(Name); if (!roomModels.ContainsKey(Model) && Model != "custom") { Session.SendNotif(LanguageLocale.GetValue("room.modelmissing")); return(null); } if (Name.Length < 3) { Session.SendNotif(LanguageLocale.GetValue("room.namelengthshort")); return(null); } if (Session.GetHabbo().UsersRooms.Count > EmuSettings.ROOMS_X_PESTAÑA) { Session.SendNotif("Você atingiu o limite de " + EmuSettings.ROOMS_X_PESTAÑA + " quartos criados..."); return(null); } UInt32 RoomId = 0; using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("INSERT INTO rooms (roomtype,caption,owner,model_name,description,category,users_max,trade_settings) VALUES ('private',@caption,@username,@model,@description,'" + Type + "','" + MaxUsers + "','" + TradeSettings + "')"); dbClient.addParameter("caption", Name); dbClient.addParameter("model", Model); dbClient.addParameter("username", Session.GetHabbo().Username); dbClient.addParameter("description", Description); RoomId = roomID != 0 ? roomID : (UInt32)dbClient.insertQuery(); } var newRoomData = GenerateRoomData(RoomId); Session.GetHabbo().UsersRooms.Add(newRoomData.Id); return(newRoomData); }
internal static void PerformRoomAction(GameClient ModSession, uint RoomId, Boolean KickUsers, Boolean LockRoom, Boolean InappropriateRoom) { var Room = OtanixEnvironment.GetGame().GetRoomManager().GetRoom(RoomId); if (Room == null) { return; } if (OtanixEnvironment.GetGame().GetRoomRankConfig().ROOMS_TO_MODIFY.Contains(Convert.ToInt32(RoomId))) { OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(ModSession.GetHabbo().Username, string.Empty, "-Modify blocked room-", "Tried to MOD-TOOL in room:" + RoomId); return; } if (LockRoom) { Room.RoomData.State = 1; Room.RoomData.Name = "Inappropriate to Hotel Management"; Room.RoomData.roomNeedSqlUpdate = true; } if (InappropriateRoom) { Room.RoomData.Name = LanguageLocale.GetValue("moderation.room.roomclosed"); Room.RoomData.Description = LanguageLocale.GetValue("moderation.room.roomclosed"); Room.RoomData.Tags.Clear(); Room.RoomData.roomNeedSqlUpdate = true; } if (KickUsers) { Room.onRoomKick(); } ServerMessage Update = new ServerMessage(Outgoing.UpdateRoom); Update.AppendUInt(Room.Id); Room.SendMessage(Update); }
private void WorkRoomKickQueue() { if (roomKick.Count > 0) { lock (roomKick.SyncRoot) { while (roomKick.Count > 0) { RoomKick kick = (RoomKick)roomKick.Dequeue(); List <RoomUser> roomUsersToRemove = new List <RoomUser>(); foreach (RoomUser RoomUser in roomUserManager.UserList.Values) { if (RoomUser.IsBot) { continue; } if (RoomUser.GetClient().GetHabbo().Rank >= kick.minrank) { continue; } if (kick.allert.Length > 0) { RoomUser.GetClient().SendNotif(LanguageLocale.GetValue("roomkick.allert") + kick.allert); } roomUsersToRemove.Add(RoomUser); } foreach (RoomUser user in roomUsersToRemove) { GetRoomUserManager().RemoveUserFromRoom(user.GetClient(), true, false); user.GetClient().CurrentRoomUserID = -1; } } } } }
private void GiveBadges() { try { DateTime startTaskTime; TimeSpan spentTime; startTaskTime = DateTime.Now; if (badgeQueue.Count > 0) { lock (badgeQueue.SyncRoot) { while (badgeQueue.Count > 0) { string badgeID = (string)badgeQueue.Dequeue(); foreach (GameClient client in clients.Values) { if (client.GetHabbo() == null) { continue; } try { client.GetHabbo().GetBadgeComponent().GiveBadge(badgeID, true); client.SendNotif(LanguageLocale.GetValue("user.badgereceived")); } catch { } } } } } spentTime = DateTime.Now - startTaskTime; if (spentTime.TotalSeconds > 3) { Logging.WriteLine("GameClientManager.GiveBadges spent: " + spentTime.TotalSeconds + " seconds in working."); } } catch (Exception e) { Logging.LogThreadException(e.ToString(), "GameClientManager.GiveBadges Exception --> Not inclusive"); } }
internal void SSOLogin() { if (Session.GetHabbo() == null) { Session.tryLogin(Request.PopFixedString()); //if (Session.tryLogin(Request.PopFixedString())) //{ // //RegisterCatalog(); // //RegisterHelp(); // //RegisterNavigator(); // //RegisterMessenger(); // //RegisterUsers(); // //RegisterRooms(); // //RegisterGroups(); // //RegisterQuests(); //} } else { Session.SendNotif(LanguageLocale.GetValue("user.allreadylogedon")); } }
internal static void PerformRoomAction(GameClient ModSession, uint RoomId, Boolean KickUsers, Boolean LockRoom, Boolean InappropriateRoom) { Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomId); if (Room == null) { return; } if (LockRoom) { Room.State = 1; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE rooms SET state = 'locked' WHERE id = " + Room.RoomId); } Room.Name = "Inappropriate to Hotel Management"; } if (InappropriateRoom) { Room.Name = LanguageLocale.GetValue("moderation.room.roomclosed"); Room.Description = LanguageLocale.GetValue("moderation.room.roomclosed"); Room.ClearTags(); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE rooms SET caption = 'Inappropriate to Hotel Management', description = 'Inappropriate to Hotel Management', tags = '' WHERE id = " + Room.RoomId + ""); } } if (KickUsers) { onCycleDoneDelegate kick = new onCycleDoneDelegate(Room.onRoomKick); Room.GetRoomUserManager().UserList.QueueDelegate(kick); } }
internal static void AlertUser(GameClient ModSession, uint UserId, String Message, Boolean Caution) { var Client = OtanixEnvironment.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 (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = " + UserId + ""); } } }
private void GiveBadges() { if (badgeQueue.Count > 0) { lock (badgeQueue.SyncRoot) { while (badgeQueue.Count > 0) { string badgeID = (string)badgeQueue.Dequeue(); foreach (var client in clients.Values) { if (client == null || client.GetHabbo() == null || client.GetHabbo().GetBadgeComponent() == null) { continue; } client.GetHabbo().GetBadgeComponent().GiveBadge(badgeID); client.SendNotif(LanguageLocale.GetValue("user.badgereceived")); } } } } }
internal override void OnSelfEnterRoom() { if (GetRoom() == null) { return; } RoomUser User = GetRoom().GetRoomUserManager().GetRoomUserByHabbo(GetBotData().OwnerId); if (User == null) { return; } ServerMessage ChatMessage = new ServerMessage(Outgoing.Talk); ChatMessage.AppendInt32(GetRoomUser().VirtualId); ChatMessage.AppendString(LanguageLocale.GetValue("bot.soplon.enter.onself")); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(OtanixEnvironment.GetGame().GetRoomRankConfig().BOTS_DEFAULT_COLOR); ChatMessage.AppendInt32(0); ChatMessage.AppendInt32(-1); User.GetClient().SendMessage(ChatMessage); }
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) && !Item.GetBaseItem().IsSeat) { 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) && !Item.GetBaseItem().IsSeat)) { 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 && !Item.GetBaseItem().IsSeat) { 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 && !Item.GetBaseItem().IsSeat) { 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().GetRoomUnits(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); } /*else if (mFloorItems.ContainsKey(Item.Id) && Item.MagicRemove) * { * RemoveFurniture(Session, Item.Id); * if (mFloorItems.ContainsKey(Item.Id)) * { * Logging.WriteLine("lul?"); * mFloorItems.Remove(Item.Id); * } * }*/ //using (DatabaseClient dbClient = FirewindEnvironment.GetDatabase().GetClient()) //{ // dbClient.addParameter("extra_data", ((StringData)Item.data).Data); // 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(Outgoing.ObjectAdd); Item.Serialize(Message, room.OwnerId); Message.AppendString(room.Owner); room.SendMessage(Message); } } else { //using (DatabaseClient dbClient = FirewindEnvironment.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(Outgoing.ObjectUpdate); Item.Serialize(Message, room.OwnerId); //Message.AppendString(room.Owner); 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 (Item.GetBaseItem().IsSeat) { updateRoomUserStatuses = true; } if (updateRoomUserStatuses) { room.GetRoomUserManager().UpdateUserStatuses(); } return(true); }