Skip to content

Commit

Permalink
Added Checks to Effect, Weapon, Unit, Talent and Score commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiephan committed Jan 23, 2021
1 parent cf2cbc5 commit 7bfc2e4
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
35 changes: 35 additions & 0 deletions (10)trymemode.stormmap/base.stormdata/Modules/LibPlayers.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ bool libPLYR_gt_AddTalent_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <adt|addtalent> <TalentName> [Player=EventPlayer]"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogTalent, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Talent \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

if ((StringWord(EventChatMessage(false), 3) != null)) {
lv_player = StringToInt(StringWord(EventChatMessage(false), 3));
}
Expand Down Expand Up @@ -309,6 +314,11 @@ bool libPLYR_gt_AddAllTalents_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Added a total of " + IntToString(lv_talentArrayIndex)) + (" talent(s) to Player " + IntToString(lv_player)))));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogHero, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Hero \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

auto52BD2C3F_catalog = c_gameCatalogHero;
auto52BD2C3F_entry = StringWord(EventChatMessage(false), 2);
auto52BD2C3F_fieldPath = "TalentTreeArray";
Expand Down Expand Up @@ -361,6 +371,11 @@ bool libPLYR_gt_RemoveTalent_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <rmt|removetalent> <TalentName> [Player=EventPlayer]"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogTalent, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Talent \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

if ((StringWord(EventChatMessage(false), 3) != null)) {
lv_player = StringToInt(StringWord(EventChatMessage(false), 3));
}
Expand Down Expand Up @@ -433,6 +448,11 @@ bool libPLYR_gt_RemoveAllTalents_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Removed a total of " + IntToString(lv_talentArrayIndex)) + (" talent(s) from Player " + IntToString(lv_player)))));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogHero, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Hero \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

autoEFCB7159_catalog = c_gameCatalogHero;
autoEFCB7159_entry = StringWord(EventChatMessage(false), 2);
autoEFCB7159_fieldPath = "TalentTreeArray";
Expand Down Expand Up @@ -485,6 +505,11 @@ bool libPLYR_gt_EnableTalent_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <dist|disabletalent> <TalentName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogTalent, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Talent \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

lv_talentName = StringWord(EventChatMessage(false), 2);
SetTalentEnabled((lv_talentName), false);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Disabled Talent \"" + StringWord(EventChatMessage(false), 2)) + "")));
Expand Down Expand Up @@ -526,6 +551,11 @@ bool libPLYR_gt_DisableTalent_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <ent|enabletalent> <TalentName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogTalent, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Talent \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

lv_talentName = StringWord(EventChatMessage(false), 2);
SetTalentEnabled((lv_talentName), true);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Enabled Talent \"" + StringWord(EventChatMessage(false), 2)) + "")));
Expand Down Expand Up @@ -674,6 +704,11 @@ bool libPLYR_gt_OverrideScoreBoard_Func (bool testConds, bool runActions) {
return true;
}

if ((CatalogEntryIsValid(c_gameCatalogScoreValue, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Score Entry \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

lv_field = StringWord(EventChatMessage(false), 2);
lv_value = StringToInt(StringWord(EventChatMessage(false), 3));
if ((StringWord(EventChatMessage(false), 4) == null)) {
Expand Down
42 changes: 41 additions & 1 deletion (10)trymemode.stormmap/base.stormdata/Modules/LibUnits.galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ bool libUNIT_gt_AddEffectstoCamera_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <adec|addeffectcamera> <EffectName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogEffect, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Effect \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

PlayerCreateEffectPoint(EventPlayer(), (StringWord(EventChatMessage(false), 2)), CameraGetTarget(EventPlayer()));
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText(("Added Effect \"" + (StringWord(EventChatMessage(false), 2) + ("\" on camera location " + libNtve_gf_ConvertPointToString(CameraGetTarget(EventPlayer())))))));
}
Expand Down Expand Up @@ -205,6 +210,11 @@ bool libUNIT_gt_RemoveEffectsfromCamera_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <rmec|removeeffectcamera> <EffectName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogEffect, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Effect \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

GameDestroyEffects(CameraGetTarget(EventPlayer()), 1.0, 0, null);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText(("Removed Effect \"" + (StringWord(EventChatMessage(false), 2) + ("\" from camera location " + libNtve_gf_ConvertPointToString(CameraGetTarget(EventPlayer())))))));
}
Expand Down Expand Up @@ -252,6 +262,11 @@ bool libUNIT_gt_AddEffects_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <ade|addeffect> <EffectName> [amount]"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogEffect, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Effect \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

