Jump to content

How to Add 3 inventory


Recommended Posts

  • Premium

Hi!

Try this:

 

find:

../common/length.h

INVENTORY_MAX_NUM       = 90,

Replace to:

INVENTORY_MAX_NUM       = 135,

Find:

../game/src/char_item.cpp

BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);

And:

BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);

Replace to:

BYTE bPage = bCell / (INVENTORY_MAX_NUM / 3);

And:

BYTE bPage = bCell / (INVENTORY_MAX_NUM / 3);

Find: (in the same file)

if (p / (INVENTORY_MAX_NUM / 2) != bPage) 

And:

if (p / (INVENTORY_MAX_NUM / 2) != bPage)

Replace to:

if (p / (INVENTORY_MAX_NUM / 3) != bPage)

And:

if (p / (INVENTORY_MAX_NUM / 3) != bPage)

Find:

../game/src/exchange.cpp

static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 2);
static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 2);

Replace to:

static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 3);
static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 3);
static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 3);

Find: (in the same file)

s_grid1.Clear();
s_grid2.Clear();

Replace to:

s_grid1.Clear();
s_grid2.Clear();
s_grid3.Clear();

and replace to your self..

for (i = 0; i < INVENTORY_MAX_NUM / 3; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
 
        s_grid1.Put(i, 1, item->GetSize());
    }
    for (i = INVENTORY_MAX_NUM / 3; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
 
        s_grid2.Put(i - INVENTORY_MAX_NUM / 3, 1, item->GetSize());
    }
 
    for (i = INVENTORY_MAX_NUM / 3; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
 
        s_grid3.Put(i - INVENTORY_MAX_NUM / 3, 1, item->GetSize());
    }

Client side:

Find:

../userinterface/gametype.h

const DWORD c_Inventory_Page_Count = 2;

Replace to:

const DWORD c_Inventory_Page_Count = 3;

Open inventorywindow.py:

EQUIPMENT_START_INDEX = 90

Replace to:


EQUIPMENT_START_INDEX = 135
Link to comment
Share on other sites

yes 

EQUIPMENT_START_INDEX = 135

 

 

 

