Add Venture Vision Behavior (#609)

Add the Venture Vision behavior and associated functionality.  Pet digs still do not show up however.

The Kit bonus for factions have been tested and properly grant and take away the buff when it is casted and uncasted.  Tested as well using multiple Venture Vision behaviors at once and the vision only went away when there were zero equipped at once.

Remove extra includes

Convert to Tabs

Remove extra forward declaration
This commit is contained in:
David Markowitz
2022-07-04 21:48:56 -07:00
committed by GitHub
parent 8a54e7ccd2
commit cc25ec0151
5 changed files with 141 additions and 1 deletions

View File

@@ -785,3 +785,32 @@ ZoneStatistics& CharacterComponent::GetZoneStatisticsForMap(LWOMAPID mapID) {
m_ZoneStatistics.insert({ mapID, {0, 0, 0, 0, 0 } });
return m_ZoneStatistics.at(mapID);
}
void CharacterComponent::AddVentureVisionEffect(std::string ventureVisionType) {
const auto ventureVisionTypeIterator = m_ActiveVentureVisionEffects.find(ventureVisionType);
if (ventureVisionTypeIterator != m_ActiveVentureVisionEffects.end()) {
ventureVisionTypeIterator->second = ++ventureVisionTypeIterator->second;
} else {
// If the effect it not found, insert it into the active effects.
m_ActiveVentureVisionEffects.insert(std::make_pair(ventureVisionType, 1U));
}
UpdateClientMinimap(true, ventureVisionType);
}
void CharacterComponent::RemoveVentureVisionEffect(std::string ventureVisionType) {
const auto ventureVisionTypeIterator = m_ActiveVentureVisionEffects.find(ventureVisionType);
if (ventureVisionTypeIterator != m_ActiveVentureVisionEffects.end()) {
ventureVisionTypeIterator->second = --ventureVisionTypeIterator->second;
UpdateClientMinimap(ventureVisionTypeIterator->second != 0U, ventureVisionType);
}
}
void CharacterComponent::UpdateClientMinimap(bool showFaction, std::string ventureVisionType) const {
if (!m_Parent) return;
AMFArrayValue arrayToSend;
arrayToSend.InsertValue(ventureVisionType, showFaction ? static_cast<AMFValue*>(new AMFTrueValue()) : static_cast<AMFValue*>(new AMFFalseValue()));
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent ? m_Parent->GetSystemAddress() : UNASSIGNED_SYSTEM_ADDRESS, "SetFactionVisibility", &arrayToSend);
}

View File

@@ -274,12 +274,32 @@ public:
*/
void UpdatePlayerStatistic(StatisticID updateID, uint64_t updateValue = 1);
/**
* Add a venture vision effect to the player minimap.
*/
void AddVentureVisionEffect(std::string ventureVisionType);
/**
* Remove a venture vision effect from the player minimap.
* When an effect hits 0 active effects, it is deactivated.
*/
void RemoveVentureVisionEffect(std::string ventureVisionType);
/**
* Update the client minimap to reveal the specified factions
*/
void UpdateClientMinimap(bool showFaction, std::string ventureVisionType) const;
/**
* Character info regarding this character, including clothing styles, etc.
*/
Character* m_Character;
private:
/**
* The map of active venture vision effects
*/
std::map<std::string, uint32_t> m_ActiveVentureVisionEffects;
/**
* Whether this character is racing