summaryrefslogtreecommitdiff
path: root/npc/commands/kami.txt
blob: 8ac29c7f82329853f6379b08a8ac7660ac552370 (plain) (blame)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// TMW2 Script
//
// @k <message>
// Broadcast, and broadcast to #world too
//
// @servmsg <message>
// Experimental, uses servicemessage() - requires up to date server

-	script	@k	32767,{
    end;

OnCall:
    .@request$ = strcharinfo(0)+": ";
	.@request$ += implode(.@atcmd_parameters$, " ");
    channelmes("#world", .@request$);
    announce l(.@request$), bc_all|bc_npc;
    end;

OnServMsg:
    .@request$ = strcharinfo(0)+": ";
	.@request$ += implode(.@atcmd_parameters$, " ");
    // This can be slow, beware
    .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
    for (.@i = 0; .@i < .@c; .@i++) {
        message(.@players[.@i], .@request$);
    }
    end;

OnBuff:
    .@n$=strtoupper(strcharinfo(0, "JESUSALVA", playerattached()));
    // Disabled command, used for debug purposes
    .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
    for (.@i = 0; .@i < .@c; .@i++) {
        attachrid(.@players[.@i]);
        sc_start SC_INCMHPRATE, 300000, 100;
        sc_start SC_INCMSPRATE, 300000, 100;
        sc_start SC_INCFLEERATE, 300000, 100;
        sc_start SC_INCHITRATE, 300000, 100;
        sc_start SC_WALKSPEED, 300000, 150;
        sc_start SC_ATTHASTE_POTION3, 300000, 50;
        percentheal 100, 100;
        dispbottom l("YOU WERE BLESSED BY %s", .@n$);
        dispbottom l("YOU CAN FEEL THE POWER FLOWING TROUGH YOU.");
        detachrid();
    }
    end;

OnInstDestroy:
	.@request = implode(.@atcmd_parameters$, " ");
    if (.@request != 0)
        instance_destroy(.@request);
    end;

OnInstCheck:
	.@request$ = implode(.@atcmd_parameters$, " ");
    dispbottom has_instance2(.@request$);
    end;

OnPurify:
    getmapxy(.@m$, .@x, .@y, 0);
    .@r=60;
    .@b=BL_PET;

    .@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
    for (.@i = 0; .@i < .@c; .@i++) {
        specialeffect(FX_LIGHTNING, AREA, .@mbs[.@i]);
        unitwarp(.@mbs[.@i], "boss", 25, 25);
    }
    end;

OnHarm:
    harm(getcharid(3), 500, HARM_PHYS);
    end;

OnHarm2:
    .@id=getcharid(3);
    detachrid();
    harm(.@id, 500, HARM_MISC, Ele_Holy);
    end;

// Casted only via HCP::doevent::@k::OnLagDebug
OnLagDebug:
    consoleinfo("Checking for laggy maps, %d", gettimetick(0));
    freeloop(true);
    for (.@i=0;.@i<=600;.@i++) {
        .@m$ = getmapinfo(MAPINFO_NAME, .@i);
        if (.@m$ != "" && .@m$ != "U") {
            .@tops[.@i] = mobcount(.@m$, "all");
        }
    }
    freeloop(false);
    consoleinfo("Done checking, %d", gettimetick(0));
    .@t1 = array_highest(.@tops);
    .@m$ = getmapinfo(MAPINFO_NAME, .@t1);
    consoleinfo("#1 - %s - %s", .@m$, fnum(.@tops[.@t1]));
    .@tops[.@t1]=-1;
    .@t1 = array_highest(.@tops);
    .@m$ = getmapinfo(MAPINFO_NAME, .@t1);
    consoleinfo("#2 - %s - %s", .@m$, fnum(.@tops[.@t1]));
    .@tops[.@t1]=-1;
    .@t1 = array_highest(.@tops);
    .@m$ = getmapinfo(MAPINFO_NAME, .@t1);
    consoleinfo("#3 - %s - %s", .@m$, fnum(.@tops[.@t1]));
    //debugmes getmapinfo(MAPINFO_ID, "032-1");
    end;

OnInit:
    bindatcmd "k", "@k::OnCall", 60, 80, 1;
    bindatcmd "servmsg", "@k::OnServMsg", 80, 99, 1;

    bindatcmd "blessing", "@k::OnBuff", 80, 99, 1;
    bindatcmd "harm", "@k::OnHarm", 80, 80, 1;
    bindatcmd "cruelty", "@k::OnHarm2", 99, 99, 1;

    bindatcmd "instcheck", "@k::OnInstCheck", 99, 100, 1;
    bindatcmd "instdestr", "@k::OnInstDestroy", 99, 100, 1;
    bindatcmd "burnlivio", "@k::OnPurify", 99, 100, 1;
    end;
}

// kamibroadcast( message{, sender} )
function	script	kamibroadcast	{
    .@msg$=getarg(0);
    .@snd$=getarg(1, "");

    // Send to #world
    if (.@snd$ == "")
        channelmes("#world", .@msg$);
    else
        channelmes("#world", "[ "+.@snd$+" ] : "+.@msg$);

    // Make an announce
    if (.@snd$ == "")
        announce .@msg$, bc_all|bc_npc;
    else
        announce .@snd$+" : "+.@msg$, bc_all|bc_npc;

    return;
}