From ee017bc9f5435bf6de2e28aab2cb5d3edc430d95 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 25 十月 2023 01:33:14 +0800 Subject: [PATCH] 9964 【BT0.1】【主干】境界塔 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py | 193 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 159 insertions(+), 34 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py index d8e9fbd..44b1b6d 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py @@ -41,6 +41,7 @@ import PlayerViewCache import GameWorldBoss import AuctionHouse +import PlayerAssist import PlayerTalk import PlayerTeam @@ -88,8 +89,11 @@ 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) +def GetMemberFightPower(curMember): return curMember.GetExattr3() + curMember.GetExattr5() * ChConfig.Def_PerPointValue +def SetMemberFightPower(curMember, fightPower): + curMember.SetExattr5(fightPower / ChConfig.Def_PerPointValue) + curMember.SetExattr3(fightPower % ChConfig.Def_PerPointValue) + return def GetMemberJoinTime(curMember): return curMember.GetExattr4() def SetMemberJoinTime(curMember, joinTime): return curMember.SetExattr4(joinTime) @@ -132,9 +136,25 @@ if not lackCnt: break elif lackCnt < 0: - GameWorld.ErrLog(' 随机假仙盟异常 已存在的随机数大于还需要的随机个数lackFakeCnt=%s,fakeIDList=%s'%(lackFakeCnt, fakeIDList)) + #GameWorld.DebugLog(' 随机假仙盟异常 已存在的随机数大于还需要的随机个数lackFakeCnt=%s,fakeIDList=%s'%(lackFakeCnt, fakeIDList)) return [] return fakeIDList + +def GetFamilyNameFakeIndex(familyName): + ## 获取仙盟名是否是系统随机出来的假仙盟名 + # @return: 0-不是, >0 对应的 fakeIndex + fakeFamilyNameList = IpyGameDataPY.GetFuncEvalCfg('FakeFamilyName') + randomCnt = IpyGameDataPY.GetFuncCfg('FakeFamilyName', 2) + for i in xrange(randomCnt): + fakeID = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % i) + if not fakeID: + continue + nameIndex = fakeID - 1 + if nameIndex >=0 and nameIndex < len(fakeFamilyNameList): + fakeName = GameWorld.GbkToCode(fakeFamilyNameList[nameIndex]) + if familyName == fakeName: + return fakeID + return 0 def SyncFakeFamilyInfo(curPlayer=None): '''通知假仙盟信息''' @@ -164,7 +184,7 @@ def SyncCreatFamilyTimes(curPlayer=None): # 通知建盟次数 - packData = ChPyNetSendPack.tagGCFakeFamilyInfo() + packData = ChPyNetSendPack.tagGCServerCreatFamilyTimes() packData.Clear() packData.Times = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes) if not curPlayer: @@ -268,6 +288,10 @@ #-设置家族成员属性 DoPlayerJionFamily(curFamily, curPlayer, IPY_GameServer.fmlLeader) creatFamilyTimes = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes) + # 如果是手动指定仙盟名创建的,判断是否在系统随机的假仙盟里,如果是的话就当做创建系统分配的假仙盟处理 + if familyName and not fakeIndex: + fakeIndex = GetFamilyNameFakeIndex(familyName) + GameWorld.DebugLog(" 玩家手动输入创建仙盟名与系统随机的假仙盟名相同,默认当做创建假仙盟!fakeIndexID=%s" % (fakeIndex)) #扣道具(前N个战盟并且假编号在随机编号里不要钱) if fakeIndex and fakeIndex in fakeIndexList: PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % fakeIndexList.index(fakeIndex), 0) @@ -392,19 +416,21 @@ #通知战盟红包信息 PlayerFamilyRedPacket.NotifyRedPacketInfo(jionPlayer) - #通知战盟BOSS开启信息 - PlayerFamilyBoss.NotifyFamilyBossFBInfo(jionPlayer) + #通知战盟BOSS + PlayerFamilyBoss.OnPlayerJionFamily(curFamily, jionPlayer) #通知家族仓库 PyDataManager.GetFamilyStoreItemManager().SyncFamilyStoreItem(jionPlayer, curFamily.GetID()) #仙盟拍品 AuctionHouse.Sync_FamilyAuctionItemInfo(jionPlayer, curFamily.GetID()) - SetMemberFightPower(familyMember, jionPlayer.GetFightPower()) + SetMemberFightPower(familyMember, PlayerControl.GetFightPower(jionPlayer)) AddFamilyIDToFightPowerChangeList(curFamily.GetID()) #通知仙盟盛宴题目 PlayerFamilyParty.NotifyFamilyPartyQuestion(jionPlayer) #通知守卫人皇信息 PlayerFamilySWRH.NotifySWRHInfo(jionPlayer, curFamily.GetID()) + #通知仙盟协助信息 + PlayerAssist.SyncFamilyAssist(jionPlayer) #oss记录加入家族信息 DataRecordPack.DR_PlayerJoinFamily(jionPlayer, curFamily.GetID(), curFamily.GetName(), curFamily.GetCount()) return @@ -608,7 +634,7 @@ #=============================================================================================== return -def SendFamilyFakePack(familyID, clientPack): +def SendFamilyFakePack(familyID, clientPack, excludePlayerIDList=[]): ## 广播家族成员PY封包 family = GameWorld.GetFamilyManager().FindFamily(familyID) if not family: @@ -617,8 +643,11 @@ for index in xrange(family.GetCount()): member = family.GetAt(index) memPlayer = member.GetPlayer() - if memPlayer: - NetPackCommon.SendFakePack(memPlayer, clientPack) + if not memPlayer: + continue + if excludePlayerIDList and memPlayer.GetPlayerID() in excludePlayerIDList: + continue + NetPackCommon.SendFakePack(memPlayer, clientPack) return def Sync_PyAllFamilyInfo(curPlayer, allPageCnt, viewPage, startIndex, endIndex): @@ -1465,10 +1494,10 @@ PlayerFamilyAction.AddFamilyActionNote(tagPlayerName, curFamily.GetID(), ShareDefine.Def_ActionType_FamilyEvent, [ShareDefine.Def_FamilyActionEvent_MemberChange, ShareDefine.Def_FamilyMemberChange_KickOut], tick) #删除玩家 - curFamily.DeleteMember(tagPlayerID) - __DoPlayerLeaveFamilyByID(curFamily, tagPlayerID) - + curFamily.DeleteMember(tagPlayerID) tagPlayer = playerManager.FindPlayerByID(tagMemberID) + + __DoPlayerLeaveFamilyByID(curFamily, tagPlayerID, tagPlayer) #玩家在线, 设置这个玩家的属性 PlayerForceLeaveFamily(tagPlayer, tick) @@ -1565,7 +1594,7 @@ curFamily.DeleteMember(curMember.GetPlayerID()) #玩家在线, 设置这个玩家的属性 PlayerForceLeaveFamily(curPlayer, tick) - __DoPlayerLeaveFamilyByID(curFamily, curPlayerID) + __DoPlayerLeaveFamilyByID(curFamily, curPlayerID, curPlayer) DataRecordPack.DR_PlayerLeaveFamily(curPlayer, curFamily.GetID(), curFamily.GetName(), curFamily.GetCount(), familyLV, curPlayer.GetPlayerID(), curPlayer.GetName(), familyLV, updTime) @@ -1583,12 +1612,14 @@ # @param curFamily 离开的家族 # @param leavePlayerID 离开的玩家ID # @return None -def __DoPlayerLeaveFamilyByID(curFamily, leavePlayerID): +def __DoPlayerLeaveFamilyByID(curFamily, leavePlayerID, tagPlayer=None): + PlayerCompensation.SendMailByKey("LeaveFamilyNotice", [leavePlayerID], []) PlayerFamilyAction.DelFamilyOfficerModelEquip(curFamily.GetID(), leavePlayerID) # 玩家战盟名变更处理 __OnFamilyNameChange(leavePlayerID, '') AddFamilyIDToFightPowerChangeList(curFamily.GetID()) PlayerViewCache.OnPlayerFamilyChange(leavePlayerID, 0, "") + PlayerAssist.OnPlayerLeaveFamily(curFamily.GetID(), leavePlayerID, tagPlayer) if leavePlayerID in PyGameData.g_autoViceleaderDict.get(curFamily.GetID(),[]): PyGameData.g_autoViceleaderDict[curFamily.GetID()].remove(leavePlayerID) return @@ -1709,8 +1740,10 @@ addFamilyMoney, curFamily.GetFamilyActiveValue(), addFamilyActiveValue) #通知客户端 - #curFamily.Broadcast_FamilyChange() - curPlayer.Sync_FamilyInfo() + if addFamilyHornor: + curFamily.Broadcast_FamilyChange() + else: + curPlayer.Sync_FamilyInfo() #金钱变更时才通知 if addFamilyMoney != 0: @@ -1955,8 +1988,10 @@ if not PlayerControl.GetIsTJG(curPlayer): #上线重置离线时间为0, 非脱机挂才设置 - curMember.SetExattr2(0) + curMember.SetExattr2(0) # 在线0,脱机1,>1离线时间 curPlayer.Sync_FamilyInfo() + else: + curMember.SetExattr2(1) # 脱机1 curPlayer.MapServer_FamilyRefresh() curMember = GetPlayerFamilyMember(curPlayer) @@ -2652,6 +2687,13 @@ __SetFamilyActivityDayStateValue(0) return +def FamilyOnDayEx(tick): + familyManager = GameWorld.GetFamilyManager() + for i in range(0, familyManager.GetCount()): + family = familyManager.GetAt(i) + #仙盟boss + PlayerFamilyBoss.FamilyBossFBOnDayEx(family) + return #--------------------------------------------------------------------- ##家族过周 @@ -2686,7 +2728,7 @@ DataRecordPack.DR_FamilyActiveValueByOnWeek(familyID, family.GetName(), familyActiveValue) #清除家族boss副本信息 - PlayerFamilyBoss.FamilyBossFBOnWeek(familyID) + PlayerFamilyBoss.FamilyBossFBOnWeek(family) return @@ -2884,7 +2926,7 @@ GameWorld.Log("GetLeaderOfflineTime->FindMember, None;%s" % leaderID) return 0 offLineTimeNum = curMember.GetExattr2() - if not offLineTimeNum: + if not offLineTimeNum or offLineTimeNum == 1: return 0 offLineTime = GameWorld.ChangeTimeNumToStr(offLineTimeNum) return GameWorld.GetPastHour(offLineTime) @@ -2895,7 +2937,7 @@ for i in range(0, family.GetCount()): member = family.GetAt(i) offLineTimeNum = member.GetExattr2() - if not offLineTimeNum: + if not offLineTimeNum or offLineTimeNum == 1: #有人在线直接返回 return 0 if not offLineTime: @@ -2930,7 +2972,7 @@ elif toMember2.GetExattr1() < member.GetExattr1(): toMember2 = member - offLineHour = GameWorld.GetPastHour(GameWorld.ChangeTimeNumToStr(member.GetExattr2())) if member.GetExattr2() else 0 + offLineHour = GameWorld.GetPastHour(GameWorld.ChangeTimeNumToStr(member.GetExattr2())) if member.GetExattr2() > 1 else 0 #GameWorld.DebugLog('memberID=%s 离线%s小时,历史贡献度%s'%(member.GetPlayerID(), offLineHour, member.GetExattr1())) if offLineHour < 48: if not toMember1: @@ -3298,17 +3340,6 @@ PlayerFamilyAction.ViewFamilyRequestInfo(curPlayer) return - -## 开启家族boss副本 -# @param index 玩家索引 -# @param clientData 封包数据结构体 -# @param tick 时间戳 -# @return None -def OpenFamilyBossFB(index, clientData, tick): - curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) - fbMapID = clientData.MapID - PlayerFamilyBoss.OpenFamilyBossFB(curPlayer, tick) - return #=============================================================================== # //A4 06 变更家族成员加入审核方式#tagCGChangeFamilyAcceptJoinType #struct tagCGChangeFamilyAcceptJoinType @@ -3530,7 +3561,8 @@ requestPlayerName = curPlayer.GetName() playerLV = curPlayer.GetLV() #玩家Id, 等级,职业,战斗力 - actionDataList = [curPlayer.GetID(), playerLV, curPlayer.GetJob(), curPlayer.GetFightPower()] + fightPower = PlayerControl.GetFightPower(curPlayer) + actionDataList = [curPlayer.GetID(), playerLV, curPlayer.GetJob(), fightPower % ChConfig.Def_PerPointValue, fightPower / ChConfig.Def_PerPointValue] allFamilyActionManager = GameWorld.GetFamilyActionManager() familyManager = GameWorld.GetFamilyManager() indexList = range(familyManager.GetCount()) @@ -3585,3 +3617,96 @@ PlayerControl.NotifyCode(curPlayer, "jiazu_pan_500807") return + +##--------------------------------------- 仙盟传功 -------------------------------------------------- +def MapServer_FamilyChuangong(curPlayer, msgList): + msgType, msgData = msgList + + if msgType == "Invite": + tagPlayerID = msgData[0] + __DoChuangong_Invite(curPlayer, tagPlayerID) + return + + if msgType == "Response": + tagPlayerID, isOK = msgData + __DoChuangong_Response(curPlayer, tagPlayerID, isOK) + return + + return + +def __CheckChuangongPlayer(curPlayer, tagPlayerID): + curFamily = curPlayer.GetFamily() + if not curFamily: + return + tagMember = curFamily.FindMember(tagPlayerID) + if not tagMember: + GameWorld.DebugLog("非盟友无法传功! tagPlayerID=%s" % tagPlayerID, curPlayer.GetPlayerID()) + return + tagPlayer = tagMember.GetPlayer() + if not tagPlayer: + PlayerControl.NotifyCode(curPlayer, "FairyFeastPlayerOffline") + return + return tagPlayer + +def __DoChuangong_Invite(curPlayer, tagPlayerID): + ## 邀请 + playerID = curPlayer.GetPlayerID() + tagPlayer = __CheckChuangongPlayer(curPlayer, tagPlayerID) + if not tagPlayer: + return + invitePlayerIDList = PyGameData.g_chuangongPlayerDict.get(playerID, []) + if tagPlayerID not in invitePlayerIDList: + invitePlayerIDList.append(tagPlayerID) + PyGameData.g_chuangongPlayerDict[playerID] = invitePlayerIDList + clientPack = ChPyNetSendPack.tagGCChuangongInviteInfo() + clientPack.Clear() + clientPack.PlayerID = curPlayer.GetPlayerID() + clientPack.Name = curPlayer.GetName() + clientPack.NameLen = len(clientPack.Name) + clientPack.LV = curPlayer.GetLV() + clientPack.Job = curPlayer.GetJob() + clientPack.RealmLV = curPlayer.GetOfficialRank() + NetPackCommon.SendFakePack(tagPlayer, clientPack) + GameWorld.DebugLog("邀请传功: tagPlayerID=%s, %s" % (tagPlayerID, PyGameData.g_chuangongPlayerDict), playerID) + return + +def __DoChuangong_Response(curPlayer, tagPlayerID, isOK): + ## 相应 + playerID = curPlayer.GetPlayerID() + tagPlayer = __CheckChuangongPlayer(curPlayer, tagPlayerID) + if not tagPlayer: + return + invitePlayerIDList = PyGameData.g_chuangongPlayerDict.get(tagPlayerID, []) + if not isOK: + if playerID in invitePlayerIDList: + invitePlayerIDList.remove(playerID) + PyGameData.g_chuangongPlayerDict[tagPlayerID] = invitePlayerIDList + GameWorld.DebugLog("拒绝传功: tagPlayerID=%s, %s" % (tagPlayerID, PyGameData.g_chuangongPlayerDict), playerID) + return + if not invitePlayerIDList: + PlayerControl.NotifyCode(curPlayer, "TagHadFinishChuangong") + return + if playerID not in invitePlayerIDList: + GameWorld.DebugLog("不在对方邀请列表了,无法传功: tagPlayerID=%s, %s" % (tagPlayerID, invitePlayerIDList), playerID) + return + PyGameData.g_chuangongPlayerDict.pop(tagPlayerID) + + # 通知双方开始传功 + __NotifyChuangongStart(curPlayer, tagPlayer) + __NotifyChuangongStart(tagPlayer, curPlayer) + return + +def __NotifyChuangongStart(curPlayer, tagPlayer): + clientPack = ChPyNetSendPack.tagGCChuangongStart() + clientPack.Clear() + clientPack.PlayerID = tagPlayer.GetPlayerID() + clientPack.Name = tagPlayer.GetName() + clientPack.NameLen = len(clientPack.Name) + clientPack.LV = tagPlayer.GetLV() + clientPack.Job = tagPlayer.GetJob() + clientPack.RealmLV = tagPlayer.GetOfficialRank() + NetPackCommon.SendFakePack(curPlayer, clientPack) + return + +##-------------------------------------------------------------------------------------------------- + -- Gitblit v1.8.0