AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ServerMailReward Class Reference
Inheritance diagram for ServerMailReward:
PlayerScript ScriptObject

Public Member Functions

 ServerMailReward ()
 
void OnLogin (Player *player) override
 
- Public Member Functions inherited from PlayerScript
virtual void OnPlayerJustDied (Player *)
 
virtual void OnCalculateTalentsPoints (Player const *, uint32 &)
 
virtual void OnPlayerReleasedGhost (Player *)
 
virtual void OnSendInitialPacketsBeforeAddToMap (Player *, WorldPacket &)
 
virtual void OnBattlegroundDesertion (Player *, BattlegroundDesertionType const)
 
virtual void OnPlayerCompleteQuest (Player *, Quest const *)
 
virtual void OnPVPKill (Player *, Player *)
 
virtual void OnPlayerPVPFlagChange (Player *, bool)
 
virtual void OnCreatureKill (Player *, Creature *)
 
virtual void OnCreatureKilledByPet (Player *, Creature *)
 
virtual void OnPlayerKilledByCreature (Creature *, Player *)
 
virtual void OnLevelChanged (Player *, uint8)
 
virtual void OnFreeTalentPointsChanged (Player *, uint32)
 
virtual void OnTalentsReset (Player *, bool)
 
virtual void OnAfterSpecSlotChanged (Player *, uint8)
 
virtual void OnBeforeUpdate (Player *, uint32)
 
virtual void OnUpdate (Player *, uint32)
 
virtual void OnMoneyChanged (Player *, int32 &)
 
virtual void OnBeforeLootMoney (Player *, Loot *)
 
virtual void OnGiveXP (Player *, uint32 &, Unit *, uint8)
 
virtual bool OnReputationChange (Player *, uint32, int32 &, bool)
 
virtual void OnReputationRankChange (Player *, uint32, ReputationRank, ReputationRank, bool)
 
virtual void OnLearnSpell (Player *, uint32)
 
virtual void OnForgotSpell (Player *, uint32)
 
virtual void OnDuelRequest (Player *, Player *)
 
virtual void OnDuelStart (Player *, Player *)
 
virtual void OnDuelEnd (Player *, Player *, DuelCompleteType)
 
virtual void OnChat (Player *, uint32, uint32, std::string &)
 
virtual void OnBeforeSendChatMessage (Player *, uint32 &, uint32 &, std::string &)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Player *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Group *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Guild *)
 
virtual void OnChat (Player *, uint32, uint32, std::string &, Channel *)
 
virtual void OnEmote (Player *, uint32)
 
virtual void OnTextEmote (Player *, uint32, uint32, ObjectGuid)
 
virtual void OnSpellCast (Player *, Spell *, bool)
 
virtual void OnLoadFromDB (Player *)
 
virtual void OnLogin (Player *)
 
virtual void OnBeforeLogout (Player *)
 
virtual void OnLogout (Player *)
 
virtual void OnCreate (Player *)
 
virtual void OnDelete (ObjectGuid, uint32)
 
virtual void OnFailedDelete (ObjectGuid, uint32)
 
virtual void OnSave (Player *)
 
virtual void OnBindToInstance (Player *, Difficulty, uint32, bool)
 
virtual void OnUpdateZone (Player *, uint32, uint32)
 
virtual void OnUpdateArea (Player *, uint32, uint32)
 
virtual void OnMapChanged (Player *)
 
virtual bool OnBeforeTeleport (Player *, uint32, float, float, float, float, uint32, Unit *)
 
virtual void OnUpdateFaction (Player *)
 
virtual void OnAddToBattleground (Player *, Battleground *)
 
virtual void OnQueueRandomDungeon (Player *, uint32 &)
 
virtual void OnRemoveFromBattleground (Player *, Battleground *)
 
virtual void OnAchiComplete (Player *, AchievementEntry const *)
 
virtual bool OnBeforeAchiComplete (Player *, AchievementEntry const *)
 
virtual void OnCriteriaProgress (Player *, AchievementCriteriaEntry const *)
 
virtual bool OnBeforeCriteriaProgress (Player *, AchievementCriteriaEntry const *)
 
