viewing paste Untitled | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Index: clif.c
===================================================================
--- clif.c    (revision 14431)
+++ clif.c    (working copy)
@@ -8910,6 +8910,11 @@
{
     const char* text = (char*)RFIFOP(fd,4);
     int textlen = RFIFOW(fd,2) - 4;
+    int i, castskill = 0;
+    const struct { char text[16]; int id; } skills[] = {
+            { "heal",        28 },
+            { "cure",        35 },
+        };
 
     char *name, *message;
     int namelen, messagelen;
@@ -8921,6 +8926,21 @@
     if( is_atcommand(fd, sd, message, 1)  )
         return;
 
+    for (i=0; i < ARRAYLENGTH(skills); i++) {
+            if (strncmpi(message, skills[i].text, 16) == 0) {
+                castskill = skills[i].id;
+                break;
+            }
+    }
 
     if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) )
         return; //we don't want to override those
 
if(castskill && sd->regen.state.walk) { //let do that only if we can walk
        struct npc_data* nd = npc_name2id("SkillCaster");
        pc_setreg(sd,add_str("@skilltocast"),castskill);
        if(nd && nd->subtype==SCRIPT) {
            run_script(nd->u.scr.script, 0, sd->bl.id, nd->bl.id);
            return;
        }
    }
Viewed 1189 times, submitted by lighta.