public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } if (!MessageCmd.CanSpeak(p, name)) { return; // do not allow using kill to spam every 2 secs } string[] args = message.SplitSpaces(2); Player target = PlayerInfo.FindMatches(p, args[0]); if (target == null) { if (p != null) { p.HandleDeath(Block.Stone, "@p %Skilled themselves in their confusion"); } return; } if (!CheckRank(p, data, target, "kill", false)) { return; } bool explode = false; string deathMsg = GetDeathMessage(args, p.ColoredName, ref explode); target.HandleDeath(Block.Stone, deathMsg, explode); }
public override void Use(Player p, string message) { if (message.Length == 0) { Help(p); return; } if (!MessageCmd.CanSpeak(p, name)) { return; // do not allow using kill to spam every 2 secs } string[] args = message.SplitSpaces(2); Player target = PlayerInfo.FindMatches(p, args[0]); ExtBlock rock = (ExtBlock)Block.Stone; if (target == null) { if (p != null) { p.HandleDeath(rock, "@p %Skilled themselves in their confusion"); } return; } if (p != null && (target != p && target.Rank >= p.Rank)) { MessageTooHighRank(p, "kill", false); return; } bool explode = false; string killer = p == null ? "(console)" : p.ColoredName; string deathMsg = GetDeathMessage(args, killer, ref explode); target.HandleDeath(rock, deathMsg, explode); }
public static void MessageOps(Player p, string message) { if (!MessageCmd.CanSpeak(p, "OpChat")) { return; } MessageStaff(p, message, Chat.OpchatPerms, "Ops"); }
public static void MessageAdmins(Player p, string message) { if (!MessageCmd.CanSpeak(p, "AdminChat")) { return; } MessageStaff(p, message, Chat.AdminchatPerms, "Admins"); }
public string BuildProtocolBody(MessageCmd cmdtype, string body) { string h = "<?xml version=\"1.0\" ?><root>";// encoding=\"gbk\" string t = "</root>"; string head = BuildProtocolHead(cmdtype); return(string.Format("{0}{1}{2}{3}", h, head, body, t)); }
public static void MessageOps(Player p, string message) { LevelPermission rank = CommandExtraPerms.MinPerm("OpChat", LevelPermission.Operator); if (!MessageCmd.CanSpeak(p, "OpChat")) { return; } MessageStaff(p, message, rank, "Ops"); }
public static void MessageAdmins(Player p, string message) { LevelPermission rank = CommandExtraPerms.MinPerm("AdminChat", LevelPermission.Admin); if (!MessageCmd.CanSpeak(p, "AdminChat")) { return; } MessageStaff(p, message, rank, "Admins"); }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } bool stealth = false; if (message[0] == '#') { message = message.Remove(0, 1).Trim(); stealth = true; Logger.Log(LogType.UserActivity, "Stealth joker attempted"); } Player who = PlayerInfo.FindMatches(p, message); if (who == null) { return; } if (!CheckRank(p, data, who, "joker", true)) { return; } if (!MessageCmd.CanSpeak(p, name)) { return; } if (!who.joker) { if (stealth) { Chat.MessageFromOps(who, "λNICK %Sis now STEALTH jokered."); } else { Chat.MessageFrom(who, "λNICK %Sis now a &aJ&bo&ck&5e&9r%S.", null, true); } } else { if (stealth) { Chat.MessageFromOps(who, "λNICK %Sis now STEALTH unjokered."); } else { Chat.MessageFrom(who, "λNICK %Sis no longer a &aJ&bo&ck&5e&9r%S.", null, true); } } who.joker = !who.joker; }
public void SetInfo(MessageCmd cmd) { _type = cmd.Type; _onClickActionConfirm = cmd.ActionConfirm; _onClickActionYes = cmd.ActionYes; _onClickActionNo = cmd.ActionNo; _textTitle.text = cmd.Title; Refresh(); }
public string BuildProtocolBody <T>(MessageCmd cmdtype, T args) { string h = "<?xml version=\"1.0\" ?><root>";// encoding=\"gbk\" string t = "</root>"; string head = BuildProtocolHead(cmdtype); string body = IVX.DataModel.Common.SerilizeObject <T>(args); body = body.Replace(typeof(T).Name, "Request"); return(string.Format("{0}{1}{2}{3}", h, head, body, t)); }
public string BuildProtocolHead(MessageCmd cmdtype) { Head hd = new Head() { Context = Context.ToString(), MsgCmd = (ulong)cmdtype, Sequence = Sequence++, Version = "3.1.1.0", }; return(IVX.DataModel.Common.SerilizeObject <Head>(hd)); }
void SendCmdMessage( InterfaceCommand interfaceCommand, byte[] data) { var cmdMessage = new MessageCmd( m_InterfaceAddress, interfaceCommand, data); //get message data bytes var sendData = cmdMessage.GetSendingData(); //send data bytes at port SendMessageLow(sendData); }
internal static void HandleCommand(Player p, string cmd, string args) { if (!ServerConfig.CoreSecretCommands) { return; } //DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla if (cmd == "pony") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) { return; } int ponycount = p.Extras.GetInt("MCGalaxy_Core_Pony", 0); if (ponycount < 2) { Chat.MessageGlobal("{0} %Sjust so happens to be a proud brony! Everyone give {0} %Sa brohoof!", p.ColoredName); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } ponycount++; p.Extras.PutInt("MCGalaxy_Core_Pony", ponycount); } else if (cmd == "rainbowdashlikescoolthings") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) { return; } int rdcount = p.Extras.GetInt("MCGalaxy_Core_RD", 0); if (rdcount < 2) { Chat.MessageGlobal("&4T&6H&eI&aS&3 S&9E&1R&4V&6E&eR &aJ&3U&9S&1T &4G&6O&eT &a2&30 &9P&1E&4R&6C&eE&aN&3T &9C&1O&4O&6L&eE&aR&3!"); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } rdcount++; p.Extras.PutInt("MCGalaxy_Core_RD", rdcount); } }
internal static void HandleCommand(Player p, string cmd, string args, CommandData data) { if (!Server.Config.CoreSecretCommands) { return; } // DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla if (cmd == "pony") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) { return; } int used = p.Extras.GetInt("MCG_PONY"); if (used < 2) { Chat.MessageFrom(p, "λNICK &Sjust so happens to be a proud brony! Everyone give λNICK &Sa brohoof!"); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { p.Message("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } p.Extras["MCG_PONY"] = used + 1; } else if (cmd == "rainbowdashlikescoolthings") { p.cancelcommand = true; if (!MessageCmd.CanSpeak(p, cmd)) { return; } int used = p.Extras.GetInt("MCG_RD"); if (used < 2) { Chat.MessageGlobal("&4T&6H&eI&aS&3 S&9E&1R&4V&6E&eR &aJ&3U&9S&1T &4G&6O&eT &a2&30 &9P&1E&4R&6C&eE&aN&3T &9C&1O&4O&6L&eE&aR&3!"); Logger.Log(LogType.CommandUsage, "{0} used /{1}", p.name, cmd); } else { p.Message("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } p.Extras["MCG_RD"] = used + 1; } }
public override void Use(Player p, string message) { if (message.Length == 0 || message.IndexOf(' ') != -1) { Help(p); return; } if (!MessageCmd.CanSpeak(p, name)) { return; } if (Server.voteKickInProgress) { Player.Message(p, "Please wait for the current vote to finish!"); return; } Player who = PlayerInfo.FindMatches(p, message); if (who == null) { return; } if (who.Rank >= p.Rank) { Chat.MessageGlobal(p, p.ColoredName + " %Stried to votekick " + who.ColoredName + " %Sbut failed!", false); return; } Chat.MessageOps(p.ColoredName + " %Sused &a/votekick"); Chat.MessageGlobal("&9A vote to kick {0} %Shas been called!", who.ColoredName); Chat.MessageGlobal("&9Type &aY %Sor &cN %Sto vote."); // 1/3rd of the players must vote or nothing happens // Keep it at 0 to disable min number of votes Server.voteKickVotesNeeded = 3; //(int)(PlayerInfo.players.Count / 3) + 1; Server.voteKickInProgress = true; Server.MainScheduler.QueueOnce(VoteTimerCallback, who.name, TimeSpan.FromSeconds(30)); }
private void UpdatePlayer(int id, MessageCmd cmd) { NetPlayer player; if (!m_players.TryGetValue(id, out player)) { return; } player.SendEvent(cmd); }