comparison WorldPlan.lua @ 14:54adb0d4938b v1.0-rc3

WorldQuests: - Filter interface reverted: - Left-click to single out a category value, right-click to exclude. Hold shift to set multiple inclusion rules. - Filters operate inclusively. If any of the criteria is green, that pin will appear.
author Nenue
date Mon, 24 Oct 2016 05:49:55 -0400
parents 06c9a30d48da
children 8b1e8ba5753d
comparison
equal deleted inserted replaced
13:06c9a30d48da 14:54adb0d4938b
184 } 184 }
185 WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID 185 WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID
186 WorldPlanCore.FilterStyle = POI_FILTER_STYLE 186 WorldPlanCore.FilterStyle = POI_FILTER_STYLE
187 187
188 WorldPlanCore.FilterOptions = {} 188 WorldPlanCore.FilterOptions = {}
189 WorldPlanCore.UsedFilters = {}
189 190
190 191
191 -- operating flags 192 -- operating flags
192 local superTrackedID 193 local superTrackedID
193 local currentMapName 194 local currentMapName
949 local print = wqprint 950 local print = wqprint
950 local db = WorldPlan.db 951 local db = WorldPlan.db
951 local qType = self.worldQuestType 952 local qType = self.worldQuestType
952 local rType = self.rewardType 953 local rType = self.rewardType
953 self.filtered = nil 954 self.filtered = nil
954 self.whiteListed = nil
955 self.used = true 955 self.used = true
956 956
957 local whiteListed, blackListed 957 print(' |cFFFF4400IsShowable()|r', self.title)
958 for filterKey, includes in pairs(FilterInclusions) do 958
959 local isIncluded
960 for filterKey, filterValues in pairs(WorldPlan.UsedFilters) do
959 local controlValue = self[filterKey] 961 local controlValue = self[filterKey]
960 if controlValue then 962 if controlValue then
961 if includes[controlValue] == nil then 963 local filterType = filterValues[controlValue]
962 includes[controlValue] = true 964 if filterType == true then
963 elseif includes[controlValue] == false then 965 isIncluded = true
964 self.filtered = true 966 print(' include? ', filterKey, controlValue, filterType)
965 break 967 end
966 end 968 end
967 end 969 end
968 end 970 self.filtered = (not isIncluded)
971
969 972
970 if not TQ_IsActive(self.questID) then 973 if not TQ_IsActive(self.questID) then
971 self.used = nil 974 self.used = nil
972 end 975 end
973 if qType == LE_QUEST_TAG_TYPE_PROFESSION then 976 if qType == LE_QUEST_TAG_TYPE_PROFESSION then
974 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then 977 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
975 self.used = nil 978 self.used = nil
976 end 979 end
977 end 980 end
978 print(' |cFFFF4400IsShowable()|r', self.used, self.filtered, self.title)
979 return self.used, self.filtered 981 return self.used, self.filtered
980 end 982 end
981 983
982 function QuestPOI:UpdateTimer (timeLeft, timeType) 984 function QuestPOI:UpdateTimer (timeLeft, timeType)
983 print('|cFF0088FFUpdatePinTimer()|r') 985 print('|cFF0088FFUpdatePinTimer()|r')
1156 button:SetID(index) 1158 button:SetID(index)
1157 button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0 1159 button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0
1158 button.relativeFrame = relativeFrame 1160 button.relativeFrame = relativeFrame
1159 button:Refresh(info, (numHeaders == 1), numQuests) 1161 button:Refresh(info, (numHeaders == 1), numQuests)
1160 button:Show() 1162 button:Show()
1161 print(' using', button.label:GetText())
1162 relativeFrame = button 1163 relativeFrame = button
1163 end 1164 end
1164 1165
1165 end 1166 end
1166 1167
1208 1209
1209 end 1210 end
1210 print('anchor to', self.relativeFrame:GetName()) 1211 print('anchor to', self.relativeFrame:GetName())
1211 1212
1212 local r, g, b, a = 1,1,1,1 1213 local r, g, b, a = 1,1,1,1
1213 if self.filterKey then 1214 local used = WorldPlan.UsedFilters[self.filterKey]
1214 if FilterInclusions[self.filterKey][self.filterValue] == nil then 1215 if used and self.filterKey then
1215 FilterInclusions[self.filterKey][self.filterValue] = true 1216 if used[self.filterValue] == true then
1216 end
1217
1218
1219 if FilterInclusions[self.filterKey][self.filterValue] == true then
1220 r, g, b = 0, 1, 0 1217 r, g, b = 0, 1, 0
1221 elseif FilterInclusions[self.filterKey][self.filterValue] == false then 1218 elseif used[self.filterValue] == false then
1222 r, g, b = 1, 0, 0 1219 r, g, b = 1, 0, 0
1223 end 1220 end
1224 end 1221 end
1225 self.iconBorder:SetVertexColor(r, g, b, a) 1222 self.iconBorder:SetVertexColor(r, g, b, a)
1226 self:UpdateSize() 1223 self:UpdateSize()
1255 local setInclude = (button == 'LeftButton') 1252 local setInclude = (button == 'LeftButton')
1256 1253
1257 1254
1258 if not filterKey then 1255 if not filterKey then
1259 -- resetting 1256 -- resetting
1260 for k,v in pairs(FilterInclusions) do 1257 for k,v in pairs(WorldPlan.UsedFilters) do
1261 wipe(v) 1258 wipe(v)
1262 end 1259 end
1260 elseif IsShiftKeyDown() then
1261 WorldPlan.UsedFilters[filterKey] = nil
1263 else 1262 else
1264 FilterInclusions[filterKey][filterValue] = setInclude 1263 WorldPlan.UsedFilters[filterKey] = WorldPlan.UsedFilters[filterKey] or {}
1265 if (not IsShiftKeyDown()) then 1264 WorldPlan.UsedFilters[filterKey][filterValue] = setInclude
1266 for k, info in ipairs(WorldPlan.FilterOptions) do 1265 print(filterKey, filterValue, '=', setInclude)
1267 if (info.filterKey == filterKey) and (info.filterValue ~= filterValue) then 1266
1268 FilterInclusions[info.filterKey][info.filterValue] = (not setInclude) 1267 for index, info in ipairs(WorldPlan.FilterOptions) do
1268 if info.filterKey == filterKey then
1269 if (not IsControlKeyDown()) and (filterValue ~= info.filterValue) then
1270 WorldPlan.UsedFilters[filterKey][info.filterValue] = (not setInclude)
1271 print(filterKey, info.filterValue, '=', WorldPlan.UsedFilters[filterKey][info.filterValue])
1269 end 1272 end
1270 end 1273 end
1271 end 1274 end
1275
1272 end 1276 end
1273 print('|cFF00FF88Filter Update:', filterKey, filterValue, operation) 1277 print('|cFF00FF88Filter Update:', filterKey, filterValue, operation)
1274 WorldPlan:RefreshAll() 1278 WorldPlan:RefreshAll()
1275 end 1279 end
1276 1280