Quantcast

* Added notification integration with Mik's Scrolling Battle Text

Jesse Adams [03-01-11 - 19:11]
* Added notification integration with Mik's Scrolling Battle Text
* Re-worked look and feel of default frame (more simplistic)
* Only show races for the continent you are currently on
Filename
README
Solvent.lua
Solvent.xml
diff --git a/README b/README
index 8002771..5cb1f17 100644
--- a/README
+++ b/README
@@ -11,12 +11,14 @@ Upcoming Changes:
 * Make a configuration dialog
 * Make the window position persist
 * For Brainh: Arrow on minimap that points to closest dig site
-
-Things to Test:
-* All races in queue
-* Ensure new race shows up upon first survey
+* Ensure race shows up upon first survey (not second)

 Changelog:
+2011-03-01:
+* Added notification integration with Mik's Scrolling Battle Text
+* Re-worked look and feel of default frame (more simplistic)
+* Only show races for the continent you are currently on
+
 2011-02-25:
 * Add slash command to automatically solve everything
 * Click on race icon to solve artifact (when bar is yellow)
diff --git a/Solvent.lua b/Solvent.lua
index 106126d..0ec7d94 100644
--- a/Solvent.lua
+++ b/Solvent.lua
@@ -3,11 +3,20 @@ SOLVENT_DEBUG = false
 solventDefaultEnabled = 'yes'
 solventDefaultScale = 1.0
 solventDefaultAlpha = 1.0
+solventDefaultLocked = 'no'

 function SolventMessage(text)
   DEFAULT_CHAT_FRAME:AddMessage("[Solvent]: " .. text, 0, 0.6, 0.6)
 end

