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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/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 CrossPlayer
import PlayerControl
import PlayerFamilyZhenbaoge
import PlayerFamily
import DBDataMgr
import random
import time
 
def GetGMServerIDList(curPlayer):
    ## »ñÈ¡ÃüÁî¶îÍâ·¢Ë͵½ÆäËû·þÎñÆ÷£¬Èç¿ç·þ
    crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
    if crossServerID:
        GameWorld.DebugAnswer(curPlayer, "±¾·þ¹«»áÒÑ»¥Í¨¿ç·þID:%s" % crossServerID)
        return [crossServerID]
    GameWorld.DebugAnswer(curPlayer, "±¾·þ¹«»áδ»¥Í¨")
    return []
 
def OnExecCross(crossPlayer, msgList):
    if not msgList:
        return
    if GameWorld.IsMainServer() and DBDataMgr.GetFamilyMgr().GetCurCrossServerID():
        # ±¾·þ¹«»áÒÑ»¥Í¨²»ÔÙÖ´Ðб¾·þÃüÁî
        return
    
    familyID = crossPlayer.GetFamilyID()
    familyMgr = DBDataMgr.GetFamilyMgr()
    curFamily = familyMgr.FindFamily(familyID)
    if not curFamily:
        GameWorld.DebugAnswer(crossPlayer, "Íæ¼Òδ¼ÓÈ빫»á!")
        return
    
    if GameWorld.IsCrossServer():
        zoneID = familyMgr.GetFamilyZoneID(familyID)
        GameWorld.DebugAnswer(crossPlayer, "¿ç·þ¹«»áID:%s,zoneID=%s" % (familyID, zoneID))
        
    value1 = msgList[0]
    if value1 == 0:
        PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
        GameWorld.DebugAnswer(crossPlayer, "ÖØÖù«»áÕ䱦¸óOK")
        return
    
    #Ìí¼Ó¼Ù¿³¼Û
    gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
    if not gActionData:
        GameWorld.DebugAnswer(crossPlayer, "ÇëÏÈÖØÖÃÕ䱦¸ó")
        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(crossPlayer, "¿³¼ÛÈË´Î:%s,¿³¼Û:%s,ÏÖ¼Û:%s" % (fackID % 1000, cutPrice, nowPrice))
        
    PlayerFamily.SendFamilyAction(syncActionDataList)
    nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
    GameWorld.DebugAnswer(crossPlayer, "Ìí¼Ó¼Ù¿³¼ÛÊý:%s,×Ü¿³¼ÛÊý:%s,µ±Ç°¼Û¸ñ:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
    return
 
def OnExec(curPlayer, msgList):
    
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "-----%s-----" % GameWorld.GetCurrentDataTimeStr())
        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
    
    crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(curPlayer.GetPlayerID())
    if not crossPlayer:
        return
    
    value1 = msgList[0]
    
    # Ä¬Èϱ¾·þÖ´ÐеÄ
    if 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 = PlayerFamily.GetFamilyTime() - minutes * 60
        PlayerControl.SetLeaveFamilyTimeEx(curPlayer, leaveFamilyTimeEx)
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍ˹«»áʱ¼ä:%s" % GameWorld.ChangeTimeNumToStr(leaveFamilyTimeEx))
        return
    
    OnExecCross(crossPlayer, msgList)
    return