internal void DoWarp(Warp WData) { // Set the warp info up. startTime = DateTime.Now; wData = WData; lastLocation = Player.Position; // Grab time to wait. List<RocketPermissionsGroup> groups = R.Permissions.GetGroups(Player, false); if (groups.Count != 0) { if (!Warps.WaitGroups.TryGetValue(groups[0].Id, out timetoWait)) if (!Warps.WaitGroups.TryGetValue("all", out timetoWait)) { Logger.LogWarning("Error: Was Unable to get time to wait on player, using default of 10 seconds."); timetoWait = 10; } } else { Logger.LogWarning("Error: Was Unable to get time to wait on player, using default of 10 seconds."); timetoWait = 10; } if (Warps.Instance.Configuration.Instance.EnableMovementRestriction) UnturnedChat.Say(Player, Warps.Instance.Translate("warp_wait_nomovement", wData.Name, timetoWait)); else UnturnedChat.Say(Player, Warps.Instance.Translate("warp_wait", wData.Name, timetoWait)); doWarp = true; }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length == 0 || command.Length > 1) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_help")); return; } string warpName = command[0].Sanitze().Trim(); if (warpName == string.Empty) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_not_set")); return; } Warp warpData = new Warp(); UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller; warpData.Name = warpName; warpData.SetterCharName = unturnedCaller.CharacterName.Sanitze(); warpData.SetterSteamName = unturnedCaller.SteamName.Sanitze(); warpData.SetterCSteamID = unturnedCaller.CSteamID; warpData.World = Warps.MapName; warpData.Rotation = unturnedCaller.Rotation; warpData.Location = unturnedCaller.Position; if (Warps.CheckUconomy()) { if (Warps.Instance.Configuration.Instance.SetWarpChargeEnable && Warps.Instance.Configuration.Instance.SetWarpCost > 0.00m) { if (!Warps.TryCharge(caller, Warps.Instance.Configuration.Instance.SetWarpCost)) { return; } } } if (Warps.warpsData.SetWarp(warpData)) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_set")); return; } else { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_not_set")); return; } }
public bool SetWarp(Warp warpData) { try { if (WarpsData.ContainsKey(warpData.GetKey())) { WarpsData.Remove(warpData.GetKey()); } WarpsData.Add(warpData.GetKey(), warpData); SaveWarps(); return(true); } catch (Exception ex) { Logger.LogException(ex, "Error: Unable to set warp."); return(false); } }
public bool SetWarp(Warp warpData) { try { if (WarpsData.ContainsKey(warpData.GetKey())) { WarpsData.Remove(warpData.GetKey()); } WarpsData.Add(warpData.GetKey(), warpData); SaveWarps(); return true; } catch (Exception ex) { Logger.LogException(ex, "Error: Unable to set warp."); return false; } }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length == 0 || command.Length > 1) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_help")); return; } string warpName = command[0].Sanitze().Trim(); if (warpName == string.Empty) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_not_set")); return; } Warp warpData = new Warp(); UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller; warpData.Name = warpName; warpData.SetterCharName = unturnedCaller.CharacterName.Sanitze(); warpData.SetterSteamName = unturnedCaller.SteamName.Sanitze(); warpData.SetterCSteamID = unturnedCaller.CSteamID; warpData.World = Warps.MapName; warpData.Rotation = unturnedCaller.Rotation; warpData.Location = unturnedCaller.Position; if (Warps.CheckUconomy()) if (Warps.Instance.Configuration.Instance.SetWarpChargeEnable && Warps.Instance.Configuration.Instance.SetWarpCost > 0.00m) if (!Warps.TryCharge(caller, Warps.Instance.Configuration.Instance.SetWarpCost)) return; if (Warps.warpsData.SetWarp(warpData)) { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_set")); return; } else { UnturnedChat.Say(caller, Warps.Instance.Translate("setwarp_not_set")); return; } }
internal void DoWarp(Warp WData) { // Set the warp info up. startTime = DateTime.Now; wData = WData; lastLocation = Player.Position; // Grab time to wait. List <RocketPermissionsGroup> groups = R.Permissions.GetGroups(Player, false); if (groups.Count != 0) { if (!Warps.WaitGroups.TryGetValue(groups[0].Id, out timetoWait)) { if (!Warps.WaitGroups.TryGetValue("all", out timetoWait)) { Logger.LogWarning("Error: Was Unable to get time to wait on player, using default of 10 seconds."); timetoWait = 10; } } } else { Logger.LogWarning("Error: Was Unable to get time to wait on player, using default of 10 seconds."); timetoWait = 10; } if (Warps.Instance.Configuration.Instance.EnableMovementRestriction) { UnturnedChat.Say(Player, Warps.Instance.Translate("warp_wait_nomovement", wData.Name, timetoWait)); } else { UnturnedChat.Say(Player, Warps.Instance.Translate("warp_wait", wData.Name, timetoWait)); } doWarp = true; }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length == 0 || command.Length > 2) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_help")); return; } Warp warp = Warps.warpsData.GetWarp(command[0]); UnturnedPlayer unturnedTarget = command.GetUnturnedPlayerParameter(1); if (warp != null) { if (unturnedTarget != null && (caller.HasPermission("warp.other") || SteamAdminlist.checkAdmin(caller is ConsolePlayer ? CSteamID.Nil : (CSteamID)ulong.Parse(caller.Id)))) { if (unturnedTarget.Stance == EPlayerStance.DRIVING || unturnedTarget.Stance == EPlayerStance.SITTING) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_cant_warp_in_car")); return; } if (Warps.CheckUconomy()) { if (Warps.Instance.Configuration.Instance.WarpOtherChargeEnable && Warps.Instance.Configuration.Instance.WarpOtherCost > 0.00m) { if (!Warps.TryCharge(caller, Warps.Instance.Configuration.Instance.WarpOtherCost)) { return; } } } unturnedTarget.Teleport(warp.Location, warp.Rotation); UnturnedChat.Say(caller, Warps.Instance.Translate("admin_warp", unturnedTarget.CharacterName, warp.Name)); Logger.Log(Warps.Instance.Translate("admin_warp_log", caller.DisplayName, caller.Id, unturnedTarget.CharacterName, warp.Name)); UnturnedChat.Say(unturnedTarget, Warps.Instance.Translate("player_warp", warp.Name)); return; } else if (unturnedTarget != null) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_other_not_allowed")); return; } if (unturnedTarget == null && command.Length == 2) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_cant_find_player")); return; } else if (caller is ConsolePlayer) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_console_no_player")); return; } else { UnturnedPlayer unturnedCaller = (UnturnedPlayer)caller; if (unturnedCaller.Stance == EPlayerStance.DRIVING || unturnedCaller.Stance == EPlayerStance.SITTING) { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_cant_warp_in_car")); return; } if (Warps.Instance.Configuration.Instance.EnableWaitGroups) { if (Warps.CheckUconomy()) { if (Warps.Instance.Configuration.Instance.WarpCargeEnable && Warps.Instance.Configuration.Instance.WarpCost > 0.00m) { if (!Warps.TryCharge(caller, Warps.Instance.Configuration.Instance.WarpCost, true)) { return; } } } WarpsPlayerComponent wpc = unturnedCaller.GetComponent <WarpsPlayerComponent>(); wpc.DoWarp(warp); return; } else { if (Warps.CheckUconomy()) { if (Warps.Instance.Configuration.Instance.WarpCargeEnable && Warps.Instance.Configuration.Instance.WarpCost > 0.00m) { if (!Warps.TryCharge(caller, Warps.Instance.Configuration.Instance.WarpCost)) { return; } } } unturnedCaller.Teleport(warp.Location, warp.Rotation); UnturnedChat.Say(caller, Warps.Instance.Translate("player_warp", warp.Name)); return; } } } else { UnturnedChat.Say(caller, Warps.Instance.Translate("warp_cant_find_warp", command[0])); return; } }