Jump to content
Secrets

Release: Soul Link Modification - Script-based

Recommended Posts

anyone know how to fix this?

[Error]: status_read_soullink_db: Cannot load custom soul link buffs from db/soul_link.yml.
[Info]: status_read_soullink_db: Done reading 0 custom soul links.

Edit: Fixed

 

Uh.. another problem...
is the autobonus3 not working in the soul_link.yml?

i got these effect working in the item_db.txt, then move it to the soul_link.yml, but it's not working anymore.

autobonus3 "{ bonus bStr,10; bonus bDex,10; bonus bFlee,15; }",1000,158400,459,"{ }";
autobonus3 "{ if(getskilllv(486)==5) { bonus bAtkRate,200; } }",1000,180000,486,"{ }";

any help on this please.

Edited by tokenacc001

Share this post


Link to post
Share on other sites
diff --git a/db/soul_link.yml b/db/soul_link.yml
---
 db/soul_link.yml             | 74 ++++++++++++++++++++++++++++++++++++
 src/map/script.cpp           |  1 +
 src/map/script_constants.hpp | 17 +++++++++
 src/map/status.cpp           | 50 ++++++++++++++++++++++++
 4 files changed, 142 insertions(+)
 create mode 100644 db/soul_link.yml

diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 000000000..bdcf72cb0
--- /dev/null
+++ b/db/soul_link.yml
@@ -0,0 +1,74 @@
+# Custom soul link buffs.
+# Author: Secret <Secret@rathena.org>
+#
+# Format
+# <SL_ constant>: <YAML string literal with a pair of enclosing bracket for the script>
+#
+# You can code the script just like an item script.
+#
+# Use ONLY spaces to indent.
+# DONT USE TABS
+
+# Header: # Metadata for future use
+#    Version: 1
+#    Type: MOD_SECRET_SOUL_LINK
+SL_ALCHEMIST: |
+    {
+        bonus bStr,1;
+    }
+SL_MONK: |
+    {
+        bonus bStr,1;
+    }
+SL_STAR: |
+    {
+        bonus bStr,1;
+    }
+SL_SAGE: |
+    {
+        bonus bStr,1;
+    }
+SL_CRUSADER: |
+    {
+        bonus bStr,1;
+    }
+SL_SUPERNOVICE: |
+    {
+        bonus bStr,1;
+    }
+SL_KNIGHT: |
+    {
+        bonus bStr,1;
+    }
+SL_WIZARD: |
+    {
+        bonus bStr,1;
+    }
+SL_PRIEST: |
+    {
+        bonus bStr,1;
+    }
+SL_BARDDANCER: |
+    {
+        bonus bStr,1;
+    }
+SL_ROGUE: |
+    {
+        bonus bStr,1;
+    }
+SL_ASSASIN: |
+    {
+        bonus bStr,1;
+    }
+SL_BLACKSMITH: |
+    {
+        bonus bStr,1;
+    }
+SL_HUNTER: |
+    {
+        bonus bStr,1;
+    }
+SL_SOULLINKER: |
+    {
+        bonus bStr,1;
+    }
+  SL_GUNNER: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"GS_DESPERADO",30;
+    }
+SL_NINJA: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"NJ_ISSEN",30;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index e9e10a643..69c9a0ab6 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -60,6 +60,7 @@
 #include "pc_groups.hpp"
 #include "pet.hpp"
 #include "quest.hpp"
+#include "status.hpp"
 #include "storage.hpp"
 
 using namespace rathena;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 16e405d0e..8e7bf166d 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -16,6 +16,23 @@
 	export_constant(INT_MIN);
 	export_constant(INT_MAX);
 
