فهرست منبع

CastCancel Attribute Fixes (#9028)

- The CastCancel attribute now defaults to "true"
- Corrected the list of skills that cannot be cast-canceled (fixes #9023)
  * Please see linked issue for a complete list of skill changes

Co-authored-by: Lemongrass3110
Playtester 3 ماه پیش
والد
کامیت
012741b2e7
9فایلهای تغییر یافته به همراه94 افزوده شده و 222 حذف شده
  1. 3 3
      db/import-tmpl/skill_db.yml
  2. 15 112
      db/pre-re/skill_db.yml
  3. 31 96
      db/re/skill_db.yml
  4. 3 3
      db/skill_db.yml
  5. 2 2
      doc/yaml/db/skill_db.yml
  6. 1 1
      src/map/skill.cpp
  7. 1 1
      src/map/skill.hpp
  8. 4 4
      src/tool/csv2yaml.cpp
  9. 34 0
      src/tool/yamlupgrade.cpp

+ 3 - 3
db/import-tmpl/skill_db.yml

@@ -1,5 +1,5 @@
 # This file is a part of rAthena.
-#   Copyright(C) 2021 rAthena Development Team
+#   Copyright(C) 2024 rAthena Development Team
 #   https://rathena.org - https://github.com/rathena
 #
 # This program is free software: you can redistribute it and/or modify
@@ -58,7 +58,7 @@
 #   NoNearNPC:                Determines if the skill can be used near a NPC. (Optional)
 #     AdditionalRange         Number of cells from an NPC where the skill can be cast. (Optional)
 #     Type:                   Type of NPC.
-#   CastCancel                Cancel cast when hit. (Default: false)
+#   CastCancel                Cancel cast when hit. (Default: true)
 #   CastDefenseReduction      Defense reduction rate during skill cast. (Default: 0)
 #   CastTime:                 Time to cast the skill in milliseconds. (Default: 0)
 #     - Level                 Skill level.
@@ -140,4 +140,4 @@
 
 Header:
   Type: SKILL_DB
-  Version: 3
+  Version: 4

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 15 - 112
db/pre-re/skill_db.yml


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 31 - 96
db/re/skill_db.yml


+ 3 - 3
db/skill_db.yml

@@ -58,7 +58,7 @@
 #   NoNearNPC:                Determines if the skill can be used near a NPC. (Optional)
 #     AdditionalRange         Number of cells from an NPC where the skill can be cast. (Optional)
 #     Type:                   Type of NPC.
-#   CastCancel                Cancel cast when hit. (Default: false)
+#   CastCancel                Cancel cast when hit. (Default: true)
 #   CastDefenseReduction      Defense reduction rate during skill cast. (Default: 0)
 #   CastTime:                 Time to cast the skill in milliseconds. (Default: 0)
 #     - Level                 Skill level.
@@ -115,7 +115,7 @@
 #         Amount              Ammo amount required at specific skill level.
 #     State                   Special state required to cast. (Default: None)
 #     Status:                 Status change required to cast. (Default: nullptr)
-#     SphereCost:             Spirit sphere required to cast. (Default: 0)
+#     SpiritSphereCost:       Spirit sphere required to cast. (Default: 0)
 #       - Level               Skill level.
 #         Amount              Spirit sphere required at specific skill level.
 #     ItemCost:               Item required to cast. (Default: 0)
@@ -140,7 +140,7 @@
 
 Header:
   Type: SKILL_DB
-  Version: 3
+  Version: 4
 
 Footer:
   Imports:

+ 2 - 2
doc/yaml/db/skill_db.yml

@@ -41,7 +41,7 @@
 #   NoNearNPC:                Determines if the skill can be used near a NPC. (Optional)
 #     AdditionalRange         Number of cells from an NPC where the skill can be cast. (Optional)
 #     Type:                   Type of NPC.
-#   CastCancel                Cancel cast when hit. (Default: false)
+#   CastCancel                Cancel cast when hit. (Default: true)
 #   CastDefenseReduction      Defense reduction rate during skill cast. (Default: 0)
 #   CastTime:                 Time to cast the skill in milliseconds. (Default: 0)
 #     - Level                 Skill level.
@@ -98,7 +98,7 @@
 #         Amount              Ammo amount required at specific skill level.
 #     State                   Special state required to cast. (Default: None)
 #     Status:                 Status change required to cast. (Default: nullptr)
-#     SphereCost:             Spirit sphere required to cast. (Default: 0)
+#     SpiritSphereCost:       Spirit sphere required to cast. (Default: 0)
 #       - Level               Skill level.
 #         Amount              Spirit sphere required at specific skill level.
 #     ItemCost:               Item required to cast. (Default: 0)

+ 1 - 1
src/map/skill.cpp

@@ -24894,7 +24894,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef& node) {
 		skill->castcancel = active;
 	} else {
 		if (!exists)
-			skill->castcancel = false;
+			skill->castcancel = true;
 	}
 
 	if (this->nodeExists(node, "CastDefenseReduction")) {

+ 1 - 1
src/map/skill.hpp

@@ -317,7 +317,7 @@ private:
 	template<typename T, size_t S> bool parseNode(const std::string& nodeName, const std::string& subNodeName, const ryml::NodeRef& node, T(&arr)[S]);
 
 public:
-	SkillDatabase() : TypesafeCachedYamlDatabase("SKILL_DB", 3, 1) {
+	SkillDatabase() : TypesafeCachedYamlDatabase("SKILL_DB", 4) {
 		this->clear();
 	}
 

+ 4 - 4
src/tool/csv2yaml.cpp

@@ -288,14 +288,14 @@ bool Csv2YamlTool::initialize( int32 argc, char* argv[] ){
 	}
 
 	skill_txt_data( path_db_mode, path_db );
-	if (!process("SKILL_DB", 3, { path_db_mode }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
+	if (!process("SKILL_DB", 4, { path_db_mode }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
 		return sv_readdb(path.c_str(), name_ext.c_str(), ',', 18, 18, -1, &skill_parse_row_skilldb, false);
 	})){
 		return false;
 	}
 
 	skill_txt_data( path_db_import, path_db_import );
-	if (!process("SKILL_DB", 3, { path_db_import }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
+	if (!process("SKILL_DB", 4, { path_db_import }, "skill_db", [](const std::string& path, const std::string& name_ext) -> bool {
 		return sv_readdb(path.c_str(), name_ext.c_str(), ',', 18, 18, -1, &skill_parse_row_skilldb, false);
 	})){
 		return false;
@@ -1727,8 +1727,8 @@ static bool skill_parse_row_skilldb( char* split[], size_t columns, size_t curre
 		body << YAML::EndMap;
 	}
 
-	if (strcmpi(split[9], "yes") == 0)
-		body << YAML::Key << "CastCancel" << YAML::Value << "true";
+	if (strcmpi(split[9], "yes") != 0)
+		body << YAML::Key << "CastCancel" << YAML::Value << "false";
 	if (atoi(split[10]) != 0)
 		body << YAML::Key << "CastDefenseReduction" << YAML::Value << atoi(split[10]);
 

+ 34 - 0
src/tool/yamlupgrade.cpp

@@ -12,6 +12,7 @@ static bool upgrade_status_db(std::string file, const uint32 source_version);
 static bool upgrade_map_drops_db(std::string file, const uint32 source_version);
 static bool upgrade_enchantgrade_db( std::string file, const uint32 source_version );
 static bool upgrade_item_group_db( std::string file, const uint32 source_version );
+static bool upgrade_skill_db( std::string file, const uint32 source_version );
 
 template<typename Func>
 bool process(const std::string &type, uint32 version, const std::vector<std::string> &paths, const std::string &name, Func lambda) {
@@ -151,6 +152,12 @@ bool YamlUpgradeTool::initialize( int32 argc, char* argv[] ){
 		return false;
 	}
 
+	if( !process( "SKILL_DB", 4, root_paths, "skill_db", []( const std::string& path, const std::string& name_ext, uint32 source_version ) -> bool {
+		return upgrade_skill_db( path + name_ext, source_version );
+		} ) ){
+		return false;
+	}
+
 	return true;
 }
 
@@ -524,6 +531,33 @@ static bool upgrade_item_group_db( std::string file, const uint32 source_version
 	return true;
 }
 
+static bool upgrade_skill_db( std::string file, const uint32 source_version ){
+	size_t entries = 0;
+
+	for( auto input : inNode["Body"] ){
+		// If under version 4
+		if( source_version < 4 ){
+			if( input["CastCancel"].IsDefined() ){
+				// If CastCancel was true (new default value)
+				if( input["CastCancel"].as<bool>() ){
+					// Remove it
+					input.remove( "CastCancel" );
+				}
+			}else{
+				if( input["CastTime"].IsDefined() || input["FixedCastTime"].IsDefined() ){
+					input.force_insert( "CastCancel", false );
+				}
+			}
+		}
+
+		body << input;
+		entries++;
+	}
+
+	ShowStatus( "Done converting/upgrading '" CL_WHITE "%zu" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", entries, file.c_str() );
+
+	return true;
+}
 
 int32 main( int32 argc, char *argv[] ){
 	return main_core<YamlUpgradeTool>( argc, argv );

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است