- function ShowHead(meindex, talkerindex)
- if npc.isFaceToFace(meindex, talkerindex) == 1 then
- token = "3 『" .. char.getChar(meindex, "名字") .. "』\n"
- .."\n 请问您需要些什么服务呢??"
- .."\n 〖更换宠物外形〗"
- .."\n 〖恢复宠物外形〗"
- lssproto.windows(talkerindex, "选择框", "取消", 1, char.getWorkInt( meindex, "对象"), token)
- end
- end
- function Talked(meindex, talkerindex , szMes, color )
- if npc.isFaceToFace(meindex, talkerindex) == 1 then
- ShowHead(meindex, talkerindex)
- end
- end
- function WindowTalked ( meindex, talkerindex, seqno, select, data)
- if seqno == 1 then
- if select == 2 or select == 8 then
- return
- end
- local num = other.atoi(data)
- if num == 1 then
- local str
- if paymod == 1 then
- str = "\n需要消耗〖" ..TM_JINBI.."金币〗\n按确定开始变身!"
- elseif paymod == 2 then
- str = "\n需要消耗〖" ..TM_Fame.."声望〗与〖" ..TM_Vigor.."活力〗\n按确定开始变身!"
- end
- token = "\n宠物可互换外形,互换后不增加宠物属性"
- .."\n ★★被提取外形的宠物会被删除★★"
- .."\n ★★骑宠转换后不可骑乘★★"
- .."\n ★★可骑乘的宠物不可提取外形★★"
- ..str
- lssproto.windows(talkerindex, "对话框", "确定|取消", 2, char.getWorkInt( meindex, "对象"), token)
- elseif num == 2 then
- if paymod == 1 then
- token = "\n" .. "\n恢复宠物外形\n需要消耗〖" ..TM_JINBI.."金币〗\n按确定开始变身!"
- elseif paymod == 2 then
- token = "\n" .. "\n恢复宠物外形\n需要消耗〖" ..TM_Fame.."声望〗与〖" ..TM_Vigor.."活力〗\n按确定开始变身!"
- end
- lssproto.windows(talkerindex, "对话框", "确定", 7, char.getWorkInt( meindex, "对象"), token)
- end
- elseif seqno == 2 then
- if select == 1 or select == 4 then
- if paymod == 1 then
- local TM_MYJB = sasql.getVipPoint(talkerindex)
- if TM_MYJB<TM_JINBI then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗你的金币都不够,还想更换宠物外形?!", "随机色")
- return
- end
- elseif paymod == 2 then
- local TM_MySW = char.getInt(talkerindex, "声望")
- local TM_MyHL = char.getInt(talkerindex, "活力")
-
- if TM_MySW < TM_Fame*100 then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的声望都不够,还想更换宠物外形?多挂机少说话~", "随机色")
- return
- end
-
- if TM_MyHL < TM_Vigor then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的活力都不够,这次是帮不到你了,多在线点时间,活力自然就多了。", "随机色")
- return
- end
- end
- token = "\n"
- .. "\n请选择需要换皮肤的宠物"
- lssproto.windows(talkerindex, "对话框", "确定", 3, char.getWorkInt( meindex, "对象"), token)
- end
- elseif seqno == 3 then
- lssproto.windows(talkerindex, "宠物框", "取消", 4, char.getWorkInt( meindex, "对象"), "")
- elseif seqno == 4 then
- pethaveid1 = other.atoi(data)
- if pethaveid1 < 1 or pethaveid1 > 5 then
- return
- end
- TM_PetIndex1 = char.getCharPet(talkerindex,pethaveid1-1)
- pet1 = TM_PetIndex1
- petpic1 = char.getInt(TM_PetIndex1,"图像号")
- yuanpetpic1 = char.getInt(TM_PetIndex1,"整数存储1")
- if yuanpetpic1 == pet1pic1 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗此宠物曾经已经更换过外形,请恢复原本的样子再来吧!", "随机色")
- return
- elseif yuanpetpic1 ~= 0 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗此宠物已经更换过外形,请恢复原本的样子再来吧!", "随机色")
- return
- end
- for i=1, #_PET do
- if _PET[i] == petpic1 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗此宠物无法变更外形!", "随机色")
- return
- end
- end
-
- token = "\n"
- .. "\n 请选择用哪只宠物的外形"
- .. "\n ★★被提取外形的宠物会被删除★★"
- .. "\n ★★请慎重考虑好再点确定★★"
- lssproto.windows(talkerindex, "对话框", "确定", 5, char.getWorkInt( meindex, "对象"), token)
- elseif seqno == 5 then
- lssproto.windows(talkerindex, "宠物框", "取消", 6, char.getWorkInt( meindex, "对象"), "")
- elseif seqno == 6 then
- pethaveid2 = other.atoi(data)
- if pethaveid2 < 1 or pethaveid2 > 5 then
- return
- end
- TM_PetIndex2 = char.getCharPet(talkerindex,pethaveid2-1)
- pet2 = TM_PetIndex2
- petpic2 = char.getInt(TM_PetIndex2,"图像号")
-
- if pet1 == pet2 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗同一只宠物无法更换外形", "随机色")
- return
- elseif petpic2 == petpic1 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗两只一样外形的宠物无法更换外形", "随机色")
- return
- elseif char.getInt(TM_PetIndex2,"整数存储1") ~= 0 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗更换过外形的宠物无法提取形象,请先恢复宠物外形", "随机色")
- return
- end
- for i=1 , #_RIDE do
- if _RIDE[i] == petpic2 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗更换外形失败,骑宠无法提取外形。", "随机色")
- return
- end
- end
- if paymod == 1 then
- local TM_MYJB = sasql.getVipPoint(talkerindex)
- if TM_MYJB<TM_JINBI then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗你的金币都不够,还想更换宠物外形?!", "随机色")
- return
- end
- sasql.setVipPoint(talkerindex,TM_MYJB-TM_JINBI)
- elseif paymod == 2 then
- local TM_MySW = char.getInt(talkerindex, "声望")
- local TM_MyHL = char.getInt(talkerindex, "活力")
- if TM_MySW < TM_Fame*100 then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的声望都不够,还想换宠物外形?多挂机少说话~", "随机色")
- return
- end
- if TM_MyHL < TM_Vigor then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的活力都不够,这次是帮不到你了,多在线点时间,活力自然就多了。", "随机色")
- return
- end
- char.setInt(talkerindex, "声望", char.getInt(talkerindex, "声望") - TM_Fame*100)
- char.setInt(talkerindex, "活力", char.getInt(talkerindex, "活力") - TM_Vigor)
- end
- --char.TalkToCli(talkerindex, -1, "更换前pet1图像号"..char.getInt(pet1,"图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换前pet2图像号".. char.getInt(pet2,"图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换前pet1原图像号"..char.getInt(pet1,"原图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换前pet2原图像号"..char.getInt(pet2,"原图像号"), "随机色")
- char.setInt(pet1,"图像号",petpic2)
- char.setInt(pet2,"图像号",petpic1)
- char.setInt(pet1,"原图像号",petpic2)
- char.setInt(pet2,"原图像号",petpic1)
- char.setInt(TM_PetIndex1,"整数存储1",petpic1)
- char.setInt(TM_PetIndex2,"整数存储1",petpic2)
- --char.TalkToCli(talkerindex, -1, "更换后整数存储1="..char.getInt(TM_PetIndex1,"整数存储1"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换后pet1图像号"..char.getInt(pet1,"图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换后pet2图像号"..char.getInt(pet2,"图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换后pet1原图像号"..char.getInt(pet1,"原图像号"), "随机色")
- --char.TalkToCli(talkerindex, -1, "更换后pet2原图像号"..char.getInt(pet2,"原图像号"), "随机色")
- char.sendStatusString(talkerindex, "K" .. pethaveid1 - 1)
- char.sendStatusString(talkerindex, "K" .. pethaveid2 - 1)
- if deletepet == 1 then
- char.DelPet(talkerindex, pet2)--删除被提取外形的宠物
- end
- if paymod == 1 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_JINBI.." 金币!" , "随机色")
- elseif paymod == 2 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_Fame.." 声望!" , "随机色")
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_Vigor.." 活力!" , "随机色")
- end
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗恭喜您的宠物成功改变外形。" , "随机色")
- elseif seqno == 7 then
- lssproto.windows(talkerindex, "宠物框", "取消", 8, char.getWorkInt( meindex, "对象"), "")
- elseif seqno == 8 then
-
- pethaveid1 = other.atoi(data)
- if pethaveid1 < 1 or pethaveid1 > 5 then
- return
- end
- if paymod == 1 then
- local TM_MYJB = sasql.getVipPoint(talkerindex)
- if TM_MYJB<TM_JINBI then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗你的金币都不够,还想更换宠物外形?!", "随机色")
- return
- end
- sasql.setVipPoint(talkerindex,TM_MYJB-TM_JINBI)
- elseif paymod == 2 then
- local TM_MySW = char.getInt(talkerindex, "声望")
- local TM_MyHL = char.getInt(talkerindex, "活力")
-
- if TM_MySW < TM_Fame*100 then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的声望都不够,还想换宠物外形?多挂机少说话~", "随机色")
- return
- end
-
- if TM_MyHL < TM_Vigor then
- char.TalkToCli(talkerindex, meindex, "〖温馨提示〗你的活力都不够,这次是帮不到你了,多在线点时间,活力自然就多了。", "随机色")
- return
- end
- char.setInt(talkerindex, "声望", char.getInt(talkerindex, "声望") - TM_Fame*100)
- char.setInt(talkerindex, "活力", char.getInt(talkerindex, "活力") - TM_Vigor)
- end
- TM_PetIndex1 = char.getCharPet(talkerindex,pethaveid1-1)
- pet1 = TM_PetIndex1
- petpic1 = char.getInt(TM_PetIndex1,"图像号")
- yuanpetpic1 = char.getInt(TM_PetIndex1,"整数存储1")
- if yuanpetpic1 == 0 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗宠物已经是原本的形象,无需恢复", "随机色")
- return
- end
- char.setInt(pet1,"图像号",yuanpetpic1)
- char.setInt(pet1,"原图像号",yuanpetpic1)
- char.setInt(TM_PetIndex1,"整数存储1",0)
- char.sendStatusString(talkerindex, "K" .. pethaveid1 - 1)
- if paymod == 1 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_JINBI.." 金币!" , "随机色")
- elseif paymod == 2 then
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_Fame.." 声望!" , "随机色")
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗变身消耗了您 "..TM_Vigor.." 活力!" , "随机色")
- end
- char.TalkToCli(talkerindex, -1, "〖温馨提示〗恭喜您的宠物外形成功恢复。" , "随机色")
- elseif seqno == 9 then
- return
- end
-
- end
- function Create(name, metamo, floor, x, y, dir)
- npcindex = npc.CreateNpc(name, metamo, floor, x, y, dir)
- char.setFunctionPointer(npcindex, "对话事件", "Talked", "")
- char.setFunctionPointer(npcindex, "窗口事件", "WindowTalked", "")
- end
- function data()
- pet1 = 0
- pet2 = 0
- petpic1 = 0
- petpic2 = 0
- yuanpetpic1 = 0
- yuanpetpic2 = 0
- pethaveid1 = 0
- pethaveid2 = 0
- TM_PetIndex1 = 0
- TM_PetIndex2 = 0
- paymod = 1 --付款方式1为金币2为声望活力
- TM_JINBI = 50 --需要金币
- TM_Fame = 1 --需要声望
- TM_Vigor = 1 --需要活力
- deletepet = 1 --是否删除被提取外形的宠物1为是0为不删除
- _PET = {101427,101424,101425,101426}--不能更换形象的宠物
- _RIDE = {100327,100328,100329,100330}--不能提取形象的宠物
- end
- function main()
- Create("宠物换肤大师", 100780, 2000, 61, 33, 4)
- data()
- end
复制代码
|