Jump to content
Sadness

12 Inventários

Recommended Posts

Olá,

Como o próprio título diz seguindo este tutorial irão conseguir expandir o vosso número de inventários para 12.

Source

common/length.h


- INVENTORY_MAX_NUM = 135,
+ INVENTORY_MAX_NUM = 540,
Please login or register to see this code.

common/tables.h


typedef struct SQuickslot
{
BYTE type;
- BYTE pos;
+ UINT pos;
} TQuickslot;
Please login or register to see this code.

game/src/char.h


- BYTE bItemGrid[iNVENTORY_AND_EQUIP_SLOT_MAX];
+ UINT bItemGrid[iNVENTORY_AND_EQUIP_SLOT_MAX];

- void SyncQuickslot(BYTE bType, BYTE bOldPos, BYTE bNewPos);
+ void SyncQuickslot(BYTE bType, UINT bOldPos, UINT bNewPos);

- bool GetQuickslot(BYTE pos, TQuickslot ** ppSlot);
+ bool GetQuickslot(UINT pos, TQuickslot ** ppSlot);

- bool SetQuickslot(BYTE pos, TQuickslot & rSlot);
+ bool SetQuickslot(UINT pos, TQuickslot & rSlot);

- bool DelQuickslot(BYTE pos);
+ bool DelQuickslot(UINT pos);

- bool SwapQuickslot(BYTE a, BYTE b);
+ bool SwapQuickslot(UINT a, UINT b);

- void ChainQuickslotItem(LPITEM pItem, BYTE bType, BYTE bOldPos);
+ void ChainQuickslotItem(LPITEM pItem, BYTE bType, UINT bOldPos);

- void SetWear(BYTE bCell, LPITEM item);
+ void SetWear(UINT bCell, LPITEM item);

- LPITEM GetWear(BYTE bCell) const;
+ LPITEM GetWear(UINT bCell) const;

- bool RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell = -1);
+ bool RefineInformation(UINT bCell, BYTE bType, int iAdditionalCell = -1);

- bool SwapItem(BYTE bCell, BYTE bDestCell);
+ bool SwapItem(UINT bCell, UINT bDestCell);
Please login or register to see this code.

game/src/char_battle.cpp


## 1000 kann nach belieben angepasst werden sollte bei 6 Inventar seiten über 255 sein.
## 2 x vorhanden beide ersetzen!
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, vec_bSlots[i], 255);
+ SyncQuickslot(QUICKSLOT_TYPE_ITEM, vec_bSlots[i], 1000);

## 2 x vorhanden beide ersetzen!
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE1, 255);
+ SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE1, 1000);
Please login or register to see this code.

game/src/char_item.cpp


## 1000 kann nach belieben angepasst werden sollte bei 6 Inventar seiten über 255 sein.
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
+ SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 1000);

- BYTE bCell = Cell.cell;
+ UINT bCell = Cell.cell;

## 2 x vorhanden beide ersetzen!
- if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
+ if (m_pointsInstant.bItemGrid[bCell] == (UINT)iExceptionCell)


## 2 x vorhanden beide ersetzen!
- BYTE bPage = bCell / (INVENTORY_MAX_NUM / 3);
+ UINT bPage = bCell / (INVENTORY_MAX_NUM / 12);


## 2 x vorhanden beide ersetzen!
- BYTE p = bCell + (5 * j);
+ UINT p = bCell + (5 * j);

## 2 x vorhanden beide ersetzen!
- if (p / (INVENTORY_MAX_NUM / 3) != bPage)
+ if (p / (INVENTORY_MAX_NUM / 12) != bPage)

## 3 x vorhanden beide ersetzen!
- BYTE bCell = item->GetCell();
+ UINT bCell = item->GetCell();

-bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell)
+bool CHARACTER::RefineInformation(UINT bCell, BYTE bType, int iAdditionalCell)

- SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 255);
+ SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 1000);

-bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell)
+bool CHARACTER::SwapItem(UINT bCell, UINT bDestCell)

- BYTE bEquipCell = item2->GetCell() - INVENTORY_MAX_NUM;
+ INT bEquipCell = item2->GetCell() - INVENTORY_MAX_NUM;

