public GameItemHandler(Room room) { this.room = room; this.rnd = new Random(); this.banzaiPyramids = new QueuedDictionary<uint, RoomItem>(); this.banzaiTeleports = new QueuedDictionary<uint, RoomItem>(); }
internal void Init(Int32 pBaseId, Int32 pRoomUserId, UInt32 pRoomId, RoomUser user, Room room) { this.BaseId = pBaseId; this.RoomUserId = pRoomUserId; this.RoomId = pRoomId; this.roomUser = user; this.room = room; }
internal static ChatMessage CreateMessage(string message, GameClient user, Room room) { uint userID = user.GetHabbo().Id; string username = user.GetHabbo().Username; uint roomID = room.RoomId; string roomName = room.Name; DateTime timeSpoken = DateTime.Now; ChatMessage chatMessage = new ChatMessage(userID, username, roomID, roomName, message, timeSpoken); return chatMessage; }
internal static UInt32 GetLinkedTele(UInt32 TeleId, Room pRoom) { using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT tele_two_id FROM items_tele_links WHERE tele_one_id = " + TeleId); DataRow Row = dbClient.getRow(); if (Row == null) { return 0; } return Convert.ToUInt32(Row[0]); } }
public RoomUserManager(Room room) { //this.RoomUserCounter = 0; this.room = room; this.userlist = new QueuedDictionary<int, RoomUser>(new EventHandler(OnUserAdd), null, new EventHandler(onRemove), null); this.pets = new Hashtable(); this.usersByUsername = new Hashtable(); this.usersByUserID = new Hashtable(); this.primaryPrivateUserID = 0; this.secondaryPrivateUserID = 0; this.ToRemove = new List<RoomUser>(room.UsersMax); this.petCount = 0; this.userCount = 0; }
public AdminRoomUserMessageArgs(GameClient session) { this.session = session; this.RoomUser = null; this.allowsExecution = false; this.Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId); if (Room != null) { this.allowsExecution = Room.CheckRights(session, true); this.RoomUser = Room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); } if (Room == null || RoomUser == null || !allowsExecution) allowsExecution = false; }
internal static UInt32 GetTeleRoomId(UInt32 TeleId, Room pRoom) { if (pRoom.GetRoomItemHandler().GetItem(TeleId) != null) return pRoom.RoomId; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT room_id FROM items_rooms WHERE item_id = " + TeleId); DataRow Row = dbClient.getRow(); if (Row == null) { return 0; } return Convert.ToUInt32(Row[0]); } }
public Gamemap(Room room) { this.room = room; this.DiagonalEnabled = true; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); if (mStaticModel == null) throw new Exception("No modeldata found for roomID " + room.RoomId); this.mDynamicModel = new DynamicRoomModel(this.mStaticModel); this.mCoordinatedItems = new Hashtable(); this.gotPublicPool = room.RoomData.Model.gotPublicPool; this.mGameMap = new byte[Model.MapSizeX, Model.MapSizeY]; this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY]; userMap = new Hashtable(); if (room.IsPublic) this.roomLinkInformation = ButterflyEnvironment.GetGame().GetRoomManager().getLinkedRoomData(room.RoomId); }
public RoomItemHandling(Room room) { this.room = room; this.mRemovedItems = new Hashtable(); this.mMovedItems = new Hashtable(); this.mAddedItems = new Hashtable(); this.mRollers = new QueuedDictionary<uint,RoomItem>(); this.mWallItems = new QueuedDictionary<uint, RoomItem>(); this.mFloorItems = new QueuedDictionary<uint, RoomItem>(); this.roomItemUpdateQueue = new Queue(); this.mGotRollers = false; this.mRoolerCycle = 0; this.mRollerSpeed = 4; rollerItemsMoved = new List<uint>(); rollerUsersMoved = new List<uint>(); rollerMessages = new List<ServerMessage>(); }
internal static bool IsTeleLinked(UInt32 TeleId, Room pRoom) { uint LinkId = GetLinkedTele(TeleId, pRoom); if (LinkId == 0) { return false; } RoomItem item = pRoom.GetRoomItemHandler().GetItem(LinkId); if (item != null && item.GetBaseItem().InteractionType == Butterfly.HabboHotel.Items.InteractionType.teleport) return true; uint RoomId = GetTeleRoomId(LinkId, pRoom); if (RoomId == 0) { return false; } return true; }
public Gamemap(Room room) { this.room = room; this.DiagonalEnabled = true; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); if (mStaticModel == null) { Logging.LogMessage("The room model " + room.ModelName + " could not be found for room " + room.RoomId); room.ModelName = "model_a"; this.mStaticModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName, room.RoomId); } if (mStaticModel == null) throw new Exception("No modeldata found for roomID " + room.RoomId); if(room.ModelName == "custom") room.ModelName = "model_custom" + room.RoomId; this.mDynamicModel = new DynamicRoomModel(this.mStaticModel); this.mCoordinatedItems = new Hashtable(); this.coordinatedItemEvents = new Hashtable(); // this.gotPublicPool = room.RoomData.Model.gotPublicPool; this.mGameMap = new byte[Model.MapSizeX, Model.MapSizeY]; this.mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY]; userMap = new Hashtable(); }
internal void Fill(Room Room) { this.Id = Room.RoomId; this.Name = Room.Name; this.Description = Room.Description; this.Type = Room.Type; this.Owner = Room.Owner; this.Category = Room.Category; this.State = Room.State; this.UsersNow = Room.UsersNow; this.UsersMax = Room.UsersMax; this.ModelName = Room.ModelName; this.CCTs = Room.CCTs; this.Score = Room.Score; this.Tags = new List<string>(); foreach (string tag in Room.Tags.ToArray()) this.Tags.Add(tag); this.AllowPets = Room.AllowPets; this.AllowPetsEating = Room.AllowPetsEating; this.AllowWalkthrough = Room.AllowWalkthrough; this.Hidewall = Room.Hidewall; this.myIcon = Room.Icon; this.Password = Room.Password; this.Event = Room.Event; this.Wallpaper = Room.Wallpaper; this.Floor = Room.Floor; this.Landscape = Room.Landscape; this.FloorThickness = Room.FloorThickness; this.WallThickness = Room.WallThickness; mModel = ButterflyEnvironment.GetGame().GetRoomManager().GetModel(ModelName, Id); }
private void HandleWallItemPlace(UserItem item, string placementData, Room room) { string[] dataBits = placementData.Split(' '); if (!dataBits[1].StartsWith(":")) //Is wallitem return; switch (item.GetBaseItem().InteractionType) { case Butterfly.HabboHotel.Items.InteractionType.dimmer: { MoodlightData moodData = room.MoodlightData; if (moodData != null && room.GetRoomItemHandler().GetItem(moodData.ItemId) != null) { Session.SendChatMessage("Je kunt maar 1 sfeerverlichter per kamer plaatsen.", 0); return; } } break; } try { WallCoordinate coordinate = new WallCoordinate(":" + placementData.Split(':')[1]); RoomItem roomItem = new RoomItem(item.itemID, room.RoomId, item.BaseItemID, item.extraData, coordinate, room); if (room.GetRoomItemHandler().SetWallItem(Session, roomItem)) { Session.GetHabboDataContainer().GetInventoryComponent().RemoveItem(item.itemID, true); } } catch { return; } }
internal void UnloadRoom(Room Room) { if (Room == null) { return; } lock (roomsToRemoveQueue.SyncRoot) { roomsToRemoveQueue.Enqueue(Room.RoomId); } Room.Destroy(); Logging.WriteLine("[RoomMgr] Unloaded room: \"" + Room.Name + "\" (ID: " + Room.RoomId + ")"); }
private void HandleFloorItemPlace(UserItem item, Room room, int X, int Y, int Rot) { if (Session.GetHabbo().forceRot > -1) Rot = Session.GetHabbo().forceRot; RoomItem roomItem = new RoomItem(item.itemID, room.RoomId, item.BaseItemID,room.OwnerId, item.extraData, X, Y, 0, Rot, room); if (room.GetRoomItemHandler().SetFloorItem(Session, roomItem, X, Y, Rot, true, false, true)) Session.GetHabboDataContainer().GetInventoryComponent().RemoveItem(item.itemID, true); if (WiredUtillity.TypeIsWired(item.GetBaseItem().InteractionType)) WiredSaver.HandleDefaultSave(item.itemID, room); ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.FURNI_PLACE); }
public ElevatedUserRoomMessageArgs(GameClient session) { this.session = session; this.Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId); this.allowsExecution = (Room != null && Room.CheckRights(session, false)); }
internal void Destroy() { if (banzaiTeleports != null) banzaiTeleports.Destroy(); if (banzaiPyramids != null) banzaiPyramids.Clear(); banzaiPyramids = null; banzaiTeleports = null; room = null; rnd = null; }
internal void UpdateUser(GameClient client) { this.client = client; if (client != null && client.GetHabbo() != null) currentRoom = client.GetHabbo().CurrentRoom; }
internal void PrepareRoomForUser(uint Id, string Password) { ClearRoomLoading(); QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); if (ButterflyEnvironment.ShutdownStarted) { Session.SendNotif(LanguageLocale.GetValue("shutdown.alert")); return; } if (Session.GetHabbo().InRoom) { Room OldRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (OldRoom != null) { OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); Session.CurrentRoomUserID = -1; } } Room Room = ButterflyEnvironment.GetGame().GetRoomManager().LoadRoom(Id); if (Room == null || Session == null || Session.GetHabbo() == null) return; if (Session.GetHabbo().IsTeleporting && Session.GetHabbo().TeleportingRoomID != Id) return; Session.GetHabbo().LoadingRoom = Id; CurrentLoadingRoom = Room; if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && Room.UserIsBanned(Session.GetHabbo().Id)) { if (Room.HasBanExpired(Session.GetHabbo().Id)) { Room.RemoveBan(Session.GetHabbo().Id); } else { // C`PA Response.Init(224); Response.AppendInt32(4); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } if (Room.UsersNow >= Room.UsersMax && !Session.GetHabbo().HasFuse("fuse_enter_full_rooms")) { if (!ButterflyEnvironment.GetGame().GetRoleManager().RankHasRight(Session.GetHabbo().Rank, "fuse_enter_full_rooms")) { Response.Init(224); Response.AppendInt32(1); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } if (Room.Type == "public") { if (Room.State > 0 && !Session.GetHabbo().HasFuse("fuse_mod")) { Session.SendNotif(LanguageLocale.GetValue("room.noaccess")); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } Response.Init(166); Response.AppendStringWithBreak("/client/public/" + Room.ModelName + "/0"); //SendResponse();//****** response.appendResponse(GetResponse()); } else if (Room.Type == "private") { Response.Init(19); //SendResponse();//****** response.appendResponse(GetResponse()); if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && !Room.CheckRights(Session, true) && !Session.GetHabbo().IsTeleporting) { if (Room.State == 1) { if (Room.UserCount == 0) { Response.Init(131); //SendResponse();//****** response.appendResponse(GetResponse()); } else { Response.Init(91); Response.AppendStringWithBreak(""); //SendResponse();//****** response.appendResponse(GetResponse()); ServerMessage RingMessage = new ServerMessage(91); RingMessage.AppendStringWithBreak(Session.GetHabbo().Username); Room.SendMessageToUsersWithRights(RingMessage); } response.sendResponse(); return; } else if (Room.State == 2) { if (Password.ToLower() != Room.Password.ToLower()) { Response.Init(33); Response.AppendInt32(-100002); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } } Response.Init(166); Response.AppendStringWithBreak("/client/internal/" + Room.RoomId + "/id"); //SendResponse(); //****** response.appendResponse(GetResponse()); } Session.GetHabbo().LoadingChecksPassed = true; response.addBytes(LoadRoomForUser().getPacket); //LoadRoomForUser(); response.sendResponse(); }
internal void Destroy() { mFloorItems.Clear(); mWallItems.Clear(); mRemovedItems.Clear(); mMovedItems.Clear(); mAddedItems.Clear(); roomItemUpdateQueue.Clear(); room = null; mFloorItems = null; mWallItems = null; mRemovedItems = null; mMovedItems = null; mAddedItems = null; mWallItems = null; roomItemUpdateQueue = null; }
internal void BroadcastCurrentSongData(Room Instance) { if (mSong != null) Instance.SendMessage(JukeboxComposer.ComposePlayingComposer(mSong.SongData.Id, mSongQueuePosition, 0)); else Instance.SendMessage(JukeboxComposer.ComposePlayingComposer(0, 0, 0)); }
public void Update(Room Instance) { if (mIsPlaying && (mSong == null || (TimePlaying >= (mSong.SongData.LengthSeconds + 1)))) { if (mPlaylist.Count == 0) { Stop(); mRoomOutputItem.ExtraData = "0"; mRoomOutputItem.UpdateState(); } else { SetNextSong(); } mBroadcastNeeded = true; } if (mBroadcastNeeded) { BroadcastCurrentSongData(Instance); mBroadcastNeeded = false; } }
public RoomMessageArgs(GameClient session) { this.session = session; this.Room = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId); this.allowsExecution = Room != null; }
internal void Destroy() { room = null; usersByUsername.Clear(); usersByUsername = null; usersByUserID.Clear(); usersByUserID = null; OnUserEnter = null; pets.Clear(); pets = null; userlist.Destroy(); userlist = null; }
internal ServerMessage SerializeRelativeHeightmap(Room room) { if (!RelativeSerialized) { SerializedRelativeHeightmap = GetRelativeHeightmap(); RelativeSerialized = true; } return SerializedRelativeHeightmap; }
internal void Destroy() { userMap.Clear(); mDynamicModel.Destroy(); mCoordinatedItems.Clear(); if (roomLinkInformation != null) roomLinkInformation.Clear(); Array.Clear(mGameMap, 0, mGameMap.Length); Array.Clear(mUserItemEffect, 0, mUserItemEffect.Length); Array.Clear(mItemHeightMap, 0, mItemHeightMap.Length); userMap = null; mGameMap = null; mUserItemEffect = null; mItemHeightMap = null; mCoordinatedItems = null; roomLinkInformation = null; mDynamicModel = null; room = null; mStaticModel = null; }
internal void OnRoomUserAdd() { QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); List<RoomUser> UsersToDisplay = new List<RoomUser>(); if (CurrentLoadingRoom == null) return; foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values) { if (User.IsSpectator) continue; UsersToDisplay.Add(User); } Response.Init(28); Response.AppendInt32(UsersToDisplay.Count); foreach (RoomUser User in UsersToDisplay) { User.Serialize(Response, CurrentLoadingRoom.GetGameMap().gotPublicPool); } response.appendResponse(GetResponse()); GetResponse().Init(472); GetResponse().AppendBoolean(CurrentLoadingRoom.Hidewall); GetResponse().AppendInt32(CurrentLoadingRoom.WallThickness); GetResponse().AppendInt32(CurrentLoadingRoom.FloorThickness); response.appendResponse(GetResponse()); if (CurrentLoadingRoom.Type == "public") { Response.Init(471); Response.AppendBoolean(false); Response.AppendStringWithBreak(CurrentLoadingRoom.ModelName, "room modelname"); Response.AppendBoolean(false); response.appendResponse(GetResponse()); } else if (CurrentLoadingRoom.Type == "private") { Response.Init(471); Response.AppendBoolean(true); Response.AppendUInt(CurrentLoadingRoom.RoomId); if (CurrentLoadingRoom.CheckRights(Session, true)) { Response.AppendBoolean(true); } else { Response.AppendBoolean(false); } response.appendResponse(GetResponse()); // GQhntX]uberEmu PacketloggingDescriptionHQMSCQFJtag1tag2Ika^SMqurbIHH Response.Init(454); Response.AppendInt32(1); Response.AppendUInt(CurrentLoadingRoom.RoomId); Response.AppendInt32(0); Response.AppendStringWithBreak(CurrentLoadingRoom.Name); Response.AppendStringWithBreak(CurrentLoadingRoom.Owner); Response.AppendInt32(CurrentLoadingRoom.State); Response.AppendInt32(0); Response.AppendInt32(25); Response.AppendStringWithBreak(CurrentLoadingRoom.Description); Response.AppendInt32(0); Response.AppendInt32(1); Response.AppendInt32(8228); Response.AppendInt32(CurrentLoadingRoom.Category); Response.AppendStringWithBreak(""); Response.AppendInt32(CurrentLoadingRoom.TagCount); foreach (string Tag in CurrentLoadingRoom.Tags.ToArray()) { Response.AppendStringWithBreak(Tag); } CurrentLoadingRoom.Icon.Serialize(Response); Response.AppendBoolean(false); response.appendResponse(GetResponse()); } ServerMessage Updates = CurrentLoadingRoom.GetRoomUserManager().SerializeStatusUpdates(true); if (Updates != null) { //Session.SendMessage(Updates); response.appendResponse(Updates); } foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values) { if (User.IsSpectator) continue; if (User.IsDancing) { Response.Init(480); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.DanceId); response.appendResponse(GetResponse()); } if (User.IsAsleep) { Response.Init(486); Response.AppendInt32(User.VirtualId); Response.AppendBoolean(true); response.appendResponse(GetResponse()); } if (User.CarryItemID > 0 && User.CarryTimer > 0) { Response.Init(482); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.CarryTimer); response.appendResponse(GetResponse()); } if (!User.IsBot) { try { if (User.GetClient() != null && User.GetClient().GetHabbo() != null && User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent() != null && User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect >= 1) { Response.Init(485); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect); response.appendResponse(GetResponse()); } } catch (Exception e) { Logging.HandleException(e, "Rooms.SendRoomData3"); } } } response.sendResponse(); CurrentLoadingRoom = null; }
internal Room LoadRoom(UInt32 Id) { if (IsRoomLoaded(Id)) { return GetRoom(Id); } RoomData Data = GenerateRoomData(Id); if (Data == null) return null; Room Room = new Room(Data); //Room Room = new Room(Data.Id, Data.Name, Data.Description, Data.Type, Data.Owner, Data.Category, Data.State, // Data.UsersMax, Data.ModelName, Data.CCTs, Data.Score, Data.Tags, Data.AllowPets, Data.AllowPetsEating, // Data.AllowWalkthrough, Data.Hidewall, Data.Icon, Data.Password, Data.Wallpaper, Data.Floor, Data.Landscape, Data, Data.AllowRightsOverride); lock (roomsToAddQueue.SyncRoot) { roomsToAddQueue.Enqueue(Room); } Room.InitBots(); Room.InitPets(); //Logging.WriteLine("[RoomMgr] Loaded room: \"" + Room.Name + "\" (ID: " + Id + ")"); return Room; }