lv_count = StringToInt(StringWord(EventChatMessage(false), 3));
if ((lv_count == 0)) {
lv_count = 1;
Expand Down Expand Up @@ -311,6 +326,11 @@ bool libUNIT_gt_RemoveEffect_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <rme|removeeffect> <EffectName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogEffect, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Effect \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

autoCC1E0A15_g = UnitGroupSelected(EventPlayer());
autoCC1E0A15_u = UnitGroupCount(autoCC1E0A15_g, c_unitCountAll);
for (;; autoCC1E0A15_u -= 1) {
Expand Down Expand Up @@ -456,6 +476,11 @@ bool libUNIT_gt_AddWeapon_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <adw|addweapon> <WeaponName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogWeapon, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Weapon \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

auto5A99CB48_g = UnitGroupSelected(EventPlayer());
auto5A99CB48_u = UnitGroupCount(auto5A99CB48_g, c_unitCountAll);
for (;; auto5A99CB48_u -= 1) {
Expand Down Expand Up @@ -506,6 +531,11 @@ bool libUNIT_gt_RemoveWeapon_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <rmw|removeweapon> <WeaponName>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogWeapon, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Weapon \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

auto34C1F59F_g = UnitGroupSelected(EventPlayer());
auto34C1F59F_u = UnitGroupCount(auto34C1F59F_g, c_unitCountAll);
for (;; auto34C1F59F_u -= 1) {
Expand Down Expand Up @@ -1447,6 +1477,11 @@ bool libUNIT_gt_ReplaceUnits_Func (bool testConds, bool runActions) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText("Usage: <rpu|replaceunit> <TargetUnitId>"));
}
else {
if ((CatalogEntryIsValid(c_gameCatalogUnit, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Unit \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

auto45A293B1_g = UnitGroupSelected(EventPlayer());
auto45A293B1_u = UnitGroupCount(auto45A293B1_g, c_unitCountAll);
for (;; auto45A293B1_u -= 1) {
Expand Down Expand Up @@ -1923,7 +1958,12 @@ bool libUNIT_gt_SummonUnit_Func (bool testConds, bool runActions) {
}

lv_unittype = (StringWord(EventChatMessage(false), 2));
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText(((("Trying to spawn " + (IntToString(lv_amount) + " ")) + ((lv_unittype) + (" with scale of " + FixedToString(lv_scale, c_fixedPrecisionAny)))) + (" for Player " + IntToString(lv_player)))));
if ((CatalogEntryIsValid(c_gameCatalogUnit, (StringWord(EventChatMessage(false), 2))) == false)) {
UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText((("Error: Unit \"" + StringWord(EventChatMessage(false), 2)) + "\" does not exist.")));
return true;
}

UIDisplayMessage(PlayerGroupAll(), c_messageAreaDebug, StringToText(((("Spawned " + (IntToString(lv_amount) + " ")) + ((lv_unittype) + (" with scale of " + FixedToString(lv_scale, c_fixedPrecisionAny)))) + (" for Player " + IntToString(lv_player)))));
autoE55C84B8_ae = lv_amount;
lv_i = 1;
for ( ; ( (autoE55C84B8_ai >= 0 && lv_i <= autoE55C84B8_ae) || (autoE55C84B8_ai < 0 && lv_i >= autoE55C84B8_ae) ) ; lv_i += autoE55C84B8_ai ) {
Expand Down
Binary file not shown.

0 comments on commit 7bfc2e4

Please sign in to comment.