diff --git a/Database_MySql.cs b/Database_MySql.cs index f10338b..6cffeca 100644 --- a/Database_MySql.cs +++ b/Database_MySql.cs @@ -431,10 +431,10 @@ private static void LoadInventory(Player player) string itemName = (string)reader["name"]; int slot = (int)reader["slot"]; - ItemTemplate template; - if (slot < player.inventorySize && ItemTemplate.dict.TryGetValue(itemName.GetStableHashCode(), out template)) + ScriptableItem itemData; + if (slot < player.inventorySize && ScriptableItem.dict.TryGetValue(itemName.GetStableHashCode(), out itemData)) { - Item item = new Item(template); + Item item = new Item(itemData); int amount = (int)reader["amount"]; item.petHealth = (int)reader["petHealth"]; item.petLevel = (int)reader["petLevel"]; @@ -460,10 +460,10 @@ private static void LoadEquipment(Player player) string itemName = (string)reader["name"]; int slot = (int)reader["slot"]; - ItemTemplate template; - if (slot < player.equipmentInfo.Length && ItemTemplate.dict.TryGetValue(itemName.GetStableHashCode(), out template)) + ScriptableItem itemData; + if (slot < player.equipmentInfo.Length && ScriptableItem.dict.TryGetValue(itemName.GetStableHashCode(), out itemData)) { - Item item = new Item(template); + Item item = new Item(itemData); int amount = (int)reader["amount"]; player.equipment[slot] = new ItemSlot(item, amount); } @@ -479,8 +479,8 @@ private static void LoadSkills(Player player) // which are only for newly created characters) // fill all slots first - foreach (var template in player.skillTemplates) - player.skills.Add(new Skill(template)); + foreach (ScriptableSkill skillData in player.skillTemplates) + player.skills.Add(new Skill(skillData)); using (var reader = GetReader( "SELECT name, level, castTimeEnd, cooldownEnd FROM character_skills WHERE `character`=@character ", @@ -524,13 +524,13 @@ private static void LoadBuffs(Player player) while (reader.Read()) { string buffName = (string)reader["name"]; - SkillTemplate template; - if (SkillTemplate.dict.TryGetValue(buffName.GetStableHashCode(), out template)) + ScriptableSkill skillData; + if (ScriptableSkill.dict.TryGetValue(buffName.GetStableHashCode(), out skillData)) { // make sure that 1 <= level <= maxlevel (in case we removed a skill // level etc) - int level = Mathf.Clamp((int)reader["level"], 1, template.maxLevel); - Buff buff = new Buff((BuffSkillTemplate)template, level); + int level = Mathf.Clamp((int)reader["level"], 1, skillData.maxLevel); + Buff buff = new Buff((BuffSkill)skillData, level); // buffTimeEnd is based on Time.time, which will be // different when restarting a server, hence why we saved // them as just the remaining times. so let's convert them @@ -554,10 +554,10 @@ private static void LoadQuests(Player player) while (reader.Read()) { string questName = (string)reader["name"]; - QuestTemplate template; - if (QuestTemplate.dict.TryGetValue(questName.GetStableHashCode(), out template)) + ScriptableQuest questData; + if (ScriptableQuest.dict.TryGetValue(questName.GetStableHashCode(), out questData)) { - Quest quest = new Quest(template); + Quest quest = new Quest(questData); quest.killed = (int)reader["killed"]; quest.completed = (bool)reader["completed"]; player.quests.Add(quest); diff --git a/Readme.md b/Readme.md index ed04ef3..913625e 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # UMMORPG Mysql Addon -This is a Mysql Addon for uMMORPG 1.117 and [previous versions](https://github.com/paulpach/ummorpg_mysql/releases) +This is a Mysql Addon for uMMORPG 1.120 and [previous versions](https://github.com/paulpach/ummorpg_mysql/releases) This is pretty much a drop in replacement for the sqlite Database.cs that comes with uMMORPG.