Skip to content

Commit

Permalink
improve: datapack cleanup/refactor (#2008)
Browse files Browse the repository at this point in the history
- Fixes #1840 
- Adds some missing achievements
- Adds some missing mounts
- Adds some missing outfits
  • Loading branch information
luan authored Dec 10, 2023
1 parent ad5c0c1 commit f0fcd2c
Show file tree
Hide file tree
Showing 83 changed files with 2,355 additions and 1,666 deletions.
12 changes: 0 additions & 12 deletions data-otservbr-global/lib/compat/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -788,18 +788,6 @@ function doSendAnimatedText()
return true
end

function doPlayerAddExp(cid, exp, useMult, ...)
local player = Player(cid)
if player == nil then
return false
end

if useMult then
exp = exp * getRateFromTable(experienceStages, player:getLevel(), configManager.getNumber(configKeys.RATE_EXPERIENCE))
end
return player:addExperience(exp, ...)
end

function doPlayerAddManaSpent(cid, mana)
local p = Player(cid)
return p and p:addManaSpent(mana) or false
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2957,6 +2957,7 @@ GlobalStorage = {
ZamuloshSummon = 60030,
FerumbrasEssence = 60031,
DesperateSoul = 60032,
FlowerPuzzleTimer = 60033,
Crystals = {
Crystal1 = 60040,
Crystal2 = 60041,
Expand Down
3 changes: 3 additions & 0 deletions data-otservbr-global/lib/quests/the_primal_ordeal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ function RegisterPrimalPackBeast(template)
primalMonster.name = "Primal Pack Beast"
primalMonster.description = "a primal pack beast"

primalMonster.health = primalMonster.health
primalMonster.maxHealth = primalMonster.maxHealth
primalMonster.raceId = nil
primalMonster.Bestiary = nil
primalMonster.corpse = 0

primal:register(primalMonster)
end
9 changes: 8 additions & 1 deletion data-otservbr-global/npc/gnomadness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,18 @@ local function creatureSayCallback(npc, creature, type, message)
local desiredLevel = getMoneyCount(message)
if desiredLevel <= 0 then
npcHandler:say("I'm sorry, I don't understand. What hazard level would you like to set?", npc, creature)
npcHandler:setTopic(playerId, 0)
npcHandler:setTopic(playerId, 2)
return true
end
if hazard:setPlayerCurrentLevel(player, desiredLevel) then
npcHandler:say("Your hazard level has been set to " .. desiredLevel .. ". Good luck!", npc, creature)
if desiredLevel >= hazard.maxLevel and not player:kv():scoped("primal-ordeal"):get("received-prize") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations you received the Noxious Ripptor mount.")
player:addMount(202)
npcHandler:say("You've achived the maximum hazard level. As a reward, you've received the Noxious Ripptor mount and a primal bag.", npc, creature)
player:addItem(PrimalBagId, 1)
player:kv():scoped("primal-ordeal"):set("received-prize", true)
end
else
npcHandler:say("You can't set your hazard level higher than your maximum unlocked level.", npc, creature)
end
Expand Down
31 changes: 1 addition & 30 deletions data-otservbr-global/npc/oberon's_bile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,12 @@ npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 23991,
lookTypeEx = 10980,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
31 changes: 1 addition & 30 deletions data-otservbr-global/npc/oberon's_hate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,12 @@ npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 23991,
lookTypeEx = 10980,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
32 changes: 1 addition & 31 deletions data-otservbr-global/npc/oberon's_ire.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,11 @@ npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 23991,
lookTypeEx = 11211,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
31 changes: 1 addition & 30 deletions data-otservbr-global/npc/oberon's_spite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,12 @@ npcConfig.walkInterval = 0
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookTypeEx = 23991,
lookTypeEx = 11212,
}

npcConfig.flags = {
floorchange = false,
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:onThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:onAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:onDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:onMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:onSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:onCloseChannel(npc, creature)
end

npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)
Loading

0 comments on commit f0fcd2c

Please sign in to comment.