From 96dda1cd10a50d8055a55bc6f2580b12f9bd980a Mon Sep 17 00:00:00 2001 From: Assambra Date: Tue, 29 May 2018 16:25:07 +0200 Subject: [PATCH 1/2] Necessary adjustments for uMMORPG ver. 1.120, to work with the renamed Templates Items/Skill/Quest/Recipe --- Database_MySql.cs | 26 +++++++++++++------------- Readme.md | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Database_MySql.cs b/Database_MySql.cs index f10338b..91f92ae 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); } @@ -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. From 485bc01bd0a4d9ee054e36b783d595b3a2dd5211 Mon Sep 17 00:00:00 2001 From: Assambra Date: Tue, 29 May 2018 17:26:33 +0200 Subject: [PATCH 2/2] fix missing renaming in LoadSkills function --- Database_MySql.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Database_MySql.cs b/Database_MySql.cs index 91f92ae..6cffeca 100644 --- a/Database_MySql.cs +++ b/Database_MySql.cs @@ -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 ",