virtual void OnAchiSave (CharacterDatabaseTransaction, Player *, uint16, CompletedAchievementData)
 
virtual void OnCriteriaSave (CharacterDatabaseTransaction, Player *, uint16, CriteriaProgress)
 
virtual void OnGossipSelect (Player *, uint32, uint32, uint32)
 
virtual void OnGossipSelectCode (Player *, uint32, uint32, uint32, const char *)
 
virtual void OnBeingCharmed (Player *, Unit *, uint32, uint32)
 
virtual void OnAfterSetVisibleItemSlot (Player *, uint8, Item *)
 
virtual void OnAfterMoveItemFromInventory (Player *, Item *, uint8, uint8, bool)
 
virtual void OnEquip (Player *, Item *, uint8, uint8, bool)
 
virtual void OnPlayerJoinBG (Player *)
 
virtual void OnPlayerJoinArena (Player *)
 
virtual void OnGetMaxPersonalArenaRatingRequirement (Player const *, uint32, uint32 &) const
 
virtual void OnLootItem (Player *, Item *, uint32, ObjectGuid)
 
virtual void OnBeforeFillQuestLootItem (Player *, LootItem &)
 
virtual void OnStoreNewItem (Player *, Item *, uint32)
 
virtual void OnCreateItem (Player *, Item *, uint32)
 
virtual void OnQuestRewardItem (Player *, Item *, uint32)
 
virtual bool CanPlaceAuctionBid (Player *, AuctionEntry *)
 
virtual void OnGroupRollRewardItem (Player *, Item *, uint32, RollVote, Roll *)
 
virtual bool OnBeforeOpenItem (Player *, Item *)
 
virtual bool OnBeforeQuestComplete (Player *, uint32)
 
virtual void OnQuestComputeXP (Player *, Quest const *, uint32 &)
 
virtual void OnBeforeDurabilityRepair (Player *, ObjectGuid, ObjectGuid, float &, uint8)
 
virtual void OnBeforeBuyItemFromVendor (Player *, ObjectGuid, uint32, uint32 &, uint8, uint8, uint8)
 
virtual void OnBeforeStoreOrEquipNewItem (Player *, uint32, uint32 &, uint8, uint8, uint8, ItemTemplate const *, Creature *, VendorItem const *, bool)
 
virtual void OnAfterStoreOrEquipNewItem (Player *, uint32, Item *, uint8, uint8, uint8, ItemTemplate const *, Creature *, VendorItem const *, bool)
 
virtual void OnAfterUpdateMaxPower (Player *, Powers &, float &)
 
virtual void OnAfterUpdateMaxHealth (Player *, float &)
 
virtual void OnBeforeUpdateAttackPowerAndDamage (Player *, float &, float &, bool)
 
virtual void OnAfterUpdateAttackPowerAndDamage (Player *, float &, float &, float &, float &, bool)
 
virtual void OnBeforeInitTalentForLevel (Player *, uint8 &, uint32 &)
 
virtual void OnFirstLogin (Player *)
 
virtual void OnSetMaxLevel (Player *, uint32 &)
 
virtual bool CanJoinInBattlegroundQueue (Player *, ObjectGuid, BattlegroundTypeId, uint8, GroupJoinBattlegroundResult &)
 
virtual bool ShouldBeRewardedWithMoneyInsteadOfExp (Player *)
 
virtual void OnBeforeTempSummonInitStats (Player *, TempSummon *, uint32 &)
 
virtual void OnBeforeGuardianInitStatsForLevel (Player *, Guardian *, CreatureTemplate const *, PetType &)
 
virtual void OnAfterGuardianInitStatsForLevel (Player *, Guardian *)
 
virtual void OnBeforeLoadPetFromDB (Player *, uint32 &, uint32 &, bool &, bool &)
 
virtual bool CanJoinInArenaQueue (Player *, ObjectGuid, uint8, BattlegroundTypeId, uint8, uint8, GroupJoinBattlegroundResult &)
 
virtual bool CanBattleFieldPort (Player *, uint8, BattlegroundTypeId, uint8)
 
