From 429416ef334c6f2488c51aac7eaa53a05b438c4e Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:15:36 +0200 Subject: [PATCH 01/20] add config.shareKill OnActorDeath --- scripts/eventHandler.lua | 52 +++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 70943b5c..32ed16a3 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -185,20 +185,44 @@ eventHandler.InitializeDefaultHandlers = function() local cell = LoadedCells[cellDescription] tes3mp.ClearKillChanges() - - for uniqueIndex, actor in pairs(actors) do - if WorldInstance.data.kills[actor.refId] == nil then - WorldInstance.data.kills[actor.refId] = 0 - end - - WorldInstance.data.kills[actor.refId] = WorldInstance.data.kills[actor.refId] + 1 - WorldInstance:QuicksaveToDrive() - tes3mp.AddKill(actor.refId, WorldInstance.data.kills[actor.refId]) - - table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) - end - - tes3mp.SendWorldKillCount(pid, true) + + if config.shareKill == true then + + for uniqueIndex, actor in pairs(actors) do + if WorldInstance.data.kills[actor.refId] == nil then + WorldInstance.data.kills[actor.refId] = 0 + end + + WorldInstance.data.kills[actor.refId] = WorldInstance.data.kills[actor.refId] + 1 + WorldInstance:QuicksaveToDrive() + tes3mp.AddKill(actor.refId, WorldInstance.data.kills[actor.refId]) + + table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) + end + + tes3mp.SendWorldKillCount(pid, true) + + elseif config.shareKill == false then + + if Players[pid].data.kills == nil then + Players[pid].data.kills = {} + end + + for uniqueIndex, actor in pairs(actors) do + if Players[pid].data.kills[actor.refId] == nil then + Players[pid].data.kills[actor.refId] = 0 + end + + Players[pid].data.kills[actor.refId] = Players[pid].data.kills[actor.refId] + 1 + Players[pid]:QuicksaveToDrive() + tes3mp.AddKill(actor.refId, Players[pid].data.kills[actor.refId]) + + table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) + end + + tes3mp.SendWorldKillCount(pid, false) + + end cell:RequestContainers(pid, tableHelper.getArrayFromIndexes(actors)) end) From 22b5d1742642ce777388cd6a116c5b9792eba947 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:18:10 +0200 Subject: [PATCH 02/20] Update commandHandler.lua --- scripts/commandHandler.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/commandHandler.lua b/scripts/commandHandler.lua index b5bfb959..73779b1d 100644 --- a/scripts/commandHandler.lua +++ b/scripts/commandHandler.lua @@ -741,7 +741,21 @@ function commandHandler.ProcessCommand(pid, cmd) WorldInstance:QuicksaveToDrive() WorldInstance:LoadKills(pid, true) tes3mp.SendMessage(pid, "All the kill counts for creatures and NPCs have been reset.\n", true) + + elseif cmd[1] == "resetkills" and config.shareKill == false then + + if Players[pid].data.kills == nil then + Players[pid].data.kills = {} + end + -- Set all currently recorded kills to 0 for players + for refId, killCount in pairs(Players[pid].data.kills) do + Players[pid].data.kills[refId] = 0 + end + Players[pid]:QuicksaveToDrive() + Players[pid]:LoadKills(pid, false) + tes3mp.SendMessage(pid, "All the kill counts for creatures and NPCs have been reset.\n", false) + elseif cmd[1] == "suicide" then if config.allowSuicideCommand == true then tes3mp.SetHealthCurrent(pid, 0) From 689725491538f8e5a196430867cb84488ac80d7a Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:21:09 +0200 Subject: [PATCH 03/20] Update base.lua --- scripts/player/base.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/player/base.lua b/scripts/player/base.lua index 1e149e1d..c30a1dba 100644 --- a/scripts/player/base.lua +++ b/scripts/player/base.lua @@ -1485,6 +1485,21 @@ function BasePlayer:SaveClientScriptGlobal(variables) stateHelper:SaveClientScriptGlobal(self, variables) end +function BasePlayer:LoadKill(pid, forEveryone) + + if self.data.kills == nil then + self.data.kills = {} + end + + tes3mp.ClearKillChanges() + + for refId, killCount in pairs(self.data.kills) do + tes3mp.AddKill(refId, killCount) + end + + tes3mp.SendWorldKillCount(pid, forEveryone) +end + function BasePlayer:LoadDestinationOverrides(pid) stateHelper:LoadDestinationOverrides(self.pid, self) end From b94225390b7e2f760b6b9862889726510c119365 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:22:28 +0200 Subject: [PATCH 04/20] Update base.lua --- scripts/player/base.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/player/base.lua b/scripts/player/base.lua index c30a1dba..6f661516 100644 --- a/scripts/player/base.lua +++ b/scripts/player/base.lua @@ -284,7 +284,11 @@ function BasePlayer:FinishLogin() self:LoadReputation() end - WorldInstance:LoadKills(self.pid) + if config.shareKill == true then + WorldInstance:LoadKills(self.pid) + else + self:LoadKill(self.pid, false) + end self:LoadSpecialStates() @@ -376,7 +380,11 @@ function BasePlayer:EndCharGen() WorldInstance:LoadTopics(self.pid) end - WorldInstance:LoadKills(self.pid) + if config.shareKill == true then + WorldInstance:LoadKills(self.pid) + else + self:LoadKill(self.pid, false) + end if spawnUsed ~= nil and spawnUsed.cellDescription ~= nil then tes3mp.SetCell(self.pid, spawnUsed.cellDescription) From d30a1e2aa223a016e92d62a94486246246f2c501 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:25:46 +0200 Subject: [PATCH 05/20] Update config.lua --- scripts/config.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/config.lua b/scripts/config.lua index 723b59df..e15906bf 100644 --- a/scripts/config.lua +++ b/scripts/config.lua @@ -115,6 +115,9 @@ config.shareMapExploration = false -- Whether ingame videos should be played for other players when triggered by one player config.shareVideos = true +-- Whether mobs and npcs in the game should be shared for all players when killed +config.shareKill = true + -- Which clientside script records should be blanked out so they are not run -- Note: By default, the original character generation scripts are included -- because they're not suitable for multiplayer From bcd08c2a71644a0349e5b7f0f75edba85535322e Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:30:38 +0200 Subject: [PATCH 06/20] Update eventHandler.lua --- scripts/eventHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 32ed16a3..9e3b83f7 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -202,7 +202,7 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.SendWorldKillCount(pid, true) - elseif config.shareKill == false then + else if Players[pid].data.kills == nil then Players[pid].data.kills = {} From 52f8f975630086da99bb71905d90571c452e5e80 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:33:29 +0200 Subject: [PATCH 07/20] Update commandHandler.lua --- scripts/commandHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commandHandler.lua b/scripts/commandHandler.lua index 73779b1d..a86745be 100644 --- a/scripts/commandHandler.lua +++ b/scripts/commandHandler.lua @@ -731,7 +731,7 @@ function commandHandler.ProcessCommand(pid, cmd) end end - elseif cmd[1] == "resetkills" and moderator then + elseif cmd[1] == "resetkills" and moderator and config.shareKill == true then -- Set all currently recorded kills to 0 for connected players for refId, killCount in pairs(WorldInstance.data.kills) do From 5e6b9fcaba2ef687625fa5464737651e35cf7f91 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:45:47 +0200 Subject: [PATCH 08/20] Update eventHandler.lua --- scripts/eventHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 9e3b83f7..a1984f95 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -186,7 +186,7 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.ClearKillChanges() - if config.shareKill == true then + if config.shareKills == true then for uniqueIndex, actor in pairs(actors) do if WorldInstance.data.kills[actor.refId] == nil then From 9ba274c46b1c450f13e819a97a55167d513765af Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:48:00 +0200 Subject: [PATCH 09/20] Update commandHandler.lua --- scripts/commandHandler.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/commandHandler.lua b/scripts/commandHandler.lua index a86745be..70c44605 100644 --- a/scripts/commandHandler.lua +++ b/scripts/commandHandler.lua @@ -731,7 +731,7 @@ function commandHandler.ProcessCommand(pid, cmd) end end - elseif cmd[1] == "resetkills" and moderator and config.shareKill == true then + elseif cmd[1] == "resetkills" and moderator and config.shareKills == true then -- Set all currently recorded kills to 0 for connected players for refId, killCount in pairs(WorldInstance.data.kills) do @@ -742,7 +742,7 @@ function commandHandler.ProcessCommand(pid, cmd) WorldInstance:LoadKills(pid, true) tes3mp.SendMessage(pid, "All the kill counts for creatures and NPCs have been reset.\n", true) - elseif cmd[1] == "resetkills" and config.shareKill == false then + elseif cmd[1] == "resetkills" and config.shareKills == false then if Players[pid].data.kills == nil then Players[pid].data.kills = {} From 044857ec4830b17ad030236c3f360fd6dad81e17 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:50:45 +0200 Subject: [PATCH 10/20] Update base.lua --- scripts/player/base.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/player/base.lua b/scripts/player/base.lua index 6f661516..dc036fd5 100644 --- a/scripts/player/base.lua +++ b/scripts/player/base.lua @@ -284,10 +284,10 @@ function BasePlayer:FinishLogin() self:LoadReputation() end - if config.shareKill == true then + if config.shareKills == true then WorldInstance:LoadKills(self.pid) else - self:LoadKill(self.pid, false) + self:LoadKills(self.pid, false) end self:LoadSpecialStates() @@ -380,10 +380,10 @@ function BasePlayer:EndCharGen() WorldInstance:LoadTopics(self.pid) end - if config.shareKill == true then + if config.shareKills == true then WorldInstance:LoadKills(self.pid) else - self:LoadKill(self.pid, false) + self:LoadKills(self.pid, false) end if spawnUsed ~= nil and spawnUsed.cellDescription ~= nil then @@ -1493,7 +1493,7 @@ function BasePlayer:SaveClientScriptGlobal(variables) stateHelper:SaveClientScriptGlobal(self, variables) end -function BasePlayer:LoadKill(pid, forEveryone) +function BasePlayer:LoadKills(pid, forEveryone) if self.data.kills == nil then self.data.kills = {} From c75449d9979b8958500a71a43f4dd31585bf5071 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Tue, 6 Sep 2022 22:51:27 +0200 Subject: [PATCH 11/20] Update config.lua --- scripts/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config.lua b/scripts/config.lua index e15906bf..edc71b0f 100644 --- a/scripts/config.lua +++ b/scripts/config.lua @@ -116,7 +116,7 @@ config.shareMapExploration = false config.shareVideos = true -- Whether mobs and npcs in the game should be shared for all players when killed -config.shareKill = true +config.shareKills = true -- Which clientside script records should be blanked out so they are not run -- Note: By default, the original character generation scripts are included From 96fc97c2549fda4210b5f0c607411e5e333e4ca4 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 16:00:21 +0200 Subject: [PATCH 12/20] Added sharing for allies and for players who hit if the target has not been hit for more than 600 seconds then the sharing list for the hits is reset, the allies receive the share regardless of the hits --- scripts/eventHandler.lua | 83 +++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 18 deletions(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index a1984f95..a43c2dc2 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -4,6 +4,8 @@ commandHandler = require("commandHandler") local consoleKickMessage = " has been kicked for using the console despite not having the permission to do so.\n" +local sendKills = {} + eventHandler.InitializeDefaultValidators = function() -- Don't validate object deletions for currently unusable containers (such as @@ -188,39 +190,67 @@ eventHandler.InitializeDefaultHandlers = function() if config.shareKills == true then - for uniqueIndex, actor in pairs(actors) do - if WorldInstance.data.kills[actor.refId] == nil then - WorldInstance.data.kills[actor.refId] = 0 - end - - WorldInstance.data.kills[actor.refId] = WorldInstance.data.kills[actor.refId] + 1 - WorldInstance:QuicksaveToDrive() - tes3mp.AddKill(actor.refId, WorldInstance.data.kills[actor.refId]) - - table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) - end - - tes3mp.SendWorldKillCount(pid, true) - - else - if Players[pid].data.kills == nil then Players[pid].data.kills = {} end - + for uniqueIndex, actor in pairs(actors) do + if Players[pid].data.kills[actor.refId] == nil then Players[pid].data.kills[actor.refId] = 0 end Players[pid].data.kills[actor.refId] = Players[pid].data.kills[actor.refId] + 1 Players[pid]:QuicksaveToDrive() + + if sendKills[uniqueIndex] == nil then + sendKills[uniqueIndex] = {timestamp = os.time(), playersName = {}} + end + tableHelper.insertValueIfMissing(sendKills[uniqueIndex].playersName, string.lower(Players[pid].accountName)) + tes3mp.AddKill(actor.refId, Players[pid].data.kills[actor.refId]) + + for alliedName, slot in pairs(Players[pid].data.alliedPlayers) do + + local alliedPid = logicHandler.GetPlayerByName(alliedName).pid + + if Players[alliedPid] ~= nil and Players[alliedPid]:IsLoggedIn() then + + if Players[alliedPid].data.kills == nil then + Players[alliedPid].data.kills = {} + end + + if Players[alliedPid].data.kills[actor.refId] == nil then + Players[alliedPid].data.kills[actor.refId] = 0 + end + + Players[alliedPid].data.kills[actor.refId] = Players[alliedPid].data.kills[actor.refId] + 1 + Players[alliedPid]:QuicksaveToDrive() + tableHelper.insertValueIfMissing(sendKills[uniqueIndex].playersName, string.lower(Players[alliedPid].accountName)) + + end + + end table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) + end - tes3mp.SendWorldKillCount(pid, false) + for targetIndex, actor in pairs(actors) do + + for targetName, slot in pairs(sendKills[targetIndex].playersName) do + + local targetPid = logicHandler.GetPlayerByName(targetName).pid + + if Players[targetPid] ~= nil and Players[targetPid]:IsLoggedIn() then + tes3mp.SendWorldKillCount(targetPid, false) + end + + end + + sendKills[targetIndex] = nil + + end end @@ -345,6 +375,23 @@ eventHandler.InitializeDefaultHandlers = function() if object.hit.success == true then debugMessage = debugMessage .. " has successfully hit " + + if config.shareKills == false and object.hittingPid ~= nil then + + if sendKills[uniqueIndex] == nil then + sendKills[uniqueIndex] = {timestamp = os.time(), playersName = {}} + else + if os.time() - sendKills[uniqueIndex].timestamp >= 600 then + sendKills[uniqueIndex] = nil + else + sendKills[uniqueIndex].timestamp = os.time() + end + end + + tableHelper.insertValueIfMissing(sendKills[uniqueIndex].playersName, string.lower(Players[object.hittingPid].accountName)) + + end + else debugMessage = debugMessage .. " has missed hitting " end From 3401c5c987581850927d74cd55281da7f31f4079 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 16:03:59 +0200 Subject: [PATCH 13/20] Update eventHandler.lua --- scripts/eventHandler.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index a43c2dc2..3f3b2335 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -189,7 +189,23 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.ClearKillChanges() if config.shareKills == true then - + + for uniqueIndex, actor in pairs(actors) do + if WorldInstance.data.kills[actor.refId] == nil then + WorldInstance.data.kills[actor.refId] = 0 + end + + WorldInstance.data.kills[actor.refId] = WorldInstance.data.kills[actor.refId] + 1 + WorldInstance:QuicksaveToDrive() + tes3mp.AddKill(actor.refId, WorldInstance.data.kills[actor.refId]) + + table.insert(cell.unusableContainerUniqueIndexes, uniqueIndex) + end + + tes3mp.SendWorldKillCount(pid, true) + + else + if Players[pid].data.kills == nil then Players[pid].data.kills = {} end From d7cc726e3a5e11d1b3ad3e28ac4aa6aba929cc2e Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 16:10:27 +0200 Subject: [PATCH 14/20] Update eventHandler.lua --- scripts/eventHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 3f3b2335..559d76e3 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -398,7 +398,7 @@ eventHandler.InitializeDefaultHandlers = function() sendKills[uniqueIndex] = {timestamp = os.time(), playersName = {}} else if os.time() - sendKills[uniqueIndex].timestamp >= 600 then - sendKills[uniqueIndex] = nil + sendKills[uniqueIndex] = {timestamp = os.time(), playersName = {}} else sendKills[uniqueIndex].timestamp = os.time() end From 8ba8f8b4a2c53908892ed3810e1e00598b8b88a7 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:29:10 +0200 Subject: [PATCH 15/20] Update eventHandler.lua --- scripts/eventHandler.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 559d76e3..656e3455 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -226,7 +226,7 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.AddKill(actor.refId, Players[pid].data.kills[actor.refId]) - for alliedName, slot in pairs(Players[pid].data.alliedPlayers) do + for _, alliedName in ipairs(self.data.alliedPlayers) do local alliedPid = logicHandler.GetPlayerByName(alliedName).pid @@ -254,7 +254,7 @@ eventHandler.InitializeDefaultHandlers = function() for targetIndex, actor in pairs(actors) do - for targetName, slot in pairs(sendKills[targetIndex].playersName) do + for _, targetName in pairs(sendKills[targetIndex].playersName) do local targetPid = logicHandler.GetPlayerByName(targetName).pid From c0fe275e6c5d55abf2ce5fad6b260782f67c20f4 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:33:48 +0200 Subject: [PATCH 16/20] Update eventHandler.lua --- scripts/eventHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index 656e3455..a6fb1a94 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -226,7 +226,7 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.AddKill(actor.refId, Players[pid].data.kills[actor.refId]) - for _, alliedName in ipairs(self.data.alliedPlayers) do + for _, alliedName in ipairs(Players[pid].data.alliedPlayers) do local alliedPid = logicHandler.GetPlayerByName(alliedName).pid From 1921fd22cb99fac3e0e24ea4e921e95058b2cc88 Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Wed, 7 Sep 2022 23:04:31 +0200 Subject: [PATCH 17/20] Update eventHandler.lua --- scripts/eventHandler.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index a6fb1a94..cd578af5 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -254,7 +254,7 @@ eventHandler.InitializeDefaultHandlers = function() for targetIndex, actor in pairs(actors) do - for _, targetName in pairs(sendKills[targetIndex].playersName) do + for _, targetName in ipairs(sendKills[targetIndex].playersName) do local targetPid = logicHandler.GetPlayerByName(targetName).pid From caeea42bba7eb9fcfc8f75986eed18815af0ad5d Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 5 Dec 2022 08:53:28 +0100 Subject: [PATCH 18/20] Update eventHandler.lua --- scripts/eventHandler.lua | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua index cd578af5..8a965559 100644 --- a/scripts/eventHandler.lua +++ b/scripts/eventHandler.lua @@ -227,24 +227,28 @@ eventHandler.InitializeDefaultHandlers = function() tes3mp.AddKill(actor.refId, Players[pid].data.kills[actor.refId]) for _, alliedName in ipairs(Players[pid].data.alliedPlayers) do - - local alliedPid = logicHandler.GetPlayerByName(alliedName).pid - - if Players[alliedPid] ~= nil and Players[alliedPid]:IsLoggedIn() then + + if logicHandler.GetPlayerByName(alliedName) then - if Players[alliedPid].data.kills == nil then - Players[alliedPid].data.kills = {} - end + local alliedPid = logicHandler.GetPlayerByName(alliedName).pid - if Players[alliedPid].data.kills[actor.refId] == nil then - Players[alliedPid].data.kills[actor.refId] = 0 - end + if Players[alliedPid] ~= nil and Players[alliedPid]:IsLoggedIn() then - Players[alliedPid].data.kills[actor.refId] = Players[alliedPid].data.kills[actor.refId] + 1 - Players[alliedPid]:QuicksaveToDrive() - tableHelper.insertValueIfMissing(sendKills[uniqueIndex].playersName, string.lower(Players[alliedPid].accountName)) + if Players[alliedPid].data.kills == nil then + Players[alliedPid].data.kills = {} + end + + if Players[alliedPid].data.kills[actor.refId] == nil then + Players[alliedPid].data.kills[actor.refId] = 0 + end + + Players[alliedPid].data.kills[actor.refId] = Players[alliedPid].data.kills[actor.refId] + 1 + Players[alliedPid]:QuicksaveToDrive() + tableHelper.insertValueIfMissing(sendKills[uniqueIndex].playersName, string.lower(Players[alliedPid].accountName)) + + end - end + end end From a571d78e8dc1906e11d80b3a2aa8a568ce2fbd8c Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 23 Jan 2023 00:54:41 +0100 Subject: [PATCH 19/20] add config.ignoreModifierWithMaxAttribute --- scripts/player/base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/player/base.lua b/scripts/player/base.lua index dc036fd5..9c63e3c6 100644 --- a/scripts/player/base.lua +++ b/scripts/player/base.lua @@ -839,7 +839,7 @@ function BasePlayer:SaveAttributes(playerPacket) local message = "Your base " .. attributeName .. " has exceeded the maximum allowed value " .. "and been reset to its last recorded one.\n" tes3mp.SendMessage(self.pid, message) - elseif (attribute.base + attribute.modifier) > maxAttributeValue then + elseif (attribute.base + attribute.modifier) > maxAttributeValue and not config.ignoreModifierWithMaxAttribute then tes3mp.ClearAttributeModifier(self.pid, attributeId) tes3mp.SendAttributes(self.pid) From cd4b693037011681ec7d1945f1c20709708227ec Mon Sep 17 00:00:00 2001 From: Rickoff <38435435+rickoff@users.noreply.github.com> Date: Mon, 23 Jan 2023 00:57:43 +0100 Subject: [PATCH 20/20] Update config.lua --- scripts/config.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/config.lua b/scripts/config.lua index edc71b0f..0e5fafdd 100644 --- a/scripts/config.lua +++ b/scripts/config.lua @@ -193,6 +193,9 @@ config.forbiddenCells = { "ToddTest" } -- The maximum value that any attribute except Speed is allowed to have config.maxAttributeValue = 200 +-- Allow modifier values to bypass allowed attribute values +config.ignoreModifierWithMaxAttribute = false + -- The maximum value that Speed is allowed to have -- Note: Speed is given special treatment because of the Boots of Blinding Speed config.maxSpeedValue = 365