chore: move addon into Pawn/ + add standard .gitignore
Matches the Exiles fork-layout convention (each addon in its own folder).
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>VgerCore</title>
|
||||
<link rel="stylesheet" type="text/css" href="VgerCore.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>VgerCore 1.0.5</h1>
|
||||
|
||||
<p>
|
||||
VgerCore contains functionality that is shared by mods written by Vger of
|
||||
Azjol-Nerub (US). By default, VgerCore comes with all of the mods that
|
||||
need it. You don't need to do anything special to install VgerCore.</p>
|
||||
<h3>
|
||||
Mods that need VgerCore</h3>
|
||||
<ul>
|
||||
<li>Backdrop</li>
|
||||
<li>Divisor</li>
|
||||
<li>Gyro</li>
|
||||
<li>Hear Kitty</li>
|
||||
<li>Pawn</li>
|
||||
</ul>
|
||||
<h2>Notes</h2>
|
||||
<p>I welcome your feedback. The best way to contact me is through
|
||||
<a target="_blank" href="http://my.curse.com/users/VgerAN/">Curse</a>. You
|
||||
can also contact me through in-game mail: Vger on Azjol-Nerub (US), Horde.
|
||||
(Just make sure that you keep a character on my server and check your mail, or I
|
||||
can't respond!) Also, check out my
|
||||
<a target="_blank" href="http://www.vgermods.com/">official site</a>, where you
|
||||
can find links to all of my mods.</p>
|
||||
<h2>Release history</h2>
|
||||
<h3>Version 1.0.5</h3>
|
||||
<ul>
|
||||
<li>Minor performance enhancements.</li>
|
||||
</ul>
|
||||
<h3>Version 1.0.4</h3>
|
||||
<ul>
|
||||
<li>Updated ExecuteChatCommand for patch 3.3.5.</li>
|
||||
</ul>
|
||||
<h3>Version 1.0.3</h3>
|
||||
<ul>
|
||||
<li>Added StringFindReverse.</li>
|
||||
</ul>
|
||||
<h3>Version 1.0.2</h3>
|
||||
<ul>
|
||||
<li>Added RGBToHex and HexToRGB.</li>
|
||||
</ul>
|
||||
<h3>Version 1.0.1</h3>
|
||||
<ul>
|
||||
<li>Added the CaseInsensitiveComparer function for use with table.sort.</li>
|
||||
<li>Added more colors.</li>
|
||||
</ul>
|
||||
<h3>Version 1.0</h3>
|
||||
<ul>
|
||||
<li>VgerCore is now at version 1.0! Instead of being a standalone mod,
|
||||
it's now embedded by default. If you have a VgerCore folder in
|
||||
your Interface\AddOns folder, you can now delete it.</li>
|
||||
</ul>
|
||||
<h3>Version 0.4.1</h3>
|
||||
<ul>
|
||||
<li>Added static function support to HookInsecureFunction.</li>
|
||||
<li>HookInsecureFunction now supports hooking functions with more than 10 parameters.</li>
|
||||
<li>Added HookInsecureScript, which works like the original (Object, FunctionName, Hook) overload of
|
||||
HookInsecureFunction, except instead of a function name, it takes a script handler name.</li>
|
||||
</ul>
|
||||
<h3>Version 0.4</h3>
|
||||
<ul>
|
||||
<li>Added color DarkBlue for Pawn.</li>
|
||||
<li>Message, BigMessage, Assert, and Fail will now accept non-string
|
||||
messages (such as booleans and nil).</li>
|
||||
<li>Added MultilineMessage to print a large message to the console as a
|
||||
series of individual messages so as to not break scrolling behavior.
|
||||
This is useful for mod usage information, for example.</li>
|
||||
</ul>
|
||||
<h3>Version 0.3.1</h3>
|
||||
<ul>
|
||||
<li>ExecuteChatCommand (used when running macros) will now no longer try to
|
||||
execute protected commands such as /cast. This will prevent WoW from
|
||||
asking to disable VgerCore simply due to user error.</li>
|
||||
</ul>
|
||||
<h3>Version 0.3</h3>
|
||||
<ul>
|
||||
<li>Added new function VgerCore.HookInsecureFunction (analogous to
|
||||
hooksecurefunc in the WoW APIs) for Pawn.</li>
|
||||
</ul>
|
||||
<h3>Version 0.2.1</h3>
|
||||
<ul>
|
||||
<li>Minor update; fully compatible with version 0.2.</li>
|
||||
<li>Simplified code to take advantage of new functionality in GetMacroInfo.</li>
|
||||
<li>Used by Pawn.</li>
|
||||
</ul>
|
||||
<h3>Version 0.2</h3>
|
||||
<ul>
|
||||
<li>Updated for patch 2.0.</li>
|
||||
<li>Fixed a typo that might have manifested itself as an error about "PawnMessage."</li>
|
||||
<li>Removed the optional dependency on CT_RaidAssist.</li>
|
||||
<li>Used by Hear Kitty.</li>
|
||||
</ul>
|
||||
<h3>Version 0.1</h3>
|
||||
<ul>
|
||||
<li>First version publicly released.</li>
|
||||
<li>Used by Gyro.</li>
|
||||
</ul>
|
||||
|
||||
<h2>The fine print</h2>
|
||||
<p>© 2006-2010 Green Eclipse. This mod is released under the Creative Commons
|
||||
<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/" target="_blank">
|
||||
Attribution-NonCommercial-NoDerivs 3.0</a> license. In short, this means
|
||||
that you can use it, copy it, and share it, but you can't sell it or distribute
|
||||
your own altered versions without permission. By using the mod you agree to the terms of the license. For more information, click the link.</p>
|
||||
|
||||
</body></html>
|
||||
@@ -0,0 +1,83 @@
|
||||
.codeblock {
|
||||
background-color: #eaecef;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
.loot {
|
||||
background-color: #202020;
|
||||
border-style: outset;
|
||||
border-width: 2px;
|
||||
color: white;
|
||||
margin-right: auto;
|
||||
padding: .5em;
|
||||
width: 25em;
|
||||
}
|
||||
|
||||
.loot .blue {
|
||||
color: #1068ff;
|
||||
}
|
||||
|
||||
.loot .green {
|
||||
color: lime;
|
||||
}
|
||||
|
||||
.loot .grey {
|
||||
color: silver;
|
||||
}
|
||||
|
||||
.loot .itemname {
|
||||
font-size: 125%;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.loot .pawnblue {
|
||||
color: #8ec3e6;
|
||||
}
|
||||
|
||||
.loot .purple {
|
||||
color: #6800ff;
|
||||
}
|
||||
|
||||
.loot .white {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.loot div {
|
||||
margin-top: .1em;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Segoe UI, Verdana, sans-serif;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Courier New, monospace;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #42669e;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #7ba9d3;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: #5e88b8;
|
||||
}
|
||||
|
||||
h4 {
|
||||
color: #42669e;
|
||||
font-weight: normal;
|
||||
margin-bottom: -1em;
|
||||
}
|
||||
|
||||
html {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
-- VgerCore by Vger-Azjol-Nerub
|
||||
-- www.vgermods.com
|
||||
-- © 2006-2010 Green Eclipse. This mod is released under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 license.
|
||||
--
|
||||
-- Version 1.0.5: minor performance enhancements
|
||||
local VgerCoreThisVersion = 1.05
|
||||
--
|
||||
-- VgerCore contains functionality that is shared by Vger's mods.
|
||||
-- It can be used as a standalone add-on, or embedded within other mods.
|
||||
--
|
||||
------------------------------------------------------------
|
||||
|
||||
local InitializeOrUpgrade = not (VgerCore and VgerCore.Version and VgerCore.Version >= VgerCoreThisVersion);
|
||||
|
||||
-- If the currently loaded version of VgerCore isn't as good as this one, load the new one.
|
||||
if InitializeOrUpgrade then
|
||||
|
||||
VgerCore = {}
|
||||
VgerCore.Version = VgerCoreThisVersion
|
||||
|
||||
-- Common colors
|
||||
VgerCore.Color = {}
|
||||
|
||||
VgerCore.Color.Reset = "|r"
|
||||
|
||||
VgerCore.Color.Blue = "|cff8ec3e6"
|
||||
VgerCore.Color.BlueR = 142 / 255
|
||||
VgerCore.Color.BlueG = 195 / 255
|
||||
VgerCore.Color.BlueB = 230 / 255
|
||||
|
||||
VgerCore.Color.DarkBlue = "|cff6a92ac"
|
||||
VgerCore.Color.DarkBlueR = 106 / 255
|
||||
VgerCore.Color.DarkBlueG = 146 / 255
|
||||
VgerCore.Color.DarkBlueB = 172 / 255
|
||||
|
||||
VgerCore.Color.Green = "|cffb4fe2c"
|
||||
VgerCore.Color.GreenR = 180 / 255
|
||||
VgerCore.Color.GreenG = 255 / 255
|
||||
VgerCore.Color.GreenB = 44 / 255
|
||||
|
||||
VgerCore.Color.Orange = "|cfffecf38"
|
||||
VgerCore.Color.OrangeR = 255 / 255
|
||||
VgerCore.Color.OrangeG = 207 / 255
|
||||
VgerCore.Color.OrangeB = 56 / 255
|
||||
|
||||
VgerCore.Color.Lemon = "|cfffffdd0"
|
||||
VgerCore.Color.LemonR = 255 / 255
|
||||
VgerCore.Color.LemonG = 253 / 255
|
||||
VgerCore.Color.LemonB = 208 / 255
|
||||
|
||||
VgerCore.Color.Salmon = "|cfffe8460"
|
||||
VgerCore.Color.SalmonR = 255 / 255
|
||||
VgerCore.Color.SalmonG = 132 / 255
|
||||
VgerCore.Color.SalmonB = 96 / 255
|
||||
|
||||
VgerCore.Color.Beige = "|cffe0dec8"
|
||||
VgerCore.Color.BeigeR = 224 / 255
|
||||
VgerCore.Color.BeigeG = 222 / 255
|
||||
VgerCore.Color.BeigeB = 200 / 255
|
||||
|
||||
VgerCore.Color.White = "|cffffffff"
|
||||
VgerCore.Color.WhiteR = 255 / 255
|
||||
VgerCore.Color.WhiteG = 255 / 255
|
||||
VgerCore.Color.WhiteB = 255 / 255
|
||||
|
||||
VgerCore.Color.Grey = "|cff909090"
|
||||
VgerCore.Color.GreyR = 144 / 255
|
||||
VgerCore.Color.GreyG = 144 / 255
|
||||
VgerCore.Color.GreyB = 144 / 255
|
||||
|
||||
VgerCore.Color.Silver = "|cffc0c0c0"
|
||||
VgerCore.Color.SilverR = 192 / 255
|
||||
VgerCore.Color.SilverG = 192 / 255
|
||||
VgerCore.Color.SilverB = 192 / 255
|
||||
|
||||
VgerCore.Color.Black= "|cff000000"
|
||||
VgerCore.Color.BlackR = 0 / 255
|
||||
VgerCore.Color.BlackG = 0 / 255
|
||||
VgerCore.Color.BlackB = 0 / 255
|
||||
|
||||
VgerCore.MoneyColor = {}
|
||||
VgerCore.MoneyColor.Gold = "|cffecda90"
|
||||
VgerCore.MoneyColor.Silver = "|cffd7d5d8"
|
||||
VgerCore.MoneyColor.Copper = "|cffe2ad8e"
|
||||
|
||||
-- Common sounds
|
||||
VgerCore.Sound = {}
|
||||
VgerCore.Sound.Bell = "Sound\\Interface\\RaidWarning.wav"
|
||||
VgerCore.Sound.Fanfare = "Sound\\Spells\\NetherwindFocusImpact.wav"
|
||||
|
||||
|
||||
-- Displays a standard VgerCore message.
|
||||
function VgerCore.Message(Text)
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(VgerCore.Color.Orange .. tostring(Text))
|
||||
else
|
||||
message(VgerCore.Color.Orange .. tostring(Text))
|
||||
end
|
||||
end
|
||||
|
||||
-- Displays a bunch of messages from one string, separated by newlines.
|
||||
-- Notes:
|
||||
-- * Colors specified at the beginning of Text will not propagate to subsequent lines of Text.
|
||||
-- Use the optional Color parameter instead.
|
||||
-- * Empty lines will be skipped. Add a space to the line if you want it to be printed.
|
||||
function VgerCore.MultilineMessage(Text, Color)
|
||||
local Line
|
||||
local ColorString = Color
|
||||
if not ColorString then ColorString = "" end
|
||||
for Line in string.gmatch(Text, "[^\r\n]+") do
|
||||
VgerCore.Message(ColorString .. Line)
|
||||
end
|
||||
end
|
||||
|
||||
-- Displays a large VgerCore message.
|
||||
function VgerCore.BigMessage(Text)
|
||||
if UIErrorsFrame then
|
||||
UIErrorsFrame:AddMessage(tostring(Text), VgerCore.Color.GreenR, VgerCore.Color.GreenG, VgerCore.Color.GreenB, 1.0, 4.0)
|
||||
end
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(VgerCore.Color.Green .. tostring(Text))
|
||||
end
|
||||
end
|
||||
|
||||
-- Displays a VgerCore error message if the condition is false.
|
||||
function VgerCore.Assert(Condition, Message)
|
||||
-- Possibility: call the assert() function to get a callstack and integrate with mods such as Swatter.
|
||||
if not Condition then VgerCore.Fail(Message) end
|
||||
end
|
||||
|
||||
-- Displays a VgerCore error message.
|
||||
function VgerCore.Fail(Message)
|
||||
VgerCore.Message(VgerCore.Color.Salmon .. "ERROR: " .. VgerCore.Color.White .. tostring(Message))
|
||||
end
|
||||
|
||||
-- Hooks an insecure function. Similar to the base WoW API's hooksecurefunc. The hook function will be run
|
||||
-- after the original function to be hooked.
|
||||
-- Valid usage:
|
||||
-- VgerCore.HookInsecureFunction(Object, FunctionName, Hook)
|
||||
-- VgerCore.HookInsecureFunction(FunctionName, Hook)
|
||||
function VgerCore.HookInsecureFunction(arg1, arg2, arg3)
|
||||
local TypeOfObject = type(arg1)
|
||||
local OldFunction
|
||||
if TypeOfObject == "table" then -- Object, FunctionName, Hook
|
||||
OldFunction = arg1[arg2]
|
||||
if OldFunction then
|
||||
arg1[arg2] = VgerCore.CreateHookFunction(OldFunction, arg3)
|
||||
else
|
||||
VgerCore.Fail("VgerCore.HookInsecureFunction: could not find member function '" .. arg2 .. "'.")
|
||||
end
|
||||
elseif TypeOfObject == "string" then -- FunctionName, Hook
|
||||
OldFunction = getglobal(arg1)
|
||||
if OldFunction then
|
||||
_G = getfenv()
|
||||
_G[arg1] = VgerCore.CreateHookFunction(OldFunction, arg2)
|
||||
else
|
||||
VgerCore.Fail("VgerCore.HookInsecureFunction: could not find function '" .. arg1 .. "'.")
|
||||
end
|
||||
else
|
||||
VgerCore.Fail("VgerCore.HookInsecureFunction argument 1 must be table or string, not " .. TypeOfObject .. ".")
|
||||
end
|
||||
end
|
||||
|
||||
-- Hooks an insecure script handler. Works just like HookInsecureFunction(Object, FunctionName, Hook), except that
|
||||
-- instead of a function name, a script name is passed.
|
||||
function VgerCore.HookInsecureScript(Object, ScriptName, Hook)
|
||||
local OldFunction = Object:GetScript(ScriptName)
|
||||
if OldFunction then
|
||||
Object:SetScript(ScriptName, VgerCore.CreateHookFunction(OldFunction, Hook))
|
||||
else
|
||||
Object:SetScript(ScriptName, Hook)
|
||||
end
|
||||
end
|
||||
|
||||
-- Internal function used by HookInsecureFunction.
|
||||
function VgerCore.CreateHookFunction(OldFunction, Hook)
|
||||
return function(...)
|
||||
local ReturnValue = OldFunction(...)
|
||||
Hook(...)
|
||||
return ReturnValue
|
||||
end
|
||||
end
|
||||
|
||||
-- Executes a chat command just as if it were typed in the chat window.
|
||||
-- Returns true if successful, or false if not (primarily if the command is a secure function, such as /cast).
|
||||
function VgerCore.ExecuteChatCommand(Command)
|
||||
local EditBox = DEFAULT_CHAT_FRAME.editBox
|
||||
if not EditBox then return false end
|
||||
|
||||
-- First, make sure that this command is okay.
|
||||
local _, _, SlashCommand = strfind(Command, "^(/%w+) ")
|
||||
if SlashCommand then
|
||||
if IsSecureCmd(SlashCommand) then
|
||||
VgerCore.Fail(SlashCommand .. " is a secure command and cannot be run automatically.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Now, execute the chat command.
|
||||
local PreviousText = EditBox:GetText()
|
||||
EditBox:SetText(Command)
|
||||
ChatEdit_SendText(EditBox)
|
||||
EditBox:SetText(PreviousText)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Runs a macro.
|
||||
-- Returns true if successful, or false if not.
|
||||
function VgerCore.RunMacro(MacroName)
|
||||
-- First, get the text of the macro.
|
||||
local _, _, Script, _ = GetMacroInfo(MacroName)
|
||||
if not Script then return false end
|
||||
|
||||
-- Then, execute each line individually. Ignore comments marked with # or -.
|
||||
local Line
|
||||
for Line in string.gmatch(Script, "[^\n]+") do
|
||||
local FirstChar = strsub(Line, 1, 1)
|
||||
if FirstChar ~= "#" and FirstChar ~= "-" then
|
||||
VgerCore.ExecuteChatCommand(Line)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Returns true if the user is in a Battleground, or false if not.
|
||||
function VgerCore.IsInBattleground()
|
||||
for Battleground = 1, MAX_BATTLEFIELD_QUEUES do
|
||||
local Status, _, _ = GetBattlefieldStatus(Battleground)
|
||||
if Status == "active" then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Comparer function for use in table.sort that sorts strings alphabetically, ignoring case.
|
||||
function VgerCore.CaseInsensitiveComparer(a, b)
|
||||
return strlower(a) < strlower(b)
|
||||
end
|
||||
|
||||
-- Returns a six-digit hex string for three RGB values 0-1.
|
||||
function VgerCore.RGBToHex(r, g, b)
|
||||
r = r <= 1 and r >= 0 and r or 0
|
||||
g = g <= 1 and g >= 0 and g or 0
|
||||
b = b <= 1 and b >= 0 and b or 0
|
||||
return format("%02x%02x%02x", r * 255, g * 255, b * 255)
|
||||
end
|
||||
|
||||
-- Returns RGB values 0-1 for a six-digit hex string, or nil if unsuccessful.
|
||||
function VgerCore.HexToRGB(hex)
|
||||
if not hex or strlen(hex) ~= 6 then return end
|
||||
local r, g, b = strsub(hex, 1, 2), strsub(hex, 3, 4), strsub(hex, 5, 6)
|
||||
r, g, b = r or 0, g or 0, b or 0
|
||||
return tonumber(r, 16) / 255, tonumber(g, 16) / 255, tonumber(b, 16) / 255
|
||||
end
|
||||
|
||||
-- Same as strfind, but finds the last occurrence of a substring. The substring to find must be
|
||||
-- a single character.
|
||||
function VgerCore.StringFindReverse(str, find)
|
||||
VgerCore.Assert(strlen(find) == 1, "The substring to find must be a single character.")
|
||||
local FindByte = strbyte(find)
|
||||
local StringLength = strlen(str)
|
||||
local i
|
||||
for i = StringLength, 1, -1 do
|
||||
if strbyte(str, i) == FindByte then return i end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
end -- if InitializeOrUpgrade
|
||||
Reference in New Issue
Block a user