Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 KB | None | 0 0
  1. /*
  2. *
  3. * Copyright (C) 2014 Teiby
  4. * Written by Teiby <http://www.teiby.de/>
  5. *
  6. */
  7.  
  8. #ifndef SOLO_3V3_H
  9. #define SOLO_3V3_H
  10.  
  11. // SOLO_3V3_TALENTS found in: TalentTab.dbc -> TalentTabID
  12. const uint32 SOLO_3V3_TALENTS_DPS[] =
  13. {
  14. 182, // assasination
  15. 398, // blood
  16. 399, // frost DK
  17. 746, // arms
  18. 181, // combat
  19. 263, // enhancement
  20. 750, // feral
  21. 815, // fury
  22. 839, // protection (warrior)
  23. 183, // subtlety
  24. 400, // unholy
  25. 845, // protection (paladin)
  26. 855, // retribution
  27. 261, // elemental
  28. 811, // beast mastery
  29. 807, // marskmanship
  30. 809, // survival
  31. 752, // balance
  32. 799, // arcane
  33. 871, // affliction
  34. 851, // fire
  35. 867, // demonology
  36. 795, // shadow
  37. 823, // frost mage
  38. 865, // destruction
  39. 0 // End
  40. };
  41.  
  42. const uint32 SOLO_3V3_TALENTS_MELEE[] =
  43. {
  44. 182, // assasination
  45. 398, // blood
  46. 399, // frost DK
  47. 746, // arms
  48. 181, // combat
  49. 263, // enhancement
  50. 750, // feral
  51. 815, // fury
  52. 839, // protection (warrior)
  53. 183, // subtlety
  54. 400, // unholy
  55. 845, // protection (paladin)
  56. 855, // retribution
  57. 0 // End
  58. };
  59.  
  60. const uint32 SOLO_3V3_TALENTS_CASTER[] =
  61. {
  62. 261, // elemental
  63. 811, // beast mastery
  64. 807, // marskmanship
  65. 809, // survival
  66. 752, // balance
  67. 799, // arcane
  68. 871, // affliction
  69. 851, // fire
  70. 867, // demonology
  71. 795, // shadow
  72. 823, // frost mage
  73. 865, // destruction
  74. 0 // End
  75. };
  76.  
  77. const uint32 SOLO_3V3_TALENTS_HEALER[] =
  78. {
  79. 831, // holy (paladin)
  80. 813, // holy (priest)
  81. 760, // discipline
  82. 262, // restoration (shaman)
  83. 748, // restoration (druid)
  84. 0 // End
  85. };
  86.  
  87. enum Solo3v3TalentCat
  88. {
  89. MELEE = 0,
  90. CASTER,
  91. HEALER,
  92. MAX_TALENT_CAT
  93. };
  94.  
  95. // TalentTab.dbc -> TalentTabID
  96. const uint32 FORBIDDEN_TALENTS_IN_1V1_ARENA[] =
  97. {
  98. // Healer
  99. 201, // PriestDiscipline
  100. 202, // PriestHoly
  101. 382, // PaladinHoly
  102. 262, // ShamanRestoration
  103. 282, // DruidRestoration
  104.  
  105. // Tanks
  106. //383, // PaladinProtection
  107. //163, // WarriorProtection
  108.  
  109. 0 // End
  110. };
  111.  
  112. // Returns MELEE, RANGE or HEALER (depends on talent builds)
  113. static Solo3v3TalentCat GetTalentCatForSolo3v3(Player* player)
  114. {
  115. if (!player || sWorld->getBoolConfig(CONFIG_SOLO_3V3_FILTER_TALENTS) == false)
  116. return MELEE;
  117.  
  118. uint32 count[MAX_TALENT_CAT];
  119. for (int i = 0; i < MAX_TALENT_CAT; i++)
  120. count[i] = 0;
  121.  
  122. for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
  123. {
  124. TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
  125.  
  126. if (!talentInfo)
  127. continue;
  128.  
  129. for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
  130. {
  131. if (talentInfo->RankID[rank] == 0)
  132. continue;
  133.  
  134. if (sWorld->getBoolConfig(CONFIG_SOLO_3V3_FFA_ENABLE))
  135. {
  136. for (int8 i = 0; SOLO_3V3_TALENTS_DPS[i] != 0; i++)
  137. if (SOLO_3V3_TALENTS_DPS[i] == talentInfo->TalentTab)
  138. count[MELEE] += rank + 1;
  139. for (int8 i = 0; SOLO_3V3_TALENTS_HEALER[i] != 0; i++)
  140. if (SOLO_3V3_TALENTS_HEALER[i] == talentInfo->TalentTab)
  141. count[HEALER] += rank + 1;
  142. }
  143.  
  144. }
  145. }
  146.  
  147. uint32 prevCount = 0;
  148. Solo3v3TalentCat talCat = MELEE; // Default MELEE (if no talent points set)
  149. bool isDps = false;
  150. for (int i = 0; i < MAX_TALENT_CAT; i++)
  151. {
  152. if (count[i] > prevCount)
  153. {
  154. talCat = (Solo3v3TalentCat)i;
  155. prevCount = count[i];
  156. }
  157. }
  158.  
  159. return talCat;
  160. }
  161.  
  162. // Return false, if player have invested more than 35 talentpoints in a forbidden talenttree.
  163. static bool Arena1v1CheckTalents(Player* player)
  164. {
  165. if (!player)
  166. return false;
  167.  
  168. if (sWorld->getBoolConfig(CONFIG_ARENA_1V1_BLOCK_FORBIDDEN_TALENTS) == false)
  169. return true;
  170.  
  171. uint32 count = 0;
  172. for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
  173. {
  174. TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
  175.  
  176. if (!talentInfo)
  177. continue;
  178.  
  179. for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
  180. {
  181. if (talentInfo->RankID[rank] == 0)
  182. continue;
  183.  
  184. if (player->HasTalent(talentInfo->RankID[rank], player->GetActiveSpec()))
  185. {
  186. for (int8 i = 0; FORBIDDEN_TALENTS_IN_1V1_ARENA[i] != 0; i++)
  187. if (FORBIDDEN_TALENTS_IN_1V1_ARENA[i] == talentInfo->TalentTab)
  188. count += rank + 1;
  189. }
  190. }
  191. }
  192.  
  193. if (count >= 21)
  194. {
  195. // Dont show error message for healers already in
  196. // arena because of the bonus rewards for healers
  197. if (player->InArena())
  198. return false;
  199. else
  200. {
  201. player->GetSession()->SendAreaTriggerMessage("You can't join, because you have invested too many points in a forbidden talent. Please edit your talents.");
  202. return false;
  203. }
  204. }
  205. else
  206. return true;
  207. }
  208.  
  209. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement