diff --git a/ARL.lua b/ARL.lua index 4bdeb48..9738d07 100644 --- a/ARL.lua +++ b/ARL.lua @@ -95,6 +95,9 @@ private.trainer_list = {} private.seasonal_list = {} private.vendor_list = {} +-- Filter flags - defined in Constants.lua +local F = private.filter_flags + ------------------------------------------------------------------------------ -- Data which is stored regarding a players statistics (luadoc copied from Collectinator, needs updating) ------------------------------------------------------------------------------ @@ -1156,8 +1159,6 @@ end -- do -- Filter flag functions ------------------------------------------------------------------------------- do - local F_ALLIANCE, F_HORDE = 1, 2 - ------------------------------------------------------------------------------- -- Item "rarity" ------------------------------------------------------------------------------- @@ -1167,12 +1168,11 @@ do -- Its keys and values are populated the first time CanDisplayRecipe() is called. local HardFilterFlags, SoftFilterFlags, RepFilterFlags - local F_DK, F_DRUID, F_HUNTER, F_MAGE, F_PALADIN, F_PRIEST, F_SHAMAN, F_ROGUE, F_WARLOCK, F_WARRIOR = 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 local ClassFilterFlags = { - ["deathknight"] = F_DK, ["druid"] = F_DRUID, ["hunter"] = F_HUNTER, - ["mage"] = F_MAGE, ["paladin"] = F_PALADIN, ["priest"] = F_PRIEST, - ["shaman"] = F_SHAMAN, ["rogue"] = F_ROGUE, ["warlock"] = F_WARLOCK, - ["warrior"] = F_WARRIOR, + ["deathknight"] = F.DK, ["druid"] = F.DRUID, ["hunter"] = F.HUNTER, + ["mage"] = F.MAGE, ["paladin"] = F.PALADIN, ["priest"] = F.PRIEST, + ["shaman"] = F.SHAMAN, ["rogue"] = F.ROGUE, ["warlock"] = F.WARLOCK, + ["warrior"] = F.WARRIOR, } ---Scans a specific recipe to determine if it is to be displayed or not. @@ -1233,12 +1233,6 @@ do -- Check the hard filter flags ------------------------------------------------------------------------------- if not HardFilterFlags then - local F_IBOE, F_IBOP, F_IBOA, F_RBOE, F_RBOP, F_RBOA = 36, 37, 38, 40, 41, 42 - local F_DPS, F_TANK, F_HEALER, F_CASTER = 51, 52, 53, 54 - local F_CLOTH, F_LEATHER, F_MAIL, F_PLATE, F_CLOAK, F_TRINKET, F_RING, F_NECK, F_SHIELD = 56, 57, 58, 59, 60, 61, 62, 63, 64 - local F_1H, F_2H, F_AXE, F_SWORD, F_MACE, F_POLEARM, F_DAGGER = 66, 67, 68, 69, 70, 71, 72 - local F_STAFF, F_WAND, F_THROWN, F_BOW, F_XBOW, F_AMMO, F_FIST, F_GUN = 73, 74, 75, 76, 77, 78, 79, 80 - local binding_filters = filter_db.binding local player_filters = filter_db.player local armor_filters = filter_db.item.armor @@ -1248,49 +1242,49 @@ do ------------------------------------------------------------------------------------------------ -- Binding flags. ------------------------------------------------------------------------------------------------ - ["itemboe"] = { flag = F_IBOE, sv_root = binding_filters }, - ["itembop"] = { flag = F_IBOP, sv_root = binding_filters }, - ["itemboa"] = { flag = F_IBOA, sv_root = binding_filters }, - ["recipeboe"] = { flag = F_RBOE, sv_root = binding_filters }, - ["recipebop"] = { flag = F_RBOP, sv_root = binding_filters }, - ["recipeboa"] = { flag = F_RBOA, sv_root = binding_filters }, + ["itemboe"] = { flag = F.IBOE, sv_root = binding_filters }, + ["itembop"] = { flag = F.IBOP, sv_root = binding_filters }, + ["itemboa"] = { flag = F.IBOA, sv_root = binding_filters }, + ["recipeboe"] = { flag = F.RBOE, sv_root = binding_filters }, + ["recipebop"] = { flag = F.RBOP, sv_root = binding_filters }, + ["recipeboa"] = { flag = F.RBOA, sv_root = binding_filters }, ------------------------------------------------------------------------------------------------ -- Player Type flags. ------------------------------------------------------------------------------------------------ - ["melee"] = { flag = F_DPS, sv_root = player_filters }, - ["tank"] = { flag = F_TANK, sv_root = player_filters }, - ["healer"] = { flag = F_HEALER, sv_root = player_filters }, - ["caster"] = { flag = F_CASTER, sv_root = player_filters }, + ["melee"] = { flag = F.DPS, sv_root = player_filters }, + ["tank"] = { flag = F.TANK, sv_root = player_filters }, + ["healer"] = { flag = F.HEALER, sv_root = player_filters }, + ["caster"] = { flag = F.CASTER, sv_root = player_filters }, ------------------------------------------------------------------------------------------------ -- Armor flags. ------------------------------------------------------------------------------------------------ - ["cloth"] = { flag = F_CLOTH, sv_root = armor_filters }, - ["leather"] = { flag = F_LEATHER, sv_root = armor_filters }, - ["mail"] = { flag = F_MAIL, sv_root = armor_filters }, - ["plate"] = { flag = F_PLATE, sv_root = armor_filters }, - ["trinket"] = { flag = F_TRINKET, sv_root = armor_filters }, - ["cloak"] = { flag = F_CLOAK, sv_root = armor_filters }, - ["ring"] = { flag = F_RING, sv_root = armor_filters }, - ["necklace"] = { flag = F_NECK, sv_root = armor_filters }, - ["shield"] = { flag = F_SHIELD, sv_root = armor_filters }, + ["cloth"] = { flag = F.CLOTH, sv_root = armor_filters }, + ["leather"] = { flag = F.LEATHER, sv_root = armor_filters }, + ["mail"] = { flag = F.MAIL, sv_root = armor_filters }, + ["plate"] = { flag = F.PLATE, sv_root = armor_filters }, + ["trinket"] = { flag = F.TRINKET, sv_root = armor_filters }, + ["cloak"] = { flag = F.CLOAK, sv_root = armor_filters }, + ["ring"] = { flag = F.RING, sv_root = armor_filters }, + ["necklace"] = { flag = F.NECK, sv_root = armor_filters }, + ["shield"] = { flag = F.SHIELD, sv_root = armor_filters }, ------------------------------------------------------------------------------------------------ -- Weapon flags. ------------------------------------------------------------------------------------------------ - ["onehand"] = { flag = F_1H, sv_root = weapon_filters }, - ["twohand"] = { flag = F_2H, sv_root = weapon_filters }, - ["axe"] = { flag = F_AXE, sv_root = weapon_filters }, - ["sword"] = { flag = F_SWORD, sv_root = weapon_filters }, - ["mace"] = { flag = F_MACE, sv_root = weapon_filters }, - ["polearm"] = { flag = F_POLEARM, sv_root = weapon_filters }, - ["dagger"] = { flag = F_DAGGER, sv_root = weapon_filters }, - ["fist"] = { flag = F_FIST, sv_root = weapon_filters }, - ["gun"] = { flag = F_GUN, sv_root = weapon_filters }, - ["staff"] = { flag = F_STAFF, sv_root = weapon_filters }, - ["wand"] = { flag = F_WAND, sv_root = weapon_filters }, - ["thrown"] = { flag = F_THROWN, sv_root = weapon_filters }, - ["bow"] = { flag = F_BOW, sv_root = weapon_filters }, - ["crossbow"] = { flag = F_XBOW, sv_root = weapon_filters }, - ["ammo"] = { flag = F_AMMO, sv_root = weapon_filters }, + ["onehand"] = { flag = F.ONE_HAND, sv_root = weapon_filters }, + ["twohand"] = { flag = F.TWO_HAND, sv_root = weapon_filters }, + ["axe"] = { flag = F.AXE, sv_root = weapon_filters }, + ["sword"] = { flag = F.SWORD, sv_root = weapon_filters }, + ["mace"] = { flag = F.MACE, sv_root = weapon_filters }, + ["polearm"] = { flag = F.POLEARM, sv_root = weapon_filters }, + ["dagger"] = { flag = F.DAGGER, sv_root = weapon_filters }, + ["fist"] = { flag = F.FIST, sv_root = weapon_filters }, + ["gun"] = { flag = F.GUN, sv_root = weapon_filters }, + ["staff"] = { flag = F.STAFF, sv_root = weapon_filters }, + ["wand"] = { flag = F.WAND, sv_root = weapon_filters }, + ["thrown"] = { flag = F.THROWN, sv_root = weapon_filters }, + ["bow"] = { flag = F.BOW, sv_root = weapon_filters }, + ["crossbow"] = { flag = F.XBOW, sv_root = weapon_filters }, + ["ammo"] = { flag = F.AMMO, sv_root = weapon_filters }, } end @@ -1306,48 +1300,40 @@ do if not RepFilterFlags then local rep_filters = filter_db.rep - local F_ARGENTDAWN, F_CENARION_CIRCLE, F_THORIUM_BROTHERHOOD, F_TIMBERMAW_HOLD, F_ZANDALAR = 96, 97, 98, 99, 100 - local F_ALDOR, F_ASHTONGUE, F_CENARION_EXPEDITION, F_HELLFIRE, F_CONSORTIUM = 101, 102, 103, 104, 105 - local F_KOT, F_LOWERCITY, F_NAGRAND, F_SCALE_SANDS, F_SCRYER, F_SHATAR = 106, 107, 108, 109, 110, 111 - local F_SHATTEREDSUN, F_SPOREGGAR, F_VIOLETEYE = 112, 113, 114 - local F_ARGENTCRUSADE, F_FRENZYHEART, F_EBONBLADE, F_KIRINTOR, F_HODIR = 115, 116, 117, 118, 119 - local F_KALUAK, F_ORACLES, F_WYRMREST, F_WRATHCOMMON1, F_WRATHCOMMON2 = 120, 121, 122, 123, 124 - local F_WRATHCOMMON3, F_WRATHCOMMON4, F_WRATHCOMMON5, F_ASHEN_VERDICT = 125, 126, 127, 128 - RepFilterFlags = { - [F_ARGENTDAWN] = rep_filters.argentdawn, - [F_CENARION_CIRCLE] = rep_filters.cenarioncircle, - [F_THORIUM_BROTHERHOOD] = rep_filters.thoriumbrotherhood, - [F_TIMBERMAW_HOLD] = rep_filters.timbermaw, - [F_ZANDALAR] = rep_filters.zandalar, - [F_ALDOR] = rep_filters.aldor, - [F_ASHTONGUE] = rep_filters.ashtonguedeathsworn, - [F_CENARION_EXPEDITION] = rep_filters.cenarionexpedition, - [F_HELLFIRE] = rep_filters.hellfire, - [F_CONSORTIUM] = rep_filters.consortium, - [F_KOT] = rep_filters.keepersoftime, - [F_LOWERCITY] = rep_filters.lowercity, - [F_NAGRAND] = rep_filters.nagrand, - [F_SCALE_SANDS] = rep_filters.scaleofthesands, - [F_SCRYER] = rep_filters.scryer, - [F_SHATAR] = rep_filters.shatar, - [F_SHATTEREDSUN] = rep_filters.shatteredsun, - [F_SPOREGGAR] = rep_filters.sporeggar, - [F_VIOLETEYE] = rep_filters.violeteye, - [F_ARGENTCRUSADE] = rep_filters.argentcrusade, - [F_FRENZYHEART] = rep_filters.frenzyheart, - [F_EBONBLADE] = rep_filters.ebonblade, - [F_KIRINTOR] = rep_filters.kirintor, - [F_HODIR] = rep_filters.sonsofhodir, - [F_KALUAK] = rep_filters.kaluak, - [F_ORACLES] = rep_filters.oracles, - [F_WYRMREST] = rep_filters.wyrmrest, - [F_WRATHCOMMON1] = rep_filters.wrathcommon1, - [F_WRATHCOMMON2] = rep_filters.wrathcommon2, - [F_WRATHCOMMON3] = rep_filters.wrathcommon3, - [F_WRATHCOMMON4] = rep_filters.wrathcommon4, - [F_WRATHCOMMON5] = rep_filters.wrathcommon5, - [F_ASHEN_VERDICT] = rep_filters.ashenverdict, + [F.ARGENTDAWN] = rep_filters.argentdawn, + [F.CENARION_CIRCLE] = rep_filters.cenarioncircle, + [F.THORIUM_BROTHERHOOD] = rep_filters.thoriumbrotherhood, + [F.TIMBERMAW_HOLD] = rep_filters.timbermaw, + [F.ZANDALAR] = rep_filters.zandalar, + [F.ALDOR] = rep_filters.aldor, + [F.ASHTONGUE] = rep_filters.ashtonguedeathsworn, + [F.CENARION_EXPEDITION] = rep_filters.cenarionexpedition, + [F.HELLFIRE] = rep_filters.hellfire, + [F.CONSORTIUM] = rep_filters.consortium, + [F.KOT] = rep_filters.keepersoftime, + [F.LOWERCITY] = rep_filters.lowercity, + [F.NAGRAND] = rep_filters.nagrand, + [F.SCALE_SANDS] = rep_filters.scaleofthesands, + [F.SCRYER] = rep_filters.scryer, + [F.SHATAR] = rep_filters.shatar, + [F.SHATTEREDSUN] = rep_filters.shatteredsun, + [F.SPOREGGAR] = rep_filters.sporeggar, + [F.VIOLETEYE] = rep_filters.violeteye, + [F.ARGENTCRUSADE] = rep_filters.argentcrusade, + [F.FRENZYHEART] = rep_filters.frenzyheart, + [F.EBONBLADE] = rep_filters.ebonblade, + [F.KIRINTOR] = rep_filters.kirintor, + [F.HODIR] = rep_filters.sonsofhodir, + [F.KALUAK] = rep_filters.kaluak, + [F.ORACLES] = rep_filters.oracles, + [F.WYRMREST] = rep_filters.wyrmrest, + [F.WRATHCOMMON1] = rep_filters.wrathcommon1, + [F.WRATHCOMMON2] = rep_filters.wrathcommon2, + [F.WRATHCOMMON3] = rep_filters.wrathcommon3, + [F.WRATHCOMMON4] = rep_filters.wrathcommon4, + [F.WRATHCOMMON5] = rep_filters.wrathcommon5, + [F.ASHEN_VERDICT] = rep_filters.ashenverdict, } end local rep_display = true @@ -1389,19 +1375,17 @@ do -- If one of these is true (ie: we want to see trainers and there is a trainer flag) we display the recipe ------------------------------------------------------------------------------------------------ if not SoftFilterFlags then - local F_TRAINER, F_VENDOR, F_INSTANCE, F_RAID, F_SEASONAL, F_QUEST, F_PVP, F_WORLD_DROP, F_MOB_DROP, F_DISC = 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 - SoftFilterFlags = { - ["trainer"] = { flag = F_TRAINER, sv_root = obtain_filters }, - ["vendor"] = { flag = F_VENDOR, sv_root = obtain_filters }, - ["instance"] = { flag = F_INSTANCE, sv_root = obtain_filters }, - ["raid"] = { flag = F_RAID, sv_root = obtain_filters }, - ["seasonal"] = { flag = F_SEASONAL, sv_root = obtain_filters }, - ["quest"] = { flag = F_QUEST, sv_root = obtain_filters }, - ["pvp"] = { flag = F_PVP, sv_root = obtain_filters }, - ["worlddrop"] = { flag = F_WORLD_DROP, sv_root = obtain_filters }, - ["mobdrop"] = { flag = F_MOB_DROP, sv_root = obtain_filters }, - ["discovery"] = { flag = F_DISC, sv_root = obtain_filters }, + ["trainer"] = { flag = F.TRAINER, sv_root = obtain_filters }, + ["vendor"] = { flag = F.VENDOR, sv_root = obtain_filters }, + ["instance"] = { flag = F.INSTANCE, sv_root = obtain_filters }, + ["raid"] = { flag = F.RAID, sv_root = obtain_filters }, + ["seasonal"] = { flag = F.SEASONAL, sv_root = obtain_filters }, + ["quest"] = { flag = F.QUEST, sv_root = obtain_filters }, + ["pvp"] = { flag = F.PVP, sv_root = obtain_filters }, + ["worlddrop"] = { flag = F.WORLD_DROP, sv_root = obtain_filters }, + ["mobdrop"] = { flag = F.MOB_DROP, sv_root = obtain_filters }, + ["discovery"] = { flag = F.DISC, sv_root = obtain_filters }, } end diff --git a/Constants.lua b/Constants.lua index b31fdb0..0b40eef 100644 --- a/Constants.lua +++ b/Constants.lua @@ -97,9 +97,9 @@ private.filter_strings = { } ------------------------------------------------------------------------------- --- Acquire flags. +-- Acquire types. ------------------------------------------------------------------------------- -private.acquire_flags = { +private.acquire_types = { ["TRAINER"] = 1, ["VENDOR"] = 2, ["MOB"] = 3, @@ -121,9 +121,74 @@ private.acquire_strings = { [8] = "CUSTOM", } +------------------------------------------------------------------------------- +-- Reputation levels. +------------------------------------------------------------------------------- +private.rep_levels = { + ["FRIENDLY"] = 1, + ["HONORED"] = 2, + ["REVERED"] = 3, + ["EXALTED"] = 4, +} + private.rep_level_strings = { [1] = "FRIENDLY", [2] = "HONORED", [3] = "REVERED", [4] = "EXALTED", -} \ No newline at end of file +} + +------------------------------------------------------------------------------- +-- Factions. +------------------------------------------------------------------------------- +private.faction_ids = { + ["THORIUM_BROTHERHOOD"] = 59, + ["ZANDALAR"] = 270, + ["ARGENTDAWN"] = 529, + ["TIMBERMAW_HOLD"] = 576, + ["WINTERSPRING"] = 589, + ["CENARION_CIRCLE"] = 609, + ["ALDOR"] = 932, + ["CONSORTIUM"] = 933, + ["SCRYER"] = 934, + ["MAGHAR"] = 941, + ["HONOR_HOLD"] = 946, + ["THRALLMAR"] = 947, + ["SPOREGGAR"] = 970, + ["KURENI"] = 978, + ["LOWERCITY"] = 1011, + ["ASHTONGUE"] = 1012, + ["KALUAK"] = 1073, + ["KIRINTOR"] = 1090, + ["WYRMREST"] = 1091, + ["EBONBLADE"] = 1098, + ["ARGENTCRUSADE"] = 1106, + ["HODIR"] = 1119, + ["ASHEN_VERDICT"] = 1156, +} + +private.faction_strings = { + [59] = "THORIUM_BROTHERHOOD", + [270] = "ZANDALAR", + [529] = "ARGENTDAWN", + [576] = "TIMBERMAW_HOLD", + [589] = "WINTERSPRING", + [609] = "CENARION_CIRCLE", + [932] = "ALDOR", + [933] = "CONSORTIUM", + [934] = "SCRYER", + [941] = "MAGHAR", + [946] = "HONOR_HOLD", + [947] = "THRALLMAR", + [970] = "SPOREGGAR", + [978] = "KURENI", + [1011] = "LOWERCITY", + [1012] = "ASHTONGUE", + [1073] = "KALUAK", + [1090] = "KIRINTOR", + [1091] = "WYRMREST", + [1098] = "EBONBLADE", + [1106] = "ARGENTCRUSADE", + [1119] = "HODIR", + [1156] = "ASHEN_VERDICT", +} diff --git a/Database/Alchemy.lua b/Database/Alchemy.lua index 0835310..eb69b4c 100644 --- a/Database/Alchemy.lua +++ b/Database/Alchemy.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Blacksmithing.lua b/Database/Blacksmithing.lua index f563251..4743dbf 100644 --- a/Database/Blacksmithing.lua +++ b/Database/Blacksmithing.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - -------------------------------------------------------------------------------- --- Reputation Levels -------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Cooking.lua b/Database/Cooking.lua index f3e1d46..29a812d 100644 --- a/Database/Cooking.lua +++ b/Database/Cooking.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Enchanting.lua b/Database/Enchanting.lua index ffc63ff..b33edab 100644 --- a/Database/Enchanting.lua +++ b/Database/Enchanting.lua @@ -34,22 +34,15 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Engineering.lua b/Database/Engineering.lua index 4f54402..e139e31 100644 --- a/Database/Engineering.lua +++ b/Database/Engineering.lua @@ -34,27 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Acquire Flags --------------------------------------------------------------------------------------------------------------------- -local R_WINTERSPRING = 589 - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/FirstAid.lua b/Database/FirstAid.lua index fe4045c..2d50f0d 100644 --- a/Database/FirstAid.lua +++ b/Database/FirstAid.lua @@ -34,23 +34,13 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Acquire Flags --------------------------------------------------------------------------------------------------------------------- -local R_ARGENTDAWN = 529 - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- local FRIENDLY = 1 local HONORED = 2 local REVERED = 3 diff --git a/Database/Inscription.lua b/Database/Inscription.lua index 38a0ce0..b0065f6 100644 --- a/Database/Inscription.lua +++ b/Database/Inscription.lua @@ -37,14 +37,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Jewelcrafting.lua b/Database/Jewelcrafting.lua index 0a7adde..eed87ac 100644 --- a/Database/Jewelcrafting.lua +++ b/Database/Jewelcrafting.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Leatherworking.lua b/Database/Leatherworking.lua index bc53f2d..4a591bf 100644 --- a/Database/Leatherworking.lua +++ b/Database/Leatherworking.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - -------------------------------------------------------------------------------- --- Reputation Levels -------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Runeforging.lua b/Database/Runeforging.lua index 357ebe8..40aa480 100644 --- a/Database/Runeforging.lua +++ b/Database/Runeforging.lua @@ -34,14 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Smelting.lua b/Database/Smelting.lua index 0734ebb..4bd6dd7 100644 --- a/Database/Smelting.lua +++ b/Database/Smelting.lua @@ -34,14 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Database/Tailoring.lua b/Database/Tailoring.lua index e260a65..a939a73 100644 --- a/Database/Tailoring.lua +++ b/Database/Tailoring.lua @@ -34,22 +34,17 @@ local R_COMMON, R_UNCOMMON, R_RARE, R_EPIC, R_LEGENDARY, R_ARTIFACT = 1, 2, 3, 4 local GAME_ORIG, GAME_TBC, GAME_WOTLK = 0, 1, 2 ------------------------------------------------------------------------------- --- Filter flags +-- Filter flags. Acquire types, and Reputation levels. ------------------------------------------------------------------------------- -local F = private.filter_flags - -------------------------------------------------------------------------------- --- Acquire types -------------------------------------------------------------------------------- -local A = private.acquire_flags - --------------------------------------------------------------------------------------------------------------------- --- Reputation Levels --------------------------------------------------------------------------------------------------------------------- -local FRIENDLY = 1 -local HONORED = 2 -local REVERED = 3 -local EXALTED = 4 +local F = private.filter_flags +local A = private.acquire_types +local REP = private.rep_levels +local FAC = private.faction_ids + +local FRIENDLY = 1 +local HONORED = 2 +local REVERED = 3 +local EXALTED = 4 local initialized = false local num_recipes = 0 diff --git a/Datamine.lua b/Datamine.lua index fa9f336..f47c013 100644 --- a/Datamine.lua +++ b/Datamine.lua @@ -1456,8 +1456,9 @@ do local FILTER_STRINGS = private.filter_strings local ACQUIRE_STRINGS = private.acquire_strings - local ACQUIRE_FLAGS = private.acquire_flags + local ACQUIRE_TYPES = private.acquire_types local REP_LEVELS = private.rep_level_strings + local FACTION_NAMES = private.faction_strings local function Sort_AscID(a, b) local reca, recb = private.recipe_list[a], private.recipe_list[b] @@ -1500,10 +1501,11 @@ do for index, name in ipairs(addon.sorted_recipes) do local data = private.recipe_list[name] local flag_string + local specialty = not data.specialty and "" or (", "..data.specialty) tinsert(output, string.format("-- %s -- %d", data.name, data.spell_id)) - tinsert(output, string.format("AddRecipe(%d, %d, %s, %s, %s, %d, %d, %d, %d, %s)", + tinsert(output, string.format("AddRecipe(%d, %d, %s, %s, %s, %d, %d, %d, %d%s)", data.spell_id, data.skill_level, tostring(data.item_id), RARITY_STRINGS[data.quality], VERSION_STRINGS[tostring(data.genesis)], - data.optimal_level, data.medium_level, data.easy_level, data.trivial_level, tostring(data.specialty))) + data.optimal_level, data.medium_level, data.easy_level, data.trivial_level, specialty)) for i = 1, NUM_FILTER_FLAGS, 1 do if data.Flags[i] then @@ -1521,15 +1523,24 @@ do for index, acquire in ipairs(data.Acquire) do local acquire_type = acquire.type - if not flag_string then - if acquire_type == ACQUIRE_FLAGS.REPUTATION then - flag_string = "A."..ACQUIRE_STRINGS[acquire.type]..", "..acquire.ID..", "..REP_LEVELS[acquire.rep_level or 1]..", "..acquire.rep_vendor + if acquire_type == ACQUIRE_TYPES.REPUTATION then + local faction_string = FACTION_NAMES[acquire.ID] + + if not faction_string then + faction_string = acquire.ID + addon:Printf("Recipe %d (%s) - no string for faction %d", data.spell_id, data.name, acquire.ID) else - flag_string = "A."..ACQUIRE_STRINGS[acquire.type]..", "..acquire.ID + faction_string = "FAC."..faction_string + end + + if not flag_string then + flag_string = "A."..ACQUIRE_STRINGS[acquire.type]..", "..faction_string..", ".."REP."..REP_LEVELS[acquire.rep_level or 1]..", "..acquire.rep_vendor + else + flag_string = flag_string..", ".."A."..ACQUIRE_STRINGS[acquire.type]..", "..faction_string..", ".."REP."..REP_LEVELS[acquire.rep_level or 1]..", "..acquire.rep_vendor end else - if acquire_type == ACQUIRE_FLAGS.REPUTATION then - flag_string = flag_string..", ".."A."..ACQUIRE_STRINGS[acquire.type]..", "..acquire.ID..", "..REP_LEVELS[acquire.rep_level or 1]..", "..acquire.rep_vendor + if not flag_string then + flag_string = "A."..ACQUIRE_STRINGS[acquire.type]..", "..acquire.ID else flag_string = flag_string..", ".."A."..ACQUIRE_STRINGS[acquire.type]..", "..acquire.ID end diff --git a/Frame.lua b/Frame.lua index d72f192..d156746 100644 --- a/Frame.lua +++ b/Frame.lua @@ -109,9 +109,9 @@ local FACTION_NEUTRAL = BFAC["Neutral"] ------------------------------------------------------------------------------- -- Acquire flag constants. ------------------------------------------------------------------------------- ---local A_TRAINER, A_VENDOR, A_MOB, A_QUEST, A_SEASONAL, A_REPUTATION, A_WORLD_DROP, A_CUSTOM, A_PVP, A_MAX = 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 +local A = private.acquire_types local A_MAX = 9 -local A = private.acquire_flags + ------------------------------------------------------------------------------- -- Filter flag constants. ------------------------------------------------------------------------------- diff --git a/Player.lua b/Player.lua index 21947f6..4646a2b 100644 --- a/Player.lua +++ b/Player.lua @@ -50,10 +50,11 @@ local Player = private.Player ------------------------------------------------------------------------------- -- Constants ------------------------------------------------------------------------------- -local F_ALLIANCE, F_HORDE = 1, 2 ---local A_TRAINER, A_VENDOR, A_MOB, A_QUEST, A_SEASONAL, A_REPUTATION, A_WORLD_DROP, A_CUSTOM, A_PVP, A_MAX = 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 -local A = private.acquire_flags +local A = private.acquire_types +local F = private.filter_flags + local A_MAX = 9 + ------------------------------------------------------------------------------- -- Variables ------------------------------------------------------------------------------- @@ -98,26 +99,21 @@ end -- Determines if the player has an appropiate level in any applicable faction -- to learn the recipe. function Player:HasProperRepLevel(recipe_index) - -- Reputation constants for special cases. - local REP_MAGHAR = 941 - local REP_HONOR_HOLD = 946 - local REP_THRALLMAR = 947 - local REP_KURENI = 978 - local has_faction = true local is_alliance = self.faction == BFAC["Alliance"] local player_rep = self["Reputation"] local acquire_info = private.recipe_list[recipe_index]["Acquire"] local reputations = private.reputation_list + local FAC = private.faction_ids for index in pairs(acquire_info) do if acquire_info[index].type == A.REPUTATION then local rep_id = acquire_info[index].ID - if rep_id == REP_HONOR_HOLD or rep_id == REP_THRALLMAR then - rep_id = is_alliance and REP_HONOR_HOLD or REP_THRALLMAR - elseif rep_id == REP_MAGHAR or rep_id == REP_KURENI then - rep_id = is_alliance and REP_KURENI or REP_MAGHAR + if rep_id == FAC.HONOR_HOLD or rep_id == FAC.THRALLMAR then + rep_id = is_alliance and FAC.HONOR_HOLD or FAC.THRALLMAR + elseif rep_id == FAC.MAGHAR or rep_id == FAC.KURENI then + rep_id = is_alliance and FAC.KURENI or FAC.MAGHAR end local rep_name = reputations[rep_id].name @@ -134,9 +130,9 @@ function Player:HasProperRepLevel(recipe_index) end function Player:IsCorrectFaction(recipe_flags) - if self.faction == BFAC["Alliance"] and recipe_flags[F_HORDE] and not recipe_flags[F_ALLIANCE] then + if self.faction == BFAC["Alliance"] and recipe_flags[F.HORDE] and not recipe_flags[F.ALLIANCE] then return false - elseif self.faction == BFAC["Horde"] and recipe_flags[F_ALLIANCE] and not recipe_flags[F_HORDE] then + elseif self.faction == BFAC["Horde"] and recipe_flags[F.ALLIANCE] and not recipe_flags[F.HORDE] then return false end return true