mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[10859] Search for linked GO using the original used GO as base of the search
Add some comments for future improvements of this function. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
0c20c0f9f7
commit
a2e068659c
2 changed files with 10 additions and 4 deletions
|
|
@ -835,6 +835,9 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
|
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
|
||||||
|
|
||||||
|
// TODO: allow all traps to be activated, some are without spell
|
||||||
|
// but will have animation and/or are expected to despawn
|
||||||
if(!trapSpell) // checked at load already
|
if(!trapSpell) // checked at load already
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -843,14 +846,17 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
|
||||||
// search nearest linked GO
|
// search nearest linked GO
|
||||||
GameObject* trapGO = NULL;
|
GameObject* trapGO = NULL;
|
||||||
{
|
{
|
||||||
// using original GO distance
|
// search closest with base of used GO, using max range of trap spell as search radius
|
||||||
MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*target,trapEntry,range);
|
MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*this, trapEntry, range);
|
||||||
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO,go_check);
|
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(trapGO, go_check);
|
||||||
|
|
||||||
Cell::VisitGridObjects(this, checker, range);
|
Cell::VisitGridObjects(this, checker, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
// found correct GO
|
// found correct GO
|
||||||
|
|
||||||
|
// TODO: handle the GO with Use()
|
||||||
|
|
||||||
// FIXME: when GO casting will be implemented trap must cast spell to target
|
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||||
if(trapGO)
|
if(trapGO)
|
||||||
target->CastSpell(target, trapSpell, true, NULL, NULL, GetGUID());
|
target->CastSpell(target, trapSpell, true, NULL, NULL, GetGUID());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10858"
|
#define REVISION_NR "10859"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue