Changeset 634 for tools/WoWHeadLoader
- Timestamp:
- Dec 10, 2013, 4:49:25 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/WoWHeadLoader/WoWHeadLoader.lpr
r631 r634 63 63 Column2DB: array [1..6] of string = ('Description','Description','SubName','','',''); 64 64 ImportTable: integer = 6; 65 From: integer = 1; 65 66 { TWoWHeadLoader } 66 67 // IdHTTP1.Request.UserAgent:= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; … … 73 74 begin 74 75 // quick check parameters 75 ErrorMsg:=CheckOptions('hsuptai ','helpschemauserpasswordhostCharsetimporttable');76 ErrorMsg:=CheckOptions('hsuptaif','helpschemauserpasswordhostCharsetimporttablefrom'); 76 77 if ErrorMsg<>'' then begin 77 78 ShowException(Exception.Create(ErrorMsg)); … … 109 110 ImportTable := StrToInt(GetOptionValue('i', 'importtable')); 110 111 end else ImportTable := 6; 112 if HasOption('f', 'from') then begin 113 From := StrToInt(GetOptionValue('f', 'from')); 114 end else From := 1; 111 115 112 116 Database.Connect; … … 147 151 WriteLn(' -a --Charset Database Charset, default utf8'); 148 152 WriteLn(' -i --importtable Table import: TextAchievement=1,TextItem=2,TextCreature=3,TextGameObject=4,TextArea=5,TextQuest=6, default 6'); 153 WriteLn(' -f --from ID text begin importing'); 149 154 end; 150 155 … … 168 173 GetText(4,6); 169 174 } 175 176 // GetText(3977,3); 177 // GetText(29265,3); 178 170 179 // for t :=1 to Length(Group) do 171 for i := 1to GetMaxID(Group[ImportTable]) do begin //GetMaxID('quest')180 for i := From to GetMaxID(Group[ImportTable]) do begin //GetMaxID('quest') 172 181 GetText(i,ImportTable); 173 write('.');182 // write('.'); 174 183 end; 184 write('Done!!!'); 175 185 //čekej před uzavřením 176 ReadLn;186 // ReadLn; 177 187 end; 178 188 … … 195 205 if (pos('<b style="color: red">This quest was marked obsolete',data) > 0) or (pos('<b style="color: red">This quest is no longer available',data) > 0) then begin 196 206 foundtext:=false; 207 WriteLn('obsolete'); 197 208 Exit; 198 209 end; 199 WriteLn();200 WriteLn('guest='+IntToStr(Id));201 210 202 211 … … 264 273 DBRows := Database.Query('SELECT * FROM `TextQuest` WHERE `Entry` ='+IntToStr(Id)+' AND `Language` =0 ORDER BY `TextQuest`.`VersionEnd` DESC '); 265 274 if (DBRows.Count > 0) then begin 266 if (DBRows.Data[0].Values['VersionEnd'] = IntToStr(ImportedVersion)) then Exit; //konec pokud už tam text je 275 if (DBRows.Data[0].Values['VersionEnd'] = IntToStr(ImportedVersion)) then begin 276 WriteLn('Allready importet'); 277 Exit; //konec pokud už tam text je 278 end; 267 279 if ( 268 280 CompareStrings(DBRows.Data[0].Values['Title'],textname) and … … 290 302 Database.Query('UPDATE `TextQuest` SET `VersionEnd` = '+IntToStr(ImportedVersion)+' WHERE `Take` = '+DBRows.Data[0].Values['Id']+' AND `Entry` ='+IntToStr(Id)+';'); 291 303 UpdateTranslated('textquest'); 304 WriteLn('update'); 292 305 Exit; //konec: text je stejný upravili se jenom výsledné verze 293 306 end; … … 336 349 +SqlPre(textobjective4)+', ' 337 350 +'0, NULL, 1,0,NULL,'+IntToStr(ImportedVersion)+','+IntToStr(ImportedVersion)+',NOW())'); 351 WriteLn('insert'); 338 352 339 353 //TODO: zkopírovat přeložený text pokud je celý anglický přeložený … … 373 387 on E: EIdHTTPProtocolException do 374 388 begin 375 if E.ErrorCode = 404 then 389 if E.ErrorCode = 404 then begin 376 390 foundtext := false; 391 WriteLn('notfound'); 392 end; 377 393 378 394 end; … … 439 455 end; 440 456 if ('npc' = Group[TextType]) then begin 441 textdescription := skipto('<',textname); 442 textdescription := TextStringReplace(Copy(textdescription,0,Pos('>',textdescription)-1)); 457 if not (Pos('src="',textname) >0) then begin 458 if (Pos('>',textname) > 0) then 459 textdescription := skipto('<',textname); 460 textdescription := TextStringReplace(Copy(textdescription,0,Length(textdescription)-1)); 461 end; 443 462 if (Pos('<',textname) >0) then 444 textname := TextStringReplace(Copy(textname,0,Pos('<',textname)-1));463 textname := TextStringReplace(Copy(textname,0,Pos('<',textname)-1)); 445 464 end; 446 465 textname:=DelHtmlTags(textname);
Note:
See TracChangeset
for help on using the changeset viewer.