From 82037b89b33c3fa2a5cfaf33038fbf9ebddea17f Mon Sep 17 00:00:00 2001 From: EPuncker Date: Sat, 20 Sep 2014 23:59:59 -0300 Subject: Added 4 new permissions --- doc/permissions.txt | 4 ++++ src/map/clif.c | 4 ++-- src/map/pc.c | 6 ++++++ src/map/pc_groups.c | 4 ++++ src/map/pc_groups.h | 4 ++++ src/map/skill.c | 3 +++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/permissions.txt b/doc/permissions.txt index 7280395dc..a656f8bcf 100644 --- a/doc/permissions.txt +++ b/doc/permissions.txt @@ -33,3 +33,7 @@ disable_pvp : Ability to disable Player vs. Player. disable_commands_when_dead : Ability to disable @command usage when dead. can_trade_bound: Ability to trade or otherwise distribute bound items (drop, storage, vending etc...). hchsys_admin : Hercules Chat System Admin (Ability to modify channel settings regardless of ownership and join password-protected channels without requiring a password.) +disable_pickup: Ability to disable the player from picking up any item from ground, they can still receive items picked up by others means like party share píck. +disable_exp: Ability to disable the player from gaining any experience point. +disable_store: Ability to disable the player from using/openning npc and player stores. +disable_skill_usage: Ability to disable the player from using any skill. diff --git a/src/map/clif.c b/src/map/clif.c index b8051697e..018087000 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10886,7 +10886,7 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) unsigned short* item_list = (unsigned short*)RFIFOP(fd,4); int result; - if( sd->state.trading || !sd->npc_shopid ) + if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) ) result = 1; else result = npc->buylist(sd,n,item_list); @@ -15602,7 +15602,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) int fail = 0; nullpo_retv(sd); - if( sd->state.trading || !sd->npc_shopid ) + if( sd->state.trading || !sd->npc_shopid || pc_has_permission(sd,PC_PERM_DISABLE_STORE) ) fail = 1; else { #if PACKETVER < 20101116 diff --git a/src/map/pc.c b/src/map/pc.c index e28d0545a..5fc4e3ddf 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4153,6 +4153,9 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) if(!check_distance_bl(&fitem->bl, &sd->bl, 2) && sd->ud.skill_id!=BS_GREED) return 0; // Distance is too far + if( pc_has_permission(sd,PC_PERM_DISABLE_PICK_UP) ) + return 0; + if (sd->status.party_id) p = party->search(sd->status.party_id); @@ -6029,6 +6032,9 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in if(!battle_config.pvp_exp && map->list[sd->bl.m].flag.pvp) // [MouseJstr] return false; // no exp on pvp maps + if( pc_has_permission(sd,PC_PERM_DISABLE_EXP) ) + return false; + if(sd->status.guild_id>0) base_exp-=guild->payexp(sd,base_exp); diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index e577c642f..9cd478b3f 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -420,6 +420,10 @@ void do_init_pc_groups(void) { { "disable_commands_when_dead", PC_PERM_DISABLE_CMD_DEAD }, { "hchsys_admin", PC_PERM_HCHSYS_ADMIN }, { "can_trade_bound", PC_PERM_TRADE_BOUND }, + { "disable_pickup", PC_PERM_DISABLE_PICK_UP }, + { "disable_store", PC_PERM_DISABLE_STORE }, + { "disable_exp", PC_PERM_DISABLE_EXP }, + { "disable_skill_usage", PC_PERM_DISABLE_SKILL_USAGE }, }; unsigned char i, len = ARRAYLENGTH(pc_g_defaults); diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index f52e2ba22..48ff782dd 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -35,6 +35,10 @@ enum e_pc_permission { PC_PERM_DISABLE_CMD_DEAD = 0x100000, PC_PERM_HCHSYS_ADMIN = 0x200000, PC_PERM_TRADE_BOUND = 0x400000, + PC_PERM_DISABLE_PICK_UP = 0x800000, + PC_PERM_DISABLE_STORE = 0x1000000, + PC_PERM_DISABLE_EXP = 0x2000000, + PC_PERM_DISABLE_SKILL_USAGE = 0x4000000, }; // Cached config settings for quick lookup diff --git a/src/map/skill.c b/src/map/skill.c index db1296260..4ab0ca1c7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -453,6 +453,9 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) if (idx == 0) return 1; // invalid skill id + if( pc_has_permission(sd, PC_PERM_DISABLE_SKILL_USAGE) ) + return 1; + if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL)) return 0; // can do any damn thing they want -- cgit v1.2.3-60-g2f50