void OnStructurePlaced(StructureComponent component, IStructureComponentItem structureComponentItem) { var structurecheck = component.gameObject.AddComponent <StructureCheck>(); structurecheck.owner = structureComponentItem.character; structurecheck.radius = 0f; if ((antiPillarStash || antiPillarBarricade) && component.IsPillar()) { structurecheck.radius = 0.2f; } else if (antiFoundationGlitch && (component.type == StructureComponent.StructureComponentType.Foundation)) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } else if (component.type == StructureComponent.StructureComponentType.Ramp) { if (antiRampStack) { if (MeshBatchPhysics.Raycast(structurecheck.position + Vector3ABitUp, Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { if (cachedhitInstance != null) { cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>(); if (cachedComponent.type == StructureComponent.StructureComponentType.Foundation || cachedComponent.type == StructureComponent.StructureComponentType.Ceiling) { var weight = getweight.GetValue(cachedComponent._master) as Dictionary <StructureComponent, HashSet <StructureComponent> >; int ramps = 0; if (weight.ContainsKey(cachedComponent)) { foreach (StructureComponent structure in weight[cachedComponent]) { if (structure.type == StructureComponent.StructureComponentType.Ramp) { ramps++; } } } if (ramps > rampstackMax) { TakeDamage.KillSelf(component.GetComponent <IDMain>()); if (structurecheck.owner != null && structurecheck.owner.playerClient != null) { ConsoleNetworker.SendClientCommand(structurecheck.owner.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("You are not allowed to stack more than {0} ramps", rampstackMax.ToString()))); } timer.Once(0.01f, () => GameObject.Destroy(structurecheck)); return; } } } } } if (antiRampGlitch) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } } timer.Once(0.05f, () => structurecheck.CheckCollision()); }
public static void sayUser(uLink.NetworkPlayer player, string arg) { if (!string.IsNullOrEmpty(arg) && player != null) { ConsoleNetworker.SendClientCommand(player, "chat.add " + Facepunch.Utility.String.QuoteSafe(Fougerite.Server.GetServer().server_message_name) + " " + Facepunch.Utility.String.QuoteSafe(arg)); } }
public static void say(uLink.NetworkPlayer player, string playername, string arg) { if (!string.IsNullOrEmpty(arg) && !string.IsNullOrEmpty(playername) && player != null) { ConsoleNetworker.SendClientCommand(player, "chat.add " + playername + " " + arg); } }
public static void MessageClan(ClanData clan, string text, [Optional, DefaultParameterValue(null)] NetUser AsUser) { try { if (!text.IsEmpty() && (clan != null)) { string chatClanIcon = Core.ChatClanIcon; if (chatClanIcon == "") { chatClanIcon = "<" + (clan.Abbr.IsEmpty() ? clan.Name : clan.Abbr) + ">"; } if (AsUser != null) { chatClanIcon = AsUser.displayName + Core.ChatDivider + chatClanIcon; } text = "chat.add " + Helper.QuoteSafe(chatClanIcon) + " " + Helper.QuoteSafe(Helper.GetChatTextColor(Core.ChatClanColor) + text.Trim(new char[] { '"' })); foreach (UserData data in clan.Members.Keys) { PlayerClient client; if (PlayerClient.FindByUserID(data.SteamID, out client)) { ConsoleNetworker.SendClientCommand(client.netPlayer, text); } } } } catch (Exception exception) { Debug.Log("ERROR: " + exception.Message); } }
public static void sayUser(uLink.NetworkPlayer player, string customName, string arg) { if (!string.IsNullOrEmpty(arg) && !string.IsNullOrEmpty(customName) && player != null) { ConsoleNetworker.SendClientCommand(player, "chat.add " + Facepunch.Utility.String.QuoteSafe(customName) + " " + Facepunch.Utility.String.QuoteSafe(arg)); } }
private object OnRunCommand(ConsoleSystem.Arg arg, bool wantreply) { // Sanity checks if (arg == null) { return(null); } string cmd = $"{arg.Class}.{arg.Function}"; // Is it chat.say? if (cmd == "chat.say") { // Get the args var str = arg.GetString(0); if (str.Length == 0) { return(true); } // Get covalence player var iplayer = covalence.PlayerManager.GetPlayer(arg.argUser.userID.ToString()); // Is it a chat command? if (str[0] != '/' && str[0] != '!') { return(Interface.CallHook("OnPlayerChat", arg.argUser, str) ?? Interface.CallHook("OnUserChat", iplayer, str)); } // Get the arg string var argstr = str.Substring(1); if (str.Length == 1) { return(true); } // Parse it string chatcmd; string[] args; ParseChatCommand(argstr, out chatcmd, out args); if (chatcmd == null) { return(null); } // Handle it var ply = arg.argUser; if (ply != null && !cmdlib.HandleChatCommand(ply, chatcmd, args)) { ConsoleNetworker.SendClientCommand(ply.networkPlayer, $"chat.add \"Server\" \" Unknown command {chatcmd}\""); return(true); } // Handled arg.ReplyWith(string.Empty); return(true); } return(cmdlib.HandleConsoleCommand(arg, wantreply)); }
public static void MessageClan(NetUser user, ClanData clan, string text) { try { if (!text.IsEmpty()) { string str = "<Undefined>"; if (user == null) { if (clan != null) { str = "<" + (clan.Abbr.IsEmpty() ? clan.Name : clan.Abbr) + ">"; } ConsoleSystem.Print(str + ": " + text, false); } else { if (clan == null) { clan = Users.GetBySteamID(user.userID).Clan; } if (clan != null) { str = "<" + (clan.Abbr.IsEmpty() ? clan.Name : clan.Abbr) + ">"; text = "chat.add " + Helper.QuoteSafe(str) + " " + Helper.QuoteSafe(Helper.GetChatTextColor(Core.ChatClanColor) + text.Trim(new char[] { '"' })); ConsoleNetworker.SendClientCommand(user.networkPlayer, text); } } } } catch (Exception exception) { Debug.Log("ERROR: " + exception.Message); } }
public static void NoticeAll(string icon, string text, NetUser sender = null, float duration = 5f) { try { if (!text.IsEmpty()) { text = string.Concat(new object[] { "notice.popup \"", duration, "\" ", icon, "\" ", Helper.QuoteSafe(text) }); foreach (PlayerClient current in PlayerClient.All) { if (current.netUser != sender) { ConsoleNetworker.SendClientCommand(current.netPlayer, text); } } } } catch (Exception ex) { Debug.Log("ERROR: " + ex.Message); } }
void OnDestroy() { if (playerclient != null && playerclient.netUser != null) { ConsoleNetworker.SendClientCommand(playerclient.netUser.networkPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(removeDeactivated)); } }
public static void Message(string color, uLink.NetworkPlayer player, string text, string sender = null, float timewait = 0f) { if (!text.IsEmpty()) { if (!Broadcast.Timewait.ContainsKey(player) || !(Broadcast.Timewait[player] > DateTime.Now)) { if (timewait > 0f) { if (!Broadcast.Timewait.ContainsKey(player)) { Broadcast.Timewait.Add(player, DateTime.Now.AddMilliseconds((double)(1000f * timewait))); } else { Broadcast.Timewait[player] = DateTime.Now.AddMilliseconds((double)(1000f * timewait)); } } if (string.IsNullOrEmpty(sender)) { sender = Core.ServerName; } text = Helper.GetChatTextColor(color) + text.Trim(new char[] { '"' }); ConsoleNetworker.SendClientCommand(player, "chat.add " + Helper.QuoteSafe(sender) + " " + Helper.QuoteSafe(text)); } } }
public static void sayUser(uLink.NetworkPlayer player, string arg) { Contract.Requires(player != null); Contract.Requires(arg != null); ConsoleNetworker.SendClientCommand(player, "chat.add " + Facepunch.Utility.String.QuoteSafe(Fougerite.Server.GetServer().server_message_name) + " " + Facepunch.Utility.String.QuoteSafe(arg)); }
public static void MessageClan(ClanData clan, string text) { try { if (!text.IsEmpty()) { if (clan != null) { string text2 = Core.ChatClanIcon; if (text2 == "") { text2 = "<" + (clan.Abbr.IsEmpty() ? clan.Name : clan.Abbr) + ">"; } text = "chat.add " + Helper.QuoteSafe(text2) + " " + Helper.QuoteSafe(Helper.GetChatTextColor(Core.ChatClanColor) + text.Trim(new char[] { '"' })); foreach (UserData current in clan.Members.Keys) { PlayerClient playerClient; if (PlayerClient.FindByUserID(current.SteamID, out playerClient)) { ConsoleNetworker.SendClientCommand(playerClient.netPlayer, text); } } } } } catch (Exception ex) { Debug.Log("ERROR: " + ex.Message); } }
void OnAirdrop(Vector3 targetposition) { string message = "Airdrop inbound"; string location = string.Empty; string distance = string.Empty; string direction = string.Empty; if (useLocation && Location != null) { location = Location.Call("FindLocationName", targetposition) as string; if (location != null) { location = " near " + location; } } message += location + "!"; foreach (PlayerClient player in PlayerClient.All) { var currentmessage = message.ToString(); if (showDistance) { distance = "approx. " + Math.Ceiling(Math.Abs(Vector3.Distance(targetposition, player.lastKnownPosition))).ToString() + "m"; } if (showDirection) { direction = GetDirection(targetposition, player.lastKnownPosition); } if (showDistance || showDirection) { currentmessage = string.Format("{0} ({1} {2} of your position)", currentmessage, distance, direction); } ConsoleNetworker.SendClientCommand(player.netPlayer, "chat.add AntiCheat " + Facepunch.Utility.String.QuoteSafe(currentmessage)); } }
public void SendCommand(string cmd) { if (this.IsOnline) { ConsoleNetworker.SendClientCommand(this.ourPlayer.netPlayer, cmd); } }
//string str1 = Facepunch.Utility.String.QuoteSafe(rustpp.config.GetSetting("Settings", "system_message_nameTEST")); public static void sayUser(uLink.NetworkPlayer player, string arg) { string str1 = Facepunch.Utility.String.QuoteSafe(rustpp.server_message_name); string str2 = Facepunch.Utility.String.QuoteSafe(arg); ConsoleNetworker.SendClientCommand(player, "chat.add " + str1 + " " + str2); }
public static void Chat(string sender, string text, [Optional, DefaultParameterValue(null)] NetUser exclude) { try { if (!text.IsEmpty()) { if (string.IsNullOrEmpty(sender)) { sender = Core.ServerName; } text = Helper.QuoteSafe(text); sender = Helper.QuoteSafe(sender); if (exclude == null) { ConsoleNetworker.Broadcast("chat.add " + sender + " " + text); } else { foreach (PlayerClient client in PlayerClient.All) { if (client.netUser != exclude) { ConsoleNetworker.SendClientCommand(client.netPlayer, "chat.add " + sender + " " + text); } } } } } catch (Exception exception) { Debug.Log("ERROR: " + exception.Message); } }
public static void say(uLink.NetworkPlayer player, string playername, string arg) { string str1 = playername; string str2 = arg; ConsoleNetworker.SendClientCommand(player, "chat.add " + str1 + " " + str2); }
public static void broadcastTo(uLink.NetworkPlayer player, string message) { PlayerClient playerClient = Array.Find(Vars.AllPlayerClients.ToArray(), (PlayerClient pc) => pc.netPlayer == player); Vars.conLog.Chat("<TO " + playerClient.userName + "> " + Vars.botName + ": " + message); ConsoleNetworker.SendClientCommand(player, "chat.add \"[PM] " + Vars.botName + "\" \"" + Vars.replaceQuotes(message) + "\""); }
void cmdChatBan(NetUser netuser, string command, string[] args) { if (!hasAccess(netuser, "canban")) { SendReply(netuser, notAllowed); return; } if (args.Length == 0) { SendReply(netuser, "/ban STEAMID NAME REASON"); SendReply(netuser, "/ban PLAYERNAME REASON"); return; } cachedSteamid = string.Empty; cachedName = string.Empty; NetUser targetuser = rust.FindPlayer(args[0]); if (targetuser != null) { cachedSteamid = targetuser.playerClient.userID.ToString(); cachedName = targetuser.playerClient.userName.ToString(); } else { if (args[0].Length != 17) { SendReply(netuser, noplayerfound); return; } cachedSteamid = args[0]; } cachedReason = string.Empty; if (args.Length > 1) { if (cachedName == string.Empty) { cachedName = args[1]; if (args.Length > 2) { cachedReason = args[2]; } } else { cachedReason = args[1]; } } cachedReason += "(" + netuser.displayName + ")"; if (BanList.Contains(Convert.ToUInt64(cachedSteamid))) { SendReply(netuser, string.Format("{0} is already in the banlist", cachedSteamid)); return; } if (!broadcastBan) { ConsoleNetworker.SendClientCommand(netuser.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format(banMessage, cachedSteamid, cachedName, cachedReason))); } else { Broadcast(string.Format(banMessage, cachedSteamid, cachedName, cachedReason)); } Interface.CallHook("cmdBan", cachedSteamid, cachedName, cachedReason); }
public static void noticeTo(uLink.NetworkPlayer sender, string icon, string message, int duration = 2, bool log = false) { if (log) { Vars.conLog.Chat("<NOTICE> " + Vars.botName + ": " + message); } ConsoleNetworker.SendClientCommand(sender, "notice.popup " + duration + " \"" + icon + "\" \"" + Vars.replaceQuotes(message) + "\""); }
public static void say(uLink.NetworkPlayer player, string playername, string arg) { Contract.Requires(player != null); Contract.Requires(!string.IsNullOrEmpty(playername)); Contract.Requires(arg != null); ConsoleNetworker.SendClientCommand(player, "chat.add " + playername + " " + arg); }
void SendMessage(NetUser netUser, string name, string message = null) { if (message == null) { message = name; name = "Server"; } ConsoleNetworker.SendClientCommand(netUser.networkPlayer, $"chat.add {QuoteSafe(name)} {QuoteSafe(message)}"); }
static void AntiGlitchBroadcastAdmins(string message) { foreach (PlayerClient player in PlayerClient.All) { if (player.netUser.CanAdmin()) { ConsoleNetworker.SendClientCommand(player.netPlayer, "chat.add AntiGlitch \"" + message + "\""); } } }
public static void ChatPM(NetUser sender, NetUser client, string text) { try { if (!text.IsEmpty()) { string str = Helper.QuoteSafe(Config.GetMessage("Command.PM.To", null, null) + " " + client.displayName); string str2 = Helper.QuoteSafe(Config.GetMessage("Command.PM.From", null, null) + " " + sender.displayName); string chatTextColor = Helper.GetChatTextColor(Core.ChatWhisperColor); text = Regex.Replace(text, "(\\[COLOR\\s*\\S*])|(\\[/COLOR\\s*\\S*])", "", RegexOptions.IgnoreCase).Trim(); Helper.LogChat(string.Concat(new string[] { "[PM] \"", sender.displayName, "\" for \"", client.displayName, "\" say ", text }), false); string[] array = Helper.WarpChatText(Helper.ObsceneText(text), Core.ChatLineMaxLength, "", ""); for (int i = 0; i < array.Length; i++) { ConsoleNetworker.SendClientCommand(sender.networkPlayer, "chat.add " + str + " " + Helper.QuoteSafe(chatTextColor + array[i])); ConsoleNetworker.SendClientCommand(client.networkPlayer, "chat.add " + str2 + " " + Helper.QuoteSafe(chatTextColor + array[i])); } if (Core.ChatHistoryPrivate) { if (!Core.History.ContainsKey(sender.userID)) { Core.History.Add(sender.userID, new List <HistoryRecord>()); } if (Core.History[sender.userID].Count > Core.ChatHistoryStored) { Core.History[sender.userID].RemoveAt(0); } Core.History[sender.userID].Add(default(HistoryRecord).Init(Config.GetMessage("Command.PM.To", null, null) + " " + client.displayName, text)); if (!Core.History.ContainsKey(client.userID)) { Core.History.Add(client.userID, new List <HistoryRecord>()); } if (Core.History[client.userID].Count > Core.ChatHistoryStored) { Core.History[client.userID].RemoveAt(0); } Core.History[client.userID].Add(default(HistoryRecord).Init(Config.GetMessage("Command.PM.From", null, null) + " " + sender.displayName, text)); } } } catch (Exception ex) { Debug.Log("ERROR: " + ex.Message); } }
/// <summary> /// Sends the specified message to the player /// </summary> /// <param name="message"></param> public void Message(string message) { switch (LastCommand) { case CommandType.Chat: ConsoleNetworker.SendClientCommand(netUser.networkPlayer, $"chat.add \"Server\" {message.Quote()}"); break; case CommandType.Console: Command($"echo {message}"); break; } }
/// <summary> /// Sends the specified message and prefix to the player /// </summary> /// <param name="message"></param> /// <param name="prefix"></param> /// <param name="args"></param> public void Message(string message, string prefix, params object[] args) { message = args.Length > 0 ? string.Format(Formatter.ToRustLegacy(message), args) : Formatter.ToRustLegacy(message); switch (LastCommand) { case CommandType.Chat: ConsoleNetworker.SendClientCommand(netUser.networkPlayer, $"chat.add \"{(string.IsNullOrEmpty(prefix) ? "Server" : prefix)}\" {message.Quote()}"); break; case CommandType.Console: Command($"echo {message}"); break; } }
public static void Notice(uLink.NetworkPlayer player, string icon, string text, [Optional, DefaultParameterValue(5f)] float duration) { try { if (!text.IsEmpty()) { ConsoleNetworker.SendClientCommand(player, string.Concat(new object[] { "notice.popup \"", duration, "\" \"", icon, "\" ", Helper.QuoteSafe(text) })); } } catch (Exception exception) { Debug.Log("ERROR: " + exception.Message); } }
object OnItemCraft(CraftingInventory inv, BlueprintDataBlock bpdb, int amount, ulong starttime) { if (!blockedCrafting.Contains(bpdb.resultItem.name)) { return(null); } NetUser netuser = (inv.idMain as Character).netUser; if (netuser != null) { ConsoleNetworker.SendClientCommand(netuser.networkPlayer, "notice.popup 10 q " + Facepunch.Utility.String.QuoteSafe(blockCraftMessage)); } return(true); }
object OnResearchItem(InventoryItem resourceitem, IInventoryItem otherItem) { if (!blockedResearch.Contains(otherItem.datablock.name)) { return(null); } NetUser netuser = (resourceitem.inventory.idMain as Character).netUser; if (netuser != null) { ConsoleNetworker.SendClientCommand(netuser.networkPlayer, "notice.popup 10 q " + Facepunch.Utility.String.QuoteSafe(blockResearchMessage)); } return(InventoryItem.MergeResult.Failed); }
public void CheckCollision() { foreach (Collider collider in Physics.OverlapSphere(this.position, this.radius)) { if (collider.GetComponent <DeployableObject>() != null) { if (structuremaster.IsPillar()) { if (antiPillarStash && collider.GetComponent <DeployableObject>().name == "SmallStash(Clone)") { shouldDestroy = true; } else if (antiPillarBarricade && collider.GetComponent <DeployableObject>().name == "Barricade_Fence_Deployable(Clone)") { shouldDestroy = true; } } else if (antiFoundationGlitch && (structuremaster.type == StructureComponent.StructureComponentType.Foundation)) { shouldDestroy = true; } else if (antiRampGlitch && (structuremaster.type == StructureComponent.StructureComponentType.Ramp)) { shouldDestroy = true; } } else if (collider.GetComponent <Character>()) { if (antiRampGlitch && (structuremaster.type == StructureComponent.StructureComponentType.Ramp)) { shouldDestroy = true; } } if (shouldDestroy) { if (owner != null && owner.playerClient != null) { ConsoleNetworker.SendClientCommand(owner.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("{0} is blocking the way", collider.gameObject.name))); } TakeDamage.KillSelf(structuremaster.GetComponent <IDMain>()); return; } } if (this != null) { GameObject.Destroy(this); } }