#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
##@package Func_6
|
#²Ö¿â¹ÜÀíÔ± Âß¼´¦Àí
|
#
|
# @author PanWei
|
# @date 2010-5-13ÏÂÎç03:41:28
|
# @version 1.3
|
#
|
# @change: "2013-05-07 15:30" wdb ²Ö¿âÐÞ¸Ä
|
# @change: "2013-12-12 15:30" hxp ÐÞ¸Ämark
|
# @change: "2016-07-20 14:30" hxp È¥³ý×êʯ´æÈ¡; Íæ¼Ò»õ±Ò´æ´¢¸üÐÂͳһ½Ó¿Ú
|
#---------------------------------------------------------------------
|
#"""Version = 2016-07-20 14:30"""
|
#---------------------------------------------------------------------
|
import IPY_GameWorld
|
import ItemControler
|
import ChConfig
|
import GameWorld
|
import PlayerControl
|
import DataRecordPack
|
import ChPyNetSendPack
|
import NetPackCommon
|
|
|
#---------------------------------------------------------------------
|
#===============================================================================
|
# //0C 01 ±³°üÎïÆ··ÅÈë²Ö¿â#tagCPutItemInWarehouse
|
# tagCPutItemInWarehouse * GettagCPutItemInWarehouse();
|
#
|
# class IPY_CPutItemInWarehouse
|
# {
|
# public:
|
# //±³°üλÖÃ
|
# int GetItemIndex();
|
# //·ÅÈëλÖÃ
|
# int GetWarehouseIndex();
|
# //·ÅÈëÊýÁ¿
|
# int GetCount();
|
# };
|
#===============================================================================
|
##¿Í»§¶Ë·â°üÏìÓ¦ //0C 01 ±³°üÎïÆ··ÅÈë²Ö¿â#tagCPutItemInWarehouse
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //0C 01 ±³°üÎïÆ··ÅÈë²Ö¿â#tagCPutItemInWarehouse
|
def PutItemInWarehouse(curPlayer, tick):
|
|
#»ñµÃ·â°ü
|
sendPack = IPY_GameWorld.IPY_CPutItemInWarehouse()
|
#±³°üλÖÃ
|
bagIndex = sendPack.GetItemIndex()
|
#µÃµ½Íæ¼ÒµÄ±³°ü
|
bagPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
#µÃµ½µ±Ç°ÎïÆ·
|
curItem = bagPack.GetAt(bagIndex)
|
|
if not curItem or curItem.IsEmpty():
|
return
|
|
#·ÅÈëλÖÃ
|
putIndex = sendPack.GetWarehouseIndex()
|
#·ÅÈëÊýÁ¿
|
putCount = sendPack.GetCount()
|
itemControl = ItemControler.PlayerItemControler(curPlayer)
|
curItemTypeID = curItem.GetItemTypeID()
|
curItemGUID = curItem.GetGUID()
|
|
if not itemControl.CanPutInItem(IPY_GameWorld.rptWarehouse, curItemTypeID, putCount, curItem.GetIsBind()):
|
PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptWarehouse])
|
return
|
|
DataRecordPack.DR_ChangePackItem(curPlayer, curItemTypeID, putCount, curItemGUID,
|
IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse)
|
|
#±³°üÎïÆ··ÅÈë²Ö¿â
|
ItemControler.DragItem(curPlayer, IPY_GameWorld.rptItem, bagIndex, IPY_GameWorld.rptWarehouse, putIndex, putCount)
|
return
|
|
#---------------------------------------------------------------------
|
#===============================================================================
|
# //0C 02 È¡³ö²Ö¿âÎïÆ·#tagCGetItemInWarehouse
|
# tagCGetItemInWarehouse * GettagCGetItemInWarehouse();
|
#
|
# class IPY_CGetItemInWarehouse
|
# {
|
# public:
|
# //²Ö¿âλÖÃ
|
# int GetWarehouseIndex();
|
# //ÎïÆ·Î»ÖÃ
|
# int GetItemIndex();
|
# //È¡³öÊýÁ¿
|
# int GetCount();
|
# };
|
#===============================================================================
|
##¿Í»§¶Ë·â°üÏìÓ¦ //0C 02 È¡³ö²Ö¿âÎïÆ·#tagCGetItemInWarehouse
|
# @param index Íæ¼ÒË÷Òý
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks ¿Í»§¶Ë·â°üÏìÓ¦ //0C 02 È¡³ö²Ö¿âÎïÆ·#tagCGetItemInWarehouse
|
def GetItemInWarehouse(curPlayer, tick):
|
|
#»ñµÃ·â°ü
|
sendPack = IPY_GameWorld.IPY_CGetItemInWarehouse()
|
#²Ö¿âλÖÃ
|
warehouseIndex = sendPack.GetWarehouseIndex()
|
#µÃµ½Íæ¼ÒµÄ²Ö¿â
|
warehousePack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptWarehouse)
|
#µÃµ½µ±Ç°ÎïÆ·
|
curItem = warehousePack.GetAt(warehouseIndex)
|
if not curItem or curItem.IsEmpty():
|
return
|
|
#·ÅÈë±³°üλÖÃ
|
putIndex = sendPack.GetItemIndex()
|
#·ÅÈëÊýÁ¿
|
putCount = sendPack.GetCount()
|
itemControl = ItemControler.PlayerItemControler(curPlayer)
|
curItemTypeID = curItem.GetItemTypeID()
|
curItemGUID = curItem.GetGUID()
|
|
if not itemControl.CanPutInItem(IPY_GameWorld.rptItem, curItemTypeID, putCount, curItem.GetIsBind()):
|
PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])
|
return False
|
|
DataRecordPack.DR_ChangePackItem(curPlayer, curItemTypeID, putCount, curItemGUID,
|
IPY_GameWorld.rptWarehouse, IPY_GameWorld.rptItem)
|
#²Ö¿âÎïÆ··ÅÈë±³°ü
|
ItemControler.DragItem(curPlayer, IPY_GameWorld.rptWarehouse, warehouseIndex, IPY_GameWorld.rptItem, putIndex, putCount)
|
return
|
|