Jump to content
Secrets

Release: Soul Link Modification - Script-based

Recommended Posts

On 3/3/2020 at 2:33 PM, Takuyakii said:

 

Solved ❤️

how did you fixed it?

 

Share this post


Link to post
Share on other sites
Posted (edited)

how did you solve?

&constant error on latest git?

@Takuyakii

@Secrets

 

On 2/21/2020 at 5:20 PM, Takuyakii said:

Any update about this? 

getting error on latest rev.

image.thumb.png.5d9e5c63ed0c0204a91faf9940e1f417.png

same error any update regarding this? using latest rathena git..

Edited by mhielo12
add person to tag

Share this post


Link to post
Share on other sites
On 3/3/2020 at 2:33 PM, Takuyakii said:

 

Solved ❤️

How did you solve it? Can you share with us?

Share this post


Link to post
Share on other sites

Updated to rAthena Git Hash: ad820c1, pending approval.

Further support depends on my mood at that moment.

  • Upvote 2

Share this post


Link to post
Share on other sites
On 4/2/2020 at 2:29 PM, Secrets said:

Updated to rAthena Git Hash: ad820c1, pending approval.

Further support depends on my mood at that moment.

Support please this mod really helps 😞

Share this post


Link to post
Share on other sites
3 hours ago, mhielo12 said:

Support please this mod really helps 😞

I think he updated this mod... download the latest one and check if its still giving you issues.

  • Upvote 1

Share this post


Link to post
Share on other sites
On 4/4/2020 at 7:48 AM, Radian said:

I think he updated this mod... download the latest one and check if its still giving you issues.

goodness thanks 🙂 

Share this post


Link to post
Share on other sites
Posted (edited)
On 12/14/2019 at 12:17 PM, Mabuhay said:

To get rid of the warning, just comment the header in db/soul_link.yml

#Header: # Metadata for future use
#  Type: MOD_SECRET_SOUL_LINK
#  Version: 1

 

It does work! Thanks!

Anybody fixes this warning?
image.thumb.png.8f2dff7598ac653b008279e13776065d.png
 

Edited by gidzdlcrz

Share this post


Link to post
Share on other sites
Posted (edited)

when i implement this mod. this happen when i use ./athena-start stop.
how to fix this? 

Latest git version.

leaked error.png

Edited by ScarrFace

Share this post


Link to post
Share on other sites
On 5/8/2020 at 7:28 AM, ScarrFace said:

when i implement this mod. this happen when i use ./athena-start stop.
how to fix this? 

Latest git version.

leaked error.png

Yep mine too. This screenshot is from my live server
image.png.9467d7e58c835ee3db2722c4ade9ce37.png
 

Maybe it has something to do with this (screenshot comes my from local server)image.thumb.png.f90cfc91d650e32964d16d816b8e48cf.png


Please @Secrets ♥ Thank you so much!

Share this post


Link to post
Share on other sites
On 11/2/2019 at 4:28 AM, Ice Bear said:

@secrets how to remove bonuses when you die and revive at the same place, the bonus effects retain unless you get buff with another status.

solved. solution lies in status.cpp and pc.cpp

hi how did you put on pc.c?

Share this post


Link to post
Share on other sites
On 5/17/2020 at 7:43 PM, Kuneho said:

hi how did you put on pc.c?

Its already been updated. The only problem now is the memory leak and the compile warning.

Share this post


Link to post
Share on other sites
17 hours ago, gidzdlcrz said:

Its already been updated. The only problem now is the memory leak and the compile warning.

nvm solve

Share this post


Link to post
Share on other sites

You are welcome to submit patches for fixing the mod 🙂

  • Upvote 2

Share this post


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

You are welcome to submit patches for fixing the mod 🙂

From a4fffed650a9719e1bbe1fbee4cf23fa6ecfb76a Mon Sep 17 00:00:00 2001
From: Jittapan Pluemsumran <secret@jittapan.app>
Date: Thu, 2 Apr 2020 13:26:35 +0700
Subject: [PATCH] :D

---
 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>
 #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);
+}
+
 /**
  * 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("db/soul_link.yml");
 	return 0;
 }
 
-- 
2.26.0.windows.1

here you go 😄  Even Ninja And Gunslinger is there i just add it just follow what is inside and its will run smoothly no memory Leak 😄 a  have Good they Thanks Sir @Secrets

Edited by Kuneho
  • Upvote 1

Share this post


Link to post
Share on other sites
On 5/24/2020 at 4:42 AM, Kuneho said:
From a4fffed650a9719e1bbe1fbee4cf23fa6ecfb76a Mon Sep 17 00:00:00 2001
From: Jittapan Pluemsumran <secret@jittapan.app>
Date: Thu, 2 Apr 2020 13:26:35 +0700
Subject: [PATCH] :D

---
 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>
 #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);
+}
+
 /**
  * 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("db/soul_link.yml");
 	return 0;
 }
 
-- 
2.26.0.windows.1

here you go 😄  Even Ninja And Gunslinger is there i just add it just follow what is inside and its will run smoothly no memory Leak 😄 a  have Good they Thanks Sir @Secrets

Hello @Kuneho. Ive checked every line and i must say the only difference with this and secrets were the additions of NINJA and GUNSLINGER. Howerver. The compile warning is still there. And maybe, just maybe thats the reason of the memory leak.

https://rathena.org/board/topic/115221-release-soul-link-modification-script-based/?do=findComment&comment=378296
 

Share this post


Link to post
Share on other sites
7 hours ago, gidzdlcrz said:

Hello @Kuneho. Ive checked every line and i must say the only difference with this and secrets were the additions of NINJA and GUNSLINGER. Howerver. The compile warning is still there. And maybe, just maybe thats the reason of the memory leak.

https://rathena.org/board/topic/115221-release-soul-link-modification-script-based/?do=findComment&comment=378296
 

maybe i can help if you show me all of youre SRC files that you edit 😄

Share this post


Link to post
Share on other sites
8 hours ago, Kuneho said:

maybe i can help if you show me all of youre SRC files that you edit 😄

I have done this to fresh pull from git. The compiler warning and the memory leak is still there. So i guess it has nothing to do with my other mods.

Share this post


Link to post
Share on other sites
Posted (edited)
void status_read_soullink_db(const char* file_name) {

adding the const from the original will remove the compiler warning.
however the memory leak will be there whenever you @mapexit. this is because the (script_buf) is not cleared when exiting the map server.. you just simply need to add this script_free_code(soul_link[(CONSTANT LOOP)]); esomewhere around the the mapexit. ^_~

Edited by Haruka Mayumi
  • Upvote 1

Share this post


Link to post
Share on other sites
3 hours ago, Haruka Mayumi said:
void status_read_soullink_db(const char* file_name) {

adding the const from the original will remove the compiler warning.
however the memory leak will be there whenever you @mapexit. this is because the (script_buf) is not cleared when exiting the map server.. you just simply need to add this script_free_code(soul_link[(CONSTANT LOOP)]); esomewhere around the the mapexit. ^_~

Where to do this @Haruka Mayumisama! ♥ Onegai desu! Hihi!

Share this post


Link to post
Share on other sites
Posted (edited)

hi, i got error like this?
 

[Error]: status_read_soullink_db: Cannot load custom soul link buffs from db/soul_link.yml.

how to solved this?

 

with this mod can solved this issue 4018

thanks secret !

Edited by LearningRO
solved

Share this post


Link to post
Share on other sites

New release, pending approval. Attempted to fix memory leaks in this release.

  • Upvote 3

Share this post


Link to post
Share on other sites

 

[ 88%] Building CXX object src/map/CMakeFiles/map-server.dir/status.cpp.o
/root/rathena/src/map/status.cpp: In function 'int status_readdb()':
/root/rathena/src/map/status.cpp:15980:44: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  status_read_soullink_db("db/soul_link.yml");

Change: 

status_read_soullink_db("db/soul_link.yml");

To:

status_read_soullink_db((char*)"db/soul_link.yml");

 

Share this post


Link to post
Share on other sites

Won’t be updating this for a while. Feel free to share your fixes.

Please remember that I’m not obliged to give you support. Please don’t PM me on Discord or on this site about this mod.

  • Upvote 1

Share this post


Link to post
Share on other sites
On 6/11/2020 at 10:07 PM, Secrets said:

New release, pending approval. Attempted to fix memory leaks in this release.

Wooow! Thanks @Secrets

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.