使用于 Tampermonkey 的武神传说脚本的前置 API 库
此脚本添加了一个全局对象
api
。api
是使用Vue
进行数据驱动的,api
的属性可以用在Vue
的渲染函数或计算属性内,当api
的属性发生变化时,Vue
相应的组件会渲染更新。脚本在使用过程中存在问题需要反馈?拥有更好的想法?欢迎加群交流。
QQ群:研究更好的挖矿姿势
953279200
以上插件均基于
wsmud_api
开发。
api.prop
api.id
api.name
api.hp
api.hpmax
api.mp
api.mpmax
api.mplimit
api.wx1
先天悟性api.wx1
后天悟性api.xxxl
学习效率 不含百分号api.lxxl
练习效率 不含百分号api.skills
技能列表api.skilllimit
技能等级上限api.packs
背包列表api.packlimit
背包物品上限api.money
api.eqs
装备列表api.performs
出招列表api.room
房间数据
api.room.name
api.room.x
api.room.y
api.room.path
api.room.commands
api.room.desc
api.room.exits
api.room.items
api.room.npcs
api.roles
本地角色列表api.send(...args)
需要发送多条指令时,可以在单字符串中使用英文逗号隔开,或使用多个参数传入。
api.send('jh fam 0 start,go west,go west,go north,go enter,go west')
api.send('jh fam 0 start', 'go west', 'go west', 'go north', 'go enter', 'go west')
需要延迟某条指令的发送时,在指令前加入一个数字即可,单位为毫秒。
api.send('go west,2000,go west')
api.send('go west', 2000, 'go west')
使用
api.send()
发送的所有指令都会被加入一个队列中依次发送,每条指令之间会有默认的延迟时间,所以不会出现不要急,慢慢来。
的现象。除非故意使用很低的延迟导致发送指令的频率过快,例如
go north,0,go north,0,go north
。所以如非必要,尽量不要使用很低的延迟发送指令。
api.addStyle(style)
api.addStyle(`
div#test {
color: red;
}
`)
api.setValue(key, value)
api.getValue(key)
api.deleteValue(key)
// 保存
api.setValue('TestKey', { a: 1, b: 2 })
// 读取
api.getValue('TestKey') // { a: 1, b: 2 }
// 删除
api.deleteValue('TestKey')
数据被保存在浏览器的 localStorage 中。
api.cookie()
const cookie = api.cookie()
// 保存
cookie.TestKey = 'JustTestValue'
// 读取
console.log(cookie.TestKey) // "JustTestValue"
// 删除
delete cookie.TestKey
console.log(cookie.TestKey) // undefined
console.green(log)
console.orange(log)
console.red(log)
console.green('This is a green log.')
console.orange('This is an orange log.')
console.red('This is a red log.')