+	/* soul links */
+	export_constant(SL_ALCHEMIST);
+	export_constant(SL_MONK);
+	export_constant(SL_STAR);
+	export_constant(SL_SAGE);
+	export_constant(SL_CRUSADER);
+	export_constant(SL_SUPERNOVICE);
+	export_constant(SL_KNIGHT);
+	export_constant(SL_WIZARD);
+	export_constant(SL_PRIEST);
+	export_constant(SL_BARDDANCER);
+	export_constant(SL_ROGUE);
+	export_constant(SL_ASSASIN);
+	export_constant(SL_BLACKSMITH);
+	export_constant(SL_HUNTER);
+	export_constant(SL_SOULLINKER);
+	export_constant(SL_GUNNER);
+	export_constant(SL_NINJA);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index 84b832e12..2c51d139d 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <string>
+#include <unordered_map> //SKYZONE NOTE: DONOT PUT ON TOP MAKE SURE THIS ALWAYS BELOW OF STRING
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.hpp"
@@ -66,6 +67,8 @@ bool running_npc_stat_calc_event; /// Indicate if OnPCStatCalcEvent is running.
 // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits
 short current_equip_opt_index; /// Contains random option index of an equipped item. [Secret]
 
+std::unordered_map<int, script_code*> soul_link;
+
 unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 
 sc_type SkillStatusChangeTable[MAX_SKILL];
@@ -4086,6 +4089,13 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
 		current_equip_opt_index = -1;
 	}
 
+	if (sd && sc->count && sc->data[SC_SPIRIT]) {
+		auto spirit = sc->data[SC_SPIRIT];
+		if (spirit != nullptr && soul_link.find(spirit->val2) != soul_link.end() && soul_link[spirit->val2] != nullptr) {
+			run_script(soul_link[spirit->val2], 0, sd->bl.id, 0);
+		}
+	}
+
 	if (sc->count && sc->data[SC_ITEMSCRIPT]) {
 		struct item_data *data = itemdb_exists(sc->data[SC_ITEMSCRIPT]->val1);
 		if (data && data->script)
@@ -15491,6 +15501,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(const char* file_name) {
+	YAML::Node root;
+	int count = 0;
+	try {
+		root = YAML::LoadFile(file_name);
+		if (root.IsMap()) {
+			for (auto node : root) {
+				struct script_code *code;
+				std::string key = node.first.as<std::string>();
+				int64 constant = 0;
+				if (key.compare(0, 3, "SL_")) {
+					ShowWarning("status_read_soullink_db: Expected a constant with SL_ prefix, got %s.\n", key.c_str());
+					continue;
+				}
+				if (!script_get_constant(key.c_str(), &constant)) {
+					ShowWarning("status_read_soullink_db: Tried to assign custom buff to nonexistent constant %s.\n", key.c_str());
+					continue;
+				}
+				if ((code = parse_script(node.second.as<std::string>().c_str(), file_name, node.second.Mark().line, 0)) == NULL) {
+					ShowWarning("status_read_soullink_db: Invalid or empty script on custom soul link %s.\n", key.c_str());
+					continue;
+				}
+				if (soul_link[constant] != nullptr)
+					script_free_code(soul_link[constant]);
+				soul_link[constant] = code;
+				count++;
+			}
+		}
+		else {
+			ShowError("status_read_soullink_db: The file's structure is broken. Root node is not a map.\n");
+		}
+	}
+	catch (...) {
+		ShowError("status_read_soullink_db: Cannot load custom soul link buffs from %s.\n", file_name);
+	}
+
+	ShowInfo("status_read_soullink_db: Done reading %d custom soul links.\n", count);
+}

/**
*CLEAR THE STATUS AFTER DEATH
*/
+void status_clear_soul_link_db()
+{
+	for (const auto& entry : soul_link) {
+		script_free_code(entry.second);
+	}
+	soul_link.clear();
+}
+

 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -15557,6 +15606,7 @@ int status_readdb(void)
 
 	size_fix_db.load(); 
+	status_read_soullink_db((char*)"db/soul_link.yml");
 	return 0;
 }
 
 
/**
*CLEAR THE STATUS AFTER DEATH
*/
 
@@ find void do_final_status(void)
{
+	status_clear_soul_link_db(); //SKYZONE
	ers_destroy(sc_data_ers);
}

 

Read Some Note I put. I saw some error because they don't know the pattern of the script.
the script is working on any version you only need is to spot the pattern. I put some added clear the status after death I saw it some of comment how to do it. 

  • Upvote 1
  • MVP 1

Share this post


