Skip to content

Commit

Permalink
Added missing variables, fixed Conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Oen44 committed Dec 1, 2020
1 parent e39e366 commit 7ae5748
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions upgrade_system_core.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dofile("data/upgrade_system_const.lua")

local UPGRADE_SYSTEM_VERSION = "2.4.4"
local UPGRADE_SYSTEM_VERSION = "2.4.5"
print(">> Loaded Upgrade System v" .. UPGRADE_SYSTEM_VERSION)

US_CONDITIONS = {}
Expand Down Expand Up @@ -295,6 +295,8 @@ function us_onEquip(cid, iuid, slot)
end
local item = Item(iuid)
if player and item then
local maxHP = player:getMaxHealth()
local maxMP = player:getMaxMana()
local newBonuses = item:getBonusAttributes()
for key, value in pairs(newBonuses) do
local attr = US_ENCHANTMENTS[value[1]]
Expand All @@ -310,7 +312,7 @@ function us_onEquip(cid, iuid, slot)
if not US_CONDITIONS[value[1]][value[2]][itemId] then
US_CONDITIONS[value[1]][value[2]][itemId] = Condition(attr.condition)
if attr.condition ~= CONDITION_MANASHIELD then
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_SUBID, 1000 + math.random(value[1] * value[2]))
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_SUBID, 1000 + itemId)
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(attr.param, attr.percentage == true and 100 + value[2] or value[2])
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_TICKS, -1)
else
Expand Down Expand Up @@ -461,6 +463,8 @@ function us_onLogin(player)
player:registerEvent("UpgradeSystemMana")
player:registerEvent("UpgradeSystemPD")

local maxHP = player:getMaxHealth()
local maxMP = player:getMaxMana()
for slot = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(slot)
if item then
Expand All @@ -480,7 +484,7 @@ function us_onLogin(player)
if not US_CONDITIONS[value[1]][value[2]][itemId] then
US_CONDITIONS[value[1]][value[2]][itemId] = Condition(attr.condition)
if attr.condition ~= CONDITION_MANASHIELD then
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_SUBID, 1000 + math.random(value[1] * value[2]))
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_SUBID, 1000 + itemId)
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(attr.param, attr.percentage == true and 100 + value[2] or value[2])
US_CONDITIONS[value[1]][value[2]][itemId]:setParameter(CONDITION_PARAM_TICKS, -1)
else
Expand Down

0 comments on commit 7ae5748

Please sign in to comment.