Core/Guilds: implement guild profession fields for guild roster packets
This commit is contained in:
1 parent
d17d8e9277
commit
6d759dc6e8
6 files changed
+107
-4
No files matched your search
@@ -6118,6 +6118,9 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Guild * guild = GetGuild())
|
||||
guild->UpdateMemberData(this, GUILD_MEMBER_DATA_PROFESSIONS, 0);
|
||||
}
|
||||
|
||||
bool Player::HasSkill(uint32 skill) const
|
||||
@@ -17330,6 +17333,34 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::LoadPrimaryProfessionsFromDB(ObjectGuid guid, std::vector<PrimaryProfessionData>& data)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SKILLS);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint16 skill = fields[0].GetUInt16();
|
||||
uint16 value = fields[1].GetUInt16();
|
||||
uint16 max = fields[2].GetUInt16();
|
||||
|
||||
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
|
||||
if (!skillLine || skillLine->categoryId != SKILL_CATEGORY_PROFESSION)
|
||||
continue;
|
||||
|
||||
PrimaryProfessionData profession;
|
||||
profession.SkillId = skill;
|
||||
profession.Step = max / 75;
|
||||
profession.Rank = value;
|
||||
data.push_back(profession);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
|
||||
{
|
||||
loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
|
||||
@@ -28584,3 +28615,26 @@ void Player::SendTamePetFailure(PetTameFailureReason reason)
|
||||
data << uint8(reason);
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void Player::GetPrimaryProfessionData(PrimaryProfessionData* data)
|
||||
{
|
||||
for (uint8 i = 0; i < 2; i++)
|
||||
{
|
||||
uint32 skillId = GetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1 + i);
|
||||
SkillStatusMap::iterator itr = mSkillStatus.find(skillId);
|
||||
if (itr != mSkillStatus.end() && itr->second.uState != SKILL_DELETED)
|
||||
{
|
||||
uint16 field = itr->second.pos / 2;
|
||||
uint8 offset = itr->second.pos & 1; // itr->second.pos % 2
|
||||
data[i].SkillId = skillId;
|
||||
data[i].Step = GetUInt16Value(PLAYER_SKILL_STEP_0 + field, offset);
|
||||
data[i].Rank = GetUInt16Value(PLAYER_SKILL_RANK_0 + field, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[i].SkillId = 0;
|
||||
data[i].Step = 0;
|
||||
data[i].Rank = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user