Skip to content

Commit

Permalink
Phase one of WoW client data access refactorization / rewriting.
Browse files Browse the repository at this point in the history
sc_array_t, sc_data_t, sc_data_access_t are gone. sc_array_t, sc_data_t are fully replaced by the dbc_t, now extended to handle all "raw access" to client data. This also means that the days of massive memory allocations is over. Everything is accessed using the static data included in the binary through const safety.

Second big change is that spell_data_t, spelleffect_data_t, talent_t are now the proper access classes for individual spell/effect/talent data. Each of the structs has gained an access method api to each of the fields in the struct. Raw value access is still retained, obviously, but should be avoided unless you know what oyu are doing(tm). Additionally, the enumeration based access to effects of a spell has been removed from the data access APIs.

In many cases, class modules had to change. I have changed them to use the:
a) dbc_t where needed ( player_t, sim_t "xx_data" variable has changed to "dbc" variable)
b) spells, to use the run time linked (cached) pointers, in spell_data_t, spelleffect_data_t. This is not done fully as of yet.
c) Class modules that used the "enum based" spell/effect data access have been converted to use the effect id / effect number based access.

In addition to all this, thread safety has been implemented where applicable, and obsolete / unused methods have been removed throughout the data access system.

This commit also changes the contents of a few files:
a) data_definitions.hh no longer contains the "new" spell_data_t, spelleffect_data_t, talent_t structs, they have moved to simulationcraft.h, as they gained functionality
b) sc_data_access.cpp is removed
c) sc_const_data.cpp contains the implementation for dbc_t struct
d) sc_data.cpp contains the implementation for spell_data_t, spelleffect_data_t, talent_t



git-svn-id: https://simulationcraft.googlecode.com/svn/trunk@7876 3b4652a1-8050-0410-ac47-3d40261b0f8b
  • Loading branch information
navv1234 committed Mar 2, 2011
1 parent caf9dae commit ce14344
Show file tree
Hide file tree
Showing 40 changed files with 4,103 additions and 5,106 deletions.
6 changes: 3 additions & 3 deletions dbc_extract/dbc/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,9 @@ def initialize_data_model(build, obj):
# Then, derive patch classes from base
for build_id in sorted(_DIFF_DATA.keys()):
for dbc_file_name, dbc_fields in _DBC_FIELDS.iteritems():
if build_id > build:
break

class_base_name = dbc_file_name.split('.')[0].replace('-', '_')
class_name = r'%s%d' % ( class_base_name, build )
dbc_diff_data = _DIFF_DATA.get(build_id, { }).get(dbc_file_name)
Expand Down Expand Up @@ -958,6 +961,3 @@ def initialize_data_model(build, obj):
del cls._field_fmt[idx_field]
delattr(cls, diff_data[0])

if build_id >= build:
break

1 change: 0 additions & 1 deletion engine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ SRC =\
sc_const_data.cpp \
sc_consumable.cpp \
sc_data.cpp \
sc_data_access.cpp \
sc_death_knight.cpp \
sc_druid.cpp \
sc_enchant.cpp \
Expand Down
149 changes: 0 additions & 149 deletions engine/data_definitions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,152 +15,6 @@ struct spell_data_t;
struct spelleffect_data_t;
struct talent_data_t;

struct dbc_t
{
static void set_ptr( bool );
static bool get_ptr();
static const char* build_level();
static const char* wow_version();
static void init();
static void de_init();
static int glyphs( std::vector<unsigned>& glyph_ids, int cid );

static void create_spell_data_index();
static spell_data_t** get_spell_data_index();
static unsigned get_spell_data_index_size();

static void create_spelleffect_data_index();
static spelleffect_data_t** get_spelleffect_data_index();
static unsigned get_spelleffect_data_index_size();

static void create_talent_data_index();
static talent_data_t** get_talent_data_index();
static unsigned get_talent_data_index_size();
};

