Commit graph

66 commits

Author SHA1 Message Date
Eduardo Dantas
61d0b6e9db
refactor: add gamestore catalog modules (#3738)
This refactors a comprehensive set of modules for the GameStore system,
including constants, helpers, and parsers. The changes establish a
robust foundation for handling store offers, user actions, and
transactions in a modular and maintainable way. The most important
changes are the addition of a detailed constants file, helper functions
for offer handling, and a parser module that manages all store-related
protocol events and purchase logic.

**GameStore System Foundation**

* Added a new `gamestore.constants.lua` file containing all core
constants for the GameStore, such as offer types, sub-actions, action
types, coin types, error codes, packet codes, default values,
descriptions, and item limits. This centralizes configuration and
improves maintainability.

**Helper Functions**

* Introduced `gamestore.helpers.lua` with utility functions for
converting offer types to display types and determining if an offer
requires configuration, improving code reuse and clarity in offer
handling.

**Store Event and Purchase Parsing**

* Added `gamestore.parsers.lua` which handles all GameStore protocol
events, including opening the store, searching offers, buying offers,
transferring coins, and transaction history. This module coordinates
with helpers and senders to process requests and responses, including
error handling and purchase validation.

These changes collectively lay out the structure for a feature-rich,
extensible GameStore system, making future enhancements and debugging
easier.

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-06 12:33:07 -03:00
André Morais
6f47dfa5dd
fix: buy all regular blessings (#3722)
Refined the logic for purchasing all blessings in the game store,
ensuring that players cannot exceed the maximum blessing count and that
purchases correctly handle partial blessing states. The changes focus on
improving the validation and processing of the "All Blessings" offer to
prevent over-purchasing and to handle edge cases where some blessings
are already at their maximum.

Blessing purchase logic improvements:

- Updated the validation in `Player.canBuyOffer` to check blessings 2
through 8 for maximum count before disabling the "All Blessings" offer,
ensuring players can only buy it if at least one blessing is not maxed.
- Refactored `GameStore.processAllBlessingsPurchase` to add only the
necessary amount of each blessing, respecting the maximum count per
blessing and handling cases where some blessings are already partially
acquired.
2025-10-20 14:58:08 -03:00
Victor
56bd20bb84
feature: gamestore 'new' flag in home offers (#3704)
Fix gamestore homepage offer state display inconsistency by implementing proper state validation logic in sendHomePage() function. This change aligns the homepage behavior with other gamestore functions that already implement correct offer state handling.

Co-authored-by: Madara <158350170+caiozord@users.noreply.github.com>
2025-09-19 14:56:22 -03:00
LeoTK
0d253f8330
fix: gamestore exploit (#3515)
Fixed the exploit when holding enter and clicking the buy button multiple times, buying the same item multiple times even though it was charged for each purchase, this was used to stock up on many exp buffs.
2025-07-06 18:45:47 -03:00
LeoTK
b0a6920027
fix: check value purchase exp boost (#3501)
Related to pr: https://github.com/opentibiabr/canary/pull/3496
2025-04-22 22:59:50 -03:00
LeoTK
f9322d2588
fix: gamestore exp price (#3496)
By making this modification it will work and visually the correct amount
of expboost will be charged.
2025-04-22 11:48:36 -03:00
pudimtibia
4023def380
fix: adjust character limit for player names (#3174) 2024-12-31 13:31:56 -03:00
Elson Costa
3aeb3e75d5
feat: cyclopedia improvements (#2629) 2024-07-05 17:44:53 -03:00
Eduardo Dantas
d3ddea0b03
fix: gamestore nil player (#2715)
Related to #2694
2024-06-27 13:58:25 -03:00
Eduardo Dantas
4af5b2dc18
fix: store UI exhaustion and improve bosslever messages (#2694)
Fixed the store exhaustion to work correctly.

Fixed the boss lever messages to better inform the participants.
2024-06-15 00:14:03 -03:00
Luan Luciano
7c9b8d54fb
fix: xp boost time granted by reward daily (#2586) 2024-04-29 12:39:56 -03:00
Mirkaan
a820101006
fix: typo in gamestore function and remove cooldown for item usage while walking (#2485) 2024-04-26 09:34:58 -03:00
Elson Costa
3fcf585600
fix: improves on gamestore, fix on gitignore and items (#2415) 2024-04-23 09:07:35 -03:00
Luan Luciano
167bae5c75
fix: problem with casks items in the charge loop and adjustment without code (#2505) 2024-04-04 11:48:45 -03:00
Elson Costa
e9e99675c6
fix: global server save and expBoostCount improvements (#2449) 2024-03-18 14:45:11 -03:00
LeoTK
28463c125d
fix: adjustments when purchasing household items (#1940) 2024-02-29 12:34:38 -03:00
Nyel
bbb8e4a97e
fix: gamestore task hunting third slot (#2250)
Fix permanent hunting task slot.
Fixes #2237
2024-02-17 03:18:10 +00:00
Elson Costa
d11856992c
fix: gamestore buy stackable items (#2201)
# Description

- Fixed stackable items in store;
- Created script to remove empty parcels from the store inbox on login.

---------

Co-authored-by: Luan Luciano <luanluciano@outlook.com>
2024-02-14 20:21:13 +00:00
Eduardo Dantas
428acba84d
fix: store related errors (#2154)
Resolves #2153

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Elson Costa <elsongabriel@hotmail.com>
2024-02-05 14:00:08 +00:00
Eduardo Dantas
e44bd199aa
fix: check store inbox max capacity (#2109)
Resolves #2108
2024-01-17 05:01:56 +00:00
Luan Santos
2874951925
mv: moveable -> movable (#2067)
Just to achieve consistency in the codebase and use the same (more
modern) spelling of the word "movable".
2023-12-30 08:04:58 +00:00
Luan Santos
fb4338c399
feat: item ownership (#2003)
This add the ability to set ownership on items. An owned item cannot be
picked up or used by anyone except the character that owns it.

If an owned item is inside a container (backpack, etc) that container is
now also treated as owned. "looking" at an owned item shows you the
owner.

New function:
- `item:setOwner(ownerPlayer or id)`
- `item:getOwnerId()`
- `item:getOwnerName()`
- `item:hasOwner()`
- `item:canBeMoved()`

I also sneaked in some other unrelated improvements that didn't fit any
individual PR in here, but the are pretty small.

---------

Co-authored-by: Eduardo Dantas <eduardo.dantas@hotmail.com.br>
2023-12-28 19:27:17 +00:00
Luan Santos
cb60cda5fa
feat: namelocks (#2005)
Adds a `/namelock` command to help you ax those offensive names from
your server.
It works by providing the player with a "free" mandatory name change
upon login.

---------

Co-authored-by: Elson Costa <elsongabriel@hotmail.com>
2023-12-28 10:11:05 -08:00
Elson Costa
2f54ccf207
fix: max limit of character name (#2035)
It was increased to the max limit of character name. (can use exiva and other spells and remover to update in config.php of AAC).
2023-12-18 09:07:42 -03:00
Luan Luciano
e5bd83a669
improve: add context parameter to addString() (#1826)
Make the debug message: "[NetworkMessage::addString] - Value string is
empty" less vague by adding a context parameter to it.

-  addString(value, function)
2023-12-09 11:27:40 -08:00
Eduardo Dantas
c18bf44cc8
improve: migrate hireling skills and outfits to kv system (#1935)
Resolves #1926 

Addressed a conflict between hireling system and gamestore subaction IDs, which led to occasional loss of offers and inconvenienced players who had to repurchase the offers. To resolve this issue, we increased the IDs to larger numbers and conducted a minor system overhaul. This involved transitioning to the use of Key-Value (KV) storage, removing obsolete cache code, and enhancing system clarity and performance for a smoother player experience.

Co-authored-by: Luan Santos <git@luan.sh>
2023-12-02 15:21:30 -03:00
Eduardo Dantas
f4bb861a54
fix: invalid mount offer from store (#1933)
Fixes bug introduced from #1821 

A mount was added that does not yet exist in appearances, until we add a new dat, we will just ignore their existence.
Removed invalid mounts.
2023-11-28 14:33:17 -03:00
Elson Costa
83a823f3e2
fix: some scripts (#1821)
Continues fixing of #1784 and #1847 

• Improved message on exercise_training.
• Fixes reward charges.
• Created flag in prison bosses' scripts to enable minus players and removed already created functions.
• Removed create torch when player login.
• Fixes in 'clearBossRoom' function usage on bosses teleports.
• Fixed count days and time on ferumbras_lever and fixed mechanic of Ascending Ferumbras boss.
• Fixed xp boost storage resetter (on very ss, the storage was being presented, and the player always buy it with 30 tc).
• Added 13.21 new mounts, reordered and fixed typos, changed the word moveable to movable.
• Removed unnecessary spaces.
2023-11-28 04:37:58 -03:00
Luan Luciano
9dc47c0299
fix: resolved problem with non-existent store condition (#1827)
Resolves #1824
2023-11-15 12:48:04 -03:00
Elson Costa
f7271db119
fix: some scripts (#1784)
Continues fixing of #1741

• Created a function to check time in levers and changed with `creature:getStorageValue(config.storage) > os.time()`;
• Adjusted save_interval messages.
• Added check to show msg with payment information when traveling as free.
• Fixed loot to custodian.
• Fixed some typos.
• Adjusted reward talkaction, to check cap.
• Fixed adventurer's stone usage.
• Added messages when starting or stopping using exercise weapons.
• Fixed some events of bosses.
2023-11-13 13:48:11 -03:00
Leonardo Antelmi
a828a75cab
fix: home offers linking correctly (#1723)
Fixing the offers in home page of store, linking correctly to open the selected offer
2023-10-20 21:25:41 -03:00
Eduardo Dantas
870bbed47d
fix: house transfer owner only in startup (#1621)
The transfer of houses is now permitted only during server restarts to
prevent server freezing when moving items to the depot. While this is
not the most sophisticated solution, it's the simplest and least
error-prone due to the base's complexity. This approach mirrors what
CipSoft employs in the global version of Tibia and effectively addresses
the issue without introducing possible new bugs.

Additional updates include modifications to NPCs to sell the new kit,
which displays the item's sprite in the wrap container. Support for
using old kits remains, allowing players to convert them into new ones.

Unrelated changes affecting houses:
• Purchasing a house with items still inside is no longer possible. This
prevents issues in rare scenarios, such as incomplete item transfers due
to console closure.
• Introduced an "all" parameter to the "/r" command for removing all
items from a tile.
• Removed the "allowpickUpAble" tags from ground/border and derived
items. These were initially implemented to enable item "throwing" onto
tiles. Now, an item can be thrown only if its type is "trashholder,"
fulfilling the same purpose. This change was made because the check for
items inside the house before purchasing relies on the "pickupable" tag,
which is not applicable to tiles and derivatives.
2023-09-23 14:54:14 -07:00
Eduardo Dantas
4275713ea0
feat: protocol 13.21 (#1523)
New features:
• StoreInbox pagination
• StoreInbox showing items inside wrap container
• StoreInbox (containers) filters.

Clients for tests:
https://github.com/dudantas/tibia-client/releases/tag/13.21.13839

Assets editor: https://github.com/Arch-Mina/Assets-Editor/pull/7

Thanks, @marcosvf132, for providing bytes.

Co-authored-by: Luan Santos <github@luan.sh>
2023-09-12 00:21:00 -03:00
Luan Santos
5549d87f9d
improve: switch to Stylua formatter (#1582)
Stylua is easier to configure than what we had before, since it's
already available as a code action. It also parses the code while it
formats which will help catch syntax errors on PRs automatically.
2023-09-10 10:17:19 -07:00
Luan Santos
cacb7c6827
fix: store xp and gold pouch (#1583) 2023-09-10 08:17:19 -07:00
Luan Santos
3d21c8cc5f
fix: add missing offer type to store (#1570) 2023-09-05 13:13:04 -07:00
Luan Santos
f14154fc42
feat: many, many variety datapack improvements (#1551)
Hard one to describe because it's a lot of datapack changes bundle
together. Non-exhaustive list:
- Fixed a bunch of small quest details that prevented them for being
completable
- Fixes a few raid locations
- Added a new NPC "Battlemart" that can be used a refiller NPC
- Adjusted spawn densities in some spawns
- Fixed a few details with certain spells
2023-09-04 08:51:31 -07:00
Luan Santos
03f065d689
improve: lua format from EmmyLuaCodeStyle (#1513)
Credits: @elsongabriel

---------

Co-authored-by: Elson Gabriel <elsongabriel@hotmail.com>
2023-08-27 10:49:56 -07:00
Eduardo Dantas
96adc6a4f3 improve: change all "Spdlog" to new "logger" using braces
Updated logging from 'Spdlog' to 'logger', and shifted some log information to debug level for a cleaner server console.
2023-08-21 19:52:52 -03:00
Luan Santos
b566ed47b6
feat: game store search (#1356) 2023-08-07 20:22:02 -03:00
Elson Costa
88b08ad04c
feat: vip system (#1063)
Created vip system functionality with some validations and improvements:
• Adjusted store checking to sell VIP or premium;
• Created configs and scripts;
• Fixed and created validation to auto-loot flag enabled by each player.

Features (Vip Accounts):
• Gain more XP
• Gain more loot
• Gain more skill
• Gain coins to be online
• Gain tokens (customized) to be online
• Toggle auto-loot exclusive
• Reduce familiar cooldown time
2023-07-29 02:25:14 -03:00
Luan Santos
72be9ccf27
feat: new beds behavior (#1291)
This is #235 re-done on top of main. Added all beds to store/npc appropriately and pulled number of beds info from Tibia.com (via tibiadata api)
2023-07-28 02:55:07 -03:00
Eduardo Dantas
50cb4b5308
fix: coins transaction from store and market (#1134)
• Corrected the behaviour of coins to ensure they function properly. In the market, only transferable coins will be deducted. 
• In the store, non-transferable coins will be used first, followed by transferable ones.
• Resolved issues with coins in client version 11.00.
• Fixed several typographical errors.
• Replaced coin management in Lua with C++ functions to eliminate the need for direct SQL queries in Lua scripts.
2023-05-27 13:58:22 -03:00
Elson Costa
1c159a6ffc
fix: gamestore init and others improvements (#1115) 2023-05-21 14:05:44 -03:00
Karin
15bfb0ad19
feat: transferable coins system (#1096)
Transferable coins feature.
2023-05-20 16:26:33 -03:00
Majesty
ad9e20f119
feat: update gamestore offers (#1085)
• Offers arranged in alphabetical order.
• New offers added.
2023-05-20 16:24:32 -03:00
Marcos
46d1080b6d
feat: multiprotocol compatibility with client 11.00 (10x) (#516)
This adds support for the Tibia client 10x, which connects directly to the server without the need for an AAC login. No changes are required on the AAC side, and you can continue to use the acc/login.php endpoint for the client 11+.

To use the client 10x, simply set the tag "allowOldProtocol" to true or false in the config.lua file. You can only log in using your account name on client 10x, and only using your email on client 11+.

Please note that you will need to update the client 10x to your server's sprites/items data. You can download the client 10x from this link: https://github.com/dudantas/tibia-client/releases/download/13.16.13209/client-10x-outdated-11.00.zip.

For update your .spr and .dat can use the SpiderClientConverter: https://github.com/Arch-Mina/ClientConverter
2023-04-28 12:40:20 -07:00
Marcos
6b644a520e
feat: protocol update to 13.16 (#1010)
This changes only includes the protocol update up to 13.16. For the changes related to the features, please check PR #531 
Disclaimer: this changes removes tournament system and coins completely since Cipsoft removed it from their client, no way back.

Client for login: https://github.com/dudantas/tibia-client/releases/tag/13.16.13209
Client notes:
• Use the client "client-127.0.0.1-13.16.13209" to test local, it already uses the OpenTibia RSA key and the local ip.
• Place the files "cache/eventscheduler.json" and "cache/boostedcreature.json" as read-only for the correct functioning of the systems by the server.
2023-04-24 22:28:30 -07:00
Eduardo Dantas
84f99ba7ab
fix: gamestore exhaustion (#1008)
Exhaustion in all actions, as some other buttons generate a large load of information, such as "parseRequestStoreOffers", thus preventing someone from abusing this to generate a freeze on the server.
2023-04-24 19:09:17 -07:00
duuh30
b73486b1a6
improve: inbox items can't be moved (#983)
By default, all items purchased from the store and sent to the store inbox are marked with ATTR_STORE_ITEM except if you mark the offer as moveable = true

Here is an example of an offer in the store that will be "moveable" from the store inbox (read pull request description for more information).

The behaviour of items purchased through the store will now be the same as in real tibia.
2023-04-23 18:00:10 -07:00