envanter genişletme sistemi [kod revize]

  • Konuyu açan Konuyu açan isthambul1453
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 0
  • Gösterim Gösterim 51

isthambul1453

Premium Üye
Premium Üye
Üye
Mesaj
98
Beğeni
75
Puan
331
Ticaret Puanı
0
game.py

add

"expand_inventory" : self.ExpandInventory,

search

def __PlayMusic(self, flag, filename):

before

def ExpandInventory(self, page_count):
self.interface.wndInventory.OnExpandInventory(int(page_count))

search

self.inventoryTab = []

remove these lines


self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))

add after

for i in range(player.INVENTORY_MAX_PAGE_COUNT):
self.inventoryTab.append(self.GetChild("Inventory_Tab_%02d" % (i+1)))

self.expandButton = self.GetChild("ExpandButton")
self.expandButton.SetEvent(ui.__mem_func__(self.ExpandInventory))

remove (x2)


self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))

add after


for i in range(player.INVENTORY_MAX_PAGE_COUNT):
self.inventoryTab.SetEvent(lambda arg=i: self.SetInventoryPage(arg))

for i in range(player.GetInventoryPageCount(), player.INVENTORY_MAX_PAGE_COUNT):
self.inventoryTab.Hide()

search

if self.mallButton:
self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))

add after

self.expandButton = ui.Button()
self.expandButton.SetParent(self)
self.expandButton.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
self.expandButton.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
self.expandButton.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
self.expandButton.SetText("Genislet")
self.expandButton.SetPosition(10, 100)
self.expandButton.SetEvent(ui.__mem_func__(self.ExpandInventory))
self.expandButton.Show()

modify your setinventorypage code like that

def SetInventoryPage(self, page):
if page >= player.GetInventoryPageCount():
return

self.inventoryTab[self.inventoryPageIndex].SetUp()
self.inventoryPageIndex = page
self.inventoryTab[self.inventoryPageIndex].Down()
self.RefreshBagSlotWindow()

and add after

def ExpandInventory(self):
net.SendChatPacket("/expand_inventory")

def OnExpandInventory(self, page_count):
for i in range(page_count):
self.inventoryTab.Show()
self.RefreshBagSlotWindow()

pythonnetworkstream.cpp open and add

bool CPythonNetworkStream::RecvExpandInventory()
{
TPacketGCExpandInventory p;
if (!Recv(sizeof(TPacketGCExpandInventory), &p))
return false;

CPythonPlayer::Instance().SetStatus(POINT_INVENTORY_PAGE_COUNT, p.page_count);
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnExpandInventory", Py_BuildValue("(i)", p.page_count));
return true;
}

bool CPythonNetworkStream::SendExpandInventoryPacket()
{
TPacketCGExpandInventory packet;
packet.header = HEADER_CG_EXPAND_INVENTORY;
if (!Send(sizeof(packet), &packet))
return false;
return true;
}

pythonnetworkstreammodule.cpp

PyObject* netSendExpandInventoryPacket(PyObject* poSelf, PyObject* poArgs)
{
CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
rkNetStream.SendExpandInventoryPacket();
return Py_BuildNone();
}

pythonplayer.cpp

find


switch (dwType)
{
case POINT_MIN_WEP:

add before


if (dwType == POINT_INVENTORY_PAGE_COUNT)
{
m_playerStatus.inventory_page_count = lValue;
return;
}

add

int CPythonPlayer::GetInventoryPageCount()
{
return m_playerStatus.inventory_page_count;
}

pythonplayermodule.cpp add

PyObject* playerGetInventoryPageCount(PyObject* poSelf, PyObject* poArgs)
{
return Py_BuildValue("i", CPythonPlayer::Instance().GetInventoryPageCount());
}


{ "GetInventoryPageCount", playerGetInventoryPageCount, METH_VARARGS },

length.h

change

INVENTORY_MAX_NUM = 135,

to


INVENTORY_PAGE_SIZE = 45,
INVENTORY_MAX_PAGE_COUNT = 50,
INVENTORY_MAX_NUM = INVENTORY_PAGE_SIZE * INVENTORY_MAX_PAGE_COUNT,

open char.h and find

} CHARACTER_POINT;

add before

BYTE inventory_page_count;

add before

private:
DWORD m_dwAffectedEunhyungLevel;

these funcs

public:
void ExpandInventory();
int GetInventoryPageCount() const;

char_item.cpp open and search

for ( int i = 0; i < INVENTORY_MAX_NUM; ++i)
if (IsEmptyItemGrid(TItemPos (INVENTORY, i), size))
return i;

add after


int maxPage = GetInventoryPageCount();
for (int i = INVENTORY_PAGE_SIZE; i < INVENTORY_PAGE_SIZE * maxPage; ++i)
if (IsEmptyItemGrid(TItemPos (INVENTORY, i), size))
return i;

countemptyinventory func find it and add before


void CHARACTER::ExpandInventory()
{
if (GetInventoryPageCount() >= INVENTORY_MAX_PAGE_COUNT)
{
ChatPacket(CHAT_TYPE_INFO, "Envanterin zaten maksimum seviyede.");
return;
}

int cost = (GetInventoryPageCount() - 2) * 10000000; // 3. sayfa 10m, 4. sayfa 20m vs.

if (GetGold() < cost)
{
ChatPacket(CHAT_TYPE_INFO, "Envanteri geni艧letmek i莽in yeterli alt谋n谋n yok.");
return;
}

PointChange(POINT_GOLD, -cost);
m_points.inventory_page_count++;
ChatPacket(CHAT_TYPE_INFO, "Envanterin geni艧letildi!");
Save();
}

int CHARACTER::GetInventoryPageCount() const
{
return m_points.inventory_page_count;
}


coded with ilovespaghetticodeGPT
hold your breasts and squish like a lemon after see my new junk systems
TR:babay
 
Geri
Üst