Example #1
0
        public async Task <bool> Run()
        {
            if (!Enabled || !World.CurrentArea.IsTown)
            {
                return(false);
            }

            await StaticPositions.GetCommonPortalSpotByAct().ComeAtOnce();

            var portalObj = LokiPoe.LocalData.TownPortals.Find(p => p.NetworkObject.IsTargetable && p.OwnerName == LokiPoe.Me.Name);

            if (portalObj == null)
            {
                GlobalLog.Error("[ReturnAfterTownrunTask] There is no portal to enter.");
                Enabled = false;
                return(true);
            }

            var portal = portalObj.NetworkObject as Portal;
            await portal.WalkablePosition().ComeAtOnce();

            if (!await PlayerAction.TakePortal(portal))
            {
                ErrorManager.ReportError();
                return(true);
            }
            Enabled = false;
            return(true);
        }
Example #2
0
        public static async Task <bool> OpenWaypoint()
        {
            WalkablePosition wpPos;

            if (World.CurrentArea.IsTown)
            {
                wpPos = StaticPositions.GetWaypointPosByAct();
            }
            else
            {
                var wpObj = LokiPoe.ObjectManager.Waypoint;
                if (wpObj == null)
                {
                    GlobalLog.Error("[OpenWaypoint] Fail to find any Waypoint nearby.");
                    return(false);
                }
                wpPos = wpObj.WalkablePosition();
            }

            await EnableAlwaysHighlight();

            await wpPos.ComeAtOnce();

            if (!await Interact(LokiPoe.ObjectManager.Waypoint, () => LokiPoe.InGameState.WorldUi.IsOpened, "wold panel opening"))
            {
                return(false);
            }

            await Wait.SleepSafe(200);

            return(true);
        }
Example #3
0
        public static async Task <bool> OpenStash()
        {
            if (StashUi.IsOpened)
            {
                return(true);
            }

            WalkablePosition stashPos;

            if (World.CurrentArea.IsTown)
            {
                stashPos = StaticPositions.GetStashPosByAct();
            }
            else
            {
                var stashObj = LokiPoe.ObjectManager.Stash;
                if (stashObj == null)
                {
                    GlobalLog.Error("[OpenStash] Fail to find any Stash nearby.");
                    return(false);
                }
                stashPos = stashObj.WalkablePosition();
            }

            await PlayerAction.EnableAlwaysHighlight();

            await stashPos.ComeAtOnce();

            if (!await PlayerAction.Interact(LokiPoe.ObjectManager.Stash, () => StashUi.IsOpened && StashUi.StashTabInfo != null, "stash opening"))
            {
                return(false);
            }

            await Wait.SleepSafe(200);

            return(true);
        }