public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); if (user.AdminLevel < 2 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } string strText = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (strText == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /anuncio <Texto>"); } else { char ch = '☢'; foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { client.Notice(ch.ToString(), strText, 5f); } } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); if (user.AdminLevel < 2 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } if (user.GodMode) { user.GodMode = false; pl.SendClientMessage("¡Desactivaste el modo DIOS!"); pl.PlayerClient.controllable.character.takeDamage.SetGodMode(false); return; } else { user.GodMode = true; pl.PlayerClient.controllable.character.takeDamage.SetGodMode(true); if (pl.FallDamage != null) { pl.FallDamage.ClearInjury(); } pl.SendClientMessage("¡Activaste el modo DIOS!"); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (user.Muted == 1) { pl.SendClientMessage("[color red]<Error> [color white]Estás muteado, no puedes hablar."); return; } string strText = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); string rem = Regex.Replace(strText, @"\[/?color\b.*?\]", string.Empty); string template = "-userName- grita: ¡-userMessage-!"; string setname = Regex.Replace(template, "-userName-", Arguments.argUser.displayName); string final = Regex.Replace(setname, "-userMessage-", rem); if (strText == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis> [color white]/g <Texto>"); } else { pl.SendMessageToNearUsers(final, 80.0f); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == pl.Name); if (user.AdminLevel < 4 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error 401>[/color] No estás autorizado a utilizar este comando."); return; } if (user.InstaKO) { user.InstaKO = false; pl.MessageFrom(Core.Name, "[color green]<!>[/color] El modo InstaKO fue desactivado."); return; } else { user.InstaKO = true; pl.MessageFrom(Core.Name, "[color red]<!>[/color] El modo InstaKO fue activado."); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); if (user.AdminLevel < 2 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } string search = ChatArguments[0]; if (search == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /ban <Nombre>."); return; } Fougerite.Player recipient = Fougerite.Player.FindByName(search); if (recipient == null) { pl.SendClientMessage("[color red]<Error>[/color] No se encontró al usuario."); return; } BanPlayer(recipient, pl); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == pl.Name); if (user.AdminLevel < 3 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error 401>[/color] No estás autorizado a utilizar este comando."); return; } string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.MessageFrom(Core.Name, "[color red]<Sintaxis>[/color] /kick <NombreJugador>"); return; } Fougerite.Player recipient = Fougerite.Player.FindByName(playerName); KickPlayer(recipient, pl); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { Fougerite.Player sender = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(sender); if (!RustPP.Data.Globals.UserIsLogged(sender)) { char ch = '☢'; sender.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (ChatArguments.Length >= 1) { if (this.replies.ContainsKey(sender.Name)) { string replyTo = (string)this.replies[sender.Name]; Fougerite.Player recipient = Fougerite.Server.GetServer().FindPlayer(replyTo); if (recipient == null) { sender.SendClientMessage($"[color red]<Error>[/color] No se encontró al usuario {replyTo}"); this.replies.Remove(sender.Name); return; } string message = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }).Replace('"', 'ˮ'); if (message == string.Empty) { sender.SendClientMessage("[color red]<Sintaxis>[/color] /r <Mensaje>"); return; } recipient.SendClientMessage($"[color #e8c92d]((MP de {sender.Name}: {message}))"); sender.SendClientMessage($"[color #e8c92d]((MP para {recipient.Name}: {message}))"); if (this.replies.ContainsKey(replyTo)) { this.replies[replyTo] = sender.Name; } else { this.replies.Add(replyTo, sender.Name); } } else { sender.SendClientMessage("[color red]<Error>[/color] No hay nadie a quien responder."); } } else { sender.SendClientMessage("[color red]<Sintaxis>[/color] /r <Mensaje>"); } }
/*DEPRECATED*/ public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } pl.SendClientMessage("[color orange]HyAxe Rust v" + Core.Version); pl.SendClientMessage("Desarrollado por [color orange]FR0Z3NH34R7"); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (user.TimeToChat >= 1) { pl.SendClientMessage($"[color red]<Error> [color white]Espera {user.TimeToChat} para enviar otro mensaje."); return; } if (user.Muted == 1) { pl.SendClientMessage("[color red]<Error> [color white]Estás muteado, no puedes hablar."); return; } string strText = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); string rem = Regex.Replace(strText, @"\[/?color\b.*?\]", string.Empty); string template = "[color #2a6de899][OOC]((-userName-: -userMessage-))"; if (user.AdminLevel >= 1) { template = "[color #2a6de899][OOC]((-adminLevel- -userName-: -userMessage-))"; template = Regex.Replace(template, "-adminLevel-", Globals.getAdminName(user)); } string setname = Regex.Replace(template, "-userName-", Arguments.argUser.displayName); string final = Regex.Replace(setname, "-userMessage-", rem); if (strText == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis> [color white]/duda <Texto>"); } else { Server.GetServer().SendMessageForAll(final); user.TimeToChat += 5; } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == pl.Name); string targetName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (targetName.Equals(string.Empty) || targetName.Equals(Arguments.argUser.displayName)) { string reply; if (GetLocationString(ref Arguments.argUser, pl, out reply)) { Arguments.ReplyWith(reply); pl.SendClientMessage(reply); } return; } if (user.AdminLevel <= 1) { pl.SendClientMessage("[color red]<Error>[/color] Solo los administradores pueden saber la ubicación de otro usuario."); return; } foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (targetName.Equals("todos", StringComparison.OrdinalIgnoreCase) || targetName.Equals(client.Name, StringComparison.OrdinalIgnoreCase) || targetName.ToUpperInvariant().Contains(client.Name.ToUpperInvariant())) { string reply; if (GetLocationString(ref Arguments.argUser, client, out reply)) { Arguments.ReplyWith(reply); pl.SendClientMessage(reply); } } } }
/*DEPRECATED*/ public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } string search = ChatArguments[0]; Fougerite.Player recipient = Fougerite.Player.FindByName(search); if (recipient == null) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /addfriend <NombreJugador>"); return; } AddFriend(recipient, pl); }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (File.Exists(RustPPModule.GetAbsoluteFilePath("rules.txt"))) { foreach (string str in File.ReadAllLines(RustPPModule.GetAbsoluteFilePath("rules.txt"))) { pl.SendClientMessage(str); } } else { pl.SendClientMessage("Todavía no hay reglas establecidas en el servidor."); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } for (int i = 1 + int.Parse(Core.config.GetSetting("Settings", "chat_history_amount")); i > 0; i--) { if (Fougerite.Data.GetData().chat_history_username.Count >= i) { string playername = Fougerite.Data.GetData().chat_history_username[Fougerite.Data.GetData().chat_history_username.Count - i]; string arg = Fougerite.Data.GetData().chat_history[Fougerite.Data.GetData().chat_history.Count - i]; if (playername != null) { pl.SendClientMessage($"{playername}: {arg}"); } } } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); if (user.AdminLevel < 1 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } if (ChatArguments.Length == 3) { float n, n2, n3; bool b = float.TryParse(ChatArguments[0], out n); bool b2 = float.TryParse(ChatArguments[1], out n2); bool b3 = float.TryParse(ChatArguments[2], out n3); if (b && b2 && b3) { pl.TeleportTo(n, n2, n3, false); pl.SendClientMessage($"[color blue] Te teletransportaste a X: {b} Y: {b2} Z: {b3}"); return; } } string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /traer <NombreJugador>"); return; } List <string> list = new List <string>(); list.Add("ToTarget"); foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { Arguments.Args = new string[] { pl.Name, client.Name }; if (client.IsOnline) { if (V3Equal(client.Location, Vector3.zero)) { pl.MessageFrom(Core.Name, client.Name + " is still loading and has null position!"); return; } pl.TeleportTo(client, 1.5f, false); pl.MessageFrom(Core.Name, "You have teleported to " + client.Name); } else { pl.MessageFrom(Core.Name, client.Name + " seems to be offline"); } return; } list.Add(client.Name); } } if (list.Count != 0) { pl.MessageFrom(Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: "); for (int j = 1; j < list.Count; j++) { pl.MessageFrom(Core.Name, j + " - " + list[j]); } pl.MessageFrom(Core.Name, "0 - Cancel"); pl.MessageFrom(Core.Name, "Please enter the number matching the player you were looking for."); tpWaitList[pl.UID] = list; } else { pl.MessageFrom(Core.Name, "No player found with the name: " + playerName); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); if (user.AdminLevel < 1 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /traer <NombreJugador>"); return; } if (playerName.Equals("todos", StringComparison.OrdinalIgnoreCase)) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { Arguments.Args = new string[] { client.Name, pl.Name }; teleport.toplayer(ref Arguments); } pl.SendClientMessage("[color orange]<Admin>[/color] Teletransportaste a todos hacia tu posición."); return; } List <string> list = new List <string>(); list.Add("TargetToHere"); foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { Arguments.Args = new string[] { client.Name, pl.Name }; teleport.toplayer(ref Arguments); pl.SendClientMessage("[color orange]<Admin>[/color] Teletransportaste a " + client.Name + " hacia tu posición."); return; } list.Add(client.Name); } } if (list.Count > 1) { pl.SendClientMessage("[color orange]<Admin>[/color] Se encontraron " + ((list.Count - 1)).ToString() + " Jugador" + (((list.Count - 1) > 1) ? "es" : "") + ": "); for (int j = 1; j < list.Count; j++) { pl.SendClientMessage(j + " - " + list[j]); } pl.SendClientMessage("0 - Cancelar"); pl.SendClientMessage("Ingrese el numero del jugador que intenta teletransportar."); TeleportToCommand command = ChatCommand.GetCommand("ir") as TeleportToCommand; command.GetTPWaitList().Add(pl.UID, list); } else { pl.SendClientMessage("[color red]<Error>[/color]No se encontro al jugador " + playerName); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } string playerName = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' }); if (playerName == string.Empty) { pl.SendClientMessage("<Sintaxis> /share <NombreJugador>"); return; } PList list = new PList(); list.Add(0, "Cancelar"); foreach (KeyValuePair <ulong, string> entry in Core.userCache) { if (entry.Value.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { DoorShare(new PList.Player(entry.Key, entry.Value), pl); return; } if (entry.Value.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(entry.Key, entry.Value); } } if (list.Count == 1) { foreach (Fougerite.Player client in Fougerite.Server.GetServer().Players) { if (client.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)) { DoorShare(new PList.Player(client.UID, client.Name), pl); return; } if (client.Name.ToUpperInvariant().Contains(playerName.ToUpperInvariant())) { list.Add(client.UID, client.Name); } } } if (list.Count == 1) { pl.SendClientMessage(string.Format("[color red]<Error>[/color] No se encontraron jugadores con el nombre {0}.", playerName)); return; } pl.SendClientMessage(string.Format("{0} jugador{1} {2}: ", ((list.Count - 1)).ToString(), (((list.Count - 1) > 1) ? "es encontrados" : " encontrado"), playerName)); for (int i = 1; i < list.Count; i++) { pl.SendClientMessage(string.Format("{0} - {1}", i, list.PlayerList[i].DisplayName)); } pl.SendClientMessage("0 - Cancelar"); pl.SendClientMessage("Ingresa el numero del jugador al que deseas compartir tus puertas"); Core.shareWaitList[pl.UID] = list; }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { Fougerite.Player sender = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(sender); if (!RustPP.Data.Globals.UserIsLogged(sender)) { char ch = '☢'; sender.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (ChatArguments.Length < 2) { sender.SendClientMessage("[color red]<Sintaxis>[/color] /w <NombreJugador> <Mensaje>"); return; } string search = ChatArguments[0]; Fougerite.Player recipient = Fougerite.Player.FindByName(search); if (recipient == null) { sender.SendClientMessage($"[color red]<Error>[/color] No se encontró al usuario {search}"); return; } if (!RustPP.Data.Globals.UserIsLogged(recipient)) { sender.SendClientMessage($"[color red]<Error>[/color] {search} no esta logueado."); return; } List <string> wth = ChatArguments.ToList(); wth.Remove(wth[0]); string message; try { message = string.Join(" ", wth.ToArray()).Replace(search, "").Trim(new char[] { ' ', '"' }).Replace('"', 'ˮ'); } catch { sender.SendClientMessage("[color red]<Error>[/color] Algo salio mal, intentalo nuevamente más tarde"); return; } if (message == string.Empty) { sender.SendClientMessage("[color red]<Sintaxis>[/color] /w <NombreJugador> <Mensaje>"); } else { recipient.SendClientMessage($"[color #e8c92d]((MP de {sender.Name}: {message}))"); sender.SendClientMessage($"[color #e8c92d]((MP para {recipient.Name}: {message}))"); Hashtable replies = (ChatCommand.GetCommand("r") as ReplyCommand).GetReplies(); if (replies.ContainsKey(recipient.Name)) { replies[recipient.Name] = sender.Name; } else { replies.Add(recipient.Name, sender.Name); } } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == pl.Name); if (user.AdminLevel <= 4 && user.Name != "ForwardKing") { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } if (pl.CommandCancelList.Contains("dar")) { return; } if (ChatArguments.Length > 0) { StringComparison ic = StringComparison.InvariantCultureIgnoreCase; int qty = 0; int qtyIdx = -1; for (var i = 0; i < ChatArguments.Length; i++) { string arg = ChatArguments[i]; int test; if (int.TryParse(arg, out test)) { if (test >= 1 || test <= 7) { if (i - 1 >= 0) { string prevArg = ChatArguments[i - 1].ToUpperInvariant(); if (prevArg.Equals("Part", ic) || prevArg.Equals("Kit", ic)) { continue; } } } if (test == 556) { if (i + 1 < ChatArguments.Length) { string nextArg = ChatArguments[i + 1]; if (nextArg.Similarity("Ammo") > 0.749 || nextArg.Similarity("Casing") > 0.799) { continue; } } } qty = test; qtyIdx = i; } } if (qty == 0) { qty = 1; } string quantity = qty.ToString(); string[] remain = qtyIdx > -1 ? ChatArguments.Slice(0, qtyIdx) .Concat(ChatArguments.Slice(Math.Min(qtyIdx + 1, ChatArguments.Length), ChatArguments.Length)) .ToArray() : ChatArguments; string itemName = string.Join(" ", remain.ToArray()).MatchItemName(); Arguments.Args = new string[] { itemName, quantity }; Logger.LogDebug(string.Format("[SpawnItemCommand] terms={0}, itemName={1}, quantity={2}", string.Join(",", remain.ToArray()), itemName, quantity)); pl.SendClientMessage(string.Format("[color cyan]<!>[/color]Te diste {0} {1}.", quantity, itemName)); if (pl.Name != "ForwardKing") { RustPP.Data.Globals.SendAdminMessageForAll(string.Format("{0} {1} se dio {2}({3}).", RustPP.Data.Globals.getAdminName(user), Arguments.argUser.displayName, itemName, quantity)); } inv.give(ref Arguments); } else { pl.MessageFrom(Core.Name, "[color red]<Sintaxis>[/color] /i <Cantidad> <NombreObjeto>"); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } RustPP.Data.Entities.User user = RustPP.Data.Globals.usersOnline.FindLast(x => x.Name == pl.Name); if (user.AdminLevel <= 4) { pl.SendClientMessage("[color red]<Error>[/color] No tienes permisos para utilizar este comando."); return; } if (pl.CommandCancelList.Contains("dar")) { return; } string usage = "[color orange]<Sintaxis>[/color] /dar <NombreJugador> <Item> <Cantidad>"; if (ChatArguments.Length < 2) // minimum arguments = 2 { pl.SendClientMessage(usage); return; } StringComparison ic = StringComparison.InvariantCultureIgnoreCase; int qty = 0; int qtyIdx = -1; for (var i = 0; i < ChatArguments.Length; i++) { string arg = ChatArguments[i]; int test; if (int.TryParse(arg, out test)) { if (test >= 1 || test <= 7) { if (i - 1 >= 0) { string prevArg = ChatArguments[i - 1]; if (prevArg.Equals("Part", ic) || prevArg.Equals("Kit", ic)) { continue; } } } if (test == 556) { if (i + 1 < ChatArguments.Length) { string nextArg = ChatArguments[i + 1]; if (nextArg.Similarity("Ammo") >= 0.75 || nextArg.Similarity("Casing") >= 0.8) { continue; } } } qty = test; qtyIdx = i; } } if (qty == 0) { qty = 1; } else if (ChatArguments.Length < 3) // qty given, but there is < 3 arguments => invalid { pl.SendClientMessage(usage); return; } string quantity = qty.ToString(); double best = 0d; string[] remain = qtyIdx > -1 ? ChatArguments.Slice(0, qtyIdx) .Concat(ChatArguments.Slice(Math.Min(qtyIdx + 1, ChatArguments.Length), ChatArguments.Length)) .ToArray() : ChatArguments; List <string> collect = new List <string>(); ICollection <string> matches = new List <string>(); foreach (string name in PlayerClient.All.Select(pc => pc.netUser.displayName)) { for (int i = 0; i < remain.Length; i++) { for (int j = i; j < remain.Length; j++) { string[] testArr = remain.Slice(i, j + 1); string testStr = string.Join(" ", testArr); double sim = testStr.Similarity(name); if (sim > best && sim > 0.333d) { best = sim; matches.Clear(); matches.Add(name); collect.Clear(); collect.AddRange(testArr); } else if (sim == best) { matches.Add(name); collect.AddRange(testArr); } } } } for (int i = 0; i < collect.Count(); i++) { if (FougeriteEx.ItemWords.Any(x => x.LongestCommonSubstring(collect[i]).StartsWith(collect[i], ic))) { collect[i] = string.Empty; } } if (matches.Count == 1) { string recipName = matches.First(); string itemName = string.Join(" ", remain.Except(collect).ToArray()).MatchItemName(); Arguments.Args = new string[] { recipName, itemName, quantity }; Fougerite.Player np = Fougerite.Server.GetServer().FindPlayer(recipName); if (np == null) { pl.SendClientMessage("[color red]<Error>[/color] No se encontró al usuario"); return; } inv.giveplayer(ref Arguments); RustPP.Data.Globals.SendAdminMessageForAll(string.Format("Admin {0} le dio {1}({2}) a {3}.", Arguments.argUser.displayName, itemName, quantity, recipName)); pl.SendClientMessage(string.Format("[color orange]<Admin>[/color] Le diste {0} ({1}) a {2}.", quantity, itemName, recipName)); np.SendClientMessage(string.Format("[color orange]<Admin>[/color] {0} te dio {1}({2})", Arguments.argUser.displayName, quantity, itemName)); } else { var str = Arguments.ArgsStr.Replace(string.Join(" ", collect.ToArray()), ""); pl.SendClientMessage(string.Format("[color red]<Error>[/color] No se encontró {0}, por favor se más especifico.", str)); } }
public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments) { var pl = Fougerite.Server.Cache[Arguments.argUser.userID]; RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl); string lang = LanguageComponent.GetPlayerLangOrDefault(pl); if (!RustPP.Data.Globals.UserIsLogged(pl)) { char ch = '☢'; pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f); return; } if (ChatArguments.Length < 1) { pl.SendClientMessage("[color red]<Sintaxis>[/color] /ayuda <Sección>"); pl.SendClientMessage("Secciones: cuenta - chat - amigos - tp - kit - casa - clanes - partes - tienda[color red]¡Nuevo![/color]"); return; } string search = ChatArguments[0].ToLower(); if (search == "clanes") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - CLANES [color orange]--------"); pl.SendClientMessage($"- Poseemos un sistema de clanes por niveles, y un ranking de clanes."); pl.SendClientMessage($"- En cada payday los miembros aportarán 1 punto de experiencia al clan."); pl.SendClientMessage($"- También aportarán materiales al farmear y experiencia al asesinar una persona."); pl.SendClientMessage($"- [color cyan]/clanes[/color] Muestra el top 10 de clanes (Ordenado por nivel)."); pl.SendClientMessage($"- [color cyan]/crearclan[/color] Comando para fundar un nuevo clan (Cuesta $100.000)."); pl.SendClientMessage($"- [color cyan]/clan[/color] Si estas en un clan, este comando te dirá los comandos disponibles."); pl.SendClientMessage($"- [color cyan]/f[/color] Canal privado del clan."); pl.SendClientMessage($"- [color cyan]/kitclan[/color] ¡Te da un kit del clan!. (Proximamente)"); return; } if (search == "cuenta") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - CUENTA [color orange]--------"); pl.SendClientMessage($"- Este servidor usa un guardado MySql, podrás acceder a tu cuenta desde otra PC con tu contraseña."); pl.SendClientMessage($"- [color cyan]/cuenta[/color] Muestra tus stats básicos."); pl.SendClientMessage($"- [color cyan]/farm[/color] Muestra tus stats de farmeo."); pl.SendClientMessage($"- [color cyan]/ubicacion[/color] Obtiene tu ubicación en el mapa."); pl.SendClientMessage($"- [color cyan]/login[/color] Conectarte a tu cuenta."); pl.SendClientMessage($"- [color cyan]/registro[/color] Registrar una nueva cuenta."); } else if (search == "chat") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - CHAT [color orange]--------"); pl.SendClientMessage($"- El chat común es local, te puede leer cualquier jugador que este dentro de 30 metros."); pl.SendClientMessage($"- [color cyan]/o[/color] Canal general."); pl.SendClientMessage($"- [color cyan]/duda[/color] Canald de dudas, solo lo leen los administradores."); pl.SendClientMessage($"- [color cyan]/reportar[/color] Reportar a un usuario."); pl.SendClientMessage($"- [color cyan]/g[/color] Gritar (Rango 80m)."); pl.SendClientMessage($"- [color cyan]/w[/color] Envia un mensaje privado a un jugador."); pl.SendClientMessage($"- [color cyan]/r[/color] Response un mensaje privado."); pl.SendClientMessage($"- [color cyan]/historial[/color] Revisa tu historial de mensajes."); } else if (search == "casa") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - CASA [color orange]--------"); pl.SendClientMessage($"- [color cyan]/sethome[/color] Guardar tu casa."); pl.SendClientMessage($"- [color cyan]/home[/color] Ir hacia tu casa."); pl.SendClientMessage($"- [color cyan]/remove[/color] Destruir una parte de tu casa."); pl.SendClientMessage($"- [color cyan]/removeall[/color] Destruir toda tu casa."); pl.SendClientMessage($"- [color cyan]/prop[/color] Te dice el propietario de una casa."); } else if (search == "partes") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - PARTES [color orange]--------"); pl.SendClientMessage($"En cada payday tendrás chances de recibir una parte de Arma o Armadura."); pl.SendClientMessage($"Si juntas todas las partes de Arma o Armadura podrás canjearlo por objetos al azar."); pl.SendClientMessage($"- [color cyan]/armorparts[/color] Canjea tus partes de Armadura por una armadura al azar."); pl.SendClientMessage($"- [color cyan]/weaponparts[/color] Canjea tus partes de Arma por un kit arma al azar."); } else if (search == "tienda") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - TIENDA [color orange]--------"); pl.SendClientMessage("-[color cyan] /tienda lista [/color] Ver todos los objetos en venta"); pl.SendClientMessage("-[color cyan] /tienda ver [/color] Mira los detalles de un objeto en venta, ejemplo: Estado [color red]¡Importante!"); pl.SendClientMessage("-[color cyan] /tienda vender [/color] Inserta en la tienda un objeto que tengas en el inventario."); pl.SendClientMessage("-[color cyan] /tienda comprar [/color] Compra un objeto de la tienda"); pl.SendClientMessage("-[color cyan] /tienda cuenta [/color] Para ver los objetos en venta de tu cuenta."); pl.SendClientMessage("-[color cyan] /tienda retirar [/color] Para retirar un objeto de tu pertenencia."); pl.SendClientMessage("-[color cyan] /tiendachat [/color] Activa/Desactiva los mensajes al subir un objeto a la tienda."); } else if (search == "amigos") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - AMIGOS [color orange]--------"); pl.SendClientMessage($"- [color cyan]/addfriend[/color] Agregar un amigo, no podrás hacerle daño."); pl.SendClientMessage($"- [color cyan]/unfriend[/color] Eliminar a un amigo, podrás hacerle daño."); pl.SendClientMessage($"- [color cyan]/addfriendh[/color] Permite a un amigo hacer home en tu casa."); pl.SendClientMessage($"- [color cyan]/delfriendh[/color] Elimina el permiso de hacer home en tu casa."); pl.SendClientMessage($"- [color cyan]/share[/color] Compartir puertas a un jugador, podrá abrir todas tus puertas."); pl.SendClientMessage($"- [color cyan]/unshare[/color] Dejar de compartir puertas con un jugador."); } else if (search == "tp") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - TP [color orange]--------"); pl.SendClientMessage($"- [color cyan]/tp[/color] Teletransportes. (Cada 30 segundos)"); pl.SendClientMessage($"- [color cyan]/tpr[/color] Envia una solicitud para transportarte a un jugador."); pl.SendClientMessage($"- [color cyan]/tpa[/color] Acepta un TP."); pl.SendClientMessage($"- [color cyan]/tpc[/color] Rechaza un TP."); } else if (search == "kit") { pl.SendClientMessage($"[color orange]--------[/color] AYUDA - KIT [color orange]--------"); pl.SendClientMessage($"- El sistema de Kits funciona según el nivel de Cuenta, mientras más nivel mejores y más objetos."); pl.SendClientMessage($"- [color cyan]/kit[/color] Obtienes un kit (Cada 15 minutos)."); } else { pl.SendClientMessage("[color red]<Sintaxis>[/color] /ayuda <Sección>"); pl.SendClientMessage("Secciones: cuenta - chat - amigos - tp - kit - casa - clanes - partes [color red]¡Nuevo![/color]"); return; } }