Esempio n. 1
0
 public static Npc GetNpcNearby(Npc.NpcType type, Npc.FactionType faction, int continentId, Point currentPosition, bool ignoreRadiusSettings = false)
 {
     try
     {
         Npc npcTemp = new Npc();
         foreach (Npc npc in ListNpc)
         {
             if ((npc.Faction != faction && npc.Faction != Npc.FactionType.Neutral) || npc.Type != type || npc.ContinentIdInt != continentId)
             {
                 continue;
             }
             if (!(npcTemp.Position.DistanceTo(currentPosition) > npc.Position.DistanceTo(currentPosition)) && npcTemp.Position.X != 0)
             {
                 continue;
             }
             if (ignoreRadiusSettings || npc.Position.DistanceTo(currentPosition) <= nManagerSetting.CurrentSetting.MaxDistanceToGoToMailboxesOrNPCs)
             {
                 npcTemp = npc;
             }
         }
         return(npcTemp);
     }
     catch (Exception ex)
     {
         Logging.WriteError(
             "QuestersDB > GetNpcNearby(Npc.NpcType type, Npc.FactionType faction, Enums.ContinentId continentId, Point currentPosition, bool ignoreRadiusSettings = false): " +
             ex);
         return(new Npc());
     }
 }
Esempio n. 2
0
        private static Npc DoSpawnRobot(string robot, Npc.NpcType type, bool checkOnly = false)
        {
            int robotItemId;
            int robotEntryId;
            int gossipOption = 0;

            switch (robot)
            {
            case "74A":
                robotItemId  = 18232;
                robotEntryId = 14337;
                break;

            case "110G":
                robotItemId  = 34113;
                robotEntryId = 24780;
                break;

            case "Jeeves":
                robotItemId  = 49040;
                robotEntryId = 35642;
                gossipOption = 2;
                break;

            default:
                return(null);
            }
            if (!checkOnly)
            {
                MountTask.DismountMount();
                ItemsManager.UseItem(ItemsManager.GetItemNameById(robotItemId));
                Thread.Sleep(2000);
            }
            WoWUnit unitRobot = ObjectManager.ObjectManager.GetNearestWoWUnit(ObjectManager.ObjectManager.GetWoWUnitByEntry(robotEntryId));

            if (!unitRobot.IsValid || !unitRobot.IsAlive)
            {
                return(null);
            }
            Npc npcRobot = new Npc
            {
                Entry          = unitRobot.Entry,
                Position       = unitRobot.Position,
                Name           = unitRobot.Name,
                ContinentIdInt = Usefuls.ContinentId,
                Faction        = ObjectManager.ObjectManager.Me.PlayerFaction.ToLower() == "horde"
                    ? Npc.FactionType.Horde
                    : Npc.FactionType.Alliance,
                SelectGossipOption = gossipOption,
                Type = type
            };

            return(npcRobot);
        }
Esempio n. 3
0
 public static Npc GetNpcNearby(Npc.NpcType type, bool ignoreRadiusSettings = false)
 {
     try
     {
         Npc.FactionType faction = (Npc.FactionType)Enum.Parse(typeof(Npc.FactionType), ObjectManager.ObjectManager.Me.PlayerFaction);
         return(GetNpcNearby(type, faction, Usefuls.ContinentId, ObjectManager.ObjectManager.Me.Position, ignoreRadiusSettings));
     }
     catch (Exception ex)
     {
         Logging.WriteError("QuestersDB > GetNpcNearby(Npc.NpcType type, bool ignoreRadiusSettings = false): " + ex);
         return(new Npc());
     }
 }