Skip to content
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
498228c
Update login.lua
LeoTKBR Oct 4, 2023
e492edf
Create autosync.yml
LeoTKBR Nov 1, 2023
b312e75
Update autosync.yml
LeoTKBR Nov 1, 2023
13c7799
Update autosync.yml
LeoTKBR Nov 1, 2023
abcc3a2
Update autosync.yml
LeoTKBR Nov 1, 2023
a383e95
Update autosync.yml
LeoTKBR Nov 1, 2023
e0b9d70
Update autosync.yml
LeoTKBR Nov 1, 2023
467fe4e
Update autosync.yml
LeoTKBR Nov 1, 2023
ae7e3ec
Update autosync.yml
LeoTKBR Nov 1, 2023
40f9d9e
Update autosync.yml
LeoTKBR Nov 1, 2023
430c489
Update autosync.yml
LeoTKBR Nov 1, 2023
965160d
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 4, 2023
708239f
Update autosync.yml
LeoTKBR Nov 4, 2023
203fa21
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 4, 2023
6927683
Merge branch 'main' of https://github.com/LeoTKBR/canary
LeoTKBR Nov 5, 2023
6dbe8ea
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 7, 2023
bfaef08
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 9, 2023
eabbcc5
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 16, 2023
61541d4
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 19, 2023
82c3ebf
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 23, 2023
67f7a9a
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 30, 2023
65f4896
Merge branch 'opentibiabr:main' into main
LeoTKBR Dec 5, 2023
45c764f
Merge branch 'opentibiabr:main' into main
LeoTKBR Sep 17, 2024
9c2f4db
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 7, 2024
d35e4a8
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 21, 2024
691870f
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 22, 2024
325a906
Merge branch 'opentibiabr:main' into main
LeoTKBR Mar 28, 2025
29bc04c
#Remove autosync
LeoTKBR Mar 28, 2025
92eb12a
Merge branch 'opentibiabr:main' into main
LeoTKBR May 1, 2025
cb4565b
Fix Gamestore Exploit
LeoTKBR May 6, 2025
89d4e29
Lua code format - (Stylua)
github-actions[bot] May 6, 2025
03432cb
Fix offer.Type to offer.type
LeoTKBR May 14, 2025
91b4a09
fix: makecointransaction checkboost
LeoTKBR May 25, 2025
7b14900
Update data/modules/scripts/gamestore/init.lua
LeoTKBR Jul 6, 2025
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
67 changes: 37 additions & 30 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ GameStore.CoinType = {
Transferable = 1,
}

GameStore.Storages = {
expBoostCount = 51052,
GameStore.Kv = {
expBoostCount = "exp-boost-count",
purchaseCooldown = "purchase-cooldown",
}

GameStore.ConverType = {
Expand Down Expand Up @@ -419,6 +420,18 @@ function parseBuyStoreOffer(playerId, msg)
return false
end

-- Cooldown Purchase
local playerKV = player:kv()
local purchaseCooldown = playerKV:get(GameStore.Kv.purchaseCooldown) or 0
local currentTime = os.time()
local waittime = purchaseCooldown - currentTime
if waittime > 0 then
queueSendStoreAlertToUser("You are making many purchases simultaneously in a few moments.", 250, playerId)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are making many purchases simultaneously in a few moments.")
return false
end
playerKV:set(GameStore.Kv.purchaseCooldown, os.time() + 5)

-- 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
Expand Down Expand Up @@ -447,7 +460,8 @@ function parseBuyStoreOffer(playerId, msg)
end

-- At this point the purchase is assumed to be formatted correctly
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or offer.price
local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or offer.price
local offerCoinType = offer.coinType
if offer.type == GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE and player:kv():get("namelock") then
offerPrice = 0
Expand Down Expand Up @@ -751,7 +765,9 @@ function Player.canBuyOffer(self, offer)
disabledReason = "You already have 3 slots released."
end
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then
if self:getStorageValue(GameStore.Storages.expBoostCount) == GameStore.ItemLimit.EXPBOOST then
local playerKV = self:kv()
local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0
if purchaseExpCount == GameStore.ItemLimit.EXPBOOST then
disabled = 1
disabledReason = "You can't buy XP Boost for today."
end
Expand Down Expand Up @@ -922,7 +938,9 @@ function sendShowStoreOffers(playerId, category, redirectId)
for _, off in ipairs(offer.offers) do
xpBoostPrice = nil
if offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST then
xpBoostPrice = GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)]
local playerKV = player:kv()
local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0
xpBoostPrice = GameStore.ExpBoostValues[purchaseExpCount]
end

