// CStoryCore - [2020-04-13 11:57:47]
#ifndef _CSTORYCORE_H_
#define _CSTORYCORE_H_

#include "TStageOperation.h"
#include "CLoadingScreen.h"
#include "CDataBase.h"
#include "CPlayer.h"
#include "CStageManager.h"
#include "CSideStoryProfile.h"
#include "CStoryProfile.h"
#include "TPlayerInfoLight.h"
#include "TStorySeason.h"
#include "TStoryConfig.h"
#include "CMyProfile.h"

/*
0017622C CStoryCore::GetMinutes()
001E1B78 CStoryCore::Init()
001E1BA4 CStoryCore::SetupStage(int)
001E1CDC CStoryCore::GetClubTeam()
001E1CEC CStoryCore::GetNationalTeam()
001E1CFC CStoryCore::GetSeason()
001E1D30 CStoryCore::GetStageIndex()
001E1D64 CStoryCore::SetupStageX(char const*,int)
001E1D78 CStoryCore::SetupStageX(TStoryStage *)
001E1D88 CStoryCore::SetupSingleNIS(TStageOperation *)
001E1D9C CStoryCore::SetupSingleNIS(char const*,int,int)
001E1DBC CStoryCore::AddNISCommentary(int)
001E1DCC CStoryCore::SetupAndEnterGame(ELoadingScreen,bool,bool)
001E1DF8 CStoryCore::PlayStage(bool,bool)
001E1E08 CStoryCore::EnterGame(ELoadingScreen,bool)
001E1E1C CStoryCore::Process()
001E1E2C CStoryCore::RenderHUD()
001E1E3C CStoryCore::GetOppoTeam(int,int,int,int,TTeamInfo *)
001E1E8C CStoryCore::SetupNextStage()
001E1EC0 CStoryCore::LoadConfigForPromoLanguages()
001E1EEC CStoryCore::GetCorrectConfig(bool)
001E1FFC CStoryCore::LoadConfigForTimeAndRepeatNotifications()
001E2028 CStoryCore::FindLatestRepeatNotifications(long &)
001E2058 CStoryCore::FindLatestTimeNotifications(long &)
001E2088 CStoryCore::DownloadConfig()
001E20B4 CStoryCore::LoadConfig(bool)
001E2100 CStoryCore::LoadAdvertsFromConfig()
001E213C CStoryCore::LoadStages()
001E21D0 CStoryCore::OnFreeGameAssets()
001E2208 CStoryCore::GetPlayerInitialised()
001E2218 CStoryCore::GetStageInfo(int)
001E226C CStoryCore::GetTodaysDate(wchar_t *,int)
001E229C CStoryCore::GetTrophyModelName()
001E231C CStoryCore::UpdateEnvironment()
001E242C CStoryCore::RandomiseSunPos()
001E2520 CStoryCore::ProcessText(wchar_t *,int,wchar_t const*,int)
001E2798 CStoryCore::GetStageClubTeam(int)
001E27C8 CStoryCore::GetStageTeam(int)
001E2870 CStoryCore::CheckStageVersions()
001E2A40 CStoryCore::GetStageSeason(int)
001E2A98 CStoryCore::GetAreGoldenBootsEnabled()
001E2A9C CStoryCore::AttemptSideStoryEntry()
001E2B20 CStoryCore::EnterSideStory()
001E2BA4 CStoryCore::STORY_GetSeason(int)
001E2BC8 CStoryCore::GetConfigSeasonWithID(int)
001E2C04 CStoryCore::PromotionCB(int,void *)
001E2C1C CStoryCore::ShowPromotion(int,bool,bool,EPromoTriggerType,int,int,bool)
001E3124 CStoryCore::CalculateCurrentStageID()
001E31D8 CStoryCore::CountNumValidPromos()
001E3208 CStoryCore::IsPromoValid(TPromo const*,bool)
001E33D4 CStoryCore::FindValidPromo(int,bool)
001E3418 CStoryCore::SetSeason(int)
001E3448 CStoryCore::GetStageUnlockTime(int,int)
001E34A6 CStoryCore::GetStageUnlockTime(int)
001E34FC CStoryCore::GetShirtNumber()
001E3530 CStoryCore::SetStageStars(int,int)
001E3570 CStoryCore::SetStageComplete(int,int)
001E35CC CStoryCore::SetLastPlayedStageID(int)
001E35F4 CStoryCore::GetProfileStages()
001E3620 CStoryCore::ApplyUserPlayer(TPlayerInfo *)
001E3650 CStoryCore::GetTimeString(long,wchar_t *,bool)
001E3798 CStoryCore::GetTimeFromString(char *,int)
001E37BC CStoryCore::IncrementSessionStagesComplete(bool)

001E1E1C CStoryCore::Process() //game loop 0015A6F0
*/
//---------------------------------------------------------------------------------------------------------
enum EPromoTriggerType {
  EPromoTriggerType_Neg = -1,
  EPromoTriggerType_0,
  EPromoTriggerType_1,
  EPromoTriggerType_2,
  EPromoTriggerType_3,
  EPromoTriggerType_4,
  EPromoTriggerType_5,
  EPromoTriggerType_6,
  EPromoTriggerType_7,
};
//---------------------------------------------------------------------------------------------------------
struct TCStoryCoreActiveStory {
  TStorySeason *field_0;       // 00
  int *field_4;                // 04
  bool *AreGettingMoreStars;   // 08
  ushort *NationalTeam;        // 0C
  ushort *pClubTeam;           // 10:这里是ushort* 2022.1.23(SJ)
  PolaroidDate *field_14;     // 14
  bool *pIsInitialised;        // 18
  TPlayerInfoLight *field_1C;  // 1C
  wchar_t *PlayerName;         // 20
};

