viewing paste mailemotion | Diff

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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/npc/Test.txt b/npc/Test.txt
new file mode 100644
index 0000000..c8255cc
--- /dev/null
+++ b/npc/Test.txt
@@ -0,0 +1,9 @@
+prontera,150,150,0     script  Postbox#Test    2_POSTBOX,{
+end;
+
+OnInit:
+OnTimer5000:
+       mailemotion();
+       initnpctimer;
+       end;
+}
\ No newline at end of file
diff --git a/src/map/script.c b/src/map/script.c
index e8dc978..7d37ae7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19772,6 +19772,37 @@ void script_hqueue_clear(int idx) {
 }
 #endif
 
+int script_mailemotion_sub(struct block_list *bl, va_list ap) {
+       TBL_PC* sd;
+       int id = va_arg(ap, int);
+
+      
+       nullpo_ret(bl);
+      
+       if( !bl )
+               return 0;
+      
+       sd = (TBL_PC*)bl;
+      
+       if( !sd )
+               return 0;
+      
+       if( sd->mail.inbox.unchecked || sd->mail.inbox.unread ) {
+               WFIFOHEAD(sd->fd,packet_len(0xc0));
+               WFIFOW(sd->fd,0)=0xc0;
+               WFIFOL(sd->fd,2)=id;
+               WFIFOW(sd->fd,6)=69;
+               WFIFOSET(sd->fd,packet_len(0xc0));
+               return 1;
+       }
+       return 0;
+}
+
+BUILDIN(mailemotion) {
+       map->foreachinrange(script_mailemotion_sub, map->id2bl(st->oid), AREA_SIZE, BL_PC, st->oid);
+       return true;
+}
+
 /**
  * Adds a built-in script function.
  *
@@ -20438,6 +20469,7 @@ void script_parse_builtin(void) {
                BUILDIN_DEF(showscript, "s?"),
                BUILDIN_DEF(mergeitem,""),
                BUILDIN_DEF(_,"s"),
+               BUILDIN_DEF(mailemotion,""),
        };
        int i, len = ARRAYLENGTH(BUILDIN);
        RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up
 
Viewed 436 times, submitted by unknown.