hxp
9 天以前 e5353bd8a09e4a134ad18f0a8855770669cf43bb
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
110
111
112
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.GoldRush
#
# @todo:ÌÔ½ð
# @author hxp
# @date 2025-09-03
# @version 1.0
#
# ÏêϸÃèÊö: ÌÔ½ð
#
#-------------------------------------------------------------------------------
#"""Version = 2025-09-03 15:30"""
#-------------------------------------------------------------------------------
 
import GameWorld
import PlayerControl
import PlayerGoldRush
import IpyGameDataPY
import ChConfig
import time
 
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param msgList ²ÎÊýÁбí [addSkillID]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, msgList):
    # @return: ÊÇ·ñ·¢Ë͵½GameServer
    
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "---------- ÌÔ½ðÃüÁî ----------")
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÌÔ½ð: GoldRush 0")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÓªµØ: GoldRush c ID ÊÇ·ñ½âËø")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖü๤: GoldRush w ID ÊÇ·ñ½âËø")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖòֿâ: GoldRush a Ëæ»úδÁìÈ¡½±ÀøÊý")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖôÎÊý: GoldRush r ÒÑÌÔ½ð´ÎÊý")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖùܼÒ: GoldRush k Ê£Óàʱ³¤·ÖÖÓ")
        return True
    
    value1 = msgList[0]
    if value1 == 0:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCnt, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushRecoverTime, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, 0)
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        for index in range(ipyDataMgr.GetGoldRushCampCount()):
            ipyData = ipyDataMgr.GetGoldRushCampByIndex(index)
            campID = ipyData.GetCampID()
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampInfo % campID, 0)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampEndTime % campID, 0)
        for index in range(sum(IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1))):
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, 0)
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÌÔ½ð")
        
    elif value1 == "c":
        campID = msgList[1] if len(msgList) > 1 else 0
        unlock = msgList[2] if len(msgList) > 2 else 0
        unlockState = 1 if unlock else 0
        campState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushCampState)
        campState = GameWorld.SetBitValue(campState, campID, unlockState)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCampState, campState)
        GameWorld.DebugAnswer(curPlayer, "ÓªµØ(%s)ÊÇ·ñ½âËø: %s" % (campID, unlockState))
        
    elif value1 == "w":
        workerID = msgList[1] if len(msgList) > 1 else 0
        unlock = msgList[2] if len(msgList) > 2 else 0
        unlockState = 1 if unlock else 0
        workerState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWorkerState)
        workerState = GameWorld.SetBitValue(workerState, workerID, unlockState)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWorkerState, workerState)
        GameWorld.DebugAnswer(curPlayer, "¼à¹¤(%s)ÊÇ·ñ½âËø: %s" % (workerID, unlockState))
        
    elif value1 == "a":
        ungetCnt = msgList[1] if len(msgList) > 1 else 0
        spaceList = IpyGameDataPY.GetFuncEvalCfg("GoldRush", 1)
        maxSpace = sum(spaceList) if PlayerGoldRush.GoldRushAutoCanUse(curPlayer) else spaceList[0]
        for index in range(maxSpace):
            if ungetCnt <= 0:
                break
            if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldRushWarehouse % index):
                continue
            ipyData = PlayerGoldRush.GetRefreshGoldItemIpyData(curPlayer)
            if not ipyData:
                continue
            goldID = ipyData.GetGoldID()
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushWarehouse % index, goldID)
            GameWorld.DebugAnswer(curPlayer, "ÌÔ½ð²Ö¿âËæ»úδÁìÈ¡:index:%s,ID:%s" % (index, goldID))
            ungetCnt -= 1
            
    elif value1 == "r":
        goldRushCnt = msgList[1] if len(msgList) > 1 else 0
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushCnt, goldRushCnt)
        GameWorld.DebugAnswer(curPlayer, "ÒÑÌÔ½ð´ÎÊý: %s" % goldRushCnt)
    elif value1 == "k":
        remainMinutes = msgList[1] if len(msgList) > 1 else 0
        if remainMinutes > 0:
            endTime = int(time.time()) + remainMinutes * 60
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, endTime)
            GameWorld.DebugAnswer(curPlayer, "ÉèÖùܼҵ½ÆÚʱ¼ä: %s" % GameWorld.ChangeTimeNumToStr(endTime))
        else:
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldRushAutoEndTime, 0)
            GameWorld.DebugAnswer(curPlayer, "ÖØÖùܼҵ½ÆÚʱ¼ä: 0")
    else:
        return
    PlayerGoldRush.SyncGoldRushInfo(curPlayer)
    PlayerGoldRush.SyncGoldCampInfo(curPlayer)
    return