Skip to content

Commit

Permalink
synchronize lasted :D
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed Apr 24, 2024
1 parent fa81a9c commit c19103a
Show file tree
Hide file tree
Showing 37 changed files with 172 additions and 927 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ bld/
[Ll]og/
build/
vcproj/
!vcproj/canary.sln
!vcproj/canary.vcxproj
!vcproj/settings.props
!vcproj/otxserver.sln
!vcproj/otxserver.vcxproj

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down Expand Up @@ -397,4 +402,4 @@ otxserver.old
vcpkg_installed

# CLION
cmake-build-debug*
cmake-build-*
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ With downloads, support, tutorials, Lua scripts, C++ codes, PHP codes and more .
* [Tibiaking](https://tibiaking.com/) - [Português]
* [OTLand](https://otland.net/) - [English]
* [Tibia Face](https://tibiaface.foroactivo.com/) - [Español]
* [Black Tibia](https://tibiaface.foroactivo.com/) - [Español]

## Special Thanks OTServBR-Global
- our partners OTServBR-Global.
Expand All @@ -32,11 +31,10 @@ With downloads, support, tutorials, Lua scripts, C++ codes, PHP codes and more .
- [slavidodo](https://github.com/slavidodo)
- [mignari and our awesome tools](https://github.com/ottools)
- [saiyansking/optimized_forgottenserver and contributors](https://github.com/SaiyansKing/optimized_forgottenserver)
- [mattyx14/otxserver](https://github.com/mattyx14/otxserver) and contributors.
- [otland/forgottenserver](https://github.com/otland/forgottenserver) and contributors.
- if we forget someone, we apologize by forgot you. but you know, **forgot**tenserver.

## Contacts:
## Contacts OTX Server 2:
- <b>Matty(English & Spanish):</b><br>
Facebook: https://www.facebook.com/Mattyx14/<br>
E-mail: [email protected]<br>
Expand Down
4 changes: 4 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ wheelAtelierRevealGreaterCost = 6000000
familiarTime = 30

partyAutoShareExperience = true
-- partyShareRangeMultiplier: the range of the party share experience, default 3/2 (1.5)
partyShareRangeMultiplier = 1.5
partyShareLootBoosts = false
partyShareLootBoostsDimishingFactor = 0.7

Expand Down Expand Up @@ -239,6 +241,7 @@ onlyPremiumAccount = false
-- NOTE: enablePlayerPutItemInAmmoSlot = true, will enable players to put any items on ammo slot, more used in custom shopping system
-- NOTE: startStreakLevel will make a reward streak level for new players who never logged in
-- NOTE: if showLootsInBestiary is true, will cause all loots to be shown in the bestiary even if the player has not reached the required number of kills
-- NOTE: minTownIdToBankTransfer blocks towns less than defined from receiving money transfers
stashMoving = false
depotChest = 4
autoLoot = false
Expand All @@ -257,6 +260,7 @@ storeInboxMaxLimit = 2000
enablePlayerPutItemInAmmoSlot = false
startStreakLevel = 0
showLootsInBestiary = false
minTownIdToBankTransfer = 3

-- Teleport summon
-- Set to true will never remove the summon
Expand Down
3 changes: 0 additions & 3 deletions data-otxserver/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ Storage = {
-- unused ExerciseDummyExhaust = 30029,
SamsOldBackpack = 30030,
SamsOldBackpackDoor = 30031,
StrawberryCupcake = 30032,
ChayenneReward = 30033,
SwampDiggingTimeout = 30034,
HydraEggQuest = 30035,
Expand All @@ -125,8 +124,6 @@ Storage = {
Navigator = 30048,
DwarvenLegs = 30049,
PrinceDrazzakTime = 30050,
LemonCupcake = 30052,
BlueberryCupcake = 30053,
-- Reserved in Global.Storage.FamiliarSummonEvent10 = 30054
-- Reserved in Global.Storage.FamiliarSummonEvent60 = 30055
ChayenneKeyTime = 30056,
Expand Down
51 changes: 0 additions & 51 deletions data-otxserver/scripts/actions/other/cup_cakes.lua

This file was deleted.

4 changes: 2 additions & 2 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75427,7 +75427,7 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="250"/>
<attribute key="level" value="600"/>
<attribute key="mana" value="21"/>
<attribute key="unproperly" value="true"/>
<attribute key="fromDamage" value="113"/>
Expand Down Expand Up @@ -75455,7 +75455,7 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="250"/>
<attribute key="level" value="600"/>
<attribute key="mana" value="21"/>
<attribute key="unproperly" value="true"/>
<attribute key="fromDamage" value="103"/>
Expand Down
2 changes: 1 addition & 1 deletion data/modules/scripts/gamestore/gamestore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6770,7 +6770,7 @@ for k, category in ipairs(GameStore.Categories) do
offer.type = GameStore.OfferTypes.OFFER_TYPE_NONE
end
if not offer.coinType then
offer.coinType = GameStore.CoinType.Coin
offer.coinType = GameStore.CoinType.Transferable
end
end
end
Expand Down
46 changes: 25 additions & 21 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ GameStore.DefaultDescriptions = {
TEMPLE = { "Need a quick way home? Buy this transportation service to get instantly teleported to your home temple. \n\nNote, you cannot use this service while having a battle sign or a protection zone block. Further, the service will not work in no-logout zones or close to your home temple." },
}

GameStore.ItemLimit = {
PREY_WILDCARD = 50,
INSTANT_REWARD_ACCESS = 90,
EXPBOOST = 6,
HIRELING = 10,
}

--==Parsing==--
GameStore.isItsPacket = function(byte)
for k, v in pairs(GameStore.RecivedPackets) do
Expand Down Expand Up @@ -507,8 +514,8 @@ function parseBuyStoreOffer(playerId, msg)
if not pcallOk then
local alertMessage = pcallError.code and pcallError.message or "Something went wrong. Your purchase has been cancelled."

if not pcallError.code then -- unhandled error
-- log some debugging info
-- unhandled error
if not pcallError.code then
logger.warn("[parseBuyStoreOffer] - Purchase failed due to an unhandled script error. Stacktrace: {}", pcallError)
end

Expand Down Expand Up @@ -618,7 +625,6 @@ function sendOfferDescription(player, offerId, description)
end

function Player.canBuyOffer(self, offer)
local playerId = self:getId()
local disabled, disabledReason = 0, ""
if offer.disabled or not offer.type then
disabled = 1
Expand Down Expand Up @@ -697,12 +703,12 @@ function Player.canBuyOffer(self, offer)
disabledReason = "You already have this mount."
end
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_INSTANT_REWARD_ACCESS then
if self:getCollectionTokens() >= 90 then
if self:getCollectionTokens() >= GameStore.ItemLimit.INSTANT_REWARD_ACCESS then
disabled = 1
disabledReason = "You already have maximum of reward tokens."
end
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_PREYBONUS then
if self:getPreyCards() >= 50 then
if self:getPreyCards() >= GameStore.ItemLimit.PREY_WILDCARD then
disabled = 1
disabledReason = "You already have maximum of prey wildcards."
end
Expand All @@ -722,7 +728,7 @@ 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) == 6 then
if self:getStorageValue(GameStore.Storages.expBoostCount) == GameStore.ItemLimit.EXPBOOST then
disabled = 1
disabledReason = "You can't buy XP Boost for today."
end
Expand All @@ -731,7 +737,7 @@ function Player.canBuyOffer(self, offer)
disabledReason = "You already have an active XP boost."
end
elseif offer.type == GameStore.OfferTypes.OFFER_TYPE_HIRELING then
if self:getHirelingsCount() >= 10 then
if self:getHirelingsCount() >= GameStore.ItemLimit.HIRELING then
disabled = 1
disabledReason = "You already have bought the maximum number of allowed hirelings."
end
Expand Down Expand Up @@ -1565,8 +1571,9 @@ function GameStore.processAllBlessingsPurchase(player, count)
end

function GameStore.processInstantRewardAccess(player, offerCount)
if player:getCollectionTokens() + offerCount >= 91 then
return error({ code = 1, message = "You cannot own more than 90 reward tokens." })
local limit = GameStore.ItemLimit.INSTANT_REWARD_ACCESS
if player:getCollectionTokens() + offerCount >= limit + 1 then
return error({ code = 1, message = "You cannot own more than " .. limit .. " reward tokens." })
end
player:setCollectionTokens(player:getCollectionTokens() + offerCount)
end
Expand Down Expand Up @@ -1641,7 +1648,6 @@ function GameStore.processHouseRelatedPurchase(player, offer)
decoKit:setAttribute(ITEM_ATTRIBUTE_STORE, systemTime())
end
end
player:sendUpdateContainer(inbox)
else
for i = 1, offer.count do
local decoKit = inbox:addItem(ITEM_DECORATION_KIT, 1)
Expand All @@ -1653,10 +1659,10 @@ function GameStore.processHouseRelatedPurchase(player, offer)
decoKit:setAttribute(ITEM_ATTRIBUTE_STORE, systemTime())
end
end
player:sendUpdateContainer(inbox)
end
end
end
player:sendUpdateContainer(inbox)
end
end

Expand All @@ -1677,11 +1683,7 @@ function GameStore.processOutfitPurchase(player, offerSexIdTable, addon)
elseif player:hasOutfit(looktype, _addon) then
return error({ code = 0, message = "You already own this outfit." })
else
if
not (player:addOutfitAddon(looktype, _addon)) -- TFS call failed
or (not player:hasOutfit(looktype, _addon)) -- Additional check; if the looktype doesn't match player sex for example,
-- then the TFS check will still pass... bug? (TODO)
then
if not player:addOutfitAddon(looktype, _addon) or not player:hasOutfit(looktype, _addon) then
error({ code = 0, message = "There has been an issue with your outfit purchase. Your purchase has been cancelled." })
else
player:addOutfitAddon(offerSexIdTable.male, _addon)
Expand Down Expand Up @@ -1769,8 +1771,9 @@ function GameStore.processTaskHuntingThirdSlot(player)
end

function GameStore.processPreyBonusReroll(player, offerCount)
if player:getPreyCards() + offerCount >= 51 then
return error({ code = 1, message = "You cannot own more than 50 prey wildcards." })
local limit = GameStore.ItemLimit.PREY_WILDCARD
if player:getPreyCards() + offerCount >= limit + 1 then
return error({ code = 1, message = "You cannot own more than " .. limit .. " prey wildcards." })
end
player:addPreyCards(offerCount)
end
Expand Down Expand Up @@ -1812,8 +1815,8 @@ function GameStore.processHirelingPurchase(player, offer, productType, hirelingN
return addPlayerEvent(sendStorePurchaseSuccessful, 650, player:getId(), message)
-- If not, we ask him to do!
else
if player:getHirelingsCount() >= 10 then
return error({ code = 1, message = "You cannot have more than 10 hirelings." })
if player:getHirelingsCount() >= GameStore.ItemLimit.HIRELING then
return error({ code = 1, message = "You cannot have more than " .. GameStore.ItemLimit.HIRELING .. " hirelings." })
end
-- TODO: Use the correct dialog (byte 0xDB) on client 1205+
-- for compatibility, request name using the change name dialog
Expand Down Expand Up @@ -2219,7 +2222,8 @@ function sendHomePage(playerId)
msg:sendToPlayer(player)
end

function Player:openStore(serviceName) --exporting the method so other scripts can use to open store
--exporting the method so other scripts can use to open store
function Player:openStore(serviceName)
local playerId = self:getId()
openStore(playerId)

Expand Down
18 changes: 18 additions & 0 deletions data/scripts/actions/items/blueberry_cupcake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local blueberryCupcake = Action()

function blueberryCupcake.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("blueberry-cupcake-cooldown") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait before using it again.")
return true
end

player:addMana(player:getMaxMana())
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your mana has been refilled.")
player:say("Mmmm.", TALKTYPE_MONSTER_SAY)
player:setExhaustion("blueberry-cupcake-cooldown", 10 * 60)
item:remove(1)
return true
end

blueberryCupcake:id(28484)
blueberryCupcake:register()
24 changes: 24 additions & 0 deletions data/scripts/actions/items/lemon_cupcake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local distanceCondition = Condition(CONDITION_ATTRIBUTES)
distanceCondition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
distanceCondition:setParameter(CONDITION_PARAM_TICKS, 60 * 60 * 1000)
distanceCondition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 10)
distanceCondition:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local lemonCupcake = Action()

function lemonCupcake.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("lemon-cupcake-cooldown") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait before using it again.")
return true
end

player:addCondition(distanceCondition)
player:sendTextMessage(MESSAGE_FAILURE, "You feel more focused.")
player:say("Mmmm.", TALKTYPE_MONSTER_SAY)
player:setExhaustion("lemon-cupcake-cooldown", 10 * 60)
item:remove(1)
return true
end

lemonCupcake:id(28486)
lemonCupcake:register()
11 changes: 7 additions & 4 deletions data/scripts/actions/items/potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ function flaskPotion.onUse(player, item, fromPosition, target, toPosition, isHot
local deactivatedFlasks = player:kv():get("talkaction.potions.flask") or false
if not deactivatedFlasks then
local container = Container(item:getParent().uid)
local inbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)

if fromPosition.x == CONTAINER_POSITION and container ~= inbox and container:getEmptySlots() ~= 0 then
container:addItem(potion.flask, 1)
if container then
local storeInbox = player:getSlotItem(CONST_SLOT_STORE_INBOX)
if fromPosition.x == CONTAINER_POSITION and container ~= storeInbox and container:getEmptySlots() ~= 0 then
container:addItem(potion.flask, 1)
else
player:addItem(potion.flask, 1)
end
else
Game.createItem(potion.flask, 1, fromPosition)
end
Expand Down
18 changes: 18 additions & 0 deletions data/scripts/actions/items/strawberry_cupcake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local strawberryCupcake = Action()

function strawberryCupcake.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:hasExhaustion("strawberry-cupcake-cooldown") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait before using it again.")
return true
end

player:addHealth(player:getMaxHealth())
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your health has been refilled.")
player:say("Mmmm.", TALKTYPE_MONSTER_SAY)
player:setExhaustion("strawberry-cupcake-cooldown", 10 * 60)
item:remove(1)
return true
end

strawberryCupcake:id(28485)
strawberryCupcake:register()
Loading

0 comments on commit c19103a

Please sign in to comment.