require("Envir/Market_Def/NpcLua/zh.lua") --个人封装函数
-----------------------------引路人NPC
function show(actor)
-- if getint(actor,"完成任务id") == 15 then
-- newdeletetask(actor,16) --删除任务16
-- setint(actor,"完成任务id",16)
-- addbindgold(actor,10000)
-- sendmsg9(actor,"了解药品,获得金币*10000")
-- callscriptex(actor, "CallLua", "QFunction-0", "@renwupanduan") --任务系统
-- end
local msg = [[
<Img|width=530|height=250|esc=1|bg=1|scale9r=10|scale9t=10|loadDelay=1|scale9b=10|scale9l=10|move=0|img=public/bg_npc_04.jpg|reset=1|show=0>
<Img|x=9.0|y=9.0|height=232|img=/210.png|esc=0>
<Button|x=529.0|y=2.0|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
<Img|x=132.0|y=26.0|img=image/title_91.png|esc=0>
<Img|x=313.0|y=26.0|img=image/title_92.png|esc=0>
<Text|ax=0.5|ay=0.5|x=264.0|y=31.0|color=243|size=18|text=药店老板>
<Img|x=34.0|y=50.0|img=slws/203.png|esc=0>
<Text|x=25.0|y=65.0|color=255|size=18|text=你好,我是给冒险者提供药品服务的老者,请问需要点什么?>
<Text|ay=0.5|x=51.0|y=150.5|size=18|color=250|text=购买药品|link=@goumaiyaopin>
<Text|ay=0.5|x=180.0|y=150.5|color=250|size=18|text=好的,我知道了|link=@exit>
]]
say(actor,msg)
end
local yao_t = {
{"强效金创药包",1,5000},{"强效魔法药包",1,5000},{"强效太阳水",1,500},{"强效太阳水",10,5000},{"万年雪霜",1,1000},{"万年雪霜",10,10000},{"万年雪霜包",1,5}
}
function goumaiyaopin(actor,yemian,xzid)
yemian = tonumber(yemian) or 1
xzid = tonumber(xzid) or 0
local msg = [[
<Img|width=530|height=250|esc=1|bg=1|scale9r=10|scale9t=10|loadDelay=1|scale9b=10|scale9l=10|move=0|img=public/bg_npc_04.jpg|reset=1|show=0>
<Img|x=9.0|y=9.0|height=232|img=slws/210.png|esc=0>
<Button|x=529.0|y=2.0|nimg=public/1900000510.png|pimg=public/1900000511.png|link=@exit>
<Img|x=159.0|y=22.0|img=slws/142.png|esc=0>
<Img|x=315.0|y=22.0|img=slws/143.png|esc=0>
<Text|ax=0.5|ay=0.5|x=264.0|y=31.0|color=251|size=18|text=药店老板>
<Img|x=34.0|y=50.0|img=slws/203.png|esc=0>
<RText|x=25.0|y=60.0|color=255|size=16|text=为了给你足够的体验,本服普通药品不占背包,高效续航>
<RText|x=25.0|y=83.0|color=255|size=16|text=不用再为打怪PK无药而烦恼>
<RText|x=25.0|y=106.0|color=255|size=16|text=强效金创药包以及强效魔法药包购买后将自动存入内挂保护功能中>
<RText|x=25.0|y=129.0|color=255|size=16|text=请在内挂保护中设置好使用规则>
<RText|x=25.0|y=152.0|color=255|size=16|text=每次购买存储量增加<5000/FCOLOR=250>,新人上线赠送<50万/FCOLOR=250>储量>
<Text|ay=0.5|x=51.0|y=214.5|size=18|color=250|text=返回|link=@show>
<Img|x=26.0|y=206.0|img=slws/211.png|esc=0>
<Img|x=1.0|y=250.0|img=zh/80.png|link=@kong>
]]
if yemian == 1 then
msg=msg.."<Button|x=28.0|y=488.0|nimg=zh/82.png|color=255|size=18|pimg=zh/83.png|link=@kong>"
msg=msg.."<Button|x=123.0|y=488.0|nimg=zh/84.png|color=255|size=18|pimg=zh/85.png|link=@goumaiyaopin,1>"
else
msg=msg.."<Button|x=28.0|y=488.0|nimg=zh/82.png|color=255|size=18|pimg=zh/83.png|link=@goumaiyaopin,1>"
msg=msg.."<Button|x=123.0|y=488.0|nimg=zh/84.png|color=255|size=18|pimg=zh/85.png|link=@kong>"
end
msg=msg.."<Text|ax=0.5|ay=0.5|x=99.5|y=512.5|color=255|size=18|text=".. yemian .."/1>"
local xuhao = 0
for i = 1+(yemian-1)*8,8+(yemian-1)*8 do
if yao_t[i] == nil then
break
end
-- if i >= 12 then
-- if getlevel(actor) < 65 and getbaseinfo(actor,39) == 0 then
-- break
-- end
-- end
msg=msg.."<Img|x=".. 19+xuhao%2*149 .."|y=".. 268+math.floor(xuhao/2)*52 .."|width=145|height=50|esc=0|img=slws/148.png|link=@goumaiyaopin,".. yemian..",".. i ..">"
msg=msg.."<Img|x=".. 20+xuhao%2*149 .."|y=".. 269+math.floor(xuhao/2)*52 .."|img=zh/81.png|esc=0>"
msg=msg.."<ItemShow|x=".. 11+xuhao%2*149 .."|y=".. 260+math.floor(xuhao/2)*52 .."|width=70|height=70|itemid=".. getidbyname(yao_t[i][1]) .."|itemcount=1|showtips=1|bgtype=0>"
if yao_t[i][2] > 1 then
msg=msg.."<Text|ay=0.5|x=".. 23+xuhao%2*149 .."|y=".. 305+math.floor(xuhao/2)*52 .."|outline=1|color=255|size=14|text=".. yao_t[i][2] ..">"
end
msg=msg.."<Text|ay=0.5|x=".. 70+xuhao%2*149 .."|y=".. 283+math.floor(xuhao/2)*52 .."|color=255|size=14|text=".. yao_t[i][1] ..">"
if i > 6 then
msg=msg.."<Text|ay=0.5|x=".. 70+xuhao%2*149 .."|y=".. 305+math.floor(xuhao/2)*52 .."|color=255|size=14|text=".. yao_t[i][3] .."元宝>"
else
msg=msg.."<Text|ay=0.5|x=".. 70+xuhao%2*149 .."|y=".. 305+math.floor(xuhao/2)*52 .."|color=255|size=14|text=".. yao_t[i][3] .."金币>"
end
if xzid == i then
msg=msg.."<Img|x=".. 18+xuhao%2*149 .."|y=".. 267+math.floor(xuhao/2)*52 .."|width=147|height=52|scale9b=0|scale9r=0|scale9t=0|img=slws/45.png|scale9l=0|esc=0>"
end
xuhao = xuhao + 1
end
msg=msg.."<Button|x=228.0|y=497.0|nimg=zh/86.png|color=255|size=18|pimg=zh/87.png|link=@goumai,".. xzid ..">"
say(actor,msg)
end
function goumai(actor,par)
local zhekou = 1
par = tonumber(par)
if par == 0 then
sendmsg9(actor,"请选择购买的药品")
return
end
if par == 1 then
if getint(actor,"存储红量") >= 500000 then
sendmsg9(actor,"HP存储量已满")
return
end
if getbindgold(actor) < 5000 then
sendmsg9(actor,"金币不足".. 5000)
return
end
subbindgold(actor, 5000*zhekou)
setint(actor, "存储红量", getint(actor,"存储红量")+5000)
if getint(actor,"存储红量") >= 500000 then
setint(actor,"存储红量",500000)
end
sendmsg9(actor,"购买成功,当前HP储量"..getint(actor,"存储红量"))
callscriptex(actor, "CallLua", "yaodian", "@chuliangxiangshi")
return
end
if par == 2 then
if getint(actor,"存储蓝量") >= 500000 then
sendmsg9(actor,"MP存储量已满")
return
end
if getbindgold(actor) < 5000*zhekou then
sendmsg9(actor,"金币不足".. 5000*zhekou)
return
end
subbindgold(actor,5000*zhekou)
setint(actor,"存储蓝量",getint(actor,"存储蓝量")+5000)
if getint(actor,"存储蓝量") >= 500000 then
setint(actor,"存储蓝量",500000)
end
sendmsg9(actor,"购买成功,当前MP储量"..getint(actor,"存储蓝量"))
callscriptex(actor, "CallLua", "yaodian", "@chuliangxiangshi")
return
end
-- 元宝购买的药店
if par > 6 then
if getbagblank(actor) < yao_t[par][2] then
sendmsg9(actor,"背包空格不足".. yao_t[par][2] .."格")
return
end
if getingot(actor) < yao_t[par][3] then
sendmsg9(actor,"元宝不足".. yao_t[par][3])
return
end
subingot(actor,yao_t[par][3],"买药")
giveitem(actor,yao_t[par][1],yao_t[par][2],0)
sendmsg9(actor,"购买成功")
return
end
-- 普通药品
if getbagblank(actor) < yao_t[par][2] then
sendmsg9(actor,"背包空格不足")
return
end
if getbindgold(actor) < yao_t[par][3]*zhekou then
sendmsg9(actor,"金币不足"..yao_t[par][3]*zhekou)
return
end
local bind = 0
-- 有绑定金币,先扣,设置物品绑定规则
if getbindjinbi(actor) > 0 then
bind = 370
end
subbindgold(actor,yao_t[par][3]*zhekou)
giveitem(actor,yao_t[par][1],yao_t[par][2],bind)
sendmsg9(actor,"购买成功")
return
end
function chuliangxiangshi(actor) --红蓝储量显示
delbutton(actor, 303, 2)
local msg = ""
if getispc(actor) then --端游
msg = msg .."<RText|ay=0.5|x=282.0|y=272.5|color=31|outline=1|size=16|text=HP 每秒恢复15点 当前已存储 ".. getint(actor,"存储红量") .."点>"
msg = msg .."<RText|ay=0.5|x=282.0|y=331.5|color=154|outline=1|size=16|text=MP 每秒恢复20点 当前已存储 ".. getint(actor,"存储蓝量") .."点>"
else
msg = msg .."<RText|ay=0.5|x=362.0|y=312.5|color=31|outline=1|size=16|text=HP 每秒恢复15点 当前已存储 ".. getint(actor,"存储红量") .."点>"
msg = msg .."<RText|ay=0.5|x=362.0|y=371.5|color=154|outline=1|size=16|text=MP 每秒恢复20点 当前已存储 ".. getint(actor,"存储蓝量") .."点>"
end
addbutton(actor, 303, 2, msg)
end
function meimiaohuixue(actor)
-- haoshistart(actor)
--sendmsg6(actor,"死亡"..tostring(getbaseinfo(actor,0)))
if not getbaseinfo(actor,0) and getbaseinfo(actor,9) > 0 then --未死亡状态
local shuaxin = 0
if getbaseinfo(actor,9) < getbaseinfo(actor,10) then
if getint(actor,"红量自动恢复") == 1 and getbaseinfo(actor,9)/getbaseinfo(actor,10) < getint(actor,"红量恢复百分比")/100 and getint(actor,"存储红量") >=15 then
local morenhp = 15
shuaxin = 1
setint(actor, "存储红量", getint(actor,"存储红量") - morenhp)
local chazhi = getbaseinfo(actor,10) - getbaseinfo(actor,9) --血量差值
if chazhi < morenhp then --小于15点的情况
morenhp = chazhi
end
setbaseinfo(actor, 9, getbaseinfo(actor,9) + morenhp)
healthspellchanged(actor)
sendattackeff(actor, 4, morenhp, "*")
end
end
if getbaseinfo(actor,11) < getbaseinfo(actor,12) then
if getint(actor,"蓝量自动恢复") == 1 and getbaseinfo(actor,11)/getbaseinfo(actor,12) < getint(actor,"蓝量恢复百分比")/100 and getint(actor,"存储蓝量") >=20 then
local morenmp = 20
shuaxin = 1
setint(actor,"存储蓝量", getint(actor,"存储蓝量") - morenmp)
-- sendmsg6(actor, "mp+" .. morenmp)
humanmp(actor,"+", morenmp, 1000)
end
end
if shuaxin == 1 then
callscriptex(actor, "CallLua", "yaodian", "@chuliangxiangshi")
end
end
-- haoshiend(actor)
end
function baohujiemian(actor) --保护界面
delbutton(actor,303 ,1)
local msg = ""
setplaydef(actor,"N51",getint(actor,"红量恢复百分比"))
setplaydef(actor,"N52",getint(actor,"蓝量恢复百分比"))
if getispc(actor) then --端游
msg = "<Img|x=0|y=225|img=slws/235.png|esc=0>"
msg = msg.."<RText|x=10.0|y=362.0|color=255|size=16|outline=1|text=提示:<先设置自动回血百分比,再点击前面勾选即可/FCOLOR=254> <存储量为0时,请前往土城药店购买/FCOLOR=250>>"
---红
msg = msg .."<Text|ax=0.5|ay=0.5|x=120.5|y=247.5|size=16|outline=1|color=255|text=生命值低于$STM(SLIDERV_N51)% 自动恢复>"
--msg = msg .."<RText|ax=0.5|ay=0.5|x=120.5|y=247.5|size=16|outline=1|color=255|text=生命值低于<".. getint(actor,"红量恢复百分比") .."%/FCOLOR=31> 自动恢复>"
msg = msg .."<Slider|sliderid=N51|x=47.0|y=265.0|width=150|height=14|defvalue=".. getint(actor,"红量恢复百分比") .."|bgimg=public/bg_szjm_01.png|barimg=public/bg_szjm_02.png|ballimg=public/bg_szjm_02_1.png|link=@lagan#滑栏类型=1>"
if getint(actor,"红量自动恢复") == 0 then
msg = msg .."<Img|x=244.0|y=258.0|img=zh/77.png|link=@baohugouxuan#血量保护勾选种类=1>"
else
msg = msg .."<Img|x=244.0|y=258.0|img=zh/78.png|link=@baohugouxuan#血量保护勾选种类=1>"
end
---蓝
msg = msg .."<Text|ax=0.5|ay=0.5|x=120.5|y=307.5|outline=1|color=255|size=16|text=魔法值低于$STM(SLIDERV_N52)% 自动恢复>"
--msg = msg .."<RText|ax=0.5|ay=0.5|x=120.5|y=307.5|outline=1|color=255|size=16|text=魔法值低于<".. getint(actor,"蓝量恢复百分比") .."%/FCOLOR=154> 自动恢复>"
msg = msg .."<Slider|sliderid=N52|x=47.0|y=325.0|width=150|height=14|defvalue=".. getint(actor,"蓝量恢复百分比") .."|bgimg=public/bg_szjm_01.png|barimg=public/bg_szjm_02.png|ballimg=public/bg_szjm_02_1.png|link=@lagan#滑栏类型=2>"
if getint(actor,"蓝量自动恢复") == 0 then
msg = msg .."<Img|x=244.0|y=318.0|img=zh/77.png|link=@baohugouxuan#血量保护勾选种类=2>"
else
msg = msg .."<Img|x=244.0|y=318.0|img=zh/78.png|link=@baohugouxuan#血量保护勾选种类=2>"
end
else --手游
msg = "<Img|x=0|y=260|img=slws/235.png|esc=0>"
msg = msg.."<RText|x=70.0|y=402.0|color=255|size=16|outline=1|text=提示:<先设置自动回血百分比,再点击前面勾选即可/FCOLOR=254> <存储量为0时,请前往土城药店购买/FCOLOR=250>>"
---红
msg = msg .."<Text|ax=0.5|ay=0.5|x=146.5|y=287.5|size=16|outline=1|color=255|text=生命值低于$STM(SLIDERV_N51)% 自动恢复>"
--msg = msg .."<RText|ax=0.5|ay=0.5|x=146.5|y=287.5|size=16|outline=1|color=255|text=生命值低于<".. getint(actor,"红量恢复百分比") .."%/FCOLOR=31> 自动恢复>"
msg = msg .."<Slider|sliderid=N51|x=41.0|y=305.0|width=210|height=14|defvalue=".. getint(actor,"红量恢复百分比") .."|bgimg=public/bg_szjm_01.png|barimg=public/bg_szjm_02.png|ballimg=public/bg_szjm_02_1.png|link=@lagan#滑栏类型=1>"
if getint(actor,"红量自动恢复") == 0 then
msg = msg .."<Img|x=324.0|y=298.0|img=zh/77.png|link=@baohugouxuan#血量保护勾选种类=1>"
else
msg = msg .."<Img|x=324.0|y=298.0|img=zh/78.png|link=@baohugouxuan#血量保护勾选种类=1>"
end
---蓝
msg = msg .."<Text|ax=0.5|ay=0.5|x=146.5|y=347.5|outline=1|color=255|size=16|text=魔法值低于$STM(SLIDERV_N52)% 自动恢复>"
--msg = msg .."<RText|ax=0.5|ay=0.5|x=146.5|y=347.5|outline=1|color=255|size=16|text=魔法值低于<".. getint(actor,"蓝量恢复百分比") .."%/FCOLOR=154> 自动恢复>"
msg = msg .."<Slider|sliderid=N52|x=41.0|y=365.0|width=210|height=14|defvalue=".. getint(actor,"蓝量恢复百分比") .."|bgimg=public/bg_szjm_01.png|barimg=public/bg_szjm_02.png|ballimg=public/bg_szjm_02_1.png|link=@lagan#滑栏类型=2>"
if getint(actor,"蓝量自动恢复") == 0 then
msg = msg .."<Img|x=324.0|y=358.0|img=zh/77.png|link=@baohugouxuan#血量保护勾选种类=2>"
else
msg = msg .."<Img|x=324.0|y=358.0|img=zh/78.png|link=@baohugouxuan#血量保护勾选种类=2>"
end
end
addbutton(actor,303 ,1,msg)
chuliangxiangshi(actor) --储量显示
end
function baohugouxuan(actor,par)
-- sendmsg9(actor, "勾了..." .. par)
if par == "1" then
if getint(actor,"红量自动恢复") == 0 then
setint(actor,"红量自动恢复",1)
else
setint(actor,"红量自动恢复",0)
end
-- sendmsg6(actor, "红的显示状态:" .. getint(actor, "红量自动恢复"))
else
if getint(actor,"蓝量自动恢复") == 0 then
setint(actor,"蓝量自动恢复",1)
else
setint(actor,"蓝量自动恢复",0)
end
-- sendmsg6(actor, "蓝的显示状态:" .. getint(actor, "蓝量自动恢复"))
end
return baohujiemian(actor)
end
function lagan(actor,par)
if par == "1" then
setint(actor,"红量恢复百分比",getplaydef(actor,"N51"))
else
setint(actor,"蓝量恢复百分比",getplaydef(actor,"N52"))
end
return baohujiemian(actor)
end
----------------红蓝存储量
function check_hp_mp_capacity(actor) --30秒定时器
if getint(actor,"红量自动恢复") == 1 and getint(actor,"存储红量") < 15 then
sendmsg9(actor,"生命值存储量不足 请前往土城药店补充药品")
end
if getint(actor,"蓝量自动恢复") == 1 and getint(actor,"存储蓝量") < 20 then
sendmsg9(actor,"魔法值存储量不足 请前往土城药店补充药品")
end
end
function playborn(actor)
--------新人登录段
if getbaseinfo(actor,47) then --新人登录
setint(actor,"红量恢复百分比",90)
setint(actor,"蓝量恢复百分比",80)
setint(actor,"红量自动恢复",1)
setint(actor,"蓝量自动恢复",1)
setint(actor,"存储红量",500000)
setint(actor,"存储蓝量",500000)
end
end