Fixes to all-reputation and all-skill custom option handling:

- Move on-create customs (all explored, all reputations) to CharacterHandler::HandlePlayerLogin for first login. Fixes #19839.
- Add Wrath factions to all reputations custom (it only had BC factions).
- Remove unused ReputationMgr::SendStates. Add ReputationMgr::SendState handling for sending all updated states in arbitrary order if nullptr is passed (used in point #1).
- Fix all weapon skills max custom to properly apply on learning new weapon skills.

(cherry picked from commit 4b6351e6a5)
This commit is contained in:
treeston
2017-06-15 04:19:12 +02:00
committed by Carbenium
parent c12ee97f12
commit 2d191a6680
5 changed files with 78 additions and 61 deletions

View File

@@ -523,56 +523,6 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
SetCreateCurrency(CURRENCY_TYPE_APEXIS_CRYSTALS, sWorld->getIntConfig(CONFIG_CURRENCY_START_APEXIS_CRYSTALS));
SetCreateCurrency(CURRENCY_TYPE_JUSTICE_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_JUSTICE_POINTS));
// start with every map explored
if (sWorld->getBoolConfig(CONFIG_START_ALL_EXPLORED))
{
for (uint16 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ExploredZones, i), UI64LIT(0xFFFFFFFFFFFFFFFF));
}
//Reputations if "StartAllReputation" is enabled, -- @todo Fix this in a better way
if (sWorld->getBoolConfig(CONFIG_START_ALL_REP))
{
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(942), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(935), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(936), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1011), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(970), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(967), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(989), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(932), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(934), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1038), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(1077), 42999);
// Factions depending on team, like cities and some more stuff
switch (GetTeam())
{
case ALLIANCE:
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(72), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(47), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(69), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(930), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(730), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(978), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(54), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(946), 42999);
break;
case HORDE:
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(76), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(68), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(81), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(911), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(729), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(941), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(530), 42999);
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(947), 42999);
break;
default:
break;
}
}
// Played time
m_Last_tick = time(nullptr);
m_Played_time[PLAYED_TIME_TOTAL] = 0;

View File

@@ -1175,6 +1175,77 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(pCurrChar->getRace(), pCurrChar->getClass());
for (uint32 spellId : info->castSpells)
pCurrChar->CastSpell(pCurrChar, spellId, true);
// start with every map explored
if (sWorld->getBoolConfig(CONFIG_START_ALL_EXPLORED))
{
for (uint16 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
pCurrChar->SetUpdateFieldValue(pCurrChar->m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ExploredZones, i), UI64LIT(0xFFFFFFFFFFFFFFFF));
}
// Max relevant reputations if "StartAllReputation" is enabled
if (sWorld->getBoolConfig(CONFIG_START_ALL_REP))
{
ReputationMgr& repMgr = pCurrChar->GetReputationMgr();
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 942), 42999, false); // Cenarion Expedition
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 935), 42999, false); // The Sha'tar
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 936), 42999, false); // Shattrath City
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1011), 42999, false); // Lower City
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 970), 42999, false); // Sporeggar
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 967), 42999, false); // The Violet Eye
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 989), 42999, false); // Keepers of Time
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 932), 42999, false); // The Aldor
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 934), 42999, false); // The Scryers
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1038), 42999, false); // Ogri'la
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1077), 42999, false); // Shattered Sun Offensive
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1106), 42999, false); // Argent Crusade
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1104), 42999, false); // Frenzyheart Tribe
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1090), 42999, false); // Kirin Tor
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1098), 42999, false); // Knights of the Ebon Blade
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1156), 42999, false); // The Ashen Verdict
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1073), 42999, false); // The Kalu'ak
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1105), 42999, false); // The Oracles
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1119), 42999, false); // The Sons of Hodir
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1091), 42999, false); // The Wyrmrest Accord
// Factions depending on team, like cities and some more stuff
switch (pCurrChar->GetTeam())
{
case ALLIANCE:
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 72), 42999, false); // Stormwind
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 47), 42999, false); // Ironforge
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 69), 42999, false); // Darnassus
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 930), 42999, false); // Exodar
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 730), 42999, false); // Stormpike Guard
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 978), 42999, false); // Kurenai
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 54), 42999, false); // Gnomeregan Exiles
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 946), 42999, false); // Honor Hold
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1037), 42999, false); // Alliance Vanguard
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1068), 42999, false); // Explorers' League
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1126), 42999, false); // The Frostborn
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1094), 42999, false); // The Silver Covenant
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1050), 42999, false); // Valiance Expedition
break;
case HORDE:
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 76), 42999, false); // Orgrimmar
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 68), 42999, false); // Undercity
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 81), 42999, false); // Thunder Bluff
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 911), 42999, false); // Silvermoon City
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 729), 42999, false); // Frostwolf Clan
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 941), 42999, false); // The Mag'har
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 530), 42999, false); // Darkspear Trolls
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry( 947), 42999, false); // Thrallmar
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1052), 42999, false); // Horde Expedition
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1067), 42999, false); // The Hand of Vengeance
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1124), 42999, false); // The Sunreavers
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1064), 42999, false); // The Taunka
repMgr.SetOneFactionReputation(sFactionStore.LookupEntry(1085), 42999, false); // Warsong Offensive
break;
default:
break;
}
repMgr.SendState(nullptr);
}
}
// show time before shutdown if shutdown planned.
@@ -1257,7 +1328,7 @@ void WorldSession::HandleSetFactionNotAtWar(WorldPackets::Character::SetFactionN
void WorldSession::HandleSetFactionCheat(WorldPacket& /*recvData*/)
{
TC_LOG_ERROR("network", "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
GetPlayer()->GetReputationMgr().SendStates();
GetPlayer()->GetReputationMgr().SendState(nullptr);
}
void WorldSession::HandleTutorialFlag(WorldPackets::Misc::TutorialSetFlag& packet)

View File

@@ -187,13 +187,16 @@ void ReputationMgr::SendState(FactionState const* faction)
WorldPackets::Reputation::SetFactionStanding setFactionStanding;
setFactionStanding.ReferAFriendBonus = 0.0f;
setFactionStanding.BonusFromAchievementSystem = 0.0f;
setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), faction->Standing);
if (faction)
setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), faction->Standing);
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
{
if (itr->second.needSend)
{
itr->second.needSend = false;
if (itr->second.ReputationListID != faction->ReputationListID)
if (!faction || itr->second.ReputationListID != faction->ReputationListID)
setFactionStanding.Faction.emplace_back(int32(itr->second.ReputationListID), itr->second.Standing);
}
}
@@ -219,12 +222,6 @@ void ReputationMgr::SendInitialReputations()
_player->SendDirectMessage(initFactions.Write());
}
void ReputationMgr::SendStates()
{
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
SendState(&(itr->second));
}
void ReputationMgr::SendVisible(FactionState const* faction, bool visible) const
{
if (_player->GetSession()->PlayerLoading())

View File

@@ -139,7 +139,6 @@ class TC_GAME_API ReputationMgr
void SendInitialReputations();
void SendForceReactions();
void SendState(FactionState const* faction);
void SendStates();
private: // internal helper functions
void Initialize();

View File

@@ -889,7 +889,7 @@ StartPlayerLevel = 1
#
# StartDeathKnightPlayerLevel
# Description: Staring level for death knights after creation.
# Description: Starting level for death knights after creation.
# Range: 1-MaxPlayerLevel
# Default: 55