Jump to content

can_attack permission


Daegaladh

Recommended Posts


  • Group:  Developer
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  230
  • Reputation:   131
  • Joined:  11/21/11
  • Last Seen:  

I think it would be useful to add a can_attack permission, so you can prevent GMs to attack monsters or players (to prevent corruption acts like: tanking players, get items to give to players, etc...).

I've just coded it by myself, so here's the code ;)

Edit: I think I should add a check to pets, homunculus, mercenaries and elementals too...

pc_groups.c

 { "use_changemaptype", PC_PERM_USE_CHANGEMAPTYPE },
 { "all_commands", PC_PERM_USE_ALL_COMMANDS },
 { "receive_requests", PC_PERM_RECEIVE_REQUESTS },
+ { "can_attack", PC_PERM_ATTACK},
};

/**

pc.h

 PC_PERM_USE_CHANGEMAPTYPE   = 0x04000,
 PC_PERM_USE_ALL_COMMANDS	= 0x08000,
 PC_PERM_RECEIVE_REQUESTS	= 0x10000,
+ PC_PERM_ATTACK			  = 0x20000,
};

#define pc_setdead(sd)		( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )

clif.c :

 case 0x00: // once attack
 case 0x07: // continuous attack

+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
+
 if( pc_cant_act(sd) || sd->sc.option&OPTION_HIDE )
 return;

 if( skilllv < 1 ) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [skotlex]

+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
+
 tmp = skill_get_inf(skillnum);
 if (tmp&INF_GROUND_SKILL || !tmp)
 return; //Using a ground/passive skill on a target? WRONG.

/// There are various variants of this packet, some of them have padding between fields.
void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
{
+ if( !pc_has_permission(sd, PC_PERM_ATTACK) )
+ return;
 if (pc_cant_act(sd))
 return;
 if (pc_issit(sd))

Edited by Daegaladh
  • Upvote 3
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

- good idea putting this on gm.conf to activate or not

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  230
  • Reputation:   131
  • Joined:  11/21/11
  • Last Seen:  

Nope, it goes on groups.conf

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  37
  • Reputation:   11
  • Joined:  11/10/11
  • Last Seen:  

Good idea Dae

Like it :3

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...