Workbench v1
300
lvl: 5

ID:

275

Author:

Boekie

Rarity:

unique

Status:

Approved

Description:

This bench is used to improve other items.

Latest Upload Comment:

Restored from 1.10
Improve Item
Every kill increases item quality by 0.15%. The quality improvement is bound to the item.
Download

Toggle Triggers

Header

goldcost: 0
    globals
        MultiboardValues boekie_itemQualBonus
    endglobals
    
    //Do not remove or rename this function!
    //Put your initialization tasks here, this function will be called on map init
    private function init takes nothing returns nothing
        set boekie_itemQualBonus = MultiboardValues.create(1)
        call boekie_itemQualBonus.setKey(0,"Workbench")
    endfunction

On Item Creation

goldcost: 0
function onCreate takes Item itm returns nothing
set itm.userReal = 0.00 
endfunction

On Item Drop

goldcost: 0
function onDrop takes Item itm returns nothing
call itm.getCarrier().modifyProperty( MOD_ITEM_QUALITY_ON_KILL, -itm.userReal ) 
endfunction

On Item Pickup

goldcost: 0
function onPickup  takes Item itm returns nothing
call itm.getCarrier().modifyProperty( MOD_ITEM_QUALITY_ON_KILL, itm.userReal ) 
endfunction

On Kill

goldcost: 300
function onKill takes Item itm returns nothing
call itm.getCarrier().modifyProperty( MOD_ITEM_QUALITY_ON_KILL, -itm.userReal )  
set itm.userReal = itm.userReal + 0.0015  
call itm.getCarrier().modifyProperty( MOD_ITEM_QUALITY_ON_KILL, itm.userReal )
endfunction

On Tower Details

goldcost: 0
function onTowerDetails takes Item itm returns MultiboardValues
    call boekie_itemQualBonus.setValue(0,formatPercent(itm.userReal,2))
    return boekie_itemQualBonus
endfunction