summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorcookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-18 20:06:54 +0000
committercookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-18 20:06:54 +0000
commitd049046dc121866bc7c2d62bf5773adf05335870 (patch)
tree4f6904263c495711e661d07850664d271bd511fa /src/map/battle.c
parent9fa4acce4a3fd134993a5cfe18506392dbfa5555 (diff)
downloadhercules-d049046dc121866bc7c2d62bf5773adf05335870.tar.gz
hercules-d049046dc121866bc7c2d62bf5773adf05335870.tar.bz2
hercules-d049046dc121866bc7c2d62bf5773adf05335870.tar.xz
hercules-d049046dc121866bc7c2d62bf5773adf05335870.zip
New permissions added for groups: show_bossmobs, disable_pvm and disable_pvp; documented usage in permissions.txt
Fixed a typo in monster.conf. Removed old functionality from showmobs command to make room for show_bossmobs. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16445 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 35e2fc710..561f9ef53 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4801,6 +4801,38 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if( (s_bl = battle_get_master(src)) == NULL )
s_bl = src;
+ // Disable PVM for specific groups.
+ if (src->type&BL_PC && target->type&BL_MOB && src->id && map_id2sd(src->id) != NULL)
+ { // Source => PC, Target => MOB
+ if (pc_has_permission(map_id2sd(src->id), PC_PERM_DISABLE_PVM))
+ return 0;
+ }
+ else if (src->type&BL_HOM && target->type&BL_MOB)
+ { // Source => HOM, Target => MOB; check the master BL id of homun
+ struct homun_data *hd = (TBL_HOM*)src;
+ if (hd != NULL && hd->master->bl.id)
+ {
+ if (pc_has_permission(map_id2sd(hd->master->bl.id), PC_PERM_DISABLE_PVM))
+ return 0;
+ }
+ }
+
+ // Disable PVP
+ if (src->type&BL_PC && target->type&(BL_PC|BL_HOM) && src->id && map_id2sd(src->id) != NULL)
+ { // Source => PC, Target => PC
+ if (pc_has_permission(map_id2sd(src->id), PC_PERM_DISABLE_PVP))
+ return 0;
+ }
+ else if (src->type&BL_HOM && target->type&(BL_HOM|BL_PC))
+ { // Source => HOM, Target => MOB|PC; check the master BL id of homun
+ struct homun_data *hd = (TBL_HOM*)src;
+ if (hd != NULL && hd->master->bl.id)
+ {
+ if (pc_has_permission(map_id2sd(hd->master->bl.id), PC_PERM_DISABLE_PVP))
+ return 0;
+ }
+ }
+
switch( target->type ) { // Checks on actual target
case BL_PC: {
struct status_change* sc = status_get_sc(src);