Link to post
Share on other sites
On 9/30/2020 at 1:39 PM, Skyzone said:
diff --git a/db/soul_link.yml b/db/soul_link.yml
---
 db/soul_link.yml             | 74 ++++++++++++++++++++++++++++++++++++
 src/map/script.cpp           |  1 +
 src/map/script_constants.hpp | 17 +++++++++
 src/map/status.cpp           | 50 ++++++++++++++++++++++++
 4 files changed, 142 insertions(+)
 create mode 100644 db/soul_link.yml

diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 000000000..bdcf72cb0
--- /dev/null
+++ b/db/soul_link.yml
@@ -0,0 +1,74 @@
+# Custom soul link buffs.
+# Author: Secret <Secret@rathena.org>
+#
+# Format
+# <SL_ constant>: <YAML string literal with a pair of enclosing bracket for the script>
+#
+# You can code the script just like an item script.
+#
+# Use ONLY spaces to indent.
+# DONT USE TABS
+
+# Header: # Metadata for future use
+#    Version: 1
+#    Type: MOD_SECRET_SOUL_LINK
+SL_ALCHEMIST: |
+    {
+        bonus bStr,1;
+    }
+SL_MONK: |
+    {
+        bonus bStr,1;
+    }
+SL_STAR: |
+    {
+        bonus bStr,1;
+    }
+SL_SAGE: |
+    {
+        bonus bStr,1;
+    }
+SL_CRUSADER: |
+    {
+        bonus bStr,1;
+    }
+SL_SUPERNOVICE: |
+    {
+        bonus bStr,1;
+    }
+SL_KNIGHT: |
+    {
+        bonus bStr,1;
+    }
+SL_WIZARD: |
+    {
+        bonus bStr,1;
+    }
+SL_PRIEST: |
+    {
+        bonus bStr,1;
+    }
+SL_BARDDANCER: |
+    {
+        bonus bStr,1;
+    }
+SL_ROGUE: |
+    {
+        bonus bStr,1;
+    }
+SL_ASSASIN: |
+    {
+        bonus bStr,1;
+    }
+SL_BLACKSMITH: |
+    {
+        bonus bStr,1;
+    }
+SL_HUNTER: |
+    {
+        bonus bStr,1;
+    }
+SL_SOULLINKER: |
+    {
+        bonus bStr,1;
+    }
+  SL_GUNNER: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"GS_DESPERADO",30;
+    }
+SL_NINJA: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"NJ_ISSEN",30;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index e9e10a643..69c9a0ab6 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -60,6 +60,7 @@
 #include "pc_groups.hpp"
 #include "pet.hpp"
 #include "quest.hpp"
+#include "status.hpp"
 #include "storage.hpp"
 
 using namespace rathena;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 16e405d0e..8e7bf166d 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -16,6 +16,23 @@
 	export_constant(INT_MIN);
 	export_constant(INT_MAX);
 
+	/* soul links */
+	export_constant(SL_ALCHEMIST);
+	export_constant(SL_MONK);
+	export_constant(SL_STAR);
+	export_constant(SL_SAGE);
+	export_constant(SL_CRUSADER);
+	export_constant(SL_SUPERNOVICE);
+	export_constant(SL_KNIGHT);
+	export_constant(SL_WIZARD);
+	export_constant(SL_PRIEST);
+	export_constant(SL_BARDDANCER);
+	export_constant(SL_ROGUE);
+	export_constant(SL_ASSASIN);
+	export_constant(SL_BLACKSMITH);
+	export_constant(SL_HUNTER);
+	export_constant(SL_SOULLINKER);
+	export_constant(SL_GUNNER);
+	export_constant(SL_NINJA);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index 84b832e12..2c51d139d 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <string>
+#include <unordered_map> //SKYZONE NOTE: DONOT PUT ON TOP MAKE SURE THIS ALWAYS BELOW OF STRING
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.hpp"
@@ -66,6 +67,8 @@ bool running_npc_stat_calc_event; /// Indicate if OnPCStatCalcEvent is running.
 // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits
 short current_equip_opt_index; /// Contains random option index of an equipped item. [Secret]
 
