hxp
2025-10-24 3432541b467d53ffe4ed3872c734e76638e30df8
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.Taofa
#
# @todo:¹«»áÌÖ·¥
# @author hxp
# @date 2025-10-24
# @version 1.0
#
# ÏêϸÃèÊö: ¹«»áÌÖ·¥
#
#-------------------------------------------------------------------------------
#"""Version = 2025-10-24 19:00"""
#-------------------------------------------------------------------------------
 
import ChConfig
import GameWorld
import PlayerControl
import PlayerFamilyZhenbaoge
import PlayerFamilyTaofa
import PlayerFamily
import DBDataMgr
import random
import time
 
def OnExec(curPlayer, msgList):
    
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())
        GameWorld.DebugAnswer(curPlayer, "ÖØÖù«»áÌÖ·¥: Taofa 0")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖò¼Õó²ã¼¶: Taofa z ²ã¼¶ [Ê£ÓàÃë]")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖõ±Ç°Å­Æø: Taofa a Å­Æø")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÌÖ·¥´ÎÊý: Taofa c ÒÑÌÖ·¥´ÎÊý  ÎïÆ·´ÎÊý")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖñ¦ÏäÁìÈ¡: Taofa b ÒÑÁìÈ¡±¦Ïä Î´ÁìÈ¡")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖñ¦Ïäʱ¼ä: Taofa t ¼¸Ãëǰͳ¼ÆµÄ")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖñ¦Ïä¹±Ï×: Taofa g Òѹ±Ï×±¦Ïä [ÀÛ¼ÆÉ˺¦ ÀúÊ·É˺¦]")
        #GameWorld.DebugAnswer(curPlayer, "ÐÂÔö³ÉÔ±ÌÖ·¥: Taofa m ÈËÊý [ÿÈ˹¥»÷´ÎÊý Å­Æø´ÎÊý É˺¦ÖµA µ½B]")
        #GameWorld.DebugAnswer(curPlayer, "ABֵûÓÐÌîÔò°´³£¹æ¿³¼Û¼Û¸ñ¼ÆËã")
        GameWorld.DebugAnswer(curPlayer, "´´½¨ÏÉÃËÏà¹ØÊ¹ÓÃÃüÁî: CreateFamily")
        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:
        PlayerFamilyTaofa.OnTaofaReset(curFamily)
        PlayerFamilyTaofa.OnTaofaResetPlayer(curPlayer)
        GameWorld.DebugAnswer(curPlayer, "ÖØÖù«»áÌÖ·¥OK")
        return
    
    if value1 == "z":
        gLayer = msgList[1] if len(msgList) > 1 else 0
        remainSeconds = msgList[2] if len(msgList) > 2 else 3600
        gEndTime = int(time.time()) + remainSeconds
        familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyTaofa.ActionType)
        gActionData = familyAction.GetActionDataByValue1(PlayerFamilyTaofa.ActionGlobalID, True)
        PlayerFamilyTaofa.SetFABuzhenLayer(gActionData, gLayer)
        PlayerFamilyTaofa.SetFABuzhenEndTime(gActionData, gEndTime)
        PlayerFamily.SendFamilyAction(gActionData)
        GameWorld.DebugAnswer(curPlayer, "²¼Õó²ã:%s,µ½ÆÚ:%s" % (gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)))
        return
    
    # ÐÂÔö³ÉÔ±ÌÖ·¥
    if value1 == "m":
        memCnt = msgList[1] if len(msgList) > 1 else 0
        GameWorld.DebugAnswer(curPlayer, "³ÉÔ±ÌÖ·¥:%s" % (memCnt))
        return
    
    elif value1 == "a":
        anger = msgList[1] if len(msgList) > 1 else 0
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaAnger, anger)
        GameWorld.DebugAnswer(curPlayer, "µ±Ç°Å­Æø: %s" % anger)
        
    elif value1 == "c":
        atkCnt = msgList[1] if len(msgList) > 1 else 0
        itemAddCnt = msgList[2] if len(msgList) > 2 else 0
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaCnt, atkCnt)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaItemAddCnt, itemAddCnt)
        GameWorld.DebugAnswer(curPlayer, "ÒÑÌÖ·¥´ÎÊý:%s, ÎïÆ·Ôö¼Ó´ÎÊý:%s" % (atkCnt, itemAddCnt))
        
    elif value1 == "b":
        totalGetCnt = msgList[1] if len(msgList) > 1 else 0
        unGetCnt = msgList[2] if len(msgList) > 2 else 0
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt, totalGetCnt)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, unGetCnt)
        GameWorld.DebugAnswer(curPlayer, "ÒÑÁìÈ¡±¦Ïä:%s, Î´ÁìÈ¡:%s" % (totalGetCnt, unGetCnt))
        
    elif value1 == "t":
        befSeconds = msgList[1] if len(msgList) > 1 else 0
        lastTime = int(time.time()) - befSeconds
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, lastTime)
        GameWorld.DebugAnswer(curPlayer, "Éϴμì²é±¦Ïäʱ¼ä:%s" % (GameWorld.ChangeTimeNumToStr(lastTime)))
        
    elif value1 == "g":
        contribCnt = msgList[1] if len(msgList) > 1 else 0
        boxHurtTotal = msgList[2] if len(msgList) > 2 else None
        boxHurtTotalHis = msgList[3] if len(msgList) > 3 else None
        if boxHurtTotal == None:
            boxHurt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxHurt)
            boxHurtEx = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtEx)
            boxHurtTotal = boxHurt + boxHurtEx * ChConfig.Def_PerPointValue
        if boxHurtTotalHis == None:
            boxHurtHis = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtHis)
            boxHurtHisEx = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtHisEx)
            boxHurtTotalHis = max(boxHurtTotal, boxHurtHis + boxHurtHisEx * ChConfig.Def_PerPointValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxContribCnt, contribCnt)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurt, boxHurtTotal % ChConfig.Def_PerPointValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtEx, boxHurtTotal / ChConfig.Def_PerPointValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtHis, boxHurtTotalHis % ChConfig.Def_PerPointValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtHisEx, boxHurtTotalHis / ChConfig.Def_PerPointValue)
        GameWorld.DebugAnswer(curPlayer, "Òѹ±Ï×±¦Ïä:%s,×ÜÉ˺¦:%s,ÀúÊ·:%s" % (contribCnt, boxHurtTotal, boxHurtTotalHis))
        
    PlayerFamilyTaofa.SyncTaofaInfo(curPlayer)
    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