您好!!!欢迎您的到来!!!

宝宝守护脚本分享


   为了能让烈焰私服更好的发展,下面我就把宝宝守护脚本分享出来!!


local shztbl,shhtsjbl,shexpbl,shitems1,shitems2,shitems3,shitems2exp,shitems3exp=392,393,394,10096,10097,10098,10000,100000; --守护状态、护体时间、守护等级、守护经验、守护召唤令、守护经验丹、守护经验丹(大)、经验丹所加经验、经验丹(大)所加经验
--shztbl 守护状态变量:0未出征、1召唤、2护体
local npcid=1027; --NPC的ID
local shname={ --守护名称
{"<font color='#1E90FF'>一星守护【战】","<font color='#CD8500'>二星守护【战】","<font color='#CD0000'>三星守护【战】","<font color='#76EE00'>四星守护【战】","<font color='#551A8B'>五星守护【战】","<font color='#CD00CD'>六星守护【战】","</font>"},
{"<font color='#1E90FF'>一星守护【法】","<font color='#CD8500'>二星守护【法】","<font color='#CD0000'>三星守护【法】","<font color='#76EE00'>四星守护【法】","<font color='#551A8B'>五星守护【法】","<font color='#CD00CD'>六星守护【法】","</font>"},
{"<font color='#1E90FF'>一星守护【道】","<font color='#CD8500'>二星守护【道】","<font color='#CD0000'>三星守护【道】","<font color='#76EE00'>四星守护【道】","<font color='#551A8B'>五星守护【道】","<font color='#CD00CD'>六星守护【道】","</font>"},
};
local shmon={ --守护宠物ID
{9201,9202,9203,9204,9205,9206},
{9301,9302,9303,9304,9305,9306},
{9401,9402,9403,9404,9405,9406},
};
local shmonwg={ --守护宠物外观ID
{5121,5127,5132,5133,5138,5139},
{5123,5129,5134,5135,5140,5141},
{5125,5131,5136,5137,5142,5143},
};
local shbuff={ --守护BUFF-ID
{3101,3102,3103,3104,3105,3106},
{3201,3202,3203,3204,3205,3206},
{3301,3302,3303,3304,3305,3306},
};
local shexp={ --守护升级经验  单位 万
[0]=0;
[1]=5;
[2]=100;
[3]=800;
[4]=2000;
[5]=6000;
[6]=15000;
[7]=600000000;
};
local shsx={ --守护属性
{
{15000,30000,45000,60000,80000,100000}, --战-攻击1-6星 9201-9206
{3000,4000,5000,6000,8000,10000},    --战-防御1-6星
{30,45,60,75,90,105},                --战-血量1-6星
},
{
{15000,30000,45000,60000,80000,100000}, --法-攻击1-6星 9301-9306
{3000,4000,5000,6000,8000,10000},    --法-防御1-6星
{30,45,60,75,90,105},                --法-血量1-6星
},
{
{15000,30000,45000,60000,80000,100000}, --道-攻击1-6星 9401-9406
{3000,4000,5000,6000,8000,10000},       --道-防御1-6星
{30,45,60,75,90,105},                --道-血量1-6星
},
};
local shht={ --护体属性
{
{2000,4000,7000,12000,18000,30000}, --战-攻击1-6星
{1,2,3,4,6,10},                    --战-增伤1-6星 %百分比
{10,20,30,40,50,100},            --战-血量1-6星 %百分比
},
{
{2000,4000,7000,12000,18000,30000}, --法-攻击1-6星
{1,2,3,4,6,10},                    --法-增伤1-6星 %百分比
{10,20,30,40,50,100},            --法-血量1-6星 %百分比
},
{
{2000,4000,7000,12000,18000,30000}, --道-攻击1-6星
{1,2,3,4,6,10},                    --道-增伤1-6星 %百分比
{10,20,30,40,50,100},            --道-血量1-6星 %百分比
},
};
function cklevel(exp)
local level=0;
if exp==0 then
level=0;
elseif exp>=shexp[1] and exp<shexp[2] then
level=1;
elseif exp>=shexp[2] and exp<shexp[3] then
level=2;
elseif exp>=shexp[3] and exp<shexp[4] then
level=3;
elseif exp>=shexp[4] and exp<shexp[5] then
level=4;
elseif exp>=shexp[5] and exp<shexp[6] then
level=5;
elseif exp>=shexp[6] then
level=6;
end
return level;
end
function ontalk3013(npc,event,player)
player:echo(0,npc:GetLowGUID(),[[
 
#&talk_line#&
  <font color='#00F5FF'> 说明:120之前可以免费使用新手守护  </font>
        <font color='#00F5FF'> 下线死亡消失请重新召唤守护  </font>
        <font color='#00F5FF'> 守护经验丹可通BOSS爆出或者商城  </font>
<font color='#00F5FF'> 护体以后重新召唤守护不扣元宝  </font>
 
#&talk_line#&
   <u><a href='event:M2409,26,5'><font color='#CD00CD'>【新手守护】(免费)</font></a></u>
 
#&talk_line#&
<u><a href='event:M2402,1'><font color='#C71585'>【守护晋级】</font></a></u> <u><a href='event:M2402,2'><font color='#C71585'>【守护属性】</font></a></u>
 
#&talk_line#&
<u><a href='event:M2409,26,3'><font color='#C71585'>【守护召唤】</font></a></u> <u><a href='event:M2409,26,4'><font color='#C71585'>【守护护体】</font></a></u>
#&talk_line#&
 
]]);
end
function ontalk3013_1(npc,event,player)
local dj=cklevel(player:get_param(shexpbl)/10000);
local name=shname[player:get_job()][dj];
if name == nil then
name = "无守护"
end
if dj < 6 then
player:echo(0,npc:GetLowGUID(),[[
 
 
#&talk_line#&
#&talk_line#&
 <b><font color='#CDCD00'>您当前:</font>]]..name..[[   当前经验:]]..player:get_param(shexpbl)..[[</b>
#&talk_line#&
下一星守护属性    下一星护体属性
#&talk_line#&
攻击:]]..shsx[player:get_job()][1][dj+1]..[[ 攻击:]]..shht[player:get_job()][1][dj+1]..[[ 
防御:]]..shsx[player:get_job()][2][dj+1]..[[ 增伤:]]..shht[player:get_job()][2][dj+1]..[[%
 血量(万):]]..shsx[player:get_job()][3][dj+1]..[[   血量%:]]..shht[player:get_job()][3][dj+1]..[[%
#&talk_line#&
晋级要求:经验]]..shexp[dj+1]..[[W
]]);
else
player:echo(0,npc:GetLowGUID(),[[
 
 
#&talk_line#&
#&talk_line#&
 <b>您当前:]]..name..[[   当前经验:]]..player:get_param(shexpbl)..[[</b>
#&talk_line#&
下一星守护属性    下一星护体属性
#&talk_line#&
攻击:]]..shsx[player:get_job()][1][dj]..[[ 攻击:]]..shht[player:get_job()][1][dj]..[[ 
防御:]]..shsx[player:get_job()][2][dj]..[[ 增伤:]]..shht[player:get_job()][2][dj]..[[%
血量(万):]]..shsx[player:get_job()][3][dj]..[[       血量%:]]..shht[player:get_job()][3][dj]..[[%
#&talk_line#&
晋级要求:已满级
]]);
end
player:echo(0,npc:GetLowGUID(),[[
#&talk_line#&
<u>【注:使用经验丹时可自动提升星级】</u>
#&talk_line#&
    <u><a href='event:M2402,0'>【返回首页】</a></u>
#&talk_line#&
#&talk_line#&
]]);
end
function ontalk3013_2(npc,event,player)
player:echo(0,npc:GetLowGUID(),[[
#&talk_line#&
#&talk_line#&
<b><font color='#00F5FF'>守护属性:</font></b>
<font color='#00F5FF'>一星  二星  三星  四星  五星  六星</font>
<font color='#00F5FF'>  攻击:  ]]..shsx[player:get_job()][1][1]..[[ ]]..shsx[player:get_job()][1][2]..[[ ]]..shsx[player:get_job()][1][3]..[[ ]]..shsx[player:get_job()][1][4]..[[ ]]..shsx[player:get_job()][1][5]..[[ ]]..shsx[player:get_job()][1][6]..[[ 
防御:  ]]..shsx[player:get_job()][2][1]..[[ ]]..shsx[player:get_job()][2][2]..[[ ]]..shsx[player:get_job()][2][3]..[[ ]]..shsx[player:get_job()][2][4]..[[ ]]..shsx[player:get_job()][2][5]..[[ ]]..shsx[player:get_job()][2][6]..[[ 
血量(万):  ]]..shsx[player:get_job()][3][1]..[[ ]]..shsx[player:get_job()][3][2]..[[ ]]..shsx[player:get_job()][3][3]..[[ ]]..shsx[player:get_job()][3][4]..[[ ]]..shsx[player:get_job()][3][5]..[[ ]]..shsx[player:get_job()][3][6]..[[ </font>
 
#&talk_line#&
 
<b><font color='#00F5FF'>护体属性:</font></b></b>
<font color='#00F5FF'>一星  二星  三星  四星  五星  六星</font></b>
<font color='#00F5FF'> 攻击:  ]]..shht[player:get_job()][1][1]..[[ ]]..shht[player:get_job()][1][2]..[[ ]]..shht[player:get_job()][1][3]..[[ ]]..shht[player:get_job()][1][4]..[[ ]]..shht[player:get_job()][1][5]..[[ ]]..shht[player:get_job()][1][6]..[[ 
增伤%:  ]]..shht[player:get_job()][2][1]..[[ ]]..shht[player:get_job()][2][2]..[[ ]]..shht[player:get_job()][2][3]..[[ ]]..shht[player:get_job()][2][4]..[[ ]]..shht[player:get_job()][2][5]..[[ ]]..shht[player:get_job()][2][6]..[[ 
血量%:  ]]..shht[player:get_job()][3][1]..[[ ]]..shht[player:get_job()][3][2]..[[ ]]..shht[player:get_job()][3][3]..[[ ]]..shht[player:get_job()][3][4]..[[ ]]..shht[player:get_job()][3][5]..[[ ]]..shht[player:get_job()][3][6]..[[ </font>
 
#&talk_line#&
#&talk_line#&
    <u><a href='event:M2402,0'>【返回首页】</a></u>
#&talk_line#&
]]);
end
 
