From c3aec05665d9485203d93d4a7a47065e14ae8c58 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Sun, 4 Nov 2012 07:28:12 -0500 Subject: [PATCH] -Added a new search parameter to allow players to display items in locations currently owned by them. Example: Lets say you want to see all your items in your bank? type @bank Example: Lets say you want to see all your items in the void bank? type @void Please note this will ONLY display items for your currently logged in character. Available Commands: @bag @bank @equip @mailbox @void @auction @guid --- BagSync.toc | 2 +- BagSync_Search.lua | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/BagSync.toc b/BagSync.toc index 1a77d2f..4c050d0 100644 --- a/BagSync.toc +++ b/BagSync.toc @@ -2,7 +2,7 @@ ## Title: BagSync ## Notes: BagSync tracks your characters items and displays it within tooltips. ## Author: Xruptor -## Version: 7 +## Version: 7.1 ## OptionalDeps: tekDebug ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB, BagSyncCRAFT_DB, BagSyncBLACKLIST_DB diff --git a/BagSync_Search.lua b/BagSync_Search.lua index 17c8559..02777e2 100644 --- a/BagSync_Search.lua +++ b/BagSync_Search.lua @@ -3,6 +3,7 @@ local searchTable = {} local rows, anchor = {} local currentRealm = GetRealmName() local GetItemInfo = _G['GetItemInfo'] +local currentPlayer = UnitName('player') local ItemSearch = LibStub('LibItemSearch-1.0') local bgSearch = CreateFrame("Frame","BagSync_SearchFrame", UIParent) @@ -127,6 +128,7 @@ local function DoSearch() local tempList = {} local previousGuilds = {} local count = 0 + local playerSearch = false if strlen(searchStr) > 0 then @@ -140,7 +142,9 @@ local function DoSearch() ["auction"] = 0, ["guild"] = 0, } - + + if string.len(searchStr) > 1 and string.find(searchStr, "@") and allowList[string.sub(searchStr, 2)] ~= nil then playerSearch = true end + --loop through our characters --k = player, v = stored data for player for k, v in pairs(BagSyncDB[currentRealm]) do @@ -164,8 +168,13 @@ local function DoSearch() if dblink then local dName, dItemLink, dRarity = GetItemInfo(dblink) if dName and dItemLink then + --are we checking in our bank,void, etc? + if playerSearch and string.sub(searchStr, 2) == q and string.sub(searchStr, 2) ~= "guild" and k == currentPlayer and not tempList[dblink] then + table.insert(searchTable, { name=dName, link=dItemLink, rarity=dRarity } ) + tempList[dblink] = dName + count = count + 1 --we found a match - if not tempList[dblink] and ItemSearch:Find(dItemLink, searchStr) then + elseif not playerSearch and not tempList[dblink] and ItemSearch:Find(dItemLink, searchStr) then table.insert(searchTable, { name=dName, link=dItemLink, rarity=dRarity } ) tempList[dblink] = dName count = count + 1 @@ -191,8 +200,12 @@ local function DoSearch() if dblink then local dName, dItemLink, dRarity = GetItemInfo(dblink) if dName then + if playerSearch and string.sub(searchStr, 2) == q and string.sub(searchStr, 2) == "guild" and k == currentPlayer and not tempList[dblink] then + table.insert(searchTable, { name=dName, link=dItemLink, rarity=dRarity } ) + tempList[dblink] = dName + count = count + 1 --we found a match - if not tempList[dblink] and ItemSearch:Find(dItemLink, searchStr) then + elseif not playerSearch and not tempList[dblink] and ItemSearch:Find(dItemLink, searchStr) then table.insert(searchTable, { name=dName, link=dItemLink, rarity=dRarity } ) tempList[dblink] = dName count = count + 1 -- 1.7.9.5