Implementing Cooking #
In this section, we’ll cook a muffin using the previously built plugins.
Start Pragma Engine #
Run make run
to start Pragma Engine. Run this in a terminal with platform
as the working directory.
- Alternatively, Pragma Engine can be run from IntelliJ. From the IntelliJ toolbar in the upper right, ensure
MainKt - LocalConfigured
is selected, then click the play button. - If not, click Add Configuration…. In the Run/Debug Configurations window that appears, expand Kotlin in the left hand side, then select
MainKt - LocalConfigured
. Click OK. Click the play button in the IntelliJ toolbar to start Pragma Engine.
- Once the engine has started successfully, it prints the message
[main] INFO main - Pragma server startup complete
.
Cook the muffin with Postman #
- Open and send
authenticateOrCreateV2
for bothplayer
andoperator
.
Player: PragmaDev [date] ➨ Social ➨ Player ➨ Account ➨ authenticateOrCreateV2
Operator: PragmaDev [date] ➨ Social ➨ Operator ➨ Account ➨ authenticateOrCreateV2
We will be sending player and operator service calls, hence the need to log into Pragma Engine with both roles.
Navigate to
PragmaDev [date] ➨ Game ➨ RPC - Player ➨ Inventory ➨ Crafting Scenarios
and double clickCooking A Muffin
.Click the Run button to set up the muffin cooking steps.
Check the Save responses box, then click
Run PragmaDev [date]
. The following processes will run:- operator: Grant Required Ingredients—obtain the required ingredients to craft
- We use
GrantItemsOperatorV1Request
to give the player the required ingredients to cook a muffin.
- We use
- test01: Set Expected Muffins—automated test setup
- Postman sends a
GetInventoryV2Request
and stores the result to validate the results of the remaining crafting steps.
- Postman sends a
- test01: craftV1 - start baking a muffin—exchange ingredients for
incompletePlainMuffin
- test01: craftV1 - not finished wait 3 seconds—attempt to redeem
incompletePlainMuffin
forplainMuffin
before cooking has finished- In
CraftingEntries.json
, we specified a 3 second cook time for ourplainMuffinRecipe
. We attempt to redeem ourincompletePlainMuffin
prior to its completion to ensure Pragma rejects our cooking attempt.
- In
- test01: craftV1 - finish baking muffin—successfully redeem
incompletePlainMuffin
forplainMuffin
- We again redeem our
incompletePlainMuffin
after 3 seconds and receive our completedplainMuffin
.
- We again redeem our
- operator: Grant Required Ingredients—obtain the required ingredients to craft
If all tests passed, you successfully implemented cooking as a plugin. More information can be found by looking at the request and response bodies of each service call.