Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bidaumm committed Aug 17, 2020
0 parents commit 6021db3
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 owenwalker92

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
89 changes: 89 additions & 0 deletions Recount_MinimapIcon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
RecountButton_Position = 0;
RecountButton_Locked = false;
RecountButton_Hover = false;
Minimap_Circle = {};
Minimap_Circle.X = 0;
Minimap_Circle.Y = 0;

function Recount_IconButton_OnClick(arg1)
if (arg1 == "RightButton") then
if Recount_MinimapFrame:IsVisible() then
Recount_MinimapFrame:Hide();
else
Recount_MinimapFrame:Show();
end
elseif (arg1 == "LeftButton") then
Recount_MinimapIcon_Toggle();
end

end

function Recount_MinimapIcon_SetMinimap()
Minimap_Circle.X = getglobal("Minimap"):GetWidth()+20;
Minimap_Circle.Y = getglobal("Minimap"):GetHeight()+20;

getglobal("Recount_ButtonLock_Text"):SetText("Lock");
getglobal("Recount_ButtonConfig_Text"):SetText("Show Config");
getglobal("Recount_ButtonReset_Text"):SetText("Reset Data");
end

function Recount_MinimapIcon_ShowTooltip()
GameTooltip:SetOwner(Recount_IconButton, "ANCHOR_RIGHT");
GameTooltip:AddLine("Recount", 1, 1, 0);
GameTooltip:AddLine("Left click: Show Main Window", 1, 1, 1);
GameTooltip:AddLine("Right click: Show Options", 1, 1, 1);
GameTooltip:Show();
end

function Recount_MinimapIcon_Toggle()
if Recount_MainWindow:IsVisible() then
Recount_MainWindow:Hide();
else
Recount_MainWindow:Show();
end
end

function Recount_MinimapIcon_UpdatePosition()
Recount_IconButton:SetPoint(
"TOPLEFT",
"Minimap",
"TOPLEFT",
54 - (Minimap_Circle.X/2 * cos(RecountButton_Position)),
(Minimap_Circle.Y/2 * sin(RecountButton_Position)) - 55
);
end

function Recount_MinimapIcon_Drag()
--thanks to Atlas addon for this code
local xpos, ypos = GetCursorPosition();
local xmin, ymin = Minimap:GetLeft(), Minimap:GetBottom();

xpos = xmin-xpos/UIParent:GetScale()+70;
ypos = ypos/UIParent:GetScale()-ymin-70;

Recount_MinimapIcon_SetPosition(math.deg(math.atan2(ypos, xpos)));
end

function Recount_MinimapIcon_SetPosition(pos)
if (pos < 0) then
pos = pos + 360;
end

RecountButton_Position = pos;
Recount_MinimapIcon_UpdatePosition();
end

function Recount_MinimapIcon_OnLoad()
Recount:RegisterEvent("MINIMAP_HIDE");
if (RecountButton_Locked) then
getglobal("Recount_IconButton").locked = true;
getglobal("Recount_ButtonLock_Text"):SetText("Un-Lock");
else
getglobal("Recount_IconButton").locked = false;
getglobal("Recount_ButtonLock_Text"):SetText("Lock");
end
end

function Recount:MINIMAP_HIDE()
Recount_MinimapFrame:Hide()
end
10 changes: 10 additions & 0 deletions Recount_MinimapIcon.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Interface: 20100
## Title: Recount Minimap Icon|cff7fff7f -Ace2-|r
## Notes: Adds an icon to the minimap for Recount
## Version: 1.03
## Author: Tetsuos
## Dependencies: Recount
## SavedVariables: RecountButton_Position, RecountButton_Locked

Recount_MinimapIcon.xml
Recount_MinimapIcon.lua
198 changes: 198 additions & 0 deletions Recount_MinimapIcon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<Frame name="Recount_MinimapIcon_Load" hidden="true" enableMouse="false" movable="false">
<Scripts>
<OnEvent>if (event == "VARIABLES_LOADED") then
Recount_MinimapIcon_OnLoad();
end</OnEvent>
</Scripts>
<Size>
<AbsDimension x="1" y="1" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
</Frame>
<Button name="Recount_IconButton" toplevel="true" frameStrata="LOW" parent="Minimap" enableMouse="true" movable="true" hidden="false">
<Size>
<AbsDimension x="33" y="33" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-15" y="0" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="Recount_IconButton_Icon" file="Interface\AddOns\Recount_MinimapIcon\textures\icon-passive">
<Size>
<AbsDimension x="21" y="21" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="7" y="-6" />
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.075" right="0.925" top="0.075" bottom="0.925" />
</Texture>
</Layer>
<Layer level="OVERLAY">
<Texture file="Interface\Minimap\MiniMap-TrackingBorder">
<Size>
<AbsDimension x="56" y="56" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" />
</Anchors>
</Texture>
</Layer>
</Layers>
<HighlightTexture alphaMode="ADD" file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight" />
<Scripts>
<OnLoad>this:RegisterForClicks("LeftButtonUp","RightButtonUp");
this:RegisterForDrag("LeftButton");
this.locked = false;</OnLoad>
<OnEnter>Recount_MinimapIcon_ShowTooltip();
Recount_MinimapIcon_SetMinimap();</OnEnter>
<OnMouseDown>Recount_IconButton_Icon:SetTexCoord(0,1,0,1);</OnMouseDown>
<OnMouseUp>Recount_IconButton_Icon:SetTexCoord(.075,.925,.075,.925);</OnMouseUp>
<OnLeave>GameTooltip:Hide()</OnLeave>
<OnDragStart>if (not this.locked) then
this.being_dragged = true;
this:LockHighlight();
self:StartMoving();
end</OnDragStart>
<OnDragStop>this.being_dragged = false;
this:UnlockHighlight();
self:StopMovingOrSizing();
Recount_IconButton_Icon:SetTexCoord(.075,.925,.075,.925);</OnDragStop>
<OnClick>Recount_IconButton_OnClick(arg1);
Recount_IconButton_Icon:SetTexCoord(.075,.925,.075,.925);</OnClick>
<OnEvent>Recount_MinimapIcon_UpdatePosition();</OnEvent>
<OnUpdate>if (this.being_dragged and not this.locked) then
Recount_MinimapIcon_Drag();
end</OnUpdate>
</Scripts>
</Button>
<Button name="Recount_ButtonTemplate" virtual="true">
<Size>
<AbsDimension x="75" y="16" />
</Size>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parent_Text" inherits="GameFontWhite">
<Size>
<AbsDimension x="75" y="16" />
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnEnter />
<OnLeave />
</Scripts>
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD">
<Size>
<AbsDimension x="75" y="16" />
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
</HighlightTexture>
</Button>
<Frame name="Recount_MinimapFrame" hidden="true" toplevel="true" frameStrata="DIALOG" parent="UIParent">
<Size>
<absDimension x="80" y="75" />
</Size>
<Anchors>
<Anchor point="RIGHT" relativePoint="BOTTOMLEFT" relativeTo="Recount_IconButton">
<Offset>
<AbsDimension x="5" y="5" />
</Offset>
</Anchor>
</Anchors>
<Backdrop bgfile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<TileSize>
<AbsValue val="32" />
</TileSize>
<EdgeSize>
<AbsValue val="16" />
</EdgeSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5" />
</BackgroundInsets>
</Backdrop>
<Frames>
<Button name="Recount_ButtonLock" inherits="Recount_ButtonTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="Recount_MinimapFrame">
<Offset>
<AbsDimension x="2" y="-5" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>if (Recount_IconButton.locked) then
Recount_IconButton.locked = false;
RecountButton_Locked = false;
Recount_MinimapFrame:Hide();
else
Recount_IconButton.locked = true;
RecountButton_Locked = true;
Recount_MinimapFrame:Hide();
end</OnClick>
</Scripts>
</Button>
<Button name="Recount_ButtonConfig" inherits="Recount_ButtonTemplate" id="2">
<Anchors>
<Anchor point="TOP" relativeTo="Recount_ButtonLock">
<Offset>
<AbsDimension x="0" y="-20" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>Recount:ShowConfig();
Recount_MinimapFrame:Hide()</OnClick>
</Scripts>
</Button>
<Button name="Recount_ButtonReset" inherits="Recount_ButtonTemplate" id="2">
<Anchors>
<Anchor point="TOP" relativeTo="Recount_ButtonConfig">
<Offset>
<AbsDimension x="0" y="-20" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>Recount:ResetData();
Recount_MinimapFrame:Hide();</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnUpdate>if (Recount_IconButton.locked) then
getglobal("Recount_ButtonLock_Text"):SetText("Un-Lock");
else
getglobal("Recount_ButtonLock_Text"):SetText("Lock");
end</OnUpdate>
<OnEnter />
<OnLeave />
</Scripts>
</Frame>
</Ui>
Binary file added textures/icon-passive.tga
Binary file not shown.

0 comments on commit 6021db3

Please sign in to comment.