一朵物语

标题: 剑3插件语言 [打印本页]

作者: 丨一朵丶大脑壳    时间: 2009-6-9 21:52
标题: 剑3插件语言
本帖最后由 丨一朵丶大脑壳 于 2009-6-9 21:56 编辑

今天发现最可能的就是LUA了就连二测都有,不信用搜索 *.LUA 所以赶快去学习这个。同志加油哦。这下面可能是个更新的,但是还没确定引用的函数,所以不知道啦,争取在没公布之前,找到嘿嘿.
-----------------------------------------------------------------------------
local tNotifyList = {}
local NORMAL_FONT = 162
local STRESS_FONT = 163
function OnBattleFieldNotify(dwMapID, nNotifyType, nAvgQueueTime, nPassTime, nTimeIndex, nSerialNumber)
-- update data
if nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.QUEUE_INFO
or nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.JOIN_BATTLE_FIELD then
  if not tNotifyList[dwMapID] then
   tNotifyList[dwMapID] = {}
   FireEvent("BATTLE_FIELD_STATE_UPDATE")
  end
  tNotifyList[dwMapID].nNotifyType = nNotifyType
  tNotifyList[dwMapID].nAvgQueueTime = nAvgQueueTime
  tNotifyList[dwMapID].nPassTime = nPassTime
  tNotifyList[dwMapID].nTimeIndex = nTimeIndex
  tNotifyList[dwMapID].nSerialNumber = nSerialNumber
elseif nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.LEAVE_BATTLE_FIELD then
  CloseMessageBox("BattleField_Enter_" .. dwMapID)
  tNotifyList[dwMapID] = nil
  FireEvent("BATTLE_FIELD_STATE_UPDATE")
end

if nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.JOIN_BATTLE_FIELD then
  if not tNotifyList[dwMapID].bRemind then
   local tMsg =
   {
    szMessage = FormatString(
     g_tStrings.STR_BATTLEFIELD_MESSAGE_ENTER,
     GetBattleFieldQueueName(dwMapID, tNotifyList[dwMapID].nTimeIndex, tNotifyList[dwMapID].nSerialNumber)
    ),
    szName = "BattleField_Enter_" .. dwMapID,
    {szOption = g_tStrings.STR_HOTKEY_ENTER, fnAction = function() DoAcceptJoinBattleField(dwMapID, nTimeIndex, nSerialNumber) end, },
    {szOption = g_tStrings.STR_HOTKEY_HIDE, },
    {szOption = g_tStrings.STR_HOTKEY_LEAVE, fnAction = function() DoLeaveBattleFieldQueue(dwMapID) end, },
   }
   MessageBox(tMsg)
   tNotifyList[dwMapID].bRemind = true
  end
end
end
function GetCurrentBattleField()
return tNotifyList
end
function GetBattleFieldStateTip()
local szTip = nil

if IsInBattleField() then
  local hScene = GetClientPlayer().GetScene()
  local szBattleFiledName = GetBattleFieldQueueName(hScene.dwMapID, nil, hScene.GetSerialNumber())
  if szBattleFiledName then
   szTip = GetFormatText(g_tStrings.STR_BATTLEFIELD_FIGHTING, NORMAL_FONT) .. GetFormatText(szBattleFiledName, STRESS_FONT)
  end
end
  
for dwMapID, tData in pairs(tNotifyList) do
  local szSubTip = nil
  if tData.nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.QUEUE_INFO then
   szSubTip = FormatBattleFieldQueueTip(
    GetBattleFieldQueueName(dwMapID, tData.nTimeIndex, tData.nSerialNumber),
    tData.nPassTime,
    tData.nAvgQueueTime
   )
  elseif tData.nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.JOIN_BATTLE_FIELD then
   szSubTip = FormatBattleFieldJoinTip(
    GetBattleFieldQueueName(dwMapID, tData.nTimeIndex, tData.nSerialNumber),  
    MAX_BATTLE_FIELD_OVERTIME - tData.nPassTime
   )
  end
  if szSubTip then
   if szTip then
    szTip = szTip .. GetFormatText("\n\n", NORMAL_FONT) .. szSubTip
   else
    szTip = szSubTip
   end
  end
