Premium Istny 79 Posted December 7, 2020 Premium Share Posted December 7, 2020 (edited) Fix allow you to use vnum4 in refine_proto Explanation: By default refine materials are beign loaded until vnumx == 0, but if you assign item to the last socket, material_count will never be assigned. As a result material_count will remain 0, despite 5 material items being set. Adding simple additional check solves this problem Open db/ClientManagerBoot.cpp replace for (int i = 0; i < REFINE_MATERIAL_MAX_NUM; i++) { str_to_number(prt->materials[i].vnum, data[col++]); str_to_number(prt->materials[i].count, data[col++]); if (prt->materials[i].vnum == 0) { prt->material_count = i; break; } } with for (int i = 0; i < REFINE_MATERIAL_MAX_NUM; i++) { str_to_number(prt->materials[i].vnum, data[col++]); str_to_number(prt->materials[i].count, data[col++]); if (prt->materials[i].vnum == 0) { prt->material_count = i; break; } else if (i+1 == REFINE_MATERIAL_MAX_NUM) { prt->material_count = REFINE_MATERIAL_MAX_NUM; break; } } final result Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 1 2 Link to comment Share on other sites More sharing options...
Premium Syreldar 1874 Posted December 7, 2020 Premium Share Posted December 7, 2020 (edited) The answer below is correct. I need some sleep. Edited December 7, 2020 by Syreldar "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted December 7, 2020 Silver Share Posted December 7, 2020 (edited) BYTE material_count = 0; for (int i = 0; i < REFINE_MATERIAL_MAX_NUM; i++) { str_to_number(prt->materials[i].vnum, data[col++]); str_to_number(prt->materials[i].count, data[col++]); if (prt->materials[i].vnum) material_count++; } prt->material_count = material_count; Issue is how they approached counting in the first place. When the loop hits a vnum equal to zero, material count was assigned based on current loop index which means if you had 5 slots occupied you would never hit an empty slot which is why material count would be always zero. By extending the loop you would also need to extend mysql columns which does nothing in this case. Edited December 7, 2020 by Sonitex Wrong data type :/ 2 Link to comment Share on other sites More sharing options...
Premium Istny 79 Posted December 7, 2020 Author Premium Share Posted December 7, 2020 9 minutes ago, Sonitex said: BYTE material_count = 0; for (int i = 0; i < REFINE_MATERIAL_MAX_NUM; i++) { str_to_number(prt->materials[i].vnum, data[col++]); str_to_number(prt->materials[i].count, data[col++]); if (prt->materials[i].vnum) material_count++; } prt->material_count = material_count; Issue is how they approached counting in the first place. When the loop hits a vnum equal to zero, material count was assigned based on current loop index which means if you had 5 slots occupied you would never hit an empty slot which is why material count would be always zero. By extending the loop you would also need to extend mysql columns which does nothing in this case. Cleaner, only downside is, if someone for unknow reason will have for example socket3 set to 0 and socket4 to 11 loop in CHARACTER::DoRefine will use value frome socket3 as material vnum which is 0. Summarazing don't do a mess and you are good to go 1 Link to comment Share on other sites More sharing options...
Silver Sonitex 1438 Posted December 7, 2020 Silver Share Posted December 7, 2020 (edited) 8 minutes ago, Istny said: Cleaner, only downside is, if someone for unknow reason will have for example socket3 set to 0 and socket4 to 11 loop in CHARACTER::DoRefine will use value frome socket3 as material vnum which is 0. Summarazing don't do a mess and you are good to go Yeah but it goes both ways. Before if you set a value for socket0, left socket1 empty and set socket2, 3rd socket would be ignored. But as you said, you need a bit more precision & focus when doing things like that. Edited December 7, 2020 by Sonitex 1 Link to comment Share on other sites More sharing options...
meneleos 305 Posted December 7, 2020 Share Posted December 7, 2020 (edited) prt->material_count = 0; for (int i = 0; i < REFINE_MATERIAL_MAX_NUM; i++) { str_to_number(prt->materials[i].vnum, data[col++]); str_to_number(prt->materials[i].count, data[col++]); if (prt->materials[i].vnum != 0) prt->material_count++; } Edited December 7, 2020 by meneleos Link to comment Share on other sites More sharing options...
Recommended Posts