localdb.pas

来自「2009最新 传奇汉化0599代码 传奇汉化」· PAS 代码 · 共 1,924 行 · 第 1/5 页

PAS
1,924
字号
          MapFlag.boDECGAMEPOINT:=True;
          ArrestStringEx(s34,'(',')',s38);

          MapFlag.nDECGAMEPOINT:=Str_ToInt(GetValidStr3(s38,s38,['/']),-1);
          MapFlag.nDECGAMEPOINTTIME:=Str_ToInt(s38,-1);
          Continue;
        end;
        if CompareLStr(s34,'INCGAMEGOLD',length('INCGAMEGOLD')) then begin
          MapFlag.boINCGAMEGOLD:=True;
          ArrestStringEx(s34,'(',')',s38);

          MapFlag.nINCGAMEGOLD:=Str_ToInt(GetValidStr3(s38,s38,['/']),-1);
          MapFlag.nINCGAMEGOLDTIME:=Str_ToInt(s38,-1);
          Continue;
        end;
        if CompareLStr(s34,'INCGAMEPOINT',length('INCGAMEPOINT')) then begin
          MapFlag.boINCGAMEPOINT:=True;
          ArrestStringEx(s34,'(',')',s38);

          MapFlag.nINCGAMEPOINT:=Str_ToInt(GetValidStr3(s38,s38,['/']),-1);
          MapFlag.nINCGAMEPOINTTIME:=Str_ToInt(s38,-1);
          Continue;
        end;
        if CompareText(s34,'RUNHUMAN') = 0 then begin
          MapFlag.boRUNHUMAN:= True;
          Continue;
        end;
        if CompareText(s34,'RUNMON') = 0 then begin
          MapFlag.boRUNMON:= True;
          Continue;
        end;
        if CompareText(s34,'NEEDHOLE') = 0 then begin
          MapFlag.boNEEDHOLE := True;
          Continue;
        end;
        if CompareText(s34,'NORECALL') = 0 then begin
          MapFlag.boNORECALL := True;
          Continue;
        end;
        if CompareText(s34,'NOGUILDRECALL') = 0 then begin
          MapFlag.boNOGUILDRECALL := True;
          Continue;
        end;
        if CompareText(s34,'NODEARRECALL') = 0 then begin
          MapFlag.boNODEARRECALL := True;
          Continue;
        end;
        if CompareText(s34,'NOMASTERRECALL') = 0 then begin
          MapFlag.boNOMASTERRECALL := True;
          Continue;
        end;
        if CompareText(s34,'NORANDOMMOVE') = 0 then begin
          MapFlag.boNORANDOMMOVE := True;
          Continue;
        end;
        if CompareText(s34,'NODRUG') = 0 then begin
          MapFlag.boNODRUG := True;
          Continue;
        end;
        if CompareText(s34,'MINE') = 0 then begin
          MapFlag.boMINE := True;
          Continue;
        end;
        if CompareText(s34,'MINE2') = 0 then begin
          MapFlag.boMINE2 := True;
          Continue;
        end;
        if CompareText(s34,'MINE3') = 0 then begin
          MapFlag.boMINE3 := True;
          Continue;
        end;
        if CompareText(s34,'NOTHROWITEM') = 0 then begin
          MapFlag.boNOTHROWITEM := True;
          Continue;
        end;
        if CompareText(s34,'NODROPITEM') = 0 then begin
          MapFlag.boNODROPITEM := True;
          Continue;
        end;

        if CompareText(s34,'NOPOSITIONMOVE') = 0 then begin
          MapFlag.boNOPOSITIONMOVE := True;
          Continue;
        end;

        if CompareText(s34,'NOHORSE') = 0 then begin
          MapFlag.boNOHORSE := True;
          Continue;
        end;
        if CompareText(s34,'NOCHAT') = 0 then begin
          MapFlag.boNOCHAT := True;
          Continue;
        end;
        if (s34[1] = 'L') then begin
          MapFlag.nL:= Str_ToInt(Copy(s34,2,Length(s34) -1),1);
        end;
        if CompareLStr(s34,'THUNDER',length('THUNDER')) then begin
          ArrestStringEx(s34,'(',')',s38);
          MapFlag.nThunder := Str_ToInt(s38,-1);
          Continue;
        end;
        if CompareLStr(s34,'LAVA',length('LAVA')) then begin
          ArrestStringEx(s34,'(',')',s38);
          MapFlag.nLava := Str_ToInt(s38,-1);
          Continue;
        end;
        if CompareLStr(s34,'GT',length('GT')) then begin
          ArrestStringEx(s34,'(',')',s38);
          MapFlag.nGuildTerritory := Str_ToInt(s38,-1);
          if g_GuildTerritory.FindGuildTerritory(MapFlag.nGuildTerritory) = nil then
            g_GuildTerritory.AddEmptyGT(MapFlag.nGuildTerritory);
          Continue;
        end;
      end;

      if g_MapManager.AddMapInfo(sMapName,sMapDesc,nServerIndex,@MapFlag,QuestNPC) = nil then Result:= -10;
      Result := 1;
{$IFDEF UseTXT}
        end;
      end;

      sData := s34;

      for i:=0 to LoadList.Count -1 do begin
        sLineText:=LoadList.Strings[i];
        if (sLineText <> '') and (sLineText[1] <> '[') and (sLineText[1] <> ';') then begin
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',', #9]);
            sMapName:=sData;
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',', #9]);
            nSMapX:=Str_ToInt(sData,0);
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',', #9]);
            nSMapY:=Str_ToInt(sData,0);
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',','-','>', #9]);
            sDMapNO:=sData;
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',', #9]);
            nDMapX:=Str_ToInt(sData,0);
            sLineText:=GetValidStr3(sLineText,sData,[' ', ',',';', #9]);
            nDMapY:=Str_ToInt(sData,0);
            g_MapManager.AddMapRoute(sMapName,nSMapX,nSMapY,sDMapNO,nDMapX,nDMapY);
        end;
      end;
      LoadList.Free;
   end;
{$ELSE}
      Query.Next;
    end;
  finally
    Query.Close;
  end;

{$ENDIF}
  finally
    LeaveCriticalSection(ProcessHumanCriticalSection);
  end;
  FrmMain.Caption:=sCaption;
  {$IFNDEF UseTXT}
    LoadMapRoute();
  {$ENDIF}
end;

{$IFDEF UseTXT}
function TFrmDB.LoadMinMap():Integer;
var
  sFileName,tStr,sMapNO,sMapIdx:String;
  tMapList:TStringList;
  i,nIdx:Integer;
begin
  Result:=0;
  sFileName:=g_Config.sEnvirDir + 'MiniMap.txt';
  if FileExists(sFileName) then begin
    MiniMapList.Clear;
    tMapList:=TStringList.Create;
    tMapList.LoadFromFile(sFileName);
    for i:=0 to tMapList.Count -1 do begin
      tStr:=tMapList.Strings[i];
      if (tStr <> '') and (tStr[1] <> ';') then begin
        tStr:=GetValidStr3(tStr, sMapNO, [' ', #9]);
        tStr:=GetValidStr3(tStr, sMapIdx, [' ', #9]);
        nIdx:=Str_ToInt(sMapIdx,0);
        if nIdx > 0 then
          MiniMapList.AddObject(sMapNO,TObject(nIdx));
      end;
    end;
    g_MapManager.ReSetMinMap(); //Sergiu
    tMapList.Free;
  end;
end;
{$ELSE}
function TFrmDB.LoadMapRoute():Integer;
var
  i,nSMapX,nSMapY,nDMapX,nDMapY:Integer;
  sSMapNO,sDMapNO:String;
ResourceString
  sSQLString = 'SELECT * FROM TBL_MOVEMAPEVENT';
begin
  Result:= -1;
  EnterCriticalSection(ProcessHumanCriticalSection);
  try
  try
    UseSQL();
    Query.SQL.Clear;
    Query.SQL.Add(sSQLString);
    try
      Query.Open;
    except
      Result:= -2;
    end;
    for i:=0 to Query.RecordCount -1 do begin
      sSMapNO       := Trim(Query.FieldByName('FLD_SMAPFILENAME').AsString);
      nSMapX        := Query.FieldByName('FLD_SX').AsInteger;
      nSMapY        := Query.FieldByName('FLD_SY').AsInteger;
      sDMapNO       := Trim(Query.FieldByName('FLD_DMAPFILENAME').AsString);
      nDMapX        := Query.FieldByName('FLD_DX').AsInteger;
      nDMapY        := Query.FieldByName('FLD_DY').AsInteger;

      g_MapManager.AddMapRoute(sSMapNO,nSMapX,nSMapY,sDMapNO,nDMapX,nDMapY);

      Result := 1;
      Query.Next;
    end;
  finally
    Query.Close;
  end;
  finally
    LeaveCriticalSection(ProcessHumanCriticalSection);
  end;
end;
{$ENDIF}

procedure TFrmDB.QFunctionNPC;
var
  sScriptFile :String;
  sScritpDir  :String;
  SaveList    :TStringList;
  sShowFile   :String;
begin
try
  sScriptFile:=g_Config.sEnvirDir + sMarket_Def + 'QFunction-0.txt';
  sShowFile:=ReplaceChar(sScriptFile,'\','/');
  sScritpDir:=g_Config.sEnvirDir + sMarket_Def;
  if not DirectoryExists(sScritpDir) then
    mkdir(Pchar(sScritpDir));

  if not FileExists(sScriptFile) then begin
    SaveList:=TStringList.Create;
    SaveList.Add(';QFunctions');
    SaveList.SaveToFile(sScriptFile);
    SaveList.Free;
  end;
  if FileExists(sScriptFile) then begin
    g_FunctionNPC:=TMerchant.Create;
    g_FunctionNPC.m_sMapName  := '0';
    g_FunctionNPC.m_nCurrX    := 0;
    g_FunctionNPC.m_nCurrY    := 0;
    g_FunctionNPC.m_sCharName := 'QFunction';
    g_FunctionNPC.m_nFlag     := 0;
    g_FunctionNPC.m_wAppr     := 0;
    g_FunctionNPC.m_sFilePath := sMarket_Def;
    g_FunctionNPC.m_sScript   := 'QFunction';
    g_FunctionNPC.m_boIsHide  := True;
    g_FunctionNPC.m_boIsQuest := False;
    UserEngine.AddMerchant(g_FunctionNPC);
  end else begin
    g_FunctionNPC:=nil;
  end;
except
  g_FunctionNPC:=nil;
end;
end;

procedure TFrmDB.QMangeNPC();
var
  sScriptFile :String;
  sScritpDir  :String;
  SaveList    :TStringList;
  sShowFile   :String;
begin
try
  sScriptFile:=g_Config.sEnvirDir + 'MapQuest_def\' + 'QManage.txt';
  sShowFile:=ReplaceChar(sScriptFile,'\','/');
  sScritpDir:=g_Config.sEnvirDir + 'MapQuest_def\';
  if not DirectoryExists(sScritpDir) then
    mkdir(Pchar(sScritpDir));

  if not FileExists(sScriptFile) then begin
    SaveList:=TStringList.Create;
    SaveList.Add(';QManage');
    SaveList.SaveToFile(sScriptFile);
    SaveList.Free;
  end;
  if FileExists(sScriptFile) then begin
    g_ManageNPC:=TMerchant.Create;
    g_ManageNPC.m_sMapName:='0';
    g_ManageNPC.m_nCurrX:=0;
    g_ManageNPC.m_nCurrY:=0;
    g_ManageNPC.m_sCharName:='QManage';
    g_ManageNPC.m_nFlag:=0;
    g_ManageNPC.m_wAppr:=0;
    g_ManageNPC.m_sFilePath:='MapQuest_def\';
    g_ManageNPC.m_boIsHide:=True;
    g_ManageNPC.m_boIsQuest:=False;
    UserEngine.QuestNPCList.Add(g_ManageNPC);
  end else begin
    g_ManageNPC:=nil;
  end;
except
  g_ManageNPC:=nil;
end;
end;
procedure TFrmDB.RobotNPC();
var
  sScriptFile:String;
  sScritpDir :String;
  tSaveList:TStringList;
begin
try
  sScriptFile:=g_Config.sEnvirDir + 'Robot_def\' + 'RobotManage.txt';
  sScritpDir:=g_Config.sEnvirDir + 'Robot_def\';
  if not DirectoryExists(sScritpDir) then
    mkdir(Pchar(sScritpDir));

  if not FileExists(sScriptFile) then begin
    tSaveList:=TStringList.Create;
    tSaveList.Add(';Robot');
    tSaveList.SaveToFile(sScriptFile);
    tSaveList.Free;
  end;
  if FileExists(sScriptFile) then begin
    g_RobotNPC:=TMerchant.Create;
    g_RobotNPC.m_sMapName:='0';
    g_RobotNPC.m_nCurrX:=0;
    g_RobotNPC.m_nCurrY:=0;
    g_RobotNPC.m_sCharName:='RobotManage';
    g_RobotNPC.m_nFlag:=0;
    g_RobotNPC.m_wAppr:=0;
    g_RobotNPC.m_sFilePath:='Robot_def\';
    g_RobotNPC.m_boIsHide:=True;
    g_RobotNPC.m_boIsQuest:=False;
    UserEngine.QuestNPCList.Add(g_RobotNPC);
  end else begin
    g_RobotNPC:=nil;
  end;
except
  g_RobotNPC:=nil;
end;
end;
//00489414
function TFrmDB.LoadMapQuest(): Integer;
var
  sFileName,tStr:String;
  tMapQuestList:TStringList;
  i:Integer;
  sMap,s1C,s20,sMonName,sItem,sQuest,s30,s34:String;
  n38,n3C:Integer;
  boGrouped:Boolean;
  Map:TEnvirnoment;
begin
    Result:=1;
    sFileName:=g_Config.sEnvirDir + 'MapQuest.txt';
    if FileExists(sFileName) then begin
      tMapQuestList:=TStringList.Create;
      tMapQuestList.LoadFromFile(sFileName);
      for i:=0 to tMapQuestList.Count -1 do begin
        tStr:=tMapQuestList.Strings[i];
        if (tStr <> '') and (tStr[1] <> ';') then begin
          tStr:=GetValidStr3(tStr, sMap, [' ', #9]);
          tStr:=GetValidStr3(tStr, s1C, [' ', #9]);
          tStr:=GetValidStr3(tStr, s20, [' ', #9]);
          tStr:=GetValidStr3(tStr, sMonName, [' ', #9]);
          if (sMonName <> '') and (sMonName[1] = '"') then
            ArrestStringEx(sMonName,'"','"',sMonName);
          tStr:=GetValidStr3(tStr, sItem, [' ', #9]);
          if (sItem <> '') and (sItem[1] = '"') then
            ArrestStringEx(sItem,'"','"',sItem);
          tStr:=GetValidStr3(tStr, sQuest, [' ', #9]);
          tStr:=GetValidStr3(tStr, s30, [' ', #9]);
          if (sMap <> '') and (sMonName <> '') and (sQuest <> '') then begin
            Map:=g_MapManager.FindMap(sMap);
            if Map <> nil then begin
              ArrestStringEx(s1C,'[',']',s34);
              n38:=Str_ToInt(s34,0);
              n3C:=Str_ToInt(s20,0);
              if CompareLStr(s30,'GROUP',length('GROUP')) then boGrouped:=True
              else boGrouped:=False;
              if not Map.CreateQuest(n38,n3C,sMonName,sItem,sQuest,boGrouped) then Result:= -i;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?