globals
hashtable BMH_ConfigTable
//Basic stats are 1 - 20. Custom stats start from 21
integer STAT_DAMAGE = 1
integer STAT_HEALTH = 2
integer STAT_HEALTHREG = 3
integer STAT_ARMOR = 4
integer STAT_MANA = 5
integer STAT_MANAREG = 6
integer STAT_ATTACKRATE = 7
endglobals
library BonusModHash requires ExtraFunctions
function AddStat takes unit u,integer Stat,integer amount returns nothing
local integer i = 0
local integer Max = LoadInteger(BMH_ConfigTable,Stat,StringHash("Abils"))
local integer AbilityID
loop
exitwhen i > Max
set AbilityID = LoadInteger(BMH_ConfigTable,Stat,StringHash("AbilIndex"+I2S(i)))
if GetUnitAbilityLevel(u,AbilityID) > 0 then
set amount = amount + IntPower(2,i)
call UnitRemoveAbility(u,AbilityID)
endif
set i = i + 1
endloop
set i = Max
loop
exitwhen i < 0
if amount >= IntPower(2,i) then
call UnitAddAbility(u,LoadInteger(BMH_ConfigTable,Stat,StringHash("AbilIndex"+I2S(i))))
set amount = amount - IntPower(2,i)
endif
set i = i - 1
endloop
endfunction
//++
function InitTrig_BonusModHash takes nothing returns nothing
local integer i
set BMH_ConfigTable = InitHashtable()
//Damage
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(0)),'ADM0')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(1)),'ADM1')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(2)),'ADM2')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(3)),'ADM3')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(4)),'ADM4')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(5)),'ADM5')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(6)),'ADM6')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(7)),'ADM7')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(8)),'ADM8')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(9)),'ADM9')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("AbilIndex"+I2S(10)),'ADMA')
call SaveInteger(BMH_ConfigTable,STAT_DAMAGE,StringHash("Abils"),10)
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(0)),'AHP0')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(1)),'AHP1')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(2)),'AHP2')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(3)),'AHP3')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(4)),'AHP4')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(5)),'AHP5')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(6)),'AHP6')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(7)),'AHP7')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(8)),'AHP8')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(9)),'AHP9')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(10)),'AHPA')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("Abils"),10)
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(0)),'AHR0')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(1)),'AHR1')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(2)),'AHR2')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(3)),'AHR3')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(4)),'AHR4')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(5)),'AHR5')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(6)),'AHR6')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(7)),'AHR7')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(8)),'AHR8')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(9)),'AHR9')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("AbilIndex"+I2S(10)),'AHRA')
call SaveInteger(BMH_ConfigTable,STAT_HEALTH,StringHash("Abils"),10)
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(0)),'AAM0')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(1)),'AAM1')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(2)),'AAM2')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(3)),'AAM3')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(4)),'AAM4')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(5)),'AAM5')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(6)),'AAM6')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(7)),'AAM7')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(8)),'AAM8')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(9)),'AAM9')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("AbilIndex"+I2S(10)),'AAMA')
call SaveInteger(BMH_ConfigTable,STAT_ARMOR,StringHash("Abils"),10)
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(0)),'AMN0')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(1)),'AMN1')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(2)),'AMN2')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(3)),'AMN3')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(4)),'AMN4')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(5)),'AMN5')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(6)),'AMN6')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(7)),'AMN7')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(8)),'AMN8')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(9)),'AMN9')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(10)),'AMNA')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(11)),'AMNB')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(12)),'AMNC')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("AbilIndex"+I2S(13)),'AMND')
call SaveInteger(BMH_ConfigTable,STAT_MANA,StringHash("Abils"),13)
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(0)),'AMR0')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(1)),'AMR1')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(2)),'AMR2')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(3)),'AMR3')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(4)),'AMR4')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(5)),'AMR5')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(6)),'AMR6')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(7)),'AMR7')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(8)),'AMR8')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(9)),'AMR9')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("AbilIndex"+I2S(10)),'AMRA')
call SaveInteger(BMH_ConfigTable,STAT_MANAREG,StringHash("Abils"),10)
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(0)),'AAR0')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(1)),'AAR1')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(2)),'AAR2')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(3)),'AAR3')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(4)),'AAR4')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(5)),'AAR5')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(6)),'AAR6')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(7)),'AAR7')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("AbilIndex"+I2S(8)),'AAR8')
call SaveInteger(BMH_ConfigTable,STAT_ATTACKRATE,StringHash("Abils"),8)
endfunction
endlibrary