Item shop module. Item shop is described in detail in Shop article.

Methods

inline buy (itemID:Int):String

Sends request to cache server to buy item from shop. If the item has a limited amount, this method will check if it is still available and modify its amount.

Parameters:

itemID

Item ID.

Returns:

Operation error code. notAvailable - item is not in shop or no longer available. ok - operation successful.

getDiff ():Void

Updates local shop contents copy from cache server. This can be called each time the client sends the request to get shop contents.

inline getItem (id:Int):_ShopItem

Returns shop item by its ID.

Parameters:

id

Item ID.

Returns:

Shop item structure. Returns null, if the item is not in shop.

inline iterator ():Iterator<_ShopItem>

Returns shop items iterator.

Returns:

Shop items iterator.

inline sell (itemID:Int):Void

Notifies cache server about selling item.

Parameters:

itemID

Item ID.