夜游神 发表于 2022-12-31 21:03:17

战神引擎重启后取回宝宝脚本

program Mir2;
Const BB_Times = 2; //一小时内允许取宝宝,过了时间只能保存

var
BB_OldTime : Integer;
procedure OnInitialize;
begin
        BB_OldTime := ConvertDateTimeToDB(GetNow);//获取重启时间
end;

procedure _InMonster;//保存宝宝
var
NowTimes,OldTimes : integer;
GetMonNum1, GetMonNum2, GetMonNum3 : integer;//宝宝数量
begin
        if This_Player.Job = 1 then
        begin
                NowTimes := ConvertDateTimeToDB(GetNow);
                OldTimes := BB_OldTime;
                if (NowTimes-OldTimes) > (3600*BB_Times) then
                begin
                        GetMonNum1 := This_Player.GetSlaveCount('虎卫');
                        GetMonNum2 := This_Player.GetSlaveCount('巨型多角虫1');
                        GetMonNum3 := This_Player.GetSlaveCount('魔龙血蛙');
                        IF (GetMonNum1+GetMonNum2+GetMonNum3) > 0 then
                        begin
                                This_Player.SetS(96,11,GetMonNum1);
                                This_Player.SetS(96,12,GetMonNum2);
                                This_Player.SetS(96,13,GetMonNum3);
                                This_Player.NpcDialog(This_Player,
                                '宝宝保存成功!\');
                        end else
                        This_Player.NpcDialog(This_Player,         
                        '能保存的宝宝一个都没有呢!\');
                end else
                This_Player.NpcDialog(This_Player,         
                '重启后的'+IntToStr(BB_Times)+'小时后才保存!\');
        end else
        This_Player.NpcDialog(This_Player,
        '法师才能到我这里保存宝宝!\');
end;

procedure _OutMonster;//取宝宝
var
NowTimes, OldTimes : integer;
GetMonNum1, GetMonNum2, GetMonNum3 : integer;//宝宝数量
begin
        if This_Player.Job = 1 then
        begin
                NowTimes := ConvertDateTimeToDB(GetNow);
                OldTimes := BB_OldTime;
                if (NowTimes-OldTimes) < (3600*BB_Times) then
                begin
                        GetMonNum1 := This_Player.GetS(96,11);
                        GetMonNum2 := This_Player.GetS(96,12);
                        GetMonNum3 := This_Player.GetS(96,13);
                        IF (GetMonNum1+GetMonNum2+GetMonNum3) > 0 then
                        begin
                                This_Player.SetS(96,11,0);
                                This_Player.SetS(96,12,0);
                                This_Player.SetS(96,13,0);
                                IF GetMonNum1 > 0 then This_Player.MakeSlaveEx('虎卫', GetMonNum1 ,0);
                                IF GetMonNum2 > 0 then This_Player.MakeSlaveEx('巨型多角虫1', GetMonNum2 ,0);
                                IF GetMonNum3 > 0 then This_Player.MakeSlaveEx('魔龙血蛙', GetMonNum3 ,0);
                                This_Player.NpcDialog(This_Player,         
                                '宝宝取出成功!\');
                        end else
                        This_Player.NpcDialog(This_Player,         
                        '你的库存中一个宝宝都没有呢!\');
                end else
                This_Player.NpcDialog(This_Player,         
                '重启后的'+IntToStr(BB_Times)+'小时内才能取!\');
        end else
        This_Player.NpcDialog(This_Player,
        '法师才能到我这里取宝宝!\');
end;
procedure domain;
var
NowTimes, OldTimes : integer;
begin
        NowTimes := ConvertDateTimeToDB(GetNow);
        OldTimes := BB_OldTime;
        if (NowTimes-OldTimes) > (3600*BB_Times) then //大于 N 小时
        begin
                This_Npc.NpcDialog(This_Player,
                '法师可以到我这里来保存宝宝,服务器重启的<'+IntToStr(BB_Times)+
                '>小时内可以取出来;超过<'+IntToStr(BB_Times)+
                '>小时后就只能保存宝宝,直到服务器重启时才能取出!|<(保存会覆盖上次的数据)>\' +
                '|当前  <巨型多角虫:>'+ IntToStr(This_Player.GetS(96,11))+
                '|数量  < 魔龙血蛙:>'+ IntToStr(This_Player.GetS(96,12))+
                '|    <   虎卫:>'+ IntToStr(This_Player.GetS(96,13))+
                '|{cmd}<保存身上带着的宝宝/@InMonster>'
                );
        end else
        begin
                This_Npc.NpcDialog(This_Player,
                '法师可以到我这里来保存宝宝,服务器重启的<'+IntToStr(BB_Times)+
                '>小时内可以取出来;超过<'+IntToStr(BB_Times)+
                '>小时后就只能保存宝宝,直到服务器重启时才能取出!|<(保存会覆盖上次的数据)>\' +
                '|当前  <巨型多角虫:>'+ IntToStr(This_Player.GetS(96,11))+
                '|数量  < 魔龙血蛙:>'+ IntToStr(This_Player.GetS(96,12))+
                '|    <   虎卫:>'+ IntToStr(This_Player.GetS(96,13))+
                '|{cmd}<取出保存的宝宝/@OutMonster>'
                );
        end;
end;

begin
        IF This_Player.GetS(96,11) < 0 then This_Player.SetS(96,11,0);
        IF This_Player.GetS(96,12) < 0 then This_Player.SetS(96,12,0);
        IF This_Player.GetS(96,13) < 0 then This_Player.SetS(96,13,0);
        domain;
end.

Chinese.Doll 发表于 2023-12-28 08:08:14

积分任务
页: [1]
查看完整版本: 战神引擎重启后取回宝宝脚本