// ======================================================================================= \\
// Local Handle System (made by KaTTaNa) \\
// ======================================================================================= \\
function H2I takes handle h returns integer
return h
return 0
endfunction
function LocalVars takes nothing returns gamecache
if udg_RSCache == null then
set udg_RSCache = InitGameCache("jasslocalvars.w3v")
endif
return udg_RSCache
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
// ======================================================================================= \\
// Recipe System (made by Rheias) \\
// ======================================================================================= \\
function RecipeSysCon takes nothing returns boolean
local trigger RecipeSysExe = GetTriggeringTrigger()
local unit triggerer = GetTriggerUnit()
local integer r = GetHandleInt(RecipeSysExe,"r")
local integer a = GetHandleInt(RecipeSysExe,"a")
local integer b = GetHandleInt(RecipeSysExe,"b")
local integer c = GetHandleInt(RecipeSysExe,"c")
local integer d = GetHandleInt(RecipeSysExe,"d")
local integer e = GetHandleInt(RecipeSysExe,"e")
local integer f = GetHandleInt(RecipeSysExe,"f")
local string p = GetHandleString(RecipeSysExe,"p")
local string t = GetHandleString(RecipeSysExe,"t")
local integer pickedSlot = 0
local item pickedItem
local integer sum = GetHandleInt(RecipeSysExe,"sum")
local integer count = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == a and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == b and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == c and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == d and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == e and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == f and pickedItem != null then
set count = count + 1
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
if count == sum then
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == a and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == b and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == c and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == d and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == e and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
set pickedSlot = 0
loop
exitwhen pickedSlot > 6
set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
if GetItemTypeId(pickedItem) == f and pickedItem != null then
call UnitRemoveItem(triggerer,pickedItem)
call RemoveItem(pickedItem)
exitwhen true
endif
set pickedSlot= pickedSlot + 1
endloop
call UnitAddItemById(triggerer,r)
call DestroyEffect(AddSpecialEffectTarget(t,triggerer,p))
endif
set pickedItem = null
set triggerer = null
set RecipeSysExe = null
return true
endfunction
function RecipeSysSet takes integer r,integer a,integer b,integer c,integer d,integer e,integer f, string p, string t returns nothing
local trigger RecipeSysExe = CreateTrigger()
local boolexpr RecipeSysCondition = Condition(function RecipeSysCon)
local integer sum = 0
call TriggerRegisterAnyUnitEventBJ(RecipeSysExe,EVENT_PLAYER_UNIT_PICKUP_ITEM)
if r != 0 then
call SetHandleInt(RecipeSysExe,"r",r)
if a != 0 then
call SetHandleInt(RecipeSysExe,"a",a)
set sum = sum + 1
endif
if b != 0 then
call SetHandleInt(RecipeSysExe,"b",b)
set sum = sum + 1
endif
if c != 0 then
call SetHandleInt(RecipeSysExe,"c",c)
set sum = sum + 1
endif
if d != 0 then
call SetHandleInt(RecipeSysExe,"d",d)
set sum = sum + 1
endif
if e != 0 then
call SetHandleInt(RecipeSysExe,"e",e)
set sum = sum + 1
endif
if f != 0 then
call SetHandleInt(RecipeSysExe,"f",f)
set sum = sum + 1
endif
call SetHandleInt(RecipeSysExe,"sum",sum)
call SetHandleString(RecipeSysExe,"p",p)
call SetHandleString(RecipeSysExe,"t",t)
call TriggerAddCondition(RecipeSysExe,RecipeSysCondition)
else
call DisableTrigger(RecipeSysExe)
call DestroyTrigger(RecipeSysExe)
endif
set RecipeSysExe = null
set RecipeSysCondition = null
endfunction
Name | Type | is_array | initial_value |
RSCache | gamecache | No |