| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_FamilyTransfer
|
| | | #
|
| | | # @todo:GM工具命令 - 转让会长
|
| | | # @author hxp
|
| | | # @date 2025-12-21
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: GM工具命令 - 转让会长
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-12-21 17:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GMCommon
|
| | | import GameWorld
|
| | | import PlayerFamily
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | |
|
| | | ## 收到gm命令执行
|
| | | # @param gmCmdDict:gm命令字典
|
| | | # @return None |
| | | def OnExec(gmCmdDict):
|
| | | |
| | | queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') |
| | | familyName = gmCmdDict.get(GMCommon.Def_GMKey_FamilyName, '')
|
| | | |
| | | if familyName == '':
|
| | | return GMCommon.Def_ParamErr
|
| | | |
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | if queryType == "FamilyID":
|
| | | familyID = GameWorld.ToIntDef(familyName)
|
| | | if not familyID:
|
| | | return GMCommon.Def_ParamErr
|
| | | curFamily = familyMgr.FindFamily(familyID)
|
| | | else:
|
| | | curFamily = familyMgr.FindFamilyByName(familyName)
|
| | | |
| | | if not curFamily:
|
| | | GameWorld.DebugLogEx("目标工会不存在")
|
| | | return GMCommon.Def_NoTag, "no tag family"
|
| | | |
| | | familyID = curFamily.GetID()
|
| | | tagPlayer = None
|
| | | queryTagType = gmCmdDict.get("queryTagType", '') |
| | | queryTag = gmCmdDict.get("queryTag", '')
|
| | | if queryTagType == "PlayerName":
|
| | | tagPlayer = GameWorld.GetPlayerManager().FindPlayerByName(queryTag)
|
| | | else:
|
| | | tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(GameWorld.ToIntDef(queryTag))
|
| | | |
| | | if not tagPlayer:
|
| | | GameWorld.DebugLogEx("目标玩家不在线")
|
| | | return GMCommon.Def_NoTag, "tagPlayer is offLine"
|
| | | |
| | | tagPlayerID = tagPlayer.GetPlayerID()
|
| | | toMember = curFamily.FindMember(tagPlayerID)
|
| | | if not toMember:
|
| | | GameWorld.DebugLogEx("目标玩家非该工会成员: tagPlayerID=%s", tagPlayerID)
|
| | | return GMCommon.Def_NoTag, "tagPlayer is not this family member"
|
| | | |
| | | PlayerFamily.ChangeFamilyLeader(curFamily, toMember)
|
| | | PlayerFamily.Broadcast_FamilyChange(familyID, PlayerFamily.FamilyChangeType_LeaderChange)
|
| | | |
| | | # 邮件通知
|
| | | PlayerMail.SendMailByKey("FamilyLeaderAutoChange", tagPlayerID, [], [curFamily.GetName()])
|
| | | return GMCommon.Def_Success
|