| | |
| | | import PlayerCompensation
|
| | | import PlayerFamilyParty
|
| | | import PlayerFamilySWRH
|
| | | import PlayerViewCache
|
| | | import GameWorldBoss
|
| | | import PlayerTalk
|
| | |
|
| | | import copy
|
| | |
| | | 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 GetFamilyMemberHasPow(tagMember, ChConfig.Def_PurviewDictKey_CanCall):
|
| | | tagPlayer.Sync_FamilyInfo()
|
| | | PlayerFamilyAction.ViewFamilyRequestInfo(tagPlayer)
|
| | | |
| | | if isGMOP:
|
| | | curFamily.SetBroadcast('')
|
| | | curFamily.Broadcast_FamilyChange()
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, "DungeonGuardSkyText2")
|
| | | return
|
| | |
|
| | | if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss): |
| | | PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError")
|
| | | return
|
| | | |
| | | tagPlayerName = curTagMember.GetName() # 被踢玩家名
|
| | | tagPlayerID = curTagMember.GetPlayerID() # 被踢玩家ID
|
| | | tagFamilyLV = curTagMember.GetFamilyLV() # 被踢玩家职位
|
| | |
| | | if PlayerFamilySWRH.IsInFamilySWRH():
|
| | | PlayerControl.NotifyCode(curPlayer, "DungeonGuardSkyText1")
|
| | | return
|
| | | |
| | | if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss): |
| | | PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError")
|
| | | return
|
| | | |
| | | #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()])
|
| | |
|
| | |
| | | # 玩家战盟名变更处理
|
| | | __OnFamilyNameChange(leavePlayerID, '')
|
| | | AddFamilyIDToFightPowerChangeList(curFamily.GetID())
|
| | | PlayerViewCache.OnPlayerLeaveFamily(leavePlayerID)
|
| | | return
|
| | |
|
| | | #//////////////////////////////////////////////////////////////
|
| | |
| | |
|
| | | familyMoney = family.GetMoney()
|
| | |
|
| | | useMoney = GetFamilySetting(family, ChConfig.Def_FamilySetting_SystemLostMoney)
|
| | | |
| | | #家族资金不足, 解散
|
| | | if familyMoney < useMoney:
|
| | | family.SetMoney(0)
|
| | | delFamilyList.append(family)
|
| | | continue
|
| | | # useMoney = GetFamilySetting(family, ChConfig.Def_FamilySetting_SystemLostMoney)
|
| | | # |
| | | # #家族资金不足, 解散
|
| | | # if familyMoney < useMoney:
|
| | | # family.SetMoney(0)
|
| | | # delFamilyList.append(family)
|
| | | # continue
|
| | | #多久没人上线,解散
|
| | | offlineDay = GetLastOnlineMemberOfflineTime(family)
|
| | | GameWorld.DebugLog(' 仙盟%s %s天没人上线了'%(family.GetID(), offlineDay))
|
| | |
| | | ChConfig.Def_Family_ClearRequestAddNote_Day)
|
| | |
|
| | | #此处不通知地图服务器家族资金变更
|
| | | family.SetMoney(familyMoney - useMoney)
|
| | | if useMoney > 0:
|
| | | #帮会日常维持消耗{%S1%}银两帮会资金
|
| | | PlayerControl.FamilyNotify(family.GetID(), 'jiazu_lhs_272921', [useMoney])
|
| | | # family.SetMoney(familyMoney - useMoney)
|
| | | # if useMoney > 0:
|
| | | # #帮会日常维持消耗{%S1%}银两帮会资金
|
| | | # PlayerControl.FamilyNotify(family.GetID(), 'jiazu_lhs_272921', [useMoney])
|
| | | #自动传位
|
| | | __AutoChangeLeader(family)
|
| | |
|
| | |
| | | SetFamilyBroadcastCnt(family, 0)
|
| | | #清除本周任务已获得资金数量
|
| | | SetCurWeekMissionMoney(family, 0)
|
| | | for j in xrange(family.GetCount()):
|
| | | member = family.GetAt(j)
|
| | | #原先是地图玩家上线后重置,导致玩家不上线周贡献显示之前的,固在此重置
|
| | | member.SetFamilyActiveValue(0)
|
| | | |
| | | |
| | | #通知地图服务器刷新家族属性
|
| | | SendPack_MapServer_PlayerFamilyRefresh(family)
|
| | | #oss记录上周家族信息
|
| | |
| | | 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)
|
| | |
| | | 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
|
| | | #
|