#!/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