Greasy Fork is available in English.

wsmud_api

使用于 Tampermonkey 的武神传说脚本的前置 API 库

安装此脚本?
作者推荐脚本

您或许会喜欢wsmud_login

安装此脚本
脚本作者
suqing
今日安装
0
总安装量
956
得分
1 0 0
版本
0.0.9
创建日期
2020-08-24
最近更新
2020-08-30
许可证
MIT
应用到

简介

此脚本添加了一个全局对象 apiapi 是使用 Vue 进行数据驱动的,api 的属性可以用在 Vue 的渲染函数或计算属性内,当 api 的属性发生变化时,Vue 相应的组件会渲染更新。

脚本在使用过程中存在问题需要反馈?拥有更好的想法?欢迎加群交流。

QQ群:研究更好的挖矿姿势 953279200

插件

  • wsmud_login 登录插件,一键切换游戏角色,淡化了账号概念。

以上插件均基于 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 中。

Cookie

  • 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.')