function shjyd(item,event,player)
local dj1=cklevel(player:get_param(shexpbl)/10000);
if dj1 < 6 then
player:set_param(shexpbl,player:get_param(shexpbl)+shitems2exp)
player:alert(10,0,0,"守护经验 +"..shitems2exp.."");
local dj2=cklevel(player:get_param(shexpbl)/10000);
if dj2 > dj1 then
if player:get_param(shztbl) == 1 then
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
end
player:gen_slave(shmon[player:get_job()][dj2],shmonwg[player:get_job()][dj2],""..shname[player:get_job()][dj2].."<br>"..player:GetName().."",1);
elseif player:get_param(shztbl) == 2 then
player:set_status(shbuff[player:get_job()][dj2],0,100,5);
end
player:alert(10,0,0,"恭喜守护晋级!");
end
return 0;
else
player:alert(10,0,0,"您的守护星级已满!");
return 1;
end
end
function shjydd(item,event,player)
local dj1=cklevel(player:get_param(shexpbl)/10000);
if dj1 < 6 then
player:set_param(shexpbl,player:get_param(shexpbl)+shitems3exp)
player:alert(10,0,0,"守护经验 +"..shitems3exp.."");
local dj2=cklevel(player:get_param(shexpbl)/10000);
if dj2 > dj1 then
if player:get_param(shztbl) == 1 then
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
end
player:gen_slave(shmon[player:get_job()][dj2],shmonwg[player:get_job()][dj2],""..shname[player:get_job()][dj2].."<br>"..player:GetName().."",1);
elseif player:get_param(shztbl) == 2 then
player:set_status(shbuff[player:get_job()][dj2],0,100,5);
end
player:alert(10,0,0,"恭喜守护晋级!");
end
return 0;
else
player:alert(10,0,0,"您的守护星级已满!");
return 1;
end
end
function panel_26_3(player)
local dj=cklevel(player:get_param(shexpbl)/10000);
if dj >= 1 then
if player:get_param(shztbl) == 0 then
if player:get_vcoin() >= 100000 then
player:gen_clear(5315);
player:gen_clear(5316);
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
player:del_status(shbuff[player:get_job()][i]);
end
player:sub_vcoin(100000);
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:set_param(shztbl,1)
player:alert(10,0,0,"守护召唤成功!");
else
player:alert(10,0,0,"您没有10W元宝,召唤失败!");
end
elseif player:get_param(shztbl) == 1 then
-- player:alert(10,0,0,"守护已经过了!");
if player:get_vcoin() >= 100000 then
player:gen_clear(5315);
player:gen_clear(5316);
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
player:del_status(shbuff[player:get_job()][i]);
end
player:sub_vcoin(100000);
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:set_param(shztbl,1)
player:alert(10,0,0,"守护召唤成功!");
else
player:alert(10,0,0,"您没有10W元宝,召唤失败!");
end
elseif player:get_param(shztbl) == 2 then
player:gen_clear(5315);
player:gen_clear(5316);
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
player:del_status(shbuff[player:get_job()][i]);
end
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:set_param(shztbl,1)
player:alert(10,0,0,"守护召唤成功!");
end
else
player:alert(10,0,0,"无守护!");
end
end
function panel_26_4(player)
if player:get_vcoin() >= 100000 then
local dj=cklevel(player:get_param(shexpbl)/10000);
if dj >= 1 then
if player:get_param(shztbl) == 0 then
player:alert(10,0,0,"请先召唤守护再护体!");
elseif player:get_param(shztbl) == 1 then
player:sub_vcoin(100000);
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
player:del_status(shbuff[player:get_job()][i]);
end
player:set_status(shbuff[player:get_job()][dj],0,100,5);
player:set_param(shztbl,2)
player:set_param(shhtsjbl,3600);
player:set_timer(8,10);
player:alert(10,0,0,"守护护体成功!");
elseif player:get_param(shztbl) == 2 then
player:alert(10,0,0,"守护已经护体过了!");
end
else
player:alert(10,0,0,"无守护!");
end
else
player:alert(10,0,0,"您没有10W元宝,召唤失败!");
end
end
function panel_26_5(player)
    if player:get_level() <= 200 then
