require("Envir/Market_Def/NpcLua/zh.lua") --个人封装函数
--[[
@description: 计算回复的HP
@return {number}
--]]
function calc_hp(actor)
local morenhp = 0
if getint(actor,"红10自动恢复") == 1 and getbaseinfo(actor, 9) / getbaseinfo(actor, 10) < getint(actor,"红10恢复百分比")/100 then
morenhp = 10
local chazhi = getbaseinfo(actor,10) - getbaseinfo(actor,9) --血量差值
if chazhi < morenhp then --小于10点的情况
morenhp = chazhi
return morenhp
end
end
if getint(actor,"红80自动恢复") == 1 and getbaseinfo(actor, 9) / getbaseinfo(actor, 10) < getint(actor,"红80恢复百分比")/100 then
if getbindgold(actor) < 300 then
return morenhp
else
subbindgold(actor, 300, "自动吃药")
end
morenhp = morenhp + 80
local chazhi = getbaseinfo(actor,10) - getbaseinfo(actor,9) --血量差值
if chazhi < morenhp then --小于加的点数情况
morenhp = chazhi
end
return morenhp
end
if getint(actor,"红60自动恢复") == 1 and getbaseinfo(actor, 9) / getbaseinfo(actor, 10) < getint(actor,"红60恢复百分比")/100 then
if getbindgold(actor) < 100 then
return morenhp
else
subbindgold(actor, 100, "自动吃药")
end
morenhp = morenhp + 60
local chazhi = getbaseinfo(actor,10) - getbaseinfo(actor,9) --血量差值
if chazhi < morenhp then --小于加的点数情况
morenhp = chazhi
end
return morenhp
end
return morenhp
end
--[[
@description: 计算回复的MP
@return {number}
--]]
function calc_mp(actor)
local morenmp = 0
if getint(actor,"蓝20自动恢复") == 1 and getbaseinfo(actor, 11) / getbaseinfo(actor, 12) < getint(actor,"蓝20恢复百分比")/100 then
morenmp = 20
local chazhi = getbaseinfo(actor, 12) - getbaseinfo(actor, 11) --血量差值
if chazhi < morenmp then --小于20点的情况
morenmp = chazhi
return morenmp
end
end
if getint(actor,"蓝120自动恢复") == 1 and getbaseinfo(actor, 11) / getbaseinfo(actor, 12) < getint(actor,"蓝120恢复百分比")/100 then
if getbindgold(actor) < 300 then
return morenmp
else
subbindgold(actor, 300, "自动吃药")
end
morenmp = morenmp + 120
local chazhi = getbaseinfo(actor,12) - getbaseinfo(actor, 11) --血量差值
if chazhi < morenmp then --小于加的点数情况
morenmp = chazhi
end
return morenmp
end
if getint(actor,"蓝80自动恢复") == 1 and getbaseinfo(actor, 11) / getbaseinfo(actor, 12) < getint(actor,"蓝80恢复百分比")/100 then
if getbindgold(actor) < 100 then
return morenmp
else
subbindgold(actor, 100, "自动吃药")
end
morenmp = morenmp + 80
local chazhi = getbaseinfo(actor, 12) - getbaseinfo(actor, 11) --血量差值
if chazhi < morenmp then --小于加的点数情况
morenmp = chazhi
end
return morenmp
end
return morenmp
end
function meimiaohuixue(actor)
-- haoshistart(actor)
--sendmsg6(actor,"死亡"..tostring(getbaseinfo(actor,0)))
if not getbaseinfo(actor, 0) and getbaseinfo(actor, 9) > 0 then --未死亡状态
if getbaseinfo(actor, 9) < getbaseinfo(actor, 10) then
local n = calc_hp(actor)
-- sendmsg6(actor, "当前加HP值=" .. n)
if n > 0 then
setbaseinfo(actor, 9, getbaseinfo(actor,9) + n)
healthspellchanged(actor)
sendattackeff(actor, 4, n, "*")
end
end
if getbaseinfo(actor,11) < getbaseinfo(actor,12) then
local m = calc_mp(actor)
-- sendmsg6(actor, "当前加MP值=" ..m)
if m > 0 then
humanmp(actor, "+", m, 1000)
end
end
end
end
function baohujiemian(actor) --保护界面
delbutton(actor,303 ,1)
local msg = ""
setplaydef(actor,"N51",getint(actor,"红10恢复百分比"))
setplaydef(actor,"N52",getint(actor,"红60恢复百分比"))
setplaydef(actor,"N53",getint(actor,"红80恢复百分比"))
setplaydef(actor,"N54",getint(actor,"蓝20恢复百分比"))
setplaydef(actor,"N55",getint(actor,"蓝80恢复百分比"))
setplaydef(actor,"N56",getint(actor,"蓝120恢复百分比"))
if getispc(actor) then --端游
---红
msg = "<Text|ax=0.5|ay=0.5|x=133|y=27|size=12|outline=1|color=255|text=生命值低于$STM(SLIDERV_N51)% 使用强效金药药>"
msg = msg .."<Slider|sliderid=N51|x=50.0|y=40.0|width=180|height=14|defvalue=".. getint(actor,"红10恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=355|y=45|outline=1|color=46|size=14|text=强效金创HP+ 10 永久免费>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=123|y=73|size=12|outline=1|color=255|text=生命值低于$STM(SLIDERV_N52)% 瞬间回血药>"
msg = msg .."<Slider|sliderid=N52|x=50.0|y=85.0|width=180|height=14|defvalue=".. getint(actor,"红60恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=404|y=92|outline=1|color=46|size=14|text=瞬回血药HP+ 60 每次恢复收费:100金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=123|y=112|size=12|outline=1|color=255|text=生命值低于$STM(SLIDERV_N53)% 瞬间回血药>"
msg = msg .."<Slider|sliderid=N53|x=50.0|y=125.0|width=180|height=14|defvalue=".. getint(actor,"红80恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=404|y=132|outline=1|color=46|size=14|text=瞬回血药HP+ 80 每次恢复收费:300金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=132|y=157|size=12|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N54)% 使用强效魔法药>"
msg = msg .."<Slider|sliderid=N54|x=50.0|y=170.0|width=180|height=14|defvalue=".. getint(actor,"蓝20恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=355|y=173|outline=1|color=168|size=14|text=强效魔法MP+ 20 永久免费>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=133|y=197|size=12|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N55)% 使用瞬回蓝药>"
msg = msg .."<Slider|sliderid=N55|x=50.0|y=210|width=180|height=14|defvalue=".. getint(actor,"蓝80恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=404|y=215|outline=1|color=168|size=14|text=瞬回蓝药MP+ 80 每次恢复收费:100金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=133|y=237|size=12|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N56)% 使用瞬回蓝药>"
msg = msg .."<Slider|sliderid=N56|x=50.0|y=250.0|width=180|height=14|defvalue=".. getint(actor,"蓝120恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=404|y=257|outline=1|color=168|size=14|text=瞬回蓝药MP+120 每次恢复收费:300金币>"
if getint(actor,"红10自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=38.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP10>"
else
msg = msg .."<Img|x=25.0|y=38.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP10>"
end
if getint(actor,"红60自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=83.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP60>"
else
msg = msg .."<Img|x=25.0|y=83.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP60>"
end
if getint(actor,"红80自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=123.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP80>"
else
msg = msg .."<Img|x=25.0|y=123.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP80>"
end
if getint(actor,"蓝20自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=168.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP20>"
else
msg = msg .."<Img|x=25.0|y=168.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP20>"
end
if getint(actor,"蓝80自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=208.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP80>"
else
msg = msg .."<Img|x=25.0|y=208.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP80>"
end
if getint(actor,"蓝120自动恢复") == 0 then
msg = msg .."<Img|x=25.0|y=248.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP120>"
else
msg = msg .."<Img|x=25.0|y=248.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP120>"
end
else --手游
msg = "<Text|ax=0.5|ay=0.5|x=155|y=42|size=14|outline=1|color=255|text=生命值低于$STM(SLIDERV_N51)% 使用强效金药药>"
msg = msg .."<Slider|sliderid=N51|x=60.0|y=55.0|width=230|height=14|defvalue=".. getint(actor,"红10恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=414|y=60|outline=1|color=46|size=15|text=强效金创HP+10 永久免费>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=141|y=88|size=14|outline=1|color=255|text=生命值低于$STM(SLIDERV_N52)% 瞬间回血药>"
msg = msg .."<Slider|sliderid=N52|x=60.0|y=100.0|width=230|height=14|defvalue=".. getint(actor,"红60恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=462|y=107|outline=1|color=46|size=15|text=瞬回血药HP+60 每次恢复收费:100金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=141|y=132|size=14|outline=1|color=255|text=生命值低于$STM(SLIDERV_N53)% 瞬间回血药>"
msg = msg .."<Slider|sliderid=N53|x=60.0|y=150.0|width=230|height=14|defvalue=".. getint(actor,"红80恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress3.png|ballimg=custom/protect_setting/hpbar.png|link=@lagan#滑栏类型=1>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=463|y=157|outline=1|color=46|size=15|text=瞬回血药HP+80 每次恢复收费:300金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=156|y=187|size=14|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N54)% 使用强效魔法药>"
msg = msg .."<Slider|sliderid=N54|x=60.0|y=200.0|width=230|height=14|defvalue=".. getint(actor,"蓝20恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=413|y=203|outline=1|color=168|size=15|text=强效魔法MP+20 永久免费>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=155|y=232|size=14|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N55)% 使用瞬回蓝药>"
msg = msg .."<Slider|sliderid=N55|x=60.0|y=245|width=230|height=14|defvalue=".. getint(actor,"蓝80恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=463|y=250|outline=1|color=168|size=15|text=瞬回蓝药MP+80 每次恢复收费:100金币>"
msg = msg .. "<Text|ax=0.5|ay=0.5|x=155|y=277|size=14|outline=1|color=255|text=魔法值低于$STM(SLIDERV_N56)% 使用瞬回蓝药>"
msg = msg .."<Slider|sliderid=N56|x=60.0|y=290.0|width=230|height=14|defvalue=".. getint(actor,"蓝120恢复百分比") .."|bgimg=custom/protect_setting/bg_progress.png|barimg=custom/protect_setting/bg_progress4.png|ballimg=custom/protect_setting/mpbar.png|link=@lagan#滑栏类型=2>"
msg = msg .. "<RText|ax=0.5|ay=0.5|x=466|y=297|outline=1|color=168|size=15|text=瞬回蓝药MP+120 每次恢复收费:300金币>"
if getint(actor,"红10自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=53.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP10>"
else
msg = msg .."<Img|x=33.0|y=53.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP10>"
end
if getint(actor,"红60自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=98.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP60>"
else
msg = msg .."<Img|x=33.0|y=98.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP60>"
end
if getint(actor,"红80自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=148.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP80>"
else
msg = msg .."<Img|x=33.0|y=148.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=HP80>"
end
if getint(actor,"蓝20自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=198.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP20>"
else
msg = msg .."<Img|x=33.0|y=198.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP20>"
end
if getint(actor,"蓝80自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=243.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP80>"
else
msg = msg .."<Img|x=33.0|y=243.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP80>"
end
if getint(actor,"蓝120自动恢复") == 0 then
msg = msg .."<Img|x=33.0|y=288.0|width=18|height=18|img=custom/protect_setting/clickbg2.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP120>"
else
msg = msg .."<Img|x=33.0|y=288.0|width=18|height=18|img=custom/protect_setting/click3.png|scale9l=9|scale9r=9|scale9t=5|scale9b=5|link=@baohugouxuan#血量保护勾选种类=MP120>"
end
end
addbutton(actor,303 ,1,msg)
-- chuliangxiangshi(actor) --储量显示
end
function baohugouxuan(actor, par)
-- sendmsg9(actor, "勾了..." .. par)
if par == "HP10" then
if getint(actor,"红10自动恢复") == 0 then
setint(actor,"红10自动恢复",1)
else
setint(actor,"红10自动恢复",0)
end
-- sendmsg6(actor, "红的显示状态:" .. getint(actor, "红量自动恢复"))
elseif par == "HP60" then
if getint(actor,"红60自动恢复") == 0 then
setint(actor,"红60自动恢复",1)
setint(actor,"红80自动恢复",0)
else
setint(actor,"红60自动恢复",0)
end
elseif par == "HP80" then
if getint(actor,"红80自动恢复") == 0 then
setint(actor,"红80自动恢复",1)
setint(actor,"红60自动恢复",0)
else
setint(actor,"红80自动恢复",0)
end
elseif par == "MP20" then
if getint(actor,"蓝20自动恢复") == 0 then
setint(actor,"蓝20自动恢复",1)
else
setint(actor,"蓝20自动恢复",0)
end
elseif par == "MP80" then
if getint(actor,"蓝80自动恢复") == 0 then
setint(actor,"蓝80自动恢复",1)
setint(actor,"蓝120自动恢复",0)
else
setint(actor,"蓝80自动恢复",0)
end
elseif par == "MP120" then
if getint(actor,"蓝120自动恢复") == 0 then
setint(actor,"蓝120自动恢复",1)
setint(actor,"蓝80自动恢复",0)
else
setint(actor,"蓝120自动恢复",0)
end
end
return baohujiemian(actor)
end
function lagan(actor,par)
if par == "1" then
setint(actor,"红10恢复百分比",getplaydef(actor,"N51"))
setint(actor,"红60恢复百分比",getplaydef(actor,"N52"))
setint(actor,"红80恢复百分比",getplaydef(actor,"N53"))
else
setint(actor,"蓝20恢复百分比",getplaydef(actor,"N54"))
setint(actor,"蓝80恢复百分比",getplaydef(actor,"N55"))
setint(actor,"蓝120恢复百分比",getplaydef(actor,"N56"))
end
return baohujiemian(actor)
end
function playborn(actor)
--------新人登录段
if getbaseinfo(actor,47) then --新人登录
setint(actor,"红10恢复百分比", 100)
setplaydef(actor, "N51", 100)
setint(actor,"红60恢复百分比", 70)
setplaydef(actor, "N52", 70)
setint(actor,"红80恢复百分比", 60)
setplaydef(actor, "N53", 60)
setint(actor,"蓝20恢复百分比", 80)
setplaydef(actor, "N54", 80)
setint(actor,"蓝80恢复百分比", 70)
setplaydef(actor, "N55", 70)
setint(actor,"蓝120恢复百分比", 50)
setplaydef(actor, "N56", 50)
setint(actor,"红10自动恢复",1)
setint(actor,"蓝20自动恢复",1)
end
end