forked from Ravie/quice
-
Notifications
You must be signed in to change notification settings - Fork 2
/
MyDataModule.pas
403 lines (371 loc) · 15.4 KB
/
MyDataModule.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
unit MyDataModule;
interface
uses
Forms, SysUtils, Classes, ActnList, ExtActns, Translate, WideStrings,
DB, ZAbstractRODataset, ZAbstractDataset, ZDataset, JvExComCtrls, JvListView;
const
DefaultLanguage = 'English';
SoftwareCompany = 'Indomit Software';
ProgramName = 'Quice';
type
TType = (ttNPC, ttItem, ttObject, ttQuest, ttChar);
TSite = (sW, sRW, sA, sT, sD);
TdmMain = class(TDataModule)
ActionList: TActionList;
BrowseURL: TBrowseURL;
MyQuery: TZQuery;
procedure DataModuleDestroy(Sender: TObject);
private
{ Private declarations }
FLanguage : string;
FSite: TSite;
procedure SetLanguage(const Value: string);
public
{ Public declarations }
ProgramDir: string;
DBCDir: string;
LanguageFile: string;
Translate: TTranslate;
Text: array [0..3000] of string;
IsAutoUpdates: boolean;
ProxyServer,
ProxyPort,
ProxyUser,
ProxyPass: string;
DBCLocale: Cardinal;
Locales: Cardinal;
property Language: string read FLanguage write SetLanguage;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Site: TSite read FSite write FSite;
procedure BrowseSite(T: TType; id: integer);
procedure wowhead(T: TType; id: integer);
procedure ruwowhead(T: TType; id: integer);
procedure thottbot(T: TType; id: integer);
procedure allakhazam(T: TType; id: integer);
procedure wowdb(T: TType; id: integer);
procedure Init;
end;
var
dmMain: TdmMain;
implementation
uses MainUnit, Functions;
{$R *.dfm}
{ TdmMain }
constructor TdmMain.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FSite := sW;
Init;
ProgramDir:=IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName));
try
DBCDir := ReadFromRegistry(CurrentUser, '', 'DBCDir', tpString);
except
DBCDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) + 'DBFilesClient';
end;
try
DBCLocale := ReadFromRegistry(CurrentUser, '', 'DBCLocale', tpInteger);
except
DBCLocale := 16;
end;
try
Language := ReadFromRegistry(CurrentUser, '', 'Language', tpString);
except
Language := DefaultLanguage;
end;
try
IsAutoUpdates := ReadFromRegistry(CurrentUser, '', 'IsAutoUpdates', tpBool);
except
IsAutoUpdates := True;
end;
try
ProxyServer := ReadFromRegistry(CurrentUser, '', 'ProxyServer', tpString);
ProxyPort := ReadFromRegistry(CurrentUser, '', 'ProxyPort', tpString);
ProxyUser := ReadFromRegistry(CurrentUser, '', 'ProxyUser', tpString);
ProxyPass := ReadFromRegistry(CurrentUser, '', 'ProxyPass', tpString);
except
end;
Translate:=TTranslate.Create;
Translate.CreateCustomTranslation;
if not FileExists(LanguageFile) then Language := DefaultLanguage;
Translate.LoadTranslations(LanguageFile);
Translate.TranslateCustomText;
end;
procedure TdmMain.BrowseSite(T: TType; id: integer);
begin
case FSite of
sW: wowhead(T, id);
sRW: ruwowhead(T, id);
sA: allakhazam(T, id);
sT: thottbot(T, id);
sD: wowdb(T, id);
end;
end;
procedure TdmMain.allakhazam(T: TType; id: integer);
var
url: string;
begin
id:=abs(id);
case T of
ttNPC: url := Format('http://wow.allakhazam.com/db/mob.html?wmob=%d',[id]);
ttItem: url := Format('http://wow.allakhazam.com/db/item.html?witem=%d',[id]);
ttObject: url := Format('http://wow.allakhazam.com/db/object.html?wobject=%d',[id]);
ttQuest: url := Format('http://wow.allakhazam.com/db/quest.html?wquest=%d',[id]);
end;
BrowseURL.URL:=url;
BrowseURL.Execute;
end;
procedure TdmMain.thottbot(T: TType; id: integer);
var
url: string;
begin
id:=abs(id);
case T of
ttNPC: url := Format('http://thottbot.com/c%d',[id]);
ttItem: url := Format('http://thottbot.com/i%d',[id]);
ttObject: url := Format('http://thottbot.com/o%d',[id]);
ttQuest: url := Format('http://thottbot.com/q%d',[id]);
end;
BrowseURL.URL:=url;
BrowseURL.Execute;
end;
procedure TdmMain.wowdb(T: TType; id: integer);
var
url: string;
begin
id:=abs(id);
case T of
ttNPC: url := Format('http://www.wowdb.com/npc.aspx?id=%d',[id]);
ttItem: url := Format('http://www.wowdb.com/item.aspx?id=%d',[id]);
ttObject: url := Format('http://www.wowdb.com/object.aspx?id=%d',[id]);
ttQuest: url := Format('http://www.wowdb.com/quest.aspx?id=%d',[id]);
end;
BrowseURL.URL:=url;
BrowseURL.Execute;
end;
procedure TdmMain.wowhead(T: TType; id: integer);
var
url: string;
begin
id:=abs(id);
case T of
ttNPC: url := Format('http://www.wowhead.com/?npc=%d',[id]);
ttItem: url := Format('http://www.wowhead.com/?item=%d',[id]);
ttObject: url := Format('http://www.wowhead.com/?object=%d',[id]);
ttQuest: url := Format('http://www.wowhead.com/?quest=%d',[id]);
end;
BrowseURL.URL:=url;
BrowseURL.Execute;
end;
procedure TdmMain.ruwowhead(T: TType; id: integer);
var
url: string;
begin
id:=abs(id);
case T of
ttNPC: url := Format('http://ru.wowhead.com/?npc=%d',[id]);
ttItem: url := Format('http://ru.wowhead.com/?item=%d',[id]);
ttObject: url := Format('http://ru.wowhead.com/?object=%d',[id]);
ttQuest: url := Format('http://ru.wowhead.com/?quest=%d',[id]);
end;
BrowseURL.URL:=url;
BrowseURL.Execute;
end;
procedure TdmMain.DataModuleDestroy(Sender: TObject);
begin
WriteToRegistry(CurrentUser, '', 'IsAutoUpdates', tpBool, IsAutoUpdates);
WriteToRegistry(CurrentUser, '', 'ProxyServer', tpString, ProxyServer);
WriteToRegistry(CurrentUser, '', 'ProxyPort', tpString, ProxyPort);
WriteToRegistry(CurrentUser, '', 'ProxyUser', tpString, ProxyUser);
WriteToRegistry(CurrentUser, '', 'ProxyPass', tpString, ProxyPass);
end;
destructor TdmMain.Destroy;
begin
Translate.Free;
inherited;
end;
procedure TdmMain.Init;
var
i:integer;
begin
for i:=0 to 3000 do
Text[i]:='';
Text[0]:='NONE';
Text[1]:='Item cannot be a quest taker';
Text[2]:='Error: Quest (%d) not found';
Text[3]:='The error has occurred while loading the Quest:';
Text[4]:='Error: QuestGiver is not set';
Text[5]:='Error: QuestGiver is not set correctly';
Text[6]:='Error: QuestTaker is not set';
Text[7]:='Error: QuestTaker is not set correctly';
Text[8]:='Warning: There is no one component assigned to field `%s`. It will be assigned to default value if it has one.';
Text[9]:='Are you sure to execute this script?';
Text[10]:='Script executed successfully.';
Text[11]:='QuestSort';
Text[12]:='Zone';
Text[13]:='Type';
Text[14]:='Faction';
Text[15]:='FactionTemplate';
Text[16]:='Skill';
Text[17]:='Creature location';
Text[18]:='Gameobject location';
Text[19]:='Item Loot';
Text[20]:='Nothing to check.';
Text[21]:='List of found quests is empty. Nothing to check.';
Text[22]:='Terminating check. Please wait.';
Text[23]:='Terminated';
Text[24]:='quest = %d';
Text[25]:='Fatal Error: Wrong quest id (%d)';
Text[26]:='Fatal Error: Quest with entry = %d not found';
Text[27]:='Warning: There more than one quest giver:';
Text[28]:='Error: quest giver is creature with entry = %d, but (`NpcFlags` & 2) <> 2';
Text[29]:='Warning: There more than one location for quest giver (id=%d) in table `creature`';
Text[30]:='Error: Location for quest giver (id=%d) not found in table `creature`';
Text[31]:='Error: quest giver is creature with entry = %d, but there is no one record in `creature_template` with entry = %0:d';
Text[32]:='Warning: There more than one location for quest giver (id=%d) in table `gameobject`';
Text[33]:='Error: Location for quest giver (id=%d) not found in table `gameobject`';
Text[34]:='Warning: quest giver is item (id=%d), but there is no one loot in tables *_loot_template and npc_vendor. May be it is not error, just item need to be rewarded or given from other quest.';
Text[35]:='Warning: There more than one quest taker:';
Text[36]:='Error: quest taker is creature with entry = %d, but (`NpcFlags` & 2) <> 2';
Text[37]:='Warning: There more than one location for quest taker (id=%d) in table `creature`';
Text[38]:='Error: Location for quest taker (id=%d) not found in table `creature`';
Text[39]:='Error: quest taker is creature with entry = %d, but there is no one record in `creature_template` with entry = %0:d';
Text[40]:='Warning: There more than one location for quest taker (id=%d) in table `gameobject`';
Text[41]:='Error: Location for quest taker (id=%d) not found in table `gameobject`';
Text[42]:='Error: quest taker is gameobject with entry = %d, but there is no one record in `gameobject_template` with entry = %0:d';
Text[43]:='Error: quest giver not found';
Text[44]:='Error: quest taker not found';
Text[45]:='Warning: There is more than one different type quest giver (quest giver count=%d)';
Text[46]:='Warning: There is more than one different type quest taker (quest taker count=%d)';
Text[47]:='Error: PrevQuestId=%d, but quest with this id is not exists';
Text[48]:='Error: NextQuestId=%d, but quest with this id is not exists';
Text[49]:='Error: Type = %d, but Type with this id is not exists';
Text[50]:='Error: %s = %d, but Faction with this id is not exists';
Text[51]:='Error: ZoneOrSort = %d, but ZoneId with this id is not exists';
Text[52]:='Error: ZoneOrSort = %d, but QuestSort with this id is not exists';
Text[53]:='Error: MinLevel (%d) > QuestLevel (%d)';
Text[54]:='Warning: QuestFlags is set to EXPLORATION but there is no one record in table `areatrigger_involvedrelation` for quest';
Text[55]:='Warning: QuestFlags is set to SPEAK_TO but NextQuestId = 0';
Text[56]:='Error: QuestFlags is set to DELIVER but ReqItemId1.-4. = 0';
Text[57]:='Error: QuestFlags is set to KILL_OR_CAST but ReqCreatureOrGOId1.-4. = 0';
Text[58]:='Warning: LimitTime = %d seconds, but QuestFlags is not set to TIMED';
Text[59]:='Warning: ReqItemId <> 0, but QuestFlags is not set to DELIVER';
Text[60]:='Warning: ReqCreatureOrGOId <> 0, but QuestFlags is not set to KILL_OR_CAST';
Text[61]:='Warning: NextQuestId <> 0, but QuestFlags is not set to SPEAK_TO';
Text[62]:='Error: %s = %d, but item with this id is not exists';
Text[63]:='Warning: %s = %d, but there is no one loot in tables *_loot_template and npc_vendor. May be it is not error, just item need to be created or rewarded from other quest.';
Text[64]:='Error: %s = %d. Loot for this item is gameobject_loot_template.entry = %d, but gameobject with this id not found in `gameobject` table';
Text[65]:='Error: %s = %d. Loot for this item is creature_loot_template.entry = %d, but creature with this id not found in `creature` table';
Text[66]:='Error: ReqSourceRef%d > 4';
Text[67]:='Error: ReqSourceId%d=0, but ReqSourceRef%0:d=%1:d';
Text[68]:='Error: ReqItemId%1:d=0, but ReqSourceRef%0:d=%1:d';
Text[69]:='Error: ReqCreatureOrGOId%d = %d, but creature with this id is not exists';
Text[70]:='Error: ReqCreatureOrGOId%d = %d, Location for creature not exists';
Text[71]:='Error: ReqCreatureOrGOId%d = %d, but gameobject with this id is not exists';
Text[72]:='Error: ReqCreatureOrGOId%d = %d, Location for gameobject not exists';
Text[73]:='Check complete: %d errors, %d warnings';
Text[74]:='Check quest (%d) : %d%%';
Text[75]:='Check quest complete';
Text[76]:='Error: quest giver is gameobject with entry = %d, but there is no one record in `gameobject_template` with entry = %0:d';
Text[77]:='<< Details';
Text[78]:='Details >>';
Text[79]:='Quests found: %d';
Text[80]:='Creatures found: %d';
Text[81]:='Error: Creature (entry = %d) not found';
Text[82]:='The error has occurred while loading the Creature_Template:';
Text[83]:='Rank';
Text[84]:='Family';
Text[85]:='Creature Type';
Text[86]:='The error has occurred while loading Creature:';
Text[87]:='GameObjects found: %d';
Text[88]:='Error: Gameobject (entry = %d) not found';
Text[89]:='The error has occurred while loading the Gameobject_Template:';
Text[90]:='The error has occurred while loading GameObject:';
Text[91]:='The error has occurred while loading creature_loot_template:';
Text[92]:='The error has occurred while loading gameobject_loot_template:';
Text[93]:='GameObject Type';
Text[94]:='Always = 0 or Unknown';
Text[95]:='State';
Text[96]:='LockID ( ID from Lock.dbc )';
Text[97]:='flags';
Text[98]:='ID gameobject ( Spawned GO type 6 )';
Text[99]:='State Battleground';
Text[100]:='QuestLoot ID';
Text[101]:='LootID';
Text[102]:='Time';
Text[103]:='MinLoot';
Text[104]:='MaxLoot';
Text[105]:='QuestID ( Quest complete )';
Text[106]:='Distance';
Text[107]:='Spell ID';
Text[108]:='Time/Distance';
Text[109]:='Chain Effect';
Text[110]:='Time/Distance for Chain Effect';
Text[111]:='areatrigger_template.id';
Text[112]:='Distance/ State';
Text[113]:='ID SpellFocusObject.dbc';
Text[114]:='Page ID';
Text[115]:='ID from PageTextMaterial.dbc';
Text[116]:='Items found: %d';
Text[117]:='Error: Item (entry = %d) not found';
Text[118]:='The error has occurred while loading the Item_Template:';
Text[119]:='Quality';
Text[120]:='InventoryType';
Text[121]:='RequiredReputationRank';
Text[122]:='StatType';
Text[123]:='DmgType';
Text[124]:='Bonding';
Text[125]:='Language';
Text[126]:='PageMaterial';
Text[127]:='Material';
Text[128]:='Sheath';
Text[129]:='BagFamily';
Text[130]:='Class';
Text[131]:='SubClass';
Text[132]:='ItemSet';
Text[133]:='Map';
Text[134]:='Search filter is empty. This task returns all entries from table.$B$BAre you sure to continue?';
Text[135]:='Script Command';
Text[136]:='Characters found: %d';
Text[137]:='New version of Quice (%s) is available. You want to download it?';
Text[138]:='You have got the latest version.';
Text[139]:='The error has occurred while loading Creature Addon:';
Text[140]:='Are you sure to uninstall Quice?';
Text[141]:='Trainer Type';
Text[142]:='Race';
Text[143]:='Class';
Text[144]:='The error has occurred while loading NPC gossip:';
Text[145]:='The error has occurred while loading NPC Text:';
Text[146]:='~OBSOLETE';
Text[147]:='Emote';
Text[148]:='ItemPetFood';
Text[149]:='The error has occurred while loading Creature Template Addon:';
Text[150]:='GemProperties';
Text[151]:='SpellItemEnchantment';
Text[152]:='ItemExtendedCost';
Text[153]:='Error: Character (guid = %d) not found';
Text[154]:='The error has occurred while loading the Character:';
Text[155]:='AreaTrigger';
Text[156]:='Conditions';
Text[157]:='The error has occurred while loading Creature EventAI:';
Text[158]:='Option Icon';
Text[159]:='The error has occurred while loading Creature Template Spells:';
Text[160]:='The error has occurred while loading DBScripts On Creature Death:';
Text[161]:='Error: Conditions (condition_entry = %d) not found';
Text[162]:='The error has occurred while loading Conditions:';
Text[163]:='Method of text output';
Text[164]:='Error: Db_script_string (entry = %d) not found';
Text[165]:='The error has occurred while loading Db_script_string:';
Text[166]:='Error: %s (entry = %d) not found';
Text[167]:='The error has occurred while loading %s:';
Text[168]:='Error: creature_model_info (id = %d) not found';
Text[169]:='The error has occurred while loading creature_model_info:';
Text[170]:='Error: gossip_menu_option (id = %d) not found';
Text[171]:='The error has occurred while loading gossip_menu_option:';
end;
procedure TdmMain.SetLanguage(const Value: string);
begin
FLanguage := Value;
LanguageFile := Format('%sLANG\%s.lng',[ProgramDir, Value]);
end;
end.