Ejemplo n.º 1
0
        public static void Add(this ActorCommonData Actor, MapItemElement Ele, int I = -1, int EliteOff = -1, bool IsMonster = false)
        {
            IMapActor Monster = new IMapActor(Actor, Ele, EliteOff, I, IsMonster);

            Monsters.Add(Actor.Address, Monster);
            MonstersAdd.Add(Monster);
        }
Ejemplo n.º 2
0
 public static void Search(ActorCommonData Actor)
 {
     if (Monsters.ContainsKey(Actor.Address))
     {
         return;
     }
 }
Ejemplo n.º 3
0
        public static void SelectionMode()
        {
            try
            {
                bool CollectionChanged = false;

                if (A_Collection.Me.GearSwap.editModeEnabled)
                {
                    A_Collection.Me.GearSwap.isEditing = true;

                    if (!A_Collection.D3UI.isOpenInventory)
                    {
                        A_Collection.Me.GearSwap.editModeEnabled = false;
                    }

                    var SelectedAcdId = GetSelectedAcdId();

                    if (SelectedAcdId > -1) // Add/Remove Selected Items to/from Collection
                    {
                        int             AcdId    = SelectedAcdId;
                        ActorCommonData ItemAcd  = GetSelectedItemAcd(AcdId);
                        double          ItemSeed = GetItemSeed(ItemAcd);
                        ItemSlotSize    ItemSize = GetSlotSize(ItemAcd);
                        long            HeroId   = A_Collection.Me.HeroGlobals.HeroID;

                        if (A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.ItemSeed == ItemSeed) == null)
                        {
                            A_Collection.Me.GearSwap.GearSwaps.Add(new GearSwapItem(HeroId, A_Collection.Me.GearSwap.Selected_SwapId, ItemSeed, ItemAcd.x118_ItemSlotX, ItemAcd.x11C_ItemSlotY, ItemSize));

                            CollectionChanged = true;
                        }
                        else
                        {
                            var tryGetEntry = A_Collection.Me.GearSwap.GearSwaps.FirstOrDefault(x => x.ItemSeed == ItemSeed);

                            A_Collection.Me.GearSwap.GearSwaps.Remove(tryGetEntry);

                            CollectionChanged = true;
                        }

                        while (GetSelectedAcdId() == AcdId)
                        {
                            Thread.Sleep(50);
                        }
                    }



                    //Thread.Sleep(50);
                }

                if (CollectionChanged)
                {
                    A_Tools.T_ExternalFile.GearSwaps.Save();
                }

                A_Collection.Me.GearSwap.isEditing = false;
            }
            catch { A_Collection.Me.GearSwap.isEditing = false; }
        }
Ejemplo n.º 4
0
		private static bool TryCreateChest(ActorCommonData acd, out IMapMarker item, ref bool interested)
		{
			item = null;
			if (acd.x180_GizmoType == GizmoType.Chest)
			{
				interested = true;
				if (IsValidGizmoChest(acd))
				{
					item = new MapMarkerAcdChest(acd, IsValidGizmoChest);
					return true;
				}
			}
			else if (acd.x180_GizmoType == GizmoType.LoreChest)
			{
				interested = true;
				if (IsValidGizmoLoreChest(acd))
				{
					item = new MapMarkerAcdChest(acd, IsValidGizmoLoreChest);
					return true;
				}
			}
			else if (acd.x180_GizmoType== GizmoType.Switch)
			{
				interested = true;
				switch (acd.x090_ActorSnoId)
				{
					case 0x0005900F: // x1_Global_Chest_CursedChest
					case 0x00059229: // x1_Global_Chest_CursedChest_B
						item = new MapMarkerAcdCursedChest(acd, IsValidSwitchCursedChest);
						return true;
				}
			}
			return false;
		}
