void CharacterComponent::sendStatus(Entity &entity) { auto *beingComponent = entity.getComponent<BeingComponent>(); MessageOut attribMsg(GPMSG_PLAYER_ATTRIBUTE_CHANGE); for (AttributeInfo *attribute : mModifiedAttributes) { attribMsg.writeInt16(attribute->id); attribMsg.writeInt32(beingComponent->getAttributeBase(attribute) * 256); attribMsg.writeInt32(beingComponent->getModifiedAttribute(attribute) * 256); } if (attribMsg.getLength() > 2) gameHandler->sendTo(mClient, attribMsg); mModifiedAttributes.clear(); if (!mModifiedAbilities.empty()) sendAbilityUpdate(entity); if (mSendAbilityCooldown) sendAbilityCooldownUpdate(entity); if (mSendAttributePointsStatus) sendAttributePointsStatus(entity); if (!mModifiedQuests.empty()) sendQuestUpdate(); }
void Character::sendStatus() { MessageOut attribMsg(GPMSG_PLAYER_ATTRIBUTE_CHANGE); for (std::set<size_t>::const_iterator i = mModifiedAttributes.begin(), i_end = mModifiedAttributes.end(); i != i_end; ++i) { int attr = *i; attribMsg.writeInt16(attr); attribMsg.writeInt32(getAttribute(attr) * 256); attribMsg.writeInt32(getModifiedAttribute(attr) * 256); } if (attribMsg.getLength() > 2) gameHandler->sendTo(this, attribMsg); mModifiedAttributes.clear(); MessageOut expMsg(GPMSG_PLAYER_EXP_CHANGE); for (std::set<size_t>::const_iterator i = mModifiedExperience.begin(), i_end = mModifiedExperience.end(); i != i_end; ++i) { int skill = *i; expMsg.writeInt16(skill); expMsg.writeInt32(getExpGot(skill)); expMsg.writeInt32(getExpNeeded(skill)); expMsg.writeInt16(levelForExp(getExperience(skill))); } if (expMsg.getLength() > 2) gameHandler->sendTo(this, expMsg); mModifiedExperience.clear(); if (mUpdateLevelProgress) { mUpdateLevelProgress = false; MessageOut progressMessage(GPMSG_LEVEL_PROGRESS); progressMessage.writeInt8(mLevelProgress); gameHandler->sendTo(this, progressMessage); } }