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

📄 game_master.pas

📁 RO模拟器!!适合玩仙境传说的玩家们呦~
💻 PAS
📖 第 1 页 / 共 5 页
字号:
                Result := 'GM_KILL Failure. ' + s + ' is not logged in.';
            end;
        end else begin
            Result := 'GM_KILL Failure. ' + s + ' is an invalid character name.';
        end;
    end;

    function command_goto(tc : TChara; str : String) : String;
    var
        s : String;
        tc1 : TChara;
    begin
        Result := 'GM_GOTO Success.';

        s := Copy(str, 6, 256);
        if CharaName.Indexof(s) <> -1 then begin
            tc1 := CharaName.Objects[CharaName.Indexof(s)] as TChara;
            if (tc.Hidden = false) then SendCLeave(tc, 2);
            tc.tmpMap := tc1.Map;
            tc.Point := tc1.Point;
            MapMove(tc.Socket, tc1.Map, tc1.Point);

            Result := 'GM_GOTO Success. ' + tc.Name + ' warped to ' + s + '.';
        end else begin
            Result := 'GM_GOTO Failure. ' + s + ' is an invalid character name.';
        end;
    end;

    function command_summon(tc : TChara; str : String) : String;
    var
        s : String;
        tc1 : TChara;
    begin
        Result := 'GM_SUMMON Success.';

        s := Copy(str, 8, 256);
        if CharaName.Indexof(s) <> -1 then begin
            Result := 'GM_SUMMON Success. ' + s + ' warped to ' + tc.Name + '.';
            tc1 := CharaName.Objects[CharaName.Indexof(s)] as TChara;

            if (tc1.Login = 2) then begin
                SendCLeave(tc1, 2);
                tc1.Map := tc.Map;
                tc1.Point := tc.Point;
                MapMove(tc1.Socket, tc.Map, tc.Point);
            end else begin
                tc1.Map := tc.Map;
                tc1.Point := tc.Point;

                Result := Result + ' But ' + s + ' is offline.';
            end;

        end else begin
            Result := 'GM_SUMMON Failure. ' + s + ' is an invalid character name.';
        end;
    end;

    function command_warp(tc : TChara; str : String) : String;
    var
        sl : TStringList;
        i, j, k : Integer;
        ta : TMapList;
    begin
        Result := 'GM_WARP Failure.';

        sl := TStringList.Create;
        sl.DelimitedText := Copy(str, 6, 256);

        if sl.Count <> 3 then Exit;
        Val(sl.Strings[1], i, k);

        if k <> 0 then Exit;
        Val(sl.Strings[2], j, k);

        if k <> 0 then Exit;
        if MapList.IndexOf(LowerCase(sl.Strings[0])) = -1 then Exit;

        ta := MapList.Objects[MapList.IndexOf(LowerCase(sl.Strings[0]))] as TMapList;
        if (i < 0) or (i >= ta.Size.X) or (j < 0) or (j >= ta.Size.Y) then Exit;

        if (tc.Hidden = false) then SendCLeave(tc, 2);
        tc.tmpMap := LowerCase(sl.Strings[0]);
        tc.Point := Point(i,j);
        MapMove(tc.Socket, LowerCase(sl.Strings[0]), Point(i,j));

        Result := 'GM_WARP Success. Warp to ' + tc.tmpMap + ' (' + IntToStr(i) + ',' + IntToStr(j) + ').';
        sl.Free;
    end;

    function command_banish(str : String) : String;
    var
        sl : TStringList;
        i, j, k : Integer;
        ta : TMapList;
        tc1 : TChara;
        s : String;
    begin
        Result := 'GM_BANISH Failure.';

        sl := TStringList.Create;
        sl.DelimitedText := Copy(str, 8, 256);

        if (sl.Count <> 4) then begin
            Result := Result + ' Missing information.';
            Exit;
        end;

        Val(sl[sl.Count - 2], i, k);
        if k <> 0 then Exit;

        Val(sl[sl.Count - 1], j, k);
        if k <> 0 then Exit;

        if MapList.IndexOf(sl.Strings[sl.Count - 3]) <> -1 then begin
            ta := MapList.Objects[MapList.IndexOf(sl.Strings[sl.Count - 3])] as TMapList;
            if (i < 0) or (i >= ta.Size.X) or (j < 0) or (j >= ta.Size.Y) then Exit;

            for k := 0 to sl.Count - 4 do begin
                s := s + ' ' + sl.Strings[k];
                s := Trim(s);
            end;

            if CharaName.Indexof(s) <> -1 then begin
                tc1 := CharaName.Objects[CharaName.Indexof(s)] as TChara;
                Result := 'GM_BANISH Success. ' + s + ' warped to ' + ta.Name + ' (' + IntToStr(i) + ', ' + IntToStr(j) + ').';

                if (tc1.Login = 2) then begin
                    SendCLeave(tc1, 2);
                    tc1.tmpMap := sl.Strings[sl.Count - 3];
                    tc1.Point := Point(i,j);
                    MapMove(tc1.Socket, tc1.tmpMap, tc1.Point);
                end else begin
                    tc1.Map := sl.Strings[sl.Count - 3];
                    tc1.Point := Point(i,j);
                    Result := Result + ' ' + s + ' is offline.';
                end;
            end else begin
                Result := Result + ' ' + s + ' is an invalid character name.';
            end;
        end else begin
            Result := 'GM_BANISH Failure. ' + sl.Strings[sl.Count - 3] + ' is not a valid map name.';
        end;

        sl.Free;
    end;

    function command_job(tc : TChara; str : String) : String;
    var
        i, j, k : Integer;
        tm : TMap;
    begin
        Result := 'GM_JOB Failure.';

        if (tc.JID <> 0) or ((DebugCMD and $0020) <> 0) then begin
            Val(Copy(str, 5, 256), i, k);
            if (k = 0) and (i >= 0) and (i <= MAX_JOB_NUMBER) and (i <> 13) then begin
                tm := Map.Objects[Map.IndexOf(tc.Map)] as TMap;

                // Colus, 20040203: Added unequip of items when you #job
                for  j := 1 to 100 do begin
                    if tc.Item[j].Equip = 32768 then begin
                        tc.Item[j].Equip := 0;
                        WFIFOW(0, $013c);
                        WFIFOW(2, 0);
                        tc.Socket.SendBuf(buf, 4);
                    end else if tc.Item[j].Equip <> 0 then begin
                    	reset_skill_effects(tc);
                        WFIFOW(0, $00ac);
                        WFIFOW(2, j);
                        WFIFOW(4, tc.Item[j].Equip);
                        tc.Item[j].Equip := 0;
                        WFIFOB(6, 1);
                        tc.Socket.SendBuf(buf, 7);
                        remove_equipcard_skills(tc, j);
                    end;
                end;

                // Darkhelmet, 20040212: Added to remove all ticks when changing jobs.
                for j := 1 to MAX_SKILL_NUMBER do begin
                    if tc.Skill[j].Data.Icon <> 0 then begin
                        if tc.Skill[j].Tick >= timeGetTime() then begin
                            UpdateIcon(tm, tc, tc.Skill[j].Data.Icon, 0);
                        end;
                    end;
                    tc.Skill[j].Tick := timeGetTime();
                    tc.Skill[j].Effect1 := 0;
                end;

                if (i > LOWER_JOB_END) then begin
                    i := i - LOWER_JOB_END + UPPER_JOB_BEGIN; // 24 - 23 + 4000 = 4001, remort novice
                    tc.ClothesColor := 1; // This is the default clothes palette color for upper classes
                end else begin
                    tc.ClothesColor := 0;
                end;

                tc.JID := i;

                if (tc.Option <> 0) then begin
                    tc.Option := 0;
                    WFIFOW(0, $0119);
                    WFIFOL(2, tc.ID);
                    WFIFOW(6, 0);
                    WFIFOW(8, 0);
                    WFIFOW(10, tc.Option);
                    WFIFOB(12, 0);
                    SendBCmd(tc.MData, tc.Point, 13);
                end;

                CalcStat(tc);
                SendCStat(tc, true); // Add the true to recalc sprites
                SendCSkillList(tc);

                // Colus, 20040303: Using newer packet to allow upper job changes
                UpdateLook(tm, tc, 0, i);

                Result := 'GM_JOB Success. New Job ID is ' + IntToStr(i) + '.';
            end else begin
                Result := Result + ' Job ID is out of range.';
            end;
        end;
    end;

    function command_blevel(tc : TChara; str : String) : String;
    var
        i, k, w3 : Integer;
        oldlevel : Integer;
    begin
        Result := 'GM_BLEVEL Failure.';

        oldlevel := tc.BaseLV;
        Val(Copy(str, 8, 256), i, k);

        if (k = 0) and (i >= 1) and (i <= 32767) and (i <> tc.BaseLV) then begin
            if tc.BaseLV > i then begin
                tc.BaseLV := i;

                for i := 0 to 5 do begin
                    tc.ParamBase[i] := 1;
                end;

                tc.StatusPoint := 48;

                for i := 1 to tc.BaseLV - 1 do begin
                    tc.StatusPoint := tc.StatusPoint + i div 5 + 3;
                end;
            end

            else begin
                w3 := tc.BaseLV;
                tc.BaseLV := i;

                for i := w3 to tc.BaseLV - 1 do begin
                    tc.StatusPoint := tc.StatusPoint + i div 5 + 3;
                end;
            end;

            if (tc.BaseNextEXP = 0) then tc.BaseNextEXP := 999999999;
            tc.BaseEXP := tc.BaseNextEXP - 1;
            tc.BaseNextEXP := ExpTable[0][tc.BaseLV];

            CalcStat(tc);
            SendCStat(tc);
            SendCStat1(tc, 0, $000b, tc.BaseLV);
            SendCStat1(tc, 0, $0009, tc.StatusPoint);
            SendCStat1(tc, 1, $0001, tc.BaseEXP);

            Result := 'GM_BLEVEL Success. level changed from ' + IntToStr(oldlevel) + ' to ' + IntToStr(tc.BaseLV) + '.';
        end else begin
            Result := Result + ' Incomplete information or level out of range.';
        end;
    end;

    function command_jlevel(tc : TChara; str : String) : String;
    var
        i, j, k : Integer;
        oldlevel : Integer;
    begin
        Result := 'GM_JLEVEL Failure.';

⌨️ 快捷键说明

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