ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/SetFamilyInfo.py
@@ -17,6 +17,7 @@
#---------------------------------------------------------------------
#"""Version = 2016-06-06 22:00"""
#---------------------------------------------------------------------
import PlayerFamilyEmblem
import PlayerFamily
import GameWorld
#---------------------------------------------------------------------
@@ -28,7 +29,8 @@
Def_FamilyInfo_FightPower,                       # 设置家族总战力
Def_FamilyInfo_BossFood,                         # 设置家族兽粮
Def_FamilyInfo_WeekMissionMoney,                 # 本周任务资金
) = range(6)
Def_FamilyInfo_Emblem,                           # 徽章
) = range(7)
#系统提示信息表
Def_MsgDict = {
@@ -38,11 +40,8 @@
               Def_FamilyInfo_FightPower:'总战力',
               Def_FamilyInfo_BossFood:'兽粮',
               Def_FamilyInfo_WeekMissionMoney:'本周任务资金',
               "all":'所有属性',
               Def_FamilyInfo_Emblem:'设置徽章',
               }
#设置全部属性时需要设置的属性类型, 一般用于快速测试用
Def_SetAllFamilyInfoList = [Def_FamilyInfo_Money]
#---------------------------------------------------------------------
## 执行逻辑
#  @param curPlayer 当前玩家
@@ -50,13 +49,14 @@
#  @return None
#  @remarks 函数详细说明.
def OnExec(curPlayer, cmdList):
    if len(cmdList) != 2:
    if not cmdList:
        helpStr = ""
        for index, name in Def_MsgDict.items():
            helpStr = helpStr + "%s-%s," % (index, name)
        GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 类型 数值')
        GameWorld.DebugAnswer(curPlayer, '%s' % helpStr)
        #GameWorld.DebugAnswer(curPlayer, '    特殊: SetFamilyInfo all, 数值; 可设置所有战盟属性数值')
        GameWorld.DebugAnswer(curPlayer, '设置徽章: %s 徽章ID [剩余时间秒]' % Def_FamilyInfo_Emblem)
        return
    
    curFamily = curPlayer.GetFamily()
@@ -65,12 +65,13 @@
        GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 玩家无家族')
        return
    
    funcType, funcValue = cmdList
    infoTypeList = [funcType]
    if funcType == "all":
        infoTypeList = Def_SetAllFamilyInfoList
    funcType = cmdList[0]
    funcValue = cmdList[1] if len(cmdList) > 1 else 0
        
    __SetFamilyInfoValue(curPlayer, curFamily, infoTypeList, funcValue)
    if not __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):
        GameWorld.DebugAnswer(curPlayer, '设置家族%s 失败, 数值 = %s'%(Def_MsgDict[funcType], funcValue))
        return
    #通知客户端刷新
    curFamily.Broadcast_FamilyChange()
    #通知地图服务器刷新
@@ -79,11 +80,9 @@
    GameWorld.DebugAnswer(curPlayer, '设置家族%s 成功, 数值 = %s'%(Def_MsgDict[funcType], funcValue))
    return
def __SetFamilyInfoValue(curPlayer, curFamily, infoTypeList, funcValue):
def __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):
    isLVUP = False
    isSort = False
    for funcType in infoTypeList:
        
        if funcType == Def_FamilyInfo_LV:
            curFamily.SetLV(funcValue)
@@ -109,14 +108,22 @@
        elif funcType == Def_FamilyInfo_WeekMissionMoney:
            PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
            
    elif funcType == Def_FamilyInfo_Emblem:
        setExpireTimes = None
        if len(cmdList) > 2:
            setExpireTimes = cmdList[2]
        if not PlayerFamilyEmblem.AddFamilyEmblem(curFamily.GetID(), funcValue, setExpireTimes):
            return
        else:
            GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 funcType = %s'%(funcType))
        return
    #自动升级战盟
    if isLVUP:
        if PlayerFamily.DoFamilyLvUp(curFamily):
            isSort = False
    if isSort:
        PlayerFamily.DoFamilySort()
    return
    return True