Skip to content

Commit

Permalink
Updated unitproperty also accept string param
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiephan committed Jan 25, 2021
1 parent 1ebdc59 commit 161189a
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 64 deletions.
79 changes: 76 additions & 3 deletions (10)trymemode.stormmap/base.stormdata/Modules/LibUnits.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@ bool libUNIT_gt_ModifyUnitProperty_Func (bool testConds, bool runActions) {
int lv_i;

// Automatic Variable Declarations
string autoA4188EC6_val;
int auto4B2220AA_ae;
const int auto4B2220AA_ai = 1;
int auto5C02B8F9_ae;
Expand All @@ -1362,13 +1363,85 @@ bool libUNIT_gt_ModifyUnitProperty_Func (bool testConds, bool runActions) {
return true;
}

lv_type = StringToInt(StringWord(EventChatMessage(false), 2));
autoA4188EC6_val = StringCase(StringWord(EventChatMessage(false), 2), false);
if (autoA4188EC6_val == "life") {
lv_type = c_unitPropLife;
}
else if (autoA4188EC6_val == "lifepercent") {
lv_type = c_unitPropLifePercent;
}
else if (autoA4188EC6_val == "lifemax") {
lv_type = c_unitPropLifeMax;
}
else if (autoA4188EC6_val == "liferegen") {
lv_type = c_unitPropLifeRegen;
}
else if (autoA4188EC6_val == "energy") {
lv_type = c_unitPropEnergy;
}
else if (autoA4188EC6_val == "energypercent") {
lv_type = c_unitPropEnergyPercent;
}
else if (autoA4188EC6_val == "energymax") {
lv_type = c_unitPropEnergyMax;
}
else if (autoA4188EC6_val == "energyregen") {
lv_type = c_unitPropEnergyRegen;
}
else if (autoA4188EC6_val == "shields") {
lv_type = c_unitPropShields;
}
else if (autoA4188EC6_val == "shieldspercent") {
lv_type = c_unitPropShieldsPercent;
}
else if (autoA4188EC6_val == "shieldsmax") {
lv_type = c_unitPropShieldsMax;
}
else if (autoA4188EC6_val == "shieldsregen") {
lv_type = c_unitPropShieldsRegen;
}
else if (autoA4188EC6_val == "kills") {
lv_type = c_unitPropKills;
}
else if (autoA4188EC6_val == "height") {
lv_type = c_unitPropHeight;
}
else if (autoA4188EC6_val == "movementspeed") {
lv_type = c_unitPropMovementSpeed;
}
else if (autoA4188EC6_val == "resources") {
lv_type = c_unitPropResources;
}
else if (autoA4188EC6_val == "radius") {
lv_type = c_unitPropRadius;
}
else if (autoA4188EC6_val == "xp") {
lv_type = c_unitPropXP;
}
else if (autoA4188EC6_val == "level") {
lv_type = c_unitPropLevel;
}
else if (autoA4188EC6_val == "killxp") {
lv_type = c_unitPropKillXP;
}
else if (autoA4188EC6_val == "basemovementspeed") {
lv_type = c_unitPropBaseMovementSpeed;
}
else if (autoA4188EC6_val == "movementspeedcurrent") {
lv_type = c_unitPropMovementSpeedCurrent;
}
else if (autoA4188EC6_val == "lifeexpectedpercent") {
lv_type = c_unitPropLifeExpectedPercent;
}
else {
lv_type = StringToInt(StringWord(EventChatMessage(false), 2));
}
if ((StringWord(EventChatMessage(false), 3) != null)) {
lv_value = StringToFixed(StringWord(EventChatMessage(false), 3));
auto5C02B8F9_ae = UnitGroupCount(UnitGroupSelected(EventPlayer()), c_unitCountAlive);
lv_i = 1;
for ( ; ( (auto5C02B8F9_ai >= 0 && lv_i <= auto5C02B8F9_ae) || (auto5C02B8F9_ai < 0 && lv_i >= auto5C02B8F9_ae) ) ; lv_i += auto5C02B8F9_ai ) {
lv_unittype = UnitGetType(UnitGroupUnit(UnitGroupSelected(1), lv_i));
lv_unittype = UnitGetType(UnitGroupUnit(UnitGroupSelected(EventPlayer()), lv_i));
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, (StringToText((lv_unittype)) + StringToText(": Changed Property")));
UnitSetPropertyFixed(UnitGroupUnit(UnitGroupSelected(EventPlayer()), lv_i), lv_type, lv_value);
}
Expand All @@ -1377,7 +1450,7 @@ bool libUNIT_gt_ModifyUnitProperty_Func (bool testConds, bool runActions) {
auto4B2220AA_ae = UnitGroupCount(UnitGroupSelected(EventPlayer()), c_unitCountAlive);
lv_i = 1;
for ( ; ( (auto4B2220AA_ai >= 0 && lv_i <= auto4B2220AA_ae) || (auto4B2220AA_ai < 0 && lv_i >= auto4B2220AA_ae) ) ; lv_i += auto4B2220AA_ai ) {
lv_unittype = UnitGetType(UnitGroupUnit(UnitGroupSelected(1), lv_i));
lv_unittype = UnitGetType(UnitGroupUnit(UnitGroupSelected(EventPlayer()), lv_i));
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, (StringToText(((lv_unittype) + "'s property value: ")) + StringToText(FixedToString(UnitGetPropertyFixed(UnitGroupUnit(UnitGroupSelected(EventPlayer()), lv_i), lv_type, c_unitPropCurrent), c_fixedPrecisionAny))));
}
}
Expand Down
Binary file not shown.
63 changes: 33 additions & 30 deletions (10)trymemode.stormmap/base.stormdata/Modules/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,39 +628,42 @@
"command": "unitproperty",
"description": [
"Allow to show / modify a selected units' property, such as max health, regen, movement speed etc.",
"|Type|Galaxy file constant|",
"|-|-|",
"|0|c_unitPropLife|",
"|1|c_unitPropLifePercent|",
"|2|c_unitPropLifeMax|",
"|3|c_unitPropLifeRegen|",
"|4|c_unitPropEnergy|",
"|5|c_unitPropEnergyPercent|",
"|6|c_unitPropEnergyMax|",
"|7|c_unitPropEnergyRegen|",
"|8|c_unitPropShields|",
"|9|c_unitPropShieldsPercent|",
"|10|c_unitPropShieldsMax|",
"|11|c_unitPropShieldsRegen|",
"|12|c_unitPropKills|",
"|17|c_unitPropHeight|",
"|18|c_unitPropMovementSpeed|",
"|20|c_unitPropResources|",
"|21|c_unitPropRadius|",
"|22|c_unitPropXP|",
"|23|c_unitPropLevel|",
"|24|c_unitPropKillXP|",
"|28|c_unitPropBaseMovementSpeed|",
"|29|c_unitPropMovementSpeedCurrent|",
"|30|c_unitPropLifeExpectedPercent|"
"If the `type` parameter is not supplied, it will return the value of the property. If the `type` parameter was set, it will modify the selected unit's property.",
"",
"The `type` parameters accept either the `Type (int)` or `Type (string)` below.",
"| Type (int) | Type (string) | Galaxy file constant |",
"|-|-|-|",
"| 0 | life | c_unitLife |",
"| 1 | lifepercent | c_unitPropLifePercent |",
"| 2 | lifemax | c_unitPropLifeMax |",
"| 3 | liferegen | c_unitPropLifeRegen |",
"| 4 | energy | c_unitPropEnergy |",
"| 5 | energypercent | c_unitPropEnergyPercent |",
"| 6 | energymax | c_unitPropEnergyMax |",
"| 7 | energyregen | c_unitPropEnergyRegen |",
"| 8 | shields | c_unitPropShields |",
"| 9 | shieldspercent | c_unitPropShieldsPercent |",
"| 10 | shieldsmax | c_unitPropShieldsMax |",
"| 11 | shieldsregen | c_unitPropShieldsRegen |",
"| 12 | kills | c_unitPropKills |",
"| 17 | height | c_unitPropHeight |",
"| 18 | movementspeed | c_unitPropMovementSpeed |",
"| 20 | resources | c_unitPropResources |",
"| 21 | radius | c_unitPropRadius |",
"| 22 | xp | c_unitPropXP |",
"| 23 | level | c_unitPropLevel |",
"| 24 | killxp | c_unitPropKillXP |",
"| 28 | basemovementspeed | c_unitPropBaseMovementSpeed |",
"| 29 | movementspeedcurrent | c_unitPropMovementSpeedCurrent |",
"| 30 | lifeexpectedpercent | c_unitPropLifeExpectedPercent |"
],
"uiAvailable": false,
"parameters": [
{
"name": "type",
"required": true,
"description": "Set the type of the property to be modified. Please refer to the table above.",
"type": "integer"
"description": "Set the type of the property to be get / modified. Please refer to the table above.",
"type": "integer/string"
},
{
"name": "value",
Expand All @@ -672,7 +675,7 @@
],
"examples": [
{
"command": "{shortCommand} 0",
"command": "{shortCommand} life",
"description": "Shows the unit's current HP"
},
{
Expand All @@ -684,15 +687,15 @@
"description": "Show the selected unit's Max Energy, usually refers as resource bar, such as mana, Tracer bullet, Chen's brew etc."
},
{
"command": "{command} 6 10000",
"command": "{command} energymax 10000",
"description": "Set the selected unit's Max Energy for 10000, usually refers as resource bar, such as mana, Tracer bullet, Chen's brew etc."
},
{
"command": "{command} 28",
"description": "Shows the base movement speed of selected units."
},
{
"command": "{command} 28 10",
"command": "{command} basemovementspeed 10",
"description": "Set the base movement speed of selected units to 10. Note that base speed for heroes is 4.8398"
}
]
Expand Down
65 changes: 34 additions & 31 deletions 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 Mon, 25 Jan 2021 01:25:32 GMT)*</sup>
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Mon, 25 Jan 2021 02:13:04 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 @@ -1550,39 +1550,42 @@ Toggle displaying units' id mode. Which will shows the unit's id on the screen w

#### ✏ Description:
Allow to show / modify a selected units' property, such as max health, regen, movement speed etc.
|Type|Galaxy file constant|
|-|-|
|0|c_unitPropLife|
|1|c_unitPropLifePercent|
|2|c_unitPropLifeMax|
|3|c_unitPropLifeRegen|
|4|c_unitPropEnergy|
|5|c_unitPropEnergyPercent|
|6|c_unitPropEnergyMax|
|7|c_unitPropEnergyRegen|
|8|c_unitPropShields|
|9|c_unitPropShieldsPercent|
|10|c_unitPropShieldsMax|
|11|c_unitPropShieldsRegen|
|12|c_unitPropKills|
|17|c_unitPropHeight|
|18|c_unitPropMovementSpeed|
|20|c_unitPropResources|
|21|c_unitPropRadius|
|22|c_unitPropXP|
|23|c_unitPropLevel|
|24|c_unitPropKillXP|
|28|c_unitPropBaseMovementSpeed|
|29|c_unitPropMovementSpeedCurrent|
|30|c_unitPropLifeExpectedPercent|
If the `type` parameter is not supplied, it will return the value of the property. If the `type` parameter was set, it will modify the selected unit's property.

The `type` parameters accept either the `Type (int)` or `Type (string)` below.
| Type (int) | Type (string) | Galaxy file constant |
|-|-|-|
| 0 | life | c_unitLife |
| 1 | lifepercent | c_unitPropLifePercent |
| 2 | lifemax | c_unitPropLifeMax |
| 3 | liferegen | c_unitPropLifeRegen |
| 4 | energy | c_unitPropEnergy |
| 5 | energypercent | c_unitPropEnergyPercent |
| 6 | energymax | c_unitPropEnergyMax |
| 7 | energyregen | c_unitPropEnergyRegen |
| 8 | shields | c_unitPropShields |
| 9 | shieldspercent | c_unitPropShieldsPercent |
| 10 | shieldsmax | c_unitPropShieldsMax |
| 11 | shieldsregen | c_unitPropShieldsRegen |
| 12 | kills | c_unitPropKills |
| 17 | height | c_unitPropHeight |
| 18 | movementspeed | c_unitPropMovementSpeed |
| 20 | resources | c_unitPropResources |
| 21 | radius | c_unitPropRadius |
| 22 | xp | c_unitPropXP |
| 23 | level | c_unitPropLevel |
| 24 | killxp | c_unitPropKillXP |
| 28 | basemovementspeed | c_unitPropBaseMovementSpeed |
| 29 | movementspeedcurrent | c_unitPropMovementSpeedCurrent |
| 30 | lifeexpectedpercent | c_unitPropLifeExpectedPercent |

