comparison Main.lua @ 164:b5ced741f9e6

Added support for recording prices for trainer services - commented out for now.
author James D. Callahan III <jcallahan@curse.com>
date Mon, 08 Oct 2012 09:59:43 -0500
parents ef88920c634b
children 311e2144c9ed
comparison
equal deleted inserted replaced
163:f26de5e5b838 164:b5ced741f9e6
1790 end -- do-block 1790 end -- do-block
1791 1791
1792 1792
1793 function WDP:TRAINER_SHOW(event_name) 1793 function WDP:TRAINER_SHOW(event_name)
1794 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) 1794 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target"))
1795 local npc = NPCEntry(unit_idnum) 1795 local trainer = NPCEntry(unit_idnum)
1796 1796
1797 if not npc then 1797 if not trainer then
1798 return 1798 return
1799 end 1799 end
1800 npc.teaches = npc.teaches or {} 1800 local trainer_standing = select(2, UnitFactionStanding("target"))
1801 trainer.teaches = trainer.teaches or {}
1801 1802
1802 -- Get the initial trainer filters 1803 -- Get the initial trainer filters
1803 local available = _G.GetTrainerServiceTypeFilter("available") 1804 local available = _G.GetTrainerServiceTypeFilter("available")
1804 local unavailable = _G.GetTrainerServiceTypeFilter("unavailable") 1805 local unavailable = _G.GetTrainerServiceTypeFilter("unavailable")
1805 local used = _G.GetTrainerServiceTypeFilter("used") 1806 local used = _G.GetTrainerServiceTypeFilter("used")
1817 DatamineTT:SetTrainerService(index) 1818 DatamineTT:SetTrainerService(index)
1818 1819
1819 local _, _, spell_id = DatamineTT:GetSpell() 1820 local _, _, spell_id = DatamineTT:GetSpell()
1820 1821
1821 if spell_id then 1822 if spell_id then
1823 local class_professions = trainer.teaches[PLAYER_CLASS]
1824
1825 if not class_professions then
1826 trainer.teaches[PLAYER_CLASS] = {}
1827 class_professions = trainer.teaches[PLAYER_CLASS]
1828 end
1822 local profession, min_skill = _G.GetTrainerServiceSkillReq(index) 1829 local profession, min_skill = _G.GetTrainerServiceSkillReq(index)
1823 profession = profession or "General" 1830 profession = profession or "General"
1824 1831
1825 local class_professions = npc.teaches[PLAYER_CLASS]
1826 if not class_professions then
1827 npc.teaches[PLAYER_CLASS] = {}
1828 class_professions = npc.teaches[PLAYER_CLASS]
1829 end
1830
1831 local profession_skills = class_professions[profession] 1832 local profession_skills = class_professions[profession]
1833
1832 if not profession_skills then 1834 if not profession_skills then
1833 class_professions[profession] = {} 1835 class_professions[profession] = {}
1834 profession_skills = class_professions[profession] 1836 profession_skills = class_professions[profession]
1835 end 1837 end
1838 -- profession_skills[spell_id] = ("%d:%d:%d"):format(required_level, min_skill, ActualCopperCost(_G.GetTrainerServiceCost(index), trainer_standing))
1836 profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill) 1839 profession_skills[spell_id] = ("%d:%d"):format(required_level, min_skill)
1837 end 1840 end
1838 end 1841 end
1839 end 1842 end
1840 -- Reset the filters to what they were before 1843 -- Reset the filters to what they were before