本文整理汇总了C#中RealmTime类的典型用法代码示例。如果您正苦于以下问题:C# RealmTime类的具体用法?C# RealmTime怎么用?C# RealmTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealmTime类属于命名空间,在下文中一共展示了RealmTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:35,代码来源:Trap.cs
示例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;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:27,代码来源:GuildCommands.cs
示例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);
}
}
}
}
}
}
开发者ID:Club559,项目名称:Mining,代码行数:60,代码来源:Player.Chat.cs
示例4: Death
public void Death(RealmTime time)
{
counter.Death(time);
if (CurrentState != null)
CurrentState.OnDeath(new BehaviorEventArgs(this, time));
Owner.LeaveWorld(this);
}
开发者ID:Jankos132,项目名称:Server-Source,代码行数:7,代码来源:Enemy.cs
示例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;
}
开发者ID:Jankos132,项目名称:Server-Source,代码行数:27,代码来源:AdminCommands.cs
示例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;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:25,代码来源:Tower.cs
示例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;
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:25,代码来源:AdminCommands.cs
示例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;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:32,代码来源:WorldCommand.cs
示例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);
}
开发者ID:Zeroeh,项目名称:PrivateServerOld,代码行数:27,代码来源:Trap.cs
示例10: Tick
public override void Tick(RealmTime time)
{
base.Tick(time); //normal world tick
CheckDupers();
UpdatePortals();
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:Nexus.cs
示例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;
}
}
}
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:31,代码来源:WorldCommand.cs
示例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;
}
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:30,代码来源:Arena.cs
示例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;
}
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:30,代码来源:WorldCommand.cs
示例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);
}
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:32,代码来源:Halo.cs
示例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;
}
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:31,代码来源:Command.cs
示例16: ActivateAbilityShoot
private void ActivateAbilityShoot(RealmTime time, Ability ability, Position target)
{
double arcGap = ability.ArcGap * Math.PI / 180;
double startAngle = Math.Atan2(target.Y - Y, target.X - X) - (ability.NumProjectiles - 1) / 2 * arcGap;
ProjectileDesc prjDesc = ability.Projectiles[0]; //Assume only one
var batch = new Packet[ability.NumProjectiles];
for (int i = 0; i < ability.NumProjectiles; i++)
{
Projectile proj = CreateProjectile(prjDesc, ObjectDesc.ObjectType,
(int)statsMgr.GetAttackDamage(prjDesc.MinDamage, prjDesc.MaxDamage),
time.tickTimes, new Position { X = X, Y = Y }, (float)(startAngle + arcGap * i), 1);
Owner.EnterWorld(proj);
fames.Shoot(proj);
batch[i] = new ShootPacket
{
BulletId = proj.ProjectileId,
OwnerId = Id,
ContainerType = ability.AbilityType,
Position = new Position { X = X, Y = Y },
Angle = proj.Angle,
Damage = (short)proj.Damage,
FromAbility = true
};
}
BroadcastSync(batch, p => this.Dist(p) < 25);
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:27,代码来源:Player.UseAbility.cs
示例17: InventorySwap
public void InventorySwap(RealmTime time, InvSwapPacket pkt)
{
Entity en1 = Owner.GetEntity(pkt.Obj1.ObjectId);
Entity en2 = Owner.GetEntity(pkt.Obj2.ObjectId);
IContainer con1 = en1 as IContainer;
IContainer con2 = en2 as IContainer;
//TODO: locker
Item item1 = con1.Inventory[pkt.Obj1.SlotId];
Item item2 = con2.Inventory[pkt.Obj2.SlotId];
if (!AuditItem(con2, item1, pkt.Obj2.SlotId) ||
!AuditItem(con1, item2, pkt.Obj1.SlotId))
(en1 as Player).Client.SendPacket(new InvResultPacket() { Result = 1 });
else
{
con1.Inventory[pkt.Obj1.SlotId] = item2;
con2.Inventory[pkt.Obj2.SlotId] = item1;
en1.UpdateCount++;
en2.UpdateCount++;
if (en1 is Player)
{
(en1 as Player).CalcBoost();
(en1 as Player).Client.SendPacket(new InvResultPacket() { Result = 0 });
}
if (en2 is Player)
{
(en2 as Player).CalcBoost();
(en2 as Player).Client.SendPacket(new InvResultPacket() { Result = 0 });
}
}
}
开发者ID:lcnvdl,项目名称:rotmg-server,代码行数:32,代码来源:Player.Inventory.cs
示例18: Process
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (!player.Guild.IsDefault)
{
try
{
var saytext = string.Join(" ", args);
if (String.IsNullOrWhiteSpace(saytext))
{
player.SendHelp("Usage: /guild <text>");
return false;
}
else
{
player.Guild.Chat(player, saytext.ToSafeText());
return true;
}
}
catch
{
player.SendInfo("Cannot guild chat!");
return false;
}
}
else
player.SendInfo("You need to be in a guild to use guild chat!");
return false;
}
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:29,代码来源:GuildCommands.cs
示例19: HandleGround
void HandleGround(RealmTime time)
{
if (time.tickTimes - l > 500)
{
if (HasConditionEffect(ConditionEffects.Paused) ||
HasConditionEffect(ConditionEffects.Invincible))
return;
WmapTile tile = Owner.Map[(int)X, (int)Y];
ObjectDesc objDesc = tile.ObjType == 0 ? null : XmlDatas.ObjectDescs[tile.ObjType];
TileDesc tileDesc = XmlDatas.TileDescs[tile.TileId];
if (tileDesc.Damaging && (objDesc == null || !objDesc.ProtectFromGroundDamage))
{
int dmg = Random.Next(tileDesc.MinDamage, tileDesc.MaxDamage);
dmg = (int)statsMgr.GetDefenseDamage(dmg, true);
HP -= dmg;
UpdateCount++;
if (HP <= 0)
Death("lava");
l = time.tickTimes;
}
}
}
开发者ID:patrick323,项目名称:rotmg_svr,代码行数:25,代码来源:Player.Ground.cs
示例20: HandleGround
private void HandleGround(RealmTime time)
{
WmapTile tile = Owner.Map[(int)X, (int)Y];
TileDesc tileDesc = Manager.GameData.Tiles[tile.TileId];
if (time.tickTimes - b > 100)
{
if (Owner.Name != "The Void")
{
if (tileDesc.NoWalk)
{
if (time.tickCount % 30 == 0)
{
client.Disconnect();
}
}
}
if (Owner.Name == "Ocean Trench")
{
bool fObject = false;
foreach (
KeyValuePair<int, StaticObject> i in
Owner.StaticObjects.Where(i => i.Value.ObjectType == 0x0731)
.Where(i => (X - i.Value.X) * (X - i.Value.X) + (Y - i.Value.Y) * (Y - i.Value.Y) < 1))
fObject = true;
OxygenRegen = fObject;
if (!OxygenRegen)
{
if (OxygenBar == 0)
HP -= 2;
else
OxygenBar -= 1;
UpdateCount++;
if (HP <= 0)
Death("server.damage_suffocation");
}
else
{
if (OxygenBar < 100)
OxygenBar += 8;
if (OxygenBar > 100)
OxygenBar = 100;
UpdateCount++;
}
}
Owner.TileEvent(this, tile);
b = time.tickTimes;
}
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:56,代码来源:Player.Ground.cs
注:本文中的RealmTime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论