public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!Variables.KitsHandler.List.Any(x => x.Name == arg1)) { player.SendChatMessage($"<color={errorColor}>That kit doesn't exist.</color>"); return; } var obj = Variables.KitsHandler.List.FirstOrDefault(x => x.Name == arg1); if (!HasPermission.Run(player, obj.ExecutableBy, false, player.player.job.jobIndex)) { player.SendChatMessage($"<color={errorColor}>You do not have access to that kit.</color>"); return; } if (obj.Disabled) { player.SendChatMessage($"<color={errorColor}>That kit is currently disabled.</color>"); return; } if (obj.CurrentlyInCooldown.ContainsKey(player.player.username)) { player.SendChatMessage($"<color={errorColor}>You already used this kit. Please wait</color> <color={argColor}>{obj.CurrentlyInCooldown[player.player.username]}</color> <color={errorColor}>second(s) before executing this command again.</color>"); return; } if (obj.Price > 0) { if (player.player.MyMoneyCount() < obj.Price) { player.SendChatMessage($"<color={errorColor}>You do not have enough money to get this kit. (You have: {player.player.MyMoneyCount()} | Needed: {obj.Price})</color>"); return; } player.player.TransferMoney(DeltaInv.RemoveFromMe, obj.Price, true); } foreach (var item in obj.Items) { player.player.TransferItem(DeltaInv.AddToMe, item.Id, item.Amount, true); } if (obj.Delay > 0) { SvMan.StartCoroutine(Variables.KitsHandler.StartCooldown(player.player.username, obj)); } player.SendChatMessage($"<color={infoColor}>You've been given the kit</color> <color={argColor}>{arg1}</color><color={infoColor}>.{(obj.Delay > 0 ? $" You can get this kit again in {obj.Delay} seconds." : "")}</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!Variables.WarpHandler.List.Any(x => x.Name == arg1)) { player.SendChatMessage($"<color={errorColor}>That warp doesn't exist.</color>"); return; } var obj = Variables.WarpHandler.List.FirstOrDefault(x => x.Name == arg1); if (!HasPermission.Run(player, obj.ExecutableBy, false, player.player.job.jobIndex)) { player.SendChatMessage($"<color={errorColor}>You do not have access to that warp.</color>"); return; } if (obj.Disabled) { player.SendChatMessage($"<color={errorColor}>That warp is currently disabled.</color>"); return; } if (obj.CurrentlyInCooldown.ContainsKey(player.player.username)) { player.SendChatMessage($"<color={errorColor}>You already went to that warp. Please wait</color> <color={argColor}>{obj.CurrentlyInCooldown[player.player.username]}</color> <color={errorColor}>second(s) before executing this command again.</color>"); return; } if (obj.Price > 0) { if (player.player.MyMoneyCount() < obj.Price) { player.SendChatMessage($"<color={errorColor}>You do not have enough money to pay for this warp. (You have: {player.player.MyMoneyCount()} | Needed: {obj.Price})</color>"); return; } player.player.TransferMoney(DeltaInv.RemoveFromMe, obj.Price, true); } player.ResetAndSavePosition(new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z), new Quaternion(obj.Rotation.X, obj.Rotation.Y, obj.Rotation.Z, obj.Rotation.W), obj.Position.PlaceIndex); if (obj.Delay > 0) { SvMan.StartCoroutine(Variables.WarpHandler.StartCooldown(player.player.username, obj)); } player.SendChatMessage($"<color={infoColor}>You've been teleported to the warp named</color> <color={argColor}>{arg1}</color><color={infoColor}>.{(obj.Delay > 0 ? $" You can teleport to this warp again in {obj.Delay} seconds." : "")}</color>"); }
public static void Run(SvPlayer player, string message) { var kits = Variables.KitsHandler.List.Where(x => !x.Disabled && HasPermission.Run(player, x.ExecutableBy, false, player.player.job.jobIndex)).Select(n => n.Name + $"{(n.Price != 0 ? $" ({n.Price})" : "")}").ToArray(); //linq rocks, and yes this was an very important comment. player.SendChatMessage($"<color={infoColor}>Kits you can obtain ({kits.Length}):</color> <color={argColor}>{(kits == null || kits.Length == 0 ? "none" : string.Join(", ", kits))}</color>"); }
public static void Run(SvPlayer player, string message) { var warps = Variables.WarpHandler.List.Where(x => !x.Disabled && HasPermission.Run(player, x.ExecutableBy, false, player.player.job.jobIndex)).Select(n => n.Name + $"{(n.Price != 0 ? $" ({n.Price})" : "")}").ToArray(); player.SendChatMessage($"<color={infoColor}>Warps you can teleport to ({warps.Length}):</color> <color={argColor}>{(warps == null || warps.Length == 0 ? "none" : string.Join(", ", warps))}</color>"); }