From 814096dd637854f89ef8de4e801c8de26d2b5a8b Mon Sep 17 00:00:00 2001 From: MinLL Date: Tue, 5 Nov 2024 21:31:39 -0800 Subject: [PATCH] Fix bugs with apostrophes, and cleanup actor states on reload --- Scripts/Source/minai_AIFF.psc | 30 +++++++++++++++--------------- Scripts/minai_AIFF.pex | Bin 24867 -> 25138 bytes minai_plugin/globals.php | 2 ++ minai_plugin/util.php | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Scripts/Source/minai_AIFF.psc b/Scripts/Source/minai_AIFF.psc index d82b411a..0e490a4b 100644 --- a/Scripts/Source/minai_AIFF.psc +++ b/Scripts/Source/minai_AIFF.psc @@ -45,20 +45,6 @@ Function InitFollow() bHasFollowPlayer = True EndFunction -Function CleanupFollow() - If !bHasFollowPlayer - Main.Debug("[FollowTarget] CleanupFollow follow not enable") - Return - EndIf - - actor[] actors = GetNearbyAI() - int i = 0 - while i < actors.Length - EndFollowTarget(actors[i], true) - i += 1 - EndWhile -EndFunction - Function Maintenance(minai_MainQuestController _main) if (main.GetVersion() != main.CurrentVersion) Main.Info("AIFF - Maintenance: Version update detected. Resetting action registry.") @@ -124,7 +110,21 @@ Function Maintenance(minai_MainQuestController _main) ; StoreContext("minai", "testKey", "This is dynamically persisted context!", 1200) InitFollow() - CleanupFollow() + CleanupStates() +EndFunction + +Function CleanupStates() + actor[] actors = GetNearbyAI() + int i = 0 + while i < actors.Length + actor akTarget = actors[i] + SetActorVariable(akTarget, "inCombat", akTarget.GetCombatState() > 0) + SetActorVariable(akTarget, "hostileToPlayer", akTarget.IsHostileToActor(player)) + SetActorVariable(akTarget, "isBleedingOut", akTarget.isBleedingOut()) + SetActorVariable(akTarget, "scene", akTarget.GetCurrentScene()) + EndFollowTarget(actors[i], true) + i += 1 + EndWhile EndFunction Function StartFollowTarget(actor akNpc, actor akTarget) diff --git a/Scripts/minai_AIFF.pex b/Scripts/minai_AIFF.pex index dcc663972a94de8ba0fdddad9fd6eb0d9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wa3frwIj zUBOfO@boy{J>{n!{eX$R`>+g!lfA4}No;ObYJCp2ek!&c#?+t;?6bP{Q!Ex5E;igD z`ZEP?>tu*ySrp3Vc@D6g2?_G=_8bA?zZ<8>U=0N_;I!ifkt6?pO=ZP;#`s?>*E*p90#sA+ z8_lNU3!~ajuLPA|yh02C`HzG!Kl#}_1i2@zQ(kfRbjTzvcE4L~by)#or+S zx|O>{=^ejOvQ@9!D!E%Mu9B@ne)fbWRG;q={(+DzucwqSUQXeExjkkLnqho>%x{Qg z$c4)r_y+~)^Z3oczx~ozO5F@7Wqy3N+WMC;gtq>{=+~h4|40Y+BUb-$njOg}k^D`_ z^%h>Hk?>y~8!xM7r^r>j!xP?V##?SBHTt{59rx^ON!S z?0E?IjWNH60V+#L#@`R;A%%xl@0TGL#~-p4B;)V7WV|UF2C_g1TYR`4oR+=Rz!HkegxbPYJ*#&9-> zjVVPdDd_`_>I!pB$Ig_qDUn8yXMLIEw{Qu4E<#G*!0cU!vGa<*b`4o3Qa%i(0)wiA zIhUC#>Na?{1%J4wm(51rZ`lTn)T~XFbO*CGRrm*)^?96Gn>s&XN-1V-DT7&qq198h zQwN;2sbzx|Y^n_$i>Z~8KHxnAEwQNxIJ{usaQHh2Gc|7?0ld^1GcBJ7mVYr1IYRL~ zbawD^fYHno$2fSi8UF<;hVIS-^pAQB{>I46z-^nsUoCbUsg|?GuR+snX4-+685paU Wk$~Vr9e?X6f39O@S-;Zj@escape("_minai_{$name}//"); - + $idPrefix = "_minai_{$name}//"; + $origLength = strlen($idPrefix); + $idPrefix = $GLOBALS["db"]->escape($idPrefix); $query = "select * from conf_opts where LOWER(id) like LOWER('{$idPrefix}%')"; $ret = $GLOBALS["db"]->fetchAll($query); - + // error_log("Building cache for $name"); foreach ($ret as $row) { //do this instead of split // because $name could have // in it - $key = substr(strtolower($row['id']), strlen($idPrefix)); + $key = substr(strtolower($row['id']), $origLength); $value = $row['value']; + // error_log($name . ':: (' . $key . ') ' . $row['id'] . ' = ' . $row['value']); $GLOBALS[MINAI_ACTOR_VALUE_CACHE][$name][$key] = $value; } } @@ -50,9 +52,7 @@ function CanVibrate($name) { // Return the specified actor value. // Caches the results of several queries that are repeatedly referenced. Function GetActorValue($name, $key, $preserveCase=false, $skipCache=false) { - $name = addslashes($name); - $key = addslashes($key); - + // error_log("Looking up $name: $key"); If (!$preserveCase && !$skipCache) { $name = strtolower($name); $key = strtolower($key); @@ -60,7 +60,7 @@ function CanVibrate($name) { If (!HasActorValueCache($name)) { BuildActorValueCache($name); } - + // error_log("Checking cache: $name, $key"); $ret = GetActorValueCache($name, $key); return $ret === null ? "" : strtolower($ret); } @@ -81,8 +81,8 @@ function CanVibrate($name) { } Function IsEnabled($name, $key) { - $name = strtolower($name); - return $GLOBALS["db"]->fetchAll("select 1 from conf_opts where LOWER(id)=LOWER('_minai_{$name}//{$key}') and LOWER(value)=LOWER('TRUE')"); + $name = strtolower($GLOBALS["db"]->escape($name)); + return $GLOBALS["db"]->fetchAll("select 1 from conf_opts where LOWER(id)=LOWER('_minai_{$name}//{$key}') and LOWER(value)=LOWER('TRUE')"); } Function IsSexActive() { @@ -181,8 +181,8 @@ function CanVibrate($name) { Function IsActionEnabled($actionName) { - $actionName = strtolower($actionName); - return $GLOBALS["db"]->fetchAll("select 1 from conf_opts where LOWER(id)=LOWER('_minai_ACTION//{$actionName}') and LOWER(value)=LOWER('TRUE')"); + $actionName = strtolower($GLOBALS["db"]->escape($actionName)); + return $GLOBALS["db"]->fetchAll("select 1 from conf_opts where LOWER(id)=LOWER('_minai_ACTION//{$actionName}') and LOWER(value)=LOWER('TRUE')"); }