Search public documentation:
Last tested against UDK May, 2012
The shop system is a graphical user interface widget which allows players to purchase new items for their heroes.
This is the Scaleform HUD class which initializes and sets up the shop interface.
- ConfigShop() - This function is called when the Scaleform HUD is first initialized. It configures all of the widgets involved with the shop and caches them into variables for easy access later on. It also reads the UDKMOBAGFxHUDProperties archetype and populates the shop categories and items. Lastly, it also binds the button events to the appropriate delegates. Once the shop has been set up, this function then hides it automatically.
- UpdateShop() - This function shows the appropriate tool tip when the mouse is over a shop category radio button.
- ChangeShopItemType() - This function is called when clicking on an item type radio button. This changes what item category movie clip is currently visible.
- ChangeShopCategory() - This function is called when clicking on an item category radio button. This changes what item list is currently visible.
- PressShopItem() - This function is called when clicking on a shop item list. This handles the case where the player wants to purchase something.
This is an archetype-able object which stores how all of the items are stored and presented in the GUI.
- Shop - An array of structs which further define the shop item. These structs define the list of item types (basic, upgrades, etc).
- LocalizedItemTypeLabel - Localized name of the item type.
- ItemTypeRBName - Name of the item type radio button symbol in the Flash GUI.
- ItemCategoryMCName - Name of the item category movie clip in the Flash GUI.
- ItemCategories - An array of structs which further define the shop item. These struts define the list of item categories (basics 1, basics 2, basics 3, etc).
- ItemCategoryRBName - Name of the item category radio button symbol in the Flash GUI.
- ItemCategoryLstName - Name of the item category list symbol in the Flash GUI.
- LocalizedItemCategoryTooltip - Localized name of the item category.
- ItemArchetypes - Array of item archetypes that can be purchased from this item type and item category.
The player controller contains functions which handles the replication required to allow players to purchase items from the shop. Replication is handled here, as the GUI itself is never replicated nor can it handle replication.
- PurchaseItem() - This function can be executed on the server or the client and starts the purchasing logic. First a check is done to make sure that the player is able to purchase the item requested. If the game is running on the client, then it will perform a remote procedure call (UDKMOBAPlayerController::ServerPurchaseItem()) so that the server can execute the purchase logic on its side; and also simulated the purchase on its side to remove any lag. If the game is running on the server, then it will just call UDKMOBAPawnReplicationInfo::PurchaseItem().
- ServerPurchaseItem() - This function is called when the server is told be the client to do so. This calls UDKMOBAPawnReplicationInfo::PurchaseItem().
- CanPurchaseItem() - This function returns true of false depending if the user is able to purchase the requested item or not.
This replication info is used for the hero pawns. This separation was done to allow the possibility for players to control multiple heroes at once. Thus, items are stored within this replication info.
- PurchaseItem() - This function is executed on the server when the player wishes to purchase an item. At this point, the game has already verified that the player is able to purchase this item and no more further checks are done. The player's cash is modified using UDKMOBAPlayerReplicationInfo::ModifyMoney() and the item is spawned. Next is deciding how the item is given to the player. If the player is within a valid shop area volume and has space within his/her inventory then it is given directly to the player. If the player is not within a valid shop area volume or has no more space within his/her inventory and has space within his/her stash then it is placed within the stash. Otherwise, the item is then dropped onto the ground which can later be picked up by other players. Depending on where the item is placed, auto created items are checked for and are combined
- CheckForItemAutoCreation() - This function is executed on the server when a new item has been purchased or grabbed from the stash. It iterates over the items within the inventory, and checks if they have all the items they need in order to create a new inventory item. If they do, then the old items are destroyed and the new item is given.
- MAX_ITEM_COUNT - A constant which defines the maximum amount of items the player can carry.
- MAX_STASH_COUNT - A constant which defined the maximum amount of items the player can stash.
- Items - Items that this hero has. This is maintained between the server and the client.
- DroppedItemArchetype - Default dropped item archetype. This actor template is defined by the game designer to set how dropped pick ups look like.
This volume defines the area of the map which players can buy items that go into their hero's inventory rather than into their stash.
- GetTeamNum() - Returns TeamNum.
- TeamNum - Index of the team that this shop area volume belongs to.
- UpperLeftCorner - Upper left corner in world coordinates of this volume. This is used to spawn dropped inventory items.
- LowerRightCorner - Lower right corner in world coordinates of this volume. This is used to spawn dropped inventory items.