summaryrefslogtreecommitdiff
path: root/npc/woe-fe/agit_controller.txt
blob: 3644ad67b6d6c716a11e6ff36fc52c34f6567f11 (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
//===== Hercules Script ======================================
//= War of Emperium - WoE Auto-Start
//===== By: ==================================================
//= kalen (1.0)
//= 1.1 by Akaru and ho|yAnge|
//===== Current Version: =====================================
//= 2.0a
//===== Description: =========================================
//= Auto Start for War of Emperium
//===== Additional Comments: =================================
//= v1.1a changed OnInit to OnAgitInit.[kobra_k88]
//= v1.2 added gettime checks. removed $AgitStarted var.[kobra_k88]
//= v1.3 Moved treasure spawn time here.[kobra_k88]
//= v1.3a Implemented Shadowlady's idea to allow for different
//= start/stop times on different days.[kobra_k88]
//= 1.4 Fixed treasure chests spawn! We had to unroll some loops
//= Now they appear in castles from 00:01 to 00:24. [Lupus]
//= 1.5 Fixed WOE end messages on non-WOE days, by Avaj
//= 1.5a missing tabs [KarLaeda]
//= 1.6 Corrected multiple "WoE has begun" announces [ultramage]
//= 1.7 Commented out the WoE start and end announces. [L0ne_W0lf]
//= 1.8 Castle owners displayed when WoE starts and finished. [L0ne_W0lf]
//= 1.8a Will now report unoccupied castles at start/end. [L0ne_W0lf]
//= 1.8b Whoops. Fixed a mistake :D [L0ne_W0lf]
//= 1.9 Rearranged the time-checks so they no longer use goto. [L0ne_W0lf]
//=	Removed treasure spawning function calls. (No longer needed)
//= 2.0 Added WoE Battle Log support for broadcasts. [L0ne_W0lf]
//= 2.0a Removed some brackets
//============================================================
//| To know how to set up WoE times, go to doc\woe_time_explanation.txt
// WoE Start/Stop times
//======================================
-	script	Agit_Event	-1,{
	end;

OnClock2100:	//start time for Tues(2), Thurs(4)
OnClock2300:	//end time for Tues(2), Thurs(4)
OnClock1600:	//start time for Sat(6)
OnClock1800:	//end time for Sat(6)

OnAgitInit:
	// starting time checks
	if((gettime(GETTIME_WEEKDAY) == TUESDAY  && gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23) ||
	   (gettime(GETTIME_WEEKDAY) == THURSDAY && gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23) ||
	   (gettime(GETTIME_WEEKDAY) == SATURDAY && gettime(GETTIME_HOUR) >= 16 && gettime(GETTIME_HOUR) < 18)) {
		if (!agitcheck()) {
			agitstart;
			callsub S_DisplayOwners;
		}
		end;
	}

	// end time checks
	if ((gettime(GETTIME_WEEKDAY) == 2 && gettime(GETTIME_HOUR) == 23) ||
	    (gettime(GETTIME_WEEKDAY) == 4 && gettime(GETTIME_HOUR) == 23) ||
	    (gettime(GETTIME_WEEKDAY) == 6 && gettime(GETTIME_HOUR) == 18)) {
		if (agitcheck()) {
			agitend;
			callsub S_DisplayOwners;
		}
		end;
	}
	end;

S_DisplayOwners:
	setarray .@maps$[0],"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05";
	setarray .@maps$[5],"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05";
	setarray .@maps$[10],"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05";
	setarray .@maps$[15],"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05";
	for (.@i = 0; .@i <= 19; ++.@i) {
		if (getcastledata(.@maps$[.@i],1))
			announce "The [" + getcastlename(.@maps$[.@i]) + "] castle has been conquered by the [" + getguildname(getcastledata(.@maps$[.@i],1)) + "] guild.",bc_all|bc_woe;
		else
			announce "The [" + getcastlename(.@maps$[.@i]) + "] castle is currently unoccupied.",bc_all|bc_woe;
	}
	end;
}