|
ReSetPetPoint.lua
- function ReSetPetPoint_Init( _MeIndex )
- Char.SetData(_MeIndex, %对象_形象%, 101157)
- Char.SetData(_MeIndex, %对象_原形%, 101157)
- Char.SetData(_MeIndex, %对象_地图%, 1998)
- Char.SetData(_MeIndex, %对象_X%, 8)
- Char.SetData(_MeIndex, %对象_Y%, 4)
- Char.SetData(_MeIndex, %对象_方向%, %右下%)
- Char.SetData(_MeIndex, %对象_原名%, "宠物工具")
- if (Char.SetTalkedEvent(nil, "ReSetPetPoint_Talked", _MeIndex) < 0) then
- print("ReSetPetPoint_Talked 註冊事件失敗。")
- return false
- end
- if (Char.SetWindowTalkedEvent(nil, "ReSetPetPoint_WindowTalked", _MeIndex) < 0) then
- print("ReSetPetPoint_WindowTalked 註冊事件失敗。")
- return false
- end
- return true
- end
- function ReSetPetPoint_Talked( _MeIndex, _TalkIndex, _Msg, _Color, _Channel)
- if NLG.CheckInFront(_TalkIndex, _MeIndex, 1) == false then
- return
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 1,
- " 「宠物工具」"..
- "\n"..
- "\n1、宠物工具可以自定义您所需要的宠物点数"..
- "\n2、设置成功以后您的宠物自动变成2转160级"..
- "\n3、宠物实际血攻防敏需按照后面的计算公式"..
- "\n4、宠物位置(1~5)"..
- "\n"..
- "\n请输入要设置的宠物位置",
- _MeIndex)
- end
- function ReSetPetPoint_WindowTalked( _MeIndex, _TalkIndex, _Seqno, _Select, _Data)
- if(_Select == 2) then
- return
- end
- if(_Seqno == 1) then
- petset_pos = tonumber(_Data) - 1
- Char.SetData(_TalkIndex,%对象_CN5%,petset_pos)
- else
- petset_pos = Char.GetData(_TalkIndex,%对象_CN5%)
- end
- local petindex = Char.GetPetIndex(_TalkIndex,petset_pos)
- if _Seqno ==1 then
-
- --设置转数
- Char.SetData(petindex , %对象_转数%, 2)
- --设置等级
- Char.SetData( petindex, %对象_等级%, 160)
- Char.SetData(petindex, %对象_反击%, 10)
- Char.SetData(petindex, %对象_暴击%, 10)
- Char.SetData(petindex,%对象_地%,0)
- Char.SetData(petindex,%对象_水%,0)
- Char.SetData(petindex,%对象_火%,0)
- Char.SetData(petindex,%对象_风%,0)
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 2,
- "\n每点体力:"..
- "\n增加 4 点耐久力"..
- "\n增加 0.1 点攻击力"..
- "\n增加 0.1 点防御力"..
- "\n增加 0 点敏捷力",
- _MeIndex)
- elseif _Seqno == 2 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_体力%, Char.GetData(petindex,%对象_体力%) + tonumber(_Data)*100)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 3,
- "\n每点攻击力:"..
- "\n增加 1 点耐久力"..
- "\n增加 1 点攻击力"..
- "\n增加 0.1 点防御力"..
- "\n增加 0 点敏捷力",
- _MeIndex)
- elseif _Seqno == 3 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_腕力%, Char.GetData(petindex,%对象_腕力%) + tonumber(_Data)*100)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 4,
- "\n每点防御力:"..
- "\n增加 1 点耐久力"..
- "\n增加 0.1 点攻击力"..
- "\n增加 1 点防御力"..
- "\n增加 0 点敏捷力",
- _MeIndex)
- elseif _Seqno == 4 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_耐力%, Char.GetData(petindex,%对象_耐力%) + tonumber(_Data)*100)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 5,
- "\n每点敏捷:"..
- "\n增加 1 点耐久力"..
- "\n增加 0.05 点攻击力"..
- "\n增加 0.05 点防御力"..
- "\n增加 1 点敏捷力",
- _MeIndex)
- elseif _Seqno == 5 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_速度%, Char.GetData(petindex,%对象_速度%) + tonumber(_Data)*100)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 6,
- "\n地属性1-10:",
- _MeIndex)
- elseif _Seqno == 6 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_地%, Char.GetData(petindex,%对象_地%) + tonumber(_Data)*10)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 7,
- "\n水属性1-10:",
- _MeIndex)
- elseif _Seqno == 7 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_水%, Char.GetData(petindex,%对象_水%) + tonumber(_Data)*10)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 8,
- "\n火属性1-10:",
- _MeIndex)
- elseif _Seqno == 8 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_火%, Char.GetData(petindex,%对象_火%) + tonumber(_Data)*10)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 9,
- "\n风属性1-10:",
- _MeIndex)
- elseif _Seqno == 9 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_风%, Char.GetData(petindex,%对象_风%) + tonumber(_Data)*10)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 10,
- "\n名称:",
- _MeIndex)
- elseif _Seqno == 10 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_原名%, _Data)
- Char.SetData( petindex, %对象_名称%, _Data)
- end
- NLG.ShowWindowTalked(_TalkIndex, 1, 3, 11,
- "\n形象:",
- _MeIndex)
- elseif _Seqno == 11 then
- if _Data ~= nil and _Data ~= "" then
- Char.SetData( petindex, %对象_形象%, tonumber(_Data))
- Char.SetData( petindex, %对象_原形%, tonumber(_Data))
- end
- Char.SetData(petindex,%对象_进化等级%,0)
- NLG.UpPet(_TalkIndex,petset_pos)
- end
-
- end
复制代码
ReSetPetPoint_init.lua
- function ReSetPetPoint_Reload()
- if (ReSetPetPoint_index == nil) then --这句检查NPC是否已经创建,防止重复创建
- ReSetPetPoint_index = NL.CreateNpc("./data/npc/lua/ReSetPetPoint/ReSetPetPoint.lua", "ReSetPetPoint_Init");
- NLG.UpChar(ReSetPetPoint_index);
- else
- NL.DelNpc(ReSetPetPoint_index);
- NLG.UpChar(ReSetPetPoint_index);
- ReSetPetPoint_index = nil;
- end
- end
- ReSetPetPoint_Reload();
复制代码
|
|