|  |  |  | 
|---|
|  |  |  | import PlayerFamilySWRH | 
|---|
|  |  |  | import PlayerViewCache | 
|---|
|  |  |  | import GameWorldBoss | 
|---|
|  |  |  | import AuctionHouse | 
|---|
|  |  |  | import PlayerTalk | 
|---|
|  |  |  | import PlayerTeam | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import copy | 
|---|
|  |  |  | import random | 
|---|
|  |  |  | 
|---|
|  |  |  | def GetCurWeekMissionMoney(curFamily): return curFamily.GetExtra2() | 
|---|
|  |  |  | def SetCurWeekMissionMoney(curFamily, value): return curFamily.SetExtra2(min(value, ChConfig.Def_UpperLimit_DWord)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 仙盟上次处理的合服天 | 
|---|
|  |  |  | def GetFamilyMixServerDay(curFamily): return curFamily.GetExtra1() | 
|---|
|  |  |  | def SetFamilyMixServerDay(curFamily, value): return curFamily.SetExtra1(value) | 
|---|
|  |  |  | ## ------------------ 成员 ---------------------- | 
|---|
|  |  |  | def GetMemberFightPower(curMember): return curMember.GetExattr3() | 
|---|
|  |  |  | def SetMemberFightPower(curMember, fightPower): return curMember.SetExattr3(fightPower) | 
|---|
|  |  |  | 
|---|
|  |  |  | curFamily.SetAcceptJoin(ShareDefine.FamilyAcceptJoin_Agree)     #设置收人方式为直接通过申请 | 
|---|
|  |  |  | PyDataManager.GetFamilyStoreItemManager().DelFamilyStoreItemAll(curFamily.GetID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #新创建的仙盟默认设置已处理过合服 | 
|---|
|  |  |  | SetFamilyMixServerDay(curFamily, PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #-设置家族成员属性 | 
|---|
|  |  |  | DoPlayerJionFamily(curFamily, curPlayer, IPY_GameServer.fmlLeader) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 玩家战盟名变更处理 | 
|---|
|  |  |  | __OnFamilyNameChange(jionPlayer.GetPlayerID(), curFamily.GetName()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #玩家缓存 | 
|---|
|  |  |  | PlayerViewCache.OnPlayerFamilyChange(jionPlayer.GetPlayerID(), curFamily.GetID(), curFamily.GetName()) | 
|---|
|  |  |  | PlayerTeam.OnTeamMemFamilyRefresh(jionPlayer, curFamily.GetID()) | 
|---|
|  |  |  | #加入仙盟联赛成员 | 
|---|
|  |  |  | GameWorldFamilyWar.AddFamilyWarMem(jionPlayer.GetPlayerID(), curFamily.GetID()) | 
|---|
|  |  |  | GameWorldFamilyWar.CheckPlayerJoinFamilyWarInfo(jionPlayer) | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerFamilyBoss.NotifyFamilyBossFBInfo(jionPlayer) | 
|---|
|  |  |  | #通知家族仓库 | 
|---|
|  |  |  | PyDataManager.GetFamilyStoreItemManager().SyncFamilyStoreItem(jionPlayer, curFamily.GetID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #仙盟拍品 | 
|---|
|  |  |  | AuctionHouse.Sync_FamilyAuctionItemInfo(jionPlayer, curFamily.GetID()) | 
|---|
|  |  |  | SetMemberFightPower(familyMember, jionPlayer.GetFightPower()) | 
|---|
|  |  |  | AddFamilyIDToFightPowerChangeList(curFamily.GetID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog('    玩家战盟名变更处理, newFamilyName=%s' % familyName, playerID) | 
|---|
|  |  |  | #不处理排行榜 | 
|---|
|  |  |  | needChangeFamilyBillboardList = [ | 
|---|
|  |  |  | #ShareDefine.Def_BT_MixCampaign_Recharge,  # 累计充值(合服活动) | 
|---|
|  |  |  | #ShareDefine.Def_BT_RechargeTeHui,  # 充值特惠活动排行榜-当前期记录 | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | billboardMgr = GameWorld.GetBillboard() | 
|---|
|  |  |  | for billboardIndex in needChangeFamilyBillboardList: | 
|---|
|  |  |  | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, familyViewPack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// A4 12 搜索家族 #tagCGPySearchFamily | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #struct    tagCGPySearchFamily | 
|---|
|  |  |  | #{ | 
|---|
|  |  |  | #    tagHead        Head; | 
|---|
|  |  |  | #    BYTE        MsgLen;        //模糊搜索家族,如果输入为空,则为不限制该条件 | 
|---|
|  |  |  | #    char        Msg[MsgLen];    //size = MsgLen | 
|---|
|  |  |  | #    BYTE        LV;        //最低家族等级,如果为0,则不限制该条件 | 
|---|
|  |  |  | #    BYTE        MaxCount;    //搜索结果所需最大条数,后端限制最多返回20条 | 
|---|
|  |  |  | #    BYTE        IsSearching;    //默认1,如果有指定其他值,则返回指定值 | 
|---|
|  |  |  | #}; | 
|---|
|  |  |  | def PySearchFamily(index, clientData, tick): | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | msg = clientData.Msg | 
|---|
|  |  |  | minFamilyLV = clientData.LV | 
|---|
|  |  |  | maxCount = min(20, clientData.MaxCount) | 
|---|
|  |  |  | IsSearching = clientData.IsSearching | 
|---|
|  |  |  |  | 
|---|
|  |  |  | familyMgr = GameWorld.GetFamilyManager() | 
|---|
|  |  |  | familyViewPack = ChPyNetSendPack.tagGCPyAllFamilyView() | 
|---|
|  |  |  | familyViewPack.Clear() | 
|---|
|  |  |  | familyViewPack.IsSearching = IsSearching | 
|---|
|  |  |  | familyViewPack.TotalCount = 1 | 
|---|
|  |  |  | #familyViewPack.CurPage = viewPage | 
|---|
|  |  |  | familyViewPack.Family = [] | 
|---|
|  |  |  | for i, familyID in enumerate(PyGameData.g_sortFamilyIDList): | 
|---|
|  |  |  | family = familyMgr.FindFamily(familyID) | 
|---|
|  |  |  | if not family: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if msg not in family.GetName(): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if minFamilyLV and family.GetLV() < minFamilyLV: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | familyViewPack.Family.append(__GetFamilyView(i, family)) | 
|---|
|  |  |  | if len(familyViewPack.Family) >= maxCount: | 
|---|
|  |  |  | break | 
|---|
|  |  |  | familyViewPack.PageCount = len(familyViewPack.Family) | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, familyViewPack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #class   IPY_CFamilyChangeBroadcast | 
|---|
|  |  |  | #{ | 
|---|
|  |  |  | #public: | 
|---|
|  |  |  | 
|---|
|  |  |  | pack = IPY_GameServer.IPY_CFamilyChangeBroadcast() | 
|---|
|  |  |  | #更改家族公告 | 
|---|
|  |  |  | curFamily.SetBroadcast(pack.GetMsg()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.Log('更改仙盟公告 Family=%s,公告=%s'%(GameWorld.CodeToGBK(curFamily.GetName()), GameWorld.CodeToGBK(pack.GetMsg())), curPlayerID) | 
|---|
|  |  |  | #通知客户端家族信息改变 | 
|---|
|  |  |  | curFamily.Broadcast_FamilyChange() | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | 
|---|
|  |  |  | if pack_FamilyLv not in ChConfig.Def_Family_MemberLVList: | 
|---|
|  |  |  | GameWorld.Log("更改家族成员等级->封包异常->等级 = %s不存在" % (pack_FamilyLv), curPlayerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if curMember.GetFamilyLV() != IPY_GameServer.fmlLeader: | 
|---|
|  |  |  | if tagMember.GetFamilyLV() >= curMember.GetFamilyLV() or pack_FamilyLv >= curMember.GetFamilyLV(): | 
|---|
|  |  |  | GameWorld.Log("更改家族成员等级->目标职位比自己的高或者对方的当前职位比自己高", curPlayerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if not isGMOP: | 
|---|
|  |  |  | if curMember.GetFamilyLV() != IPY_GameServer.fmlLeader: | 
|---|
|  |  |  | if tagMember.GetFamilyLV() >= curMember.GetFamilyLV() or pack_FamilyLv >= curMember.GetFamilyLV(): | 
|---|
|  |  |  | GameWorld.Log("更改家族成员等级->目标职位比自己的高或者对方的当前职位比自己高", curPlayerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | familyID = curFamily.GetID()  # 家族ID | 
|---|
|  |  |  | familyName = curFamily.GetName()  # 家族名字 | 
|---|
|  |  |  | 
|---|
|  |  |  | if tagMember.GetFamilyLV() != pack_FamilyLv: | 
|---|
|  |  |  | #XW_JZ_AppointFamily <n color="255,255,0">恭喜</n><n color="0,190,255">{%S1%}</n><n color="255,255,0">,被任命为{%S2%}!</n>    25  -   - | 
|---|
|  |  |  | NotifyAllFamilyMemberMsg(curFamily, curPlayer, "XW_JZ_AppointFamily", [tagMember.GetName(), pack_FamilyLv]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if tagMember.GetFamilyLV() == IPY_GameServer.fmlViceLeader and tagMember.GetPlayerID() in PyGameData.g_autoViceleaderDict.get(familyID, []): | 
|---|
|  |  |  | #自动安排的副盟主被撤职则该盟不再自动安排 | 
|---|
|  |  |  | if familyID not in PyGameData.g_forbidAutoViceleaderFamily: | 
|---|
|  |  |  | PyGameData.g_forbidAutoViceleaderFamily.append(familyID) | 
|---|
|  |  |  | #更改家族等级 | 
|---|
|  |  |  | ChangeFamilyMemberLv(tagMember, pack_FamilyLv) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if GetFamilyMemberHasPow(tagMember, ChConfig.Def_PurviewDictKey_CanCall): | 
|---|
|  |  |  | tagPlayer.Sync_FamilyInfo() | 
|---|
|  |  |  | PlayerFamilyAction.ViewFamilyRequestInfo(tagPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isGMOP: | 
|---|
|  |  |  | curFamily.SetBroadcast('') | 
|---|
|  |  |  | curFamily.Broadcast_FamilyChange() | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | 
|---|
|  |  |  | if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if PlayerFamilyBoss.IsInAllFamilyBoss(): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "LeagueBOSSExitError1") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if AuctionHouse.IsFamilyMemberBiddingAuctionItem(curFamily.GetID(), tagMemberID): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "Paimai7") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | tagPlayerName = curTagMember.GetName()  # 被踢玩家名 | 
|---|
|  |  |  | tagPlayerID = curTagMember.GetPlayerID()  # 被踢玩家ID | 
|---|
|  |  |  | tagFamilyLV = curTagMember.GetFamilyLV()  # 被踢玩家职位 | 
|---|
|  |  |  | 
|---|
|  |  |  | if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if PlayerFamilyBoss.IsInAllFamilyBoss(): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "LeagueBOSSExitError1") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if AuctionHouse.IsFamilyMemberBiddingAuctionItem(curFamily.GetID(), curMember.GetPlayerID()): | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "Paimai8") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | #判断退出时间间隔 | 
|---|
|  |  |  | curTime = int(time.time()) | 
|---|
|  |  |  | lastLeaveFamilyTime = PlayerControl.GetLeaveFamilyTime(curPlayer) | 
|---|
|  |  |  | if lastLeaveFamilyTime > 100: | 
|---|
|  |  |  | remainTime = IpyGameDataPY.GetFuncCfg('ExitFairyTime', 2) - (curTime - lastLeaveFamilyTime) | 
|---|
|  |  |  | if remainTime > 0: | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "ExitFairyTime", [remainTime*1000]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | updTime = 1 if IpyGameDataPY.GetFuncCfg('ExitFairyTime') > 1 else curTime | 
|---|
|  |  |  | elif lastLeaveFamilyTime >= IpyGameDataPY.GetFuncCfg('ExitFairyTime')-1: | 
|---|
|  |  |  | updTime = curTime | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | updTime = lastLeaveFamilyTime+1 | 
|---|
|  |  |  | PlayerControl.SetLeaveFamilyTime(curPlayer, updTime) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #XW_JZ_LeaveFamily   <n color="0,190,255">{%S1%}</n><n color="255,255,0">退出了家族!</n>  25  -   - | 
|---|
|  |  |  | NotifyAllFamilyMemberMsg(curFamily, curPlayer, "XW_JZ_LeaveFamily", [curPlayer.GetName()]) | 
|---|
|  |  |  | 
|---|
|  |  |  | __DoPlayerLeaveFamilyByID(curFamily, curPlayerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataRecordPack.DR_PlayerLeaveFamily(curPlayer, curFamily.GetID(), curFamily.GetName(), curFamily.GetCount(), | 
|---|
|  |  |  | familyLV, curPlayer.GetPlayerID(), curPlayer.GetName(), familyLV) | 
|---|
|  |  |  | familyLV, curPlayer.GetPlayerID(), curPlayer.GetName(), familyLV, updTime) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curFamily.GetCount() == 0: | 
|---|
|  |  |  | #玩家离开后, 家族没有人了 , 删除这个家族 | 
|---|
|  |  |  | 
|---|
|  |  |  | # 玩家战盟名变更处理 | 
|---|
|  |  |  | __OnFamilyNameChange(leavePlayerID, '') | 
|---|
|  |  |  | AddFamilyIDToFightPowerChangeList(curFamily.GetID()) | 
|---|
|  |  |  | PlayerViewCache.OnPlayerLeaveFamily(leavePlayerID) | 
|---|
|  |  |  | PlayerViewCache.OnPlayerFamilyChange(leavePlayerID, 0, "") | 
|---|
|  |  |  | if leavePlayerID in PyGameData.g_autoViceleaderDict.get(curFamily.GetID(),[]): | 
|---|
|  |  |  | PyGameData.g_autoViceleaderDict[curFamily.GetID()].remove(leavePlayerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #////////////////////////////////////////////////////////////// | 
|---|
|  |  |  | 
|---|
|  |  |  | def PlayerForceLeaveFamily(curPlayer, tick): | 
|---|
|  |  |  | if curPlayer == None: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #设置当天加入家族 | 
|---|
|  |  |  | GameWorld.GetPlayerManager().SetForbiddenEnterFamily(curPlayer.GetPlayerID(), True) | 
|---|
|  |  |  | # 通知map玩家不能参加家族活动 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #弹劾信息封包 | 
|---|
|  |  |  | SendPackClientImpeachMsg(curPlayer, 0, 0) | 
|---|
|  |  |  | PlayerTeam.OnTeamMemFamilyRefresh(curPlayer, 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerRefresh(curPlayer, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorldFamilyWar.OnPlayerLogin(curFamily, curPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 盟主上线处理 | 
|---|
|  |  |  | if curMember.GetFamilyLV() == IPY_GameServer.fmlLeader: | 
|---|
|  |  |  | OnFamilyLeaderLogin(curPlayer, curFamily) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnFamilyLeaderLogin(curPlayer, curFamily): | 
|---|
|  |  |  | ## 盟主登录处理 | 
|---|
|  |  |  | __DoFamilyMixServerLogicOnLeaderLogin(curPlayer, curFamily) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __DoFamilyMixServerLogicOnLeaderLogin(curPlayer, curFamily): | 
|---|
|  |  |  | ## 合服仙盟盟主登录处理 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isMixServer = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServer) | 
|---|
|  |  |  | if not isMixServer: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | lastMixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay) | 
|---|
|  |  |  | familyID = curFamily.GetID() | 
|---|
|  |  |  | familyMixServerDay = GetFamilyMixServerDay(curFamily) | 
|---|
|  |  |  | if familyMixServerDay == lastMixServerDay: | 
|---|
|  |  |  | GameWorld.DebugLog("已经处理过仙盟盟主合服登录逻辑! lastMixServerDay=%s" % (lastMixServerDay), familyID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | SetFamilyMixServerDay(curFamily, lastMixServerDay) | 
|---|
|  |  |  | GameWorld.Log("处理合服仙盟盟主登录! lastMixServerDay=%s" % (lastMixServerDay), familyID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | mailItemList = IpyGameDataPY.GetFuncEvalCfg("MixServerMail", 4) | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  | detailDict = {} | 
|---|
|  |  |  | GameWorld.Log("    发送合服盟主专属补偿邮件! familyID=%s,mailItemList=%s" % (familyID, mailItemList), playerID) | 
|---|
|  |  |  | PlayerCompensation.SendMailByKey("MixServer2", [playerID], mailItemList, detail=detailDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | ## 玩家下线家族刷新逻辑 | 
|---|
|  |  |  | 
|---|
|  |  |  | #上面已经验证过了,家族肯定存在的 | 
|---|
|  |  |  | curFamily = curPlayer.GetFamily() | 
|---|
|  |  |  | curFamilyID = curFamily.GetID() | 
|---|
|  |  |  | curPlayerID = curPlayer.GetID() | 
|---|
|  |  |  | #    curFamilyTrig = PlayerDBGSEvent.FindDBGSTrig_ByEventID(curFamilyID , PlayerDBGSEvent.Def_Key_RenameFamily) | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #    if not curFamilyTrig: | 
|---|
|  |  |  | 
|---|
|  |  |  | curMemberID = curMember.GetPlayerID() | 
|---|
|  |  |  | __OnFamilyNameChange(curMemberID, familyName) | 
|---|
|  |  |  | memberIDList.append(curMemberID) | 
|---|
|  |  |  | curPlayer = playerManager.FindPlayerByID(curMemberID) | 
|---|
|  |  |  | player = playerManager.FindPlayerByID(curMemberID) | 
|---|
|  |  |  | #玩家不在线 | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | if not player: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curPlayerMapID = GameWorld.GetQueryPlayerMapID(curPlayer) | 
|---|
|  |  |  | curPlayerMapID = GameWorld.GetQueryPlayerMapID(player) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not curPlayerMapID: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | msgStr = str([curPlayer.GetPlayerID(), familyName]) | 
|---|
|  |  |  | msgStr = str([curPlayerID, familyName]) | 
|---|
|  |  |  | playerManager.MapServer_QueryPlayer(0, 0, curMemberID, curPlayerMapID, 'FamilyNameRefresh', | 
|---|
|  |  |  | msgStr, len(msgStr), | 
|---|
|  |  |  | curPlayer.GetRouteServerIndex()) | 
|---|
|  |  |  | player.GetRouteServerIndex()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerCompensation.SendMailByKey('FamilyNameChange', memberIDList, [], [oldName, familyName]) | 
|---|
|  |  |  | PlayerControl.WorldNotify(0, 'Family_ChangeName', [oldName, familyName]) | 
|---|
|  |  |  | 
|---|
|  |  |  | #        if useMoney > 0: | 
|---|
|  |  |  | #            #帮会日常维持消耗{%S1%}银两帮会资金 | 
|---|
|  |  |  | #            PlayerControl.FamilyNotify(family.GetID(), 'jiazu_lhs_272921', [useMoney]) | 
|---|
|  |  |  | #自动传位 | 
|---|
|  |  |  | __AutoChangeLeader(family) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #通知客户端刷新 | 
|---|
|  |  |  | family.Broadcast_FamilyChange() | 
|---|
|  |  |  | 
|---|
|  |  |  | SetFamilyBroadcastCnt(family, 0) | 
|---|
|  |  |  | #清除本周任务已获得资金数量 | 
|---|
|  |  |  | SetCurWeekMissionMoney(family, 0) | 
|---|
|  |  |  | for j in xrange(family.GetCount()): | 
|---|
|  |  |  | member = family.GetAt(j) | 
|---|
|  |  |  | #原先是地图玩家上线后重置,导致玩家不上线周贡献显示之前的,固在此重置 | 
|---|
|  |  |  | member.SetFamilyActiveValue(0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #通知地图服务器刷新家族属性 | 
|---|
|  |  |  | SendPack_MapServer_PlayerFamilyRefresh(family) | 
|---|
|  |  |  | #oss记录上周家族信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerFamilyBoss.FamilyBossFBOnWeek(familyID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def FamilyOnHour(): | 
|---|
|  |  |  | familyManager = GameWorld.GetFamilyManager() | 
|---|
|  |  |  | for i in xrange(familyManager.GetCount()): | 
|---|
|  |  |  | family = familyManager.GetAt(i) | 
|---|
|  |  |  | #自动传位 | 
|---|
|  |  |  | __AutoChangeLeader(family) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __AutoChangeFamilyJobLV(family) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __AutoChangeFamilyJobLV(family): | 
|---|
|  |  |  | ##开服2天内新创建的仙盟,系统自动为仙盟安排两位副盟主 | 
|---|
|  |  |  | familyID = family.GetID() | 
|---|
|  |  |  | openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) | 
|---|
|  |  |  | if openServerDay >= IpyGameDataPY.GetFuncCfg('FairyFMZ'): | 
|---|
|  |  |  | #GameWorld.DebugLog('自动为仙盟安排两位副盟主 开服天超过 familyID=%s'%familyID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if familyID in PyGameData.g_forbidAutoViceleaderFamily: | 
|---|
|  |  |  | #GameWorld.DebugLog('自动为仙盟安排两位副盟主 被禁止 familyID=%s'%familyID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | createTime = family.GetCreateTime() | 
|---|
|  |  |  | pastHour = GameWorld.GetPastHour(createTime) | 
|---|
|  |  |  | if pastHour < IpyGameDataPY.GetFuncCfg('FairyFMZ', 2): | 
|---|
|  |  |  | #GameWorld.DebugLog('自动为仙盟安排两位副盟主 建盟未超过X小时 familyID=%s,pastHour=%s'%(familyID, pastHour)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if (pastHour - IpyGameDataPY.GetFuncCfg('FairyFMZ', 2)) % IpyGameDataPY.GetFuncCfg('FairyFMZ', 3) != 0: | 
|---|
|  |  |  | GameWorld.DebugLog('自动为仙盟安排两位副盟主 间隔没到 familyID=%s,pastHour=%s'%(familyID, pastHour)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tofmlv = IPY_GameServer.fmlViceLeader | 
|---|
|  |  |  | viceLeaderCnt = 0 #副盟主数量 | 
|---|
|  |  |  | changeMemberList = [] | 
|---|
|  |  |  | for i in xrange(family.GetCount()): | 
|---|
|  |  |  | familyMember = family.GetAt(i) | 
|---|
|  |  |  | if familyMember.GetFamilyLV() == tofmlv: | 
|---|
|  |  |  | viceLeaderCnt += 1 | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if familyMember.GetFamilyLV() < tofmlv: | 
|---|
|  |  |  | changeMemberList.append(familyMember) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | maxCnt = GetFamilySetting(family, ChConfig.Def_FamilyPowLvChangeFamilySettingDict[tofmlv]) | 
|---|
|  |  |  | #GameWorld.DebugLog('自动为仙盟安排两位副盟主 familyID=%s,viceLeaderCnt=%s,changeMemberList=%s'%(familyID, viceLeaderCnt, changeMemberList)) | 
|---|
|  |  |  | if viceLeaderCnt >= maxCnt or not changeMemberList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if familyID not in PyGameData.g_autoViceleaderDict: | 
|---|
|  |  |  | PyGameData.g_autoViceleaderDict[familyID] = [] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | changeMemberList.sort(cmp=CmpAutoMemberSort) | 
|---|
|  |  |  | for i, member in enumerate(changeMemberList): | 
|---|
|  |  |  | if viceLeaderCnt + i >= maxCnt: | 
|---|
|  |  |  | break | 
|---|
|  |  |  | ChangeFamilyMemberLv(member, tofmlv) | 
|---|
|  |  |  | playerID = member.GetPlayerID() | 
|---|
|  |  |  | if playerID not in PyGameData.g_autoViceleaderDict[familyID]: | 
|---|
|  |  |  | PyGameData.g_autoViceleaderDict[familyID].append(playerID) | 
|---|
|  |  |  | GameWorld.Log('自动为仙盟安排副盟主 familyID=%s,playerID=%s'%(familyID, playerID)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CmpAutoMemberSort(member1, member2): | 
|---|
|  |  |  | ## 排序规则: 等级>战力>入盟先后 | 
|---|
|  |  |  | ret = -cmp(member1.GetLV(), member2.GetLV()) | 
|---|
|  |  |  | if ret == 0: | 
|---|
|  |  |  | ret = -cmp(GetMemberFightPower(member1), GetMemberFightPower(member2)) | 
|---|
|  |  |  | if ret == 0: | 
|---|
|  |  |  | return cmp(GetMemberJoinTime(member1), GetMemberJoinTime(member2)) | 
|---|
|  |  |  | return ret | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | ##通知地图服务器, 玩家家族属性刷新 | 
|---|
|  |  |  | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | leaderID = curFamily.GetLeaderID() | 
|---|
|  |  |  | # 帮主在线 | 
|---|
|  |  |  | if GameWorld.GetPlayerManager().FindPlayerByID(leaderID) != None: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curMember = curFamily.FindMember(leaderID) | 
|---|
|  |  |  | if curMember == None: | 
|---|
|  |  |  | GameWorld.Log("GetLeaderOfflineTime->FindMember, None;%s" % leaderID) | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | offLineTime = GameWorld.ChangeTimeNumToStr(curMember.GetExattr2()) | 
|---|
|  |  |  | offLineTimeNum = curMember.GetExattr2() | 
|---|
|  |  |  | if not offLineTimeNum: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | offLineTime = GameWorld.ChangeTimeNumToStr(offLineTimeNum) | 
|---|
|  |  |  | return GameWorld.GetPastHour(offLineTime) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLastOnlineMemberOfflineTime(family): | 
|---|
|  |  |  | 
|---|
|  |  |  | offLineTime = 0 | 
|---|
|  |  |  | for i in range(0, family.GetCount()): | 
|---|
|  |  |  | member = family.GetAt(i) | 
|---|
|  |  |  | playerID = member.GetPlayerID() | 
|---|
|  |  |  | tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) | 
|---|
|  |  |  | if tagPlayer: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | if not member.GetExattr2(): | 
|---|
|  |  |  | offLineTimeNum = member.GetExattr2() | 
|---|
|  |  |  | if not offLineTimeNum: | 
|---|
|  |  |  | #有人在线直接返回 | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | if not offLineTime: | 
|---|
|  |  |  | offLineTime = member.GetExattr2() | 
|---|
|  |  |  | offLineTime = offLineTimeNum | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | offLineTime = max(offLineTime, member.GetExattr2()) | 
|---|
|  |  |  | offLineTime = max(offLineTime, offLineTimeNum) | 
|---|
|  |  |  | if not offLineTime: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | offLineTime = GameWorld.ChangeTimeNumToStr(offLineTime) | 
|---|
|  |  |  | 
|---|
|  |  |  | '''自动传位''' | 
|---|
|  |  |  | # 获得帮主下线了多久(小时) | 
|---|
|  |  |  | leaderOffLineTime = GetLeaderOfflineTime(curFamily) | 
|---|
|  |  |  | GameWorld.DebugLog('帮主下线了%s小时'%leaderOffLineTime) | 
|---|
|  |  |  | GameWorld.DebugLog('帮主下线了%s小时'%leaderOffLineTime, curFamily.GetID()) | 
|---|
|  |  |  | if leaderOffLineTime < IpyGameDataPY.GetFuncCfg('AutoChangeLeader'): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return ret | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def UpdFamilyWarRank(): | 
|---|
|  |  |  | '''更新仙盟联赛排名 | 
|---|
|  |  |  | 注意:该逻辑在仙盟联赛周期中不可执行,仅在下周分组定级状态下可更新 | 
|---|
|  |  |  | 仙盟联赛新一周期开始时、仙盟解散时 会触发该逻辑 | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | gameWorld = GameWorld.GetGameWorld() | 
|---|
|  |  |  | state = gameWorld.GetDictByKey(ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyWar) | 
|---|
|  |  |  | if state != GameWorldFamilyWar.FamilyWarState_NextWeekGroupRank: | 
|---|
|  |  |  | GameWorld.DebugLog("非下周分组定级阶段不可更新仙盟联赛排名!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | familyMgr = GameWorld.GetFamilyManager() | 
|---|
|  |  |  | sortFamilyIDList = GetSortFamilyIDList() | 
|---|
|  |  |  | for rank, familyID in enumerate(sortFamilyIDList, 1): | 
|---|
|  |  |  | family = familyMgr.FindFamily(familyID) | 
|---|
|  |  |  | if not family: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | curRank = GetFamilyWarRank(family) | 
|---|
|  |  |  | if not curRank: | 
|---|
|  |  |  | break | 
|---|
|  |  |  | if curRank != rank: | 
|---|
|  |  |  | SetFamilyWarRank(family, rank) | 
|---|
|  |  |  | GameWorld.Log("更新仙盟联赛仙盟排名: familyID=%s,rank=%s" % (family.GetID(), rank)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// A4 11 一键申请入盟 #tagCGOneKeyJoinFamily | 
|---|
|  |  |  | # | 
|---|