More build errors fixed

13 errors left at this stage.
This commit is contained in:
Charles A Edwards 2016-01-31 18:58:38 +00:00 committed by Antz
parent 924d182855
commit 669502916a
22 changed files with 279 additions and 56 deletions

View file

@ -40,6 +40,7 @@
#include "Util.h" #include "Util.h"
#include "Formulas.h" #include "Formulas.h"
#include "GridNotifiersImpl.h" #include "GridNotifiersImpl.h"
#include "Chat.h"
namespace MaNGOS namespace MaNGOS
{ {

View file

@ -579,7 +579,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
if (!unit) if (!unit)
return; return;
if (!unit->isSpiritService()) // it's not spirit service if (!unit->IsSpiritService()) // it's not spirit service
return; return;
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer()); unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
@ -600,7 +600,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
if (!unit) if (!unit)
return; return;
if (!unit->isSpiritService()) // it's not spirit service if (!unit->IsSpiritService()) // it's not spirit service
return; return;
sScriptMgr.OnGossipHello(GetPlayer(), unit); sScriptMgr.OnGossipHello(GetPlayer(), unit);

View file

@ -1616,6 +1616,19 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf); return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf);
} }
// return true if this creature is tapped by the player or by a member of his group.
bool Creature::IsTappedBy(Player const* player) const
{
if (player == GetOriginalLootRecipient())
return true;
Group const* playerGroup = player->GetGroup();
if (!playerGroup || playerGroup != GetGroupLootRecipient()) // if we dont have a group we arent the recipient
return false; // if creature doesnt have group bound it means it was solo killed by someone else
return true;
}
SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim) SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
{ {
if (!pVictim) if (!pVictim)
@ -2147,6 +2160,13 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL)); return (itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->GetCategoryRecoveryTime() / IN_MILLISECONDS)) > time(NULL));
} }
uint32 Creature::GetCreatureSpellCooldownDelay(uint32 spellId) const
{
CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spellId);
time_t t = time(NULL);
return uint32(itr != m_CreatureSpellCooldowns.end() && itr->second > t ? itr->second - t : 0);
}
bool Creature::HasSpellCooldown(uint32 spell_id) const bool Creature::HasSpellCooldown(uint32 spell_id) const
{ {
CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id); CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);

View file

@ -511,7 +511,8 @@ class Creature : public Unit
bool IsCorpse() const { return getDeathState() == CORPSE; } bool IsCorpse() const { return getDeathState() == CORPSE; }
bool IsDespawned() const { return getDeathState() == DEAD; } bool IsDespawned() const { return getDeathState() == DEAD; }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; } void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
uint32 GetCorpseDelay() const { return m_corpseDelay; }
bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; } bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; } bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
bool IsGuard() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; } bool IsGuard() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
@ -529,6 +530,7 @@ class Creature : public Unit
bool IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) override; bool IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) override;
bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const override; bool IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const override;
bool IsTappedBy(Player const* player) const;
bool IsElite() const bool IsElite() const
{ {
@ -572,6 +574,7 @@ class Creature : public Unit
void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time); void _AddCreatureSpellCooldown(uint32 spell_id, time_t end_time);
void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time); void _AddCreatureCategoryCooldown(uint32 category, time_t apply_time);
uint32 Creature::GetCreatureSpellCooldownDelay(uint32 spellId) const;
void AddCreatureSpellCooldown(uint32 spellid); void AddCreatureSpellCooldown(uint32 spellid);
bool HasSpellCooldown(uint32 spell_id) const; bool HasSpellCooldown(uint32 spell_id) const;
bool HasCategoryCooldown(uint32 spell_id) const; bool HasCategoryCooldown(uint32 spell_id) const;
@ -726,8 +729,9 @@ class Creature : public Unit
void SendAreaSpiritHealerQueryOpcode(Player* pl); void SendAreaSpiritHealerQueryOpcode(Player* pl);
void SetVirtualItem(VirtualItemSlot slot, uint32 item_id) { SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot, item_id); } void SetVirtualItem(VirtualItemSlot slot, uint32 item_id) { SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + slot, item_id); }
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
bool IsReputationGainDisabled() { return DisableReputationGain; } bool IsReputationGainDisabled() { return DisableReputationGain; }
protected: protected:

View file

