aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/AchievementMgr.cpp4
-rw-r--r--src/game/CreatureEventAI.cpp21
-rw-r--r--src/game/CreatureEventAI.h19
-rw-r--r--src/game/CreatureEventAIMgr.cpp10
-rw-r--r--src/game/DBCStructure.h7
-rw-r--r--src/game/ItemHandler.cpp2
-rw-r--r--src/game/MiscHandler.cpp5
-rw-r--r--src/game/Object.cpp28
-rw-r--r--src/game/Object.h2
-rw-r--r--src/game/ObjectMgr.cpp4
-rw-r--r--src/game/Opcodes.cpp2
-rw-r--r--src/game/Opcodes.h6
-rw-r--r--src/game/Pet.cpp2
-rw-r--r--src/game/Player.cpp75
-rw-r--r--src/game/Player.h20
-rw-r--r--src/game/PlayerDump.cpp2
-rw-r--r--src/game/SharedDefines.h4
-rw-r--r--src/game/SkillDiscovery.cpp19
-rw-r--r--src/game/Spell.cpp9
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellAuras.cpp10
-rw-r--r--src/game/SpellEffects.cpp50
-rw-r--r--src/game/SpellMgr.cpp49
-rw-r--r--src/game/SpellMgr.h17
-rw-r--r--src/game/StatSystem.cpp4
-rw-r--r--src/game/Totem.cpp7
-rw-r--r--src/game/Unit.cpp8
-rw-r--r--src/game/Unit.h1
-rw-r--r--src/game/UpdateData.cpp2
-rw-r--r--src/shared/Database/SQLStorage.cpp2
-rw-r--r--src/shared/vmap/TileAssembler.cpp2
31 files changed, 286 insertions, 108 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index e1cff09cdac..fdaa5dd82a8 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -1306,7 +1306,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(IsCompletedCriteria(achievementCriteria,achievement))
CompletedCriteriaFor(achievement);
- // check again the completeness for SUMM and REQ COUNT achievements,
+ // check again the completeness for SUMM and REQ COUNT achievements,
// as they don't depend on the completed criteria but on the sum of the progress of each individual criteria
if (achievement->flags & ACHIEVEMENT_FLAG_SUMM)
{
@@ -1523,7 +1523,7 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
return false;
}
- // Default case - need complete all or
+ // Default case - need complete all or
bool completed_all = true;
for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr)
{
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index 6e8ac6a4909..5c425217844 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -96,6 +96,8 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
AttackDistance = 0.0f;
AttackAngle = 0.0f;
+ InvinceabilityHpLevel = 0;
+
//Handle Spawned Events
if (!bEmptyList)
{
@@ -792,6 +794,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->ForcedDespawn();
break;
}
+ case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
+ {
+ if(action.invincibility_hp_level.is_percent)
+ InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
+ else
+ InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
+ break;
+ }
}
}
@@ -1338,6 +1348,17 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
}
}
+void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage )
+{
+ if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
+ {
+ if(m_creature->GetHealth() <= InvinceabilityHpLevel)
+ damage = 0;
+ else
+ damage = m_creature->GetHealth() - InvinceabilityHpLevel;
+ }
+}
+
bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
{
if(event.event_type != EVENT_T_SPAWNED)
diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h
index ad3827ef75d..7882e7542ec 100644
--- a/src/game/CreatureEventAI.h
+++ b/src/game/CreatureEventAI.h
@@ -113,6 +113,7 @@ enum EventAI_ActionType
ACTION_T_FORCE_DESPAWN = 41, // No Params
ACTION_T_END = 105,
+ ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health)
};
enum Target
@@ -379,6 +380,12 @@ struct CreatureEventAI_Action
{
uint32 sheath;
} set_sheath;
+ // ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42
+ struct
+ {
+ uint32 hp_level;
+ uint32 is_percent;
+ } invincibility_hp_level;
// RAW
struct
{
@@ -581,6 +588,7 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
void AttackStart(Unit *who);
void MoveInLineOfSight(Unit *who);
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
+ void DamageTaken(Unit* done_by, uint32& damage);
void UpdateAI(const uint32 diff);
void ReceiveEmote(Player* pPlayer, uint32 text_emote);
static int Permissible(const Creature *);
@@ -608,10 +616,11 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
bool bEmptyList;
//Variables used by Events themselves
- uint8 Phase; //Current phase, max 32 phases
- bool CombatMovementEnabled; //If we allow targeted movment gen (movement twoards top threat)
- bool MeleeEnabled; //If we allow melee auto attack
- float AttackDistance; //Distance to attack from
- float AttackAngle; //Angle of attack
+ uint8 Phase; // Current phase, max 32 phases
+ bool CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat)
+ bool MeleeEnabled; // If we allow melee auto attack
+ float AttackDistance; // Distance to attack from
+ float AttackAngle; // Angle of attack
+ uint32 InvinceabilityHpLevel; // Minimal health level allowed at damage apply
};
#endif
diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp
index 18db935536b..45bff09eb03 100644
--- a/src/game/CreatureEventAIMgr.cpp
+++ b/src/game/CreatureEventAIMgr.cpp
@@ -661,6 +661,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
action.set_sheath.sheath = SHEATH_STATE_UNARMED;
}
break;
+ case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
+ if(action.invincibility_hp_level.is_percent)
+ {
+ if(action.invincibility_hp_level.hp_level > 100)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
+ action.invincibility_hp_level.hp_level = 100;
+ }
+ }
+ break;
case ACTION_T_EVADE: //No Params
case ACTION_T_FLEE_FOR_ASSIST: //No Params
case ACTION_T_DIE: //No Params
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index ffc37e1ee9b..910316881a4 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1463,13 +1463,6 @@ struct SpellFocusObjectEntry
// 16 string flags, unused
};
-// stored in SQL table
-struct SpellThreatEntry
-{
- uint32 spellId;
- int32 threat;
-};
-
struct SpellRadiusEntry
{
uint32 ID;
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index d886cda742b..114393f4287 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -862,12 +862,14 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
// cheating protection
+ /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command.
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if(!pCreature)
{
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
return;
}
+ */
uint32 slot = _player->GetBankBagSlotCount();
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 2488e7696e0..c2a93c36e0c 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1018,10 +1018,11 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
uint32 size = adata->Data.size();
+ uLongf destSize = compressBound(size);
+
ByteBuffer dest;
- dest.resize(size);
+ dest.resize(destSize);
- uLongf destSize = size;
if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
{
sLog.outDebug("RAD: Failed to compress account data");
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index d565818910e..abf4de09275 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -259,13 +259,13 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const
data->AddOutOfRangeGUID(GetGUID());
}
-void Object::DestroyForPlayer(Player *target) const
+void Object::DestroyForPlayer( Player *target, bool anim ) const
{
ASSERT(target);
WorldPacket data(SMSG_DESTROY_OBJECT, 8);
data << uint64(GetGUID());
- data << uint8(0); // WotLK (bool)
+ data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation
target->GetSession()->SendPacket( &data );
}
@@ -730,7 +730,7 @@ void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const
void Object::SetInt32Value( uint16 index, int32 value )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(m_int32Values[ index ] != value)
{
@@ -749,7 +749,7 @@ void Object::SetInt32Value( uint16 index, int32 value )
void Object::SetUInt32Value( uint16 index, uint32 value )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(m_uint32Values[ index ] != value)
{
@@ -768,7 +768,7 @@ void Object::SetUInt32Value( uint16 index, uint32 value )
void Object::SetUInt64Value( uint16 index, const uint64 &value )
{
- ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) );
if(*((uint64*)&(m_uint32Values[ index ])) != value)
{
m_uint32Values[ index ] = *((uint32*)&value);
@@ -829,7 +829,7 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 &value)
void Object::SetFloatValue( uint16 index, float value )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(m_floatValues[ index ] != value)
{
@@ -848,7 +848,7 @@ void Object::SetFloatValue( uint16 index, float value )
void Object::SetByteValue( uint16 index, uint8 offset, uint8 value )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(offset > 4)
{
@@ -874,7 +874,7 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value )
void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(offset > 2)
{
@@ -948,7 +948,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply)
void Object::SetFlag( uint16 index, uint32 newFlag )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
uint32 oldval = m_uint32Values[ index ];
uint32 newval = oldval | newFlag;
@@ -969,7 +969,7 @@ void Object::SetFlag( uint16 index, uint32 newFlag )
void Object::RemoveFlag( uint16 index, uint32 oldFlag )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
uint32 oldval = m_uint32Values[ index ];
uint32 newval = oldval & ~oldFlag;
@@ -990,7 +990,7 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag )
void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(offset > 4)
{
@@ -1015,7 +1015,7 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag )
void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag )
{
- ASSERT( index < m_valuesCount || PrintIndexError( index , true ) );
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
if(offset > 4)
{
@@ -1432,7 +1432,7 @@ bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2,
void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const
{
- if(distance==0)
+ if(distance == 0)
{
rand_x = x;
rand_y = y;
@@ -1666,7 +1666,7 @@ void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*
void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
{
WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8);
- data << guid;
+ data << uint64(guid);
SendMessageToSet(&data, true);
}
diff --git a/src/game/Object.h b/src/game/Object.h
index 3004601cd50..235b3fb6b38 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -171,7 +171,7 @@ class TRINITY_DLL_SPEC Object
void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const;
void BuildUpdate(UpdateDataMapType &);
- virtual void DestroyForPlayer( Player *target ) const;
+ virtual void DestroyForPlayer( Player *target, bool anim = false ) const;
const int32& GetInt32Value( uint16 index ) const
{
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index c531366845f..7557c23d072 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -635,7 +635,7 @@ void ObjectMgr::LoadCreatureTemplates()
// used later for scale
CreatureDisplayInfoEntry const* displayScaleEntry = NULL;
-
+
if (cInfo->DisplayID_A[0])
{
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[0]);
@@ -7111,7 +7111,7 @@ uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create )
uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES);
if(!isValidString(wname,strictMask,false,create))
return CHAR_NAME_MIXED_LANGUAGES;
-
+
return CHAR_NAME_SUCCESS;
}
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index ddf7c74146a..8fd57ad52be 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -1025,7 +1025,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, &WorldSession::HandleReportPvPAFK },
- /*0x3E5*/ { "CMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL },
+ /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL },
/*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankerActivate },
/*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankQueryTab },
/*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide },
diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h
index b3d9c4f8f11..b468cc64978 100644
--- a/src/game/Opcodes.h
+++ b/src/game/Opcodes.h
@@ -694,8 +694,8 @@ enum Opcodes
CMSG_GROUP_ASSISTANT_LEADER = 0x28F,
CMSG_BUYBACK_ITEM = 0x290,
SMSG_SERVER_MESSAGE = 0x291,
- CMSG_MEETINGSTONE_JOIN = 0x292,
- CMSG_MEETINGSTONE_LEAVE = 0x293, // SMSG?
+ CMSG_MEETINGSTONE_JOIN = 0x292, // lua: SetSavedInstanceExtend
+ SMSG_MEETINGSTONE_LEAVE = 0x293,
CMSG_MEETINGSTONE_CHEAT = 0x294,
SMSG_MEETINGSTONE_SETQUEUE = 0x295,
CMSG_MEETINGSTONE_INFO = 0x296,
@@ -1033,7 +1033,7 @@ enum Opcodes
SMSG_COMSAT_CONNECT_FAIL = 0x3E2,
SMSG_VOICE_CHAT_STATUS = 0x3E3,
CMSG_REPORT_PVP_AFK = 0x3E4,
- CMSG_REPORT_PVP_AFK_RESULT = 0x3E5,
+ SMSG_REPORT_PVP_AFK_RESULT = 0x3E5, // SMSG?
CMSG_GUILD_BANKER_ACTIVATE = 0x3E6,
CMSG_GUILD_BANK_QUERY_TAB = 0x3E7,
SMSG_GUILD_BANK_LIST = 0x3E8,
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 704e0981413..4071cfb50bb 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -156,7 +156,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
}
uint32 pet_number = fields[0].GetUInt32();
-
+
if (current && owner->IsPetNeedBeTemporaryUnsummoned())
{
owner->SetTemporaryUnsummonedPetNumber(pet_number);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index d2dbdd1263c..5659f14f28a 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1329,8 +1329,8 @@ void Player::Update( uint32 p_time )
{
if (p_time >= m_DetectInvTimer)
{
- m_DetectInvTimer = 3000;
HandleStealthedUnitsDetection();
+ m_DetectInvTimer = 3000;
}
else
m_DetectInvTimer -= p_time;
@@ -3865,9 +3865,9 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target )
Unit::BuildCreateUpdateBlockForPlayer( data, target );
}
-void Player::DestroyForPlayer( Player *target ) const
+void Player::DestroyForPlayer( Player *target, bool anim ) const
{
- Unit::DestroyForPlayer( target );
+ Unit::DestroyForPlayer( target, anim );
for(uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++)
{
@@ -10710,7 +10710,6 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update )
Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
{
-
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
@@ -16717,10 +16716,10 @@ void Player::SendAttackSwingBadFacingAttack()
GetSession()->SendPacket( &data );
}
-void Player::SendAutoRepeatCancel()
+void Player::SendAutoRepeatCancel(Unit *target)
{
- WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, GetPackGUID().size());
- data.append(GetPackGUID()); // may be it's target guid
+ WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size());
+ data.append(target->GetPackGUID()); // may be it's target guid
GetSession()->SendPacket( &data );
}
@@ -17553,19 +17552,38 @@ void Player::HandleStealthedUnitsDetection()
Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(this, stealthedUnits, u_check);
VisitNearbyObject(World::GetMaxVisibleDistance(), searcher);
- for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i)
+ for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i)
{
- if (!HaveAtClient(*i) && canSeeOrDetect(*i, true))
+ if((*i)==this)
+ continue;
+
+ bool hasAtClient = HaveAtClient((*i));
+ bool hasDetected = canSeeOrDetect(*i, true);
+
+ if (hasDetected)
{
- (*i)->SendUpdateToPlayer(this);
- m_clientGUIDs.insert((*i)->GetGUID());
+ if(!hasAtClient)
+ {
+ (*i)->SendUpdateToPlayer(this);
+ m_clientGUIDs.insert((*i)->GetGUID());
- #ifdef TRINITY_DEBUG
- if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
- sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
- #endif
+ #ifdef MANGOS_DEBUG
+ if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
+ sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
+ #endif
- SendInitialVisiblePackets(*i);
+ // target aura duration for caster show only if target exist at caster client
+ // send data at target visibility change (adding to client)
+ SendInitialVisiblePackets(*i);
+ }
+ }
+ else
+ {
+ if(hasAtClient)
+ {
+ (*i)->DestroyForPlayer(this);
+ m_clientGUIDs.erase((*i)->GetGUID());
+ }
}
}
}
@@ -18773,7 +18791,7 @@ void Player::UpdateVisibilityOf(WorldObject* target)
{
if(HaveAtClient(target))
{
- if(!target->isVisibleForInState(this,true))
+ if(!target->isVisibleForInState(this, true))
{
target->DestroyForPlayer(this);
m_clientGUIDs.erase(target->GetGUID());
@@ -20360,11 +20378,30 @@ bool Player::HasTitle(uint32 bitIndex)
return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
}
-void Player::SetTitle(CharTitlesEntry const* title)
+void Player::SetTitle(CharTitlesEntry const* title, bool lost)
{
uint32 fieldIndexOffset = title->bit_index / 32;
uint32 flag = 1 << (title->bit_index % 32);
- SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
+
+ if(lost)
+ {
+ if(!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
+ return;
+
+ RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
+ }
+ else
+ {
+ if(HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
+ return;
+
+ SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
+ }
+
+ WorldPacket data(SMSG_TITLE_EARNED, 4 + 4);
+ data << uint32(title->bit_index);
+ data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost
+ GetSession()->SendPacket(&data);
}
/*-----------------------TRINITY--------------------------*/
diff --git a/src/game/Player.h b/src/game/Player.h
index a8ec9e80172..49d4c1346b9 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -136,11 +136,12 @@ enum ActionButtonUpdateState
enum ActionButtonType
{
- ACTION_BUTTON_SPELL = 0,
- ACTION_BUTTON_EQSET = 32,
- ACTION_BUTTON_MACRO = 64,
- ACTION_BUTTON_CMACRO= 65,
- ACTION_BUTTON_ITEM = 128
+ ACTION_BUTTON_SPELL = 0x00,
+ ACTION_BUTTON_C = 0x01, // click?
+ ACTION_BUTTON_EQSET = 0x20,
+ ACTION_BUTTON_MACRO = 0x40,
+ ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO,
+ ACTION_BUTTON_ITEM = 0x80
};
#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
@@ -1653,7 +1654,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetSession(WorldSession *s) { m_session = s; }
void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
- void DestroyForPlayer( Player *target ) const;
+ void DestroyForPlayer( Player *target, bool anim = false ) const;
void SendDelayResponse(const uint32);
void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP);
@@ -1663,7 +1664,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void SendAttackSwingDeadTarget();
void SendAttackSwingNotInRange();
void SendAttackSwingBadFacingAttack();
- void SendAutoRepeatCancel();
+ void SendAutoRepeatCancel(Unit *target);
void SendExplorationExperience(uint32 Area, uint32 Experience);
void SendDungeonDifficulty(bool IsInGroup);
@@ -2050,7 +2051,6 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
// Stealth detection system
- uint32 m_DetectInvTimer;
void HandleStealthedUnitsDetection();
uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
@@ -2140,7 +2140,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
bool HasTitle(uint32 bitIndex);
bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); }
- void SetTitle(CharTitlesEntry const* title);
+ void SetTitle(CharTitlesEntry const* title, bool lost = false);
//bool isActiveObject() const { return true; }
bool canSeeSpellClickOn(Creature const* creature) const;
@@ -2403,6 +2403,8 @@ class TRINITY_DLL_SPEC Player : public Unit
bool m_bCanDelayTeleport;
bool m_bHasDelayedTeleport;
+ uint32 m_DetectInvTimer;
+
// Temporary removed pet cache
uint32 m_temporaryUnsummonedPetNumber;
uint32 m_oldpetspell;
diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp
index 80f7c402fd4..2187614d368 100644
--- a/src/game/PlayerDump.cpp
+++ b/src/game/PlayerDump.cpp
@@ -332,7 +332,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
std::string PlayerDumpWriter::GetDump(uint32 guid)
{
std::string dump;
-
+
dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n";
dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 0540f8f7dbe..535664462a5 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -667,10 +667,10 @@ enum SpellEffects
SPELL_EFFECT_APPLY_AREA_AURA_ENEMY = 129,
SPELL_EFFECT_REDIRECT_THREAT = 130,
SPELL_EFFECT_131 = 131,
- SPELL_EFFECT_132 = 132,
+ SPELL_EFFECT_PLAY_MUSIC = 132,
SPELL_EFFECT_UNLEARN_SPECIALIZATION = 133,
SPELL_EFFECT_KILL_CREDIT2 = 134,
- SPELL_EFFECT_135 = 135,
+ SPELL_EFFECT_CALL_PET = 135,
SPELL_EFFECT_HEAL_PCT = 136,
SPELL_EFFECT_ENERGIZE_PCT = 137,
SPELL_EFFECT_138 = 138,
diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp
index de441168576..686fcf889b9 100644
--- a/src/game/SkillDiscovery.cpp
+++ b/src/game/SkillDiscovery.cpp
@@ -106,7 +106,9 @@ void LoadSkillDiscoveryTable()
{
if (reportedReqSpells.count(reqSkillOrSpell)==0)
{
- sLog.outErrorDb("Spell (ID: %u) not have have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",reqSkillOrSpell,spellId);
+ sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
+ " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
+ reqSkillOrSpell,spellId);
reportedReqSpells.insert(reqSkillOrSpell);
}
continue;
@@ -145,6 +147,21 @@ void LoadSkillDiscoveryTable()
sLog.outString( ">> Loaded %u skill discovery definitions", count );
if(!ssNonDiscoverableEntries.str().empty())
sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str());
+
+ // report about empty data for explicit discovery spells
+ for(uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
+ {
+ SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell_id);
+ if(!spellEntry)
+ continue;
+
+ // skip not explicit discovery spells
+ if (!IsExplicitDiscoverySpell(spellEntry))
+ continue;
+
+ if(SkillDiscoveryStore.find(spell_id)==SkillDiscoveryStore.end())
+ sLog.outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table",spell_id);
+ }
}
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f4e992b6a7b..5c1b2fc3687 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4200,13 +4200,14 @@ void Spell::HandleThreatSpells(uint32 spellId)
if(!m_targets.getUnitTarget()->CanHaveThreatList())
return;
- SpellThreatEntry const *threatSpell = sSpellThreatStore.LookupEntry<SpellThreatEntry>(spellId);
- if(!threatSpell)
+ uint16 threat = spellmgr.GetSpellThreat(spellId);
+
+ if(!threat)
return;
- m_targets.getUnitTarget()->AddThreat(m_caster, float(threatSpell->threat));
+ m_targets.getUnitTarget()->AddThreat(m_caster, float(threat));
- DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threatSpell->threat);
+ DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat);
}
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 1f4086280f0..b593bf79881 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -354,6 +354,7 @@ class Spell
void EffectActivateRune(uint32 i);
void EffectTitanGrip(uint32 i);
void EffectEnchantItemPrismatic(uint32 i);
+ void EffectPlayMusic(uint32 i);
typedef std::set<Aura *> UsedSpellMods;
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 2a072cf817f..df55a4fc1be 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -6357,7 +6357,17 @@ void AuraEffect::PeriodicTick()
if(m_auraName==SPELL_AURA_OBS_MOD_HEALTH)
pdamage = uint32(m_target->GetMaxHealth() * pdamage * GetParentAura()->GetStackAmount() / 100);
else
+ {
+ // Wild Growth (1/7 - 6 + 2*ramainTicks) %
+ if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864)
+ {
+ int32 ticks = GetParentAura()->GetAuraMaxDuration()/m_amplitude;
+ int32 remainingTicks = int32(float(GetParentAura()->GetAuraDuration()) / m_amplitude + 0.5);
+ pdamage = int32(pdamage) + int32(pdamage)*ticks*(-6+2*remainingTicks)/100;
+ }
+
pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount());
+ }
bool crit = false;
Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 7523664c8b1..724c57c48b6 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -196,7 +196,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
&Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
&Spell::EffectUnused, //131 SPELL_EFFECT_131 used in some test spells
- &Spell::EffectNULL, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
+ &Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
&Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization
&Spell::EffectKillCredit, //134 SPELL_EFFECT_KILL_CREDIT misc value is creature entry
&Spell::EffectNULL, //135 SPELL_EFFECT_CALL_PET
@@ -932,7 +932,7 @@ void Spell::EffectDummy(uint32 i)
case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires
{
int32 r = irand(0, 119);
- if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph
+ if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph
m_caster->CastSpell(m_caster, 23444, true);
else if ( r < 100 ) // Evil Twin - 4/6 evil twin
m_caster->CastSpell(m_caster, 23445, true);
@@ -1155,13 +1155,13 @@ void Spell::EffectDummy(uint32 i)
m_caster->CastSpell(m_caster, 45088, true);
return;
}
- case 55004: // Nitro Boosts
- if(!m_CastItem) return;
- if(roll_chance_i(95)) // Nitro Boosts - success
- m_caster->CastSpell(m_caster, 54861, true, m_CastItem);
- else // Knocked Up - backfire 5%
- m_caster->CastSpell(m_caster, 46014, true, m_CastItem);
- return;
+ case 55004: // Nitro Boosts
+ if(!m_CastItem) return;
+ if(roll_chance_i(95)) // Nitro Boosts - success
+ m_caster->CastSpell(m_caster, 54861, true, m_CastItem);
+ else // Knocked Up - backfire 5%
+ m_caster->CastSpell(m_caster, 46014, true, m_CastItem);
+ return;
case 50243: // Teach Language
{
if(m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -5089,6 +5089,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 61177: // Northrend Inscription Research
case 61288: // Minor Inscription Research
case 61756: // Northrend Inscription Research (FAST QA VERSION)
+ case 64323: // Book of Glyph Mastery
{
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
@@ -6495,16 +6496,14 @@ void Spell::EffectTransmitted(uint32 effIndex)
case GAMEOBJECT_TYPE_FISHINGHOLE:
case GAMEOBJECT_TYPE_CHEST:
default:
- {
break;
- }
}
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
- pGameObj->SetOwnerGUID(m_caster->GetGUID() );
+ pGameObj->SetOwnerGUID(m_caster->GetGUID());
- //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() );
+ //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
pGameObj->SetSpellId(m_spellInfo->Id);
DEBUG_LOG("AddObject at SpellEfects.cpp EffectTransmitted");
@@ -6524,9 +6523,9 @@ void Spell::EffectTransmitted(uint32 effIndex)
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0);
- //linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() );
+ //linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
linkedGO->SetSpellId(m_spellInfo->Id);
- linkedGO->SetOwnerGUID(m_caster->GetGUID() );
+ linkedGO->SetOwnerGUID(m_caster->GetGUID());
linkedGO->GetMap()->Add(linkedGO);
}
@@ -6877,4 +6876,23 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/)
return;
unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
-} \ No newline at end of file
+}
+
+void Spell::EffectPlayMusic(uint32 i)
+{
+ if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ uint32 soundid = m_spellInfo->EffectMiscValue[i];
+
+ if (!sSoundEntriesStore.LookupEntry(soundid))
+ {
+ sLog.outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.",soundid,m_spellInfo->Id);
+ return;
+ }
+
+ WorldPacket data(SMSG_PLAY_MUSIC, 4);
+ data << uint32(soundid);
+ ((Player*)unitTarget)->GetSession()->SendPacket(&data);
+}
+
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 9c9bb255ef2..ae708153142 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1446,12 +1446,50 @@ void SpellMgr::LoadSpellElixirs()
void SpellMgr::LoadSpellThreats()
{
- sSpellThreatStore.Free(); // for reload
+ mSpellThreatMap.clear(); // need for reload case
- sSpellThreatStore.Load();
+ uint32 count = 0;
+
+ // 0 1
+ QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
+ if( !result )
+ {
+
+ barGoLink bar( 1 );
+
+ bar.step();
+
+ sLog.outString();
+ sLog.outString( ">> Loaded %u aggro generating spells", count );
+ return;
+ }
+
+ barGoLink bar( result->GetRowCount() );
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ bar.step();
+
+ uint32 entry = fields[0].GetUInt32();
+ uint16 Threat = fields[1].GetUInt16();
+
+ if (!sSpellStore.LookupEntry(entry))
+ {
+ sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ continue;
+ }
+
+ mSpellThreatMap[entry] = Threat;
+
+ ++count;
+ } while( result->NextRow() );
+
+ delete result;
- sLog.outString( ">> Loaded %u aggro generating spells", sSpellThreatStore.RecordCount );
sLog.outString();
+ sLog.outString( ">> Loaded %u aggro generating spells", count );
}
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const
@@ -2843,6 +2881,11 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Explicit Diminishing Groups
switch(spellproto->SpellFamilyName)
{
+ case SPELLFAMILY_GENERIC:
+ // some generic arena related spells have by some strange reason MECHANIC_TURN
+ if (spellproto->Mechanic == MECHANIC_TURN)
+ return DIMINISHING_NONE;
+ break;
case SPELLFAMILY_MAGE:
{
// Frostbite 0x80000000
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 8315fdc2965..2540f141b43 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -40,8 +40,6 @@ class Player;
class Spell;
struct SpellModifier;
-extern SQLStorage sSpellThreatStore;
-
// only used in code
enum SpellCategories
{
@@ -224,7 +222,9 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
{
- return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM && spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT;
+ return spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
+ && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT
+ || spellInfo->Id == 64323; // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data)
}
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
@@ -524,6 +524,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
#define ELIXIR_SHATTRATH_MASK 0x8
typedef std::map<uint32, uint8> SpellElixirMap;
+typedef std::map<uint32, uint16> SpellThreatMap;
// Spell script target related declarations (accessed using SpellMgr functions)
enum SpellScriptTargetType
@@ -761,6 +762,15 @@ class SpellMgr
return SPELL_NORMAL;
}
+ uint16 GetSpellThreat(uint32 spellid) const
+ {
+ SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
+ if(itr==mSpellThreatMap.end())
+ return 0;
+
+ return itr->second;
+ }
+
// Spell proc events
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
@@ -1078,6 +1088,7 @@ class SpellMgr
SpellLearnSpellMap mSpellLearnSpells;
SpellTargetPositionMap mSpellTargetPositions;
SpellElixirMap mSpellElixirs;
+ SpellThreatMap mSpellThreatMap;
SpellProcEventMap mSpellProcEventMap;
SpellBonusMap mSpellBonusMap;
SkillLineAbilityMap mSkillLineAbilityMap;
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index bd283c81fc5..fbe16c9b726 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -863,7 +863,9 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
- float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType);
+ /* difference in AP between current attack power and base value from DB */
+ float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower;
+ float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f);
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index b11146367b2..d35ba9e30b9 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -57,9 +57,9 @@ void Totem::InitStats(uint32 duration)
Minion::InitStats(duration);
CreatureInfo const *cinfo = GetCreatureInfo();
- if (m_owner->GetTypeId()==TYPEID_PLAYER && cinfo)
+ if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
- uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(),cinfo);
+ uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
@@ -137,7 +137,7 @@ void Totem::UnSummon()
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
- // TODO: possibly all negative auras immuned?
+ // TODO: possibly all negative auras immune?
switch(spellInfo->EffectApplyAuraName[index])
{
case SPELL_AURA_PERIODIC_DAMAGE:
@@ -150,4 +150,3 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) co
}
return Creature::IsImmunedToSpellEffect(spellInfo, index);
}
-
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 359e31c3acc..3656e5096f3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3477,8 +3477,8 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
// send autorepeat cancel message for autorepeat spells
if (spellType == CURRENT_AUTOREPEAT_SPELL)
{
- if(GetTypeId()==TYPEID_PLAYER)
- ((Player*)this)->SendAutoRepeatCancel();
+ if(GetTypeId() == TYPEID_PLAYER)
+ ((Player*)this)->SendAutoRepeatCancel(this);
}
if (spell->getState() != SPELL_STATE_FINISHED)
@@ -9241,7 +9241,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
}
else // Tundra Stalker
{
- if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT,0, 0x4000000,0))
+ // Frost Fever (target debuff)
+ if (pVictim->GetAura(SPELL_AURA_MOD_HASTE, SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x2))
DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
@@ -10875,6 +10876,7 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const
//-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia)
//based on wowwiki every 5 mod we have 1 more level diff in calculation
visibleDistance += (float)(GetTotalAuraModifier(SPELL_AURA_MOD_DETECT) - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL)) / 5.0f;
+ visibleDistance = visibleDistance > MAX_PLAYER_STEALTH_DETECT_RANGE ? MAX_PLAYER_STEALTH_DETECT_RANGE : visibleDistance;
return distance < visibleDistance;
}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 3488c9b8f14..85f2ed154dd 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1012,6 +1012,7 @@ enum ReactiveType
// delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200
+#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player
struct SpellProcEventEntry; // used only privately
diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp
index a3192b74b0e..e461d63e248 100644
--- a/src/game/UpdateData.cpp
+++ b/src/game/UpdateData.cpp
@@ -128,7 +128,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
if (pSize > 100 ) // compress large packets
{
- uint32 destsize = pSize;
+ uint32 destsize = compressBound(pSize);
packet->resize( destsize + sizeof(uint32) );
packet->put<uint32>(0, pSize);
diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp
index 50fd484bff5..4113d35236d 100644
--- a/src/shared/Database/SQLStorage.cpp
+++ b/src/shared/Database/SQLStorage.cpp
@@ -38,7 +38,6 @@ const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii";
const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii";
const char PageTextfmt[]="isi";
-const char SpellThreatfmt[]="ii";
const char InstanceTemplatesrcfmt[]="iiiiiiffffs";
const char InstanceTemplatedstfmt[]="iiiiiiffffi";
@@ -50,7 +49,6 @@ SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template")
SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template");
SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template");
SQLStorage sPageTextStore(PageTextfmt,"entry","page_text");
-SQLStorage sSpellThreatStore(SpellThreatfmt,"entry","spell_threat");
SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map","instance_template");
void SQLStorage::Free ()
diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp
index cbaa4e58108..75997a847a2 100644
--- a/src/shared/vmap/TileAssembler.cpp
+++ b/src/shared/vmap/TileAssembler.cpp
@@ -243,7 +243,7 @@ namespace VMAP
char destnamebuffer[500];
char fullnamedestnamebuffer[500];
-
+
if(nameCollection.iMainFiles.size() >0)
{
sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too