· 9 years ago · Oct 17, 2016, 12:46 PM
1//--
2//-- Table structure for table `renovatio_calendar`
3//--
4//CREATE TABLE IF NOT EXISTS `renovatio_calendar` (
5// `id` bigint(20) NOT NULL AUTO_INCREMENT,
6// `calendar_id` smallint(6) NOT NULL default 'Nothing',
7// `time` datetime NOT NULL default '0000-00-00 00:00:00',
8// `title_rus` varchar(250) NOT NULL default '',
9// `title_eng` varchar(250) NOT NULL default '',
10// `desc_rus` varchar(250) NOT NULL default '',
11// `desc_eng` varchar(250) NOT NULL default '',
12// PRIMARY KEY (`id`)
13//) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_ci AUTO_INCREMENT=1;
14// ========================= Renovatio Ragnarok Online Calendar =========================
15- script renovatio_calendar_init -1,{
16 end;
17
18OnInit:
19 $calendar_total_days = 30; // The total amount of different days that can be on our server
20 $calendar_woe_init = 0; // 1/0 Enable/Disable working script on War of Emperium days
21 setarray $calendar_woe_days[0], 1, 2, 4, 6; // Days of the week, when the War or Emperium have place: 0 = Sunday, ... 6 = Saturday
22 $calendar_force_start = 1; // 1/0 Yes/No - Force start calendar if inactive
23 $calendar_duration_round = 7; // After how much days calendar can repeated
24 $calendar_repeat_allow = 0; // 1/0 Allow/Deny repeating of calendar days per ``$calendar_duration_round`` days
25 if( !$calendar_active && $calendar_force_start ) // If after any reasons ( server restart, crash or other issues ) calendar not working - force start
26 {
27 if( $calendar_repeat_allow )
28 {
29 // Cheking for WoE days, if current day compare with any days in a setarray and $calendar_woe_init is on, than end; script...
30 for( .@a = 0; .@a < getarraysize( $calendar_woe_days ); .@a++ )
31 {
32 if( gettime(4) == $calendar_woe_days[ .@a ] && $calendar_woe_init ) .@woe_not_pass_day++;
33 }
34 if( .@woe_not_pass_day != 0 ) end;
35
36 // Setting any random day from a row because $calendar_repeat_allow is set
37 $calendar_day_id = rand( 1,$calendar_total_days ); // Any random day...
38 callfunc( "F_renovatio_calendar",$calendar_day_id ); // Starting any random day from our row
39 end; // For security reasons...
40 }