AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
PlayerUpdates.cpp File Reference
#include "AchievementMgr.h"
#include "BattlefieldMgr.h"
#include "CellImpl.h"
#include "Channel.h"
#include "ChannelMgr.h"
#include "Formulas.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "Group.h"
#include "Guild.h"
#include "InstanceScript.h"
#include "Language.h"
#include "OutdoorPvPMgr.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "UpdateFieldFlags.h"
#include "Vehicle.h"
#include "Weather.h"
#include "WeatherMgr.h"
#include "WorldStatePackets.h"
#include "GridNotifiersImpl.h"

Go to the source code of this file.

Functions

int SkillGainChance (uint32 SkillValue, uint32 GrayLevel, uint32 GreenLevel, uint32 YellowLevel)
 
float getProbabilityOfLevelUp (uint32 SkillValue)
 
template<class T >
void UpdateVisibilityOf_helper (GuidUnorderedSet &s64, T *target, std::vector< Unit * > &)
 
template<>
void UpdateVisibilityOf_helper (GuidUnorderedSet &s64, GameObject *target, std::vector< Unit * > &)
 
template<>
void UpdateVisibilityOf_helper (GuidUnorderedSet &s64, Creature *target, std::vector< Unit * > &v)
 
template<>
void UpdateVisibilityOf_helper (GuidUnorderedSet &s64, Player *target, std::vector< Unit * > &v)
 
template<class T >
void BeforeVisibilityDestroy (T *, Player *)
 
template<>
void BeforeVisibilityDestroy< Creature > (Creature *t, Player *p)
 

Variables

constexpr auto ZONE_UPDATE_INTERVAL = 1000
 
static uint32 bonusSkillLevels [] = {75, 150, 225, 300, 375, 450}
 
static const std::size_t bonusSkillLevelsSize
 

Function Documentation

◆ BeforeVisibilityDestroy()

template<class T >
void BeforeVisibilityDestroy ( T *  ,
Player  
)
inline
1622{
1623}

◆ BeforeVisibilityDestroy< Creature >()

template<>
void BeforeVisibilityDestroy< Creature > ( Creature t,
Player p 
)
inline
1627{
1628 if (p->GetPetGUID() == t->GetGUID() && t->IsPet())
1629 ((Pet*) t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
1630}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
Definition: Pet.h:41
bool IsPet() const
Definition: Unit.h:710
ObjectGuid GetPetGUID() const
Definition: Unit.h:1232

References Object::GetGUID(), Unit::GetPetGUID(), Unit::IsPet(), and PET_SAVE_NOT_IN_SLOT.

Referenced by Player::UpdateVisibilityOf().

◆ getProbabilityOfLevelUp()

float getProbabilityOfLevelUp ( uint32  SkillValue)
823{
824 /* According to El's Extreme Angling page, from 1 to 115 the probability of
825 * a skill level up is 100% since 100/1 = 100. From 115 - 135 should average
826 * 2 catches per skill up so that means 100/2 = 50%. This returns the
827 * probability depending on the player's SkillValue.
828 */
829 if (!SkillValue)
830 {
831 return 0.0f;
832 }
833
834 std::array<uint32, 10> bounds {115, 135, 160, 190, 215,
835 295, 315, 355, 425, 450};
836 std::array<float, 11> dens {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f,
837 9.0f, 10.0f, 11.0f, 12.0f, 1.0f};
838 auto it =
839 std::lower_bound(std::begin(bounds), std::end(bounds), SkillValue);
840 return 100 / dens[std::distance(std::begin(bounds), it)];
841}

Referenced by Player::UpdateFishingSkill().

◆ SkillGainChance()

int SkillGainChance ( uint32  SkillValue,
uint32  GrayLevel,
uint32  GreenLevel,
uint32  YellowLevel 
)
inline
709{
710 if (SkillValue >= GrayLevel)
711 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREY) * 10;
712 if (SkillValue >= GreenLevel)
713 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREEN) * 10;
714 if (SkillValue >= YellowLevel)
715 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_YELLOW) * 10;
716 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_ORANGE) * 10;
717}
@ CONFIG_SKILL_CHANCE_ORANGE
Definition: IWorld.h:264
@ CONFIG_SKILL_CHANCE_YELLOW
Definition: IWorld.h:265
@ CONFIG_SKILL_CHANCE_GREY
Definition: IWorld.h:267
@ CONFIG_SKILL_CHANCE_GREEN
Definition: IWorld.h:266
#define sWorld
Definition: World.h:443

References CONFIG_SKILL_CHANCE_GREEN, CONFIG_SKILL_CHANCE_GREY, CONFIG_SKILL_CHANCE_ORANGE, CONFIG_SKILL_CHANCE_YELLOW, and sWorld.

Referenced by Player::UpdateCraftSkill(), and Player::UpdateGatherSkill().

◆ UpdateVisibilityOf_helper() [1/4]

template<>
void UpdateVisibilityOf_helper ( GuidUnorderedSet s64,
Creature target,
std::vector< Unit * > &  v 
)
inline
1607{
1608 s64.insert(target->GetGUID());
1609 v.push_back(target);
1610}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [2/4]

template<>
void UpdateVisibilityOf_helper ( GuidUnorderedSet s64,
GameObject target,
std::vector< Unit * > &   
)
inline
1597{
1598 // @HACK: This is to prevent objects like deeprun tram from disappearing
1599 // when player moves far from its spawn point while riding it
1600 if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
1601 s64.insert(target->GetGUID());
1602}
@ GAMEOBJECT_TYPE_TRANSPORT
Definition: SharedDefines.h:1571
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:137
uint32 type
Definition: GameObjectData.h:33

References GAMEOBJECT_TYPE_TRANSPORT, GameObject::GetGOInfo(), Object::GetGUID(), and GameObjectTemplate::type.

◆ UpdateVisibilityOf_helper() [3/4]

template<>
void UpdateVisibilityOf_helper ( GuidUnorderedSet s64,
Player target,
std::vector< Unit * > &  v 
)
inline
1615{
1616 s64.insert(target->GetGUID());
1617 v.push_back(target);
1618}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [4/4]

template<class T >
void UpdateVisibilityOf_helper ( GuidUnorderedSet s64,
T *  target,
std::vector< Unit * > &   
)
inline
1590{
1591 s64.insert(target->GetGUID());
1592}

Referenced by Player::UpdateVisibilityOf().

Variable Documentation

◆ bonusSkillLevels

uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450}
static

Referenced by Player::UpdateSkillPro().

◆ bonusSkillLevelsSize

const std::size_t bonusSkillLevelsSize
static
Initial value:
=
sizeof(bonusSkillLevels) / sizeof(uint32)
std::uint32_t uint32
Definition: Define.h:107
static uint32 bonusSkillLevels[]
Definition: PlayerUpdates.cpp:866

Referenced by Player::UpdateSkillPro().

◆ ZONE_UPDATE_INTERVAL

constexpr auto ZONE_UPDATE_INTERVAL = 1000
constexpr
Todo:
: this import is not necessary for compilation and marked as unused by the IDE

Referenced by Player::Update(), and Player::UpdateZone().