{"index":EQUIPMENT_START_INDEX+0, "x":39, "y":37, "width":32, "height":64},
{"index":EQUIPMENT_START_INDEX+1, "x":39, "y":2, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+2, "x":39, "y":145, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+3, "x":75, "y":67, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+4, "x":3, "y":3, "width":32, "height":96},
{"index":EQUIPMENT_START_INDEX+5, "x":114, "y":67, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+6, "x":114, "y":35, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+7, "x":2, "y":145, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+8, "x":75, "y":145, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+9, "x":114, "y":2, "width":32, "height":32},
{"index":EQUIPMENT_START_INDEX+10, "x":75, "y":35, "width":32, "height":32},
## 새 반지1
{"index":item.EQUIPMENT_RING1, "x":2, "y":106, "width":32, "height":32},
## 새 반지2
{"index":item.EQUIPMENT_RING2, "x":75, "y":106, "width":32, "height":32},
## 새 벨트
{"index":item.EQUIPMENT_BELT, "x":39, "y":106, "width":32, "height":32},
Link to comment
Share on other sites

  • /game/src/exchange.cpp
  1. static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 2); // inven page 1
  2. static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 2); // inven page 2
  3. static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inven page 3
  4. static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inven page 4
  5. static CGrid s_grid5(5, INVENTORY_MAX_NUM/5 / 2); // inven page 5
  6.  
  7. s_grid1.Clear();
  8. s_grid2.Clear();
  9. s_grid3.Clear();
  10. s_grid4.Clear();
  11. s_grid5.Clear();
  12.  
  13. LPCHARACTER victim = GetCompany()->GetOwner();
  14. LPITEM item;
  15.  
  16. int i;
  17.  
  18. for (i = 0; i < INVENTORY_MAX_NUM / 5; ++i)
  19. {
  20. if (!(item = victim->GetInventoryItem(i)))
  21. continue;
  22.  
  23. s_grid1.Put(i, 1, item->GetSize());
  24. }
  25. for (i = INVENTORY_MAX_NUM / 5; i < INVENTORY_MAX_NUM; ++i)
  26. {
  27. if (!(item = victim->GetInventoryItem(i)))
  28. continue;
  29.  
  30. s_grid2.Put(i - INVENTORY_MAX_NUM / 5, 1, item->GetSize());
  31. }
  32. for (i = INVENTORY_MAX_NUM / 5; i < INVENTORY_MAX_NUM; ++i)
  33. {
  34. if (!(item = victim->GetInventoryItem(i)))
  35. continue;
  36.  
  37. s_grid3.Put(i - INVENTORY_MAX_NUM / 5, 1, item->GetSize());
  38. }
  39. for (i = INVENTORY_MAX_NUM / 5; i < INVENTORY_MAX_NUM; ++i)
  40. {
  41. if (!(item = victim->GetInventoryItem(i)))
  42. continue;
  43.  
  44. s_grid4.Put(i - INVENTORY_MAX_NUM / 5, 1, item->GetSize());
  45. }
  46. for (i = INVENTORY_MAX_NUM / 5; i < INVENTORY_MAX_NUM; ++i)
  47. {
  48. if (!(item = victim->GetInventoryItem(i)))
  49. continue;
  50.  
  51. s_grid5.Put(i - INVENTORY_MAX_NUM / 5, 1, item->GetSize());
  52. }

 

  1. int iPos = s_grid1.FindBlank(1, item->GetSize());
     
    if (iPos >= 0)
    {
    s_grid1.Put(iPos, 1, item->GetSize());
    }
    else
    {
    iPos = s_grid2.FindBlank(1, item->GetSize());
     
    if (iPos >= 0)
    {
    s_grid2.Put(iPos, 1, item->GetSize());
    }
    else
    {
    iPos = s_grid3.FindBlank(1, item->GetSize());
     
    if (iPos >= 0)
    {
    s_grid3.Put(iPos, 1, item->GetSize());
    }
    else
    {
    iPos = s_grid4.FindBlank(1, item->GetSize());
     
    if (iPos >= 0)
    {
    s_grid4.Put(iPos, 1, item->GetSize());
    }
    else
    {
    iPos = s_grid5.FindBlank(1, item->GetSize());
     
    if (iPos >= 0)
    {
    s_grid5.Put(iPos, 1, item->GetSize());
    }
    else
    {
    return false;
    }
    }
    }
    }
    }
    }
    }
     
    return true;
    }

|___________________________________________________

 

  • /game/src/char_item.cpp
  1. bPage = bCell / (INVENTORY_MAX_NUM / 5); 
  2. the 4
  • sourcecommonlength.h
  1. INVENTORY_MAX_NUM = 225,
  • ClientUserInterfaceGameType.h
  1. const DWORD c_Inventory_Page_Size = 5*9; // x*y  
  2. const DWORD c_Inventory_Page_Count = 5; 
Link to comment
Share on other sites

No, belt_inventory does not cause this error.

It's the inventory size clientside, not only the py-part but also the binary.

Equipment is normally stored at the end of your normal inventory. The server now has 135 as the inventory size (45 more than the prior 90) so the equipment starts with index 136 there. But the client still thinks that the inventory size is just 90, so the equipment starts at 91 there. That's the mismatch you can see. When equipping something, the server will move the item to the proper index, so it's at 136+, not 91+ like the client has it :)

 

In GameType.h change

const DWORD c_Inventory_Page_Count = 2;

to

const DWORD c_Inventory_Page_Count = 3;

and make sure you've recompiled everything after raising the inventory size serverside to 135. Then everything should work :)

Link to comment
Share on other sites

yes 

 

look the 

 