virtual bool CanGroupInvite (Player *, std::string &)
 
virtual bool CanGroupAccept (Player *, Group *)
 
virtual bool CanSellItem (Player *, Item *, Creature *)
 
virtual bool CanSendMail (Player *, ObjectGuid, ObjectGuid, std::string &, std::string &, uint32, uint32, Item *)
 
virtual void PetitionBuy (Player *, Creature *, uint32 &, uint32 &, uint32 &)
 
virtual void PetitionShowList (Player *, Creature *, uint32 &, uint32 &, uint32 &)
 
virtual void OnRewardKillRewarder (Player *, KillRewarder *, bool, float &)
 
virtual bool CanGiveMailRewardAtGiveLevel (Player *, uint8)
 
virtual void OnDeleteFromDB (CharacterDatabaseTransaction, uint32)
 
virtual bool CanRepopAtGraveyard (Player *)
 
virtual Optional< bool > OnPlayerIsClass (Player const *, Classes, ClassContext)
 
virtual void OnGetMaxSkillValue (Player *, uint32, int32 &, bool)
 
virtual bool OnPlayerHasActivePowerType (Player const *, Powers)
 
virtual void OnUpdateGatheringSkill (Player *, uint32, uint32, uint32, uint32, uint32, uint32 &)
 This hook called before gathering skill gain is applied to the character. More...
 
virtual void OnUpdateCraftingSkill (Player *, SkillLineAbilityEntry const *, uint32, uint32 &)
 This hook is called before crafting skill gain is applied to the character. More...
 
virtual bool OnUpdateFishingSkill (Player *, int32, int32, int32, int32)
 
virtual bool CanAreaExploreAndOutdoor (Player *)
 
virtual void OnVictimRewardBefore (Player *, Player *, uint32 &, uint32 &)
 
virtual void OnVictimRewardAfter (Player *, Player *, uint32 &, uint32 &, float &)
 
virtual void OnCustomScalingStatValueBefore (Player *, ItemTemplate const *, uint8, bool, uint32 &)
 
virtual void OnCustomScalingStatValue (Player *, ItemTemplate const *, uint32 &, int32 &, uint8, uint32, ScalingStatValuesEntry const *)
 
virtual void OnApplyItemModsBefore (Player *, uint8, bool, uint8, uint32, int32 &)
 
virtual void OnApplyEnchantmentItemModsBefore (Player *, Item *, EnchantmentSlot, bool, uint32, uint32 &)
 
virtual void OnApplyWeaponDamage (Player *, uint8, ItemTemplate const *, float &, float &, uint8)
 
virtual bool CanArmorDamageModifier (Player *)
 
virtual void OnGetFeralApBonus (Player *, int32 &, int32, ItemTemplate const *, ScalingStatValuesEntry const *)
 
virtual bool CanApplyWeaponDependentAuraDamageMod (Player *, Item *, WeaponAttackType, AuraEffect const *, bool)
 
virtual bool CanApplyEquipSpell (Player *, SpellInfo const *, Item *, bool, bool)
 
virtual bool CanApplyEquipSpellsItemSet (Player *, ItemSetEffect *)
 
virtual bool CanCastItemCombatSpell (Player *, Unit *, WeaponAttackType, uint32, uint32, Item *, ItemTemplate const *)
 
virtual bool CanCastItemUseSpell (Player *, Item *, SpellCastTargets const &, uint8, uint32)
 
virtual void OnApplyAmmoBonuses (Player *, ItemTemplate const *, float &)
 
virtual bool CanEquipItem (Player *, uint8, uint16 &, Item *, bool, bool)
 
virtual bool CanUnequipItem (Player *, uint16, bool)
 
virtual bool CanUseItem (Player *, ItemTemplate const *, InventoryResult &)
 
virtual bool CanSaveEquipNewItem (Player *, Item *, uint16, bool)
 
virtual bool CanApplyEnchantment (Player *, Item *, EnchantmentSlot, bool, bool, bool)
 
virtual void OnGetQuestRate (Player *, float &)
 
