Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed skills getting mixed with attributes in the database. #5

Closed
wants to merge 1 commit into from

2 participants

@Ablu
Owner
  • Server maintainer should check their db and clean it if nessecary *

Tested by jurkan and myself.

@Ablu Ablu Fixed skills getting mixed with attributes in the database.
* Server maintainer should check their db and clean it if nessecary *

Tested by jurkan and myself.
71a2870
@Bertram25
Collaborator

Meh, I don't get how the fix is working yet. I'll hop on this a bit more later.

@Ablu
Owner

Basically updateDerivedAttributes() got called with a skill. Which lead to skills getting into the attributes table. The server used updateDerivedAttributes() to inform the client about this which lead to resending the stuff to the account server. So i used the existing sendStatus() function for that.

@Bertram25
Collaborator

Ok for that part.

Was there the same problem in the receiveExperience() function, too, then?

@Bertram25

Hmm, doesn't this send a level up message on each sendStatus() calls with forceall = true?

Owner

well that only happens on login to inform the client about the level

@Ablu
Owner

eh hm :/ I was am pretty sure that i modified that there too... because that was the place where we found the issue. I need to look into this again.

@Bertram25

Here, you're now relying on the sendstatus() function to update the derivedAttributes, which is fine.
Yet, The sendStatus function is itself not updating the derivedAttributes anymore.

Can you tell me at which moment the derived attributes are updated before sending the status to the client?
(Maybe it's a false problem, but let's check. :])

Owner

eh the removal of line 380 was wrong if i understand it right... I do not know what i intended with that. need to look into this patch again i guess.

@Bertram25
Collaborator

ok, thanks for your answers. :) Good luck.

@Ablu
Owner

eh sorry i was a bit confused i think only the deletion of the character->modifiedAllAttribute(); line was wrong. I will change that and test all the stuff again this evening. Thanks a lot for looking at it.

closing this pull request since i did it based on a special commit range

@Ablu Ablu closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2012
  1. @Ablu

    Fixed skills getting mixed with attributes in the database.

    Ablu authored
    * Server maintainer should check their db and clean it if nessecary *
    
    Tested by jurkan and myself.
This page is out of date. Refresh to see the latest.
View
8 src/game-server/character.cpp
@@ -452,7 +452,7 @@ void Character::setBuySell(BuySell *t)
}
}
-void Character::sendStatus()
+void Character::sendStatus(bool forceAll)
{
MessageOut attribMsg(GPMSG_PLAYER_ATTRIBUTE_CHANGE);
for (std::set<size_t>::const_iterator i = mModifiedAttributes.begin(),
@@ -478,7 +478,7 @@ void Character::sendStatus()
if (expMsg.getLength() > 2) gameHandler->sendTo(this, expMsg);
mModifiedExperience.clear();
- if (mUpdateLevelProgress)
+ if (mUpdateLevelProgress || forceAll)
{
mUpdateLevelProgress = false;
MessageOut progressMessage(GPMSG_LEVEL_PROGRESS);
@@ -646,9 +646,7 @@ void Character::receiveExperience(int skill, int experience, int optimalLevel)
// Check for skill levelup
if (Character::levelForExp(newExp) >= Character::levelForExp(oldExp))
- updateDerivedAttributes(skill);
-
- mRecalculateLevel = true;
+ recalculateLevel();
}
void Character::incrementKillCount(int monsterType)
View
2  src/game-server/character.h
@@ -231,7 +231,7 @@ class Character : public Being
* Sends a message that informs the client about attribute
* modified since last call.
*/
- void sendStatus();
+ void sendStatus(bool forceAll = false);
/**
* Gets the ID of the map that the character is on.
View
7 src/game-server/gamehandler.cpp
@@ -377,12 +377,7 @@ void GameHandler::tokenMatched(GameClient *computer, Character *character)
// Force sending the whole character to the client.
Inventory(character).sendFull();
- character->modifiedAllAttribute();
- std::map<int, int>::const_iterator skill_it;
- for (skill_it = character->getSkillBegin(); skill_it != character->getSkillEnd(); skill_it++)
- {
- character->updateDerivedAttributes(skill_it->first);
- }
+ character->sendStatus(true);
}
void GameHandler::deletePendingClient(GameClient *computer)
Something went wrong with that request. Please try again.