@ -707,7 +707,8 @@ class GameObject : public WorldObject
(m_respawnTime > 0 && !m_spawnedByDefault) || (m_respawnTime > 0 && !m_spawnedByDefault) ||
(m_respawnTime == 0 && m_spawnedByDefault); (m_respawnTime == 0 && m_spawnedByDefault);
} }
bool isSpawnedByDefault() const { return m_spawnedByDefault; } bool isSpawnedByDefault() const { return m_spawnedByDefault; }
void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
uint32 GetRespawnDelay() const { return m_respawnDelayTime; } uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
void Refresh(); void Refresh();
void Delete(); void Delete();

View file

@ -244,7 +244,7 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
pl->SetInGuild(m_Id); pl->SetInGuild(m_Id);
pl->SetGuildLevel(GetLevel()); pl->SetGuildLevel(GetLevel());
pl->SetRank(newmember.RankId); pl->SetRank(newmember.RankId);
pl->SetGuildInvited(0); pl->SetGuildIdInvited(0);
} }
UpdateAccountsNumber(); UpdateAccountsNumber();
@ -567,6 +567,17 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
return members.empty(); return members.empty();
} }
bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
{
if (newRank <= GetLowestRank()) // Validate rank (allow only existing ranks)
if (MemberSlot* member = GetMemberSlot(guid))
{
member->ChangeRank(newRank);
return true;
}
return false;
}
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language) void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
{ {
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(), GR_RIGHT_GCHATSPEAK)) if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(), GR_RIGHT_GCHATSPEAK))

View file

@ -35,6 +35,8 @@
class Item; class Item;
#define GUILD_RANK_NONE 0xFF
enum GuildDefaultRanks enum GuildDefaultRanks
{ {
// these ranks can be modified, but they cannot be deleted // these ranks can be modified, but they cannot be deleted
@ -362,6 +364,7 @@ class Guild
void SetLeader(ObjectGuid guid); void SetLeader(ObjectGuid guid);
bool AddMember(ObjectGuid plGuid, uint32 plRank); bool AddMember(ObjectGuid plGuid, uint32 plRank);
bool DelMember(ObjectGuid guid, bool isDisbanding = false); bool DelMember(ObjectGuid guid, bool isDisbanding = false);
bool ChangeMemberRank(ObjectGuid guid, uint8 newRank);
// lowest rank is the count of ranks - 1 (the highest rank_id in table) // lowest rank is the count of ranks - 1 (the highest rank_id in table)
uint32 GetLowestRank() const { return m_Ranks.size() - 1; } uint32 GetLowestRank() const { return m_Ranks.size() - 1; }

View file

@ -184,39 +184,39 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
case ITEM_SUBCLASS_CONTAINER: case ITEM_SUBCLASS_CONTAINER:
return true; return true;
case ITEM_SUBCLASS_SOUL_CONTAINER: case ITEM_SUBCLASS_SOUL_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS)) if (!(pProto->BagFamily & BAG_FAMILY_SOUL_SHARDS))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_HERB_CONTAINER: case ITEM_SUBCLASS_HERB_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS)) if (!(pProto->BagFamily & BAG_FAMILY_HERBS))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_ENCHANTING_CONTAINER: case ITEM_SUBCLASS_ENCHANTING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_ENCHANTING_SUPP))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_MINING_CONTAINER: case ITEM_SUBCLASS_MINING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_ENGINEERING_CONTAINER: case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_GEM_CONTAINER: case ITEM_SUBCLASS_GEM_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS)) if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER: case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_LEATHERWORKING_SUPP))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER: case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_INSCRIPTION_SUPP))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_FISHING_CONTAINER: case ITEM_SUBCLASS_FISHING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_FISHING_SUPP)) if (!(pProto->BagFamily & BAG_FAMILY_FISHING_SUPP))
return false; return false;
return true; return true;
default: default:
@ -226,11 +226,11 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
switch (pBagProto->SubClass) switch (pBagProto->SubClass)
{ {
case ITEM_SUBCLASS_QUIVER: case ITEM_SUBCLASS_QUIVER:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS)) if (!(pProto->BagFamily & BAG_FAMILY_ARROWS))
return false; return false;
return true; return true;
case ITEM_SUBCLASS_AMMO_POUCH: case ITEM_SUBCLASS_AMMO_POUCH:
if (!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS)) if (!(pProto->BagFamily & BAG_FAMILY_BULLETS))
return false; return false;
return true; return true;
default: default:
@ -409,6 +409,13 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
return true; return true;
} }
bool Item::IsNotEmptyBag() const
{
if (Bag const* bag = ToBag())
return !bag->IsEmpty();
return false;
}
void Item::UpdateDuration(Player* owner, uint32 diff) void Item::UpdateDuration(Player* owner, uint32 diff)
{ {
if (!GetUInt32Value(ITEM_FIELD_DURATION)) if (!GetUInt32Value(ITEM_FIELD_DURATION))

View file

@ -308,9 +308,15 @@ class Item : public Object
virtual bool LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid = ObjectGuid()); virtual bool LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid = ObjectGuid());
virtual void DeleteFromDB(); virtual void DeleteFromDB();
void DeleteFromInventoryDB(); void DeleteFromInventoryDB();
void LoadLootFromDB(Field* fields); void LoadLootFromDB(Field* fields);
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; } Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED); }
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; }
bool IsCurrencyToken() const { return GetProto()->IsCurrencyToken(); }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; } bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
bool CanBeTraded(bool mail = false) const; bool CanBeTraded(bool mail = false) const;
void SetInTrade(bool b = true) { mb_in_trade = b; } void SetInTrade(bool b = true) { mb_in_trade = b; }

