| | |
| | | except ValueError:
|
| | | return defValue
|
| | |
|
| | | def ToFloat(input, defValue = 0):
|
| | | try:
|
| | | result = float(input)
|
| | | return result
|
| | | |
| | | except ValueError:
|
| | | return defValue
|
| | | |
| | | ## 判断2个对象是否同国籍
|
| | | # @param srcObj 起点对象
|
| | | # @param desObj 目标对象
|
| | |
| | | ##获取玩家所属区服ID
|
| | | # @param curPlayer
|
| | | # @return
|
| | | def GetPlayerServerID(curPlayer):
|
| | | accID = curPlayer.GetAccID()
|
| | | def GetPlayerServerID(curPlayer): return GetAccIDServerID(curPlayer.GetAccID())
|
| | | def GetAccIDServerID(accID):
|
| | | infoList = accID.split(Def_AccID_Split_Sign)
|
| | | return 0 if len(infoList) < 3 else int(infoList[-1][1:])
|
| | |
|
| | |
| | | if cfgID == None or dayIndex == None or not ipyData:
|
| | | return 0
|
| | | templateIDList = ipyData.GetTemplateIDList()
|
| | | if not templateIDList:
|
| | | return 0
|
| | | templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
|
| | | return templateID
|
| | |
|
| | | def GetTemplateIDByList(templateIDList, dayIndex):
|
| | | if dayIndex == None:
|
| | | return 0
|
| | | if not templateIDList:
|
| | | return 0
|
| | | templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
|
| | | return templateID
|
| | |
|
| | |
| | |
|
| | | return 0
|
| | |
|
| | | def DebugAnswer(curPlayer, text):
|
| | | def DebugAnswer(curPlayer, text, isLog=True):
|
| | | '''转码后再发DebugAnswer'''
|
| | | #===========================================================================
|
| | | # if not GetGameWorld().GetDebugLevel():
|
| | | # return
|
| | | #===========================================================================
|
| | | DebugLog(text)
|
| | | if isLog:
|
| | | DebugLog(text)
|
| | | text = text.decode(ShareDefine.Def_Game_Character_Encoding).encode(GetCharacterEncoding())
|
| | | curPlayer.DebugAnswer(text)
|
| | | return
|