public static bool HasGangCommand(GameClient Session, string command) { if (Session == null || Session.GetRoleplay() == null) { return(false); } int GangId = Session.GetRoleplay().GangId; int GangRank = Session.GetRoleplay().GangRank; if (GangId == 1000) { return(false); } Group Gang = GetGang(GangId); GroupRank Rank = GetGangRank(GangId, GangRank); if (Gang == null || Rank == null) { return(false); } if (!Rank.HasCommand(command)) { return(false); } return(true); }
public ConcurrentDictionary <int, GroupRank> GenerateGangRanks() { ConcurrentDictionary <int, GroupRank> Ranks = new ConcurrentDictionary <int, GroupRank>(); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `rp_gangs_ranks` WHERE `gang` = '1000'"); DataTable Table = dbClient.getTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { int GangRank = Convert.ToInt32(Row["rank"]); string Name = Row["name"].ToString(); string MaleFigure = ""; string FemaleFigure = ""; int Pay = 0; string[] Commands = Row["commands"].ToString().Split(','); string[] WorkRooms = "".Split(','); int Limit = Convert.ToInt32(Row["limit"]); GroupRank Rank = new GroupRank(1000, GangRank, Name, MaleFigure, FemaleFigure, Pay, Commands, WorkRooms, Limit); if (!Ranks.ContainsKey(GangRank)) { Ranks.TryAdd(GangRank, Rank); } } } } return(Ranks); }
public static bool HasJobCommand(GameClient Session, string command) { if (Session == null || Session.GetRoleplay() == null) { return(false); } int JobId = Session.GetRoleplay().JobId; int JobRank = Session.GetRoleplay().JobRank; if (JobId == 1) { return(false); } Group Job = GetJob(JobId); GroupRank Rank = GetJobRank(JobId, JobRank); if (Job == null || Rank == null) { return(false); } if (!Rank.HasCommand(command)) { return(false); } return(true); }
public ConcurrentDictionary <int, GroupRank> GenerateJobRanks(int Id) { ConcurrentDictionary <int, GroupRank> Ranks = new ConcurrentDictionary <int, GroupRank>(); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `rp_jobs_ranks` WHERE `job` = '" + Id + "'"); DataTable Table = dbClient.getTable(); if (Table != null) { foreach (DataRow Row in Table.Rows) { int JobRank = Convert.ToInt32(Row["rank"]); string Name = Row["name"].ToString(); string MaleFigure = Row["male_figure"].ToString(); string FemaleFigure = Row["female_figure"].ToString(); int Pay = Convert.ToInt32(Row["pay"]); string[] Commands = Row["commands"].ToString().Split(','); string[] WorkRooms = Row["workrooms"].ToString().Split(','); int Limit = Convert.ToInt32(Row["limit"]); GroupRank Rank = new GroupRank(Id, JobRank, Name, MaleFigure, FemaleFigure, Pay, Commands, WorkRooms, Limit); if (!Ranks.ContainsKey(JobRank)) { Ranks.TryAdd(JobRank, Rank); } } } } return(Ranks); }