summaryrefslogtreecommitdiff
path: root/npc/events/nguild/nguild_treas.txt
blob: 8bfa184c572c2027c47adc6274c63780dbfe3e92 (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
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2015  Hercules Dev Team
//= Copyright (C)  brianluau
//= Copyright (C)  L0ne_W0lf
//= Copyright (C)  Lupus
//= Copyright (C)  kobra_k88
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= War of Emperium Treasure Rooms for NGuild Guild Castles
//================= Description ===========================================
//= War of Emperium Treasure Rooms for Novice Guild Castles
//================= Current Version =======================================
//= 1.3b
//=========================================================================

//== Treasure Spawning Function ============================
function	script	F_GldTreas	{
	if(getarg(10) !=  1) {
		setcastledata getarg(0),4,0;
		setcastledata getarg(0),5,0;

		// Why on earth are we killing old treasure chest spawns?
		//killmonster getarg(0),"Treasure_"+getarg(1)+"::OnDied";

		// Don't spawn treasures if Castle is empty, or Eco is greater than 100
		if(getcastledata(getarg(0),2) > 100 || getcastledata(getarg(0),1) == 0) return;

		// Only spawn one treasure chest for novice castles.
		if (compare(getarg(0),"nguild"))
			set getarg(2),1;
		else
			set getarg(2),getcastledata(getarg(0),2)/5+4;

		if (getarg(2) <= 0) return;

		//sets the counter variable = to the box number amount
		set getarg(3), getarg(2);
	}
	for (.@i = 1; .@i <= getarg(3); ++.@i) {
		// set treasure box ID
		set getarg(4), getarg(5) + (.@i+1) % 2;
		areamonster getarg(0),getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
	}
	return;
}

//== Treasure Room Switch ==================================
function	script	F_GldTreasSw	{
	mes " ";
	mes "There's a small lever. Will you pull it?";
	next;

	if (select("Pull.", "Do not.") == 1) {
		warp getarg(0),getarg(1),getarg(2);
		return;
	}
	close;
}

//== Castle 1 ==============================================

//- Treasure Spawn -
nguild_alde,1,1,1	script	Treasure_N01	FAKE_NPC,{

OnRecvCastleN01:
	end;
OnInit:
	if($boxNumN01 == 0) end;
	$@bxN01 = $boxNumN01;
	callfunc "F_GldTreas","nguild_alde","N01",$boxNumN01,$@bxN01,$@boxIdN01,1324+rand(10),114,218,123,227,1;
	end;

OnDied:
	mapannounce "nguild_alde","Treasure Chest Broken Open",17;
	--$boxNumN01;
	if($boxNumN01 == 0) mapannounce "nguild_alde", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

//- Treasure Room Switch -
nguild_alde,123,223,0	script	Switch#TresN01	HIDDEN_NPC,{
	callfunc "F_GldTreasSw", "nguild_alde",218,176;
	end;
}

//== Castle 2 ==============================================

//- Treasure Spawn -
nguild_gef,1,1,1	script	Treasure_N02	FAKE_NPC,{

OnRecvCastleN02:
	end;
OnInit:
	if($boxNumN02 == 0) end;
	$@bxN02 = $boxNumN02;
	callfunc "F_GldTreas","nguild_gef","N02",$boxNumN02,$@bxN02,$@boxIdN02,1334+rand(10),150,108,158,114,1;
	end;

OnDied:
	mapannounce "nguild_gef","Treasure Chest Broken Open",17;
	--$boxNumN02;
	if($boxNumN02 == 0) mapannounce "nguild_gef", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

//- Treasure Room Switch -
nguild_gef,152,117,0	script	Switch#TresN02	HIDDEN_NPC,{
	callfunc "F_GldTreasSw","nguild_gef",40,49;
	end;
}

//== Castle 3 ==============================================

//- Treasure Spawn -
nguild_pay,1,1,0	script	Treasure_N03	FAKE_NPC,{
OnRecvCastleN03:
	end;
OnInit:
	if($boxNumN03 == 0) end;
	$@bxN03 = $boxNumN03;
	callfunc "F_GldTreas","nguild_pay","N03",$boxNumN03,$@bxN03,$@boxIdN03,1344+rand(10),286,4,295,13,1;
	end;

OnDied:
	mapannounce "nguild_pay","Treasure Chest Broken Open",17;
	--$boxNumN03;
	if($boxNumN03 == 0) mapannounce "nguild_pay", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

//- Treasure Room Switch -
nguild_pay,295,8,0	script	Switch#TresN03	HIDDEN_NPC,{
	callfunc "F_GldTreasSw", "nguild_pay",120,59;
	end;
}

//== Castle 4 ==============================================

//- Treasure Spawn -
nguild_prt,1,1,0	script	Treasure_N04	FAKE_NPC,{
OnRecvCastleN04:
	end;
OnInit:
	if($boxNumN04 == 0) end;
	$@bxN04 = $boxNumN04;
	callfunc "F_GldTreas","nguild_prt","N04",$boxNumN04,$@bxN04,$@boxIdN04,1354+rand(10),6,204,15,213,1;
	end;

OnDied:
	mapannounce "nguild_prt","Treasure Chest Broken Open",17;
	--$boxNumN04;
	if($boxNumN04 == 0) mapannounce "nguild_prt", "All of the treasure boxes have been opened.  You must wait untill the next day for them to appear again.",0;
	end;
}

//- Treasure Room Switch -
nguild_prt,15,209,0	script	Switch#TresN04	HIDDEN_NPC,{
	callfunc "F_GldTreasSw", "nguild_prt",109,179;
	end;
}