⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localdb.pas

📁 乐都SQL版传奇全套代码,绝对可编译
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    end;
    QDDinfoList.Free;
  end;
  QuestDiaryList.Clear;
  bo2D := False;
  nC := 1;
  while (True) do
  begin
    QDDinfoList := nil;
    s14 := 'QuestDiary\' + sub_48978C(nC) + '.txt';
    if FileExists(s14) then
    begin
      s18 := '';
      QDDinfo := nil;
      LoadList := TStringList.Create;
      try
        LoadList.LoadFromFile(s14);
        for i := 0 to LoadList.Count - 1 do
        begin
          s1C := LoadList.Strings[i];
          if (s1C <> '') and (s1C[1] <> ';') then
          begin
            if (s1C[1] = '[') and (length(s1C) > 2) then
            begin
              if s18 = '' then
              begin
                ArrestStringEx(s1C, '[', ']', s18);
                QDDinfoList := TMyList.create;
                New(QDDinfo);
                QDDinfo.n00 := nC;
                QDDinfo.s04 := s18;
                QDDinfo.sList := TStringList.Create;
                QDDinfoList.Add(QDDinfo);
                bo2D := True;
              end
              else
              begin
                if s1C[1] <> '@' then
                begin
                  s1C := GetValidStr3(s1C, s20, [' ', #9]);
                  ArrestStringEx(s20, '[', ']', s20);
                  New(QDDinfo);
                  QDDinfo.n00 := Str_ToInt(s20, 0);
                  QDDinfo.s04 := s1C;
                  QDDinfo.sList := TStringList.Create;
                  QDDinfoList.Add(QDDinfo);
                  bo2D := True;
                end
                else
                  bo2D := False;
              end;
            end
            else
            begin                                             //00489AFD
              if bo2D then
                QDDinfo.sList.Add(s1C);
            end;
          end;                                                //00489B11
        end;
      finally
        LoadList.Free;
      End;
    end;                                                    //00489B25
    if QDDinfoList <> nil then
      QuestDiaryList.Add(QDDinfoList)
    else
      QuestDiaryList.Add(nil);
    Inc(nC);
    if nC >= 105 then
      break;
  end;

end;
//00488EF0

function TFrmDB.LoadStartPoint(): Integer;
var
  sFileName, tStr, s18, s1C, s20        : string;
  LoadList                              : TStringList;
  i                                     : Integer;
begin
  Result := 0;
  sFileName := g_Config.sEnvirDir + 'StartPoint.txt';
  if FileExists(sFileName) then
  begin
    try
      g_StartPointList.Lock;
      g_StartPointList.Clear;
      LoadList := TStringList.Create;
      try
        LoadList.LoadFromFile(sFileName);
        for i := 0 to LoadList.Count - 1 do
        begin
          tStr := Trim(LoadList.Strings[i]);
          if (tStr <> '') and (tStr[1] <> ';') then
          begin
            tStr := GetValidStr3(tStr, s18, [' ', #9]);
            tStr := GetValidStr3(tStr, s1C, [' ', #9]);
            tStr := GetValidStr3(tStr, s20, [' ', #9]);
            if (s18 <> '') and (s1C <> '') and (s20 <> '') then
            begin
              g_StartPointList.AddObject(s18, TObject(MakeLong(Str_ToInt(s1C, 0),
                Str_ToInt(s20, 0))));
              Result := 1;
            end;
          end;
        end;
      finally
        LoadList.Free;
      End;
    finally
      g_StartPointList.UnLock;
    end;
  end;
end;
//00489240

function TFrmDB.LoadUnbindList(): Integer;
var
  sFileName, tStr, sData, s20           : string;
  tUnbind                               : pTUnbindInfo;
  LoadList                              : TStringList;
  i                                     : Integer;
  n10                                   : Integer;
begin
  Result := 0;
  sFileName := g_Config.sEnvirDir + 'UnbindList.txt';
  if FileExists(sFileName) then
  begin
    LoadList := TStringList.Create;
    Try
      LoadList.LoadFromFile(sFileName);
      for i := 0 to LoadList.Count - 1 do
      begin
        tStr := LoadList.Strings[i];
        if (tStr <> '') and (tStr[1] <> ';') then
        begin
          //New(tUnbind);
          tStr := GetValidStr3(tStr, sData, [' ', #9]);
          tStr := GetValidStrCap(tStr, s20, [' ', #9]);
          if (s20 <> '') and (s20[1] = '"') then
            ArrestStringEx(s20, '"', '"', s20);

          n10 := Str_ToInt(sData, 0);
          if n10 > 0 then
            g_UnbindList.AddObject(s20, TObject(n10))
          else
          begin
            Result := -i;                                     //需要取负数
            break;
          end;
        end;
      end;
    finally
     LoadList.Free;
    End;
  end;
end;

function TFrmDB.LoadNpcScript(NPC: TNormNpc; sPatch,
  sScritpName: string): Integer;                            //0048C4D8
begin
  if sPatch = '' then
    sPatch := sNpc_def;
  Result := LoadScriptFile(NPC, sPatch, sScritpName, False);
end;

function TFrmDB.LoadScriptFile(NPC: TNormNpc; sPatch, sScritpName: string;
  boFlag: Boolean): Integer;                                //0048B684
var
  nQuestIdx, i, n1C, n20, n24, nItemType, nPriceRate: Integer;
  n6C, n70                              : Integer;
  sScritpFileName, s30, s34, s38, s3C, s40, s44, s48, s4C, s50: string;
  LoadList                              : TStringList;
  DefineList                            : TMyList;
  s54, s58, s5C, s74                    : string;
  DefineInfo                            : pTDefineInfo;
  bo8D                                  : Boolean;
  Script                                : pTScript;
  SayingRecord                          : pTSayingRecord;
  SayingProcedure                       : pTSayingProcedure;
  QuestConditionInfo                    : pTQuestConditionInfo;
  QuestActionInfo                       : pTQuestActionInfo;
  Goods                                 : pTGoods;

  function LoadCallScript(sFileName, sLabel: string; List: TStringList):
      Boolean;
    //00489BD4
  var
    i                                   : Integer;
    LoadStrList                         : TStringList;
    bo1D                                : Boolean;
    s18                                 : string;
  begin
    Result := False;
    if FileExists(sFileName) then
    begin
      LoadStrList := TStringList.Create;
      try
        LoadStrList.LoadFromFile(sFileName);
        DeCodeStringList(LoadStrList);
        sLabel := '[' + sLabel + ']';
        bo1D := False;
        for i := 0 to LoadStrList.Count - 1 do
        begin
          s18 := Trim(LoadStrList.Strings[i]);
          if s18 <> '' then
          begin
            if not bo1D then
            begin
              if (s18[1] = '[') and (CompareText(s18, sLabel) = 0) then
              begin
                bo1D := True;
                List.Add(s18);
              end;
            end
            else
            begin                                             //00489CBF
              if s18[1] <> '{' then
              begin
                if s18[1] = '}' then
                begin
                  bo1D := False;
                  Result := True;
                  break;
                end
                else
                begin                                         //00489CD9
                  List.Add(s18);
                end;
              end;
            end;
          end; //00489CE4 if s18 <> '' then begin
        end; // for I := 0 to LoadStrList.Count - 1 do begin
      finally
       LoadStrList.Free;
      End;
    end
    else
      MainOutMessage('文件不存在: ' + sFileName);

  end;

 function LoadScriptcall(LoadList: TStringList):Boolean; //0048B138
  var
    i               : Integer;
    s14, s18, s1C, s20, s34: string;
  begin
    Result:=True;
    for i := 0 to LoadList.Count - 1 do
    begin
      s14 := Trim(LoadList.Strings[i]);

      if (s14 <> '') and (s14[1] = '#') and (CompareLStr(s14, '#CALL',
        Length('#CALL'))) then
      begin
        s14 := ArrestStringEx(s14, '[', ']', s1C);
        s20 := Trim(s1C);
        s18 := Trim(s14);
        Result:=False;
        s34 := g_Config.sEnvirDir + 'QuestDiary\' + s20;
        if LoadCallScript(s34, s18, LoadList) then
        begin
          LoadList.Strings[i] := '#ACT';
          LoadList.Insert(i + 1, 'goto ' + s18);
        end
        else
        begin
          MainOutMessage('script error, load fail: ' + s20 + s18);
        end;
      end;
    end;
  end;

  function LoadDefineInfo(LoadList: TStringList; List: TMyList): string; //0048B35C
  var
    i                                   : Integer;
    s14, s28, s1C, s20, s24             : string;
    DefineInfo                          : pTDefineInfo;
    LoadStrList                         : TStringList;
  begin
    for i := 0 to LoadList.Count - 1 do
    begin
      s14 := Trim(LoadList.Strings[i]);
      if (s14 <> '') and (s14[1] = '#') then
      begin
        if CompareLStr(s14, '#SETHOME', length('#SETHOME')) then
        begin
          Result := Trim(GetValidStr3(s14, s1C, [' ', #9]));
          LoadList.Strings[i] := '';
        end;
        if CompareLStr(s14, '#DEFINE', length('#DEFINE')) then
        begin
          s14 := (GetValidStr3(s14, s1C, [' ', #9]));
          s14 := (GetValidStr3(s14, s20, [' ', #9]));
          s14 := (GetValidStr3(s14, s24, [' ', #9]));
          New(DefineInfo);
          DefineInfo.sName := UpperCase(s20);
          DefineInfo.sText := s24;
          List.Add(DefineInfo);
          LoadList.Strings[i] := '';
        end;                                                //0048B505
        if CompareLStr(s14, '#INCLUDE', length('#INCLUDE')) then
        begin
          s28 := Trim(GetValidStr3(s14, s1C, [' ', #9]));
          s28 := g_Config.sEnvirDir + 'Defines\' + s28;
          if FileExists(s28) then
          begin
            LoadStrList := TStringList.Create;
            try
              LoadStrList.LoadFromFile(s28);
              Result := LoadDefineInfo(LoadStrList, List);
            finally
              LoadStrList.Free;
            End;
          end
          else
          begin
            MainOutMessage('script error, load fail: ' + s28);
          end;
          LoadList.Strings[i] := '';
        end;
      end;
    end;
  end;

  function MakeNewScript(): pTScript;                       //00489D74
  var
    ScriptInfo                          : pTScript;
  begin
    New(ScriptInfo);
    ScriptInfo.boQuest := False;
    FillChar(ScriptInfo.QuestInfo, SizeOf(TQuestInfo) * 10, #0);
    nQuestIdx := 0;
    ScriptInfo.RecordList := TMyList.create;
    NPC.m_ScriptList.Add(ScriptInfo);
    Result := ScriptInfo;
  end;

  function QuestCondition(sText: string; QuestConditionInfo:
    pTQuestConditionInfo): Boolean;                         //00489DDC
  var
    sCmd, sParam1, sParam2, sParam3, sParam4, sParam5, sParam6: string;
    nCMDCode                            : Integer;
  label
    L001;
  begin
    Result := False;
    sText := GetValidStrCap(sText, sCmd, [' ', #9]);
    sText := GetValidStrCap(sText, sParam1, [' ', #9]);
    sText := GetValidStrCap(sText, sParam2, [' ', #9]);
    sText := GetValidStrCap(sText, sParam3, [' ', #9]);
    sText := GetValidStrCap(sText, sParam4, [' ', #9]);
    sText := GetValidStrCap(sText, sParam5, [' ', #9]);
    sText := GetValidStrCap(sText, sParam6, [' ', #9]);
    sCmd := UpperCase(sCmd);
    nCMDCode := 0;
    if sCmd = sCHECK then
    begin
      nCMDCode := nCHECK;
      ArrestStringEx(sParam1, '[', ']', sParam1);
      if not IsStringNumber(sParam1) then
        nCMDCode := 0;
      if not IsStringNumber(sParam2) then
        nCMDCode := 0;
      goto L001;
    end;
    if sCmd = sCHECKOPEN then
    begin
      nCMDCode := nCHECKOPEN;
      ArrestStringEx(sParam1, '[', ']', sParam1);
      if not IsStringNumber(sParam1) then
        nCMDCode := 0;
      if not IsStringNumber(sParam2) then
  

⌨️ 快捷键说明

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