|  |  | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | #"""Version = 2016-06-06 22:00"""
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | import PlayerFamilyEmblem
 | 
 |  |  | import PlayerFamily
 | 
 |  |  | import GameWorld
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | 
 |  |  | Def_FamilyInfo_FightPower,                       # 设置家族总战力
 | 
 |  |  | Def_FamilyInfo_BossFood,                         # 设置家族兽粮
 | 
 |  |  | Def_FamilyInfo_WeekMissionMoney,                 # 本周任务资金
 | 
 |  |  | ) = range(6)
 | 
 |  |  | Def_FamilyInfo_Emblem,                           # 徽章
 | 
 |  |  | ) = range(7)
 | 
 |  |  | 
 | 
 |  |  | #系统提示信息表
 | 
 |  |  | Def_MsgDict = {
 | 
 |  |  | 
 |  |  |                Def_FamilyInfo_FightPower:'总战力',
 | 
 |  |  |                Def_FamilyInfo_BossFood:'兽粮',
 | 
 |  |  |                Def_FamilyInfo_WeekMissionMoney:'本周任务资金',
 | 
 |  |  |                "all":'所有属性',
 | 
 |  |  |                Def_FamilyInfo_Emblem:'设置徽章',
 | 
 |  |  |                }
 | 
 |  |  | 
 | 
 |  |  | #设置全部属性时需要设置的属性类型, 一般用于快速测试用
 | 
 |  |  | Def_SetAllFamilyInfoList = [Def_FamilyInfo_Money]
 | 
 |  |  | #---------------------------------------------------------------------
 | 
 |  |  | ## 执行逻辑
 | 
 |  |  | #  @param curPlayer 当前玩家
 | 
 |  |  | 
 |  |  | #  @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()
 | 
 |  |  | 
 |  |  |         GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 玩家无家族')
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  |     funcType, funcValue = cmdList
 | 
 |  |  |     infoTypeList = [funcType]
 | 
 |  |  |     if funcType == "all":
 | 
 |  |  |         infoTypeList = Def_SetAllFamilyInfoList
 | 
 |  |  |          | 
 |  |  |     __SetFamilyInfoValue(curPlayer, curFamily, infoTypeList, funcValue)
 | 
 |  |  |     funcType = cmdList[0]
 | 
 |  |  |     funcValue = cmdList[1] if len(cmdList) > 1 else 0
 | 
 |  |  |      | 
 |  |  |     if not __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):
 | 
 |  |  |         GameWorld.DebugAnswer(curPlayer, '设置家族%s 失败, 数值 = %s'%(Def_MsgDict[funcType], funcValue))
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     #通知客户端刷新
 | 
 |  |  |     curFamily.Broadcast_FamilyChange()
 | 
 |  |  |     #通知地图服务器刷新
 | 
 |  |  | 
 |  |  |     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)
 | 
 |  |  |         isSort = True
 | 
 |  |  |         
 | 
 |  |  |         if funcType == Def_FamilyInfo_LV:
 | 
 |  |  |             curFamily.SetLV(funcValue)
 | 
 |  |  |             isSort = True
 | 
 |  |  |              | 
 |  |  |         elif funcType == Def_FamilyInfo_Money:
 | 
 |  |  |             curFamily.SetMoney(funcValue)
 | 
 |  |  |             isLVUP = True
 | 
 |  |  |             if funcValue == 0:
 | 
 |  |  |                 PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
 | 
 |  |  |                  | 
 |  |  |         elif funcType == Def_FamilyInfo_WarRank:
 | 
 |  |  |             PlayerFamily.SetFamilyWarRank(curFamily, funcValue)
 | 
 |  |  |             isSort = True
 | 
 |  |  |          | 
 |  |  |         elif funcType == Def_FamilyInfo_FightPower:
 | 
 |  |  |             PlayerFamily.SetFamilyTotalFightPower(curFamily, funcValue)
 | 
 |  |  |             isSort = True
 | 
 |  |  |              | 
 |  |  |         elif funcType == Def_FamilyInfo_BossFood:
 | 
 |  |  |             PlayerFamily.SetFamilyBossFood(curFamily, funcValue)
 | 
 |  |  |              | 
 |  |  |         elif funcType == Def_FamilyInfo_WeekMissionMoney:
 | 
 |  |  |     elif funcType == Def_FamilyInfo_Money:
 | 
 |  |  |         curFamily.SetMoney(funcValue)
 | 
 |  |  |         isLVUP = True
 | 
 |  |  |         if funcValue == 0:
 | 
 |  |  |             PlayerFamily.SetCurWeekMissionMoney(curFamily, 0)
 | 
 |  |  |             
 | 
 |  |  |         else:
 | 
 |  |  |             GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo 错误 funcType = %s'%(funcType))
 | 
 |  |  |     elif funcType == Def_FamilyInfo_WarRank:
 | 
 |  |  |         PlayerFamily.SetFamilyWarRank(curFamily, funcValue)
 | 
 |  |  |         isSort = True
 | 
 |  |  |      | 
 |  |  |     elif funcType == Def_FamilyInfo_FightPower:
 | 
 |  |  |         PlayerFamily.SetFamilyTotalFightPower(curFamily, funcValue)
 | 
 |  |  |         isSort = True
 | 
 |  |  |          | 
 |  |  |     elif funcType == Def_FamilyInfo_BossFood:
 | 
 |  |  |         PlayerFamily.SetFamilyBossFood(curFamily, funcValue)
 | 
 |  |  |          | 
 |  |  |     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:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     #自动升级战盟
 | 
 |  |  |     if isLVUP:
 | 
 |  |  |         if PlayerFamily.DoFamilyLvUp(curFamily):
 | 
 |  |  |             isSort = False
 | 
 |  |  |     if isSort:
 | 
 |  |  |         PlayerFamily.DoFamilySort()
 | 
 |  |  |     return
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  |      |