Skip to content

Commit

Permalink
Added Floating Combat Text Command
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiephan committed Jan 1, 2021
1 parent 8769e34 commit eaec11a
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 1 deletion.
72 changes: 72 additions & 0 deletions (10)trymemode.stormmap/base.stormdata/Modules/LibUtilities.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ trigger libUTIL_gt_ResetCameraObject;
trigger libUTIL_gt_ForceRunTrigger;
trigger libUTIL_gt_ToggleACTS;
trigger libUTIL_gt_MinionWaveInterval;
trigger libUTIL_gt_FloatingCombatText;

// Library Initialization
void libUTIL_InitVariables ();
Expand Down Expand Up @@ -638,6 +639,76 @@ void libUTIL_gt_MinionWaveInterval_Init () {
TriggerAddEventChatMessage(libUTIL_gt_MinionWaveInterval, c_playerAny, "minionwaveinterval", false);
}

//--------------------------------------------------------------------------------------------------
// Trigger: Floating Combat Text
//--------------------------------------------------------------------------------------------------
bool libUTIL_gt_FloatingCombatText_Func (bool testConds, bool runActions) {
// Variable Declarations
const string lv_type_prefix = "FloatingCombatElements/FloatingCombat";
const string lv_type_default = "NormalAmountGiven";
const string lv_state_default = "Basic";
const string lv_state_suffix = "State";
text lv_message;
string lv_type;
string lv_state;
unit lv_unit;

// Automatic Variable Declarations
unitgroup autoF3A382EE_g;
int autoF3A382EE_u;

// Variable Initialization
lv_type = (("" + lv_type_prefix) + lv_type_default);
lv_state = (("" + lv_state_default) + lv_state_suffix);

// Conditions
if (testConds) {
if (!(((StringWord(EventChatMessage(false), 1) == "fct") || (StringWord(EventChatMessage(false), 1) == "floatingcombattext")))) {
return false;
}
}

// Actions
if (!runActions) {
return true;
}

if ((StringWord(EventChatMessage(false), 2) == null)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <fct|floatingcombattext> <message> [state] [type]"));
}
else {
lv_message = StringToText(StringWord(EventChatMessage(false), 2));
if ((StringWord(EventChatMessage(false), 3) != null)) {
lv_state = (StringWord(EventChatMessage(false), 3) + lv_state_suffix);
}

if ((StringWord(EventChatMessage(false), 4) != null)) {
lv_type = (lv_type_prefix + StringWord(EventChatMessage(false), 4));
}

if (((lv_type == (lv_type_prefix + "LesserAmountReceived")) || (lv_type == (lv_type_prefix + "LesserAmountGiven")) || (lv_type == (lv_type_prefix + "NormalAmountReceived")) || (lv_type == (lv_type_prefix + "NormalAmountGiven")) || (lv_type == (lv_type_prefix + "MediumAmountReceived")) || (lv_type == (lv_type_prefix + "MediumAmountGiven")) || (lv_type == (lv_type_prefix + "GreaterAmountReceived")) || (lv_type == (lv_type_prefix + "GreaterAmountGiven")) || (lv_type == (lv_type_prefix + "CritAmountReceived")) || (lv_type == (lv_type_prefix + "CritAmountGiven")) || (lv_type == (lv_type_prefix + "AmountReadable")) || (lv_type == (lv_type_prefix + "CritAmountReadable")) || (lv_type == (lv_type_prefix + "SelfAmountReceived")) || (lv_type == (lv_type_prefix + "HealPrevented")) || (lv_type == (lv_type_prefix + "QuestProgress")))) {
autoF3A382EE_g = UnitGroupSelected(EventPlayer());
autoF3A382EE_u = UnitGroupCount(autoF3A382EE_g, c_unitCountAll);
for (;; autoF3A382EE_u -= 1) {
lv_unit = UnitGroupUnitFromEnd(autoF3A382EE_g, autoF3A382EE_u);
if (lv_unit == null) { break; }
FloatingCombatElementCreateTextAtUnit(PlayerGroupAll(), lv_type, lv_state, lv_unit, lv_message, libNtve_gv_FloatingCombatTextAutoRandomSeed);
}
}
else {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Invalid Floating Combat Text Type. Please see doc for acceptable types."));
}
}
return true;
}

