hxp
2024-04-26 ee43f12300d1085a28dd44bdc802bee9917c5e0d
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddPersonalCompensation.py
@@ -29,6 +29,7 @@
import GMCommon
import uuid
import ChConfig
import ShareDefine
#---------------------------------------------------------------------
@@ -49,12 +50,40 @@
#  @return None
#  @remarks 函数详细说明.
def OnExec(orderId, gmCmdDict):
    strMsg = ""
    gmCmdDict = ClearEmptyFromDict(gmCmdDict)
    PlayerIDList = eval(gmCmdDict.get('PlayerIDList', '[]'))
    GameWorld.DebugLog("GMT_AddPersonalCompensation gmCmdDict:%s" % gmCmdDict)
    queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
    if queryType == GMCommon.Def_GMKey_FamilyID:
        sendFamilyIDList = []
        PlayerIDList = []
        familyIDList = gmCmdDict.get("playerList", "").split(",")
        GameWorld.Log("发送仙盟邮件: familyIDList=%s" % familyIDList)
        for familyID in familyIDList:
            familyID = GameWorld.ToIntDef(familyID)
            familyInfo = {"familyID":familyID}
            memberIDList = []
            family = GameWorld.GetFamilyManager().FindFamily(familyID)
            if not family:
                GameWorld.DebugLog("    not family %s" % familyID)
                continue
            for index in range(family.GetCount()):
                curMember = family.GetAt(index)
                curMemberID = curMember.GetPlayerID()
                if curMemberID:
                    memberIDList.append(curMemberID)
            PlayerIDList += memberIDList
            familyInfo["PlayerIDList"] = memberIDList
            sendFamilyIDList.append(familyInfo)
        GameWorld.Log("    send FamilyIDList=%s" % sendFamilyIDList)
        GameWorld.Log("    send PlayerIDList=%s" % PlayerIDList)
        strMsg = str(sendFamilyIDList)
    else:
        PlayerIDList = eval(gmCmdDict.get('PlayerIDList', '[]'))
    if PlayerIDList == []:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
        return
    LimitTime = gmCmdDict.get('EndTime', '2050-12-13 00:00:00')
    
    curServerTime = GameWorld.GetCurrentDataTimeStr()
@@ -63,6 +92,7 @@
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_InvalidTime)
        return
        
    MailType = int(gmCmdDict.get('MailType', '0'))
    Title = gmCmdDict.get('Title', '')
    Text = gmCmdDict.get('Text', '')
    GUID = str(uuid.uuid1())
@@ -71,6 +101,7 @@
    goldPaper = int(gmCmdDict.get('GoldPaper', '0'))
    silver = int(gmCmdDict.get('Silver', '0')) 
    sender = gmCmdDict.get('Sender', ChConfig.Def_Mail_SenderSys)
    detail = gmCmdDict.get('Detail', "")
    
    #工具发过来的物品下标依据 'index,index,...'  不一定是从0开始并按顺序连续 =_=#
    intemIndexStrList = []
@@ -90,11 +121,11 @@
    #    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
    #    return
    PlayerCompensation.AddPersonalItem(GUID, addItemDictList, PlayerIDList, 
                                       LimitTime, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
                                       gold, goldPaper, silver)
                                       LimitTime, PlayerCompensation.GetMailText(Title, Text, MailType, sender),
                                       gold, goldPaper, silver, detail=detail)
    
    #执行成功
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success)
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, strMsg)
    # 流向
    DataRecordPack.DR_ToolGMOperate(0, '', '', 'GMT_AddPersonalCompensation', str(gmCmdDict))
    return
@@ -108,7 +139,8 @@
    addItemDict['Count'] = GameWorld.ToIntDef(gmCmdDict.get('ItemCnt%s'%itemIndexStr, '0'))
    if addItemDict['Count'] == 0:
        return {}
    addItemDict['IsBind'] = GameWorld.ToIntDef(gmCmdDict.get('IsBind%s'%itemIndexStr, '0'))
    addItemDict['IsAuctionItem'] = GameWorld.ToIntDef(gmCmdDict.get('IsBind%s'%itemIndexStr, '0'))
    appointID = GameWorld.ToIntDef(gmCmdDict.get('AppointID%s'%itemIndexStr, '0'))
    #添加UserData信息
    addItemDict['UserData'] = ''
    UserDataDict = {}
@@ -139,6 +171,9 @@
            continue
        itemUserData[key] = value
        
    if appointID:
        itemUserData[ShareDefine.Def_CItemKey_AppointID] = appointID
    if itemUserData:
        addItemDict['UserData'] = '%s'%itemUserData