<a name="cmd-unitproperty-parameters"></a>

#### ⚙ Parameters:
<type>
Required: true
Type: integer
Usage: Set the type of the property to be modified. Please refer to the table above.
Type: integer/string
Usage: Set the type of the property to be get / modified. Please refer to the table above.
[value]
Required: false
Type: float
Expand All @@ -1591,17 +1594,17 @@ Allow to show / modify a selected units' property, such as max health, regen, mo
<a name="cmd-unitproperty-examples"></a>

#### 🔧 Examples:
> up 0
> up life
(Shows the unit's current HP)
> up 0 1
(Set the selected units's Current HP to 1; MAX SPEEDZ TAZZZZDINGO)
> unitproperty 6
(Show the selected unit's Max Energy, usually refers as resource bar, such as mana, Tracer bullet, Chen's brew etc.)
> unitproperty 6 10000
> unitproperty energymax 10000
(Set the selected unit's Max Energy for 10000, usually refers as resource bar, such as mana, Tracer bullet, Chen's brew etc.)
> unitproperty 28
(Shows the base movement speed of selected units.)
> unitproperty 28 10
> unitproperty basemovementspeed 10
(Set the base movement speed of selected units to 10. Note that base speed for heroes is 4.8398)
<a name="cmd-unitproperty-uiAvailability"></a>

Expand Down

0 comments on commit 161189a

Please sign in to comment.