Premium WeedHex 635 Posted May 27, 2020 Premium Share Posted May 27, 2020 (edited) Here it is a nice fix about bonus calculation in % from item for sash. I think nowadays everyone has this system. So enjoy. File: item.cpp Search for: else if (pkItemAbsorbed->bType == ITEM_WEAPON) Replace the whole statement with: else if (pkItemAbsorbed->bType == ITEM_WEAPON) { //Basic attack value from weapon if (pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[4] > 0) { long lAttGrade = pkItemAbsorbed->alValues[4] + pkItemAbsorbed->alValues[5]; if (pkItemAbsorbed->alValues[3] > pkItemAbsorbed->alValues[4]) lAttGrade = pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[5]; double dValue = lAttGrade * GetSocket(ACCE_ABSORPTION_SOCKET); dValue = (double)dValue / 100; dValue = (double)dValue + .5; lAttGrade = (long) dValue; if ((pkItemAbsorbed->alValues[3] > 0 && lAttGrade < 1) || (pkItemAbsorbed->alValues[4] > 0 && lAttGrade < 1)) lAttGrade += 1; else if ((pkItemAbsorbed->alValues[3] > 0) || (pkItemAbsorbed->alValues[4] > 0)) lAttGrade += 1; m_pOwner->ApplyPoint(APPLY_ATT_GRADE_BONUS, bAdd ? lAttGrade : -lAttGrade); } //Basic magic attack value from weapon if (pkItemAbsorbed->alValues[1] + pkItemAbsorbed->alValues[2] > 0) { long lAttMagicGrade = pkItemAbsorbed->alValues[2] + pkItemAbsorbed->alValues[5]; if (pkItemAbsorbed->alValues[1] > pkItemAbsorbed->alValues[2]) lAttMagicGrade = pkItemAbsorbed->alValues[1] + pkItemAbsorbed->alValues[5]; double dValue = lAttMagicGrade * GetSocket(ACCE_ABSORPTION_SOCKET); dValue = (double)dValue / 100; dValue = (double)dValue + .5; lAttMagicGrade = (long) dValue; if (((pkItemAbsorbed->alValues[1] > 0) && (lAttMagicGrade < 1)) || ((pkItemAbsorbed->alValues[2] > 0) && (lAttMagicGrade < 1))) lAttMagicGrade += 1; else if ((pkItemAbsorbed->alValues[1] > 0) || (pkItemAbsorbed->alValues[2] > 0)) lAttMagicGrade += 1; m_pOwner->ApplyPoint(APPLY_MAGIC_ATT_GRADE, bAdd ? lAttMagicGrade : -lAttMagicGrade); } } As u can see if you have the SASH_SYSTEM, before the it was making mistakes with 'pkItemAbsorbed->alValues[5]'. Let's test! Regards. Edited May 28, 2020 by WeedHex 9 Link to comment Share on other sites More sharing options...
Contributor TMP4 11001 Posted May 28, 2020 Contributor Share Posted May 28, 2020 Hm i think i have a different sash system, can you explain the bug so i can test if i have the bug, please? Thanks Link to comment Share on other sites More sharing options...
Kafa 153 Posted May 28, 2020 Share Posted May 28, 2020 (edited) 2 hours ago, TMP4 said: Hm i think i have a different sash system, can you explain the bug so i can test if i have the bug, please? Thanks There is a bug with the bonus calculation at weapons, if you still dont understand then i really dont know bro compare the bonus you have on your sash with the ones you receive @WeedHex thanks! Vote WeedHex for president Edited May 28, 2020 by Kafa 1 Link to comment Share on other sites More sharing options...
Contributor TMP4 11001 Posted May 28, 2020 Contributor Share Posted May 28, 2020 (edited) @WeedHex Did you just added if (pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[4] > 0) if (pkItemAbsorbed->alValues[1] + pkItemAbsorbed->alValues[2] > 0) to check if those are bigger then 0, or did you changed more code in that version of sash? If you just checked for "> 0" then i'm ok, I'm checking that too. Otherwise please tell me what you modified in addition. Edited May 28, 2020 by TMP4 Link to comment Share on other sites More sharing options...
Premium WeedHex 635 Posted May 28, 2020 Author Premium Share Posted May 28, 2020 (edited) //Basic attack value from weapon if (pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[4] > 0) //Basic magic attack value from weapon if (pkItemAbsorbed->alValues[1] + pkItemAbsorbed->alValues[2] > 0) Item_proto for weapons: VALUE0 = empty VALUE1 = MIN MAGIC ATTACK VALUE2 =MAX MAGIC ATTACK VALUE3 = MIN ATTACK VALUE VALUE4 = MAX ATTACK VALUE VALUE5 = ADDEND TO INCREASE VALUE As you can see before of my fix, the system was making mistakes with VALUE5 keeping the value, independently the kind of bonus. With my fix now, system checks before if the weapon has MAGIC or ATTACK, and than calculate it. Edited May 28, 2020 by WeedHex Link to comment Share on other sites More sharing options...
Contributor TMP4 11001 Posted May 28, 2020 Contributor Share Posted May 28, 2020 (edited) I googled the system what you're using, and yes, you just added that 2 if to check "> 0". So i'm ok, that's checked in mine too Edited May 28, 2020 by TMP4 Link to comment Share on other sites More sharing options...
Premium WeedHex 635 Posted May 28, 2020 Author Premium Share Posted May 28, 2020 1 minute ago, TMP4 said: I googled the system what you're using, and yes, you just added that 2 if to check "> 0". So i'm ok, that's checked in mine too Yes, just replace the statement and of course before understand what I did. Maybe there are different versions, but the fix is same way. Link to comment Share on other sites More sharing options...
Recommended Posts