#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # ##@package GM.Commands.AddFairyEvent # # @todo:Ôö¼ÓçÎç¿Ê¼þ # @author xdh # @date 2019-4-13 # @version 1.0 # # ÏêϸÃèÊö: Ôö¼ÓçÎç¿Ê¼þ # #--------------------------------------------------------------------- """Version = 2019-4-13 16:00""" #--------------------------------------------------------------------- import IpyGameDataPY import GameWorld import ChConfig import PlayerFairyDomain import GameLogic_CrossGrassland import PlayerControl import ShareDefine import random #--------------------------------------------------------------------- #Âß¼­ÊµÏÖ ## GMÃüÁîÖ´ÐÐÈë¿Ú # @param curPlayer µ±Ç°Íæ¼Ò # @param msgList ²ÎÊýÁбí # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def OnExec(curPlayer, msgList): if not msgList: GameWorld.DebugAnswer(curPlayer, "AddFairyEvent ʼþID ʼþID ...") return maxEventCnt = PlayerFairyDomain.GetMaxEventCnt() # ×î´ó¿É³öÏÖʼþ¸öÊý if len(msgList) > maxEventCnt: GameWorld.DebugAnswer(curPlayer, "×î´óʼþÊýÁ¿ %s"%maxEventCnt) fdEventIDList = msgList[:maxEventCnt] openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1 for i in xrange(maxEventCnt): prefdEventID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventID % i) if prefdEventID: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % prefdEventID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % prefdEventID, 0) fdEventID = fdEventIDList[i] if i < len(fdEventIDList) else 0 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventID % i, fdEventID) if fdEventID: PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, PlayerFairyDomain.FDEventState_CanVisit) if fdEventID in PlayerFairyDomain.AdventuresTypeList: ipyData = IpyGameDataPY.InterpolationSearch('FairyAdventures', 'OpenServerDay', openServerDay, {'EventID':fdEventID}) if ipyData: conditionList = ipyData.GetCondition() if conditionList: condition = random.choice(conditionList) index = conditionList.index(condition) else: index = 0 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, ipyData.GetID() * 100 + index) ipyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdEventID) if not ipyData: continue # ²ÝÔ°ÖØÖà if ipyData.GetEventType() in [PlayerFairyDomain.FDEventType_GrasslandXian, PlayerFairyDomain.FDEventType_GrasslandLing]: GameLogic_CrossGrassland.DoResetCrossGrassland(curPlayer, ipyData.GetEventType(), fdEventID) #ÉèÖÃѰ·ÃÖÐ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 1) #ÉèÖóõʼÌåÁ¦ initEnergy = IpyGameDataPY.GetFuncCfg('ImmortalDomainStrength') PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEnergy, initEnergy) PlayerFairyDomain.NotifyVisitFairyDomainInfo(curPlayer, fdEventIDList) PlayerFairyDomain.NotifyFairyAdventuresInfo(curPlayer) GameWorld.DebugAnswer(curPlayer, "ÐÂÔö ʼþ fdEventIDList=%s"%fdEventIDList) return