public void Describe(Player p, StringBuilder perms) { perms.Append(Group.GetColoredName(Min) + "%S+"); if (Max != LevelPermission.Nobody) { perms.Append(" up to " + Group.GetColoredName(Max)); } List <string> whitelist = Whitelisted; foreach (string name in whitelist) { perms.Append(", " + p.FormatNick(name)); } List <string> blacklist = Blacklisted; if (blacklist.Count == 0) { return; } perms.Append(" %S(except "); foreach (string name in blacklist) { perms.Append(p.FormatNick(name) + ", "); } perms.Remove(perms.Length - 2, 2); perms.Append("%S)"); }
bool CheckList(Player p, LevelPermission plRank, string name, bool whitelist) { if (!CheckDetailed(p, plRank)) { string mode = whitelist ? "whitelist" : "blacklist"; p.Message("&WHence you cannot modify the {0} {1}.", Type, mode); return(false); } Group group = PlayerInfo.GetGroup(name); if (group.Permission <= plRank) { return(true); } if (!whitelist) { p.Message("&WYou cannot blacklist players of a higher rank."); return(false); } else if (Check(name, group.Permission) == AccessResult.Blacklisted) { p.Message("{0} %Sis blacklisted from {1} {2}%S.", p.FormatNick(name), ActionIng, ColoredName); return(false); } return(true); }
public static void ReloadAll(Level lvl, Player src, bool announce) { Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { if (p.level != lvl) { continue; } PlayerActions.ReloadMap(p); if (!announce) { continue; } if (src == null || !p.CanSee(src)) { p.Message("&bMap reloaded"); } else { p.Message("&bMap reloaded by " + p.FormatNick(src)); } if (src.CanSee(p)) { src.Message("&4Finished reloading for " + src.FormatNick(p)); } } }
public void Output(Player p) { bool Nothing = !(All | IRC | Titles | Nicks | EightBall | DrawOutput | WorldChanges | BlockdefChanges); if (Names.Count > 0) { Nothing = false; p.Message("&cCurrently ignoring the following players:"); p.Message(Names.Join(n => p.FormatNick(n))); } if (IRCNicks.Count > 0) { Nothing = false; p.Message("&cCurrently ignoring the following IRC nicks:"); p.Message(IRCNicks.Join()); } if (All) { p.Message("&cIgnoring all chat"); } if (IRC) { p.Message("&cIgnoring IRC chat"); } if (Titles) { p.Message("&cPlayer titles do not show before names in chat"); } if (Nicks) { p.Message("&cCustom player nicks do not show in chat"); } if (EightBall) { p.Message("&cIgnoring &T/8ball"); } if (DrawOutput) { p.Message("&cIgnoring draw command output"); } if (WorldChanges) { p.Message("&cIgnoring world change messages"); } if (BlockdefChanges) { p.Message("&cIgnoring block definition messages"); } if (Nothing) { p.Message("&cIgnoring nothing and nobody"); } }
/// <summary> Attempts to change the logout message of the target player </summary> /// <remarks> Not allowed when players who cannot speak (e.g. muted) </remarks> public static bool SetLogoutMessage(Player p, string target, string message) { if (message.Length == 0) { p.Message("Logout message of {0} &Swas removed", p.FormatNick(target)); } else { // Don't allow changing while muted if (!p.CheckCanSpeak("change logout messages")) { return(false); } p.Message("Logout message of {0} &Swas changed to: {1}", p.FormatNick(target), message); } PlayerDB.SetLogoutMessage(target, message); return(true); }
public static void MessageDirect(Player p, Player target, string message) { if (message.Length == 0) { p.Message("No message entered"); return; } Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, target.name, message); if (!p.IsConsole) { p.Message("[<] {0}: &f{1}", p.FormatNick(target), message); } Chat.MessageChat(ChatScope.PM, p, "&9[>] λNICK: &f" + message, target, null); }
public void OnListChanged(Player p, Level lvl, string name, bool whitelist, bool removedFromOpposite) { string msg = p.FormatNick(name); if (removedFromOpposite) { msg += " %Swas removed from the " + Type + (whitelist ? " blacklist" : " whitelist"); } else { msg += " %Swas " + Type + (whitelist ? " whitelisted" : " blacklisted"); } ApplyChanges(p, lvl, msg); }
/// <summary> Outputs list of players using MultiPageOutput.Output. </summary> /// <remarks> Names are formatted using PlayerInfo.GetColoredName(). </remarks> public void Output(Player p, string group, string listCmd, string modifier) { List <string> list = All(); if (list.Count == 0) { p.Message("There are no {0}.", group); } else { p.Message("{0}:", group.Capitalize()); MultiPageOutput.Output(p, list, (name) => p.FormatNick(name), listCmd, "players", modifier, false); } }
public void Output(Player p) { if (Names.Count > 0) { p.Message("&cCurrently ignoring the following players:"); p.Message(Names.Join(n => p.FormatNick(n))); } if (IRCNicks.Count > 0) { p.Message("&cCurrently ignoring the following IRC nicks:"); p.Message(IRCNicks.Join()); } if (All) { p.Message("&cIgnoring all chat"); } if (IRC) { p.Message("&cIgnoring IRC chat"); } if (Titles) { p.Message("&cPlayer titles do not show before names in chat"); } if (Nicks) { p.Message("&cCustom player nicks do not show in chat"); } if (EightBall) { p.Message("&cIgnoring %T/8ball"); } if (DrawOutput) { p.Message("&cIgnoring draw command output"); } if (WorldChanges) { p.Message("&cIgnoring world change messages"); } }
static string UnescapeMessage(Player pl, Player src, string msg) { string nick = pl.FormatNick(src); msg = msg.Replace("λNICK", nick); if (pl.Ignores.Titles) { return(msg.Replace("λFULL", src.GroupPrefix + nick)); } else if (pl.Ignores.Nicks) { return(msg.Replace("λFULL", src.color + src.prefix + src.truename)); } else { return(msg.Replace("λFULL", src.FullName)); } }
public void DisplayInfo(Player p) { p.Message("Bot {0} &S({1}) has:", ColoredName, name); p.Message(" Owner: &f{0}", string.IsNullOrEmpty(Owner) ? "no one" : p.FormatNick(Owner)); if (!String.IsNullOrEmpty(AIName)) { p.Message(" AI: &f{0}", AIName); } if (hunt || kill) { p.Message(" Hunt: &f{0}&S, Kill: %f{1}", hunt, kill); } if (SkinName != name) { p.Message(" Skin: &f{0}", SkinName); } if (Model != "humanoid") { p.Message(" Model: &f{0}", Model); } if (!(ScaleX == 0 && ScaleY == 0 && ScaleZ == 0)) { p.Message(" X scale: &a{0}&S, Y scale: &a{1}&S, Z scale: &a{2}", ScaleX == 0 ? "none" : ScaleX.ToString(), ScaleY == 0 ? "none" : ScaleY.ToString(), ScaleZ == 0 ? "none" : ScaleZ.ToString() ); } if (String.IsNullOrEmpty(ClickedOnText)) { return; } ItemPerms perms = CommandExtraPerms.Find("About", 1) ?? new ItemPerms(LevelPermission.AdvBuilder); if (!perms.UsableBy(p.Rank)) { return; //don't show bot's ClickedOnText if player isn't allowed to see message block contents } p.Message(" Clicked-on text: {0}", ClickedOnText); }
public bool Blacklist(Player p, LevelPermission plRank, Level lvl, string target) { if (!CheckList(p, plRank, target, false)) { return(false); } if (Blacklisted.CaselessContains(target)) { p.Message("{0} %Sis already blacklisted.", p.FormatNick(target)); return(true); } bool removed = true; if (!Whitelisted.CaselessRemove(target)) { Blacklisted.Add(target); removed = false; } OnListChanged(p, lvl, target, false, removed); return(true); }
public bool CheckDetailed(Player p, LevelPermission plRank) { AccessResult access = Check(p.name, plRank); if (access == AccessResult.Allowed) { return(true); } if (access == AccessResult.Whitelisted) { return(true); } if (access == AccessResult.Blacklisted) { p.Message("You are blacklisted from {0} {1}", ActionIng, ColoredName); return(false); } string whitelist = ""; if (Whitelisted.Count > 0) { whitelist = "(and " + Whitelisted.Join(pl => p.FormatNick(pl)) + "%S) "; } if (access == AccessResult.BelowMinRank) { p.Message("Only {2}%S+ {3}may {0} {1}", Action, ColoredName, Group.GetColoredName(Min), whitelist); } else if (access == AccessResult.AboveMaxRank) { p.Message("Only {2} %Sand below {3}may {0} {1}", Action, ColoredName, Group.GetColoredName(Max), whitelist); } return(false); }
public static string GetColoredName(Player p, string name) { return(p.FormatNick(name)); }