[Jass corvered] [vJass] RIGHT CLICK RECIPE v0.01
Cái SYSTEM này chắc nhiều bạn biết rồi nhưng khổ nỗi nó lại làm bằng GUI nên nếu bạn làm nhiều Item thì sẽ phải bấm khá lâu. Thế nên mình quyết định cover cái System này thành Jass cho dễ dùng hơn.
Bản gốc(v1.05): http://www.hiveworkshop.com/forums/spells-569/gui-right-click-item-recipe-1-05-a-227350/?prev=search%3Dclick%26d%3Dlist%26r%3D20
Bản Cover : http://www.mediafire.com/download/zmzvapidyu2d9uj/Cover+RCR+SYSTEM.w3x
Mô tả: SYSTEM này sử dụng để ghép 2 Item với nhau bằng cách click chuột để chỉ định( không phải cầm vào là tự ghép ngay =.=.
Hướng đẫn xài:
Rất đơn giản, sử dụng câu lệnh: regitem( Item thứ nhất, Item thứ hai, Item hợp thành)
Bản gốc(v1.05): http://www.hiveworkshop.com/forums/spells-569/gui-right-click-item-recipe-1-05-a-227350/?prev=search%3Dclick%26d%3Dlist%26r%3D20
Bản Cover : http://www.mediafire.com/download/zmzvapidyu2d9uj/Cover+RCR+SYSTEM.w3x
Mô tả: SYSTEM này sử dụng để ghép 2 Item với nhau bằng cách click chuột để chỉ định( không phải cầm vào là tự ghép ngay =.=.
Hướng đẫn xài:
Rất đơn giản, sử dụng câu lệnh: regitem( Item thứ nhất, Item thứ hai, Item hợp thành)
- Code:
library RCRCombie initializer Init
globals
private item RCR_CombineItemA
private item RCR_CombineItemB
//Chinh hieu ung khi ep do o day
private string RCR_CombineSFX = "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl"
/*******************************/
private hashtable RCR_CombineTable = InitHashtable()
private integer RCR_SaveA
private integer RCR_SaveB
private integer RCR_SaveR
private integer RCR_SaveRecipeItemA
private integer RCR_SaveRecipeItemB
private integer RCR_SaveRecipeResult
endglobals
/*************************************************************************
* Su dung cau lenh sau de dang ki: *
* regitem( IT1 , IT2 , IT ) *
* Mon thu nhat Mon thu hai do tao thanh *
**************************************************************************/
private function SaveRecipe takes nothing returns nothing
set RCR_SaveA = RCR_SaveRecipeItemA
set RCR_SaveB = RCR_SaveRecipeItemB
set RCR_SaveR = RCR_SaveRecipeResult
call SaveInteger( RCR_CombineTable, RCR_SaveB, RCR_SaveA, RCR_SaveR)
call SaveInteger( RCR_CombineTable, RCR_SaveA, RCR_SaveB, RCR_SaveR )
endfunction
function regitem takes integer IT1, integer IT2, integer IT returns nothing
set RCR_SaveRecipeItemA = IT1
set RCR_SaveRecipeItemB = IT2
set RCR_SaveRecipeResult = IT
call SaveRecipe()
endfunction
private function COND1 takes nothing returns boolean
if ( GetOrderTargetItem() == null) then
return false
endif
return true
endfunction
private function COND4 takes nothing returns boolean
if ( RCR_CombineSFX == "" ) then
return false
endif
return true
endfunction
private function COND3 takes nothing returns boolean
if ( RCR_SaveR == 0 ) then
return false
endif
if ( RCR_SaveA == RCR_SaveB ) then
return false
endif
return true
endfunction
private function COND2 takes nothing returns boolean
if (RCR_CombineItemA == null) then
return false
endif
if (RCR_CombineItemB == null) then
return false
endif
if ( RCR_CombineItemA == RCR_CombineItemB) then
return false
endif
return true
endfunction
private function Action takes nothing returns nothing
local effect CombineEFF
local unit tempUnit = GetTriggerUnit()
local integer tempItemType
local integer LoopA = GetIssuedOrderId() - 852002
// null previous variables
set RCR_SaveR = 0
set RCR_CombineItemB = UnitItemInSlot(tempUnit, LoopA)
set RCR_CombineItemA = GetOrderTargetItem()
// Now check recipes
if ( COND2() ) then
// Retrieve recipe result
set RCR_SaveRecipeItemA = GetItemTypeId(RCR_CombineItemA)
set RCR_SaveRecipeItemB = GetItemTypeId(RCR_CombineItemB)
set RCR_SaveA = RCR_SaveRecipeItemA
set RCR_SaveB = RCR_SaveRecipeItemB
set RCR_SaveR = LoadInteger(RCR_CombineTable, RCR_SaveB, RCR_SaveA)
set tempItemType = RCR_SaveR
// Verify result
if ( COND3() ) then
call UnitRemoveItem( tempUnit, RCR_CombineItemA)
call UnitRemoveItem( tempUnit, RCR_CombineItemB)
call UnitAddItemById( tempUnit, tempItemType)
if ( COND4() ) then
set CombineEFF = AddSpecialEffectTarget( RCR_CombineSFX, tempUnit, "origin" )
call DestroyEffect( CombineEFF )
endif
call RemoveItem( RCR_CombineItemA )
call RemoveItem( RCR_CombineItemB )
endif
endif
set tempUnit = null
set CombineEFF = null
endfunction
private function Init takes nothing returns nothing
local trigger t1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t1, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( t1, Condition( function COND1 ) )
call TriggerAddAction( t1, function Action )
endfunction
endlibrary