From d049046dc121866bc7c2d62bf5773adf05335870 Mon Sep 17 00:00:00 2001 From: cookiecrumbs Date: Wed, 18 Jul 2012 20:06:54 +0000 Subject: 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 --- conf/battle/monster.conf | 2 +- doc/permissions.txt | 3 +++ src/map/atcommand.c | 8 +++----- src/map/battle.c | 32 ++++++++++++++++++++++++++++++++ src/map/pc.h | 3 +++ src/map/pc_groups.c | 3 +++ 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/conf/battle/monster.conf b/conf/battle/monster.conf index 4d9014c91..398b2a0ab 100644 --- a/conf/battle/monster.conf +++ b/conf/battle/monster.conf @@ -198,6 +198,6 @@ ksprotection: 0 // Should MVP slaves retain their target when summoned back to their master? mob_slave_keep_target: yes -// Wheter or not to spawn the mvp tomb. +// Whether or not to spawn the mvp tomb. // See http://irowiki.org/wiki/MVP#Gravestone mvp_tomb_enabled: yes diff --git a/doc/permissions.txt b/doc/permissions.txt index afadb680c..e3e44ef7f 100644 --- a/doc/permissions.txt +++ b/doc/permissions.txt @@ -19,3 +19,6 @@ use_check : Ability to use client command /check (display character status). use_changemaptype : Ability to use client command /changemaptype. all_commands: Ability to use ALL atcommands/charcommands. receive_requests: Ability to receive @requests. +show_bossmobs: Ability to see boss mobs with @showmobs. +disable_pvm: Ability to disable Player v.s. Monster. +disable_pvp: Ability to disable Player v.s. Player. \ No newline at end of file diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9586d5a24..8e199ca73 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6790,15 +6790,13 @@ ACMD_FUNC(showmobs) clif_displaymessage(fd, atcmd_output); return 0; } -// Uncomment the following line to show mini-bosses & MVP. -//#define SHOW_MVP -#ifndef SHOW_MVP - if(mob_db(mob_id)->status.mode&MD_BOSS){ + + if(mob_db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)){ // If player group does not have access to boss mobs. snprintf(atcmd_output, sizeof atcmd_output, "Can't show Boss mobs!"); clif_displaymessage(fd, atcmd_output); return 0; } -#endif + if(mob_id == atoi(mob_name) && mob_db(mob_id)->jname) strcpy(mob_name,mob_db(mob_id)->jname); // --ja-- //strcpy(mob_name,mob_db(mob_id)->name); // --en-- 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); diff --git a/src/map/pc.h b/src/map/pc.h index 2cb859e5b..2cf4947a1 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -590,6 +590,9 @@ enum e_pc_permission { PC_PERM_USE_CHANGEMAPTYPE = 0x04000, PC_PERM_USE_ALL_COMMANDS = 0x08000, PC_PERM_RECEIVE_REQUESTS = 0x10000, + PC_PERM_SHOW_BOSS = 0x20000, + PC_PERM_DISABLE_PVM = 0x40000, + PC_PERM_DISABLE_PVP = 0x80000, }; #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 ) diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index 59eecb254..c6713fedf 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -59,6 +59,9 @@ static const struct { { "use_changemaptype", PC_PERM_USE_CHANGEMAPTYPE }, { "all_commands", PC_PERM_USE_ALL_COMMANDS }, { "receive_requests", PC_PERM_RECEIVE_REQUESTS }, + { "show_bossmobs", PC_PERM_SHOW_BOSS }, + { "disable_pvm", PC_PERM_DISABLE_PVM }, + { "disable_pvp", PC_PERM_DISABLE_PVP }, }; /** -- cgit v1.2.3-70-g09d2