本文整理汇总了C#中RealmTime类的典型用法代码示例。如果您正苦于以下问题:C# RealmTime类的具体用法?C# RealmTime怎么用?C# RealmTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealmTime类属于命名空间,在下文中一共展示了RealmTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tick
public override void Tick(RealmTime time)
{
if (t/500 == p)
{
Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Trap,
Color = new ARGB(0xff9000ff),
TargetId = Id,
PosA = new Position {X = radius/2}
}, null);
p++;
if (p == LIFETIME*2)
{
Explode(time);
return;
}
}
t += time.thisTickTimes;
bool monsterNearby = false;
if (player.PvP)
this.AOE(radius/2, true, enemy =>
{
var plr = (enemy as Player);
if (!plr.PvP || (plr.PvP && plr.Team != 0 && plr.Team == player.Team) || plr == player)
return;
monsterNearby = true;
});
this.AOE(radius/2, false, enemy => monsterNearby = true);
if (monsterNearby)
Explode(time);
base.Tick(time);
}
示例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: PlayerText
public void PlayerText(RealmTime time, PlayerTextPacket pkt)
{
if (pkt.Text[0] == '/')
{
string[] x = pkt.Text.Trim().Split(' ');
ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
//CommandManager.Execute(this, time, pkt.Text); // Beta Processor
}
else
{
string txt = Encoding.ASCII.GetString(
Encoding.Convert(
Encoding.UTF8,
Encoding.GetEncoding(
Encoding.ASCII.EncodingName,
new EncoderReplacementFallback(string.Empty),
new DecoderExceptionFallback()
),
Encoding.UTF8.GetBytes(pkt.Text)
)
);
if (txt != "")
{
//Removing unwanted crashing characters from strings
string chatColor = "";
if (Client.Account.Rank > 3)
chatColor = "@";
else if (Client.Account.Rank == 3)
chatColor = "#";
foreach (var i in RealmManager.Worlds)
{
if (i.Key != 0)
{
i.Value.BroadcastPacket(new TextPacket()
{
Name = chatColor + Name,
ObjectId = Id,
Stars = Stars,
BubbleTime = 5,
Recipient = "",
Text = txt,
CleanText = txt
}, null);
}
}
foreach (var e in Owner.Enemies)
{
foreach (var b in e.Value.CondBehaviors)
{
if (b.Condition == BehaviorCondition.OnChat)
{
b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text);
b.Behave(BehaviorCondition.OnChat, e.Value, time, null, pkt.Text, this);
}
}
}
}
}
}
示例4: Death
public void Death(RealmTime time)
{
counter.Death(time);
if (CurrentState != null)
CurrentState.OnDeath(new BehaviorEventArgs(this, time));
Owner.LeaveWorld(this);
}
示例5: Process
protected override bool Process(Player player, RealmTime time, string args)
{
int index = args.IndexOf(' ');
int num;
string name = args;
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 (int i = 0; i < num; i++)
{
var entity = Entity.Resolve(player.Manager, objType);
entity.Move(player.X, player.Y);
player.Owner.EnterWorld(entity);
}
return true;
}
示例6: Tick
public override void Tick(RealmTime time)
{
base.Tick(time);
if (MainPlayer == null)
return;
if (Cleared)
return;
bool foundBoss = false;
foreach (var i in Enemies.Values)
if (i.ObjectDesc != null && i.ObjectDesc.ObjectId == FloorBosses[Floor])
foundBoss = true;
if(foundBoss)
return;
if(MainPlayer.Floors < Floor)
{
if (Floor == Tower.FLOORS)
foreach (var i in Manager.Clients.Values)
if (i.Player != null)
i.Player.SendInfo(MainPlayer.Name + " has cleared the tower!");
MainPlayer.Floors = Floor;
MainPlayer.SaveToCharacter();
MainPlayer.Client.Save();
}
Cleared = true;
}
示例7: Process
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length == 0)
{
player.SendHelp("Usage: /addeff <Effectname or Effectnumber>");
return false;
}
try
{
player.ApplyConditionEffect(new ConditionEffect
{
Effect = (ConditionEffectIndex)Enum.Parse(typeof(ConditionEffectIndex), args[0].Trim(), true),
DurationMS = -1
});
{
player.SendInfo("Success!");
}
}
catch
{
player.SendError("Invalid effect!");
return false;
}
return true;
}
示例8: Process
protected override bool Process(Player player, RealmTime time, string args)
{
Command[] cmds = player.Manager.Commands.Commands.Values
.Where(x => x.HasPermission(player))
.ToArray();
int curPage = (args != "") ? Convert.ToInt32(args) : 1;
double maxPage = Math.Floor((double) cmds.Length/10);
if (curPage > maxPage + 1)
curPage = (int) maxPage + 1;
if (curPage < 1)
curPage = 1;
var sb = new StringBuilder(string.Format("Commands <Page {0}/{1}>: \n", curPage, maxPage + 1));
int y = (curPage - 1) * 10;
int z = y + 10;
int commands = cmds.Length;
if (z > commands)
{
z = commands;
}
for (int i = y; i < z; i++)
{
sb.Append(string.Format("[/{0}{1}]{2}", cmds[i].CommandName, (cmds[i].CommandUsage != "" ? " " + cmds[i].CommandUsage : null), (cmds[i].CommandDesc != "" ? ": " + cmds[i].CommandDesc : null)) + "\n");
}
player.SendHelp(sb.ToString());
return true;
}
示例9: Tick
public override void Tick(RealmTime time)
{
if (t / 500 == p)
{
Owner.BroadcastPacket(new ShowEffectPacket()
{
EffectType = EffectType.Trap,
Color = new ARGB(0xff9000ff),
TargetId = Id,
PosA = new Position() { X = radius / 2 }
}, null);
p++;
if (p == LIFETIME * 2)
{
Explode(time);
return;
}
}
t += time.thisTickTimes;
bool monsterNearby = false;
Behavior.AOE(Owner, this, radius / 2, false, enemy => monsterNearby = true);
if (monsterNearby)
Explode(time);
base.Tick(time);
}
示例10: Tick
public override void Tick(RealmTime time)
{
base.Tick(time); //normal world tick
CheckDupers();
UpdatePortals();
}
示例11: 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;
}
}
}
示例12: Tick
public override void Tick(RealmTime time)
{
base.Tick(time);
CheckOutOfBounds();
if (CheckPopulation())
{
if (ready)
{
if (waiting) return;
ready = false;
wave++;
foreach (KeyValuePair<int, Player> i in Players)
{
i.Value.Client.SendPacket(new ArenaNextWavePacket
{
Type = wave
});
}
waiting = true;
Timers.Add(new WorldTimer(5000, (world, t) =>
{
ready = false;
Spawn();
waiting = false;
}));
}
ready = true;
}
}
示例13: Process
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (player.HasConditionEffect(ConditionEffectIndex.Paused))
{
player.ApplyConditionEffect(new ConditionEffect
{
Effect = ConditionEffectIndex.Paused,
DurationMS = 0
});
player.SendInfo("Game resumed.");
}
else
{
foreach (Enemy i in player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>())
{
if (i.ObjectDesc.Enemy)
{
player.SendInfo("Not safe to pause.");
return false;
}
}
player.ApplyConditionEffect(new ConditionEffect
{
Effect = ConditionEffectIndex.Paused,
DurationMS = -1
});
player.SendInfo("Game paused.");
}
return true;
}
示例14: Tick
public override void Tick(RealmTime time)
{
if (t/500 == p2)
{
Owner.BroadcastPacket(new ShowEffectPacket
{
EffectType = EffectType.Trap,
Color = new ARGB(0xffd700),
TargetId = Id,
PosA = new Position {X = radius}
}, null);
p2++;
//Stuff
}
if (t/2000 == p)
{
var pkts = new List<Packet>();
BehaviorBase.AOE(Owner, this, radius, true,
player => { Player.ActivateHealHp(player as Player, amount, pkts); });
pkts.Add(new ShowEffectPacket
{
EffectType = EffectType.AreaBlast,
TargetId = Id,
Color = new ARGB(0xffd700),
PosA = new Position {X = radius}
});
Owner.BroadcastPackets(pkts, null);
p++;
}
t += time.thisTickTimes;
base.Tick(time);
}
示例15: Execute
public bool Execute(Player player, RealmTime time, string args)
{
if (!HasPermission(player))
{
player.SendInfo("You are not an Admin");
return false;
}
try
{
string[] a = args.Split(' ');
bool success = Process(player, time, a);
if (success)
player.Manager.Database.DoActionAsync(db =>
{
var cmd = db.CreateQuery();
cmd.CommandText = "insert into commandlog (command, args, player) values (@command, @args, @player);";
cmd.Parameters.AddWithValue("@command", CommandName);
cmd.Parameters.AddWithValue("@args", args);
cmd.Parameters.AddWithValue("@player", $"{player.AccountId}:{player.Name}");
cmd.ExecuteNonQuery();
});
return success;
}
catch (Exception ex)
{
logger.Error("Error when executing the command.", ex);
player.SendError("Error when executing the command.");
return false;
}
}