Skip to content

Commit

Permalink
feat: fragment workshop (opentibiabr#3008)
Browse files Browse the repository at this point in the history
Implemented wheel gem fragment workshop functionality and added Crusher actions

• Added system to improve gems, including the use of Crushers and Amber Crushers.
• Enabled NPC sales of Crushers and Amber Crushers.
• Optimized code by replacing some includes with forward declarations in wheel of destiny files.
• Ensured functionality aligns with expectations, allowing gem improvements, breaking, and correct bonus applications.
• Fixed opentibiabr#2861 by introducing new feature for gem handling.
• Thoroughly tested gem reveal, improvement, and the durability mechanics of Crushers.

---------
Co-authored-by: LuN [email protected]
Co-authored-by: Omega [email protected]
  • Loading branch information
phacUFPE authored Oct 29, 2024
1 parent 9c4b134 commit d6c5ec3
Show file tree
Hide file tree
Showing 35 changed files with 981 additions and 406 deletions.
1 change: 1 addition & 0 deletions data-otservbr-global/npc/ahmet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ npcConfig.shop = { -- Sellable items
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "deed of ownership", clientId = 7866, buy = 1000 },
{ itemName = "document", clientId = 2818, buy = 12 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/asphota.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "hand auger", clientId = 31334, buy = 25 },
{ itemName = "inkwell", clientId = 3509, sell = 8 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/bashira.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/beatrice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "hand auger", clientId = 31334, buy = 25 },
{ itemName = "inkwell", clientId = 3509, sell = 8 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/bertha.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2884, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/bezil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 40, sell = 40 },
{ itemName = "grey backpack", clientId = 2870, buy = 10 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/gladys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "fox paw", clientId = 27462, sell = 100 },
{ itemName = "fur armor", clientId = 22085, sell = 5000 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/gorn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2884, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/gree_dee.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "deed of ownership", clientId = 7866, buy = 1000 },
{ itemName = "document", clientId = 2818, buy = 12 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/halif.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 40, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/lubo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "hand auger", clientId = 31334, buy = 25 },
{ itemName = "machete", clientId = 3308, buy = 35, sell = 6 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/maro.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ npcConfig.shop = {
{ itemName = "cleaver", clientId = 3471, buy = 15 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "fork", clientId = 3467, buy = 10 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/maun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ npcConfig.shop = {
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crossbow", clientId = 3349, buy = 500, sell = 120 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "crystalline arrow", clientId = 15793, buy = 20 },
{ itemName = "desintegrate rune", clientId = 3197, buy = 26 },
{ itemName = "diamond arrow", clientId = 35901, buy = 100 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/nezil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 40, sell = 40 },
{ itemName = "grey backpack", clientId = 2870, buy = 10 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/perod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ npcConfig.shop = {
{ itemName = "closed trap", clientId = 3481, buy = 280 },
{ itemName = "crossbow", clientId = 3349, buy = 500, sell = 500 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "crystalline arrow", clientId = 15793, buy = 20 },
{ itemName = "cup", clientId = 2884, buy = 2 },
{ itemName = "diamond arrow", clientId = 35901, buy = 100 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/red_lilly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/rock_in_a_hard_place.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ local itemsTable = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "deepling axe", clientId = 13991, sell = 40000 },
{ itemName = "deepling squelcher", clientId = 14250, sell = 7000 },
{ itemName = "deepling staff", clientId = 13987, sell = 4000 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/sarina.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2881, buy = 3 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/shiantis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ npcConfig.shop = {
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "coal basin kit", clientId = 3513, buy = 25 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cuckoo clock", clientId = 2664, buy = 40 },
{ itemName = "document", clientId = 2834, buy = 12 },
{ itemName = "empty goldfish bowl", clientId = 5928, buy = 50 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/timur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ npcConfig.shop = {
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crossbow", clientId = 3349, sell = 160 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
{ itemName = "hand auger", clientId = 31334, buy = 25 },
Expand Down
1 change: 1 addition & 0 deletions data-otservbr-global/npc/zora.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ npcConfig.shop = {
{ itemName = "candlestick", clientId = 2917, buy = 2 },
{ itemName = "closed trap", clientId = 3481, buy = 280, sell = 75 },
{ itemName = "crowbar", clientId = 3304, buy = 260, sell = 50 },
{ itemName = "crusher", clientId = 46627, buy = 500 },
{ itemName = "cup", clientId = 2884, buy = 2 },
{ itemName = "document", clientId = 2818, buy = 12 },
{ itemName = "fishing rod", clientId = 3483, buy = 150, sell = 40 },
Expand Down
10 changes: 10 additions & 0 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76351,5 +76351,15 @@ Granted by TibiaGoals.com"/>
<attribute key="containersize" value="10"/>
<attribute key="decayTo" value="0"/>
</item>
<item id="46627" article="a" name="crusher">
<attribute key="loottype" value="tools"/>
<attribute key="showCharges" value="1"/>
<attribute key="charges" value="10"/>
<attribute key="weight" value="30"/>
</item>
<item id="46628" article="a" name="amber crusher">
<attribute key="loottype" value="tools"/>
<attribute key="weight" value="30"/>
</item>
</items>

11 changes: 7 additions & 4 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "creatures/monsters/monsters.hpp"
#include "creatures/players/player.hpp"
#include "creatures/players/wheel/player_wheel.hpp"
#include "creatures/players/wheel/wheel_gems.hpp"
#include "creatures/players/achievement/player_achievement.hpp"
#include "creatures/players/cyclopedia/player_badge.hpp"
#include "creatures/players/cyclopedia/player_cyclopedia.hpp"
Expand Down Expand Up @@ -5385,7 +5386,7 @@ uint32_t Player::getCapacity() const {
} else if (hasFlag(PlayerFlags_t::HasInfiniteCapacity)) {
return std::numeric_limits<uint32_t>::max();
}
return capacity + bonusCapacity + varStats[STAT_CAPACITY] + m_wheelPlayer->getStat(WheelStat_t::CAPACITY);
return capacity + bonusCapacity + varStats[STAT_CAPACITY] + (m_wheelPlayer->getStat(WheelStat_t::CAPACITY) * 100);
}

int32_t Player::getMaxHealth() const {
Expand Down Expand Up @@ -6716,11 +6717,13 @@ bool Player::isCreatureUnlockedOnTaskHunting(const std::shared_ptr<MonsterType>

void Player::triggerMomentum() {
auto item = getInventoryItem(CONST_SLOT_HEAD);
if (item == nullptr) {
return;

double_t chance = 0;
if (item) {
chance += item->getMomentumChance();
}

double_t chance = item->getMomentumChance();
chance += m_wheelPlayer->getBonusData().momentum;
double_t randomChance = uniform_random(0, 10000) / 100.;
if (getZoneType() != ZONE_PROTECTION && hasCondition(CONDITION_INFIGHT) && ((OTSYS_TIME() / 1000) % 2) == 0 && chance > 0 && randomChance < chance) {
bool triggered = false;
Expand Down
1 change: 1 addition & 0 deletions src/creatures/players/vocations/vocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "utils/pugicast.hpp"
#include "utils/tools.hpp"
#include "enums/player_wheel.hpp"

bool Vocations::reload() {
vocationsMap.clear();
Expand Down
4 changes: 3 additions & 1 deletion src/creatures/players/vocations/vocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include "declarations.hpp"
#include "items/item.hpp"
#include "lib/di/container.hpp"
#include "creatures/players/wheel/wheel_gems.hpp"

enum class WheelGemQuality_t : uint8_t;
enum class WheelGemSupremeModifier_t : uint8_t;

class Vocation {
public:
Expand Down
Loading

0 comments on commit d6c5ec3

Please sign in to comment.