Skip to content

Commit 0a98fe0

Browse files
committed
[Player] enable_all_sets only enables hero sets available to the spec
1 parent edec201 commit 0a98fe0

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

engine/dbc/trait_data.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "config.hpp"
88

9+
#include "dbc/dbc.hpp"
910
#include "util/util.hpp"
1011

1112
#include "trait_data.hpp"
@@ -260,6 +261,30 @@ bool trait_data_t::is_granted( const trait_data_t* trait, player_e type, special
260261
return false;
261262
}
262263

264+
std::vector<unsigned> trait_data_t::get_valid_hero_tree_ids( specialization_e spec, bool ptr )
265+
{
266+
auto class_id = util::class_id( dbc::get_class_from_spec( spec ) );
267+
auto _data = data( class_id, talent_tree::SELECTION, ptr );
268+
269+
std::vector<unsigned> id_list;
270+
271+
for ( const auto& entry : _data )
272+
{
273+
for ( const auto& spec_entry : entry.id_spec )
274+
{
275+
if ( spec_entry == static_cast<unsigned>( spec ) )
276+
{
277+
id_list.push_back( entry.id_sub_tree );
278+
}
279+
}
280+
}
281+
282+
auto it = range::unique( id_list );
283+
id_list.erase( it, id_list.end() );
284+
285+
return id_list;
286+
}
287+
263288
util::span<const trait_definition_effect_entry_t> trait_definition_effect_entry_t::data( bool ptr )
264289
{
265290
return SC_DBC_GET_DATA( __trait_definition_effect_data, __ptr_trait_definition_effect_data, ptr );

engine/dbc/trait_data.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct trait_data_t
4747
static bool is_hero_trait_available( const trait_data_t* trait, player_e type, specialization_e spec,
4848
bool ptr = false );
4949
static bool is_granted( const trait_data_t* trait, player_e type, specialization_e spec, bool ptr = false );
50+
static std::vector<unsigned> get_valid_hero_tree_ids( specialization_e spec, bool ptr = false );
5051
static util::span<const trait_data_t> data( bool ptr = false );
5152
static util::span<const trait_data_t> data( talent_tree tree, bool ptr = false );
5253
static util::span<const trait_data_t> data( unsigned class_id, talent_tree tree, bool ptr = false );

engine/player/set_bonus.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,17 @@ void set_bonus_t::initialize()
286286
void set_bonus_t::enable_all_sets()
287287
{
288288
auto set_bonuses = item_set_bonus_t::data( actor->dbc->ptr );
289+
auto hero_tree_ids = trait_data_t::get_valid_hero_tree_ids( actor->_spec, actor->dbc->ptr );
289290

290-
// assume class & spec matching bonuses are tier
291-
// or actor has the correct trait_sub_tree
291+
// assume class & spec matching bonuses are tier or hero tree is available to spec
292292
for ( const auto& bonus : set_bonuses )
293293
{
294294
bool has_class = bonus.class_id == -1 || bonus.class_id == util::class_id( actor->type );
295295
bool has_spec = bonus.spec == -1 || bonus.spec == static_cast<int>( actor->_spec );
296-
bool has_trait_sub_tree = bonus.trait_sub_tree == -1 ? true : range::contains( actor->player_sub_trees, as<unsigned>( bonus.trait_sub_tree ) );
296+
bool has_trait_sub_tree =
297+
bonus.trait_sub_tree == -1 || range::contains( hero_tree_ids, as<unsigned>( bonus.trait_sub_tree ) );
297298

298-
if ( has_class && ( has_spec || has_trait_sub_tree ) )
299+
if ( has_class && has_spec && has_trait_sub_tree )
299300
{
300301
set_bonus_spec_data[ bonus.enum_id ][ composite_idx( bonus, actor ) ][ bonus.bonus - 1 ].overridden = 1;
301302
}

engine/report/report_html_player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3913,7 +3913,7 @@ void print_html_player_results_spec_gear( report::sc_html_stream& os, const play
39133913
{
39143914
int curr_tier = set_bonus_type_e::SET_BONUS_NONE;
39153915

3916-
os << "<tr class=\"left\"><th>Set Bonus</th><td><ul class=\"float\">\n";
3916+
os << "<tr class=\"left nowrap\"><th>Set Bonus</th><td><ul class=\"float\">\n";
39173917

39183918
for ( auto bonus : bonuses )
39193919
{

0 commit comments

Comments
 (0)