| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GM.Commands.Zhenbaoge  | 
| #  | 
| # @todo:Õ䱦¸ó  | 
| # @author hxp  | 
| # @date 2024-10-29  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: Õ䱦¸ó  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2024-10-29 17:30"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import GameWorld  | 
| import PlayerFamilyZhenbaoge  | 
| import PlayerFamilyAction  | 
| import ShareDefine  | 
| import random  | 
|   | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param gmList []  | 
| #  @return None  | 
| def OnExec(curPlayer, gmList):  | 
|       | 
|     if not gmList:  | 
|         #GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÕ䱦¸ó: Zhenbaoge 0")  | 
|         #GameWorld.DebugAnswer(curPlayer, "ÐÂÔö¼Ù¿³¼Û: Zhenbaoge ´ÎÊý [Ëæ»úAÖµ ÖÁBÖµ]")  | 
|         #GameWorld.DebugAnswer(curPlayer, "ABֵûÓÐÌîÔò°´³£¹æ¿³¼Û¼Û¸ñ¼ÆËã")  | 
|         return  | 
|       | 
|     curFamily = curPlayer.GetFamily()  | 
|     if not curFamily:  | 
|         return  | 
|       | 
|     value1 = gmList[0]  | 
|     if value1 == 0:  | 
|         PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)  | 
|         GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÏÉÃËÕ䱦¸óOK")  | 
|         return  | 
|       | 
|     familyID = curFamily.GetID()  | 
|     gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)  | 
|     if not gActionData:  | 
|         GameWorld.DebugAnswer(curPlayer, "ÇëÏÈÖØÖÃÕ䱦¸ó")  | 
|         return  | 
|       | 
|     familyAction = GameWorld.GetFamilyActionManager().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)  | 
|     actionCount = familyAction.Count()  | 
|       | 
|     fackCount = value1  | 
|     randValue1 = gmList[1] if len(gmList) > 1 else 0  | 
|     randValue2 = gmList[2] if len(gmList) > 2 else 0  | 
|     syncActionDataList = [gActionData]  | 
|     startFackID = 1000 + actionCount  | 
|     for fackID in range(startFackID, startFackID + fackCount):  | 
|         FakeName = "¼ÙÃû×Ö".decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding())  | 
|         playerID = fackID  | 
|         playerName = "%s%s" % (FakeName, fackID)  | 
|           | 
|         if randValue1 and randValue2 and randValue1 <= randValue2:       | 
|             cutPrice = random.randint(randValue1, randValue2)  | 
|         else:  | 
|             cutPrice = PlayerFamilyZhenbaoge.CalcCutPrice(curFamily, gActionData, playerID)  | 
|               | 
|         if not cutPrice:  | 
|             continue  | 
|           | 
|         actionData = PlayerFamilyZhenbaoge.AddCutPrice(familyID, playerID, playerName, cutPrice, gActionData, False)  | 
|         syncActionDataList.append(actionData)  | 
|         nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)  | 
|         GameWorld.DebugAnswer(curPlayer, "¿³¼ÛÈË´Î:%s,¿³¼Û:%s,ÏÖ¼Û:%s" % (fackID % 1000, cutPrice, nowPrice))  | 
|           | 
|     PlayerFamilyAction.SendFamilyAction(syncActionDataList)  | 
|     nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)  | 
|     GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó¼Ù¿³¼ÛÊý:%s,×Ü¿³¼ÛÊý:%s,µ±Ç°¼Û¸ñ:%s" % (fackCount, familyAction.Count() - 1, nowPrice))  | 
|     return  | 
|   |