Exemple #1
0
    public void Prime(ItemClass item)
    {
        this.Item = item;

        textName.text = item.GetItemName();
        //if (ItemSprite != null)
        //    ItemSprite.sprite = item.sprite;

        ItemPrice.text = "$" + item.GetGoldCost();
        if (item.GetItemType() == ItemSlot.WEAPON)
        {
            SpriteToSet.GetComponent <Image>().sprite = WpnSprite;
        }
        if (item.GetItemType() == ItemSlot.SHIELDS)
        {
            SpriteToSet.GetComponent <Image>().sprite = ShldSprite;
        }
        if (item.GetItemType() == ItemSlot.ENGINES)
        {
            SpriteToSet.GetComponent <Image>().sprite = EngineSprite;
        }
        if (item.GetItemType() == ItemSlot.ARMOR)
        {
            SpriteToSet.GetComponent <Image>().sprite = ArmorSprite;
        }
        if (item.GetItemType() == ItemSlot.MISC)
        {
            SpriteToSet.GetComponent <Image>().sprite = PowerSprite;
        }
        //ItemDescription.text = item.GetItemDesc();
    }
        public static bool Prefix(ref string value, BindingItem binding, ItemClass ___itemClass)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            if (___itemClass == null)
            {
                return(true);
            }

            string text = binding.FieldName;

            if (text == "itemRepairDescription")
            {
                AdvLogging.DisplayLog(AdvFeatureClass, "Reading Custom Repair description");

                string descriptionKey2 = ___itemClass.DescriptionKey;
                if (Localization.Exists(descriptionKey2, ""))
                {
                    value = Localization.Get(descriptionKey2, "");
                }

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(Localization.Get("lblRepairItems", ""));

                List <ItemStack> stack = new List <ItemStack>();
                // Check if ScrapItems is specified
                if (___itemClass.Properties.Classes.ContainsKey("RepairItems"))
                {
                    DynamicProperties dynamicProperties3 = ___itemClass.Properties.Classes["RepairItems"];
                    stack = ItemsUtilities.ParseProperties(dynamicProperties3);
                }
                else if (___itemClass.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" />
                {
                    string strData = ___itemClass.Properties.Values["RepairItems"].ToString();
                    stack = ItemsUtilities.ParseProperties(strData);
                }
                else if (___itemClass.RepairTools == null || ___itemClass.RepairTools.Length <= 0)
                {
                    Recipe recipe = ItemsUtilities.GetReducedRecipes(___itemClass.GetItemName(), 2);
                    stack = recipe.ingredients;
                }
                if (stack.Count > 0)
                {
                    stringBuilder.Append(ItemsUtilities.GetStackSummary(stack));
                    value = stringBuilder.ToString();
                }
                else
                {
                    stringBuilder.Append(" You cannot repair this.");
                    value = stringBuilder.ToString();
                }
                return(false);
            }
            return(true);
        }
        public static bool Prefix(ItemActionEntryRepair __instance)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            XUi               xui       = __instance.ItemController.xui;
            ItemValue         itemValue = ((XUiC_ItemStack)__instance.ItemController).ItemStack.itemValue;
            ItemClass         forId     = ItemClass.GetForId(itemValue.type);
            EntityPlayerLocal player    = xui.playerUI.entityPlayer;

            XUiC_CraftingWindowGroup childByType = xui.FindWindowGroupByName("crafting").GetChildByType <XUiC_CraftingWindowGroup>();

            List <ItemStack> repairItems = new List <ItemStack>();

            // If the item has a repairItems, use that, instead of the vanilla version.
            if (forId.Properties.Classes.ContainsKey("RepairItems"))
            {
                Recipe            recipe             = new Recipe();
                DynamicProperties dynamicProperties3 = forId.Properties.Classes["RepairItems"];
                recipe.ingredients = ItemsUtilities.ParseProperties(dynamicProperties3);

                // Get an adjusted Craftint time from the player.
                recipe.craftingTime = (int)EffectManager.GetValue(PassiveEffects.CraftingTime, null, recipe.craftingTime, xui.playerUI.entityPlayer, recipe, FastTags.Parse(recipe.GetName()), true, true, true, true, 1, true);
                ItemsUtilities.ConvertAndCraft(recipe, player, __instance.ItemController);
                return(false);
            }
            else if (forId.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" />
            {
                Recipe recipe  = new Recipe();
                string strData = forId.Properties.Values["RepairItems"].ToString();
                recipe.ingredients = ItemsUtilities.ParseProperties(strData);

                // Get an adjusted Craftint time from the player.
                recipe.craftingTime = (int)EffectManager.GetValue(PassiveEffects.CraftingTime, null, recipe.craftingTime, xui.playerUI.entityPlayer, recipe, FastTags.Parse(recipe.GetName()), true, true, true, true, 1, true);
                ItemsUtilities.ConvertAndCraft(recipe, player, __instance.ItemController);
                return(false);
            }
            // If there's no RepairTools defined, then fall back to recipe reduction
            else if (forId.RepairTools == null || forId.RepairTools.Length <= 0)
            {
                // Determine, based on percentage left,
                int RecipeCountReduction = 2;
                if (itemValue.PercentUsesLeft < 0.2)
                {
                    RecipeCountReduction = 3;
                }

                // Use the helper method to reduce the recipe count, and control displaying on the UI for consistenncy.
                ItemsUtilities.ConvertAndCraft(forId.GetItemName(), RecipeCountReduction, player, __instance.ItemController);
                return(false);
            }

            // Fall back to possible RepairTools
            return(true);
        }
