summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c40
-rw-r--r--src/map/battle.c4
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/guild.c39
-rw-r--r--src/map/guild.h3
-rw-r--r--src/map/map.c1
-rw-r--r--src/map/map.h5
-rw-r--r--src/map/party.c2
-rw-r--r--src/map/script.c29
-rw-r--r--src/map/skill.c4
-rw-r--r--src/map/unit.c2
11 files changed, 115 insertions, 20 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f734b76da..26d53acbe 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3805,6 +3805,24 @@ int atcommand_agitstart(const int fd, struct map_session_data* sd, const char* c
/*==========================================
*
*------------------------------------------*/
+int atcommand_agitstart2(const int fd, struct map_session_data* sd, const char* command, const char* message)
+{
+ nullpo_retr(-1, sd);
+ if (agit2_flag == 1) {
+ clif_displaymessage(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
+ return -1;
+ }
+
+ agit2_flag = 1;
+ guild_agit2_start();
+ clif_displaymessage(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
+
+ return 0;
+}
+
+/*==========================================
+ *
+ *------------------------------------------*/
int atcommand_agitend(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
nullpo_retr(-1, sd);
@@ -3821,6 +3839,24 @@ int atcommand_agitend(const int fd, struct map_session_data* sd, const char* com
}
/*==========================================
+ *
+ *------------------------------------------*/
+int atcommand_agitend2(const int fd, struct map_session_data* sd, const char* command, const char* message)
+{
+ nullpo_retr(-1, sd);
+ if (agit2_flag == 0) {
+ clif_displaymessage(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
+ return -1;
+ }
+
+ agit2_flag = 0;
+ guild_agit2_end();
+ clif_displaymessage(fd, msg_txt(405)); // "War of Emperium SE has been ended."
+
+ return 0;
+}
+
+/*==========================================
* @mapexit - shuts down the map server
*------------------------------------------*/
int atcommand_mapexit(const int fd, struct map_session_data* sd, const char* command, const char* message)
@@ -8086,7 +8122,7 @@ int atcommand_main(const int fd, struct map_session_data* sd, const char* comman
intif_announce(atcmd_output, strlen(atcmd_output) + 1, 0xFE000000, 0);
// Chat logging type 'M' / Main Chat
- if( log_config.chat&1 || (log_config.chat&32 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&32 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("M", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
}
@@ -8506,6 +8542,8 @@ AtCommandInfo atcommand_info[] = {
{ "allowks", 6, atcommand_allowks },
{ "cash", 60, atcommand_cash },
{ "points", 60, atcommand_cash },
+ { "agitstart2", 60, atcommand_agitstart2 },
+ { "agitend2", 60, atcommand_agitend2 },
};
diff --git a/src/map/battle.c b/src/map/battle.c
index 1140c6640..8dc6eb394 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3150,7 +3150,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
struct mob_data *md = BL_CAST(BL_MOB, t_bl);
- if( !(agit_flag && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperiums owned by Guilds on non-woe times.
break;
}
@@ -3213,7 +3213,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case BL_MOB:
{
struct mob_data *md = BL_CAST(BL_MOB, s_bl);
- if( !(agit_flag && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperium owned by Guilds on non-woe times.
if( !md->special_state.ai )
diff --git a/src/map/clif.c b/src/map/clif.c
index f6014fe3a..489a765cf 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8250,7 +8250,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
}
// Chat logging type 'O' / Global Chat
- if( log_config.chat&1 || (log_config.chat&2 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&2 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("O", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
return;
@@ -8509,7 +8509,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
// Chat logging type 'W' / Whisper
- if( log_config.chat&1 || (log_config.chat&4 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&4 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("W", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, message);
//-------------------------------------------------------//
@@ -8566,7 +8566,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
// Chat logging type 'M' / Main Chat
- if( log_config.chat&1 || (log_config.chat&32 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&32 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("M", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
return;
diff --git a/src/map/guild.c b/src/map/guild.c
index fced17189..8af73acba 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -64,6 +64,7 @@ struct{
// timer for auto saving guild data during WoE
#define GUILD_SAVE_INTERVAL 300000
int guild_save_timer = INVALID_TIMER;
+int guild_save_timer2 = INVALID_TIMER;
int guild_payexp_timer(int tid, unsigned int tick, int id, intptr data);
int guild_save_sub(int tid, unsigned int tick, int id, intptr data);
@@ -640,7 +641,7 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd)
if(tsd->status.guild_id>0 ||
tsd->guild_invite>0 ||
- (agit_flag && map[tsd->bl.m].flag.gvg_castle))
+ ((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
{ //Can't invite people inside castles. [Skotlex]
clif_guild_inviteack(sd,0);
return 0;
@@ -798,7 +799,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
if(sd->status.account_id!=account_id ||
sd->status.char_id!=char_id || sd->status.guild_id!=guild_id ||
- (agit_flag && map[sd->bl.m].flag.gvg_castle))
+ ((agit_flag || agit2_flag) && map[sd->bl.m].flag.gvg_castle))
return 0;
intif_guild_leave(sd->status.guild_id, sd->status.account_id, sd->status.char_id,0,mes);
@@ -828,7 +829,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
//Can't leave inside guild castles.
if ((tsd = map_id2sd(account_id)) &&
tsd->status.char_id == char_id &&
- (agit_flag && map[tsd->bl.m].flag.gvg_castle))
+ ((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
return 0;
// find the member and perform expulsion
@@ -989,7 +990,7 @@ int guild_send_message(struct map_session_data *sd,const char *mes,int len)
guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
// Chat logging type 'G' / Guild Chat
- if( log_config.chat&1 || (log_config.chat&16 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&16 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("G", sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
return 0;
@@ -1301,7 +1302,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
struct guild *g[2];
int i;
- if(agit_flag) { // Disable alliance creation during woe [Valaris]
+ if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris]
clif_displaymessage(sd->fd,"Alliances cannot be made during Guild Wars!");
return 0;
} // end addition [Valaris]
@@ -1414,7 +1415,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
{
nullpo_retr(0, sd);
- if(agit_flag) { // Disable alliance breaking during woe [Valaris]
+ if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris]
clif_displaymessage(sd->fd,"Alliances cannot be broken during Guild Wars!");
return 0;
} // end addition [Valaris]
@@ -1854,8 +1855,10 @@ int guild_castlealldataload(int len,struct guild_castle *gc)
for( i = n-1; i >= 0 && !(gc[i].guild_id); --i );
ev = i; // offset of castle or -1
- if( ev < 0 ) //No castles owned, invoke OnAgitInit as it is.
+ if( ev < 0 ) { //No castles owned, invoke OnAgitInit as it is.
npc_event_doall("OnAgitInit");
+ npc_event_doall("OnAgitInit2");
+ }
else // load received castles into memory, one by one
for( i = 0; i < n; i++, gc++ )
{
@@ -1872,8 +1875,10 @@ int guild_castlealldataload(int len,struct guild_castle *gc)
{
if( i != ev )
guild_request_info(c->guild_id);
- else // last owned one
+ else { // last owned one
guild_npc_request_info(c->guild_id, "::OnAgitInit");
+ guild_npc_request_info(c->guild_id, "::OnAgitInit2");
+ }
}
}
@@ -1898,6 +1903,24 @@ int guild_agit_end(void)
return 0;
}
+int guild_agit2_start(void)
+{ // Run All NPC_Event[OnAgitStart2]
+ int c = npc_event_doall("OnAgitStart2");
+ ShowStatus("NPC_Event:[OnAgitStart2] Run (%d) Events by @AgitStart2.\n",c);
+ // Start auto saving
+ guild_save_timer2 = add_timer_interval (gettick() + GUILD_SAVE_INTERVAL, guild_save_sub, 0, 0, GUILD_SAVE_INTERVAL);
+ return 0;
+}
+
+int guild_agit2_end(void)
+{ // Run All NPC_Event[OnAgitEnd2]
+ int c = npc_event_doall("OnAgitEnd2");
+ ShowStatus("NPC_Event:[OnAgitEnd2] Run (%d) Events by @AgitEnd2.\n",c);
+ // Stop auto saving
+ delete_timer (guild_save_timer2, guild_save_sub);
+ return 0;
+}
+
int guild_save_sub(int tid, unsigned int tick, int id, intptr data)
{
static int Gid[MAX_GUILDCASTLE]; // previous owning guild
diff --git a/src/map/guild.h b/src/map/guild.h
index 61c02124b..67cfd3544 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -100,6 +100,9 @@ int guild_castlealldataload(int len,struct guild_castle *gc);
int guild_agit_start(void);
int guild_agit_end(void);
+int guild_agit2_start(void);
+int guild_agit2_end(void);
+
void do_final_guild(void);
#endif /* _GUILD_H_ */
diff --git a/src/map/map.c b/src/map/map.c
index 61c827ff0..d1da19e7f 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -122,6 +122,7 @@ int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
int minsave_interval = 100;
int save_settings = 0xFFFF;
int agit_flag = 0;
+int agit2_flag = 0;
int night_flag = 0; // 0=day, 1=night [Yor]
struct charid_request {
diff --git a/src/map/map.h b/src/map/map.h
index 4a8be92ed..01ac74cba 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -156,9 +156,9 @@ enum {
#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
//Specifies maps where players may hit each other
-#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
+#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle))
//Specifies maps that have special GvG/WoE restrictions
-#define map_flag_gvg(m) (map[m].flag.gvg || (agit_flag && map[m].flag.gvg_castle))
+#define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle))
//Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status)
#define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle)
// No Kill Steal Protection
@@ -496,6 +496,7 @@ extern int autosave_interval;
extern int minsave_interval;
extern int save_settings;
extern int agit_flag;
+extern int agit2_flag;
extern int night_flag; // 0=day, 1=night [Yor]
extern int enable_spy; //Determines if @spy commands are active.
extern char db_path[256];
diff --git a/src/map/party.c b/src/map/party.c
index 07ce7634d..a6f2c454f 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -675,7 +675,7 @@ int party_send_message(struct map_session_data *sd,const char *mes,int len)
party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);
// Chat logging type 'P' / Party Chat
- if( log_config.chat&1 || (log_config.chat&8 && !(agit_flag && log_config.chat&64)) )
+ if( log_config.chat&1 || (log_config.chat&8 && !((agit_flag || agit2_flag) && log_config.chat&64)) )
log_chat("P", sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index dc1a0fa6d..ceb0dab50 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9079,6 +9079,22 @@ BUILDIN_FUNC(agitend)
return 0;
}
+BUILDIN_FUNC(agitstart2)
+{
+ if(agit2_flag==1) return 0; // Agit2 already Start.
+ agit2_flag=1;
+ guild_agit2_start();
+ return 0;
+}
+
+BUILDIN_FUNC(agitend2)
+{
+ if(agit2_flag==0) return 0; // Agit2 already End.
+ agit2_flag=0;
+ guild_agit2_end();
+ return 0;
+}
+
/*==========================================
* Returns whether woe is on or off. // choice script
*------------------------------------------*/
@@ -9088,6 +9104,15 @@ BUILDIN_FUNC(agitcheck)
return 0;
}
+/*==========================================
+ * Returns whether woese is on or off. // choice script
+ *------------------------------------------*/
+BUILDIN_FUNC(agitcheck2)
+{
+ script_pushint(st,agit2_flag);
+ return 0;
+}
+
/// Sets the guild_id of this npc.
///
/// flagemblem <guild_id>;
@@ -13419,5 +13444,9 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(mercenary_get_faith,"i"),
BUILDIN_DEF(mercenary_set_calls,"ii"),
BUILDIN_DEF(mercenary_set_faith,"ii"),
+ // WoE SE
+ BUILDIN_DEF(agitstart2,""),
+ BUILDIN_DEF(agitend2,""),
+ BUILDIN_DEF(agitcheck2,""),
{NULL,NULL,NULL},
};
diff --git a/src/map/skill.c b/src/map/skill.c
index 2b242821d..1a8cdf0a1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -340,7 +340,7 @@ int skillnotok (int skillid, struct map_session_data *sd)
return 1;
if(map_flag_gvg(m) && skill_get_nocast (skillid) & 4)
return 1;
- if(agit_flag && skill_get_nocast (skillid) & 8)
+ if((agit_flag || agit2_flag) && skill_get_nocast (skillid) & 8)
return 1;
if(map[m].flag.restricted && map[m].zone && skill_get_nocast (skillid) & (8*map[m].zone))
return 1;
@@ -379,7 +379,7 @@ int skillnotok (int skillid, struct map_session_data *sd)
break;
case GD_EMERGENCYCALL:
if (
- !(battle_config.emergency_call&(agit_flag?2:1)) ||
+ !(battle_config.emergency_call&((agit_flag || agit2_flag)?2:1)) ||
!(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) ||
(battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle)
) {
diff --git a/src/map/unit.c b/src/map/unit.c
index 59924a108..4003e89c6 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -170,7 +170,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr data)
} else
sd->areanpc_id=0;
if (sd->state.gmaster_flag &&
- (battle_config.guild_aura&(agit_flag?2:1)) &&
+ (battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) &&
(battle_config.guild_aura&(map_flag_gvg2(bl->m)?8:4))
)
{ //Guild Aura: Likely needs to be recoded, this method seems inefficient.