+function SolventNotification(text)
+  if MikSBT then
+    MikSBT.DisplayMessage(text, MikSBT.DISPLAYTYPE_STATIC, false, 0, 150, 175)
+  else
+    SolventMessage(text)
+  end
+end
+
 function TotalKeystonesFromBags()
   keystones = {
     { -- Dwarf
@@ -99,6 +108,43 @@ needToTrainWarningSent = false
 keystones = {}
 solvableWarningSent = {}
 function SolventGetCurrentArtifacts()
+  SetMapToCurrentZone()
+  continent = GetCurrentMapContinent();
+
+  local raceToZoneMappings = {
+    -- Kalimdor
+    {
+      1,
+      3,
+      4,
+      8,
+      7
+    },
+
+    -- Eastern Kingdoms
+    {
+      1,
+      3,
+      4,
+      5,
+      8
+    },
+
+    -- Outland
+    {
+      2,
+      6
+    },
+
+    -- Northrend
+    {
+      4,
+      8,
+      5,
+      9
+    },
+  }
+
   keystones = TotalKeystonesFromBags()

   prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions();
@@ -116,13 +162,21 @@ function SolventGetCurrentArtifacts()
   end

   local raceCount = GetNumArchaeologyRaces();
-  local lastRaceName
+  local lastRaceName = 'unknown'

   if SOLVENT_DEBUG then
     print("Race Count: " .. raceCount)
   end

   for i=1,raceCount do
+    raceBelongsToContinent = false
+    for raceKey,raceId in pairs(raceToZoneMappings[continent]) do
+      if i == raceId then
+        raceBelongsToContinent = true
+        break
+      end
+    end
+
     if not solvableWarningSent[i] then
       solvableWarningSent[i] = 'no'
     end
@@ -131,8 +185,10 @@ function SolventGetCurrentArtifacts()
     SetSelectedArtifact(i)
     local artifactName, artifactDescription, artifactRarity, artifactIcon, hoverDescription, keystoneCount, bgTexture = GetSelectedArtifactInfo()
     --local artifactName, artifactDescription, artifactRarity, artifactIcon, hoverDescription, keystoneCount, bgTexture, firstCompletionTime, completionCount = GetArtifactInfoByRace(i, 0);
-
-    --print(i .. ' - ' .. raceName)
+
+    --if raceBelongsToContinent then
+    --  print(i .. ' - ' .. raceName)
+    --end

     if GetNumArtifactsByRace(i) > 0 then
       if SOLVENT_DEBUG then
@@ -165,11 +221,6 @@ function SolventGetCurrentArtifacts()
         statusBar:GetStatusBarTexture():SetHorizTile(false)
         --statusBar:SetWidth(200)
         --statusBar:SetHeight(12)
-        if i == 1 then
-          statusBars[i]:SetPoint("TOP", SolventSolveFrameAddonTitleText,"BOTTOM", 0, -15)
-        else
-          statusBars[i]:SetPoint("TOP", _G["SolventSolveFrameRow" .. lastRaceName], "BOTTOM", 0, -15)
-        end
       else
         statusBar = _G["SolventSolveFrameRow" .. raceName .. "StatusBar"]
       end
@@ -185,7 +236,7 @@ function SolventGetCurrentArtifacts()
       if solvable then
         if solvableWarningSent[i] == 'no' then
           PlaySoundFile("Interface\\Addons\\Solvent\\sounds\\shooting_star.mp3")
-          SolventMessage("Archaeology: " .. raceName .. " Artifact '".. artifactName .. "' is now solvable!")
+          SolventNotification(raceName .. " Artifact '".. artifactName .. "' is now solvable!")
           solvableWarningSent[i] = 'yes'
         end
         statusBar:SetStatusBarColor(1,1,0)
@@ -207,10 +258,9 @@ function SolventGetCurrentArtifacts()
         statusBar.artifact:SetText(artifactName)
       end
       _G["SolventSolveFrameRow" .. raceName .. "Icon"].texture:SetTexture(raceTexture)
-      --_G["SolventSolveFrameRow" .. raceName .. "Keystones"].keystones:SetText(keystones[i]["count"] .. ' / ' .. keystoneCount)
+      _G["SolventSolveFrameRow" .. raceName .. "Keystones"].keystones:SetText(keystones[i]["count"] .. ' / ' .. keystoneCount)
       _G["SolventSolveFrameRow" .. raceName .. "Keystones"].keystones:SetText("+" .. possibleFragmentsFromKeystones)

-      lastRaceName = raceName
     end

     if skillLevel == maxSkillLevel then
@@ -218,6 +268,22 @@ function SolventGetCurrentArtifacts()
     else
       SolventSolveFrameAddonTitleText:SetText("Solvent - Archaeology " .. skillLevel .. ' / ' .. maxSkillLevel)
     end
+
+    if _G["SolventSolveFrameRow" .. raceName] and raceBelongsToContinent then
+      --print("show " .. raceName)
+      _G["SolventSolveFrameRow" .. raceName]:Show()
+
+      if lastRaceName == 'unknown' then
+        statusBars[i]:SetPoint("TOP", SolventSolveFrameAddonTitleText,"BOTTOM", 0, -15)
+      else
+        statusBars[i]:SetPoint("TOP", _G["SolventSolveFrameRow" .. lastRaceName], "BOTTOM", 0, -15)
+      end
+
+      lastRaceName = raceName
+    elseif _G["SolventSolveFrameRow" .. raceName] then
+      --print("hide " .. raceName)
+      statusBars[i]:Hide()
+    end
   end
 end

@@ -234,7 +300,10 @@ function SolventHandleEvent(frame, eventName, ...)
     return
   end

-  --print(eventName)
+  if SOLVENT_DEBUG then
+    print(eventName)
+  end
+
   if eventName == "ARTIFACT_HISTORY_READY" then
     initiallyLoaded = true
     SolventGetCurrentArtifacts()
@@ -247,8 +316,13 @@ function SolventHandleEvent(frame, eventName, ...)
       surveyDetected = true
     end
   elseif surveyDetected and eventName == "CURRENCY_DISPLAY_UPDATE" then
-    surveyDetected = false
     SolventGetCurrentArtifacts()
+  elseif surveyDetected and eventName == "CHAT_MSG_CURRENCY" then
+    surveyDetected = false
+    message, rest = ...
+    if MikSBT then
+      SolventNotification(message)
+    end
   end
 end

@@ -278,6 +352,10 @@ function SolventProcessVariables()
 	if not solventConfig[solventRealm][solventCharacter].alpha then
 		solventConfig[solventRealm][solventCharacter].alpha = solventDefaultAlpha;
 	end
+
+  if not solventConfig[solventRealm][solventCharacter].locked then
+		solventConfig[solventRealm][solventCharacter].locked = solventDefaultLocked;
+	end

   variablesLoaded = true;
 	processConfigChange();
@@ -360,19 +438,26 @@ function processConfigChange()
   else
     SolventSolveFrame:Hide()
   end
+
+  if solventConfig[solventRealm][solventCharacter].locked == 'yes' then
+    SolventSolveFrame:SetMovable(false)
+  else
+    SolventSolveFrame:SetMovable(true)
+  end
+

   SolventSolveFrame:SetBackdropColor(1, 1, 1, solventConfig[solventRealm][solventCharacter].alpha)
-  SolventSolveFrame:SetBackdropBorderColor(1, 1, 1, solventConfig[solventRealm][solventCharacter].alpha)
+  SolventSolveFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, solventConfig[solventRealm][solventCharacter].alpha)
   SolventSolveFrame:SetScale(solventConfig[solventRealm][solventCharacter].scale)
 end

 dframe = CreateFrame("Frame", nil, UIParent)
 dframe:RegisterEvent("CURRENCY_DISPLAY_UPDATE");
+dframe:RegisterEvent("CHAT_MSG_CURRENCY");
 dframe:RegisterEvent("ARTIFACT_HISTORY_READY")
 dframe:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
 dframe:RegisterEvent("ARTIFACT_COMPLETE")
 dframe:RegisterEvent("VARIABLES_LOADED")
---dframe:RegisterEvent("ARTIFACT_UPDATE");       ONLY AFTER SOLVING!
 dframe:RegisterEvent("BAG_UPDATE");
 dframe:SetScript("OnEvent", SolventHandleEvent);

@@ -392,6 +477,12 @@ local function modify_display(msg, editbox)
       solventConfig[solventRealm][solventCharacter].alpha = alpha
       processConfigChange()
     end
+  elseif command == 'lock' then
+    solventConfig[solventRealm][solventCharacter].locked = 'yes'
+    processConfigChange()
+  elseif command == 'unlock' then
+    solventConfig[solventRealm][solventCharacter].locked = 'no'
+    processConfigChange()
   elseif command == 'scale' then
     scale = tonumber(rest)
     if scale >= 0 and scale <= 2 then
diff --git a/Solvent.xml b/Solvent.xml
index 0139d0a..c9227fb 100644
--- a/Solvent.xml
+++ b/Solvent.xml
@@ -28,11 +28,12 @@
       <StatusBar name="$parentStatusBar" parentKey="statusBar">
         <Layers>
           <Layer level="BACKGROUND">
-            <Texture name="$parentBarBackground" file="Interface\Addons\Archy\Media\Archy-Progress-Bg" parentKey="barBackground">
-              <Size x="265" y="35"/>
+            <Texture name="$parentBarBackground" file="Interface\CHATFRAME\CHATFRAMEBACKGROUND" parentKey="barBackground">
+              <Color r="0" g="0" b="0" a="0.7" />
+              <Size x="250" y="28"/>
               <TexCoords left="0" right="0.72265625" top="0" bottom="0.411875" />
               <Anchors>
-                <Anchor point="CENTER" x="0" y="1" />
+                <Anchor point="CENTER" x="0" y="0" />
               </Anchors>
             </Texture>
           </Layer>
@@ -76,19 +77,20 @@

 	<Frame name="SolventSolveFrame" parent="UIParent" enableMouse="true" movable="true">
 		<Size>
-			<AbsDimension x="375" y="225" />
+			<AbsDimension x="375" y="180" />
 		</Size>

 		<Anchors>
 			<Anchor point="CENTER" relativeTo="UIParent" />
 		</Anchors>

-		<Backdrop bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
-			<EdgeSize><AbsValue val="16" /></EdgeSize>
-			<TileSize><AbsValue val="32" /></TileSize>
+		<Backdrop bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\CHATFRAME\CHATFRAMEBACKGROUND" tile="true">
+			<EdgeSize><AbsValue val="1" /></EdgeSize>
+			<TileSize><AbsValue val="1" /></TileSize>
 			<BackgroundInsets>
-				<AbsInset left="5" right="5" top="5" bottom="5" />
+				<AbsInset left="1" right="1" top="1" bottom="1" />
 			</BackgroundInsets>
+      <BorderColor r="0.5" g="0.5" b="0.5" />
 		</Backdrop>

 		<Layers>
@@ -103,12 +105,8 @@

 		<Scripts>
 			<OnLoad>self:RegisterForDrag("LeftButton");SolventStartup();</OnLoad>
-			<OnDragStart>self:StartMoving();</OnDragStart>
-			<OnDragStop>self:StopMovingOrSizing();</OnDragStop>
+			<OnDragStart>if solventConfig[solventRealm][solventCharacter].locked == 'no' then self:StartMoving(); end</OnDragStart>
+			<OnDragStop>if solventConfig[solventRealm][solventCharacter].locked == 'no' then self:StopMovingOrSizing(); end</OnDragStop>
 		</Scripts>
 	</Frame>
-
-  <!--<ScrollFrame name="SolventScrollFrame" parent="UIParent" enableMouse="true" movable="true">
-
-  </ScrollFrame>-->
 </Ui>