Jump to content

12 Inventários


Sadness
 Share

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,

common/tables.h


typedef struct SQuickslot
{
BYTE type;
- BYTE pos;
+ UINT pos;
} TQuickslot;

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);

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);

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();

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)

game/src/cmd_general.cpp


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

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;

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;
}

exchange.cpp


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

game/src/fishing.cpp


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

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);

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)

game/src/item.h


- bool EquipTo(LPCHARACTER ch, BYTE bWearCell);
+ bool EquipTo(LPCHARACTER ch, UINT bWearCell);

game/src/item_manager.cpp


- o->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
+ o->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 1000);

game/src/minig.cpp


## 2 x vorhanden beide ersetzen!
- BYTE bCell = rkOldPick.GetCell();
+ UINT bCell = rkOldPick.GetCell();

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;

game/src/questlua_global.cpp


## 2 x vorhanden beide ersetzen!
- BYTE bCell = (BYTE) lua_tonumber(L,-1);
+ UINT bCell = lua_tonumber(L, -1);

game/src/questlua_item.cpp


- BYTE bCell = pItem->GetCell();
+ UINT bCell = pItem->GetCell();

game/src/questlua_pc.cpp


,
- BYTE bCell = (BYTE)lua_tonumber(L, 1);
+ UINT bCell = lua_tonumber(L

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)

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);

game/src/shop.cpp


- m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
+ m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(

game/src/shop_manager.cpp


-void CShopManager::Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount)
+void CShopManager::Sell(LPCHARACTER ch, UINT bCell, BYTE bCount) ), 1000);

game/src/shop_manager.h


- void Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount=0);
+ void Sell(LPCHARACTER ch, UINT bCell, BYTE bCount = 0);

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;

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;

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;

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);

Client/UserInterface/PythonNetworkStreamPhaseGame.cpp


-bool CPythonNetworkStream::SendRefinePacket(BYTE byPos, BYTE byType)
+bool CPythonNetworkStream::SendRefinePacket(UINT byPos, BYTE byType)

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)

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)

Client/UserInterface/PythonPlayer.h


- void AddQuickSlot(int QuickslotIndex, char IconType, char IconPosition);
+ void AddQuickSlot(int QuickslotIndex, char IconType, INT IconPosition);

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

Download:

Resultado Final:

12inventarios.png

Créditos:

Dennis

Cumprimentos,

Sadness.

  • Like 3
Link to comment
Share on other sites

  • 7 months later...
  • 10 months later...

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

Metin2.rar

Metin2.rar

Link to comment
Share on other sites

Sempre meda erro ao substituir os uiinventorywindow.py // uiinventory.py

deixo aki os meus original do client se alguem souber como posso add sem alterar pfv me ajude

depois 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

 

 

 

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...

Link to comment
Share on other sites

Sempre meda erro ao substituir os uiinventorywindow.py // uiinventory.py

deixo aki os meus original do client se alguem souber como posso add sem alterar pfv me ajude

depois 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

 

 

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.

Link to comment
Share on other sites

  • 1 year later...
Guest ReFresh

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
Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...