Skip to content

Commit

Permalink
refactor: enhance and organize the server initialization script (open…
Browse files Browse the repository at this point in the history
…tibiabr#2181)

Enhanced and organized the server initialization script, adding
functionalities and improving overall structure.
Fix checkDuplicateStorageValues for subtable values.

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Elson Costa <[email protected]>
  • Loading branch information
3 people authored Feb 8, 2024
1 parent 48807ae commit e40a5eb
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 291 deletions.
80 changes: 0 additions & 80 deletions data-canary/scripts/globalevents/startup.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
local function loadMapActionsAndUniques()
loadLuaMapAction(ChestAction)
loadLuaMapUnique(ChestUnique)
loadLuaMapAction(CorpseAction)
loadLuaMapUnique(CorpseUnique)
loadLuaMapAction(KeyDoorAction)
loadLuaMapAction(LevelDoorAction)
loadLuaMapAction(QuestDoorAction)
loadLuaMapUnique(QuestDoorUnique)
loadLuaMapAction(ItemAction)
loadLuaMapUnique(ItemUnique)
loadLuaMapAction(ItemUnmovableAction)
loadLuaMapAction(LeverAction)
loadLuaMapUnique(LeverUnique)
loadLuaMapAction(TeleportAction)
loadLuaMapUnique(TeleportUnique)
loadLuaMapAction(TeleportItemAction)
loadLuaMapUnique(TeleportItemUnique)
loadLuaMapAction(TileAction)
loadLuaMapUnique(TileUnique)
loadLuaMapAction(TilePickAction)
CreateMapItem(CreateItemOnMap)
updateKeysStorage(QuestKeysUpdate)
end

local function loadMapAttributes()
logger.debug("Loading map attributes")
loadLuaMapSign(SignTable)
loadLuaMapBookDocument(BookDocumentTable)

loadMapActionsAndUniques()
logger.debug("Loaded all actions and uniques in the map")
end

local function resetGlobalStorages()
for i = 1, #startupGlobalStorages do
Game.setStorageValue(startupGlobalStorages[i], 0)
end
end

local function resetFerumbrasAscendantQuestHabitats()
for i = 1, #GlobalStorage.FerumbrasAscendant.Habitats do
Game.setStorageValue(GlobalStorage.FerumbrasAscendant.Habitats[i], 0)
end
end

local mapAttributesLoader = GlobalEvent("Map Attributes Loader")

function mapAttributesLoader.onStartup()
loadMapAttributes()
resetGlobalStorages()
resetFerumbrasAscendantQuestHabitats()
end

mapAttributesLoader:register()
174 changes: 0 additions & 174 deletions data-otservbr-global/scripts/globalevents/others/startup.lua

This file was deleted.

Loading

0 comments on commit e40a5eb

Please sign in to comment.