1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_Execfile
#
# @todo:GM¹¤¾ßÃüÁî - Ö´ÐÐÃüÁî
# @author hxp
# @date 2026-02-13
# @version 1.0
#
# ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - Ö´ÐÐÃüÁî
#
#-------------------------------------------------------------------------------
#"""Version = 2026-02-13 14:30"""
#-------------------------------------------------------------------------------
 
import GMCommon
import GameWorld
import DataRecordPack
import traceback
import os
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
    cmdInfo = gmCmdDict.get('cmdInfo', '')
    if not cmdInfo:
        return GMCommon.Def_ParamErr
    GMT_Name = gmCmdDict.get(GMCommon.Def_GMKey_Type, '') 
    
    playerID, playerName, accID = 0, "", ""
    curPlayer = None
    errorMsg = ""
    if playerFind:
        from GMToolLogicProcess import  ProjSpecialProcess
        Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False)
        if Result != GMCommon.Def_Success:
            return Result, errorMsg
        if not curPlayer:
            return Result, "Íæ¼Ò²»ÔÚÏß"
        playerID = curPlayer.GetPlayerID()
        playerName = curPlayer.GetPlayerName()
        accID = curPlayer.GetAccID()
        
    backDir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
    execfilepath = os.path.join(backDir, "GMTExec\\%s.py" % cmdInfo)
    GameWorld.Log("GMT_Execfile: %s" % execfilepath)
    
    if not os.path.exists(execfilepath):
        return GMCommon.Def_ParamErr, "%s is not exists!" % cmdInfo
    
    resultDict = {"cmdInfo":cmdInfo}
    
    try:
        execfile(execfilepath, globals(), locals())
    except:
        errMsg = traceback.format_exc()
        GameWorld.ErrLog(errMsg)
        
        resultDict["errMsg"] = errMsg
        return GMCommon.Def_Unknow, resultDict
    
    #Á÷Ïò
    DataRecordPack.DR_ToolGMOperate(playerID, playerName, accID, GMT_Name, resultDict)
    return GMCommon.Def_Success, resultDict