+std::unordered_map<int, script_code*> soul_link;
+
 unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 
 sc_type SkillStatusChangeTable[MAX_SKILL];
@@ -4086,6 +4089,13 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
 		current_equip_opt_index = -1;
 	}
 
+	if (sd && sc->count && sc->data[SC_SPIRIT]) {
+		auto spirit = sc->data[SC_SPIRIT];
+		if (spirit != nullptr && soul_link.find(spirit->val2) != soul_link.end() && soul_link[spirit->val2] != nullptr) {
+			run_script(soul_link[spirit->val2], 0, sd->bl.id, 0);
+		}
+	}
+
 	if (sc->count && sc->data[SC_ITEMSCRIPT]) {
 		struct item_data *data = itemdb_exists(sc->data[SC_ITEMSCRIPT]->val1);
 		if (data && data->script)
@@ -15491,6 +15501,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(const char* file_name) {
+	YAML::Node root;
+	int count = 0;
+	try {
+		root = YAML::LoadFile(file_name);
+		if (root.IsMap()) {
+			for (auto node : root) {
+				struct script_code *code;
+				std::string key = node.first.as<std::string>();
+				int64 constant = 0;
+				if (key.compare(0, 3, "SL_")) {
+					ShowWarning("status_read_soullink_db: Expected a constant with SL_ prefix, got %s.\n", key.c_str());
+					continue;
+				}
+				if (!script_get_constant(key.c_str(), &constant)) {
+					ShowWarning("status_read_soullink_db: Tried to assign custom buff to nonexistent constant %s.\n", key.c_str());
+					continue;
+				}
+				if ((code = parse_script(node.second.as<std::string>().c_str(), file_name, node.second.Mark().line, 0)) == NULL) {
+					ShowWarning("status_read_soullink_db: Invalid or empty script on custom soul link %s.\n", key.c_str());
+					continue;
+				}
+				if (soul_link[constant] != nullptr)
+					script_free_code(soul_link[constant]);
+				soul_link[constant] = code;
+				count++;
+			}
+		}
+		else {
+			ShowError("status_read_soullink_db: The file's structure is broken. Root node is not a map.\n");
+		}
+	}
+	catch (...) {
+		ShowError("status_read_soullink_db: Cannot load custom soul link buffs from %s.\n", file_name);
+	}
+
+	ShowInfo("status_read_soullink_db: Done reading %d custom soul links.\n", count);
+}

/**
*CLEAR THE STATUS AFTER DEATH
*/
+void status_clear_soul_link_db()
+{
+	for (const auto& entry : soul_link) {
+		script_free_code(entry.second);
+	}
+	soul_link.clear();
+}
+

 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -15557,6 +15606,7 @@ int status_readdb(void)
 
 	size_fix_db.load(); 
+	status_read_soullink_db((char*)"db/soul_link.yml");
 	return 0;
 }
 
 
/**
*CLEAR THE STATUS AFTER DEATH
*/
 
@@ find void do_final_status(void)
{
+	status_clear_soul_link_db(); //SKYZONE
	ers_destroy(sc_data_ers);
}

 

Read Some Note I put. I saw some error because they don't know the pattern of the script.
the script is working on any version you only need is to spot the pattern. I put some added clear the status after death I saw it some of comment how to do it. 

Banzai!

Share this post


Link to post
Share on other sites

Gunslinger Spirit    
    -Enable the use of any weapon-specific skills by using revolver
    -Tracking cast time is removed
    -Increase HP by (100*BLVL)
   
how to add this? anyone?

  • Upvote 1

Share this post


Link to post
Share on other sites
56fbf3d297ed1333f728d79e2b8c17bb - Copy.jpg

anyone can help me i tried to re-patch this again but it keeps error

On 7/22/2020 at 3:22 PM, tokenacc001 said:

anyone know how to fix this?

[Error]: status_read_soullink_db: Cannot load custom soul link buffs from db/soul_link.yml.
[Info]: status_read_soullink_db: Done reading 0 custom soul links.

Edit: Fixed

 

Uh.. another problem...
is the autobonus3 not working in the soul_link.yml?