View file

@ -169,23 +169,23 @@ enum ItemPrototypeFlags2
enum BagFamilyMask enum BagFamilyMask
{ {
BAG_FAMILY_MASK_NONE = 0x00000000, BAG_FAMILY_NONE = 0x00000000,
BAG_FAMILY_MASK_ARROWS = 0x00000001, BAG_FAMILY_ARROWS = 0x00000001,
BAG_FAMILY_MASK_BULLETS = 0x00000002, BAG_FAMILY_BULLETS = 0x00000002,
BAG_FAMILY_MASK_SOUL_SHARDS = 0x00000004, BAG_FAMILY_SOUL_SHARDS = 0x00000004,
BAG_FAMILY_MASK_LEATHERWORKING_SUPP = 0x00000008, BAG_FAMILY_LEATHERWORKING_SUPP = 0x00000008,
BAG_FAMILY_MASK_INSCRIPTION_SUPP = 0x00000010, BAG_FAMILY_INSCRIPTION_SUPP = 0x00000010,
BAG_FAMILY_MASK_HERBS = 0x00000020, BAG_FAMILY_HERBS = 0x00000020,
BAG_FAMILY_MASK_ENCHANTING_SUPP = 0x00000040, BAG_FAMILY_ENCHANTING_SUPP = 0x00000040,
BAG_FAMILY_MASK_ENGINEERING_SUPP = 0x00000080, BAG_FAMILY_ENGINEERING_SUPP = 0x00000080,
BAG_FAMILY_MASK_KEYS = 0x00000100, BAG_FAMILY_KEYS = 0x00000100,
BAG_FAMILY_MASK_GEMS = 0x00000200, BAG_FAMILY_GEMS = 0x00000200,
BAG_FAMILY_MASK_MINING_SUPP = 0x00000400, BAG_FAMILY_MINING_SUPP = 0x00000400,
BAG_FAMILY_MASK_SOULBOUND_EQUIPMENT = 0x00000800, BAG_FAMILY_SOULBOUND_EQUIPMENT = 0x00000800,
BAG_FAMILY_MASK_VANITY_PETS = 0x00001000, BAG_FAMILY_VANITY_PETS = 0x00001000,
BAG_FAMILY_MASK_CURRENCY_TOKENS = 0x00002000, BAG_FAMILY_CURRENCY_TOKENS = 0x00002000,
BAG_FAMILY_MASK_QUEST_ITEMS = 0x00004000, BAG_FAMILY_QUEST_ITEMS = 0x00004000,
BAG_FAMILY_MASK_FISHING_SUPP = 0x00008000, BAG_FAMILY_FISHING_SUPP = 0x00008000,
}; };
enum SocketColor enum SocketColor
@ -652,7 +652,9 @@ struct ItemPrototype
} }
return false; return false;
} }
bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_CURRENCY_TOKENS; }
uint32 GetMaxStackSize() const { return Stackable > 0 ? uint32(Stackable) : uint32(0x7FFFFFFF - 1); } uint32 GetMaxStackSize() const { return Stackable > 0 ? uint32(Stackable) : uint32(0x7FFFFFFF - 1); }
float getDPS() const; float getDPS() const;

