Wrda
Spell Reviewer
- Joined
- Nov 18, 2012
- Messages
- 1,911
JASS:
public static method create takes unit shop, integer id, boolean isUnit, boolean isSpacer, integer startStock, integer maxStock, integer startDelay, integer replenishInterval returns thistype
local thistype this = thistype.allocate()
set this.shop = shop
set this.id = id
set this.isUnit = isUnit
set this.startStock = startStock
set this.maxStock = maxStock
set this.currentStock = startStock
set this.startDelay = startDelay
set this.replenishInterval = replenishInterval
set this.elapsedTimeStartDelay = 0
set this.elapsedTimeReplenishInterval = 0
if (head == 0) then
set head = this
else
set this.previous = head
set head = this
endif
return this
endmethod
Currently in the create method the instance isn't having the member isSpacing set as the value of the parameter. I assume with the TODO comment above about creating two types.
GetPagedButtonsType doesn't look like it's working properly. Attemped to print instance of Forest Troll Berserker and Forest Troll Shadow Priest and I got the same number (55). Same thing goes for Red Dragon Whelp and Red Drake (1).
It seems to me buying any unit on Advanced Mercenary Camp triggers the cooldown of Forest Troll Berserker when moving out to another page and then coming back, moving from these two pages makes the stock cooldown timer reset to 210 seconds.
RemovePagedButtonsId seems incomplete.
Doesn't look that worthy to have RefreshPagedButtonsPage function instead of calling the function it calls directly.
I don't really understand why AddPagedButtonsId is defining startStock, maxStock, startDelay and replenishInterval for all units/items, while unit/item types have their own values. Even when buying stuff it shows the replenish interval matching the object editor's one, and not the one on code.
Good idea to start with, but requires some tweaking.