i got these effect working in the item_db.txt, then move it to the soul_link.yml, but it's not working anymore.

autobonus3 "{ bonus bStr,10; bonus bDex,10; bonus bFlee,15; }",1000,158400,459,"{ }";
autobonus3 "{ if(getskilllv(486)==5) { bonus bAtkRate,200; } }",1000,180000,486,"{ }";

any help on this please.

FIXED!!

Edited by Rook1es

Share this post


Link to post
Share on other sites

where should i put the file exactly?

i made it working now

 

i got error when building solution these are the lines the script works though but when i made changes and do @reloadscript changes wont apply

if (soul_link[constant] != nullptr)
                        script_free_code(soul_link[constant]);
                soul_link[constant] = code;

10>c:\users\user\documents\ra\rathena\src\map\status.cpp(3757): warning C4244: 'argument': conversion from 'int64' to 'const int', possible loss of data
10>c:\users\user\documents\ra\rathena\src\map\status.cpp(3758): warning C4244: 'argument': conversion from 'int64' to 'const int', possible loss of data
10>c:\users\user\documents\ra\rathena\src\map\status.cpp(3759): warning C4244: 'argument': conversion from 'int64' to 'const int', possible loss of data


 

Edited by kalabasa

Share this post


Link to post
Share on other sites
On 9/30/2020 at 1:39 PM, Skyzone said:
diff --git a/db/soul_link.yml b/db/soul_link.yml
---
 db/soul_link.yml             | 74 ++++++++++++++++++++++++++++++++++++
 src/map/script.cpp           |  1 +
 src/map/script_constants.hpp | 17 +++++++++
 src/map/status.cpp           | 50 ++++++++++++++++++++++++
 4 files changed, 142 insertions(+)
 create mode 100644 db/soul_link.yml

diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 000000000..bdcf72cb0
--- /dev/null
+++ b/db/soul_link.yml
@@ -0,0 +1,74 @@
+# Custom soul link buffs.
+# Author: Secret <Secret@rathena.org>
+#
+# Format
+# <SL_ constant>: <YAML string literal with a pair of enclosing bracket for the script>
+#
+# You can code the script just like an item script.
+#
+# Use ONLY spaces to indent.
+# DONT USE TABS
+
+# Header: # Metadata for future use
+#    Version: 1
+#    Type: MOD_SECRET_SOUL_LINK
+SL_ALCHEMIST: |
+    {
+        bonus bStr,1;
+    }
+SL_MONK: |
+    {
+        bonus bStr,1;
+    }
+SL_STAR: |
+    {
+        bonus bStr,1;
+    }
+SL_SAGE: |
+    {
+        bonus bStr,1;
+    }
+SL_CRUSADER: |
+    {
+        bonus bStr,1;
+    }
+SL_SUPERNOVICE: |
+    {
+        bonus bStr,1;
+    }
+SL_KNIGHT: |
+    {
+        bonus bStr,1;
+    }
+SL_WIZARD: |
+    {
+        bonus bStr,1;
+    }
+SL_PRIEST: |
+    {
+        bonus bStr,1;
+    }
+SL_BARDDANCER: |
+    {
+        bonus bStr,1;
+    }
+SL_ROGUE: |
+    {
+        bonus bStr,1;
+    }
+SL_ASSASIN: |
+    {
+        bonus bStr,1;
+    }
+SL_BLACKSMITH: |
+    {
+        bonus bStr,1;
+    }
+SL_HUNTER: |
+    {
+        bonus bStr,1;
+    }
+SL_SOULLINKER: |
+    {
+        bonus bStr,1;
+    }
+  SL_GUNNER: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"GS_DESPERADO",30;
+    }
+SL_NINJA: |
+    {
+        bonus bMaxHPrate,50; bonus2 bSkillAtk,"NJ_ISSEN",30;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index e9e10a643..69c9a0ab6 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -60,6 +60,7 @@
 #include "pc_groups.hpp"
 #include "pet.hpp"
 #include "quest.hpp"
+#include "status.hpp"
 #include "storage.hpp"
 
 using namespace rathena;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 16e405d0e..8e7bf166d 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -16,6 +16,23 @@
 	export_constant(INT_MIN);
 	export_constant(INT_MAX);
 
+	/* soul links */
+	export_constant(SL_ALCHEMIST);
+	export_constant(SL_MONK);
+	export_constant(SL_STAR);
+	export_constant(SL_SAGE);
+	export_constant(SL_CRUSADER);
+	export_constant(SL_SUPERNOVICE);
+	export_constant(SL_KNIGHT);
+	export_constant(SL_WIZARD);
+	export_constant(SL_PRIEST);
+	export_constant(SL_BARDDANCER);
+	export_constant(SL_ROGUE);
+	export_constant(SL_ASSASIN);
+	export_constant(SL_BLACKSMITH);
+	export_constant(SL_HUNTER);
+	export_constant(SL_SOULLINKER);
+	export_constant(SL_GUNNER);
+	export_constant(SL_NINJA);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index 84b832e12..2c51d139d 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <string>
+#include <unordered_map> //SKYZONE NOTE: DONOT PUT ON TOP MAKE SURE THIS ALWAYS BELOW OF STRING
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.hpp"
@@ -66,6 +67,8 @@ bool running_npc_stat_calc_event; /// Indicate if OnPCStatCalcEvent is running.
 // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits
 short current_equip_opt_index; /// Contains random option index of an equipped item. [Secret]
 
+std::unordered_map<int, script_code*> soul_link;
+
 unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 
 sc_type SkillStatusChangeTable[MAX_SKILL];
@@ -4086,6 +4089,13 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
 		current_equip_opt_index = -1;
 	}
 
