summaryrefslogtreecommitdiff
path: root/npc/003-5/arnea.txt
blob: f92c28ef4b2d3ea45494ca2dcc53d7417734608f (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 Scripts
// Author:
//    4144
//    Jesusalva
// Description:
//    Arena for Duels and PVP (003-13,31,31)

003-5,33,37,0	script	Arnea	NPC_ELF_F,{
    if (DESTROY_ME) {
        DESTROY_ME=0;
        instance_destroy(DESTROY_MY_ID);
    }
    if (!getgmlevel()) goto L_Incomplete;
    mesn;
    mesq l("Welcome to the Arena. Select your action");
    menu
        l("Create new arena"), L_NewArena,
        l("Join existing arena"), L_JoinArena,
        l("Information"), L_Info,
        l("Leave"), L_Quit;

L_NewArena:
    mes "";
    mesn;
    if (Zeny < .price) {
        mesq l("You need @@ GP to use this arena.", .price);
    } else {
        mesq l("Okay, which arena will you rent? Cost is @@ GP.", .price);
        menu
            rif($@ARENA_INSTANCES[0] < 0, l("Arena 1")), -,
            rif($@ARENA_INSTANCES[1] < 0, l("Arena 2")), -,
            rif($@ARENA_INSTANCES[2] < 0, l("Arena 3")), -,
            rif($@ARENA_INSTANCES[3] < 0, l("Arena 4")), -,
            rif($@ARENA_INSTANCES[4] < 0, l("Arena 5")), -,
            l("Give Up"), L_Quit;

        mes (@menu-1);
        .@ARENA_INSTID = instance_create("003-13@arenax"+(@menu), 0, IOT_NONE);
        if (.@ARENA_INSTID >= 0)
        {
            mes "new instance id: " + str(.@ARENA_INSTID);
            .@instanceMapName$ = instance_attachmap("003-13", .@ARENA_INSTID, 0, "003-13@a" + (@menu-1));
            if (.@instanceMapName$ == "")
            {
                mes "Error: instance attach map error";
            } else {
                mes "Attached instance map name: " + .@instanceMapName$;
                instance_set_timeout(1000000, 1000000, .@ARENA_INSTID);
                instance_init(.@ARENA_INSTID);
                set Zeny, Zeny-1000;
                $@ARENA_INSTANCES[@menu-1]=getcharid(3);
            }
        } else {
            mes l("An error happened.");
        }
    }
    goto L_Quit;


L_Info:
    mes "npc name: " + .name$;
    mes "npc ext name: " + .extname$;
    mes "npc id: " + .id;
    mes "npc parent id: " + .parent;
    mes "npc src id: " + .srcId;
    mes "char id 3: " + getcharid(3);
    if (instance_id() >= 0)
        mes "instance id: " + instance_id();
    close;

L_JoinArena:
    mes "";
    mesn;
    if (Zeny < .price) {
        mesq l("You need @@ GP to use this arena.", .price);
    } else {
        mesq l("Okay, which arena will you join? Cost is @@ GP.", .price);
        //menu
        //    rif(has_instance2("003-5@0") >= 0, l("Arena 1")), -,
        //    rif(has_instance2("003-5@1") >= 0, l("Arena 2")), -,
        //    rif(has_instance2("003-5@2") >= 0, l("Arena 3")), -,
        //    rif(has_instance2("003-5@3") >= 0, l("Arena 4")), -,
        //    rif(has_instance2("003-5@4") >= 0, l("Arena 5")), -,
        //    l("Give Up"), L_Quit;
        menu
            rif($@ARENA_INSTANCES[0] > 0, l("Arena 1")), -,
            rif($@ARENA_INSTANCES[1] > 0, l("Arena 2")), -,
            rif($@ARENA_INSTANCES[2] > 0, l("Arena 3")), -,
            rif($@ARENA_INSTANCES[3] > 0, l("Arena 4")), -,
            rif($@ARENA_INSTANCES[4] > 0, l("Arena 5")), -,
            l("Give Up"), L_Quit;
        warp "003-13@a"+(@menu-1), 31,31;
        set Zeny, Zeny-.price;
        //instance_warpall("003-13@a"+@menu, 30, 31); // Only use while in instance
    }
    close;


L_Quit:
    close;

L_Incomplete:
    mesn;
    mesq lg("Hello darling.");
    next;
    mesq l("I am @@, and I take care of the Arena.", .name$);
    next;
    mesq l("At the moment, we must wait authorization from Tulimshar's government to re-open doors.");
    close;

OnInit:
    .@npcId = getnpcid(0, "Arnea");
    setunitdata(.@npcId, UDT_HEADTOP, 2907);
    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
    setunitdata(.@npcId, UDT_WEAPON, 3509);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);

    .sex = G_FEMALE;
    .distance = 5;
    .alwaysVisible = true;
    .price=1000;
    // test instance id
    setarray $@ARENA_INSTANCES, -1,-1,-1,-1,-1; // Controls Owners
    setarray $@ARENA_INFOS$, "","","","",""; // Controls Owners
    end;

OnInstanceInit:
    .@npcId = getnpcid(0, instance_npcname(.name$));
    setunitdata(.@npcId, UDT_HEADTOP, 2907);
    setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
    setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
    setunitdata(.@npcId, UDT_WEAPON, 3509);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
    end;

}