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 size_t bonusSkillLevelsSize
 

Function Documentation

◆ BeforeVisibilityDestroy()

template<class T >
void BeforeVisibilityDestroy ( T *  ,
Player  
)
inline
1626{
1627}

◆ BeforeVisibilityDestroy< Creature >()

template<>
void BeforeVisibilityDestroy< Creature > ( Creature t,
Player p 
)
inline
1631{
1632 if (p->GetPetGUID() == t->GetGUID() && t->IsPet())
1633 ((Pet*) t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
1634}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Definition: Pet.h:40
bool IsPet() const
Definition: Unit.h:1425
ObjectGuid GetPetGUID() const
Definition: Unit.h:1838

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

Referenced by Player::UpdateVisibilityOf().

◆ getProbabilityOfLevelUp()

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

Referenced by Player::UpdateFishingSkill().

◆ SkillGainChance()

int SkillGainChance ( uint32  SkillValue,
uint32  GrayLevel,
uint32  GreenLevel,
uint32  YellowLevel 
)
inline
713{
714 if (SkillValue >= GrayLevel)
715 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREY) * 10;
716 if (SkillValue >= GreenLevel)
717 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREEN) * 10;
718 if (SkillValue >= YellowLevel)
719 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_YELLOW) * 10;
720 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_ORANGE) * 10;
721}
@ CONFIG_SKILL_CHANCE_ORANGE
Definition: IWorld.h:265
@ CONFIG_SKILL_CHANCE_YELLOW
Definition: IWorld.h:266
@ CONFIG_SKILL_CHANCE_GREY
Definition: IWorld.h:268
@ CONFIG_SKILL_CHANCE_GREEN
Definition: IWorld.h:267
#define sWorld
Definition: World.h:447

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
1611{
1612 s64.insert(target->GetGUID());
1613 v.push_back(target);
1614}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [2/4]

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

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
1619{
1620 s64.insert(target->GetGUID());
1621 v.push_back(target);
1622}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [4/4]

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

Referenced by Player::UpdateVisibilityOf().

Variable Documentation

◆ bonusSkillLevels

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

Referenced by Player::UpdateSkillPro().

◆ bonusSkillLevelsSize

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

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().