comparison Engine/Objects/NPC.h @ 2498:92eeeb5200f2

.
author Ritor1
date Fri, 19 Sep 2014 00:03:04 +0600
parents
children 117c219bf913
comparison
equal deleted inserted replaced
2497:82d5d92a097c 2498:92eeeb5200f2
1 #pragma once
2
3 enum NPCProf
4 {
5 Smith = 1, // GM Weapon Repair;
6 Armorer = 2, // GM Armor Repair;
7 Alchemist = 3, // GM Potion Repair;
8 Scholar = 4, // GM Item ID; Learning: +5
9 Guide = 5, // Travel by foot: -1 day;
10 Tracker = 6, // Travel by foot: -2 days;
11 Pathfinder = 7, // Travel by foot: -3 days;
12 Sailor = 8, // Travel by sea: -2 days;
13 Navigator = 9, // Travel by sea: -3 days;
14 Healer = 10,
15 ExpertHealer = 11,
16 MasterHealer = 12,
17 Teacher = 13, // Learning: +10;
18 Instructor = 14, // Learning: +15;
19 Armsmaster = 15, // Armsmaster: +2;
20 Weaponsmaster = 16, // Armsmaster: +3;
21 Apprentice = 17, // Fire: +2; Air: +2; Water: +2; Earth: +2;
22 Mystic = 18, // Fire: +3; Air: +3; Water: +3; Earth: +3;
23 Spellmaster = 19, // Fire: +4; Air: +4; Water: +4; Earth: +4;
24 Trader = 20, // Merchant: +4;
25 Merchant = 21, // Merchant: +6;
26 Scout = 22, // Perception: +6;
27 Herbalist = 23, // Alchemy: +4;
28 Apothecary = 24, // Alchemy: +8;
29 Tinker = 25, // Traps: +4;
30 Locksmith = 26, // Traps: +6;
31 Fool = 27, // Luck: +5;
32 ChimneySweep = 28, // Luck: +20;
33 Porter = 29, // Food for rest: -1;
34 QuarterMaster = 30, // Food for rest: -2;
35 Factor = 31, // Gold finds: +10%;
36 Banker = 32, // Gold finds: +20%;
37 Cook = 33,
38 Chef = 34,
39 Horseman = 35, // Travel by foot: -2 days;
40 Bard = 36,
41 Enchanter = 37, // Resist All: +20;
42 Cartographer = 38, // Wizard Eye level 2;
43 WindMaster = 39,
44 WaterMaster = 40,
45 GateMaster = 41,
46 Acolyte = 42,
47 Piper = 43,
48 Explorer = 44, // Travel by foot -1 day; Travel by sea: -1 day;
49 Pirate = 45, // Travel by sea: -2 days; Gold finds: +10%; Reputation: +5;
50 Squire = 46,
51 Psychic = 47, // Perception: +5; Luck: +10;
52 Gypsy = 48, // Food for rest: -1; Merchant: +3; Reputation: +5;
53 Diplomat = 49,
54 Duper = 50, // Merchant: +8; Reputation: +5;
55 Burglar = 51, // Traps: +8; Stealing: +8; Reputation: +5;
56 FallenWizard = 52, // Reputation: +5;
57 Acolyte2 = 53, // Spirit: +2; Mind: +2; Body: +2;
58 Initiate = 54, // Spirit: +3; Mind: +3; Body: +3;
59 Prelate = 55, // Spirit: +4; Mind: +4; Body: +4;
60 Monk = 56, // Unarmed: +2; Dodge: +2;
61 Sage = 57, // Monster ID: +6
62 Hunter = 58 // Monster ID: +6
63 };
64
65
66
67 struct NPCTopic
68 {
69 const char *pTopic;
70 const char *pText;
71 };
72
73 extern std::array<NPCTopic, 789> pNPCTopics;
74
75
76 /* 136 */
77 #pragma pack(push, 1)
78 struct NPCData //4Ch
79 {
80 inline bool Hired() {return (uFlags & 0x80) != 0;}
81
82 char *pName; //0
83 unsigned int uPortraitID; //4
84 unsigned int uFlags; //8 // & 0x80 no greeting on dialogue start; looks like hired
85 int fame; //c
86 int rep; //10
87 unsigned int Location2D; //14
88 unsigned int uProfession; //18
89 int greet; //1c
90 int joins; //20
91 int field_24;
92 unsigned int evt_A; //28
93 unsigned int evt_B; //2c evtb
94 unsigned int evt_C; // 30 evtc
95 unsigned int evt_D; //34
96 unsigned int evt_E; //38
97 unsigned int evt_F; //3c
98 unsigned int uSex; //40
99 int bHasUsedTheAbility; //44
100 int news_topic; //48
101 };
102 #pragma pack(pop)
103
104
105 /* 138 */
106 #pragma pack(push, 1)
107 struct NPCProfession
108 {
109 inline NPCProfession():
110 uHirePrice(0), pBenefits(nullptr), pActionText(nullptr), pJoinText(nullptr), pDismissText(nullptr)
111 {}
112
113 unsigned int uHirePrice;
114 char *pBenefits;
115 char *pActionText;
116 char *pJoinText;
117 char *pDismissText;
118 };
119 #pragma pack(pop)
120
121
122 /* 139 */
123 #pragma pack(push, 1)
124 struct NPCProfessionChance
125 {
126 unsigned int uTotalprofChance; //summ
127 char professionChancePerArea[60]; //prof position
128 };
129 #pragma pack(pop)
130
131 /* 140 */
132 #pragma pack(push, 1)
133 struct NPCGreeting
134 {
135 union
136 {
137 struct
138 {
139 char *pGreeting1; //at first meet
140 char *pGreeting2; // at latest meets
141 };
142 char *pGreetings[2];
143 };
144 };
145 #pragma pack(pop)
146
147
148 /* 137 */
149 #pragma pack(push, 1)
150 struct NPCStats
151 {
152 inline NPCStats():
153 pNPCTextTXT_Raw(nullptr), pNPCTopicTXT_Raw(nullptr), pNPCDistTXT_Raw(nullptr)
154 {
155 uNumNPCNames[0] = uNumNPCNames[1] = 0;
156 }
157
158 void InitializeNPCText();
159 void InitializeNPCData();
160 void Initialize();
161 void Release();
162 void InitializeAdditionalNPCs(NPCData *pNPCDataBuff, int npc_uid, int uLocation2D, int uMapId);
163 void _476C60();
164 char * sub_495366_MispronounceName(unsigned __int8 firstLetter, unsigned __int8 genderId);
165
166
167 NPCData pNPCData[501]; //0 - 94BCh count from 1
168 NPCData pNewNPCData[501]; //94BCh- 12978h count from 1
169 char *pNPCNames[540][2];
170 NPCProfession pProfessions[59]; //count from 1
171 NPCData pAdditionalNPC[100];
172 char *pCatchPhrases[52]; //15CA4h
173 char *pNPCUnicNames[500]; //from first batch
174 NPCProfessionChance pProfessionChance[77]; //16544h profession chance in each area
175 int field_17884;
176 int field_17888;
177 NPCGreeting pNPCGreetings[205];
178 unsigned __int16 pGroups[51];
179 unsigned __int16 pGroups_copy[51];
180 unsigned int uNewlNPCBufPos;
181 unsigned int uNumNewNPCs;
182 int field_17FC8;
183 unsigned int uNumNPCProfessions;
184 unsigned int uNumNPCNames[2]; //0 male 1 female
185 char *pNPCDataTXT_Raw;
186 char *pNPCNamesTXT_Raw;
187 char *pNPCProfTXT_Raw;
188 char *pNPCNewsTXT_Raw;
189 char *pNPCTopicTXT_Raw;
190 char *pNPCTextTXT_Raw;
191 char *pNPCDistTXT_Raw;
192 char *pNPCGreetTXT_Raw;
193 char *pNCPGroupTXT_Raw;
194
195 static int dword_AE336C_LastMispronouncedNameFirstLetter;
196 static int dword_AE3370_LastMispronouncedNameResult;
197 };
198 #pragma pack(pop)
199
200 extern int pDialogueNPCCount;
201 extern std::array<struct Texture *, 6> pDialogueNPCPortraits;
202 extern int uNumDialogueNPCPortraits; // weak
203 extern struct NPCStats *pNPCStats;
204
205 bool PartyHasDragon();
206 bool CheckHiredNPCSpeciality(unsigned int uProfession);
207
208 int UseNPCSkill(NPCProf profession);
209 const char *ContractSelectText(int pEventCode);
210 void NPCHireableDialogPrepare();
211 void _4B4224_UpdateNPCTopics(int _this);
212 const char *GetProfessionActionText(int a1);
213 struct NPCData *__fastcall GetNPCData(signed int npcid);
214 struct NPCData * GetNewNPCData(signed int npcid, int* npc_indx);
215 int __fastcall GetGreetType(signed int SpeakingNPC_ID);
216 int NPC_EventProcessor(int npc_event_id, int entry_line = 0);