Esempio n. 1
0
        public static ActorClass GetActorClass(SNOActor actorSnoId)
        {
            switch (actorSnoId)
            {
            case SNOActor.Wizard_Female:
            case SNOActor.Wizard_Male:
                return(ActorClass.Wizard);

            case SNOActor.Barbarian_Female:
            case SNOActor.Barbarian_Male:
                return(ActorClass.Barbarian);

            case SNOActor.Demonhunter_Female:
            case SNOActor.Demonhunter_Male:
                return(ActorClass.DemonHunter);

            case SNOActor.X1_Crusader_Female:
            case SNOActor.X1_Crusader_Male:
                return(ActorClass.Crusader);

            case SNOActor.WitchDoctor_Female:
            case SNOActor.WitchDoctor_Male:
                return(ActorClass.Witchdoctor);

            case SNOActor.Monk_Female:
            case SNOActor.Monk_Male:
                return(ActorClass.Monk);
            }
            return(ActorClass.Invalid);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves to a position, finds actor by Id and interacts with it
        /// </summary>
        /// <param name="actorId">id of actor to interact with</param>
        /// <param name="position">position from which to interact</param>
        /// <param name="interactLimit">maximum number of times to interact</param>
        public static async Task <bool> Execute(Vector3 position, SNOActor actorId, int interactLimit = 5)
        {
            if (position == Vector3.Zero)
            {
                return(false);
            }

            if (interactLimit < 1)
            {
                interactLimit = 5;
            }

            if (Core.Player.IsInTown)
            {
                GameUI.CloseVendorWindow();
            }

            DiaObject actor;

            while ((actor = ZetaDia.Actors.GetActorsOfType <DiaObject>(true)
                            .FirstOrDefault(a => (SNOActor)a.ActorSnoId == actorId)
                    ) == null &&
                   await CommonCoroutines.MoveAndStop(position, 40f, "Close to target") != MoveResult.ReachedDestination)
            {
                await Coroutine.Yield();
            }

            if (actor != null)
            {
                return(await Execute(actor, interactLimit));
            }

            Core.Logger.Verbose("Interaction Failed: Actor not found with Id={0}", actorId);
            return(false);
        }
Esempio n. 3
0
        public static TrinityActor FindActor(SNOActor actorId, int marker = 0, float maxRange = 500, string internalName = "", Func <TrinityActor, bool> condition = null)
        {
            TrinityActor actor = null;

            if (actorId != 0)
            {
                if (marker != 0)
                {
                    actor = BountyHelpers.ScanForActor(actorId, marker, (int)maxRange, condition);
                }
                else
                {
                    actor = BountyHelpers.ScanForActor(actorId, (int)maxRange, condition);
                }
            }
            else if (!string.IsNullOrEmpty(internalName))
            {
                actor = BountyHelpers.ScanForActor(internalName, (int)maxRange, condition);
            }
            else if (actorId == 0 && marker != 0)
            {
                actor = BountyHelpers.GetActorNearMarker(marker, 10f, condition);
            }
            return(actor);
        }
Esempio n. 4
0
        public static Vector3 ScanForActorLocation(SNOActor actorId, int searchRadius, Vector3 origin = default(Vector3), Func <TrinityActor, bool> func = null)
        {
            origin = origin != Vector3.Zero ? origin : Core.Player.Position;
            var actor = Core.Actors.Where(a => a.ActorSnoId == actorId && a.Position.Distance(origin) <= searchRadius && (func == null || func(a))).OrderBy(a => a.Distance).FirstOrDefault();

            return(actor?.Position ?? Vector3.Zero);
        }
Esempio n. 5
0
 public AdventurerGemSetting(Item item)
 {
     _sno     = item.Id;
     _item    = item;
     _name    = item.Name;
     _maxRank = item.MaxRank > 0 ? item.MaxRank : 150;
     LoadDefaults();
 }
Esempio n. 6
0
        /*
         * Reference implementation: http://msdn.microsoft.com/en-us/library/s02tk69a.aspx
         */

        public static string GenerateObjectHash(Vector3 position, SNOActor actorSNO, string name)
        {
            using (MD5 md5 = MD5.Create())
            {
                string itemHashBase = $"{position}{actorSNO}{name}";
                string itemHash     = GetMd5Hash(md5, itemHashBase);
                return(itemHash);
            }
        }
Esempio n. 7
0
 public static DiaUnit FindUnit(SNOActor actorId)
 {
     return(ZetaDia.Actors.GetActorsOfType <DiaUnit>(true).Where(
                u =>
                u.IsValid &&
                u.CommonData != null &&
                u.CommonData.IsValid &&
                u.ActorSnoId == actorId
                ).OrderBy(u => u.Distance).FirstOrDefault());
 }
Esempio n. 8
0
 public static DiaGizmo FindGizmo(SNOActor actorId, Func <DiaGizmo, bool> func = null)
 {
     return(ZetaDia.Actors.GetActorsOfType <DiaGizmo>(true).Where(
                u =>
                u.IsValid &&
                u.CommonData != null &&
                u.CommonData.IsValid &&
                u.ActorSnoId == actorId &&
                (func == null || func(u))
                ).OrderBy(u => u.Position.DistanceSqr(AdvDia.MyPosition)).FirstOrDefault());
 }
Esempio n. 9
0
        public static async Task <bool> UsePortal(SNOActor actorSNO, SNOWorld sourceWorldDynamicId)
        {
            if (_usePortalCoroutine == null || _usePortalActorSNO != actorSNO || _usePortalSourceWorldDynamicId != sourceWorldDynamicId)
            {
                _usePortalCoroutine            = new UsePortalCoroutine(actorSNO, sourceWorldDynamicId);
                _usePortalActorSNO             = actorSNO;
                _usePortalSourceWorldDynamicId = sourceWorldDynamicId;
            }

            if (!await _usePortalCoroutine.GetCoroutine())
            {
                return(false);
            }

            _usePortalCoroutine = null;
            return(true);
        }
Esempio n. 10
0
        public static ACDItem GetNextStashItem(int currentCol, int currentRow, SNOActor actorSnoId = (SNOActor)(-1))
        {
            if (actorSnoId > 0)
            {
                var nextItemOfType = Core.Inventory.Stash.FirstOrDefault(i =>
                                                                         i.ActorSnoId == actorSnoId &&
                                                                         i.InventoryRow > currentRow || i.InventoryRow == currentRow && i.InventoryColumn > currentCol);

                if (nextItemOfType != null)
                {
                    return(nextItemOfType);
                }
            }
            return(Core.Inventory.Stash.FirstOrDefault(i => !i.IsTwoSquareItem &&
                                                       (i.InventoryRow > currentRow ||
                                                        i.InventoryRow == currentRow) &&
                                                       i.InventoryColumn > currentCol));
        }
Esempio n. 11
0
 public static TrinityActor ScanForActor(SNOActor actorSnoId, int searchRadius = 500, Func <TrinityActor, bool> func = null)
 {
     return(Core.Actors.Where(a => a.ActorSnoId == actorSnoId && a.Distance <= searchRadius && (func == null || func(a))).OrderBy(a => a.Distance).FirstOrDefault());
 }
Esempio n. 12
0
 public Item(SNOActor actorId, string name = "", ItemType itemType = ItemType.Unknown)
 {
     Id       = actorId;
     Name     = name;
     ItemType = itemType;
 }
Esempio n. 13
0
 public bool ShouldKeepInBackpack(SNOActor itemSnoId)
 {
     return(KeepInBackpack != null && KeepInBackpack.Any(i => (SNOActor)i.Id == itemSnoId));
 }
Esempio n. 14
0
 /// <summary>
 /// Retrieve a part by ActorSnoId
 /// </summary>
 public AvoidancePart GetPart(SNOActor actorSnoId)
 {
     return(Parts.FirstOrDefault(p => p.ActorSnoId == actorSnoId));
 }
Esempio n. 15
0
 public AttackCoroutine(SNOActor actorId)
 {
     _actorId = actorId;
     Id       = Guid.NewGuid();
 }
Esempio n. 16
0
 public static AvoidancePart GetAvoidancePart(SNOActor actorId)
 {
     return(AvoidanceDataDictionary.ContainsKey(actorId) ? AvoidanceDataDictionary[actorId] : null);
 }
Esempio n. 17
0
 public RiftEntryPortal(SNOActor actorSno, float x, float y)
 {
     ActorSNO = actorSno;
     X        = (int)x;
     Y        = (int)y;
 }
Esempio n. 18
0
 public List <ACDItem> ByActorSno(SNOActor actorSno)
 {
     return(Source().Where(i => i.ActorSnoId == actorSno).ToList());
 }
Esempio n. 19
0
 public static IEnumerable <ACDItem> ByActorSno(this IEnumerable <ACDItem> source, SNOActor actorSno)
 {
     return(source.Where(i => i.ActorSnoId == actorSno));
 }
Esempio n. 20
0
        public static TrinityObjectType GetObjectType(ActorType actorType, SNOActor actorSno, GizmoType gizmoType, string internalName)
        {
            if (GameData.ObjectTypeOverrides.ContainsKey(actorSno))
            {
                return(GameData.ObjectTypeOverrides[actorSno]);
            }

            if (GameData.CursedChestSNO.Contains(actorSno))
            {
                return(TrinityObjectType.CursedChest);
            }

            if (GameData.CursedShrineSNO.Contains(actorSno))
            {
                return(TrinityObjectType.CursedShrine);
            }

            if (GameData.ShrineSNO.Contains(actorSno))
            {
                return(TrinityObjectType.Shrine);
            }

            if (GameData.HealthGlobeSNO.Contains(actorSno))
            {
                return(TrinityObjectType.HealthGlobe);
            }

            if (GameData.PowerGlobeSNO.Contains(actorSno))
            {
                return(TrinityObjectType.PowerGlobe);
            }

            if (GameData.ProgressionGlobeSNO.Contains(actorSno))
            {
                return(TrinityObjectType.ProgressionGlobe);
            }

            if (GameData.GoldSNO.Contains(actorSno))
            {
                return(TrinityObjectType.Gold);
            }

            if (GameData.BloodShardSNO.Contains(actorSno))
            {
                return(TrinityObjectType.BloodShard);
            }

            if (actorType == ActorType.Item || GameData.ForceToItemOverrideIds.Contains(actorSno))
            {
                return(TrinityObjectType.Item);
            }

            if (GameData.AvoidanceSNO.Contains(actorSno))
            {
                return(TrinityObjectType.Avoidance);
            }

            if (GameData.ForceTypeAsBarricade.Contains(actorSno))
            {
                return(TrinityObjectType.Barricade);
            }

            if (actorType == ActorType.Monster)
            {
                return(TrinityObjectType.Unit);
            }

            if (actorType == ActorType.Gizmo)
            {
                switch (gizmoType)
                {
                case GizmoType.HealingWell:
                    return(TrinityObjectType.HealthWell);

                case GizmoType.Door:
                    return(TrinityObjectType.Door);

                case GizmoType.BreakableDoor:
                    return(TrinityObjectType.Barricade);

                case GizmoType.PoolOfReflection:
                case GizmoType.PowerUp:
                    return(TrinityObjectType.Shrine);

                case GizmoType.Chest:
                    return(TrinityObjectType.Container);

                case GizmoType.DestroyableObject:
                case GizmoType.BreakableChest:
                    return(TrinityObjectType.Destructible);

                case GizmoType.PlacedLoot:
                case GizmoType.LoreChest:     // D1 profile Lectern switch to open door
                case GizmoType.Switch:
                case GizmoType.Headstone:
                    return(TrinityObjectType.Interactable);

                case GizmoType.Portal:
                    return(TrinityObjectType.Portal);

                case GizmoType.Gate:
                    return(TrinityObjectType.Gate);
                }
            }

            if (actorType == ActorType.Environment || actorType == ActorType.Critter || actorType == ActorType.ServerProp)
            {
                return(TrinityObjectType.Environment);
            }

            if (actorType == ActorType.Projectile)
            {
                return(TrinityObjectType.Projectile);
            }

            if (GameData.BuffedLocationSno.Contains(actorSno))
            {
                return(TrinityObjectType.BuffedRegion);
            }

            if (actorType == ActorType.ClientEffect)
            {
                return(TrinityObjectType.ClientEffect);
            }

            if (actorType == ActorType.Player)
            {
                return(TrinityObjectType.Player);
            }

            if (GameData.PlayerBannerSNO.Contains(actorSno))
            {
                return(TrinityObjectType.Banner);
            }

            if (internalName != null && internalName.StartsWith("Waypoint-"))
            {
                return(TrinityObjectType.Waypoint);
            }

            return(TrinityObjectType.Unknown);
        }