root/npc/guild/agit_template.txt @ 8

Revision 1, 57.0 kB (checked in by jinshiro, 17 years ago)
Line 
1//===== eAthena Script =======================================
2//= War of Emperium Guild Template File
3//===== By: ==================================================
4//= L0ne_W0lf
5//===== Current Version: =====================================
6//= 1.4
7//===== Compatible With: =====================================
8//= eAthena SVN
9//===== Description: =========================================
10//= [ Aegis Conversion]
11//= ----------------------------------------------------------
12//= - THIS FILE IS REQUIRED FOR GUILD CASTLES TO FUNCTION.
13//= ----------------------------------------------------------
14//= - Enables AGIT Manager inside Guild Strongholds.
15//=   Visible Name required: Agit
16//=   Manages the various functions used in and out of WoE.
17//=
18//= - Enables Stewards inside Guild Strongholds which let's
19//=   the guild master invest in Defense and Economy, and
20//=   to summon guardians, a Kafra, and enter master's room.
21//=
22//= - Guardian Spawning Template
23//=   Visible Name required: Guardian
24//=   Spawn guardians when guild castle data is recieved.
25//=
26//= - Enables Kafra Services inside Guild Strongholds.
27//=   Visible Name required: Kafra Staff
28//=   Storage, Guild Storage, Teleport Service, Cart rental.
29//=
30//= - Treasure Room Protection and Chest spawning.
31//=   Chests will NOT be saved anymore in the event of crashes.
32//=   Treasures will NOT spawn on a location that already has
33//=   treasure chest spawned.
34//===== Additional Comments: =================================
35//= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
36//= 1.1 Daily investement will now be reset. [L0ne_W0lf]
37//=     Template will no longer try to spawn chests.
38//= 1.2 Fixed Eco Invest option charging twice. [L0ne_W0lf]
39//= 1.3 Fixed a loading flag emblem for Payon 1. [L0ne_W0lf]
40//=     Fixed two typos regarding Guild Steward name.
41//= 1.4 Fixed a typo in defense investment. [L0ne_W0lf]
42//============================================================
43
44// AGIT Manager Template
45//============================================================
46-       script  Gld_Agit_Manager::Gld_Agit_Manager      -1,{
47        end;
48
49// Load (or reload) specific information for a castle.
50OnInterIfInitOnce:
51        if (strnpcinfo(2) == "aldeg_cas01") { GetCastleData "aldeg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
52        else if (strnpcinfo(2) == "aldeg_cas02") { GetCastleData "aldeg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
53        else if (strnpcinfo(2) == "aldeg_cas03") { GetCastleData "aldeg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
54        else if (strnpcinfo(2) == "aldeg_cas04") { GetCastleData "aldeg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
55        else if (strnpcinfo(2) == "aldeg_cas05") { GetCastleData "aldeg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
56        else if (strnpcinfo(2) == "gefg_cas01") { GetCastleData "gefg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
57        else if (strnpcinfo(2) == "gefg_cas02") { GetCastleData "gefg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
58        else if (strnpcinfo(2) == "gefg_cas03") { GetCastleData "gefg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
59        else if (strnpcinfo(2) == "gefg_cas04") { GetCastleData "gefg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
60        else if (strnpcinfo(2) == "gefg_cas05") { GetCastleData "gefg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
61        else if (strnpcinfo(2) == "payg_cas01") { GetCastleData "payg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
62        else if (strnpcinfo(2) == "payg_cas02") { GetCastleData "payg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
63        else if (strnpcinfo(2) == "payg_cas03") { GetCastleData "payg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
64        else if (strnpcinfo(2) == "payg_cas04") { GetCastleData "payg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
65        else if (strnpcinfo(2) == "payg_cas05") { GetCastleData "payg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
66        else if (strnpcinfo(2) == "prtg_cas01") { GetCastleData "prtg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
67        else if (strnpcinfo(2) == "prtg_cas02") { GetCastleData "prtg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
68        else if (strnpcinfo(2) == "prtg_cas03") { GetCastleData "prtg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
69        else if (strnpcinfo(2) == "prtg_cas04") { GetCastleData "prtg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
70        else if (strnpcinfo(2) == "prtg_cas05") { GetCastleData "prtg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
71        // Add custom Guild Castles here.
72        else {
73                end;
74        }
75        end;
76
77// War of Emperium has started.
78OnAgitStart:
79        if (strnpcinfo(0) == "Gld_Agit_Manager") end;
80        MapRespawnGuildID strnpcinfo(2),GetCastleData(strnpcinfo(2),1),2;
81        GvgOn strnpcinfo(2);
82
83// Spawn (fall through), or respawn the Emperium once it has been broken.
84OnStartArena:
85        // OnAgitStart will fall through and spawn the Emperium.
86        if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
87        else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
88        else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
89        else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
90        else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
91        else if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
92        else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
93        else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
94        else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
95        else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
96        else if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],138,138; }
97        else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
98        else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],268,264; }
99        else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
100        else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
101        else if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
102        else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
103        else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
104        else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
105        else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
106        // Add custom Guild Castles here.
107        else {
108                end;
109        }
110        if (!mobcount(strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak")) {
111                monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Emperium",1288,1,"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
112        }
113        end;
114
115// The Emperium has been broken.
116OnAgitBreak:
117        set .@GID,getcharid(2);
118        // Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)
119        if (.@GID <= 0) {
120                set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium in Castle: "+strnpcinfo(2)+" while guildless. No data will be saved and Emperium respawned.";
121                logmes .@notice$; debugmes .@notice$;
122                donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
123                end;
124        }
125        // Adjust Economy Invest Level for Castle
126        set .@Economy,GetCastleData(strnpcinfo(2),2) - 5;
127        if (.@Economy < 0) set .@Economy, 0;
128        SetCastleData strnpcinfo(2), 2, .@Economy;
129        // Adjust Defense Invest Level for Castle
130        set .@Defence,GetCastleData(strnpcinfo(2),3) - 5;
131        if (.@Defence < 0) set .@Defence, 0;
132        SetCastleData strnpcinfo(2), 3, .@Defence;
133
134        // Set new Castle Occupant
135        SetCastleData strnpcinfo(2),1, .@GID;
136
137        // Announce that the Emperium is destroyed, and respawn all but new castle-occupants.
138        mapannounce strnpcinfo(2),"The emperium has been destroyed.",bc_map,"0x00CCFF";
139        MapRespawnGuildID strnpcinfo(2),.@GID,2;
140
141        // Refresh castle data, disable Kafra and reset Invest information.
142        GetCastleData strnpcinfo(2),0,strnpcinfo(0)+"::OnRecvCastle";
143        disablenpc "Kafra Staff#"+strnpcinfo(2);
144        for( set .@i, 4; .@i <= 9; set .@i, .@i+1 ) {
145                SetCastleData strnpcinfo(2), .@i, 0;
146        }
147        // Erase Guardian Database information if the new owners do not have Guardian Research.
148        if( getgdskilllv(.@GID,10002) == 0 ) {
149                for( set .@i, 10; .@i <= 17; set .@i, .@i+1 ) {
150                        SetCastleData strnpcinfo(2), .@i, 0;
151                }
152        }
153        // Respawn the Emperium, and display new owners.
154        if (agitcheck()) {
155                sleep 500; // Slow down script execution slightly.
156                donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
157        }
158        sleep getbattleflag("gvg_eliminate_time");
159        announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by the [" + getguildName(.@GID) + "] guild.",bc_all;
160        end;
161
162// War of Emperium has ended.
163OnAgitEnd:
164        if (strnpcinfo(0) == "Gld_Agit_Manager") end;
165        GvgOff strnpcinfo(2);
166        // If the castle has no owner at the end of WoE, do not kill Emperium.
167        if (GetCastleData(strnpcinfo(2),1)) {
168                KillMonster strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
169        }
170        end;
171
172// Occupying Guild has been disbanded.
173OnGuildBreak:
174        if (strnpcinfo(0) == "Gld_Agit_Manager") end;
175        // Kill guardians, disable the Kafra, and set owner to 0.
176        killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied";
177        disablenpc "Kafra Staff#"+strnpcinfo(2);
178        SetCastleData strnpcinfo(2),0,0;
179        // Wait before refreshing guild information.
180        sleep getbattleflag("gvg_eliminate_time");
181        Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0;
182        GetCastleData strnpcinfo(2),0,strnpcinfo(0)+"::OnRecvCastle";
183        end;
184
185OnRecvCastle:
186        RequestGuildInfo GetCastleData(strnpcinfo(2),1);
187
188        // Spawn Monsters if the castle is empty.
189        set .@GID, GetCastleData(strnpcinfo(2),1);
190        if (.@GID == 0) {
191                killmonsterall strnpcinfo(2);
192                if (compare(strnpcinfo(2),"aldeg")) {
193                        // Normal Spawns
194                        monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
195                        monster strnpcinfo(2),0,0,"Khalitzburg",1132,4;
196                        monster strnpcinfo(2),0,0,"Abysmal Knight",1219,2;
197                        monster strnpcinfo(2),0,0,"Executioner",1205,1;
198                        monster strnpcinfo(2),0,0,"Penomena",1216,10;
199                        monster strnpcinfo(2),0,0,"Alarm",1193,18;
200                        monster strnpcinfo(2),0,0,"Clock",1269,9;
201                        monster strnpcinfo(2),0,0,"Raydric Archer",1276,7;
202                        monster strnpcinfo(2),0,0,"Wanderer",1208,3;
203                        monster strnpcinfo(2),0,0,"Alice",1275,1;
204                        monster strnpcinfo(2),0,0,"Bloody Knight",1268,1;
205                        monster strnpcinfo(2),0,0,"Dark Lord",1272,1;
206                        // Set Emperium room spawn coordinates and spawn monsters.
207                        if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
208                        else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
209                        else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
210                        else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
211                        else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
212                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Dark Lord",1272,1;
213                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Tower Keeper",1270,4;
214                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Bloody Knight",1268,1;
215                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1;
216                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
217                }
218                else if (compare(strnpcinfo(2),"gefg")) {
219                        // Normal Spawns
220                        monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
221                        monster strnpcinfo(2),0,0,"Wind Ghost",1263,11;
222                        monster strnpcinfo(2),0,0,"Bathory",1102,10;
223                        monster strnpcinfo(2),0,0,"Jakk",1130,10;
224                        monster strnpcinfo(2),0,0,"Marduk",1140,20;
225                        monster strnpcinfo(2),0,0,"Raydric",1163,9;
226                        monster strnpcinfo(2),0,0,"Alice",1275,1;
227                        monster strnpcinfo(2),0,0,"Abysmal Knight",1219,1;
228                        monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
229                        monster strnpcinfo(2),0,0,"Phreeoni",1159,1;
230                        // Set Emperium room spawn coordinates and spawn monsters.
231                        if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
232                        else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
233                        else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
234                        else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
235                        else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
236                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Mysteltainn",1203,1;
237                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Hero",1087,1;
238                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"High Orc",1213,10;
239                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Archer",1189,10;
240                }
241                else if (compare(strnpcinfo(2),"payg")) {
242                        // Normal Spawns
243                        monster strnpcinfo(2),0,0,"Greatest General",1277,9;
244                        monster strnpcinfo(2),0,0,"Wanderer",1208,10;
245                        monster strnpcinfo(2),0,0,"Mutant Dragonoid",1262,5;
246                        monster strnpcinfo(2),0,0,"Bathory",1102,5;
247                        monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
248                        monster strnpcinfo(2),0,0,"Eddga",1115,1;
249                        monster strnpcinfo(2),0,0,"Horong",1129,11;
250                        monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
251                        monster strnpcinfo(2),0,0,"Kobold Archer",1282,4;
252                        monster strnpcinfo(2),0,0,"Gargoyle",1253,5;
253                        // Set Emperium room spawn coordinates and spawn monsters.
254                        if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],138,138; }
255                        else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
256                        else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],268,264; }
257                        else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
258                        else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
259                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Moonlight Flower",1150,1;
260                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Eddga",1115,1;
261                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Wanderer",1208,6;
262                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
263                }
264                else if (compare(strnpcinfo(2),"prtg")) {
265                        // Normal Spawns
266                        monster strnpcinfo(2),0,0,"Raydric",1163,1;
267                        monster strnpcinfo(2),0,0,"Khalitzburg",1132,10;
268                        monster strnpcinfo(2),0,0,"Abysmal Knight",1219,5;
269                        monster strnpcinfo(2),0,0,"Bloody Knight",1268,5;
270                        monster strnpcinfo(2),0,0,"Stormy Knight",1251,1;
271                        monster strnpcinfo(2),0,0,"Hatii",1252,1;
272                        monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
273                        monster strnpcinfo(2),0,0,"Gryphon",1259,2;
274                        monster strnpcinfo(2),0,0,"Chimera",1283,3;
275                        monster strnpcinfo(2),0,0,"Alice",1275,1;
276                        monster strnpcinfo(2),0,0,"Zealotus",1200,1;
277                        // Set Emperium room spawn coordinates and spawn monsters.
278                        if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
279                        else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
280                        else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
281                        else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
282                        else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
283                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1268,1;
284                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Master",1251,1;
285                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Hatii",1252,1;
286                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1219,1;
287                        monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
288                }
289                // Add custom Guild Castles here.
290                else {
291                        end;
292                }
293                donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
294                // Disable Kafra Staff...
295                disablenpc "Kafra Staff#"+strnpcinfo(2);
296                end;
297        }
298        else {
299                // Otherwise place the guild emblem on flags.
300                if (strnpcinfo(2) == "aldeg_cas01") { donpcevent "::OnRecvCastleA01"; }
301                else if (strnpcinfo(2) == "aldeg_cas02") { donpcevent "::OnRecvCastleA02"; }
302                else if (strnpcinfo(2) == "aldeg_cas03") { donpcevent "::OnRecvCastleA03"; }
303                else if (strnpcinfo(2) == "aldeg_cas04") { donpcevent "::OnRecvCastleA04"; }
304                else if (strnpcinfo(2) == "aldeg_cas05") { donpcevent "::OnRecvCastleA05"; }
305                else if (strnpcinfo(2) == "gefg_cas01") { donpcevent "::OnRecvCastleG01"; }
306                else if (strnpcinfo(2) == "gefg_cas02") { donpcevent "::OnRecvCastleG02"; }
307                else if (strnpcinfo(2) == "gefg_cas03") { donpcevent "::OnRecvCastleG03"; }
308                else if (strnpcinfo(2) == "gefg_cas04") { donpcevent "::OnRecvCastleG04"; }
309                else if (strnpcinfo(2) == "gefg_cas05") { donpcevent "::OnRecvCastleG05"; }
310                else if (strnpcinfo(2) == "payg_cas01") { donpcevent "::OnRecvCastlePy01"; }
311                else if (strnpcinfo(2) == "payg_cas02") { donpcevent "::OnRecvCastlePy02"; }
312                else if (strnpcinfo(2) == "payg_cas03") { donpcevent "::OnRecvCastlePy03"; }
313                else if (strnpcinfo(2) == "payg_cas04") { donpcevent "::OnRecvCastlePy04"; }
314                else if (strnpcinfo(2) == "payg_cas05") { donpcevent "::OnRecvCastlePy05"; }
315                else if (strnpcinfo(2) == "prtg_cas01") { donpcevent "::OnRecvCastlePt01"; }
316                else if (strnpcinfo(2) == "prtg_cas02") { donpcevent "::OnRecvCastlePt02"; }
317                else if (strnpcinfo(2) == "prtg_cas03") { donpcevent "::OnRecvCastlePt03"; }
318                else if (strnpcinfo(2) == "prtg_cas04") { donpcevent "::OnRecvCastlePt04"; }
319                else if (strnpcinfo(2) == "prtg_cas05") { donpcevent "::OnRecvCastlePt05"; }
320                // Add custom Guild Castles here.
321                else {
322                        end;
323                }
324                // And load purchased Guardian in castles.
325                donpcevent "Guardian#"+strnpcinfo(2)+"::OnSpawnGuardians";
326                // And display Kafra if purchased.
327                if (GetCastleData(strnpcinfo(2),9) < 1) disablenpc "Kafra Staff#"+strnpcinfo(2);
328        }
329        end;
330}
331
332// Guild Steward Template
333//============================================================
334-       script  Gld_Mngr_Template::Gld_Mngr_Template    -1,{
335        // What is the Display Name of the NPC?
336        set .@name$,strnpcinfo(1);
337
338        // Store the Guild ID of castle occupant.
339        set .@GID, GetCastleData(strnpcinfo(2),1);
340
341        // Define the types of guardians on a per castle basis.
342        // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
343        // Define the x spawn point for each uardian.
344        // [0] = 1st guardian's x spawn point.
345        // Define the y spawn point for each guardian.
346        // [0] = 1st guardian's y spawn point.
347        // Define the coordinates of the "Treasure Room."
348        // Aldebaran (Luina) Castles
349        if (strnpcinfo(2) == "aldeg_cas01") {
350                setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
351                setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
352                setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
353                setarray .@masterroom[0],113,223;
354        }
355        else if (strnpcinfo(2) == "aldeg_cas02") {
356                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
357                setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
358                setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
359                setarray .@masterroom[0],134,225;
360        }
361        else if (strnpcinfo(2) == "aldeg_cas03") {
362                setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
363                setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
364                setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
365                setarray .@masterroom[0],229,267;
366        }
367        else if (strnpcinfo(2) == "aldeg_cas04") {
368                setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
369                setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
370                setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
371                setarray .@masterroom[0],83,17;
372        }
373        else if (strnpcinfo(2) == "aldeg_cas05") {
374                setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
375                setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
376                setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
377                setarray .@masterroom[0],64,8;
378        }
379        // Geffen (Britoniah) Castles
380        else if (strnpcinfo(2) == "gefg_cas01") {
381                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
382                setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
383                setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
384                setarray .@masterroom[0],152,117;
385        }
386        else if (strnpcinfo(2) == "gefg_cas02") {
387                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
388                setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
389                setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
390                setarray .@masterroom[0],145,115;
391        }
392        else if (strnpcinfo(2) == "gefg_cas03") {
393                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
394                setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
395                setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
396                setarray .@masterroom[0],275,289;
397        }
398        else if (strnpcinfo(2) == "gefg_cas04") {
399                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
400                setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
401                setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
402                setarray .@masterroom[0],116,123;
403        }
404        else if (strnpcinfo(2) == "gefg_cas05") {
405                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
406                setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
407                setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
408                setarray .@masterroom[0],149,106;
409        }
410        // Payon (Baulder) Castles
411        else if (strnpcinfo(2) == "payg_cas01") {
412                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
413                setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
414                setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
415                setarray .@masterroom[0],295,8;
416        }
417        else if (strnpcinfo(2) == "payg_cas02") {
418                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
419                setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
420                setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
421                setarray .@masterroom[0],141,149;
422        }
423        else if (strnpcinfo(2) == "payg_cas03") {
424                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
425                setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
426                setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
427                setarray .@masterroom[0],163,167;
428        }
429        else if (strnpcinfo(2) == "payg_cas04") {
430                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
431                setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
432                setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
433                setarray .@masterroom[0],151,47;
434        }
435        else if (strnpcinfo(2) == "payg_cas05") {
436                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
437                setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
438                setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
439                setarray .@masterroom[0],153,137;
440        }
441        // Prontera (Valkyrie Realms) Castles
442        else if (strnpcinfo(2) == "prtg_cas01") {
443                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
444                setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
445                setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
446                setarray .@masterroom[0],15,209;
447        }
448        else if (strnpcinfo(2) == "prtg_cas02") {
449                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
450                setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
451                setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
452                setarray .@masterroom[0],207,229;
453        }
454        else if (strnpcinfo(2) == "prtg_cas03") {
455                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
456                setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
457                setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
458                setarray .@masterroom[0],190,130;
459        }
460        else if (strnpcinfo(2) == "prtg_cas04") {
461                setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
462                setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
463                setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
464                setarray .@masterroom[0],275,160;
465        }
466        else if (strnpcinfo(2) == "prtg_cas05") {
467                setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
468                setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
469                setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
470                setarray .@masterroom[0],281,176;
471        }
472        // Add custom Guild Castles here.
473        else {
474                end;
475        }
476       
477        mes "[ Steward " + .@name$ + " ]";
478        if (.@GID == 0) {
479                mes "I'm waiting for my master to return.";
480                mes "If you wish to speak with him, you will have to wait as well. ";
481                close;
482        }
483        if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)){
484                mes "I am loyal and I will follow my master ^ff0000" + getguildmaster(.@GID) + "^000000. We are Guardians! We defend to the bitter end!";
485                close;
486        }
487        mes "Welcome. My honorable master, ^ff0000" + getguildmaster(.@GID) + "^000000...";
488        mes "Whatever you need, I am at your service. I will be faithful in my duties.";
489        next;
490        switch(select("castle briefing:Invest in commercial growth:Invest in safeguard:Summon Guardian:Employ / discharge storehouse staff:Go into Master's room")) {
491        case 1:
492                mes "[ Steward " + .@name$ + " ]";
493                mes "I will report the Castle briefing, Master.";
494                mes " ";
495                mes " ^0000ffNow, commercial growth level is " + GetCastleData(strnpcinfo(2),2) + ".";
496                if (GetCastleData(strnpcinfo(2),4)) {
497                        mes " You invested " + GetCastleData(strnpcinfo(2),4) + "times in last 1 day.";
498                }
499                mes " Now, safeguard level is " + GetCastleData(strnpcinfo(2),3) + ".^000000";
500                if (GetCastleData(strnpcinfo(2),5)) {
501                        mes " ^0000ff- You invested " + GetCastleData(strnpcinfo(2),5) + "times in last 1 day.^000000";
502                }
503                mes " ";
504                mes "That's all to report, Master.";
505                close;
506        case 2:
507                set .@Economy,GetCastleData(strnpcinfo(2),2);
508                if(.@Economy < 8) set .@eco_invest,10000;
509                if(.@Economy >= 8) set .@eco_invest,20000;
510                if(.@Economy >= 16) set .@eco_invest,40000;
511                if(.@Economy >= 25) set .@eco_invest,80000;
512                if(.@Economy >= 34) set .@eco_invest,160000;
513                if(.@Economy >= 44) set .@eco_invest,320000;
514                if(.@Economy >= 54) set .@eco_invest,640000;
515                if(.@Economy >= 65) set .@eco_invest,1280000;
516                if(.@Economy >= 76) set .@eco_invest,2560000;
517                if(.@Economy >= 88) set .@eco_invest,5120000;
518                mes "[ Steward " + .@name$ + " ]";
519                mes "If you raise commercial growth, the quantity of goods made by the guild will increase. So if you want a prosperous future, investment will be required.";
520                mes " ";
521                mes "Originally you can invest just once but if you pay more money, you can invest twice.";
522                mes " ";
523                if (.@Economy == 100) {
524                        mes "^ff0000But the commercial growth level of our castle is peaked at 100%. It doesn't need any more investment. As I expected you have a great acumen, Master.^000000";
525                        close;
526                }
527                if (GetCastleData(strnpcinfo(2),4) == 2) {
528                        mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
529                        close;
530                }
531                if (GetCastleData(strnpcinfo(2),4) == 0) {
532                        mes "Now the needed investment amount is ^ff0000" + .@eco_invest + "^000000 zeny. Will you invest?";
533                }
534                else {
535                        mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@eco_invest + "^000000 more zeny will be needed.";
536                }
537                next;
538                switch(select("Invest in commercial growth:Cancel")) {
539                case 1:
540                        if (Zeny < .@eco_invest) {
541                                mes "[ Steward " + .@name$ + " ]";
542                                mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
543                                close;
544                        }
545                        set zeny,zeny-.@eco_invest;
546                        SetCastleData strnpcinfo(2),4,GetCastleData(strnpcinfo(2),4)+1;
547                        SetCastleData strnpcinfo(2),2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
548                        mes "[ Steward " + .@name$ + "]";
549                        mes "We finished the investment safely. I expect that our growth level will be increased by tomorrow.";
550                        close;
551                case 2:
552                        mes "[ Steward " + .@name$ + " ]";
553                        mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
554                        close;
555                }
556        case 3:
557                set .@Defence,GetCastleData(strnpcinfo(2),3);
558                if(.@Defence < 8) set .@def_invest,20000;
559                if(.@Defence >= 8) set .@def_invest,40000;
560                if(.@Defence >= 16) set .@def_invest,80000;
561                if(.@Defence >= 25) set .@def_invest,160000;
562                if(.@Defence >= 34) set .@def_invest,320000;
563                if(.@Defence >= 44) set .@def_invest,640000;
564                if(.@Defence >= 54) set .@def_invest,1280000;
565                if(.@Defence >= 65) set .@def_invest,2560000;
566                if(.@Defence >= 76) set .@def_invest,5120000;
567                if(.@Defence >= 88) set .@def_invest,10240000;
568                mes "[ Steward " + .@name$ + " ]";
569                mes "If you raise the safeguard, the durability of the Guardians and emperium will increase. So if you expect more defenses in battles, investment will be required.";
570                mes " ";
571                mes "Originally you can invest just once but if you pay more money, you can invest twice.";
572                mes " ";
573                if (.@Defence == 100) {
574                        mes "^ff0000But the safeguard level of our castle is peaked at 100%. It doesn't need any more investment. As I expected you have a great acumen, Master.^000000";
575                        close;
576                }
577                if (GetCastleData(strnpcinfo(2),5) == 2) {
578                        mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
579                        close;
580                }
581                if (GetCastleData(strnpcinfo(2),5) == 0) {
582                        mes "Now the needed investment amount is ^ff0000" + .@def_invest + "^000000 zeny. Will you invest?";
583                }
584                else {
585                        mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@def_invest + "^000000 more zeny will be needed.";
586                }
587                next;
588                switch(select("Invest in safeguard.:Cancel")) {
589                case 1:
590                        if (Zeny < .@def_invest) {
591                                mes "[ Steward " + .@name$ + " ]";
592                                mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
593                                close;
594                        }
595                        set zeny,zeny-.@def_invest;
596                        SetCastleData strnpcinfo(2),5,GetCastleData(strnpcinfo(2),5)+1;
597                        SetCastleData strnpcinfo(2),3,.@Defence+1;
598                        mes "[ Steward " + .@name$ + "]";
599                        mes "We finished the investment safely. I expect that the safeguard level will be increased by tomorrow.";
600                        close;
601                case 2:
602                        mes "[ Steward " + .@name$ + " ]";
603                        mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
604                        close;
605
606                }
607        case 4:
608                mes "[ Steward " + .@name$ + " ]";
609                mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
610                mes "Please select a guardian to defend us.";
611                next;
612                for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
613                        if (.@guardiantype[.@i] == 1) { set .@type$,"Guardian Soldier"; }
614                        else if (.@guardiantype[.@i] == 2) { set .@type$,"Guardian Archer"; }
615                        else { set .@type$,"Guardian Knight"; }
616                        if (guardianinfo(strnpcinfo(2),.@i,0)) {
617                                setarray .@gname$[.@i], .@type$ + " - Implemented (" + guardianinfo(strnpcinfo(2),.@i,2) + "/" + guardianinfo(strnpcinfo(2),.@i,1) + ")";
618                        }
619                        else {
620                                setarray .@gname$[.@i], .@type$ + " - Not Implemented";
621                        }
622                }
623                set .@menu$,.@gname$[0]+":"+.@gname$[1]+":"+.@gname$[2]+":"+.@gname$[3]+":"+.@gname$[4]+":"+.@gname$[5]+":"+.@gname$[6]+":"+.@gname$[7];
624                set .@GDnum,select(.@menu$)+9;
625                mes "[ Steward " + .@name$ + " ]";
626                mes "Will you summon the chosen guardian? 10000 zeny is required to summon.";
627                next;
628                switch(select("Summon:Cancel")) {
629                case 1:
630                        mes "[ Steward " + .@name$ + " ]";
631                        if (getgdskilllv(.@GID,10002) == 0) {
632                                mes "Master, we have not the resources to Summon the Guardian. If you want to accumulate them, you have to learn the Guild skill, We failed to summon the Guardian.";
633                                close;
634                        }
635                        if (GetCastleData(strnpcinfo(2),.@GDnum) == 1) {
636                                mes "Master, you already have summoned that Guardian. We cannot summon another.";
637                                close;
638                        }
639
640                        if (Zeny < 1000) {
641                                mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
642                                close;
643                        }
644                        set zeny,zeny-10000;
645                        SetCastleData strnpcinfo(2),.@GDnum,1; // mark as 'installed'
646                        set .@UseGID,.@GDnum - 10;
647                        if (.@guardiantype[.@UseGID] == 1) { set .@type,1287; }
648                        else if (.@guardiantype[.@UseGID] == 2) { set .@type,1285; }
649                        else { set .@type,1286; }
650                        guardian strnpcinfo(2),.@guardianposx[.@UseGID],.@guardianposy[.@UseGID],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@UseGID;
651                        mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
652                        close;
653                case 2:
654                        mes "[ Steward " + .@name$ + " ]";
655                        mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
656                        close;
657        }
658        case 5:
659                if (GetCastleData(strnpcinfo(2),9) == 1) {
660                        mes "[ Steward " + .@name$ + " ]";
661                        mes "Now about the Kafra staff... Will you discharge the Kafra staff?";
662                        next;
663                        switch(select("Discharge:Cancel")) {
664                        case 1:
665                                cutin "kafra_01",2;
666                                mes "[ Hired Kafra staff ]";
667                                mes "I worked so hard... How can this be, Master?... I'll work harder if you're displeased... Please reconsider, Master.";
668                                next;
669                                switch(select("Discharge:Cancel")) {
670                                case 1:
671                                        mes "[ Hired Kafra staff ]";
672                                        mes "Oh, my god! This is nonsense!";
673                                        next;
674                                        cutin "kafra_01",255;
675                                        break;
676                                case 2:
677                                        mes "[ Hired Kafra staff ]";
678                                        mes "I'll work harder... Thank you!";
679                                        close2;
680                                        cutin "kafra_01",255;
681                                        end;
682                                }
683                        case 2:
684                                mes "[ Steward " + .@name$ + " ]";
685                                mes "Those Kafra are hard workers. I thought it would be best to keep the staff.";
686                                close;
687                        }
688                        disablenpc "Kafra Staff#"+strnpcinfo(2);
689                        SetCastleData strnpcinfo(2),9,0;
690                        mes "[ Steward " + .@name$ + " ]";
691                        mes "....";
692                        mes "Discharged Kafra staff... But... are you displeased with something?";
693                        close;
694                }
695                else {
696                        mes "[ Steward " + .@name$ + " ]";
697                        mes "Will you contract with the Kafra head office to hire Kafra staff in our castle?";
698                        mes "^ff0000 10000zeny is needed to hire. ";
699                        next;
700                        switch(select("Hire.:Cancel")) {
701                        case 1:
702                                mes "[ Steward " + .@name$ + " ]";
703                                if (getgdskilllv(.@GID,10001) == 0) {
704                                        mes "Master, we cannot hire Kafra staff because we didn't make a contract with the Kafra head office. If you want to make a contract with the Kafra head office, you have to learn the Guild skill.";
705                                        close;
706                                }
707                                if (Zeny < 10000) {
708                                        mes "Well... I'm sorry but we don't have enough funds. We are unable to hire the Kafra staff.";
709                                        close;
710                                }
711                                set zeny,zeny-10000;
712                                enablenpc "Kafra Staff#"+strnpcinfo(2);
713                                SetCastleData strnpcinfo(2),9,1;
714                                mes "We finished making the contract with the Kafra head office successfully. We hired a Kafra staff.";
715                                next;
716                                cutin "kafra_01",2;
717                                mes "[ Hired Kafra staff ]";
718                                mes "How do you do? I'm a dispatched Kafra from head office.";
719                                mes "I'll do my best to upkeep the reputation of Guild.";
720                                next;
721                                cutin "kafra_01",255                    ;
722                                mes "[ Steward " + .@name$ + " ]";
723                                mes "The contract term of the hired Kafra staff is 1 month and after this term, you will have to pay an additional charge.";
724                                mes "It will be useful for our members.";
725                                close;
726                        case 2:
727                                mes "[ Steward " + .@name$ + " ]";
728                                mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra staff quickly.";
729                                close;
730                        }
731                }
732        case 6:
733                mes "[ Steward " + .@name$ + " ]";
734                mes "Do you want to visit the room where our valuables are stored?";
735                mes "That room is restricted to you... you are the only one with access to it.";
736                next;
737                switch(select("Go into Master's room.:Cancel")) {
738                case 1:
739                        mes "[ Steward " + .@name$ + " ]";
740                        mes "Please follow me, I will show you the secret passage.";
741                        mes "When you wish to return, pull this lever here...";
742                        close2;
743                        warp strnpcinfo(2),.@masterroom[0],.@masterroom[1];
744                        end;
745                case 2:
746                        mes "[ Steward " + .@name$ + " ]";
747                        mes "Goods are produced once a day... if you don't make use of them, they will not produce.";
748                        mes "Therefore it would be better that you remove them over time for the Guild.";
749                        close;
750                }
751        }
752}
753
754
755// Guardian Spawner Template
756//============================================================
757-       script  Gld_Guard_Template::Gld_Guard_Template  -1,{
758// Spawn Guardians in castles
759// When adding new castles, ensure that the coordinates coincide
760// with the coordinates defined in the Guild Steward template.
761OnSpawnGuardians:
762        // Define the types of guardians on a per castle basis.
763        // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
764        // Define the x spawn point for each uardian.
765        // [0] = 1st guardian's x spawn point.
766        // Define the y spawn point for each uardian.
767        // [0] = 1st guardian's y spawn point.
768        // Aldebaran (Luina) Castles
769        if (strnpcinfo(2) == "aldeg_cas01") {
770                setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
771                setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
772                setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
773        }
774        else if (strnpcinfo(2) == "aldeg_cas02") {
775                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
776                setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
777                setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
778        }
779        else if (strnpcinfo(2) == "aldeg_cas03") {
780                setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
781                setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
782                setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
783        }
784        else if (strnpcinfo(2) == "aldeg_cas04") {
785                setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
786                setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
787                setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
788        }
789        else if (strnpcinfo(2) == "aldeg_cas05") {
790                setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
791                setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
792                setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
793        }
794        // Geffen (Britoniah) Castles
795        else if (strnpcinfo(2) == "gefg_cas01") {
796                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
797                setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
798                setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
799        }
800        else if (strnpcinfo(2) == "gefg_cas02") {
801                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
802                setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
803                setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
804        }
805        else if (strnpcinfo(2) == "gefg_cas03") {
806                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
807                setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
808                setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
809        }
810        else if (strnpcinfo(2) == "gefg_cas04") {
811                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
812                setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
813                setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
814        }
815        else if (strnpcinfo(2) == "gefg_cas05") {
816                setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
817                setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
818                setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
819        }
820        // Payon (Baulder) Castles
821        else if (strnpcinfo(2) == "payg_cas01") {
822                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
823                setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
824                setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
825        }
826        else if (strnpcinfo(2) == "payg_cas02") {
827                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
828                setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
829                setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
830        }
831        else if (strnpcinfo(2) == "payg_cas03") {
832                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
833                setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
834                setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
835        }
836        else if (strnpcinfo(2) == "payg_cas04") {
837                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
838                setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
839                setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
840        }
841        else if (strnpcinfo(2) == "payg_cas05") {
842                setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
843                setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
844                setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
845        }
846        // Prontera (Valkyrie Realms) Castles
847        else if (strnpcinfo(2) == "prtg_cas01") {
848                setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
849                setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
850                setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
851        }
852        else if (strnpcinfo(2) == "prtg_cas02") {
853                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
854                setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
855                setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
856        }
857        else if (strnpcinfo(2) == "prtg_cas03") {
858                setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
859                setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
860                setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
861        }
862        else if (strnpcinfo(2) == "prtg_cas04") {
863                setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
864                setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
865                setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
866        }
867        else if (strnpcinfo(2) == "prtg_cas05") {
868                setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
869                setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
870                setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
871        }
872        // Add custom Guild Castles here.
873        else {
874                end;
875        }
876
877        // Kill all existing guardians before spawning new ones.
878        // This should prevent duplicating Guardians when char Server disconnects.
879        killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianDied";
880
881        for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
882                set .@UseGID,.@i + 10;
883                if (.@guardiantype[.@i] == 1) { set .@type,1287; }
884                else if (.@guardiantype[.@i] == 2) { set .@type,1285; }
885                else { set .@type,1286; }
886                if (GetCastleData(strnpcinfo(2),.@UseGID)) {
887                        guardian strnpcinfo(2),.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@i;
888                }
889        }
890        end;
891
892OnGuardianDied:
893        end;
894}       
895
896// Kafra Template
897//============================================================
898-       script  Gld_Kafra_Template::Gld_Kafra_Template  -1,{
899        // Store the Guild ID of castle occupant.
900        set .@GID, GetCastleData(strnpcinfo(2),1);
901
902        if (compare(strnpcinfo(2),"aldeg")) {
903                setarray .@destination$[0],"Al De Baran","aldebaran";
904                setarray .@coordinates[0],132,103;
905        }
906        else if (compare(strnpcinfo(2),"gefg")) {
907                setarray .@destination$[0],"Geffen","geffen";
908                setarray .@coordinates[0],120,39;
909        }
910        else if (compare(strnpcinfo(2),"payg")) {
911                setarray .@destination$[0],"Payon","payon";
912                setarray .@coordinates[0],70,100;
913        }
914        else if (compare(strnpcinfo(2),"prtg")) {
915                setarray .@destination$[0],"Prontera","prontera";
916                setarray .@coordinates[0],116,72;
917        }
918        // Add custom Guild Castles here.
919        else {
920                end;
921        }
922
923        cutin "kafra_01",2;
924        if (getcharid(2) == .@GID) {
925                mes "[Kafra staff]";
926                mes "Welcome. ^ff0000" + getguildname(.@GID) + "^000000 Member.";
927                mes "The Kafra Coporation will stay with you wherever you go.";
928                next;
929                switch(select("Use Storage:Use Guild Storage:Use Warp Service:Rent a Cart:Cancel")) {
930                case 1:
931                        if (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
932                                mes "[Kafra staff]";
933                                mes "I am sorry but you have to be at least Novice skill level 6 if you want to use the storage.";
934                        }
935                        else {
936                                callfunc("F_CheckKafCode");     //check your storage password, if set
937                                openstorage;
938                        }
939                        break;
940                case 2:
941                        // Unofficial, but since it's already been in eA for ages
942                        // and used, I can't exactly remove it, now, can I? >:(
943                        if(guildopenstorage(0) == 1){
944                                mes "[Kafra Employee]";
945                                mes "I'm sorry but another guild member is using the guild storage";
946                                mes "right now.  Please wait until that person is finished.";
947                                close2;
948                                cutin "", 255;
949                                end;
950                        }
951                        cutin "", 255;
952                        close;                 
953                case 3:
954                        mes "[Kafra staff]";
955                        mes "Please let me know your destination.";
956                        next;
957                        switch(select(.@destination$ + " ^880000200 ^000000z:Cancel")) {
958                        case 1:
959                                if (Zeny < 200) {
960                                        mes "[Kafra staff]";
961                                        mes "You don't have enough money. Please check again.";
962                                }
963                                else {
964                                        set zeny,zeny-200;
965                                        set kf_10_pit,kf_10_pit+2;
966                                        cutin "kafra_01",255;
967                                        warp .@destination$[1],.@coordinates[0],.@coordinates[1];
968                                        end;
969                                }
970                                break;
971                        case 2:
972                                break;
973                        }
974                        break;
975                case 4:
976                        if(baseClass != Job_Merchant){
977                                mes "[Kafra staff]";
978                                mes "I am sorry. The Cart Service is only provided for the Merchant and Blacksmith class.";
979                        }
980                        else if(checkcart() == 1){
981                                mes "[Kafra staff]";
982                                mes "You have a cart equipped already.";
983                        }
984                        else {
985                                mes "[Kafra staff]"             ;
986                                mes "The cart fee is 800 zeny. Do you want to rent a cart?";
987                                next;
988                                switch(select("Yes.:Cancel.")) {
989                                case 1:
990                                        if (Zeny < 800) {
991                                                mes "[Kafra staff]";
992                                                mes "You don't have enough Money. You need 800 Zeny to rent a cart.";
993                                        }
994                                        else {
995                                                close2;
996                                                cutin "kafra_01",255;
997                                                set kf_10_pit,kf_10_pit+8;
998                                                set zeny,zeny-800;
999                                                setcart;
1000                                                end;
1001                                        }
1002                                        break;
1003                                case 2:
1004                                        break;
1005                                }
1006                        }               
1007                        break;
1008                case 5:
1009                        mes "[Kafra staff]";
1010                        mes "The Kafra corp. always tries to give the best service.";
1011                        mes "Thank you for using Kafra corp. Please come again.";
1012                }
1013        }
1014        else {
1015                mes "[Kafra staff]";
1016                mes "I am instructed to service only for the ^ff0000" + getguildname(.@GID) + "^000000 Guild. Please try another Kafra staff member around here. Sorry for the inconvenience.";
1017        }
1018        close2;
1019        cutin "kafra_01",255;
1020        end;
1021}
1022
1023// Guild Dungeon Switch Template
1024//============================================================
1025-       script  Gld_Dun_Template::Gld_Dun_Template      -1,{
1026        // Store the Guild ID of castle occupant.
1027        set .@GID, GetCastleData(strnpcinfo(2),1);
1028
1029        // Pick what Dungeon I should warp too, and where in that dungeon.
1030        if (compare(strnpcinfo(2),"aldeg")) {
1031                set .@destination$,"gld_dun02";
1032                if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],32,122;
1033                else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],79,32;
1034                else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],165,38;
1035                else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],160,148;
1036                else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],103,169;
1037        }
1038        else if (compare(strnpcinfo(2),"gefg")) {
1039                set .@destination$,"gld_dun04";
1040                if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],39,258;
1041                else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],125,270;
1042                else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],268,251;
1043                else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,108;
1044                else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],230,35;
1045        }
1046        else if (compare(strnpcinfo(2),"payg")) {
1047                set .@destination$,"gld_dun01";
1048                if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],186,165;
1049                else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],54,165;
1050                else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],54,39;
1051                else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],186,39;
1052                else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],223,202;
1053        }
1054        else if (compare(strnpcinfo(2),"prtg")) {
1055                set .@destination$,"gld_dun03";
1056                if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],28,251;
1057                else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],164,268;
1058                else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],164,179;
1059                else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,203;
1060                else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],199,28;
1061        }
1062        // Add custom Guild Castles here.
1063        else {
1064                end;
1065        }
1066
1067        if (.@GID == 0) {
1068                mes "[ Echoing Voice ]";
1069                mes " ' The one who can overcome an ordeal and show true bravery... will find the way... ' ";
1070                close;
1071        }
1072        else {
1073                mes "[ Echoing Voice ]";
1074                mes " ' Only the one who can show true bravery can take this test. '";
1075                next;
1076                mes " ";
1077                mes "There's a small lever. Will you pull it?";
1078                next;
1079                switch(select("Pull.:Do not.")) {
1080                case 1:
1081                        if ((getcharid(2) == .@GID)) {
1082                                warp .@destination$,.@coordinates[0],.@coordinates[1];
1083                                end;
1084                        }
1085                        else {
1086                                mes " ";
1087                                mes " Nothing happened.";
1088                                close;
1089                        }
1090                case 2:
1091                        close;
1092                }
1093        }
1094}
1095
1096// Treasure Room Protection Template
1097//============================================================
1098-       script  Gld_Trea_Protect::Gld_Trea_Protect      -1,{
1099//OnTouch2:
1100OnTouch:
1101        // Store the Guild ID of castle occupant.
1102        set .@GID, GetCastleData(strnpcinfo(2),1);
1103
1104        if (strcharinfo(0) != getguildmaster(.@GID)) {
1105                if (compare(strnpcinfo(2),"aldeg")) {
1106                        warp "aldebaran",132,103;
1107                }
1108                else if (compare(strnpcinfo(2),"gefg")) {
1109                        warp "geffen",120,39;
1110                }
1111                else if (compare(strnpcinfo(2),"payg")) {
1112                        warp "payon",70,100;
1113                }
1114                else if (compare(strnpcinfo(2),"prtg")) {
1115                        warp "prontera",116,72;
1116                }
1117                // Add custom Guild Castles here.
1118                else {
1119                        end;
1120                }
1121        }
1122        end;
1123}
1124
1125// Treasure Room Spawn Template
1126//============================================================
1127-       script  Gld_Trea_Spawn::Gld_Trea_Spawn  -1,{
1128        end;
1129
1130OnClock0001:
1131        // Do nothing if this script is the template.
1132        if (strnpcinfo(1) == "Gld_Trea_Spawn") end;
1133       
1134        // If there is no owner, do nothing.
1135        if (!GetCastleData(strnpcinfo(2),1)) end;
1136
1137        // Is there Economy in this castle?
1138        set .@Treasure,GetCastleData(strnpcinfo(2),2)/5+4;
1139
1140        // Set information
1141        if (strnpcinfo(2) == "aldeg_cas01") {
1142                set .@treasurebox,1324;
1143                setarray .@treasurex[0],115,122,115,122,116,117,118,119,120,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116;
1144                setarray .@treasurey[0],226,226,219,219,225,225,225,225,225,225,224,223,222,221,220,220,220,220,220,220,221,222,223,224;
1145        }
1146        else if (strnpcinfo(2) == "aldeg_cas02") {
1147                set .@treasurebox,1326;
1148                setarray .@treasurex[0],134,135,135,134,132,133,134,135,136,137,137,137,137,137,137,136,135,134,133,132,132,132,132,132;
1149                setarray .@treasurey[0],231,231,230,230,233,233,233,233,233,233,232,231,230,229,228,228,228,228,228,228,229,230,231,232;
1150        }
1151        else if (strnpcinfo(2) == "aldeg_cas03") {
1152                set .@treasurebox,1328;
1153                setarray .@treasurex[0],224,225,225,224,222,223,224,225,226,227,227,227,227,227,227,226,225,224,223,222,222,222,222,222;
1154                setarray .@treasurey[0],269,269,268,268,271,271,271,271,271,271,270,269,268,267,266,266,266,266,266,266,267,268,269,270;
1155        }
1156        else if (strnpcinfo(2) == "aldeg_cas04") {
1157                set .@treasurebox,1330;
1158                setarray .@treasurex[0],84,85,85,84,82,83,84,85,86,87,87,87,87,87,87,86,85,84,83,82,82,82,82,82;
1159                setarray .@treasurey[0],13,13,12,12,15,15,15,15,15,15,14,13,12,11,10,10,10,10,10,10,11,12,13,14;
1160        }
1161        else if (strnpcinfo(2) == "aldeg_cas05") {
1162                set .@treasurebox,1332;
1163                setarray .@treasurex[0],61,62,62,61,59,60,61,62,63,64,64,64,64,64,64,63,62,61,60,59,59,59,59,59;
1164                setarray .@treasurey[0],12,12,11,11,14,14,14,14,14,14,13,12,11,10,9,9,9,9,9,9,10,11,12,13;
1165        }
1166        else if (strnpcinfo(2) == "gefg_cas01") {
1167                set .@treasurebox,1334;
1168                setarray .@treasurex[0],153,154,154,153,151,152,153,154,155,156,156,156,156,156,156,155,154,153,152,151,151,151,151,151;
1169                setarray .@treasurey[0],113,113,112,112,115,115,115,115,115,115,114,113,112,111,110,110,110,110,110,110,111,112,113,114;
1170        }
1171        else if (strnpcinfo(2) == "gefg_cas02") {
1172                set .@treasurebox,1336;
1173                setarray .@treasurex[0],139,140,140,139,137,138,139,140,141,142,142,142,142,142,142,141,140,139,138,137,137,137,137,137;
1174                setarray .@treasurey[0],115,115,114,114,117,117,117,117,117,117,116,115,114,113,112,112,112,112,112,112,113,114,115,116;
1175        }
1176        else if (strnpcinfo(2) == "gefg_cas03") {
1177                set .@treasurebox,1338;
1178                setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
1179                setarray .@treasurey[0],291,291,290,290,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288,288,289,290,291,292;
1180        }
1181        else if (strnpcinfo(2) == "gefg_cas04") {
1182                set .@treasurebox,1340;
1183                setarray .@treasurex[0],115,116,116,115,113,114,115,116,117,118,118,118,118,118,118,117,116,115,114,113,113,113,113,113;
1184                setarray .@treasurey[0],119,119,118,118,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116,116,117,118,119,120;
1185        }
1186        else if (strnpcinfo(2) == "gefg_cas05") {
1187                set .@treasurebox,1342;
1188                setarray .@treasurex[0],143,144,144,143,141,142,143,144,145,146,146,146,146,146,146,145,144,143,142,141,141,141,141,141;
1189                setarray .@treasurey[0],110,110,109,109,112,112,112,112,112,112,111,110,109,108,107,107,107,107,107,107,108,109,110,111;
1190        }
1191        else if (strnpcinfo(2) == "payg_cas01") {
1192                set .@treasurebox,1344;
1193                setarray .@treasurex[0],289,292,292,289,288,289,290,291,292,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288;
1194                setarray .@treasurey[0],10,10,7,7,11,11,11,11,11,11,10,9,8,7,6,6,6,6,6,6,7,8,9,10;
1195        }
1196        else if (strnpcinfo(2) == "payg_cas02") {
1197                set .@treasurebox,1346;
1198                setarray .@treasurex[0],143,146,146,143,142,143,144,145,146,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142;
1199                setarray .@treasurey[0],146,146,143,143,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142,142,143,144,145,146;
1200        }
1201        else if (strnpcinfo(2) == "payg_cas03") {
1202                set .@treasurebox,1348;
1203                setarray .@treasurex[0],158,159,159,158,156,157,158,159,160,161,161,161,161,161,161,160,159,158,157,156,156,156,156,156;
1204                setarray .@treasurey[0],169,169,168,168,171,171,171,171,171,171,170,169,168,167,166,166,166,166,166,166,167,168,169,170;
1205        }
1206        else if (strnpcinfo(2) == "payg_cas04") {
1207                set .@treasurebox,1350;
1208                setarray .@treasurex[0],146,147,147,146,144,145,146,147,148,149,149,149,149,149,149,148,147,146,145,144,144,144,144,144;
1209                setarray .@treasurey[0],48,48,47,47,50,50,50,50,50,50,49,48,47,46,45,45,45,45,45,45,46,47,48,49;
1210        }
1211        else if (strnpcinfo(2) == "payg_cas05") {
1212                set .@treasurebox,1352;
1213                setarray .@treasurex[0],155,158,158,155,154,155,156,157,158,159,159,159,159,159,159,158,157,156,155,154,154,154,154,154;
1214                setarray .@treasurey[0],134,134,131,131,135,135,135,135,135,135,134,133,132,131,130,130,130,130,130,130,131,132,133,134;
1215        }
1216        else if (strnpcinfo(2) == "prtg_cas01") {
1217                set .@treasurebox,1354;
1218                setarray .@treasurex[0],10,11,11,10,8,9,10,11,12,13,13,13,13,13,13,12,11,10,9,8,8,8,8,8;
1219                setarray .@treasurey[0],209,209,208,208,211,211,211,211,211,211,210,209,208,207,206,206,206,206,206,206,207,208,209,210;
1220        }
1221        else if (strnpcinfo(2) == "prtg_cas02") {
1222                set .@treasurebox,1356;
1223                setarray .@treasurex[0],201,202,202,201,199,200,201,202,203,204,204,204,204,204,204,203,202,201,200,199,199,199,199,199;
1224                setarray .@treasurey[0],228,228,227,227,230,230,230,230,230,230,229,228,227,226,225,225,225,225,225,225,226,227,228,229;
1225        }
1226        else if (strnpcinfo(2) == "prtg_cas03") {
1227                set .@treasurebox,1358;
1228                setarray .@treasurex[0],187,188,188,187,185,186,187,188,189,190,190,190,190,190,190,189,188,187,186,185,185,185,185,185;
1229                setarray .@treasurey[0],132,132,131,131,134,134,134,134,134,134,133,132,131,130,129,129,129,129,129,129,130,131,132,133;
1230        }
1231        else if (strnpcinfo(2) == "prtg_cas04") {
1232                set .@treasurebox,1360;
1233                setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
1234                setarray .@treasurey[0],162,162,161,161,164,164,164,164,164,164,163,162,161,160,159,159,159,159,159,159,160,161,162,163;
1235        }
1236        else if (strnpcinfo(2) == "prtg_cas05") {
1237                set .@treasurebox,1362;
1238                setarray .@treasurex[0],275,276,276,275,273,274,275,276,277,278,278,278,278,278,278,277,276,275,274,273,273,273,273,273;
1239                setarray .@treasurey[0],178,178,177,177,180,180,180,180,180,180,179,178,177,176,175,175,175,175,175,175,176,177,178,179;
1240        }
1241        // Add custom Guild Castles here.
1242        else {
1243                end;
1244        }
1245
1246        // Reset daily investment limit.
1247        setcastledata strnpcinfo(2),4,0;
1248        setcastledata strnpcinfo(2),5,0;
1249
1250        // Spawn boxes in proper order.
1251        for (set .@i,0; .@i <= .@Treasure ; set .@i,.@i+1) {
1252                // set treasure box ID
1253                set .@boxid, .@treasurebox + (.@i+2) % 2;
1254                set .@box,1 << .@i;
1255                // Spawn or do not spawn chests if one already exists.
1256                if ((getd("$@"+strnpcinfo(2)+"_treasure") & .@box) == 0) {
1257                        monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",.@boxid,1,"Treasure#"+strnpcinfo(2)+"::OnTreasureDied"+.@i;
1258                        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") | .@box;
1259                }
1260        }
1261        end;
1262
1263// Individual "You killed a chest" events to ensure proper spawning at the change of day.
1264OnTreasureDied0:
1265        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1;
1266        end;
1267OnTreasureDied1:
1268        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2;
1269        end;
1270OnTreasureDied2:
1271        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4;
1272        end;
1273OnTreasureDied3:
1274        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8;
1275        end;
1276OnTreasureDied4:
1277        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16;
1278        end;
1279OnTreasureDied5:
1280        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32;
1281        end;
1282OnTreasureDied6:
1283        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~64;
1284        end;
1285OnTreasureDied7:
1286        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~128;
1287        end;
1288OnTreasureDied8:
1289        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~256;
1290        end;
1291OnTreasureDied9:
1292        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~512;
1293        end;
1294OnTreasureDied10:
1295        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1024;
1296        end;
1297OnTreasureDied11:
1298        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2048;
1299        end;
1300OnTreasureDied12:
1301        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4096;
1302        end;
1303OnTreasureDied13:
1304        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8192;
1305        end;
1306OnTreasureDied14:
1307        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16384;
1308        end;
1309OnTreasureDied15:
1310        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32768;
1311        end;
1312OnTreasureDied16:
1313        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~65536;
1314        end;
1315OnTreasureDied17:
1316        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~131072;
1317        end;
1318OnTreasureDied18:
1319        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~262144;
1320        end;
1321OnTreasureDied19:
1322        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~524288;
1323        end;
1324OnTreasureDied20:
1325        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1048576;
1326        end;
1327OnTreasureDied21:
1328        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2097152;
1329        end;
1330OnTreasureDied22:
1331        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4194304;
1332        end;
1333OnTreasureDied23:
1334        setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8388608;
1335        end;
1336}
Note: See TracBrowser for help on using the browser.