Exemplo n.º 1
0
        public static void AddItemToDB(JSONNode currentCharacter, ItemMod itemMod)
        {
            var newItemObject   = new JSONObject();
            var newItemModArray = new JSONArray();

            Debug.Log("item mod item");
            Debug.Log(itemMod.item);

            newItemObject.Add("item_UID", itemMod.item.UID);
            newItemObject.Add("item_type", itemMod.itemType.ToString());
            currentCharacter["items"][-1] = newItemObject;
            var newModObj = new JSONObject();

            foreach (var mod in itemMod.mods)
            {
                newModObj.Add(mod.Key, mod.Value);
            }
            newItemModArray.Add(newModObj);
            newItemObject.Add("modifications", newItemModArray);
            SaveItemDB();
        }