summaryrefslogtreecommitdiff
path: root/npc/guild/gldfunc_ev_agit.txt
blob: 1a43f25272861d41370a4343a4e6c183d6ca4d9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
//===== eAthena Script =======================================
//= War of Emperium Guild Event AgitStart/AgitBreak Functions
//===== By: ==================================================
//= jAthena - kalen (1.0)
//= 1.1 by Akaru, ho|yAnge|X, and Valaris
//===== Current Version: =====================================
//= 1.8
//===== Compatible With: =====================================
//= eAthena SVN; RO Episode 4+
//===== Description: =========================================
//= F_AgitStart is in charge of spawning Emperium and mobs in castles
//=   when WoE is started.
//= F_AgitBreak resets guild castle data when a castle has been taken over.
//=   It then sets the data for the new guild master if there is one.
//=======================================
//= Break down of arguments used in F_AgitStart:
//=   arg(0): name of specific guild castle.
//=   arg(1): name of specific agit castle script.
//=   arg(2): x1 for Emperium coordinates.
//=   arg(3): y1 for Emperium coordinates.
//= Break down of arguments used in F_AgitBreak:
//=   arg(0): name of specific guild castle.
//=   arg(1): name of specific OnRevCastle label.
//===== Additional Comments: =================================
//= v1.2: All OnAgitStart and OnAgitBreak calls will use these functions.[kobra_k88]
//= v1.2a: Added OnAgitEnd function.[kobra_k88]
//= 1.3 Added code for abandoning captured castles on /breakguild [Lupus]
//= 1.3a fixed Defence / Economy underflow [Lupus] thanks2 kyoki
//= 1.4 updated a couple mapannounces in OnAgitBreak. [L0ne_W0lf]
//= 1.5 Changed the names of the Kafra from "Service" to "Staff" [L0ne_W0lf]
//= 1.6 Fixed the OnAgitBreak message being map-only and not global. (Lil DomX) [L0ne_W0lf]
//= 1.7 Updated functions, got rid of the various gotos. [L0ne_W0lf]
//=	Castles can be conquered as long as they un-owned.
//= 1.8 Fixed Guardian data being overwritten when castle ownership changes. [L0ne_W0lf]
//	Data will only be saved for guardians if you have the Guaridan Research.
//	It works this way to deal with a bug on ownership change.
//============================================================


// Function for OnAgitStart =========================================
function	script	F_AgitStart	{
	set .@map$, getarg(0);
	set .@castle$, getarg(1);
	set .@empx, getarg(2);
	set .@empy, getarg(3);

	MapRespawnGuildID .@map$,GetCastleData(.@map$,1),2;
	monster .@map$,.@empx,.@empy,"Emperium",1288,1,"Agit_"+.@castle$+"::OnAgitBreak";
	GvgOn .@map$;
	if (GetCastleData(.@map$,1) != 0) return;
	if (compare(.@map$,"aldeg_cas")) {
		areamonster .@map$,0,0,300,300,"--ja--",1117,10;
		areamonster .@map$,0,0,300,300,"--ja--",1132,4;
		areamonster .@map$,0,0,300,300,"--ja--",1219,2;
		areamonster .@map$,0,0,300,300,"--ja--",1205,1;
		areamonster .@map$,0,0,300,300,"--ja--",1216,10;
		areamonster .@map$,0,0,300,300,"--ja--",1193,17;
		areamonster .@map$,0,0,300,300,"--ja--",1269,9;
		areamonster .@map$,0,0,300,300,"--ja--",1276,7;
		areamonster .@map$,0,0,300,300,"--ja--",1208,3;
		areamonster .@map$,0,0,300,300,"--ja--",1275,1;
		areamonster .@map$,0,0,300,300,"--ja--",1268,1;
		areamonster .@map$,0,0,300,300,"--ja--",1272,1;
		monster .@map$,.@empx+1,.@empy,"--ja--",1272,1;
		monster .@map$,.@empx-1,.@empy,"--ja--",1270,4;
		monster .@map$,.@empx,.@empy+1,"--ja--",1268,1;
		monster .@map$,.@empx,.@empy-1,"--ja--",1219,1;
		monster .@map$,.@empx,.@empy,"--ja--",1276,5;
		return;
	}
	else if (compare(.@map$,"gefg_cas")) {
		areamonster .@map$,0,0,300,300,"--ja--",1117,10;
		areamonster .@map$,0,0,300,300,"--ja--",1263,11;
		areamonster .@map$,0,0,300,300,"--ja--",1102,10;
		areamonster .@map$,0,0,300,300,"--ja--",1130,10;
		areamonster .@map$,0,0,300,300,"--ja--",1140,20;
		areamonster .@map$,0,0,300,300,"--ja--",1163,9;
		areamonster .@map$,0,0,300,300,"--ja--",1275,1;
		areamonster .@map$,0,0,300,300,"--ja--",1219,1;
		areamonster .@map$,0,0,300,300,"--ja--",1150,1;
		areamonster .@map$,0,0,300,300,"--ja--",1159,1;
		monster .@map$,.@empx+1,.@empy,"--ja--",1203,1;
		monster .@map$,.@empx-1,.@empy,"--ja--",1087,1;
		monster .@map$,.@empx,.@empy+1,"--ja--",1213,7;
		monster .@map$,.@empx,.@empy-1,"--ja--",1189,7;
		return;
	}
	else if (compare(.@map$,"payg_cas")) {
		areamonster .@map$,0,0,300,300,"--ja--",1277,10;
		areamonster .@map$,0,0,300,300,"--ja--",1208,10;
		areamonster .@map$,0,0,300,300,"--ja--",1262,5;
		areamonster .@map$,0,0,300,300,"--ja--",1102,5;
		areamonster .@map$,0,0,300,300,"--ja--",1150,1;
		areamonster .@map$,0,0,300,300,"--ja--",1115,1;
		areamonster .@map$,0,0,300,300,"--ja--",1129,11;
		areamonster .@map$,0,0,300,300,"--ja--",1276,5;
		areamonster .@map$,0,0,300,300,"--ja--",1282,4;
		areamonster .@map$,0,0,300,300,"--ja--",1253,5;
		monster .@map$,.@empx,.@empy,"--ja--",1150,1;
		monster .@map$,.@empx,.@empy,"--ja--",1115,1;
		monster .@map$,.@empx,.@empy+1,"--ja--",1208,6;
		monster .@map$,.@empx,.@empy-1,"--ja--",1276,5;
		return;
	}
	else if (compare(.@map$,"prtg_cas")) {
		areamonster .@map$,0,0,300,300,"--ja--",1163,15;
		areamonster .@map$,0,0,300,300,"--ja--",1132,10;
		areamonster .@map$,0,0,300,300,"--ja--",1219,5;
		areamonster .@map$,0,0,300,300,"--ja--",1268,5;
		areamonster .@map$,0,0,300,300,"--ja--",1251,1;
		areamonster .@map$,0,0,300,300,"--ja--",1252,1;
		areamonster .@map$,0,0,300,300,"--ja--",1276,5;
		areamonster .@map$,0,0,300,300,"--ja--",1259,1;
		areamonster .@map$,0,0,300,300,"--ja--",1283,1;
		areamonster .@map$,0,0,300,300,"--ja--",1275,1;
		areamonster .@map$,0,0,300,300,"--ja--",1200,1;
		monster .@map$,.@empx+1,.@empy,"--ja--",1268,1;
		monster .@map$,.@empx-1,.@empy,"--ja--",1251,1;
		monster .@map$,.@empx,.@empy+1,"--ja--",1252,1;
		monster .@map$,.@empx,.@empy-1,"--ja--",1219,2;
		monster .@map$,.@empx,.@empy,"--ja--",1276,5;
		return;
	}
}

// Function for OnGuildBreak ======================================
function	script	F_GuildBreak	{
	set .@map$, getarg(0);
	set .@castle$, getarg(1);

	killmonsterall .@map$;

	Announce "Guild Base [" + GetCastleName(.@map$) + "] has been abandoned.",0;
	disablenpc "Kafra Staff#"+.@castle$;

	SetCastleData .@map$,0,0;
	return;
}

// Function for OnAgitBreak ======================================
function	script	F_AgitBreak	{
	set .@map$, getarg(0);
	set .@castle$, getarg(1);

	set .@GID,getcharid(2);
	if (.@GID <= 0) return;

	set .@Economy,GetCastleData(.@map$,2) - 5;
	if (.@Economy < 0) set .@Economy, 0;
	SetCastleData .@map$, 2, .@Economy;

	set .@Defence,GetCastleData(.@map$,3) - 5;
	if (.@Defence < 0) set .@Defence, 0;
	SetCastleData .@map$, 3, .@Defence;

	SetCastleData .@map$,1, .@GID;
	MapAnnounce .@map$,"The emperium has been destroyed.",bc_map,0x00CCFF;
	Announce "The [" + GetCastleName(.@map$) + "] castle has been conquered by the [" + GetGuildName(.@GID) + "] guild.",bc_all;
	GetCastleData .@map$,0,"::OnRecvCastle"+.@castle$;

	disablenpc "Kafra Staff#"+.@castle$;

	// Set data to be cleared from the castle
	// If the new owning guild doesn't have have 
	// Guardian Research erase all guardian data.
	// Otherwise remove investment data and kafra.
	if (getgdskilllv(.@GID,10002) == 0) set .@data,25;
	else set .@data,9;

	for( set .@i, 4; .@i <= .@data; set .@i, .@i+1 )
		SetCastleData .@map$, .@i, 0;

	return;
}


// Function for OnAgitEnd ======================================
function	script	F_AgitEnd	{
	set .@map$, getarg(0);
	set .@castle$, getarg(1);

	GvgOff .@map$;
	// Disable the following if statment to keep empty
	// castles from being aquired after after WoE ends.
	if (GetCastleData(.@map$,1) == 0) return;
	MapRespawnGuildID .@map$,GetCastleData(.@map$,1),4;
	KillMonster .@map$,"Agit_"+.@castle$+"::OnAgitBreak";
	end;
}