if player:get_job() == 3 then
player:gen_slave(5316,5106,"新手守护("..player:GetName()..")",1);
return;
end
for i=1,#shmon[player:get_job()] do
player:gen_clear(shmon[player:get_job()][i]);
player:del_status(shbuff[player:get_job()][i]);
end
player:set_param(shztbl,0)
player:gen_slave(5315,5106,"新手守护("..player:GetName()..")",1);
player:alert(10,0,0,"召唤成功!");
      else  
player:alert(10,0,0,"你已经很强了不需要新手守护了!");
    end
end
function SHST(player,index)
local dj=cklevel(player:get_param(shexpbl)/10000);
if index == 8 then
if player:get_param(shztbl) == 2 then
if player:get_param(shhtsjbl)-10 > 0 then
player:set_param(shhtsjbl,player:get_param(shhtsjbl)-10);
player:set_timer(9,10);
else
player:del_status(shbuff[player:get_job()][dj]);
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:set_param(shztbl,1)
player:set_param(shhtsjbl,0);
player:set_timer(8,0);
player:alert(10,0,0,"守护护体结束!");
end
end
end
if index == 9 then
if player:get_param(shztbl) == 2 then
if player:get_param(shhtsjbl)-10 > 0 then
player:set_param(shhtsjbl,player:get_param(shhtsjbl)-10);
player:set_timer(8,10);
else
player:del_status(shbuff[player:get_job()][dj]);
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:set_param(shztbl,1)
player:set_param(shhtsjbl,0);
player:set_timer(9,0);
player:alert(10,0,0,"守护护体结束!");
end
end
end
end
RegisterServerHook(60,"SHST")
function SHPD(instanceID, player, killer, n)
if player:get_param(shztbl) ~= 0 then
player:set_param(shztbl,0)
end
end
RegisterServerHook(2,"SHPD")
function SHEG(event,player)
local dj=cklevel(player:get_param(shexpbl)/10000);
if dj >=1 then
if player:get_param(shztbl) == 1 then
player:gen_slave(shmon[player:get_job()][dj],shmonwg[player:get_job()][dj],""..shname[player:get_job()][dj].."<br>"..player:GetName().."",1);
player:alert(10,0,0,"守护召唤成功!");
elseif player:get_param(shztbl) == 2 then
player:set_status(shbuff[player:get_job()][dj],0,100,5);
player:set_timer(8,10);
player:alert(10,0,0,"守护护体成功!");
end
end
end
RegisterServerHook(19,"SHEG")
 
