|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 进行匹配 | 
|---|
|  |  |  | if requestType == 1: | 
|---|
|  |  |  | if not CheckHavePKCount(curPlayer): | 
|---|
|  |  |  | GameWorld.DebugLog("PK次数不足,无法发起匹配!", curPlayer.GetPlayerID()) | 
|---|
|  |  |  | dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1) | 
|---|
|  |  |  | if dayFreeMatchCountMax: | 
|---|
|  |  |  | todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) | 
|---|
|  |  |  | todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount) | 
|---|
|  |  |  | todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount): | 
|---|
|  |  |  | GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s + todayItemAddCount=%s)" | 
|---|
|  |  |  | % (todayPKCount, dayFreeMatchCountMax, todayBuyCount, todayItemAddCount), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dataMsg = { | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.Log("    发送取消匹配到GameServer sendMsg=%s" % str(sendMsg), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CheckHavePKCount(curPlayer): | 
|---|
|  |  |  | ## 检查是否有PK次数 | 
|---|
|  |  |  | dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1) | 
|---|
|  |  |  | if dayFreeMatchCountMax: | 
|---|
|  |  |  | todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) | 
|---|
|  |  |  | todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount) | 
|---|
|  |  |  | todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount): | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CrossServerMsg_PKOverInfo(curPlayer, overInfo): | 
|---|
|  |  |  | ## 收到跨服服务器的PK结算信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | if not IsCrossRealmPKMatchState(): | 
|---|
|  |  |  | GameWorld.DebugLog("跨服匹配未开启,不可进行购买次数!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if CheckHavePKCount(curPlayer): | 
|---|
|  |  |  | GameWorld.DebugLog("有PK次数,不需要购买次数!", playerID) | 
|---|
|  |  |  | dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1) | 
|---|
|  |  |  | if not dayFreeMatchCountMax: | 
|---|
|  |  |  | GameWorld.DebugLog("每日匹配次数没有限制,不需要购买次数!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) | 
|---|
|  |  |  | todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount) | 
|---|
|  |  |  | todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount) | 
|---|
|  |  |  | canPKCount = dayFreeMatchCountMax + todayBuyCount + todayItemAddCount - todayPKCount | 
|---|
|  |  |  | if canPKCount >= dayFreeMatchCountMax: | 
|---|
|  |  |  | GameWorld.DebugLog("可PK次数不能大于每日免费次数!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | dayBuyCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 2) | 
|---|
|  |  |  | todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount) | 
|---|
|  |  |  | #todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount) | 
|---|
|  |  |  | if dayBuyCountMax and todayBuyCount >= dayBuyCountMax: | 
|---|
|  |  |  | GameWorld.DebugLog("今日购买次数已满,无法购买!todayBuyCount=%s" % (todayBuyCount), playerID) | 
|---|
|  |  |  | return | 
|---|