本文整理汇总了C#中wServer.realm.entities.Player.SendError方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendError方法的具体用法?C# Player.SendError怎么用?C# Player.SendError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wServer.realm.entities.Player
的用法示例。
在下文中一共展示了Player.SendError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
protected override bool Process(Player player, RealmTime time, string args)
{
ConditionEffectIndex effect;
if (!Enum.TryParse(args, true, out effect))
{
player.SendError("Invalid effect!");
return false;
}
if ((player.ConditionEffects & (ConditionEffects)(1 << (int)effect)) != 0)
{
//remove
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = effect,
DurationMS = 0
});
}
else
{
//add
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = effect,
DurationMS = -1
});
}
return true;
}
示例2: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.Guild != "")
try
{
var saytext = string.Join(" ", args);
if ((from w in player.Manager.Worlds let world = w.Value where w.Key != 0 from i in world.Players.Where(i => i.Value.Guild == player.Guild) select world).Any())
{
if (saytext.Equals(" ") || saytext == "")
{
player.SendHelp("Usage: /guild <text>");
return false;
}
player.Manager.Chat.SayGuild(player, saytext.ToSafeText());
return true;
}
}
catch(Exception e)
{
player.SendError(e.ToString());
player.SendInfo("Cannot guild chat!");
return false;
}
else
player.SendInfo("You need to be in a guild to use guild chat!");
return false;
}
示例3: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.HasConditionEffect(ConditionEffects.Paused))
{
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = ConditionEffectIndex.Paused,
DurationMS = 0
});
player.SendInfo("Game resumed.");
return true;
}
else
{
if (player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>().Any())
{
player.SendError("Not safe to pause.");
return false;
}
else
{
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = ConditionEffectIndex.Paused,
DurationMS = -1
});
player.SendInfo("Game paused.");
return true;
}
}
}
示例4: Execute
public bool Execute(Player player, RealmTime time, string args)
{
if (!HasPermission(player))
{
player.SendError("No permission!");
return false;
}
try
{
return Process(player, time, args);
}
catch (Exception ex)
{
log.Error("Error when executing the command.", ex);
player.SendError("Error when executing the command.");
return false;
}
}
示例5: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.Quest == null)
{
player.SendError("Player does not have a quest!");
return false;
}
player.SendInfo("Quest location: (" + player.Quest.X + ", " + player.Quest.Y + ")");
return true;
}
示例6: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.Name.EqualsIgnoreCase(args))
{
player.SendInfo("You are already at yourself, and always will be!");
return false;
}
if (player.Owner.AllowTeleport == false)
{
player.SendError("You are not allowed to teleport in this area!");
return false;
}
foreach (var i in player.Owner.Players)
{
if (i.Value.Name.EqualsIgnoreCase(args))
{
if (i.Value.isNotVisible)
{
player.SendInfo(string.Format("Unable to find player: {0}", args));
return false;
}
if (i.Value.HasConditionEffect(ConditionEffects.Invisible))
{
player.SendError("You can't teleport to invisible players");
return false;
}
player.Teleport(time, i.Value.Id);
return true;
}
}
player.SendInfo(string.Format("Unable to find player: {0}", args));
return false;
}
示例7: Process
protected override bool Process(Player player, RealmTime time, string args)
{
var index = args.IndexOf(' ');
int num;
var name = args;
string extras = "";
if (name.Split('%').Length > 1)
{
extras = name.Split('%')[1].Trim();
name = name.Split('%')[0].Trim();
}
if (args.IndexOf(' ') > 0 && int.TryParse(args.Substring(0, args.IndexOf(' ')), out num)) //multi
name = args.Substring(index + 1);
else
num = 1;
ushort objType;
if (!player.Manager.GameData.IdToObjectType.TryGetValue(name, out objType) ||
!player.Manager.GameData.ObjectDescs.ContainsKey(objType))
{
player.SendError("Unknown entity!");
return false;
}
for (var i = 0; i < num; i++)
{
var entity = Entity.Resolve(player.Manager, objType);
entity.Move(player.X, player.Y);
foreach (string item in extras.Split(';'))
{
string[] kv = item.Split(':');
switch (kv[0])
{
case "name":
entity.Name = kv[1];
break;
case "size":
entity.Size = Utils.FromString(kv[1]);
break;
case "eff":
entity.ConditionEffects = (ConditionEffects)Utils.FromString(kv[1]);
break;
case "conn":
(entity as ConnectedObject).Connection =
ConnectionInfo.Infos[(uint)Utils.FromString(kv[1])];
break;
case "mtype":
(entity as Merchants).Custom = true;
(entity as Merchants).MType = Utils.FromString(kv[1]);
break;
case "mcount":
(entity as Merchants).MRemaining = Utils.FromString(kv[1]);
break;
case "mtime":
(entity as Merchants).MTime = Utils.FromString(kv[1]);
break;
case "mcost":
(entity as SellableObject).Price = Utils.FromString(kv[1]);
break;
case "mcur":
(entity as SellableObject).Currency = (CurrencyType)Utils.FromString(kv[1]);
break;
case "stars":
(entity as SellableObject).RankReq = Utils.FromString(kv[1]);
break;
//case "nstar":
// entity.Stats[StatsType.NameChangerStar] = Utils.FromString(kv[1]); break;
}
}
player.Owner.EnterWorld(entity);
}
if (num > 1)
if (!args.ToLower().EndsWith("s"))
player.SendInfo("Sucessfully spawned " + num + " : " +
CultureInfo.CurrentCulture.TextInfo.ToTitleCase(
args.Substring(index + 1).ToLower() + "s"));
else
player.SendInfo("Sucessfully spawned " + num + " : " +
CultureInfo.CurrentCulture.TextInfo.ToTitleCase(
args.Substring(index + 1).ToLower() + "'"));
else
player.SendInfo("Sucessfully spawned " + num + " : " +
CultureInfo.CurrentCulture.TextInfo.ToTitleCase(args.ToLower()));
return true;
}