+	if (sd && sc->count && sc->data[SC_SPIRIT]) {
+		auto spirit = sc->data[SC_SPIRIT];
+		if (spirit != nullptr && soul_link.find(spirit->val2) != soul_link.end() && soul_link[spirit->val2] != nullptr) {
+			run_script(soul_link[spirit->val2], 0, sd->bl.id, 0);
+		}
+	}
+
 	if (sc->count && sc->data[SC_ITEMSCRIPT]) {
 		struct item_data *data = itemdb_exists(sc->data[SC_ITEMSCRIPT]->val1);
 		if (data && data->script)
@@ -15491,6 +15501,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(const char* file_name) {
+	YAML::Node root;
+	int count = 0;
+	try {
+		root = YAML::LoadFile(file_name);
+		if (root.IsMap()) {
+			for (auto node : root) {
+				struct script_code *code;
+				std::string key = node.first.as<std::string>();
+				int64 constant = 0;
+				if (key.compare(0, 3, "SL_")) {
+					ShowWarning("status_read_soullink_db: Expected a constant with SL_ prefix, got %s.\n", key.c_str());
+					continue;
+				}
+				if (!script_get_constant(key.c_str(), &constant)) {
+					ShowWarning("status_read_soullink_db: Tried to assign custom buff to nonexistent constant %s.\n", key.c_str());
+					continue;
+				}
+				if ((code = parse_script(node.second.as<std::string>().c_str(), file_name, node.second.Mark().line, 0)) == NULL) {
+					ShowWarning("status_read_soullink_db: Invalid or empty script on custom soul link %s.\n", key.c_str());
+					continue;
+				}
+				if (soul_link[constant] != nullptr)
+					script_free_code(soul_link[constant]);
+				soul_link[constant] = code;
+				count++;
+			}
+		}
+		else {
+			ShowError("status_read_soullink_db: The file's structure is broken. Root node is not a map.\n");
+		}
+	}
+	catch (...) {
+		ShowError("status_read_soullink_db: Cannot load custom soul link buffs from %s.\n", file_name);
+	}
+
+	ShowInfo("status_read_soullink_db: Done reading %d custom soul links.\n", count);
+}

/**
*CLEAR THE STATUS AFTER DEATH
*/
+void status_clear_soul_link_db()
+{
+	for (const auto& entry : soul_link) {
+		script_free_code(entry.second);
+	}
+	soul_link.clear();
+}
+

 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -15557,6 +15606,7 @@ int status_readdb(void)
 
 	size_fix_db.load(); 
+	status_read_soullink_db((char*)"db/soul_link.yml");
 	return 0;
 }
 
 
