Skip to content

Commit

Permalink
Merge pull request #9 from Assambra/master
Browse files Browse the repository at this point in the history
All nessessary changes for uMMORPG ver. 1.120
  • Loading branch information
paulpach authored May 29, 2018
2 parents 56cec0a + 485bc01 commit 94b9fce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions Database_MySql.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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);
}
Expand All @@ -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 ",
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down

0 comments on commit 94b9fce

Please sign in to comment.