public WiredTriggerConfigComposer(IWiredItem Box, List <int> BlockedItems) : base(ServerPacketHeader.WiredTriggerConfigMessageComposer) { base.WriteBoolean(false); base.WriteInteger(5); base.WriteInteger(Box.SetItems.Count); foreach (Item Item in Box.SetItems.Values.ToList()) { base.WriteInteger(Item.Id); } base.WriteInteger(Box.Item.GetBaseItem().SpriteId); base.WriteInteger(Box.Item.Id); base.WriteString(Box.StringData); base.WriteInteger(Box is IWiredCycle ? 1 : 0); if (Box is IWiredCycle) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(Cycle.Delay); } base.WriteInteger(0); base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(BlockedItems.Count()); if (BlockedItems.Count() > 0) { foreach (int Id in BlockedItems.ToList()) { base.WriteInteger(Id); } } }
public void OnCycle() { DateTime Start = DateTime.Now; foreach (KeyValuePair <int, IWiredItem> Item in _wiredItems.ToList()) { Item SelectedItem = _room.GetRoomItemHandler().GetItem(Item.Value.Item.Id); if (SelectedItem == null) { TryRemove(Item.Key); } if (Item.Value is IWiredCycle) { IWiredCycle Cycle = (IWiredCycle)Item.Value; if (Cycle.TickCount <= 0) { Cycle.OnCycle(); } else { Cycle.TickCount--; } } } TimeSpan Span = (DateTime.Now - Start); if (Span.Milliseconds > 400) { //log.Warn("<Room " + _room.Id + "> Wired took " + Span.TotalMilliseconds + "ms to execute - Rooms lagging behind"); } }
public void SaveBox(IWiredItem item) { var items = ""; IWiredCycle cycle = null; if (item is IWiredCycle) { cycle = (IWiredCycle)item; } foreach (var I in item.SetItems.Values) { var selectedItem = _room.GetRoomItemHandler().GetItem(Convert.ToInt32(I.Id)); if (selectedItem == null) { continue; } if (item.Type == WiredBoxType.EffectMatchPosition || item.Type == WiredBoxType.ConditionMatchStateAndPosition || item.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { items += I.Id + ":" + I.GetX + "," + I.GetY + "," + I.GetZ + "," + I.Rotation + "," + I.ExtraData + ";"; } else { items += I.Id + ";"; } } if (item.Type == WiredBoxType.EffectMatchPosition || item.Type == WiredBoxType.ConditionMatchStateAndPosition || item.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { item.ItemsData = items; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("REPLACE INTO `wired_items` VALUES (@id, @items, @delay, @string, @bool)"); dbClient.AddParameter("id", item.Item.Id); dbClient.AddParameter("items", items); dbClient.AddParameter("delay", item is IWiredCycle ? cycle.Delay : 0); dbClient.AddParameter("string", item.StringData); dbClient.AddParameter("bool", item.BoolData ? "1" : "0"); dbClient.RunQuery(); } }
public void SaveBox(IWiredItem Item) { string Items = ""; IWiredCycle Cycle = null; if (Item is IWiredCycle) { Cycle = (IWiredCycle)Item; } foreach (Item I in Item.SetItems.Values) { Item SelectedItem = _room.GetRoomItemHandler().GetItem(Convert.ToInt32(I.Id)); if (SelectedItem == null) { continue; } if (Item.Type == WiredBoxType.EffectMatchPosition || Item.Type == WiredBoxType.ConditionMatchStateAndPosition || Item.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { Items += I.Id + ":" + I.GetX + "," + I.GetY + "," + I.GetZ + "," + I.Rotation + "," + I.ExtraData + ";"; } else { Items += I.Id + ";"; } } if (Item.Type == WiredBoxType.EffectMatchPosition || Item.Type == WiredBoxType.ConditionMatchStateAndPosition || Item.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { Item.ItemsData = Items; } using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("REPLACE INTO `wired_items` VALUES (@id, @items, @delay, @string, @bool)"); dbClient.AddParameter("id", Item.Item.Id); dbClient.AddParameter("items", Items); dbClient.AddParameter("delay", (Item is IWiredCycle) ? Cycle.Delay : 0); dbClient.AddParameter("string", Item.StringData); dbClient.AddParameter("bool", Item.BoolData ? "1" : "0"); dbClient.RunQuery(); } }
public override void Compose(ServerPacket packet) { packet.WriteBoolean(false); packet.WriteInteger(15); packet.WriteInteger(WiredItem.SetItems.Count); foreach (Item Item in WiredItem.SetItems.Values.ToList()) { packet.WriteInteger(Item.Id); } packet.WriteInteger(WiredItem.Item.GetBaseItem().SpriteId); packet.WriteInteger(WiredItem.Item.Id); if (WiredItem.Type == WiredBoxType.EffectBotGivesHanditemBox) { if (String.IsNullOrEmpty(WiredItem.StringData)) { WiredItem.StringData = "Bot name;0"; } packet.WriteString(WiredItem.StringData != null ? (WiredItem.StringData.Split(';')[0]) : ""); } else if (WiredItem.Type == WiredBoxType.EffectBotFollowsUserBox) { if (String.IsNullOrEmpty(WiredItem.StringData)) { WiredItem.StringData = "0;Bot name"; } packet.WriteString(WiredItem.StringData != null ? (WiredItem.StringData.Split(';')[1]) : ""); } else { packet.WriteString(WiredItem.StringData); } if (WiredItem.Type != WiredBoxType.EffectMatchPosition && WiredItem.Type != WiredBoxType.EffectMoveAndRotate && WiredItem.Type != WiredBoxType.EffectMuteTriggerer && WiredItem.Type != WiredBoxType.EffectBotFollowsUserBox) { packet.WriteInteger(0); // Loop } else if (WiredItem.Type == WiredBoxType.EffectMatchPosition) { if (String.IsNullOrEmpty(WiredItem.StringData)) { WiredItem.StringData = "0;0;0"; } packet.WriteInteger(3); packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0); packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0); packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[2]) : 0); } else if (WiredItem.Type == WiredBoxType.EffectMoveAndRotate) { if (String.IsNullOrEmpty(WiredItem.StringData)) { WiredItem.StringData = "0;0"; } packet.WriteInteger(2); packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0); packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0); } else if (WiredItem.Type == WiredBoxType.EffectMuteTriggerer) { if (String.IsNullOrEmpty(WiredItem.StringData)) { WiredItem.StringData = "0;Message"; } packet.WriteInteger(1);//Count, for the time. packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0); } else if (WiredItem.Type == WiredBoxType.EffectBotFollowsUserBox) { packet.WriteInteger(1);//Count, for the time. packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[0]) : 0); } else if (WiredItem.Type == WiredBoxType.EffectBotGivesHanditemBox) { packet.WriteInteger(WiredItem.StringData != null ? int.Parse(WiredItem.StringData.Split(';')[1]) : 0); } if (WiredItem is IWiredCycle && WiredItem.Type != WiredBoxType.EffectKickUser && WiredItem.Type != WiredBoxType.EffectMatchPosition && WiredItem.Type != WiredBoxType.EffectMoveAndRotate && WiredItem.Type != WiredBoxType.EffectSetRollerSpeed) { IWiredCycle Cycle = (IWiredCycle)WiredItem; packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type)); packet.WriteInteger(0); packet.WriteInteger(Cycle.Delay); } else if (WiredItem.Type == WiredBoxType.EffectMatchPosition || WiredItem.Type == WiredBoxType.EffectMoveAndRotate) { IWiredCycle Cycle = (IWiredCycle)WiredItem; packet.WriteInteger(0); packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type)); packet.WriteInteger(Cycle.Delay); } else { packet.WriteInteger(0); packet.WriteInteger(WiredBoxTypeUtility.GetWiredId(WiredItem.Type)); packet.WriteInteger(0); } packet.WriteInteger(BlockedItems.Count()); // Incompatable items loop if (BlockedItems.Count() > 0) { foreach (int ItemId in BlockedItems.ToList()) { packet.WriteInteger(ItemId); } } }
public WiredEffectConfigComposer(IWiredItem Box, List <int> BlockedItems) : base(ServerPacketHeader.WiredEffectConfigMessageComposer) { base.WriteBoolean(false); base.WriteInteger(15); base.WriteInteger(Box.SetItems.Count); foreach (Item Item in Box.SetItems.Values.ToList()) { base.WriteInteger(Item.Id); } base.WriteInteger(Box.Item.GetBaseItem().SpriteId); base.WriteInteger(Box.Item.Id); if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "Bot name;0"; } base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[0]) : ""); } else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;Bot name"; } base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[1]) : ""); } else { base.WriteString(Box.StringData); } if (Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectMuteTriggerer && Box.Type != WiredBoxType.EffectBotFollowsUserBox && Box.Type != WiredBoxType.EffectAddScore) { base.WriteInteger(0); // Loop } else if (Box.Type == WiredBoxType.EffectMatchPosition) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0;0"; } base.WriteInteger(3); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0); } else if (Box.Type == WiredBoxType.EffectAddScore) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "1;1"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } else if (Box.Type == WiredBoxType.EffectMoveAndRotate) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } else if (Box.Type == WiredBoxType.EffectMuteTriggerer) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;Message"; } base.WriteInteger(1);//Count, for the time. base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); } else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox) { base.WriteInteger(1);//Count, for the time. base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); } else if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox) { base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } if (Box is IWiredCycle && Box.Type != WiredBoxType.EffectKickUser && Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectSetRollerSpeed && Box.Type != WiredBoxType.EffectAddScore) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(0); base.WriteInteger(Cycle.Delay); } else if (Box.Type == WiredBoxType.EffectMatchPosition || Box.Type == WiredBoxType.EffectMoveAndRotate || Box.Type == WiredBoxType.EffectAddScore) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(0); base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(Cycle.Delay); } else { base.WriteInteger(0); base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(0); } base.WriteInteger(BlockedItems.Count()); // Incompatable items loop if (BlockedItems.Count() > 0) { foreach (int ItemId in BlockedItems.ToList()) { base.WriteInteger(ItemId); } } }
public WiredEffectConfigComposer(IWiredItem Box, List <int> BlockedItems) : base(ServerPacketHeader.WiredEffectConfigMessageComposer) { base.WriteBoolean(false); if (Box.Type == WiredBoxType.EffectMoveUser || Box.Type == WiredBoxType.EffectProgressUserAchievement || Box.Type == WiredBoxType.EffectTimerReset) { base.WriteInteger(0); } else { base.WriteInteger(20); } base.WriteInteger(Box.SetItems.Count); foreach (Item Item in Box.SetItems.Values.ToList()) { base.WriteInteger(Item.Id); } base.WriteInteger(Box.Item.GetBaseItem().SpriteId); base.WriteInteger(Box.Item.Id); if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "Bot name;0"; } base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[0]) : ""); } else if (Box.Type == WiredBoxType.EffectAddActorToTeam) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "1"; } base.WriteString(Box.StringData != null ? Box.StringData : ""); } else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;Bot name"; } base.WriteString(Box.StringData != null ? (Box.StringData.Split(';')[1]) : ""); } else if (Box.Type == WiredBoxType.EffectGiveReward) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "1,,;1,,;1,,;1,,;1,,-0-0-0"; } base.WriteString(Box.StringData != null ? (Box.StringData.Split('-')[0]) : ""); } else if (Box.Type == WiredBoxType.EffectMoveToDir) { base.WriteString(string.Empty); } else if (Box.Type == WiredBoxType.EffectTimerReset) { base.WriteString(""); } else { base.WriteString(Box.StringData); } if (Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectMuteTriggerer && Box.Type != WiredBoxType.EffectBotFollowsUserBox && Box.Type != WiredBoxType.EffectAddScore && Box.Type != WiredBoxType.EffectMoveToDir && Box.Type != WiredBoxType.EffectGiveReward && Box.Type != WiredBoxType.EffectAddRewardPoints && Box.Type != WiredBoxType.EffectAddActorToTeam && Box.Type != WiredBoxType.EffectMoveUser) { base.WriteInteger(0); // Loop } else if (Box.Type == WiredBoxType.EffectMatchPosition) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0;0"; } base.WriteInteger(3); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[2]) : 0); } else if (Box.Type == WiredBoxType.EffectMoveUser) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } else if (Box.Type == WiredBoxType.EffectMoveToDir) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 50); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 5); } else if (Box.Type == WiredBoxType.EffectGiveReward) { base.WriteInteger(4); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[1]) : 0); base.WriteInteger(Box.BoolData ? 1 : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[2]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split('-')[3]) : 1); } else if (Box.Type == WiredBoxType.EffectAddActorToTeam) { base.WriteInteger(1); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData) : 1); } else if (Box.Type == WiredBoxType.EffectAddScore || Box.Type == WiredBoxType.EffectAddRewardPoints) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "1;1"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } else if (Box.Type == WiredBoxType.EffectMoveAndRotate) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;0"; } base.WriteInteger(2); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } else if (Box.Type == WiredBoxType.EffectMuteTriggerer) { if (String.IsNullOrEmpty(Box.StringData)) { Box.StringData = "0;Message"; } base.WriteInteger(1);//Count, for the time. base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); } else if (Box.Type == WiredBoxType.EffectBotFollowsUserBox) { base.WriteInteger(1);//Count, for the time. base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[0]) : 0); } else if (Box.Type == WiredBoxType.EffectBotGivesHanditemBox) { base.WriteInteger(Box.StringData != null ? int.Parse(Box.StringData.Split(';')[1]) : 0); } if (Box is IWiredCycle && Box.Type != WiredBoxType.EffectKickUser && Box.Type != WiredBoxType.EffectMatchPosition && Box.Type != WiredBoxType.EffectMoveAndRotate && Box.Type != WiredBoxType.EffectSetRollerSpeed && Box.Type != WiredBoxType.EffectAddScore && Box.Type != WiredBoxType.EffectAddRewardPoints && Box.Type != WiredBoxType.EffectMoveToDir && Box.Type != WiredBoxType.EffectMoveUser && Box.Type != WiredBoxType.EffectShowMessage && Box.Type != WiredBoxType.EffectGiveUserHanditem && Box.Type != WiredBoxType.EffectGiveUserEnable && Box.Type != WiredBoxType.EffectTimerReset && Box.Type != WiredBoxType.EffectGiveUserFreeze && Box.Type != WiredBoxType.EffectExecuteWiredStacks) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(0); base.WriteInteger(Cycle.Delay); } else if (Box.Type == WiredBoxType.EffectMatchPosition || Box.Type == WiredBoxType.EffectMoveAndRotate || Box.Type == WiredBoxType.EffectAddScore || Box.Type == WiredBoxType.EffectAddRewardPoints || Box.Type == WiredBoxType.EffectMoveToDir || Box.Type == WiredBoxType.EffectMoveUser || Box.Type == WiredBoxType.EffectShowMessage || Box.Type == WiredBoxType.EffectGiveUserHanditem || Box.Type == WiredBoxType.EffectGiveUserEnable || Box.Type == WiredBoxType.EffectTimerReset || Box.Type == WiredBoxType.EffectGiveUserFreeze || Box.Type == WiredBoxType.EffectExecuteWiredStacks) { IWiredCycle Cycle = (IWiredCycle)Box; base.WriteInteger(0); base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(Cycle.Delay); } else { base.WriteInteger(0); base.WriteInteger(WiredBoxTypeUtility.GetWiredId(Box.Type)); base.WriteInteger(0); } base.WriteInteger(BlockedItems.Count()); if (BlockedItems.Count() > 0) { foreach (int ItemId in BlockedItems.ToList()) { base.WriteInteger(ItemId); } } }
public IWiredItem LoadWiredBox(Item Item) { IWiredItem NewBox = GenerateNewBox(Item); DataRow Row = null; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM wired_items WHERE id=@id LIMIT 1"); dbClient.AddParameter("id", Item.Id); Row = dbClient.getRow(); if (Row != null) { if (String.IsNullOrEmpty(Convert.ToString(Row["string"]))) { if (NewBox.Type == WiredBoxType.ConditionMatchStateAndPosition || NewBox.Type == WiredBoxType.ConditionDontMatchStateAndPosition) { NewBox.StringData = "0;0;0"; } else if (NewBox.Type == WiredBoxType.ConditionUserCountInRoom || NewBox.Type == WiredBoxType.ConditionUserCountDoesntInRoom) { NewBox.StringData = "0;0"; } else if (NewBox.Type == WiredBoxType.ConditionFurniHasNoFurni) { NewBox.StringData = "0"; } else if (NewBox.Type == WiredBoxType.EffectMatchPosition) { NewBox.StringData = "0;0;0"; } else if (NewBox.Type == WiredBoxType.EffectMoveAndRotate) { NewBox.StringData = "0;0"; } } NewBox.StringData = Convert.ToString(Row["string"]); NewBox.BoolData = Convert.ToInt32(Row["bool"]) == 1; NewBox.ItemsData = Convert.ToString(Row["items"]); if (NewBox is IWiredCycle) { IWiredCycle Box = (IWiredCycle)NewBox; Box.Delay = Convert.ToInt32(Row["delay"]); } foreach (string str in Convert.ToString(Row["items"]).Split(';')) { int Id = 0; string sId = "0"; if (str.Contains(':')) { sId = str.Split(':')[0]; } if (int.TryParse(str, out Id) || int.TryParse(sId, out Id)) { Item SelectedItem = _room.GetRoomItemHandler().GetItem(Convert.ToInt32(Id)); if (SelectedItem == null) { continue; } NewBox.SetItems.TryAdd(SelectedItem.Id, SelectedItem); } } } else { NewBox.ItemsData = ""; NewBox.StringData = ""; NewBox.BoolData = false; SaveBox(NewBox); } } if (!AddBox(NewBox)) { // ummm } return(NewBox); }