private void UpdateRollerFurni(FurniInfo info, int nextX, int nextY, float nextZ, bool isLastRoller, int rollerId) { ClientMessage mMessage = new ClientMessage(); mMessage.Init(230); // Cf mMessage.appendArgumentInt(info.PosX); mMessage.appendArgumentInt(info.PosY); mMessage.appendArgumentInt(nextX); mMessage.appendArgumentInt(nextY); mMessage.appendArgumentInt(1); mMessage.appendArgumentInt(info.FurniID); mMessage.appendString(info.PosZ.ToString().Replace(',', '.')); mMessage.appendChar(2); mMessage.appendString(nextZ.ToString().Replace(',', '.')); mMessage.appendChar(2); mMessage.appendArgumentInt(rollerId); mRollerBroadcast.Append(mMessage.ToString()); info.PosX = nextX; info.PosY = nextY; info.PosZ = nextZ; InstanceManager.Game.Furni.MoveFloorItem(info.FurniID, info.PosX, info.PosY, info.PosZ, info.PosRotation, mRoomInstance.RoomInfo); }
public void RequestDecorateRoom(int itemId, int userId) { if (InstanceManager.Game.Furni.FurniExists(itemId)) { FurniInfo info = InstanceManager.Game.Furni.GetFurni(itemId); if (info.Flags.Decoration && info.OwnerID == userId) { if (info.FurniSprite == "wallpaper") { mRoomInstance.RoomInfo.Wallpaper = int.Parse(info.FurniVar); } else if (info.FurniSprite == "floor") { mRoomInstance.RoomInfo.Floor = int.Parse(info.FurniVar); } InstanceManager.Game.Rooms.UpdateRoom(mRoomInstance.RoomInfo); ClientMessage mMessage = new ClientMessage(); mMessage.Init(46); //@n mMessage.appendString(info.FurniSprite); mMessage.appendString("/"); mMessage.appendString(info.FurniVar); mRoomInstance.RoomBroadcast(mMessage); InstanceManager.Game.Furni.DeleteFurni(info.FurniID); } } }
public void RequestOpenPresent(int userId, int presentId, Users.UserInfo userInfo, long sessionId) { if (ContainsItem(presentId)) { FurniInfo furni = GetFurniObject(presentId); if (furni != null) { if (furni.Flags.Gift) { GiftInfo gift = InstanceManager.Game.Furni.GetGift(presentId); int newId = 0; InstanceManager.Game.Catalogue.BuyItem("0", gift.PurchaseCode, gift.Payload, ref userInfo, true, ref newId); InstanceManager.Game.Furni.DeleteGift(presentId); InstanceManager.Game.Furni.DeleteFurni(presentId); mFloorFurni = InstanceManager.Game.Furni.GetRoomFloorFurni(mRoomInstance.RoomInfo.RoomID); FurniInfo info = InstanceManager.Game.Furni.GetFurni(newId); ClientMessage mMessage = new ClientMessage(); mMessage.Init(129); //BA mMessage.appendString(info.FurniSprite); mMessage.appendChar(13); mMessage.appendString(info.FurniSprite); if (info.Flags.WallItem) { mMessage.appendString(" "); mMessage.appendString(info.Col); mMessage.appendChar(13); } else { mMessage.appendChar(13); mMessage.appendInt(info.L); mMessage.appendChar(13); mMessage.appendInt(info.W); mMessage.appendChar(13); mMessage.appendString(info.Col); } mRoomInstance.SendMessage(mMessage, sessionId); mMessage.Init(94); // A^ mMessage.appendInt(presentId); mRoomInstance.RoomBroadcast(mMessage); GenerateMaps(); mMessage.Init(31); //@_ mMessage.appendString(ClientMap); mRoomInstance.RoomBroadcast(mMessage); } } } }
public void TeleporterActivate(int itemId, RoomUser user) { FurniInfo item = GetFurniObject(itemId); if (item != null) { new ProcessTeleporterDelegate(ProcessTeleporter).BeginInvoke(item, user, null, null); } }
private int FindTileOffset(FurniInfo info, int x, int y) { Dictionary <int, AffectedTile> pointList = GetAffectedTiles(info); foreach (int tileOffset in pointList.Keys) { if (pointList[tileOffset].X == x && pointList[tileOffset].Y == y) { return(pointList[tileOffset].I); } } return(-1); }
public static ItemDescriptor GetDescriptor(this IItem item) { FurniInfo info = FurniData.GetInfo(item) ?? throw new Exception($"Failed to find furni info for {item.Type.ToString().ToLower()} item {item.Kind}."); string?variant = null; if (info.Identifier == "poster") { variant = GetVariant(item); } return(new ItemDescriptor(item.Type, item.Kind, variant)); }
public void RequestMoveFloorItem(int itemId, int newX, int newY, int newRot, bool firstTime, long sessionId) { FurniInfo item = GetFurniObject(itemId); mFloorFurni.Remove(item); bool result = ExecuteFloorMoveItem(item, itemId, newX, newY, newRot, firstTime, sessionId); if (!result) { mFloorFurni.Add(item); } SendFurniMovement(firstTime, !result, itemId, sessionId); }
private string ProcessWallFurniDefinition(FurniInfo wallItem) { StringBuilder sb = new StringBuilder(); sb.Append(wallItem.FurniID.ToString()); sb.Append(Convert.ToChar(9)); sb.Append(wallItem.FurniSprite); sb.Append(Convert.ToChar(9)); sb.Append(" "); sb.Append(Convert.ToChar(9)); sb.Append(wallItem.WallLocation); sb.Append(Convert.ToChar(9)); sb.Append(wallItem.Col); return(sb.ToString()); }
public void RequestWallMoveItem(int itemId, string newPos, long sessionId) { FurniInfo info = InstanceManager.Game.Furni.GetFurni(itemId); if (info.OwnerID == mRoomInstance.GetUser(sessionId).UserInfo.userId) { if (info.Flags.StickyNote) { int left = int.Parse(info.FurniVar); if (left > 0) { int newFurni = InstanceManager.Game.Furni.CreateNewFurni(info.FurniTypeId, mRoomInstance.GetUser(sessionId).UserInfo.userId); left--; if (left == 0) { InstanceManager.Game.Furni.DeleteFurni(itemId); } else { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, left.ToString()); } itemId = newFurni; } else { InstanceManager.Game.Furni.DeleteFurni(itemId); } } newPos = WallPositionCheck(newPos); if (newPos != null) { InstanceManager.Game.Furni.MoveWallItem(itemId, newPos, mRoomInstance.RoomInfo.RoomID, mRoomInstance.RoomInfo.RoomOwner); mWallFurni = InstanceManager.Game.Furni.GetRoomWallFurni(mRoomInstance.RoomInfo.RoomID); FurniInfo newInfo = GetFurniObject(itemId); ClientMessage mMessage = new ClientMessage(); mMessage.Init(83); //AS mMessage.appendString(ProcessWallFurniDefinition(newInfo)); mRoomInstance.RoomBroadcast(mMessage); } } }
private string ProcessFloorObjectDefinition(FurniInfo info) { StringBuilder sb = new StringBuilder(); sb.Append(info.FurniID.ToString()); sb.Append(" "); sb.Append(info.FurniSprite); sb.Append(" "); sb.Append(info.PosX); sb.Append(" "); sb.Append(info.PosY); sb.Append(" "); sb.Append(info.PosZ); sb.Append(" "); sb.Append(info.PosRotation); sb.Append(Convert.ToChar(13).ToString()); return(sb.ToString()); }
public static string?GetName(this ItemDescriptor descriptor) { FurniInfo info = FurniData.GetInfo(descriptor.Type, descriptor.Kind) ?? throw new Exception($"Failed to find furni info for {descriptor.Type.ToString().ToLower()} item {descriptor.Kind}."); string name = info.Name; if (info.Identifier == "poster") { string key = $"poster_{descriptor.Variant}_name"; if (Texts.ContainsKey(key)) { name = Texts[key]; } } return(string.IsNullOrWhiteSpace(name) ? info.Identifier : name); }
//83 - "G_IDATA": "AS" public void Listener83() { int itemId = 0; if (int.TryParse(mPacketBody, out itemId)) { if (InstanceManager.Game.Furni.FurniExists(itemId)) { FurniInfo info = InstanceManager.Game.Furni.GetFurni(itemId); mMessage.Init(48); //@p mMessage.appendInt(itemId); mMessage.appendChar(9); mMessage.appendString(info.Col); mMessage.appendString(" "); mMessage.appendString(info.FurniVar); SendMessage(mMessage); } } }
public void RequestChangeStickyData(int itemId, string newMessage, int newItemType, long sessionId) { if (ContainsItem(itemId)) { FurniInfo info = GetFurniObject(itemId); if (info != null) { if (info.Flags.StickyNote) { if (newItemType > 0) { InstanceManager.Game.Furni.SetItemType(itemId, newItemType); } if (newMessage.Length > 685) { newMessage = newMessage.Substring(0, 685); } newMessage = SpecialFiltering.FilterChars("2,9,47", newMessage); InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, newMessage); mWallFurni = InstanceManager.Game.Furni.GetRoomWallFurni(mRoomInstance.RoomInfo.RoomID); info = GetFurniObject(itemId); ClientMessage message = new ClientMessage(); message.Init(85); //AU message.appendInt(itemId); message.appendChar(9); message.appendString(info.FurniSprite); message.appendChar(9); message.appendString(" "); message.appendString(info.WallLocation); message.appendChar(9); message.appendString(info.Col); mRoomInstance.RoomBroadcast(message); } } } }
public void RequestPickupFloorStuff(int itemId, int userId) { if (ContainsItem(itemId)) { FurniInfo furni = GetFurniObject(itemId); if (furni != null) { if (!furni.Flags.WallItem) { InstanceManager.Game.Furni.PickupItem(itemId, userId); mFloorFurni = InstanceManager.Game.Furni.GetRoomFloorFurni(mRoomInstance.RoomInfo.RoomID); ClientMessage mMessage = new ClientMessage(); mMessage.Init(94); // A^ mMessage.appendInt(itemId); mRoomInstance.RoomBroadcast(mMessage); GenerateMaps(); mMessage.Init(31); //@_ mMessage.appendString(ClientMap); mRoomInstance.RoomBroadcast(mMessage); // Remove statuses on users effected by this item UpdateChangedUsers(furni.PosX, furni.PosY); Dictionary <int, AffectedTile> affectedTiles = GetAffectedTiles(furni); foreach (AffectedTile affectedTile in affectedTiles.Values) { UpdateChangedUsers(affectedTile.X, affectedTile.Y); } } } } }
//90 - "PLACESTUFF": "AZ" public void Listener90() { int itemID = int.Parse(mPacketBody.Split(' ')[0]); FurniInfo info = InstanceManager.Game.Furni.GetFurni(itemID); if (info.Flags.Decoration) { return; } if (info.Flags.WallItem) //Wall item { string newPos = mPacketBody.Substring(itemID.ToString().Length + 1); RoomUser rUser = mRoomInstance.GetUser(mSessionID); if (rUser.HasRights || rUser.HasAdmin) { mRoomInstance.Interactor.RequestWallMoveItem(itemID, newPos, mSessionID); InstanceManager.Sessions.InvokeReactorMethod(mSessionID, "UpdateHandInvoker"); } } else // Floor Item { string[] data = mPacketBody.Split(' '); int x = int.Parse(data[1]); int y = int.Parse(data[2]); int rot = 0; RoomUser rUser = mRoomInstance.GetUser(mSessionID); if (rUser.HasRights || rUser.HasAdmin) { mRoomInstance.Interactor.RequestMoveFloorItem(itemID, x, y, rot, true, mSessionID); InstanceManager.Sessions.InvokeReactorMethod(mSessionID, "UpdateHandInvoker"); } } }
private string ProcessFloorFurniDefinition(FurniInfo info) { StringBuilder sb = new StringBuilder(); sb.Append(info.FurniID); sb.Append(Convert.ToChar(2)); sb.Append(info.FurniSprite); sb.Append(Convert.ToChar(2)); sb.Append(ArgumentEncoding.encodeInt(info.PosX)); sb.Append(ArgumentEncoding.encodeInt(info.PosY)); sb.Append(ArgumentEncoding.encodeInt(info.W)); sb.Append(ArgumentEncoding.encodeInt(info.L)); sb.Append(ArgumentEncoding.encodeInt(info.PosRotation)); sb.Append(info.PosZ.ToString().Replace(',', '.')); sb.Append(Convert.ToChar(2)); sb.Append(info.Col); sb.Append(Convert.ToChar(2)); sb.Append(Convert.ToChar(2)); sb.Append(ArgumentEncoding.encodeInt(info.TeleportId)); sb.Append(info.FurniVar); sb.Append(Convert.ToChar(2)); return(sb.ToString()); }
public void RequestPickupWallItem(int itemId, int userId) { if (ContainsItem(itemId)) { FurniInfo info = GetFurniObject(itemId); if (info != null) { if (info.Flags.WallItem) { if (!info.Flags.StickyNote) //Can't pick up stickies { InstanceManager.Game.Furni.PickupItem(itemId, userId); mWallFurni = InstanceManager.Game.Furni.GetRoomWallFurni(mRoomInstance.RoomInfo.RoomID); ClientMessage mMessage = new ClientMessage(); mMessage.Init(84); // AT mMessage.appendInt(itemId); mRoomInstance.RoomBroadcast(mMessage); } } } } }
public void TeleporterGoIn(int itemId, RoomUser user) { FurniInfo item = GetFurniObject(itemId); if (item != null) { if (item.Flags.IsTeleport) { if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY) && PlayerCheck(item.PosX, item.PosY) == false) { user.IsMoving = true; user.TargetX = item.PosX; user.TargetY = item.PosY; user.AllowOveride = true; user.Path.Clear(); PathFinderNode node = new PathFinderNode(); node.X = item.PosX; node.Y = item.PosY; user.Path.Add(node); } } } }
public void RequestDeleteSticky(int itemId, int userId, long sessionId) { if (ContainsItem(itemId)) { FurniInfo info = GetFurniObject(itemId); if (info.Flags.StickyNote) { InstanceManager.Game.Furni.DeleteFurni(itemId); mWallFurni = InstanceManager.Game.Furni.GetRoomWallFurni(mRoomInstance.RoomInfo.RoomID); ClientMessage mMessage = new ClientMessage(); mMessage.Init(84); // AT mMessage.appendInt(itemId); mRoomInstance.RoomBroadcast(mMessage); } else { RequestPickupWallItem(itemId, userId); InstanceManager.Sessions.InvokeReactorMethod(sessionId, "UpdateHandInvoker"); } } }
public void SendFurniMovement(bool firstTime, bool badTile, int itemId, long sessionId) { FurniInfo newInfo = GetFurniObject(itemId); string data = ProcessFloorFurniDefinition(newInfo); ClientMessage mMessage = new ClientMessage(); if (firstTime) { mMessage.Init(93); // A] } else { mMessage.Init(95); // A_ } mMessage.appendString(data); if (!badTile) { mRoomInstance.RoomBroadcast(mMessage); GenerateMaps(); mMessage.Init(31); //@_ mMessage.appendString(ClientMap); mRoomInstance.RoomBroadcast(mMessage); } else { if (!firstTime) { mRoomInstance.SendMessage(mMessage, sessionId); } } }
private Dictionary <int, AffectedTile> GetAffectedTiles(FurniInfo info) { return(GetAffectedTiles(info.L, info.W, info.PosX, info.PosY, info.PosRotation)); }
public static IEnumerable <T> OfKind <T>(this IEnumerable <T> items, FurniInfo furniInfo) where T : IItem => OfKind(items, furniInfo.Type, furniInfo.Kind);
public void RequestSetStuffDataFloorItem(int itemId, string data, RoomUser user, FurniInfo.VarTypes overrideType) { FurniInfo item = GetFurniObject(itemId); ClientMessage mMessage = new ClientMessage(); if (item != null) { if (overrideType != 0) { item.VarType = overrideType; } switch (item.VarType) { case FurniInfo.VarTypes.TempOpen: if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY)) { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, "FALSE"); if (data == "TRUE") { NotifyClientSetStuffTempOpen(itemId); } } break; case FurniInfo.VarTypes.TrueFalse: if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY)) { if ((data == "TRUE" || data == "FALSE")) { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data); NotifyClientSetStuffChange(itemId, data); } } break; case FurniInfo.VarTypes.DoorDivider: if (user.HasAdmin || user.HasRights) { if (data == "O" || data == "C") { if (!PlayerCheck(item.PosX, item.PosY)) { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data); NotifyClientSetStuffChange(itemId, data); mFloorFurni = InstanceManager.Game.Furni.GetRoomFloorFurni(mRoomInstance.RoomInfo.RoomID); GenerateMaps(); } } } break; case FurniInfo.VarTypes.Dice: if (TilesTouching(item.PosX, item.PosY, user.CurrentX, user.CurrentY)) { if (data == "dice_roll" || data == "dice_off") { int newVal = 0; if (data == "dice_roll") { newVal = SpecialMath.RandomNumber(1, 6); } bool isRoll = newVal > 0; int rollVal = (item.FurniID * 38) + newVal; InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, newVal.ToString()); NotifyClientDiceRoll(item.FurniID, rollVal, isRoll); } } break; case FurniInfo.VarTypes.Bottle: if (data == "dice_roll") { int newVal = SpecialMath.RandomNumber(0, 7); bool isRoll = newVal > 0; int rollVal = (item.FurniID * 38) + newVal; InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, newVal.ToString()); NotifyClientDiceRoll(item.FurniID, rollVal, isRoll); } break; case FurniInfo.VarTypes.OnOff: if (data == "ON" || data == "OFF") { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data); NotifyClientSetStuffChange(itemId, data); } break; case FurniInfo.VarTypes.OpenOrClosed: if (data == "O" || data == "C") { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data); NotifyClientSetStuffChange(itemId, data); } break; case FurniInfo.VarTypes.NumericalOff: int tmpNum = -1; if (int.TryParse(data, out tmpNum) || data == "OFF") { if (tmpNum >= -1 && tmpNum < 10 && !(tmpNum == -1 && data == "-1")) { InstanceManager.Game.Furni.SetStuffDataFloorItem(itemId, data); NotifyClientSetStuffChange(itemId, data); } } break; } } }
private void ProcessTeleporter(FurniInfo Teleporter1, RoomUser user) { FurniInfo Teleporter2 = null; Point invalidPoint = new Point(Teleporter1.PosX, Teleporter1.PosY); if (Teleporter1.PosRotation == 0 || Teleporter1.PosRotation == 2) { invalidPoint.X++; } if (Teleporter1.PosRotation == 4) { invalidPoint.Y++; } if (InstanceManager.Game.Furni.FurniExists(Teleporter1.TeleportId)) { Teleporter2 = InstanceManager.Game.Furni.GetFurni(Teleporter1.TeleportId); } if (!user.UserLocked) { user.UserLocked = true; Thread.Sleep(1000); if (Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY) { ClientMessage message = new ClientMessage(); if (Teleporter2 != null && Teleporter2.RoomID > 0 && Teleporter1.Flags.IsTeleport && Teleporter2.Flags.IsTeleport) { message.Init(89); //AY message.appendInt(Teleporter1.FurniID); message.appendString("/"); message.appendString(user.UserInfo.sUsername); message.appendString("/"); message.appendString(Teleporter1.FurniSprite); mRoomInstance.RoomBroadcast(message); if (Teleporter2.RoomID == Teleporter1.RoomID) //Same room { Thread.Sleep(2000); Teleporter2 = InstanceManager.Game.Furni.GetFurni(Teleporter1.TeleportId); Teleporter1 = InstanceManager.Game.Furni.GetFurni(Teleporter1.FurniID); if (Teleporter2.RoomID == Teleporter1.RoomID && Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY) { message.Init(92); //A\ message.appendInt(Teleporter2.FurniID); message.appendString("/"); message.appendString(user.UserInfo.sUsername); message.appendString("/"); message.appendString(Teleporter2.FurniSprite); mRoomInstance.RoomBroadcast(message); mPlayerMap[user.CurrentX, user.CurrentY] = false; user.CurrentX = Teleporter2.PosX; user.CurrentY = Teleporter2.PosY; user.CurrentZ = Teleporter2.PosZ; mRoomInstance.AnnounceUserStatus(user.SessionID, true); mPlayerMap[user.CurrentX, user.CurrentY] = true; user.UserLocked = false; } else { if (Teleporter1.PosX == user.CurrentX && Teleporter1.PosY == user.CurrentY) { RequestSetStuffDataFloorItem(Teleporter1.FurniID, "TRUE", user, FurniInfo.VarTypes.TempOpen); RequestMovePlayer(user.SessionID, invalidPoint.X, invalidPoint.Y, null, true); } user.UserLocked = false; } } else //In another room { InstanceManager.Sessions.GetSession(user.SessionID).authenticatedDoor = Teleporter2.FurniID; InstanceManager.Sessions.GetSession(user.SessionID).authenticatedFlat = Teleporter2.RoomID; message.Init(62); //@~ message.appendArgumentInt(Teleporter2.FurniID); message.appendArgumentInt(Teleporter2.RoomID); mRoomInstance.SendMessage(message, user.SessionID); } } else //No linked teleporter exists { Thread.Sleep(700); RequestSetStuffDataFloorItem(Teleporter1.FurniID, "TRUE", user, FurniInfo.VarTypes.TempOpen); RequestMovePlayer(user.SessionID, invalidPoint.X, invalidPoint.Y, null, true); user.UserLocked = false; } } } }
private bool ExecuteFloorMoveItem(FurniInfo item, int itemId, int newX, int newY, int newRot, bool firstTime, long sessionId) { int furniCount = 0; int rollerCount = 0; //Work out new affectedTiles Dictionary <int, AffectedTile> affectedTiles = GetAffectedTiles(item.L, item.W, newX, newY, newRot); //Verify the new tiles exist if (!ValidTile(item.PosX, item.PosY)) { return(false); } foreach (AffectedTile tile in affectedTiles.Values) { if (!ValidTile(tile.X, tile.Y)) { return(false); } } //Verify the user has rights, or owns the item if they are dropping it if (firstTime && item.OwnerID != mRoomInstance.GetUser(sessionId).UserInfo.userId) { return(false); } if (!firstTime && item.RoomID != mRoomInstance.RoomInfo.RoomID) { return(false); } //Verify if it's the first time and not the users room, the item is tradeable if (firstTime && mRoomInstance.RoomInfo.RoomOwner != mRoomInstance.GetUser(sessionId).UserInfo.userId&& item.CanTrade == false) { return(false); } //Calculate the new height according to the heightmap float newZ = mHeightMap[newX, newY]; //Is the item trying to stack on itself? if (item.PosRotation == newRot && item.PosX == newX && item.PosY == newY && item.PosZ != newZ) { return(false); } //Check it's not a bad heightmap tile if (mClientMap[newX, newY] == "x") { return(false); } foreach (AffectedTile tile in affectedTiles.Values) { if (mClientMap[tile.X, tile.Y] == "x") { return(false); } } //Check for players if (mPlayerMap[newX, newY] && !(item.PosRotation != newRot && item.PosX == newX && item.PosY == newY)) { return(false); } foreach (AffectedTile tile in affectedTiles.Values) { if (mPlayerMap[tile.X, tile.Y]) { return(false); } } //Get the furniture counts (not including this item) foreach (FurniInfo tmp in mFloorFurni) { furniCount++; if (tmp.Flags.IsRoller) { rollerCount++; } } //Get the affected objects List <FurniInfo> objectsOnTile = GetFurniObjects(newX, newY); List <FurniInfo> objectsAffected = new List <FurniInfo>(); List <FurniInfo> objectsComplete = new List <FurniInfo>(); foreach (AffectedTile tile in affectedTiles.Values) { List <FurniInfo> objectsTmp = GetFurniObjects(tile.X, tile.Y); if (objectsTmp != null) { objectsAffected.AddRange(objectsTmp); } } //Check the item isn't a roller and furni exists if (objectsComplete.Count > 0 && item.Flags.IsRoller) { return(false); } if (objectsOnTile == null) { objectsOnTile = new List <FurniInfo>(); } objectsComplete.AddRange(objectsOnTile); if (objectsAffected == null) { objectsAffected = new List <FurniInfo>(); } objectsComplete.AddRange(objectsAffected); //Check you can stack the item if (objectsComplete.Count > 0 && !item.Flags.CanStack) { return(false); } //Check for nonstackable items and rollers foreach (FurniInfo info in objectsComplete) { if (!info.Flags.CanStackOn || (info.Flags.IsRoller && (item.W > 1 || item.L > 1))) { return(false); } } //Rotating the item, should remain at the same height for now if (item.PosRotation != newRot && item.PosX == newX && item.PosY == newY) { newZ = item.PosZ; } //Are any of the other tiles higher? foreach (FurniInfo info in objectsAffected) { if (info.TotalHeight > newZ) { newZ = info.TotalHeight; } } //Impose stacking limit if (newZ > MaxStackHeight) { newZ = MaxStackHeight; } //Impose furni limit if (furniCount >= 125 && firstTime) { ClientMessage mMessage = new ClientMessage(); mMessage.Init(139); //BK mMessage.appendString(InstanceManager.Game.Externals.GetTextValue("room_alert_furni_limit")); mRoomInstance.SendMessage(mMessage, sessionId); return(false); } //Impose roller limit if (item.Flags.IsRoller) { if (rollerCount >= 10 && firstTime) { ClientMessage mMessage = new ClientMessage(); mMessage.Init(139); //BK mMessage.appendString(InstanceManager.Game.Externals.GetTextValue("queue_tile_limit")); mRoomInstance.SendMessage(mMessage, sessionId); return(false); } } //Ensure it's a valid rotation if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8) { newRot = 0; } //Move the item int oldX = item.PosX; int oldY = item.PosY; affectedTiles = GetAffectedTiles(item); InstanceManager.Game.Furni.MoveFloorItem(itemId, newX, newY, newZ, newRot, mRoomInstance.RoomInfo); mFloorFurni = InstanceManager.Game.Furni.GetRoomFloorFurni(mRoomInstance.RoomInfo.RoomID); GenerateMaps(); // Remove statuses on users affected by this item UpdateChangedUsers(oldX, oldY); foreach (AffectedTile affectedTile in affectedTiles.Values) { UpdateChangedUsers(affectedTile.X, affectedTile.Y); } return(true); }