diff --git a/ElectronicObserver/Assets.zip b/ElectronicObserver/Assets.zip index 482a50a1d..5a547137c 100644 Binary files a/ElectronicObserver/Assets.zip and b/ElectronicObserver/Assets.zip differ diff --git a/ElectronicObserver/Assets/Equipment/PicketCrew.png b/ElectronicObserver/Assets/Equipment/PicketCrew.png new file mode 100644 index 000000000..e9a19d4a4 Binary files /dev/null and b/ElectronicObserver/Assets/Equipment/PicketCrew.png differ diff --git a/ElectronicObserver/Data/Constants.cs b/ElectronicObserver/Data/Constants.cs index d98dfdef2..227d037c4 100644 --- a/ElectronicObserver/Data/Constants.cs +++ b/ElectronicObserver/Data/Constants.cs @@ -401,6 +401,54 @@ public static string GetAACutinKind( int id ) { } + /// + /// 勝利ランクを表すIDを取得します。 + /// + public static int GetWinRank( string rank ) { + switch ( rank.ToUpper() ) { + case "E": + return 1; + case "D": + return 2; + case "C": + return 3; + case "B": + return 4; + case "A": + return 5; + case "S": + return 6; + case "SS": + return 7; + default: + return 0; + } + } + + /// + /// 勝利ランクを表す文字列を取得します。 + /// + public static string GetWinRank( int rank ) { + switch ( rank ) { + case 1: + return "E"; + case 2: + return "D"; + case 3: + return "C"; + case 4: + return "B"; + case 5: + return "A"; + case 6: + return "S"; + case 7: + return "SS"; + default: + return "不明"; + } + } + #endregion diff --git a/ElectronicObserver/Data/KCDatabase.cs b/ElectronicObserver/Data/KCDatabase.cs index 87bd5e886..e0f3adb51 100644 --- a/ElectronicObserver/Data/KCDatabase.cs +++ b/ElectronicObserver/Data/KCDatabase.cs @@ -1,4 +1,5 @@ using ElectronicObserver.Data.Battle; +using ElectronicObserver.Data.Quest; using System; using System.Collections.Generic; using System.Linq; @@ -104,6 +105,11 @@ public static KCDatabase Instance { /// public QuestManager Quest { get; private set; } + /// + /// 任務進捗データ + /// + public QuestProgressManager QuestProgress { get; private set; } + /// /// 戦闘データ @@ -146,6 +152,7 @@ private KCDatabase() { Fleet = new FleetManager(); Material = new MaterialData(); Quest = new QuestManager(); + QuestProgress = new QuestProgressManager(); Battle = new BattleManager(); MapInfo = new IDDictionary(); Mission = new IDDictionary(); @@ -161,11 +168,20 @@ public void Load() { if ( temp != null ) ShipGroup = temp; } + { + var temp = QuestProgress.Load(); + if ( temp != null ) { + if ( QuestProgress != null ) + QuestProgress.RemoveEvents(); + QuestProgress = temp; + } + } } public void Save() { ShipGroup.Save(); + QuestProgress.Save(); } } diff --git a/ElectronicObserver/Data/Quest/DestroyEquipment.cs b/ElectronicObserver/Data/Quest/DestroyEquipment.cs deleted file mode 100644 index 187aa60c9..000000000 --- a/ElectronicObserver/Data/Quest/DestroyEquipment.cs +++ /dev/null @@ -1,30 +0,0 @@ -using ElectronicObserver.Observer; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Data.Quest { - - /// - /// 装備を破棄した回数(≠個数)をカウントします。 - /// - public class DestroyEquipment : QuestCounter { - - - public override void Register() { - APIObserver ao = APIObserver.Instance; - - ao.APIList["api_req_kousyou/destroyitem2"].RequestReceived += Received; - - } - - public override void Unregister() { - APIObserver ao = APIObserver.Instance; - - ao.APIList["api_req_kousyou/destroyitem2"].RequestReceived -= Received; - } - } - -} diff --git a/ElectronicObserver/Data/Quest/DestroyShip.cs b/ElectronicObserver/Data/Quest/DestroyShip.cs deleted file mode 100644 index f9827021d..000000000 --- a/ElectronicObserver/Data/Quest/DestroyShip.cs +++ /dev/null @@ -1,29 +0,0 @@ -using ElectronicObserver.Observer; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Data.Quest { - - public class DestroyShip : QuestCounter { - - /// - /// 艦船を解体した回数をカウントします。 - /// - public override void Register() { - APIObserver ao = APIObserver.Instance; - - ao.APIList["api_req_kousyou/destroyship"].RequestReceived += Received; - - } - - public override void Unregister() { - APIObserver ao = APIObserver.Instance; - - ao.APIList["api_req_kousyou/destroyship"].RequestReceived -= Received; - } - - } -} diff --git a/ElectronicObserver/Data/Quest/ProgressAGo.cs b/ElectronicObserver/Data/Quest/ProgressAGo.cs new file mode 100644 index 000000000..190adbb7d --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressAGo.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 任務「あ号作戦」の進捗を管理します。 + /// + [DataContract( Name = "ProgressAGo" )] + public class ProgressAGo : ProgressData { + + /// + /// 達成に必要な出撃回数 + /// + [IgnoreDataMember] + private int sortieMax { get { return 36; } } + + /// + /// 達成に必要なS勝利回数 + /// + [IgnoreDataMember] + private int sWinMax { get { return 6; } } + + /// + /// 達成に必要なボス戦闘回数 + /// + [IgnoreDataMember] + private int bossMax { get { return 24; } } + + /// + /// 達成に必要なボス勝利回数 + /// + [IgnoreDataMember] + private int bossWinMax { get { return 12; } } + + + /// + /// 現在の出撃回数 + /// + [IgnoreDataMember] + private int sortieCount { + get { return Progress & 0xFF; } + set { Progress = ( Progress & ~0xFF ) | ( value & 0xFF ); } + } + + /// + /// 現在のS勝利回数 + /// + [IgnoreDataMember] + private int sWinCount { + get { return ( Progress >> 8 ) & 0xFF; } + set { Progress = ( Progress & ~( 0xFF << 8 ) ) | ( ( value & 0xFF ) << 8 ); } + } + + /// + /// 現在のボス戦闘回数 + /// + [IgnoreDataMember] + private int bossCount { + get { return ( Progress >> 16 ) & 0xFF; } + set { Progress = ( Progress & ~( 0xFF << 16 ) ) | ( ( value & 0xFF ) << 16 ); } + } + + /// + /// 現在のボス勝利回数 + /// + [IgnoreDataMember] + private int bossWinCount { + get { return ( Progress >> 24 ) & 0xFF; } + set { Progress = ( Progress & ~( 0xFF << 24 ) ) | ( ( value & 0xFF ) << 24 ); } + } + + + + public ProgressAGo( int questID ) + : base( questID, 0 ) { + } + + + public override double ProgressPercentage { + get { + double prog = 0; + prog += Math.Min( (double)sortieCount / sortieMax, 1.0 ) * 0.25; + prog += Math.Min( (double)sWinCount / sWinMax, 1.0 ) * 0.25; + prog += Math.Min( (double)bossCount / bossMax, 1.0 ) * 0.25; + prog += Math.Min( (double)bossWinCount / bossWinMax, 1.0 ) * 0.25; + return prog; + } + } + + + + public override void Increment() { + throw new NotSupportedException(); + } + + + public override void CheckProgress( int progressFlag ) { + //なにもしない + } + + + /// + /// 出撃回数を増やします。 + /// + public void IncrementSortie() { + sortieCount = Math.Min( sortieCount + 1, sortieMax ); + } + + /// + /// 戦闘回数を増やします。 + /// + public void IncrementBattle( string rank, bool isBoss ) { + + int irank = Constants.GetWinRank( rank ); + + if ( isBoss ) { + bossCount = Math.Min( bossCount + 1, bossMax ); + + if ( irank >= Constants.GetWinRank( "B" ) ) + bossWinCount = Math.Min( bossWinCount + 1, bossWinMax ); + } + + if ( irank >= Constants.GetWinRank( "S" ) ) + sWinCount = Math.Min( sWinCount + 1, sWinMax ); + + } + + + public override string ToString() { + return string.Format( "出撃 {0}/{1}, S勝利 {2}/{3}, ボス {4}/{5}, ボス勝利 {6}/{7} ({8:p})", + sortieCount, sortieMax, + sWinCount, sWinMax, + bossCount, bossMax, + bossWinCount, bossMax, + ProgressPercentage ); + } + + } + +} diff --git a/ElectronicObserver/Data/Quest/ProgressBattle.cs b/ElectronicObserver/Data/Quest/ProgressBattle.cs new file mode 100644 index 000000000..2a572f393 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressBattle.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 戦闘系の任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressBattle" )] + public class ProgressBattle : ProgressData { + + /// + /// 条件を満たす最低ランク + /// + [DataMember] + private int LowestRank { get; set; } + + /// + /// 対象となる海域 + /// + [DataMember] + private HashSet TargetArea { get; set; } + + /// + /// ボス限定かどうか + /// + [DataMember] + private bool IsBossOnly { get; set; } + + + public ProgressBattle( int questID, int maxCount, string lowestRank, int[] targetArea, bool isBossOnly ) + : base( questID, maxCount ) { + + LowestRank = Constants.GetWinRank( lowestRank ); + TargetArea = targetArea == null ? null : new HashSet( targetArea ); + IsBossOnly = isBossOnly; + } + + + + public void Increment( string rank, int areaID, bool isBoss ) { + + if ( TargetArea != null && !TargetArea.Contains( areaID ) ) + return; + + if ( Constants.GetWinRank( rank ) < LowestRank ) + return; + + if ( IsBossOnly && !isBoss ) + return; + + + Increment(); + } + + + } + +} diff --git a/ElectronicObserver/Data/Quest/ProgressConstruction.cs b/ElectronicObserver/Data/Quest/ProgressConstruction.cs new file mode 100644 index 000000000..2db2a05ce --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressConstruction.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 艦船建造任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressConstruction" )] + public class ProgressConstruction : ProgressData { + + public ProgressConstruction( int questID, int maxCount ) + : base( questID, maxCount ) { + } + + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressData.cs b/ElectronicObserver/Data/Quest/ProgressData.cs new file mode 100644 index 000000000..ae94cd095 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressData.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 任務の進捗を管理する基底クラスです。 + /// + [DataContract( Name = "ProgressData" )] + public abstract class ProgressData : IIdentifiable { + + /// + /// 任務ID + /// + [DataMember] + public int QuestID { get; protected set; } + + + /// + /// 進捗現在値 + /// + [DataMember] + public int Progress { get; protected set; } + + /// + /// 進捗最大値 + /// + [DataMember] + public virtual int ProgressMax { get; protected set; } + + /// + /// 進捗率 + /// + [IgnoreDataMember] + public virtual double ProgressPercentage { + get { return (double)Progress / ProgressMax; } + } + + /// + /// クリア済みかどうか + /// + [IgnoreDataMember] + public bool IsCleared { + get { return ProgressPercentage >= 1.0; } + } + + + public ProgressData( int questID, int maxCount ) { + QuestID = questID; + ProgressMax = maxCount; + } + + + + /// + /// 進捗を1増やします。 + /// + public virtual void Increment() { + + var q = KCDatabase.Instance.Quest[QuestID]; + + // 任務が存在しないか遂行中でない場合スキップ + if ( q == null ||q.State != 2 ) + return; + + CheckProgress( q.Progress ); + + + Progress = Math.Min( Progress + 1, ProgressMax ); + + //DEBUG + //Utility.Logger.Add( 1, string.Format( "Quest++: [{0}] {1} {2}/{3}", QuestID, this.GetType().Name, Progress, ProgressMax ) ); + } + + public override string ToString() { + return string.Format( "{0}/{1}", Progress, ProgressMax ); + } + + + /// + /// 実際の進捗データから、進捗度を補正します。 + /// + /// 任務データの進捗度。 + public virtual void CheckProgress( int progressFlag ) { + + switch ( progressFlag ) { + case 1: + Progress = (int)Math.Max( Progress, Math.Ceiling( ProgressMax * 0.5 ) ); + break; + case 2: + Progress = (int)Math.Max( Progress, Math.Ceiling( ProgressMax * 0.8 ) ); + break; + } + + } + + + [IgnoreDataMember] + public int ID { + get { return QuestID; } + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressDestruction.cs b/ElectronicObserver/Data/Quest/ProgressDestruction.cs new file mode 100644 index 000000000..32618ecee --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressDestruction.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 艦船解体任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressDestruction" )] + public class ProgressDestruction : ProgressData { + + public ProgressDestruction( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressDevelopment.cs b/ElectronicObserver/Data/Quest/ProgressDevelopment.cs new file mode 100644 index 000000000..9556eb99d --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressDevelopment.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 装備開発任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressDevelopment" )] + public class ProgressDevelopment : ProgressData { + + public ProgressDevelopment( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressDiscard.cs b/ElectronicObserver/Data/Quest/ProgressDiscard.cs new file mode 100644 index 000000000..022b87a91 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressDiscard.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 装備廃棄任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressDiscard" )] + public class ProgressDiscard : ProgressData { + + public ProgressDiscard( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressDocking.cs b/ElectronicObserver/Data/Quest/ProgressDocking.cs new file mode 100644 index 000000000..afefb1975 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressDocking.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 入渠任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressDocking" )] + public class ProgressDocking : ProgressData { + + public ProgressDocking( int questID, int maxCount ) + : base( questID, maxCount ) { + } + + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressExpedition.cs b/ElectronicObserver/Data/Quest/ProgressExpedition.cs new file mode 100644 index 000000000..ec2dab6b9 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressExpedition.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 遠征の進捗を管理します。 + /// + [DataContract( Name = "ProgressExpedition" )] + public class ProgressExpedition : ProgressData { + + /// + /// 対象となる海域 + /// + [DataMember] + private HashSet TargetArea { get; set; } + + + public ProgressExpedition( int questID, int maxCount, int[] targetArea ) + : base( questID, maxCount ) { + + TargetArea = targetArea == null ? null : new HashSet( targetArea ); + } + + + + + public void Increment( int areaID ) { + + if ( TargetArea != null && !TargetArea.Contains( areaID ) ) + return; + + Increment(); + } + + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressImprovement.cs b/ElectronicObserver/Data/Quest/ProgressImprovement.cs new file mode 100644 index 000000000..1e2f784c1 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressImprovement.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 装備改修任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressImprovement" )] + public class ProgressImprovement : ProgressData { + + public ProgressImprovement( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressModernization.cs b/ElectronicObserver/Data/Quest/ProgressModernization.cs new file mode 100644 index 000000000..2e50c2a3b --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressModernization.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 近代化改修任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressModernization" )] + public class ProgressModernization : ProgressData { + + public ProgressModernization( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressPractice.cs b/ElectronicObserver/Data/Quest/ProgressPractice.cs new file mode 100644 index 000000000..377aa4360 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressPractice.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 演習任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressPractice" )] + public class ProgressPractice : ProgressData { + + /// + /// 勝利のみカウントする + /// + [DataMember] + private bool WinOnly { get; set; } + + + public ProgressPractice( int questID, int maxCount, bool winOnly ) + : base( questID, maxCount ) { + + WinOnly = winOnly; + } + + + + + public void Increment( string rank ) { + + if ( WinOnly && Constants.GetWinRank( rank ) < Constants.GetWinRank( "B" ) ) + return; + + Increment(); + } + + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressSlaughter.cs b/ElectronicObserver/Data/Quest/ProgressSlaughter.cs new file mode 100644 index 000000000..66ddda2b4 --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressSlaughter.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 特定艦種撃沈任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressSlaughter" )] + public class ProgressSlaughter : ProgressData { + + /// + /// 対象となる艦種リスト + /// + [DataMember] + private HashSet TargetShipType { get; set; } + + public ProgressSlaughter( int questID, int maxCount, int[] targetShipType ) + : base( questID, maxCount ) { + + TargetShipType = targetShipType == null ? null : new HashSet( targetShipType ); + + } + + + + public void Increment( int shipTypeID ) { + if ( TargetShipType.Contains( shipTypeID ) ) + Increment(); + } + + } +} diff --git a/ElectronicObserver/Data/Quest/ProgressSupply.cs b/ElectronicObserver/Data/Quest/ProgressSupply.cs new file mode 100644 index 000000000..19d4926cc --- /dev/null +++ b/ElectronicObserver/Data/Quest/ProgressSupply.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 補給任務の進捗を管理します。 + /// + [DataContract( Name = "ProgressSupply" )] + public class ProgressSupply : ProgressData { + + public ProgressSupply( int questID, int maxCount ) + : base( questID, maxCount ) { + } + } +} diff --git a/ElectronicObserver/Data/Quest/QuestCounter.cs b/ElectronicObserver/Data/Quest/QuestCounter.cs deleted file mode 100644 index 078a582fb..000000000 --- a/ElectronicObserver/Data/Quest/QuestCounter.cs +++ /dev/null @@ -1,95 +0,0 @@ -using ElectronicObserver.Observer; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Data.Quest { - - /// - /// 任務の進捗カウンタを処理するクラスの基底です。 - /// - public abstract class QuestCounter { - - public int Counter { get; set; } - public int CounterMax { get; protected set; } - - - public QuestCounter() { - Counter = 0; - CounterMax = 0; - } - - public QuestCounter( int max ) - : this() { - CounterMax = max; - } - - - /// - /// イベントを登録します。 - /// - public abstract void Register(); - - /// - /// イベントの登録を解除します。*絶対に*忘れないでください。 - /// - public abstract void Unregister(); - - /// - /// 登録したAPIが呼ばれたときに処理されます。 - /// - public virtual void Received( string apiname, dynamic data ) { - Counter++; - } - - - public override string ToString() { - return Counter + "/" + CounterMax; - } - - - /* - * memo: - * daily: - * 敵艦隊を10回邀撃せよ! - * 敵補給艦を3隻撃沈せよ! - * 南西諸島海域の制海権を握れ! - * 敵潜水艦を制圧せよ! - * 「演習」で練度向上! - * 「演習」で他提督を圧倒せよ! - * 「遠征」を3回成功させよう! - * 「遠征」を10回成功させよう! - * 艦隊大整備! - * 艦隊酒保祭り! - * 装備「開発」集中強化! - * 艦娘「建造」艦隊強化! - * 軍縮条約対応! - * 艦の「近代化改修」を実施せよ! - * 敵空母を3隻撃沈せよ! - * 敵輸送船団を叩け! - * - * weekly: - * あ号作戦 - * い号作戦 - * 海上通商破壊作戦 - * ろ号作戦 - * 海上護衛戦 - * 敵東方艦隊を撃滅せよ! - * 敵北方艦隊主力を撃滅せよ! - * 南方海域珊瑚諸島沖の制空権を握れ! - * 海上輸送路の安全確保に努めよ! - * 大規模演習 - * 大規模遠征作戦、発令! - * 南方への鼠輸送を継続実施せよ! - * 「近代化改修」を進め、戦備を整えよ! - * 資源の再利用 - * - * monthly: - * 「潜水艦隊」出撃せよ! - * - */ - } - -} diff --git a/ElectronicObserver/Data/Quest/QuestProgressManager.cs b/ElectronicObserver/Data/Quest/QuestProgressManager.cs new file mode 100644 index 000000000..f4820b58b --- /dev/null +++ b/ElectronicObserver/Data/Quest/QuestProgressManager.cs @@ -0,0 +1,499 @@ +using ElectronicObserver.Observer; +using ElectronicObserver.Utility.Mathematics; +using ElectronicObserver.Utility.Storage; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace ElectronicObserver.Data.Quest { + + /// + /// 任務の進捗を管理します。 + /// + [DataContract( Name = "QuestProgress" )] + [KnownType( typeof( ProgressData ) )] + [KnownType( typeof( ProgressAGo ) )] + [KnownType( typeof( ProgressBattle ) )] + [KnownType( typeof( ProgressConstruction ) )] + [KnownType( typeof( ProgressDestruction ) )] + [KnownType( typeof( ProgressDevelopment ) )] + [KnownType( typeof( ProgressDiscard ) )] + [KnownType( typeof( ProgressDocking ) )] + [KnownType( typeof( ProgressExpedition ) )] + [KnownType( typeof( ProgressImprovement ) )] + [KnownType( typeof( ProgressModernization ) )] + [KnownType( typeof( ProgressPractice ) )] + [KnownType( typeof( ProgressSlaughter ) )] + [KnownType( typeof( ProgressSupply ) )] + public class QuestProgressManager : DataStorage { + + + public const string DefaultFilePath = @"Settings\QuestProgress.xml"; + + + [IgnoreDataMember] + public IDDictionary Progresses { get; private set; } + + [DataMember] + private List SerializedProgresses { + get { + return Progresses.Values.ToList(); + } + set { + Progresses = new IDDictionary( value ); + } + } + + + + public QuestProgressManager() { + + Initialize(); + } + + + public override void Initialize() { + Progresses = new IDDictionary(); + + + var ao = APIObserver.Instance; + + ao.APIList["api_get_member/questlist"].ResponseReceived += QuestUpdated; + + ao.APIList["api_req_map/start"].ResponseReceived += StartSortie; + + ao.APIList["api_req_sortie/battleresult"].ResponseReceived += BattleFinished; + ao.APIList["api_req_combined_battle/battleresult"].ResponseReceived += BattleFinished; + + ao.APIList["api_req_practice/battle_result"].ResponseReceived += PracticeFinished; + + ao.APIList["api_req_mission/result"].ResponseReceived += ExpeditionCompleted; + + ao.APIList["api_req_nyukyo/start"].RequestReceived += StartRepair; + + ao.APIList["api_req_hokyu/charge"].ResponseReceived += Supplied; + + ao.APIList["api_req_kousyou/createitem"].ResponseReceived += EquipmentDeveloped; + + ao.APIList["api_req_kousyou/createship"].RequestReceived += ShipConstructed; + + ao.APIList["api_req_kousyou/destroyship"].ResponseReceived += ShipDestructed; + + ao.APIList["api_req_kousyou/destroyitem2"].ResponseReceived += EquipmentDiscarded; + + ao.APIList["api_req_kousyou/remodel_slot"].ResponseReceived += EquipmentRemodeled; + + ao.APIList["api_req_kaisou/powerup"].ResponseReceived += Modernized; + + } + + public void RemoveEvents() { + + var ao = APIObserver.Instance; + + ao.APIList["api_get_member/questlist"].ResponseReceived -= QuestUpdated; + + ao.APIList["api_req_map/start"].ResponseReceived -= StartSortie; + + ao.APIList["api_req_sortie/battleresult"].ResponseReceived -= BattleFinished; + ao.APIList["api_req_combined_battle/battleresult"].ResponseReceived -= BattleFinished; + + ao.APIList["api_req_practice/battle_result"].ResponseReceived -= PracticeFinished; + + ao.APIList["api_req_mission/result"].ResponseReceived -= ExpeditionCompleted; + + ao.APIList["api_req_nyukyo/start"].RequestReceived -= StartRepair; + + ao.APIList["api_req_hokyu/charge"].ResponseReceived -= Supplied; + + ao.APIList["api_req_kousyou/createitem"].ResponseReceived -= EquipmentDeveloped; + + ao.APIList["api_req_kousyou/createship"].RequestReceived -= ShipConstructed; + + ao.APIList["api_req_kousyou/destroyship"].ResponseReceived -= ShipDestructed; + + ao.APIList["api_req_kousyou/destroyitem2"].ResponseReceived -= EquipmentDiscarded; + + ao.APIList["api_req_kousyou/remodel_slot"].ResponseReceived -= EquipmentRemodeled; + + ao.APIList["api_req_kaisou/powerup"].ResponseReceived -= Modernized; + + } + + + + void QuestUpdated( string apiname, dynamic data ) { + + + var quests = KCDatabase.Instance.Quest; + + //消えている・達成済みの任務の進捗情報を削除 + if ( quests.IsLoaded && quests.Count == quests.Quests.Count ) + Progresses.RemoveAll( q => !quests.Quests.ContainsKey( q.QuestID ) || quests[q.QuestID].State == 3 ); + + + foreach ( var q in quests.Quests.Values ) { + + //達成済みはスキップ + if ( q.State == 3 ) continue; + + // 進捗情報の生成 + if ( !Progresses.ContainsKey( q.QuestID ) ) { + + #region 地 獄 の 任 務 I D べ た 書 き 祭 り + + switch ( q.QuestID ) { + + case 201: //|201|敵艦隊を撃破せよ!|勝利1 + Progresses.Add( new ProgressBattle( q.QuestID, 1, "B", null, false ) ); + break; + case 216: //|216|敵艦隊主力を撃滅せよ!|戦闘1 + Progresses.Add( new ProgressBattle( q.QuestID, 1, "E", null, false ) ); + break; + case 210: //|210|敵艦隊を10回邀撃せよ!|戦闘10 + Progresses.Add( new ProgressBattle( q.QuestID, 10, "E", null, false ) ); + break; + case 211: //|211|敵空母を3隻撃沈せよ!|空母3 + Progresses.Add( new ProgressSlaughter( q.QuestID, 3, new int[] { 7, 11 } ) ); + break; + case 212: //|212|敵輸送船団を叩け!|輸送5 + Progresses.Add( new ProgressSlaughter( q.QuestID, 5, new int[] { 15 } ) ); + break; + case 218: //|218|敵補給艦を3隻撃沈せよ!|輸送3 + Progresses.Add( new ProgressSlaughter( q.QuestID, 3, new int[] { 15 } ) ); + break; + case 226: //|226|南西諸島海域の制海権を握れ!|2-(1~5)ボス勝利5 + Progresses.Add( new ProgressBattle( q.QuestID, 5, "B", new int[] { 21, 22, 23, 24, 25 }, true ) ); + break; + case 230: //|230|敵潜水艦を制圧せよ!|潜水6 + Progresses.Add( new ProgressSlaughter( q.QuestID, 6, new int[] { 13 } ) ); + break; + + case 213: //|213|海上通商破壊作戦|輸送20 + Progresses.Add( new ProgressSlaughter( q.QuestID, 20, new int[] { 15 } ) ); + break; + case 214: //|214|あ号作戦|出撃36/S勝利6/ボス24/ボス勝利12 + Progresses.Add( new ProgressAGo( q.QuestID ) ); + break; + case 220: //|220|い号作戦|空母20 + Progresses.Add( new ProgressSlaughter( q.QuestID, 20, new int[] { 7, 11 } ) ); + break; + case 221: //|221|ろ号作戦|輸送50 + Progresses.Add( new ProgressSlaughter( q.QuestID, 50, new int[] { 15 } ) ); + break; + case 228: //|228|海上護衛戦|潜水15 + Progresses.Add( new ProgressSlaughter( q.QuestID, 15, new int[] { 13 } ) ); + break; + case 229: //|229|敵東方艦隊を撃滅せよ!|4-(1~4)ボス勝利12 + Progresses.Add( new ProgressBattle( q.QuestID, 12, "B", new int[] { 41, 42, 43, 44, 45 }, true ) ); + break; + case 242: //|242|敵東方中枢艦隊を撃破せよ!|4-4ボス勝利1 + Progresses.Add( new ProgressBattle( q.QuestID, 1, "B", new int[] { 44 }, true ) ); + break; + case 243: //|243|南方海域珊瑚諸島沖の制空権を握れ!|5-2ボスS勝利2 + Progresses.Add( new ProgressBattle( q.QuestID, 2, "S", new int[] { 52 }, true ) ); + break; + case 261: //|261|海上輸送路の安全確保に努めよ!|1-5ボスA勝利3 + Progresses.Add( new ProgressBattle( q.QuestID, 3, "A", new int[] { 15 }, true ) ); + break; + case 241: //|241|敵北方艦隊主力を撃滅せよ!|3-(3~5)ボス勝利5 + Progresses.Add( new ProgressBattle( q.QuestID, 5, "B", new int[] { 33, 34, 35 }, true ) ); + break; + + case 256: //|256|「潜水艦隊」出撃せよ!|6-1ボスS勝利3 + Progresses.Add( new ProgressBattle( q.QuestID, 3, "S", new int[] { 61 }, true ) ); + break; + case 265: //|265|海上護衛強化月間|1-5ボスA勝利10 + Progresses.Add( new ProgressBattle( q.QuestID, 10, "A", new int[] { 15 }, true ) ); + break; + + //undone: その他の条件付きマンスリー任務 + + case 303: //|303|「演習」で練度向上!|演習3 + Progresses.Add( new ProgressPractice( q.QuestID, 3, false ) ); + break; + case 304: //|304|「演習」で他提督を圧倒せよ!|演習勝利5 + Progresses.Add( new ProgressPractice( q.QuestID, 5, true ) ); + break; + case 302: //|302|大規模演習|演習勝利20 + Progresses.Add( new ProgressPractice( q.QuestID, 20, true ) ); + break; + + case 402: //|402|「遠征」を3回成功させよう!|遠征成功3 + Progresses.Add( new ProgressExpedition( q.QuestID, 3, null ) ); + break; + case 403: //|403|「遠征」を10回成功させよう!|遠征成功10 + Progresses.Add( new ProgressExpedition( q.QuestID, 10, null ) ); + break; + case 404: //|404|大規模遠征作戦、発令!|遠征成功30 + Progresses.Add( new ProgressExpedition( q.QuestID, 30, null ) ); + break; + case 410: //|410|南方への輸送作戦を成功させよ!|「東京急行」「東京急行(弐)」成功1 + Progresses.Add( new ProgressExpedition( q.QuestID, 1, new int[] { 37, 38 } ) ); + break; + case 411: //|411|南方への鼠輸送を継続実施せよ!|「東京急行」「東京急行(弐)」成功6 + Progresses.Add( new ProgressExpedition( q.QuestID, 6, new int[] { 37, 38 } ) ); + break; + + case 503: //|503|艦隊大整備!|入渠5 + Progresses.Add( new ProgressDocking( q.QuestID, 5 ) ); + break; + case 504: //|504|艦隊酒保祭り!|補給15回 + Progresses.Add( new ProgressSupply( q.QuestID, 15 ) ); + break; + + case 605: //|605|新装備「開発」指令|開発1 + Progresses.Add( new ProgressDevelopment( q.QuestID, 1 ) ); + break; + case 606: //|606|新造艦「建造」指令|建造1 + Progresses.Add( new ProgressConstruction( q.QuestID, 1 ) ); + break; + case 607: //|607|装備「開発」集中強化!|開発3 + Progresses.Add( new ProgressDevelopment( q.QuestID, 3 ) ); + break; + case 608: //|608|艦娘「建造」艦隊強化!|建造3 + Progresses.Add( new ProgressConstruction( q.QuestID, 3 ) ); + break; + case 609: //|609|軍縮条約対応!|解体2 + Progresses.Add( new ProgressDestruction( q.QuestID, 2 ) ); + break; + case 619: //|619|装備の改修強化|装備改修1(失敗可) + Progresses.Add( new ProgressImprovement( q.QuestID, 1 ) ); + break; + case 613: //|613|資源の再利用|廃棄24回 + Progresses.Add( new ProgressDiscard( q.QuestID, 24 ) ); + break; + + case 702: //|702|艦の「近代化改修」を実施せよ!|改修成功2 + Progresses.Add( new ProgressModernization( q.QuestID, 2 ) ); + break; + case 703: //|703|「近代化改修」を進め、戦備を整えよ!|改修成功15 + Progresses.Add( new ProgressModernization( q.QuestID, 15 ) ); + break; + + } + + #endregion + + } + + // 進捗度にずれがあった場合補正する + var p = Progresses[q.QuestID]; + if ( p != null ) + p.CheckProgress( q.Progress ); + + } + + OnProgressChanged(); + + } + + + void BattleFinished( string apiname, dynamic data ) { + + var bm = KCDatabase.Instance.Battle; + int[] hps = null; + + + #region Slaughter + + + switch ( bm.BattleMode & Battle.BattleManager.BattleModes.BattlePhaseMask ) { + case Battle.BattleManager.BattleModes.Normal: + case Battle.BattleManager.BattleModes.AirBattle: + if ( bm.BattleNight != null ) hps = bm.BattleNight.EmulateBattle(); + else hps = bm.BattleDay.EmulateBattle(); + break; + case Battle.BattleManager.BattleModes.NightOnly: + case Battle.BattleManager.BattleModes.NightDay: + if ( bm.BattleDay != null ) hps = bm.BattleDay.EmulateBattle(); + else hps = bm.BattleNight.EmulateBattle(); + break; + } + + if ( hps == null ) return; + + IEnumerable slaughterList = Progresses.Values.Where( p => p is ProgressSlaughter ).Cast(); + + for ( int i = 0; i < 6; i++ ) { + + if ( hps[i + 6] <= 0 ) { + + var ship = KCDatabase.Instance.MasterShips[bm.BattleDay != null ? bm.BattleDay.EnemyFleetMembers[i + 1] : bm.BattleNight.EnemyFleetMembers[i + 1]]; + if ( ship == null ) continue; + + foreach ( var p in slaughterList ) + p.Increment( ship.ShipType ); + } + + } + + + #endregion + + + #region Battle + + + IEnumerable battleList = Progresses.Values.Where( p => p is ProgressBattle ).Cast(); + + foreach ( var p in battleList ) { + p.Increment( bm.Result.Rank, bm.Compass.MapAreaID * 10 + bm.Compass.MapInfoID, bm.Compass.EventID == 5 ); + } + + + #endregion + + + ProgressAGo pago = (ProgressAGo)Progresses.Values.FirstOrDefault( p => p is ProgressAGo ); + if ( pago != null ) + pago.IncrementBattle( bm.Result.Rank, bm.Compass.EventID == 5 ); + + + OnProgressChanged(); + } + + void PracticeFinished( string apiname, dynamic data ) { + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressPractice; + if ( pi != null ) pi.Increment( data.api_win_rank ); + } + + OnProgressChanged(); + } + + void ExpeditionCompleted( string apiname, dynamic data ) { + + if ( (int)data.api_clear_result == 0 ) + return; //遠征失敗 + + FleetData fleet = KCDatabase.Instance.Fleet.Fleets.Values.FirstOrDefault( f => f.Members.Contains( (int)data.api_ship_id[1] ) ); + if ( fleet == null ) + return; //本来ありえないのでブレーク処理を入れておくこと + + int areaID = fleet.ExpeditionDestination; + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressExpedition; + if ( pi != null ) pi.Increment( areaID ); + } + + OnProgressChanged(); + } + + + void StartRepair( string apiname, dynamic data ) { + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressDocking; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void Supplied( string apiname, dynamic data ) { + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressSupply; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void EquipmentRemodeled( string apiname, dynamic data ) { + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressImprovement; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + + + void Modernized( string apiname, dynamic data ) { + + if ( (int)data.api_powerup_flag == 0 ) return; //近代化改修失敗 + + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressModernization; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void EquipmentDiscarded( string apiname, dynamic data ) { + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressDiscard; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void ShipDestructed( string apiname, dynamic data ) { + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressDestruction; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void ShipConstructed( string apiname, dynamic data ) { + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressConstruction; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void EquipmentDeveloped( string apiname, dynamic data ) { + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressDevelopment; + if ( pi != null ) pi.Increment(); + } + + OnProgressChanged(); + } + + void StartSortie( string apiname, dynamic data ) { + foreach ( var p in Progresses.Values ) { + var pi = p as ProgressAGo; + if ( pi != null ) pi.IncrementSortie(); + } + + OnProgressChanged(); + } + + + + public void Clear() { + Progresses.Clear(); + } + + + public QuestProgressManager Load() { + return (QuestProgressManager)Load( DefaultFilePath ); + } + + public void Save() { + Save( DefaultFilePath ); + } + + private void OnProgressChanged() { + KCDatabase.Instance.Quest.OnQuestUpdated(); + } + } + +} diff --git a/ElectronicObserver/Data/QuestManager.cs b/ElectronicObserver/Data/QuestManager.cs index 9772eafc5..e9bf50b0a 100644 --- a/ElectronicObserver/Data/QuestManager.cs +++ b/ElectronicObserver/Data/QuestManager.cs @@ -20,6 +20,9 @@ public class QuestManager : APIWrapper { public bool IsLoaded { get; private set; } + public event Action QuestUpdated = delegate { }; + + private DateTime _prevTime; @@ -28,8 +31,12 @@ public QuestManager() { IsLoaded = false; _prevTime = DateTime.Now; } - - + + + public QuestData this[int key] { + get { return Quests[key]; } + } + public override void LoadFromResponse( string apiname, dynamic data ) { base.LoadFromResponse( apiname, (object)data ); @@ -85,6 +92,7 @@ public override void LoadFromRequest( string apiname, Dictionary Quests.Remove( int.Parse( RequestData["api_quest_id"] ) ); Count--; + QuestUpdated(); } @@ -94,6 +102,11 @@ public void Clear() { _prevTime = DateTime.Now; } + + // QuestProgressManager から呼ばれます + internal void OnQuestUpdated() { + QuestUpdated(); + } } } diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index dbd71b84e..00814275f 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -113,9 +113,21 @@ - - - + + + + + + + + + + + + + + + diff --git a/ElectronicObserver/Notifier/NotifierBase.cs b/ElectronicObserver/Notifier/NotifierBase.cs index af7f86316..3ca78ddac 100644 --- a/ElectronicObserver/Notifier/NotifierBase.cs +++ b/ElectronicObserver/Notifier/NotifierBase.cs @@ -169,5 +169,17 @@ public virtual void Notify() { } + + public virtual void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + + DialogData.ApplyToConfiguration( config ); + config.PlaysSound = PlaysSound; + config.SoundPath = SoundPath; + config.IsEnabled = IsEnabled; + config.ShowsDialog = ShowsDialog; + config.AccelInterval = AccelInterval; + + } + } } diff --git a/ElectronicObserver/Notifier/NotifierDamage.cs b/ElectronicObserver/Notifier/NotifierDamage.cs index c0018a08d..c3c1fb576 100644 --- a/ElectronicObserver/Notifier/NotifierDamage.cs +++ b/ElectronicObserver/Notifier/NotifierDamage.cs @@ -242,5 +242,23 @@ public void Notify( string[] messages ) { base.Notify(); } + + public override void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + base.ApplyToConfiguration( config ); + + var c = config as Utility.Configuration.ConfigurationData.ConfigNotifierDamage; + + if ( c != null ) { + c.NotifiesBefore = NotifiesBefore; + c.NotifiesNow = NotifiesNow; + c.NotifiesAfter = NotifiesAfter; + c.LevelBorder = LevelBorder; + c.ContainsNotLockedShip = ContainsNotLockedShip; + c.ContainsSafeShip = ContainsSafeShip; + c.ContainsFlagship = ContainsFlagship; + c.NotifiesAtEndpoint = NotifiesAtEndpoint; + } + } + } } diff --git a/ElectronicObserver/Notifier/NotifierDialogData.cs b/ElectronicObserver/Notifier/NotifierDialogData.cs index cabca1c03..d4f4d860f 100644 --- a/ElectronicObserver/Notifier/NotifierDialogData.cs +++ b/ElectronicObserver/Notifier/NotifierDialogData.cs @@ -161,6 +161,25 @@ public void DisposeImage() { } #endregion + + + public void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + + config.ImagePath = ImagePath; + config.DrawsImage = DrawsImage; + config.DrawsMessage = DrawsMessage; + config.ClosingInterval = ClosingInterval; + config.CloseOnMouseMove = CloseOnMouseMove; + config.Alignment = Alignment; + config.Location = Location; + config.HasFormBorder = HasFormBorder; + config.TopMost = TopMost; + config.ShowWithActivation = ShowWithActivation; + config.ForeColor = ForeColor; + config.BackColor = BackColor; + + } + } diff --git a/ElectronicObserver/Notifier/NotifierManager.cs b/ElectronicObserver/Notifier/NotifierManager.cs index d02e70aca..780a11d17 100644 --- a/ElectronicObserver/Notifier/NotifierManager.cs +++ b/ElectronicObserver/Notifier/NotifierManager.cs @@ -46,6 +46,15 @@ public void Initialize( FormMain parent ) { } + public void ApplyToConfiguration() { + + Expedition.ApplyToConfiguration( Utility.Configuration.Config.NotifierExpedition ); + Construction.ApplyToConfiguration( Utility.Configuration.Config.NotifierConstruction ); + Repair.ApplyToConfiguration( Utility.Configuration.Config.NotifierRepair ); + Condition.ApplyToConfiguration( Utility.Configuration.Config.NotifierCondition ); + Damage.ApplyToConfiguration( Utility.Configuration.Config.NotifierDamage ); + + } public void ShowNotifier( Form form ) { _parentForm.Invoke( (MethodInvoker)( () => form.Show() ) ); diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index 5c792a71f..77cbec21d 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -115,6 +115,7 @@ api_start2 :艦娘・装備固有データその他 13=航空要員 14=高射装置 15=対地装備 + 16=水上艦要員 [1]:図鑑表示 1=Primary Armament @@ -140,6 +141,7 @@ api_start2 :艦娘・装備固有データその他 24=AA Director 25=AP Shell 26=Rocket Artillery + 27=Picket Crew 1=主砲 2=副砲 @@ -164,6 +166,7 @@ api_start2 :艦娘・装備固有データその他 24=高射装置 25=対艦強化弾 26=対地装備 + 27=水上艦要員 [2]:カテゴリ (api_mst_slotitem_equiptype を参照) @@ -204,6 +207,8 @@ api_start2 :艦娘・装備固有データその他 35=航空要員 36=高射装置 37=対地装備 + 38=大口径主砲(II) + 39=水上艦要員 [3]:アイコンID 1=小口径主砲 @@ -237,6 +242,7 @@ api_start2 :艦娘・装備固有データその他 29=航空要員 30=高射装置 31=対地装備 + 32=水上艦要員 api_taik :耐久(0) api_souk :装甲 diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index 0e30f399b..dde20831d 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -263,7 +263,7 @@ if ( 敵損害率 >= 100 ) { rank = A; } else if ( 敵旗艦撃沈 || 敵損害率 > 味方損害率 * 2.5 ) { rank = B; -} else if ( 敵損害率 > 味方損害率 ) { +} else if ( 敵損害率 > 味方損害率 || 敵損害率 >= 50 ) { rank = C; } else { rank = D; @@ -275,7 +275,16 @@ if ( 味方に撃沈艦がある ) { ``` なお、連合艦隊での判定は少なくとも「本隊だけ」ではない模様。調査中 -ver. 0.2.1 現在、観測儀では本体・随伴隊全員の損害率を計算している。 +ver. 0.2.1 現在、観測儀では本体・随伴隊全員の損害率を計算している。 + +損害率が自軍71.5%/敵軍67.6%(旗艦生存/撃沈3隻)、自軍62.2%/敵軍57.8%(旗艦生存/撃沈3隻)でC敗北となったことがある。 +敵側の損害率が一定以上だとC敗北になる? +C敗北判定の 敵損害率 >= 50 は試験実装。 +これまでの例外判定メモ: + +* 自軍71.5%/敵軍67.6%(旗艦生存/撃沈3隻); 判定D→実際C +* 自軍62.2%/敵軍57.8%(旗艦生存/撃沈3隻); 判定D→実際C +* 自軍32.5%/敵軍32.7%(旗艦生存/撃沈2隻); 判定D→実際C #### 一度に大破できる艦数 表示上は3隻? diff --git a/ElectronicObserver/Resource/ResourceManager.cs b/ElectronicObserver/Resource/ResourceManager.cs index 9d26a1ccf..d0e115a7e 100644 --- a/ElectronicObserver/Resource/ResourceManager.cs +++ b/ElectronicObserver/Resource/ResourceManager.cs @@ -140,6 +140,7 @@ public enum EquipmentContent { MaintenanceTeam, AADirector, RocketArtillery, + PicketCrew, Locked, Unknown, } @@ -323,6 +324,7 @@ private void LoadFromArchive( string path ) { LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/MaintenanceTeam.png", "Equipment_MaintenanceTeam" ); LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/AADirector.png", "Equipment_AADirector" ); LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/RocketArtillery.png", "Equipment_RocketArtillery" ); + LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/PicketCrew.png", "Equipment_PicketCrew" ); LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/Locked.png", "Equipment_Locked" ); LoadImageFromArchive( Equipments, archive, mstpath + @"Equipment/Unknown.png", "Equipment_Unknown" ); diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index 0f213415b..45be6d838 100644 --- a/ElectronicObserver/Utility/SoftwareInformation.cs +++ b/ElectronicObserver/Utility/SoftwareInformation.cs @@ -35,7 +35,7 @@ public static string SoftwareNameEnglish { /// public static string VersionJapanese { get { - return SoftwareNameJapanese + "二型改"; + return SoftwareNameJapanese + "三型"; } } @@ -44,7 +44,7 @@ public static string VersionJapanese { /// public static string VersionEnglish { get { - return "0.2.1"; + return "0.3.0"; } } @@ -54,7 +54,7 @@ public static string VersionEnglish { /// public static DateTime UpdateTime { get { - return DateTimeHelper.CSVStringToTime( "2015/02/17 14:00:00" ); + return DateTimeHelper.CSVStringToTime( "2015/02/22 22:22:22" ); } } diff --git a/ElectronicObserver/Window/Dialog/DialogWhitecap.cs b/ElectronicObserver/Window/Dialog/DialogWhitecap.cs index 0cf229241..b2a55eb2c 100644 --- a/ElectronicObserver/Window/Dialog/DialogWhitecap.cs +++ b/ElectronicObserver/Window/Dialog/DialogWhitecap.cs @@ -180,9 +180,15 @@ private void DialogWhitecap_Paint( object sender, PaintEventArgs e ) { break; case 3: + /* col = value != 0 ? BlendColor( FromRgb( 0xFFFFFF ), FromRgb( 0xFFDDBB ), (double)y / boardSize.Height ) : BlendColor( FromRgb( 0x00FFFF ), FromRgb( 0xFFDDBB ), (double)y / boardSize.Height ); + */ + col = BlendColor( GetCell( currentDim, x, y + (int)( ( Math.Sin( clock / 100.0 * 2.0 * Math.PI ) + 1 ) * boardSize.Height / 8.0 ) ) != 0 ? + BlendColor( FromRgb( 0xFFFFFF ), FromRgb( 0xFFDDBB ), Math.Max( Math.Min( ( y + ( ( Math.Sin( clock / 100.0 * 2.0 * Math.PI ) ) * boardSize.Height / 8.0 ) ) / boardSize.Height, 1.0 ), 0.0 ) ) : + BlendColor( FromRgb( 0x00FFFF ), FromRgb( 0xFFDDBB ), Math.Min( ( y + ( ( Math.Sin( clock / 100.0 * 2.0 * Math.PI ) + 1 ) * boardSize.Height / 8.0 ) ) / boardSize.Height, 1.0 ) ), + prev, 0.8 ); break; case 4: @@ -368,7 +374,7 @@ private void DialogWhitecap_DoubleClick( object sender, EventArgs e ) { UpdateTimer.Stop(); colortheme = rand.Next( 64 ); - //colortheme = 15; + //colortheme = 3; Start(); } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 2dc036842..c38d0dedc 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -674,6 +674,8 @@ private void SetDamageRateNormal( int[] hp, BattleData bd ) { int countEnemy = ( bd.EnemyFleetMembers.Skip( 1 ).Count( v => v != -1 ) ); int sunkFriend = hp.Take( countFriend ).Count( v => v <= 0 ); int sunkEnemy = hp.Skip( 6 ).Take( countEnemy ).Count( v => v <= 0 ); + int rifriend = (int)( friendrate * 100 ); + int rienemy = (int)( enemyrate * 100 ); int rank; Color colorWin = SystemColors.WindowText; Color colorLose = Color.Red; @@ -688,12 +690,12 @@ private void SetDamageRateNormal( int[] hp, BattleData bd ) { } else if ( sunkEnemy >= (int)Math.Round( countEnemy * 0.6 ) ) { rank = 5; - } else if ( hp[6] <= 0 || - (int)( enemyrate * 100 ) > (int)( friendrate * 100 ) * 2.5 ) { + } else if ( hp[6] <= 0 || rienemy > rifriend * 2.5 ) { rank = 4; - } else if ( (int)( enemyrate * 100 ) > (int)( friendrate * 100 ) ) { + } else if ( rienemy > rifriend || rienemy >= 50 ) { rank = 3; + } else { rank = 2; } @@ -702,42 +704,14 @@ private void SetDamageRateNormal( int[] hp, BattleData bd ) { rank = Math.Min( rank, 5 ) - 1; - switch ( rank ) { - case 2: - DamageRate.Text = "D"; - DamageRate.ForeColor = colorLose; - break; - case 3: - DamageRate.Text = "C"; - DamageRate.ForeColor = colorLose; - break; - case 4: - DamageRate.Text = "B"; - DamageRate.ForeColor = colorWin; - break; - case 5: - DamageRate.Text = "A"; - DamageRate.ForeColor = colorWin; - break; - case 6: - DamageRate.Text = "S"; - DamageRate.ForeColor = colorWin; - break; - case 7: - DamageRate.Text = "SS"; - DamageRate.ForeColor = colorWin; - break; - default: - DamageRate.Text = "E"; - DamageRate.ForeColor = colorLose; - break; - } + DamageRate.Text = Constants.GetWinRank( rank ); + DamageRate.ForeColor = rank >= 4 ? colorWin : colorLose; } } - //fixme + private void SetDamageRateCombined( int[] hp, BattleData bd ) { int friendbefore = 0; @@ -771,6 +745,8 @@ private void SetDamageRateCombined( int[] hp, BattleData bd ) { int countEnemy = ( bdc.EnemyFleetMembers.Skip( 1 ).Count( v => v != -1 ) ); int sunkFriend = hp.Take( countFriend ).Count( v => v <= 0 ) + hp.Skip( 12 ).Take( countFriendCombined ).Count( v => v <= 0 ); int sunkEnemy = hp.Skip( 6 ).Take( countEnemy ).Count( v => v <= 0 ); + int rifriend = (int)( friendrate * 100 ); + int rienemy = (int)( enemyrate * 100 ); int rank; Color colorWin = SystemColors.WindowText; Color colorLose = Color.Red; @@ -785,12 +761,12 @@ private void SetDamageRateCombined( int[] hp, BattleData bd ) { } else if ( sunkEnemy >= (int)Math.Round( countEnemy * 0.6 ) ) { rank = 5; - } else if ( hp[6] <= 0 || - (int)( enemyrate * 100 ) > (int)( friendrate * 100 ) * 2.5 ) { + } else if ( hp[6] <= 0 || rienemy > rifriend * 2.5 ) { rank = 4; - } else if ( (int)( enemyrate * 100 ) > (int)( friendrate * 100 ) ) { + } else if ( rienemy > rifriend || rienemy >= 50 ) { rank = 3; + } else { rank = 2; } @@ -799,37 +775,8 @@ private void SetDamageRateCombined( int[] hp, BattleData bd ) { rank = Math.Min( rank, 5 ) - 1; - switch ( rank ) { - case 2: - DamageRate.Text = "D"; - DamageRate.ForeColor = colorLose; - break; - case 3: - DamageRate.Text = "C"; - DamageRate.ForeColor = colorLose; - break; - case 4: - DamageRate.Text = "B"; - DamageRate.ForeColor = colorWin; - break; - case 5: - DamageRate.Text = "A"; - DamageRate.ForeColor = colorWin; - break; - case 6: - DamageRate.Text = "S"; - DamageRate.ForeColor = colorWin; - break; - case 7: - DamageRate.Text = "SS"; - DamageRate.ForeColor = colorWin; - break; - default: - DamageRate.Text = "E"; - DamageRate.ForeColor = colorLose; - break; - } - + DamageRate.Text = Constants.GetWinRank( rank ); + DamageRate.ForeColor = rank >= 4 ? colorWin : colorLose; } } diff --git a/ElectronicObserver/Window/FormLog.cs b/ElectronicObserver/Window/FormLog.cs index de20709b4..ef3cd177d 100644 --- a/ElectronicObserver/Window/FormLog.cs +++ b/ElectronicObserver/Window/FormLog.cs @@ -24,7 +24,8 @@ public FormLog( FormMain parent ) { private void FormLog_Load( object sender, EventArgs e ) { foreach ( var log in Utility.Logger.Log ) { - LogList.Items.Add( log.ToString() ); + if ( log.Priority >= Utility.Configuration.Config.Log.LogLevel ) + LogList.Items.Add( log.ToString() ); } LogList.TopIndex = LogList.Items.Count - 1; diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index ead0e344a..32981e937 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -211,6 +211,7 @@ private void FormMain_FormClosing( object sender, FormClosingEventArgs e ) { private void FormMain_FormClosed( object sender, FormClosedEventArgs e ) { + NotifierManager.Instance.ApplyToConfiguration(); Utility.Configuration.Instance.Save(); APIObserver.Instance.Stop(); RecordManager.Instance.Save(); diff --git a/ElectronicObserver/Window/FormQuest.Designer.cs b/ElectronicObserver/Window/FormQuest.Designer.cs index 664757ea3..46afd4386 100644 --- a/ElectronicObserver/Window/FormQuest.Designer.cs +++ b/ElectronicObserver/Window/FormQuest.Designer.cs @@ -28,21 +28,21 @@ private void InitializeComponent() { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.QuestView = new System.Windows.Forms.DataGridView(); - this.QuestView_State = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.QuestView_Type = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.QuestView_Category = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.QuestView_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.QuestView_Progress = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.MenuMain = new System.Windows.Forms.ContextMenuStrip(this.components); this.MenuMain_ShowRunningOnly = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.MenuMain_Initialize = new System.Windows.Forms.ToolStripMenuItem(); - this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.MenuMain_ShowOnce = new System.Windows.Forms.ToolStripMenuItem(); this.MenuMain_ShowDaily = new System.Windows.Forms.ToolStripMenuItem(); this.MenuMain_ShowWeekly = new System.Windows.Forms.ToolStripMenuItem(); this.MenuMain_ShowMonthly = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.MenuMain_Initialize = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.QuestView_State = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.QuestView_Type = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.QuestView_Category = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.QuestView_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.QuestView_Progress = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.QuestView)).BeginInit(); this.MenuMain.SuspendLayout(); this.SuspendLayout(); @@ -84,51 +84,6 @@ private void InitializeComponent() { this.QuestView.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.QuestView_SortCompare); this.QuestView.Sorted += new System.EventHandler(this.QuestView_Sorted); // - // QuestView_State - // - this.QuestView_State.FalseValue = ""; - this.QuestView_State.HeaderText = ""; - this.QuestView_State.IndeterminateValue = ""; - this.QuestView_State.Name = "QuestView_State"; - this.QuestView_State.ReadOnly = true; - this.QuestView_State.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.QuestView_State.ThreeState = true; - this.QuestView_State.TrueValue = ""; - this.QuestView_State.Width = 24; - // - // QuestView_Type - // - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.QuestView_Type.DefaultCellStyle = dataGridViewCellStyle1; - this.QuestView_Type.HeaderText = "種"; - this.QuestView_Type.Name = "QuestView_Type"; - this.QuestView_Type.ReadOnly = true; - this.QuestView_Type.Width = 20; - // - // QuestView_Category - // - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.QuestView_Category.DefaultCellStyle = dataGridViewCellStyle2; - this.QuestView_Category.HeaderText = "分類"; - this.QuestView_Category.Name = "QuestView_Category"; - this.QuestView_Category.ReadOnly = true; - this.QuestView_Category.Width = 40; - // - // QuestView_Name - // - this.QuestView_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.QuestView_Name.FillWeight = 200F; - this.QuestView_Name.HeaderText = "任務名"; - this.QuestView_Name.Name = "QuestView_Name"; - this.QuestView_Name.ReadOnly = true; - // - // QuestView_Progress - // - this.QuestView_Progress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.QuestView_Progress.HeaderText = "進捗"; - this.QuestView_Progress.Name = "QuestView_Progress"; - this.QuestView_Progress.ReadOnly = true; - // // MenuMain // this.MenuMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -141,7 +96,7 @@ private void InitializeComponent() { this.toolStripSeparator1, this.MenuMain_Initialize}); this.MenuMain.Name = "MenuMain"; - this.MenuMain.Size = new System.Drawing.Size(231, 170); + this.MenuMain.Size = new System.Drawing.Size(231, 148); // // MenuMain_ShowRunningOnly // @@ -151,25 +106,6 @@ private void InitializeComponent() { this.MenuMain_ShowRunningOnly.Text = "遂行中のみ表示(&R)"; this.MenuMain_ShowRunningOnly.Click += new System.EventHandler(this.MenuMain_ShowRunningOnly_Click); // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(227, 6); - // - // MenuMain_Initialize - // - this.MenuMain_Initialize.Name = "MenuMain_Initialize"; - this.MenuMain_Initialize.Size = new System.Drawing.Size(230, 22); - this.MenuMain_Initialize.Text = "初期化(&I)"; - this.MenuMain_Initialize.Click += new System.EventHandler(this.MenuMain_Initialize_Click); - // - // ToolTipInfo - // - this.ToolTipInfo.AutoPopDelay = 30000; - this.ToolTipInfo.InitialDelay = 500; - this.ToolTipInfo.ReshowDelay = 100; - this.ToolTipInfo.ShowAlways = true; - // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; @@ -207,6 +143,71 @@ private void InitializeComponent() { this.MenuMain_ShowMonthly.Text = "マンスリー任務を表示(&M)"; this.MenuMain_ShowMonthly.Click += new System.EventHandler(this.MenuMain_ShowMonthly_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(227, 6); + // + // MenuMain_Initialize + // + this.MenuMain_Initialize.Name = "MenuMain_Initialize"; + this.MenuMain_Initialize.Size = new System.Drawing.Size(230, 22); + this.MenuMain_Initialize.Text = "初期化(&I)"; + this.MenuMain_Initialize.Click += new System.EventHandler(this.MenuMain_Initialize_Click); + // + // ToolTipInfo + // + this.ToolTipInfo.AutoPopDelay = 30000; + this.ToolTipInfo.InitialDelay = 500; + this.ToolTipInfo.ReshowDelay = 100; + this.ToolTipInfo.ShowAlways = true; + // + // QuestView_State + // + this.QuestView_State.FalseValue = ""; + this.QuestView_State.HeaderText = ""; + this.QuestView_State.IndeterminateValue = ""; + this.QuestView_State.Name = "QuestView_State"; + this.QuestView_State.ReadOnly = true; + this.QuestView_State.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.QuestView_State.ThreeState = true; + this.QuestView_State.TrueValue = ""; + this.QuestView_State.Width = 24; + // + // QuestView_Type + // + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.QuestView_Type.DefaultCellStyle = dataGridViewCellStyle1; + this.QuestView_Type.HeaderText = "種"; + this.QuestView_Type.Name = "QuestView_Type"; + this.QuestView_Type.ReadOnly = true; + this.QuestView_Type.Width = 20; + // + // QuestView_Category + // + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.QuestView_Category.DefaultCellStyle = dataGridViewCellStyle2; + this.QuestView_Category.HeaderText = "分類"; + this.QuestView_Category.Name = "QuestView_Category"; + this.QuestView_Category.ReadOnly = true; + this.QuestView_Category.Width = 40; + // + // QuestView_Name + // + this.QuestView_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.QuestView_Name.FillWeight = 200F; + this.QuestView_Name.HeaderText = "任務名"; + this.QuestView_Name.Name = "QuestView_Name"; + this.QuestView_Name.ReadOnly = true; + // + // QuestView_Progress + // + this.QuestView_Progress.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.QuestView_Progress.HeaderText = "進捗"; + this.QuestView_Progress.Name = "QuestView_Progress"; + this.QuestView_Progress.ReadOnly = true; + this.QuestView_Progress.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // // FormQuest // this.AutoHidePortion = 150D; @@ -230,11 +231,6 @@ private void InitializeComponent() { private System.Windows.Forms.DataGridView QuestView; private System.Windows.Forms.ToolTip ToolTipInfo; - private System.Windows.Forms.DataGridViewCheckBoxColumn QuestView_State; - private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Type; - private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Category; - private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Progress; private System.Windows.Forms.ContextMenuStrip MenuMain; private System.Windows.Forms.ToolStripMenuItem MenuMain_ShowRunningOnly; private System.Windows.Forms.ToolStripMenuItem MenuMain_Initialize; @@ -244,5 +240,10 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem MenuMain_ShowDaily; private System.Windows.Forms.ToolStripMenuItem MenuMain_ShowWeekly; private System.Windows.Forms.ToolStripMenuItem MenuMain_ShowMonthly; + private System.Windows.Forms.DataGridViewCheckBoxColumn QuestView_State; + private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Type; + private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Category; + private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn QuestView_Progress; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormQuest.cs b/ElectronicObserver/Window/FormQuest.cs index 338f4aaf9..3503638f0 100644 --- a/ElectronicObserver/Window/FormQuest.cs +++ b/ElectronicObserver/Window/FormQuest.cs @@ -17,17 +17,54 @@ namespace ElectronicObserver.Window { public partial class FormQuest : DockContent { + private DataGridViewCellStyle CSDefaultLeft, CSDefaultCenter, CSProgress1, CSProgress50, CSProgress80, CSProgress100; + + public FormQuest( FormMain parent ) { InitializeComponent(); ControlHelper.SetDoubleBuffered( QuestView ); ConfigurationChanged(); + + + #region set cellstyle + + CSDefaultLeft = new DataGridViewCellStyle(); + CSDefaultLeft.Alignment = DataGridViewContentAlignment.MiddleLeft; + CSDefaultLeft.BackColor = SystemColors.Control; + //CSDefaultLeft.Font = Font; + CSDefaultLeft.ForeColor = SystemColors.ControlText; + CSDefaultLeft.SelectionBackColor = Color.FromArgb( 0xFF, 0xFF, 0xCC ); + CSDefaultLeft.SelectionForeColor = SystemColors.ControlText; + CSDefaultLeft.WrapMode = DataGridViewTriState.False; + + CSDefaultCenter = new DataGridViewCellStyle( CSDefaultLeft ); + CSDefaultCenter.Alignment = DataGridViewContentAlignment.MiddleCenter; + + CSProgress1 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress1.BackColor = Color.FromArgb( 0xFF, 0xFF, 0xBB ); + + CSProgress50 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress50.BackColor = Color.FromArgb( 0xDD, 0xFF, 0xBB ); + + CSProgress80 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress80.BackColor = Color.FromArgb( 0xBB, 0xFF, 0xBB ); + + CSProgress100 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress100.BackColor = Color.FromArgb( 0xBB, 0xFF, 0xFF ); + + QuestView.DefaultCellStyle = CSDefaultCenter; + QuestView_Name.DefaultCellStyle = CSDefaultLeft; + QuestView_Progress.DefaultCellStyle = CSDefaultLeft; + + #endregion } private void FormQuest_Load( object sender, EventArgs e ) { + /*/ APIObserver o = APIObserver.Instance; APIReceivedEventHandler rec = ( string apiname, dynamic data ) => Invoke( new APIReceivedEventHandler( APIUpdated ), apiname, data ); @@ -35,6 +72,9 @@ private void FormQuest_Load( object sender, EventArgs e ) { o.APIList["api_req_quest/clearitemget"].RequestReceived += rec; o.APIList["api_get_member/questlist"].ResponseReceived += rec; + //*/ + + KCDatabase.Instance.Quest.QuestUpdated += () => Invoke( new Action( Updated ) ); ClearQuestView(); @@ -66,11 +106,6 @@ void ConfigurationChanged() { - - void APIUpdated( string apiname, dynamic data ) { - Updated(); - } - void Updated() { if ( !KCDatabase.Instance.Quest.IsLoaded ) return; @@ -98,7 +133,7 @@ void Updated() { break; default: if ( !MenuMain_ShowOnce.Checked ) continue; - break; + break; } @@ -113,23 +148,64 @@ void Updated() { row.Cells[QuestView_Name.Index].ToolTipText = string.Format( "{0} : {1}\r\n{2}", q.QuestID, q.Name, q.Description ); { - int value; + string value; + DataGridViewCellStyle style; + if ( q.State == 3 ) { - value = 3; //達成! + value = "達成!"; + style = CSProgress100; + } else { - switch ( q.Progress ) { - case 0: - value = 0; break; //(進捗ダメです) - case 1: - value = 1; break; //≧50% - case 2: - value = 2; break; //≧80% - default: - value = -1; break; //??? + + if ( KCDatabase.Instance.QuestProgress.Progresses.ContainsKey( q.QuestID ) ) { + var p = KCDatabase.Instance.QuestProgress.Progresses[q.QuestID]; + value = p.ToString(); + + double percentage = p.ProgressPercentage; + + if ( percentage >= 1.00 ) { + style = CSProgress100; + + } else if ( percentage >= 0.80 ) { + style = CSProgress80; + + } else if ( percentage >= 0.50 ) { + style = CSProgress50; + + } else if ( percentage > 0.00 ) { + style = CSProgress1; + + } else { + style = CSDefaultLeft; + + } + + } else { + + switch ( q.Progress ) { + case 0: + value = "-"; + style = CSDefaultLeft; + break; + case 1: + value = "50%以上"; + style = CSProgress50; + break; + case 2: + value = "80%以上"; + style = CSProgress80; + break; + default: + value = "???"; + style = CSDefaultLeft; + break; + } } } row.Cells[QuestView_Progress.Index].Value = value; + row.Cells[QuestView_Progress.Index].Style = style; + } QuestView.Rows.Add( row ); @@ -158,7 +234,7 @@ void Updated() { private void QuestView_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e ) { - if ( e.Value as int? != null ) { + if ( e.Value is int ) { if ( e.ColumnIndex == QuestView_Type.Index ) { e.Value = Constants.GetQuestType( (int)e.Value ); e.FormattingApplied = true; @@ -168,10 +244,11 @@ private void QuestView_CellFormatting( object sender, DataGridViewCellFormatting e.FormattingApplied = true; } else if ( e.ColumnIndex == QuestView_Name.Index ) { - e.Value = KCDatabase.Instance.Quest.Quests[(int)e.Value].Name; + e.Value = KCDatabase.Instance.Quest[(int)e.Value].Name; e.FormattingApplied = true; - } else if ( e.ColumnIndex == QuestView_Progress.Index ) { + } /* + else if ( e.ColumnIndex == QuestView_Progress.Index ) { switch ( (int)e.Value ) { case 0: e.Value = "-"; break; @@ -188,7 +265,25 @@ private void QuestView_CellFormatting( object sender, DataGridViewCellFormatting e.FormattingApplied = true; } + */ } + + + /* + if ( e.ColumnIndex == QuestView_Progress.Index ) { + int? qid = QuestView.Rows[e.RowIndex].Cells[QuestView_Name.Index].Value as int?; + + if ( qid != null ) { + var q = KCDatabase.Instance.Quest[(int)qid]; + + if ( q != null && q.State != 3 && KCDatabase.Instance.QuestProgress.Progresses.ContainsKey( q.QuestID ) ) { + e.Value = KCDatabase.Instance.QuestProgress.Progresses[q.QuestID].ToString(); + e.FormattingApplied = true; + } + } + } + */ + } @@ -252,6 +347,7 @@ private void MenuMain_Initialize_Click( object sender, EventArgs e ) { MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2 ) == System.Windows.Forms.DialogResult.Yes ) { KCDatabase.Instance.Quest.Clear(); + KCDatabase.Instance.QuestProgress.Clear(); ClearQuestView(); } @@ -275,6 +371,6 @@ protected override string GetPersistString() { return "Quest"; } - + } } diff --git a/README.md b/README.md index ebb1d66e4..545efe174 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ *このリンクの更新は遅れる可能性があります。最新版は[こちら](http://electronicobserver.blog.fc2.com/)で確認してください。* -[ver. 0.2.1 (2015/02/17)](http://bit.ly/1DAz8uG) +[ver. 0.3.0 (2015/02/22)](http://bit.ly/1BAq9KH) ### 開発者の皆様へ ---