Ejemplo n.º 1
0
        private async Task <bool> TaxiCs(Client client, CSManager csManager, Action <uint> setTeleportId)
        {
            Log.Information($"Client {client.Game.Me.Name} Taking waypoint to {Waypoint.RiverOfFlame}");
            if (!await _townManagementService.TakeWaypoint(client, Waypoint.RiverOfFlame))
            {
                Log.Warning($"Client {client.Game.Me.Name} Teleporting failed at location {client.Game.Me.Location}");
                return(false);
            }

            Log.Information($"Client {client.Game.Me.Name} Teleporting to {Area.ChaosSanctuary}");
            var pathToChaos = await _pathingService.GetPathToObjectWithOffset(client.Game.MapId, Difficulty.Normal, Area.RiverOfFlame, client.Game.Me.Location, EntityCode.WaypointAct4Levels, -6, -319, MovementMode.Teleport);

            if (!await MovementHelpers.TakePathOfLocations(client.Game, pathToChaos, MovementMode.Teleport))
            {
                Log.Warning($"Client {client.Game.Me.Name} Teleporting to {Area.ChaosSanctuary} warp failed at location {client.Game.Me.Location}");
                return(false);
            }

            var goalLocation = client.Game.Me.Location.Add(0, -30);

            if (!await GeneralHelpers.TryWithTimeout(async(_) =>
            {
                return(await client.Game.TeleportToLocationAsync(goalLocation));
            }, TimeSpan.FromSeconds(5)))
            {
                return(false);
            }

            var pathToDiabloStar = await _pathingService.GetPathToObject(client.Game.MapId, Difficulty.Normal, Area.ChaosSanctuary, client.Game.Me.Location, EntityCode.DiabloStar, MovementMode.Teleport);

            if (!await MovementHelpers.TakePathOfLocations(client.Game, pathToDiabloStar, MovementMode.Teleport))
            {
                Log.Warning($"Client {client.Game.Me.Name} Teleporting to {EntityCode.DiabloStar} failed at location {client.Game.Me.Location}");
                return(false);
            }

            if (!_townManagementService.CreateTownPortal(client))
            {
                return(false);
            }

            var myPortal = client.Game.GetEntityByCode(EntityCode.TownPortal).First(t => t.TownPortalOwnerId == client.Game.Me.Id);

            setTeleportId.Invoke(myPortal.Id);
            csManager.ResetAliveMonsters();
            if (!await WaitForBo(client))
            {
                return(false);
            }

            csManager.ResetAliveMonsters();

            setTeleportId.Invoke(0);

            if (!await KillLeftSeal(client, csManager, setTeleportId))
            {
                return(false);
            }

            csManager.ResetAliveMonsters();
            setTeleportId.Invoke(0);

            if (!await KillTopSeal(client, csManager, setTeleportId))
            {
                return(false);
            }

            csManager.ResetAliveMonsters();
            setTeleportId.Invoke(0);

            if (!await KillRightSeal(client, csManager, setTeleportId))
            {
                return(false);
            }

            csManager.ResetAliveMonsters();
            setTeleportId.Invoke(0);

            return(await KillDiablo(client, csManager, setTeleportId));
        }