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: remove unnecessary function for data-canary #2973

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions data-otservbr-global/lib/functions/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dofile(DATA_DIRECTORY .. "/lib/functions/players.lua")
76 changes: 76 additions & 0 deletions data-otservbr-global/lib/functions/players.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
function Player.getCookiesDelivered(self)
local storage, amount =
{
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.SimonTheBeggar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Markwin,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Ariella,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hairycles,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Djinn,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.AvarTar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.OrcKing,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Lorbas,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Wyda,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hjaern,
}, 0
for i = 1, #storage do
if self:getStorageValue(storage[i]) == 1 then
amount = amount + 1
end
end
return amount
end

function Player.checkGnomeRank(self)
local points = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Rank)
local questProgress = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine)
if points >= 30 and points < 120 then
if questProgress <= 25 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 26)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
end
elseif points >= 120 and points < 480 then
if questProgress <= 26 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 27)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
end
elseif points >= 480 and points < 1440 then
if questProgress <= 27 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 28)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
end
elseif points >= 1440 then
if questProgress <= 29 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 30)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
self:addAchievement("Honorary Gnome")
end
end
return true
end

function Player.addFamePoint(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current + 1)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a fame point.")
end

function Player.getFamePoints(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
return math.max(0, points)
end

function Player.removeFamePoints(self, amount)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current - amount)
end
3 changes: 3 additions & 0 deletions data-otservbr-global/lib/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ dofile(DATA_DIRECTORY .. "/lib/quests/quest.lua")

-- Tables library
dofile(DATA_DIRECTORY .. "/lib/tables/load.lua")

-- Functions library
dofile(DATA_DIRECTORY .. "/lib/functions/load.lua")
84 changes: 0 additions & 84 deletions data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,90 +90,6 @@ function Player.addManaSpent(...)
end

-- Functions From OTServBR-Global
function Player.getCookiesDelivered(self)
if not IsRunningGlobalDatapack() then
return true
end

local storage, amount =
{
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.SimonTheBeggar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Markwin,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Ariella,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hairycles,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Djinn,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.AvarTar,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.OrcKing,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Lorbas,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Wyda,
Storage.Quest.U8_1.WhatAFoolishQuest.CookieDelivery.Hjaern,
}, 0
for i = 1, #storage do
if self:getStorageValue(storage[i]) == 1 then
amount = amount + 1
end
end
return amount
end

function Player.checkGnomeRank(self)
if not IsRunningGlobalDatapack() then
return true
end

local points = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Rank)
local questProgress = self:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine)
if points >= 30 and points < 120 then
if questProgress <= 25 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 26)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
end
elseif points >= 120 and points < 480 then
if questProgress <= 26 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 27)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
end
elseif points >= 480 and points < 1440 then
if questProgress <= 27 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 28)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
end
elseif points >= 1440 then
if questProgress <= 29 then
self:setStorageValue(Storage.Quest.U9_60.BigfootsBurden.QuestLine, 30)
self:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
self:addAchievement("Gnome Little Helper")
self:addAchievement("Gnome Friend")
self:addAchievement("Gnomelike")
self:addAchievement("Honorary Gnome")
end
end
return true
end

function Player.addFamePoint(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current + 1)
self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received a fame point.")
end

function Player.getFamePoints(self)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
return math.max(0, points)
end

function Player.removeFamePoints(self, amount)
local points = self:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points)
local current = math.max(0, points)
self:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Fame_Points, current - amount)
end

luanluciano93 marked this conversation as resolved.
Show resolved Hide resolved
function Player.depositMoney(self, amount)
return Bank.deposit(self, amount)
Expand Down
Loading