internal void AddPuck(RoomItem item) { if (!pucks.ContainsKey(item.Id)) { pucks.Add(item.Id, item); } }
internal void AddPuck(RoomItem item) { if (_pucks.ContainsKey(item.Id)) { return; } _pucks.Add(item.Id, item); }
/// <summary> /// Adds the teleport. /// </summary> /// <param name="item">The item.</param> /// <param name="itemId">The item identifier.</param> internal void AddTeleport(RoomItem item, uint itemId) { if (_banzaiTeleports.ContainsKey(itemId)) { _banzaiTeleports.Inner[itemId] = item; return; } _banzaiTeleports.Add(itemId, item); }
internal void AddTeleport(RoomItem item, uint itemID) { if (banzaiTeleports.ContainsKey(itemID)) { banzaiTeleports.Inner[itemID] = item; } else { banzaiTeleports.Add(itemID, item); } }
internal void AddPyramid(RoomItem item, uint itemID) { if (banzaiPyramids.ContainsKey(itemID)) { banzaiPyramids.Inner[itemID] = item; } else { banzaiPyramids.Add(itemID, item); } }
internal void AddFurnitureToTeam(RoomItem item, Team team) { switch (team) { case Team.blue: blueTeamItems.Add(item.Id, item); break; case Team.green: greenTeamItems.Add(item.Id, item); break; case Team.red: redTeamItems.Add(item.Id, item); break; case Team.yellow: yellowTeamItems.Add(item.Id, item); break; } }
internal void AddFurnitureToTeam(RoomItem item, Team team) { switch (team) { case Team.red: _redTeamItems.Add(item.Id, item); return; case Team.green: _greenTeamItems.Add(item.Id, item); return; case Team.blue: _blueTeamItems.Add(item.Id, item); return; case Team.yellow: _yellowTeamItems.Add(item.Id, item); return; default: return; } }
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); }
internal RoomUser DeployBot(RoomBot Bot, Pet PetData) { RoomUser BotUser = new RoomUser(0, room.RoomId, primaryPrivateUserID++, room, false); int PersonalID = secondaryPrivateUserID++; BotUser.InternalRoomID = PersonalID; //this.UserList[PersonalID] = BotUser; userlist.Add(PersonalID, BotUser); DynamicRoomModel Model = room.GetGameMap().Model; if ((Bot.X > 0 && Bot.Y > 0) && Bot.X < Model.MapSizeX && Bot.Y < Model.MapSizeY) { BotUser.SetPos(Bot.X, Bot.Y, Bot.Z); BotUser.SetRot(Bot.Rot, false); } else { Bot.X = Model.DoorX; Bot.Y = Model.DoorY; BotUser.SetPos(Model.DoorX, Model.DoorY, Model.DoorZ); BotUser.SetRot(Model.DoorOrientation, false); } BotUser.BotData = Bot; BotUser.BotAI = Bot.GenerateBotAI(BotUser.VirtualId); if (BotUser.IsPet) { BotUser.BotAI.Init((int)Bot.BotId, BotUser.VirtualId, room.RoomId, BotUser, room); BotUser.PetData = PetData; BotUser.PetData.VirtualId = BotUser.VirtualId; } else { BotUser.BotAI.Init(-1, BotUser.VirtualId, room.RoomId, BotUser, room); } UpdateUserStatus(BotUser, false); BotUser.UpdateNeeded = true; ServerMessage EnterMessage = new ServerMessage(28); EnterMessage.AppendInt32(1); BotUser.Serialize(EnterMessage, room.GetGameMap().gotPublicPool); room.SendMessage(EnterMessage); BotUser.BotAI.OnSelfEnterRoom(); if (BotUser.BotData.AiType == AIType.Guide) { room.guideBotIsCalled = true; } if (BotUser.IsPet) { if (pets.ContainsKey(BotUser.PetData.PetId)) //Pet allready placed { pets[BotUser.PetData.PetId] = BotUser; } else { pets.Add(BotUser.PetData.PetId, BotUser); } petCount++; } return(BotUser); }
internal void AddBall(RoomItem item) { _balls.Add(item.Id, item); }