Guest User

Untitled

a guest
May 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.68 KB | None | 0 0
  1. bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id)
  2. {
  3. // normal case
  4. if (spellInfo->AreaId && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id)
  5. return false;
  6.  
  7. // elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup)
  8. if (spellInfo->SpellFamilyName==SPELLFAMILY_POTION)
  9. {
  10. if (uint32 mask = spellmgr.GetSpellElixirMask(spellInfo->Id))
  11. {
  12. if (mask & ELIXIR_BATTLE_MASK)
  13. {
  14. switch (spellInfo->Id)
  15. {
  16. case 45373:
  17. return true;
  18. default: if (zone_id==4075)// Bloodberry Elixir
  19. return true;
  20. }
  21. }
  22. if (mask & ELIXIR_UNSTABLE_MASK)
  23. {
  24. // in the Blade's Edge Mountains Plateaus and Gruul's Lair.
  25. switch(spellInfo->Id)
  26. {
  27. case 40567:
  28. case 40572:
  29. case 40568:
  30. case 40573:
  31. case 40576:
  32. case 40575:
  33. return true;
  34. default: return zone_id ==3522 || map_id==565;
  35. }
  36. }
  37. if (mask & ELIXIR_SHATTRATH_MASK)
  38. {
  39. // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau
  40. switch(spellInfo->Id)
  41. {
  42. case 41608:
  43. case 46839:
  44. case 41609:
  45. case 41610:
  46. case 46837:
  47. case 41611:
  48. return true;
  49. default:
  50. if (zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075)
  51. return true;
  52. }
  53.  
  54. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  55. if (!mapEntry)
  56. return false;
  57.  
  58. return mapEntry->multimap_id==206;
  59. }
  60.  
  61. // elixirs not have another limitations
  62. return true;
  63. }
  64. }
  65.  
  66. // special cases zone check (maps checked by multimap common id)
  67. switch (spellInfo->Id)
  68. {
  69. case 23333: // Warsong Flag
  70. case 23335: // Silverwing Flag
  71. case 46392: // Focused Assault
  72. case 46393: // Brutal Assault
  73. {
  74. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  75. if (!mapEntry)
  76. return false;
  77.  
  78. if (!mapEntry->IsBattleGround())
  79. return false;
  80.  
  81. if (zone_id == 3277)
  82. return true;
  83.  
  84. return false;
  85. }
  86. case 34976: // Netherstorm Flag
  87. {
  88. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  89. if (!mapEntry)
  90. return false;
  91.  
  92. if (!mapEntry->IsBattleGround())
  93. return false;
  94.  
  95. if (zone_id == 3820)
  96. return true;
  97.  
  98. return false;
  99. }
  100. case 32307: // Warmaul Ogre Banner
  101. return area_id == 3610; // return true if area_id is 3610
  102. case 32724: // Gold Team (Alliance)
  103. case 32725: // Green Team (Alliance)
  104. case 32727: // Arena Preparation
  105. case 35774: // Gold Team (Horde)
  106. case 35775: // Green Team (Horde)
  107. {
  108. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  109. if (!mapEntry)
  110. return false;
  111.  
  112. //the follow code doesn't work.
  113. //if(!mapEntry->IsBattleArena())
  114. // return false;
  115.  
  116. //this is the working code, HACK
  117. if (zone_id == 3702 || zone_id == 3968 || zone_id == 3698)
  118. return true;
  119.  
  120. return false;
  121. }
  122. case 41618: // Bottled Nethergon Energy
  123. case 41620: // Bottled Nethergon Vapor
  124. {
  125. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  126. if (!mapEntry)
  127. return false;
  128.  
  129. return mapEntry->multimap_id == 206;
  130. }
  131. case 41617: // Cenarion Mana Salve
  132. case 41619: // Cenarion Healing Salve
  133. {
  134. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  135. if (!mapEntry)
  136. return false;
  137.  
  138. return mapEntry->multimap_id == 207;
  139. }
  140. case 40216: // Dragonmaw Illusion
  141. case 42016: // Dragonmaw Illusion
  142. return area_id == 3759 || area_id == 3966 || area_id == 3939;
  143. case 2584: // Waiting to Resurrect
  144. case 22011: // Spirit Heal Channel
  145. case 22012: // Spirit Heal
  146. //case 24171: // Resurrection Impact Visual
  147. case 42792: // Recently Dropped Flag
  148. case 43681: // Inactive
  149. case 44535: // Spirit Heal (mana)
  150. case 44521: // Preparation
  151. {
  152. MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
  153. if (!mapEntry)
  154. return false;
  155.  
  156. if (!mapEntry->IsBattleGround())
  157. return false;
  158. }
  159. case 45374:
  160. return zone_id==4075;
  161. // Torment of the Worgen
  162. case 30564:
  163. case 30731:
  164. // Redemption of the Fallen
  165. case 30553:
  166. // Wrath of the Titans
  167. case 30610:
  168. // Legacy of the Mountain King
  169. case 30559:
  170. return true;
  171. default:
  172. return map_id==532;
  173. }
  174.  
  175. return true;
  176. }
Add Comment
Please, Sign In to add comment