From 6343277477b190efbc389bab2706cf94eb09be8d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 07 二月 2026 20:59:32 +0800
Subject: [PATCH] 358 【内政】红颜系统-服务端(红颜时装默认解锁的状态也通知;红颜时装物品解锁改为直接取背包中的物品;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyEmblem.py | 77 +++++++++++++++++++-------------------
1 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyEmblem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyEmblem.py
index d900533..d32beed 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyEmblem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyEmblem.py
@@ -46,29 +46,32 @@
defaultEmblemIDList = []
curTime = int(time.time())
actionType = ShareDefine.Def_ActionType_FamilyEmblem
- familyManager = DBDataMgr.GetFamilyMgr()
- for i in xrange(familyManager.GetCount()):
- family = familyManager.GetAt(i)
- if not family:
- continue
- familyID = family.GetID()
- familyAction = familyManager.GetFamilyActionMgr().GetFamilyAction(familyID, actionType)
- for index in range(familyAction.Count())[::-1]: # 可能触发删除,倒序遍历
- emblemActionObj = familyAction.At(index)
- emblemID = GetActionEmblemID(emblemActionObj)
- endTime = GetActionEmblemEndTime(emblemActionObj)
- if not endTime or endTime > curTime:
- #GameWorld.Log("检查仙盟徽章未过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
+ familyMgr = DBDataMgr.GetFamilyMgr()
+ # 每分钟刷新下仙盟战力排序
+ for zoneID in familyMgr.GetZoneIDListThisServer():
+ zoneMgr = familyMgr.GetZoneFamilyMgr(zoneID)
+ for index in range(zoneMgr.GetCount()):
+ family = zoneMgr.GetAt(index)
+ if not family:
continue
- familyAction.DelAction(index)
- GameWorld.Log("删除过期仙盟徽章! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
- if family.GetEmblemID() == emblemID:
- if not defaultEmblemIDList:
- defaultEmblemIDList = GetDefaultFamilyEmblemIDList()
- updEmblemID = random.choice(defaultEmblemIDList) if defaultEmblemIDList else 0
- GameWorld.Log("仙盟佩戴徽章过期恢复随机默认徽章! familyID=%s,emblemID=%s,endTime=%s,updEmblemID=%s" % (familyID, emblemID, endTime, updEmblemID))
- family.SetEmblemID(updEmblemID)
- family.Broadcast_FamilyChange()
+ familyID = family.GetID()
+ familyAction = familyMgr.GetFamilyActionMgr().GetFamilyAction(familyID, actionType)
+ for index in range(familyAction.Count())[::-1]: # 可能触发删除,倒序遍历
+ emblemActionObj = familyAction.At(index)
+ emblemID = GetActionEmblemID(emblemActionObj)
+ endTime = GetActionEmblemEndTime(emblemActionObj)
+ if not endTime or endTime > curTime:
+ #GameWorld.Log("检查仙盟徽章未过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
+ continue
+ familyAction.DelAction(index)
+ GameWorld.Log("删除过期仙盟徽章! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
+ if family.GetEmblemID() == emblemID:
+ if not defaultEmblemIDList:
+ defaultEmblemIDList = GetDefaultFamilyEmblemIDList()
+ updEmblemID = random.choice(defaultEmblemIDList) if defaultEmblemIDList else 0
+ GameWorld.Log("仙盟佩戴徽章过期恢复随机默认徽章! familyID=%s,emblemID=%s,endTime=%s,updEmblemID=%s" % (familyID, emblemID, endTime, updEmblemID))
+ family.SetEmblemID(updEmblemID)
+ PlayerFamily.Broadcast_FamilyInfo(familyID, isSyncMem=False) # 徽章过期
return
def GetFamilyEmblemActionData(familyID, emblemID):
@@ -77,7 +80,7 @@
familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, actionType)
for index in range(familyAction.Count()):
familyActionObj = familyAction.At(index)
- if emblemID == familyActionObj.GetValue1():
+ if emblemID == GetActionEmblemID(familyActionObj):
return familyActionObj
return
@@ -104,9 +107,6 @@
actionType = ShareDefine.Def_ActionType_FamilyEmblem
familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, actionType)
emblemActionObj = familyAction.AddAction()
- emblemActionObj.SetTime(curTime)
- emblemActionObj.SetFamilyId(familyID)
- emblemActionObj.SetActionType(actionType)
if not emblemActionObj:
return
@@ -134,19 +134,19 @@
SetActionEmblemEndTime(emblemActionObj, updEndTime)
# 通知
- #PlayerFamilyAction.SendFamilyAction(emblemActionObj)
+ PlayerFamily.SendFamilyAction(emblemActionObj)
return emblemActionObj
-def OnChangeFamilyEmblem(curPlayer, emblemID):
+def OnChangeFamilyEmblem(crossPlayer, emblemID, emblemWord=""):
## 修改仙盟徽章
- playerID = curPlayer.GetPlayerID()
- familyID = curPlayer.GetFamilyID()
- familyManager = PlayerFamily.GetFamilyMgr()
- curFamily = familyManager.FindFamily(familyID)
+ playerID = crossPlayer.GetPlayerID()
+ familyID = crossPlayer.GetFamilyID()
+ if familyID <= 0:
+ return
+ familyMgr = DBDataMgr.GetFamilyMgr()
+ curFamily = familyMgr.FindFamily(familyID)
if not curFamily:
return
- familyID = curFamily.GetID()
-
if curFamily.GetLeaderID() != playerID:
GameWorld.DebugLog("只有盟主可以修改徽章!", playerID)
return
@@ -178,8 +178,9 @@
GameWorld.Log("该徽章已过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
return
- GameWorld.DebugLog("更换仙盟徽章! familyID=%s,emblemID=%s" % (familyID, emblemID), playerID)
+ GameWorld.DebugLog("更换仙盟徽章! familyID=%s,emblemID=%s,emblemWord=%s" % (familyID, emblemID, GameWorld.CodeToGbk(emblemWord)), playerID)
curFamily.SetEmblemID(emblemID)
- #PlayerFamily.SendPack_MapServer_PlayerFamilyRefresh(curFamily)
- curFamily.Broadcast_FamilyChange()
- return
+ if emblemWord:
+ curFamily.SetEmblemWord(emblemWord)
+ PlayerFamily.Broadcast_FamilyInfo(familyID, isSyncMem=False) # 徽章修改
+ return True
--
Gitblit v1.8.0