public void OnTrigger(GameClient session, Item item, int request, bool hasRights) { if (session == null || session.GetHabbo() == null || item == null) { return; } var room = session.GetHabbo().CurrentRoom; if (room == null) { return; } var actor = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (actor == null) { return; } if (item.ExtraData == "1") { return; } if (Gamemap.TileDistance(actor.X, actor.Y, item.GetX, item.GetY) > 2) { return; } item.ExtraData = "1"; item.UpdateState(false, true); item.RequestUpdate(2, true); }
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights) { RoomUser roomUser = null; if (Session != null) { roomUser = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); } if (roomUser == null) { return; } if (Gamemap.TilesTouching(Item.GetX, Item.GetY, roomUser.X, roomUser.Y)) { if (Item.ExtraData != "-1") { if (Request == -1) { Item.ExtraData = "0"; Item.UpdateState(); return; } Item.ExtraData = "-1"; Item.UpdateState(false, true); Item.ReqUpdate(4, true); return; } } else { roomUser.MoveTo(Item.SquareInFront); } }
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null || !Session.GetHabbo().InRoom || Item == null || Item.InteractingUser > 0) { return; } RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (User.Team != TEAM.NONE) { User.FreezeInteracting = true; Item.InteractingUser = Session.GetHabbo().Id; if (Item.Data.InteractionType == InteractionType.FREEZE_TILE_BLOCK) { if (Gamemap.TileDistance(User.X, User.Y, Item.GetX, Item.GetY) < 2) { Item.GetRoom().GetFreeze().onFreezeTiles(Item, Item.freezePowerUp); } } } }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length != 2) { Session.SendWhisper("Introduce el nombre del usuario a quien deseas teleportar!", 34); return; } GameClient TargetClient = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); RoomUser Controller = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetClient != null) { Session.GetHabbo().Opponent = TargetClient.GetHabbo().Username; Session.GetHabbo().IsControlling = true; User.TeleportEnabled = !User.TeleportEnabled; if (Gamemap.TileDistance(Controller.X, Controller.Y, User.X, User.Y) > 1) { User.MoveTo(Controller.SquareInFront); } Session.GetHabbo().IsControlling = false; User.TeleportEnabled = !User.TeleportEnabled; Room.GetGameMap().GenerateMaps(); return; } else { Session.SendMessage(RoomNotificationComposer.SendBubble("definitions", "No se ha encontrado el usuario " + Params[1] + ".", "")); } }
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { RoomUser roomUser = null; if (session != null) { roomUser = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); } if (roomUser == null) { return; } if (Gamemap.TilesTouching(item.X, item.Y, roomUser.X, roomUser.Y)) { var cracks = 0; if (Plus.IsNum(item.ExtraData)) { cracks = Convert.ToInt16(item.ExtraData); } cracks++; item.ExtraData = Convert.ToString(cracks); item.UpdateState(false, true); return; } roomUser.MoveTo(item.SquareInFront); }
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { if (item.ExtraData == "1" || !item.GetBaseItem().VendingIds.Any() || item.InteractingUser != 0u || session == null) { return; } RoomUser roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (roomUserByHabbo == null) { return; } if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y)) { roomUserByHabbo.MoveTo(item.SquareInFront); return; } item.InteractingUser = session.GetHabbo().Id; roomUserByHabbo.CanWalk = false; roomUserByHabbo.ClearMovement(); roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y)); item.ReqUpdate(2, true); item.ExtraData = "1"; item.UpdateState(false, true); }
public override void OnTrigger(GameClient Session, Item Item, int Request, bool UserHasRights) { if (!(Item.ExtraData != "1") || Item.GetBaseItem().VendingIds.Count < 1 || (Item.InteractingUser != 0 || Session == null || Session.GetHabbo() == null)) { return; } RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabboId(Session.GetHabbo().Id); if (roomUserByHabbo == null) { return; } if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY)) { roomUserByHabbo.MoveTo(Item.SquareInFront); } else { Item.InteractingUser = Session.GetHabbo().Id; roomUserByHabbo.SetRot(Rotation.Calculate(roomUserByHabbo.X, roomUserByHabbo.Y, Item.GetX, Item.GetY), false); Item.ReqUpdate(2); Item.ExtraData = "1"; Item.UpdateState(false, true); } }
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights) { if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0 && Session != null) { RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (!Gamemap.TilesTouching(User.X, User.Y, Item.GetX, Item.GetY)) { User.MoveTo(Item.SquareInFront); return; } Item.InteractingUser = Session.GetHabbo().Id; if (!User.SetStep) { User.CanWalk = false; User.ClearMovement(true); User.SetRot(Rotation.Calculate(User.X, User.Y, Item.GetX, Item.GetY), false); } Item.RequestUpdate(2, true); Item.ExtraData = "1"; Item.UpdateState(false, true); } }
public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null || Session.GetHabbo() == null || Item == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (Actor == null) { return; } if (Item.ExtraData == "1") { return; } if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 2) { return; } NeonEnvironment.GetGame().GetPinataManager().ReceiveCrackableReward(Actor, Room, Item); }
public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null || Session.GetHabbo() == null || Item == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (Actor == null) { return; } if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 2) { return; } int count = int.Parse(Item.ExtraData); count++; Item.ExtraData = count + ""; Item.UpdateState(true, true); }
public void OnTrigger(GameClient session, Item item, int request, bool hasRights) { if (session == null || !session.GetHabbo().InRoom || item == null || item.InteractingUser > 0) { return; } var user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (user == null) { return; } if (user.Team != TEAM.NONE) { user.FreezeInteracting = true; item.InteractingUser = session.GetHabbo().Id; if (item.Data.InteractionType == InteractionType.FreezeTileBlock) { if (Gamemap.TileDistance(user.X, user.Y, item.GetX, item.GetY) < 2) { item.GetRoom().GetFreeze().onFreezeTiles(item, item.FreezePowerUp); } } } }
public void OnTrigger(GameClient session, Item item, int request, bool hasRights) { if (item.ExtraData != "1" && item.GetBaseItem().VendingIds.Count >= 1 && item.InteractingUser == 0 && session != null) { var user = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (user == null) { return; } if (!Gamemap.TilesTouching(user.X, user.Y, item.GetX, item.GetY)) { user.MoveTo(item.SquareInFront); return; } item.InteractingUser = session.GetHabbo().Id; user.CanWalk = false; user.ClearMovement(true); user.SetRot(Rotation.Calculate(user.X, user.Y, item.GetX, item.GetY), false); item.RequestUpdate(2, true); item.ExtraData = "1"; item.UpdateState(false, true); } }
public void OnRemove(GameClient Session, Item Item) { if (Session == null || Session.GetHabbo() == null || Item == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (Actor == null) { return; } if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 2) { return; } int count = int.Parse(Item.ExtraData); count++; Item.ExtraData = count + ""; Item.UpdateState(true, true); Session.SendMessage(new RoomNotificationComposer("Piso mudo de cor! dsadsa")); }
public bool AllowsExecution(RoomUser user, Item TriggerItem) { Room theRoom = item.GetRoom(); Gamemap map = theRoom.GetGameMap(); bool quelquesurlemobi = false; foreach (Item item2 in items) { foreach (Point coord in item2.GetCoords) { if (map.GetRoomUsers(coord).Count != 0) { quelquesurlemobi = true; } } if (!quelquesurlemobi) { return(false); } quelquesurlemobi = false; } return(true); }
public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights) { Room Room; if ((Room = Session?.GetHabbo()?.CurrentRoom) != null || Item != null || Item.ExtraData == "1") { return; } if (Session.GetHabbo().Id != Item.UserID) { Session.SendWhisper("Oeps! Dit is niet jouw Pinata - Je kunt dit niet openen!"); return; } RoomUser Actor; if ((Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id)) == null || Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 1) { return; } QuasarEnvironment.GetGame().GetPinataManager().ReceiveCrackableReward(Actor, Room, Item); }
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights) { RoomUser roomUser = null; if (session != null) { roomUser = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); } if (roomUser == null) { return; } if (Gamemap.TilesTouching(item.X, item.Y, roomUser.X, roomUser.Y)) { if (item.ExtraData == "-1") { return; } if (request == -1) { item.ExtraData = "0"; item.UpdateState(); return; } item.ExtraData = "-1"; item.UpdateState(false, true); item.ReqUpdate(4, true); return; } roomUser.MoveTo(item.SquareInFront); }
public BotTeleport(string namebot, List <Item> items, Gamemap gamemap, WiredHandler handler, int itemID) { this.itemID = itemID; this.handler = handler; this.NameBot = namebot; this.items = items; this.gamemap = gamemap; }
public ToggleItemState(Gamemap gamemap, WiredHandler handler, List <Item> items, int delay, Item Item) { this.item = Item; this.gamemap = gamemap; this.handler = handler; this.items = items; this.Delay = delay; this.disposed = false; }
public TeleportToItem(Gamemap gamemap, WiredHandler handler, List <Item> items, int delay, int itemID) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.Delay = delay; this.itemID = itemID; this.disposed = false; }
public void Dispose() { disposed = true; gamemap = null; handler = null; if (items != null) items.Clear(); delayedTriggeringUsers.Clear(); }
public ToggleItemState(Gamemap gamemap, WiredHandler handler, List <RoomItem> items, int delay, uint itemID) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.delay = delay; this.cycles = 0; this.delayedTriggeringUsers = new Queue(); this.disposed = false; }
public ToggleItemState(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, uint itemID) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.delay = delay; this.cycles = 0; this.delayedTriggeringUsers = new Queue(); this.disposed = false; }
public void Dispose() { this.disposed = true; this.gamemap = (Gamemap)null; this.handler = (WiredHandler)null; if (this.items != null) { this.items.Clear(); } }
public void Dispose() { this.handler = (WiredHandler)null; this.gamemap = (Gamemap)null; if (this.items != null) { this.items.Clear(); } this.items = (List <Item>)null; }
public bool MoveBall(RoomItem item, RoomUser mover, int newX, int newY) { if (item == null || item.GetBaseItem() == null /*|| mover == null || mover.GetHabbo() == null*/) { return(false); } if (!room.GetGameMap().itemCanBePlacedHere(newX, newY)) { return(false); } if (mover != null && mover.handelingBallStatus == 1) { if (room.GetGameMap().SquareHasUsers(newX, newY)) { return(false); } } Point oldRoomCoord = item.Coordinate; Double NewZ = room.GetGameMap().Model.SqFloorHeight[newX, newY]; ServerMessage mMessage2 = new ServerMessage(Outgoing.BallUpdate); // Cf mMessage2.AppendUInt(item.Id); mMessage2.AppendInt32(item.GetBaseItem().SpriteId); mMessage2.AppendInt32(newX); mMessage2.AppendInt32(newY); mMessage2.AppendInt32(4); // rot; mMessage2.AppendString((String.Format("{0:0.00}", TextHandling.GetString(item.GetZ)))); mMessage2.AppendString((String.Format("{0:0.00}", TextHandling.GetString(item.GetZ)))); mMessage2.AppendUInt(0); mMessage2.AppendUInt(0); mMessage2.AppendString(item.ExtraData); mMessage2.AppendInt32(-1); mMessage2.AppendUInt(0); mMessage2.AppendUInt(item.OwnerId); room.SendFastMessage(mMessage2); if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY) { return(false); } item.SetState(newX, newY, item.GetZ, Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, newX, newY, item.Rot)); if (mover != null) { return(soccer.HandleFootballGameItems(new Point(newX, newY), mover)); } return(false); }
public void Dispose() { disposed = true; gamemap = null; handler = null; if (items != null) items.Clear(); items = null; if (delayedUsers != null) delayedUsers.Clear(); }
public void Dispose() { disposed = true; gamemap = null; handler = null; if (items != null) { items.Clear(); } delayedTriggeringUsers.Clear(); }
public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null) { return; } RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y)) { int Modes = Item.GetBaseItem().Modes - 1; if (Modes <= 0) { return; } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.FURNI_SWITCH); int CurrentMode = 0; int NewMode = 0; if (!int.TryParse(Item.ExtraData, out CurrentMode)) { } if (CurrentMode <= 0) { NewMode = 1; } else if (CurrentMode >= Modes) { NewMode = 0; } else { NewMode = CurrentMode + 1; } Item.ExtraData = NewMode.ToString(); Item.UpdateState(); } else { User.MoveTo(Item.SquareInFront); } }
public TeleportToItem(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, uint itemID) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.delay = delay; this.itemID = itemID; this.cycles = 0; this.delayedUsers = new Queue(); this.rnd = new Random(); this.disposed = false; }
public TeleportToItem(Gamemap gamemap, WiredHandler handler, List <RoomItem> items, int delay, RoomItem itemID) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.delay = delay + 1; this.itemID = itemID; cycles = 0; delayedUsers = new Queue(); rnd = new Random(); disposed = false; }
public override void OnUserSay(RoomUser User, string Message) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) { return; } if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8) { return; } long nowTime = NeonEnvironment.CurrentTimeMillis(); long timeBetween = nowTime - User.GetClient().GetHabbo()._lastTimeUsedHelpCommand; if (timeBetween < 60000 && Message.Length == 5) { User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("abuse", "Espera al menos 1 minuto para volver a usar el sistema de revisión de rares.", "")); return; } User.GetClient().GetHabbo()._lastTimeUsedHelpCommand = nowTime; string Rare = Message.Split(' ')[2]; string Username = Message.Split(' ')[4]; GameClient Target = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Message.Split(' ')[4]); if (Target == null) { GetRoomUser().Chat("Oops, no se ha encontrado a esta persona, asegúrate de escribir bien su nombre.", false, 34); return; } int itemstotal = 0; using (IQueryAdapter query = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("SELECT COUNT(*) FROM items i LEFT JOIN furniture f ON(i.base_item = f.id) WHERE f.item_name = @itemsito AND i.user_id = @id AND f.is_rare = '1'"); query.AddParameter("id", Target.GetHabbo().Id); query.AddParameter("itemsito", Message.Split(' ')[2]); itemstotal = query.getInteger(); } if (itemstotal == 0) { GetRoomUser().Chat("<font color=\"#DF3A01\"><b>" + Username + "</b> no tiene ningún " + Rare + ", por lo que no puede apostar ningun@.</font>", false, 33); return; } GetRoomUser().Chat("<font color=\"#DF3A01\"><b>" + Username + "</b> tiene un total de <b>" + itemstotal + "</b> " + Rare + "s.</font>", false, 33); }
public override void OnUserSay(RoomUser User, string Message) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) { return; } if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8) { return; } long nowTime = BiosEmuThiago.CurrentTimeMillis(); long timeBetween = nowTime - User.GetClient().GetHabbo()._lastTimeUsedHelpCommand; if (timeBetween < 60000 && Message.Length == 5) { User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("furni_placement_error", "Aguarde pelo menos 1 minuto para reutilizar o sistema de revisão de raros.", "")); return; } User.GetClient().GetHabbo()._lastTimeUsedHelpCommand = nowTime; string Rare = Message.Split(' ')[2]; string Username = Message.Split(' ')[4]; GameClient Target = BiosEmuThiago.GetGame().GetClientManager().GetClientByUsername(Message.Split(' ')[4]); if (Target == null) { GetRoomUser().Chat("Opa, esta pessoa não foi encontrada, não se esqueça de soletrar seu nome.", false, 34); return; } int itemstotal = 0; using (IQueryAdapter query = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("SELECT COUNT(*) FROM items i LEFT JOIN furniture f ON(i.base_item = f.id) WHERE f.public_name = @itemsito AND i.user_id = @id AND f.is_rare = '1'"); query.AddParameter("id", Target.GetHabbo().Id); query.AddParameter("itemsito", Message.Split(' ')[2]); itemstotal = query.getInteger(); } if (itemstotal == 0) { GetRoomUser().Chat("<font color=\"#DF3A01\"><b>" + Username + "</b> não possui nenhum " + Rare + ", então você não pode apostar com ninguem.</font>", false, 33); return; } GetRoomUser().Chat("<font color=\"#DF3A01\"><b>" + Username + "</b> tem um total de <b>" + itemstotal + "</b> " + Rare + "s.</font>", false, 33); }
public SquarePoint(RoomUser User, Vector2D From, int pTargetX, int pTargetY, byte SquareData, bool pOverride, Gamemap pGameMap) { mUser = User; mX = From.X; mY = From.Y; mSquareData = SquareData; mInUse = true; mOverride = pOverride; mDistance = 0.0; mLastStep = (From.X == pTargetX) && (From.Y == pTargetY); mDistance = DreamPathfinder.GetDistance(From.X, From.Y, pTargetX, pTargetY); mMap = pGameMap; }
public TeleportToItem(Gamemap gamemap, WiredHandler handler, List<RoomItem> items, int delay, RoomItem item) { this.gamemap = gamemap; this.handler = handler; this.items = items; this.delay = delay; this.item = item; this.cycles = 0; this.delayedUsers = new Queue(); this.rnd = new Random(); this.disposed = false; AttatchListenersToItems(); }
public override void OnUserSay(RoomUser User, string Message) { if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null) { return; } if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8) { return; } switch (Message.ToLower()) { case "si": case "sim": case "yes": if (GetBotData() == null) { return; } if (User.GetClient().GetHabbo().CurrentRoom.OwnerId == User.GetClient().GetHabbo().Id) { DataTable getRoomVisit; using (IQueryAdapter query = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("SELECT username, gone FROM room_visits WHERE roomid = @id"); query.AddParameter("id", User.RoomId); getRoomVisit = query.getTable(); } foreach (DataRow Row in getRoomVisit.Rows) { var gone = Convert.ToString(Row["gone"]); var username = Convert.ToString(Row["username"]); GetRoomUser().Chat(username + " " + gone, false); } using (IQueryAdapter query = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { query.SetQuery("DELETE FROM room_visits WHERE roomid = @id"); query.AddParameter("id", User.RoomId); getRoomVisit = query.getTable(); } return; } break; } }
/// <summary> /// Finds the path. /// </summary> /// <param name="user">The user.</param> /// <param name="diag">if set to <c>true</c> [diag].</param> /// <param name="map">The map.</param> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <returns>List<Vector2D>.</returns> public static List<Vector2D> FindPath(RoomUser user, bool diag, Gamemap map, Vector2D start, Vector2D end) { var list = new List<Vector2D>(); var pathFinderNode = FindPathReversed(user, diag, map, start, end); if (pathFinderNode != null) { list.Add(end); while (pathFinderNode.Next != null) { list.Add(pathFinderNode.Next.Position); pathFinderNode = pathFinderNode.Next; } } return list; }
/// <summary> /// Resets the game map. /// </summary> /// <param name="newModelName">New name of the model.</param> /// <param name="wallHeight">Height of the wall.</param> /// <param name="wallThick">The wall thick.</param> /// <param name="floorThick">The floor thick.</param> internal void ResetGameMap(string newModelName, int wallHeight, int wallThick, int floorThick) { RoomData.ModelName = newModelName; RoomData.ModelName = newModelName; RoomData.ResetModel(); RoomData.WallHeight = wallHeight; RoomData.WallThickness = wallThick; RoomData.FloorThickness = floorThick; _gameMap = new Gamemap(this); }
/// <summary> /// Initializes the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="roomData">The room data.</param> /// <param name="rightOverride">if set to <c>true</c> [right override].</param> /// <param name="wordFilter">The word filter.</param> /// <param name="forceLoad"></param> private void Initialize(uint id, RoomData roomData, bool rightOverride, List<string> wordFilter, bool forceLoad) { RoomData = roomData; Disposed = false; RoomId = id; Bans = new Dictionary<long, double>(); MutedUsers = new Dictionary<uint, uint>(); ActiveTrades = new ArrayList(); MutedBots = false; MutedPets = false; _mCycleEnded = false; EveryoneGotRights = rightOverride; LoadedGroups = new Dictionary<uint, string>(); _roomKick = new Queue(); _idleTime = 0; RoomMuted = false; _gameMap = new Gamemap(this); _roomItemHandler = new RoomItemHandler(this); _roomUserManager = new RoomUserManager(this); WordFilter = wordFilter; LoadRights(); LoadMusic(); LoadBans(); InitUserBots(); if (!forceLoad) { _roomThread = new Thread(StartRoomProcessing); _roomThread.Name = "Room Loader"; _roomThread.Start(); } Azure.GetGame().GetRoomManager().QueueActiveRoomAdd(RoomData); }
/// <summary> /// Finds the path reversed. /// </summary> /// <param name="roomUserable">The user.</param> /// <param name="whatIsDiag">if set to <c>true</c> [diag].</param> /// <param name="gameLocalMap">The map.</param> /// <param name="startMap">The start.</param> /// <param name="endMap">The end.</param> /// <returns>PathFinderNode.</returns> public static PathFinderNode FindPathReversed(RoomUser roomUserable, bool whatIsDiag, Gamemap gameLocalMap, Vector2D startMap, Vector2D endMap) { var minSpanTreeCost = new MinHeap<PathFinderNode>(256); var pathFinderMap = new PathFinderNode[gameLocalMap.Model.MapSizeX, gameLocalMap.Model.MapSizeY]; var pathFinderStart = new PathFinderNode(startMap) {Cost = 0}; var pathFinderEnd = new PathFinderNode(endMap); pathFinderMap[pathFinderStart.Position.X, pathFinderStart.Position.Y] = pathFinderStart; minSpanTreeCost.Add(pathFinderStart); while (minSpanTreeCost.Count > 0) { pathFinderStart = minSpanTreeCost.ExtractFirst(); pathFinderStart.InClosed = true; for (var index = 0; (whatIsDiag ? (index < DiagMovePoints.Length ? 1 : 0) : (index < NoDiagMovePoints.Length ? 1 : 0)) != 0; index++) { var realEndPosition = pathFinderStart.Position + (whatIsDiag ? DiagMovePoints[index] : NoDiagMovePoints[index]); var isEndOfPath = ((realEndPosition.X == endMap.X) && (realEndPosition.Y == endMap.Y)); if (gameLocalMap.IsValidStep(roomUserable, new Vector2D(pathFinderStart.Position.X, pathFinderStart.Position.Y), realEndPosition, isEndOfPath, roomUserable.AllowOverride)) { PathFinderNode pathFinderSecondNodeCalculation; if (pathFinderMap[realEndPosition.X, realEndPosition.Y] == null) { pathFinderSecondNodeCalculation = new PathFinderNode(realEndPosition); pathFinderMap[realEndPosition.X, realEndPosition.Y] = pathFinderSecondNodeCalculation; } else pathFinderSecondNodeCalculation = pathFinderMap[realEndPosition.X, realEndPosition.Y]; if (!pathFinderSecondNodeCalculation.InClosed) { var internalSpanTreeCost = 0; if (pathFinderStart.Position.X != pathFinderSecondNodeCalculation.Position.X) internalSpanTreeCost++; if (pathFinderStart.Position.Y != pathFinderSecondNodeCalculation.Position.Y) internalSpanTreeCost++; var loopTotalCost = pathFinderStart.Cost + internalSpanTreeCost + pathFinderSecondNodeCalculation.Position.GetDistanceSquared(endMap); if (loopTotalCost < pathFinderSecondNodeCalculation.Cost) { pathFinderSecondNodeCalculation.Cost = loopTotalCost; pathFinderSecondNodeCalculation.Next = pathFinderStart; } if (!pathFinderSecondNodeCalculation.InOpen) { if (pathFinderSecondNodeCalculation.Equals(pathFinderEnd)) { pathFinderSecondNodeCalculation.Next = pathFinderStart; return pathFinderSecondNodeCalculation; } pathFinderSecondNodeCalculation.InOpen = true; minSpanTreeCost.Add(pathFinderSecondNodeCalculation); } } } } } return null; }