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
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: 
#
# @author: Alee
# @date 2019-1-14 ÏÂÎç11:30:12
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
import GameWorld
import CommFunc
import PlayerControl
import IPY_GameWorld
import BuffSkill
import SkillCommon
import base64
import ChConfig
 
# ·¢Ë͸ñʽ£º ÀàÐÍ+£¨ÊýÁ¿£©+Êý¾Ý
# Ïò¿ç·þ·¢Ë͵ÄÊý¾ÝÀàÐÍ
(
MergeData_Player,   # ¶Ô±È´¦Àí
MergeData_Item,     # ¶Ô±È´¦Àí Ö»ËãÊôÐԵı³°ü ×°±¸ ³èÎï 
MergeData_Skill,    # Ö»´¦ÀíID
MergeData_Buff,     # ¼´Ê±·¢ËÍ
) = range(0, 4)
 
# ·¢ËÍÖ÷·þÍæ¼ÒÊý¾Ý¸ø¿ç·þ
 
def SendMergeData_Buff(curPlayer, buffID, plusValueList):
    if buffID in [ChConfig.Def_SkillID_LimitSuperBuff,
                  ChConfig.Def_SkillID_TJGSuperBuff]:
        # ²»ÐèÒª´¦ÀíµÄbuff
        return
    if curPlayer.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    
    if GameWorld.IsCrossServer():
        # ·ÇÖ÷·þ
        return
    
    if not PlayerControl.GetCrossMapID(curPlayer):
        # ·Ç¿ç·þÖÐ
        return
 
    data = ''
    data = CommFunc.WriteBYTE(data, MergeData_Buff)
    data = CommFunc.WriteDWORD(data, buffID)
    data = CommFunc.WriteBYTE(data, len(plusValueList))
    for value in plusValueList:
        data = CommFunc.WriteDWORD(data, value)
 
    
    #Ö±½ÓÓÃ×Ö½ÚÁ÷»á±¨´í
    data = base64.b64encode(data)
    curPlayer.SendMergePlayerData(data)
    return
 
 
# ½ÓÊÕ×Ó·þÍæ¼ÒÊý¾Ý
def OnMergePlayerData(index, tick):
    if not GameWorld.IsCrossServer():
        # ·Ç¿ç·þ
        return
    
    # ¿ç·þ·þÎñÆ÷´¦Àí
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    pdata = base64.b64decode(curPlayer.GetMergePlayerData())
    
    pos = 0
    dataType, pos = CommFunc.ReadBYTE(pdata, pos)
    if dataType == MergeData_Buff:
        buffID, pos = CommFunc.ReadDWORD(pdata, pos)
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(buffID)
        if not curSkill:
            return
        
        plusValueList = []
        cnt, pos = CommFunc.ReadBYTE(pdata, pos)
        for i in range(cnt):
            value, pos = CommFunc.ReadDWORD(pdata, pos)
            plusValueList.append(value)
            
        buffType = SkillCommon.GetBuffType(curSkill)
        BuffSkill.AddBuffNoRefreshState(curPlayer, buffType, curSkill, tick, plusValueList)
 
        
    return