protected ConcurrentArrayList <Entities.GameClient> GetPossibleTargets() { ConcurrentArrayList <Entities.GameClient> Targets = new ConcurrentArrayList <GameClient>(); if (Screen.MapObjects.Count == 0) { return(Targets); } foreach (Maps.IMapObject MapObject in Screen.MapObjects.Values) { if (ProtectedPlayers.Contains((MapObject as Entities.GameClient))) { continue; } if (MapObject is Entities.GameClient) { if ((MapObject as Entities.GameClient).Alive) { Targets.Add(MapObject as Entities.GameClient); } } } return(Targets); }
public static void JoinArena(Entities.GameClient Player) { if (Player.Battle != null) { return; } if (Player.DynamicMap != null) { return; } if (Player.ArenaMatch != null) { return; } if (PlayerQueue.Contains(Player)) { Player.Arena.Status = Enums.ArenaStatus.NotSignedUp; using (var wait = Player.Arena.Build()) Player.Send(wait); Player.Arena.Status = Enums.ArenaStatus.WaitingForOpponent; using (var wait = Player.Arena.Build()) Player.Send(wait); } else { Player.Arena.Status = Enums.ArenaStatus.WaitingForOpponent; using (var wait = Player.Arena.Build()) Player.Send(wait); } if (MatchQueue.Count > 0) { using (var matches = new Packets.ArenaBattleInfoPacket(MatchQueue.ToDictionary().Values.ToArray())) { matches.Page = 1; matches.SetSize(); Player.Send(matches); } } PlayerQueue.Add(Player); uint DelayedID = 0; DelayedID = ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() => { if (HandleMatchUp(Player, FindMatchUp(Player))) { ProjectX_V3_Lib.Threading.DelayedTask.Remove(DelayedID); } }, 10000, 0); }
public static string GetName() { string NewName = string.Empty; int Tries = 0; while (string.IsNullOrWhiteSpace(NewName) && Tries < 100) { int index = ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(Names.Count - 1); NewName = Names[index]; if (UsedNames.Contains(NewName)) { NewName = string.Empty; } else { UsedNames.Add(NewName); } Tries++; } return(NewName); }
private void Creature_Attack_Thread() { if (this.Target != null) { if (this.Target.Alive) { if (this.Screen.MapObjects.ContainsKey(this.Target.EntityUID)) { if (Core.Screen.GetDistance(this.X, this.Y, this.Target.X, this.Target.Y) <= this.AttackRange && DateTime.Now >= this.AttackTime) { this.AttackTime = DateTime.Now.AddMilliseconds( ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next( this.AttackSpeed, this.AttackSpeed * 3)); #region physical attack using (var interact = new Packets.InteractionPacket()) { interact.Action = Enums.InteractAction.Attack; interact.EntityUID = this.EntityUID; interact.TargetUID = this.Target.EntityUID; interact.UnPacked = true; interact.X = this.Target.X; interact.Y = this.Target.Y; Packets.Interaction.Battle.Physical.Handle(this, interact); } #endregion return; } } } } if (FixedTarget != null) { this.Target = FixedTarget; } else { this.Target = null; foreach (Maps.IMapObject obj in this.Screen.MapObjects.Values) { if (obj is Entities.GameClient) { if (ProtectedPlayers.Contains((obj as Entities.GameClient))) { continue; } this.Target = obj as Entities.IEntity; if (!this.Target.Alive) { this.Target = null; continue; } break; } } } }
public bool SpawnInArena(Entities.GameClient Client) { return(!Watchers.Contains(Client)); }