Jump to content
  • 0

Unable to run Soul Link Mod


Rivers

Question


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   46
  • Joined:  12/04/13
  • Last Seen:  

Good day, I'm having some issues setting up this Soul Link mod into my server. Does anyone know what to do? This is the script below.
 

diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 0000000000..bdcf72cb0c
--- /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;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..b696158ca1 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -66,6 +66,7 @@
 #include "mob.hpp"
 #include "channel.hpp"
 #include "achievement.hpp"
+#include "status.hpp"
 
 struct eri *array_ers;
 DBMap *st_db;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 2f7f44d3b1..105fe90b81 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -13,6 +13,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);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..ee34868dfa 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <string>
 #include <functional>
+#include <unordered_map>
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.h"
@@ -65,6 +66,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];
@@ -3716,6 +3719,13 @@ int status_calc_pc_(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)
@@ -14492,6 +14502,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(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>();
+				int 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);
+}
+
 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -14560,6 +14609,8 @@ int status_readdb(void)
 		aFree(dbsubpath1);
 		aFree(dbsubpath2);
 	}
+
+	status_read_soullink_db("db/soul_link.yml");
 	return 0;
 }
 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  109
  • Reputation:   5
  • Joined:  03/17/16
  • Last Seen:  

On 6/11/2020 at 9:15 PM, Rivers said:

Good day, I'm having some issues setting up this Soul Link mod into my server. Does anyone know what to do? This is the script below.
 


diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 0000000000..bdcf72cb0c
--- /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;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..b696158ca1 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -66,6 +66,7 @@
 #include "mob.hpp"
 #include "channel.hpp"
 #include "achievement.hpp"
+#include "status.hpp"
 
 struct eri *array_ers;
 DBMap *st_db;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 2f7f44d3b1..105fe90b81 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -13,6 +13,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);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..ee34868dfa 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <string>
 #include <functional>
+#include <unordered_map>
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.h"
@@ -65,6 +66,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];
@@ -3716,6 +3719,13 @@ int status_calc_pc_(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)
@@ -14492,6 +14502,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(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>();
+				int 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);
+}
+
 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -14560,6 +14609,8 @@ int status_readdb(void)
 		aFree(dbsubpath1);
 		aFree(dbsubpath2);
 	}
+
+	status_read_soullink_db("db/soul_link.yml");
 	return 0;
 }
 

 

this script its 100% working on my server. 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  235
  • Reputation:   46
  • Joined:  12/04/13
  • Last Seen:  

May you assist me with installtion? I'm not sure how to do this.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.01
  • Content Count:  54
  • Reputation:   0
  • Joined:  08/10/20
  • Last Seen:  

On 6/11/2020 at 9:15 PM, Rivers said:

good day ser how you create WORKING CODE for rathena


diff --git a/db/soul_link.yml b/db/soul_link.yml
new file mode 100644
index 0000000000..bdcf72cb0c
--- /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;
+    }
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 0b2386c32d..b696158ca1 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -66,6 +66,7 @@
 #include "mob.hpp"
 #include "channel.hpp"
 #include "achievement.hpp"
+#include "status.hpp"
 
 struct eri *array_ers;
 DBMap *st_db;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 2f7f44d3b1..105fe90b81 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -13,6 +13,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);
+
 	/* server defines */
 	export_constant(PACKETVER);
 	export_constant(MAX_LEVEL);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index af4c3afb00..ee34868dfa 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <string>
 #include <functional>
+#include <unordered_map>
 #include <yaml-cpp/yaml.h>
 
 #include "../common/cbasetypes.h"
@@ -65,6 +66,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];
@@ -3716,6 +3719,13 @@ int status_calc_pc_(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)
@@ -14492,6 +14502,45 @@ static bool status_readdb_attrfix(const char *basedir,bool silent)
 	return true;
 }
 
+void status_read_soullink_db(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>();
+				int 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);
+}
+
 /**
  * Sets defaults in tables and starts read db functions
  * sv_readdb reads the file, outputting the information line-by-line to
@@ -14560,6 +14609,8 @@ int status_readdb(void)
 		aFree(dbsubpath1);
 		aFree(dbsubpath2);
 	}
+
+	status_read_soullink_db("db/soul_link.yml");
 	return 0;
 }
 

 

 

Link to comment
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
Answer this question...

×   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...