view NPC.h @ 646:2f778a5dc27e

m
author Ritor1
date Tue, 12 Mar 2013 01:23:59 +0600
parents 59713bb36033
children 1ff57450f090
line wrap: on
line source

#pragma once

/*
enum NPCProffession
	{
	Smith	1
	Armorer	2
	Alchemist	3
	Scholar	4
	Guide	5
	Tracker	6
	Pathfinder	7
	Sailor	8
	Navigator	9
	Healer	10
	Expert Healer	11
	Master Healer	12
	Teacher	13
	Instructor	14
	Arms Master	15
	Weapons Master	16
	Apprentice	17
	Mystic	18
	Spell Master	19
	Trader	20
	Merchant	21
	Scout	22
	Herbalist	23
	Apothecary	24
	Tinker	25
	Locksmith	26
	Fool	27
	Chimney Sweep	28
	Porter	29
	Quarter Master	30
	Factor	31
	Banker	32
	Cook	33
	Chef	34
	Horseman	35
	Bard	36
	Enchanter	37
	Cartographer	38
	Wind Master	39
	Water Master	40
	Gate Master	41
	Acolyte	42
	Piper	43
	Explorer	44
	Pirate	45
	Squire	46
	Psychic	47
	Gypsy	48
	Diplomat	49
	Duper	50
	Burglar	51
	Fallen Wizard	52
	Acolyte	53
	Initiate	54
	Prelate	55
	Monk	56
	Sage	57
	Hunter	58


	};
	*/


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)
                                  /*   

      v0 = uDefaultTravelTime_ByFoot;
  if ( CheckHiredNPCSpeciality(5u) )
    --v0;
  if ( CheckHiredNPCSpeciality(6u) )
    v0 -= 2;
  if ( CheckHiredNPCSpeciality(7u) )
    v0 -= 3;
  if ( CheckHiredNPCSpeciality(0x2Cu) )
    --v0;


      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
{
  inline NPCProfession():
    uHirePrice(0), pBenefits(nullptr), pActionText(nullptr), pJoinText(nullptr), pDismissText(nullptr)
  {}

  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;  //at first meet
  char *pGreeting2;  // at latest meets
};
#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)

extern int pDialogueNPCCount;
extern struct Texture *pDialogueNPCPortraits[6];
extern int uNumDialogueNPCPortraits; // weak
extern struct NPCStats *pNPCStats;

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