hxp
2024-10-29 328648da94a07437fc46024f3e9b7e48c2e2ae38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/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