xdh
2019-04-18 ab2158916e07846e4be746673231dac6dfa27fc9
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ResetBaseAttr.py
@@ -2,52 +2,44 @@
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
##@package GM.Commands.ResetBaseAttr
#
##@package ResetBaseAttr.py
#
# @todo: 重设玩家属性
# @author wdb
# @date 2013-06-21
# @todo:重置玩家灵根属性点
# @author hxp
# @date 2019-3-25
# @version 1.0
#
# @note:
# 详细描述:
#------------------------------------------------------------------------------
# 详细描述: 重置玩家灵根属性点
#
#-------------------------------------------------------------------------------
#"""Version = 2019-3-25 下午7:50:30"""
#-------------------------------------------------------------------------------
import Item_ResetAttrPoint
import GameWorld
import PlayerControl
#------------------------------------------------------------------------------
"""Version = 2013-06-21 14:30"""
## GM命令执行入口
#  @param curPlayer 当前玩家
#  @param list 参数列表
#  @return None
def OnExec(curPlayer, cmdlist):
def OnExec(curPlayer, cmdlist):
    
    if curPlayer.GetLV() > 1:
        GameWorld.DebugAnswer(curPlayer, "LV can not greater than 1")
    if not cmdlist:
        GameWorld.DebugAnswer(curPlayer, "重置所有灵根: ResetBaseAttr 0")
        GameWorld.DebugAnswer(curPlayer, "重置指定灵根: ResetBaseAttr ID 点数")
        return
    
    playerJob = curPlayer.GetJob()
    initBaseAttrPoint = (0, 0, 0, 0)
    # 获取创建时的基础属性
    baseSTR, basePNE, basePHY, baseCON = PlayerControl.GetPlayerBasePoint(playerJob)
    # 获取创建时的基础属性错误, 返回
    if (baseSTR, basePNE, basePHY, baseCON) == initBaseAttrPoint:
        return initBaseAttrPoint
    curPlayer.SetBaseSTR(baseSTR)
    curPlayer.SetBasePNE(basePNE)
    curPlayer.SetBasePHY(basePHY)
    curPlayer.SetBaseCON(baseCON)
    #刷新人物所有状态
    playerControl = PlayerControl.PlayerControl(curPlayer)
    playerControl.RefreshAllState()
    isOK = False
    if len(cmdlist) == 1 and cmdlist[0] == 0:
        isOK = Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, 0, 0)
    elif len(cmdlist) >= 2:
        resetID, resetPoint = cmdlist[:2]
        isOK = Item_ResetAttrPoint.DoResetAttrPoint(curPlayer, resetID, resetPoint)
    if not isOK:
        GameWorld.DebugAnswer(curPlayer, "重置灵根失败!")
    else:
        GameWorld.DebugAnswer(curPlayer, "重置灵根成功!当前剩余点数: %s" % curPlayer.GetFreePoint())
    return