Fix grade upgrade fail announcement (#7189)

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
eppc0330 2022-12-05 17:55:58 +09:00 committed by GitHub
parent 5549ad2ac2
commit 7bfae25c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 15 deletions

View File

@ -30,7 +30,9 @@
# Refine Required refine level. # Refine Required refine level.
# Chance Base chance of success out of 0~10000. # Chance Base chance of success out of 0~10000.
# Bonus Enchantgrade bonus. (Default: 0) # Bonus Enchantgrade bonus. (Default: 0)
# Announce Announce if someone tries to increase the enchantgrade. (Default: true) # AnnounceSuccess Announce on upgrade success. (Default: true)
# AnnounceFail Announce on upgrade failure. (Default: false)
# Announce Announce on upgrade success and failure.
# Catalyst: Catalyst item to increase chance of success. # Catalyst: Catalyst item to increase chance of success.
# Item The item that can be used. # Item The item that can be used.
# AmountPerStep Amount of Item needed. # AmountPerStep Amount of Item needed.
@ -49,7 +51,7 @@
Header: Header:
Type: ENCHANTGRADE_DB Type: ENCHANTGRADE_DB
Version: 1 Version: 2
Footer: Footer:
Imports: Imports:

View File

@ -30,7 +30,9 @@
# Refine Required refine level. # Refine Required refine level.
# Chance Base chance of success out of 0~10000. # Chance Base chance of success out of 0~10000.
# Bonus Enchantgrade bonus. (Default: 0) # Bonus Enchantgrade bonus. (Default: 0)
# Announce Announce if someone tries to increase the enchantgrade. (Default: true) # AnnounceSuccess Announce on upgrade success. (Default: true)
# AnnounceFail Announce on upgrade failure. (Default: false)
# Announce Announce on upgrade success and failure.
# Catalyst: Catalyst item to increase chance of success. # Catalyst: Catalyst item to increase chance of success.
# Item The item that can be used. # Item The item that can be used.
# AmountPerStep Amount of Item needed. # AmountPerStep Amount of Item needed.
@ -49,4 +51,4 @@
Header: Header:
Type: ENCHANTGRADE_DB Type: ENCHANTGRADE_DB
Version: 1 Version: 2

View File

@ -30,7 +30,9 @@
# Refine Required refine level. # Refine Required refine level.
# Chance Base chance of success out of 0~10000. # Chance Base chance of success out of 0~10000.
# Bonus Enchantgrade bonus. (Default: 0) # Bonus Enchantgrade bonus. (Default: 0)
# Announce Announce if someone tries to increase the enchantgrade. (Default: true) # AnnounceSuccess Announce on upgrade success. (Default: true)
# AnnounceFail Announce on upgrade failure. (Default: false)
# Announce Announce on upgrade success and failure.
# Catalyst: Catalyst item to increase chance of success. # Catalyst: Catalyst item to increase chance of success.
# Item The item that can be used. # Item The item that can be used.
# AmountPerStep Amount of Item needed. # AmountPerStep Amount of Item needed.
@ -49,7 +51,7 @@
Header: Header:
Type: ENCHANTGRADE_DB Type: ENCHANTGRADE_DB
Version: 1 Version: 2
Body: Body:
- Type: Armor - Type: Armor
@ -98,6 +100,7 @@ Body:
Refine: 11 Refine: 11
Chance: 5000 Chance: 5000
Bonus: 50 Bonus: 50
AnnounceFail: true
Catalyst: Catalyst:
Item: Blessed_Etel_Dust Item: Blessed_Etel_Dust
AmountPerStep: 5 AmountPerStep: 5
@ -117,6 +120,7 @@ Body:
Refine: 11 Refine: 11
Chance: 4000 Chance: 4000
Bonus: 100 Bonus: 100
AnnounceFail: true
Catalyst: Catalyst:
Item: Blessed_Etel_Dust Item: Blessed_Etel_Dust
AmountPerStep: 7 AmountPerStep: 7
@ -178,6 +182,7 @@ Body:
Refine: 11 Refine: 11
Chance: 5000 Chance: 5000
Bonus: 50 Bonus: 50
AnnounceFail: true
Catalyst: Catalyst:
Item: Blessed_Etel_Dust Item: Blessed_Etel_Dust
AmountPerStep: 5 AmountPerStep: 5
@ -197,6 +202,7 @@ Body:
Refine: 11 Refine: 11
Chance: 4000 Chance: 4000
Bonus: 100 Bonus: 100
AnnounceFail: true
Catalyst: Catalyst:
Item: Blessed_Etel_Dust Item: Blessed_Etel_Dust
AmountPerStep: 7 AmountPerStep: 7

View File

@ -23636,12 +23636,12 @@ void clif_parse_enchantgrade_start( int fd, struct map_session_data* sd ){
clif_enchantgrade_result( *sd, index, ENCHANTGRADE_UPGRADE_SUCCESS ); clif_enchantgrade_result( *sd, index, ENCHANTGRADE_UPGRADE_SUCCESS );
// Check if it has to be announced // Check if it has to be announced
if( enchantgradelevel->announce ){ if( enchantgradelevel->announceSuccess ){
clif_enchantgrade_announce( *sd, sd->inventory.u.items_inventory[index], true ); clif_enchantgrade_announce( *sd, sd->inventory.u.items_inventory[index], true );
} }
}else{ }else{
// Check if it has to be announced (has to be done before deleting the item from inventory) // Check if it has to be announced (has to be done before deleting the item from inventory)
if( enchantgradelevel->announce ){ if( enchantgradelevel->announceFail ){
clif_enchantgrade_announce( *sd, sd->inventory.u.items_inventory[index], false ); clif_enchantgrade_announce( *sd, sd->inventory.u.items_inventory[index], false );
} }

View File

@ -700,6 +700,34 @@ uint64 EnchantgradeDatabase::parseBodyNode( const ryml::NodeRef& node ){
} }
} }
if( this->nodeExists( gradeNode, "AnnounceSuccess" ) ){
bool announce;
if( !this->asBool( gradeNode, "AnnounceSuccess", announce ) ){
return 0;
}
grade->announceSuccess = announce;
}else{
if( !gradeExists ){
grade->announceSuccess = true;
}
}
if( this->nodeExists( gradeNode, "AnnounceFail" ) ){
bool announce;
if( !this->asBool( gradeNode, "AnnounceFail", announce) ){
return 0;
}
grade->announceFail = announce;
}else{
if( !gradeExists ){
grade->announceFail = false;
}
}
if( this->nodeExists( gradeNode, "Announce" ) ){ if( this->nodeExists( gradeNode, "Announce" ) ){
bool announce; bool announce;
@ -707,11 +735,8 @@ uint64 EnchantgradeDatabase::parseBodyNode( const ryml::NodeRef& node ){
return 0; return 0;
} }
grade->announce = announce; grade->announceSuccess = announce;
}else{ grade->announceFail = announce;
if( !gradeExists ){
grade->announce = true;
}
} }
if( this->nodeExists( gradeNode, "Catalyst") ){ if( this->nodeExists( gradeNode, "Catalyst") ){

View File

@ -168,7 +168,8 @@ struct s_enchantgradelevel{
uint16 refine; uint16 refine;
uint16 chance; uint16 chance;
uint16 bonus; uint16 bonus;
bool announce; bool announceSuccess;
bool announceFail;
struct{ struct{
t_itemid item; t_itemid item;
uint16 amountPerStep; uint16 amountPerStep;
@ -185,7 +186,7 @@ struct s_enchantgrade{
class EnchantgradeDatabase : public TypesafeYamlDatabase<uint16, s_enchantgrade>{ class EnchantgradeDatabase : public TypesafeYamlDatabase<uint16, s_enchantgrade>{
public: public:
EnchantgradeDatabase() : TypesafeYamlDatabase( "ENCHANTGRADE_DB", 1 ){ EnchantgradeDatabase() : TypesafeYamlDatabase( "ENCHANTGRADE_DB", 2, 1 ){
} }