View file

@ -788,6 +788,9 @@ enum EnviromentalDamage
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
}; };
/*
* This is defined in Chat.h (just like Zero, One, and Two)
* DELETE THIS IF ALL IS OK
enum PlayerChatTag enum PlayerChatTag
{ {
CHAT_TAG_NONE = 0x00, CHAT_TAG_NONE = 0x00,
@ -798,6 +801,8 @@ enum PlayerChatTag
CHAT_TAG_DEV = 0x10, // Developer CHAT_TAG_DEV = 0x10, // Developer
}; };
*/
enum PlayedTimeIndex enum PlayedTimeIndex
{ {
PLAYED_TIME_TOTAL = 0, PLAYED_TIME_TOTAL = 0,
@ -1747,7 +1752,11 @@ class Player : public Unit
void SetInGuild(uint32 GuildId); void SetInGuild(uint32 GuildId);
void SetGuildLevel(uint32 level) { SetUInt32Value(PLAYER_GUILDLEVEL, level); } void SetGuildLevel(uint32 level) { SetUInt32Value(PLAYER_GUILDLEVEL, level); }
void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); } void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); }
void SetGuildInvited(uint32 GuildId, ObjectGuid inviter = ObjectGuid()) { m_GuildIdInvited = GuildId; m_GuildInviterGuid = inviter; } // void SetGuildInvited(uint32 GuildId, ObjectGuid inviter = ObjectGuid()) { m_GuildIdInvited = GuildId; m_GuildInviterGuid = inviter; } .. PRE Dev21 version (DELETE IT?)
void SetGuildIdInvited(uint32 GuildId)
{
m_GuildIdInvited = GuildId;
}
uint32 GetGuildId() const { return GetGuildGuid().GetCounter(); } uint32 GetGuildId() const { return GetGuildGuid().GetCounter(); }
ObjectGuid GetGuildGuid() const { return GetGuidValue(OBJECT_FIELD_DATA); } ObjectGuid GetGuildGuid() const { return GetGuidValue(OBJECT_FIELD_DATA); }
std::string GetGuildName() const; std::string GetGuildName() const;

View file

@ -5699,6 +5699,21 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 /*SwingType
SendAttackStateUpdate(&dmgInfo); SendAttackStateUpdate(&dmgInfo);
} }
void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
{
CalcDamageInfo dmgInfo;
dmgInfo.HitInfo = HitInfo;
dmgInfo.attacker = this;
dmgInfo.target = target;
dmgInfo.damage = Damage - AbsorbDamage - Resist - BlockedAmount;
dmgInfo.damageSchoolMask = damageSchoolMask;
dmgInfo.absorb = AbsorbDamage;
dmgInfo.resist = Resist;
dmgInfo.TargetState = TargetState;
dmgInfo.blocked_amount = BlockedAmount;
SendAttackStateUpdate(&dmgInfo);
}
void Unit::setPowerType(Powers new_powertype) void Unit::setPowerType(Powers new_powertype)
{ {
SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
@ -9782,7 +9797,7 @@ bool Unit::isInvisibleForAlive() const
if (m_AuraFlags & UNIT_AURAFLAG_ALIVE_INVISIBLE) if (m_AuraFlags & UNIT_AURAFLAG_ALIVE_INVISIBLE)
return true; return true;
// TODO: maybe spiritservices also have just an aura // TODO: maybe spiritservices also have just an aura
return isSpiritService(); return IsSpiritService();
} }
uint32 Unit::GetCreatureType() const uint32 Unit::GetCreatureType() const

View file

@ -2422,7 +2422,8 @@ class Unit : public WorldObject
* \todo What's the swingtype for? * \todo What's the swingtype for?
*/ */
void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
/** void SendAttackStateUpdate(uint32 HitInfo, Unit* target, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
/**
* Used to send a update to the combat log for all \ref Player/\ref Unit s in the vicinity. * Used to send a update to the combat log for all \ref Player/\ref Unit s in the vicinity.
* @param log Info about who/what did damage to who and how etc, data needed for the packet * @param log Info about who/what did damage to who and how etc, data needed for the packet
* \see OpcodesList::SMSG_SPELLNONMELEEDAMAGELOG * \see OpcodesList::SMSG_SPELLNONMELEEDAMAGELOG
@ -3034,7 +3035,8 @@ class Unit : public WorldObject
// delayed+channeled spells are always interrupted // delayed+channeled spells are always interrupted
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0); void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0);
Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; } Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; }
Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; }
Spell* FindCurrentSpellBySpellId(uint32 spell_id) const; Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
bool CheckAndIncreaseCastCounter(); bool CheckAndIncreaseCastCounter();

View file

@ -3062,7 +3062,8 @@ enum SkillType
SKILL_BALANCE = 574, SKILL_BALANCE = 574,
SKILL_DESTRUCTION = 593, SKILL_DESTRUCTION = 593,
SKILL_HOLY2 = 594, SKILL_HOLY2 = 594,
SKILL_DISCIPLINE = 613, SKILL_DISCIPLINE = 613,
SKILL_LOCKPICKING = 633,
SKILL_PET_BAT = 653, SKILL_PET_BAT = 653,
SKILL_PET_HYENA = 654, SKILL_PET_HYENA = 654,
SKILL_PET_BIRD_OF_PREY = 655, SKILL_PET_BIRD_OF_PREY = 655,

View file

@ -26,6 +26,7 @@
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "World.h" #include "World.h"
#include "SocialMgr.h" #include "SocialMgr.h"
#include "Chat.h"
Channel::Channel(const std::string& name, uint32 channel_id) Channel::Channel(const std::string& name, uint32 channel_id)
: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id) : m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id)

View file

@ -3716,6 +3716,78 @@ void ChatHandler::LogCommand(char const* fullcmd)
} }
} }
void ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg msgtype, char const* message, Language language /*= LANG_UNIVERSAL*/, ChatTagFlags chatTag /*= CHAT_TAG_NONE*/,
ObjectGuid const& senderGuid /*= ObjectGuid()*/, char const* senderName /*= NULL*/,
ObjectGuid const& targetGuid /*= ObjectGuid()*/, char const* targetName /*= NULL*/,
char const* channelName /*= NULL*/)
{
bool isGM = chatTag & CHAT_TAG_GM;
data.Initialize(isGM ? SMSG_GM_MESSAGECHAT : SMSG_MESSAGECHAT);
data << uint8(msgtype);
data << uint32(language);
data << ObjectGuid(senderGuid);
data << uint32(0); // 2.1.0
switch (msgtype)
{
case CHAT_MSG_MONSTER_SAY:
case CHAT_MSG_MONSTER_PARTY:
case CHAT_MSG_MONSTER_YELL:
case CHAT_MSG_MONSTER_WHISPER:
case CHAT_MSG_RAID_BOSS_WHISPER:
case CHAT_MSG_RAID_BOSS_EMOTE:
case CHAT_MSG_MONSTER_EMOTE:
MANGOS_ASSERT(senderName);
data << uint32(strlen(senderName) + 1);
data << senderName;
data << ObjectGuid(targetGuid); // Unit Target
if (targetGuid && !targetGuid.IsPlayer() && !targetGuid.IsPet())
{
data << uint32(strlen(targetName) + 1); // target name length
data << targetName; // target name
}
MANGOS_ASSERT(message);
data << uint32(strlen(message) + 1);
data << message;
data << uint8(chatTag);
break;
case CHAT_MSG_BG_SYSTEM_NEUTRAL:
case CHAT_MSG_BG_SYSTEM_ALLIANCE:
case CHAT_MSG_BG_SYSTEM_HORDE:
data << ObjectGuid(targetGuid); // Unit Target
if (targetGuid && !targetGuid.IsPlayer())
{
MANGOS_ASSERT(targetName);
data << uint32(strlen(targetName) + 1); // target name length
data << targetName; // target name
}
MANGOS_ASSERT(message);
data << uint32(strlen(message) + 1);
data << message;
data << uint8(chatTag);
break;
default:
if (msgtype == CHAT_MSG_CHANNEL)
{
MANGOS_ASSERT(channelName);
data << channelName;
}
data << ObjectGuid(targetGuid);
MANGOS_ASSERT(message);
data << uint32(strlen(message) + 1);
data << message;
data << uint8(chatTag);
if (isGM)
{
MANGOS_ASSERT(senderName);
data << uint32(strlen(senderName) + 1);
data << senderName;
}
break;
}
}
// Instantiate template for helper function // Instantiate template for helper function
template void ChatHandler::ShowNpcOrGoSpawnInformation<Creature>(uint32 guid); template void ChatHandler::ShowNpcOrGoSpawnInformation<Creature>(uint32 guid);
template void ChatHandler::ShowNpcOrGoSpawnInformation<GameObject>(uint32 guid); template void ChatHandler::ShowNpcOrGoSpawnInformation<GameObject>(uint32 guid);

