internal WhirlpoolEvent(IEnumerable<Ship> rpShips, Fleet rpEscortFleet, RawMapExploration rpData) : base(rpData) { var rMaxAmount = (double)rpShips.Max(r => LostMaterial == MaterialType.Fuel ? r.Fuel.Current : r.Bullet.Current); var rReducedRate = Amount / rMaxAmount; var rTotalAmount = 0; foreach (var rShip in rpShips) { int rReducedAmount; if (LostMaterial == MaterialType.Fuel) { rReducedAmount = (int)(rShip.Fuel.Current * rReducedRate); rShip.Fuel.Current -= rReducedAmount; } else { rReducedAmount = (int)(rShip.Bullet.Current * rReducedRate); rShip.Bullet.Current -= rReducedAmount; } rTotalAmount += rReducedAmount; } var rMessage = rpEscortFleet == null ? StringResources.Instance.Main.Sortie_Whirlpool_Message : StringResources.Instance.Main.Sortie_Whirlpool_Message_CombinedFleet; Message = string.Format(rMessage, LostMaterial == MaterialType.Fuel ? "[icon]fuel[/icon]" : "[icon]bullet[/icon]", rTotalAmount, rReducedRate); }
void ProcessEscortSuccess(RawMapExploration rpData) { if (rpData.RankingPointBonus == 0) return; InsertRecord(rpData.RankingPointBonus); }
internal BattleEvent(MapInfo rpMap, RawMapExploration rpData, string rpNodeWikiID) : base(rpData) { Battle = new BattleInfo(rpData); int rNodeID; if (rpNodeWikiID.IsNullOrEmpty()) rNodeID = rpData.Node << 16; else rNodeID = rpNodeWikiID[0] - 'A'; EnemyEncounters = EnemyEncounterService.Instance.GetEncounters(rpMap.ID, rNodeID, rpMap.Difficulty); }
internal void Explore(RawMapExploration rpData) { PreviousNode = Node; if (PreviousNode != null) PreviousNode.Event = null; DirectionAngle = MapService.Instance.GetAngle(Map.ID, rpData.StartNode ?? Node?.ID ?? 0, rpData.Node); OnPropertyChanged(nameof(DirectionAngle)); Node = new SortieNodeInfo(Map, rpData); OnPropertyChanged(nameof(Node)); OnPropertyChanged(nameof(PreviousNode)); }
internal WhirlpoolEvent(RawMapExploration rpData) : base(rpData) { var rShips = KanColleGame.Current.Port.Fleets.Table.Values .Where(r => (r.State & FleetState.Sortie) == FleetState.Sortie) .SelectMany(r => r.Ships); var rMaxAmount = (double)rShips.Max(r => LostMaterial == MaterialType.Fuel ? r.Fuel.Current : r.Bullet.Current); var rReducedRate = Amount / rMaxAmount; foreach (var rShip in rShips) if (LostMaterial == MaterialType.Fuel) rShip.Fuel = rShip.Fuel.Update(rShip.Fuel.Current - (int)(rShip.Fuel.Current * rReducedRate)); else rShip.Bullet = rShip.Bullet.Update(rShip.Bullet.Current - (int)(rShip.Bullet.Current * rReducedRate)); }
void Explore(IReadOnlyDictionary<string, string> rpRequests, RawMapExploration rpData) { Cell = new SortieCellInfo(rpData); var rDifficulty = Map.Difficulty; if (!rDifficulty.HasValue) Cell.InternalID = Cell.ID; else { var rDifficultyCount = Enum.GetNames(typeof(EventMapDifficulty)).Length - 1; Cell.InternalID = Cell.ID * rDifficultyCount + (int)rDifficulty.Value - 3; } OnPropertyChanged(nameof(Cell)); }
internal WhirlpoolEvent(RawMapExploration rpData) : base(rpData) { var rSortie = SortieInfo.Current; IEnumerable<Ship> rShips = rSortie.Fleet.Ships; if (rSortie.EscortFleet != null) rShips = rShips.Concat(rSortie.EscortFleet.Ships); var rMaxAmount = (double)rShips.Max(r => LostMaterial == MaterialType.Fuel ? r.Fuel.Current : r.Bullet.Current); var rReducedRate = Amount / rMaxAmount; foreach (var rShip in rShips) if (LostMaterial == MaterialType.Fuel) rShip.Fuel = rShip.Fuel.Update(rShip.Fuel.Current - (int)(rShip.Fuel.Current * rReducedRate)); else rShip.Bullet = rShip.Bullet.Update(rShip.Bullet.Current - (int)(rShip.Bullet.Current * rReducedRate)); }
internal RewardEvent(RawMapExploration rpData) : base(rpData) { if (RawData.Rewards == null) return; switch (RawData.Rewards.Type) { case JTokenType.Array: Rewards = RawData.Rewards.ToObject<RawMapExploration.RawReward[]>(); break; case JTokenType.Object: Rewards = new[] { RawData.Rewards.ToObject<RawMapExploration.RawReward>() }; break; } }
internal SortieCellInfo(RawMapExploration rpData) { ID = rpData.Cell; EventType = rpData.CellEventType; EventSubType = rpData.CellEventSubType; switch (EventType) { case SortieEventType.Reward: Event = new RewardEvent(rpData); break; case SortieEventType.Whirlpool: Event = new WhirlpoolEvent(rpData); break; case SortieEventType.NormalBattle: case SortieEventType.BossBattle: Event = new BattleEvent(rpData); break; case SortieEventType.NothingHappened: Event = new NothingHappenedEvent(rpData); break; case SortieEventType.AviationReconnaissance: Event = new AviationReconnaissanceEvent(rpData); break; case SortieEventType.EscortSuccess: Event = new EscortSuccessEvent(rpData); break; case SortieEventType.Landing: Event = new LandingEvent(rpData); break; } IsDeadEnd = rpData.NextRouteCount == 0; }
internal BattleInfo(long rpTimestamp, RawMapExploration rpData) { Current = this; ID = rpTimestamp; var rSortie = SortieInfo.Current; Participants.FriendMain = rSortie.MainShips; Participants.FriendEscort = rSortie.EscortShips; foreach (FriendShip rShip in rSortie.MainShips) rShip.IsMVP = false; if (rSortie.EscortShips != null) foreach (FriendShip rShip in rSortie.EscortShips) rShip.IsMVP = false; CurrentStage = new FakeStage(this); OnPropertyChanged(nameof(CurrentStage)); IsBossBattle = rpData.NodeEventType == SortieEventType.BossBattle; if ((BattleType)rpData.NodeEventSubType == BattleType.Normal) { var rSupportFleets = KanColleGame.Current.Port.Fleets.Table.Values .Where(r => r.ExpeditionStatus.Expedition != null && !r.ExpeditionStatus.Expedition.CanReturn) .Select(r => r.ExpeditionStatus.Expedition) .SingleOrDefault(r => r.MapArea.ID == rSortie.Map.MasterInfo.AreaID && r.Time == (!IsBossBattle ? 15 : 30)); IsSupportFleetReady = rSupportFleets != null; } if (rSortie.LandBaseAerialSupportRequests != null) { var rNodeUniqueID = MapService.Instance.GetNodeUniqueID(rSortie.Map.ID, rpData.Node); if (rNodeUniqueID.HasValue && rSortie.LandBaseAerialSupportRequests.Any(r => r == rNodeUniqueID.Value)) IsLandBaseAerialSupportReady = true; } }
internal AviationReconnaissanceEvent(RawMapExploration rpData) : base(rpData) { }
internal LandingEvent(RawMapExploration rpData) : base(rpData) { }
internal NothingHappenedEvent(RawMapExploration rpData) : base(rpData) { }
internal protected SortieEvent(RawMapExploration rpData) { RawData = rpData; }
internal BattleEvent(RawMapExploration rpData) : base(rpData) { Battle = new BattleInfo(); }
internal SortieNodeInfo(SortieInfo rpOwner, long rpTimestamp, RawMapExploration rpData) { r_Owner = rpOwner; ID = rpData.Node; var rMap = r_Owner.Map; WikiID = MapService.Instance.GetNodeWikiID(rMap.ID, ID); EventType = rpData.NodeEventType; EventSubType = rpData.NodeEventSubType; switch (EventType) { case SortieEventType.Reward: Event = new RewardEvent(rpData); break; case SortieEventType.Whirlpool: Event = new WhirlpoolEvent(r_Owner.Fleet.Ships, r_Owner.EscortFleet, rpData); break; case SortieEventType.NormalBattle: case SortieEventType.BossBattle: Event = new BattleEvent(rpTimestamp, rMap, rpData, WikiID); break; case SortieEventType.NothingHappened: Event = new NothingHappenedEvent(rMap, rpData); break; case SortieEventType.AviationReconnaissance: Event = new AviationReconnaissanceEvent(rpData); break; case SortieEventType.EscortSuccess: Event = new EscortSuccessEvent(rpData); break; case SortieEventType.Landing: Event = new LandingEvent(rpData); break; } IsDeadEnd = rpData.NextRouteCount == 0; if (rpData.EnemyAerialRaid != null) try { EnemyAerialRaid = new EnemyAerialRaid(rpData.EnemyAerialRaid); var rBattleEvent = Event as BattleEvent; if (rBattleEvent != null) { rBattleEvent.EnemyAerialRaid = EnemyAerialRaid; EnemyAerialRaid = null; } } catch (Exception e) { Logger.Write(LoggingLevel.Error, string.Format(StringResources.Instance.Main.Log_Exception_API_ParseException, e.Message)); } }
internal RewardEvent(RawMapExploration rpData) : base(rpData) { }
internal protected RewardEventBase(RawMapExploration rpData) : base(rpData) { }
internal EscortSuccessEvent(RawMapExploration rpData) : base(rpData) { }