Explorar el Código

Fix grade upgrade fail announcement (#7189)

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
eppc0330 hace 2 años
padre
commit
7bfae25c74
Se han modificado 6 ficheros con 50 adiciones y 14 borrados
  1. 4 2
      db/enchantgrade.yml
  2. 4 2
      db/import-tmpl/enchantgrade.yml
  3. 8 2
      db/re/enchantgrade.yml
  4. 2 2
      src/map/clif.cpp
  5. 29 4
      src/map/status.cpp
  6. 3 2
      src/map/status.hpp

+ 4 - 2
db/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           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.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,7 +51,7 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2
 
 Footer:
   Imports:

+ 4 - 2
db/import-tmpl/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           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.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,4 +51,4 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2

+ 8 - 2
db/re/enchantgrade.yml

@@ -30,7 +30,9 @@
 #           Refine                      Required refine level.
 #           Chance                      Base chance of success out of 0~10000.
 #           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.
 #             Item                      The item that can be used.
 #             AmountPerStep             Amount of Item needed.
@@ -49,7 +51,7 @@
 
 Header:
   Type: ENCHANTGRADE_DB
-  Version: 1
+  Version: 2
 
 Body:
   - Type: Armor
@@ -98,6 +100,7 @@ Body:
             Refine: 11
             Chance: 5000
             Bonus: 50
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 5
@@ -117,6 +120,7 @@ Body:
             Refine: 11
             Chance: 4000
             Bonus: 100
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 7
@@ -178,6 +182,7 @@ Body:
             Refine: 11
             Chance: 5000
             Bonus: 50
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 5
@@ -197,6 +202,7 @@ Body:
             Refine: 11
             Chance: 4000
             Bonus: 100
+            AnnounceFail: true
             Catalyst:
                 Item: Blessed_Etel_Dust
                 AmountPerStep: 7

+ 2 - 2
src/map/clif.cpp

@@ -23636,12 +23636,12 @@ void clif_parse_enchantgrade_start( int fd, struct map_session_data* sd ){
 		clif_enchantgrade_result( *sd, index, ENCHANTGRADE_UPGRADE_SUCCESS );
 
 		// Check if it has to be announced
-		if( enchantgradelevel->announce ){
+		if( enchantgradelevel->announceSuccess ){
 			clif_enchantgrade_announce( *sd, sd->inventory.u.items_inventory[index], true );
 		}
 	}else{
 		// 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 );
 		}
 

+ 29 - 4
src/map/status.cpp

@@ -700,20 +700,45 @@ uint64 EnchantgradeDatabase::parseBodyNode( const ryml::NodeRef& node ){
 				}
 			}
 
-			if( this->nodeExists( gradeNode, "Announce" ) ){
+			if( this->nodeExists( gradeNode, "AnnounceSuccess" ) ){
 				bool announce;
 
-				if( !this->asBool( gradeNode, "Announce", announce ) ){
+				if( !this->asBool( gradeNode, "AnnounceSuccess", announce ) ){
 					return 0;
 				}
 
-				grade->announce = announce;
+				grade->announceSuccess = announce;
 			}else{
 				if( !gradeExists ){
-					grade->announce = true;
+					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" ) ){
+				bool announce;
+
+				if( !this->asBool( gradeNode, "Announce", announce ) ){
+					return 0;
+				}
+
+				grade->announceSuccess = announce;
+				grade->announceFail = announce;
+			}
+
 			if( this->nodeExists( gradeNode, "Catalyst") ){
 				const ryml::NodeRef& catalystNode = gradeNode["Catalyst"];
 

+ 3 - 2
src/map/status.hpp

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