Jump to content

Sash System Bonus Calc


Recommended Posts

  • Premium

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 by WeedHex
  • Love 9
Link to comment
Share on other sites

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 by Kafa
  • Lmao 1
Link to comment
Share on other sites

  • Contributor

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

  • Premium
  //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 by WeedHex
Link to comment
Share on other sites

  • Premium
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 :D 

 

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

Announcements



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