Advertisement
Guest User

npc_solo3v3.h

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