Jump to content
  • 0

@cloneskill


Worst

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  57
  • Reputation:   1
  • Joined:  12/07/13
  • Last Seen:  

I tried installing this diff but when compiling the error. I've tried changing the lvl per level and remained the error.

 

download diff: http://www.mediafire.com/download/shh7arv444mxbf4

Index: src/map/script.c
===================================================================
--- src/map/script.c	(revision 1187)
+++ src/map/script.c	(working copy)
@@ -14949,7 +14949,48 @@
 	return 0;
 }
 
+/* ====================================================== *
+ * cloneskill [Hold]
+ * ------------------------------------------------------ */
+BUILDIN_FUNC(cloneskill)
+{
+	int id = ((script_isint(st,2)) ? skill_get_index(script_getnum(st,2)) : skill_name2id(script_getstr(st,2)));
+	int lvl = script_getnum(st,3), oldskreg;
+	TBL_PC *sd = script_rid2sd(st);
+
+	if(!sd) return 1;
+
+	if(id <= 0 || lvl <= 0)
+	{
+		ShowError("buildin_cloneskill: Incorrect data for skill, ID = %d | Level = %d", id, lvl);
+		return 1;
+	}
+
+	if(oldskreg = pc_readglobalreg(sd, "CLONE_SKILL"))
+	{
+		sd->status.skill[oldskreg].id = 0;
+		sd->status.skill[oldskreg].lv = 0;
+		sd->status.skill[oldskreg].flag = 0;
+		clif_deleteskill(sd, oldskreg);
+	}
+
+	sd->status.skill[id].id = id;
+	sd->status.skill[id].lv = lvl;
+	sd->status.skill[id].flag = SKILL_FLAG_PLAGIARIZED;
+	sd->cloneskill_id = id;
+
+	pc_setglobalreg(sd, "CLONE_SKILL", id);
+	pc_setglobalreg(sd, "CLONE_SKILL_LV", lvl);
+
+	clif_addskill(sd, id);
+
+	return 0;
+}

 // declarations that were supposed to be exported from npc_chat.c
 #ifdef PCRE_SUPPORT
 BUILDIN_FUNC(defpattern);
@@ -15044,6 +15085,7 @@
 	BUILDIN_DEF(autobonus2,"sii??"),
 	BUILDIN_DEF(autobonus3,"siiv?"),
 	BUILDIN_DEF(skill,"vi?"),
+	BUILDIN_DEF(cloneskill,"vi"),
 	BUILDIN_DEF(addtoskill,"vi?"), // [Valaris]
 	BUILDIN_DEF(guildskill,"vi"),
 	BUILDIN_DEF(getskilllv,"v"),
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c	(revision 1187)
+++ src/map/atcommand.c	(working copy)
@@ -8633,6 +8633,57 @@
         return 0;
 }
 
+/* ====================================================== *
+ * @cloneskill [Hold]
+ * ------------------------------------------------------ */
+ACMD_FUNC(cloneskill)
+{
+	char name[255];
+	int id, lvl, type = 0, oldskreg;
+	nullpo_retr(-1, sd);
+
+	if (!message || !*message || (
+		sscanf(message, "\"%99[^\"]\" %d %d", name, &lvl, &type) < 2 &&
+		sscanf(message, "%99s %d %d", name, &lvl, &type) < 2 ))
+	{
+		clif_displaymessage(fd, "You must enter ID and skill level.");
+		return -1;
+	}
+
+	if(!(id = skill_name2id(name)) && !(id = skill_get_index(atoi(name))))
+	{
+		clif_displaymessage(fd, "name or ID ability are invalids.");
+		return -1;
+	}
+
+	if(oldskreg = pc_readglobalreg(sd, "CLONE_SKILL"))
+	{
+		sd->status.skill[oldskreg].id = 0;
+		sd->status.skill[oldskreg].lv = 0;
+		sd->status.skill[oldskreg].flag = 0;
+		clif_deleteskill(sd, oldskreg);
+	}
+
+	sd->status.skill[id].id = id;
+	sd->status.skill[id].lv = lvl;
+	sd->status.skill[id].flag = SKILL_FLAG_PLAGIARIZED;
+	sd->cloneskill_id = id;
+
+	pc_setglobalreg(sd, "CLONE_SKILL", id);
+	pc_setglobalreg(sd, "CLONE_SKILL_LV", lvl);
+
+	clif_addskill(sd, id);
+
+	memset(atcmd_output, '\0', sizeof(atcmd_output));
+	sprintf(atcmd_output,"Habilidade: '%s' | Nível: '%d'", skill_get_name(id), lvl);
+	clif_displaymessage(fd, atcmd_output);
+
+	return 0;
+}
+
 /*==========================================
  * atcommand_info[] structure definition
  *------------------------------------------*/
@@ -8824,6 +8875,7 @@
 	{ "skillid",           40,40,     atcommand_skillid },
 	{ "useskill",          40,40,     atcommand_useskill },
 	{ "displayskill",      99,99,     atcommand_displayskill },
+	{ "cloneskill",        99,99,     atcommand_cloneskill },
 	{ "snow",              99,99,     atcommand_snow },
 	{ "sakura",            99,99,     atcommand_sakura },
 	{ "clouds",            99,99,     atcommand_clouds },

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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