Exemplo n.º 1
0
        GUnit FindMobToPull()
        {
            // TODO better elite/max level decision, this at least prevents
            // attacking flight masters
            int minLevel = nodetask.GetValueOfId("MinLevel").GetIntValue();
            int maxLevel = nodetask.GetValueOfId("MaxLevel").GetIntValue();

            // TODO add active pvp option
            // int doPvp = ...;

            // Find stuff to pull
            GUnit closest = null;

            GMonster[] monsters = GObjectList.GetMonsters();
            foreach (GMonster monster in monsters)
            {
                if (!monster.IsDead &&
                    (!monster.IsTagged || monster.IsTargetingMe || monster.IsTargetingMyPet) &&
                    !ppather.IsBlacklisted(monster) && !PPather.IsPlayerFaction(monster) &&
                    (!monster.IsPlayer /*|| (doPvp && (GPlayer)monster).IsPVP)*/) &&
                    !PPather.IsStupidItem(monster))
                {
                    double dangerd = (double)DangerDistance + ((monster.IsElite ? 1.25 : 1.0) * (monster.Level - GContext.Main.Me.Level));
                    if (monster.Reaction == GReaction.Hostile &&
                        !monster.IsElite &&
                        minLevel <= monster.Level &&
                        monster.Level <= maxLevel &&
                        monster.DistanceToSelf < dangerd &&
                        Math.Abs(monster.Location.Z - GContext.Main.Me.Location.Z) < 15.0)
                    {
                        if (closest == null || monster.DistanceToSelf < closest.DistanceToSelf)
                        {
                            closest = monster;
                        }
                    }
                }
            }
            return(closest);
        }