nmmo.systems.exchange module#

class nmmo.systems.exchange.Exchange(realm)#

Bases: object

buy(buyer, item: Item)#
property packet#
sell(seller, item: Item, price: int, tick: int)#
step(current_tick: int)#

Remove expired listings from the exchange’s listings queue and item listings dictionary. It takes in one parameter, current_tick, which is the current time in the game.

The method starts by checking the oldest listing in the listings queue using a while loop. If the current tick minus the listing tick is less than or equal to the EXCHANGE_LISTING_DURATION in the realm’s configuration, the method breaks out of the loop as the oldest listing has not expired. If the oldest listing has expired, the method removes it from the listings queue and the item listings dictionary.

It then checks if the actual listing still exists and that it is indeed expired. If it does exist and is expired, it calls the _unlist_item method to remove the listing and update the item’s listed price. The process repeats until all expired listings are removed from the queue and dictionary.

unlist_item(item: Item)#
class nmmo.systems.exchange.ItemListing(item: Item, seller, price: int, tick: int)#

Bases: object