Show
Ignore:
Timestamp:
11/19/08 13:49:07 (17 years ago)
Author:
yumileroy
Message:

[svn] * Reimplemented packet/update forwarding in more generic way
* Implemented far sight spells (Far Sight, Eagle Eye, etc) at unlimited range and properly forward packets
* Implemented bind vision spells (Mind Vision, etc) to forward packets at unlimited distance
* Implemented Sentry Totem (both vision switching/forwarding and alerting)
* Other misc possession fixes
* Added .bindsight and .unbindsight commands

Please test out the above spells (including Mind Control) and report any issues on the forums.

Original author: gvcoman
Date: 2008-11-14 20:40:35-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/GridNotifiers.cpp

    r221 r233  
    4141        iter->getSource()->UpdateVisibilityOf(&i_player); 
    4242        i_player.UpdateVisibilityOf(iter->getSource()); 
    43         if (i_player.isPossessedByPlayer()) 
    44             ((Player*)i_player.GetCharmer())->UpdateVisibilityOf(iter->getSource()); 
     43 
     44        if (!i_player.GetSharedVisionList().empty()) 
     45            for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) 
     46                (*it)->UpdateVisibilityOf(iter->getSource()); 
    4547    } 
    4648} 
     
    149151        if (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist) 
    150152        { 
    151             // Send packet to possessor 
    152             if (iter->getSource()->isPossessedByPlayer()) 
    153                 SendPacket((Player*)iter->getSource()->GetCharmer()); 
     153            // Send packet to all who are sharing the player's vision 
     154            if (!iter->getSource()->GetSharedVisionList().empty()) 
     155            { 
     156                SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin(); 
     157                for ( ; it != iter->getSource()->GetSharedVisionList().end(); ++it) 
     158                    SendPacket(*it); 
     159            } 
     160 
    154161            VisitObject(iter->getSource()); 
    155162        } 
     
    164171        if (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist) 
    165172        { 
    166             // Send packet to possessor 
    167             if (iter->getSource()->isPossessedByPlayer()) 
    168                 SendPacket((Player*)iter->getSource()->GetCharmer()); 
     173            // Send packet to all who are sharing the creature's vision 
     174            if (!iter->getSource()->GetSharedVisionList().empty()) 
     175            { 
     176                SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin(); 
     177                for ( ; it != iter->getSource()->GetSharedVisionList().end(); ++it) 
     178                    SendPacket(*it); 
     179            } 
     180        } 
     181    } 
     182} 
     183 
     184void 
     185Deliverer::Visit(DynamicObjectMapType &m) 
     186{ 
     187    for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) 
     188    { 
     189        if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID())) 
     190        { 
     191            // Send packet back to the caster if the caster has vision of dynamic object 
     192            Player* caster = (Player*)iter->getSource()->GetCaster(); 
     193            if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID() && 
     194                (!i_dist || iter->getSource()->GetDistance(&i_source) <= i_dist)) 
     195                SendPacket(caster); 
    169196        } 
    170197    } 
     
    176203    if (!plr) 
    177204        return; 
     205 
     206    // Don't send the packet to self if not supposed to 
     207    if (!i_toSelf && plr == &i_source) 
     208        return; 
     209 
    178210    // Don't send the packet to possesor if not supposed to 
    179211    if (!i_toPossessor && plr->isPossessing() && plr->GetCharmGUID() == i_source.GetGUID()) 
     
    191223MessageDeliverer::VisitObject(Player* plr) 
    192224{ 
    193     if (i_toSelf || plr != &i_source) 
    194         SendPacket(plr); 
     225    SendPacket(plr); 
    195226} 
    196227 
     
    198229MessageDistDeliverer::VisitObject(Player* plr) 
    199230{ 
    200     if( (i_toSelf || plr != &i_source ) && 
    201         (!i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam())) ) 
     231    if( !i_ownTeamOnly || (i_source.GetTypeId() == TYPEID_PLAYER && plr->GetTeam() == ((Player&)i_source).GetTeam()) ) 
    202232    { 
    203233        SendPacket(plr);