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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.RemoteQuery.GY_Query_GMTDelPlayerMoney
#
# @todo:GM¹¤¾ß¿Û³ýÍæ¼Ò»õ±Ò
# @author hxp
# @date 2021-03-18
# @version 1.0
#
# ÏêϸÃèÊö: GM¹¤¾ß¿Û³ýÍæ¼Ò»õ±Ò
#
#-------------------------------------------------------------------------------
#"""Version = 2021-03-18 19:00"""
#-------------------------------------------------------------------------------
 
import GMCommon
import ShareDefine
import PlayerControl
import GameWorld
import ChConfig
 
## ÇëÇóÂß¼­
#  @param query_Type ÇëÇóÀàÐÍ
#  @param query_ID ÇëÇóµÄÍæ¼ÒID
#  @param packCMDList ·¢°üÃüÁî [ ]
#  @param tick µ±Ç°Ê±¼ä
#  @return resultDisc
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def DoLogic(query_Type, query_ID, packCMDList, tick):
    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID)
    
    if not curPlayer or curPlayer.IsEmpty():
        return ''
    
    orderId, gmCmdDict  = packCMDList
    moneyType = GameWorld.ToIntDef(gmCmdDict.get("moneyType"))
    moneyValue = GameWorld.ToIntDef(gmCmdDict.get("moneyValue"))
    delRemark = gmCmdDict.get("delRemark", "")
    
    retMsg = ""
    Result = GMCommon.Def_Success
    if moneyType not in [1, 2, 3, 4, ShareDefine.TYPE_Price_PayCoin] and moneyType not in ShareDefine.TYPE_Price_CurrencyDict:
        Result = GMCommon.Def_MoneyTypeErr
    elif not moneyValue:
        Result = GMCommon.Def_ParamErr
        retMsg = "money value error."
    #ÏÉÓñ¡¢°óÓñºǫֱ́½Ó¿Û³ýµÄ²»¼ì²é»õ±ÒÊÇ·ñ×ã¹»£¬Ö§³ÖÖ±½Ó¿Û³É¸ºÖµ
    elif moneyType not in ShareDefine.MoneyMinusRefreshDict and not PlayerControl.HaveMoney(curPlayer, moneyType, moneyValue, False):
        Result = GMCommon.Def_ParamErr
        retMsg = "money is not enough. only %s" % PlayerControl.GetMoney(curPlayer, moneyType)
        
    if Result == GMCommon.Def_Success:
        infoDict = {ChConfig.Def_Cost_Reason_SonKey:delRemark}
        if not PlayerControl.PayMoney(curPlayer, moneyType, moneyValue, ChConfig.Def_Cost_GM, infoDict, isNotify=False, isMinus=True):
            Result = GMCommon.Def_Unknow
            retMsg = "pay money error."
        else:
            retMsg = "remaining money %s" % PlayerControl.GetMoneyReal(curPlayer, moneyType)
            
    resultMsg = str([orderId, retMsg, 'GMT_DelPlayerMoney', Result])
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
    return ''