mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-12 16:12:27 +08:00
优化代码
This commit is contained in:
@@ -72,6 +72,7 @@ func CallLuaFunc(luaState *lua.LState, luaFuncName string, luaCtx *LuaCtx, luaEv
|
||||
func RegLuaLibFunc() {
|
||||
gdconf.RegScriptLibFunc("GetEntityType", GetEntityType)
|
||||
gdconf.RegScriptLibFunc("GetQuestState", GetQuestState)
|
||||
gdconf.RegScriptLibFunc("PrintLog", PrintLog)
|
||||
gdconf.RegScriptLibFunc("PrintContextLog", PrintContextLog)
|
||||
gdconf.RegScriptLibFunc("BeginCameraSceneLook", BeginCameraSceneLook)
|
||||
}
|
||||
@@ -103,10 +104,20 @@ func GetQuestState(luaState *lua.LState) int {
|
||||
questId := luaState.ToInt(3)
|
||||
dbQuest := player.GetDbQuest()
|
||||
quest := dbQuest.GetQuestById(uint32(questId))
|
||||
if quest == nil {
|
||||
luaState.Push(lua.LNumber(constant.QUEST_STATE_NONE))
|
||||
return 1
|
||||
}
|
||||
luaState.Push(lua.LNumber(quest.State))
|
||||
return 1
|
||||
}
|
||||
|
||||
func PrintLog(luaState *lua.LState) int {
|
||||
logInfo := luaState.ToString(1)
|
||||
logger.Info("[LUA LOG] %v", logInfo)
|
||||
return 0
|
||||
}
|
||||
|
||||
func PrintContextLog(luaState *lua.LState) int {
|
||||
ctx, ok := luaState.Get(1).(*lua.LTable)
|
||||
if !ok {
|
||||
@@ -117,7 +128,7 @@ func PrintContextLog(luaState *lua.LState) int {
|
||||
return 0
|
||||
}
|
||||
logInfo := luaState.ToString(2)
|
||||
logger.Info("[LUA LOG] %v [UID %v]", logInfo, uid)
|
||||
logger.Info("[LUA CTX LOG] %v [UID %v]", logInfo, uid)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user