[m] Added some more opcodes and structure updates

This commit is contained in:
Antz 2020-02-19 10:08:25 +00:00
parent 3a721c62ed
commit 5841a35c64
No known key found for this signature in database
GPG key ID: 0DF907270598C85F
7 changed files with 699 additions and 690 deletions

View file

@ -734,6 +734,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
SetUInt32Value(PLAYER_FIELD_HOME_PLAYER_REALM, 1);
SetFloatValue(PLAYER_FIELD_UI_SPELL_HIT_MODIFIER, 1.0f);
SetFloatValue(PLAYER_FIELD_HOME_REALM_TIME_OFFSET, 1);
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, -1); // -1 is default value
@ -758,7 +761,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
SetUInt32Value(PLAYER_FIELD_KILLS, 0);
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 0);
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0);
// set starting level
uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
@ -3109,7 +3112,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
// restore if need some important flags
SetUInt32Value(PLAYER_FIELD_BYTES2, 0); // flags empty by default
//SetUInt32Value(PLAYER_FIELD_BYTES2, 0 ); // flags empty by default
if (reapplyMods) // reapply stats values only on .reset stats (level) command
_ApplyAllStatBonuses();
@ -7149,7 +7152,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, float honor)
// count the number of playerkills in one day
ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
// and those in a lifetime
ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 1, true);
ApplyModUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 1, true);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS, pVictim->getClass());
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HK_RACE, pVictim->getRace());
@ -15365,17 +15368,15 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) const
}
bool have_slot = false;
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx);
if (qInfo->GetQuestId() == id)
{
return false;
}
//for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
//{
// uint32 id = GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx);
// if (qInfo->GetQuestId() == id)
// return false;
if (!id)
have_slot = true;
}
// if (!id)
// have_slot = true;
//}
if (!have_slot)
{
@ -16673,7 +16674,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
}
}
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[40].GetUInt32());
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[40].GetUInt32());
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16()); // today
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[42].GetUInt16()); // yesterday
@ -17840,10 +17841,10 @@ void Player::_LoadQuestStatus(QueryResult* result)
void Player::_LoadDailyQuestStatus(QueryResult* result)
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
//for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
//{
// SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
//}
// QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow());
@ -17867,7 +17868,7 @@ void Player::_LoadDailyQuestStatus(QueryResult* result)
if (!pQuest)
continue;
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
//SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
++quest_daily_idx;
DEBUG_LOG("Daily quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
@ -18563,7 +18564,7 @@ void Player::SaveToDB()
ss << m_taxi.SaveTaxiDestinationsToString(); // string
uberInsert.addString(ss);
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS));
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS));
uberInsert.addUInt16(GetUInt16Value(PLAYER_FIELD_KILLS, 0));
@ -19090,9 +19091,9 @@ void Player::_SaveDailyQuestStatus()
stmtDel.PExecute(GetGUIDLow());
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
stmtIns.PExecute(GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx));
//for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
// if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
// stmtIns.PExecute(GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx));
m_DailyQuestChanged = false;
}
@ -22060,15 +22061,15 @@ void Player::SendAurasForTarget(Unit* target)
void Player::SetDailyQuestStatus(uint32 quest_id)
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
m_DailyQuestChanged = true;
break;
}
}
//for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
//{
// if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
// {
// SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
// m_DailyQuestChanged = true;
// break;
// }
//}
}
void Player::SetWeeklyQuestStatus(uint32 quest_id)
@ -22085,10 +22086,10 @@ void Player::SetMonthlyQuestStatus(uint32 quest_id)
void Player::ResetDailyQuestStatus()
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
//for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
//{
// SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
//}
// DB data deleted in caller
m_DailyQuestChanged = false;