Skip to content

Commit

Permalink
updated branch with only badge system.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed Apr 26, 2024
1 parent ffcdec3 commit eec389a
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 1,491 deletions.
169 changes: 0 additions & 169 deletions data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -965,175 +965,6 @@ do

return true
end

function Player.initializeBadgeSystem(self)
-- if not BadgeSystem.enable then
-- return true
-- end
--
-- -- Account age section
-- if BadgeSystem.accountAge and #BadgeSystem.accountAge > 0 then
-- for _, it in pairs(BadgeSystem.accountAge) do
-- if BadgeSystem.accountAgeFunction(self, it.amount) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
-- -- Loyalty section
-- if BadgeSystem.loyalty and #BadgeSystem.loyalty > 0 then
-- for _, it in pairs(BadgeSystem.loyalty) do
-- if BadgeSystem.loyaltyFunction(self, it.amount) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
-- -- Account all vocations section
-- if BadgeSystem.accountAllLevel and #BadgeSystem.accountAllLevel > 0 then
-- for _, it in pairs(BadgeSystem.accountAllLevel) do
-- if BadgeSystem.accountAllLevelFunction(self, it.amount) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
-- -- Tournament participation section
-- if BadgeSystem.tournamentParticipation and #BadgeSystem.tournamentParticipation > 0 then
-- for _, it in pairs(BadgeSystem.tournamentParticipation) do
-- if BadgeSystem.tournamentParticipationFunction(self, it.amount) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
-- -- Tournament points section
-- if BadgeSystem.tournamentPoints and #BadgeSystem.tournamentPoints > 0 then
-- for _, it in pairs(BadgeSystem.tournamentPoints) do
-- if BadgeSystem.tournamentPointsFunction(self, it.amount) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
-- -- Others section
-- if BadgeSystem.others and #BadgeSystem.others > 0 then
-- for _, it in pairs(BadgeSystem.others) do
-- if it.isUnlocked(self) then
-- self:addBadge(it.id)
-- end
-- end
-- end
--
return true
end

function Player.initializeTitleSystem(self)
-- if not TitleSystem.enable then
-- return false
-- end
--
-- -- Gold section
-- if TitleSystem.gold and #TitleSystem.gold > 0 then
-- for _, it in pairs(TitleSystem.gold) do
-- if TitleSystem.goldFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Mount section
-- if TitleSystem.mounts and #TitleSystem.mounts > 0 then
-- for _, it in pairs(TitleSystem.mounts) do
-- if TitleSystem.mountFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Outfit section
-- if TitleSystem.outfits and #TitleSystem.outfits > 0 then
-- for _, it in pairs(TitleSystem.outfits) do
-- if TitleSystem.outfitFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Level section
-- if TitleSystem.level and #TitleSystem.level > 0 then
-- for _, it in pairs(TitleSystem.level) do
-- if TitleSystem.levelFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Highscores section
-- --if TitleSystem.highscores and #TitleSystem.highscores > 0 then
-- -- for _, it in pairs(TitleSystem.highscores) do
-- -- if TitleSystem.highscoreFunction(self, it.skill) then
-- -- self:addTitle(it.id)
-- -- end
-- -- end
-- --end
--
-- -- Bestiary section
-- if TitleSystem.bestiary and #TitleSystem.bestiary > 0 then
-- for _, it in pairs(TitleSystem.bestiary) do
-- if TitleSystem.bestiaryFunction(self, it.race) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Login section
-- if TitleSystem.login and #TitleSystem.login > 0 then
-- for _, it in pairs(TitleSystem.login) do
-- if TitleSystem.loginFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Task hunting section
-- if TitleSystem.task and #TitleSystem.task > 0 then
-- for _, it in pairs(TitleSystem.task) do
-- if TitleSystem.taskFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Map section
-- if TitleSystem.map and #TitleSystem.map > 0 then
-- for _, it in pairs(TitleSystem.map) do
-- if TitleSystem.mapFunction(self, it.amount) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Quest section
-- if TitleSystem.quest and #TitleSystem.quest > 0 then
-- for _, it in pairs(TitleSystem.quest) do
-- if TitleSystem.questFunction(self, it.storage, it.isKv) then
-- self:addTitle(it.id)
-- end
-- end
-- end
--
-- -- Others section
-- if TitleSystem.others and #TitleSystem.others > 0 then
-- for _, it in pairs(TitleSystem.others) do
-- if it.isUnlocked(self) then
-- self:addTitle(it.id)
-- end
-- end
-- end

