summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorMurilo Pereti Tavares <murilopereti@gmail.com>2018-01-25 01:15:08 -0200
committerMurilo Pereti Tavares <murilopereti@gmail.com>2018-01-25 01:15:08 -0200
commitfc1684c82d92de81e5688e33a8386cde3c2407db (patch)
treecb6af3fd8e9f940cc4cb9f2181e78c2dc751d203 /src/map/battle.c
parent33982166de006d777aa2d95a9d95b2778db1c65a (diff)
downloadhercules-fc1684c82d92de81e5688e33a8386cde3c2407db.tar.gz
hercules-fc1684c82d92de81e5688e33a8386cde3c2407db.tar.bz2
hercules-fc1684c82d92de81e5688e33a8386cde3c2407db.tar.xz
hercules-fc1684c82d92de81e5688e33a8386cde3c2407db.zip
Implementation of Official Clan System
All official features work including the autokick for inactive members And the system is completely customizable.
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 70ebc4a08..d52d20f24 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -25,6 +25,7 @@
#include "map/battleground.h"
#include "map/chrif.h"
+#include "map/clan.h"
#include "map/clif.h"
#include "map/elemental.h"
#include "map/guild.h"
@@ -6774,14 +6775,17 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
return (flag&state)?1:-1;
}
- if( map_flag_vs(m) ) {
+ if (map_flag_vs(m)) {
//Check rivalry settings.
- int sbg_id = 0, tbg_id = 0;
- if( map->list[m].flag.battleground ) {
+ int sbg_id = 0, tbg_id = 0, s_clan = 0, t_clan = 0;
+ if (map->list[m].flag.battleground) {
sbg_id = bg->team_get_id(s_bl);
tbg_id = bg->team_get_id(t_bl);
+ } else if (map->list[m].flag.cvc) {
+ s_clan = clan->get_id(s_bl);
+ t_clan = clan->get_id(t_bl);
}
- if( flag&(BCT_PARTY|BCT_ENEMY) ) {
+ if (flag & (BCT_PARTY | BCT_ENEMY)) {
int s_party = status->get_party_id(s_bl);
int s_guild = status->get_guild_id(s_bl);
int t_guild = status->get_guild_id(t_bl);
@@ -6791,10 +6795,12 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (s_guild != 0 && t_guild != 0 && (s_guild == t_guild || guild->isallied(s_guild, t_guild)))
state |= BCT_PARTY;
else
- state |= flag&BCT_ENEMY ? BCT_ENEMY : BCT_PARTY;
+ state |= flag & BCT_ENEMY ? BCT_ENEMY : BCT_PARTY;
} else if (!(map->list[m].flag.pvp && map->list[m].flag.pvp_noparty)
&& (!map->list[m].flag.battleground || sbg_id == tbg_id)) {
state |= BCT_PARTY;
+ } else if (!map->list[m].flag.cvc || s_clan == t_clan) {
+ state |= BCT_PARTY;
} else {
state |= BCT_ENEMY;
}
@@ -6802,18 +6808,22 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
state |= BCT_ENEMY;
}
}
- if( flag&(BCT_GUILD|BCT_ENEMY) ) {
+ if (flag & (BCT_GUILD | BCT_ENEMY)) {
int s_guild = status->get_guild_id(s_bl);
int t_guild = status->get_guild_id(t_bl);
- if( !(map->list[m].flag.pvp && map->list[m].flag.pvp_noguild)
+ if (!(map->list[m].flag.pvp && map->list[m].flag.pvp_noguild)
&& s_guild && t_guild
- && (s_guild == t_guild || (!(flag&BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild)))
- && (!map->list[m].flag.battleground || sbg_id == tbg_id) )
+ && (s_guild == t_guild || (!(flag & BCT_SAMEGUILD) && guild->isallied(s_guild, t_guild)))
+ && (!map->list[m].flag.battleground || sbg_id == tbg_id)
+ && (!map->list[m].flag.cvc || s_clan == t_clan)
+ ) {
state |= BCT_GUILD;
- else
+ } else {
state |= BCT_ENEMY;
+ }
}
- if( state&BCT_ENEMY && map->list[m].flag.battleground && sbg_id && sbg_id == tbg_id )
+
+ if (state & BCT_ENEMY && ((map->list[m].flag.battleground && sbg_id && sbg_id == tbg_id) || (map->list[m].flag.cvc && s_clan && s_clan == t_clan)))
state &= ~BCT_ENEMY;
if (state&BCT_ENEMY && battle_config.pk_mode && !map_flag_gvg(m) && s_bl->type == BL_PC && t_bl->type == BL_PC) {