From 14e359e510df3a877d2ef63cd864206bfd617dfa Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Wed, 29 Jun 2022 20:05:16 +0700 Subject: [PATCH] Refactor some commands --- sources/Commands/ACommandDosh.uc | 10 +++++----- sources/Commands/ACommandDosh_Announcer.uc | 4 ++-- sources/Commands/ACommandNick.uc | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sources/Commands/ACommandDosh.uc b/sources/Commands/ACommandDosh.uc index be4f007..255761d 100644 --- a/sources/Commands/ACommandDosh.uc +++ b/sources/Commands/ACommandDosh.uc @@ -53,22 +53,22 @@ protected function BuildData(CommandDataBuilder builder) protected function ExecutedFor( EPlayer target, - CallData result, + CallData arguments, EPlayer instigator) { local int oldAmount, newAmount; local int amount, minValue, maxValue; // Find min and max value boundaries - minValue = result.options.GetIntBy(P("/min/minValue"), 0); - maxValue = result.options.GetIntBy(P("/max/maxValue"), MaxInt); + minValue = arguments.options.GetIntBy(P("/min/minValue"), 0); + maxValue = arguments.options.GetIntBy(P("/max/maxValue"), MaxInt); if (minValue > maxValue) { maxValue = minValue; } // Change dosh oldAmount = target.GetDosh(); - amount = result.parameters.GetInt(P("amount")); - if (result.subCommandName.IsEmpty()) { + amount = arguments.parameters.GetInt(P("amount")); + if (arguments.subCommandName.IsEmpty()) { newAmount = oldAmount + amount; } else { diff --git a/sources/Commands/ACommandDosh_Announcer.uc b/sources/Commands/ACommandDosh_Announcer.uc index bf2ea13..31cbdd8 100644 --- a/sources/Commands/ACommandDosh_Announcer.uc +++ b/sources/Commands/ACommandDosh_Announcer.uc @@ -65,13 +65,13 @@ public final function AnnounceLostDosh(int doshAmount) { lostDosh.initialized = true; lostDosh.toSelfReport = _.text.MakeTemplate_S( - "You {$TextPositive successfully took} {$TypeNumber %1} do$h from" + "You {$TextNegative took} {$TypeNumber %1} do$h from" @ "yourself!"); lostDosh.toSelfPublic = _.text.MakeTemplate_S( "%%instigator%% {$TextNegative took} {$TypeNumber %1} do$h from" @ "themselves!"); lostDosh.toOtherReport = _.text.MakeTemplate_S( - "You {$TextPositive successfully took} {$TypeNumber %1} do$h from" + "You {$TextNegative took} {$TypeNumber %1} do$h from" @ "%%target%%!"); lostDosh.toOtherPrivate = _.text.MakeTemplate_S( "%%instigator%% {$TextNegative took} {$TypeNumber %1} do$h from" diff --git a/sources/Commands/ACommandNick.uc b/sources/Commands/ACommandNick.uc index 81260ca..853a80a 100644 --- a/sources/Commands/ACommandNick.uc +++ b/sources/Commands/ACommandNick.uc @@ -54,19 +54,19 @@ protected function BuildData(CommandDataBuilder builder) } protected function Executed( - CallData result, + CallData arguments, EPlayer callerPlayer) { local Text givenName; local array errors; - givenName = result.parameters.GetText(P("nick")); + givenName = arguments.parameters.GetText(P("nick")); // `newName`'s reference persists between different command calls and // only deallocated when we need this variable for the next execution. // "Leaking" a single `Text` like that is insignificant. _.memory.Free(newName); newName = _.text.Empty(); - if (result.options.HasKey(P("plain"))) { + if (arguments.options.HasKey(P("plain"))) { newName = givenName.MutableCopy(); } else @@ -75,10 +75,10 @@ protected function Executed( .ParseFormatted(givenName, newName, true); } foundErrors = false; - if (result.options.HasKey(P("color"))) + if (arguments.options.HasKey(P("color"))) { foundErrors = !TryChangeDefaultColor( - result.options.GetTextBy(P("/color/default_color"))); + arguments.options.GetTextBy(P("/color/default_color"))); } foundErrors = foundErrors || (errors.length > 0); class'FormattingReportTool'.static.Report(callerConsole, errors); @@ -87,12 +87,12 @@ protected function Executed( protected function ExecutedFor( EPlayer target, - CallData result, + CallData arguments, EPlayer instigator) { local Text alteredVersion; - if (!foundErrors || result.options.HasKey(P("fix"))) + if (!foundErrors || arguments.options.HasKey(P("fix"))) { announcer.Setup(target, instigator, othersConsole); target.SetName(newName);