view NPC.h @ 353:95be2dcecadf

Partial refactor for Player::GetActualSkillLevel
author Nomad
date Thu, 21 Feb 2013 03:49:33 +0200
parents 0ea5fbd16edb
children f0f66f690777
line wrap: on
line source

#pragma once


struct NPCTopic
{
  const char *pTopic;
  const char *pText;
};

extern NPCTopic pNPCTopics[789];


/*  136 */
#pragma pack(push, 1)
struct NPCData  //4Ch
{
  inline bool Hired() {return uFlags & 0x80;}

  char *pName;  //0
  unsigned int uPortraitID;  //4
  unsigned int uFlags;     //8    // & 0x80    no greeting on dialogue start; looks like hired
  int fame;  //c
  int rep;  //10
  unsigned int Location2D;  //14
  unsigned int uProfession; //18      CheckHiredNPCSpeciality(uProfession)
                                  /*   

      case PLAYER_SKILL_MONSTER_ID:
      if ( CheckHiredNPCSpeciality(58) )
        skill += 6;
      if ( CheckHiredNPCSpeciality(57) )
        skill += 6;

    case PLAYER_SKILL_ARMSMASTER:
        if ( CheckHiredNPCSpeciality(15) )
          skill += 2;
        if ( CheckHiredNPCSpeciality(16) )
          skill += 3;

    case PLAYER_SKILL_STEALING:
      if (CheckHiredNPCSpeciality(51))
        skill +=

    case PLAYER_SKILL_ALCHEMY:
        if ( CheckHiredNPCSpeciality(23) )
          skill += 4;
        if ( CheckHiredNPCSpeciality(24) )
	  skill += 8

    case PLAYER_SKILL_LEARNING:
        if ( CheckHiredNPCSpeciality(13) )
          skill += 10;
        if ( CheckHiredNPCSpeciality(14) )
          skill += 15;
        if ( CheckHiredNPCSpeciality(4) )
          skill += 5;

    case PLAYER_SKILL_UNARMED:	
      if (CheckHiredNPCSpeciality(56) )
       skill +

    case PLAYER_SKILL_DODGE:
      if ( CheckHiredNPCSpeciality(56) )
       skill+

    case PLAYER_SKILL_MERCHANT:
        if ( CheckHiredNPCSpeciality(20) )
          skill += 4;
        if ( CheckHiredNPCSpeciality(21) )
          skill += 6;
        if ( CheckHiredNPCSpeciality(48) )
          skill += 3;
        if ( CheckHiredNPCSpeciality(50) )
          skill += 8;

    case PLAYER_SKILL_PERCEPTION:
      if ( CheckHiredNPCSpeciality(22) )
        v2 = 6;
      if ( CheckHiredNPCSpeciality(47) )
        v2 += 5;

    case PLAYER_SKILL_TRAP_DISARM:
      if ( CheckHiredNPCSpeciality(25) )
        v2 = 4;
      if ( CheckHiredNPCSpeciality(26) )
        v2 += 6;
      if ( CheckHiredNPCSpeciality(51) )
        v2 += 8;

      FIRE WATER EARTH AIR
          if ( CheckHiredNPCSpeciality(17) )
            v2 = 2;
          if ( CheckHiredNPCSpeciality(18) )
            v2 += 3;
          if ( CheckHiredNPCSpeciality(19) )
            v2 += 4;
          if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
            v2 += 3;

      SPIRIT MIND BODY
          if ( CheckHiredNPCSpeciality(53) )
            v2 = 2;
          if ( CheckHiredNPCSpeciality(54) )
            v2 += 3;
          if ( CheckHiredNPCSpeciality(55) )
            v2 += 4;
  */
  int greet;  //1c
  int joins;  //20
  int field_24;
  unsigned int evt_A; //28
  unsigned int evt_B; //2c evtb
  unsigned int evt_C; //  30 evtc
  unsigned int evt_D;  //34
  unsigned int evt_E;  //38
  unsigned int evt_F;  //3c
  unsigned int uSex;  //40
  int bHasUsedTheAbility; //44
  int news_topic;  //48
};
#pragma pack(pop)


/*  138 */
#pragma pack(push, 1)
struct NPCProfession
{
  unsigned int uHirePrice;
  char *pBenefits;
  char *pActionText;
  char *pJoinText;
  char *pDismissText;
};
#pragma pack(pop)


/*  139 */
#pragma pack(push, 1)
struct NPCProfessionChance
{
  unsigned int uTotalprofChance;  //summ 
  char professionChancePerArea[60]; //prof position
};
#pragma pack(pop)

/*  140 */
#pragma pack(push, 1)
struct NPCGreeting
{
  char *pGreeting1;
  char *pGreeting2;
};
#pragma pack(pop)


/*  137 */
#pragma pack(push, 1)
struct NPCStats
{
  inline NPCStats():
    pNPCTextTXT_Raw(nullptr), pNPCTopicTXT_Raw(nullptr), pNPCDistTXT_Raw(nullptr)
  {
    uNumNPCNames[0] = uNumNPCNames[1] = 0;
  }

  void InitializeNPCText();
  void InitializeNPCData();
  void Initialize();
  void Release();
  void InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId);
  void _476C60();

  
  NPCData pNPCData[501]; //0 - 94BCh count from 1 
  NPCData pNewNPCData[501]; //94BCh- 12978h count from 1
  char *pNPCNames[540][2];
  NPCProfession pProfessions[59];  //count from 1
  NPCData pAdditionalNPC[100];
  char *pCatchPhrases[52];  //15CA4h
  char *pNPCUnicNames[500];  //from first batch
  NPCProfessionChance pProfessionChance[77]; //16544h profession chance in each area
  int field_17884;
  int field_17888;
  NPCGreeting pNPCGreetings[205];
  unsigned __int16 pGroups[51];
  unsigned __int16 pGroups_copy[51];
  unsigned int uNewlNPCBufPos;
  unsigned int uNumNewNPCs;
  int field_17FC8;
  unsigned int uNumNPCProfessions;
  unsigned int uNumNPCNames[2]; //0 male 1 female
  char *pNPCDataTXT_Raw;
  char *pNPCNamesTXT_Raw;
  char *pNPCProfTXT_Raw;
  char *pNPCNewsTXT_Raw;
  char *pNPCTopicTXT_Raw;
  char *pNPCTextTXT_Raw;
  char *pNPCDistTXT_Raw;
  char *pNPCGreetTXT_Raw;
  char *pNCPGroupTXT_Raw;
};
#pragma pack(pop)

bool PartyHasDragon();
bool CheckHiredNPCSpeciality(unsigned int uProfession);