nameLockPrice = nil
Expand Down Expand Up @@ -1076,7 +1094,9 @@ function sendShowStoreOffersOnOldProtocol(playerId, category)
end

local disabled, disabledReason = player:canBuyOffer(offer).disabled, player:canBuyOffer(offer).disabledReason
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or (newPrice or offer.price or 0xFFFF)
local playerKV = player:kv()
local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or (newPrice or offer.price or 0xFFFF)
msg:addU32(offer.id and offer.id or 0xFFFF)
msg:addString(name, "sendShowStoreOffersOnOldProtocol - name")
msg:addString(offer.description or GameStore.getDefaultDescription(offer.type, offer.count), "sendShowStoreOffersOnOldProtocol - offer.description or GameStore.getDefaultDescription(offer.type, offer.count)")
Expand Down Expand Up @@ -1774,13 +1794,8 @@ end

function GameStore.processExpBoostPurchase(player)
local currentXpBoostTime = player:getXpBoostTime()
local expBoostCount = player:getStorageValue(GameStore.Storages.expBoostCount)
player:setXpBoostPercent(50)
player:setXpBoostTime(currentXpBoostTime + 3600)

if expBoostCount == -1 or expBoostCount == 0 or expBoostCount > 5 then
expBoostCount = 1
end
end

function GameStore.processPreyThirdSlot(player)
Expand Down Expand Up @@ -2062,26 +2077,16 @@ function Player.makeCoinTransaction(self, offer, desc)
desc = offer.name
end

if offer.Type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST or GameStore.OfferTypes.OFFER_TYPE_EXPBOOSTCUSTOM then
local expBoostCount = self:getStorageValue(GameStore.Storages.expBoostCount)

if expBoostCount == -1 or expBoostCount == 0 or expBoostCount > 5 then
local isExpBoost = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST
if isExpBoost then
local playerKV = self:kv()
local expBoostCount = tonumber(playerKV:get(GameStore.Kv.expBoostCount)) or 0
if expBoostCount <= 0 or expBoostCount > 5 then
expBoostCount = 1
end
if expBoostCount <= 1 then
offer.price = GameStore.ExpBoostValues[1]
elseif expBoostCount == 2 then
offer.price = GameStore.ExpBoostValues[2]
elseif expBoostCount == 3 then
offer.price = GameStore.ExpBoostValues[3]
elseif expBoostCount == 4 then
offer.price = GameStore.ExpBoostValues[4]
elseif expBoostCount == 5 then
offer.price = GameStore.ExpBoostValues[5]
else
offer.price = offer.price
end
self:setStorageValue(GameStore.Storages.expBoostCount, expBoostCount + 1)
local priceTable = isExpBoost and GameStore.ExpBoostValues or GameStore.ExpBoostValuesCustom
offer.price = priceTable[expBoostCount] or priceTable[1]
playerKV:set(GameStore.Kv.expBoostCount, expBoostCount + 1)
end

if offer.coinType == GameStore.CoinType.Coin and self:canRemoveCoins(offer.price) then
Expand Down Expand Up @@ -2205,7 +2210,9 @@ function sendHomePage(playerId)

msg:addU16(#homeOffers) -- offers
for p, offer in pairs(homeOffers) do
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[player:getStorageValue(GameStore.Storages.expBoostCount)] or offer.price
local playerKV = player:kv()
local purchaseExpCount = playerKV:get(GameStore.Kv.expBoostCount) or 0
local offerPrice = offer.type == GameStore.OfferTypes.OFFER_TYPE_EXPBOOST and GameStore.ExpBoostValues[purchaseExpCount] or offer.price
if offer.type == GameStore.OfferTypes.OFFER_TYPE_NAMECHANGE and player:kv():get("namelock") then
offerPrice = 0
end
Expand Down