Internal Code on ePrivLevel

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

Internal Code on ePrivLevel

Postby Yemla » Thu Oct 28, 2010 4:26 am

Currently in GamePlayer.CS
Code: Select all
      public override bool IsAttackable
      {
         get
         {
            return (Client.Account.PrivLevel < 2 && base.IsAttackable);
         }
      }


What it should be...
Code: Select all
      public override bool IsAttackable
      {
         get
         {
            return (Client.Account.PrivLevel < (int)ePrivLevel.GM && base.IsAttackable);
         }
      }



oviously i don't have time to go into everyscript to modify these errors to get them working like that but corrently that method would ruin you if you modify GMs like example

Player = 1
Helper = 2
GM = 3
Admin = 4

well that would screw that up if you didn't want Helpers to not get hit =/

I noticed some are alrdy fixed but all would be nice
Yemla
Contributor
 
Posts: 215
Joined: Sat Feb 02, 2008 3:21 am
Website: http://www.facebook.com/J.D.Snelling
Location: California

Re: Internal Code on ePrivLevel

Postby Graveen » Thu Oct 28, 2010 8:28 am

Well, on strict sense, you could not exactly be inferior or superior to an enum like ePrivLevel.XXXX.

Single privilege is not optimal. To be honest, Dre suggested 2 years ago to handle privlevel with flag system, to allow a role based system:

- a word (16 bits), let's call it right
- bit 1 'd give the right to login (interesting in case of banà
- bit 2 'd give the right to play (aka doing actions: attack, cast spell) (interesting if you want to allow 'watchers')
- bit 3 'd give the right to create a mob or modify one
- bit 4 for items
- bit 5 for mob delete
- bit 6 for item delete
- bit 7 is deidcated to translation
- bit 8 allows player command
- bit 9 allows GM command
- bit 10 for admin command
- bit 11 for /code...
- bit 12....etc.... w/e you want

This 'd allow complex permissions, like non 'playable' GMs (bit 9 set, but no bit 2)

Technically, you have to create a PrivelegeMgr class, which 'll parse and return true if you have the correct right, then check in every place of the code: if (PrivLevelMgr.Check(ePrivilege.CanPlay, player))
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest