|  |  |  | 
|---|
|  |  |  | import ChConfig | 
|---|
|  |  |  | import ChEquip | 
|---|
|  |  |  | import GameWorld | 
|---|
|  |  |  | import ItemCommon | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import PlayerControl | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | #逻辑实现 | 
|---|
|  |  |  | ## GM命令执行入口 | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @return None | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def OnExec(curPlayer, cmdList): | 
|---|
|  |  |  | if not cmdList: | 
|---|
|  |  |  | __GMHelpAnswer(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | packType = IPY_GameWorld.rptEquip | 
|---|
|  |  |  | curPack = curPlayer.GetItemManager().GetPack(packType) | 
|---|
|  |  |  | refreshClassLV = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if len(cmdList) == 1: #设置所有 | 
|---|
|  |  |  | setStarLV = cmdList[0] | 
|---|
|  |  |  | # 设置所有阶 | 
|---|
|  |  |  | if len(cmdList) == 2: | 
|---|
|  |  |  | setStarLV, evolveLV = cmdList | 
|---|
|  |  |  | equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv') | 
|---|
|  |  |  | for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []): | 
|---|
|  |  |  | for classlv in xrange(1, equipMaxClasslv+1): | 
|---|
|  |  |  | 
|---|
|  |  |  | 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] | 
|---|
|  |  |  | ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, evolveLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置所有部位强化等级(%s),进化等级(%s)" % (setStarLV, evolveLV)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 设置指定阶 | 
|---|
|  |  |  | elif len(cmdList) == 3: | 
|---|
|  |  |  | classLV, setStarLV, evolveLV = cmdList | 
|---|
|  |  |  | for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(packType, []): | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, gridIndex, evolveLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if len(cmdList) != 3: | 
|---|
|  |  |  | __GMHelpAnswer(curPlayer, "参数错误!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置%s阶所有部位强化等级(%s),进化等级(%s)" % (classLV, setStarLV, evolveLV)) | 
|---|
|  |  |  | refreshClassLV = classLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | classLV, equipPlace, starLV = cmdList | 
|---|
|  |  |  | # 设置指定阶部位 | 
|---|
|  |  |  | elif len(cmdList) == 4: | 
|---|
|  |  |  | classLV, equipPlace, starLV, evolveLV = cmdList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if equipPlace not in ChConfig.Pack_EquipPart_CanPlusStar[packType]: | 
|---|
|  |  |  | __GMHelpAnswer(curPlayer, "部位不存在!") | 
|---|
|  |  |  | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | ChEquip.SetEquipPartProficiency(curPlayer, packType, gridIndex, evolveLV) | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置%s阶%s部位强化等级(%s),进化等级(%s)" % (classLV, equipPlace, starLV, evolveLV)) | 
|---|
|  |  |  | refreshClassLV = classLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | __GMHelpAnswer(curPlayer, "参数错误!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Operate_EquipPlus.DoLogic_OnEquipPartStarLVChange(curPlayer, packType, refreshClassLV) | 
|---|
|  |  |  | ChEquip.NotifyEquipPartPlusLV(curPlayer, packType) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __GMHelpAnswer(curPlayer, errorMsg=""): | 
|---|
|  |  |  | if errorMsg: | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "%s" % errorMsg) | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV 等级  设置所有") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV 阶级 强化等级") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "SetEquipPartPlusLV 阶级 部位 强化等级") | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #=========================================================================== | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置所有阶级: SetEquipPartPlusLV 强化等级 进阶等级") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置指定阶级: SetEquipPartPlusLV 阶级  强化等级 进阶等级") | 
|---|
|  |  |  | GameWorld.DebugAnswer(curPlayer, "设置指定部位: SetEquipPartPlusLV 阶级 部位 强化等级 进阶等级") | 
|---|
|  |  |  | return | 
|---|