View file

@ -69,6 +69,17 @@ enum ChatCommandSearchResult
CHAT_COMMAND_UNKNOWN_SUBCOMMAND, // command found but some level subcommand not find in subcommand list CHAT_COMMAND_UNKNOWN_SUBCOMMAND, // command found but some level subcommand not find in subcommand list
}; };
enum PlayerChatTag
{
CHAT_TAG_NONE = 0,
CHAT_TAG_AFK = 1,
CHAT_TAG_DND = 2,
CHAT_TAG_GM = 3,
CHAT_TAG_COM = 4, // Commentator
CHAT_TAG_DEV = 5, // Developer
};
typedef uint32 ChatTagFlags;
class ChatHandler class ChatHandler
{ {
public: public:
@ -109,7 +120,33 @@ class ChatHandler
ChatCommand const* FindCommand(char const* text); ChatCommand const* FindCommand(char const* text);
bool isValidChatMessage(const char* msg); bool isValidChatMessage(const char* msg);
bool HasSentErrorMessage() { return sentErrorMessage;} bool HasSentErrorMessage() { return sentErrorMessage; }
/**
* \brief Prepare SMSG_GM_MESSAGECHAT/SMSG_MESSAGECHAT
*
* Method: BuildChatPacket build message chat packet generic way
* FullName: ChatHandler::BuildChatPacket
* Access: public static
* Returns: void
*
* \param WorldPacket& data : Provided packet will be filled with requested info
* \param ChatMsg msgtype : Message type from ChatMsg enum from SharedDefines.h
* \param ChatTagFlags chatTag : Chat tag from PlayerChatTag in Chat.h
* \param char const* message : Message to send
* \param Language language : Language from Language enum in SharedDefines.h
* \param ObjectGuid const& senderGuid : May be null in some case but often required for ignore list
* \param char const* senderName : Required for type *MONSTER* or *BATTLENET, but also if GM is true
* \param ObjectGuid const& targetGuid : Often null, but needed for type *MONSTER* or *BATTLENET or *BATTLEGROUND* or *ACHIEVEMENT
* \param char const* targetName : Often null, but needed for type *MONSTER* or *BATTLENET or *BATTLEGROUND*
* \param char const* channelName : Required only for CHAT_MSG_CHANNEL
**/
static void BuildChatPacket(
WorldPacket& data, ChatMsg msgtype, char const* message, Language language = LANG_UNIVERSAL, ChatTagFlags chatTag = CHAT_TAG_NONE,
ObjectGuid const& senderGuid = ObjectGuid(), char const* senderName = NULL,
ObjectGuid const& targetGuid = ObjectGuid(), char const* targetName = NULL,
char const* channelName = NULL);
protected: protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass explicit ChatHandler() : m_session(NULL) {} // for CLI subclass

View file

@ -143,7 +143,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
DEBUG_LOG("Player %s Invited %s to Join his Guild", GetPlayer()->GetName(), Invitedname.c_str()); DEBUG_LOG("Player %s Invited %s to Join his Guild", GetPlayer()->GetName(), Invitedname.c_str());
player->SetGuildInvited(GetPlayer()->GetGuildId(), GetPlayer()->GetObjectGuid()); player->SetGuildIdInvited(GetPlayer()->GetGuildId());
// Put record into guildlog // Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_INVITE_PLAYER, GetPlayer()->GetObjectGuid(), player->GetObjectGuid()); guild->LogGuildEvent(GUILD_EVENT_LOG_INVITE_PLAYER, GetPlayer()->GetObjectGuid(), player->GetObjectGuid());
@ -292,7 +292,7 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& recvPacket)
if (Player* inviter = sObjectMgr.GetPlayer(GetPlayer()->GetGuildInviterGuid())) if (Player* inviter = sObjectMgr.GetPlayer(GetPlayer()->GetGuildInviterGuid()))
inviter->SendGuildDeclined(GetPlayer()->GetName(), recvPacket.GetOpcode() == CMSG_GUILD_AUTO_DECLINE); inviter->SendGuildDeclined(GetPlayer()->GetName(), recvPacket.GetOpcode() == CMSG_GUILD_AUTO_DECLINE);
GetPlayer()->SetGuildInvited(0); GetPlayer()->SetGuildIdInvited(0);
GetPlayer()->SetInGuild(0); GetPlayer()->SetInGuild(0);
GetPlayer()->SetGuildLevel(0); GetPlayer()->SetGuildLevel(0);
} }

