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 "WorldState.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
1672{
1673}

◆ BeforeVisibilityDestroy< Creature >()

template<>
void BeforeVisibilityDestroy< Creature > ( Creature t,
Player p 
)
inline
1677{
1678 if (p->GetPetGUID() == t->GetGUID() && t->IsPet())
1679 ((Pet*) t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
1680}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Definition Pet.h:41
bool IsPet() const
Definition Unit.h:763
ObjectGuid GetPetGUID() const
Definition Unit.h:694

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

Referenced by Player::UpdateVisibilityOf().

◆ getProbabilityOfLevelUp()

float getProbabilityOfLevelUp ( uint32  SkillValue)
866{
867 /* According to El's Extreme Angling page, from 1 to 115 the probability of
868 * a skill level up is 100% since 100/1 = 100. From 115 - 135 should average
869 * 2 catches per skill up so that means 100/2 = 50%. This returns the
870 * probability depending on the player's SkillValue.
871 */
872 if (!SkillValue)
873 {
874 return 0.0f;
875 }
876
877 std::array<uint32, 10> bounds {115, 135, 160, 190, 215,
878 295, 315, 355, 425, 450};
879 std::array<float, 11> dens {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f,
880 9.0f, 10.0f, 11.0f, 12.0f, 1.0f};
881 auto it =
882 std::lower_bound(std::begin(bounds), std::end(bounds), SkillValue);
883 return 100 / dens[std::distance(std::begin(bounds), it)];
884}

Referenced by Player::UpdateFishingSkill().

◆ SkillGainChance()

int SkillGainChance ( uint32  SkillValue,
uint32  GrayLevel,
uint32  GreenLevel,
uint32  YellowLevel 
)
inline
752{
753 if (SkillValue >= GrayLevel)
754 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREY) * 10;
755 if (SkillValue >= GreenLevel)
756 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_GREEN) * 10;
757 if (SkillValue >= YellowLevel)
758 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_YELLOW) * 10;
759 return sWorld->getIntConfig(CONFIG_SKILL_CHANCE_ORANGE) * 10;
760}
@ 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:363

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
1657{
1658 s64.insert(target->GetGUID());
1659 v.push_back(target);
1660}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [2/4]

template<>
void UpdateVisibilityOf_helper ( GuidUnorderedSet s64,
GameObject target,
std::vector< Unit * > &   
)
inline
1647{
1648 // @HACK: This is to prevent objects like deeprun tram from disappearing
1649 // when player moves far from its spawn point while riding it
1650 if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
1651 s64.insert(target->GetGUID());
1652}
@ GAMEOBJECT_TYPE_TRANSPORT
Definition SharedDefines.h:1571
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:136
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
1665{
1666 s64.insert(target->GetGUID());
1667 v.push_back(target);
1668}

References Object::GetGUID().

◆ UpdateVisibilityOf_helper() [4/4]

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

Referenced by Player::UpdateVisibilityOf().

Variable Documentation

◆ bonusSkillLevels

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

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:909

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