From 9e0d7d11aa6d6419b73a226687cc5b551b60819d Mon Sep 17 00:00:00 2001 From: Hao Zhang Date: Mon, 12 Jan 2026 16:24:10 +0800 Subject: [PATCH] =?UTF-8?q?adding=20=E4=B8=8D=E9=81=87=E6=95=8C=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/ng.lua | 213 ++++++++++++++++++++++++++----------------------- 1 file changed, 113 insertions(+), 100 deletions(-) diff --git a/Modules/ng.lua b/Modules/ng.lua index 2f9859d..a8a1c42 100644 --- a/Modules/ng.lua +++ b/Modules/ng.lua @@ -1,13 +1,13 @@ ----ģ +---模块类 ---@class ngModule: ModuleType local ngModule = ModuleBase:createModule('ng') --- ͨ +-- 普通玩家命令 local commandsNormal = {} local function addFrame(charIndex) --Char.DischargeParty(charIndex); - Char.SetData(charIndex, CONST.CHAR_, 200000); + Char.SetData(charIndex, CONST.CHAR_声望, 200000); end local function identity(player) @@ -15,15 +15,15 @@ local function identity(player) for itemSlot = 8, 27 do local ItemIndex = Char.GetItemIndex(player, itemSlot) if ItemIndex > 0 then - local money = Char.GetData(player, CONST.CHAR_); - local itemLv = Item.GetData(ItemIndex, CONST._ȼ); + local money = Char.GetData(player, CONST.CHAR_金币); + local itemLv = Item.GetData(ItemIndex, CONST.道具_等级); local price = itemLv * 200; - if Item.GetData(ItemIndex, CONST._Ѽ) == 0 and money >= (itemLv * 200) then + if Item.GetData(ItemIndex, CONST.道具_已鉴定) == 0 and money >= (itemLv * 200) then Count = Count + 1 - Char.SetData(player, CONST.CHAR_, money - price); - Item.SetData(ItemIndex, CONST._Ѽ, 1) - NLG.SystemMessage(player, "[ϵͳ] ĵߵȼΪ" .. itemLv .. "۳ħ" .. price .. "G"); - NLG.SystemMessage(player, "[ϵͳ] ϵ " .. Item.GetData(ItemIndex, CONST._ǰ) .. "ѼΪ " .. Item.GetData(ItemIndex, CONST._)) + Char.SetData(player, CONST.CHAR_金币, money - price); + Item.SetData(ItemIndex, CONST.道具_已鉴定, 1) + NLG.SystemMessage(player, "[系统] 您鉴定的道具等级为" .. itemLv .. "级。扣除魔币" .. price .. "G"); + NLG.SystemMessage(player, "[系统] 你身上的 " .. Item.GetData(ItemIndex, CONST.道具_鉴前名) .. "已鉴定为 " .. Item.GetData(ItemIndex, CONST.道具_名字)) Item.UpItem(player, itemSlot); NLG.UpChar(player); return ; @@ -31,7 +31,7 @@ local function identity(player) end end if Count == 0 then - NLG.SystemMessage(player, "[ϵͳ] ûҪƷǮԼ˵ߡ"); + NLG.SystemMessage(player, "[系统] 你身上没有需要鉴定的物品【或你的钱不足以鉴定此道具】"); return ; end return @@ -41,102 +41,102 @@ local function repairEquipment(player) local Count = 0 for ItemSlot = 8, 8 do local ItemIndex = Char.GetItemIndex(player, ItemSlot) - local money = Char.GetData(player, CONST.CHAR_); - local itemLv = Item.GetData(ItemIndex, CONST._ȼ); - local itemName = Item.GetData(ItemIndex, CONST._); - local itemDur = Item.GetData(ItemIndex, CONST._;); - local itemMaxDur = Item.GetData(ItemIndex, CONST._;); + local money = Char.GetData(player, CONST.CHAR_金币); + local itemLv = Item.GetData(ItemIndex, CONST.道具_等级); + local itemName = Item.GetData(ItemIndex, CONST.道具_名字); + local itemDur = Item.GetData(ItemIndex, CONST.道具_耐久); + local itemMaxDur = Item.GetData(ItemIndex, CONST.道具_最大耐久); local repairedDur = itemMaxDur - itemDur --local decMaxDur = repairedDur * 1 local price = repairedDur * 10 - local itemType = Item.GetData(ItemIndex, CONST._); + local itemType = Item.GetData(ItemIndex, CONST.道具_类型); if money > price and itemMaxDur > itemDur and itemType >= 0 and itemType <= 14 then Count = Count + 1 - Char.SetData(player, CONST.CHAR_, money - price); - --Item.SetData(ItemIndex, CONST._;, itemDur + xhnj); + Char.SetData(player, CONST.CHAR_金币, money - price); + --Item.SetData(ItemIndex, CONST.道具_耐久, itemDur + xhnj); --Item.UpItem(player, ItemSlot); - -- local djnj1 = Item.GetData(ItemIndex,CONST._;); - -- local djzdnj1 = Item.GetData(ItemIndex,CONST._;); - Item.SetData(ItemIndex, CONST._;, itemMaxDur); - Item.SetData(ItemIndex, CONST._;, itemMaxDur); - NLG.SystemMessage(player, "[ϵͳ] װ" .. itemName .. "ָˡ" .. repairedDur .. ";á۳ħҡ" .. price .. "G"); + -- local djnj1 = Item.GetData(ItemIndex,CONST.道具_耐久); + -- local djzdnj1 = Item.GetData(ItemIndex,CONST.道具_最大耐久); + Item.SetData(ItemIndex, CONST.道具_耐久, itemMaxDur); + Item.SetData(ItemIndex, CONST.道具_最大耐久, itemMaxDur); + NLG.SystemMessage(player, "[系统] 您修理的装备【" .. itemName .. "】恢复了【" .. repairedDur .. "】耐久。扣除魔币【" .. price .. "G】"); Item.UpItem(player, ItemSlot); NLG.UpChar(player); return end end if Count == 0 then - NLG.SystemMessage(player, "[ϵͳ] һûҪָ;õװħҲ㡣"); + NLG.SystemMessage(player, "[系统] 你道具栏第一格没有要恢复耐久的装备或者您的修理魔币不足。"); return end return end local function spriteRepair(player) - local ZH = Char.GetData(player, CONST.CHAR_); - local money = Char.GetData(player, CONST.CHAR_); - local LV = Char.GetData(player, CONST.CHAR_ȼ); + local ZH = Char.GetData(player, CONST.CHAR_掉魂); + local money = Char.GetData(player, CONST.CHAR_金币); + local LV = Char.GetData(player, CONST.CHAR_等级); local ZHMB = ZH * 200; local ZHMBKC = ZHMB * LV if ZH <= 0 then - NLG.SystemMessage(player, "ûеꡣ"); + NLG.SystemMessage(player, "你没有掉魂。"); end if money >= ZHMBKC and ZH > 0 then - Char.SetData(player, CONST.CHAR_, money - ZHMBKC); - Char.SetData(player, CONST.CHAR_, 0); + Char.SetData(player, CONST.CHAR_金币, money - ZHMBKC); + Char.SetData(player, CONST.CHAR_掉魂, 0); Char.FeverStop(player); NLG.UpChar(player); - NLG.SystemMessage(player, "лɡлΪ" .. ZH .. "Ϊ" .. ZHMBKC .. "ħҡ"); + NLG.SystemMessage(player, "招魂完成。招魂数量为【" .. ZH .. "】费用为【" .. ZHMBKC .. "】魔币。"); end if money < ZHMBKC then - NLG.SystemMessage(player, "Ǯû㻹л꣬һȥɡл۸ *1000*ȼ"); + NLG.SystemMessage(player, "连钱都没有你还招魂,一边尿尿玩泥巴去吧。【招魂价格计算 掉魂*1000*等级】"); end end local function healthRepair(player) - local i = Char.GetData(player, CONST.CHAR_); - local money = Char.GetData(player, CONST.CHAR_); - if (Char.GetData(player, CONST.CHAR_) < 1) then - NLG.SystemMessage(player, "δˡ"); + local i = Char.GetData(player, CONST.CHAR_受伤); + local money = Char.GetData(player, CONST.CHAR_金币); + if (Char.GetData(player, CONST.CHAR_受伤) < 1) then + NLG.SystemMessage(player, "您未受伤。"); return ; end - if (money >= 200) and (Char.GetData(player, CONST.CHAR_) > 0 and Char.GetData(player, CONST.CHAR_) < 26) then - Char.SetData(player, CONST.CHAR_, 0); - Char.SetData(player, CONST.CHAR_, money - 200); + if (money >= 200) and (Char.GetData(player, CONST.CHAR_受伤) > 0 and Char.GetData(player, CONST.CHAR_受伤) < 26) then + Char.SetData(player, CONST.CHAR_受伤, 0); + Char.SetData(player, CONST.CHAR_金币, money - 200); NLG.UpdateParty(player); NLG.UpChar(player); - NLG.SystemMessage(player, "ϲϡ"); - NLG.SystemMessage(player, "۳200ħҡ"); + NLG.SystemMessage(player, "恭喜你治疗完毕。"); + NLG.SystemMessage(player, "扣除200魔币。"); return ; end - if (money >= 400) and (Char.GetData(player, CONST.CHAR_) > 24 and Char.GetData(player, CONST.CHAR_) < 51) then - Char.SetData(player, CONST.CHAR_, 0); - Char.SetData(player, CONST.CHAR_, money - 400); + if (money >= 400) and (Char.GetData(player, CONST.CHAR_受伤) > 24 and Char.GetData(player, CONST.CHAR_受伤) < 51) then + Char.SetData(player, CONST.CHAR_受伤, 0); + Char.SetData(player, CONST.CHAR_金币, money - 400); NLG.UpdateParty(player); NLG.UpChar(player); - NLG.SystemMessage(player, "ϲϡ"); - NLG.SystemMessage(player, "۳400ħҡ"); + NLG.SystemMessage(player, "恭喜你治疗完毕。"); + NLG.SystemMessage(player, "扣除400魔币。"); return ; end - if (money >= 800) and (Char.GetData(player, CONST.CHAR_) > 49 and Char.GetData(player, CONST.CHAR_) < 76) then - Char.SetData(player, CONST.CHAR_, 0); - Char.SetData(player, CONST.CHAR_, money - 800); + if (money >= 800) and (Char.GetData(player, CONST.CHAR_受伤) > 49 and Char.GetData(player, CONST.CHAR_受伤) < 76) then + Char.SetData(player, CONST.CHAR_受伤, 0); + Char.SetData(player, CONST.CHAR_金币, money - 800); NLG.UpdateParty(player); NLG.UpChar(player); - NLG.SystemMessage(player, "ϲϡ"); - NLG.SystemMessage(player, "۳800ħҡ"); + NLG.SystemMessage(player, "恭喜你治疗完毕。"); + NLG.SystemMessage(player, "扣除800魔币。"); return ; end - if (money >= 1000) and (Char.GetData(player, CONST.CHAR_) > 74 and Char.GetData(player, CONST.CHAR_) < 101) then - Char.SetData(player, CONST.CHAR_, 0); - Char.SetData(player, CONST.CHAR_, money - 1000); + if (money >= 1000) and (Char.GetData(player, CONST.CHAR_受伤) > 74 and Char.GetData(player, CONST.CHAR_受伤) < 101) then + Char.SetData(player, CONST.CHAR_受伤, 0); + Char.SetData(player, CONST.CHAR_金币, money - 1000); NLG.UpdateParty(player); NLG.UpChar(player); - NLG.SystemMessage(player, "ϲϡ"); - NLG.SystemMessage(player, "۳1000ħҡ"); + NLG.SystemMessage(player, "恭喜你治疗完毕。"); + NLG.SystemMessage(player, "扣除1000魔币。"); return ; else - NLG.SystemMessage(player, "ԲħҲ㣬Ƽ۸Ϊ2004008001000"); + NLG.SystemMessage(player, "对不起!您的魔币不足,治疗价格为【白伤200】【黄伤400】【紫伤800】【红伤1000】!"); return ; end return 0 @@ -148,10 +148,10 @@ function commandsNormal.where(charIndex, args) target = tonumber(args[1]) end NLG.TalkToCli(charIndex, -1, target .. - ' ͼ:' .. tostring(Char.GetData(target, CONST.CHAR_ͼ)) .. '/' .. tostring(Char.GetData(target, CONST.CHAR_ͼ)) .. + ' 地图:' .. tostring(Char.GetData(target, CONST.CHAR_地图)) .. '/' .. tostring(Char.GetData(target, CONST.CHAR_地图类型)) .. ', X:' .. tostring(Char.GetData(target, CONST.CHAR_X)) .. ', Y:' .. tostring(Char.GetData(target, CONST.CHAR_Y)) .. - ', :' .. tostring(Char.GetData(target, CONST.CHAR_)) + ', 方向:' .. tostring(Char.GetData(target, CONST.CHAR_方向)) ) end @@ -166,9 +166,9 @@ function commandsNormal.char(charIndex, args) end -- function commandsNormal.rank4(charIndex) --- if Char.GetData(charIndex, CONST.CHAR_ְ) == 3 and Char.GetData(charIndex, CONST.CHAR_ȼ) >= 100 then --- Char.SetData(charIndex, CONST.CHAR_ְ, 4); --- Char.SetData(charIndex, CONST.CHAR_ְҵ, Char.GetData(charIndex, CONST.CHAR_ְҵ) + 1); +-- if Char.GetData(charIndex, CONST.CHAR_职阶) == 3 and Char.GetData(charIndex, CONST.CHAR_等级) >= 100 then +-- Char.SetData(charIndex, CONST.CHAR_职阶, 4); +-- Char.SetData(charIndex, CONST.CHAR_职业, Char.GetData(charIndex, CONST.CHAR_职业) + 1); -- NLG.UpChar(charIndex); -- end -- end @@ -185,16 +185,16 @@ function commandsNormal.item(charIndex, args) end --function commandsNormal.changeSex(charIndex, args) --- print( Char.GetData(charIndex, CONST.CHAR_), Char.GetData(charIndex, CONST.CHAR_ԭ), Char.GetData(charIndex, CONST.CHAR_ԭʼͼ)) +-- print( Char.GetData(charIndex, CONST.CHAR_形象), Char.GetData(charIndex, CONST.CHAR_原形), Char.GetData(charIndex, CONST.CHAR_原始图档)) -- --if args[1] then --- -- Char.SetData(charIndex, CONST.CHAR_, args[1]); +-- -- Char.SetData(charIndex, CONST.CHAR_形象, args[1]); -- --else --- -- Char.SetData(charIndex, CONST.CHAR_, Char.GetData(charIndex, CONST.CHAR_ԭ)); +-- -- Char.SetData(charIndex, CONST.CHAR_形象, Char.GetData(charIndex, CONST.CHAR_原形)); -- --end --end function commandsNormal.daka(charIndex) - Char.SetData(charIndex, CONST.CHAR_ʱ, 99 * 3600); + Char.SetData(charIndex, CONST.CHAR_卡时, 99 * 3600); if Char.IsFeverTime(charIndex) == 1 then Char.FeverStop(charIndex) else @@ -204,12 +204,12 @@ function commandsNormal.daka(charIndex) end function commandsNormal.redoDp(charIndex) - local total = (Char.GetData(charIndex, CONST.CHAR_ȼ) - 1) * 4 + 30; - local s = { CONST.CHAR_, CONST.CHAR_, CONST.CHAR_ǿ, CONST.CHAR_ٶ, CONST.CHAR_ħ } + local total = (Char.GetData(charIndex, CONST.CHAR_等级) - 1) * 4 + 30; + local s = { CONST.CHAR_体力, CONST.CHAR_力量, CONST.CHAR_强度, CONST.CHAR_速度, CONST.CHAR_魔法 } for i, v in pairs(s) do Char.SetData(charIndex, v, 0); end - Char.SetData(charIndex, CONST.CHAR_, total); + Char.SetData(charIndex, CONST.CHAR_升级点, total); NLG.UpChar(charIndex) end @@ -217,6 +217,18 @@ function commandsNormal.encount(charIndex) Battle.Encount(charIndex, charIndex); end +function commandsNormal.noEncount(charIndex) + local kg = Char.GetData(charIndex,CONST.对象_不遇敌开关); + if kg == 0 then + Char.SetData(charIndex, CONST.对象_不遇敌开关, 1) + NLG.SystemMessage(charIndex, "不遇敌已经开启!"); + else + Char.SetData(charIndex, CONST.对象_不遇敌开关, 0) + NLG.SystemMessage(charIndex, "不遇敌已经关闭!"); + end + NLG.UpChar(charIndex) +end + function commandsNormal.goHome(charIndex) --Char.DischargeParty(charIndex); Char.Warp(charIndex, 0, 1000, 236, 88); @@ -228,16 +240,16 @@ local function getPetBp(player, args) local pet = Char.GetPet(player, i); if (pet >= 0) then hasPet = true; - local arr_rank1 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank11 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank2 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank21 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank3 = Pet.GetArtRank(pet, CONST.PET_ǿ); - local arr_rank31 = Pet.FullArtRank(pet, CONST.PET_ǿ); - local arr_rank4 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank41 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank5 = Pet.GetArtRank(pet, CONST.PET_ħ); - local arr_rank51 = Pet.FullArtRank(pet, CONST.PET_ħ); + local arr_rank1 = Pet.GetArtRank(pet, CONST.PET_体成); + local arr_rank11 = Pet.FullArtRank(pet, CONST.PET_体成); + local arr_rank2 = Pet.GetArtRank(pet, CONST.PET_力成); + local arr_rank21 = Pet.FullArtRank(pet, CONST.PET_力成); + local arr_rank3 = Pet.GetArtRank(pet, CONST.PET_强成); + local arr_rank31 = Pet.FullArtRank(pet, CONST.PET_强成); + local arr_rank4 = Pet.GetArtRank(pet, CONST.PET_敏成); + local arr_rank41 = Pet.FullArtRank(pet, CONST.PET_敏成); + local arr_rank5 = Pet.GetArtRank(pet, CONST.PET_魔成); + local arr_rank51 = Pet.FullArtRank(pet, CONST.PET_魔成); local a1 = (arr_rank1 - arr_rank11); local a2 = (arr_rank2 - arr_rank21); local a3 = (arr_rank3 - arr_rank31); @@ -245,16 +257,16 @@ local function getPetBp(player, args) local a5 = (arr_rank5 - arr_rank51); local a6 = a1 + a2 + a3 + a4 + a5; local a61 = arr_rank1 + arr_rank2 + arr_rank3 + arr_rank4 + arr_rank5; - NLG.SystemMessage(player, Char.GetData(pet, CONST.CHAR_) .. ":" .. a61 .. "" .. a6 .. ')') - NLG.SystemMessage(player, ":" .. arr_rank1 .. "(" .. a1 .. ") :" .. arr_rank2 .. "(" .. a2 .. ") ǿ:" .. arr_rank3 .. "(" .. a3 .. ") :" .. - arr_rank4 .. "(" .. a4 .. ") ħ:" .. arr_rank5 .. "(" .. a5 .. ")"); + NLG.SystemMessage(player, Char.GetData(pet, CONST.CHAR_名字) .. "总:" .. a61 .. "(" .. a6 .. ')') + NLG.SystemMessage(player, "体:" .. arr_rank1 .. "(" .. a1 .. ") 力:" .. arr_rank2 .. "(" .. a2 .. ") 强:" .. arr_rank3 .. "(" .. a3 .. ") 敏:" .. + arr_rank4 .. "(" .. a4 .. ") 魔:" .. arr_rank5 .. "(" .. a5 .. ")"); end end if not args[2] then if hasPet then NLG.SystemMessage(player, "-----------------------------------"); else - NLG.SystemMessage(player, "ûг"); + NLG.SystemMessage(player, "没有宠物"); end end end @@ -262,22 +274,22 @@ end local function petRebirth(player, args) local pet = Char.GetPet(player, tonumber(args[2])); if pet >= 0 then - local s = { CONST.PET_, CONST.PET_, CONST.PET_ǿ, CONST.PET_, CONST.PET_ħ }; + local s = { CONST.PET_体成, CONST.PET_力成, CONST.PET_强成, CONST.PET_敏成, CONST.PET_魔成 }; for i, v in pairs(s) do local r = Pet.FullArtRank(pet, v); Pet.SetArtRank(pet, v, r - math.random(0, 4)) end Pet.ReBirth(player, pet); - local arr_rank1 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank11 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank2 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank21 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank3 = Pet.GetArtRank(pet, CONST.PET_ǿ); - local arr_rank31 = Pet.FullArtRank(pet, CONST.PET_ǿ); - local arr_rank4 = Pet.GetArtRank(pet, CONST.PET_); - local arr_rank41 = Pet.FullArtRank(pet, CONST.PET_); - local arr_rank5 = Pet.GetArtRank(pet, CONST.PET_ħ); - local arr_rank51 = Pet.FullArtRank(pet, CONST.PET_ħ); + local arr_rank1 = Pet.GetArtRank(pet, CONST.PET_体成); + local arr_rank11 = Pet.FullArtRank(pet, CONST.PET_体成); + local arr_rank2 = Pet.GetArtRank(pet, CONST.PET_力成); + local arr_rank21 = Pet.FullArtRank(pet, CONST.PET_力成); + local arr_rank3 = Pet.GetArtRank(pet, CONST.PET_强成); + local arr_rank31 = Pet.FullArtRank(pet, CONST.PET_强成); + local arr_rank4 = Pet.GetArtRank(pet, CONST.PET_敏成); + local arr_rank41 = Pet.FullArtRank(pet, CONST.PET_敏成); + local arr_rank5 = Pet.GetArtRank(pet, CONST.PET_魔成); + local arr_rank51 = Pet.FullArtRank(pet, CONST.PET_魔成); local a1 = (arr_rank1 - arr_rank11); local a2 = (arr_rank2 - arr_rank21); local a3 = (arr_rank3 - arr_rank31); @@ -285,9 +297,9 @@ local function petRebirth(player, args) local a5 = (arr_rank5 - arr_rank51); local a6 = a1 + a2 + a3 + a4 + a5; local a61 = arr_rank1 + arr_rank2 + arr_rank3 + arr_rank4 + arr_rank5; - NLG.SystemMessage(player, Char.GetData(pet, CONST.CHAR_) .. ":" .. a61 .. "" .. a6 .. ')') - NLG.SystemMessage(player, ":" .. arr_rank1 .. "(" .. a1 .. ") :" .. arr_rank2 .. "(" .. a2 .. ") ǿ:" .. arr_rank3 .. "(" .. a3 .. ") :" .. - arr_rank4 .. "(" .. a4 .. ") ħ:" .. arr_rank5 .. "(" .. a5 .. ")"); + NLG.SystemMessage(player, Char.GetData(pet, CONST.CHAR_名字) .. "总:" .. a61 .. "(" .. a6 .. ')') + NLG.SystemMessage(player, "体:" .. arr_rank1 .. "(" .. a1 .. ") 力:" .. arr_rank2 .. "(" .. a2 .. ") 强:" .. arr_rank3 .. "(" .. a3 .. ") 敏:" .. + arr_rank4 .. "(" .. a4 .. ") 魔:" .. arr_rank5 .. "(" .. a5 .. ")"); end end @@ -315,15 +327,16 @@ function ngModule:handleTalkEvent(charIndex, msg) return 1; end ---- ģ鹳 +--- 加载模块钩子 function ngModule:onLoad() self:logInfo('load') self:regCallback('TalkEvent', Func.bind(self.handleTalkEvent, self)) end ---- жģ鹳 +--- 卸载模块钩子 function ngModule:onUnload() self:logInfo('unload') end return ngModule; +