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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
//===== eAthena Script =======================================
//= War of Emperium Guild Manager Function
//===== By: ==================================================
//= jAthena - kalen (1.0) & eAthena Team
//===== Current Version: =====================================
//= 1.8
//===== Compatible With: =====================================
//= eAthena SVN; RO Episode 4+
//===== Description: =========================================
//= [ Aegis Conversion]
//= The Guild Manager allows the Guildmaster to invest in comerce
//= and defense, hire guardians and kafras, go to the treasure room,
//= and surrender the guild castle.
//==============================================
//= Break down of arguments used in the function:
//= arg(0): name of Castle Manager
//= arg(1): name of guild castle.
//= arg(2): x1 coordinate for warp to treasure room
//= arg(3): y1 coordinate for warp to treasure room
//= arg(4): guild script suffix for kafra, Guardian scripts etc.
//===== Additional Comments: =================================
//= 1.31: Added support for Emsolute Develop [celest]
//= 1.2: All Guild manager scripts use this function. Optimized Comerce and Defense investment. [kobra_k88]
//= 1.2a Function now returns to script that called it. Added disablenpc line to surrender castle option to remove kafra upon surrender.[kobra_k88]
//= 1.2b U can't surrender the base during WOE [Lupus]
//= 1.2c Fixed issue of guardians hp not increasing upon defense investment.[kobra_k88]
//= 1.3 Now you can't install Guardians during WOE [Lupus]
//= 1.4 Remove surrender abbility (Was 100% custom as far as I can tell) [Kayla]
//= 1.41 Fixed possible Economy investment overflow with Emsolute Develop learnt [Lupus]
//= 1.5 Official Novice Castles Menu (u can't invest / hire guardians) [Lupus]
//= 1.6 According to recent info u can re-install Guardians during WoE [Lupus]
//= 1.6a Fix for guild manager recognizing [KarLaeda]
//= 1.6b Fixed the chance for double invest, now 50% instead of 49% [Lupus]
//= 1.7 Changed the names of the Kafra from "Service" to "Staff" [L0ne_W0lf]
//= 1.8 Rescripted to Aegis 10.3 standards. [L0ne_W0lf]
//= This update changes quite a bit of the internal workings of the guild manager.
//= No longer uses defined numerical values for guardian HP calculation
//= Guardian summon display list is now DYNAMIC. Updated with guardian corrections.
//= Added dialog for castle Abandoning. Commented out be default.
//============================================================
function script F_GldManager {
set .@GID, GetCastleData(getarg(1),1);
// Define the types of guardians on a per castle basis
// 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
// Aldebaran (Luina)
if (getarg(1) == "aldeg_cas01") setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
if (getarg(1) == "aldeg_cas02") setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
if (getarg(1) == "aldeg_cas03") setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
if (getarg(1) == "aldeg_cas04") setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
if (getarg(1) == "aldeg_cas05") setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
// Geffen (Britoniah)
if (getarg(1) == "gefg_cas01") setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
if (getarg(1) == "gefg_cas02") setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
if (getarg(1) == "gefg_cas03") setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
if (getarg(1) == "gefg_cas04") setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
if (getarg(1) == "gefg_cas05") setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
// Payon (Baulder)
if (getarg(1) == "payg_cas01") setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
if (getarg(1) == "payg_cas02") setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
if (getarg(1) == "payg_cas03") setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
if (getarg(1) == "payg_cas04") setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
if (getarg(1) == "payg_cas05") setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
// Prontera (Valkyrie Realms)
if (getarg(1) == "prtg_cas01") setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
if (getarg(1) == "prtg_cas02") setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
if (getarg(1) == "prtg_cas03") setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
if (getarg(1) == "prtg_cas04") setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
if (getarg(1) == "prtg_cas05") setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
if (.@GID == 0){
mes "[ "+getarg(0)+" ]";
mes "I have been waiting for a master to fulfill my destiny.";
mes "Brave soul... fate will guide you towards your future...";
return 0;
}
if (getcharid(2) != .@GID){
mes "[ "+getarg(0)+" ]";
mes "No matter how much you pester me, I'll still follow my master ^ff0000" + getguildmaster(.@GID) + "^000000. Where are Guardians?! Send these ruffians away right now!";
return 0;
}
mes "[ "+getarg(0)+" ]";
mes "Welcome. My honorable master, ^ff0000" + getguildmaster(.@GID) + "^000000...";
mes "Your humble servent, "+getarg(0)+", is here to serve you.";
next;
// To allow abandoning of castles, uncomment the following switch,
// comment out the switch below it, and uncomment case 7.
//switch(select("Castle briefing:Invest in commercial growth:Invest in Castle Defenses:Summon Guardian:Employ / discharge a storehouse staff member:Go into Master's room:Abandon Castle")) {
switch(select("Castle briefing:Invest in commercial growth:Invest in Castle Defenses:Summon Guardian:Employ / discharge a storehouse staff member:Go into Master's room")) {
case 1:
mes "[ "+getarg(0)+" ]";
mes "I will report the Castle briefing, Master.";
mes " ";
mes " ^0000ffNow, commercial growth level is " + GetCastleData(getarg(1),2) + ".";
if (GetCastleData(getarg(1),4) > 0)
mes "You invested " + GetCastleData(getarg(1),4) + "times in last 1 day.";
mes "Now, the Castle Defense level is " + GetCastleData(getarg(1),3) + ".^000000";
if (GetCastleData(getarg(1),5) > 0)
mes " ^0000ff- You invested " + GetCastleData(getarg(1),5) + "times in last 1 day.^000000";
mes " ";
mes "That's all to report, Master.";
return 0;
case 2:
set .@Economy,GetCastleData(getarg(1),2);
if(.@Economy < 8) set .@eco_invest,10000;
if(.@Economy >= 8) set .@eco_invest,20000;
if(.@Economy >= 16) set .@eco_invest,40000;
if(.@Economy >= 25) set .@eco_invest,80000;
if(.@Economy >= 34) set .@eco_invest,160000;
if(.@Economy >= 44) set .@eco_invest,320000;
if(.@Economy >= 54) set .@eco_invest,640000;
if(.@Economy >= 65) set .@eco_invest,1280000;
if(.@Economy >= 76) set .@eco_invest,2560000;
if(.@Economy >= 88) set .@eco_invest,5120000;
mes "[ "+getarg(0)+" ]";
mes "If you invest in commercial growth, the quantity of goods made by the guild will increase. Therfore, if you consider our future, investments will be a necessity.";
mes " ";
mes "Initially, you are able to invest just once but if you pay more money, you will be able to invest twice.";
if (.@Economy == 100) {
mes " ";
mes "^ff0000The commercial growth level of our Castle is at it's highest, 100%. No more investments are needed. Just as I have expected from a great economist like you, Master.^000000";
return 0;
}
mes " ";
if (GetCastleData(getarg(1),4) == 2) {
mes "^ff0000You have already invested twice today. You cannot invest any more.^000000 I expect riches of the guild to grow at a high rate.";
return 0;
}
else if (GetCastleData(getarg(1),4) == 0)
mes "The current investment amount required is ^ff0000" + .@eco_invest + "^000000 zeny. Will you invest?";
else
mes "You have already invested once. Do you wish to invest one more time? ^ff0000" + .@eco_invest + "^000000 more zeny will be needed.";
next;
if (select("Invest in commercial growth:Cancel") == 1) {
mes "[ "+getarg(0)+" ]";
if (Zeny < .@eco_invest) {
mes "I'm sorry but there is not enough zeny to invest in the reserves of guild. You have failed to invest, Master.";
return 0;
}
set zeny,zeny-.@eco_invest;;
SetCastleData getarg(1),4,GetCastleData(getarg(1),4)+1;
SetCastleData getarg(1),2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
mes "We have finished investing safely. I expect in our coming days, the growth level will increase.";
return 0;
}
mes "[ "+getarg(0)+" ]";
mes "I'll do as you have instructed my master... There is no hurry. There is nothing we can not accomplish.";
return 0;
case 3:
set .@Defence,GetCastleData(getarg(1),3);
if(.@Defence < 8) set .@def_invest,20000;
if(.@Defence >= 8) set .@def_invest,40000;
if(.@Defence >= 16) set .@def_invest,80000;
if(.@Defence >= 25) set .@def_invest,160000;
if(.@Defence >= 34) set .@def_invest,320000;
if(.@Defence >= 44) set .@def_invest,640000;
if(.@Defence >= 54) set .@def_invest,1280000;
if(.@Defence >= 65) set .@def_invest,2560000;
if(.@Defence >= 76) set .@def_invest,5120000;
if(.@Defence >= 88) set .@def_invest,10240000;
mes "[ "+getarg(0)+" ]";
mes "If you raise Castle Defenses, the durability of Guardians and the Emperium will increase. Therefore, if you consider our coming battles, some investment in this area will be required.";
mes " ";
mes "Originally you can invest just once but if you pay more money, you can invest twice.";
if (.@Defence == 100) {
mes " ";
mes "^ff0000But the Castle Defense level of our Castle is at it's highest, 100%. No more investments are needed. Just as I have expected from a great strategist like you, Master.^000000";
return 0;
}
mes " ";
if (GetCastleData(getarg(1),5) == 2) {
mes "^ff0000You have already invested twice today. You cannot invest any more.^000000 I expect the Defenses of the guild to grow at a high rate.";
return 0;
}
else if (GetCastleData(getarg(1),5) == 1)
mes "The current investment amount required is ^ff0000" + .@def_invest + "^000000 zeny. Will you invest?";
else
mes "You have already invested once. Do you wish to invest one more time? ^ff0000" + .@def_invest + "^000000 more zeny will be needed.";
next;
if (select("Invest in Castle Defenses.:Cancel") == 1) {
mes "[ "+getarg(0)+" ]";
if (Zeny < .@def_invest) {
mes "I'm sorry but there is not enough zeny to invest in the reserves of guild. You have failed to invest, Master.";
return 0;
}
set Zeny,Zeny-@def_invest;
SetCastleData getarg(1),5,GetCastleData(getarg(1),5)+1;
SetCastleData getarg(1),3,.@Defence+1;
set .@Defence, .@Defence + 1;
set .@AGuardian, strmobinfo(4,1285) + (.@Defence*2000);
set .@KGuardian, strmobinfo(4,1286) + (.@Defence*2000);
set .@SGuardian, strmobinfo(4,1287) + (.@Defence*2000);
for (set .@i, 0; .@i <= 7 ; set .@i, .@i+1) {
if (.@guardiantype[.@i] == 1) set .@GHP,.@SGuardian;
else if (.@guardiantype[.@i] == 2) set .@GHP,.@AGuardian;
else set .@GHP,.@KGuardian;
if (GetCastleData(getarg(1),(.@i + 10)) == 1) SetCastleData getarg(1),(.@i + 18),.@GHP;
}
mes "We have finished investing safely. I expect in our coming days, the growth level will increase.";
return 0;
}
mes "[ "+getarg(0)+" ]";
mes "I'll do as you have instructed my master... There is no hurry. There is nothing we can not accomplish.";
return 0;
case 4:
set .@Defence,GetCastleData(getarg(1),3);
set .@AGuardian, strmobinfo(4,1285) + (.@Defence*2000);
set .@KGuardian, strmobinfo(4,1286) + (.@Defence*2000);
set .@SGuardian, strmobinfo(4,1287) + (.@Defence*2000);
mes "[ "+getarg(0)+" ]";
mes "Do you still want to summon a Guardian? It'll be a protector to defend us to the end.";
mes "Choose a Guardian to summon.";
next;
for (set .@i, 0; .@i <= 7 ; set .@i, .@i+1) {
if (.@guardiantype[.@i] == 1) {
set .@type$,"Soldier";
setarray .@GuardianHP[.@i],.@SGuardian;
}
else if (.@guardiantype[.@i] == 2) {
set .@type$,"Archer";
setarray .@GuardianHP[.@i],.@AGuardian;
}
else {
set .@type$,"Knight";
setarray .@GuardianHP[.@i],.@KGuardian;
}
if (GetCastleData(getarg(1),(.@i+10)))
setarray .@name$[.@i],"Guardian "+.@type$+" - Implemented (" + guardianinfo(.@i) + "/" + .@GuardianHP[.@i] + ")";
else
setarray .@name$[.@i],"Guardian "+.@type$+" - Not Implemented";
}
set .@menu$,.@name$[0]+":"+.@name$[1]+":"+.@name$[2]+":"+.@name$[3]+":"+.@name$[4]+":"+.@name$[5]+":"+.@name$[6]+":"+.@name$[7];
switch(select(.@menu$)) {
case 1: set @GDnum,10; break;
case 2: set @GDnum,11; break;
case 3: set @GDnum,12; break;
case 4: set @GDnum,13; break;
case 5: set @GDnum,14; break;
case 6: set @GDnum,15; break;
case 7: set @GDnum,16; break;
case 8: set @GDnum,17; break;
}
mes "[ "+getarg(0)+" ]";
mes "Do you wish to summon the chosen guardian? 10,000 zeny is required to summon it.";
next;
if (select("Summon:Cancel") == 1) {
mes "[ "+getarg(0)+" ]";
if (getgdskilllv(.@GID,10002) == 0) {
mes "Master, we do not have any research materials to summon the Guardian. If you want to accumulate knowledge for Guardians, you have to learn the Guild skill first, We have failed to summon the Guardian.";
return 0;
}
if (GetCastleData(getarg(1),@GDnum) == 1) {
mes "Master, you have already have that Guardian. You cannot summon any more.";
return 0;
}
if (Zeny < 1000) {
mes "Well... I'm sorry but we don't have enough funds to summon the Guardian. We have failed to summon the Guardian.";
return 0;
}
set zeny,zeny-10000;
set .@HP,@GDnum + 8;
SetCastleData getarg(1),@GDnum,1;
SetCastleData getarg(1),.@HP,.@GuardianHP[(@GDnum - 10)];
mes "We have successfully summoned the Guardian. We now have our strong force to defend us!";
return 1;
}
mes "[ "+getarg(0)+" ]";
mes "I have done as you have commanded, but please remember if you have money to spare, it will be better if we use a Guardian.";
return 0;
case 5:
if (GetCastleData(getarg(1),9) == 1) {
mes "[ "+getarg(0)+" ]";
mes "We are now hiring Kafra employee... Will you fire any current Kafra employee?";
next;
switch(select("Discharge:Cancel")) {
cutin "kafra_01",2;
mes "[ Hired Kafra Employee ]";
mes "I worked so hard... How can you do that, Master?... Please... Please reconsider... Check it again, Master... Please...";
next;
switch(select("Discharge:Cancel")) {
case 1:
mes "[ Hired Kafra Employee ]";
mes "Oh, my goodness! This is nonsense!";
next;
cutin "kafra_01",255;
break;
case 2:
mes "[ Hired Kafra Employee ]";
mes "I'll work hard for you... Thank you!";
return 0;
}
break;
case 2:
mes "[ "+getarg(0)+" ]";
mes "She worked hard in my opinion. It was a good decision to keep her.";
return 0;
}
disablenpc "Kafra Staff#"+getarg(4);
SetCastleData getarg(1),9,0;
mes "[ "+getarg(0)+" ]";
mes "....";
mes "I have discharged the Kafra employee... But... are you dissatisfied with the decision?";
return 0;
}
else {
mes "[ "+getarg(0)+" ]";
mes "Will you contact Kafra head office to hire Kafra staff in our Castle?";
mes "^ff0000 10,000 zeny is required for their services. ";
next;
if (select("Hire.:Cancel") == 1) {
mes "[ "+getarg(0)+" ]";
if (getgdskilllv(.@GID,10001) == 0) {
mes "Master, we cannot hire Kafra staff because we have not established a contract with Kafra head office. If you want to establish a contract with Kafra head office, you have to learn Guild skill first.";
return 0;
}
if (Zeny < 10000) {
mes "[ "+getarg(0)+" ]";
mes "Well... I'm sorry but we don't have enough funds to hire Kafra staff.";
return 0;
}
set Zeny,Zeny-10000;
enablenpc "Kafra Staff#"+getarg(4);
SetCastleData getarg(1),9,1;
mes "We have completed our task in establishing a contract with Kafra head office and hired Kafra staff.";
next;
cutin "kafra_01",2;
mes "[ Hired Kafra Employee ]";
mes "How do you do? I was dispatched from head office.";
mes "I'll do my best to not tarnish reputation of the Guild.";
next;
cutin "kafra_01",255;
mes "[ "+getarg(0)+" ]";
mes "The Contract terms of the hired Kafra staff is for 1 month and after this term, you will need to to pay an additional charge.";
mes "This will be good for our workers.";
return 0;
}
mes "[ "+getarg(0)+" ]";
mes "I've done as you have commanded, but for the sake of our workers, it would be better to hire Kafra staff immediately.";
return 0;
}
case 6:
mes "[ "+getarg(0)+" ]";
mes "Do you wish to go to the Master's Room.";
mes "That place is for only for you... no one else can enter the room.";
next;
if (select("Go into Master's room.:Cancel") == 1) {
mes "[ "+getarg(0)+" ]";
mes "I'll show you the secret path. Follow me...please.";
mes "When you want to return here, please press the secret switch.";
warp getarg(1),getarg(2),getarg(3);
end;
}
mes "[ "+getarg(0)+" ]";
mes "Goods are produced once a day... if you don't remove them in time, they will not be produced anymore.";
mes "Therefore, it will be better if you check up on them from time to time.";
return 0;
//case 7:
// mes "[ "+getarg(0)+" ]";
// mes "Master!!";
// mes "Will you give up this Castle after all that we have all gone through?!";
// mes "If.. If this is your final decision, what does all the blood that has been shed mean to you!?";
// mes "Please reconsider! Master!!";
// next;
// if (select("Leave Agit.:Cancel") == 1) {
// mes "[ "+getarg(0)+" ]";
// mes "Master!! Please think it over, Master!!";
// mes "The blood we shed so far...don't you care for all the sacrifices that were made?!";
// next;
// if (select("Cancel:Leave Castle.") == 1) {
// mes "[ "+getarg(0)+" ]";
// mes "I knew you were kidding, Master!!";
// mes "Please, Master.. Although you were kidding, don't do that again. You really scared me for a moment.";
// return 0;
// }
// mes "[ "+getarg(0)+" ]";
// mes "Master!!.....";
// mes "...... Ma..s...ter.....";
// callfunc "F_GuildBreak",getarg(0),getarg(4);
// return 0;
// }
// mes "[ "+getarg(0)+" ]";
// mes "I knew you were kidding, Master!!";
// mes "Please, Master.. Although you were kidding, don't do that again. You really scared me for a moment.";
// return 0;
}
}
|