Ejemplo n.º 5
0
        public static bool isElite(ActorCommonData monster)
        {
            try
            {
                switch (monster.x0B8_MonsterQuality)
                {
                case Enigma.D3.Enums.MonsterQuality.Unique:
                case Enigma.D3.Enums.MonsterQuality.Rare:
                case Enigma.D3.Enums.MonsterQuality.Champion:
                case Enigma.D3.Enums.MonsterQuality.Boss:
                case Enigma.D3.Enums.MonsterQuality.Minion:
                    return(true);

                default:
                    if (IsTreasureGoblin(monster))
                    {
                        return(true);
                    }
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        private static void get_AllActors()
        {
            try
            {
                lock (A_Collection.Environment.Actors.AllActors)
                {
                    lock (A_Collection.Me.HeroDetails.EquippedItems)
                    {
                        A_Collection.Environment.Actors.AllActors.Clear();
                        A_Collection.Me.HeroDetails.EquippedItems.Clear();

                        Predicate <Enigma.D3.Enums.ItemLocation> isEquipped = (location) =>
                                                                              location >= Enigma.D3.Enums.ItemLocation.PlayerHead &&
                                                                              location <= Enigma.D3.Enums.ItemLocation.PlayerNeck;

                        var acdcontainer = ActorCommonData.Container.ToList();


                        for (int i = 0; i < acdcontainer.Count(); i++)
                        {
                            if (acdcontainer[i].x000_Id == -1)
                            {
                                continue;
                            }

                            ActorCommonData acd = acdcontainer[i];


                            bool isMonster = false;
                            isMonster = A_Tools.T_ACD.IsValidMonster(acd); // Experimental

                            bool isPlayer = false;
                            if (!isMonster && acd.x184_ActorType == ActorType.Player)
                            {
                                isPlayer = true;
                            }

                            double progress = 0;
                            if (isMonster && Properties.Settings.Default.overlayriftprogress)
                            {
                                progress = A_Tools.T_ACD.get_RiftProgress(acd);
                            }

                            double distance = A_Tools.T_ACD.get_Distance(acd.x0D0_WorldPosX, acd.x0D4_WorldPosY);

                            A_Collection.Environment.Actors.AllActors.Add(new ACD(acd, isMonster, isPlayer, distance, progress));

                            if (isEquipped(acd.x114_ItemLocation))
                            {
                                A_Collection.Me.HeroDetails.EquippedItems.Add(acd);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                A_Handler.Log.Exception.addExceptionLogEntry(e, A_Enums.ExceptionThread.ICollector);
            }
        }
Ejemplo n.º 7
0
        public static ActorCommonData GetTarget()
        {
            ActorCommonData acdTarget = null;

            var queryMonster = ActorCommonDataHelper.EnumerateMonsters().Where(x => x.x0D0_WorldPosX > 0 && x.x188_Hitpoints > 00001 && x.x190_TeamId == 10 && x.x184_ActorType == Enigma.D3.Enums.ActorType.Monster && !x.x004_Name.Contains("sandWasp"));

            var queryMonsterQuality = queryMonster
                                      .Where(x => x.x0B8_MonsterQuality > Enigma.D3.Enums.MonsterQuality.Normal)
                                      .OrderBy(x => x.x0B8_MonsterQuality);

            if (queryMonsterQuality.Any())
            {
                var acd = queryMonsterQuality.First();
                WindowHook.SetD3WindowText(string.Format("Target {0} x098_MonsterSnoId:{1}", acd.x004_Name, acd.x098_MonsterSnoId));
                return(acd);
            }


            var queryMonsterLeft = queryMonster
                                   .OrderBy(x => x.x188_Hitpoints);

            if (queryMonsterLeft.Any())
            {
                var acd = queryMonsterLeft.First();
                WindowHook.SetD3WindowText(string.Format("Target {0} x098_MonsterSnoId:{1}", acd.x004_Name, acd.x184_ActorType == Enigma.D3.Enums.ActorType.Monster));
                return(acd);
            }

            WindowHook.SetD3WindowText("Target NULL");
            return(acdTarget);
        }
Ejemplo n.º 8
0
        public static bool TryCreateChest(this ActorCommonData acd, bool CheckForRacks = false)
        {
            if (!CheckForRacks)
            {
                if ((acd.IsValidGizmoChest()) && acd.x004_Name.ToLower().IndexOf("chest") != -1)
                {
                    return(true);
                }
            }

            else
            {
                if (acd.IsValidGizmoChest())
                {
                    return(true);
                }
            }


            /* else if (acd.x180_GizmoType == GizmoType.Switch)
             * {
             *   switch (acd.x090_ActorSnoId)
             *   {
             *       case 0x0005900F: // x1_Global_Chest_CursedChest
             *       case 0x00059229: // x1_Global_Chest_CursedChest_B
             *           return true;
             *   }
             * }*/
            return(false);
        }
Ejemplo n.º 9
0
            public static bool IsMaterial(ActorCommonData acd)
            {
                switch (acd.x090_ActorSnoId)
                {
                case 361988:        //Crafting_Legendary_05
                case 361989:        //Crafting_Looted_Reagent_05
                case 361986:        //Crafting_Rare_05
                case 361985:        //Crafting_Magic_05
                case 361984:        //Crafting_AssortedParts_05
                case 137958:        //CraftingMaterials_Flippy_Global
                case 365020:        //CraftingReagent_Legendary_Set_Borns_X1
                case 364281:        //CraftingReagent_Legendary_Set_Cains_X1
                case 364290:        //CraftingReagent_Legendary_Set_Demon_X1
                case 364305:        //CraftingReagent_Legendary_Set_Hallowed_X1
                case 364975:        //CraftingReagent_Legendary_Set_CaptainCrimsons_X1
                case 364725:        //DemonOrgan_Diablo_x1
                case 364723:        //DemonOrgan_Ghom_x1
                case 364724:        //DemonOrgan_SiegeBreaker_x1
                case 364722:        //DemonOrgan_SkeletonKing_x1
                case 366949:        //InfernalMachine_Diablo_x1
                case 366947:        //InfernalMachine_Ghom_x1
                case 366948:        //InfernalMachine_SiegeBreaker_x1
                case 366946:        //InfernalMachine_SkeletonKing_x1
                case 359504:        //HoradricRelic

                    return(true);

                default:
                    return(false);
                }
            }
Ejemplo n.º 10
0
        public static int get_MonstersInRangeOfSelectedMonster(ActorCommonData selectedMonster, double Range, out List <ActorCommonData> MonstersInRange)
        {
            MonstersInRange = new List <ActorCommonData>();

            try
            {
                List <A_Collector.ACD> acdcontainer;
                lock (A_Collection.Environment.Actors.AllActors) acdcontainer = A_Collection.Environment.Actors.AllActors.ToList();

                int counter = 0;

                foreach (var acd in acdcontainer)
                {
                    if (acd.IsMonster && acd._ACD.x000_Id != selectedMonster.x000_Id)
                    {
                        double distance = A_Tools.T_ACD.get_Distance(selectedMonster.x0D0_WorldPosX, selectedMonster.x0D4_WorldPosY, acd._ACD.x0D0_WorldPosX, acd._ACD.x0D4_WorldPosY);
                        if (distance <= Range)
                        {
                            counter++;
                            MonstersInRange.Add(acd._ACD);
                        }
                    }
                }

                return(counter);
            }
            catch { return(0); }
        }
Ejemplo n.º 11
0
 private static bool TryCreateChest(ActorCommonData acd, out IMapMarker item, ref bool interested)
 {
     item = null;
     if (acd.x178_GizmoType == GizmoType.Chest)
     {
         interested = true;
         if (IsValidGizmoChest(acd))
         {
             item = new MapMarkerAcdChest(acd, IsValidGizmoChest);
             return(true);
         }
     }
     else if (acd.x178_GizmoType == GizmoType.LoreChest)
     {
         interested = true;
         if (IsValidGizmoLoreChest(acd))
         {
             item = new MapMarkerAcdChest(acd, IsValidGizmoLoreChest);
             return(true);
         }
     }
     else if (acd.x178_GizmoType == GizmoType.Switch)
     {
         interested = true;
         switch (acd.x090_ActorSnoId)
         {
         case 0x0005900F:                         // x1_Global_Chest_CursedChest
         case 0x00059229:                         // x1_Global_Chest_CursedChest_B
             item = new MapMarkerAcdCursedChest(acd, IsValidSwitchCursedChest);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 12
0
 public static bool IsValidMonster(ActorCommonData acd)
 {
     return(acd.x188_Hitpoints > 0.00001 &&
            (acd.x198_Flags_Is_Trail_Proxy_Etc & 1) == 0 &&
            acd.x184_ActorType == Enigma.D3.Enums.ActorType.Monster &&
            acd.x190_TeamId == 10);
 }
Ejemplo n.º 13
0
        public static bool isBuff(List <int> SnoPowerIDs, ActorCommonData acd)
        {
            try
            {
                acd.TakeSnapshot();
                if (acd.x000_Id != -1)
                {
                    var attributes = acd.EnumerateAttributes();

                    foreach (var attrib in attributes)
                    {
                        uint attribId = (uint)(attrib.x04_Key & 0xFFF);
                        uint modifier = (uint)(attrib.x04_Key >> 12);
                        int  value    = attrib.x08_Value.Int32;

                        if (SnoPowerIDs.Contains((int)modifier) && value > 0)
                        {
                            acd.FreeSnapshot();
                            return(true);
                        }
                    }
                }
                acd.FreeSnapshot();
                return(false);
            }
            catch { return(false); }
        }
Ejemplo n.º 14
0
        public static bool IsTreasureGoblin(ActorCommonData Acd)
        {
            switch (Acd.x090_ActorSnoId)
            {
            case 5984:     // treasureGoblin_A
            case 5985:     // treasureGoblin_B
            case 5987:     // treasureGoblin_C
            case 5988:     // treasureGoblin_D
            case 408655:   // (PH) Backup Goblin
            case 408989:   // Blood Thief
            case 391593:   // Treasure Fiend
            case 413289:   // (PH) Teleporty Goblin
            case 410576:
            case 410586:
            case 326803:
            case 408354:
            case 410572:
            case 410574:

                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 15
0
        public static bool isBlinded(ActorCommonData acd)
        {
            try
            {
                var _acd = acd;
                _acd.TakeSnapshot();

                double attrib_blind = 0;

                if (_acd.x000_Id != -1)
                {
                    attrib_blind = _acd.GetAttributeValue(Enigma.D3.Enums.AttributeId.Blind);
                }

                _acd.FreeSnapshot();

                if (attrib_blind == 1)
                {
                    return(true);
                }

                return(false);
            }
            catch { return(false); }
        }
Ejemplo n.º 16
0
        public static bool ClickOnCube(ActorCommonData inputCubeStand)
        {
            bool FoundCube   = false;
            int  LoopCounter = 0;

            // Attempt to click on Cube, wait 2 sec (10x200ms)
            while (!FoundCube && LoopCounter <= 10)
            {
                float RX_Cube, RY_Cube;

                LoopCounter += 1;

                // Try to find where the cube is?
                A_Tools.T_World.ToScreenCoordinate(inputCubeStand.x0D0_WorldPosX, inputCubeStand.x0D4_WorldPosY, inputCubeStand.x0D8_WorldPosZ, out RX_Cube, out RY_Cube);

                // If vendor page or kanai page is not already visible, click it
                bool IsVendorPageVisible        = Tools.IsVendorPage_Visible();
                bool IsKanaiCubeMainPageVisible = Tools.IsKanaisCube_MainPage_Visible();

                if (!IsVendorPageVisible)
                {
                    // Move mouse cursor to the cube location coord and click it
                    A_Tools.InputSimulator.IS_Mouse.MoveCursor((uint)RX_Cube, (uint)RY_Cube);
                    A_Tools.InputSimulator.IS_Mouse.LeftClick();

                    Thread.Sleep(200);
                }

                if (IsVendorPageVisible && IsKanaiCubeMainPageVisible)
                {
                    FoundCube = true;
                }
            }
            return(FoundCube);
        }
Ejemplo n.º 17
0
        public static List <ActivePower> get_PlayerActivePowers(ActorCommonData acd)
        {
            try
            {
                acd.TakeSnapshot();

                var attributes = acd.EnumerateAttributes().ToList();

                List <ActivePower> Buffer = new List <ActivePower>();

                for (int i = 0; i < attributes.Count; i++)
                {
                    uint attribId = (uint)(attributes[i].x04_Key & 0xFFF);
                    uint modifier = (uint)(attributes[i].x04_Key >> 12);
                    int  value    = attributes[i].x08_Value.Int32;

                    Buffer.Add(new ActivePower((int)attribId, (int)modifier, value));
                }

                acd.FreeSnapshot();

                return(Buffer);
            }
            catch
            {
                return(new List <ActivePower>());
            }
        }
Ejemplo n.º 18
0
        public static bool IsCubeNearby(out ActorCommonData CubeStand)
        {
            CubeStand = new ActorCommonData();

            try
            {
                List <ACD> AllActors;
                lock (A_Collection.Environment.Actors.AllActors) AllActors = A_Collection.Environment.Actors.AllActors;

                var acd = AllActors.FirstOrDefault(x => x._ACD.x090_ActorSnoId == KanaiCube_Stand)._ACD;

                if (acd != null)
                {
                    CubeStand = acd;

                    return(true);
                }

                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 19
0
        public static async Task AttackAcdAsync(ActorCommonData acd)
        {
            var minHitsReached = acd.x188_Hitpoints;
            var dtHitReached   = DateTime.Now;

            DateTime dtTimeout = DateTime.Now;

            while (acd.x188_Hitpoints > 00000.1)
            {
                if (DateTime.Now > dtTimeout.AddSeconds(30) || DateTime.Now > dtHitReached.AddSeconds(5))
                {
                    return;
                }

                var acdVector3 = new SharpDX.Vector3()
                {
                    X = acd.x0D0_WorldPosX, Y = acd.x0D4_WorldPosY, Z = acd.x0D8_WorldPosZ
                };
                await MoveTo.MoveToPosAsync(acdVector3);

                var screenPos = D3ToScreen.FromD3toScreenCoords(acdVector3);

                MouseEvents.LeftClick(screenPos.X, screenPos.Y);
                await Task.Delay(new Random().Next(100, 250));

                if (acd.x188_Hitpoints < minHitsReached)
                {
                    minHitsReached = acd.x188_Hitpoints;
                    dtHitReached   = DateTime.Now;
                }
            }
        }
Ejemplo n.º 20
0
 private static int Validate(ActorCommonData acd)
 {
     if (acd == null)
     {
         throw new ArgumentNullException("acd");
     }
     return(acd.Address);
 }
Ejemplo n.º 21
0
 public ACD(ActorCommonData _acd, bool isMonster, bool isPlayer, double distance, double progress)
 {
     this._ACD      = _acd;
     this.IsMonster = isMonster;
     this.IsPlayer  = isPlayer;
     this.Distance  = distance;
     this.Progress  = progress;
 }
Ejemplo n.º 22
0
        public static int EliteAffixes(this ActorCommonData ACD)
        {
            HashSet <int> Affix = TryAdd(ACD);

            if (AffixList.Count >= Max || Affix.Count == 0)
            {
                NewActorID.Add(ACD.x000_Id, ((int)ACD.x0B8_MonsterQuality == 1) ? 1 : 0);
                return(-1);
            }

            AffixHelper Current = null;

            if (ACD.x0B8_MonsterQuality == Enigma.D3.Enums.MonsterQuality.Champion) // Blue
            {
                Current = Affix.Exist();

                if (Current != null) // Already have same affixes, link with that instead!
                {
                    if (!Current.Owners.Contains(ACD.x000_Id))
                    {
                        Current.Owners.Add(ACD.x000_Id);
                        return(Current.ElementKey);
                    }

                    NewActorID.Add(ACD.x000_Id, 0);
                    return(Current.ElementKey);
                }
            }

            else
            {
                if (AffixList.ContainsKey(ACD.x000_Id))
                {
                    NewActorID.Add(ACD.x000_Id, 1);
                    return(AffixList[ACD.x000_Id].ElementKey);
                }
            }

            Current = new AffixHelper
            {
                Key        = ACD.x000_Id,
                Name       = "ElitePack" + ACD.x000_Id,
                Affixes    = Affix,
                ElementKey = GetKey(),
                Owners     = new HashSet <int>()
                {
                    ACD.x000_Id
                },
            };

            //UserControl T = Controller.GameManager.Instance.GManager.GRef.Attacher.Add<Templates.Elites.EliteAffixes>(Current.Name, Current);
            UserControl T = Controller.GameManager.Instance.GManager.GRef.D3OverlayControl.CreateControl <Templates.Elites.EliteAffixes>(Current.Name, false, Current);

            Current.UserControl = T;
            AffixList.Add(ACD.x000_Id, Current);
            NewActorID.Add(Current.Key, ((int)ACD.x0B8_MonsterQuality == 1) ? 1 : 0);
            return(Current.ElementKey);
        }
Ejemplo n.º 23
0
        public static double Distance(this ActorCommonData acd)
        {
            if (Engine.Current == null)
            {
                return(0);
            }

            return(Math.Pow(Engine.Current.LocalData.x24_WorldPosX - acd.x0D0_WorldPosX, 2) + Math.Pow(Engine.Current.LocalData.x28_WorldPosY - acd.x0D4_WorldPosY, 2));
        }
Ejemplo n.º 24
0
        private static Enigma.D3.Enums.ItemLocation GetHeroLocationByItemAcd(ActorCommonData ItemAcd)
        {
            lock (A_Collection.Me.HeroDetails.EquippedItems)
            {
                var Container = A_Collection.Me.HeroDetails.EquippedItems.ToList();

                return(Container.FirstOrDefault(x => x.x000_Id == ItemAcd.x000_Id).x114_ItemLocation);
            }
        }
Ejemplo n.º 25
0
        public static bool HasValidTarget(ActorCommonData acd)
        {
            if (acd == null || acd.x188_Hitpoints < 00001)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 26
0
        public static bool IsElite(this ActorCommonData acd, bool IncludeUnique = false)
        {
            if (IncludeUnique)
            {
                return(acd.x0B8_MonsterQuality == MonsterQuality.Champion || acd.x0B8_MonsterQuality == MonsterQuality.Rare || acd.x0B8_MonsterQuality == MonsterQuality.Boss || acd.x0B8_MonsterQuality == MonsterQuality.Unique);
            }

            return(acd.x0B8_MonsterQuality == MonsterQuality.Champion || acd.x0B8_MonsterQuality == MonsterQuality.Rare);
        }
Ejemplo n.º 27
0
        public static bool TryCreateLootable(this ActorCommonData acd)
        {
            if (acd.IsValidGizmoLoreChest())
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 28
0
        public static bool IsKeyWarden(this ActorCommonData Actor)
        {
            if (Keywardens.Contains(Actor.x090_ActorSnoId))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 29
0
        public static bool IsPowerPylon(this ActorCommonData Actor)
        {
            if (PowerPylon == null)
            {
                PowerPylon = new HashSet <int>(new int[] { 330695, 330696, 330697, 330698, 330699, 398654 });
            }

            return(PowerPylon.Contains(Actor.x090_ActorSnoId));
            // 176074 // blessed Shrine Protection
        }
Ejemplo n.º 30
0
		public MapMarkerAcd(ActorCommonData acd, Func<ActorCommonData, bool> isValid)
			: base(Validate(acd))
		{
			if (isValid == null)
				throw new ArgumentNullException("isValid");

			_acd = acd;
			_acdId = _acd.x000_Id;
			_isValid = isValid;
		}
Ejemplo n.º 31
0
 public static bool isBoss(ActorCommonData monster)
 {
     try
     {
         return(monster.x0B8_MonsterQuality == MonsterQuality.Boss);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 32
0
 public static bool isEliteYellow(ActorCommonData monster)
 {
     try
     {
         return(monster.x0B8_MonsterQuality == MonsterQuality.Rare);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 33
0
		private static bool TryCreateMonster(ActorCommonData acd, out IMapMarker item, ref bool interested)
		{
			item = null;
			if (acd.x184_ActorType == ActorType.Monster)
			{
				interested = true;
				if (IsValidMonster(acd))
				{
					item = new MapMarkerAcdMonster(acd, IsValidMonster);
					return true;
				}
			}
			return false;
		}
Ejemplo n.º 34
0
		public static IMapMarker Create(ActorCommonData acd, out bool ignore)
		{
			IMapMarker item;
			bool interested = false;

			if (TryCreateMonster(acd, out item, ref interested) ||
				TryCreateChest(acd, out item, ref interested) ||
				TryCreateWreckable(acd, out item, ref interested))
			{
				// Successfull!
			}

			ignore = !interested;
			return item;
		}
Ejemplo n.º 35
0
		private static bool TryCreateWreckable(ActorCommonData acd, out IMapMarker item, ref bool interested)
		{
			item = null;
			if (acd.x180_GizmoType == GizmoType.BreakableChest ||
				acd.x180_GizmoType == GizmoType.BreakableDoor ||
				acd.x180_GizmoType == GizmoType.DestroyableObject)
			{
				interested = true;
				if (IsValidGizmoWreckableObject(acd))
				{
					item = new MapMarkerAcdWreckable(acd, IsValidGizmoWreckableObject);
					return true;
				}
			}
			return false;
		}
Ejemplo n.º 36
0
		private static bool IsValidGizmoWreckableObject(ActorCommonData acd)
		{
			return acd.x188_Hitpoints == 0.001f;
		}
Ejemplo n.º 37
0
 public MapMarkerAcdWreckable(ActorCommonData item, Func<ActorCommonData, bool> isValid)
     : base(item, isValid)
 {
 }
Ejemplo n.º 38
0
		public MapMarkerAcdMonster(ActorCommonData monster, Func<ActorCommonData, bool> isValid)
			: base(monster, isValid)
		{
			ZIndex = (int)Acd.x0B8_MonsterQuality;
		}
Ejemplo n.º 39
0
		private static int Validate(ActorCommonData acd)
		{
			if (acd == null)
				throw new ArgumentNullException("acd");
			return acd.Address;
		}
Ejemplo n.º 40
0
		private static bool IsValidGizmoChest(ActorCommonData acd)
		{
			return (acd.x248_CollisionFlags & 0x400) == 0 &&
				Attributes.ChestOpen.GetValue(acd) != 1;
		}
Ejemplo n.º 41
0
		private static bool IsValidGizmoLoreChest(ActorCommonData acd)
		{
			return Attributes.ChestOpen.GetValue(acd, 0xA0000) != 1;
		}
Ejemplo n.º 42
0
		public void Update(Engine engine)
		{
			try
			{
				if (!IsLocalActorValid(engine))
					return;

				if (!IsObjectManagerOnNewFrame(engine))
					return;

				var itemsToAdd = new List<IMapMarker>();

				var acds = ActorCommonData.Container;
				if (acds == null)
				{
					Trace.TraceError("ACDs == null");
				}
				else
				{
					var bufferSizePreDump = _acdsBuffer.Length;

					acds.TakeSnapshot();
					var dump = acds.GetBufferDump(ref _acdsBuffer);

					var bufferSizePostDump = _acdsBuffer.Length;
					if (bufferSizePostDump < bufferSizePreDump)
					{
						_minimapItems.Clear();
						_minimapItemsDic.Clear();
						_playerAcd = null;
						return;
					}

					// Must have a local ACD to base coords on.
					if (_playerAcd == null)
					{
						var playerAcdId = ActorCommonDataHelper.GetLocalAcd().x000_Id;

						foreach (var item in dump)
						{
							var acdId = BitConverter.ToInt32(_acdsBuffer, item.BufferOffset + 0x00);
							if (acdId == playerAcdId)
							{
								_playerAcd = item.Create();
							}
						}

						if (_playerAcd == null)
							return;
					}

					var firstFreeAcd = acds.x114_Free;
					if (firstFreeAcd != _firstFreeAcd)
					{
						foreach (var item in dump)
						{
							if (_minimapItemsDic.ContainsKey(item.Address))
								continue;
							var acd = item.Create();

							int acdId = acd.x000_Id;
							if (acdId == -1)
								continue;

							var actorSnoId = acd.x090_ActorSnoId;
							if (_ignoredSnoIds.Contains(actorSnoId))
								continue;

							if (!_minimapItemsDic.ContainsKey(acd.Address))
							{
								bool ignore;
								var minimapItem = MapMarkerFactory.Create(acd, out ignore);
								if (ignore)
								{
									_ignoredSnoIds.Add(actorSnoId);
								}
								else if (minimapItem != null)
								{
									_minimapItemsDic.Add(acd.Address, minimapItem);
									itemsToAdd.Add(minimapItem);
								}
							}
						}
					}

					_firstFreeAcd = firstFreeAcd;
					acds.FreeSnapshot();
				}

				UpdateUI(itemsToAdd);
			}
			catch (Exception exception)
			{
				OnUpdateException(exception);
			}
		}
Ejemplo n.º 43
0
		private bool IsObjectManagerOnNewFrame(Engine engine)
		{
			_objectManager = _objectManager ?? engine.ObjectManager;

			// Don't do anything unless game updated frame.
			int currentFrame = _objectManager.x038_Counter_CurrentFrame;
			if (currentFrame == _lastFrame)
				return false;
			if (currentFrame < _lastFrame)
			{
				// Lesser frame than before = left game probably.
				_playerAcd = null;
				_lastFrame = currentFrame;
				return false;
			}
			_lastFrame = currentFrame;
			return true;
		}
Ejemplo n.º 44
0
		private static bool IsValidMonster(ActorCommonData acd)
		{
			return acd.x188_Hitpoints > 0.00001 &&
				(acd.x198_Flags_Is_Trail_Proxy_Etc & 1) == 0 &&
				acd.x190_TeamId == 10;
		}
Ejemplo n.º 45
0
 public MapMarkerAcdChest(ActorCommonData item, Func<ActorCommonData, bool> isValid)
     : base(item, isValid)
 {
 }
Ejemplo n.º 46
0
		private static bool IsValidSwitchCursedChest(ActorCommonData acd)
		{
			return true;
		}