Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::list<uint32> objects;
- if (m_caster->GetMapId() == 4406)
- {
- objects.push_back(194583); // axe
- objects.push_back(194584); // arena
- objects.push_back(194585); // lightning
- objects.push_back(194587); // ivory;
- }
- else if (m_spellInfo->Id == 70336)
- objects.push_back(70336);
- if (!objects.empty())
- {
- for(std::list<uint32>::iterator itr = objects.begin(); itr != objects.end(); ++itr)
- {
- // Description:
- // code check out if player is hidden behind GO in circle with diameter equal to GO size
- // with center placed on the perimeter of GO
- // C<- caster
- // / \<- cone of spell
- // / \
- // / (o) \<- shelter object
- // / (T) \<- target in safty circle
- std::list<GameObject*>lObjectList;
- target->GetGameObjectListWithEntryInGrid(lObjectList, target, *itr, target->GetDistance2d(m_caster));
- float fTargetX, fTargetY, fTargetZ;
- float fCasterX, fCasterY, fCasterZ;
- target->GetPosition(fTargetX, fTargetY, fTargetZ);
- m_caster->GetPosition(fCasterX, fCasterY, fCasterZ);
- for (std::list<GameObject*>::iterator itr = lObjectList.begin(); itr != lObjectList.end(); ++itr)
- {
- float fObjectSize = (*itr)->GetGOInfo()->size;
- if (target->GetDistance2d(*itr) > fObjectSize)
- continue;
- float fObjectX, fObjectY, fObjectZ;
- (*itr)->GetPosition(fObjectX, fObjectY, fObjectZ);
- float fAlpha = m_caster->GetAngle(fTargetX, fTargetY);
- float fCircleX, fCircleY;
- fCircleY = fObjectY + fObjectSize*sin(fAlpha);
- fCircleX = fObjectX + fObjectSize*cos(fAlpha);
- if (target->GetDistance2d(fCircleX, fCircleY) <= fObjectSize)
- return false;
- }
- }
- }
Add Comment
Please, Sign In to add comment