π getWeaponSkillType error in log
TeoTwawki opened this issue Β· comments
I affirm:
- I understand that if I do not agree to the following points by completing the checkboxes my issue will be ignored.
- I have read and understood the Contributing Guide and the Code of Conduct.
- I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated.
OS / platform the server is running (if known)
windows server 2019
Branch affected by issue
base
Steps to reproduce
Took awhile to find a repro for this. people were guessing at it in the private servers discord weeks ago, and I finally stumbled on exactly how to see it.
Equip a sword + shield and use vorpal blade. No shield = no error.
This line in xi.weaponskills.calculateRawWSDmg
will throw an error:
local offhandSkill = attacker:getWeaponSkillType(xi.slot.SUB)
I replaced the get with a zero and used vorpal, no error. put things back, vorpal'd again, error back. Took my shield off and used vorpal: no error. put my shield back on, vorpal again errors. So that's where its coming from for sure.
Expected behavior
Presumably don't get offhand skill when not a weapon, don't throw error
β¨ Thanks for the report! β¨
This is a friendly automated reminder that the maintainers won't look at your report until you've properly completed all of the checkboxes in the pre-filled template.
bah, I hit that button too fast again. Hello Mr. Github actions bot.
if not wsParams.multiHitfTP then
ftp = 1
end
- local offhandSkill = attacker:getWeaponSkillType(xi.slot.SUB)
+ local offhandSkill = xi.skill.NONE
+ local subEquip = attacker:getStorageItem(0, 0, xi.slot.SUB)
+ -- Make sure we HAVE an offhand, and its a weapon
+ if subEquip and not subEquip:isShield() then
+ offhandSkill = attacker:getWeaponSkillType(xi.slot.SUB)
+ end
if calcParams.skillType == xi.skill.HAND_TO_HAND then
offhandSkill = xi.skill.HAND_TO_HAND
subTPGain = mainhandTPGain
end
That seems to handle it. If anyone would like to more thoroughly test and then PR it if good its free real estate - I don't know when I'll have time.
would help if I didn't have heaps of memories of things being counted as a weapons that shouldn't have been, and making it impossible to miscast things as one. but yes that looks like a better solution, if you want to test it out and pr it.
anyone remember when all the grips and shields were in item_weapon.sql
? good times (not -_-)
ed: could possibly also bake in the "use mainhand skill when we're using h2h" here