BUG: AddSkillBonus adds incorrect amount

Old bugs stored here for reference.
Locked
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

BUG: AddSkillBonus adds incorrect amount

Post by Ememjr » Wed Apr 17, 2019 4:35 am

when using the add skill bonus Lua Function from a script the incorrect amount is being added as following
starting skill value 5/100
add 5 with addskillbounes then value is 15/105

the little troubleshooting i did so far has this lua function executing twice each time i execute the spell

Code: Select all

int EQ2Emu_lua_AddSkillBonus(lua_State* state) {
i have confirmed the the addskillbonus is only in the script once


Edit: squashed, pending commit

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: BUG: AddSkillBonus adds incorrect amount

Post by tyrbo » Wed Apr 17, 2019 5:39 am

Looking at the code (forgive me, it's been a while), I don't think I changed anything significant with how adding skills works.
iirc, this was struct/packet related and not an issue with the code.

A quick look through my commits and this _may_ be the fix:

https://github.com/stitchpvp/world/blam ... #L347-L348

Might have just been that the logic was a little funky. Anyway, that seems to work on Stitch, so I'd give it a shot.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: BUG: AddSkillBonus adds incorrect amount

Post by Ememjr » Wed Apr 17, 2019 6:11 am

yup that is what i found, we were on the right track

Code: Select all

sint16 skill_max_with_bonuses = CalculateSkillMaxValue(skill->skill_id, skill->max_val);
				packet->setArrayDataByName("skill_id", skill->skill_id, i);
				packet->setArrayDataByName("type", skill->skill_type, i);
				//packet->setArrayDataByName("current_val", CalculateSkillValue(skill->skill_id, skill->current_val), i);
				//packet->setArrayDataByName("base_val", skill->max_val, i);
				//packet->setArrayDataByName("max_val", skill->max_val, i);
				packet->setArrayDataByName("current_val", CalculateSkillValue(skill->skill_id, skill->current_val), i);
				packet->setArrayDataByName("base_val", skill_max_with_bonuses, i);   //<<<<change this line to skill->currentskill to fix this bug
				packet->setArrayDataByName("skill_delta2", skill_max_with_bonuses - skill->max_val, i);
				packet->setArrayDataByName("max_val", skill->max_val, i);
				packet->setArrayDataByName("display_minval", skill->display, i);
				packet->setArrayDataByName("display_maxval", skill->display, i);
				i++;
base val should not be skill_max_with_bonuses
my current val is currect, you should probaly change your current_val to CalculateSkillValue(skill->skill_id, skill->current_val) so that is adds in the AddSkillBonus

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: BUG: AddSkillBonus adds incorrect amount

Post by tyrbo » Wed Apr 17, 2019 6:27 am

I'm pretty sure it all shows correctly on Stitch at this point.
I'm not making any more changes to my old code though, just focused on the rewrite.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: BUG: AddSkillBonus adds incorrect amount

Post by Ememjr » Wed Apr 17, 2019 12:14 pm

ok it is a false alarm, i did not find a fix, but seem to have found where in a general area it is failing

here is orginal portion of packet (this is #3 of 31 skill updates) from the inital full send packet

Code: Select all

Name: type_3    Index:  0       Type:  int32            Data:  3
Name: current_val_3     Index:  0       Type:  int16            Data:  10
Name: base_val_3        Index:  0       Type:  int16            Data:  10
Name: max_val_3         Index:  0       Type:  int16            Data:  105
Name: skill_delta_3     Index:  0       Type:  sint16           Data:  3
Name: skill_delta2_3    Index:  0       Type:  sint16           Data:  3
Name: display_minval_3          Index:  0       Type:  int8             Data:  1
Name: display_maxval_3          Index:  0       Type:  int8             Data:  1
Name: language_unknown_3        Index:  0       Type:  int8             Data:  0
you will see that current_val is 10 the correct value

here is the dump

Code: Select all

   0: 1F 00 73 01 00 00 BE 02 - 15 D4 93 D8 D4 69 05 05  | ..s..........i..
  16: E0 01 01 9E 20 7C B2 7A - D4 65 01 01 08 9F 11 21  | .... |.z.e.....!
  32: 0A 75 C9 AA 65 01 01 B0 - 01 01 9F 03 24 5A 0A 8A  | .u..e.......$Z..
  48: AA 69 0A 0A B0 01 01 9F - 02 24 98 D3 E3 AA 69 05  | .i.......$....i.
  64: 05 B0 01 01 9F 06 29 0B - 11 2A AA 69 05 05 B0 01  | ......)..*.i....
  80: 01 9F 11 2D EA 03 99 AA - 65 01 01 B0 01 01 9F 02  | ...-....e.......
  96: 34 A1 43 AC AA 69 05 05 - B0 01 01 8E 34 E2 D0 AA  | 4.C..i......4...
 112: 65 01 01 B0 01 01 9F 06 - 3E 7F 0C 41 AA 69 05 05  | e.......>..A.i..
 128: B0 01 01 8F 5C 9D FC BC - AA 65 01 01 07 9F 06 75  | ....\....e.....u
 144: 6D D1 92 AA 69 05 05 B0 - 01 01 9F 0C 79 76 D8 8D  | m...i.......yv..
 160: AA 69 05 05 B0 01 01 9F - 0C 7B 8D 17 2E AA 65 01  | .i.......{....e.
 176: 01 07 9D 06 8A 40 42 AA - 69 05 05 B0 01 01 8F 8E  | .....@B.i.......
 192: 11 F2 27 AA 65 01 01 07 - 8F 96 FC 67 DD AA 65 01  | ..'.e......g..e.
 208: 01 07 9F 01 9D 3F B5 16 - AA 69 05 05 B0 01 01 8F  | .....?...i......
 224: 9E B1 77 A6 AA 65 01 01 - 07 9F 01 B5 B5 8F E6 AA  | ..w..e..........
 240: 69 05 05 B0 01 01 9F 11 - BD 91 0C 6D AA 65 01 01  | i..........m.e..
 256: B0 01 01 9F 01 CB EF DD - 30 AA 69 05 05 B0 01 01  | ........0.i.....
 272: 9F 0C CC 64 74 1E AA 65 - 01 01 07 9F 04 D2 F1 5A  | ...dt..e.......Z
 288: 8C AA 65 01 01 07 9F 02 - D5 DB 48 D4 AA 69 05 05  | ..e.......H..i..
 304: B0 01 01 9F 06 DA 22 95 - A9 AA 69 05 05 B0 01 01  | ......"...i.....
 320: 8F E3 BA CE 46 AA 65 01 - 01 07 8F F0 AC 21 16 AA  | ....F.e......!..
 336: 65 01 01 07 9F 06 F7 DB - A0 2F AA 69 05 05 B0 01  | e......../.i....
 352: 01 9F 0C FD 52 8D 32 AA - 69 05 05 B0 01 01 9F 0F  | ....R.2.i.......
 368: FD 86 97 E1 AA 65 01 01 - 07 00                    | .....e....




this is the update packet after casting spell that has an addskillbonus of 3 on it. current_val is now 13

Code: Select all

Name: type_3    Index:  0       Type:  int32            Data:  3
Name: current_val_3     Index:  0       Type:  int16            Data:  13
Name: base_val_3        Index:  0       Type:  int16            Data:  10
Name: max_val_3         Index:  0       Type:  int16            Data:  105
Name: skill_delta_3     Index:  0       Type:  sint16           Data:  3
Name: skill_delta2_3    Index:  0       Type:  sint16           Data:  3
Name: display_minval_3          Index:  0       Type:  int8             Data:  1
Name: display_maxval_3          Index:  0       Type:  int8             Data:  1
Name: language_unknown_3        Index:  0       Type:  int8             Data:  0
here is the dump of the update packet, its just updateing 1 skill that is different

Code: Select all

   0: 1F 00 0B 00 00 00 48 C1 - 03 07 82 03 7F 7F 7F 7F  | ......H.........
  16: 3A 00                                              | :.
this is one of the Xor update packets, so i have to assume that it is not XORing correctly or if offset wrong

Locked

Who is online

Users browsing this forum: No registered users and 0 guests