代码拉取完成,页面将自动刷新
const fs = require('fs')
const path = require('path')
const UI = require('tera-mod-ui').Settings
exports.NetworkMod = function(mod) {
/* 增加映射码 add_Opcode */
const parseMap = require('tera-data-parser').parsers.Map;
const filename = `protocol.${mod.clientInterface.info.protocolVersion}.map`
const customMap = parseMap(path.join(__dirname, 'opcodes', filename))
for (var code in customMap) {
mod.dispatch.addOpcode(code, customMap[code])
}
/* UI设置 */
if (!global.TeraProxy.GUIMode) return
let ui = null, npcContact = null
let settings = { id: null, index: 0, questReward: -1, unk: -1 }
let structure = [{
key: "index", name: "副本传送石 快捷按钮", type: "select", options: [{ name: "-请手动选择-", key: 0 }]
}]
ui = new UI(mod, structure, settings, { height: 60 })
ui.on('update', result => {
if (!npcContact || !settings.id || settings.index==0) return
mod.send('C_DIALOG', 1, settings)
ui.close()
})
this.destructor = () => { if (ui) ui.close(), ui = null }
mod.hook('C_NPC_CONTACT', 2, e => {
npcContact = e.gameId
})
mod.hook('S_DIALOG', 3, e => {
if (!npcContact || !e.specialActionButton.enabled || mod.game.me.inDungeon) return
settings.id = e.id
e.buttons.forEach(btn => {
var zone = btn.text.replace(/[^\d]/g,"").substring(0, 4)
btn.key = btn.index
mod.queryData('/StrSheet_Dungeon/String@id=?', [Number(zone)]).then(result => {
if (!result || !result.attributes || !result.attributes.string) return
btn.name = result.attributes.string
})
structure[0].options.push(btn)
})
if (structure[0].options.length < 2) return
mod.send('S_CUSTOM_STYLE_SYSTEM_MESSAGE', 1, {
style: 44, message: `<font size="40">矮子才用命令进本</font>`
})
ui.show()
})
mod.tryHook('S_SOCIAL_CANCEL', 1, e => {
if (!npcContact || npcContact!=e.target) return
settings = { id: null, index: 0, questReward: -1, unk: -1 }
structure[0].options = [{name: "-请手动选择-", key: 0}]
npcContact = null
ui.update(settings)
ui.close()
})
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。