xdh
2019-03-14 c409f8d2d3ac5530b7dc1f14c15715beb3bb1da7
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GM.Commands.SetEquipPartPlusLV
#
# @todo:ÉèÖÃ×°±¸²¿Î»¹«¹²Ç¿»¯µÈ¼¶
# @author hxp
# @date 2015-12-15
# @version 1.0
#
# ÏêϸÃèÊö: ÉèÖÃ×°±¸²¿Î»¹«¹²Ç¿»¯µÈ¼¶
#
#---------------------------------------------------------------------
"""Version = 2015-12-15 17:00"""
#---------------------------------------------------------------------
import Operate_EquipPlus
import IPY_GameWorld
import ChConfig
import ChEquip
import GameWorld
import ItemCommon
import IpyGameDataPY
import PlayerControl
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param cmdList ²ÎÊýÁбí [packType, index, starLV]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, cmdList):
    if not cmdList:
        __GMHelpAnswer(curPlayer)
        return
    packType = IPY_GameWorld.rptEquip
    curPack = curPlayer.GetItemManager().GetPack(packType)
    
    if len(cmdList) == 1: #ÉèÖÃËùÓÐ
        setStarLV = cmdList[0]
        equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []):
            for classlv in xrange(1, equipMaxClasslv+1):
                ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)
                if not ipyData:
                    continue 
                gridIndex = ipyData.GetGridIndex()
                curEquip = curPack.GetAt(gridIndex)
                ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, setStarLV)
                ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
                ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, 0)
        #Ë¢ÐÂËùÓÐÊôÐÔ
        ChEquip.RefreshPlayerEquipAttribute(curPlayer)
        playControl = PlayerControl.PlayerControl(curPlayer)
        playControl.RefreshPlayerAttrState()
        ChEquip.NotifyEquipPartPlusLV(curPlayer)
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃËùÓв¿Î»Ç¿»¯µÈ¼¶Îª: %s" % (setStarLV))
    elif len(cmdList) == 2:
        classLV = cmdList[0]
        setStarLV = cmdList[1]
        for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []):
            ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
            if not ipyData:
                continue
            gridIndex = ipyData.GetGridIndex()
            curEquip = curPack.GetAt(gridIndex)
            ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, setStarLV)
            ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
            ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, 0)
        Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
        ChEquip.NotifyEquipPartPlusLV(curPlayer)
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s½×ËùÓв¿Î»Ç¿»¯µÈ¼¶Îª: %s" % (classLV, setStarLV))
        return
    
    if len(cmdList) != 3:
        __GMHelpAnswer(curPlayer, "²ÎÊý´íÎó£¡")
        return
    
    classLV, equipPlace, starLV = cmdList
    
    if equipPlace not in ChConfig.Pack_EquipPart_CanPlusStar[packType]:
        __GMHelpAnswer(curPlayer, "²¿Î»²»´æÔÚ£¡")
        return
    ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
    if not ipyData:
        return
    gridIndex = ipyData.GetGridIndex()
    curEquip = curPack.GetAt(gridIndex)
#    if not ItemCommon.CheckItemCanUse(curEquip):
#        return
#    maxStarLV = ItemCommon.GetItemMaxPlusLV(curPlayer, gridIndex, curEquip)
#    starLV = min(starLV, maxStarLV)
    ChEquip.SetEquipPartPlusLV(curPlayer, packType, gridIndex, curEquip, starLV)
    ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, 0)
    Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, classLV)
    ChEquip.NotifyEquipPartPlusLV(curPlayer, packType, gridIndex)
    GameWorld.DebugAnswer(curPlayer, "ÉèÖÃ%s½×%s²¿Î»Ç¿»¯µÈ¼¶Îª: %s" % (classLV, equipPlace, starLV))
    return
 
 
def __GMHelpAnswer(curPlayer, errorMsg=""):
    if errorMsg:
        GameWorld.DebugAnswer(curPlayer, "%s" % errorMsg)
        GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV µÈ¼¶  ÉèÖÃËùÓÐ")
        GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV ½×¼¶ Ç¿»¯µÈ¼¶")
        GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV ½×¼¶ ²¿Î» Ç¿»¯µÈ¼¶")
    
 
    #===========================================================================
    return