- BYTE bInvenCell = item1->GetCell();
+ UINT bInvenCell = item1->GetCell();

- BYTE bCell1 = item1->GetCell();
+ UINT bCell1 = item1->GetCell();

- BYTE bCell2 = item2->GetCell();
+ UINT bCell2 = item2->GetCell();

- BYTE bOldCell = item->GetCell();
+ UINT bOldCell = item->GetCell();
Please login or register to see this code.

game/src/char_quickslot.cpp


-void CHARACTER::SyncQuickslot(BYTE bType, BYTE bOldPos, BYTE bNewPos)
+void CHARACTER::SyncQuickslot(BYTE bType, UINT bOldPos, UINT bNewPos)

- if (bNewPos == 255)
+ if (bNewPos == 1000)

-bool CHARACTER::GetQuickslot(BYTE pos, TQuickslot ** ppSlot)
+bool CHARACTER::GetQuickslot(UINT pos, TQuickslot ** ppSlot)

-bool CHARACTER::SetQuickslot(BYTE pos, TQuickslot & rSlot)
+bool CHARACTER::SetQuickslot(UINT pos, TQuickslot & rSlot)

-bool CHARACTER::DelQuickslot(BYTE pos)
+bool CHARACTER::DelQuickslot(UINT pos)

-bool CHARACTER::SwapQuickslot(BYTE a, BYTE b)
+bool CHARACTER::SwapQuickslot(UINT a, UINT b)

-void CHARACTER::ChainQuickslotItem(LPITEM pItem, BYTE bType, BYTE bOldPos)
+void CHARACTER::ChainQuickslotItem(LPITEM pItem, BYTE bType, UINT bOldPos)
Please login or register to see this code.

game/src/cmd_general.cpp


- for (BYTE i=0; i<INVENTORY_MAX_NUM; ++i)
+ for (UINT i=0; i<INVENTORY_MAX_NUM; ++i)
Please login or register to see this code.

game/src/cmd_gm.cpp


- ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
+ ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 1000);

## 3 x vorhanden beide ersetzen!
- BYTE cell = 0;
+ UINT cell = 0;
Please login or register to see this code.

game/src/exchange.cpp


iPos = s_grid6.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid6.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid7.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid7.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid8.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid8.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid9.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid9.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid10.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid10.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid11.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid11.Put(iPos, 1, itemSize);
continue;
}

iPos = s_grid12.FindBlank(1, itemSize);
if (iPos >= 0)
{
s_grid12.Put(iPos, 1, itemSize);
continue;
}

return false;
}
}

return true;
}
Please login or register to see this code.

exchange.cpp


- m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
+ m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 1000);
Please login or register to see this code.

game/src/fishing.cpp


## 2 x vorhanden beide ersetzen!
- BYTE bCell = rod->GetCell();
+ UINT bCell = rod->GetCell();
Please login or register to see this code.

game/src/input_main.cpp


case SHOP_SUBHEADER_CG_SELL2:
{
- if (uiBytes < sizeof(BYTE) + sizeof(BYTE))
+ if (uiBytes < sizeof(UINT) + sizeof(BYTE))
return -1;

- BYTE pos = *(c_pData++);
+ UINT pos = *reinterpret_cast<const UINT*>(c_pData++);
BYTE count = *(c_pData);

sys_log(0, "INPUT: %s SHOP: SELL2", ch->GetName());
CShopManager::instance().Sell(ch, pos, count);
- return sizeof(BYTE) + sizeof(BYTE);
+ return sizeof(UINT) + sizeof(BYTE);
}

- ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, p->ItemPos.cell, 255);
+ ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, p->ItemPos.cell, 1000);
Please login or register to see this code.

game/src/item.cpp


- pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, wCell, 255);
+ pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, wCell, 1000);

- m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, m_wCell, 255);
+ m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, m_wCell, 1000);

-bool CItem::EquipTo(LPCHARACTER ch, BYTE bWearCell)
+bool CItem::EquipTo(LPCHARACTER ch, UINT bWearCell)
Please login or register to see this code.

