Ingame Shop¶
This module is a compilation of all in-game Shop related classes.
- class Listing[source]¶
A dynamically flowing Queue with the provision for pinning items from removal.
- Parameters
items (List[ShopItem]) – An optional list of items to be added to the queue.
maxsize (Optional[int]) – The maximum size of the queue., default is 5.
- property name_id_map: Dict[str, str]¶
Returns a mapping between item names and their ids.
- Returns
A dictionary of item names and their ids.
- Return type
Dict[str, str]
- class ShopCategory[source]¶
The different categories of PokeGambler Shop.
- Parameters
name (str) – The name of the category.
description (str) – The description for the category.
emoji (str) – The emoji for the category.
items (
Listing
) – A list of items in the category.
- class ShopItem[source]¶
Base class for any item visible in the PokeGambler Shop.
- Parameters
itemid (str) – The id of the item.
name (str) – The name of the item.
description (str) – The description for the item.
price (int) – The price of the item.
emoji (str) – The emoji for the item.
pinned (bool) – Whether the item is pinned in the Shop.
- debit_player()[source]¶
Debits from the player, the price of the item.
- Parameters
user (
discord.Member
) – The user to debit from.quantity (Optional[int]) – The quantity of items to debit., default is 1.
premium (bool) – Whether the item is premium.
- class BoostItem[source]¶
This class represents a purchasable temporary boost.
- async buy()[source]¶
Applies the relevant temporary boost to the user.
- Parameters
message (
discord.Message
) – The message which triggered the boost purchase.quantity (int) – The number of stacks of boost to buy.
- Returns
A success/error message.
- Return type
str
- class PremiumBoostItem[source]¶
Permanent Boosts purchasable from Premium Shop
- buy()[source]¶
Applies the relevant permanent boost to the user.
- Parameters
message (
discord.Message
) – The message which triggered the boost purchase.quantity (int) – The number of stacks of boost to buy.
- Returns
A success/error message.
- Return type
str
- class TradebleItem[source]¶
This class represents a shop version of
Tradable
.- buy()[source]¶
Buys the Item and places in user’s inventory.
- Parameters
message (
discord.Message
) – The message that triggered this action.quantity (int) – The number of items to buy.
- Returns
A success/error message.
- Return type
str
- class Title[source]¶
This class represents a purchasable Title.
- async buy()[source]¶
Automatically adds the titled role to the user. Also edits their nickname if possible.
- Parameters
message (
discord.Message
) – The message that triggered this action.- Returns
A success/error message.
- Return type
str
- class Shop[source]¶
The main class containing all Shop related data and functionality.
- classmethod add_category()[source]¶
Adds a new category to the Shop.
- Parameters
category (
ShopCategory
) – The new ShopCategory to add.
- classmethod from_name()[source]¶
Returns the itemid of the item with given name.
- Parameters
name (str) – The name of the item.
- Returns
The itemid of the item.
- Return type
str
- classmethod get_item()[source]¶
Returns the item registered in Shop based on itemID.
- Parameters
itemid (str) – The itemid of the item.
force_new (bool) – If True, a new Item is created.
- Returns
The item registered in Shop.
- Return type
- classmethod refresh_tradables()[source]¶
Similar to
update_category()
, but exclusive forTradable
.
- classmethod update_category()[source]¶
Updates an existing category in the Shop.
- Parameters
category (str) – The name of the category.
items (list[
ShopItem
]) – The items to add to the category.
- classmethod validate()[source]¶
Validates if an item is purchasable and affordable by the user.
- Parameters
user (
discord.Member
) – The user to check the item for.item (
ShopItem
) – The item to check.quantity (int) – The quantity of the item.
- Returns
The error message if the item is not purchasable.
- Return type
str