Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * Copyright (C) 2014 Teiby
- * Written by Teiby <http://www.teiby.de/>
- *
- */
- #ifndef SOLO_3V3_H
- #define SOLO_3V3_H
- // SOLO_3V3_TALENTS found in: TalentTab.dbc -> TalentTabID
- const uint32 SOLO_3V3_TALENTS_DPS[] =
- {
- 182, // assasination
- 398, // blood
- 399, // frost DK
- 746, // arms
- 181, // combat
- 263, // enhancement
- 750, // feral
- 815, // fury
- 839, // protection (warrior)
- 183, // subtlety
- 400, // unholy
- 845, // protection (paladin)
- 855, // retribution
- 261, // elemental
- 811, // beast mastery
- 807, // marskmanship
- 809, // survival
- 752, // balance
- 799, // arcane
- 871, // affliction
- 851, // fire
- 867, // demonology
- 795, // shadow
- 823, // frost mage
- 865, // destruction
- 0 // End
- };
- const uint32 SOLO_3V3_TALENTS_MELEE[] =
- {
- 182, // assasination
- 398, // blood
- 399, // frost DK
- 746, // arms
- 181, // combat
- 263, // enhancement
- 750, // feral
- 815, // fury
- 839, // protection (warrior)
- 183, // subtlety
- 400, // unholy
- 845, // protection (paladin)
- 855, // retribution
- 0 // End
- };
- const uint32 SOLO_3V3_TALENTS_CASTER[] =
- {
- 261, // elemental
- 811, // beast mastery
- 807, // marskmanship
- 809, // survival
- 752, // balance
- 799, // arcane
- 871, // affliction
- 851, // fire
- 867, // demonology
- 795, // shadow
- 823, // frost mage
- 865, // destruction
- 0 // End
- };
- const uint32 SOLO_3V3_TALENTS_HEALER[] =
- {
- 831, // holy (paladin)
- 813, // holy (priest)
- 760, // discipline
- 262, // restoration (shaman)
- 748, // restoration (druid)
- 0 // End
- };
- enum Solo3v3TalentCat
- {
- MELEE = 0,
- CASTER,
- HEALER,
- MAX_TALENT_CAT
- };
- // TalentTab.dbc -> TalentTabID
- const uint32 FORBIDDEN_TALENTS_IN_1V1_ARENA[] =
- {
- // Healer
- 201, // PriestDiscipline
- 202, // PriestHoly
- 382, // PaladinHoly
- 262, // ShamanRestoration
- 282, // DruidRestoration
- // Tanks
- //383, // PaladinProtection
- //163, // WarriorProtection
- 0 // End
- };
- // Returns MELEE, RANGE or HEALER (depends on talent builds)
- static Solo3v3TalentCat GetTalentCatForSolo3v3(Player* player)
- {
- if (!player || sWorld->getBoolConfig(CONFIG_SOLO_3V3_FILTER_TALENTS) == false)
- return MELEE;
- uint32 count[MAX_TALENT_CAT];
- for (int i = 0; i < MAX_TALENT_CAT; i++)
- count[i] = 0;
- for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
- {
- TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
- if (!talentInfo)
- continue;
- for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
- {
- if (talentInfo->RankID[rank] == 0)
- continue;
- if (sWorld->getBoolConfig(CONFIG_SOLO_3V3_FFA_ENABLE))
- {
- for (int8 i = 0; SOLO_3V3_TALENTS_DPS[i] != 0; i++)
- if (SOLO_3V3_TALENTS_DPS[i] == talentInfo->TalentTab)
- count[MELEE] += rank + 1;
- for (int8 i = 0; SOLO_3V3_TALENTS_HEALER[i] != 0; i++)
- if (SOLO_3V3_TALENTS_HEALER[i] == talentInfo->TalentTab)
- count[HEALER] += rank + 1;
- }
- }
- }
- uint32 prevCount = 0;
- Solo3v3TalentCat talCat = MELEE; // Default MELEE (if no talent points set)
- bool isDps = false;
- for (int i = 0; i < MAX_TALENT_CAT; i++)
- {
- if (count[i] > prevCount)
- {
- talCat = (Solo3v3TalentCat)i;
- prevCount = count[i];
- }
- }
- return talCat;
- }
- // Return false, if player have invested more than 35 talentpoints in a forbidden talenttree.
- static bool Arena1v1CheckTalents(Player* player)
- {
- if (!player)
- return false;
- if (sWorld->getBoolConfig(CONFIG_ARENA_1V1_BLOCK_FORBIDDEN_TALENTS) == false)
- return true;
- uint32 count = 0;
- for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
- {
- TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
- if (!talentInfo)
- continue;
- for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank)
- {
- if (talentInfo->RankID[rank] == 0)
- continue;
- if (player->HasTalent(talentInfo->RankID[rank], player->GetActiveSpec()))
- {
- for (int8 i = 0; FORBIDDEN_TALENTS_IN_1V1_ARENA[i] != 0; i++)
- if (FORBIDDEN_TALENTS_IN_1V1_ARENA[i] == talentInfo->TalentTab)
- count += rank + 1;
- }
- }
- }
- if (count >= 21)
- {
- // Dont show error message for healers already in
- // arena because of the bonus rewards for healers
- if (player->InArena())
- return false;
- else
- {
- player->GetSession()->SendAreaTriggerMessage("You can't join, because you have invested too many points in a forbidden talent. Please edit your talents.");
- return false;
- }
- }
- else
- return true;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement