eemillundgren
New Member
- Jul 11, 2015
- 8
- 1
Hi, I have discovered this, someone who knows how to fix these 2 problems?
You must be registered for see links
public bool SetFloorItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool OnRoller, bool sendMessage, bool updateRoomUserStatuses = false) {
bool NeedsReAdd = false;
if (newItem)
if (Item.IsWired)
if (Item.IsWired)
if (_room.HideWired)
{
_room.HideWired = false;
Session.SendWhisper("El Wired está oculto.");
_room.SendMessage(_room.HideWiredMessages(false));
}
if (Item.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps && _room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps).Count() > 0)
return false;
List<Item> ItemsOnTile = GetFurniObjects(newX, newY);
if (Item.GetBaseItem().InteractionType == InteractionType.ROLLER && ItemsOnTile.Where(x => x.GetBaseItem().InteractionType == InteractionType.ROLLER && x.Id != Item.Id).Count() > 0)
return 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)
_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)
{
_room.GetGameMap().AddToMap(Item);
}
return false;
}
}
// Start calculating new Z coordinate
Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];
if (!OnRoller)
{
// Make sure this tile is open and there are no users here
if (_room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
{
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().GetRoomUsers(new Point(Tile.X, Tile.Y)).Count > 0)
{
if (NeedsReAdd)
_room.GetGameMap().AddToMap(Item);
return false;
}
}
}
}
// Find affected objects
var ItemsAffected = new List<Item>();
var ItemsComplete = new List<Item>();
foreach (ThreeDCoord Tile in AffectedTiles.Values.ToList())
{
List<Item> 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 (Item I in ItemsComplete.ToList())
{
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.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
newZ = Item.GetZ;
Double StackingTile = 0;
// Are there any higher objects in the stack!?
foreach (Item I in ItemsComplete.ToList())
{
if (I == null)
continue;
if (I.Id == Item.Id)
continue; // cannot stack on self
if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
StackingTile = I.GetZ;
if (I.TotalHeight > newZ)
newZ = StackingTile != 0 ? StackingTile : I.TotalHeight;
}
}
// Verify the rotation is correct
if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8 && !Item.GetBaseItem().ExtraRot)
newRot = 0;
Item.Rotation = 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 (_floorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
_room.GetGameMap().RemoveFromMap(Item);
return true;
}
if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
_floorItems.TryAdd(Item.Id, Item);
else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
_wallItems.TryAdd(Item.Id, Item);
if (sendMessage)
_room.SendMessage(new ObjectAddComposer(Item, _room));
}
else
{
UpdateItem(Item);
if (!OnRoller && sendMessage)
_room.SendMessage(new ObjectUpdateComposer(Item, _room.OwnerId));
}
_room.GetGameMap().AddToMap(Item);
if (Item.GetBaseItem().IsSeat)
updateRoomUserStatuses = true;
if (updateRoomUserStatuses)
_room.GetRoomUserManager().UpdateUserStatusses();
if (Item.GetBaseItem().InteractionType == InteractionType.TENT || Item.GetBaseItem().InteractionType == InteractionType.TENT_SMALL)
{
_room.RemoveTent(Item.Id, Item);
_room.AddTent(Item.Id);
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "' WHERE `id` = '" + Item.Id + "' LIMIT 1");
}
return true;
}
public List<Item> GetFurniObjects(int X, int Y)
{
return _room.GetGameMap().GetCoordinatedItems(new Point(X, Y));
}
public bool SetFloorItem(Item Item, int newX, int newY, Double newZ)
{
if (_room == null)
return false;
_room.GetGameMap().RemoveFromMap(Item);
Item.SetState(newX, newY, newZ, Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, Item.Rotation));
if (Item.GetBaseItem().InteractionType == InteractionType.TONER)
{
if (_room.TonerData == null)
{
_room.TonerData = new TonerData(Item.Id);
}
}
UpdateItem(Item);
_room.GetGameMap().AddItemToMap(Item);
return true;
}
public bool SetWallItem(GameClient Session, Item Item)
{
if (!Item.IsWallItem || _wallItems.ContainsKey(Item.Id))
return false;
if (_floorItems.ContainsKey(Item.Id))
{
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.MOODLIGHT)
{
if (_room.MoodlightData == null)
{
_room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = _room.MoodlightData.GenerateExtraData();
}
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "', `wall_pos` = @WallPos WHERE `id` = '" + Item.Id + "' LIMIT 1");
dbClient.AddParameter("WallPos", Item.wallCoord);
dbClient.RunQuery();
}
_wallItems.TryAdd(Item.Id, Item);
_room.SendMessage(new ItemAddComposer(Item));
return true;
}
public void UpdateItem(Item item)
{
if (item == null)
return;
if (!_movedItems.ContainsKey(item.Id))
_movedItems.TryAdd(item.Id, item);
}
public void RemoveItem(Item item)
{
if (item == null)
return;
if (_movedItems.ContainsKey(item.Id))
_movedItems.TryRemove(item.Id, out item);
if (_rollers.ContainsKey(item.Id))
_rollers.TryRemove(item.Id, out item);
}
public void OnCycle()
{
if (mGotRollers)
{
try
{
_room.SendMessage(CycleRollers());
}
catch //(Exception e)
{
// Logging.LogThreadException(e.ToString(), "rollers for room with ID " + room.RoomId);
mGotRollers = false;
}
}
if (_roomItemUpdateQueue.Count > 0)
{
List<Item> addItems = new List<Item>();
while (_roomItemUpdateQueue.Count > 0)
{
var item = (Item)null;
if (_roomItemUpdateQueue.TryDequeue(out item))
{
item.ProcessUpdates();
if (item.UpdateCounter > 0)
addItems.Add(item);
}
}
foreach (Item item in addItems.ToList())
{
if (item == null)
continue;
_roomItemUpdateQueue.Enqueue(item);
}
}
//mFloorItems.OnCycle();
//mWallItems.OnCycle();
}
public List<Item> RemoveItems(GameClient Session)
{
List<Item> Items = new List<Item>();
foreach (Item Item in this.GetWallAndFloor.ToList())
{
if (Item == null || Item.UserID != Session.GetHabbo().Id)
continue;
if (Item.IsFloorItem)
{
Item I = null;
this._floorItems.TryRemove(Item.Id, out I);
Session.GetHabbo().GetInventoryComponent()._floorItems.TryAdd(Item.Id, I);
this._room.SendMessage(new ObjectRemoveComposer(Item, Item.UserID));
}
else if (Item.IsWallItem)
{
Item I = null;
this._wallItems.TryRemove(Item.Id, out I);
Session.GetHabbo().GetInventoryComponent()._wallItems.TryAdd(Item.Id, I);
this._room.SendMessage(new ItemRemoveComposer(Item, Item.UserID));
}
this._room.GetGameMap().GenerateMaps();
Session.SendMessage(new FurniListAddComposer(Item));
}
return Items;
}
public ICollection<Item> GetFloor
{
get
{
return this._floorItems.Values;
}
}
public ICollection<Item> GetWall
{
get
{
return this._wallItems.Values;
}
}
public IEnumerable<Item> GetWallAndFloor
{
get
{
return this._floorItems.Values.Concat(this._wallItems.Values);
}
}
public bool CheckPosItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool SendNotify = true)
{
try
{
Dictionary<int, ThreeDCoord> dictionary = Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);
if (!this._room.GetGameMap().ValidTile(newX, newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if ((this._room.GetGameMap().Model.DoorX == coord.X) && (this._room.GetGameMap().Model.DoorY == coord.Y))
return false;
}
if ((this._room.GetGameMap().Model.DoorX == newX) && (this._room.GetGameMap().Model.DoorY == newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (!this._room.GetGameMap().ValidTile(coord.X, coord.Y))
return false;
}
double num = this._room.GetGameMap().Model.SqFloorHeight[newX, newY];
if ((((Item.Rotation == newRot) && (Item.GetX == newX)) && (Item.GetY == newY)) && (Item.GetZ != num))
return false;
if (this._room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN)
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (this._room.GetGameMap().Model.SqState[coord.X, coord.Y] != SquareState.OPEN)
return false;
}
if (!Item.GetBaseItem().IsSeat)
{
if (this._room.GetGameMap().SquareHasUsers(newX, newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (this._room.GetGameMap().SquareHasUsers(coord.X, coord.Y))
return false;
}
}
List<Item> furniObjects = this.GetFurniObjects(newX, newY);
List<Item> collection = new List<Item>();
List<Item> list3 = new List<Item>();
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
List<Item> list4 = this.GetFurniObjects(coord.X, coord.Y);
if (list4 != null)
collection.AddRange(list4);
}
if (furniObjects == null)
furniObjects = new List<Item>();
list3.AddRange(furniObjects);
list3.AddRange(collection);
foreach (Item item in list3.ToList())
{
if ((item.Id != Item.Id) && !item.GetBaseItem().Stackable)
return false;
}
return true;
}
catch
{
return false;
}
}
public ICollection<Item> GetRollers()
{
return this._rollers.Values;
}
public void Dispose()
{
foreach (Item Item in this.GetWallAndFloor.ToList())
{
if (Item == null)
continue;
Item.Destroy();
}
_floorItems.Clear();
_wallItems.Clear();
_movedItems.Clear();
this._roomItemUpdateQueue = null;
_room = null;
_floorItems = null;
_wallItems = null;
_movedItems = null;
_wallItems = null;
_roomItemUpdateQueue = null;
}
}
}
bool NeedsReAdd = false;
if (newItem)
if (Item.IsWired)
if (Item.IsWired)
if (_room.HideWired)
{
_room.HideWired = false;
Session.SendWhisper("El Wired está oculto.");
_room.SendMessage(_room.HideWiredMessages(false));
}
if (Item.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps && _room.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().WiredType == WiredBoxType.EffectRegenerateMaps).Count() > 0)
return false;
List<Item> ItemsOnTile = GetFurniObjects(newX, newY);
if (Item.GetBaseItem().InteractionType == InteractionType.ROLLER && ItemsOnTile.Where(x => x.GetBaseItem().InteractionType == InteractionType.ROLLER && x.Id != Item.Id).Count() > 0)
return 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)
_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)
{
_room.GetGameMap().AddToMap(Item);
}
return false;
}
}
// Start calculating new Z coordinate
Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];
if (!OnRoller)
{
// Make sure this tile is open and there are no users here
if (_room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN && !Item.GetBaseItem().IsSeat)
{
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().GetRoomUsers(new Point(Tile.X, Tile.Y)).Count > 0)
{
if (NeedsReAdd)
_room.GetGameMap().AddToMap(Item);
return false;
}
}
}
}
// Find affected objects
var ItemsAffected = new List<Item>();
var ItemsComplete = new List<Item>();
foreach (ThreeDCoord Tile in AffectedTiles.Values.ToList())
{
List<Item> 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 (Item I in ItemsComplete.ToList())
{
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.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
newZ = Item.GetZ;
Double StackingTile = 0;
// Are there any higher objects in the stack!?
foreach (Item I in ItemsComplete.ToList())
{
if (I == null)
continue;
if (I.Id == Item.Id)
continue; // cannot stack on self
if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
StackingTile = I.GetZ;
if (I.TotalHeight > newZ)
newZ = StackingTile != 0 ? StackingTile : I.TotalHeight;
}
}
// Verify the rotation is correct
if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8 && !Item.GetBaseItem().ExtraRot)
newRot = 0;
Item.Rotation = 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 (_floorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
_room.GetGameMap().RemoveFromMap(Item);
return true;
}
if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
_floorItems.TryAdd(Item.Id, Item);
else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
_wallItems.TryAdd(Item.Id, Item);
if (sendMessage)
_room.SendMessage(new ObjectAddComposer(Item, _room));
}
else
{
UpdateItem(Item);
if (!OnRoller && sendMessage)
_room.SendMessage(new ObjectUpdateComposer(Item, _room.OwnerId));
}
_room.GetGameMap().AddToMap(Item);
if (Item.GetBaseItem().IsSeat)
updateRoomUserStatuses = true;
if (updateRoomUserStatuses)
_room.GetRoomUserManager().UpdateUserStatusses();
if (Item.GetBaseItem().InteractionType == InteractionType.TENT || Item.GetBaseItem().InteractionType == InteractionType.TENT_SMALL)
{
_room.RemoveTent(Item.Id, Item);
_room.AddTent(Item.Id);
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.RunQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "' WHERE `id` = '" + Item.Id + "' LIMIT 1");
}
return true;
}
public List<Item> GetFurniObjects(int X, int Y)
{
return _room.GetGameMap().GetCoordinatedItems(new Point(X, Y));
}
public bool SetFloorItem(Item Item, int newX, int newY, Double newZ)
{
if (_room == null)
return false;
_room.GetGameMap().RemoveFromMap(Item);
Item.SetState(newX, newY, newZ, Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, Item.Rotation));
if (Item.GetBaseItem().InteractionType == InteractionType.TONER)
{
if (_room.TonerData == null)
{
_room.TonerData = new TonerData(Item.Id);
}
}
UpdateItem(Item);
_room.GetGameMap().AddItemToMap(Item);
return true;
}
public bool SetWallItem(GameClient Session, Item Item)
{
if (!Item.IsWallItem || _wallItems.ContainsKey(Item.Id))
return false;
if (_floorItems.ContainsKey(Item.Id))
{
Session.SendNotification(PlusEnvironment.GetGame().GetLanguageLocale().TryGetValue("room_item_placed"));
return true;
}
Item.Interactor.OnPlace(Session, Item);
if (Item.GetBaseItem().InteractionType == InteractionType.MOODLIGHT)
{
if (_room.MoodlightData == null)
{
_room.MoodlightData = new MoodlightData(Item.Id);
Item.ExtraData = _room.MoodlightData.GenerateExtraData();
}
}
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("UPDATE `items` SET `room_id` = '" + _room.RoomId + "', `x` = '" + Item.GetX + "', `y` = '" + Item.GetY + "', `z` = '" + Item.GetZ + "', `rot` = '" + Item.Rotation + "', `wall_pos` = @WallPos WHERE `id` = '" + Item.Id + "' LIMIT 1");
dbClient.AddParameter("WallPos", Item.wallCoord);
dbClient.RunQuery();
}
_wallItems.TryAdd(Item.Id, Item);
_room.SendMessage(new ItemAddComposer(Item));
return true;
}
public void UpdateItem(Item item)
{
if (item == null)
return;
if (!_movedItems.ContainsKey(item.Id))
_movedItems.TryAdd(item.Id, item);
}
public void RemoveItem(Item item)
{
if (item == null)
return;
if (_movedItems.ContainsKey(item.Id))
_movedItems.TryRemove(item.Id, out item);
if (_rollers.ContainsKey(item.Id))
_rollers.TryRemove(item.Id, out item);
}
public void OnCycle()
{
if (mGotRollers)
{
try
{
_room.SendMessage(CycleRollers());
}
catch //(Exception e)
{
// Logging.LogThreadException(e.ToString(), "rollers for room with ID " + room.RoomId);
mGotRollers = false;
}
}
if (_roomItemUpdateQueue.Count > 0)
{
List<Item> addItems = new List<Item>();
while (_roomItemUpdateQueue.Count > 0)
{
var item = (Item)null;
if (_roomItemUpdateQueue.TryDequeue(out item))
{
item.ProcessUpdates();
if (item.UpdateCounter > 0)
addItems.Add(item);
}
}
foreach (Item item in addItems.ToList())
{
if (item == null)
continue;
_roomItemUpdateQueue.Enqueue(item);
}
}
//mFloorItems.OnCycle();
//mWallItems.OnCycle();
}
public List<Item> RemoveItems(GameClient Session)
{
List<Item> Items = new List<Item>();
foreach (Item Item in this.GetWallAndFloor.ToList())
{
if (Item == null || Item.UserID != Session.GetHabbo().Id)
continue;
if (Item.IsFloorItem)
{
Item I = null;
this._floorItems.TryRemove(Item.Id, out I);
Session.GetHabbo().GetInventoryComponent()._floorItems.TryAdd(Item.Id, I);
this._room.SendMessage(new ObjectRemoveComposer(Item, Item.UserID));
}
else if (Item.IsWallItem)
{
Item I = null;
this._wallItems.TryRemove(Item.Id, out I);
Session.GetHabbo().GetInventoryComponent()._wallItems.TryAdd(Item.Id, I);
this._room.SendMessage(new ItemRemoveComposer(Item, Item.UserID));
}
this._room.GetGameMap().GenerateMaps();
Session.SendMessage(new FurniListAddComposer(Item));
}
return Items;
}
public ICollection<Item> GetFloor
{
get
{
return this._floorItems.Values;
}
}
public ICollection<Item> GetWall
{
get
{
return this._wallItems.Values;
}
}
public IEnumerable<Item> GetWallAndFloor
{
get
{
return this._floorItems.Values.Concat(this._wallItems.Values);
}
}
public bool CheckPosItem(GameClient Session, Item Item, int newX, int newY, int newRot, bool newItem, bool SendNotify = true)
{
try
{
Dictionary<int, ThreeDCoord> dictionary = Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, newRot);
if (!this._room.GetGameMap().ValidTile(newX, newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if ((this._room.GetGameMap().Model.DoorX == coord.X) && (this._room.GetGameMap().Model.DoorY == coord.Y))
return false;
}
if ((this._room.GetGameMap().Model.DoorX == newX) && (this._room.GetGameMap().Model.DoorY == newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (!this._room.GetGameMap().ValidTile(coord.X, coord.Y))
return false;
}
double num = this._room.GetGameMap().Model.SqFloorHeight[newX, newY];
if ((((Item.Rotation == newRot) && (Item.GetX == newX)) && (Item.GetY == newY)) && (Item.GetZ != num))
return false;
if (this._room.GetGameMap().Model.SqState[newX, newY] != SquareState.OPEN)
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (this._room.GetGameMap().Model.SqState[coord.X, coord.Y] != SquareState.OPEN)
return false;
}
if (!Item.GetBaseItem().IsSeat)
{
if (this._room.GetGameMap().SquareHasUsers(newX, newY))
return false;
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
if (this._room.GetGameMap().SquareHasUsers(coord.X, coord.Y))
return false;
}
}
List<Item> furniObjects = this.GetFurniObjects(newX, newY);
List<Item> collection = new List<Item>();
List<Item> list3 = new List<Item>();
foreach (ThreeDCoord coord in dictionary.Values.ToList())
{
List<Item> list4 = this.GetFurniObjects(coord.X, coord.Y);
if (list4 != null)
collection.AddRange(list4);
}
if (furniObjects == null)
furniObjects = new List<Item>();
list3.AddRange(furniObjects);
list3.AddRange(collection);
foreach (Item item in list3.ToList())
{
if ((item.Id != Item.Id) && !item.GetBaseItem().Stackable)
return false;
}
return true;
}
catch
{
return false;
}
}
public ICollection<Item> GetRollers()
{
return this._rollers.Values;
}
public void Dispose()
{
foreach (Item Item in this.GetWallAndFloor.ToList())
{
if (Item == null)
continue;
Item.Destroy();
}
_floorItems.Clear();
_wallItems.Clear();
_movedItems.Clear();
this._roomItemUpdateQueue = null;
_room = null;
_floorItems = null;
_wallItems = null;
_movedItems = null;
_wallItems = null;
_roomItemUpdateQueue = null;
}
}
}
Last edited by a moderator: