# Morrrrre...GameAPIs
基于某未发行版本泄露部分源码,提供一些内部api
# 触发器
# setGameDefeat
- 参数及类型:
- 返回值及类型:
- 该方法的主要作用:移除玩家
- 具体使用案例如下:
ScriptSupportEvent:registerEvent(
[=[Player.ClickBlock]=],
function()
Trigger.Player:setGameDefeat(0)
end
)
# setWeather
- 参数及类型:
- v1:
number
(opens new window) 0晴雨交错 1晴天 2 雨天
- v1:
- 返回值及类型:
- 该方法的主要作用:设置天气
- 具体使用案例如下:
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=],
function()
local v1 = 0
Trigger.World:setWeather(v1)
end
)
# notifyGameInfo2Self
参数及类型:
返回值及类型:
该方法的主要作用:显示飘窗信息
具体使用案例如下:
Trigger.PlayerGroup:notifyGameInfo2Self(v1, v2)
local function func_a()
if Trigger.World and Trigger.World.getAllPlayers then
return Trigger.World:getAllPlayers()
end
end
local function func_b()
local v1 = func_a()
local v2 = [=[HcatVeryBeautiful]=]
if logidx then
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 1, v1)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 2, v2)
end
if v1 == nil or v2 == nil then
print("-- [func_b] error -- param is nil:", v1, v2)
return
end
if Trigger.PlayerGroup and Trigger.PlayerGroup.notifyGameInfo2Self then
return Trigger.PlayerGroup:notifyGameInfo2Self(v1, v2)
end
end
# Trigger.Player:setPlayerAttr
参数及类型:
返回值及类型:
该方法的主要作用:设置玩家属性
具体使用案例如下:
local function func_1()
local v1 = class.TriggerPlayerVar.new(CurEventParam.TriggerByPlayer, PLAYERATTR.CUR_HP).AttrData
local v2 = 1
if v1 == nil or v2 == nil then
return false
end
if type(v1) ~= type(v2) then
return false
end
return (v1 + v2)
end
local function func_2()
local v1 = CurEventParam.TriggerByPlayer
_exeObjid_ = v1
local v2 = PLAYERATTR.CUR_HP
local v3 = func_1()
if logidx then
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 1, v1)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 2, v2)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 3, v3)
end
if v1 == nil or v2 == nil or v3 == nil then
print("-- [func_2] error -- param is nil:", v1, v2, v3)
return
end
if Trigger.Player and Trigger.Player.setPlayerAttr then
return Trigger.Player:setPlayerAttr(v1, v2, v3)
end
end
# Trigger.Buff:addBuff
参数及类型:
返回值及类型:
该方法的主要作用:addBuff
具体使用案例如下:
local function func_5()
local v1 = CurEventParam.TriggerByPlayer
_exeObjid_ = v1
local v2 = 208003
local v3 = false
local v4 = 2
if logidx then
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 1, v1)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 2, v2)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 3, v3)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 4, v4)
end
if v1 == nil or v2 == nil or v3 == nil or v4 == nil then
print("-- [func_5] error -- param is nil:", v1, v2, v3, v4)
return
end
if Trigger.Buff and Trigger.Buff.addBuff then
return Trigger.Buff:addBuff(v1, v2, v3, v4)
end
end
# Trigger.Creature:killActor
参数及类型:
返回值及类型:
该方法的主要作用:击杀生物
具体使用案例如下:
Trigger.Creature:killActor(v1)
# Trigger.Creature:removeActor
参数及类型:
返回值及类型:
该方法的主要作用:直接删除实体
具体使用案例如下:
--删除事件中的生物实体
Trigger.Creature:removeActor(CurEventParam.TriggerByCreature)
# Trigger.Item:createProjectile
参数及类型:
- v1:
number
(opens new window) 创建投射物的位置 - v2:
number
(opens new window) 投掷物ID - v3
number
(opens new window) 发射到的位置
- v1:
返回值及类型:
该方法的主要作用:创建投掷物
具体使用案例如下:
local function func_2()
local v1 = CurEventParam.EventTargetPos
local v2 = 0
local v3 = 20
local v4 = 0
if v1 == nil or v2 == nil or v3 == nil or v4 == nil then
print("-- [func_2] error -- param is nil:", v1, v2, v3, v4)
return
end
if Trigger.World and Trigger.World.offsetPos then
return Trigger.World:offsetPos(v1, v2, v3, v4)
end
end
local function func_3()
local v1 = CurEventParam.TriggerByCreature
if v1 == nil then
print("-- [func_3] error -- param is nil:", v1)
return
end
if Trigger.Creature and Trigger.Creature.getPosition then
return Trigger.Creature:getPosition(v1)
end
end
local function func_4()
local v1 = func_2()
local v2 = 12285
local v3 = func_3()
if logidx then
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 1, v1)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 2, v2)
Trigger.Debug:ReportActionRunData(logidx, _status_idx_, 3, v3)
end
if v1 == nil or v2 == nil or v3 == nil then
print("-- [func_4] error -- param is nil:", v1, v2, v3)
return
end
if Trigger.Item and Trigger.Item.createProjectile then
return Trigger.Item:createProjectile(v1, v2, v3)
end
end
# Trigger.Creature:setAttribute
参数及类型:
- v1:
number
(opens new window) - v2
- v3
- v1:
返回值及类型:
该方法的主要作用:直接删除实体
具体使用案例如下:
--设置触发事件的生物当前血量为1
local v1 = CurEventParam.TriggerByCreature
_exeObjid_ = v1
local v2 = CREATUREATTR.CUR_HP
local v3 = 1
Trigger.Creature:setAttribute(v1, v2, v3)
# threadpool:work
参数及类型:
返回值及类型:
该方法的主要作用:多线程工作
具体使用案例如下:
local logidx = Trigger and Trigger.Debug:logTriggerBegin()
if logidx then
Trigger.Debug:setTriggerid(logidx, _triggerid_)
Trigger.Debug:setTriggerEvent(logidx, eventidx)
Trigger.Debug:setTriggerEventParams(logidx, eventparams)
Trigger.Debug:setTriggerOtherParams(logidx, curparams)
end
local curparams = CurEventParam and copy_table(CurEventParam)
threadpool:work(function()
main(param, nil, logidx, curparams)
end)
# Trigger.Player:killPlayer()
参数及类型:
- uin:
返回值及类型:
该方法的主要作用:杀死玩家
具体使用案例如下:
Trigger.Player:killPlayer(event.eventobjid)
# stop
- 返回值及类型:
- 该方法的主要作用:释放触发器
- 具体使用案例如下:
Trigger:stop()
# ClientMgr
# playMusic
参数及类型:
- path:
返回值及类型:
该方法的主要作用:播放音乐
具体使用案例如下:
ClientMgr:playMusic(filepath(1) .. "vardata/MOOD.mp3")
# ScriptSupportCtrl
# getCurOwid
- 返回值及类型:
- owid
- 该方法的主要作用:取当前owid
- 具体使用案例如下:
# 杂七杂八
消息框
StoreMsgBox(boxType, text, GetS(609), costId, lackMiniNum, needNum);
getglobal("ZhishuInputTextFrameEdit"):GetText()
getglobal("CloseAccountFrameEdit"):Clear();
getglobal("CloseAccountFrameAgreeBtn"):Disable();
getglobal("CloseAccountFrameAgreeBtnNormal"):SetGray(true);
getglobal("CloseAccountFrameAgreeBtnPushedBG"):SetGray(true);
getglobal("DeveloperStoreSkuFrameList"):setDealMsg(true);
getglobal("DeveloperExtractPropFrameNumberNameEdit"):SetText(1);
if IsEnableNewAccountSystem() then
getglobal("GameSetFrameOtherCloseAccountTitle"):Hide();
getglobal("GameSetFrameOtherCloseAccountBtn"):Hide();
getglobal("GameSetFrameOtherCloseAccountTitle"):Show();
getglobal("GameSetFrameOtherCloseAccountBtn"):Show();
getglobal("CloseAccountFrameAgreeBtn"):Enable();
getglobal("CloseAccountFrameContentText"):SetText(GetS(9222), 61, 69, 70);
getglobal("PlayerExpBarStarBkg"):SetSize(170, 72)
getglobal("PokedexSeriesBox"):setDealMsg(false);
getglobal("BeanConvertFrameHappyFireworkName"):SetPoint("topleft","BeanConvertFrameHappyFirework","top",-195,20)
getglobal("BeanConvertFrameHappyFireworkMiniIcon"):SetTexture("items/icon12750.png");
getglobal("StoreMsgboxFrame"):SetClientString( "道具不足前往家园获取" );
SetCurEditBox("DeveloperExtractPropFrameNumberNameEdit");
HideAllFrame("PaletteFrame", true);
# 禁用ESC
_G.IgnoreEsc = true
WorldMgr:NoticeRentStatusTime(reason, sec or 0)
# 取字符串资源
GetS()
# 游戏提示
ShowGameTips(GetS(21673), 3);
# 不带过滤器的游戏提示
ShowGameTipsWithoutFilter("Path:"..LuaInterface:getStdioRoot())
# StdioRoot
ClientMgr:clickCopy(LuaInterface:getStdioRoot())
ShowGameTipsWithoutFilter("已复制StdioRoot")
-- 返回:C:/Users/Hcat/AppData/Roaming/miniworddata110/
# 检查过滤文本
DefMgr:checkFilterString("Fuck")
# 过滤文本
local txt = DefMgr:filterString(txt);
# 添加过滤文本
DefMgr:addFilterString(aString)
# 直接过滤文本
DefMgr:filterStringDirect(LettersTitle);
# 客户端管理
# 取设备ID
ClientMgr:getDeviceID()
# 复制到剪贴板
ClientMgr:clickCopy(LuaInterface:getStdioRoot())
# 是否纯净服
ClientMgr:isPureServer()
# 取文本格式客户端版本号
local curVersion = ClientMgr:clientVersion();
t_extra.version = ClientMgr:clientVersionToStr(curVersion);
ClientMgr:clientVersion();
# 取当前房间相关
local roomId = ClientMgr:getCurrentRentRoomId()
local room_uin = ClientMgr:getCurrentRentRoomUin()
# 播放音乐
ClientMgr:playMusic(path, loop);
ClientMgr:playMusic("sounds/music/bgm5.ogg", true);
# 停止音乐
ClientMgr:stopMusic();
# 退出游戏,不退出进程
ClientMgr:gotoGame("none")
# 退出进程
ClientMgr:gotoGame("exit")
# 回到主菜单
ClientMgr:gotoGame("MainMenuStage");
# 播放音效
ClientMgr:playSound2D("sounds/ui/info/death.ogg", 1);
# 设置Sdk浮动菜单
ClientMgr:setSdkFloatMenu(2); -- 1 退出游戏地图; 2 进入游戏地图
# 当前世界
# 设置游戏规则
CurWorld:setGameRule(ruleId, curOpId, 0);
# 世界管理
WorldMgr:setGameRuleValue(ruleId, val)
self.Mini.gamerule.getGameRuleValue(key)
WorldMgr:setGameRuleValue(GMRULE_BGMUSICMODE, val)
# 客户端当前游戏
# 发送聊天信息
ClientCurGame:sendChat(tipsContent,tipsType,tipsUin)
# 见代码
ClientCurGame:getHostUin();
# 见代码
ClientCurGame:getMaxPlayerNum();
ClientCurGame:getNumPlayerBriefInfo();
# 设置操作UI
-- true 鼠标移出游戏 false 捕获鼠标
ClientCurGame:setOperateUI(false)
info.version = LuaInterface:getCltVersion()
info.apiid = LuaInterface:getApiId()
# 账号管理
# 取昵称
AccountManager:getNickName();
# 获取账号uin
AccountManager:getUin();
# 取当前世界描述
AccountManager:getCurWorldDesc()
# 取当前世界ID
AccountManager:getCurWorldId()
# 取地图路径
AccountManager:getMapPath(AccountManager:getCurWorldId()
# 设置当前世界名称
AccountManager:setCurWorldName(worldName)
# 取账号数据
AccountManager:getAccountData()
AccountManager:getAccountData():getMiniBean(); --取迷你豆
AccountManager:getAccountData():getVipInfo()--VIp
AccountManager:getAccountData():getMiniCoin()
AccountManager:getAccountData():getAccountItemNum(costId)
AccountManager:getAccountData():getBagSize()
AccountManager:getAccountData():isItemUnlock(itemDef.UnlockFlag)
# 身份证验证
AccountManager:idcard_auth('370104198002273311', '宋林')
# 身份证信息
AccountManager:idcard_info()
AccountManager:data_update()
AccountManager:getmmsum() --25cfde8f698c339870778e3fa02d793a111589253639
# 获取当前owid
--该方法被封装到ScriptSupportCtrl:getCurOwid()
--AccountManager:getCurWorldDesc().wdesc.worldid
# 开发者信息
local test_developer_info = function ()
--{{{
local code, info, cfg = AccountManager:dev_developer_info(AccountManager:getUin())
print(' 开发者信息 ', code, info, cfg)
--local Uin = 204849422
--local code, info, cfg = AccountManager:dev_developer_info(Uin)
--print(' 开发者信息 ', ErrorCode[code], info, cfg)
--}}}
end
# 向账号添加物品
# 绑定密码
# 修改密码
# 绑定手机
# 社会化登录相关
# 使用某个角色
AccountManager:useRoleModel(2)=>true --使用 卡卡
AccountManager:useRoleModel(8)=>true -- 使用 妮妮
# 已登录?
AccountManager:isLogin()
# 取生存时间
AccountManager:getSvrTime()
# 取多人玩家数
AccountManager:getMultiPlayer()
# 查找世界描述
local owid = CurWorld:getOWID();
local desc = AccountManager:findWorldDesc(owid)
# 创建房间
AccountManager:createRoom(worldInfo.worldtype, worldInfo.worldname, playernum, password, '#G测试阶段,遇到问题可在设置界面反馈.(本图由迷你号:'..worldInfo.realowneruin..'上传分享)', text, creattype, 2, false);
# ban物品
PermitsMgr:banItem(g_DangerItemsForBan[i], state);
# 账号是否绑定
AccountManager:isBindAccount()
# 线程池
等待
threadpool:wait(event_id, timeout, tick_func)
local code, result = threadpool:wait(seq, timeout) --等待这个事件timeout秒
# 脚本支持组件
# 文件是否存在
ScriptSupportCtrl:checkFileExist(filepath)
if ScriptSupportCtrl:checkFileExist(filepath) then
ScriptSupportCtrl:delFile(filepath)
end
# 删除文件
ScriptSupportCtrl:delFile(filepath)
# 创建目录
ScriptSupportCtrl:createDirectory(dirpath)
# 取当前owid
ScriptSupportCtrl:getCurOwid()
# 检查目录是否存在
ScriptSupportCtrl:checkDirectoryExist(dirpath)
# 取调试标识
ScriptSupportCtrl:getDebugFlag()
# 获取迷你号(地图作者)
封装的AccountManager:getCurWorldDesc().realowneruin
ScriptSupportCtrl:getMini()
# 加密反加密
盲猜调用的这个库https://github.com/xxtea/xxtea-lua
# 获取加密标志
ScriptSupportCtrl:getEncryptionFlag()
# 加密
ScriptSupportCtrl:encrypt(content)
# 解码
ScriptSupportCtrl:decrypt(content)
# 模组管理
# 取地图模组数量
ModMgr:getMapModCount()
if ModMgr then
local modCount = ModMgr:getMapModCount()
for idx = 1, modCount do
local moddesc = ModMgr:getMapModDescByIndex(idx-1)
if moddesc then
srcdir = moddesc.rootDir .. "/ss/trigger"
dstdir = param2 .. "/" .. moddesc.uuid .. "/ss/trigger"
SSGMCommand_Export(srcdir, dstdir)
end
end
end
# Lua接口
LuaInterface:getApiId()
LuaInterface:getCltVersion()
# 是否PC
LuaInterface:ispc()
# 取工作取路径
LuaInterface:getStdioRoot()
# 取UIN
LuaInterface:getUin()
# 取密码
LuaInterface:getPasswd()
LuaInterface:getOpenString()
LuaInterface:getAccountName()
# 取地址
LuaInterface:geturl()
--http://wskacchm.mini1.cn:4000/
ns_http.func.rpc_string_raw(url,response_callback);
ns_http.func.rpc_string_raw_https( "https://www.sogou.com/", cb_, nil, true, postData, https_header )
Longitude = LuaInterface:getLongtitude(),
Latitude = LuaInterface:getLantitude(),
CltVersion = LuaInterface:getCltVersion(),
CltType = LuaInterface:getCltTye(),
# 界面
# 打开微缩打包界面
local param = {disableOperateUI = true};
GetInst("UIManager"):Open("PackingCM", param);
# 信息框
MessageBoxFrame2:Open(2, "#Y标题", "#K测试#R测试\n[Test]")
ClientCurGame:sendChat("测试完毕", 1)
# 玩家
# 强制打开某工作台
--itemid 为固定参数 WOKESTAGE-> 800 824 833 工具箱 修理台 附魔台
player:forceOpenBoxUI(itemid)
function BF_InitItemToContainer()
local num = BF_Data.getAllStuffNum();
if num<1 then return end
local grid_index ;
for i =1, num do
grid_index = BUILDBLUEPRINT_START_INDEX+i -1;
local gridInfo = BF_Data.getOriginalGridInfo(i);
if gridInfo ~= nil then
local grid = CurMainPlayer:getBackPack():index2Grid(grid_index);
if grid~= nil and grid:getNum()<1 then
CurMainPlayer:setItem(gridInfo.itemId,0, gridInfo.durable);
for i=1, gridInfo.enchantnum do
CurMainPlayer:getBackPack():enchant(grid_index, gridInfo.enchants[i]);
end
end
end
end
end