hxp
2019-04-16 767426c623624202acd0c97854946f4fafafe904
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
113
114
115
116
117
118
119
120
#!/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
 
def DoResetCrossGrassland(curPlayer, eventType):
    ## ²ÝÔ°ÖØÖÃ
    
    resetCollectType = 10 + eventType
    NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType])
    
    # ±¦Ïä¹Ö´ÎÊýÖØÖÃ
    
    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
 
## ¸ø×Ô¶¨Ò帱±¾½±ÀøºóÐø´¦Àí
## @return: ·µ»Ø½áË㸱±¾overÐÅÏ¢×ֵ䣬²»º¬jsonItemÐÅÏ¢
def OnGiveCustomFBPrizeOK(curPlayer, mapID, lineID):
    __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
    overDict = {}
    return overDict