[8229] Improve stealth detection code for player case. Author: Ambal

--HG--
branch : trunk
This commit is contained in:
megamage
2009-07-30 10:38:53 +08:00
parent 7bd47f8827
commit 5d9d64e6f0
6 changed files with 43 additions and 12 deletions
+8 -1
View File
@@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` ( CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`required_8213_01_mangos_spell_bonus_data` bit(1) default NULL `required_8227_01_mangos_spell_proc_event` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@@ -17667,8 +17667,15 @@ INSERT INTO `spell_proc_event` VALUES
(63108, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63108, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63156, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63156, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63158, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63158, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
<<<<<<< HEAD:sql/mangos.sql
(63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); (63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0);
>>>>>>> 4386e1133bd161f1b3a8d378e567b3d61f83ce89:sql/mangos.sql >>>>>>> 4386e1133bd161f1b3a8d378e567b3d61f83ce89:sql/mangos.sql
=======
(63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0),
(63730, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63733, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0),
(63737, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0);
>>>>>>> ee001a20a10446a8936bec95b7680b50319ac61d:sql/mangos.sql
/*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
+2
View File
@@ -249,6 +249,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas
(50246,-1, -1, -1, -1, -1, -1, -1, -1,-1,'01001000', 'Spell::EffectDummy'), (50246,-1, -1, -1, -1, -1, -1, -1, -1,-1,'01001000', 'Spell::EffectDummy'),
(50286, 7,0x0000000000000000,0x00000100, -1, -1, -1, 3, -1,-1,'Starfall', 'Spell::EffectDummy'), (50286, 7,0x0000000000000000,0x00000100, -1, -1, -1, 3, -1,-1,'Starfall', 'Spell::EffectDummy'),
(50288,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Starfall', 'Spell::EffectDummy'), (50288,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Starfall', 'Spell::EffectDummy'),
(51209,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hungering Cold', 'Spell::EffectDummy'),
(51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'), (51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'),
(51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), (51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'),
(52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'), (52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'),
@@ -318,6 +319,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas
( 0,11,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Healing Stream Totem', 'Spell::EffectDummy'), ( 0,11,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Healing Stream Totem', 'Spell::EffectDummy'),
( 0, 4,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Heroic Throw', 'Spell::EffectSchoolDMG'), ( 0, 4,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Heroic Throw', 'Spell::EffectSchoolDMG'),
( 0,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), ( 0,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'),
( 0,15,0x0000100000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Hungering Cold', 'Spell::EffectDummy'),
( 0, 5,0x0000000000000004,0x00000000, -1, -1, -1, -1, 3,-1,'Immolate', 'Spell::EffectSchoolDMG'), ( 0, 5,0x0000000000000004,0x00000000, -1, -1, -1, -1, 3,-1,'Immolate', 'Spell::EffectSchoolDMG'),
(0, 5, -1, -1, 208, -1, -1, -1, 4,-1,'Improved Life Tap', 'Spell::EffectDummy'), (0, 5, -1, -1, 208, -1, -1, -1, 4,-1,'Improved Life Tap', 'Spell::EffectDummy'),
( 0, 5,0x0000004000000000,0x00000000,2128, -1, -1, 2, -1,-1,'Incinerate', 'Spell::EffectSchoolDMG'), ( 0, 5,0x0000004000000000,0x00000000,2128, -1, -1, 2, -1,-1,'Incinerate', 'Spell::EffectSchoolDMG'),
+29 -10
View File
@@ -1329,8 +1329,8 @@ void Player::Update( uint32 p_time )
{ {
if (p_time >= m_DetectInvTimer) if (p_time >= m_DetectInvTimer)
{ {
m_DetectInvTimer = 3000;
HandleStealthedUnitsDetection(); HandleStealthedUnitsDetection();
m_DetectInvTimer = 3000;
} }
else else
m_DetectInvTimer -= p_time; m_DetectInvTimer -= p_time;
@@ -17552,19 +17552,38 @@ void Player::HandleStealthedUnitsDetection()
Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(this, stealthedUnits, u_check); Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(this, stealthedUnits, u_check);
VisitNearbyObject(World::GetMaxVisibleDistance(), searcher); 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); if(!hasAtClient)
m_clientGUIDs.insert((*i)->GetGUID()); {
(*i)->SendUpdateToPlayer(this);
m_clientGUIDs.insert((*i)->GetGUID());
#ifdef TRINITY_DEBUG #ifdef MANGOS_DEBUG
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) 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)); sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i));
#endif #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());
}
} }
} }
} }
+2 -1
View File
@@ -2051,7 +2051,6 @@ class TRINITY_DLL_SPEC Player : public Unit
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow); void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
// Stealth detection system // Stealth detection system
uint32 m_DetectInvTimer;
void HandleStealthedUnitsDetection(); void HandleStealthedUnitsDetection();
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
@@ -2404,6 +2403,8 @@ class TRINITY_DLL_SPEC Player : public Unit
bool m_bCanDelayTeleport; bool m_bCanDelayTeleport;
bool m_bHasDelayedTeleport; bool m_bHasDelayedTeleport;
uint32 m_DetectInvTimer;
// Temporary removed pet cache // Temporary removed pet cache
uint32 m_temporaryUnsummonedPetNumber; uint32 m_temporaryUnsummonedPetNumber;
uint32 m_oldpetspell; uint32 m_oldpetspell;
+1
View File
@@ -10905,6 +10905,7 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const
//-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia) //-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 //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 += (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; return distance < visibleDistance;
} }
+1
View File
@@ -1012,6 +1012,7 @@ enum ReactiveType
// delay time next attack to prevent client attack animation problems // delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200 #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 struct SpellProcEventEntry; // used only privately