Changeset 634 for tools


Ignore:
Timestamp:
Dec 10, 2013, 4:49:25 PM (11 years ago)
Author:
maron
Message:
  • Added: options from
  • Fixed: some bugs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/WoWHeadLoader/WoWHeadLoader.lpr

    r631 r634  
    6363  Column2DB: array [1..6] of string = ('Description','Description','SubName','','','');
    6464  ImportTable: integer = 6;
     65  From: integer = 1;
    6566{ TWoWHeadLoader }
    6667//   IdHTTP1.Request.UserAgent:= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
     
    7374begin
    7475  // quick check parameters
    75   ErrorMsg:=CheckOptions('hsuptai','helpschemauserpasswordhostCharsetimporttable');
     76  ErrorMsg:=CheckOptions('hsuptaif','helpschemauserpasswordhostCharsetimporttablefrom');
    7677  if ErrorMsg<>'' then begin
    7778    ShowException(Exception.Create(ErrorMsg));
     
    109110    ImportTable := StrToInt(GetOptionValue('i', 'importtable'));
    110111  end else ImportTable := 6;
     112  if HasOption('f', 'from') then begin
     113    From := StrToInt(GetOptionValue('f', 'from'));
     114  end else From := 1;
    111115
    112116  Database.Connect;
     
    147151  WriteLn('  -a --Charset     Database Charset, default utf8');
    148152  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');
    149154end;
    150155
     
    168173  GetText(4,6);
    169174  }
     175
     176//  GetText(3977,3);
     177//  GetText(29265,3);
     178
    170179 // for t :=1 to Length(Group) do
    171     for i := 1 to GetMaxID(Group[ImportTable]) do begin //GetMaxID('quest')
     180    for i := From to GetMaxID(Group[ImportTable]) do begin //GetMaxID('quest')
    172181      GetText(i,ImportTable);
    173       write('.');
     182   //   write('.');
    174183    end;
     184     write('Done!!!');
    175185  //čekej před uzavřením
    176   ReadLn;
     186//  ReadLn;
    177187end;
    178188
     
    195205     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
    196206       foundtext:=false;
     207       WriteLn('obsolete');
    197208       Exit;
    198209     end;
    199      WriteLn();
    200      WriteLn('guest='+IntToStr(Id));
    201210
    202211
     
    264273    DBRows := Database.Query('SELECT * FROM  `TextQuest` WHERE  `Entry` ='+IntToStr(Id)+' AND  `Language` =0 ORDER BY  `TextQuest`.`VersionEnd` DESC ');
    265274    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;
    267279      if (
    268280        CompareStrings(DBRows.Data[0].Values['Title'],textname) and
     
    290302        Database.Query('UPDATE  `TextQuest` SET  `VersionEnd` = '+IntToStr(ImportedVersion)+' WHERE  `Take` = '+DBRows.Data[0].Values['Id']+' AND `Entry` ='+IntToStr(Id)+';');
    291303        UpdateTranslated('textquest');
     304        WriteLn('update');
    292305        Exit;   //konec: text je stejný upravili se jenom výsledné verze
    293306      end;
     
    336349      +SqlPre(textobjective4)+', '
    337350      +'0,  NULL, 1,0,NULL,'+IntToStr(ImportedVersion)+','+IntToStr(ImportedVersion)+',NOW())');
     351      WriteLn('insert');
    338352
    339353      //TODO: zkopírovat přeložený text pokud je celý anglický přeložený
     
    373387     on E: EIdHTTPProtocolException do
    374388     begin
    375        if E.ErrorCode = 404 then
     389       if E.ErrorCode = 404 then begin
    376390         foundtext := false;
     391         WriteLn('notfound');
     392       end;
    377393
    378394     end;
     
    439455     end;
    440456     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;
    443462       if (Pos('<',textname) >0) then
    444          textname := TextStringReplace(Copy(textname,0,Pos('<',textname)-1));
     463          textname := TextStringReplace(Copy(textname,0,Pos('<',textname)-1));
    445464     end;
    446465     textname:=DelHtmlTags(textname);
Note: See TracChangeset for help on using the changeset viewer.