#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GameWorldLogic.FBProcess.GameLogic_CrossGrassland # # @todo:¿ç·þ²ÝÔ° # @author hxp # @date 2019-04-15 # @version 1.0 # # ÏêϸÃèÊö: ¿ç·þ²ÝÔ° # #------------------------------------------------------------------------------- #"""Version = 2019-04-15 16:30""" #------------------------------------------------------------------------------- import GameWorld import GameWorldProcess import PlayerFairyDomain import NPCCustomRefresh import IpyGameDataPY import PyGameData import NPCCommon import PlayerControl import ChConfig def DoResetCrossGrassland(curPlayer, eventType, fdeventID): ## ²ÝÔ°ÖØÖà resetCollectType = 10 + eventType NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType]) # ±¦Ïä¹Ö´ÎÊýÖØÖà if eventType == PlayerFairyDomain.FDEventType_GrasslandXian: npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1) if npcID: NPCCommon.UpdateNPCAttackCount(curPlayer, [npcID], 0) return def __SetGrasslandVisitState(curPlayer, mapID, lineID, state): ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID}) if not ipyData: return False eventID = ipyData.GetID() if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, eventID, state): return False return True def OnEnterFBEvent(curPlayer, mapID, lineID, tick): if not __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting): return False return True ## ¿ªÆô¸±±¾ def OnOpenFB(tick): gameWorld = GameWorld.GetGameWorld() realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID() key = (realMapID, copyMapID) if key in PyGameData.g_crossFuncLineDataCache: refreshNPCInfo = PyGameData.g_crossFuncLineDataCache[key] GameWorld.DebugLog("¸±±¾¿ªÆô¸ù¾Ý±£´æµÄÐéÄâÏß·±êÊÔµãË¢¹ÖÐÅϢˢ¹Ö: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo)) NPCCustomRefresh.OnFBOpenSetRandomRefreshNPCInfo(refreshNPCInfo, tick) return def GetCurFBFuncLineID(): ## »ñÈ¡±¾Ïß·¹¦ÄÜÏß·ID return GameWorld.GetGameWorld().GetPropertyID() % 10000 / 10 def GetCurFBLineZoneID(): ## »ñÈ¡±¾Ïß·ËùÊô¿ç·þ·ÖÇø return GameWorld.GetGameWorld().GetPropertyID() / 10000 ## ½ø¸±±¾ def DoEnterFB(curPlayer, tick): playerID = curPlayer.GetPlayerID() zoneID = GetCurFBLineZoneID() funcLineID = GetCurFBFuncLineID() GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s" % (zoneID, funcLineID), playerID) return ## ¸±±¾×ÜÂß¼­¼ÆÊ±Æ÷ def OnProcess(tick): return ## ¹Ø±Õ¸±±¾ def OnCloseFB(tick): gameWorld = GameWorld.GetGameWorld() refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo() if refreshNPCInfo: realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID() key = (realMapID, copyMapID) PyGameData.g_crossFuncLineDataCache[key] = refreshNPCInfo GameWorld.DebugLog("»º´æÐéÄâÏß·±êÊÔµãË¢¹ÖÐÅÏ¢: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo)) GameWorld.GetGameWorld().SetPropertyID(0) return ## Íæ¼ÒÍ˳ö¸±±¾ def DoExitFB(curPlayer, tick): return ##Íæ¼ÒÖ÷¶¯À뿪¸±±¾. def DoPlayerLeaveFB(curPlayer, tick): gameWorld = GameWorld.GetGameWorld() #×îºóÒ»ÈËÍ˳ö¸±±¾Ôò¹Ø±ÕµØÍ¼ if gameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1: GameWorldProcess.CloseFB(tick) return ## ¿Í»§¶Ë½øÈë×Ô¶¨Ò峡¾° def OnEnterCustomScene(curPlayer, mapID, lineID): __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting) return def DoCheckUpdateGrasslandEnd(curPlayer): ## ¼ì²é¸üвÝÔ°ÒѰݷÃÍê³É grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian] crossMapID = PlayerControl.GetCrossMapID(curPlayer) clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID) if crossMapID in grasslandMapIDList: mapID = crossMapID lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine) elif clientCustomSceneMapID in grasslandMapIDList: mapID = clientCustomSceneMapID lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID) else: return # ²É¼¯´ÎÊýÊÇ·ñÒÑÓÃÍê collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID) if not collNPCIpyDataList: return for collIpyData in collNPCIpyDataList: npcIDList = collIpyData.GetNPCIDList() for npcID in npcIDList: collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID) if not collectNPCIpyData: return limitMaxTime = collectNPCIpyData.GetMaxCollectCount() totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID) if totalCollTime < limitMaxTime: GameWorld.DebugLog("²ÝÔ°NPC²É¼¯´ÎÊýδÓÃÍê! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime)) return # ±¦Ïä¹Ö¹¥»÷´ÎÊýÊÇ·ñÒÑÓÃÍê if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian: boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1) boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID) if not boxNPCIpyData: return attackCountDropWeightInfo = boxNPCIpyData.GetAttackCountDropWeightInfo() if not attackCountDropWeightInfo: return maxAttackCount = max(attackCountDropWeightInfo) attackCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % boxNPCID) if attackCount < maxAttackCount: GameWorld.DebugLog("²ÝÔ°±¦Ïä¹Ö¹¥»÷´ÎÊýδÓÃÍê! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount)) return __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited) GameWorld.DebugLog("ÉèÖòÝÔ°ÒÑÍê³É!mapID=%s, lineID=%s" % (mapID, lineID)) return