//--------------------------------------------------------------------------------------------------
void libUTIL_gt_FloatingCombatText_Init () {
libUTIL_gt_FloatingCombatText = TriggerCreate("libUTIL_gt_FloatingCombatText_Func");
TriggerAddEventChatMessage(libUTIL_gt_FloatingCombatText, c_playerAny, "fct", false);
TriggerAddEventChatMessage(libUTIL_gt_FloatingCombatText, c_playerAny, "floatingcombattext", false);
}

void libUTIL_InitTriggers () {
libUTIL_gt_MapInit_Init();
libUTIL_gt_ClearTextMessage_Init();
Expand All @@ -656,6 +727,7 @@ void libUTIL_InitTriggers () {
libUTIL_gt_ForceRunTrigger_Init();
libUTIL_gt_ToggleACTS_Init();
libUTIL_gt_MinionWaveInterval_Init();
libUTIL_gt_FloatingCombatText_Init();
}

//--------------------------------------------------------------------------------------------------
Expand Down
Binary file not shown.
70 changes: 70 additions & 0 deletions (10)trymemode.stormmap/base.stormdata/Modules/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,76 @@
"description": "Exit and Load the veteran tutorial map."
}
]
},
{
"shortCommand": "fct",
"command": "floatingcombattext",
"description": [
"Show a custom floating combat text with different built-in templates.",
"",
"The table is the available combineations of `state` and `type`. Columns are `state` (e.g `Shield`) and Rows are `type` (e.g `NormalAmountGiven`):",
"",
"| `type` \\ `state` | `Ability` | `Basic` | `Heal` | `Mana` | `Shield` | `XP` | `Quest` | `Reduced` |",
"|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|",
"| `LesserAmountReceived` | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ |",
"| `LesserAmountGiven` | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ❌ |",
"| `NormalAmountReceived` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ |",
"| `NormalAmountGiven` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ |",
"| `MediumAmountReceived` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ |",
"| `MediumAmountGiven` | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ |",
"| `GreaterAmountReceived` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ |",
"| `GreaterAmountGiven` | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ |",
"| `CritAmountReceived` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ |",
"| `CritAmountGiven` | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ |",
"| `AmountReadable` | ❌ | ❌ | ✔ | ❌ | ✔ | ❌ | ❌ | ✔ |",
"| `CritAmountReadable` | ❌ | ✔ | ❌ | ❌ | ✔ | ❌ | ❌ | ❌ |",
"| `SelfAmountReceived` | ❌ | ❌ | ❌ | ❌ | ❌ | ✔ | ❌ | ❌ |",
"| `HealPrevented` | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |",
"| `QuestProgress` | ❌ | ✔ | ❌ | ❌ | ❌ | ❌ | ✔ | ❌ |",
"",
">Note: The capitalizations of `type` is required to be followed."
],
"uiAvailable": false,
"parameters": [
{
"name": "message",
"required": true,
"description": "Defines the message to be shown in Floating Combat Text",
"type": "string"
},
{
"name": "state",
"required": false,
"description": "Defines the state of the Floating Combat Text",
"type": "string",
"defaultValue": "Basic"
},
{
"name": "type",
"required": false,
"description": "Defines the type of the Floating Combat Text",
"type": "string",
"defaultValue": "NormalAmountGiven"
}
],
"examples": [
{
"command": "{shortCommand} 100",
"description": "Shows the FCT \"100\" with the style of basic attack (orange)"
},
{
"command": "{shortCommand} 50 XP SelfAmountReceived",
"description": "Shows the FCT \"50\" with the style of xp gathered (small purple text)"
},
{
"command": "{command} nice Quest QuestProgress",
"description": "Shows the FCT \"nice\" with the style of quest progressing (gold circle with \"!\")"
},
{
"command": "{command} 999 Shield CritAmountGiven",
"description": "Shows the FCT \"999\" with the style of critical shield (white with explosion style)"
}
]
}
]
},
Expand Down
73 changes: 72 additions & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a name="meta-top"></a>

