From dc0b92c1e2fe9f3d24c183b325dad54d088735c1 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 10 七月 2025 17:01:24 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_ServerCode --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py | 129 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 116 insertions(+), 13 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py index 6e63e0f..a59e6a5 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py @@ -20,10 +20,12 @@ import ShareDefine import PlayerControl import NetPackCommon +import PlayerViewCache import ChPyNetSendPack import PlayerFamilyTech import PlayerFamilyEmblem import PlayerFamilyZhenfa +import PlayerFamilyZhenbaoge import IPY_PlayerDefine import IpyGameDataPY import IPY_GameWorld @@ -68,6 +70,18 @@ IPY_PlayerDefine.fmlViceLeader:"DeputyLeaderMax", } +def FamilyOnDay(): + if GameWorld.IsCrossServer(): + return + + familyManager = DBDataMgr.GetFamilyMgr() + for i in range(0, familyManager.GetCount()): + family = familyManager.GetAt(i) + #珍宝阁 + PlayerFamilyZhenbaoge.OnDay(family) + + return + def PlayerOnDay(curPlayer): if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Family): return @@ -75,9 +89,7 @@ Sync_FamilyDayRewardState(curPlayer) __FamilyAffair_Refresh(curPlayer, True) - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0) - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0) - #PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer) + PlayerFamilyZhenbaoge.PlayerOnDay(curPlayer) return def OnPlayerLogin(curPlayer, tick): @@ -89,7 +101,7 @@ PlayerFamilyTech.Sync_PlayerFamilyTechLV(curPlayer) __FamilyAffair_CheckReset(curPlayer) PlayerFamilyZhenfa.OnPlayerLogin(curPlayer) - #PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer) + PlayerFamilyZhenbaoge.OnPlayerLogin(curPlayer) return def OnPlayerLogout(curPlayer): @@ -194,12 +206,12 @@ if not PlayerControl.PayMoney(curPlayer, moneyType, needMoney, "CreateFamily"): return - newFamilyID = random.randint(10000, 20000) # 先随机,之后替换接口 serverID = GameWorld.GetPlayerServerID(curPlayer) - curFamily = familyMgr.AddFamily(newFamilyID, fullFamilyName, serverID) + curFamily = familyMgr.AddFamily(fullFamilyName, serverID) if curFamily == None: GameWorld.ErrLog("创建家族失败", playerID) return + newFamilyID = curFamily.GetID() curFamily.SetLV(1) emblemIDList = PlayerFamilyEmblem.GetDefaultFamilyEmblemIDList() if not emblemID or emblemID not in emblemIDList: @@ -214,7 +226,7 @@ #XW_JZ_EstablishSud <n color="255,255,0">恭喜您,家族建立成功!</n> 25 - - PlayerControl.NotifyCode(curPlayer, "XW_JZ_EstablishSud") PlayerControl.WorldNotify(0, "jiazu_liubo_671654", [curPlayer.GetName(), fullFamilyName, newFamilyID]) - #PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily) + PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily) return def CheckInputFamilyName(curPlayer, inputName): @@ -397,7 +409,6 @@ #触发家族升级事件, 在SetFamilyLV之后,任务可以取等级判定 if isLVUP: pass - #EventShell.EventResponse_OnFamilyLVUp(curPlayer) if lastFamilyID != 0 and curPlayer.GetFamilyID() == 0: #玩家离开家族 @@ -407,7 +418,6 @@ #刚进家族并为族长,触发建家族事件 if curPlayer.GetFamilyMemberLV() == IPY_GameWorld.fmlLeader: pass - #EventShell.EventResponse_OnCreateFamily(curPlayer) #进入家族触发事件 __OnEnterFamily(curPlayer, tick) @@ -421,7 +431,6 @@ familyMgr = DBDataMgr.GetFamilyMgr() familyMgr.DelPlayerReqJoinFamilyIDAll(curPlayer.GetPlayerID()) Sync_RequestAddFamilyInfo(curPlayer) - #EventShell.EventResponse_OnFamily(curPlayer) __FamilyAffair_CheckReset(curPlayer) PlayerFamilyTech.Sync_PlayerFamilyTechLV(curPlayer) #GameLogic_FamilyWar.DoCheckChampionFamilyTitle(curPlayer) @@ -440,8 +449,6 @@ curPlayer.SetFamilyLV(0) PlayerControl.SetLeaveFamilyTimeEx(curPlayer, int(time.time())) - #触发玩家离开家族的任务 - #EventShell.EventResponse_OnLeaveFamily(curPlayer) FBLogic.OnLeaveFamily(curPlayer, tick) return @@ -755,7 +762,7 @@ reqInfo.ReqTime = reqTime if curPlayer: reqInfo.IsOnLine = True - viewCache = DBDataMgr.GetPlayerViewCacheMgr().FindViewCache(playerID) + viewCache = PlayerViewCache.FindViewCache(playerID) if viewCache: reqInfo.Name = viewCache.GetPlayerName() reqInfo.NameLen = len(reqInfo.Name) @@ -1355,6 +1362,102 @@ ## ------------------------------------------------------------------------------------------------ +#// A6 17 查询家族行为信息 #tagCMQueryFamilyAction +# +#struct tagCMQueryFamilyAction +#{ +# tagHead Head; +# BYTE ActionType; // 行为类型 +# DWORD FamilyID; // 家族ID,发0默认自己家族 +#}; +def OnQueryFamilyAction(index, cliendData, tick): + curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) + + if not curPlayer: + return + + actionType = cliendData.ActionType + familyID = cliendData.FamilyID + if not familyID: + familyID = curPlayer.GetFamilyID() + + SendFamilyActionInfo(curPlayer, familyID, actionType) + return + +def SendFamilyActionInfo(curPlayer, familyID, actionType): + ## 发送家族行为 + # @param curPlayer: 为None时通知该仙盟所有成员 + + familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, actionType) + + clientPack = ChPyNetSendPack.tagMCFamilyActionInfo() + clientPack.FamilyID = familyID + clientPack.ActionType = actionType + clientPack.FamilyActionList = [] + + for index in xrange(familyAction.Count()): + familyActionData = familyAction.At(index) + + actionData = ChPyNetSendPack.tagMCFamilyAction() + actionData.Time = familyActionData.GetTime() + actionData.Name = familyActionData.GetName() + actionData.NameLen = len(actionData.Name) + actionData.Value1 = familyActionData.GetValue1() + actionData.Value2 = familyActionData.GetValue2() + actionData.Value3 = familyActionData.GetValue3() + actionData.Value4 = familyActionData.GetValue4() + actionData.Value5 = familyActionData.GetValue5() + actionData.Value6 = familyActionData.GetValue6() + actionData.UseData = familyActionData.GetUserData() + actionData.UseDataLen = len(actionData.UseData) + clientPack.FamilyActionList.append(actionData) + + clientPack.Count = len(clientPack.FamilyActionList) + + if curPlayer: + NetPackCommon.SendFakePack(curPlayer, clientPack) + return + Broadcast_FamilyPack(familyID, clientPack) + return + +def SendFamilyAction(actionDataList, curPlayer=None): + ## 同步指定仙盟action + # @param actionDataList: 支持列表或指定actionData + # @param curPlayer: 为None时通知该仙盟所有成员 + if not isinstance(actionDataList, list): + actionDataList = [actionDataList] + if not actionDataList: + return + familyActionData = actionDataList[0] + familyID = familyActionData.GetFamilyID() + actionType = familyActionData.GetActionType() + + clientPack = ChPyNetSendPack.tagMCFamilyActionInfo() + clientPack.FamilyID = familyID + clientPack.ActionType = actionType + clientPack.FamilyActionList = [] + for familyActionData in actionDataList: + actionData = ChPyNetSendPack.tagMCFamilyAction() + actionData.Time = familyActionData.GetTime() + actionData.Name = familyActionData.GetName() + actionData.NameLen = len(actionData.Name) + actionData.Value1 = familyActionData.GetValue1() + actionData.Value2 = familyActionData.GetValue2() + actionData.Value3 = familyActionData.GetValue3() + actionData.Value4 = familyActionData.GetValue4() + actionData.Value5 = familyActionData.GetValue5() + actionData.Value6 = familyActionData.GetValue6() + actionData.UseData = familyActionData.GetUserData() + actionData.UseDataLen = len(actionData.UseData) + clientPack.FamilyActionList.append(actionData) + clientPack.Count = len(clientPack.FamilyActionList) + + if curPlayer: + NetPackCommon.SendFakePack(curPlayer, clientPack) + return + Broadcast_FamilyPack(familyID, clientPack) + return + def GetFamilyDayAward(curPlayer): ##领取仙盟每日奖励 2小时脱机挂时间 return -- Gitblit v1.8.0