- Joined
- Nov 13, 2006
- Messages
- 1,814
i dont understand why stoping the function if i stored data to local string variable array
damn interesting, when more item added then function stoped earlier and earlier
(used debug msg, like if 6 equiped then stop where debug say 7, if 8 equiped then where debug is 6 and if 9 then where is debug show the stats, indifferent what item in slot, indifferent what is the equip order, result same break time by time and if only ~3 piece then no error or something)
damn interesting, when more item added then function stoped earlier and earlier
(used debug msg, like if 6 equiped then stop where debug say 7, if 8 equiped then where debug is 6 and if 9 then where is debug show the stats, indifferent what item in slot, indifferent what is the equip order, result same break time by time and if only ~3 piece then no error or something)
JASS:
//we calculate how much str, agi, int coming from items - directly and from sockets
//we start in inventory - we check the charms
set i = 1
loop
exitwhen i > MAX_INVENTORY
if HaveSavedHandle(udg_Stat_Table, cv, i + 99) then
set itm = LoadItemHandle(udg_Stat_Table, cv, i + 99)
if GetItemLevel(itm) == 111 then //if item level is 111 then item is charm
set id = GetHandleId(itm)
set ITEM_STR = ITEM_STR + LoadInteger(udg_CItem_Table, id, 44)
set ITEM_AGI = ITEM_AGI + LoadInteger(udg_CItem_Table, id, 45)
set ITEM_INT = ITEM_INT + LoadInteger(udg_CItem_Table, id, 46)
endif
endif
set i = i + 1
endloop
set itm = null
//we start build the code for equipments, each equipment individually and at end combine to a large row
//equipment slots: 1 - 10
set i = 1
loop
exitwhen i == 11
set EQC[i] = ""
//if in equipment slot have saved item then
if HaveSavedHandle(udg_Stat_Table, cv, i) then
if i < 6 then
set EQ_B_CODE1 = EQ_B_CODE1 + Pow2[i - 1]
else
if EQ_B_CODE1 < 32 then
set EQ_B_CODE1 = EQ_B_CODE1 + 32
endif
set EQ_B_CODE2 = EQ_B_CODE2 + Pow2[i - 6]
endif
set EQ_Count = EQ_Count + 1
set id = GetHandleId(LoadItemHandle(udg_Stat_Table, cv, i))
set ITEM_STR = ITEM_STR + LoadInteger(udg_CItem_Table, id, 44)
set ITEM_AGI = ITEM_AGI + LoadInteger(udg_CItem_Table, id, 45)
set ITEM_INT = ITEM_INT + LoadInteger(udg_CItem_Table, id, 46)
set DURATIBILITY = R2I(LoadReal(udg_CItem_Table, id, 15) - LoadReal(udg_CItem_Table, id, 14)) //maxdur - duratibility
//we build a number, what store 6 boolean:
//unique id, refined, socketed, ethernal, rnd def(armor)/activation(weapon), duratibility length(1 or 2)
set a1 = 0
if LoadInteger(udg_CItem_Table, id, 0) > 0 then
set a1 = a1 + 1
endif
if LoadInteger(udg_CItem_Table, id, 16) > 0 then
set a1 = a1 + 2
endif
if LoadInteger(udg_CItem_Table, id, 18) > 0 then
set a1 = a1 + 4
endif
if LoadInteger(udg_CItem_Table, id, 13) > 0 then
set a1 = a1 + 8
endif
if LoadInteger(udg_CItem_Table, id, 25) > 0 then
set a1 = a1 + 16
endif
if DURATIBILITY >= l then
set a1 = a1 + 32
endif
set EQC[i] = SL_IntegerToCode(a1, 1)
// --- end of boolean and we create from number a character ---
// lets if was unique id then add that
set a1 = LoadInteger(udg_CItem_Table, id, 0)
if a1 > 0 then
set EQC[i] = EQC[i] + SL_IntegerToCode(a1, 1)
else
//lets check base stats: subtype, quality, grade, lv req
set EQC[i] = EQC[i] + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 3), 1) + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 4), 1) + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 7), 2) + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 8), 2)
//lets add the bonus item stats
set ii = 0
set a2 = 0
loop
set BONUS = Inline_Item_Bonus_Stat(ii)
set BONUS_LEN = Inline_Item_Bonus_Stat_Length(BONUS)
exitwhen BONUS == 0
set a1 = LoadInteger(udg_CItem_Table, id, BONUS)
if a1 > 0 then
set EQC[i] = EQC[i] + SL_IntegerToCode(BONUS, GEM_LEN) + SL_IntegerToCode(a1, BONUS_LEN)
endif
set ii = ii + 1
endloop
endif
//check if defence is random on armor or no
if LoadInteger(udg_CItem_Table, id, 25) > 0 then
if (i == 1 or i == 2 or i == 4) and LoadInteger(udg_CItem_Table, id, 25) == 1 then
set ii = 0
loop
exitwhen ii > 4
set a1 = LoadInteger(udg_CItem_Table, id, 35 + ii)
set EQC[i] = EQC[i] + SL_IntegerToCode(a1, 2)
set ii = ii + 1
endloop
elseif i == 3 then
set EQC[i] = EQC[i] + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 25), 1)
endif
endif
//save duratibility
set EQC[i] = EQC[i] + SL_IntegerToCode(DURATIBILITY, - 1)
//check if item is refined
if LoadInteger(udg_CItem_Table, id, 16) > 0 then
set EQC[i] = EQC[i] + SL_IntegerToCode(LoadInteger(udg_CItem_Table, id, 16), 1)
endif
//read out the socket bonus stat and its value too
set a1 = LoadInteger(udg_CItem_Table, id, 18)
if a1 > 0 then
set ii = 0
loop
exitwhen ii > a1
set a2 = LoadInteger(udg_CItem_Table, id, 1500 + ii)
set b3 = LoadInteger(udg_CItem_Table, id, 1000 + ii)
//if socket was filled then add socket unique id to code
set b4 = 1
loop
exitwhen b4 > b3
set EQC[i] = EQC[i] + SL_IntegerToCode(a2, 1)
set b4 = b4 + 1
endloop
//we check if sockets give bonus stat too
if a2 == 0 then
set ii = a1 + 1 //break out from loop
else
set a3 = LoadInteger(udg_CItem_Table, id, 2)
set a4 = ItemType2GemType(a3)
if a4 != 0 then
set b1 = LoadInteger(udg_CItem_Table, - 2000 - a2, 8 + a4)
set b2 = LoadInteger(udg_CItem_Table, - 2000 - a2, b1)
set b4 = b2 * b3
if b1 == 44 then
set ITEM_STR = ITEM_STR + b4
elseif b1 == 44 then
set ITEM_AGI = ITEM_AGI + b4
elseif b1 == 44 then
set ITEM_INT = ITEM_INT + b4
endif
endif
endif
set ii = ii + 1
endloop
endif
endif
set i = i + 1
endloop