Mercurial > wow > wowdb-profiler
comparison Main.lua @ 87:2ab6c802b485
Record required quest completions for item purchase.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Mon, 27 Aug 2012 12:21:29 -0500 |
parents | 9be5fc389c13 |
children | 5da0e8da22de |
comparison
equal
deleted
inserted
replaced
86:9be5fc389c13 | 87:2ab6c802b485 |
---|---|
1008 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_BG:gsub("%%d", "(%%d+)")), | 1008 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_BG:gsub("%%d", "(%%d+)")), |
1009 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_3V3_BG:gsub("%%d", "(%%d+)")), | 1009 ("^%s$"):format(_G.ITEM_REQ_ARENA_RATING_3V3_BG:gsub("%%d", "(%%d+)")), |
1010 } | 1010 } |
1011 | 1011 |
1012 local ITEM_REQ_REPUTATION_MATCH = "Requires (.-) %- (.*)" | 1012 local ITEM_REQ_REPUTATION_MATCH = "Requires (.-) %- (.*)" |
1013 local ITEM_REQ_QUEST_MATCH1 = "Requires: .*" | |
1014 local ITEM_REQ_QUEST_MATCH2 = "Must have completed: .*" | |
1013 | 1015 |
1014 function WDP:UpdateMerchantItems(event) | 1016 function WDP:UpdateMerchantItems(event) |
1015 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) | 1017 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) |
1016 | 1018 |
1017 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | 1019 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then |
1047 end | 1049 end |
1048 local faction, reputation = current_line:GetText():match(ITEM_REQ_REPUTATION_MATCH) | 1050 local faction, reputation = current_line:GetText():match(ITEM_REQ_REPUTATION_MATCH) |
1049 | 1051 |
1050 if faction or reputation then | 1052 if faction or reputation then |
1051 DBEntry("items", item_id).req_reputation = ("%s:%s"):format(faction:gsub("-", ""), reputation:upper()) | 1053 DBEntry("items", item_id).req_reputation = ("%s:%s"):format(faction:gsub("-", ""), reputation:upper()) |
1054 break | |
1055 end | |
1056 end | |
1057 | |
1058 for line_index = 1, num_lines do | |
1059 local current_line = _G["WDPDatamineTTTextLeft" .. line_index] | |
1060 | |
1061 if not current_line then | |
1062 break | |
1063 end | |
1064 local line_text = current_line:GetText() | |
1065 local quest_name = line_text:match(ITEM_REQ_QUEST_MATCH1) or line_text:match(ITEM_REQ_QUEST_MATCH2) | |
1066 | |
1067 if quest_name then | |
1068 DBEntry("items", item_id).req_quest = ("%s"):format(quest_name:gsub("(.+): ", ""), quest_name) | |
1052 break | 1069 break |
1053 end | 1070 end |
1054 end | 1071 end |
1055 | 1072 |
1056 if extended_cost then | 1073 if extended_cost then |