vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
2 | xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd"> |
||
3 | |||
4 | -- Create MiniMapCords Frame |
||
5 | <Frame name="MiniCoordsFrame" parent="Minimap" enableMouse="true" hidden="false" frameStrata="MEDIUM" movable="true"> |
||
6 | <Size> |
||
7 | <AbsDimension x="40" y="10"/> |
||
8 | </Size> |
||
9 | <Anchors> |
||
10 | <Anchor point="BOTTOM" relativeTo="Minimap" relativePoint="BOTTOM"> |
||
11 | <Offset> |
||
12 | <AbsDimension x="0" y="0"/> |
||
13 | </Offset> |
||
14 | </Anchor> |
||
15 | </Anchors> |
||
16 | <Layers> |
||
17 | <Layer level="ARTWORK"> |
||
18 | -- Create a FontString within the MiniMapCords Frame |
||
19 | <FontString name="MiniCoords" toplevel="true" hidden="false" inherits="GameFontNormal" text=""> |
||
20 | <Anchors> |
||
21 | <Anchor point="CENTER"> |
||
22 | <Offset> |
||
23 | <AbsDimension x="0" y="0"/> |
||
24 | </Offset> |
||
25 | </Anchor> |
||
26 | </Anchors> |
||
27 | </FontString> |
||
28 | </Layer> |
||
29 | </Layers> |
||
30 | <Scripts> |
||
31 | <OnLoad> |
||
32 | -- Registering the event and set the Initalizing text |
||
33 | this:RegisterEvent("ZONE_CHANGED_NEW_AREA"); |
||
34 | MiniCoords:SetText("Initalizing..."); |
||
35 | MiniCoords:SetTextColor(0.5, 1, 0.5); |
||
36 | </OnLoad> |
||
37 | <OnEvent> |
||
38 | -- If we go to a new area, need to set the map that region to get the exact coords. |
||
39 | if (event == "ZONE_CHANGED_NEW_AREA") then |
||
40 | SetMapToCurrentZone(); |
||
41 | end |
||
42 | </OnEvent> |
||
43 | <OnUpdate> |
||
44 | -- Write the coordinates if it's valid, or "instance" if we're an Instance (maybe get this message in another circumstances) |
||
45 | if Minimap:IsVisible() then |
||
46 | local px, py = GetPlayerMapPosition("player"); |
||
47 | if (px > 0 and py > 0) then |
||
48 | MiniCoords:Show(); |
||
49 | local output = ""; |
||
50 | local mult = 10^0; |
||
51 | output = math.floor(((px * 100) * mult + 0.5) / mult)..","..math.floor(((py * 100) * mult + 0.5) / mult); |
||
52 | MiniCoords:SetText(output); |
||
53 | MiniCoords:SetTextColor(0.5, 1, 0.5); |
||
54 | else |
||
55 | MiniCoords:SetText("Instance"); |
||
56 | MiniCoords:SetTextColor(1, 0.5, 0.5); |
||
57 | end |
||
58 | end |
||
59 | </OnUpdate> |
||
60 | <OnMouseDown> |
||
61 | -- We can drag the coords text via the LeftMouseButton or paste our position in the chat editbox |
||
62 | if(arg1== "LeftButton") then |
||
63 | if(IsShiftKeyDown()) then |
||
64 | if (ChatFrameEditBox:IsVisible()) then |
||
65 | local msg = "My location: "..GetRealZoneText().." ("..MiniCoords:GetText()..")"; |
||
66 | ChatFrameEditBox:Insert(msg); |
||
67 | end |
||
68 | else |
||
69 | this:StartMoving(); |
||
70 | end |
||
71 | end |
||
72 | this.isMoving = true; |
||
73 | </OnMouseDown> |
||
74 | <OnMouseUp> |
||
75 | if(this.isMoving) then |
||
76 | this:StopMovingOrSizing(); |
||
77 | this.isMoving = false; |
||
78 | end |
||
79 | </OnMouseUp> |
||
80 | </Scripts> |
||
81 | </Frame> |
||
82 | </Ui> |