From 237a4219aadca70bce40eeb2dcee6b5363484c68 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Sun, 1 Sep 2024 17:10:42 +0100 Subject: [PATCH] Add P/S/T skills --- scripts/globals/synergy.lua | 15 ++--- settings/default/main.lua | 3 + sql/synergy_recipes.sql | 34 +++++++--- src/map/lua/luautils.cpp | 118 ++++++++++++++++++--------------- src/map/utils/synergyutils.cpp | 33 +++++---- src/map/utils/synergyutils.h | 10 ++- 6 files changed, 126 insertions(+), 87 deletions(-) diff --git a/scripts/globals/synergy.lua b/scripts/globals/synergy.lua index 676f1bd3803..d6673501c9f 100644 --- a/scripts/globals/synergy.lua +++ b/scripts/globals/synergy.lua @@ -10,9 +10,6 @@ xi.synergy = xi.synergy or {} -- Synergy Furnace ----------------------------------- --- NOTE: Change this to play with the synergy furnace -local testSynergy = true - -- NOTE: These are baked into every zone local synergyMessages = { @@ -157,7 +154,7 @@ xi.synergy.attachToSynergyFurnace = function(player, npc) end xi.synergy.synergyFurnaceOnTrade = function(player, npc, trade) - if not testSynergy then + if not xi.settings.main.ENABLE_SYNERGY then return end @@ -180,7 +177,7 @@ xi.synergy.synergyFurnaceOnTrade = function(player, npc, trade) local recipeId = recipe['id'] -- This is for writing to the furnace so it can be pulled out later with GetSynergyRecipeByID() local recipeItemId = recipe['result'] local recipeItemQty = recipe['resultQty'] - local recipeRank = recipe['rank'] + local recipeRank = recipe['primary_rank'] npc:setLocalVar(vars.SYNERGY_FURNACE_CURRENT_RECIPE, recipeId) @@ -192,7 +189,7 @@ xi.synergy.synergyFurnaceOnTrade = function(player, npc, trade) [xi.element.ICE] = recipe['cost_ice_fewell'], [xi.element.WIND] = recipe['cost_wind_fewell'], [xi.element.EARTH] = recipe['cost_earth_fewell'], - [xi.element.THUNDER] = recipe['cost_thunder_fewell'], + [xi.element.THUNDER] = recipe['cost_lightning_fewell'], [xi.element.WATER] = recipe['cost_water_fewell'], [xi.element.LIGHT] = recipe['cost_light_fewell'], [xi.element.DARK] = recipe['cost_dark_fewell'], @@ -225,7 +222,7 @@ xi.synergy.synergyFurnaceOnTrade = function(player, npc, trade) end xi.synergy.synergyFurnaceOnTrigger = function(player, npc) - if not testSynergy then + if not xi.settings.main.ENABLE_SYNERGY then return end @@ -310,7 +307,7 @@ xi.synergy.synergyFurnaceOnTrigger = function(player, npc) end xi.synergy.synergyFurnaceOnEventUpdate = function(player, csid, option, npc) - if not testSynergy then + if not xi.settings.main.ENABLE_SYNERGY then return end @@ -496,7 +493,7 @@ xi.synergy.synergyFurnaceOnEventUpdate = function(player, csid, option, npc) end xi.synergy.synergyFurnaceOnEventFinish = function(player, csid, option, npc) - if not testSynergy then + if not xi.settings.main.ENABLE_SYNERGY then return end diff --git a/settings/default/main.lua b/settings/default/main.lua index ed29a1b1e1a..bd40fa2826d 100644 --- a/settings/default/main.lua +++ b/settings/default/main.lua @@ -282,6 +282,9 @@ xi.settings.main = CHOCOBO_RAISING_DISABLE_RETIREMENT = false, -- true/false. CHOCOBO_RAISING_STAT_GROWTH_CAP = 512, -- int. + -- SYNERGY (HEAVILY-IN-DEVELOPMENT, USE AT YOUR OWN RISK) + ENABLE_SYNERGY = false, -- true/false. Enable Synergy features. + -- MISC RIVERNE_PORTERS = 120, -- Time in seconds that Unstable Displacements in Cape Riverne stay open after trading a scale. LANTERNS_STAY_LIT = 1200, -- time in seconds that lanterns in the Den of Rancor stay lit. diff --git a/sql/synergy_recipes.sql b/sql/synergy_recipes.sql index c069856b7d0..723a7f83c5d 100644 --- a/sql/synergy_recipes.sql +++ b/sql/synergy_recipes.sql @@ -1,12 +1,17 @@ DROP TABLE IF EXISTS `synergy_recipes`; CREATE TABLE `synergy_recipes` ( `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT, - `rank` smallint(5) unsigned NOT NULL, + `primary_skill` tinyint(2) unsigned NOT NULL, + `primary_rank` tinyint(2) unsigned NOT NULL, + `secondary_skill` tinyint(2) unsigned NOT NULL, + `secondary_rank` tinyint(2) unsigned NOT NULL, + `tertiary_skill` tinyint(2) unsigned NOT NULL, + `tertiary_rank` tinyint(2) unsigned NOT NULL, `cost_fire_fewell` smallint(5) unsigned NOT NULL, `cost_ice_fewell` smallint(5) unsigned NOT NULL, `cost_wind_fewell` smallint(5) unsigned NOT NULL, `cost_earth_fewell` smallint(5) unsigned NOT NULL, - `cost_thunder_fewell` smallint(5) unsigned NOT NULL, + `cost_lightning_fewell` smallint(5) unsigned NOT NULL, `cost_water_fewell` smallint(5) unsigned NOT NULL, `cost_light_fewell` smallint(5) unsigned NOT NULL, `cost_dark_fewell` smallint(5) unsigned NOT NULL, @@ -31,6 +36,17 @@ CREATE TABLE `synergy_recipes` ( ) ENGINE=Aria TRANSACTIONAL=0 AUTO_INCREMENT=3500 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- Variables +SET @SKILL_SYNERGY = 0; +SET @SKILL_FISHING = 1; +SET @SKILL_WOODWORKING = 2; +SET @SKILL_SMITHING = 3; +SET @SKILL_GOLDSMITHING = 4; +SET @SKILL_CLOTHCRAFT = 5; +SET @SKILL_LEATHERCRAFT = 6; +SET @SKILL_BONECRAFT = 7; +SET @SKILL_ALCHEMY = 8; +SET @SKILL_COOKING = 9; + SET @RANK_AMATEUR = 0; SET @RANK_RECRUIT = 1; SET @RANK_INITIATE = 2; @@ -103,13 +119,13 @@ LOCK TABLES `synergy_recipes` WRITE; -- ------------- -- Rank: Amateur -INSERT INTO `synergy_recipes` VALUES (1, @RANK_AMATEUR, 0, 0, 0, 5, 0, 0, 0, 0, 27899, 27899, 0, 0, 0, 0, 0, 0, 27898, 27898, 27898, 27898, 1, 1, 1, 1, 'Alliance Shirt +1'); -INSERT INTO `synergy_recipes` VALUES (2, @RANK_AMATEUR, 0, 0, 0, 0, 0, 0, 5, 5, 20713, 20713, 0, 0, 0, 0, 0, 0, 20714, 20714, 20714, 20714, 1, 1, 1, 1, 'Excalipoor II'); -INSERT INTO `synergy_recipes` VALUES (3, @RANK_AMATEUR, 5, 0, 0, 5, 0, 0, 0, 0, 9079, 9080, 9081, 0, 0, 0, 0, 0, 3585, 3585, 3585, 3585, 1, 1, 1, 1, 'Galley Kitchen'); -INSERT INTO `synergy_recipes` VALUES (4, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 26956, 26956, 0, 0, 0, 0, 0, 0, 26957, 26957, 26957, 26957, 1, 1, 1, 1, 'Poroggo Coat +1'); -INSERT INTO `synergy_recipes` VALUES (5, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 26514, 26514, 0, 0, 0, 0, 0, 0, 26515, 26515, 26515, 26515, 1, 1, 1, 1, 'Poroggo Fleece +1'); -INSERT INTO `synergy_recipes` VALUES (6, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 23803, 23803, 0, 0, 0, 0, 0, 0, 23804, 23804, 23804, 23804, 1, 1, 1, 1, 'Poroggo Cassock +1'); -INSERT INTO `synergy_recipes` VALUES (7, @RANK_AMATEUR, 0, 10, 0, 0, 0, 0, 0, 0, 25675, 25675, 0, 0, 0, 0, 0, 0, 25679, 25679, 25679, 25679, 1, 1, 1, 1, 'White Rarab Cap +1'); +INSERT INTO `synergy_recipes` VALUES (1, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 0, 0, 5, 0, 0, 0, 0, 27899, 27899, 0, 0, 0, 0, 0, 0, 27898, 27898, 27898, 27898, 1, 1, 1, 1, 'Alliance Shirt +1'); +INSERT INTO `synergy_recipes` VALUES (2, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 0, 0, 0, 0, 0, 5, 5, 20713, 20713, 0, 0, 0, 0, 0, 0, 20714, 20714, 20714, 20714, 1, 1, 1, 1, 'Excalipoor II'); +INSERT INTO `synergy_recipes` VALUES (3, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 5, 0, 0, 5, 0, 0, 0, 0, 9079, 9080, 9081, 0, 0, 0, 0, 0, 3585, 3585, 3585, 3585, 1, 1, 1, 1, 'Galley Kitchen'); +INSERT INTO `synergy_recipes` VALUES (4, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 26956, 26956, 0, 0, 0, 0, 0, 0, 26957, 26957, 26957, 26957, 1, 1, 1, 1, 'Poroggo Coat +1'); +INSERT INTO `synergy_recipes` VALUES (5, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 26514, 26514, 0, 0, 0, 0, 0, 0, 26515, 26515, 26515, 26515, 1, 1, 1, 1, 'Poroggo Fleece +1'); +INSERT INTO `synergy_recipes` VALUES (6, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 0, 0, 0, 0, 10, 0, 0, 23803, 23803, 0, 0, 0, 0, 0, 0, 23804, 23804, 23804, 23804, 1, 1, 1, 1, 'Poroggo Cassock +1'); +INSERT INTO `synergy_recipes` VALUES (7, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, @SKILL_SYNERGY, @RANK_AMATEUR, 0, 10, 0, 0, 0, 0, 0, 0, 25675, 25675, 0, 0, 0, 0, 0, 0, 25679, 25679, 25679, 25679, 1, 1, 1, 1, 'White Rarab Cap +1'); -- ----------- -- RECIPES END diff --git a/src/map/lua/luautils.cpp b/src/map/lua/luautils.cpp index f08c02f3f2b..de3241451ef 100644 --- a/src/map/lua/luautils.cpp +++ b/src/map/lua/luautils.cpp @@ -5894,33 +5894,38 @@ namespace luautils sol::table table = lua.create_table(); - table["id"] = result.id; - table["rank"] = result.rank; - table["cost_fire_fewell"] = result.cost_fire_fewell; - table["cost_ice_fewell"] = result.cost_ice_fewell; - table["cost_wind_fewell"] = result.cost_wind_fewell; - table["cost_earth_fewell"] = result.cost_earth_fewell; - table["cost_thunder_fewell"] = result.cost_thunder_fewell; - table["cost_water_fewell"] = result.cost_water_fewell; - table["cost_light_fewell"] = result.cost_light_fewell; - table["cost_dark_fewell"] = result.cost_dark_fewell; - table["ingredient1"] = result.ingredient1; - table["ingredient2"] = result.ingredient2; - table["ingredient3"] = result.ingredient3; - table["ingredient4"] = result.ingredient4; - table["ingredient5"] = result.ingredient5; - table["ingredient6"] = result.ingredient6; - table["ingredient7"] = result.ingredient7; - table["ingredient8"] = result.ingredient8; - table["result"] = result.result; - table["resultHQ1"] = result.resultHQ1; - table["resultHQ2"] = result.resultHQ2; - table["resultHQ3"] = result.resultHQ3; - table["resultQty"] = result.resultQty; - table["resultHQ1Qty"] = result.resultHQ1Qty; - table["resultHQ2Qty"] = result.resultHQ2Qty; - table["resultHQ3Qty"] = result.resultHQ3Qty; - table["resultName"] = result.resultName; + table["id"] = result.id; + table["primary_skill"] = result.primary_skill; + table["primary_rank"] = result.primary_rank; + table["secondary_skill"] = result.secondary_skill; + table["secondary_rank"] = result.secondary_rank; + table["tertiary_skill"] = result.tertiary_skill; + table["tertiary_rank"] = result.tertiary_rank; + table["cost_fire_fewell"] = result.cost_fire_fewell; + table["cost_ice_fewell"] = result.cost_ice_fewell; + table["cost_wind_fewell"] = result.cost_wind_fewell; + table["cost_earth_fewell"] = result.cost_earth_fewell; + table["cost_lightning_fewell"] = result.cost_lightning_fewell; + table["cost_water_fewell"] = result.cost_water_fewell; + table["cost_light_fewell"] = result.cost_light_fewell; + table["cost_dark_fewell"] = result.cost_dark_fewell; + table["ingredient1"] = result.ingredient1; + table["ingredient2"] = result.ingredient2; + table["ingredient3"] = result.ingredient3; + table["ingredient4"] = result.ingredient4; + table["ingredient5"] = result.ingredient5; + table["ingredient6"] = result.ingredient6; + table["ingredient7"] = result.ingredient7; + table["ingredient8"] = result.ingredient8; + table["result"] = result.result; + table["resultHQ1"] = result.resultHQ1; + table["resultHQ2"] = result.resultHQ2; + table["resultHQ3"] = result.resultHQ3; + table["resultQty"] = result.resultQty; + table["resultHQ1Qty"] = result.resultHQ1Qty; + table["resultHQ2Qty"] = result.resultHQ2Qty; + table["resultHQ3Qty"] = result.resultHQ3Qty; + table["resultName"] = result.resultName; return table; } @@ -5961,33 +5966,38 @@ namespace luautils sol::table table = lua.create_table(); - table["id"] = result.id; - table["rank"] = result.rank; - table["cost_fire_fewell"] = result.cost_fire_fewell; - table["cost_ice_fewell"] = result.cost_ice_fewell; - table["cost_wind_fewell"] = result.cost_wind_fewell; - table["cost_earth_fewell"] = result.cost_earth_fewell; - table["cost_thunder_fewell"] = result.cost_thunder_fewell; - table["cost_water_fewell"] = result.cost_water_fewell; - table["cost_light_fewell"] = result.cost_light_fewell; - table["cost_dark_fewell"] = result.cost_dark_fewell; - table["ingredient1"] = result.ingredient1; - table["ingredient2"] = result.ingredient2; - table["ingredient3"] = result.ingredient3; - table["ingredient4"] = result.ingredient4; - table["ingredient5"] = result.ingredient5; - table["ingredient6"] = result.ingredient6; - table["ingredient7"] = result.ingredient7; - table["ingredient8"] = result.ingredient8; - table["result"] = result.result; - table["resultHQ1"] = result.resultHQ1; - table["resultHQ2"] = result.resultHQ2; - table["resultHQ3"] = result.resultHQ3; - table["resultQty"] = result.resultQty; - table["resultHQ1Qty"] = result.resultHQ1Qty; - table["resultHQ2Qty"] = result.resultHQ2Qty; - table["resultHQ3Qty"] = result.resultHQ3Qty; - table["resultName"] = result.resultName; + table["id"] = result.id; + table["primary_skill"] = result.primary_skill; + table["primary_rank"] = result.primary_rank; + table["secondary_skill"] = result.secondary_skill; + table["secondary_rank"] = result.secondary_rank; + table["tertiary_skill"] = result.tertiary_skill; + table["tertiary_rank"] = result.tertiary_rank; + table["cost_fire_fewell"] = result.cost_fire_fewell; + table["cost_ice_fewell"] = result.cost_ice_fewell; + table["cost_wind_fewell"] = result.cost_wind_fewell; + table["cost_earth_fewell"] = result.cost_earth_fewell; + table["cost_lightning_fewell"] = result.cost_lightning_fewell; + table["cost_water_fewell"] = result.cost_water_fewell; + table["cost_light_fewell"] = result.cost_light_fewell; + table["cost_dark_fewell"] = result.cost_dark_fewell; + table["ingredient1"] = result.ingredient1; + table["ingredient2"] = result.ingredient2; + table["ingredient3"] = result.ingredient3; + table["ingredient4"] = result.ingredient4; + table["ingredient5"] = result.ingredient5; + table["ingredient6"] = result.ingredient6; + table["ingredient7"] = result.ingredient7; + table["ingredient8"] = result.ingredient8; + table["result"] = result.result; + table["resultHQ1"] = result.resultHQ1; + table["resultHQ2"] = result.resultHQ2; + table["resultHQ3"] = result.resultHQ3; + table["resultQty"] = result.resultQty; + table["resultHQ1Qty"] = result.resultHQ1Qty; + table["resultHQ2Qty"] = result.resultHQ2Qty; + table["resultHQ3Qty"] = result.resultHQ3Qty; + table["resultName"] = result.resultName; return table; } diff --git a/src/map/utils/synergyutils.cpp b/src/map/utils/synergyutils.cpp index 4742a7b8fff..2bf981c106c 100644 --- a/src/map/utils/synergyutils.cpp +++ b/src/map/utils/synergyutils.cpp @@ -32,9 +32,10 @@ namespace synergyutils { const auto rset = db::preparedStmt(R"""( SELECT - id, rank, + id, + primary_skill, primary_rank, secondary_skill, secondary_rank, tertiary_skill, tertiary_rank, cost_fire_fewell, cost_ice_fewell, cost_wind_fewell, cost_earth_fewell, - cost_thunder_fewell, cost_water_fewell, cost_light_fewell, cost_dark_fewell, + cost_lightning_fewell, cost_water_fewell, cost_light_fewell, cost_dark_fewell, ingredient1, ingredient2, ingredient3, ingredient4, ingredient5, ingredient6, ingredient7, ingredient8, result, resultHQ1, resultHQ2, resultHQ3, @@ -50,17 +51,23 @@ namespace synergyutils while (rset->next()) { auto recipe = SynergyRecipe{ - .id = static_cast(rset->getUInt("id")), - .rank = static_cast(rset->getUInt("rank")), - - .cost_fire_fewell = static_cast(rset->getUInt("cost_fire_fewell")), - .cost_ice_fewell = static_cast(rset->getUInt("cost_ice_fewell")), - .cost_wind_fewell = static_cast(rset->getUInt("cost_wind_fewell")), - .cost_earth_fewell = static_cast(rset->getUInt("cost_earth_fewell")), - .cost_thunder_fewell = static_cast(rset->getUInt("cost_thunder_fewell")), - .cost_water_fewell = static_cast(rset->getUInt("cost_water_fewell")), - .cost_light_fewell = static_cast(rset->getUInt("cost_light_fewell")), - .cost_dark_fewell = static_cast(rset->getUInt("cost_dark_fewell")), + .id = static_cast(rset->getUInt("id")), + + .primary_skill = static_cast(rset->getUInt("primary_skill")), + .primary_rank = static_cast(rset->getUInt("primary_rank")), + .secondary_skill = static_cast(rset->getUInt("secondary_skill")), + .secondary_rank = static_cast(rset->getUInt("secondary_rank")), + .tertiary_skill = static_cast(rset->getUInt("tertiary_skill")), + .tertiary_rank = static_cast(rset->getUInt("tertiary_rank")), + + .cost_fire_fewell = static_cast(rset->getUInt("cost_fire_fewell")), + .cost_ice_fewell = static_cast(rset->getUInt("cost_ice_fewell")), + .cost_wind_fewell = static_cast(rset->getUInt("cost_wind_fewell")), + .cost_earth_fewell = static_cast(rset->getUInt("cost_earth_fewell")), + .cost_lightning_fewell = static_cast(rset->getUInt("cost_lightning_fewell")), + .cost_water_fewell = static_cast(rset->getUInt("cost_water_fewell")), + .cost_light_fewell = static_cast(rset->getUInt("cost_light_fewell")), + .cost_dark_fewell = static_cast(rset->getUInt("cost_dark_fewell")), .ingredient1 = static_cast(rset->getUInt("ingredient1")), .ingredient2 = static_cast(rset->getUInt("ingredient2")), diff --git a/src/map/utils/synergyutils.h b/src/map/utils/synergyutils.h index 3e6a78be75e..d86d4895f74 100644 --- a/src/map/utils/synergyutils.h +++ b/src/map/utils/synergyutils.h @@ -29,13 +29,19 @@ namespace synergyutils struct SynergyRecipe { uint32 id; - uint8 rank; + + uint8 primary_skill; + uint8 primary_rank; + uint8 secondary_skill; + uint8 secondary_rank; + uint8 tertiary_skill; + uint8 tertiary_rank; uint8 cost_fire_fewell; uint8 cost_ice_fewell; uint8 cost_wind_fewell; uint8 cost_earth_fewell; - uint8 cost_thunder_fewell; + uint8 cost_lightning_fewell; uint8 cost_water_fewell; uint8 cost_light_fewell; uint8 cost_dark_fewell;