mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Some work on visible auras
This commit is contained in:
parent
90b0c47592
commit
1d3667e765
7 changed files with 66 additions and 52 deletions
|
|
@ -62,7 +62,7 @@ bool LoginQueryHolder::Initialize()
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u' ORDER by spell,effect_index", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,slot,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,slot,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL },
|
{ "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL },
|
||||||
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
|
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
|
||||||
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
|
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
|
||||||
{ "chardelete", SEC_CONSOLE, true, &ChatHandler::HandleCombatStopCommand, "", NULL },
|
{ "chardelete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL },
|
||||||
{ "sendmessage", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL },
|
{ "sendmessage", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL },
|
||||||
{ "repairitems", SEC_GAMEMASTER, false, &ChatHandler::HandleRepairitemsCommand, "", NULL },
|
{ "repairitems", SEC_GAMEMASTER, false, &ChatHandler::HandleRepairitemsCommand, "", NULL },
|
||||||
{ "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL },
|
{ "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL },
|
||||||
|
|
|
||||||
|
|
@ -17756,26 +17756,30 @@ void Player::SendAurasForTarget(Unit *target)
|
||||||
WorldPacket data(SMSG_AURA_UPDATE_ALL);
|
WorldPacket data(SMSG_AURA_UPDATE_ALL);
|
||||||
data.append(target->GetPackGUID());
|
data.append(target->GetPackGUID());
|
||||||
|
|
||||||
for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr)
|
Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras();
|
||||||
|
for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
|
||||||
|
{
|
||||||
|
for(uint32 j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
if(Aura *aura = target->GetAura(itr->second, j))
|
||||||
{
|
{
|
||||||
Aura* aura = itr->second;
|
|
||||||
if(aura->GetAuraSlot() >= MAX_AURAS || aura->IsPassive() || aura->GetCasterGUID()!=GetGUID())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
data << uint8(aura->GetAuraSlot());
|
data << uint8(aura->GetAuraSlot());
|
||||||
data << uint32(aura->GetId());
|
data << uint32(aura->GetId());
|
||||||
|
|
||||||
if(aura->GetId())
|
if(aura->GetId())
|
||||||
{
|
{
|
||||||
uint8 auraFlags = aura->GetAuraFlags();
|
uint8 auraFlags = aura->GetAuraFlags();
|
||||||
data << uint8(auraFlags); // flags
|
// flags
|
||||||
data << uint8(aura->GetAuraLevel()); // level
|
data << uint8(auraFlags);
|
||||||
data << uint8(aura->m_procCharges); // charges
|
// level
|
||||||
|
data << uint8(aura->GetAuraLevel());
|
||||||
|
// charges
|
||||||
|
data << uint8(aura->m_procCharges);
|
||||||
|
|
||||||
/*if(!(auraFlags & AFLAG_NOT_GUID))
|
if(!(auraFlags & AFLAG_NOT_GUID))
|
||||||
{
|
{
|
||||||
data << uint8(0) // packed GUID of someone (caster?)
|
data << uint8(0); // packed GUID of someone (caster?)
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if(auraFlags & AFLAG_DURATION) // include aura duration
|
if(auraFlags & AFLAG_DURATION) // include aura duration
|
||||||
{
|
{
|
||||||
|
|
@ -17783,6 +17787,9 @@ void Player::SendAurasForTarget(Unit *target)
|
||||||
data << uint32(aura->GetAuraDuration());
|
data << uint32(aura->GetAuraDuration());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
#ifndef MANGOS_SPELLAURADEFINES_H
|
#ifndef MANGOS_SPELLAURADEFINES_H
|
||||||
#define MANGOS_SPELLAURADEFINES_H
|
#define MANGOS_SPELLAURADEFINES_H
|
||||||
|
|
||||||
#define MAX_AURAS 56 // probably changes to 64 in WotLK
|
#define MAX_AURAS 64 // client support up to 255, but it will cause problems with group auras updating
|
||||||
#define MAX_POSITIVE_AURAS 40
|
|
||||||
|
|
||||||
enum AURA_FLAGS
|
enum AURA_FLAGS
|
||||||
{
|
{
|
||||||
|
|
@ -27,14 +26,11 @@ enum AURA_FLAGS
|
||||||
AFLAG_EFF_INDEX_0 = 0x01,
|
AFLAG_EFF_INDEX_0 = 0x01,
|
||||||
AFLAG_EFF_INDEX_1 = 0x02,
|
AFLAG_EFF_INDEX_1 = 0x02,
|
||||||
AFLAG_EFF_INDEX_2 = 0x04,
|
AFLAG_EFF_INDEX_2 = 0x04,
|
||||||
AFLAG_NOT_GUID = 0x08,
|
AFLAG_NOT_GUID = 0x08, // caster guid?
|
||||||
AFLAG_UNK1 = 0x10, // positive?
|
AFLAG_UNK1 = 0x10, // positive?
|
||||||
AFLAG_DURATION = 0x20,
|
AFLAG_DURATION = 0x20,
|
||||||
AFLAG_UNK2 = 0x40,
|
AFLAG_UNK2 = 0x40,
|
||||||
AFLAG_UNK3 = 0x80,
|
AFLAG_NEGATIVE = 0x80
|
||||||
AFLAG_NEGATIVE = 0x09,
|
|
||||||
AFLAG_POSITIVE = 0x1F,
|
|
||||||
AFLAG_MASK = 0xFF
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//m_schoolAbsorb
|
//m_schoolAbsorb
|
||||||
|
|
|
||||||
|
|
@ -947,22 +947,13 @@ void Aura::_AddAura()
|
||||||
{
|
{
|
||||||
if(!samespell) // new slot need
|
if(!samespell) // new slot need
|
||||||
{
|
{
|
||||||
if (IsPositive()) // empty positive slot
|
if(m_target->GetVisibleAurasCount() < MAX_AURAS)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < MAX_POSITIVE_AURAS; i++)
|
Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras();
|
||||||
|
for(uint8 i = 0; i < MAX_AURAS; ++i)
|
||||||
{
|
{
|
||||||
if (m_target->GetVisibleAura(i) == 0)
|
Unit::VisibleAuraMap::const_iterator itr = visibleAuras->find(i);
|
||||||
{
|
if(itr == visibleAuras->end())
|
||||||
slot = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // empty negative slot
|
|
||||||
{
|
|
||||||
for (uint8 i = MAX_POSITIVE_AURAS; i < MAX_AURAS; i++)
|
|
||||||
{
|
|
||||||
if (m_target->GetVisibleAura(i) == 0)
|
|
||||||
{
|
{
|
||||||
slot = i;
|
slot = i;
|
||||||
break;
|
break;
|
||||||
|
|
@ -978,7 +969,7 @@ void Aura::_AddAura()
|
||||||
if(slot < MAX_AURAS) // slot found
|
if(slot < MAX_AURAS) // slot found
|
||||||
{
|
{
|
||||||
SetAura(false);
|
SetAura(false);
|
||||||
SetAuraFlags(AFLAG_EFF_INDEX_0 | AFLAG_NOT_GUID | (GetAuraMaxDuration() ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_UNK1 : AFLAG_NONE));
|
SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_GUID | (GetAuraMaxDuration() ? AFLAG_DURATION : AFLAG_NONE) | (IsPositive() ? AFLAG_NONE : AFLAG_NEGATIVE));
|
||||||
SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
SetAuraLevel(caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
|
||||||
UpdateAuraCharges();
|
UpdateAuraCharges();
|
||||||
SendAuraUpdate(false);
|
SendAuraUpdate(false);
|
||||||
|
|
@ -1135,10 +1126,10 @@ void Aura::SendAuraUpdate(bool remove)
|
||||||
data << uint8(GetAuraLevel());
|
data << uint8(GetAuraLevel());
|
||||||
data << uint8(GetAuraCharges());
|
data << uint8(GetAuraCharges());
|
||||||
|
|
||||||
/*if(!(auraFlags & AFLAG_NOT_GUID))
|
if(!(auraFlags & AFLAG_NOT_GUID))
|
||||||
{
|
{
|
||||||
data << uint8(0); // pguid
|
data << uint8(0); // pguid
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if(auraFlags & AFLAG_DURATION)
|
if(auraFlags & AFLAG_DURATION)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,6 @@ Unit::Unit()
|
||||||
m_ShapeShiftFormSpellId = 0;
|
m_ShapeShiftFormSpellId = 0;
|
||||||
m_canModifyStats = false;
|
m_canModifyStats = false;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_AURAS; ++i)
|
|
||||||
m_visibleAuras[i] = 0;
|
|
||||||
for (int i = 0; i < MAX_SPELL_IMMUNITY; i++)
|
for (int i = 0; i < MAX_SPELL_IMMUNITY; i++)
|
||||||
m_spellImmune[i].clear();
|
m_spellImmune[i].clear();
|
||||||
for (int i = 0; i < UNIT_MOD_END; i++)
|
for (int i = 0; i < UNIT_MOD_END; i++)
|
||||||
|
|
|
||||||
|
|
@ -716,6 +716,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
typedef std::list<DiminishingReturn> Diminishing;
|
typedef std::list<DiminishingReturn> Diminishing;
|
||||||
typedef std::set<AuraType> AuraTypeSet;
|
typedef std::set<AuraType> AuraTypeSet;
|
||||||
typedef std::set<uint32> ComboPointHolderSet;
|
typedef std::set<uint32> ComboPointHolderSet;
|
||||||
|
typedef std::map<uint8, uint32> VisibleAuraMap;
|
||||||
|
|
||||||
virtual ~Unit ( );
|
virtual ~Unit ( );
|
||||||
|
|
||||||
|
|
@ -1155,8 +1156,29 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ }
|
void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ }
|
||||||
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
|
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
|
||||||
|
|
||||||
uint32 GetVisibleAura(uint32 slot) { return m_visibleAuras[slot]; }
|
uint32 GetVisibleAura(uint8 slot)
|
||||||
void SetVisibleAura(uint32 slot, uint32 spellid) { m_visibleAuras[slot] = spellid; }
|
{
|
||||||
|
VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
|
||||||
|
if(itr != m_visibleAuras.end())
|
||||||
|
return itr->second;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void SetVisibleAura(uint8 slot, uint32 spellid)
|
||||||
|
{
|
||||||
|
if(spellid == 0)
|
||||||
|
{
|
||||||
|
VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
|
||||||
|
if(itr != m_visibleAuras.end())
|
||||||
|
{
|
||||||
|
m_visibleAuras.erase(itr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_visibleAuras[slot] = spellid;
|
||||||
|
}
|
||||||
|
VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; }
|
||||||
|
uint8 GetVisibleAurasCount() { return m_visibleAuras.size(); }
|
||||||
|
|
||||||
Aura* GetAura(uint32 spellId, uint32 effindex);
|
Aura* GetAura(uint32 spellId, uint32 effindex);
|
||||||
AuraMap & GetAuras() { return m_Auras; }
|
AuraMap & GetAuras() { return m_Auras; }
|
||||||
|
|
@ -1330,7 +1352,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
float m_weaponDamage[MAX_ATTACK][2];
|
float m_weaponDamage[MAX_ATTACK][2];
|
||||||
bool m_canModifyStats;
|
bool m_canModifyStats;
|
||||||
//std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
|
//std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
|
||||||
uint32 m_visibleAuras[MAX_AURAS];
|
VisibleAuraMap m_visibleAuras;
|
||||||
|
|
||||||
float m_speed_rate[MAX_MOVE_TYPE];
|
float m_speed_rate[MAX_MOVE_TYPE];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue