|
- function ShowHead(meindex, talkerindex)
- momny = char.getInt(talkerindex,"金库魔币")
- gold = char.getInt(talkerindex,"金库金币")
- vipl = char.getInt(talkerindex,"VIP等级")
- trans = char.getInt(talkerindex,"转生次数")
- token = "3\n § 请选择您需要的服务 §\n\n\n"
- .. " ≡ 转生角色 ≡\n"
- .. " ≡ 转生宠物 ≡\n\n"
- --.. " ≡ 存入小金库魔币 ≡\n"
- --.. " ≡ 存入金库软妹币 ≡\n\n"
- --.. " ≡ 金库现有魔币:".. momny .." 金币:".. gold .." ≡\n\n"
- .. " ≡ 您当前转生次数:".. trans .." ≡\n"
- .. " ≡ 金库魔币:".. momny .." 金币:".. gold .." VIP积分:".. vipl .." ≡\n\n"
-
- --lssproto.windows(talkerindex, "选择框", 8, 0, char.getWorkInt( meindex, "对象"), token)
- lssproto.windows(talkerindex, "选择框", "确定", 326, meindex, token)
- end
- function checkEmptItemNum(charaindex)--检测剩余物品格子
- EmptyItemNum = 0
- for i = 8, 27 do
- if char.getItemIndex(charaindex, i) == -1 then
- EmptyItemNum = EmptyItemNum + 1
- end
- end
- return EmptyItemNum
- end
- --NPC窗口事件(NPC索引)
- function WindowTalked ( meindex, talkerindex, seqno, select, data)
- char.TalkToCli(talkerindex, -1, "Seqno:"..seqno.." | select:"..select.." | data:"..data, "红色")
- if select == 2 then
- return
- end
-
- --开始检测地图队伍数据
- if seqno == 326 then --一定要修改 自己的都是这个
- if select == 0 then --
- if other.atoi(data) == 1 then--转生角色
- trans = char.getInt(talkerindex,"转生次数")
- char.TalkToCli(talkerindex, -1, "您当前转生次数:"..trans, "黄色")
- token = "\n § 转生管理大师竭诚为您服务 §\n\n\n"
- .. "\n\n\n您确定要转生吗?"
- lssproto.windows(talkerindex, "对话框", "确定|取消", 325, meindex, token)
- return
- end
- if other.atoi(data) == 2 then--转生宠物
- trans = char.getInt(talkerindex,"转生次数")
- char.TalkToCli(talkerindex, -1, "您当前转生次数:"..trans, "黄色")
- token = "\n § 转生管理大师竭诚为您服务 §\n\n\n"
- .. "\n\n\n宠物转生暂时没开放"
- lssproto.windows(talkerindex, "对话框", "确定|取消", 324, meindex, token)
- return
- end
-
- if other.atoi(data) == 3 then
- --momny = char.getInt(talkerindex,"金库金币")
- --char.TalkToCli(talkerindex, -1, "您当前小金库金币:"..momny, "黄色")
- token = "\n § 小金库管理大师竭诚为您服务 §\n\n\n"
- .. "\n\n您要把魔币存入小金库吗?"
- .. "\n\n请您输入要存入多少魔币放入小金库"
- lssproto.windows(talkerindex, "输入框", "确定|取消", 323, meindex, token)
- --lssproto.windows(talkerindex, "对话框", "确定", 320, meindex, token)
- return
- end
-
- if other.atoi(data) == 4 then
- --momny = char.getInt(talkerindex,"金库金币")
- --char.TalkToCli(talkerindex, -1, "您当前小金库金币:"..momny, "黄色")
- token = "\n § 小金库管理大师竭诚为您服务 §\n\n\n"
- .. "\n\n您要把金币存入小金库吗?"
- .. "\n\n请您输入要放入多少金币到小金库"
- lssproto.windows(talkerindex, "输入框", "确定|取消", 322, meindex, token)
- --lssproto.windows(talkerindex, "对话框", "确定", 320, meindex, token)
- return
- end
- end
-
- elseif seqno == 322 then
- if select == 1 then --
- num = other.atoi(data)
- char.TalkToCli(talkerindex, -1, "您想要放入小金库金币数量:"..data, "黄色")
- --要检测取出的小于当前剩余的才可以
- char.TalkToCli(talkerindex, -1, "您身上金币数量:"..char.getitemunbforid(talkerindex,473658) , "黄色")
- if char.getitemunbforid(talkerindex,473658) < num then
- char.TalkToCli(talkerindex, -1, "您身上金币数量不足!!", "黄色")
- return
- end
- char.TalkToCli(talkerindex, -1, "您小金库放入后金币:"..char.getInt(talkerindex,"金库金币") + num, "黄色")
- char.TalkToCli(talkerindex, -1, "您身上金币:"..char.getInt(talkerindex,"金库金币"), "黄色")
- --char.TalkToCli(talkerindex, -1, "您仓库魔币:"..char.getInt(talkerindex,"仓库魔币"), "黄色")
- if char.getInt(talkerindex,"金库金币") + num <= 100000000 and num <= char.getitemunbforid(talkerindex,473658) then
- momnyrest = char.getInt(talkerindex,"金库金币") + num --加上现在的要写入现在的值
- --身上要减少的金币
- char.delitemunbforid(talkerindex,473658,num)
- if momnyrest >= 0 then
- char.setInt(talkerindex,"金库金币",momnyrest)--要检测下是不是还有
- end
- return
- else
- char.TalkToCli(talkerindex, -1, "您放入的金币数据不对!!!!", "黄色")
- end
- end
-
- elseif seqno == 323 then
- if select == 1 then --
- num = other.atoi(data)
- char.TalkToCli(talkerindex, -1, "您想要放入小金库魔币:"..data, "黄色")
- --要检测取出的小于当前剩余的才可以
- char.TalkToCli(talkerindex, -1, "您小金库放入后魔币:"..char.getInt(talkerindex,"金库魔币") + num, "黄色")
- char.TalkToCli(talkerindex, -1, "您身上魔币:"..char.getInt(talkerindex,"身上魔币"), "黄色")
- char.TalkToCli(talkerindex, -1, "您仓库魔币:"..char.getInt(talkerindex,"仓库魔币"), "黄色")
- if char.getInt(talkerindex,"金库魔币") + num <= 100000000 and num <= char.getInt(talkerindex,"身上魔币") then
- momnyrest = char.getInt(talkerindex,"金库魔币") + num --加上现在的要写入现在的值
- --身上要减少的魔币
- npc.DelGold(talkerindex,num)
- char.Updata(talkerindex,"魔币")
- if momnyrest >= 0 then
- char.setInt(talkerindex,"金库魔币",momnyrest)--要检测下是不是还有
- end
- return
- else
- char.TalkToCli(talkerindex, -1, "您放入的魔币数据不对!!!!", "黄色")
- end
- end
- elseif seqno == 325 then--转生角色
- if select == 1 then --
- trans = char.getInt(talkerindex,"转生次数")
- char.TalkToCli(talkerindex, -1, "您当前转生次数:"..trans, "黄色")
- --要检测下一转需要条件没转对应等级和对应的转生需要物品
- if trans == 0 then --0转1
- char.TalkToCli(talkerindex, -1, "您体力点数:"..char.getInt(talkerindex,"体力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您腕力点数:"..char.getInt(talkerindex,"腕力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您耐力点数:"..char.getInt(talkerindex,"耐力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您速度点数:"..char.getInt(talkerindex,"速度"), "黄色")
- char.TalkToCli(talkerindex, -1, "您魔法点数:"..char.getInt(talkerindex,"魔法"), "黄色")
- char.TalkToCli(talkerindex, -1, "您升级点点数:"..char.getInt(talkerindex,"升级点"), "黄色")
- if char.getInt(talkerindex, "等级") < 400 then --等级不够
- char.TalkToCli(talkerindex, -1, "您当前转生次数:"..trans.."需要400级才能进修到下次转生!当前您等级不够请努力进修!", "黄色")
- return
- end
- --加检测身上物品
- if char.getitemunbforid(talkerindex,66610) < 5 then
- char.TalkToCli(talkerindex, -1, "您身上转生石数量不足!!", "黄色")
- return
- end
- char.delitemunbforid(talkerindex,66610,5)
- --开始写转生需要处理的属性全部清0 在增加对应的属性
- char.setInt(talkerindex,"体力",0)
- char.setInt(talkerindex,"腕力",0)
- char.setInt(talkerindex,"耐力",0)
- char.setInt(talkerindex,"速度",0)
- char.setInt(talkerindex,"魔法",0)
- char.setInt(talkerindex,"升级点",500)
- char.setInt(talkerindex, "等级",1)
- char.Updata(talkerindex,"全部")
- char.TalkToCli(talkerindex, -1, "您转生后的点数", "黄色")
- char.TalkToCli(talkerindex, -1, "您腕力点数:"..char.getInt(talkerindex,"腕力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您耐力点数:"..char.getInt(talkerindex,"耐力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您速度点数:"..char.getInt(talkerindex,"速度"), "黄色")
- char.TalkToCli(talkerindex, -1, "您魔法点数:"..char.getInt(talkerindex,"魔法"), "黄色")
- char.TalkToCli(talkerindex, -1, "您升级点点数:"..char.getInt(talkerindex,"升级点"), "黄色")
- char.setInt(talkerindex,"转生次数",1)
- end
- if trans == 1 then --1转2
- char.TalkToCli(talkerindex, -1, "您体力点数:"..char.getInt(talkerindex,"体力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您腕力点数:"..char.getInt(talkerindex,"腕力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您耐力点数:"..char.getInt(talkerindex,"耐力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您速度点数:"..char.getInt(talkerindex,"速度"), "黄色")
- char.TalkToCli(talkerindex, -1, "您魔法点数:"..char.getInt(talkerindex,"魔法"), "黄色")
- char.TalkToCli(talkerindex, -1, "您升级点点数:"..char.getInt(talkerindex,"升级点"), "黄色")
- if char.getInt(talkerindex, "等级") < 450 then --等级不够
- char.TalkToCli(talkerindex, -1, "您当前转生次数:"..trans.."需要450级才能进修到下次转生!当前您等级不够请努力进修!", "黄色")
- return
- end
- --开始写转生需要处理的属性全部清0 在增加对应的属性
- char.setInt(talkerindex,"体力",0)
- char.setInt(talkerindex,"腕力",0)
- char.setInt(talkerindex,"耐力",0)
- char.setInt(talkerindex,"速度",0)
- char.setInt(talkerindex,"魔法",0)
- char.setInt(talkerindex,"升级点",1000)
- char.setInt(talkerindex, "等级",1)
- char.Updata(talkerindex,"全部")
- char.TalkToCli(talkerindex, -1, "您转生后的点数", "黄色")
- char.TalkToCli(talkerindex, -1, "您腕力点数:"..char.getInt(talkerindex,"腕力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您耐力点数:"..char.getInt(talkerindex,"耐力"), "黄色")
- char.TalkToCli(talkerindex, -1, "您速度点数:"..char.getInt(talkerindex,"速度"), "黄色")
- char.TalkToCli(talkerindex, -1, "您魔法点数:"..char.getInt(talkerindex,"魔法"), "黄色")
- char.TalkToCli(talkerindex, -1, "您升级点点数:"..char.getInt(talkerindex,"升级点"), "黄色")
- char.setInt(talkerindex,"转生次数",2)
- end
- end
-
- elseif seqno == 324 then
- if select == 1 then --
- num = other.atoi(data) --取软妹币要增加物品检测物品格子
- if checkEmptItemNum(talkerindex) == 0 then
- char.TalkToCli(talkerindex, meindex, "物品已满,请道具栏留有足够的空位!", "黄色")
- return
- end
- char.TalkToCli(talkerindex, -1, "您的背包空位置数量:"..checkEmptItemNum(talkerindex), "黄色")
- char.TalkToCli(talkerindex, -1, "您想要取出小金库软妹币:"..data, "黄色")
- if char.getInt(talkerindex,"金库金币") >= num then
- goldrest = char.getInt(talkerindex,"金库金币") - num
- npc.AddItem(talkerindex,473658,num)--给金卡
- --char.Updata(talkerindex,"魔币")--要刷新物品
- if goldrest >= 0 then
- char.setInt(talkerindex,"金库金币",goldrest)--设置剩余数量要检测下是不是还有
- end
- return
- else
- char.TalkToCli(talkerindex, -1, "您想要取的小金库金币太多了", "黄色")
- end
- end
-
- elseif seqno == 2 then
- end
- end
- function ShowWindow(meindex, talkerindex, page, maxpage, seqno, token, mytype)
- char.setWorkInt(talkerindex,"NPC临时11",page)
-
- if maxpage == 99 then
- button = 8
- elseif maxpage == 1 then
- button = 12
- elseif maxpage == 944 then
- button = 44
- elseif page == 1 and page < maxpage then
- button = 40
- elseif page > 1 and page < maxpage then
- button = 56
- elseif page == maxpage then
- button = 24
- end
-
- if mytype == 1 then
- lssproto.windows(talkerindex, "选择框", button, seqno, char.getWorkInt( meindex, "对象"), token)
- elseif mytype == 2 then
- lssproto.windows(talkerindex, "对话框", button, seqno, char.getWorkInt( meindex, "对象"), token)
- elseif mytype == 3 then
- lssproto.windows(talkerindex, "宽输入框", button, seqno, char.getWorkInt( meindex, "对象"), token)
- end
- end
- --NPC对话事件(NPC索引)
- function Talked(meindex, talkerindex, szMes, color )
- print("NPCindex")
- print (meindex)
- print("玩家index")
- print (talkerindex)
- if npc.isFaceToFace(meindex, talkerindex) == 1 then
- ShowHead(meindex, talkerindex)
- end
- end
- function RandomIndex(tabNum,indexNum)
- indexNum = indexNum or tabNum
- local t = {}
- local rt = {}
- for i = 1,indexNum do
- local ri = math.random(1,tabNum + 1 - i)
- local v = ri
- for j = 1,tabNum do
- if not t[j] then
- ri = ri - 1
- if ri == 0 then
- table.insert(rt,j)
- t[j] = true
- end
- end
- end
- end
- return rt
- end
- function Loop(meindex)
- print("陪练循环函数")
- char.RandRandWalk(meindex)
- --char.ToAroundChar(meindex)
- if char.getInt(meindex, "原图像号") == char.getInt(meindex, "图像号") then
- --print("1陪练循环函数")
- char.setInt(meindex, "图像号", 100100)
- --char.RandRandWalk(meindex)
- --char.ToAroundChar(meindex)
- --char.setInt(meindex, "循环事件时间", 2000)
- else
- --print("2陪练循环函数")
- char.setInt(meindex, "图像号", char.getInt(meindex, "原图像号"))
- --char.RandRandWalk(meindex)
- --char.setInt(meindex, "循环事件时间", 0)
- end
- --char.ToAroundChar(meindex)
- end
- --NPC重叠事件(NPC索引, 玩家索引)
- function Overlap(meindex, toindex)
- print()
- print("当前是踩踏事件")
- print( tonumber(os.date("%M", os.time())))--分钟
- battleindex = battle.CreateVsEnemy(toindex, meindex, enemytable)
- --[[char.setWorkInt(meindex, "NPC临时1", other.time() + 60)
- --战斗宠物数组,设置战斗的宠物ID,最大10只
- enemyid = char.getWorkInt(meindex, "NPC临时3")
- battleindex = battle.CreateVsEnemy(toindex, meindex, enemytable)]]
- end
- --[[
- function NetLoopFunction()
- print()
- print("当前小时")
- print( tonumber(os.date("%H", os.time())))--小时
- print("当前分钟")
- print( tonumber(os.date("%M", os.time())))--分钟
- end
- ]]
- --NPC战斗结束事件(NPC索引, 战斗索引,赢败)
- function BattleOver(meindex, battleindex, iswin)
- --当NPC输了
- print()
- print("当前是战斗后事件")
- print("战斗结束了")
- print(iswin)
- print()
- end
- function Create(name, metamo, floor, x, y, dir)
- --创建NPC(NPC名字,图像号,地图号,坐标X,坐标Y,方向号)将返回一个NPC索引
- npcindex = npc.CreateNpc(name, metamo, floor, x, y, dir)
- --设置事件触发(NPC索引,事件,执行函数,执行函数文件路径)
- char.setFunctionPointer(npcindex, "对话事件", "Talked", "")--ok
- char.setFunctionPointer(npcindex, "窗口事件", "WindowTalked", "")--ok
- char.setInt(npcindex, "循环事件时间", 50000)
- --char.setFunctionPointer(npcindex, "循环事件", "Loop", "")--NPC 走路还没OK 和 这个 没什么关系不能用这个走路要不同步不对应
- --char.setFunctionPointer(npcindex, "重叠事件", "Overlap", "") --ok
- --char.setFunctionPointer(npcindex, "战后事件", "BattleOver", "")
- end
- function data()
- TM_Gold = {0,0,0,0,0}
-
- TM_Vigor = {0,0,0,0,0}
-
- TM_SW = {0,0,0,0,0}
-
- TM_Point = {0,0,0,0,0}
- TM_MapName = {" 测试法兰城 "," 80级练级地图 "," 30级练级地图 "," 130级内心 ",""}
- --TM_MapName = {" 120级雷龙区 "," 90级雷龙区 "," 80级穿甲区 "," 130级草泥区 ",""}
- --TM_MapName = {" 120级雷龙区 "," 90级雷龙区 "," 80级穿甲区 ",""}
-
- --TM_Map = {500,11004,10001,34567,0}
- TM_Map = {1000,11004,10001,34567,0}
-
- EmptyTeamPlayer = {}
- FullTeamPlayer = {}
- EmptyTeamSold = {}
- FullTeamSold = {}
- enemytable = {enemyid, 1, 2, 3, 4, 5, 6, 1, 2, 3}
- end
- function main()
- data()
- Create("「 诛神转生师 」", 100000, 1000, 227, 87, 6)--1000, 227, 85, 6)
- end
复制代码
|
|