hxp
2024-11-25 878fef04122d1feaa0f42c429f364659931bc379
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
71
72
73
74
75
76
77
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.GMT_Execfile
#
# @todo:Ö´ÐÐÃüÁîÎļþ
# @author hxp
# @date 2021-05-19
# @version 1.0
#
# ÏêϸÃèÊö: Ö´ÐÐÃüÁîÎļþ
#
#-------------------------------------------------------------------------------
#"""Version = 2021-05-19 11:00"""
#-------------------------------------------------------------------------------
 
import GMCommon
import GameWorld
import DataRecordPack
import ChConfig
 
import traceback
import os
 
#Âß¼­ÊµÏÖ(ÕâÀïcurPlayer = None)
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò None
#  @param gmList [cmdIndex,gmAccID,forbidAccIP]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict): 
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
    cmdInfo = gmCmdDict.get('cmdInfo', '')
    if not cmdInfo:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
        return
    
    if playerFind:
        
        if queryType == GMCommon.Def_GMKey_PlayerAccID:
            queryType = ChConfig.queryType_sqtPlayerByAccID
            
        elif queryType == GMCommon.Def_GMKey_PlayerName:
            queryType = ChConfig.queryType_sqtPlayerByName
            
        GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTExecfile", [orderId, cmdInfo], False)
        return
    
    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):
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr, "%s is not exists!" % cmdInfo)
        return
    
    resultDict = {"cmdInfo":cmdInfo}
    
    try:
        execfile(execfilepath, globals(), locals())
    except:
        errMsg = traceback.format_exc()
        GameWorld.ErrLog(errMsg)
        
        resultDict["errMsg"] = errMsg
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Unknow, resultDict)
        return
    
    DataRecordPack.DR_ToolGMOperate(0, "", "", "GMT_Execfile", resultDict)
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, resultDict)
    return