Exemple #4
0
        public static string GetItemName(int itemId)
        {
            if (itemId == 0)
            {
                return("");
            }
            //Log.Out ("GETTING ITEM NAME FOR: " + itemId.ToString ());
            ItemClass _itemClass = ItemClass.list [itemId];

            return(_itemClass.GetItemName());
        }
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try {
                if (_params.Count < 1)
                {
                    SdtdConsole.Instance.Output("Usage: ShowEquipment <steamid|playername|entityid>");
                    SdtdConsole.Instance.Output("   or: ShowEquipment <steamid|playername|entityid> <1>");
                    return;
                }

                string steamid = PersistentContainer.Instance.Players.GetSteamID(_params [0], true);
                if (steamid == null)
                {
                    SdtdConsole.Instance.Output("Playername or entity/steamid id not found or no inventory saved (first saved after a player has been online for 30s).");
                    return;
                }

                Player p = PersistentContainer.Instance.Players [steamid, false];
                PersistentData.Inventory inv = p.Inventory;
                if (p.IsOnline == true)
                {
                    EntityPlayer ply = p.Entity;
                    int          num = 0;
                    int          vc  = ply.equipment.GetSlotCount();
                    SdtdConsole.Instance.Output("**** Equipment of player " + ply.EntityName + " ****");
                    for (int i = 0; i < vc; i++)
                    {
                        //ib[k].itemValue.type =
                        ItemValue gg = p.Entity.equipment.GetSlotItem(i);
                        if (gg != null)
                        {
                            try
                            {
                                if (gg.type >= 1)
                                {
                                    ItemClass itemClass = ItemClass.GetForId(gg.type);
                                    string    name      = itemClass.GetItemName();                     //ib..GetItemName ();
                                    if (name != null)
                                    {
                                        num++;
                                        SdtdConsole.Instance.Output(num + ". *    Slot # " + i + "/" + vc + " => " + name + " *");
                                    }
                                }
                            }catch (Exception e) {
                            }
                        }
                    }
                    SdtdConsole.Instance.Output("**** Total of " + num + " slots equiped ****");
                }
            } catch (Exception e) {
                Log.Out("Error in ShowEquipment.Run: " + e);
            }
        }
        public void Execute2()
        {
            NGuiInvGridCreativeMenu cm = new NGuiInvGridCreativeMenu();
            //SdtdConsole.Instance.Output ("##Liste des objets disponibles##");
            List <string> itemsListKFP = new List <string> ()
            {
            };

            foreach (ItemStack invF in cm.GetAllItems())
            {
                ItemClass ib          = ItemClass.list [invF.itemValue.type];
                string    name        = ib.GetItemName();
                int       stackNumber = ib.Stacknumber.Value;
                if (name != null && name.Length > 0)
                {
                    itemsListKFP.Add(name + "\t" + stackNumber.ToString());
                }
            }
            foreach (ItemStack invF in cm.GetAllBlocks())
            {
                ItemClass ib          = ItemClass.list [invF.itemValue.type];
                string    name        = ib.GetItemName();
                int       stackNumber = ib.Stacknumber.Value;
                if (name != null && name.Length > 0)
                {
                    itemsListKFP.Add(name + "\t" + stackNumber.ToString());
                }
            }
            try {
                itemsListKFP.Sort();
                int    num       = 0;
                string itemsList = string.Empty;
                for (int i = 0; i < itemsListKFP.Count; i++)
                {
                    if (itemsListKFP[i] != null)
                    {
                        itemsList += itemsListKFP[i] + "\n";
                        num++;
                    }
                }
                string       exportPath = Utils.GetGameDir("ItemsInfos");
                StreamWriter sw         = new StreamWriter(exportPath + "/itemsList.txt");
                sw.Write(itemsList);
                sw.Close();
                itemsList = null;
                SdtdConsole.Instance.Output("Items List saved to file successfully..");
            } catch (Exception arg) {
                Log.Out("Error in ListItems.Run.listAll: " + arg);
            }
        }
        public static bool Prefix(ItemActionEntryRepair __instance, StateTypes ___state, string ___lblReadBook, string ___lblNeedMaterials)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            StateTypes stateTypes = ___state;

            if (stateTypes == StateTypes.RecipeLocked)
            {
                GameManager.ShowTooltip(__instance.ItemController.xui.playerUI.entityPlayer, ___lblReadBook);
                return(false);
            }
            if (stateTypes != StateTypes.NotEnoughMaterials)
            {
                return(false);
            }

            GameManager.ShowTooltip(__instance.ItemController.xui.playerUI.entityPlayer, ___lblNeedMaterials);
            List <ItemStack> stack = new List <ItemStack>();
            ItemClass        forId = ItemClass.GetForId(((XUiC_ItemStack)__instance.ItemController).ItemStack.itemValue.type);

            if (forId.Properties.Classes.ContainsKey("RepairItems"))
            {
                DynamicProperties dynamicProperties3 = forId.Properties.Classes["RepairItems"];
                stack = ItemsUtilities.ParseProperties(dynamicProperties3);
                ItemsUtilities.CheckIngredients(stack, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }
            else if (forId.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" />
            {
                string strData = forId.Properties.Values["RepairItems"].ToString();
                stack = ItemsUtilities.ParseProperties(strData);
                ItemsUtilities.CheckIngredients(stack, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }
            else if (forId.RepairTools == null || forId.RepairTools.Length <= 0)
            {
                Recipe recipe = ItemsUtilities.GetReducedRecipes(forId.GetItemName(), 2);
                ItemsUtilities.CheckIngredients(recipe.ingredients, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }

            return(true);
        }
Exemple #8
0
        public static void ChestCheck()
        {
            LinkedList <Chunk> chunkArray = new LinkedList <Chunk>();
            DictionaryList <Vector3i, TileEntity> tiles = new DictionaryList <Vector3i, TileEntity>();
            ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters;

            for (int i = 0; i < chunklist.Count; i++)
            {
                ChunkCluster chunk = chunklist[i];
                chunkArray = chunk.GetChunkArray();
                foreach (Chunk _c in chunkArray)
                {
                    tiles = _c.GetTileEntities();
                    foreach (TileEntity tile in tiles.dict.Values)
                    {
                        TileEntityType type = tile.GetTileEntityType();
                        if (type.ToString().Equals("SecureLoot"))
                        {
                            TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile;
                            AdminToolsClientInfo          Admin      = GameManager.Instance.adminTools.GetAdminToolsClientInfo(SecureLoot.GetOwner());
                            if (Admin.PermissionLevel > Admin_Level)
                            {
                                ItemStack[] items      = SecureLoot.items;
                                int         slotNumber = 0;
                                foreach (ItemStack item in items)
                                {
                                    if (!item.IsEmpty())
                                    {
                                        ItemClass _itemClass = ItemClass.list[item.itemValue.type];
                                        string    _itemName  = _itemClass.GetItemName();
                                        if (dict.Contains(_itemName))
                                        {
                                            int       _count    = item.count;
                                            ItemStack itemStack = new ItemStack();
                                            SecureLoot.UpdateSlot(slotNumber, itemStack);
                                            Vector3i _chestPos = SecureLoot.localChunkPos;
                                            Log.Out(string.Format("[SERVERTOOLS] Removed {0} {1}, from a chest located at {2} {3} {4}", item.count, _itemName, _chestPos.x, _chestPos.y, _chestPos.z));
                                        }
                                    }
                                    slotNumber++;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        public void Refresh()
        {
            NGuiInvGridCreativeMenu cm = new NGuiInvGridCreativeMenu();

            foreach (ItemStack invF in cm.GetAllItems())
            {
                ItemClass ib = ItemClass.list [invF.itemValue.type];

                string name = ib.GetItemName();
                if (name != null && name.Length > 0)
                {
                    if (!items.ContainsKey(name))
                    {
                        items.Add(name, invF.itemValue);
                    }
                    else
                    {
                        //Log.Out ("Item \"" + name + "\" already in list!");
                    }
                }
            }

            foreach (ItemStack invF in cm.GetAllBlocks())
            {
                ItemClass ib   = ItemClass.list [invF.itemValue.type];
                string    name = ib.GetItemName();
                if (name != null && name.Length > 0)
                {
                    if (!items.ContainsKey(name))
                    {
                        items.Add(name, invF.itemValue);
                    }
                    else
                    {
                        //Log.Out ("Item \"" + name + "\" already in list!");
                    }
                }
            }

            //Log.Out (items.Count + " items loaded");
        }
Exemple #10
0
        public static string GetBlockName(BlockValue blockValue)
        {
            ItemValue itemValue = blockValue.ToItemValue();

            if (itemValue == null)
            {
                return("air");
            }

            if (itemValue.type == 0)
            {
                return("air");
            }

            ItemClass itemClass = ItemClass.list [itemValue.type];

            if (itemClass == null)
            {
                return("air");
            }

            return(itemClass.GetItemName());
        }
Exemple #11
0
        public static void LoadGameItems()
        {
            NGuiInvGridCreativeMenu _menu = new NGuiInvGridCreativeMenu();

            foreach (ItemStack _itemStack in _menu.GetAllItems())
            {
                ItemClass _itemClass = ItemClass.list[_itemStack.itemValue.type];
                string    name       = _itemClass.GetItemName();
                if (name != null && name.Length > 0 && !Dict.ContainsKey(name))
                {
                    Dict.Add(name, _itemStack.itemValue);
                }
            }
            foreach (ItemStack _itemStack in _menu.GetAllBlocks())
            {
                ItemClass _itemClass = ItemClass.list[_itemStack.itemValue.type];
                string    name       = _itemClass.GetItemName();
                if (name != null && name.Length > 0 && !Dict.ContainsKey(name))
                {
                    Dict.Add(name, _itemStack.itemValue);
                }
            }
        }
Exemple #12
0
 private void GetLocal(ItemClass item) => Bin.Add("Local", Local = item.GetLocalizedItemName() ?? item.GetItemName());
Exemple #13
0
 private static void UpgradeXml()
 {
     try
     {
         FileWatcher.EnableRaisingEvents = false;
         using (StreamWriter sw = new StreamWriter(FilePath, false, Encoding.UTF8))
         {
             sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
             sw.WriteLine("<KillNotice>");
             sw.WriteLine(string.Format("<ST Version=\"{0}\" />", Config.Version));
             sw.WriteLine("    <!-- <Weapon Name=\"\" NewName=\"\" /> -->");
             for (int i = 0; i < OldNodeList.Count; i++)
             {
                 if (OldNodeList[i].NodeType == XmlNodeType.Comment && !OldNodeList[i].OuterXml.Contains("<!-- <Weapon Name=\"\""))
                 {
                     sw.WriteLine(OldNodeList[i].OuterXml);
                 }
             }
             sw.WriteLine();
             sw.WriteLine();
             bool blank = true;
             for (int i = 0; i < OldNodeList.Count; i++)
             {
                 if (OldNodeList[i].NodeType != XmlNodeType.Comment)
                 {
                     XmlElement line = (XmlElement)OldNodeList[i];
                     if (line.HasAttributes && line.Name == "Weapon")
                     {
                         blank = false;
                         string name = "", newName = "";
                         if (line.HasAttribute("Name"))
                         {
                             name = line.GetAttribute("Name");
                         }
                         if (line.HasAttribute("NewName"))
                         {
                             newName = line.GetAttribute("NewName");
                         }
                         sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", name, newName));
                     }
                 }
             }
             if (blank)
             {
                 List <ItemClass> _itemClassMelee  = ItemClass.GetItemsWithTag(FastTags.Parse("melee"));
                 List <ItemClass> _itemClassRanged = ItemClass.GetItemsWithTag(FastTags.Parse("ranged"));
                 for (int i = 0; i < _itemClassMelee.Count; i++)
                 {
                     ItemClass     _itemClass = _itemClassMelee[i];
                     List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                     if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                     {
                         sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                     }
                 }
                 for (int i = 0; i < _itemClassRanged.Count; i++)
                 {
                     ItemClass     _itemClass = _itemClassRanged[i];
                     List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                     if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                     {
                         sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                     }
                 }
             }
             sw.WriteLine("</KillNotice>");
             sw.Flush();
             sw.Close();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in KillNotice.UpgradeXml: {0}", e.Message));
     }
     FileWatcher.EnableRaisingEvents = true;
     LoadXml();
 }
Exemple #14
0
 private static void UpdateXml()
 {
     try
     {
         FileWatcher.EnableRaisingEvents = false;
         using (StreamWriter sw = new StreamWriter(FilePath, false, Encoding.UTF8))
         {
             sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
             sw.WriteLine("<KillNotice>");
             sw.WriteLine(string.Format("<ST Version=\"{0}\" />", Config.Version));
             sw.WriteLine("    <!-- <Weapon Name=\"\" NewName=\"\" /> -->");
             sw.WriteLine();
             sw.WriteLine();
             if (Dict.Count > 0)
             {
                 foreach (KeyValuePair <string, string> kvp in Dict)
                 {
                     sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", kvp.Key, kvp.Value));
                 }
             }
             else
             {
                 List <ItemClass> _itemClassMelee  = ItemClass.GetItemsWithTag(FastTags.Parse("melee"));
                 List <ItemClass> _itemClassRanged = ItemClass.GetItemsWithTag(FastTags.Parse("ranged"));
                 for (int i = 0; i < _itemClassMelee.Count; i++)
                 {
                     ItemClass     _itemClass = _itemClassMelee[i];
                     List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                     if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                     {
                         sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                     }
                 }
                 for (int i = 0; i < _itemClassRanged.Count; i++)
                 {
                     ItemClass     _itemClass = _itemClassRanged[i];
                     List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                     if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                     {
                         sw.WriteLine(string.Format("    <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                     }
                 }
             }
             sw.WriteLine("</KillNotice>");
             sw.Flush();
             sw.Close();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in KillNotice.UpdateXml: {0}", e.Message));
     }
     FileWatcher.EnableRaisingEvents = true;
 }
        public static bool Prefix(ItemActionEntryScrap __instance)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }
            #region vanilla_code
            XUi            xui            = __instance.ItemController.xui;
            XUiC_ItemStack xuiC_ItemStack = (XUiC_ItemStack)__instance.ItemController;

            ItemStack itemStack       = xuiC_ItemStack.ItemStack.Clone();
            Recipe    scrapableRecipe = CraftingManager.GetScrapableRecipe(itemStack.itemValue, itemStack.count);
            if (scrapableRecipe == null)
            {
                return(true);
            }

            XUiController xuiController = __instance.ItemController.xui.FindWindowGroupByName("workstation_workbench");
            if (xuiController == null || !xuiController.WindowGroup.isShowing)
            {
                xuiController = xui.FindWindowGroupByName("crafting");
            }

            XUiC_CraftingWindowGroup childByType = xuiController.GetChildByType <XUiC_CraftingWindowGroup>();
            if (childByType == null)
            {
                return(true);
            }
            #endregion  vanilla_code

            LocalPlayerUI    uiforPlayer = LocalPlayerUI.GetUIForPlayer(__instance.ItemController.xui.playerUI.entityPlayer);
            List <ItemStack> scrapItems  = new List <ItemStack>();

            ItemClass forId = ItemClass.GetForId(itemStack.itemValue.type);
            // Check if ScrapItems is specified
            if (forId.Properties.Classes.ContainsKey("ScrapItems"))
            {
                DynamicProperties dynamicProperties3 = forId.Properties.Classes["ScrapItems"];
                scrapItems = ItemsUtilities.ParseProperties(dynamicProperties3);
                ItemsUtilities.Scrap(scrapItems, itemStack, __instance.ItemController);
                return(false);
            }
            else if (forId.Properties.Contains("ScrapItems")) // Support for <property name="ScrapItems" value="resourceWood,0,resourceLeather,2" />
            {
                string strData = forId.Properties.Values["ScrapItems"].ToString();
                scrapItems = ItemsUtilities.ParseProperties(strData);
                ItemsUtilities.Scrap(scrapItems, itemStack, __instance.ItemController);
                return(false);
            }
            // Check if Repair Items is specified, if the ScrapItems wasn't.
            else if (forId.Properties.Classes.ContainsKey("RepairItems"))
            {
                DynamicProperties dynamicProperties3 = forId.Properties.Classes["RepairItems"];
                scrapItems = ItemsUtilities.ParseProperties(dynamicProperties3);
                ItemsUtilities.Scrap(scrapItems, itemStack, __instance.ItemController);
                return(false);
            }
            else if (forId.RepairTools == null || forId.RepairTools.Length <= 0)
            {
                if (CraftingManager.GetRecipe(forId.GetItemName()) == null)
                {
                    return(true);
                }

                if (CraftingManager.GetRecipe(forId.GetItemName()).tags.Test_AnySet(FastTags.Parse("usevanillascrap")))
                {
                    return(true);
                }

                // If there's a recipe, reduce it
                Recipe recipe = ItemsUtilities.GetReducedRecipes(forId.GetItemName(), 2);

                ItemsUtilities.Scrap(recipe.ingredients, itemStack, __instance.ItemController);
                return(false);
            }
            return(true);
        }
Exemple #16
0
 private static void UpdateXml()
 {
     fileWatcher.EnableRaisingEvents = false;
     using (StreamWriter sw = new StreamWriter(filePath))
     {
         sw.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
         sw.WriteLine("<KillNotice>");
         sw.WriteLine("    <Weapons>");
         if (dict.Count > 0)
         {
             foreach (KeyValuePair <string, string> kvp in dict)
             {
                 sw.WriteLine(string.Format("        <Weapon Name=\"{0}\" NewName=\"{1}\" />", kvp.Key, kvp.Value));
             }
         }
         else
         {
             List <ItemClass> _itemClassMelee  = ItemClass.GetItemsWithTag(FastTags.Parse("melee"));
             List <ItemClass> _itemClassRanged = ItemClass.GetItemsWithTag(FastTags.Parse("ranged"));
             for (int i = 0; i < _itemClassMelee.Count; i++)
             {
                 ItemClass     _itemClass = _itemClassMelee[i];
                 List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                 if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                 {
                     sw.WriteLine(string.Format("        <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                 }
             }
             for (int i = 0; i < _itemClassRanged.Count; i++)
             {
                 ItemClass     _itemClass = _itemClassRanged[i];
                 List <string> _tags      = _itemClass.ItemTags.GetTagNames();
                 if (_itemClass.CreativeMode != EnumCreativeMode.None && _itemClass.CreativeMode != EnumCreativeMode.Dev && !_tags.Contains("ammo"))
                 {
                     sw.WriteLine(string.Format("        <Weapon Name=\"{0}\" NewName=\"{1}\" />", _itemClass.GetItemName(), _itemClass.GetLocalizedItemName() ?? _itemClass.GetItemName()));
                 }
             }
         }
         sw.WriteLine("    </Weapons>");
         sw.WriteLine("</KillNotice>");
         sw.Flush();
         sw.Close();
     }
     fileWatcher.EnableRaisingEvents = true;
 }
Exemple #17
0
        public static void CheckBox(ClientInfo _cInfo, string _price)
        {
            int _p;

            if (int.TryParse(_price, out _p))
            {
                if (_p > 0)
                {
                    if (!AuctionItems.ContainsKey(_cInfo.entityId))
                    {
                        ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters;
                        for (int i = 0; i < chunklist.Count; i++)
                        {
                            ChunkCluster chunk = chunklist[i];
                            chunkArray = chunk.GetChunkArray();
                            for (int j = 0; j < chunkArray.Count; j++)
                            {
                                Chunk _c = chunkArray[j];
                                tiles = _c.GetTileEntities();
                                foreach (TileEntity tile in tiles.dict.Values)
                                {
                                    TileEntityType type = tile.GetTileEntityType();
                                    if (type.ToString().Equals("SecureLoot"))
                                    {
                                        EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                        TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile;
                                        Vector3i vec3i = SecureLoot.ToWorldPos();
                                        if ((vec3i.x - _player.position.x) * (vec3i.x - _player.position.x) + (vec3i.z - _player.position.z) * (vec3i.z - _player.position.z) <= 1.5 * 1.5)
                                        {
                                            int _playerCount = ConnectionManager.Instance.ClientCount();
                                            if (_playerCount > 1)
                                            {
                                                List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients();
                                                for (int k = 0; k < _cInfoList.Count; k++)
                                                {
                                                    ClientInfo _cInfo2 = _cInfoList[k];
                                                    if (_cInfo != _cInfo2)
                                                    {
                                                        EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                                                        if ((vec3i.x - _player2.position.x) * (vec3i.x - _player2.position.x) + (vec3i.z - _player2.position.z) * (vec3i.z - _player2.position.z) <= 8 * 8)
                                                        {
                                                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you are too close to another player to use auction. Tell them to back off and get their own moldy sandwich.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                            List <string> boxUsers = SecureLoot.GetUsers();
                                            if (!boxUsers.Contains(_cInfo.playerId) && !SecureLoot.GetOwner().Equals(_cInfo.playerId))
                                            {
                                                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} the local secure loot is not owned by you or a friend. You can only auction an item through a secure loot you own.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                                                return;
                                            }
                                            ItemStack[] items      = SecureLoot.items;
                                            int         count      = 0;
                                            int         slotNumber = 0;
                                            foreach (ItemStack item in items)
                                            {
                                                if (!item.IsEmpty())
                                                {
                                                    if (count < 1)
                                                    {
                                                        ItemClass _itemClass   = ItemClass.list[item.itemValue.type];
                                                        string    _itemName    = _itemClass.GetItemName();
                                                        string[]  _auctionItem = { item.count.ToString(), _itemName, item.itemValue.Quality.ToString(), _price };
                                                        SecureLoot.UpdateSlot(slotNumber, ItemStack.Empty);
                                                        AuctionItems.Add(_cInfo.entityId, _auctionItem);
                                                        PersistentContainer.Instance.Players[_cInfo.playerId, true].CancelTime  = DateTime.Now;
                                                        PersistentContainer.Instance.Players[_cInfo.playerId, true].AuctionData = _cInfo.entityId;
                                                        PersistentContainer.Instance.Players[_cInfo.playerId, true].AuctionItem = _auctionItem;
                                                        PersistentContainer.Instance.Save();
                                                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} your auction item {2} has been removed from the secure loot and added to the auction.[-]", Config.Chat_Response_Color, _cInfo.playerName, _itemName), Config.Server_Response_Name, false, "ServerTools", false));
                                                        using (StreamWriter sw = new StreamWriter(filepath, true))
                                                        {
                                                            sw.WriteLine(string.Format("{0}: {1} has added {2} {3}, {4} quality to the auction for {5} {6}. Entry # {7}", DateTime.Now, _cInfo.playerName, item.count, _itemName, item.itemValue.Quality, _price, Wallet.Coin_Name, _cInfo.entityId));
                                                            sw.WriteLine();
                                                            sw.Flush();
                                                            sw.Close();
                                                        }
                                                        count++;
                                                    }
                                                }
                                                slotNumber++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (!AuctionItems.ContainsKey(_cInfo.entityId))
                        {
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} auction sell failed. No items were found in a secure chest you own near by.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                            _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} place an item in a chest and stand very close to it, then use /auction sell #.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                        }
                    }
                    else
                    {
                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you have auction item # {2} in the auction already. Wait for it to sell or cancel it with /auction cancel.[-]", Config.Chat_Response_Color, _cInfo.playerName, _cInfo.entityId), Config.Server_Response_Name, false, "ServerTools", false));
                    }
                }
                else
                {
                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you need to input a price greater than zero. This is not a transfer system.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                }
            }
            else
            {
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} your sell price must be an integer and greater than zero.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
            }
        }
Exemple #18
0
        public static void CheckBox(ClientInfo _cInfo, string _price)
        {
            string    _sql    = string.Format("SELECT auctionid, steamid FROM Auction WHERE steamid = '{0}'", _cInfo.playerId);
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                int _auctionid;
                int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _auctionid);
                string _message = "you have auction item # {Value} in the auction already. Wait for it to sell or cancel it with /auction cancel.";
                _message = _message.Replace("{Value}", _auctionid.ToString());
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                int _p;
                if (int.TryParse(_price, out _p))
                {
                    if (_p > 0)
                    {
                        ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters;
                        for (int i = 0; i < chunklist.Count; i++)
                        {
                            ChunkCluster chunk = chunklist[i];
                            chunkArray = chunk.GetChunkArray();
                            foreach (Chunk _c in chunkArray)
                            {
                                tiles = _c.GetTileEntities();
                                foreach (TileEntity tile in tiles.dict.Values)
                                {
                                    TileEntityType type = tile.GetTileEntityType();
                                    if (type.ToString().Equals("SecureLoot"))
                                    {
                                        EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                        TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile;
                                        Vector3i vec3i = SecureLoot.ToWorldPos();
                                        if ((vec3i.x - _player.position.x) * (vec3i.x - _player.position.x) + (vec3i.z - _player.position.z) * (vec3i.z - _player.position.z) <= 1.5 * 1.5)
                                        {
                                            int _playerCount = ConnectionManager.Instance.ClientCount();
                                            if (_playerCount > 1)
                                            {
                                                List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList();
                                                for (int k = 0; k < _cInfoList.Count; k++)
                                                {
                                                    ClientInfo _cInfo2 = _cInfoList[k];
                                                    if (_cInfo != _cInfo2)
                                                    {
                                                        EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                                                        if ((vec3i.x - _player2.position.x) * (vec3i.x - _player2.position.x) + (vec3i.z - _player2.position.z) * (vec3i.z - _player2.position.z) <= 8 * 8)
                                                        {
                                                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you are too close to another player to use auction. Tell them to back off and get their own moldy sandwich.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                            List <string> boxUsers = SecureLoot.GetUsers();
                                            if (!boxUsers.Contains(_cInfo.playerId) && !SecureLoot.GetOwner().Equals(_cInfo.playerId))
                                            {
                                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", the local secure loot is not owned by you or a friend. You can only auction an item through a secure loot you own.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                return;
                                            }
                                            ItemStack[] items      = SecureLoot.items;
                                            int         count      = 0;
                                            int         slotNumber = 0;
                                            foreach (ItemStack item in items)
                                            {
                                                if (!item.IsEmpty())
                                                {
                                                    if (count < 1)
                                                    {
                                                        ItemClass _itemClass = ItemClass.list[item.itemValue.type];
                                                        string    _itemName  = _itemClass.GetItemName();
                                                        SecureLoot.UpdateSlot(slotNumber, ItemStack.Empty);
                                                        _sql = string.Format("INSERT INTO Auction (steamid, itemName, itemCount, itemQuality, itemPrice, cancelTime, sellDate) VALUES ('{0}', '{1}', {2}, {3}, {4}, '{5}', '{6}')", _cInfo.playerId, _itemName, item.count, item.itemValue.Quality, _price, DateTime.Now, DateTime.Now);
                                                        SQL.FastQuery(_sql);
                                                        string _message = "your auction item {Name} has been removed from the secure loot and added to the auction.";
                                                        _message = _message.Replace("{Name}", _itemName);
                                                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                        using (StreamWriter sw = new StreamWriter(filepath, true))
                                                        {
                                                            sw.WriteLine(string.Format("{0}: {1} has added {2} {3}, {4} quality to the auction for {5} {6}.", DateTime.Now, _cInfo.playerName, item.count, _itemName, item.itemValue.Quality, _price, Wallet.Coin_Name));
                                                            sw.WriteLine();
                                                            sw.Flush();
                                                            sw.Close();
                                                        }
                                                        count++;
                                                    }
                                                }
                                                slotNumber++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you need to input a price greater than zero. This is not a transfer system.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                    }
                }
                else
                {
                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", your sell price must be an integer and greater than zero.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                }
            }
            _result.Dispose();
        }
Exemple #19
0
        public static void Deposit(ClientInfo _cInfo, string _amount)
        {
            bool Found = false;
            int  _coinAmount;

            if (int.TryParse(_amount, out _coinAmount))
            {
                ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters;
                for (int i = 0; i < chunklist.Count; i++)
                {
                    ChunkCluster chunk = chunklist[i];
                    chunkArray = chunk.GetChunkArray();
                    foreach (Chunk _c in chunkArray)
                    {
                        tiles = _c.GetTileEntities();
                        foreach (TileEntity tile in tiles.dict.Values)
                        {
                            if (!Found)
                            {
                                TileEntityType type = tile.GetTileEntityType();
                                if (type.ToString().Equals("SecureLoot"))
                                {
                                    TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile;
                                    if (SecureLoot.IsUserAllowed(_cInfo.playerId))
                                    {
                                        Vector3i     vec3i   = SecureLoot.ToWorldPos();
                                        EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                        if ((vec3i.x - _player.position.x) * (vec3i.x - _player.position.x) + (vec3i.z - _player.position.z) * (vec3i.z - _player.position.z) <= 1.5 * 1.5)
                                        {
                                            int _playerCount = ConnectionManager.Instance.ClientCount();
                                            if (_playerCount > 1)
                                            {
                                                List <ClientInfo> _cInfoList = ConnectionManager.Instance.Clients.List.ToList();
                                                for (int k = 0; k < _cInfoList.Count; k++)
                                                {
                                                    ClientInfo _cInfo2 = _cInfoList[k];
                                                    if (_cInfo != _cInfo2)
                                                    {
                                                        EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                                                        if ((vec3i.x - _player2.position.x) * (vec3i.x - _player2.position.x) + (vec3i.z - _player2.position.z) * (vec3i.z - _player2.position.z) <= 8 * 8)
                                                        {
                                                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + " you are too close to another player to deposit from your chest in to the bank.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                            return;
                                                        }
                                                    }
                                                }
                                            }
                                            ItemStack[] items      = SecureLoot.items;
                                            int         slotNumber = 0;
                                            foreach (ItemStack item in items)
                                            {
                                                if (!item.IsEmpty())
                                                {
                                                    ItemClass _itemClass = ItemClass.list[item.itemValue.type];
                                                    string    _itemName  = _itemClass.GetItemName();
                                                    if (_itemName == Ingame_Coin)
                                                    {
                                                        if (item.count >= _coinAmount)
                                                        {
                                                            string    _sql    = string.Format("SELECT bank FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                                            DataTable _result = SQL.TQuery(_sql);
                                                            int       _bank;
                                                            int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bank);
                                                            _result.Dispose();
                                                            int    _percent  = Deposit_Fee / 100;
                                                            double _fee      = _coinAmount * _percent;
                                                            int    _newCoin  = _coinAmount - (int)_fee;
                                                            double _newLimit = Limit + (Limit * _percent);
                                                            if (_bank + _coinAmount <= (int)_newLimit)
                                                            {
                                                                Found = true;
                                                                int       _newCount  = item.count - _coinAmount;
                                                                ItemValue _itemValue = ItemClass.GetItem(Ingame_Coin, false);
                                                                if (_itemValue.type == ItemValue.None.type)
                                                                {
                                                                    ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + " the bank coin is not setup correctly, contact the server Admin.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                                    Log.Out(string.Format("[SERVERTOOLS] Unable to find item {0}", Ingame_Coin));
                                                                    return;
                                                                }
                                                                else
                                                                {
                                                                    _itemValue = new ItemValue(ItemClass.GetItem(Ingame_Coin).type, 1, 1, false);
                                                                }
                                                                ItemStack itemStack = new ItemStack(_itemValue, _newCount);
                                                                SecureLoot.UpdateSlot(slotNumber, itemStack);
                                                                _sql = string.Format("UPDATE Players SET bank = {0} WHERE steamid = '{1}'", _bank + _newCoin, _cInfo.playerId);
                                                                SQL.FastQuery(_sql);
                                                                using (StreamWriter sw = new StreamWriter(filepath, true))
                                                                {
                                                                    sw.WriteLine(string.Format("{0}: {1} has added {2} to their bank account.", DateTime.Now, _cInfo.playerName, _newCoin));
                                                                    sw.WriteLine();
                                                                    sw.Flush();
                                                                    sw.Close();
                                                                }
                                                                string _message = " deposited {Value} in to your bank minus the transfer fee of {Percent} percent.";
                                                                _message = _message.Replace("{Value}", _coinAmount.ToString());
                                                                _message = _message.Replace("{Percent}", Deposit_Fee.ToString());
                                                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                                return;
                                                            }
                                                            else
                                                            {
                                                                string _message = " your bank can not hold this much. The bank can hold {Limit} total. You currently have {Value}.";
                                                                _message = _message.Replace("{Limit}", Limit.ToString());
                                                                _message = _message.Replace("{Value}", _bank.ToString());
                                                                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            string _message = " there is not enough {Name} in the secure loot to deposit this value.";
                                                            _message = _message.Replace("{Name}", Ingame_Coin);
                                                            ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                                                        }
                                                    }
                                                }
                                                slotNumber++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you input an invalid integer. Type " + ChatHook.Command_Private + Command95 + " #.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            if (Found)
            {
                string _message = "there is not enough {Value} in the secure loot to deposit this value.";
                _message = _message.Replace("{Name}", Ingame_Coin);
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _message + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
            else
            {
                ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + ", you do not have enough in the secure loot to deposit that much into your bank.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
            }
        }
        public static void Deposit(ClientInfo _cInfo, string _amount)
        {
            bool Found = false;
            int  _coinAmount;

            if (int.TryParse(_amount, out _coinAmount))
            {
                ChunkClusterList chunklist = GameManager.Instance.World.ChunkClusters;
                for (int i = 0; i < chunklist.Count; i++)
                {
                    ChunkCluster chunk = chunklist[i];
                    chunkArray = chunk.GetChunkArray();
                    for (int j = 0; j < chunkArray.Count; j++)
                    {
                        Chunk _c = chunkArray[j];
                        tiles = _c.GetTileEntities();
                        foreach (TileEntity tile in tiles.dict.Values)
                        {
                            TileEntityType type = tile.GetTileEntityType();
                            if (type.ToString().Equals("SecureLoot"))
                            {
                                EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                                TileEntitySecureLootContainer SecureLoot = (TileEntitySecureLootContainer)tile;
                                Vector3i vec3i = SecureLoot.ToWorldPos();
                                if ((vec3i.x - _player.position.x) * (vec3i.x - _player.position.x) + (vec3i.z - _player.position.z) * (vec3i.z - _player.position.z) <= 1.5 * 1.5)
                                {
                                    int _playerCount = ConnectionManager.Instance.ClientCount();
                                    if (_playerCount > 1)
                                    {
                                        List <ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients();
                                        for (int k = 0; k < _cInfoList.Count; k++)
                                        {
                                            ClientInfo _cInfo2 = _cInfoList[k];
                                            if (_cInfo != _cInfo2)
                                            {
                                                EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                                                if ((vec3i.x - _player2.position.x) * (vec3i.x - _player2.position.x) + (vec3i.z - _player2.position.z) * (vec3i.z - _player2.position.z) <= 8 * 8)
                                                {
                                                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you are too close to another player to use auction. Tell them to back off and get their own moldy sandwich.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                    List <string> boxUsers = SecureLoot.GetUsers();
                                    if (!boxUsers.Contains(_cInfo.playerId) && !SecureLoot.GetOwner().Equals(_cInfo.playerId))
                                    {
                                        _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} the local secure loot is not owned by you. You can only deposit to the bank through a secure loot you own.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
                                        return;
                                    }
                                    ItemStack[] items      = SecureLoot.items;
                                    int         slotNumber = 0;
                                    foreach (ItemStack item in items)
                                    {
                                        if (!item.IsEmpty())
                                        {
                                            ItemClass _itemClass = ItemClass.list[item.itemValue.type];
                                            string    _itemName  = _itemClass.GetItemName();
                                            if (_itemName == Ingame_Coin)
                                            {
                                                if (item.count >= _coinAmount)
                                                {
                                                    Found = true;
                                                    int       _newCount  = item.count - _coinAmount;
                                                    ItemValue _itemValue = ItemClass.GetItem(Ingame_Coin, true);
                                                    if (_itemValue.type == ItemValue.None.type)
                                                    {
                                                        Log.Out(string.Format("[SERVERTOOLS] Unable to find item {0}", Ingame_Coin));
                                                        return;
                                                    }
                                                    else
                                                    {
                                                        _itemValue = new ItemValue(ItemClass.GetItem(Ingame_Coin).type, 1, 1, true);
                                                    }
                                                    ItemStack itemStack = new ItemStack(_itemValue, _newCount);
                                                    SecureLoot.UpdateSlot(slotNumber, itemStack);
                                                    int    _oldBank = PersistentContainer.Instance.Players[_cInfo.playerId, true].Bank;
                                                    double _percent = _coinAmount * 0.05;
                                                    int    _newCoin = _coinAmount - (int)_percent;
                                                    PersistentContainer.Instance.Players[_cInfo.playerId, true].Bank = _oldBank + _newCoin;
                                                    PersistentContainer.Instance.Save();
                                                    using (StreamWriter sw = new StreamWriter(filepath, true))
                                                    {
                                                        sw.WriteLine(string.Format("{0}: {1} has added {2} to their bank account.", DateTime.Now, _cInfo.playerName, _newCoin));
                                                        sw.WriteLine();
                                                        sw.Flush();
                                                        sw.Close();
                                                    }
                                                    continue;
                                                }
                                                else
                                                {
                                                    _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} there is not enough {2} in the secure loot to deposit this value.[-]", Config.Chat_Response_Color, _cInfo.playerName, Ingame_Coin), Config.Server_Response_Name, false, "ServerTools", false));
                                                }
                                            }
                                        }
                                        slotNumber++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you input an invalid integer. Type /deposit #.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
            }
            if (Found)
            {
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} deposited {2} into your bank account from the secure loot. 5% fee was applied.[-]", Config.Chat_Response_Color, _cInfo.playerName, Ingame_Coin), Config.Server_Response_Name, false, "ServerTools", false));
            }
            else
            {
                _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1} you don't have enough in the secure loot to deposit that much into your bank.[-]", Config.Chat_Response_Color, _cInfo.playerName), Config.Server_Response_Name, false, "ServerTools", false));
            }
        }