View file

@ -198,7 +198,8 @@ class Map : public GridRefManager<NGridType>
bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); } bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); } bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); } bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
bool IsRaidOrHeroicDungeon() const { return IsRaid() || GetDifficulty() > DUNGEON_DIFFICULTY_NORMAL; } bool IsRaidOrHeroicDungeon() const { return IsRaid() || GetDifficulty() > DUNGEON_DIFFICULTY_NORMAL; }
bool IsHeroic() const { return IsRaid() || i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); } bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); }
bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); } bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); } bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); }

View file

@ -92,11 +92,11 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data)
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
if (!pCreature->isTabardDesigner()) if (!pCreature->IsTabardDesigner())
{ {
sLog.outError("WORLD: HandlePetitionBuyOpcode - unsupported npc type, npc: %s", guidNPC.GetString().c_str()); sLog.outError("WORLD: HandlePetitionBuyOpcode - unsupported npc type, npc: %s", guidNPC.GetString().c_str());
return; return;
} }
if (sGuildMgr.GetGuildByName(name)) if (sGuildMgr.GetGuildByName(name))
{ {
@ -678,7 +678,7 @@ void WorldSession::SendPetitionShowList(ObjectGuid guid)
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
// only guild petitions currently used // only guild petitions currently used
if (!pCreature->isTabardDesigner()) if (!pCreature->IsTabardDesigner())
{ {
DEBUG_LOG("WORLD: HandlePetitionShowListOpcode - %s is not supported npc type.", guid.GetString().c_str()); DEBUG_LOG("WORLD: HandlePetitionShowListOpcode - %s is not supported npc type.", guid.GetString().c_str());
return; return;

View file

@ -2440,10 +2440,10 @@ namespace LuaPlayer
bool no_cost = Eluna::CHECKVAL<bool>(L, 2, true); bool no_cost = Eluna::CHECKVAL<bool>(L, 2, true);
#ifdef CATA #ifdef CATA
player->ResetTalents(no_cost); player->resetTalents(no_cost);
#else #else
#ifdef TRINITY #ifdef TRINITY
player->ResetTalents(no_cost); player->resetTalents(no_cost);
#else #else
player->resetTalents(no_cost); player->resetTalents(no_cost);
#endif #endif

View file

@ -102,7 +102,19 @@ class Field
* *
* @return bool * @return bool
*/ */
bool GetBool() const { return mValue ? atoi(mValue) > 0 : false; } bool GetBool() const { return mValue ? atoi(mValue) > 0 : false; }
/**
* @brief
*
* @return double
*/
double GetDouble() const { return mValue ? static_cast<double>(atof(mValue)) : 0.0f; }
/**
* @brief
*
* @return int8
*/
int8 GetInt8() const { return mValue ? static_cast<int8>(atol(mValue)) : int8(0); }
/** /**
* @brief * @brief
* *
@ -145,8 +157,26 @@ class Field
return 0; return 0;
return value; return value;
} }
/**
* @brief
*
* @return int64
*/
uint64 GetInt64() const
{
int64 value = 0;
if (!mValue || sscanf(mValue, SI64FMTD, &value) == -1)
return 0;
return value;
}
/**
* @brief
*
* @param type
*/
void SetType(enum DataTypes type) { mType = type; } void SetType(enum DataTypes type) { mType = type; }
/** /**