return true
end
end

function Player:questKV(questName)
Expand Down
34 changes: 4 additions & 30 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,31 +398,6 @@ function parseRequestStoreOffers(playerId, msg)
end
end

-- Used on cyclopedia store summary
local function insertPlayerTransactionSummary(player, offer)
if offer.type == GameStore.OfferTypes.OFFER_TYPE_INSTANT_REWARD_ACCESS then
player:addRewardCollectionObtained(math.max(1, offer.count))
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_BLESSINGS then
player:addBlessingsObtained(offer.blessid, math.max(1, offer.count))
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HOUSE then
player:addHouseItemsObtained(offer.itemtype, math.max(1, offer.count))
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then
player:addXpBoostsObtained(1)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_PREYBONUS then
player:addPreyCardsObtained(math.max(1, offer.count))
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING then
player:addHirelingsObtained(1)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING_SKILL then
player:addHirelingJobsObtained(offer.id - HIRELING_STORAGE.SKILL)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING_OUTFIT then
player:addHirelingOutfitObtained(offer.id - HIRELING_STORAGE.OUTFIT)
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_ALLBLESSINGS then
for i = 1, 8 do
player:addBlessingsObtained(i, offer.count)
end
end
end

function parseBuyStoreOffer(playerId, msg)
local player = Player(playerId)
local id = msg:getU32()
Expand All @@ -434,13 +409,13 @@ function parseBuyStoreOffer(playerId, msg)

-- All guarding conditions under which the offer should not be processed must be included here
if
not table.contains(GameStore.OfferTypes, offer.type) -- we've got an invalid offer type
not table.contains(GameStore.OfferTypes, offer.type) -- we've got an invalid offer type
or not player
or (player:getVocation():getId() == 0) and (not GameStore.haveOfferRook(id)) -- we don't have such offer
or not offer
or (offer.type == GameStore.OfferTypes.OFFER_TYPE_NONE) -- offer is disabled
or (
offer.type ~= GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE
offer.type ~= GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_EXPBOOST
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_PREYBONUS
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_PREYSLOT
Expand All @@ -454,7 +429,7 @@ function parseBuyStoreOffer(playerId, msg)
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_HIRELING_SKILL
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_HIRELING_OUTFIT
and not offer.id
)
)
then
return queueSendStoreAlertToUser("This offer is unavailable [1]", 350, playerId, GameStore.StoreErrors.STORE_ERROR_INFORMATION)
end
Expand Down Expand Up @@ -547,7 +522,6 @@ function parseBuyStoreOffer(playerId, msg)
return queueSendStoreAlertToUser(alertMessage, 500, playerId)
end

insertPlayerTransactionSummary(player, offer)
local configure = useOfferConfigure(offer.type)
if configure ~= GameStore.ConfigureOffers.SHOW_CONFIGURE then
if not player:makeCoinTransaction(offer) then
Expand Down Expand Up @@ -657,7 +631,7 @@ function Player.canBuyOffer(self, offer)
end

if
offer.type ~= GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE
offer.type ~= GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_EXPBOOST
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_PREYSLOT
and offer.type ~= GameStore.OfferTypes.OFFER_TYPE_HUNTINGSLOT
Expand Down
2 changes: 0 additions & 2 deletions data/scripts/creaturescripts/player/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ function playerLoginGlobal.onLogin(player)
end

player:initializeLoyaltySystem()
--player:initializeTitleSystem()
--player:initializeBadgeSystem()
player:registerEvent("PlayerDeath")
player:registerEvent("DropLoot")
player:registerEvent("BossParticipation")
Expand Down
129 changes: 0 additions & 129 deletions data/scripts/lib/register_badges.lua

This file was deleted.

Loading

0 comments on commit eec389a

Please sign in to comment.