Gold Machine Module
This module aims to let players upgrade their pets to get better stats.
Usually, this module will be used behind a UI, so all functions present in this module, can be used on both the client and the server, but using them from the client calls the server. (So make your UI call the controller that will handle the communication with the server.)
Installation
In your wally.toml file, add this to your dependencies:
Import
You have two solutions to import this module, depending if you wish to import the Controller or the Service on your own, or if you let the module give you the right code.
Configuration
Usage
Client Side
This method allows you to listen to an event sent by the GoldMachineService and run a callback function whenever an event is received.
List of events:
OnPetAddedFailed: Called when a player tried to add a pet to the craft, but it failed. Sends the error code as a parameter.
OnPetsUpdated: Called when the list of pets in the current craft is updated. Sends the list of the pets in the craft as a parameter.
OnCraftSucceeded: Called when a craft succeeds. Sends the name of the newly crafted pet as a parameter.
OnCraftFailed: Called when a craft failed. Sends the name of the pet that should have been crafted as a parameter.
Usage
Explanation
name: The name of the event you wish to listen to.
callback: The callback function that will be run whenever this event is received.
This method allows a player to add a pet to the current craft of a gold pet. A maximum of 4 pets can be added to a craft, and all pets in a craft need to be the same.
Usage
Explanation
uuid: The UUID of the pet to add to the craft.
name: The name of the pet to add to the craft.
This method allows a player to remove a pet from the current craft of a gold pet.
Usage
Explanation
uuid: The UUID of the pet to remove from the craft.
This method allows a player to craft a gold pet with the pets added. The success of the craft depends on the number of pets put in it. Each pet is 25% more chance for the craft to succeed. With 4 pets, the craft has 100% chance to succeed.