public HashSet <GoapGoal> CreateGoals(ClassConfiguration classConfig, IBlacklist blacklist) { var availableActions = new HashSet <GoapGoal>(); List <WowPoint> pathPoints, spiritPath; GetPaths(out pathPoints, out spiritPath, classConfig); var playerDirection = new PlayerDirection(addonReader.PlayerReader, wowProcess, logger); var stopMoving = new StopMoving(wowProcess, addonReader.PlayerReader); var castingHandler = new CastingHandler(wowProcess, addonReader.PlayerReader, logger, classConfig, playerDirection, NpcNameFinder); var stuckDetector = new StuckDetector(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger); var followRouteAction = new FollowRouteGoal(addonReader.PlayerReader, wowProcess, playerDirection, pathPoints, stopMoving, NpcNameFinder, blacklist, logger, stuckDetector, classConfig); var walkToCorpseAction = new WalkToCorpseGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, pathPoints, stopMoving, logger, stuckDetector); this.RouteInfo = new RouteInfo(pathPoints, spiritPath, followRouteAction, walkToCorpseAction); availableActions.Clear(); if (classConfig.Mode == Mode.CorpseRun) { availableActions.Add(new WaitGoal(logger)); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else if (classConfig.Mode == Mode.AttendedGather) { availableActions.Add(followRouteAction); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else { availableActions.Add(new ItemsBrokenGoal(addonReader.PlayerReader, logger)); if (classConfig.Mode == Mode.AttendedGrind) { availableActions.Add(new WaitGoal(logger)); } else { availableActions.Add(followRouteAction); availableActions.Add(walkToCorpseAction); } availableActions.Add(new TargetDeadGoal(wowProcess, logger)); availableActions.Add(new ApproachTargetGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, stuckDetector, classConfig)); if (classConfig.WrongZone.ZoneId > 0) { availableActions.Add(new WrongZoneGoal(addonReader.PlayerReader, wowProcess, playerDirection, logger, stuckDetector, classConfig)); } if (classConfig.Parallel.Sequence.Count > 0) { availableActions.Add(new ParallelGoal(wowProcess, addonReader.PlayerReader, stopMoving, classConfig.Parallel.Sequence, castingHandler, logger)); } var lootAction = new LootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); if (classConfig.Loot) { lootAction = new PostKillLootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); } try { var genericCombat = new CombatGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, classConfig, castingHandler); availableActions.Add(genericCombat); availableActions.Add(new PullTargetGoal(wowProcess, addonReader.PlayerReader, NpcNameFinder, stopMoving, logger, castingHandler, stuckDetector, classConfig)); foreach (var item in classConfig.Adhoc.Sequence) { availableActions.Add(new AdhocGoal(wowProcess, addonReader.PlayerReader, stopMoving, item, castingHandler, logger)); } } catch (Exception ex) { logger.LogError(ex.ToString()); } } return(availableActions); }
public HashSet <GoapGoal> CreateGoals(ClassConfiguration classConfig, IBlacklist blacklist) { var availableActions = new HashSet <GoapGoal>(); List <WowPoint> pathPoints, spiritPath; GetPaths(out pathPoints, out spiritPath, classConfig); var playerDirection = new PlayerDirection(addonReader.PlayerReader, wowProcess, logger); var stopMoving = new StopMoving(wowProcess, addonReader.PlayerReader); var castingHandler = new CastingHandler(wowProcess, addonReader.PlayerReader, logger, classConfig, playerDirection, NpcNameFinder); var stuckDetector = new StuckDetector(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger); var followRouteAction = new FollowRouteGoal(addonReader.PlayerReader, wowProcess, playerDirection, pathPoints, stopMoving, NpcNameFinder, blacklist, logger, stuckDetector, classConfig, pather); var walkToCorpseAction = new WalkToCorpseGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, pathPoints, stopMoving, logger, stuckDetector, pather); availableActions.Clear(); if (classConfig.Mode == Mode.CorpseRun) { availableActions.Add(new WaitGoal(logger)); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else if (classConfig.Mode == Mode.AttendedGather) { availableActions.Add(followRouteAction); availableActions.Add(new CorpseRunGoal(addonReader.PlayerReader, wowProcess, playerDirection, spiritPath, stopMoving, logger, stuckDetector)); } else { if (classConfig.Mode == Mode.AttendedGrind) { availableActions.Add(new WaitGoal(logger)); } else { availableActions.Add(followRouteAction); availableActions.Add(walkToCorpseAction); } availableActions.Add(new TargetDeadGoal(wowProcess, logger)); availableActions.Add(new ApproachTargetGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, stuckDetector, classConfig)); if (classConfig.WrongZone.ZoneId > 0) { availableActions.Add(new WrongZoneGoal(addonReader.PlayerReader, wowProcess, playerDirection, logger, stuckDetector, classConfig)); } if (classConfig.Parallel.Sequence.Count > 0) { availableActions.Add(new ParallelGoal(wowProcess, addonReader.PlayerReader, stopMoving, classConfig.Parallel.Sequence, castingHandler, logger)); } var lootAction = new LootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); if (classConfig.Loot) { lootAction = new PostKillLootGoal(wowProcess, addonReader.PlayerReader, addonReader.BagReader, stopMoving, logger, classConfig); lootAction.AddPreconditions(); availableActions.Add(lootAction); } try { var genericCombat = new CombatGoal(wowProcess, addonReader.PlayerReader, stopMoving, logger, classConfig, castingHandler); availableActions.Add(genericCombat); availableActions.Add(new PullTargetGoal(wowProcess, addonReader.PlayerReader, NpcNameFinder, stopMoving, logger, castingHandler, stuckDetector, classConfig)); foreach (var item in classConfig.Adhoc.Sequence) { availableActions.Add(new AdhocGoal(wowProcess, addonReader.PlayerReader, stopMoving, item, castingHandler, logger)); } } catch (Exception ex) { logger.LogError(ex.ToString()); } var pathProviders = new List <IRouteProvider> { followRouteAction, walkToCorpseAction }; if (classConfig.VendorLocation.X > 0 && !string.IsNullOrEmpty(classConfig.VendorTargetKey)) { var vendorAction = new VendorGoal(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfig, pather, this.addonReader.BagReader); availableActions.Add(vendorAction); pathProviders.Add(vendorAction); } else { logger.LogWarning("Vendor location or target key is not defined, so no vendoring when bags are full."); } if (classConfig.RepairLocation.X > 0 && !string.IsNullOrEmpty(classConfig.RepairTargetKey)) { var repairAction = new RepairGoal(addonReader.PlayerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfig, pather, this.addonReader.BagReader); availableActions.Add(repairAction); pathProviders.Add(repairAction); } else { availableActions.Add(new ItemsBrokenGoal(addonReader.PlayerReader, logger)); logger.LogWarning("Repair location or target key is not defined, so bot will stop if gear is red."); } this.RouteInfo = new RouteInfo(pathPoints, spiritPath, pathProviders, addonReader.PlayerReader); } return(availableActions); }