#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#
|
# @todo:
|
#
|
# @author: Alee
|
# @date 2017-12-29 ÏÂÎç02:02:23
|
# @version 1.0
|
#
|
# @note: ¹¹½¨¹¤¾ßÐèͬ²½´Ë±í
|
#
|
#---------------------------------------------------------------------
|
import CommFunc
|
import logging
|
# 1. ¹¹½¨±í
|
|
|
class ChinMapData():
|
def __init__(self):
|
#MapID Name Country LV ExistTime MapFBType AutoSize Period PeriodValue1 PeriodHour1
|
#PeriodMinute1 PeriodValue2 PeriodHour2 PeriodMinute2 LocalReborn SkillReborn RebornMap
|
#RebornMapX RebornMapY CanRide CanOutPet TreasureID
|
self.MapID = 0
|
self.LV = 0
|
self.TreasureID = 0
|
self.MapFBType = 0
|
|
def ReadFromList(self, curList):
|
self.MapID = CommFunc.ToIntDef(curList[0])
|
self.LV = CommFunc.ToIntDef(curList[3])
|
self.MapFBType = CommFunc.ToIntDef(curList[5])
|
self.TreasureID = eval(curList[21])
|
|
|
return
|
|
|
class ChinMapDataMgr():
|
def __init__(self):
|
self.__Table = []
|
|
def InitTable(self, tablePath):
|
fileIO = open(tablePath, "r")
|
lines = fileIO.readlines()
|
|
linenum = 0
|
for line in lines:
|
linenum += 1
|
# 1.×Ö¶ÎÃû
|
if linenum <= 1:
|
continue
|
classObj = ChinMapData()
|
lineList = line.split('\t')
|
classObj.ReadFromList(lineList)
|
|
self.__Table.append(classObj)
|
|
def FindMaxMapID(self, lv, fbID):
|
maxMapID = self.__Table[0].MapID # ĬÈϵÚÒ»ÕŵØÍ¼
|
for mapData in self.__Table:
|
# 10000¿ªÍ·ÎªÒ°Íâ¹Ò»úµØÍ¼
|
if mapData.MapID/10000 != 1:
|
continue
|
|
if lv < mapData.LV:
|
continue
|
|
if fbID < mapData.TreasureID:
|
continue
|
|
maxMapID = mapData.MapID
|
|
return maxMapID
|
|
def FindMapByID(self, mapID):
|
for mapData in self.__Table:
|
if mapData.MapID != mapID:
|
continue
|
|
return mapData
|
|
__gChinMapDataReader = None
|
|
def ReadChinMapData( PyBaseRoot):
|
global __gChinMapDataReader
|
if not __gChinMapDataReader:
|
__gChinMapDataReader = ChinMapDataMgr()
|
__gChinMapDataReader.InitTable(PyBaseRoot + "Data\\tagChinMap.txt")
|
|
def GetChinMapData():
|
global __gChinMapDataReader
|
return __gChinMapDataReader
|