| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package SetFamilyInfo  | 
| # @todo: ÉèÖüÒ×åÊôÐÔ  | 
| #  | 
| # @author: panwei  | 
| # @date 2010-12-10  | 
| # @version 1.2  | 
| #  | 
| # @change: "2015-03-23 10:00" hxp Ôö¼ÓÉèÖüÒÔ°µÈ¼¶£¬¾Ñé  | 
| # @change: "2016-06-06 22:00" hxp Ôö¼Ó¼Ò×å×êʯ¡¢ÁîÅÆ  | 
| #  | 
| # @note:   | 
| #---------------------------------------------------------------------  | 
| #"""Version = 2016-06-06 22:00"""  | 
| #---------------------------------------------------------------------  | 
| import PlayerFamilyEmblem  | 
| import PlayerFamily  | 
| import GameWorld  | 
| #---------------------------------------------------------------------  | 
| #¹¦ÄÜö¾Ù  | 
| (  | 
| Def_FamilyInfo_LV,                               # ÉèÖüÒ×åµÈ¼¶  | 
| Def_FamilyInfo_Money,                            # ÉèÖüÒ×å×ʽð  | 
| Def_FamilyInfo_WarRank,                          # ÉèÖüÒ×åÁªÈüÃû´Î  | 
| Def_FamilyInfo_FightPower,                       # ÉèÖüÒ×å×ÜÕ½Á¦  | 
| Def_FamilyInfo_BossFood,                         # ÉèÖüÒ×åÊÞÁ¸  | 
| Def_FamilyInfo_WeekMissionMoney,                 # ±¾ÖÜÈÎÎñ×ʽð  | 
| Def_FamilyInfo_Emblem,                           # »ÕÕÂ  | 
| ) = range(7)  | 
|   | 
| #ϵͳÌáʾÐÅÏ¢±í  | 
| Def_MsgDict = {  | 
|                Def_FamilyInfo_LV:'µÈ¼¶',  | 
|                Def_FamilyInfo_Money:'×ʽð',  | 
|                Def_FamilyInfo_WarRank:'ÁªÈüÃû´Î',  | 
|                Def_FamilyInfo_FightPower:'×ÜÕ½Á¦',  | 
|                Def_FamilyInfo_BossFood:'ÊÞÁ¸',  | 
|                Def_FamilyInfo_WeekMissionMoney:'±¾ÖÜÈÎÎñ×ʽð',  | 
|                Def_FamilyInfo_Emblem:'ÉèÖûÕÕÂ',  | 
|                }  | 
| #---------------------------------------------------------------------  | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param cmdList [ö¾Ù, ÊýÖµ]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer, cmdList):  | 
|     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()  | 
|       | 
|     if not curFamily:  | 
|         GameWorld.DebugAnswer(curPlayer, 'SetFamilyInfo ´íÎó Íæ¼ÒÎÞ¼Ò×å')  | 
|         return  | 
|       | 
|     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()  | 
|     #֪ͨµØÍ¼·þÎñÆ÷ˢР | 
|     PlayerFamily.SendPack_MapServer_PlayerFamilyRefresh(curFamily)  | 
|       | 
|     GameWorld.DebugAnswer(curPlayer, 'ÉèÖüÒ×å%s ³É¹¦, ÊýÖµ = %s'%(Def_MsgDict[funcType], funcValue))  | 
|     return  | 
|   | 
| def __SetFamilyInfoValue(curPlayer, curFamily, funcType, funcValue, cmdList):  | 
|     isLVUP = False  | 
|     isSort = False  | 
|       | 
|     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:  | 
|         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 True  | 
|   | 
|      |