end
return szTip
end
function GetBattleFieldMenu()
local tMenu = nil

if IsInBattleField() then
  tMenu = { { szOption = g_tStrings.STR_BATTLEFIELD_MENU_LEAVE, fnAction = function() LeaveBattleField() end, } }
end

for dwMapID, tData in pairs(tNotifyList) do
  if tData.nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.QUEUE_INFO
  or tData.nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.JOIN_BATTLE_FIELD then
   if tMenu then
    table.insert(tMenu, {bDevide = true})
   else
    tMenu = {}
   end
   
   table.insert(tMenu, { szOption = GetBattleFieldQueueName(dwMapID, tData.nTimeIndex, tData.nSerialNumber), bDisable = true, nFont = STRESS_FONT, })
   if tData.nNotifyType == BATTLE_FIELD_NOTIFY_TYPE.JOIN_BATTLE_FIELD then
    table.insert(tMenu, { szOption = g_tStrings.STR_BATTLEFIELD_MENU_ENTER, fnAction = function() DoAcceptJoinBattleField(dwMapID, tData.nTimeIndex, tData.nSerialNumber) end, })
   end
   table.insert(tMenu, { szOption = g_tStrings.STR_BATTLEFIELD_MENU_LEAVE, fnAction = function() DoLeaveBattleFieldQueue(dwMapID) end, })
  end
end
return tMenu
end
function GetBattleFieldQueueName(dwMapID, nTimeIndex, nSerialNumber)
local szName = GetBattleFieldName(dwMapID)
if nSerialNumber and nSerialNumber ~= 0 then
  szName = szName .. "(" .. nSerialNumber .. ")"
end
return szName
end
function HasBattleFieldInfo()
local hPlayer = GetClientPlayer()
if not hPlayer then
  return false
end

local hScene = hPlayer.GetScene()
if IsBattleFieldMap(hScene.dwMapID) then
  return true
end
for _, _ in pairs(tNotifyList) do
  return true
end
end
function IsInBattleField()
local hPlayer = GetClientPlayer()
if hPlayer then
  local hScene = hPlayer.GetScene()
  return IsBattleFieldMap(hScene.dwMapID)
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function DoAcceptJoinBattleField(dwMapID, nTimeIndex, nSerialNumber)
CloseMessageBox("BattleField_Enter_" .. dwMapID)
tNotifyList[dwMapID] = nil
FireEvent("BATTLE_FIELD_STATE_UPDATE")
AcceptJoinBattleField(dwMapID, nTimeIndex, nSerialNumber)
end
function DoLeaveBattleFieldQueue(dwMapID)
CloseMessageBox("BattleField_Enter_" .. dwMapID)
tNotifyList[dwMapID] = nil
FireEvent("BATTLE_FIELD_STATE_UPDATE")
LeaveBattleFieldQueue(dwMapID)
end
function FormatBattleFieldTime(nTime)
local szTime
if nTime > 60 then
  szTime = math.floor(nTime / 60) .. g_tStrings.STR_BUFF_H_TIME_M
else
  szTime = nTime .. g_tStrings.STR_BUFF_H_TIME_S
end
return szTime
end
function FormatBattleFieldQueueTip(szBattleField, nPassTime, nAvgTime)
local szBattleField = GetFormatText(szBattleField, STRESS_FONT)
local szTip = FormatString(
  g_tStrings.STR_BATTLEFIELD_QUEUE_WAIT,
  "\"font=" .. NORMAL_FONT .. " </text>" .. szBattleField .. "<text>text=\""
)
szTip = szTip .. "\n"
szTip = "<text>text=\"" .. szTip .. "\" font=" .. NORMAL_FONT .. "</text>"