virtual bool PassedQuestKilledMonsterCredit (Player *, Quest const *, uint32, uint32, ObjectGuid)
 
virtual bool CheckItemInSlotAtLoadInventory (Player *, Item *, uint8, uint8 &, uint16 &)
 
virtual bool NotAvoidSatisfy (Player *, DungeonProgressionRequirements const *, uint32, bool)
 
virtual bool NotVisibleGloballyFor (Player *, Player const *)
 
virtual void OnGetArenaPersonalRating (Player *, uint8, uint32 &)
 
virtual void OnGetArenaTeamId (Player *, uint8, uint32 &)
 
virtual void OnIsFFAPvP (Player *, bool &)
 
virtual void OnFfaPvpStateUpdate (Player *, bool)
 
virtual void OnIsPvP (Player *, bool &)
 
virtual void OnGetMaxSkillValueForLevel (Player *, uint16 &)
 
virtual bool NotSetArenaTeamInfoField (Player *, uint8, ArenaTeamInfoType, uint32)
 
virtual bool CanJoinLfg (Player *, uint8, std::set< uint32 > &, const std::string &)
 
virtual bool CanEnterMap (Player *, MapEntry const *, InstanceTemplate const *, MapDifficulty const *, bool)
 
virtual bool CanInitTrade (Player *, Player *)
 
virtual bool CanSetTradeItem (Player *, Item *, uint8)
 This hook called just before finishing the handling of the action of a player setting an item in a trade slot. More...
 
virtual void OnSetServerSideVisibility (Player *, ServerSideVisibilityType &, AccountTypes &)
 
virtual void OnSetServerSideVisibilityDetect (Player *, ServerSideVisibilityType &, AccountTypes &)
 
virtual void OnPlayerResurrect (Player *, float, bool)
 
virtual void OnBeforeChooseGraveyard (Player *, TeamId, bool, uint32 &)
 
virtual bool CanPlayerUseChat (Player *, uint32, uint32, std::string &)
 This hook called before player sending message in default chat. More...
 
virtual bool CanPlayerUseChat (Player *, uint32, uint32, std::string &, Player *)
 This hook called before player sending message to other player via private. More...
 
virtual bool CanPlayerUseChat (Player *, uint32, uint32, std::string &, Group *)
 This hook called before player sending message to group. More...
 
virtual bool CanPlayerUseChat (Player *, uint32, uint32, std::string &, Guild *)
 This hook called before player sending message to guild. More...
 
virtual bool CanPlayerUseChat (Player *, uint32, uint32, std::string &, Channel *)
 This hook called before player sending message to channel. More...
 
virtual void OnPlayerLearnTalents (Player *, uint32, uint32, uint32)
 This hook called after player learning talents. More...
 
virtual void OnPlayerEnterCombat (Player *, Unit *)
 This hook called after player entering combat. More...
 
virtual void OnPlayerLeaveCombat (Player *)
 This hook called after player leave combat. More...
 
virtual void OnQuestAbandon (Player *, uint32)
 This hook called after player abandoning quest. More...
 
virtual bool OnCanPlayerFlyInZone (Player *, uint32, uint32, SpellInfo const *)
 This hook called before other CanFlyChecks are applied. More...
 
virtual void AnticheatSetCanFlybyServer (Player *, bool)
 
virtual void AnticheatSetUnderACKmount (Player *)
 
virtual void AnticheatSetRootACKUpd (Player *)
 
virtual void AnticheatSetJumpingbyOpcode (Player *, bool)
 
virtual void AnticheatUpdateMovementInfo (Player *, MovementInfo const &)
 
virtual bool AnticheatHandleDoubleJump (Player *, Unit *)
 
virtual bool AnticheatCheckMovementInfo (Player *, MovementInfo const &, Unit *, bool)
 
virtual bool CanSendErrorAlreadyLooted (Player *)
 This hook is called, to avoid displaying the error message that the body has already been stripped. More...
 
virtual void OnAfterCreatureLoot (Player *)
 It is used when an item is taken from a creature. More...
 
virtual void OnAfterCreatureLootMoney (Player *)
 After a creature's money is taken. More...
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Additional Inherited Members

