diff --git a/db/pre-re/produce_db.yml b/db/pre-re/produce_db.yml
index 8c13d8f91c..89db849b82 100644
--- a/db/pre-re/produce_db.yml
+++ b/db/pre-re/produce_db.yml
@@ -51,4 +51,3 @@ Header:
Footer:
Imports:
- Path: db/pre-re/skill_produce_db.yml
- - Path: db/pre-re/skill_changematerial_db.yml
diff --git a/db/pre-re/skill_changematerial_db.yml b/db/pre-re/skill_changematerial_db.yml
deleted file mode 100644
index 540cb21dd1..0000000000
--- a/db/pre-re/skill_changematerial_db.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-# This file is a part of rAthena.
-# Copyright(C) 2022 rAthena Development Team
-# https://rathena.org - https://github.com/rathena
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-#
-###########################################################################
-# Item Produce Database
-###########################################################################
-#
-# Item Produce Settings
-#
-###########################################################################
-# - ItemLevel Number which determines what kind of a crafting window will pop-up.
-# Recipe:
-# - Product AegisName of the produced item.
-# SkillName Skill name required. (Default: null)
-# SkillLevel Skill level required. (Default: 1)
-# Consumed: List of items consumed to produce the Product.
-# - Item AegisName of the consumed item.
-# Amount Amount required.
-# Clear Remove the item with the given AegisName from Consumed. (Optional)
-# NotConsumed: List of items not consumed to produce the Product. (Default: null)
-# - Item AegisName of the unconsumed item.
-# Clear Remove the item with the given AegisName from NotConsumed. (Optional)
-# BaseRate Base rate (in n/10%). (Default: 1000)
-# Make: List of item amounts with their individual rate produced by Change Material. (Default: null)
-# - Amount Amount of item created (unique to the list).
-# Rate Rate to create the Amount (in n/10%). Default: 1000. 0 to remove on import.
-###########################################################################
-
-Header:
- Type: PRODUCE_DB
- Version: 1
diff --git a/db/re/produce_db.yml b/db/re/produce_db.yml
index ab37f435e3..4a515f87e3 100644
--- a/db/re/produce_db.yml
+++ b/db/re/produce_db.yml
@@ -1,5 +1,5 @@
# This file is a part of rAthena.
-# Copyright(C) 2022 rAthena Development Team
+# Copyright(C) 2023 rAthena Development Team
# https://rathena.org - https://github.com/rathena
#
# This program is free software: you can redistribute it and/or modify
diff --git a/db/re/skill_produce_db.yml b/db/re/skill_produce_db.yml
index 684c289c1d..e679000416 100644
--- a/db/re/skill_produce_db.yml
+++ b/db/re/skill_produce_db.yml
@@ -1645,7 +1645,7 @@ Body:
Amount: 1
NotConsumed:
- Item: Normal_Potion_Book
- - Product: aegis_100371
+ - Product: Homun_F_Tablet
SkillName: AM_PHARMACY
SkillLevel: 1
Consumed:
@@ -1663,34 +1663,34 @@ Body:
SkillName: SA_CREATECON
SkillLevel: 1
Consumed:
- - Item: Scorpion's_Tail
- Amount: 3
+ - Item: Boody_Red
+ Amount: 1
- Item: Scroll
Amount: 1
- Product: Elemental_Water
SkillName: SA_CREATECON
SkillLevel: 1
Consumed:
+ - Item: Crystal_Blue
+ Amount: 1
- Item: Scroll
Amount: 1
- - Item: Snail's_Shell
- Amount: 3
- Product: Elemental_Earth
SkillName: SA_CREATECON
SkillLevel: 1
Consumed:
- - Item: Horn
- Amount: 3
- Item: Scroll
Amount: 1
+ - Item: Wind_Of_Verdure
+ Amount: 1
- Product: Elemental_Wind
SkillName: SA_CREATECON
SkillLevel: 1
Consumed:
- - Item: Colorful_Shell
- Amount: 3
- Item: Scroll
Amount: 1
+ - Item: Yellow_Live
+ Amount: 1
- ItemLevel: 24
Recipe:
- Product: Ansila
@@ -2203,18 +2203,18 @@ Body:
Amount: 10
- Item: Empty_Potion
Amount: 5
- - Item: Red_Syrup
+ - Item: High_RedPotion
Amount: 15
- Product: Concentrated_B_P
SkillName: GN_S_PHARMACY
SkillLevel: 1
Consumed:
- - Item: Blue_Syrup
- Amount: 15
- Item: Empty_Cylinder
Amount: 10
- Item: Empty_Potion
Amount: 5
+ - Item: High_BluePotion
+ Amount: 15
- Product: Concentrated_G_P
SkillName: GN_S_PHARMACY
SkillLevel: 1
@@ -2223,9 +2223,9 @@ Body:
Amount: 10
- Item: Empty_Potion
Amount: 5
- - Item: White_Syrup
+ - Item: High_WhitePotion
Amount: 10
- - Item: Yellow_Syrup
+ - Item: High_YelloPotion
Amount: 10
- ItemLevel: 30
Recipe:
@@ -2336,7 +2336,7 @@ Body:
- Item: Portable_Furnace
Amount: 5
NotConsumed:
- - Item: Device_Creation_Guide
+ - Item: Device_M_Book
- Product: Auto_Battle_Capsule
SkillName: MT_M_MACHINE
SkillLevel: 1
@@ -2348,7 +2348,7 @@ Body:
- Item: Portable_Furnace
Amount: 5
NotConsumed:
- - Item: Device_Creation_Guide
+ - Item: Device_M_Book
- ItemLevel: 32
Recipe:
- Product: Flame_Acid_Bottle
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 28d65c44a6..62de9fbe20 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -6393,8 +6393,6 @@ void clif_skill_produce_mix_list( map_session_data *sd, int skill_id, int trigge
int count = 0;
for (const auto &itemlvit : skill_produce_db) {
- if (itemlvit.second->data.empty())
- continue;
for (const auto &datait : itemlvit.second->data) {
if (skill_can_produce_mix(sd, datait.second->nameid, trigger, 1) != nullptr &&
(skill_id <= 0 || (skill_id > 0 && datait.second->req_skill == skill_id))
@@ -6446,8 +6444,6 @@ void clif_cooking_list( map_session_data *sd, int trigger, uint16 skill_id, int
int count = 0;
for (const auto &itemlvit : skill_produce_db) {
- if (itemlvit.second->data.empty())
- continue;
for (const auto &datait : itemlvit.second->data) {
if( skill_can_produce_mix( sd, datait.second->nameid, trigger, qty ) == nullptr ){
continue;
@@ -19518,8 +19514,6 @@ void clif_elementalconverter_list( map_session_data *sd ){
int count = 0;
for (const auto &itemlvit : skill_produce_db) {
- if (itemlvit.second->data.empty())
- continue;
for (const auto &datait : itemlvit.second->data) {
if( skill_can_produce_mix( sd, datait.second->nameid, 23, 1 ) ){
p->items[count].itemId = client_nameid( datait.second->nameid );
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 067ebd2276..2db4cab26d 100755
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -21408,17 +21408,15 @@ std::shared_ptr skill_can_produce_mix(map_session_data
std::shared_ptr produce = nullptr;
for (const auto &itemlvit : skill_produce_db) {
- if (itemlvit.second->data.empty())
- continue;
for (const auto &datait : itemlvit.second->data) {
- if (datait.second->nameid == nameid) {
- if (datait.second->req_skill > 0 && pc_checkskill(sd, datait.second->req_skill) < datait.second->req_skill_lv)
- continue; // must iterate again to check other skills that produce it. [malufett]
- if (datait.second->req_skill > 0 && sd->menuskill_id > 0 && sd->menuskill_id != datait.second->req_skill)
- continue; // special case
- produce = datait.second;
- break;
- }
+ if (datait.second->nameid != nameid)
+ continue;
+ if (datait.second->req_skill > 0 && pc_checkskill(sd, datait.second->req_skill) < datait.second->req_skill_lv)
+ continue; // must iterate again to check other skills that produce it. [malufett]
+ if (datait.second->req_skill > 0 && sd->menuskill_id > 0 && sd->menuskill_id != datait.second->req_skill)
+ continue; // special case
+ produce = datait.second;
+ break;
}
if (produce != nullptr)
break;
@@ -21539,32 +21537,30 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
}
}
- if (!produce->materials.empty()) {
- for (const auto &mat : produce->materials) {
- short x, j;
- t_itemid id = mat.first;
+ for (const auto &mat : produce->materials) {
+ short x, j;
+ t_itemid id = mat.first;
- if (!item_db.exists(id))
- continue;
- num++;
- x = (skill_id == RK_RUNEMASTERY ? 1 : qty) * mat.second;
- do {
- int y = 0;
+ if (!item_db.exists(id))
+ continue;
+ num++;
+ x = (skill_id == RK_RUNEMASTERY ? 1 : qty) * mat.second;
+ do {
+ int y = 0;
- j = pc_search_inventory(sd,id);
+ j = pc_search_inventory(sd,id);
- if (j >= 0) {
- y = sd->inventory.u.items_inventory[j].amount;
- if (y > x)
- y = x;
- pc_delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
- } else {
- ShowError("skill_produce_mix: material item error\n");
- return false;
- }
- x -= y;
- } while( j >= 0 && x > 0 );
- }
+ if (j >= 0) {
+ y = sd->inventory.u.items_inventory[j].amount;
+ if (y > x)
+ y = x;
+ pc_delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
+ } else {
+ ShowError("skill_produce_mix: material item error\n");
+ return false;
+ }
+ x -= y;
+ } while( j >= 0 && x > 0 );
}
if ((equip = (itemdb_isequip(nameid) && skill_id != GN_CHANGEMATERIAL && skill_id != GN_MAKEBOMB)) && itemdb_type(nameid) == IT_WEAPON )
@@ -21987,7 +21983,7 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
}
if (skill_id == GN_CHANGEMATERIAL && tmp_item.amount) { //Success
- int k = 0, l;
+ bool is_produce_success = false;
bool isStackable = itemdb_isstackable(tmp_item.nameid);
if (!produce->qty.empty()) {
@@ -21995,7 +21991,7 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
if (rnd()%1000 < qtyit.second){
uint16 total_qty = qty * qtyit.first;
tmp_item.amount = (isStackable ? total_qty : 1);
- for (l = 0; l < total_qty; l += tmp_item.amount) {
+ for ( int l = 0; l < total_qty; l += tmp_item.amount ) {
if ((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif_additem(sd,0,0,flag);
if( battle_config.skill_drop_items_full ){
@@ -22003,11 +21999,11 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i
}
}
}
- k++;
+ is_produce_success = true;
}
}
}
- if (k) {
+ if (is_produce_success) {
clif_produceeffect(sd,6,nameid);
clif_misceffect(&sd->bl,5);
clif_msg_skill(sd,skill_id,ITEM_PRODUCE_SUCCESS);
@@ -22474,7 +22470,7 @@ int skill_elementalanalysis(map_session_data* sd, int n, uint16 skill_lv, unsign
}
int skill_changematerial(map_session_data *sd, int n, unsigned short *item_list) {
- int k, c, p = 0, amount;
+ int k, c, qty = 0, amount;
t_itemid nameid;
nullpo_ret(sd);
@@ -22494,7 +22490,7 @@ int skill_changematerial(map_session_data *sd, int n, unsigned short *item_list)
if (data->materials.empty())
return 0;
- p = 0;
+ qty = 0;
do {
c = 0;
// Verification of overlap between the objects required and the list submitted.
@@ -22512,20 +22508,20 @@ int skill_changematerial(map_session_data *sd, int n, unsigned short *item_list)
clif_msg_skill(sd,GN_CHANGEMATERIAL,ITEM_UNIDENTIFIED);
return 0;
}
- if (nameid == mat.first && (amount - p * mat.second) >= mat.second && (amount - p * mat.second) % mat.second == 0) // must be in exact amount
+ if (nameid == mat.first && (amount - qty * mat.second) >= mat.second && (amount - qty * mat.second) % mat.second == 0) // must be in exact amount
c++; // match
}
}
- p++;
+ qty++;
} while(n == data->materials.size() && c == n);
- p--;
- if ( p > 0 ) {
- skill_produce_mix(sd,GN_CHANGEMATERIAL,datait.second->nameid,0,0,0,p, datait.second);
+ qty--;
+ if ( qty > 0 ) {
+ skill_produce_mix(sd,GN_CHANGEMATERIAL,datait.second->nameid,0,0,0,qty, datait.second);
return 1;
}
}
- if( p == 0)
+ if( qty == 0)
clif_msg_skill(sd,GN_CHANGEMATERIAL,ITEM_CANT_COMBINE);
return 0;
@@ -24570,7 +24566,7 @@ static bool skill_parse_row_nocastdb(char* split[], int columns, int current)
return true;
}
-bool SkillProduceDatabase::add_itemconsumed(const ryml::NodeRef& node, std::shared_ptr &entry, bool isConsumed) {
+bool SkillProduceDatabase::addItemConsumed(const ryml::NodeRef& node, std::shared_ptr &entry, bool isConsumed) {
for (const auto &it : node) {
if (this->nodeExists(it, "Clear")) {
std::string item_name;
@@ -24767,12 +24763,12 @@ uint64 SkillProduceDatabase::parseBodyNode(const ryml::NodeRef &node) {
}
if (this->nodeExists(subit, "Consumed")) {
- if (!this->add_itemconsumed(subit["Consumed"], entry, true))
+ if (!this->addItemConsumed(subit["Consumed"], entry, true))
return 0;
}
if (this->nodeExists(subit, "NotConsumed")) {
- if (!this->add_itemconsumed(subit["NotConsumed"], entry, false))
+ if (!this->addItemConsumed(subit["NotConsumed"], entry, false))
return 0;
}
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index fd9ca3e179..e590222977 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -465,7 +465,7 @@ public:
const std::string getDefaultLocation() override;
uint64 parseBodyNode(const ryml::NodeRef& node) override;
- bool add_itemconsumed(const ryml::NodeRef& node, std::shared_ptr &entry, bool isConsumed);
+ bool addItemConsumed(const ryml::NodeRef& node, std::shared_ptr &entry, bool isConsumed);
};
extern SkillProduceDatabase skill_produce_db;