Skip to content

Commit

Permalink
Add P/S/T skills
Browse files Browse the repository at this point in the history
  • Loading branch information
zach2good committed Sep 1, 2024
1 parent e8862eb commit 237a421
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 87 deletions.
15 changes: 6 additions & 9 deletions scripts/globals/synergy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
{
Expand Down Expand Up @@ -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

Expand All @@ -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)

Expand All @@ -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'],
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions settings/default/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 25 additions & 9 deletions sql/synergy_recipes.sql
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
118 changes: 64 additions & 54 deletions src/map/lua/luautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
33 changes: 20 additions & 13 deletions src/map/utils/synergyutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -50,17 +51,23 @@ namespace synergyutils
while (rset->next())
{
auto recipe = SynergyRecipe{
.id = static_cast<uint32>(rset->getUInt("id")),
.rank = static_cast<uint8>(rset->getUInt("rank")),

.cost_fire_fewell = static_cast<uint8>(rset->getUInt("cost_fire_fewell")),
.cost_ice_fewell = static_cast<uint8>(rset->getUInt("cost_ice_fewell")),
.cost_wind_fewell = static_cast<uint8>(rset->getUInt("cost_wind_fewell")),
.cost_earth_fewell = static_cast<uint8>(rset->getUInt("cost_earth_fewell")),
.cost_thunder_fewell = static_cast<uint8>(rset->getUInt("cost_thunder_fewell")),
.cost_water_fewell = static_cast<uint8>(rset->getUInt("cost_water_fewell")),
.cost_light_fewell = static_cast<uint8>(rset->getUInt("cost_light_fewell")),
.cost_dark_fewell = static_cast<uint8>(rset->getUInt("cost_dark_fewell")),
.id = static_cast<uint32>(rset->getUInt("id")),

.primary_skill = static_cast<uint8>(rset->getUInt("primary_skill")),
.primary_rank = static_cast<uint8>(rset->getUInt("primary_rank")),
.secondary_skill = static_cast<uint8>(rset->getUInt("secondary_skill")),
.secondary_rank = static_cast<uint8>(rset->getUInt("secondary_rank")),
.tertiary_skill = static_cast<uint8>(rset->getUInt("tertiary_skill")),
.tertiary_rank = static_cast<uint8>(rset->getUInt("tertiary_rank")),

.cost_fire_fewell = static_cast<uint8>(rset->getUInt("cost_fire_fewell")),
.cost_ice_fewell = static_cast<uint8>(rset->getUInt("cost_ice_fewell")),
.cost_wind_fewell = static_cast<uint8>(rset->getUInt("cost_wind_fewell")),
.cost_earth_fewell = static_cast<uint8>(rset->getUInt("cost_earth_fewell")),
.cost_lightning_fewell = static_cast<uint8>(rset->getUInt("cost_lightning_fewell")),
.cost_water_fewell = static_cast<uint8>(rset->getUInt("cost_water_fewell")),
.cost_light_fewell = static_cast<uint8>(rset->getUInt("cost_light_fewell")),
.cost_dark_fewell = static_cast<uint8>(rset->getUInt("cost_dark_fewell")),

.ingredient1 = static_cast<uint16>(rset->getUInt("ingredient1")),
.ingredient2 = static_cast<uint16>(rset->getUInt("ingredient2")),
Expand Down
10 changes: 8 additions & 2 deletions src/map/utils/synergyutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 237a421

Please sign in to comment.