/**
*CLEAR THE STATUS AFTER DEATH
*/
 
@@ find void do_final_status(void)
{
+	status_clear_soul_link_db(); //SKYZONE
	ers_destroy(sc_data_ers);
}

 

Read Some Note I put. I saw some error because they don't know the pattern of the script.
the script is working on any version you only need is to spot the pattern. I put some added clear the status after death I saw it some of comment how to do it. 

Hello sir i think need to add this

skill.cpp

 

Find :

    case SL_ALCHEMIST:
    case SL_ASSASIN:
    case SL_BARDDANCER:
    case SL_BLACKSMITH:
    case SL_CRUSADER:
    case SL_HUNTER:
    case SL_KNIGHT:
    case SL_MONK:
    case SL_PRIEST:
    case SL_ROGUE:
    case SL_SAGE:
    case SL_SOULLINKER:
    case SL_STAR:
    case SL_SUPERNOVICE:
    case SL_WIZARD:
        if (sd && tsc && (tsc->data[SC_SOULGOLEM] || tsc->data[SC_SOULSHADOW] || tsc->data[SC_SOULFALCON] || tsc->data[SC_SOULFAIRY])) { // Soul links from Soul Linker and Soul Reaper skills don't stack.
            clif_skill_fail(sd, skill_id, USESKILL_FAIL,0);
            break;
        }
        //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SPIRIT constant.
        if (sd && dstsd && !((dstsd->class_&MAPID_UPPERMASK) == type)) {
            clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
            break;
        }
 

Add :

    case SL_ALCHEMIST:
    case SL_ASSASIN:
    case SL_BARDDANCER:
    case SL_BLACKSMITH:
    case SL_CRUSADER:
    case SL_HUNTER:
    case SL_KNIGHT:
    case SL_MONK:
    case SL_PRIEST:
    case SL_ROGUE:
    case SL_SAGE:
    case SL_SOULLINKER:
    case SL_STAR:
    case SL_SUPERNOVICE:
    case SL_WIZARD:
+   case SL_GUNNER:
+   case SL_NINJA:
        if (sd && tsc && (tsc->data[SC_SOULGOLEM] || tsc->data[SC_SOULSHADOW] || tsc->data[SC_SOULFALCON] || tsc->data[SC_SOULFAIRY])) { // Soul links from Soul Linker and Soul Reaper skills don't stack.
            clif_skill_fail(sd, skill_id, USESKILL_FAIL,0);
            break;
        }
        //NOTE: here, 'type' has the value of the associated MAPID, not of the SC_SPIRIT constant.
        if (sd && dstsd && !((dstsd->class_&MAPID_UPPERMASK) == type)) {
            clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
            break;
        }

 

status.cpp

Find :

    /* Storing the target job rather than simply SC_SPIRIT simplifies code later on */
    SkillStatusChangeTable[skill_get_index(SL_ALCHEMIST)]    = (sc_type)MAPID_ALCHEMIST,
    SkillStatusChangeTable[skill_get_index(SL_MONK)]        = (sc_type)MAPID_MONK,
    SkillStatusChangeTable[skill_get_index(SL_STAR)]        = (sc_type)MAPID_STAR_GLADIATOR,
    SkillStatusChangeTable[skill_get_index(SL_SAGE)]        = (sc_type)MAPID_SAGE,
    SkillStatusChangeTable[skill_get_index(SL_CRUSADER)]    = (sc_type)MAPID_CRUSADER,
    SkillStatusChangeTable[skill_get_index(SL_SUPERNOVICE)]    = (sc_type)MAPID_SUPER_NOVICE,
    SkillStatusChangeTable[skill_get_index(SL_KNIGHT)]    = (sc_type)MAPID_KNIGHT,
    SkillStatusChangeTable[skill_get_index(SL_WIZARD)]    = (sc_type)MAPID_WIZARD,
    SkillStatusChangeTable[skill_get_index(SL_PRIEST)]    = (sc_type)MAPID_PRIEST,
    SkillStatusChangeTable[skill_get_index(SL_BARDDANCER)]    = (sc_type)MAPID_BARDDANCER,
    SkillStatusChangeTable[skill_get_index(SL_ROGUE)]    = (sc_type)MAPID_ROGUE,
    SkillStatusChangeTable[skill_get_index(SL_ASSASIN)]    = (sc_type)MAPID_ASSASSIN,
    SkillStatusChangeTable[skill_get_index(SL_BLACKSMITH)]    = (sc_type)MAPID_BLACKSMITH,
    SkillStatusChangeTable[skill_get_index(SL_HUNTER)]    = (sc_type)MAPID_HUNTER,
    SkillStatusChangeTable[skill_get_index(SL_SOULLINKER)]    = (sc_type)MAPID_SOUL_LINKER,

