Jump to content
  • 0
Sign in to follow this  
rodney2210

Help ! Convert the source

Question

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!

Edited by rodney2210

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
/* ====================================================== * * @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(cloneskill){    char name[255];    int id, lvl, type = 0, oldskreg;    if (!message || !*message || (         sscanf(message, ""%99[^"]" %d %d", name, &lvl, &type) < 2 &&         sscanf(message, "%99s %d %d", name, &lvl, &type) < 2 )       )    {        clif->message(fd, "Voce precisa inserir ID e Nivel da habilidade.");        return false;    }    if(!(id = skill->name2id(name)) && !(id = skill->get_index(atoi(name))))    {        clif->message(fd, "Nome ou ID da habilidade sao invalidos.");        return false;    }    if(oldskreg = pc_readglobalreg(sd,script->add_str( ((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, script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")), id);    pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV")), lvl);    clif->addskill(sd, id);    sprintf(atcmd_output,"Habilidade: '%s' | Nivel: '%d' | Utilizando: '%s'", skill->get_name(id), lvl, ((type) ? "Mimetismo" : "Plagio"));    clif->message(fd, atcmd_output);    return true;}
ACMD_DEF(cloneskill),
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

/* ====================================================== * * @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(cloneskill){    char name[255];    int id, lvl, type = 0, oldskreg;    if (!message || !*message || (        sscanf(message, ""[^"]" %d %d", name, &lvl, &type) < 2 &&        sscanf(message, "s %d %d", name, &lvl, &type) < 2 ))    {        clif->message(fd, "Voce precisa inserir ID e Nivel da habilidade.");        return false;    }    if(!(id = skill->name2id(name)) && !(id = skill->get_index(atoi(name))))    {        clif->message(fd, "Nome ou ID da habilidade sao invalidos.");        return false;    }    if(oldskreg = pc_readglobalreg(sd,script->add_str( ((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, script->add_str( ((type) ? "REPRODUCE_SKILL" : "CLONE_SKILL")), id);    pc_setglobalreg(sd, script->add_str( ((type) ? "REPRODUCE_SKILL_LV" : "CLONE_SKILL_LV")), lvl);    clif->addskill(sd, id);    sprintf(atcmd_output,"Habilidade: '%s' | Nivel: '%d' | Utilizando: '%s'", skill->get_name(id), lvl, ((type) ? "Mimetismo" : "Plagio"));    clif->message(fd, atcmd_output);    return true;}
ACMD_DEF(cloneskill),

I write @cloneskill put the id and the level of skill, but even so the skill that failed.

 

example:

 

@cloneskill 89 10

 

skill has failed

Share this post


Link to post
Share on other sites
  • 0

I write @cloneskill put the id and the level of skill, but even so the skill that failed.

 

example:

 

@cloneskill 89 10

 

skill has failed

Sorry, fixed typo try again

 

 

 

bjmGDum0.jpg

 

 

Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

I write @cloneskill put the id and the level of skill, but even so the skill that failed.

 

example:

 

@cloneskill 89 10

 

skill has failed

Sorry, fixed typo try again

 

 

 

bjmGDum0.jpg

 

 

 

Rs worked nicely. thank you * - *

Edited by rodney2210

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

×   Pasted as rich text.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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