xdh
2018-12-21 4d0ea0c5ac258cfdaccc46b9d8910b0938f08c5b
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package SetMoney
#
# @todo:ÉèÖÃÍæ¼ÒµÄÇ®
# @author hxp
# @date 2013-12-10 14:00
# @version 1.1
#
# @change: "2016-07-20 14:30" hxp Í³Ò»º¯Êý
#
# ÏêϸÃèÊö: ÉèÖÃÍæ¼ÒµÄÇ®
#
#---------------------------------------------------------------------
#"""Version = 2016-07-20 14:30"""
#---------------------------------------------------------------------
 
import PlayerControl
import Lang
import ChConfig
import ShareDefine
import GameWorld
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param list ²ÎÊýÁбí [ <Ç®±ÒÀàÐÍ><ÊýÁ¿>]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, List):
    if len(List) != 2:
        #²ÎÊý²»ÕýÈ·
        GameWorld.DebugAnswer(curPlayer, Lang.GBText("²ÎÊý²»ÕýÈ·"))
        GameWorld.DebugAnswer(curPlayer, "1-ÏÉÓñ;2-°óÓñ;3-Í­Ç®;6-Õ½Ã˹±Ï×¶È;10-Õ½Ã˲ֿâ»ý·Ö;13-¾³½çÐÞÐеã;14-·ûÓ¡ÈÚºÏʯ;15-ÏÉÃË»îÔ¾Áî")
        GameWorld.DebugAnswer(curPlayer, "16-ÖúÕ½»ý·Ö;23-·ûÓ¡¾«»ª;24-·ûÓ¡Ë鯬;25-Ѱ±¦»ý·Ö;26-¼¯Êжî¶È;27-µ¤¾«;28-»ê³¾;")
        GameWorld.DebugAnswer(curPlayer, "29-¾Û»êË鯬;30-ºËÐÄ»·")
        return
    #Ç®±ÒÀàÐÍ
    moneyType = List[0]
    #Ç®±ÒÊýÁ¿
    moneyCount = List[1]
    #ÊäÈëÀàÐͲ»¶ÔÌáʾǮ±ÒÀàÐÍ´í
    if type(moneyType) != int or type(moneyCount) not in [int, long]:
        GameWorld.DebugAnswer(curPlayer, Lang.GBText("²ÎÊý²»ÕýÈ·"))
        return
    #Ç®±ÒÀàÐÍ·¶Î§
    if moneyType not in [1,2,3,4] and moneyType not in ShareDefine.TYPE_Price_CurrencyDict:
        GameWorld.DebugAnswer(curPlayer, Lang.GBText("Ç®±ÒÀàÐͲ»ÕýÈ·"))
        return
    #0ÎIJ»´¦Àí
    if moneyCount < 0:
        return
    playerMoney = PlayerControl.GetMoney(curPlayer, moneyType)
    if playerMoney > moneyCount:
        PlayerControl.PayMoney(curPlayer, moneyType, playerMoney - moneyCount, ChConfig.Def_Cost_GM, {ChConfig.Def_Cost_Reason_SonKey:"SetMoney"})
    elif playerMoney < moneyCount:
        PlayerControl.GiveMoney(curPlayer, moneyType, moneyCount - playerMoney, ChConfig.Def_GiveMoney_GM, {ChConfig.Def_Give_Reason_SonKey:"SetMoney"})
        
    return