| | |
| | | PlayerLoginRefreshFamily(crossPlayer) # 必须先刷新
|
| | | Sync_RequestAddFamilyInfo(crossPlayer, False)
|
| | | PlayerTalk.NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcFamily]) # 公会聊天缓存
|
| | | if GameWorld.IsCrossServer():
|
| | | PlayerTalk.NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcCountry]) # 跨服公会聊天缓存
|
| | | PlayerFamilyTaofa.OnCrossPlayerLogin(crossPlayer)
|
| | | return
|
| | |
|
| | |
| | | joinCDMinute = joinCDMinuteList[kickedCnt - 1] if len(joinCDMinuteList) >= kickedCnt else joinCDMinuteList[-1]
|
| | | if joinCDMinute:
|
| | | cdTimes = joinCDMinute * 60
|
| | | passTimes = int(time.time()) - leaveFamilyTime
|
| | | passTimes = GetFamilyTime() - leaveFamilyTime
|
| | | if passTimes < cdTimes:
|
| | | GameWorld.DebugLog("加入公会CD中: leaveCnt=%s,kickedCnt=%s,lastVoluntarily=%s,leaveFamilyTime=%s(%s),passTimes=%s < %s"
|
| | | % (leaveCnt, kickedCnt, lastVoluntarily, leaveFamilyTime, GameWorld.ChangeTimeNumToStr(leaveFamilyTime), passTimes, cdTimes))
|
| | | return True
|
| | | return False
|
| | |
|
| | | def GetFamilyTime():
|
| | | if GameWorld.IsMainServer() and DBFamily.IsFamilyCross():
|
| | | return CrossMgr.GetSSServerMgr().GetCrossTime()
|
| | | return int(time.time())
|
| | |
|
| | | def AutoJoinFamily(crossPlayer):
|
| | | if crossPlayer.GetFamilyID():
|
| | |
| | | if CheckFamilyNameExists(crossPlayer, newName, fromServerID):
|
| | | return
|
| | |
|
| | | zoneMgr = familyMgr.GetZoneFamilyMgrByFamilyID(familyID)
|
| | | if not zoneMgr:
|
| | | return
|
| | | |
| | | if not zoneMgr.FamilyRemainName(family, newName):
|
| | | return
|
| | | |
| | | if cdHours:
|
| | | SetRenameTime(family, curTime)
|
| | | |
| | | moneyType, moneyValue = IpyGameDataPY.GetFuncEvalCfg("FamilyRename", 1)
|
| | | if moneyType and moneyValue:
|
| | | CrossPlayer.CostPlayerResources(crossPlayer, "FamilyRename", costMoneyDict={moneyType:moneyValue})
|
| | | |
| | | family.SetName(newName) |
| | | if cdHours:
|
| | | SetRenameTime(family, curTime)
|
| | |
|
| | | crossPlayerMgr = CrossPlayer.GetCrossPlayerMgr()
|
| | | for index in xrange(family.GetCount()):
|
| | |
| | | def OnFamilyTalk(curPlayer, familyID, talkPack, tick):
|
| | | clientData, tick = None, 0
|
| | | reqDataEx = {"talkBuffer":talkPack.GetBuffer()}
|
| | | FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnFamilyTalk", reqCD=0, reqDataEx=reqDataEx)
|
| | | FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnFamilyTalk", reqDataEx=reqDataEx)
|
| | | return
|
| | | def __OnFamilyTalk(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
|
| | | talkBuffer = reqDataEx["talkBuffer"]
|
| | |
| | | content = clientPack.Content
|
| | | bubbleBox = clientPack.BubbleBox
|
| | | PlayerTalk.DoTalkCache(channelType, playerID, content, bubbleBox, familyID)
|
| | | return
|
| | |
|
| | | def OnCrossFamilyTalk(curPlayer, talkPack, tick):
|
| | | ## 跨服公会聊天,与跨服公会互通范围一致
|
| | | crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
|
| | | if crossServerID <= 0:
|
| | | GameWorld.DebugLog("本服公会未互通,不允许跨服聊天")
|
| | | return
|
| | | clientData, tick = None, 0
|
| | | reqDataEx = {"talkBuffer":talkPack.GetBuffer()}
|
| | | FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnCrossTalk", reqDataEx=reqDataEx)
|
| | | return
|
| | | def __OnCrossTalk(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
|
| | | talkBuffer = reqDataEx["talkBuffer"]
|
| | | playerID = crossPlayer.GetPlayerID()
|
| | | |
| | | if not talkBuffer:
|
| | | return
|
| | | |
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | zoneID = familyMgr.GetZoneIDInThisServer(fromServerID)
|
| | | if zoneID < 0:
|
| | | GameWorld.ErrLog("找不到服务器ID在跨服中的公会分区! fromServerID=%s" % fromServerID)
|
| | | return
|
| | | zoneMgr = familyMgr.GetZoneFamilyMgr(zoneID)
|
| | | serverIDList = zoneMgr.GetZoneServerIDList()
|
| | | if not serverIDList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCTalk()
|
| | | clientPack.ReadData(talkBuffer)
|
| | | CrossPlayer.SendFackPackToServerList(clientPack, serverIDList)
|
| | | |
| | | # 聊天缓存
|
| | | channelType = clientPack.ChannelType
|
| | | content = clientPack.Content
|
| | | bubbleBox = clientPack.BubbleBox
|
| | | PlayerTalk.DoTalkCache(channelType, playerID, content, bubbleBox)
|
| | | return
|
| | |
|
| | | ## -------------------------------------- 游戏服本服处理 --------------------------------------------
|
| | |
| | | curPlayer.SetFamilyActiveValue(0)
|
| | | curPlayer.SetLastWeekFamilyActiveValue(0)
|
| | | curPlayer.SetFamilyLV(0)
|
| | | PlayerControl.SetLeaveFamilyTimeEx(curPlayer, int(time.time()))
|
| | | PlayerControl.SetLeaveFamilyTimeEx(curPlayer, GetFamilyTime())
|
| | | leaveCnt, kickedCnt, _ = PlayerControl.GetLeaveFamilyInfo(curPlayer)
|
| | | GameWorld.DebugLog("__OnLeaveFamily: isVoluntarily=%s,leaveCnt=%s,kickedCnt=%s" % (isVoluntarily, leaveCnt, kickedCnt))
|
| | | delMoneyType, delMoneyPer = IpyGameDataPY.GetFuncCfg("FamilyLeave", 3), 0
|