xdh
2018-11-19 76aaa2bc9a47e1896638740312affe1ec61f2334
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GMT_AddEntireCompensation.py
#
# @todo:Ìí¼ÓÈ«·þ²¹³¥
# @author xmnathan
# @date 2014-09-29 13:00
# @version 1.4
#
# @change: "2014-10-24 17:30" hxp Ôö¼Ó²¹³¥Áìȡʱ¼äÅжϣ¬ÒѹýÆÚ·µ»ØGM¹¤¾ßʱ¼ä´íÎó
# @change: "2015-06-19 17:00" hxp ÎÞÎïÆ·¿ÉÌí¼Ó²¹³¥
# @change: "2017-04-26 16:30" hxp ÓÅ»¯´úÂ룬 ×°±¸ÐÅÏ¢×Öµäͳһ´¦Àí
# @change: "2018-08-10 12:00" hxp Ôö¼ÓÉèÖÃÓʼþÏÞÖÆµÈ¼¶Éý¼¶ºóÊÇ·ñ¿ÉÁ죬ÉèÖÃÓʼþÊÇ·ñÐèÒªÉóºË
#
# ÏêϸÃèÊö: Ìí¼ÓÈ«·þ²¹³¥
#
#---------------------------------------------------------------------
#"""Version = 2018-08-10 12:00"""
#---------------------------------------------------------------------
 
#µ¼Èë
import DataRecordPack
import GMT_AddPersonalCompensation
import PlayerCompensation
import GameWorld
import GMCommon
import uuid
import ChConfig
#---------------------------------------------------------------------
 
## ÇåÀí×Öµä
#  @param gmCmdDict µ±Ç°Íæ¼Ò
#  @return None
def ClearEmptyFromDict(gmCmdDict):
    keysList = gmCmdDict.keys()[::]
    for key in keysList:
        if gmCmdDict[key] == '':
            gmCmdDict.pop(key)
            continue
    return gmCmdDict
 
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gmCmdDict: ÃüÁî×Öµä
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict):
    gmCmdDict = ClearEmptyFromDict(gmCmdDict)
    
    LimitTime = gmCmdDict.get('EndTime', '2050-12-13 00:00:00')
    curServerTime = GameWorld.GetCurrentDataTimeStr()
    # µ±Ç°Ê±¼äÒѾ­³¬¹ýÁìȡʱ¼ä
    if not curServerTime or curServerTime >= LimitTime:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_InvalidTime)
        return
    
    Title = gmCmdDict.get('Title', '')
    Text = gmCmdDict.get('Text', '')
    GUID = gmCmdDict.get('GUID', '') # GM¹¤¾ßÐèÒª¶ÔÈ«·þÓʼþ½øÐжà·þÅúÁ¿¹ÜÀí£¬ËùÒÔÕâÀïGUIDÔÝÓÉGM¹¤¾ß¾ö¶¨
    if not GUID:
        GUID = str(uuid.uuid1())
    if GUID.startswith("{") and GUID.endswith("}"):
        GUID = GUID[1:-1]
    limitLV = min(99999, int(gmCmdDict.get('PlayerLV', '0'))) # Ö§³ÖµÄ×î´óµÈ¼¶
    limitLVType = int(gmCmdDict.get('LimitLVType', '0')) # Ô­ÏÈδ´ïµ½ÓʼþÁìÈ¡µÈ¼¶µÄÍæ¼ÒÖ®ºóÉý¼¶ÉÏÀ´ÊÇ·ñ¿ÉÁìÈ¡Óʼþ, Ä¬ÈÏ0-²»¿É£¬1-¿ÉÒÔ
    checkState = int(gmCmdDict.get('CheckState', '0')) # ÓʼþÉóºË״̬£¬Îª¼æÈÝÀÏÓʼþ£¬Ä¬ÈÏ0-ÒÑÉóºË£¬1-δÉóºË
    mailInfo = PlayerCompensation.GetEntireCompensationInfo(checkState, limitLVType, limitLV)
    PlayerJob = int(gmCmdDict.get('PlayerJob', '127'))
    
    gold = int(gmCmdDict.get('Gold', '0'))
    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 = []
    itemNums = gmCmdDict.get('itemNums', '')
    if itemNums.strip() != '':
        intemIndexStrList = itemNums.split(',')
    #Ìí¼ÓÎïÆ·
    addItemDictList = []
    for itemIndexStr in intemIndexStrList:
        addItemDict = GMT_AddPersonalCompensation.GetGMTCompensationItemDict(gmCmdDict, itemIndexStr)
        if not addItemDict:
            continue
        #Ìí¼Óµ½ÎïÆ·ÐÅÏ¢Áбí
        addItemDictList.append(addItemDict)
        
    #if len(addItemDictList) == 0:
    #    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
    #    return
 
    PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime, 
                                     mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
                                     gold, goldPaper, silver, detail)
 
    #Ö´Ðгɹ¦
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, {"GUID":GUID})  
    # Á÷Ïò
    DataRecordPack.DR_ToolGMOperate(0, '', '', 'GMT_AddEntireCompensation', str(gmCmdDict))
    return