Hello all, it has been a while since i last visited the forum. I have been trying for hours to solve this problem but it seems i have not had any luck.
Expected behavior:
when i hit monsters single arrow with bow or at TG the proficiency percentage increases till it reaches 100% then the skill levels. this should happen for all levels until it is maxed out.
Actual Behavior:
when i hit monsters or TG stake with single arrow the proficiency behaves normally until level 2. when the bow proficiency reaches level 3, the percentage resets each time it reaches 10%. however the actual experience gained is still recorded. So if i keep on hitting and i let it reset for 10 times it actually levels up but the problem is i do not know how much percent is left this way. i started debugging the addProficiencyExperience() function but it seems to be working exactly fine. in fact the bow is the only weapon that has this problem, all single handed or two handed weapons at least the mostly used ones i tried work fine i did not notice any behavior like this from any other proficiency.
I am hoping someone can tell me where i can find the code to debug that is specific for showing the percentage left for proficiency level up for bow.
I would debug the handler for bow attacks, it's most likely an issue with not updating the client properly. So step through the whole handler and not just that function, as you said it actually works, it just doesn't show properly. So I would throw my 2 cents at it happening a step further back than that function.
}
else if (owner is Pet)
{
if (((Pet)owner).PetOwner != null)
{
var expGain = owner.CalculateExperienceGain(target, dmg);
((Pet)owner).PetOwner.GainExperience(expGain);
}
}
target.ReceiveDamage(dmg, owner.UID);
if (!target.Alive)
{
if (target is SOB)
{
target.Kill(1, owner.UID);
owner.SendToScreen(InteractPacket.Create(owner.UID , target.UID, (ushort)target.Location.X, (ushort)target.Location.Y, (owner.WeaponType == 500 ? InteractAction.Shoot : InteractAction.Attack), dmg), true);
}
else
{
check the weapon.dat on the client if it is changed, it can solve your problem.
Inside the client folder there are 2 files called WeaponSkilllLevelExp.ini but i change them nothing happens. and i found no weapon.dat on the client (5065) however i can say all the files are last modified between 2003 and 2005. i tried to follow the function till the [1025] WeaponProficiency packet. but every thing seems to be going fine. i dont know if i missed something but all it does is check for wep id , and skill experience then add id to the id of the player after calculating the exp based on dmg and all. so i am still lost here on where does the code make the percentage of gained vs needed exp then send it to display to user. For example when i made the team member mini-map search i had to send the member id and locX and locY and so it updates on case 106. but with this one i dont see any change to percentage or anything of that sort. maybe it is handled by the client. but if so then the values passed from the server may be messed up. but then again how does the skill normally lvl when it reaches maximum experience needed for that level?
i am a bit lost here i would really apreciate some help xD
I have the same problem currently. I'm pretty sure it's a client-side problem as experience/level values update properly on server-side.
For me, it's not only bow but any weapon. What happens is that, when you get to 25% of experience on proficiency, on client-side, it reverts back to 0% and starts counting again. On server-side, experience is up-to-date though. After it reverts back from 25% to 0% 3 times (75% in total), on 4th 25%, it suddenly levels up.
WeaponSkillLevelExp.ini values in client are same with the ones in server.
I did not figure the issue out yet actually. It has been about 2 years since I last coded in CO2 and I am back now, This bug is really killing my mind still cant figure out the root cause.
Also you are correct it is not only limited to the Bow proficiency, this issue is a global one on all weapon types
guys I think I found out the issue. The issue was in this line var buffer = new byte[24];
it was defined initially as new byte[22]. And we are passing 4 + 8 + 22 = 24;
so we were skipping 2 bytes on each send which I think was the reason for messing up the exp calculation on the client.
Actually I am not sure if this is the correct way or not but this server was originally made by Pro4Never and the way its currently structured for the packet handling is that 1025 (WeaponProficiencyPacket) & the skill packet is 1103 (ConquerSkill). and actually [1104] is not used at all. I might try to use it and see what gets affected. But anyway the main issue is now fixed because all proficiencies now reach 100% then level up compared to only reaching 10% or under due to the limit on the buffer size.