From db72112f4cb48a5ab83cde13b80d21fcaf429d7f Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 18 十一月 2024 15:03:30 +0800 Subject: [PATCH] 1111 跨服榜Name2长度改为65 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py | 248 ++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 222 insertions(+), 26 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py index acc1879..93b6ae1 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py @@ -29,13 +29,17 @@ import DataRecordPack import PlayerFamilyBoss import IpyGameDataPY +import PlayerFamilyZhenbaoge import PlayerFamilyRedPacket import GameWorldFamilyWar import ChPyNetSendPack import NetPackCommon import PyDataManager import PyGameData +import PlayerBillboard +import PlayerActBossTrial import PlayerCompensation +import PlayerFamilyEmblem import PlayerFamilyParty import PlayerFamilySWRH import PlayerViewCache @@ -73,6 +77,9 @@ if not family: return 0 return GetFamilyTotalFightPower(family) +# 徽章ID +def GetFamilyEmblemID(curFamily): return curFamily.GetExtra6() +def SetFamilyEmblemID(curFamily, emblemID): return curFamily.SetExtra6(emblemID) # 公告修改次数 def GetFamilyBroadcastCnt(curFamily): return curFamily.GetExtra3() @@ -89,12 +96,62 @@ 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) #---------------------------------------------------------------------- + +def OnGameServerInitOK(): + ## 服务器启动成功处理 + DoFamilySort() + return + +def OnMixServerInit(): + ## 合服后首次启动成功处理 + + # 仙盟联赛重置 + GameWorldFamilyWar.DoFamilyWarReset() + # 重置所有仙盟联赛评级 + familyManager = GameWorld.GetFamilyManager() + for i in xrange(familyManager.GetCount()): + family = familyManager.GetAt(i) + SetFamilyWarRank(family, 0) + + # 仙盟榜相关榜单重新上榜 + familyID = family.GetID() + familyBillInfo = GetFamilyBillboardInfo(family) + + familySubmitTotal = PlayerActBossTrial.GetFamilySubmitTotalByID(familyID) + PlayerBillboard.UpdateFamilyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamily, familyBillInfo, familySubmitTotal) + + DoFamilySort() + return + +def OnLoadDBPlayerOK(): + ## 服务器启动加载DB玩家成功处理 + + # 检查仙盟ServerID + familyManager = GameWorld.GetFamilyManager() + for i in xrange(familyManager.GetCount()): + family = familyManager.GetAt(i) + if family.GetServerID(): + continue + familyID = family.GetID() + # 没有则默认取盟主的 + leaderID = family.GetLeaderID() + leaderAccID = PlayerControl.GetDBPlayerAccIDByID(leaderID) + if not leaderAccID: + continue + serverID = GameWorld.GetAccIDServerID(leaderAccID) + family.SetServerID(serverID) + GameWorld.Log("启动更新仙盟所属服务器ID: familyID=%s,serverID=%s,leaderID=%s,%s" % (familyID, serverID, leaderID, leaderAccID)) + + return def RandomFakeFamily(): '''随机3个假仙盟''' @@ -215,7 +272,7 @@ # @param tick 当前时间 # @return None # @remarks 函数详细说明. -def DoCreateFamily(curPlayer, familyName, fakeIndex, tick): +def DoCreateFamily(curPlayer, familyName, fakeIndex, tick, emblemID=0): #---验证玩家属性--- curPlayerID = curPlayer.GetPlayerID() @@ -272,11 +329,16 @@ if curFamily == None: GameWorld.ErrLog("家族创建数目已满, 创建家族失败", curPlayerID) return - GameWorld.Log("创建仙盟: familyID=%s,playerID=%s" % (curFamily.GetID(), curPlayerID)) + emblemIDList = PlayerFamilyEmblem.GetDefaultFamilyEmblemIDList() + if not emblemID or emblemID not in emblemIDList: + emblemID = random.choice(emblemIDList) # 从默认徽章中随机选择一个 + GameWorld.Log("创建仙盟: familyID=%s,playerID=%s,emblemID=%s" % (curFamily.GetID(), curPlayerID, emblemID)) #---创建家族--- + curFamily.SetServerID(GameWorld.GetAccIDServerID(curPlayer.GetAccID())) curFamily.SetCreateTime(GameWorld.GetCurrentDataTimeStr()) curFamily.SetLV(1) curFamily.SetAcceptJoin(ShareDefine.FamilyAcceptJoin_Agree) #设置收人方式为直接通过申请 + SetFamilyEmblemID(curFamily, emblemID) PyDataManager.GetFamilyStoreItemManager().DelFamilyStoreItemAll(curFamily.GetID()) #新创建的仙盟默认设置已处理过合服 @@ -293,6 +355,8 @@ if fakeIndex and fakeIndex in fakeIndexList: PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % fakeIndexList.index(fakeIndex), 0) GameWorld.Log(' 创建前n个假仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex)) + fakeAwardItemList = IpyGameDataPY.GetFuncEvalCfg("FakeFamilyName", 3) + PlayerCompensation.SendMailByKey("FackFamilyNotice", [curPlayerID], fakeAwardItemList) elif creatFamilyTimes < IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 3): GameWorld.Log(' 创建前n个仙盟不扣钱! creatFamilyTimes=%s' % creatFamilyTimes) else: @@ -340,6 +404,8 @@ GameWorld.Log('创建家族 : %s(%s), fakeIndex=%s, creatFamilyTimes=%s' % (fullFamilyName, curFamily.GetID(), fakeIndex, creatFamilyTimes+1), curPlayerID) PlayerControl.WorldNotify(0, "jiazu_liubo_671654", [curPlayer.GetName(), fullFamilyName, curFamily.GetID()]) + + PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily) return ## 获取家族全名 @@ -413,13 +479,13 @@ #通知战盟红包信息 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()) #通知仙盟盛宴题目 @@ -539,6 +605,7 @@ # tagHead Head; # char Name[33]; # WORD FakeID; +# BYTE EmblemID; //选择徽章ID,解锁仙盟等级为1级的均为可选ID #}; ## 查看申请帮会的成员信息 # @param index 玩家索引 @@ -549,8 +616,9 @@ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) inputName = clientPack.Name fakeIndex = clientPack.FakeID + emblemID = clientPack.EmblemID #执行创建家族逻辑 - DoCreateFamily(curPlayer, inputName, fakeIndex, tick) + DoCreateFamily(curPlayer, inputName, fakeIndex, tick, emblemID) #重置查看家族状态(仅创建家族时候重置, 其余状态由MapServer退出事件时重置) __ClearViewFamilyState(curPlayer) #玩家离开事件 @@ -686,6 +754,7 @@ totalFightPower = GetFamilyTotalFightPower(family) familyView.TotalFightPower = totalFightPower % ChConfig.Def_PerPointValue familyView.TotalFightPowerEx = totalFightPower / ChConfig.Def_PerPointValue + familyView.EmblemID = GetFamilyEmblemID(family) return familyView ## 玩家模糊查询家族,0F 0D封包 @@ -766,6 +835,19 @@ break familyViewPack.PageCount = len(familyViewPack.Family) NetPackCommon.SendFakePack(curPlayer, familyViewPack) + return + +#// A4 13 修改家族徽章 #tagCGChangeFamilyEmblem +# +#struct tagCGChangeFamilyEmblem +#{ +# tagHead Head; +# BYTE EmblemID; // 更换的徽章ID +#}; +def OnChangeFamilyEmblem(index, clientData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + changeEmblemID = clientData.EmblemID + PlayerFamilyEmblem.OnChangeFamilyEmblem(curPlayer, changeEmblemID) return #class IPY_CFamilyChangeBroadcast @@ -1610,6 +1692,7 @@ # @param leavePlayerID 离开的玩家ID # @return None def __DoPlayerLeaveFamilyByID(curFamily, leavePlayerID, tagPlayer=None): + PlayerCompensation.SendMailByKey("LeaveFamilyNotice", [leavePlayerID], []) PlayerFamilyAction.DelFamilyOfficerModelEquip(curFamily.GetID(), leavePlayerID) # 玩家战盟名变更处理 __OnFamilyNameChange(leavePlayerID, '') @@ -1984,8 +2067,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) @@ -2073,6 +2158,8 @@ curMember.SetJob(curPlayer.GetJob()) curMember.SetOperateInfo(curPlayer.GetOperateInfo()) curMember.SetOfficialRank(curPlayer.GetOfficialRank()) + curMember.SetFace(curPlayer.GetFace()) + curMember.SetFacePic(curPlayer.GetFacePic()) return #--------------------------------------------------------------------- ## 玩家刷新 @@ -2681,6 +2768,15 @@ __SetFamilyActivityDayStateValue(0) return +def FamilyOnDayEx(tick): + familyManager = GameWorld.GetFamilyManager() + for i in range(0, familyManager.GetCount()): + family = familyManager.GetAt(i) + #仙盟boss + PlayerFamilyBoss.FamilyBossFBOnDayEx(family) + #珍宝阁 + PlayerFamilyZhenbaoge.OnDayEx(family) + return #--------------------------------------------------------------------- ##家族过周 @@ -2715,7 +2811,7 @@ DataRecordPack.DR_FamilyActiveValueByOnWeek(familyID, family.GetName(), familyActiveValue) #清除家族boss副本信息 - PlayerFamilyBoss.FamilyBossFBOnWeek(familyID) + PlayerFamilyBoss.FamilyBossFBOnWeek(family) return @@ -2833,7 +2929,7 @@ GameWorld.ErrLog("key = %s not in tagFamily.txt" % familyLv) return 0 keyStr = ChConfig.FamilySettingDict[index] - return getattr(curFamilyLvSetting, keyStr) + return getattr(curFamilyLvSetting, "Get%s" % keyStr)() #=============================================================================== @@ -2913,7 +3009,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) @@ -2924,7 +3020,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: @@ -2959,7 +3055,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: @@ -3327,17 +3423,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 @@ -3559,7 +3644,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()) @@ -3614,3 +3700,113 @@ 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() + clientPack.Face = curPlayer.GetFace() + clientPack.FacePic = curPlayer.GetFacePic() + 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 + +##-------------------------------------------------------------------------------------------------- + +def GetFamilyBillboardInfo(curFamily): + ## 获取仙盟榜单信息 区服ID、徽章、仙盟名、盟主名、仙盟总战力、仙盟等级 + familyID = curFamily.GetID() + name = curFamily.GetName() + id2 = curFamily.GetLeaderID() + name2 = curFamily.GetLeaderName() + fightPower = GetFamilyTotalFightPower(curFamily) + value1 = fightPower / ChConfig.Def_PerPointValue + value2 = fightPower % ChConfig.Def_PerPointValue + value3 = GetFamilyEmblemID(curFamily) + value4 = curFamily.GetLV() + value5 = curFamily.GetServerID() + return {"id":familyID, "name":name, "id2":id2, "name2":name2, "value1":value1, "value2":value2, + "value3":value3, "value4":value4, "value5":value5} + -- Gitblit v1.8.0