summaryrefslogtreecommitdiff
path: root/tes3mp
diff options
context:
space:
mode:
Diffstat (limited to 'tes3mp')
-rw-r--r--tes3mp/custom.diff59
-rw-r--r--tes3mp/disableAssassins.lua127
2 files changed, 0 insertions, 186 deletions
diff --git a/tes3mp/custom.diff b/tes3mp/custom.diff
deleted file mode 100644
index 6b8ba34..0000000
--- a/tes3mp/custom.diff
+++ /dev/null
@@ -1,59 +0,0 @@
-diff --git a/scripts/eventHandler.lua b/scripts/eventHandler.lua
-index f30775c..8a49224 100644
---- a/scripts/eventHandler.lua
-+++ b/scripts/eventHandler.lua
-@@ -302,6 +302,7 @@ eventHandler.OnPlayerLevel = function(pid)
- if eventStatus.validDefaultHandler then
- Players[pid]:SaveLevel()
- Players[pid]:SaveStatsDynamic()
-+ disableAssassins.OnLevelUp(pid)
- end
- customEventHooks.triggerHandlers("OnPlayerLevel", eventStatus, {pid})
- end
-diff --git a/scripts/player/base.lua b/scripts/player/base.lua
-index 36cdd3c..cc1e8ac 100644
---- a/scripts/player/base.lua
-+++ b/scripts/player/base.lua
-@@ -202,6 +202,8 @@ function BasePlayer:FinishLogin()
- self:LoadJournal()
- end
-
-+ disableAssassins.OnLogin(self.pid)
-+
- if config.shareFactionRanks == true then
- WorldInstance:LoadFactionRanks(self.pid)
- else
-@@ -299,6 +301,8 @@ function BasePlayer:EndCharGen()
-
- WorldInstance:LoadKills(self.pid)
-
-+ disableAssassins.OnLogin(self.pid)
-+
- if config.defaultSpawnCell ~= nil then
-
- tes3mp.SetCell(self.pid, config.defaultSpawnCell)
-diff --git a/scripts/serverCore.lua b/scripts/serverCore.lua
-index a4f7e0c..4c55a3b 100644
---- a/scripts/serverCore.lua
-+++ b/scripts/serverCore.lua
-@@ -1,6 +1,8 @@
- require("utils")
- require("enumerations")
-
-+disableAssassins = require("disableAssassins")
-+
- jsonInterface = require("jsonInterface")
-
- -- Lua's default io library for input/output can't open Unicode filenames on Windows,
-diff --git a/scripts/world/base.lua b/scripts/world/base.lua
-index bc24e76..304b568 100644
---- a/scripts/world/base.lua
-+++ b/scripts/world/base.lua
-@@ -292,6 +292,7 @@ function BaseWorld:SaveKills(pid)
- for index = 0, tes3mp.GetKillChangesSize(pid) - 1 do
-
- local refId = tes3mp.GetKillRefId(pid, index)
-+ disableAssassins.OnKill(pid, refId)
- local number = tes3mp.GetKillNumber(pid, index)
- self.data.kills[refId] = number
- end
diff --git a/tes3mp/disableAssassins.lua b/tes3mp/disableAssassins.lua
deleted file mode 100644
index ae72a51..0000000
--- a/tes3mp/disableAssassins.lua
+++ /dev/null
@@ -1,127 +0,0 @@
-local Methods = {}
---[[Setting defines how the assassins disbaled
-1: script checks if the journal entries associated with the quest are present and if not - adds them to the journal to completely
-skip having assassins.
-2: track how many assassins the player kills and store it in a custom variable. Load the value on login.
-3: set assassin spawn occurance to initialKills, which is by default max-1, so players would only see the assassins spawn once.
-4: set the appropriate script value to 10 and disable assassins from spawning if player's level is below minLevel value.
-Set the value to initialKills instead if above the level requirement.
-]]
-local setting = 1
--- Minimum level to start having assassins appear if setting == 4
-local minLevel = 20
---[[Initial occurance value to use. Only applicable when setting is 3 or 4. The higher the value, the smaller the odds. Odds are 0
-at 10, 1% at 9, 11% at 8 and so on. Odds are also affected by player's level - low level will have odds of 0 with values
-of 3 and up, for example. In a way, it can be used to delay assassin spawn before certain level is reached, although a separate
-setting does it better.]]
-local initialKills = 0
-
--- Check how to handle the script based on setting when player joins the game
-Methods.OnLogin = function(pid)
- local data = disableAssassins.DefineData(pid)
- local level = Players[pid].data.stats.level
- if setting == 1 then
- disableAssassins.CheckJournal(pid)
- elseif setting == 2 then
- disableAssassins.LoadKills(pid, data)
- elseif setting == 3 then
- if data.disableAssassins < initialKills then
- data.disableAssassins = initialKills
- end
- disableAssassins.LoadKills(pid, data)
- elseif setting == 4 then
- if level < minLevel then
- -- set it to something very unlikely to occur naturally and disable spawning
- data.disableAssassins = 999
- end
- disableAssassins.LoadKills(pid, data)
- end
-end
-
--- Find customVariables based on journal sharing setting, define saved variable
-Methods.DefineData = function(pid)
- local data
- if config.shareJournal then
- data = WorldInstance.data.customVariables
- else
- data = Players[pid].data.customVariables
- end
- if data.Skvysh == nil then
- data.Skvysh = {}
- end
- if data.Skvysh.disableAssassins == nil then
- data.Skvysh.disableAssassins = 0
- end
- return data.Skvysh
-end
-
--- Check if the target killed was an assassin and count it as an occurance for later sessions
-Methods.OnKill = function(pid, refId)
- local assassins = {"db_assassin1b", "db_assassin1", "db_assassin2", "db_assassin3", "db_assassin4"}
- local isAssassin = false
- local data = disableAssassins.DefineData(pid)
- if tableHelper.containsValue(assassins, refId, false) then
- isAssassin = true
- end
- if isAssassin then
- data.disableAssassins = data.disableAssassins + 1
- end
-end
-
--- Check if journal already has the quest done and ask to add the entries if not
-Methods.CheckJournal = function(pid)
- local journal
- local found = false
- if config.shareJournal then
- journal = WorldInstance.data.journal
- else
- journal = Players[pid].data.journal
- end
- for key, value in pairs(journal) do
- if journal[key].quest == "tr_dbattack" then
- if journal[key].index == 60 then
- found = true
- end
- end
- end
- if found == false then
- disableAssassins.AddJournal(pid)
- disableAssassins.AddTopic(pid)
- end
-end
-
--- Add journal entries to end the attacks and allow teleportation to Mournhold
-Methods.AddJournal = function(pid)
- logicHandler.RunConsoleCommandOnPlayer(pid, "Journal TR_DBAttack 10")
- logicHandler.RunConsoleCommandOnPlayer(pid, "Journal TR_DBAttack 30")
- logicHandler.RunConsoleCommandOnPlayer(pid, "Journal TR_DBAttack 40")
- logicHandler.RunConsoleCommandOnPlayer(pid, "Journal TR_DBAttack 50")
- logicHandler.RunConsoleCommandOnPlayer(pid, "Journal TR_DBAttack 60")
-end
-
--- add topics regarding the quest
-Methods.AddTopic = function(pid)
- logicHandler.RunConsoleCommandOnPlayer(pid, "AddTopic \"Dark Brotherhood\"")
- logicHandler.RunConsoleCommandOnPlayer(pid, "AddTopic \"transport to Mournhold\"")
- logicHandler.RunConsoleCommandOnPlayer(pid, "AddTopic \"transport to Vvardenfell\"")
-end
-
--- Set occurance value through console based on stored value
-Methods.LoadKills = function(pid, data)
- logicHandler.RunConsoleCommandOnPlayer(pid, "Set dbAttackScript.attackonce to " .. data.disableAssassins)
-end
-
--- When a player levels up, check if they passed the threshold and set occurance count to initialKills if that is the case
-Methods.OnLevelUp = function(pid)
- local data = disableAssassins.DefineData(pid)
- local level = Players[pid].data.stats.level
- if level >= minLevel then
- -- if it was disabled before through the script
- if data.disableAssassins >= 999 then
- data.disableAssassins = initialKills
- disableAssassins.LoadKills(pid, data)
- end
- end
-end
-
-return Methods