exchange.cpp

 

  1. int iPos = s_grid1.FindBlank(1, item->GetSize());
  2.  
  3. if (iPos >= 0)
  4. {
  5. s_grid1.Put(iPos, 1, item->GetSize());
  6. }
  7. else
  8. {
  9. iPos = s_grid2.FindBlank(1, item->GetSize());
  10.  
  11. if (iPos >= 0)
  12. {
  13. s_grid2.Put(iPos, 1, item->GetSize());
  14. }
  15. else
  16. {
  17.        iPos = s_grid3.FindBlank(1, item->GetSize());
  18.  
  19. if (iPos >= 0)
  20. {
  21. s_grid3.Put(iPos, 1, item->GetSize());
  22. }
  23. else
  24. {
  25. return false;
  26. }
  27. }
  28. }
  29. }
  30. }
  31. }
Link to comment
Share on other sites

  • Premium
 

oh 

 

 

There is a problem
Tools do not come in its place

 

t32y9Np.png

 

It's not a problem with the py-files, it's a problem with the source. Did you do that too?

Please rewrite the EQUIPMENT_START_INDEX in the inventorywindow.py and look what happen! :)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

this inventorywindow.py 

  1. import uiScriptLocale
  2. import item
  3.  
  4. EQUIPMENT_START_INDEX = 135
  5.  
  6. window = {
  7. "name" : "InventoryWindow",
  8.  
  9. ## 600 - (width + 오른쪽으로 부터 띄우기 24 px)
  10. "x" : SCREEN_WIDTH - 176,
  11. "y" : SCREEN_HEIGHT - 37 - 565,
  12.  
  13. "style" : ("movable", "float",),
  14.  
  15. "width" : 176,
  16. "height" : 565,
  17.  
  18. "children" :
  19. (
  20. ## Inventory, Equipment Slots
  21. {
  22. "name" : "board",
  23. "type" : "board",
  24. "style" : ("attach",),
  25.  
  26. "x" : 0,
  27. "y" : 0,
  28.  
  29. "width" : 176,
  30. "height" : 565,
  31.  
  32. "children" :
  33. (
  34. ## Title
  35. {
  36. "name" : "TitleBar",
  37. "type" : "titlebar",
  38. "style" : ("attach",),
  39.  
  40. "x" : 8,
  41. "y" : 7,
  42.  
  43. "width" : 161,
  44. "color" : "yellow",
  45.  
  46. "children" :
  47. (
  48. { "name":"TitleName", "type":"text", "x":77, "y":3, "text":uiScriptLocale.INVENTORY_TITLE, "text_horizontal_align":"center" },
  49. ),
  50. },
  51.  
  52. ## Equipment Slot
  53. {
  54. "name" : "Equipment_Base",
  55. "type" : "image",
  56.  
  57. "x" : 10,
  58. "y" : 33,
  59.  
  60. "image" : "d:/ymir work/ui/equipment_bg_without_ring.tga",
  61.  
  62. "children" :
  63. (
  64.  
  65. {
  66. "name" : "EquipmentSlot",
  67. "type" : "slot",
  68.  
  69. "x" : 3,
  70. "y" : 3,
  71.  
  72. "width" : 150,
  73. "height" : 182,
  74.  
  75. "slot" : (
  76. {"index":EQUIPMENT_START_INDEX+0, "x":39, "y":37, "width":32, "height":64},
  77. {"index":EQUIPMENT_START_INDEX+1, "x":39, "y":2, "width":32, "height":32},
  78. {"index":EQUIPMENT_START_INDEX+2, "x":39, "y":145, "width":32, "height":32},
  79. {"index":EQUIPMENT_START_INDEX+3, "x":75, "y":67, "width":32, "height":32},
  80. {"index":EQUIPMENT_START_INDEX+4, "x":3, "y":3, "width":32, "height":96},
  81. {"index":EQUIPMENT_START_INDEX+5, "x":114, "y":67, "width":32, "height":32},
  82. {"index":EQUIPMENT_START_INDEX+6, "x":114, "y":35, "width":32, "height":32},
  83. {"index":EQUIPMENT_START_INDEX+7, "x":2, "y":145, "width":32, "height":32},
  84. {"index":EQUIPMENT_START_INDEX+8, "x":75, "y":145, "width":32, "height":32},
  85. {"index":EQUIPMENT_START_INDEX+9, "x":114, "y":2, "width":32, "height":32},
  86. {"index":EQUIPMENT_START_INDEX+10, "x":75, "y":35, "width":32, "height":32},
  87. ## 새 반지1
  88. {"index":item.EQUIPMENT_RING1, "x":2, "y":106, "width":32, "height":32},
  89. ## 새 반지2
  90. {"index":item.EQUIPMENT_RING2, "x":75, "y":106, "width":32, "height":32},
  91. ## 새 벨트
  92. {"index":item.EQUIPMENT_BELT, "x":39, "y":106, "width":32, "height":32},
  93. ),
  94. },
  95. ## Dragon Soul Button
  96. {
  97. "name" : "DSSButton",
  98. "type" : "button",
  99.  
  100. "x" : 114,
  101. "y" : 107,
  102.  
  103. "tooltip_text" : uiScriptLocale.TASKBAR_DRAGON_SOUL,
  104.  
  105. "default_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_01.tga",
  106. "over_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_02.tga",
  107. "down_image" : "d:/ymir work/ui/dragonsoul/dss_inventory_button_03.tga",
  108. },
  109. ## MallButton
  110. {
  111. "name" : "MallButton",
  112. "type" : "button",
  113.  
  114. "x" : 118,
  115. "y" : 148,
  116.  
  117. "tooltip_text" : uiScriptLocale.MALL_TITLE,
  118.  
  119. "default_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_01.tga",
  120. "over_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_02.tga",
  121. "down_image" : "d:/ymir work/ui/game/TaskBar/Mall_Button_03.tga",
  122. },
  123. ## CostumeButton
  124. {
  125. "name" : "CostumeButton",
  126. "type" : "button",
  127.  
  128. "x" : 78,
  129. "y" : 5,
  130.  
  131. "tooltip_text" : uiScriptLocale.COSTUME_TITLE,
  132.  
  133. "default_image" : "d:/ymir work/ui/game/taskbar/costume_Button_01.tga",
  134. "over_image" : "d:/ymir work/ui/game/taskbar/costume_Button_02.tga",
  135. "down_image" : "d:/ymir work/ui/game/taskbar/costume_Button_03.tga",
  136. },
  137. {
  138. "name" : "Equipment_Tab_01",
  139. "type" : "radio_button",
  140.  
  141. "x" : 86,
  142. "y" : 161,
  143.  
  144. "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
  145. "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
  146. "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",
  147.  
  148. "children" :
  149. (
  150. {
  151. "name" : "Equipment_Tab_01_Print",
  152. "type" : "text",
  153.  
  154. "x" : 0,
  155. "y" : 0,
  156.  
  157. "all_align" : "center",
  158.  
  159. "text" : "I",
  160. },
  161. ),
  162. },
  163. {
  164. "name" : "Equipment_Tab_02",
  165. "type" : "radio_button",
  166.  
  167. "x" : 86 + 32,
  168. "y" : 161,
  169.  
  170. "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
  171. "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
  172. "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",
  173.  
  174. "children" :
  175. (
  176. {
  177. "name" : "Equipment_Tab_02_Print",
  178. "type" : "text",
  179.  
  180. "x" : 0,
  181. "y" : 0,
  182.  
  183. "all_align" : "center",
  184.  
  185. "text" : "II",
  186. },
  187. ),
  188. },
  189.  
  190. ),
  191. },
  192.  
  193.                 {
  194.                     "name" : "Inventory_Tab_01",
  195.                     "type" : "radio_button",
  196.                     "x" : 10,
  197.                     "y" : 222,
  198.                     "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
  199.                     "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
  200.                     "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",
  201.                     "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_1,
  202.                     "children" :
  203.                     (
  204.                         {
  205.                             "name" : "Inventory_Tab_01_Print",
  206.                             "type" : "text",
  207.                             "x" : 0,
  208.                             "y" : 0,
  209.                             "all_align" : "center",
  210.                             "text" : "I",
  211.                         },
  212.                     ),
  213.                 },
  214.                 {
  215.                     "name" : "Inventory_Tab_02",
  216.                     "type" : "radio_button",
  217.                     "x" : 40,
  218.                     "y" : 222,
  219.                     "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
  220.                     "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
  221.                     "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",
  222.                     "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_2,
  223.                     "children" :
  224.                     (
  225.                         {
  226.                             "name" : "Inventory_Tab_02_Print",
  227.                             "type" : "text",
  228.                             "x" : 0,
  229.                             "y" : 0,
  230.                             "all_align" : "center",
  231.                             "text" : "II",
  232.                         },
  233.                     ),
  234.                 },
  235.                 {
  236.                     "name" : "Inventory_Tab_03",
  237.                     "type" : "radio_button",
  238.                     "x" : 70,
  239.                     "y" : 222,
  240.                     "default_image" : "d:/ymir work/ui/game/windows/tab_button_small_01.sub",
  241.                     "over_image" : "d:/ymir work/ui/game/windows/tab_button_small_02.sub",
  242.                     "down_image" : "d:/ymir work/ui/game/windows/tab_button_small_03.sub",
  243.                     "tooltip_text" : uiScriptLocale.INVENTORY_PAGE_BUTTON_TOOLTIP_3,
  244.                     "children" :
  245.                     (
  246.                         {
  247.                             "name" : "Inventory_Tab_03_Print",
  248.                             "type" : "text",
  249.                             "x" : 0,
  250.                             "y" : 0,
  251.                             "all_align" : "center",
  252.                             "text" : "III",
  253.                         },
  254.                     ),
  255.                 },
  256.  
  257. ## Item Slot
  258. {
  259. "name" : "ItemSlot",
  260. "type" : "grid_table",
  261.  
  262. "x" : 8,
  263. "y" : 246,
  264.  
  265. "start_index" : 0,
  266. "x_count" : 5,
  267. "y_count" : 9,
  268. "x_step" : 32,
  269. "y_step" : 32,
  270.  
  271. "image" : "d:/ymir work/ui/public/Slot_Base.sub"
  272. },
  273.  
  274. ## Print
  275. {
  276. "name":"Money_Slot",
  277. "type":"button",
  278.  
  279. "x":8,
  280. "y":28,
  281.  
  282. "horizontal_align":"center",
  283. "vertical_align":"bottom",
  284.  
  285. "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
  286. "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
  287. "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub",
  288.  
  289. "children" :
  290. (
  291. {
  292. "name":"Money_Icon",
  293. "type":"image",
  294.  
  295. "x":-18,
  296. "y":2,
  297.  
  298. "image":"d:/ymir work/ui/game/windows/money_icon.sub",
  299. },
  300.  
  301. {
  302. "name" : "Money",
  303. "type" : "text",
  304.  
  305. "x" : 3,
  306. "y" : 3,
  307.  
  308. "horizontal_align" : "right",
  309. "text_horizontal_align" : "right",
  310.  
  311. "text" : "123456789",
  312. },
  313. ),
  314. },
  315.  
  316. ),
  317. },
  318. ),
  319. }
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 11

      Metin2 Closed Beta Content (2003-2004)

    2. 11

      Metin2 Closed Beta Content (2003-2004)

    3. 0

      Football Ground

    4. 11

      Metin2 Closed Beta Content (2003-2004)

    5. 0

      Error compile binary Zentoria2

    6. 11

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.