hxp
2025-06-12 edc3910a9d090e5df4deb2dbc37709a740375938
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/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 ChConfig
import GameWorld
import PlayerControl
import PlayerFamilyZhenbaoge
import PlayerFamily
import DBDataMgr
import random
import time
 
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param msgList ²ÎÊýÁбí [addSkillID]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, msgList):
    
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÏÉÃËÕ䱦¸ó: Zhenbaoge 0")
        GameWorld.DebugAnswer(curPlayer, "ÖØÖýñÈÕ״ֵ̬: Zhenbaoge d")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍËÏÉÃËʱ¼ä: Zhenbaoge ft x·ÖÖÓǰ")
        GameWorld.DebugAnswer(curPlayer, "ÐÂÔö¼Ù¿³¼ÛÊý¾Ý: Zhenbaoge ´ÎÊý [Ëæ»úAÖµ ÖÁBÖµ]")
        GameWorld.DebugAnswer(curPlayer, "ABֵûÓÐÌîÔò°´³£¹æ¿³¼Û¼Û¸ñ¼ÆËã")
        return
    
    familyID = curPlayer.GetFamilyID()
    if not familyID:
        GameWorld.DebugAnswer(curPlayer, "ûÓÐÏÉÃË")
        return
    curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
    if not curFamily:
        return
    
    value1 = msgList[0]
    if value1 == 0:
        PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÏÉÃËÕ䱦¸óOK")
        return
        
    elif value1 == "d":
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeCut, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyZhenbaogeBuy, 0)
        PlayerFamilyZhenbaoge.Sync_ZhenbaogeInfo(curPlayer)
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÕ䱦¸óÍæ¼Ò½ñÈÕ״̬OK")
        return
    
    elif value1 == "ft":
        minutes = msgList[1] if len(msgList) > 1 else 0
        leaveFamilyTimeEx = int(time.time()) - minutes * 60
        PlayerControl.SetLeaveFamilyTimeEx(curPlayer, leaveFamilyTimeEx)
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍËÏÉÃËʱ¼ä:%s" % GameWorld.ChangeTimeNumToStr(leaveFamilyTimeEx))
        return
    
    #Ìí¼Ó¼Ù¿³¼Û
    gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
    if not gActionData:
        GameWorld.DebugAnswer(curPlayer, "ÇëÏÈÖØÖÃÕ䱦¸ó")
        return
    
    familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)
    actionCount = familyAction.Count()
    
    fackCount = value1
    randValue1 = msgList[1] if len(msgList) > 1 else 0
    randValue2 = msgList[2] if len(msgList) > 2 else 0
    syncActionDataList = [gActionData]
    startFackID = 1000 + actionCount
    FakeName = GameWorld.GbkToCode("¼ÙÃû×Ö")
    for fackID in range(startFackID, startFackID + fackCount):
        
        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))
        
    PlayerFamily.SendFamilyAction(syncActionDataList)
    nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
    GameWorld.DebugAnswer(curPlayer, "Ìí¼Ó¼Ù¿³¼ÛÊý:%s,×Ü¿³¼ÛÊý:%s,µ±Ç°¼Û¸ñ:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
    return