summaryrefslogtreecommitdiff
path: root/npc/commands/warp.txt
blob: 0c6122eba3e280bef852e31c5e6c4ae9756bd322 (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
// @w atcommand
// warps using anchors or map name
//
// group lv: 1
// group char lv: 2
// log: True
//
// usage:
//    @w <map or anchor> [, x [, y]]
//    #w "char" <map or anchor> [, x [, y]]
//
// example:
//    @w artis
//    #w "char" artis

-	script	@w	32767,{
    end;

OnCall:
    .@request$ = strtoupper(strip(.@atcmd_parameters$[0])); // sanitize
    .@map$ = "";
    .@x = 0;
    .@y = 0;

    for (.@i = 0; .@i < .count; .@i += 2)
    {
        if (.@request$ ~= .aliases$[.@i])
        {
            explode .@coords$, .aliases$[.@i + 1], " ";
            .@map$ = .@coords$[0];
            .@x = atoi(.@coords$[1]);
            .@y = atoi(.@coords$[2]);
            break;
        }
    }

    if (.@map$ == "")
    {
        .@map$ = .@atcmd_parameters$[0];
    }

    if (.@atcmd_parameters$[2] != "")
    {
        .@x = atoi(.@atcmd_parameters$[1]);
        .@y = atoi(.@atcmd_parameters$[2]);
    }

    cwarp .@map$, .@x, .@y; // XXX: maybe here use a slide_or_warp function

OnInit:
    setarray .aliases$[0],

        // ARTIS
        "^ART",             "001-1 89 86",    // artis town square
        "^LIGHT",           "001-2-0 37 32",  // light armor shop
        "^NOBLE1?$",        "001-2-1 37 37",  // noble house 1
        "^NOBLE2$",         "001-2-10 40 38", // noble house 2
        "^NOBLE3$",         "001-2-11 45 33", // noble house 3
        "^NOBLE4$",         "001-2-12 34 32", // noble house 4
        "^NOBLE5$",         "001-2-15 34 38", // noble house 5
        "^MOON",            "001-2-2 39 34",  // moon's house
        "^LIB",             "001-2-4 49 37",  // library
        "^CITY|^HALL",      "001-2-7 36 38",  // city hall
        "^HARB|^MASTER",    "001-2-16 32 33", // harbourmaster
        "^WARE",            "001-2-18 39 31", // warehouse
        "^MERCH|^BANK",     "001-2-19 29 31", // merchant hall
        "^SHIP2$",          "001-2-21 30 28", // la johanne (artis)
        "^ALCH",            "001-2-26 30 32", // alchemist
        "^BLACK|SMITH",     "001-2-27 35 32", // blacksmith
        "^RED|PLUSH|^INN",  "001-2-28 32 32", // red plush inn
        "^LEG",             "001-2-33 34 36", // legion

        // PROLOGUE
        "^START|^BEGIN",    "000-0 22 24",    // starting point
        "^START2$",         "000-0-0 26 28",  // starting point step 2
        "^START3$",         "000-0-1 26 28",  // starting point step 3
        "^DRA|ISLAND",      "000-1 77 110",   // drasil island
        "^FIRST|^DECK1?$",  "000-2-0 27 27",  // first deck
        "^SECOND|^DECK2$",  "000-2-1 53 33",  // second deck
        "^HOLD$",           "000-2-2 43 30",  // hold
        "^NARD",            "000-2-3 21 27",  // nard's room
        "^ALIG|^HID",       "000-2-4 36 29";  // alige's hideout

    .count = getarraysize(.aliases$[0]);

    if (debug > 0)
    {
        bindatcmd "w", "@w::OnCall", 0, 2, 0;
        end;
    }

    bindatcmd "w", "@w::OnCall", 1, 2, 1;
}