public bool LimitedRaidBattle(string raidId) { var battleInfo = LimitedRaidBattleInfo(raidId); if (battleInfo.isPlaying) { var hp = battleInfo.hp - battleInfo.totalDamage; bool useFullAttack = hp > _client.ViewModel.EasyBossDamage; var attackType = useFullAttack ? AstrumClient.FULL : AstrumClient.NORMAL; var needBp = useFullAttack ? AstrumClient.BP_FULL : AstrumClient.BP_NORMAL; if (_client.ViewModel.Fever) { int quantity = needBp - _client.ViewModel.BpValue; if (quantity > 0 && quantity <= _client.ViewModel.CanUseBpQuantity) { _client.UseItem(AstrumClient.ITEM_BP, AstrumClient.INSTANT_MINI_BP, quantity); } } if (_client.ViewModel.BpValue >= needBp) { LimitedRaidBattleAttack(battleInfo._id, attackType); return(true); } } return(false); }
private async void UseHalfStaminaButton_Click(object sender, RoutedEventArgs e) { await Task.Run(() => { try { if (client.ViewModel.StaminaHalfStock > 0) { client.UseItem(AstrumClient.ITEM_STAMINA, AstrumClient.INSTANT_HALF_STAMINA, 1); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }); }
public bool FuryRaidBattle(string raidId) { var battleInfo = FuryBattleInfo(raidId); if (battleInfo.isPlaying) { if (battleInfo.isNew) { var attackType = AstrumClient.FIRST; if (AstrumClient.RESCUE.Equals(battleInfo.type)) { attackType = AstrumClient.RESCUE; } FuryRaidBattleAttack(battleInfo._id, attackType); return(true); } if (battleInfo.rescue.use) { FuryRaidBattleRescue(battleInfo._id); } if (AstrumClient.FIND.Equals(battleInfo.type)) { var hp = battleInfo.hp - battleInfo.totalDamage; bool useFullAttack = hp > _client.ViewModel.EasyBossDamage; var attackType = useFullAttack ? AstrumClient.FULL : AstrumClient.NORMAL; var needBp = useFullAttack ? AstrumClient.BP_FULL : AstrumClient.BP_NORMAL; if (battleInfo.rare == 4) { int quantity = needBp - _client.ViewModel.BpValue; if (quantity > 0 && quantity <= _client.ViewModel.CanUseBpQuantity) { _client.UseItem(AstrumClient.ITEM_BP, AstrumClient.INSTANT_MINI_BP, quantity); } } if (_client.ViewModel.BpValue >= needBp) { FuryRaidBattleAttack(battleInfo._id, attackType); return(true); } } } else { FuryRaidBattleResult(raidId); } return(false); }
public void Run() { _client.Access("breeding"); var breedingInfo = BreedingInfo(); var stage = EnterBreedingStage(); var areaId = stage._id; while (_client.ViewModel.IsRunning) { if (stage.isBossStage) { BreedingAreaBossBattle(areaId); return; } else if (stage.stageClear && stage.nextStage.isBossStage) { stage = ForwardBreedingStage(areaId); _client.RaiseNotificationEvent("area boss", AstrumClient.DELAY_LONG); BreedingAreaBossBattle(areaId); return; } else { var breedingRaidId = stage.status.breeding._id; if (breedingRaidId != null) { _client.ViewModel.IsBreedingRaid = true; if (_client.ViewModel.CanFullAttackForEvent) { BreedingRaid(breedingRaidId); return; } } else { _client.ViewModel.IsBreedingRaid = false; } bool isBpFull = _client.ViewModel.BpValue >= AstrumClient.BP_FULL; bool isFever = _client.ViewModel.Fever; if (!isBpFull && !isFever) { _client.ViewModel.IsStaminaEmpty = true; } else { _client.ViewModel.IsStaminaEmpty = false; } if (_client.ViewModel.IsStaminaEmpty) { bool staminaGreaterThanKeep = _client.ViewModel.StaminaValue >= _client.ViewModel.KeepStamina; bool staminaGreaterThanExp = _client.ViewModel.StaminaValue >= (_client.ViewModel.ExpMax - _client.ViewModel.ExpValue); if (staminaGreaterThanKeep || staminaGreaterThanExp) { _client.ViewModel.IsStaminaEmpty = false; } else { return; } } if (stage.staminaEmpty) { if (stage.items != null && _client.ViewModel.ExpMax - _client.ViewModel.ExpValue > 100) { var item = stage.items.Find(e => AstrumClient.INSTANT_HALF_STAMINA.Equals(e._id)); if (item.stock > _client.ViewModel.MinStaminaStock && _client.ViewModel.Fever) { _client.UseItem(AstrumClient.ITEM_STAMINA, AstrumClient.INSTANT_HALF_STAMINA, 1); return; } else { _client.ViewModel.IsStaminaEmpty = true; return; } } else { _client.ViewModel.IsStaminaEmpty = true; return; } } //forward stage = ForwardBreedingStage(areaId); } } }
public void Run() { _client.Access("stage"); var viewModel = _client.ViewModel; var stage = EnterStage(); var areaId = stage._id; while (viewModel.IsRunning) { if (stage.isBossStage) { AreaBossBattle(areaId); return; } else if (stage.stageClear && stage.nextStage.isBossStage) { stage = ForwardStage(areaId); AreaBossBattle(areaId); return; } else { viewModel.IsFuryRaid = false; viewModel.IsLimitedRaid = false; if (viewModel.IsFuryRaidEnable) { viewModel.IsFuryRaid = true; if (stage.furyraid != null) { if (stage.furyraid.rare == 4) { viewModel.CanFuryRaid = true; } } else if (viewModel.CanFuryRaid) { _client.FuryRaid(); viewModel.CanFuryRaid = false; return; } else if (!viewModel.Fever) { if (stage.status.furyraid.find != null) { if (stage.status.furyraid.find.isNew || viewModel.CanFullAttack) { _client.FuryRaid(); return; } } if (stage.status.furyraid.rescue != null) { if (stage.status.furyraid.rescue.isNew) { _client.FuryRaid(); return; } } } } if (viewModel.IsLimitedRaidEnable) { var limitedRaidId = stage.status.limitedraid._id; if (limitedRaidId != null) { viewModel.IsLimitedRaid = true; if (viewModel.CanFullAttackForEvent) { _client.LimitedRaid(); return; } } } if (stage.status.raid != null && !viewModel.Fever) { viewModel.IsFuryRaid = false; viewModel.IsLimitedRaid = false; viewModel.IsBreedingRaid = false; if (stage.status.raid.find != null) { if (stage.status.raid.find.isNew || viewModel.CanFullAttack) { _client.Raid(); return; } } if (stage.status.raid.rescue != null) { if (stage.status.raid.rescue.isNew || viewModel.CanFullAttack) { _client.Raid(); return; } } } if (viewModel.IsStaminaEmpty) { bool staminaGreaterThanKeep = viewModel.StaminaValue >= viewModel.KeepStamina; bool staminaGreaterThanExp = viewModel.StaminaValue >= (viewModel.ExpMax - viewModel.ExpValue); bool isBpFull = viewModel.BpValue >= AstrumClient.BP_FULL; bool isFever = viewModel.Fever; if (staminaGreaterThanKeep || staminaGreaterThanExp || isBpFull || isFever) { viewModel.IsStaminaEmpty = false; } else { return; } } if (stage.staminaEmpty) { if (stage.items != null && viewModel.ExpMax - viewModel.ExpValue > 100) { var item = stage.items.Find(e => AstrumClient.INSTANT_HALF_STAMINA.Equals(e._id)); if (item.stock > viewModel.MinStaminaStock && viewModel.Fever) { _client.UseItem(AstrumClient.ITEM_STAMINA, AstrumClient.INSTANT_HALF_STAMINA, 1); return; } else { viewModel.IsStaminaEmpty = true; return; } } else { viewModel.IsStaminaEmpty = true; return; } } //forward stage = ForwardStage(areaId); } } }