if nAvgTime > 0 then
  szTip = szTip .. GetFormatText(g_tStrings.STR_BATTLEFIELD_QUEUE_AVGTIME, NORMAL_FONT)
  szTip = szTip .. GetFormatText(FormatBattleFieldTime(nAvgTime) .. "\n", STRESS_FONT)
else
  szTip = szTip .. GetFormatText(g_tStrings.STR_BATTLEFIELD_QUEUE_TIME_UNKNOW .. "\n", NORMAL_FONT)
end

szTip = szTip .. GetFormatText(g_tStrings.STR_BATTLEFIELD_QUEUE_PASSTIME, NORMAL_FONT)
szTip = szTip .. GetFormatText(FormatBattleFieldTime(nPassTime) .. "\n", STRESS_FONT)
return szTip
end
function FormatBattleFieldJoinTip(szBattleField, nLastTime)
local szBattleField = GetFormatText(szBattleField, STRESS_FONT)
local szLastTime = GetFormatText(FormatBattleFieldTime(nLastTime), STRESS_FONT)
local szTip = FormatString(
  g_tStrings.STR_BATTLEFIELD_QUEUE_ENTER,
  "\"font=" .. NORMAL_FONT .. " </text>" .. szBattleField .. "<text>text=\"",
  "\"font=" .. NORMAL_FONT .. " </text>" .. szLastTime .. "<text>text=\""
)
return "<text>text=\"" .. szTip .. "\" font=" .. NORMAL_FONT .. "</text>"
end
RegisterEvent("BATTLE_FIELD_NOTIFY", function() OnBattleFieldNotify(arg3, arg0, arg1, arg2, arg4, arg5) end)
作者: 丨一朵丶撒旦    时间: 2009-6-9 22:07

作者: 丨一朵丶败邶    时间: 2009-6-9 22:13
什么 东东   我不懂``- -
作者: 丨一朵丶裳儿    时间: 2009-6-9 22:17
天文啊比英文还难看懂
作者: 丨一朵丶大脑壳    时间: 2009-6-9 22:20
晕这就是LUA语言写的,刚才在剑3里发现这东西,嘿嘿,就和魔兽写插件一样,只不过的是好象,金山没给接口,没说明书呵呵。
作者: 丨一朵丶箪禅    时间: 2009-6-9 22:23
先收藏,有机会再学习学习
作者: 丨一朵丶墨子    时间: 2009-6-9 22:26
不要只发代码,至少注释之后再发,要不好多童鞋都晕的。

作者: 丨一朵丶大脑壳    时间: 2009-6-9 23:02
我都不知道怎么注释,金山没给我接口说明,只能理解下表示的什么意思,确定金山开插件是使用=LUA语言,说以还不会的赶快去www.lua.org学习正在找人翻译呵呵,还有就是LUA在哪下后面在说.
作者: 丨一朵丶败邶    时间: 2009-6-10 00:09
话说  只能用现成的  不会自己编的人  爬过- -

   我还是等现成的吧- -
作者: 丨一朵丶小扇    时间: 2009-6-12 02:18
我们期待大脑壳同学的大作
作者: 丨一朵丶紫紫    时间: 2009-6-12 17:33
JS的天气系统也是高人利用bug开出来的
咱只能看懂一点点
作者: 丨一朵丶诗语    时间: 2009-6-13 11:38
天哪大脑袋你好帅~~~~
作者: 丨一朵丶专属    时间: 2009-6-14 10:49
等现成
作者: 丨一朵丶漈兲涯    时间: 2009-6-16 10:13
.......天书奇谈.......
作者: 丨一朵丶风铃草    时间: 2009-6-18 23:17
什么代码``
作者: 丨一朵丶蜗I牛    时间: 2009-6-28 22:57
顶顶....我看不懂这种语言




欢迎光临 一朵物语 (http://bbs.yiduo.org/) Powered by Discuz! X3.2