struct TStoryStages {
  bool field_0;
  int Version_4;
  int dCount_8;  //下面这个结构的数据长度
  TStorySeason *list_C; //not sidestoryseason
  int field_10;  //下面这个结构的数据长度  sidestoryseason len
  TStorySeason *field_14;//sidestoryseason
  int field_18;
  float f_1C; 
};

class CFTTXmlReader;

//---------------------------------------------------------------------------------------------------------
class CStoryCore {
public:
  static int GetMinutes();                                                       // 0017622C
  static void Init();                                                            // 001E1B78
  static int SetupStage(int);                                                    // 001E1BA4
  static ushort GetClubTeam();                                                   // 001E1CDC
  static ushort GetNationalTeam();                                               // 001E1CEC
  static ushort GetSeason();                                                     // 001E1CFC
  static ushort GetStageIndex();                                                 // 001E1D30
  static void SetupStageX(char const *, int);                                    // 001E1D64
  static void SetupStageX(TStoryStage *);                                        // 001E1D78
  static void SetupSingleNIS(TStageOperation *);                                 // 001E1D88
  static void SetupSingleNIS(char const *, int, int);                            // 001E1D9C
  static void AddNISCommentary(int);                                             // 001E1DBC
  static void SetupAndEnterGame(ELoadingScreen, bool, bool);                     // 001E1DCC
  static void PlayStage(bool, bool);                                             // 001E1DF8
  static void EnterGame(ELoadingScreen, bool);                                   // 001E1E08
  static void Process();                                                         // 001E1E1C
  static void RenderHUD();                                                       // 001E1E2C
  static void GetOppoTeam(int, int, int, int, TTeamInfo *);                      // 001E1E3C
  static void SetupNextStage();                                                  // 001E1E8C
  static void LoadConfigForPromoLanguages();                                     // 001E1EC0
  static CFTTXmlReader *GetCorrectConfig(bool);                                  // 001E1EEC
  static void LoadConfigForTimeAndRepeatNotifications();                         // 001E1FFC
  static void FindLatestRepeatNotifications(long &);                             // 001E2028
  static void FindLatestTimeNotifications(long &);                               // 001E2058
  bool DownloadConfig();                                                         // 001E2088
  static void LoadConfig(bool);                                                  // 001E20B4
  void LoadAdvertsFromConfig();                                                  // 001E2100
  static bool LoadStages();                                                      // 001E213C
  static void OnFreeGameAssets();                                                // 001E21D0
  bool GetPlayerInitialised();                                                   // 001E2208
  static TStage *GetStageInfo(int);                                              // 001E2218
  static void GetTodaysDate(wchar_t *, int);                                     // 001E226C
  static const char *GetTrophyModelName();                                       // 001E229C
  static void UpdateEnvironment();                                               // 001E231C
  void RandomiseSunPos();                                                        // 001E242C
  static void ProcessText(wchar_t *, int, wchar_t const *, int);                 // 001E2520
  static ushort GetStageClubTeam(int);                                           // 001E2798
  static ushort GetStageTeam(int);                                               // 001E27C8
  void CheckStageVersions();                                                     // 001E2870
  static TStorySeason *GetStageSeason(int);                                      // 001E2A40
  static int GetAreGoldenBootsEnabled();                                         // 001E2A98
  static bool AttemptSideStoryEntry();                                           // 001E2A9C
  static int EnterSideStory();                                                   // 001E2B20
  static TStorySeason *STORY_GetSeason(int);                                     // 001E2BA4
  static TStorySeason *GetConfigSeasonWithID(int);                               // 001E2BC8
  static void PromotionCB(int, void *);                                          // 001E2C04
  static int ShowPromotion(int, bool, bool, EPromoTriggerType, int, int, bool);  // 001E2C1C
  static int CalculateCurrentStageID();                                          // 001E3124
  int CountNumValidPromos();                                                     // 001E31D8
  static int IsPromoValid(TPromo const *, bool);                                 // 001E3208
  static TPromo *FindValidPromo(int, bool);                                      // 001E33D4
  static void SetSeason(int);                                                    // 001E3418
  static int GetStageUnlockTime(int, int);                                       // 001E3448
  static int GetStageUnlockTime(int);                                            // 001E34A6
  static uchar GetShirtNumber();                                                 // 001E34FC
  static void SetStageStars(int, int);                                           // 001E3530
  static void SetStageComplete(int, int);                                        // 001E3570
  static void SetLastPlayedStageID(int);                                         // 001E35CC
  CStoryProfileStages *GetProfileStages();                                       // 001E35F4
  static void ApplyUserPlayer(TPlayerInfo *);                                    // 001E3620
  static int GetTimeString(long, wchar_t *, bool);                               // 001E3650
  static time_t GetTimeFromString(char *, int);                                  // 001E3798
  static void IncrementSessionStagesComplete(bool);                                     // 001E37BC

  static CStageManager m_tStageManager;
  static TCStoryCoreActiveStory m_tActiveStory;
  static CSideStoryProfile m_cSideProfile;
  static CStoryProfile m_cProfile;
  static TStoryStages m_tStages;
  static int m_iEnvironmentSignature;
  static int ms_iSessionStagesCompleted;

  CFTTVector32 fvec_00;  // 00
};

//---------------------------------------------------------------------------------------------------------
#endif  //_CSTORYCORE_H_