# Usage
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Fri, 01 Jan 2021 10:54:51 GMT)*</sup>
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Fri, 01 Jan 2021 13:16:33 GMT)*</sup>

Generally, most of the functionalities are using chat commands. Simply type the commands in the chat box (like how you would normally chat with teammates).
>Note: Remember to either use allies or all chat channel when try to use the commands. Public chat channels and Private Messages (PM) does not work.
Expand Down Expand Up @@ -34,6 +34,8 @@ Some of the commands have an UI counterpart implemented, which will display a me

- 💭 [Command: `endgame`](#cmd-endgame)

- 💭 [Command: `floatingcombattext`](#cmd-floatingcombattext)

- 💭 [Command: `forceruntrigger`](#cmd-forceruntrigger)

- 💭 [Command: `loadmap`](#cmd-loadmap)
Expand Down Expand Up @@ -256,6 +258,75 @@ End the game instantly and kick all players from the game.



[\[Return to Table of Contents 🧾\]](#meta-toc)

[\[Return to Top ⬆\]](#meta-top)

<a name="cmd-floatingcombattext"></a>

## (`floatingcombattext` | `fct`) `<message>` `[state]` `[type]`
<a name="cmd-floatingcombattext-description"></a>

#### ✏ Description:
Show a custom floating combat text with different built-in templates.

The table is the available combineations of `state` and `type`. Columns are `state` (e.g `Shield`) and Rows are `type` (e.g `NormalAmountGiven`):

| `type` \ `state` | `Ability` | `Basic` | `Heal` | `Mana` | `Shield` | `XP` | `Quest` | `Reduced` |
|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| `LesserAmountReceived` |||||||||
| `LesserAmountGiven` |||||||||
| `NormalAmountReceived` |||||||||
| `NormalAmountGiven` |||||||||
| `MediumAmountReceived` |||||||||
| `MediumAmountGiven` |||||||||
| `GreaterAmountReceived` |||||||||
| `GreaterAmountGiven` |||||||||
| `CritAmountReceived` |||||||||
| `CritAmountGiven` |||||||||
| `AmountReadable` |||||||||
| `CritAmountReadable` |||||||||
| `SelfAmountReceived` |||||||||
| `HealPrevented` |||||||||
| `QuestProgress` |||||||||

>Note: The capitalizations of `type` is required to be followed.
<a name="cmd-floatingcombattext-parameters"></a>

#### ⚙ Parameters:
<message>
Required: true
Type: string
Usage: Defines the message to be shown in Floating Combat Text
[state]
Required: false
Type: string
Usage: Defines the state of the Floating Combat Text
Default: Basic
[type]
Required: false
Type: string
Usage: Defines the type of the Floating Combat Text
Default: NormalAmountGiven
<a name="cmd-floatingcombattext-examples"></a>

#### 🔧 Examples:
> fct 100
(Shows the FCT "100" with the style of basic attack (orange))
> fct 50 XP SelfAmountReceived
(Shows the FCT "50" with the style of xp gathered (small purple text))
> floatingcombattext nice Quest QuestProgress
(Shows the FCT "nice" with the style of quest progressing (gold circle with "!"))
> floatingcombattext 999 Shield CritAmountGiven
(Shows the FCT "999" with the style of critical shield (white with explosion style))
<a name="cmd-floatingcombattext-uiAvailability"></a>

#### 🖼 UI Availability:
-**Not Implemented**



[\[Return to Table of Contents 🧾\]](#meta-toc)

[\[Return to Top ⬆\]](#meta-top)
Expand Down

0 comments on commit eaec11a

Please sign in to comment.