function shzh(item,event,player)
player:echo(0,npcid,[[
 
#&talk_line#&
  <font color='#00F5FF'> 说明:120之前可以免费使用新手守护  </font>
        <font color='#00F5FF'> 下线死亡消失请重新召唤守护  </font>
        <font color='#00F5FF'> 守护经验丹可通BOSS爆出或者商城  </font>
<font color='#00F5FF'> 护体以后重新召唤不扣元宝  </font>
#&talk_line#&
#&talk_line#&
   <u><a href='event:M2409,26,5'><font color='#CD00CD'>【新手守护】(免费)</font></a></u>
#&talk_line#&
#&talk_line#&
<u><a href='event:M2402,1'><font color='#C71585'>【守护晋级】</font></a></u> <u><a href='event:M2402,2'><font color='#C71585'>【守护属性】</font></a></u>
#&talk_line#&
#&talk_line#&
<u><a href='event:M2409,26,3'><font color='#C71585'>【守护召唤】</font></a></u> <u><a href='event:M2409,26,4'><font color='#C71585'>【守护护体】</font></a></u>
#&talk_line#&
#&talk_line#&
#&talk_line#&
#&talk_line#&
#&talk_line#&
#&talk_line#&
]]);
return 0;
end
RegisterItemGossipEvent(shitems1,1,"shzh")
RegisterItemGossipEvent(shitems2,1,"shjyd")
RegisterItemGossipEvent(shitems3,1,"shjydd")
 
Npc3013Funid = 
{
[0] = ontalk3013;
[1] = ontalk3013_1;
[2] = ontalk3013_2;
}
 
function CreatureNpcFun(npc,event,player,funid)
if Npc3013Funid[funid] ~= nil then
Npc3013Funid[funid](npc,event,player);
end
end
 
RegisterUnitEvent(3013,20,"ontalk3013")
RegisterUnitEvent(3013,29,"CreatureNpcFun")