game/src/item.h


- bool EquipTo(LPCHARACTER ch, BYTE bWearCell);
+ bool EquipTo(LPCHARACTER ch, UINT bWearCell);
Please login or register to see this code.

game/src/item_manager.cpp


- o->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
+ o->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 1000);
Please login or register to see this code.

game/src/minig.cpp


## 2 x vorhanden beide ersetzen!
- BYTE bCell = rkOldPick.GetCell();
+ UINT bCell = rkOldPick.GetCell();
Please login or register to see this code.

game/src/packet.h


typedef struct command_quickslot_add
{
BYTE header;
- BYTE pos;
+ UINT pos;
TQuickslot slot;
} TPacketCGQuickslotAdd;

typedef struct command_quickslot_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
} TPacketCGQuickslotDel;

typedef struct command_quickslot_swap
{
BYTE header;
- BYTE pos;
+ UINT pos;
- BYTE change_pos;
+ UINT change_pos;
} TPacketCGQuickslotSwap;

typedef struct packet_item_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
} TPacketGCItemDel;

struct packet_quickslot_add
{
BYTE header;
- BYTE pos;
+ UINT pos;
TQuickslot slot;
};

struct packet_quickslot_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
};

struct packet_quickslot_swap
{
BYTE header;
- BYTE pos;
+ UINT pos;
- BYTE pos_to;
+ UINT pos_to;
};

typedef struct SPacketCGRefine
{
BYTE header;
- BYTE pos;
+ UINT pos;
BYTE type;
} TPacketCGRefine;

typedef struct SPacketCGRequestRefineInfo
{
BYTE header;
- BYTE pos;
+ UINT pos;
} TPacketCGRequestRefineInfo;

typedef struct SPacketGCRefineInformaion
{
BYTE header;
BYTE type;
- BYTE pos;
+ UINT pos;
DWORD src_vnum;
DWORD result_vnum;
BYTE material_count;
Please login or register to see this code.

game/src/questlua_global.cpp


## 2 x vorhanden beide ersetzen!
- BYTE bCell = (BYTE) lua_tonumber(L,-1);
+ UINT bCell = lua_tonumber(L, -1);
Please login or register to see this code.

game/src/questlua_item.cpp


- BYTE bCell = pItem->GetCell();
+ UINT bCell = pItem->GetCell();
Please login or register to see this code.

game/src/questlua_pc.cpp


,
- BYTE bCell = (BYTE)lua_tonumber(L, 1);
+ UINT bCell = lua_tonumber(L
Please login or register to see this code.

game/src/safebox.cpp


-LPITEM CSafebox::GetItem(BYTE bCell)
+LPITEM CSafebox::GetItem(INT bCell)

-bool CSafebox::MoveItem(BYTE bCell, BYTE bDestCell, BYTE count)
+bool CSafebox::MoveItem(INT bCell, INT bDestCell, BYTE count)
Please login or register to see this code.

game/src/safebox.h


- bool MoveItem(BYTE bCell, BYTE bDestCell, BYTE count);
+ bool MoveItem(INT bCell, INT bDestCell, BYTE count);

- LPITEM GetItem(BYTE bCell);
+ LPITEM GetItem(INT bCell);
Please login or register to see this code.

game/src/shop.cpp


- m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
+ m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(
Please login or register to see this code.

game/src/shop_manager.cpp


-void CShopManager::Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount)
+void CShopManager::Sell(LPCHARACTER ch, UINT bCell, BYTE bCount) ), 1000);
Please login or register to see this code.

game/src/shop_manager.h


- void Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount=0);
+ void Sell(LPCHARACTER ch, UINT bCell, BYTE bCount = 0);
Please login or register to see this code.

Cliente

Client/UserInterface/AbstractPlayer.h


- virtual void AddQuickSlot(int QuickslotIndex, char IconType, char IconPosition) = 0;
+ virtual void AddQuickSlot(int QuickslotIndex, char IconType, INT IconPosition) = 0;
Please login or register to see this code.

Client/UserInterface/GameType.h


-const DWORD c_Inventory_Page_Count
+const DWORD c_Inventory_Page_Count = 12;

