hxp
2025-05-29 167357e8425d0dc12f41ed5fdfd4d95f2c2a5aaf
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/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