- Protected Member Functions inherited from PlayerScript
 PlayerScript (const char *name, std::vector< uint16 > enabledHooks=std::vector< uint16 >())
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ ServerMailReward()

ServerMailReward::ServerMailReward ( )
inline
27: PlayerScript("ServerMailReward", {PLAYERHOOK_ON_LOGIN}) { }
@ PLAYERHOOK_ON_LOGIN
Definition: PlayerScript.h:68
Definition: PlayerScript.h:211

References PLAYERHOOK_ON_LOGIN.

Member Function Documentation

◆ OnLogin()

void ServerMailReward::OnLogin ( Player player)
inlineoverridevirtual

Reimplemented from PlayerScript.

31 {
32 // Retrieve all server mail records and session only once
33 auto const& serverMailStore = sObjectMgr->GetAllServerMailStore();
34 WorldSession* session = player->GetSession();
35 // We should always have a session, just incase
36 if (!session)
37 return;
38
39 uint32 playerGUID = player->GetGUID().GetCounter();
40
41 for (auto const& [mailId, servMail] : serverMailStore)
42 {
44 stmt->SetData(0, playerGUID);
45 stmt->SetData(1, mailId);
46
47 // Capture servMail by value
48 auto callback = [session, servMailWrapper = std::reference_wrapper<ServerMail const>(servMail)](PreparedQueryResult result)
49 {
50 ServerMail const& servMail = servMailWrapper.get(); // Dereference the wrapper to get the original object
51
52 if (!result)
53 {
54 sObjectMgr->SendServerMail(
55 session->GetPlayer(),
56 servMail.id,
57 servMail.reqLevel,
58 servMail.reqPlayTime,
59 servMail.moneyA,
60 servMail.moneyH,
61 servMail.itemA,
62 servMail.itemCountA,
63 servMail.itemH,
64 servMail.itemCountH,
65 servMail.subject,
66 servMail.body,
67 servMail.active
68 );
69 }
70 };
71
72 // Execute the query asynchronously and add the callback
73 session->GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(callback));
74 }
75 }
std::uint32_t uint32
Definition: Define.h:107
#define sObjectMgr
Definition: ObjectMgr.h:1635
@ CHAR_SEL_MAIL_SERVER_CHARACTER
Definition: CharacterDatabase.h:84
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:45
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
T & AddCallback(T &&query)
Definition: AsyncCallbackProcessor.h:34
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
LowType GetCounter() const
Definition: ObjectGuid.h:145
WorldSession * GetSession() const
Definition: Player.h:1998
Definition: Mail.h:214
uint32 moneyH
Definition: Mail.h:220
std::string subject
Definition: Mail.h:225
uint8 active
Definition: Mail.h:227
uint32 itemA
Definition: Mail.h:221
uint8 reqLevel
Definition: Mail.h:217
std::string body
Definition: Mail.h:226
uint32 moneyA
Definition: Mail.h:219
uint32 id
Definition: Mail.h:216
uint32 itemH
Definition: Mail.h:223
uint32 itemCountA
Definition: Mail.h:222
uint32 reqPlayTime
Definition: Mail.h:218
uint32 itemCountH
Definition: Mail.h:224
Player session in the World.
Definition: WorldSession.h:330
Player * GetPlayer() const
Definition: WorldSession.h:362
QueryCallbackProcessor & GetQueryProcessor()
Definition: WorldSession.h:1077

References ServerMail::active, AsyncCallbackProcessor< T >::AddCallback(), ServerMail::body, CHAR_SEL_MAIL_SERVER_CHARACTER, CharacterDatabase, ObjectGuid::GetCounter(), Object::GetGUID(), WorldSession::GetPlayer(), WorldSession::GetQueryProcessor(), Player::GetSession(), ServerMail::id, ServerMail::itemA, ServerMail::itemCountA, ServerMail::itemCountH, ServerMail::itemH, ServerMail::moneyA, ServerMail::moneyH, ServerMail::reqLevel, ServerMail::reqPlayTime, PreparedStatementBase::SetData(), sObjectMgr, and ServerMail::subject.