typedef struct SQuickSlot
{
BYTE Type;
- BYTE Position;
+ UINT Position;
} TQuickSlot;
Please login or register to see this code.

Client/UserInterface/Packet.h


typedef struct command_quickslot_add
{
BYTE header;
- BYTE pos;
+ UINT pos;
TQuickSlot slot;
}TPacketCGQuickSlotAdd;

typedef struct command_quickslot_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
}TPacketCGQuickSlotDel;

typedef struct command_quickslot_swap
{
BYTE header;
- BYTE pos;
+ UINT pos;
- BYTE change_pos;
+ UINT change_pos;
}TPacketCGQuickSlotSwap;

typedef struct SPacketCGRefine
{
BYTE header;
- BYTE pos;
+ UINT pos;
BYTE type;
} TPacketCGRefine;

typedef struct packet_item_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
} TPacketGCItemDel;

typedef struct packet_quickslot_add
{
BYTE header;
- BYTE pos;
+ UINT pos;
TQuickSlot slot;
} TPacketGCQuickSlotAdd;

typedef struct packet_quickslot_del
{
BYTE header;
- BYTE pos;
+ UINT pos;
} TPacketGCQuickSlotDel;

typedef struct packet_quickslot_swap
{
BYTE header;
- BYTE pos;
+ UINT pos;
- BYTE change_pos;
+ UINT change_pos;
} TPacketGCQuickSlotSwap;

typedef struct SPacketGCRefineInformation
{
BYTE header;
- BYTE pos;
+ UINT pos;
TRefineTable refine_table;
} TPacketGCRefineInformation;

typedef struct SPacketGCRefineInformationNew
{
BYTE header;
BYTE type;
- BYTE pos;
+ UINT pos;
TRefineTable refine_table;
} TPacketGCRefineInformationNew;
Please login or register to see this code.

Client/UserInterface/PythonNetworkStream.h


- bool SendQuickSlotAddPacket(BYTE wpos, BYTE type, BYTE pos);
+ bool SendQuickSlotAddPacket(UINT wpos, BYTE type, UINT pos);
- bool SendQuickSlotDelPacket(BYTE wpos);
+ bool SendQuickSlotDelPacket(UINT wpos);
- bool SendQuickSlotMovePacket(BYTE wpos, BYTE change_pos);
+ bool SendQuickSlotMovePacket(UINT wpos, UINT change_pos);

- bool SendShopSellPacketNew(BYTE bySlot, BYTE byCount);
+ bool SendShopSellPacketNew(UINT bySlot, BYTE byCount);

- bool SendRefinePacket(BYTE byPos, BYTE byType);
+ bool SendRefinePacket(UINT byPos, BYTE byType);
Please login or register to see this code.

Client/UserInterface/PythonNetworkStreamPhaseGame.cpp


-bool CPythonNetworkStream::SendRefinePacket(BYTE byPos, BYTE byType)
+bool CPythonNetworkStream::SendRefinePacket(UINT byPos, BYTE byType)
Please login or register to see this code.

Client/UserInterface/PythonNetworkStreamPhaseGameItem.cpp


## Das ganze Packet sollte so aussehen
-bool CPythonNetworkStream::SendShopSellPacketNew(BYTE bySlot, BYTE byCount)
+bool CPythonNetworkStream::SendShopSellPacketNew(UINT bySlot, BYTE byCount)
+{
+ if (!__CanActMainInstance())
+ return true;

+ TPacketCGShop PacketShop;
+ PacketShop.header = HEADER_CG_SHOP;
+ PacketShop.subheader = SHOP_SUBHEADER_CG_SELL2;

+ if (!Send(sizeof(TPacketCGShop), &PacketShop))
+ {
+ Tracef("SendShopSellPacket Error\n");
+ return false;
+ }
+ if (!Send(sizeof(UINT), &bySlot))
+ {
+ Tracef("SendShopAddSellPacket Error\n");
+ return false;
+ }
+ if (!Send(sizeof(BYTE), &byCount))
+ {
+ Tracef("SendShopAddSellPacket Error\n");
+ return false;
+ }

+ Tracef(" SendShopSellPacketNew(bySlot=%d, byCount=%d)\n", bySlot, byCount);

+ return SendSequence();
+}

-bool CPythonNetworkStream::SendQuickSlotAddPacket(BYTE wpos, BYTE type, BYTE pos)
+bool CPythonNetworkStream::SendQuickSlotAddPacket(UINT wpos, BYTE type, UINT pos)

-bool CPythonNetworkStream::SendQuickSlotDelPacket(BYTE pos)
+bool CPythonNetworkStream::SendQuickSlotDelPacket(UINT pos)

-bool CPythonNetworkStream::SendQuickSlotMovePacket(BYTE pos, BYTE change_pos)
+bool CPythonNetworkStream::SendQuickSlotMovePacket(UINT pos, UINT change_pos)
Please login or register to see this code.

Client/UserInterface/PythonPlayer.cpp


- for (BYTE i = 0; i < QUICKSLOT_MAX_NUM; ++i)
+ for (UINT i = 0; i < QUICKSLOT_MAX_NUM; ++i)

- rkNetStream.SendQuickSlotMovePacket((BYTE) dwGlobalSrcSlotIndex, (BYTE)dwGlobalDstSlotIndex);
+ rkNetStream.SendQuickSlotMovePacket((UINT) dwGlobalSrcSlotIndex, (UINT)dwGlobalDstSlotIndex);

- rkNetStream.SendQuickSlotAddPacket((BYTE)dwGlobalSlotIndex, (BYTE)dwWndType, (BYTE)dwWndItemPos);
+ rkNetStream.SendQuickSlotAddPacket((UINT)dwGlobalSlotIndex, (BYTE)dwWndType, (UINT)dwWndItemPos);

- rkNetStream.SendQuickSlotDelPacket((BYTE)dwGlobalSlotIndex);
+ rkNetStream.SendQuickSlotDelPacket((UINT)dwGlobalSlotIndex);

-void CPythonPlayer::AddQuickSlot(int QuickSlotIndex, char IconType, char IconPosition)
+void CPythonPlayer::AddQuickSlot(int QuickSlotIndex, char IconType, INT IconPosition)
Please login or register to see this code.

Client/UserInterface/PythonPlayer.h


- void AddQuickSlot(int QuickslotIndex, char IconType, char IconPosition);
+ void AddQuickSlot(int QuickslotIndex, char IconType, INT IconPosition);
Please login or register to see this code.

Irei deixar para download a parte em python ( uiinventorywindow.py // uiinventory.py )

Download:

Please login or register to see this link.

Resultado Final:

Please login or register to see this image.

Créditos:

Dennis

Cumprimentos,

Sadness.

  • Upvote 4

Share this post


Link to post
Share on other sites

Sempre meda erro ao substituir os uiinventorywindow.py // uiinventory.pydeixo aki os meus original do client se alguem souber como posso add sem alterar pfv me ajudedepois de compilar a source bin tb fico com esse erro[spoiler=syserr]0221 21:58:59073 :: GRANNY: r:/granny/rt/granny_file_info.cpp(145): File has run-time type tag of 0x8000000f, which doesn't match this version of Granny (0x80000010). Automatic conversion will be attempted.0221 21:58:00677 :: Unknown packet header: 60, last: 2 2

Please login or register to see this attachment.

Please login or register to see this link.

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

Eu utilizei este tutorial e funcionou bem, mas tive de fazer alterações à cerca dos sistemas que tinha já previamente incluído nos ficheiros necessários editar...

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

em vez de postares os teus arquivos para alguem o fazer por ti, cria um tópico a explicar o problema juntamente com o tópico de pedido de ajuda deixa la o syserr para ajudar os outros a perceber o erro. Cumprimentos.

Share this post


Link to post
Share on other sites
Posted (edited)

Hey man,

I tried to do same thing for safebox. I did for it 600 slots. But item move don't work on higher pages. And on 540 slot or higher I can't add item. Can you do it for safebox fixed?

Edited by ReFresh

Share this post


Link to post
Share on other sites

×

Important Information

By using this site, you agree to our Terms of Use.