Dark gamer
New Member
- Reaction score
- 0
tags.
function BaoItem takes integer id,integer str,integer agi,integer int,integer dam,integer arm,integer ias,integer ims,integer rel,integer rem returns nothing
set ItemID[ItemCount] = id
set ItemStr[ItemCount] = str
set ItemAgi[ItemCount] = agi
set ItemInt[ItemCount] = int
set ItemDam[ItemCount] = dam
set ItemArm[ItemCount] = arm
set ItemCount = ItemCount + 1
endfunction
function ItemLM takes integer id,integer life,integer mana returns nothing
endfunction
function Trig_Init_Item_Actions takes nothing returns nothing
call BaoItem(039;I00O039;,0,0,0,24,0,0,0,0,0)
call BaoItem(039;I00P039;,0,0,0,15,0,10,0,0,0)
call BaoItem(039;I00D039;,6,0,0,0,0,0,0,0,0)
call BaoItem(039;I00C039;,0,6,0,0,0,0,0,0,0)
call BaoItem(039;I000039;,0,0,0,0,0,0,50,0,0)
call BaoItem(039;I00V039;,0,0,0,18,3,0,0,0,0)
call BaoItem(039;I00M039;,0,0,0,12,0,0,0,0,0)
call BaoItem(039;I00J039;,0,0,9,0,0,0,0,0,0)
call BaoItem(039;I017039;,24,0,0,0,0,0,0,0,0)
call BaoItem(039;I00K039;,9,0,0,0,0,0,0,0,0)
call BaoItem(039;I01A039;,0,0,0,48,0,0,0,0,0)
call BaoItem(039;I00Q039;,0,0,0,6,0,0,0,0,0)
call BaoItem(039;I00S039;,0,0,0,21,0,5,0,0,0)
call BaoItem(039;I00E039;,3,0,0,0,0,0,0,0,0)
call BaoItem(039;I002039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I001039;,0,0,0,0,0,15,0,0,0)
call BaoItem(039;I00L039;,0,9,0,0,0,0,0,0,0)
call BaoItem(039;I00H039;,9,9,9,0,0,0,0,0,0)
call BaoItem(039;I00I039;,3,3,3,0,0,0,0,0,0)
call BaoItem(039;I00N039;,0,0,0,18,0,0,0,0,0)
call BaoItem(039;I00G039;,0,0,3,0,0,0,0,0,0)
call BaoItem(039;I00W039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I01G039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I00T039;,0,0,0,0,6,0,0,0,0)
call BaoItem(039;I01F039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I01C039;,0,0,0,24,0,0,0,0,0)
call BaoItem(039;I01D039;,0,0,0,21,0,0,0,0,0)
call BaoItem(039;I01E039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I00R039;,0,0,0,30,0,0,0,0,0)
call BaoItem(039;I007039;,0,0,0,0,0,0,0,2,0)
call BaoItem(039;I00F039;,0,0,6,0,0,0,0,0,0)
call BaoItem(039;I003039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I00B039;,0,3,0,0,0,0,0,0,0)
call BaoItem(039;I008039;,0,0,0,0,0,0,0,0,2)
call BaoItem(039;I018039;,0,0,24,0,0,0,0,0,0)
call BaoItem(039;I004039;,0,0,0,0,0,0,0,4,0)
call BaoItem(039;I005039;,0,0,0,0,0,0,0,0,4)
call BaoItem(039;I019039;,0,24,0,0,0,0,0,0,0)
call BaoItem(039;I01J039;,0,0,0,0,0,0,0,0,0)
call BaoItem(039;I023039;,0,9,0,18,0,0,30,0,0)
call BaoItem(039;I03A039;,0,0,0,0,15,0,0,0,0)
call BaoItem(039;I01Q039;,0,0,0,9,0,0,0,0,0)
call BaoItem(039;I031039;,0,0,0,30,0,35,0,0,0)
call BaoItem(039;I02H039;,9,6,12,0,0,0,0,0,0)
call BaoItem(039;I02X039;,0,0,12,21,0,0,0,0,0)
call BaoItem(039;I036039;,0,0,0,54,0,0,0,0,0)
call BaoItem(039;I02J039;,6,12,9,0,0,0,0,0,0)
call BaoItem(039;I03C039;,0,0,0,54,0,0,0,0,0)
call BaoItem(039;I02Q039;,0,0,15,21,0,0,0,0,0)
call BaoItem(039;I02P039;,0,0,12,18,0,0,0,0,1)
call BaoItem(039;I02R039;,0,0,18,24,0,0,0,0,3)
call BaoItem(039;I02T039;,0,0,0,21,0,0,0,0,0)
call BaoItem(039;I01H039;,0,0,0,0,0,0,0,5,5)
call BaoItem(039;I01S039;,0,0,0,33,0,0,0,0,0)
call BaoItem(039;I02B039;,0,0,0,33,0,0,0,0,0)
call BaoItem(039;I02L039;,12,9,6,0,0,0,0,0,0)
call BaoItem(039;I02D039;,0,0,0,30,0,45,0,0,0)
call BaoItem(039;I02Z039;,18,0,0,30,0,0,0,0,0)
call BaoItem(039;I020039;,15,6,6,0,0,0,0,0,0)
call BaoItem(039;I021039;,6,6,15,0,0,0,0,0,0)
call BaoItem(039;I01Z039;,6,15,6,0,0,0,0,0,0)
call BaoItem(039;I02F039;,0,0,0,18,0,0,100,0,0)
call BaoItem(039;I014039;,0,0,0,9,0,25,65,0,0)
call BaoItem(039;I01Y039;,6,3,3,0,0,0,0,0,0)
call BaoItem(039;I02U039;,0,12,0,18,0,0,0,0,0)
call BaoItem(039;I03E039;,18,0,0,30,0,0,80,0,0)
call BaoItem(039;I027039;,6,0,0,34,0,0,0,0,0)
call BaoItem(039;I045039;,0,0,0,0,5,0,0,0,0)
call BaoItem(039;I038039;,0,0,0,33,0,0,0,7,6)
call BaoItem(039;I025039;,0,0,0,0,0,0,0,0,3 )
call BaoItem(039;I01W039;,3,3,6,0,0,0,0,0,0)
call BaoItem(039;I029039;,0,0,3,18,0,3,0,0,0)
call BaoItem(039;I01L039;,0,0,7,12,0,0,0,0,0)
call BaoItem(039;I01X039;,3,6,3,0,0,0,0,0,0)
call BaoItem(039;I02N039;,0,0,0,0,5,0,0,0,0)
call BaoItem(039;I016039;,0,0,0,30,0,15,22,0,0)
call BaoItem(039;I040039;,0,0,39,39,0,0,0,0,0)
call BaoItem(039;I03W039;,0,27,0,33,30,33,0,0,0)
call BaoItem(039;I03G039;,10,0,0,60,0,0,0,0,0)
call BaoItem(039;I03S039;,0,36,0,24,0,0,0,0,0)
call BaoItem(039;I03I039;,27,0,0,36,0,0,0,0,0)
call BaoItem(039;I03O039;,0,0,0,80,0,0,0,9,0)
call BaoItem(039;I03Q039;,24,24,24,24,0,0,0,0,0)
call BaoItem(039;I03K039;,0,0,0,60,0,0,0,0,0)
call BaoItem(039;I03M039;,0,0,0,85,6,25,0,0,0)
call BaoItem(039;I03U039;,0,0,30,0,0,0,0,0,8)
call BaoItem(039;I03Y039;,33,0,0,0,0,0,0,11,0)
endfunction
function HeroStatus takes unit u,real str,real agi,real int,real dam,real armor returns nothing
local integer t
local integer a
local integer b
local integer c
local integer dvi
local integer chuc
local integer tram
local integer array abi1
local integer array abi2
local integer array abi3
local integer array at
local integer i
local boolean tru
set at[1] = R2I(str)
set at[2] = R2I(agi)
set at[3] = R2I(int)
set at[4] = R2I(dam)
set at[5] = R2I(armor)
set abi1[1] = 039;SJ01039; // str 1
set abi1[2] = 039;SJ04039; // agi 1
set abi1[3] = 039;SJ07039; // int 1
set abi1[4] = 039;AItg039; // dam 1
set abi1[5] = 039;AId1039; // arm 1
set abi2[1] = 039;SJ02039; // str 10
set abi2[2] = 039;SJ05039; // agi 10
set abi2[3] = 039;SJ08039; // int 10
set abi2[4] = 039;AItn039; // dam 10
set abi2[5] = 039;AId2039; // arm 10
set abi3[1] = 039;SJ03039; // str 100
set abi3[2] = 039;SJ09039; // agi 100
set abi3[3] = 039;SJ09039; // int 100
set abi3[4] = 039;AItc039; // dam 100
set abi3[5] = 039;AId3039; // arm 100
set i = 1
loop
exitwhen i > 5
set tru = false
if at<i> < 0 then
set at<i> = - at<i>
set tru = true
endif
if at<i> != 0 then
set t = at<i>
set dvi = GetUnitAbilityLevel(u,abi1<i>) - 1
set chuc = GetUnitAbilityLevel(u,abi2<i>) - 1
set tram = GetUnitAbilityLevel(u,abi3<i>) - 1
set a = (t - ModuloInteger(t,100))/100
set t = t - a * 100
set b = (t - ModuloInteger(t,10))/10
set t = t - b * 10
set c = t
if tru == false then
if c + dvi >= 10 then
set b = b + 1
set c = c + dvi - 10
else
set c = c + dvi
endif
if b + chuc >= 10 then
set a = a + 1
set b = b + chuc - 10
else
set b = b + chuc
endif
set a = a + tram
else
if dvi - c < 0 then
set b = b - 1
set c = 10 + dvi - c
else
set c = dvi - c
endif
if chuc - b < 0 then
set a = a - 1
set b = 10 + chuc - b
else
set b = chuc - b
endif
if tram - a < 0 then
set a = 0
else
set a = tram - a
endif
endif
call SetUnitAbilityLevel(u,abi1<i>,c + 1)
call SetUnitAbilityLevel(u,abi2<i>,b + 1)
call SetUnitAbilityLevel(u,abi3<i>,a + 1)
endif
set i = i + 1
endloop
endfunction
</i></i></i></i></i></i></i></i></i></i></i>
//Event pick item
function Trig_Pick_Up_Item_Actions takes nothing returns nothing
local integer a = 1
local unit u = GetTriggerUnit()
local item i = GetManipulatedItem()
local integer id = GetItemTypeId(i)
set a = 1
loop
exitwhen a > ItemCount
if id == ItemID[a] then
exitwhen true
endif
set a = a + 1
endloop
call HeroStatus(u,ItemStr[a],ItemAgi[a],ItemInt[a],ItemDam[a],ItemArm[a])
set i = null
set u = null
endfunction
//Loss Item - ability
function Trig_Loss_An_Item_Actions takes nothing returns nothing
local integer a = 1
local unit u = GetTriggerUnit()
local item i = GetManipulatedItem()
local integer id = GetItemTypeId(i)
set a = 1
loop
exitwhen a > ItemCount
if id == ItemID[a] then
exitwhen true
endif
set a = a + 1
endloop
call HeroStatus(u,-ItemStr[a],-ItemAgi[a],-ItemInt[a],-ItemDam[a],-ItemArm[a])
set i = null
set u = null
endfunction
//===========================================================================
function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddAction( t, function Trig_Loss_An_Item_Actions )
set t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( t, function Trig_Pick_Up_Item_Actions )
set t = CreateTrigger( )
call TriggerRegisterTimerEventSingle( t, 0.10 )
call TriggerAddAction( t, function Trig_Init_Item_Actions )
set t = null
endfunction
endscope