本文整理汇总了C#中IRocketPlayer类的典型用法代码示例。如果您正苦于以下问题:C# IRocketPlayer类的具体用法?C# IRocketPlayer怎么用?C# IRocketPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRocketPlayer类属于命名空间,在下文中一共展示了IRocketPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
if (command.Length == 0)
{
UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("ltps_command_help"));
return;
}
int limitTPS;
if (command.Length == 1 && int.TryParse(command[0], out limitTPS))
{
//limit the minimum tps that can be used above a value of 0, but less than 10, to 10.
if (limitTPS > 0 && limitTPS < 10)
{
limitTPS = 10;
}
UnityEngine.Application.targetFrameRate = limitTPS;
if (!(caller is ConsolePlayer))
{
UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("tps_set", limitTPS));
}
Logger.Log(FPSCap.Instance.Translations.Instance.Translate("tps_set", limitTPS));
}
else
{
UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("invalid_arg"));
return;
}
}
示例2: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
UnturnedChat.Say(caller, "Rocket Regions by Trojaner [SteamID: ]", Color.cyan);
UnturnedChat.Say(caller, "Available under GNU Affero General Public License v3", Color.cyan);
UnturnedChat.Say(caller, "Copyright © 2015-2016 Trojaner", Color.cyan);
UnturnedChat.Say(caller, "Source code available under http://github.com/Trojaner25/Rocket-Regions", Color.cyan);
}
示例3: Execute
// Run the command.
public void Execute(IRocketPlayer caller, string[] command)
{
UnturnedChat.Say(Feast.Instance.Translate("now_feast_msg", new object[] {
Feast.Instance.nextLocation.Name
}), UnturnedChat.GetColorFromName(Feast.Instance.Configuration.Instance.MessageColor, Color.red));
Feast.Instance.runFeast();
}
示例4: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
if (command.Length != 1)
{
UnturnedChat.Say(caller, "You must enter a player name!");
return;
}
UnturnedPlayer player = (UnturnedPlayer)caller;
if (player == null)
{
return;
}
UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[0]);
if (otherPlayer == null)
{
UnturnedChat.Say(caller, "Could not find player by the name of " + command[0]);
return;
}
player.Features.VanishMode = true;
player.Teleport(otherPlayer);
UnturnedChat.Say(caller, "You AdminTP'd to " + otherPlayer.DisplayName);
Logger.Log("Player " + player.DisplayName + " AdminTp'd to " + otherPlayer.DisplayName);
}
示例5: GetCSteamId
public static CSteamID GetCSteamId(IRocketPlayer player)
{
if (player == null) return CSteamID.Nil;
//for some reason one of the fiels below can be null
var steamPlayerId= GetUnturnedPlayer(player)?.Player?.channel?.owner?.playerID;
return steamPlayerId?.steamID ?? CSteamID.Nil;
}
示例6: GetPermissions
public List<Permission> GetPermissions(IRocketPlayer player, List<string> requestedPermissions)
{
List<Permission> playerPermissions = GetPermissions(player);
playerPermissions.ForEach((Permission p) => { p.Name = p.Name.ToLower(); });
List<Permission> applyingPermissions = playerPermissions.Where(p => requestedPermissions.Contains(p.Name)).ToList();
if (playerPermissions.Where(p => p.Name == "*").FirstOrDefault() != null) applyingPermissions.Add(new Permission("*"));
foreach (Permission p in playerPermissions)
{
string pb = p.Name;
if (pb.Contains(".")) pb = p.Name.Substring(0, p.Name.IndexOf('.'));
if (p.Name.EndsWith(".*")) //Player permission is a wildcard permission
{
foreach (string ps in requestedPermissions)
{
string b = ps;
if (ps.Contains("."))
b = ps.Substring(0, ps.IndexOf('.')).ToLower();
if (ps.StartsWith(pb + ".")) //Check if wildcard base pb is the start of this permission
{
applyingPermissions.Add(p);
}
}
}
//Grant base permission if required
requestedPermissions.Where(ps => ps == pb).ToList().ForEach((ap) => { applyingPermissions.Add(p); });
}
return applyingPermissions;
}
示例7: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
if (command.Length == 0)
{
this.SendUsage(caller);
return;
}
var name = command.GetStringParameter(0);
var region = RegionsPlugin.Instance.GetRegion(name);
if (region == null)
{
UnturnedChat.Say(caller, "Region \"" + name + "\" not found", Color.red);
return;
}
if (!region.IsOwner(caller) && !PermissionUtil.HasPermission(caller, "remove.override"))
{
UnturnedChat.Say(caller, "You're not the owner of this region!", Color.red);
return;
}
RegionsPlugin.Instance.Regions.Remove(region);
RegionsPlugin.Instance.Configuration.Save();
RegionsPlugin.Instance.OnRegionRemoved(region);
UnturnedChat.Say(caller, "Successfully removed region: " + name, Color.green);
}
示例8: DropMagsWithLimit
public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
{
if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
{
UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("dropping_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
{
ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
}
}
else
{
UnturnedItems.GetItemAssetById(1);
ushort amountoverlimit = ammoAmountToSpawn;
ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;
UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_dropping", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
{
ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
}
}
}
示例9: GetPermissions
public List<Permission> GetPermissions(IRocketPlayer player)
{
List<Permission> UserGroup = new List<Permission>();
Permission Usergroup = new Permission(string.Join(" ", LIGHT.Instance.Database.getGroupPermission(LIGHT.Instance.Database.CheckUserGroup(player.Id))), LIGHT.Instance.Database.Cooldown(LIGHT.Instance.Database.CheckUserGroup(player.Id)));
UserGroup.Add(Usergroup);
return UserGroup;
}
示例10: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
if (caller is UnturnedPlayer && command.Length != 1)
{
UnturnedPlayer player = (UnturnedPlayer)caller;
player.Heal(100);
player.Bleeding = false;
player.Broken = false;
player.Infection = 0;
player.Hunger = 0;
player.Thirst = 0;
UnturnedChat.Say(player, U.Translate("command_heal_success"));
}
else
{
UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[0]);
if (otherPlayer != null)
{
otherPlayer.Heal(100);
otherPlayer.Bleeding = false;
otherPlayer.Broken = false;
otherPlayer.Infection = 0;
otherPlayer.Hunger = 0;
otherPlayer.Thirst = 0;
UnturnedChat.Say(caller, U.Translate("command_heal_success_me", otherPlayer.CharacterName));
if(caller != null)
UnturnedChat.Say(otherPlayer, U.Translate("command_heal_success_other", caller.DisplayName));
}
else
{
UnturnedChat.Say(caller, U.Translate("command_generic_target_player_not_found"));
}
}
}
示例11: Execute
public void Execute(IRocketPlayer caller, params string[] command)
{
if (command.Length != 1)
{
UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_generic_invalid_parameter"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
return;
}
try
{
ThePunisher.Instance.Database.UnbanBanPlayer(command[0]);
if (!SteamBlacklist.unban(ThePunisher.Instance.Database.GetPlayerSteamId(command[0])) && ThePunisher.Instance.Database.GetPlayerIdAndName(command[0]).Length <=0)
{
UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_generic_player_not_found"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
return;
}
else
{
UnturnedChat.Say(ThePunisher.Instance.Translate("command_unban_public", ThePunisher.Instance.Database.GetPlayerIdAndName(command[0])[0]), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PublicMessageColor));
}
}
catch
{
UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_unban_player_not_found"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
return;
}
}
示例12: addPlayerComponents
private void addPlayerComponents(IRocketPlayer p)
{
foreach (Type component in unturnedPlayerComponents)
{
((UnturnedPlayer)p).Player.gameObject.AddComponent(component);
}
}
示例13: SetGroup
public bool SetGroup(IRocketPlayer caller , string group)
{
bool Result = false;
if (LIGHT.Instance.Database.CheckGroup(group))
{
UnturnedPlayer target = (UnturnedPlayer)caller;
if (target != null)
{
LIGHT.Instance.Database.AddUserIntoGroup(caller.Id, group);
UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_added_user", target.SteamName, group));
Result = true;
}
else
{
UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_fail_nouser"));
Result = false;
}
}
else
{
UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_fail_nogroup"));
Result = false;
}
return Result;
}
示例14: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
IRocketPlayer p = (IRocketPlayer)UnturnedPlayer.FromName(command[3]);
if (p == null)
{
UnturnedChat.Say(caller, "player not found!");
return;
}
if (EffectRepeater.Instance.activeThreads.ContainsKey(p.Id))
{
UnturnedChat.Say(caller, p.DisplayName + " already has a effect on them!");
UnturnedChat.Say(caller, "use /killeffect " + "\"" + p.DisplayName + "\" to stop their effect" );
return;
}
//int times;
//double delay;
//ushort id;
effectData eD = new effectData();
int.TryParse(command[0], out eD.TimeToPlay);
double.TryParse(command[1], out eD.Delay);
ushort.TryParse(command[2], out eD.Id);
eD.IRocketPlayer = p;
EffectRepeater.Instance.StartThread(eD);
UnturnedChat.Say(caller, "added effect " + eD.Id.ToString() + " to " + p.DisplayName + " with interval of " + eD.Delay.ToString() + " for " + eD.TimeToPlay.ToString() + " times!");
}
示例15: Execute
public void Execute(IRocketPlayer caller, string[] command)
{
UnturnedPlayer player = (UnturnedPlayer)caller;
if (player == null)
{
Logger.Log("This command cannot be called from the console.");
return;
}
if (!Main.OnCooldown(player) && Main.Connected == true)
{
var shorten = Main.ShortenUrl("http://motdgd.com/motd/?user=" + Main.Instance.Configuration.Instance.User_ID + "&gm=minecraft&clt_user=" + player.CSteamID + "&srv_id=" + Main.Server_ID);
if (shorten != "")
{
UnturnedChat.Say(player, "For getting reward go to: " + shorten);
}
else
{
UnturnedChat.Say(player, "There was error with shortening URL. Contact your server administrator.");
}
}
else if (Main.OnCooldown(player))
{
UnturnedChat.Say(player, "You are on cooldown.");
}
else if (Main.Connected == false)
{
UnturnedChat.Say(player, "There was error while connecting to HUB. Try again later.");
}
else
{
UnturnedChat.Say(player, "Error while processing your request.");
}
}