Guest User

Untitled

a guest
Jan 5th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. std::list<uint32> objects;
  2.  
  3. if (m_caster->GetMapId() == 4406)
  4. {
  5.     objects.push_back(194583); // axe
  6.     objects.push_back(194584); // arena
  7.     objects.push_back(194585); // lightning
  8.     objects.push_back(194587); // ivory;
  9. }
  10. else if (m_spellInfo->Id == 70336)
  11.     objects.push_back(70336);
  12.  
  13. if (!objects.empty())
  14. {
  15.     for(std::list<uint32>::iterator itr = objects.begin(); itr != objects.end(); ++itr)
  16.     {
  17.         // Description:
  18.         // code check out if player is hidden behind GO in circle with diameter equal to GO size
  19.         // with center placed on the perimeter of GO
  20.         //     C<- caster
  21.         //    / \<- cone of spell
  22.         //   /   \
  23.         //  / (o) \<- shelter object
  24.         // /  (T)  \<- target in safty circle
  25.  
  26.         std::list<GameObject*>lObjectList;
  27.         target->GetGameObjectListWithEntryInGrid(lObjectList, target, *itr, target->GetDistance2d(m_caster));
  28.         float fTargetX, fTargetY, fTargetZ;
  29.         float fCasterX, fCasterY, fCasterZ;
  30.         target->GetPosition(fTargetX, fTargetY, fTargetZ);
  31.         m_caster->GetPosition(fCasterX, fCasterY, fCasterZ);
  32.        
  33.         for (std::list<GameObject*>::iterator itr = lObjectList.begin(); itr != lObjectList.end(); ++itr)
  34.         {
  35.             float fObjectSize = (*itr)->GetGOInfo()->size;
  36.             if (target->GetDistance2d(*itr) > fObjectSize)
  37.                 continue;
  38.  
  39.             float fObjectX, fObjectY, fObjectZ;
  40.             (*itr)->GetPosition(fObjectX, fObjectY, fObjectZ);
  41.             float fAlpha = m_caster->GetAngle(fTargetX, fTargetY);
  42.             float fCircleX, fCircleY;
  43.             fCircleY = fObjectY + fObjectSize*sin(fAlpha);
  44.             fCircleX = fObjectX + fObjectSize*cos(fAlpha);
  45.             if (target->GetDistance2d(fCircleX, fCircleY) <= fObjectSize)
  46.                 return false;
  47.         }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment