Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Extended Stack Items Source


100%

Recommended Posts

  • Administrator

I have successfully extended the maximum number of items in a stack, so I'd like to share the changes made. Originally, the "count" variables for certain structures were of type "BYTE," allowing for a maximum number of only 255. I have modified these variables to be of type "WORD" (unsigned short), allowing for a maximum number of around 60,000.

Changes made in the client:

  1. In packet.h:

    • In the "typedef struct command_item_drop2" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct command_item_move" struct, the "BYTE num;" has been replaced with "WORD num;".
    • In the "typedef struct SShopItemTable" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_set_item2" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_update_item" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct SEquipmentItemSet" struct, the "BYTE count;" has been replaced with "WORD count;".
  2. In PythonNetworkPhaseGame.cpp, the function "RecvExchangePacket" has been updated:

    • The line "CPythonExchange::Instance().SetItemToSelf(iSlotIndex, exchange_packet.arg1, (BYTE) exchange_packet.arg3);" has been changed to "CPythonExchange::Instance().SetItemToSelf(iSlotIndex, exchange_packet.arg1, (WORD) exchange_packet.arg3);".
    • The line "CPythonExchange::Instance().SetItemToTarget(iSlotIndex, exchange_packet.arg1, (BYTE) exchange_packet.arg3);" has been changed to "CPythonExchange::Instance().SetItemToTarget(iSlotIndex, exchange_packet.arg1, (WORD) exchange_packet.arg3);".
  3. In pythonexchange.cpp:

    • The function "BYTE CPythonExchange::GetItemCountFromTarget(BYTE pos)" has been replaced with "WORD CPythonExchange::GetItemCountFromTarget(BYTE pos)".
    • The function "BYTE CPythonExchange::GetItemCountFromSelf(BYTE pos)" has been replaced with "WORD CPythonExchange::GetItemCountFromSelf(BYTE pos)".
    • The function "void CPythonExchange::SetItemToTarget(DWORD pos, DWORD vnum, BYTE count)" has been replaced with "void CPythonExchange::SetItemToTarget(DWORD pos, DWORD vnum, WORD count)".
    • The function "void CPythonExchange::SetItemToSelf(DWORD pos, DWORD vnum, BYTE count)" has been replaced with "void CPythonExchange::SetItemToSelf(DWORD pos, DWORD vnum, WORD count)".
  4. In pythonexchange.h:

    • The function "BYTE GetItemCountFromTarget(BYTE pos)" has been replaced with "WORD GetItemCountFromTarget(BYTE pos)".
    • The function "BYTE GetItemCountFromSelf(BYTE pos)" has been replaced with "WORD GetItemCountFromSelf(BYTE pos)".
    • The function "void SetItemToTarget(DWORD pos, DWORD vnum, BYTE count)" has been replaced with "void SetItemToTarget(DWORD pos, DWORD vnum, WORD count)".
    • The function "void SetItemToSelf(DWORD pos, DWORD vnum, BYTE count)" has been replaced with "void SetItemToSelf(DWORD pos, DWORD vnum, WORD count)".
    • The "BYTE item_count[EXCHANGE_ITEM_MAX_NUM];" has been changed to "WORD item_count[EXCHANGE_ITEM_MAX_NUM];".
  5. In PythonNetworkStreamPhaseGameItem.cpp:

    • The function "bool CPythonNetworkStream::SendShopSellPacketNew" has been replaced with a new version.
    • The functions "bool CPythonNetworkStream::SendItemMovePacket" and "bool CPythonNetworkStream::SendSafeBoxItemMovePacket" have been updated to use "WORD" for "num" instead of "BYTE".
  6. In pythonplayermodule.cpp:

    • The function "PyObject * playerSetItemCount" has been updated to handle both "BYTE" and "WORD" counts.
  7. In PythonNetworkStreamModule.cpp:

    • The function "PyObject* netSendItemMovePacket" has been updated to use "WORD" for "num" instead of "BYTE".
  8. In GameType.h:

    • The "typedef struct packet_item" struct has been updated to use "WORD" for "count" instead of "BYTE".
    • The "typedef struct packet_shop_item" struct has been updated to use "WORD" for "count" instead of "BYTE".

Changes made in the server:

  1. In common/tables.h:

    • In the "typedef struct SShopItemTable" struct, the "BYTE count;" has been replaced with "WORD count;".
  2. In packet.h:

    • In the "typedef struct command_item_drop2" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct command_item_move" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_item_set" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_item_update" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_shop_item" struct, the "BYTE count;" has been replaced with "WORD count;".
    • In the "typedef struct packet_view_equip" struct, the "BYTE count;" has been replaced with "WORD count;".
  3. In input_main.cpp, the function "int CInputMain::Shop" has been updated to handle the new "TfckOFF" struct and use "WORD" for "byCount" instead of "BYTE".

  4. In shop_manager.cpp, the function "void CShopManager::Sell" has been updated to use "WORD" for "bCount" instead of "BYTE".

  5. In shop.h, the "typedef struct shop_item" struct has been updated to use "WORD" for "count" instead of "BYTE".

  6. In shop_manager.h, the function "void Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount=0);" has been updated to use "WORD" for "bCount" instead of "BYTE".

  7. In char_item.cpp, the functions "bool CHARACTER::DropItem" and "bool CHARACTER::MoveItem" have been updated to use "WORD" for "bCount" instead of "BYTE".

  8. In char.h, the functions "bool DropItem" and "bool MoveItem" have been updated to use "WORD" for "bCount" instead of "BYTE". The function "LPITEM AutoGiveItem" has also been updated to use "WORD" for "bCount" instead of "BYTE".

  9. In safebox.cpp, the function "bool CSafebox::MoveItem" has been updated to use "WORD" for "count" instead of "BYTE".

  10. In common/item_length.h, the maximum number in a stack has been changed to 300 (for testing purposes).

  11. In oxevent.cpp and oxevent.h, the function "GiveItemToAttender" has been updated to use "WORD" for "count" instead of "BYTE".

Database Changes:

  1. In the player database, the "item" table's "count" column has been modified from "tinyint" to "smallint" with a length of 4. This change allows for the storage of larger values for item counts.

  2. In the "shop_item" table, the "count" column has been modified from "tinyint" to "smallint" to accommodate larger item counts.

With all these changes made in the client, server, and database, the maximum number of items in a stack has been extended to around 60,000 (adjustable according to the chosen value in common/item_length.h). The modifications allow for safer and more efficient handling of items in the game, enhancing the overall gameplay experience.

 

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

Author

masodikbela

 

 

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...