Might be a problem in wc3_givexp

Post here to report bugs in Warcraft3 XP. Please read the sticky.

Moderator: Forum Moderator

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Might be a problem in wc3_givexp

Postby juKay » Thu Aug 11, 2005 12:06 pm

I know it's a give XP command but I tried to remove XP from a user and it worked. However it never got save to the database, mysql, so when he rejoined he had all the original XP. We tried this three times without success. However if I gave him more XP it got saved without any problem.

Maybe adding write_xp_to_file(id,"") at the end of the function would solve it?

Btw what is the second argument to write_xp_to_file for? givenline[128], it's never used.

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Postby ferret » Thu Aug 11, 2005 2:41 pm

Its left over from the old flat-flat method of saving.

I'll put a write_xp_to_file into wc3_givexp ... However.. This shouldn't be necessary. Disconnecting and/or finishing a round should cause a write_xp_to_file (Unless you turned off end round saving)

I know disconnecting will save correctly because I use ENDROUND_SAVE 0 to cut CPU usage on round restart.

I'll also review the SQL statements. I wonder if the issue is there, because I know this works with VAULT.
-< www.gamehavoc.com >-

Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Postby juKay » Fri Aug 12, 2005 3:41 pm

Are you talking about ROUNDEND_SAVEALL or did I miss something? I've left that to the default and if I'm correct the default is enabled.

Looked at the code now and you are correct, it's a SQL statement error.

In write_xp_to_file() you have this. So if the players XP is lower than before it won't get saved.

Code: Select all

format(mquery, 1023, "UPDATE `%s` SET playername='%s',xp=%d,skill1=%d,skill2=%d,skill3=%d,skill4=%d WHERE \
playerid='%s' AND race=%d AND xp<%d", mysqltablename, playername, playerxp[id], p_skills[id][1], \
p_skills[id][2], p_skills[id][3], p_skills[id][4], playerid, p_skills[id][0], playerxp[id])

User avatar
ferret
Lead Warcraft 3 XP Developer
Posts: 422
Joined: Wed Jul 06, 2005 8:20 am
Location: Atlanta, GA
Contact:

Postby ferret » Fri Aug 12, 2005 4:11 pm

Can you give me the correct statement? SQL isn't my strong suit and I didn't write those queries.
-< www.gamehavoc.com >-



Lazarus Long: And I know you didn't because the Server Files are version 2.2.6 and the file you posted is version 2.2.5, so do as I told you above and don't ever lie to me again or help is gone!

User avatar
juKay
WC3Mods Donor
WC3Mods Donor
Posts: 14
Joined: Thu Aug 11, 2005 2:36 am
Location: Härnösand / Sweden
Contact:

Postby juKay » Sat Aug 13, 2005 2:35 am

The problem is here:
format(mquery, 1023, "UPDATE `%s` SET playername='%s',xp=%d,skill1=%d,skill2=%d,skill3=%d,skill4=%d WHERE \
playerid='%s' AND race=%d AND xp<%d", mysqltablename, playername, playerxp[id], p_skills[id][1], \
p_skills[id][2], p_skills[id][3], p_skills[id][4], playerid, p_skills[id][0], playerxp[id])

Can't quite figure out why it's checking so that your old xp is smaller than the new value. Must be some saftey net if the xp system would bug or something like it.

Simply just remove the "AND xp<%d" and problem should be solved.

User avatar
Lazarus Long
Lead PITA SOB
Posts: 618
Joined: Tue Jul 05, 2005 9:24 pm

Postby Lazarus Long » Sat Aug 13, 2005 2:50 am

Hello, ferret:

juKay wrote:Simply just remove the "AND xp<%d" and problem should be solved.

Yep, perfectly safe.
Lazarus

User avatar
Lazarus Long
Lead PITA SOB
Posts: 618
Joined: Tue Jul 05, 2005 9:24 pm

Postby Lazarus Long » Sun Sep 11, 2005 5:41 pm

done - it's part of 2.6.1
Lazarus



Return to “WC3XP - Bug Feedback”

Who is online

Users browsing this forum: No registered users and 1 guest