hxp
2020-01-11 ece7760d17592dfcadef52e47848836b13cf3f47
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/MakeItemCount.py
@@ -14,11 +14,13 @@
#
# 模块详细说明
#导入
import IPY_GameWorld
import ItemControler
import ShareDefine
import ChConfig
import GameWorld
import ChConfig
import ItemCommon
#---------------------------------------------------------------------
#全局变量
#---------------------------------------------------------------------
@@ -36,40 +38,48 @@
    
    #输入命令格式错误
    if len(msgList) < 1:
        GameWorld.DebugAnswer(curPlayer, "MakeItemCount id, [count, 符印等级]")
        GameWorld.DebugAnswer(curPlayer, "MakeItemCount ID (个数  拍品组数 全部传奇属性)")
        return
    
    event = [ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]
    itemID = msgList[0]
    count = msgList[1] if len(msgList) > 1 else 1
    runeLV = msgList[2] if len(msgList) > 2 else None
    itemCount = msgList[1] if len(msgList) > 1 else 1
    auctionGroup = msgList[2] if len(msgList) > 2 else 0
    isAllAttr = msgList[3] if len(msgList) > 3 else 0
    
    itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
    if not itemData:
        GameWorld.DebugAnswer(curPlayer, '该物品不存在 = %s' % (itemID))
        return
    packCount = itemData.GetPackCount()
    if packCount > 1:
        __DoGMGivePlayerItem(curPlayer, itemID, count, runeLV)
    if itemID in ChConfig.Def_TransformItemIDList:
        curItem = ItemControler.GetOutPutItemObj(itemID, itemCount, curPlayer=curPlayer)
        PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
        if not PlayerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=event):
            GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
        return
    playerItemControler = ItemControler.PlayerItemControler(curPlayer)
    # 拍品
    if auctionGroup > 0:
        for _ in xrange(auctionGroup):
            if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, True, [IPY_GameWorld.rptItem], event=event):
                GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
    else:
        for _ in xrange(count):
            __DoGMGivePlayerItem(curPlayer, itemID, 1, runeLV)
        if not ItemCommon.GetIsEquip(itemData):
            if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, False, [IPY_GameWorld.rptItem], event=event):
                GameWorld.DebugAnswer(curPlayer, "###放入物品失败!")
        else:
            for _ in xrange(itemCount):
                __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, 1, False, isAllAttr, event)
    return
def __DoGMGivePlayerItem(curPlayer, itemID, count, runeLV):
def __DoGMGivePlayerItem(curPlayer, playerItemControler, itemID, count, isAuctionItem, isAllAttr, event):
    if ItemControler.GetAppointItemRealID(itemID):
        ItemControler.GivePlayerAppointItem(curPlayer, itemID, 0, True, True)
        ItemControler.GivePlayerAppointItem(curPlayer, itemID, isAuctionItem, event=event)
        return
    curItem = ItemControler.GetOutPutItemObj(itemID)
    ItemControler.SetItemCount(curItem, count, curPlayer.GetPlayerID(), curPlayer.GetAccID(),
                               curPlayer.GetPlayerName())
    if curItem.GetType() == ChConfig.Def_ItemType_Rune and runeLV:
        curItem.SetUserAttr(ShareDefine.Def_IudetRuneLV, runeLV)
    #将物品放置玩家背包
    PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
    if not PlayerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=[ChConfig.ItemGive_GMMake, False, {"CMD":"MakeItemCount"}]):
    curItem = ItemControler.GetOutPutItemObj(itemID, count, isAuctionItem, curPlayer=curPlayer, isAllAttr=isAllAttr)
    if not playerItemControler.PutInItem(IPY_GameWorld.rptItem, curItem, event=event):
        GameWorld.DebugAnswer(curPlayer, "放入物品失败!")
        
    return