struct spell_data_t {
const char * name; // Spell name from Spell.dbc stringblock (enGB)
unsigned id; // Spell ID in dbc
unsigned flags; // Unused for now, 0x00 for all
double prj_speed; // Projectile Speed
unsigned school; // Spell school mask
int power_type; // Resource type
unsigned class_mask; // Class mask for spell
unsigned race_mask; // Racial mask for the spell
int scaling_type; // Array index for gtSpellScaling.dbc. -1 means the last sub-array, 0 disabled
double extra_coeff; // An "extra" coefficient (used for some spells to indicate AP based coefficient)
// SpellLevels.dbc
unsigned spell_level; // Spell learned on level. NOTE: Only accurate for "class abilities"
unsigned max_level; // Maximum level for scaling
// SpellRange.dbc
double min_range; // Minimum range in yards
double max_range; // Maximum range in yards
// SpellCooldown.dbc
unsigned cooldown; // Cooldown in milliseconds
unsigned gcd; // GCD in milliseconds
// SpellCategories.dbc
unsigned category; // Spell category (for shared cooldowns, effects?)
// SpellDuration.dbc
double duration; // Spell duration in milliseconds
// SpellPower.dbc
unsigned cost; // Resource cost
// SpellRuneCost.dbc
unsigned rune_cost; // Bitmask of rune cost 0x1, 0x2 = Blood | 0x4, 0x8 = Unholy | 0x10, 0x20 = Frost
unsigned runic_power_gain; // Amount of runic power gained ( / 10 )
// SpellAuraOptions.dbc
unsigned max_stack; // Maximum stack size for spell
unsigned proc_chance; // Spell proc chance in percent
unsigned proc_charges; // Per proc charge amount
// SpellScaling.dbc
int cast_min; // Minimum casting time in milliseconds
int cast_max; // Maximum casting time in milliseconds
int cast_div; // A divisor used in the formula for casting time scaling (20 always?)
double c_scaling; // A scaling multiplier for level based scaling
unsigned c_scaling_level; // A scaling divisor for level based scaling
// SpellEffect.dbc
unsigned effect[3]; // Effect identifiers
// Spell.dbc flags
unsigned attributes[10]; // Spell.dbc "flags", record field 1..10, note that 12694 added a field here after flags_7
const char * desc; // Spell.dbc description stringblock
const char * tooltip; // Spell.dbc tooltip stringblock
// SpellDescriptionVariables.dbc
const char * desc_vars; // Spell description variable stringblock, if present

// Pointers for runtime linking
spelleffect_data_t* effect1;
spelleffect_data_t* effect2;
spelleffect_data_t* effect3;

static spell_data_t* list();
static spell_data_t* nil();
static spell_data_t* find( unsigned, const std::string& confirmation = std::string() );
static spell_data_t* find( const std::string& name );
static void link();
};

// SpellEffect.dbc
struct spelleffect_data_t {
unsigned id; // Effect id
unsigned flags; // Unused for now, 0x00 for all
unsigned spell_id; // Spell this effect belongs to
unsigned index; // Effect index for the spell
effect_type_t type; // Effect type
effect_subtype_t subtype; // Effect sub-type
// SpellScaling.dbc
double m_avg; // Effect average spell scaling multiplier
double m_delta; // Effect delta spell scaling multiplier
double m_unk; // Unused effect scaling multiplier
//
double coeff; // Effect coefficient
double amplitude; // Effect amplitude (e.g., tick time)
// SpellRadius.dbc
double radius; // Minimum spell radius
double radius_max; // Maximum spell radius
//
int base_value; // Effect value
int misc_value; // Effect miscellaneous value
int misc_value_2; // Effect miscellaneous value 2
int trigger_spell_id;// Effect triggers this spell id
double m_chain; // Effect chain multiplier
double pp_combo_points; // Effect points per combo points
double real_ppl; // Effect real points per level
int die_sides; // Effect damage range

// Pointers for runtime linking
spell_data_t* spell;
spell_data_t* trigger_spell;

static spelleffect_data_t* list();
static spelleffect_data_t* nil();
static spelleffect_data_t* find( unsigned );
static void link();
};

struct talent_data_t {
const char * name; // Talent name
unsigned id; // Talent id
unsigned flags; // Unused for now, 0x00 for all
unsigned tab_page; // Talent tab page
unsigned m_class; // Class mask
unsigned m_pet; // Pet mask
unsigned dependance; // Talent depends on this talent id
unsigned depend_rank; // Requires this rank of depended talent
unsigned col; // Talent column
unsigned row; // Talent row
unsigned rank_id[3]; // Talent spell rank identifiers for ranks 1..3

// Pointers for runtime linking
spell_data_t* spell1;
spell_data_t* spell2;
spell_data_t* spell3;

static talent_data_t* list();
static talent_data_t* nil();
static talent_data_t* find( unsigned, const std::string& confirmation = std::string() );
static talent_data_t* find( const std::string& name );
static void link();
};

struct random_prop_data_t {
unsigned ilevel;
double p_epic[5];
Expand Down Expand Up @@ -211,9 +65,6 @@ struct item_data_t {
int socket_color[3]; // item_socket_color
int gem_properties;
int id_socket_bonus;

static item_data_t* list();
static item_data_t* find( unsigned item_id );
};

struct item_scale_data_t {
Expand Down
Loading

0 comments on commit ce14344

Please sign in to comment.