Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: small adjustments and corrections to the core #2524

Merged
merged 17 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions data-canary/scripts/actions/other/large_sea_shell.lua

This file was deleted.

101 changes: 0 additions & 101 deletions data-canary/scripts/weapons/scripted_weapons.lua

This file was deleted.

1 change: 0 additions & 1 deletion data-otservbr-global/lib/others/load.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
dofile(DATA_DIRECTORY .. "/lib/others/dawnport.lua")
dofile(DATA_DIRECTORY .. "/lib/others/vip_system.lua")
20 changes: 0 additions & 20 deletions data-otservbr-global/scripts/creaturescripts/customs/vip.lua

This file was deleted.

12 changes: 0 additions & 12 deletions data-otservbr-global/scripts/creaturescripts/others/forge_kill.lua

This file was deleted.

File renamed without changes.
10 changes: 5 additions & 5 deletions data/libs/functions/load.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
-- Load core functions
dofile(CORE_DIRECTORY .. "/libs/functions/bit.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/bitwise_flags.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/boss_lever.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/combat.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/constants.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/container.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/creature.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/functions.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/gematelier.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/fs.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/functions.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/game.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/gematelier.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/item.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/itemtype.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/lever.lua")
Expand All @@ -20,14 +21,13 @@ dofile(CORE_DIRECTORY .. "/libs/functions/player.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/position.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/pronouns.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/quests.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/queue.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/revscriptsys.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/set.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/spawn.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/spectators.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/bosslever.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/string.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/tables.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/teleport.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/tile.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/vocation.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/set.lua")
dofile(CORE_DIRECTORY .. "/libs/functions/queue.lua")
1 change: 1 addition & 0 deletions data/libs/systems/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dofile(CORE_DIRECTORY .. "/libs/systems/hazard.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/hireling.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/raids.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/reward_boss.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/vip.lua")
dofile(CORE_DIRECTORY .. "/libs/systems/zones.lua")
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
local config = {
activationMessage = "You have received %s VIP days.",
activationMessageType = MESSAGE_EVENT_ADVANCE,

expirationMessage = "Your VIP days ran out.",
expirationMessageType = MESSAGE_ADMINISTRATOR,
expirationMessage = "Your VIP days have expired.",
vipDaysInfiniteMessage = "You have an infinite amount of VIP days remaining.",
noVipStatusMessage = "You do not have VIP status on your account.",
vipTimeRemainingMessage = "You have %s of VIP time remaining.",
omarcopires marked this conversation as resolved.
Show resolved Hide resolved

outfits = {},
mounts = {},
}

function Player.onRemoveVip(self)
self:sendTextMessage(config.expirationMessageType, config.expirationMessage)
self:sendTextMessage(MESSAGE_ADMINISTRATOR, config.expirationMessage)

for _, outfit in ipairs(config.outfits) do
self:removeOutfit(outfit)
Expand All @@ -28,6 +28,7 @@ function Player.onRemoveVip(self)
playerOutfit.lookType = 128
end
playerOutfit.lookAddons = 0

self:setOutfit(playerOutfit)
end

Expand All @@ -36,7 +37,7 @@ end

function Player.onAddVip(self, days, silent)
if not silent then
self:sendTextMessage(config.activationMessageType, string.format(config.activationMessage, days))
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(config.activationMessage, days))
end

for _, outfit in ipairs(config.outfits) do
Expand All @@ -52,16 +53,15 @@ end

function CheckPremiumAndPrint(player, msgType)
if player:getVipDays() == 0xFFFF then
player:sendTextMessage(msgType, "You have infinite amount of VIP days left.")
player:sendTextMessage(msgType, config.vipDaysInfiniteMessage)
omarcopires marked this conversation as resolved.
Show resolved Hide resolved
return true
end

local playerVipTime = player:getVipTime()
if playerVipTime < os.time() then
local msg = "You do not have VIP on your account."
player:sendTextMessage(msgType, msg)
player:sendTextMessage(msgType, config.noVipStatusMessage)
omarcopires marked this conversation as resolved.
Show resolved Hide resolved
return true
end

player:sendTextMessage(msgType, string.format("You have %s of VIP time left.", getFormattedTimeRemaining(playerVipTime)))
player:sendTextMessage(msgType, string.format(config.vipTimeRemainingMessage, getFormattedTimeRemaining(playerVipTime)))
omarcopires marked this conversation as resolved.
Show resolved Hide resolved
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ local hirelingLamp = Action()

function hirelingLamp.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local spawnPosition = player:getPosition()
local hireling_id = item:getCustomAttribute("Hireling")
local hirelingId = item:getCustomAttribute("Hireling")
local house = spawnPosition and spawnPosition:getTile() and spawnPosition:getTile():getHouse() or nil

if not house then
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_FAILURE, "You may use this only inside a house.")
Expand All @@ -22,10 +23,10 @@ function hirelingLamp.onUse(player, item, fromPosition, target, toPosition, isHo
return false
end

local hireling = getHirelingById(hireling_id)
local hireling = getHirelingById(hirelingId)
if not hireling then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There was an error creating the hireling and it has been deleted, please, contact server admin.")
logger.warn("[hirelingLamp.onUse] Player {} is using hireling with id {} not exist in the database", player:getName(), hireling_id)
logger.warn("[hirelingLamp.onUse] Player {} is using hireling with id {} not exist in the database", player:getName(), hirelingId)
logger.error("Deleted the lamp")
item:remove(1)
return true
Expand Down
30 changes: 30 additions & 0 deletions data/scripts/actions/items/large_sea_shell.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local largeSeashell = Action()

function largeSeashell.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("delay-large-seashell") then
player:say("You have already opened a shell today.", TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
return true
end

local chance = math.random(100)
local message = "Nothing is inside."

if chance <= 16 then
doTargetCombatHealth(0, player, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_NONE)
message = "Ouch! You squeezed your fingers."
elseif chance > 16 and chance <= 64 then
Game.createItem(math.random(281, 282), 1, player:getPosition())
message = "You found a beautiful pearl."
player:addAchievementProgress("Shell Seeker", 100)
end

player:setExhaustion("delay-large-seashell", 20 * 60 * 60)
player:say(message, TALKTYPE_MONSTER_SAY, false, player, item:getPosition())
item:transform(198)
item:decay()
item:getPosition():sendMagicEffect(CONST_ME_BUBBLES)
return true
end

largeSeashell:id(197)
largeSeashell:register()
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
local onBossDeath = CreatureEvent("BossLeverOnDeath")

function onBossDeath.onDeath(creature)
if not creature then
return true
end

local name = creature:getName()
local key = "boss." .. toKey(name)
local zone = Zone(key)

if not zone then
return true
end

local bossLever = BossLever[name]
if not bossLever then
return true
end

if bossLever.timeoutEvent then
stopEvent(bossLever.timeoutEvent)
bossLever.timeoutEvent = nil
end

if bossLever.timeAfterKill > 0 then
zone:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The " .. name .. " has been defeated. You have " .. bossLever.timeAfterKill .. " seconds to leave the room.")
bossLever.timeoutEvent = addEvent(function(zn)
Expand All @@ -26,4 +32,5 @@ function onBossDeath.onDeath(creature)
end
return true
end

onBossDeath:register()
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dofile(CORE_DIRECTORY .. "/modules/scripts/blessings/blessings.lua")

local adventurerBlessingLogin = CreatureEvent("AdventurerBlessingLogin")

function adventurerBlessingLogin.onLogin(player)
return Blessings.doAdventurerBlessing(player)
end
Expand Down
Loading
Loading