Jump to content

  •  

rodney2210

Member Since 16 Jan 2014
Offline Last Active Dec 27 2015 12:42 AM
-----

Topics I've Started

Help ! Convert the source

27 June 2014 - 12:58 AM

Hello, I would like to ask help from you guys this command to convert the SRC to reconcile with the current hercules emulator:

+/* ====================================================== *
+ * @cloneskill [Hold]
+ *    <> Permite ao jogador plagiar qualquer habilidade
+ * Uso:
+ *    <>    @cloneskill <id/nome da habilidade> <nível> <tipo>
+ * tipo:
+ *    <>    0 = Copiada através da habilidade Plágio
+ *    <>    1 = Copiada através da habilidade Mimetismo
+ * ------------------------------------------------------ */
+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, "Você precisa inserir ID e Nível da habilidade.");
+        return -1;
+    }
+
+    if(!(id = skill_name2id(name)) && !(id = skill_get_index(atoi(name))))
+    {
+        clif_displaymessage(fd, "Nome ou ID da habilidade são inválidos.");
+        return -1;
+    }
+
+    if(oldskreg = pc_readglobalreg(sd, ((type) ? "REPRODUCE_SKILL" : "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;
+    if(type)
+        sd->reproduceskill_id = id;
+    else
+        sd->cloneskill_id = id;
+
+    pc_setglobalreg(sd, ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL"), id);
+    pc_setglobalreg(sd, ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV"), lvl);
+
+    clif_addskill(sd, id);
+
+    sprintf(atcmd_output,"Habilidade: '%s' | Nível: '%d' | Utilizando: '%s'", skill_get_name(id), lvl, ((type) ? "Mimetismo" : "Plágio"));
+    clif_displaymessage(fd, atcmd_output);
+
+    return 0;
+}
+
 /**
  * Fills the reference of available commands in atcommand DBMap
  **/
@@ -8796,6 +8852,7 @@
         ACMD_DEF(skillid),
         ACMD_DEF(useskill),
         ACMD_DEF(displayskill),
+        ACMD_DEF(cloneskill),
         ACMD_DEF(snow),
         ACMD_DEF(sakura),
         ACMD_DEF(clouds),
 

 


Thanks from now!