add :

    /* Storing the target job rather than simply SC_SPIRIT simplifies code later on */
    SkillStatusChangeTable[skill_get_index(SL_ALCHEMIST)]    = (sc_type)MAPID_ALCHEMIST,
    SkillStatusChangeTable[skill_get_index(SL_MONK)]        = (sc_type)MAPID_MONK,
    SkillStatusChangeTable[skill_get_index(SL_STAR)]        = (sc_type)MAPID_STAR_GLADIATOR,
    SkillStatusChangeTable[skill_get_index(SL_SAGE)]        = (sc_type)MAPID_SAGE,
    SkillStatusChangeTable[skill_get_index(SL_CRUSADER)]    = (sc_type)MAPID_CRUSADER,
    SkillStatusChangeTable[skill_get_index(SL_SUPERNOVICE)]    = (sc_type)MAPID_SUPER_NOVICE,
    SkillStatusChangeTable[skill_get_index(SL_KNIGHT)]    = (sc_type)MAPID_KNIGHT,
    SkillStatusChangeTable[skill_get_index(SL_WIZARD)]    = (sc_type)MAPID_WIZARD,
    SkillStatusChangeTable[skill_get_index(SL_PRIEST)]    = (sc_type)MAPID_PRIEST,
    SkillStatusChangeTable[skill_get_index(SL_BARDDANCER)]    = (sc_type)MAPID_BARDDANCER,
    SkillStatusChangeTable[skill_get_index(SL_ROGUE)]    = (sc_type)MAPID_ROGUE,
    SkillStatusChangeTable[skill_get_index(SL_ASSASIN)]    = (sc_type)MAPID_ASSASSIN,
    SkillStatusChangeTable[skill_get_index(SL_BLACKSMITH)]    = (sc_type)MAPID_BLACKSMITH,
    SkillStatusChangeTable[skill_get_index(SL_HUNTER)]    = (sc_type)MAPID_HUNTER,
    SkillStatusChangeTable[skill_get_index(SL_SOULLINKER)]    = (sc_type)MAPID_SOUL_LINKER,
+    SkillStatusChangeTable[skill_get_index(SL_GUNNER)]    = (sc_type)MAPID_GUNSLINGER,
+    SkillStatusChangeTable[skill_get_index(SL_NINJA)]    = (sc_type)MAPID_NINJA,

restart your server then recompile

i hope it helps 🙂
 

 

Edited by Rook1es

Share this post


Link to post
Share on other sites
On 7/22/2020 at 1:22 AM, tokenacc001 said:

anyone know how to fix this?

[Error]: status_read_soullink_db: Cannot load custom soul link buffs from db/soul_link.yml.
[Info]: status_read_soullink_db: Done reading 0 custom soul links.

Edit: Fixed

.

howd u fix this my friend?

Share this post


Link to post
Share on other sites

need to update of source

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, Chasewalk said:

need to update of source

can i send you a message?

 

edit:

my source is updated, now i fixed this error by applying the fix in “issue 4018”. However, i can not edit the default db/soul_link.yml.

Edited by Fresh prince

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, Fresh prince said:

 

my source is updated, now i fixed this error by applying the fix in “issue 4018”. However, i can not edit the default db/soul_link.yml.

disregard this it’s been working. I’m testing it with the wrong item. sorry

 

Edited by Fresh prince

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.