Initial commit
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
<!--
|
||||
Name: Prat_KeyBindings
|
||||
Revision: $Revision: 13965 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#KeyBindings
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds keybindings for modules.
|
||||
Dependencies: Prat
|
||||
-->
|
||||
|
||||
<Bindings>
|
||||
<!-- ChannelNames -->
|
||||
<Binding name="officer" header="Prat_ChannelNames">
|
||||
ChatFrame_OpenChat("/o");
|
||||
</Binding>
|
||||
<Binding name="guild" >
|
||||
ChatFrame_OpenChat("/g");
|
||||
</Binding>
|
||||
<Binding name="party" >
|
||||
ChatFrame_OpenChat("/p");
|
||||
</Binding>
|
||||
<Binding name="raid" >
|
||||
ChatFrame_OpenChat("/raid");
|
||||
</Binding>
|
||||
<Binding name="raidwarn" >
|
||||
ChatFrame_OpenChat("/rw");
|
||||
</Binding>
|
||||
<Binding name="battleground" >
|
||||
ChatFrame_OpenChat("/bg");
|
||||
</Binding>
|
||||
<Binding name="say" >
|
||||
ChatFrame_OpenChat("/say");
|
||||
</Binding>
|
||||
<Binding name="yell" >
|
||||
ChatFrame_OpenChat("/yell");
|
||||
</Binding>
|
||||
<Binding name="whisper" >
|
||||
ChatFrame_OpenChat("/w");
|
||||
</Binding>
|
||||
<Binding name="one">
|
||||
ChatFrame_OpenChat("/1");
|
||||
</Binding>
|
||||
<Binding name="two">
|
||||
ChatFrame_OpenChat("/2");
|
||||
</Binding>
|
||||
<Binding name="three">
|
||||
ChatFrame_OpenChat("/3");
|
||||
</Binding>
|
||||
<Binding name="four">
|
||||
ChatFrame_OpenChat("/4");
|
||||
</Binding>
|
||||
<Binding name="five">
|
||||
ChatFrame_OpenChat("/5");
|
||||
</Binding>
|
||||
<Binding name="six">
|
||||
ChatFrame_OpenChat("/6");
|
||||
</Binding>
|
||||
<Binding name="seven">
|
||||
ChatFrame_OpenChat("/7");
|
||||
</Binding>
|
||||
<Binding name="eight">
|
||||
ChatFrame_OpenChat("/8");
|
||||
</Binding>
|
||||
<Binding name="nine">
|
||||
ChatFrame_OpenChat("/9");
|
||||
</Binding>
|
||||
<Binding name="ten">
|
||||
ChatFrame_OpenChat("/10");
|
||||
</Binding>
|
||||
<!-- TellTarget -->
|
||||
<Binding name="TellTarget" header="Prat_TellTarget">
|
||||
Prat_TellTarget:TellTarget();
|
||||
</Binding>
|
||||
</Bindings>
|
||||
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
Name: Prat
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
laytya (laytya at github)
|
||||
Inspired By: idChat2 by Industrial
|
||||
Website: https://github.com/laytya/Prat
|
||||
Description: A framework for chat frame modules.
|
||||
Dependencies: Ace2
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("Prat")
|
||||
local waterfall = AceLibrary("Waterfall-1.0")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Prat"] = true,
|
||||
["A framework for chat frame modules."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Prat"] = "Prat",
|
||||
["A framework for chat frame modules."] = "Фреймворк для чата.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Prat"] = "Prat",
|
||||
["A framework for chat frame modules."] = "聊天窗口增加插件。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Prat"] = "Prat",
|
||||
["A framework for chat frame modules."] = "대화창 모듈에 대한 프레임워크",
|
||||
} end)
|
||||
|
||||
Prat = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDB-2.0", "AceDebug-2.0", "AceEvent-2.0", "AceHook-2.1", "AceModuleCore-2.0")
|
||||
|
||||
Prat:RegisterDB("PratDB")
|
||||
Prat:SetModuleMixins("AceEvent-2.0", "AceHook-2.1")
|
||||
Prat.Options = {
|
||||
name = L["Prat"],
|
||||
desc = L["A framework for chat frame modules."],
|
||||
type = "group",
|
||||
args = {}
|
||||
}
|
||||
|
||||
local version = GetAddOnMetadata("Prat", "Version");
|
||||
|
||||
Prat:RegisterChatCommand({"/pratcl"}, Prat.Options)
|
||||
Prat:RegisterChatCommand({"/prat"}, function() waterfall:Open('Prat') end)
|
||||
waterfall:Register('Prat', 'aceOptions', Prat.Options, 'title','Prat ' .. version,'colorR', 0.6, 'colorG', 0.7, 'colorB', 1)
|
||||
@@ -0,0 +1,58 @@
|
||||
## Interface: 11200
|
||||
|
||||
## Title: Prat |cff7fff7f -Ace2-|r
|
||||
## Title-zhCN: |cff7fff7f-Ace2-|r Prat
|
||||
## Notes-ruRU: Фреймворк для чата.
|
||||
## Notes: A framework for chat frame modules.
|
||||
## Notes-frFR: Framework pour des modules concernant les fentres de discussion
|
||||
## Version: v1.0.8
|
||||
## Author: Prat Development Team, laytya, Qxcl
|
||||
|
||||
## X-Category: Chat/Communication
|
||||
## X-Website: https://github.com/Qxcl/Prat-turtle
|
||||
## X-Credits: Industrial, Ammo, Cirk, Yris, Leuchtturm, AnduinLothar, Satrina, <CWDG>昏睡墨鱼&月色狼影, Prat Development Team, RuWOW team
|
||||
|
||||
## OptionalDeps: Ace2
|
||||
|
||||
## SavedVariables: PratDB
|
||||
|
||||
libs\AceLibrary\AceLibrary.lua
|
||||
libs\AceOO-2.0\AceOO-2.0.lua
|
||||
libs\AceAddon-2.0\AceAddon-2.0.lua
|
||||
libs\AceConsole-2.0\AceConsole-2.0.lua
|
||||
libs\AceDB-2.0\AceDB-2.0.lua
|
||||
libs\AceDebug-2.0\AceDebug-2.0.lua
|
||||
libs\AceEvent-2.0\AceEvent-2.0.lua
|
||||
libs\AceHook-2.1\AceHook-2.1.lua
|
||||
libs\AceTab-2.0\AceTab-2.0.lua
|
||||
libs\AceModuleCore-2.0\AceModuleCore-2.0.lua
|
||||
libs\AceLocale-2.2\AceLocale-2.2.lua
|
||||
libs\Babble-Class-2.2\Babble-Class-2.2.lua
|
||||
libs\Waterfall-1.0\Waterfall-1.0.lua
|
||||
|
||||
Prat.lua
|
||||
|
||||
modules\Buttons.lua
|
||||
modules\ChannelNames.lua
|
||||
modules\ChannelSeparator.lua
|
||||
modules\ChannelColorMemory.lua
|
||||
modules\ChatTabs.lua
|
||||
modules\Fading.lua
|
||||
modules\FontSize.lua
|
||||
modules\Editbox.lua
|
||||
modules\Highlight.lua
|
||||
modules\History.lua
|
||||
modules\Justify.lua
|
||||
modules\KeyBindings.lua
|
||||
modules\Notification.lua
|
||||
modules\PlayerNames.lua
|
||||
modules\PopupMessage.lua
|
||||
modules\Scroll.lua
|
||||
modules\StickyChannels.lua
|
||||
modules\TellTarget.lua
|
||||
modules\Timestamps.lua
|
||||
modules\UrlCopy.lua
|
||||
modules\Who.lua
|
||||
|
||||
frames\who.xml
|
||||
frames\popup.xml
|
||||
Executable
BIN
Binary file not shown.
Executable
+37
@@ -0,0 +1,37 @@
|
||||
<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/">
|
||||
|
||||
|
||||
<Frame name="Prat_PopupFrame" hidden="true" toplevel="true">
|
||||
<Size>
|
||||
<AbsDimension x="505" y="95"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER"/>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentBG">
|
||||
<Color r="0.0" g="0.0" b="0.0" a="0.5"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString name="$parentText" inherits="GameFontNormalLarge">
|
||||
<Size>
|
||||
<AbsDimension x="500" y="100"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER"/>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnUpdate>
|
||||
Prat_PopupMessage:PopupUpdated(arg1);
|
||||
</OnUpdate>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
</Ui>
|
||||
Executable
+416
@@ -0,0 +1,416 @@
|
||||
<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/">
|
||||
|
||||
|
||||
<Button name="PratWhoButtonTemplate" virtual="true">
|
||||
<Size>
|
||||
<AbsDimension x="300" y="16"/>
|
||||
</Size>
|
||||
<Frames>
|
||||
<Frame name="$parentButtonText" setAllPoints="true">
|
||||
<Layers>
|
||||
<Layer level="BORDER">
|
||||
<FontString name="$parentName" inherits="GameFontNormal">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:Button_OnClick();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
<HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"/>
|
||||
</Button>
|
||||
|
||||
|
||||
<Frame name="PratWhoFrame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="UIParent" enableKeyboard="true" setAllPoints="true">
|
||||
<Size>
|
||||
<AbsDimension x="380" y="475"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-104"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
|
||||
<BackgroundInsets>
|
||||
<AbsInset left="11" right="12" top="12" bottom="11"/>
|
||||
</BackgroundInsets>
|
||||
<TileSize>
|
||||
<AbsValue val="32"/>
|
||||
</TileSize>
|
||||
<EdgeSize>
|
||||
<AbsValue val="32"/>
|
||||
</EdgeSize>
|
||||
</Backdrop>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<Texture name="PratWhoFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
|
||||
<Size>
|
||||
<AbsDimension x="256" y="64"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOP">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="12"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
<FontString inherits="GameFontNormal" text="Prat : Who">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoFrameHeader">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-14"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
<Layer level="HIGH">
|
||||
<FontString name="PratWhoTitle" inherits="GameFontNormal" text="Loading ...">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoFrame">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-40"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Button name="PratWhoFrameRefresh" inherits="OptionsButtonTemplate" text="Refresh">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="15" y="15"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:RefreshFrame();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="PratWhoFrameOk" inherits="OptionsButtonTemplate" text="Close">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-15" y="15"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:HideFrame();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="PratWhoToggleButton" inherits="OptionsButtonTemplate" text="">
|
||||
<size>
|
||||
<AbsDimension x="160" y="24"/>
|
||||
</size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="27"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:ToggleChanListWho();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="PratWhoInviteButton" inherits="OptionsButtonTemplate" text="Invite">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="15" y="40"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:Invite();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="PratWhoWhisperButton" inherits="OptionsButtonTemplate" text="Whisper">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-15" y="40"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Prat_Who:Whisper();
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
|
||||
<Button name="PratWhoButton1" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="PratWhoFrame">
|
||||
<Offset>
|
||||
<AbsDimension x="23" y="-80"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton2" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton1" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton3" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton2" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton4" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton3" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton5" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton4" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton6" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton5" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton7" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton6" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton8" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton7" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton9" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton8" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton10" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton9" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton11" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton10" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton12" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton11" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton13" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton12" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton14" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton13" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton15" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton14" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton16" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton15" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton17" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton16" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton18" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton17" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton19" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton18" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="PratWhoButton20" inherits="PratWhoButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="PratWhoButton19" relativePoint="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<ScrollFrame name="PratWhoScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="296" y="332"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="PratWhoFrame">
|
||||
<Offset>
|
||||
<AbsDimension x="-40" y="-75"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
|
||||
<Size>
|
||||
<AbsDimension x="31" y="256"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="5"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.484375" top="0" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
|
||||
<Size>
|
||||
<AbsDimension x="31" y="106"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="-2"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0.515625" right="1.0" top="0" bottom="0.4140625"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnVerticalScroll>
|
||||
FauxScrollFrame_OnVerticalScroll(PRAT_WHO_FRAME_HEIGHT, Prat_Who_UpdateFrame);
|
||||
</OnVerticalScroll>
|
||||
</Scripts>
|
||||
</ScrollFrame>
|
||||
|
||||
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnDragStart>
|
||||
PratWhoFrame:StartMoving();
|
||||
</OnDragStart>
|
||||
<OnDragStop>
|
||||
PratWhoFrame:StopMovingOrSizing();
|
||||
</OnDragStop>
|
||||
<OnMouseUp>
|
||||
PratWhoFrame:StopMovingOrSizing();
|
||||
</OnMouseUp>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Ui>
|
||||
Executable
+1078
File diff suppressed because it is too large
Load Diff
Executable
+1909
File diff suppressed because it is too large
Load Diff
Executable
+1518
File diff suppressed because it is too large
Load Diff
Executable
+242
@@ -0,0 +1,242 @@
|
||||
--[[
|
||||
Name: AceDebug-2.0
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceDebug-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceDebug-2.0
|
||||
Description: Mixin to allow for simple debugging capabilities.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceDebug-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17638 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local DEBUGGING, TOGGLE_DEBUGGING
|
||||
|
||||
if GetLocale() == "frFR" then
|
||||
DEBUGGING = "D\195\169boguage"
|
||||
TOGGLE_DEBUGGING = "Activer/d\195\169sactiver le d\195\169boguage"
|
||||
elseif GetLocale() == "deDE" then
|
||||
DEBUGGING = "Debuggen"
|
||||
TOGGLE_DEBUGGING = "Aktiviert/Deaktiviert Debugging"
|
||||
elseif GetLocale() == "koKR" then
|
||||
DEBUGGING = "디버깅"
|
||||
TOGGLE_DEBUGGING = "디버깅 기능 사용함/사용안함"
|
||||
elseif GetLocale() == "zhTW" then
|
||||
DEBUGGING = "除錯"
|
||||
TOGGLE_DEBUGGING = "啟用/停用除錯功能"
|
||||
elseif GetLocale() == "zhCN" then
|
||||
DEBUGGING = "\232\176\131\232\175\149"
|
||||
TOGGLE_DEBUGGING = "\229\144\175\231\148\168/\231\166\129\231\148\168 \232\176\131\232\175\149"
|
||||
elseif GetLocale() == "ruRU" then
|
||||
DEBUGGING = "Отладка"
|
||||
TOGGLE_DEBUGGING = "Вкл/Выкл отладку для этого аддона."
|
||||
else -- enUS
|
||||
DEBUGGING = "Debugging"
|
||||
TOGGLE_DEBUGGING = "Enable/disable debugging"
|
||||
end
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local math_mod = math.mod or math.fmod
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceDebug = AceOO.Mixin {"Debug", "CustomDebug", "IsDebugging", "SetDebugging", "SetDebugLevel", "LevelDebug", "CustomLevelDebug", "GetDebugLevel"}
|
||||
|
||||
local function print(text, r, g, b, frame, delay)
|
||||
(frame or DEFAULT_CHAT_FRAME):AddMessage(text, r, g, b, 1, delay or 5)
|
||||
end
|
||||
|
||||
local tmp
|
||||
|
||||
function AceDebug:CustomDebug(r, g, b, frame, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging then return end
|
||||
|
||||
local output = string.format("|cff7fff7f(DEBUG) %s:[%s%3d]|r", tostring(self), date("%H:%M:%S"), math_mod(GetTime(), 1) * 1000)
|
||||
|
||||
if string.find(tostring(a1), "%%") then
|
||||
output = output .. " " .. string.format(tostring(a1), tostring(a2), tostring(a3), tostring(a4), tostring(a5), tostring(a6), tostring(a7), tostring(a8), tostring(a9), tostring(a10), tostring(a11), tostring(a12), tostring(a13), tostring(a14), tostring(a15), tostring(a16), tostring(a17), tostring(a18), tostring(a19), tostring(a20))
|
||||
else
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
|
||||
-- This block dynamically rebuilds the tmp array stopping on the first nil.
|
||||
table.insert(tmp, output)
|
||||
|
||||
table.insert(tmp, tostring(a1))
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
while tmp[table.getn(tmp)] == nil do
|
||||
table.remove(tmp)
|
||||
end
|
||||
for k = 1, table.getn(tmp) do
|
||||
tmp[k] = tostring(tmp[k])
|
||||
end
|
||||
|
||||
output = table.concat(tmp, " ")
|
||||
|
||||
for k,v in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
end
|
||||
|
||||
print(output, r, g, b, frame or self.debugFrame, delay)
|
||||
end
|
||||
|
||||
function AceDebug:Debug(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
AceDebug.CustomDebug(self, nil, nil, nil, nil, nil, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceDebug:IsDebugging()
|
||||
return self.debugging
|
||||
end
|
||||
|
||||
function AceDebug:SetDebugging(debugging)
|
||||
self.debugging = debugging
|
||||
end
|
||||
|
||||
-- Takes a number 1-3
|
||||
-- Level 1: Critical messages that every user should receive
|
||||
-- Level 2: Should be used for local debugging (function calls, etc)
|
||||
-- Level 3: Very verbose debugging, will dump everything and anything
|
||||
-- If set to nil, you will receive no debug information
|
||||
function AceDebug:SetDebugLevel(level)
|
||||
AceDebug:argCheck(level, 1, "number", "nil")
|
||||
if not level then
|
||||
self.debuglevel = nil
|
||||
return
|
||||
end
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `SetDebugLevel`, must be a number 1-3")
|
||||
end
|
||||
self.debuglevel = level
|
||||
end
|
||||
|
||||
function AceDebug:GetDebugLevel()
|
||||
return self.debuglevel
|
||||
end
|
||||
|
||||
function AceDebug:CustomLevelDebug(level, r, g, b, frame, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging or not self.debuglevel then return end
|
||||
AceDebug:argCheck(level, 1, "number")
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `LevelDebug`, must be a number 1-3")
|
||||
end
|
||||
if level > self.debuglevel then return end
|
||||
|
||||
local output = string.format("|cff7fff7f(DEBUG) %s:[%s.%3d]|r", tostring(self), date("%H:%M:%S"), math_mod(GetTime(), 1) * 1000)
|
||||
|
||||
if string.find(tostring(a1), "%%") then
|
||||
output = output .. " " .. string.format(tostring(a1), tostring(a2), tostring(a3), tostring(a4), tostring(a5), tostring(a6), tostring(a7), tostring(a8), tostring(a9), tostring(a10), tostring(a11), tostring(a12), tostring(a13), tostring(a14), tostring(a15), tostring(a16), tostring(a17), tostring(a18), tostring(a19), tostring(a20))
|
||||
else
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
|
||||
-- This block dynamically rebuilds the tmp array stopping on the first nil.
|
||||
table.insert(tmp, output)
|
||||
|
||||
table.insert(tmp, tostring(a1))
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
while tmp[table.getn(tmp)] == nil do
|
||||
table.remove(tmp)
|
||||
end
|
||||
for k = 1, table.getn(tmp) do
|
||||
tmp[k] = tostring(tmp[k])
|
||||
end
|
||||
|
||||
output = table.concat(tmp, " ")
|
||||
|
||||
for k,v in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
end
|
||||
|
||||
print(output, r, g, b, frame or self.debugFrame, delay)
|
||||
end
|
||||
|
||||
function AceDebug:LevelDebug(level, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.debugging or not self.debuglevel then return end
|
||||
AceDebug:argCheck(level, 1, "number")
|
||||
if level < 1 or level > 3 then
|
||||
AceDebug:error("Bad argument #1 to `LevelDebug`, must be a number 1-3")
|
||||
end
|
||||
if level > self.debuglevel then return end
|
||||
|
||||
AceDebug.CustomLevelDebug(self, level, nil, nil, nil, nil, nil, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
|
||||
local options
|
||||
function AceDebug:GetAceOptionsDataTable(target)
|
||||
if not options then
|
||||
options = {
|
||||
debug = {
|
||||
name = DEBUGGING,
|
||||
desc = TOGGLE_DEBUGGING,
|
||||
type = "toggle",
|
||||
get = "IsDebugging",
|
||||
set = "SetDebugging",
|
||||
order = -2,
|
||||
}
|
||||
}
|
||||
end
|
||||
return options
|
||||
end
|
||||
AceLibrary:Register(AceDebug, MAJOR_VERSION, MINOR_VERSION, AceDebug.activate)
|
||||
AceDebug = AceLibrary(MAJOR_VERSION)
|
||||
Executable
+973
@@ -0,0 +1,973 @@
|
||||
--[[
|
||||
Name: AceEvent-2.0
|
||||
Revision: $Rev: 17803 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceEvent-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceEvent-2.0
|
||||
Description: Mixin to allow for event handling, scheduling, and inter-addon
|
||||
communication.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceEvent-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17803 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local Mixin = AceOO.Mixin
|
||||
local AceEvent = Mixin {
|
||||
"RegisterEvent",
|
||||
"RegisterAllEvents",
|
||||
"UnregisterEvent",
|
||||
"UnregisterAllEvents",
|
||||
"TriggerEvent",
|
||||
"ScheduleEvent",
|
||||
"ScheduleRepeatingEvent",
|
||||
"CancelScheduledEvent",
|
||||
"CancelAllScheduledEvents",
|
||||
"IsEventRegistered",
|
||||
"IsEventScheduled",
|
||||
"RegisterBucketEvent",
|
||||
"UnregisterBucketEvent",
|
||||
"UnregisterAllBucketEvents",
|
||||
"IsBucketEventRegistered",
|
||||
}
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local weakKey = {__mode="k"}
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, weakKey)
|
||||
function new()
|
||||
local t = next(list)
|
||||
if t then
|
||||
list[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
function del(t)
|
||||
setmetatable(t, nil)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
list[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
local FAKE_NIL
|
||||
local RATE
|
||||
|
||||
local eventsWhichHappenOnce = {
|
||||
PLAYER_LOGIN = true,
|
||||
AceEvent_FullyInitialized = true,
|
||||
VARIABLES_LOADED = true,
|
||||
PLAYER_LOGOUT = true,
|
||||
}
|
||||
|
||||
local registeringFromAceEvent
|
||||
function AceEvent:RegisterEvent(event, method, once)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
if self == AceEvent and not registeringFromAceEvent then
|
||||
AceEvent:argCheck(method, 3, "function")
|
||||
self = method
|
||||
else
|
||||
AceEvent:argCheck(method, 3, "string", "function", "nil", "boolean", "number")
|
||||
if type(method) == "boolean" or type(method) == "number" then
|
||||
AceEvent:argCheck(once, 4, "nil")
|
||||
once, method = method, event
|
||||
end
|
||||
end
|
||||
AceEvent:argCheck(once, 4, "number", "boolean", "nil")
|
||||
if eventsWhichHappenOnce[event] then
|
||||
once = true
|
||||
end
|
||||
local throttleRate
|
||||
if type(once) == "number" then
|
||||
throttleRate, once = once
|
||||
end
|
||||
if not method then
|
||||
method = event
|
||||
end
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register event %q to method %q, it does not exist", event, method)
|
||||
else
|
||||
assert(type(method) == "function" or type(method) == "string")
|
||||
end
|
||||
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if not AceEvent_registry[event] then
|
||||
AceEvent_registry[event] = new()
|
||||
AceEvent.frame:RegisterEvent(event)
|
||||
end
|
||||
|
||||
local remember = true
|
||||
if AceEvent_registry[event][self] then
|
||||
remember = false
|
||||
end
|
||||
AceEvent_registry[event][self] = method
|
||||
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
if once then
|
||||
if not AceEvent_onceRegistry then
|
||||
AceEvent.onceRegistry = new()
|
||||
AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
end
|
||||
if not AceEvent_onceRegistry[event] then
|
||||
AceEvent_onceRegistry[event] = new()
|
||||
end
|
||||
AceEvent_onceRegistry[event][self] = true
|
||||
else
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] then
|
||||
AceEvent_onceRegistry[event][self] = nil
|
||||
if not next(AceEvent_onceRegistry[event]) then
|
||||
AceEvent_onceRegistry[event] = del(AceEvent_onceRegistry[event])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
if throttleRate then
|
||||
if not AceEvent_throttleRegistry then
|
||||
AceEvent.throttleRegistry = new()
|
||||
AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
end
|
||||
if not AceEvent_throttleRegistry[event] then
|
||||
AceEvent_throttleRegistry[event] = new()
|
||||
end
|
||||
if AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
end
|
||||
AceEvent_throttleRegistry[event][self] = setmetatable(new(), weakKey)
|
||||
local t = AceEvent_throttleRegistry[event][self]
|
||||
t[RATE] = throttleRate
|
||||
else
|
||||
if AceEvent_throttleRegistry and AceEvent_throttleRegistry[event] then
|
||||
if AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
end
|
||||
if not next(AceEvent_throttleRegistry[event]) then
|
||||
AceEvent_throttleRegistry[event] = del(AceEvent_throttleRegistry[event])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if remember then
|
||||
AceEvent:TriggerEvent("AceEvent_EventRegistered", self, event)
|
||||
end
|
||||
end
|
||||
|
||||
local ALL_EVENTS
|
||||
|
||||
function AceEvent:RegisterAllEvents(method)
|
||||
if self == AceEvent then
|
||||
AceEvent:argCheck(method, 1, "function")
|
||||
self = method
|
||||
else
|
||||
AceEvent:argCheck(method, 1, "string", "function")
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register all events to method %q, it does not exist", method)
|
||||
end
|
||||
end
|
||||
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if not AceEvent_registry[ALL_EVENTS] then
|
||||
AceEvent_registry[ALL_EVENTS] = new()
|
||||
AceEvent.frame:RegisterAllEvents()
|
||||
end
|
||||
|
||||
AceEvent_registry[ALL_EVENTS][self] = method
|
||||
end
|
||||
|
||||
local _G = getfenv(0)
|
||||
local memstack, timestack = {}, {}
|
||||
local memdiff, timediff
|
||||
function AceEvent:TriggerEvent(event, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if (not AceEvent_registry[event] or not next(AceEvent_registry[event])) and (not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS])) then
|
||||
return
|
||||
end
|
||||
local _G_event = _G.event
|
||||
_G.event = event
|
||||
local lastEvent = AceEvent.currentEvent
|
||||
AceEvent.currentEvent = event
|
||||
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
local AceEvent_debugTable = AceEvent.debugTable
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_onceRegistry[event]) do
|
||||
tmp[obj] = AceEvent_registry[event] and AceEvent_registry[event][obj] or nil
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
local method = tmp[obj]
|
||||
AceEvent.UnregisterEvent(obj, event)
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
local throttleTable = AceEvent_throttleRegistry and AceEvent_throttleRegistry[event]
|
||||
if AceEvent_registry[event] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_registry[event]) do
|
||||
tmp[obj] = method
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local method = tmp[obj]
|
||||
local continue = false
|
||||
if throttleTable and throttleTable[obj] then
|
||||
local a1 = a1
|
||||
if a1 == nil then
|
||||
a1 = FAKE_NIL
|
||||
end
|
||||
if not throttleTable[obj][a1] or GetTime() - throttleTable[obj][a1] >= throttleTable[obj][RATE] then
|
||||
throttleTable[obj][a1] = GetTime()
|
||||
else
|
||||
continue = true
|
||||
end
|
||||
end
|
||||
if not continue then
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
if AceEvent_registry[ALL_EVENTS] then
|
||||
local tmp = new()
|
||||
for obj, method in pairs(AceEvent_registry[ALL_EVENTS]) do
|
||||
tmp[obj] = method
|
||||
end
|
||||
local obj = next(tmp)
|
||||
while obj do
|
||||
local method = tmp[obj]
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
if not AceEvent_debugTable[event] then
|
||||
AceEvent_debugTable[event] = new()
|
||||
end
|
||||
if not AceEvent_debugTable[event][obj] then
|
||||
AceEvent_debugTable[event][obj] = new()
|
||||
AceEvent_debugTable[event][obj].mem = 0
|
||||
AceEvent_debugTable[event][obj].time = 0
|
||||
AceEvent_debugTable[event][obj].count = 0
|
||||
end
|
||||
if memdiff then
|
||||
table.insert(memstack, memdiff)
|
||||
table.insert(timestack, timediff)
|
||||
end
|
||||
memdiff, timediff = 0, 0
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(method) == "string" then
|
||||
local obj_method = obj[method]
|
||||
if obj_method then
|
||||
obj_method(obj, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
elseif method then -- function
|
||||
method(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
local dmem, dtime = memdiff, timediff
|
||||
mem, time = gcinfo() - mem - memdiff, GetTime() - time - timediff
|
||||
AceEvent_debugTable[event][obj].mem = AceEvent_debugTable[event][obj].mem + mem
|
||||
AceEvent_debugTable[event][obj].time = AceEvent_debugTable[event][obj].time + time
|
||||
AceEvent_debugTable[event][obj].count = AceEvent_debugTable[event][obj].count + 1
|
||||
|
||||
memdiff, timediff = table.remove(memstack), table.remove(timestack)
|
||||
if memdiff then
|
||||
memdiff = memdiff + mem + dmem
|
||||
timediff = timediff + time + dtime
|
||||
end
|
||||
end
|
||||
tmp[obj] = nil
|
||||
obj = next(tmp)
|
||||
end
|
||||
del(tmp)
|
||||
end
|
||||
_G.event = _G_event
|
||||
AceEvent.currentEvent = lastEvent
|
||||
end
|
||||
|
||||
-- local accessors
|
||||
local getn = table.getn
|
||||
local tinsert = table.insert
|
||||
local tremove = table.remove
|
||||
local floor = math.floor
|
||||
local GetTime = GetTime
|
||||
local next = next
|
||||
local pairs = pairs
|
||||
local unpack = unpack
|
||||
|
||||
local delayRegistry
|
||||
local tmp = {}
|
||||
local function OnUpdate()
|
||||
local t = GetTime()
|
||||
for k,v in pairs(delayRegistry) do
|
||||
tmp[k] = true
|
||||
end
|
||||
for k in pairs(tmp) do
|
||||
local v = delayRegistry[k]
|
||||
if v then
|
||||
local v_time = v.time
|
||||
if not v_time then
|
||||
delayRegistry[k] = del(v)
|
||||
elseif v_time <= t then
|
||||
local v_repeatDelay = v.repeatDelay
|
||||
if v_repeatDelay then
|
||||
-- use the event time, not the current time, else timing inaccuracies add up over time
|
||||
v.time = v_time + v_repeatDelay
|
||||
end
|
||||
local event = v.event
|
||||
local mem, time
|
||||
if AceEvent_debugTable then
|
||||
mem, time = gcinfo(), GetTime()
|
||||
end
|
||||
if type(event) == "function" then
|
||||
event(unpack(v))
|
||||
else
|
||||
AceEvent:TriggerEvent(event, unpack(v))
|
||||
end
|
||||
if AceEvent_debugTable then
|
||||
mem, time = gcinfo() - mem, GetTime() - time
|
||||
v.mem = v.mem + mem
|
||||
v.timeSpent = v.timeSpent + time
|
||||
v.count = v.count + 1
|
||||
end
|
||||
if not v_repeatDelay then
|
||||
local x = delayRegistry[k]
|
||||
if x and x.time == v_time then -- check if it was manually reset
|
||||
delayRegistry[k] = del(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for k in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function ScheduleEvent(self, repeating, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
local id
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
id, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20 = event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20
|
||||
AceEvent:argCheck(event, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(delay, 4, "number")
|
||||
self:CancelScheduledEvent(id)
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
if not delayRegistry then
|
||||
AceEvent.delayRegistry = new()
|
||||
delayRegistry = AceEvent.delayRegistry
|
||||
AceEvent.frame:SetScript("OnUpdate", OnUpdate)
|
||||
end
|
||||
local t
|
||||
if type(id) == "table" then
|
||||
for k in pairs(id) do
|
||||
id[k] = nil
|
||||
end
|
||||
t = id
|
||||
else
|
||||
t = new()
|
||||
end
|
||||
t[1] = a1
|
||||
t[2] = a2
|
||||
t[3] = a3
|
||||
t[4] = a4
|
||||
t[5] = a5
|
||||
t[6] = a6
|
||||
t[7] = a7
|
||||
t[8] = a8
|
||||
t[9] = a9
|
||||
t[10] = a10
|
||||
t[11] = a11
|
||||
t[12] = a12
|
||||
t[13] = a13
|
||||
t[14] = a14
|
||||
t[15] = a15
|
||||
t[16] = a16
|
||||
t[17] = a17
|
||||
t[18] = a18
|
||||
t[19] = a19
|
||||
t[20] = a20
|
||||
table_setn(t, 20)
|
||||
t.event = event
|
||||
t.time = GetTime() + delay
|
||||
t.self = self
|
||||
t.id = id or t
|
||||
t.repeatDelay = repeating and delay
|
||||
if AceEvent_debugTable then
|
||||
t.mem = 0
|
||||
t.count = 0
|
||||
t.timeSpent = 0
|
||||
end
|
||||
delayRegistry[t.id] = t
|
||||
AceEvent.frame:Show()
|
||||
return t.id
|
||||
end
|
||||
|
||||
function AceEvent:ScheduleEvent(event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
AceEvent:argCheck(delay, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(a1, 4, "number")
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
return ScheduleEvent(self, false, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceEvent:ScheduleRepeatingEvent(event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(event) == "string" or type(event) == "table" then
|
||||
if type(event) == "table" then
|
||||
if not delayRegistry or not delayRegistry[event] then
|
||||
AceEvent:error("Bad argument #2 to `ScheduleEvent'. Improper id table fed in.")
|
||||
end
|
||||
end
|
||||
if type(delay) ~= "number" then
|
||||
AceEvent:argCheck(delay, 3, "string", "function", --[[ so message is right ]] "number")
|
||||
AceEvent:argCheck(a1, 4, "number")
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(event, 2, "string", "function")
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
end
|
||||
|
||||
return ScheduleEvent(self, true, event, delay, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
end
|
||||
|
||||
function AceEvent:CancelScheduledEvent(t)
|
||||
AceEvent:argCheck(t, 2, "string", "table")
|
||||
if delayRegistry then
|
||||
local v = delayRegistry[t]
|
||||
if v then
|
||||
delayRegistry[t] = del(v)
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function AceEvent:IsEventScheduled(t)
|
||||
AceEvent:argCheck(t, 2, "string", "table")
|
||||
if delayRegistry then
|
||||
local v = delayRegistry[t]
|
||||
if v then
|
||||
return true, v.time - GetTime()
|
||||
end
|
||||
end
|
||||
return false, nil
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterEvent(event)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if AceEvent_registry[event] and AceEvent_registry[event][self] then
|
||||
AceEvent_registry[event][self] = nil
|
||||
local AceEvent_onceRegistry = AceEvent.onceRegistry
|
||||
if AceEvent_onceRegistry and AceEvent_onceRegistry[event] and AceEvent_onceRegistry[event][self] then
|
||||
AceEvent_onceRegistry[event][self] = nil
|
||||
if not next(AceEvent_onceRegistry[event]) then
|
||||
AceEvent_onceRegistry[event] = del(AceEvent_onceRegistry[event])
|
||||
end
|
||||
end
|
||||
local AceEvent_throttleRegistry = AceEvent.throttleRegistry
|
||||
if AceEvent_throttleRegistry and AceEvent_throttleRegistry[event] and AceEvent_throttleRegistry[event][self] then
|
||||
AceEvent_throttleRegistry[event][self] = del(AceEvent_throttleRegistry[event][self])
|
||||
if not next(AceEvent_throttleRegistry[event]) then
|
||||
AceEvent_throttleRegistry[event] = del(AceEvent_throttleRegistry[event])
|
||||
end
|
||||
end
|
||||
if not next(AceEvent_registry[event]) then
|
||||
AceEvent_registry[event] = del(AceEvent_registry[event])
|
||||
if not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
AceEvent.frame:UnregisterEvent(event)
|
||||
end
|
||||
end
|
||||
else
|
||||
if self == AceEvent then
|
||||
error(string.format("Cannot unregister event %q. Improperly unregistering from AceEvent-2.0.", event), 2)
|
||||
else
|
||||
AceEvent:error("Cannot unregister event %q. %q is not registered with it.", event, self)
|
||||
end
|
||||
end
|
||||
AceEvent:TriggerEvent("AceEvent_EventUnregistered", self, event)
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterAllEvents()
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if AceEvent_registry[ALL_EVENTS] and AceEvent_registry[ALL_EVENTS][self] then
|
||||
AceEvent_registry[ALL_EVENTS][self] = nil
|
||||
if not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
del(AceEvent_registry[ALL_EVENTS])
|
||||
AceEvent.frame:UnregisterAllEvents()
|
||||
for k,v in pairs(AceEvent_registry) do
|
||||
if k ~= ALL_EVENTS then
|
||||
AceEvent.frame:RegisterEvent(k)
|
||||
end
|
||||
end
|
||||
AceEvent_registry[event] = nil
|
||||
end
|
||||
end
|
||||
local first = true
|
||||
for event, data in pairs(AceEvent_registry) do
|
||||
if first then
|
||||
if AceEvent_registry.AceEvent_EventUnregistered then
|
||||
event = "AceEvent_EventUnregistered"
|
||||
else
|
||||
first = false
|
||||
end
|
||||
end
|
||||
local x = data[self]
|
||||
data[self] = nil
|
||||
if x and event ~= ALL_EVENTS then
|
||||
if not next(data) then
|
||||
del(data)
|
||||
if not AceEvent_registry[ALL_EVENTS] or not next(AceEvent_registry[ALL_EVENTS]) then
|
||||
AceEvent.frame:UnregisterEvent(event)
|
||||
end
|
||||
AceEvent_registry[event] = nil
|
||||
end
|
||||
AceEvent:TriggerEvent("AceEvent_EventUnregistered", self, event)
|
||||
end
|
||||
if first then
|
||||
event = nil
|
||||
end
|
||||
end
|
||||
if AceEvent.onceRegistry then
|
||||
for event, data in pairs(AceEvent.onceRegistry) do
|
||||
data[self] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:CancelAllScheduledEvents()
|
||||
if delayRegistry then
|
||||
for k,v in pairs(delayRegistry) do
|
||||
if v.self == self then
|
||||
delayRegistry[k] = del(v)
|
||||
end
|
||||
end
|
||||
if not next(delayRegistry) then
|
||||
AceEvent.frame:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:IsEventRegistered(event)
|
||||
AceEvent:argCheck(event, 2, "string")
|
||||
local AceEvent_registry = AceEvent.registry
|
||||
if self == AceEvent then
|
||||
return AceEvent_registry[event] and next(AceEvent_registry[event]) and true or false
|
||||
end
|
||||
if AceEvent_registry[event] and AceEvent_registry[event][self] then
|
||||
return true, AceEvent_registry[event][self]
|
||||
end
|
||||
return false, nil
|
||||
end
|
||||
|
||||
local bucketfunc
|
||||
function AceEvent:RegisterBucketEvent(event, delay, method)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
if type(event) == "table" then
|
||||
for k,v in pairs(event) do
|
||||
if type(k) ~= "number" then
|
||||
AceEvent:error("All keys to argument #2 to `RegisterBucketEvent' must be numbers.")
|
||||
elseif type(v) ~= "string" then
|
||||
AceEvent:error("All values to argument #2 to `RegisterBucketEvent' must be strings.")
|
||||
end
|
||||
end
|
||||
end
|
||||
AceEvent:argCheck(delay, 3, "number")
|
||||
if AceEvent == self then
|
||||
AceEvent:argCheck(method, 4, "function")
|
||||
self = method
|
||||
else
|
||||
if type(event) == "string" then
|
||||
AceEvent:argCheck(method, 4, "string", "function", "nil")
|
||||
if not method then
|
||||
method = event
|
||||
end
|
||||
else
|
||||
AceEvent:argCheck(method, 4, "string", "function")
|
||||
end
|
||||
|
||||
if type(method) == "string" and type(self[method]) ~= "function" then
|
||||
AceEvent:error("Cannot register event %q to method %q, it does not exist", event, method)
|
||||
end
|
||||
end
|
||||
if not AceEvent.buckets then
|
||||
AceEvent.buckets = new()
|
||||
end
|
||||
if not AceEvent.buckets[event] then
|
||||
AceEvent.buckets[event] = new()
|
||||
end
|
||||
if not AceEvent.buckets[event][self] then
|
||||
AceEvent.buckets[event][self] = new()
|
||||
AceEvent.buckets[event][self].current = new()
|
||||
AceEvent.buckets[event][self].self = self
|
||||
else
|
||||
AceEvent.CancelScheduledEvent(self, AceEvent.buckets[event][self].id)
|
||||
end
|
||||
local bucket = AceEvent.buckets[event][self]
|
||||
bucket.method = method
|
||||
|
||||
local func = function(arg1)
|
||||
bucket.run = true
|
||||
if arg1 then
|
||||
bucket.current[arg1] = true
|
||||
end
|
||||
end
|
||||
AceEvent.buckets[event][self].func = func
|
||||
if type(event) == "string" then
|
||||
AceEvent.RegisterEvent(self, event, func)
|
||||
else
|
||||
for _,v in ipairs(event) do
|
||||
AceEvent.RegisterEvent(self, v, func)
|
||||
end
|
||||
end
|
||||
if not bucketfunc then
|
||||
bucketfunc = function(bucket)
|
||||
local current = bucket.current
|
||||
local method = bucket.method
|
||||
local self = bucket.self
|
||||
if bucket.run then
|
||||
if type(method) == "string" then
|
||||
self[method](self, current)
|
||||
elseif method then -- function
|
||||
method(current)
|
||||
end
|
||||
for k in pairs(current) do
|
||||
current[k] = nil
|
||||
k = nil
|
||||
end
|
||||
bucket.run = false
|
||||
end
|
||||
end
|
||||
end
|
||||
bucket.id = AceEvent.ScheduleRepeatingEvent(self, bucketfunc, delay, bucket)
|
||||
end
|
||||
|
||||
function AceEvent:IsBucketEventRegistered(event)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
return AceEvent.buckets and AceEvent.buckets[event] and AceEvent.buckets[event][self]
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterBucketEvent(event)
|
||||
AceEvent:argCheck(event, 2, "string", "table")
|
||||
if not AceEvent.buckets or not AceEvent.buckets[event] or not AceEvent.buckets[event][self] then
|
||||
AceEvent:error("Cannot unregister bucket event %q. %q is not registered with it.", event, self)
|
||||
end
|
||||
|
||||
local bucket = AceEvent.buckets[event][self]
|
||||
|
||||
if type(event) == "string" then
|
||||
AceEvent.UnregisterEvent(self, event)
|
||||
else
|
||||
for _,v in ipairs(event) do
|
||||
AceEvent.UnregisterEvent(self, v)
|
||||
end
|
||||
end
|
||||
AceEvent:CancelScheduledEvent(bucket.id)
|
||||
|
||||
del(bucket.current)
|
||||
AceEvent.buckets[event][self] = del(AceEvent.buckets[event][self])
|
||||
if not next(AceEvent.buckets[event]) then
|
||||
AceEvent.buckets[event] = del(AceEvent.buckets[event])
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:UnregisterAllBucketEvents()
|
||||
if not AceEvent.buckets or not next(AceEvent.buckets) then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(AceEvent.buckets) do
|
||||
if v == self then
|
||||
AceEvent.UnregisterBucketEvent(self, k)
|
||||
k = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:OnEmbedDisable(target)
|
||||
self.UnregisterAllEvents(target)
|
||||
|
||||
self.CancelAllScheduledEvents(target)
|
||||
|
||||
self.UnregisterAllBucketEvents(target)
|
||||
end
|
||||
|
||||
function AceEvent:EnableDebugging()
|
||||
if not self.debugTable then
|
||||
self.debugTable = new()
|
||||
|
||||
if delayRegistry then
|
||||
for k,v in pairs(self.delayRegistry) do
|
||||
if not v.mem then
|
||||
v.mem = 0
|
||||
v.count = 0
|
||||
v.timeSpent = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceEvent:IsFullyInitialized()
|
||||
return self.postInit or false
|
||||
end
|
||||
|
||||
function AceEvent:IsPostPlayerLogin()
|
||||
return self.playerLogin or false
|
||||
end
|
||||
|
||||
function AceEvent:activate(oldLib, oldDeactivate)
|
||||
AceEvent = self
|
||||
|
||||
if oldLib then
|
||||
self.onceRegistry = oldLib.onceRegistry
|
||||
self.throttleRegistry = oldLib.throttleRegistry
|
||||
self.delayRegistry = oldLib.delayRegistry
|
||||
self.buckets = oldLib.buckets
|
||||
self.registry = oldLib.registry
|
||||
self.frame = oldLib.frame
|
||||
self.debugTable = oldLib.debugTable
|
||||
self.playerLogin = oldLib.pew or DEFAULT_CHAT_FRAME and DEFAULT_CHAT_FRAME.defaultLanguage and true
|
||||
self.postInit = oldLib.postInit or self.playerLogin and ChatTypeInfo and ChatTypeInfo.WHISPER and ChatTypeInfo.WHISPER.r and true
|
||||
self.ALL_EVENTS = oldLib.ALL_EVENTS
|
||||
self.FAKE_NIL = oldLib.FAKE_NIL
|
||||
self.RATE = oldLib.RATE
|
||||
end
|
||||
if not self.registry then
|
||||
self.registry = {}
|
||||
end
|
||||
if not self.frame then
|
||||
self.frame = CreateFrame("Frame", "AceEvent20Frame")
|
||||
end
|
||||
if not self.ALL_EVENTS then
|
||||
self.ALL_EVENTS = {}
|
||||
end
|
||||
if not self.FAKE_NIL then
|
||||
self.FAKE_NIL = {}
|
||||
end
|
||||
if not self.RATE then
|
||||
self.RATE = {}
|
||||
end
|
||||
ALL_EVENTS = self.ALL_EVENTS
|
||||
FAKE_NIL = self.FAKE_NIL
|
||||
RATE = self.RATE
|
||||
local inPlw = false
|
||||
local blacklist = {
|
||||
UNIT_INVENTORY_CHANGED = true,
|
||||
BAG_UPDATE = true,
|
||||
ITEM_LOCK_CHANGED = true,
|
||||
ACTIONBAR_SLOT_CHANGED = true,
|
||||
}
|
||||
self.frame:SetScript("OnEvent", function()
|
||||
local event = event
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
inPlw = false
|
||||
elseif event == "PLAYER_LEAVING_WORLD" then
|
||||
inPlw = true
|
||||
end
|
||||
if event and (not inPlw or not blacklist[event]) then
|
||||
self:TriggerEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
|
||||
end
|
||||
end)
|
||||
if self.delayRegistry then
|
||||
delayRegistry = self.delayRegistry
|
||||
self.frame:SetScript("OnUpdate", OnUpdate)
|
||||
end
|
||||
|
||||
self:UnregisterAllEvents()
|
||||
self:CancelAllScheduledEvents()
|
||||
|
||||
registeringFromAceEvent = true
|
||||
self:RegisterEvent("LOOT_OPENED", function()
|
||||
SendAddonMessage("LOOT_OPENED", "", "RAID")
|
||||
end)
|
||||
registeringFromAceEvent = nil
|
||||
|
||||
if not self.playerLogin then
|
||||
registeringFromAceEvent = true
|
||||
self:RegisterEvent("PLAYER_LOGIN", function()
|
||||
self.playerLogin = true
|
||||
end, true)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
|
||||
if not self.postInit then
|
||||
local isReload = true
|
||||
local function func()
|
||||
self.postInit = true
|
||||
self:TriggerEvent("AceEvent_FullyInitialized")
|
||||
if self.registry["CHAT_MSG_CHANNEL_NOTICE"] and self.registry["CHAT_MSG_CHANNEL_NOTICE"][self] then
|
||||
self:UnregisterEvent("CHAT_MSG_CHANNEL_NOTICE")
|
||||
end
|
||||
if self.registry["MEETINGSTONE_CHANGED"] and self.registry["MEETINGSTONE_CHANGED"][self] then
|
||||
self:UnregisterEvent("MEETINGSTONE_CHANGED")
|
||||
end
|
||||
if self.registry["MINIMAP_ZONE_CHANGED"] and self.registry["MINIMAP_ZONE_CHANGED"][self] then
|
||||
self:UnregisterEvent("MINIMAP_ZONE_CHANGED")
|
||||
end
|
||||
if self.registry["LANGUAGE_LIST_CHANGED"] and self.registry["LANGUAGE_LIST_CHANGED"][self] then
|
||||
self:UnregisterEvent("LANGUAGE_LIST_CHANGED")
|
||||
end
|
||||
end
|
||||
registeringFromAceEvent = true
|
||||
local f = function()
|
||||
self.playerLogin = true
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 1)
|
||||
end
|
||||
self:RegisterEvent("MEETINGSTONE_CHANGED", f, true)
|
||||
self:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE", function()
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 0.05)
|
||||
end)
|
||||
self:RegisterEvent("LANGUAGE_LIST_CHANGED", function()
|
||||
if self.registry["MEETINGSTONE_CHANGED"] and self.registry["MEETINGSTONE_CHANGED"][self] then
|
||||
registeringFromAceEvent = true
|
||||
self:UnregisterEvent("MEETINGSTONE_CHANGED")
|
||||
self:RegisterEvent("MINIMAP_ZONE_CHANGED", f, true)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
end)
|
||||
self:ScheduleEvent("AceEvent_FullyInitialized", func, 10)
|
||||
registeringFromAceEvent = nil
|
||||
end
|
||||
|
||||
self.super.activate(self, oldLib, oldDeactivate)
|
||||
if oldLib then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceEvent, MAJOR_VERSION, MINOR_VERSION, AceEvent.activate)
|
||||
AceEvent = AceLibrary(MAJOR_VERSION)
|
||||
Executable
+569
@@ -0,0 +1,569 @@
|
||||
--[[
|
||||
Name: AceHook-2.1
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceHook-2.1
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceHook-2.1
|
||||
Description: Mixin to allow for safe hooking of functions, methods, and scripts.
|
||||
Dependencies: AceLibrary, AceOO-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceHook-2.1"
|
||||
local MINOR_VERSION = "$Revision: 17638 $"
|
||||
|
||||
-- This ensures the code is only executed if the libary doesn't already exist, or is a newer version
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Create the library object
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceHook = AceOO.Mixin {
|
||||
"Hook",
|
||||
"HookScript",
|
||||
"SecureHook",
|
||||
"Unhook",
|
||||
"UnhookAll",
|
||||
"HookReport",
|
||||
"IsHooked",
|
||||
}
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Library Definitions
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local protFuncs = {
|
||||
CameraOrSelectOrMoveStart = true, CameraOrSelectOrMoveStop = true,
|
||||
TurnOrActionStart = true, TurnOrActionStop = true,
|
||||
PitchUpStart = true, PitchUpStop = true,
|
||||
PitchDownStart = true, PitchDownStop = true,
|
||||
MoveBackwardStart = true, MoveBackwardStop = true,
|
||||
MoveForwardStart = true, MoveForwardStop = true,
|
||||
Jump = true, StrafeLeftStart = true,
|
||||
StrafeLeftStop = true, StrafeRightStart = true,
|
||||
StrafeRightStop = true, ToggleMouseMove = true,
|
||||
ToggleRun = true, TurnLeftStart = true,
|
||||
TurnLeftStop = true, TurnRightStart = true,
|
||||
TurnRightStop = true,
|
||||
}
|
||||
|
||||
local function issecurevariable(x)
|
||||
if protFuncs[x] then
|
||||
return 1
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local _G = getfenv(0)
|
||||
|
||||
local function hooksecurefunc(arg1, arg2, arg3)
|
||||
if type(arg1) == "string" then
|
||||
arg1, arg2, arg3 = _G, arg1, arg2
|
||||
end
|
||||
local orig = arg1[arg2]
|
||||
arg1[arg2] = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
local x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20 = orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
|
||||
arg3(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
|
||||
return x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20
|
||||
end
|
||||
end
|
||||
|
||||
local protectedScripts = {
|
||||
OnClick = true,
|
||||
}
|
||||
|
||||
|
||||
local handlers, scripts, actives, registry
|
||||
|
||||
--[[---------------------------------------------------------------------------------
|
||||
Private definitions (Not exposed)
|
||||
----------------------------------------------------------------------------------]]
|
||||
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, {__mode = "k"})
|
||||
function new()
|
||||
local t = next(list)
|
||||
if not t then
|
||||
return {}
|
||||
end
|
||||
list[t] = nil
|
||||
return t
|
||||
end
|
||||
|
||||
function del(t)
|
||||
setmetatable(t, nil)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
list[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
local function createFunctionHook(self, func, handler, orig, secure)
|
||||
if not secure then
|
||||
if type(handler) == "string" then
|
||||
-- The handler is a method, need to self it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
else
|
||||
-- secure hooks don't call the original method
|
||||
if type(handler) == "string" then
|
||||
-- The handler is a method, need to self it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function createMethodHook(self, object, method, handler, orig, secure, script)
|
||||
if script then
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function()
|
||||
if actives[uid] then
|
||||
return self[handler](self, object)
|
||||
else
|
||||
return orig()
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function()
|
||||
if actives[uid] then
|
||||
return handler(object)
|
||||
else
|
||||
return orig()
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
elseif not secure then
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
else
|
||||
return orig(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
else
|
||||
-- secure hooks don't call the original method
|
||||
if type(handler) == "string" then
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return self[handler](self, a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
else
|
||||
-- The handler is a function, just call it
|
||||
local uid
|
||||
uid = function(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
if actives[uid] then
|
||||
return handler(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20)
|
||||
end
|
||||
end
|
||||
return uid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function hookFunction(self, func, handler, secure)
|
||||
local orig = _G[func]
|
||||
|
||||
if not orig or type(orig) ~= "function" then
|
||||
AceHook:error("Attempt to hook a non-existant function %q", func)
|
||||
end
|
||||
|
||||
if not handler then
|
||||
handler = func
|
||||
end
|
||||
|
||||
if registry[self][func] then
|
||||
local uid = registry[self][func]
|
||||
|
||||
if actives[uid] then
|
||||
-- We have an active hook from this source. Don't multi-hook
|
||||
AceHook:error("%q already has an active hook from this source.", func)
|
||||
end
|
||||
|
||||
if handlers[uid] == handler then
|
||||
-- The hook is inactive, so reactivate it
|
||||
actives[uid] = true
|
||||
return
|
||||
else
|
||||
AceHook:error("There is a stale hook for %q can't hook or reactivate.", func)
|
||||
end
|
||||
end
|
||||
|
||||
if type(handler) == "string" then
|
||||
if type(self[handler]) ~= "function" then
|
||||
AceHook:error("Could not find the the handler %q when hooking function %q", handler, func)
|
||||
end
|
||||
elseif type(handler) ~= "function" then
|
||||
AceHook:error("Could not find the handler you supplied when hooking %q", func)
|
||||
end
|
||||
|
||||
local uid = createFunctionHook(self, func, handler, orig, secure)
|
||||
registry[self][func] = uid
|
||||
actives[uid] = true
|
||||
handlers[uid] = handler
|
||||
|
||||
if not secure then
|
||||
_G[func] = uid
|
||||
self.hooks[func] = orig
|
||||
else
|
||||
hooksecurefunc(func, uid)
|
||||
end
|
||||
end
|
||||
|
||||
local function unhookFunction(self, func)
|
||||
if not registry[self][func] then
|
||||
AceHook:error("Tried to unhook %q which is not currently hooked.", func)
|
||||
end
|
||||
|
||||
local uid = registry[self][func]
|
||||
|
||||
if actives[uid] then
|
||||
-- See if we own the global function
|
||||
if self.hooks[func] and _G[func] == uid then
|
||||
_G[func] = self.hooks[func]
|
||||
self.hooks[func] = nil
|
||||
registry[self][func] = nil
|
||||
handlers[uid] = nil
|
||||
scripts[uid] = nil
|
||||
actives[uid] = nil
|
||||
-- Magically all-done
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function hookMethod(self, obj, method, handler, script, secure)
|
||||
if not handler then
|
||||
handler = method
|
||||
end
|
||||
|
||||
if not obj or type(obj) ~= "table" then
|
||||
AceHook:error("The object you supplied could not be found, or isn't a table.")
|
||||
end
|
||||
|
||||
local uid = registry[self][obj] and registry[self][obj][method]
|
||||
if uid then
|
||||
if actives[uid] then
|
||||
-- We have an active hook from this source. Don't multi-hook
|
||||
AceHook:error("%q already has an active hook from this source.", method)
|
||||
end
|
||||
|
||||
if handlers[uid] == handler then
|
||||
-- The hook is inactive, reactivate it.
|
||||
actives[uid] = true
|
||||
return
|
||||
else
|
||||
AceHook:error("There is a stale hook for %q can't hook or reactivate.", method)
|
||||
end
|
||||
end
|
||||
|
||||
if type(handler) == "string" then
|
||||
if type(self[handler]) ~= "function" then
|
||||
AceHook:error("Could not find the handler %q you supplied when hooking method %q", handler, method)
|
||||
end
|
||||
elseif type(handler) ~= "function" then
|
||||
AceHook:error("Could not find the handler you supplied when hooking method %q", method)
|
||||
end
|
||||
|
||||
local orig
|
||||
if script then
|
||||
if not obj.GetScript then
|
||||
AceHook:error("The object you supplied does not have a GetScript method.")
|
||||
end
|
||||
if not obj:HasScript(method) then
|
||||
AceHook:error("The object you supplied doesn't allow the %q method.", method)
|
||||
end
|
||||
|
||||
orig = obj:GetScript(method)
|
||||
if type(orig) ~= "function" then
|
||||
-- Sometimes there is not a original function for a script.
|
||||
orig = function() end
|
||||
end
|
||||
else
|
||||
orig = obj[method]
|
||||
end
|
||||
if not orig then
|
||||
AceHook:error("Could not find the method or script %q you are trying to hook.", method)
|
||||
end
|
||||
|
||||
if not registry[self][obj] then
|
||||
registry[self][obj] = new()
|
||||
end
|
||||
|
||||
if not self.hooks[obj] then
|
||||
self.hooks[obj] = new()
|
||||
end
|
||||
|
||||
local uid = createMethodHook(self, obj, method, handler, orig, secure, script)
|
||||
registry[self][obj][method] = uid
|
||||
actives[uid] = true
|
||||
handlers[uid] = handler
|
||||
scripts[uid] = script and true or nil
|
||||
|
||||
if script then
|
||||
obj:SetScript(method, uid)
|
||||
self.hooks[obj][method] = orig
|
||||
elseif not secure then
|
||||
obj[method] = uid
|
||||
self.hooks[obj][method] = orig
|
||||
else
|
||||
hooksecurefunc(obj, method, uid)
|
||||
end
|
||||
end
|
||||
|
||||
local function unhookMethod(self, obj, method)
|
||||
if not registry[self][obj] or not registry[self][obj][method] then
|
||||
AceHook:error("Attempt to unhook a method %q that is not currently hooked.", method)
|
||||
return
|
||||
end
|
||||
|
||||
local uid = registry[self][obj][method]
|
||||
|
||||
if actives[uid] then
|
||||
if scripts[uid] then -- If this is a script
|
||||
if obj:GetScript(method) == uid then
|
||||
-- We own the script. Revert to normal.
|
||||
obj:SetScript(method, self.hooks[obj][method])
|
||||
self.hooks[obj][method] = nil
|
||||
registry[self][obj][method] = nil
|
||||
handlers[uid] = nil
|
||||
scripts[uid] = nil
|
||||
actives[uid] = nil
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
else
|
||||
if self.hooks[obj] and self.hooks[obj][method] and obj[method] == uid then
|
||||
-- We own the method. Revert to normal.
|
||||
obj[method] = self.hooks[obj][method]
|
||||
self.hooks[obj][method] = nil
|
||||
registry[self][obj][method] = nil
|
||||
handlers[uid] = nil
|
||||
actives[uid] = nil
|
||||
else
|
||||
actives[uid] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.hooks[obj] and not next(self.hooks[obj]) then
|
||||
self.hooks[obj] = del(self.hooks[obj])
|
||||
end
|
||||
if not next(registry[self][obj]) then
|
||||
registry[self][obj] = del(registry[self][obj])
|
||||
end
|
||||
end
|
||||
|
||||
-- ("function" [, handler] [, hookSecure]) or (object, "method" [, handler] [, hookSecure])
|
||||
function AceHook:Hook(object, method, handler, hookSecure)
|
||||
if type(object) == "string" then
|
||||
method, handler, hookSecure = object, method, handler
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
if not hookSecure and issecurevariable(method) then
|
||||
AceHook:error("Attempt to hook secure function %q. Use `SecureHook' or add `true' to the argument list to override.", method)
|
||||
end
|
||||
AceHook:argCheck(handler, 3, "function", "string", "nil")
|
||||
AceHook:argCheck(hookSecure, 4, "boolean", "nil")
|
||||
hookFunction(self, method, handler, false)
|
||||
else
|
||||
if handler == true then
|
||||
handler, hookSecure = nil, true
|
||||
end
|
||||
if not hookSecure and issecurevariable(object, method) then
|
||||
AceHook:error("Attempt to hook secure method %q. Use `SecureHook' or add `true' to the argument list to override.", method)
|
||||
end
|
||||
AceHook:argCheck(object, 2, "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
AceHook:argCheck(hookSecure, 5, "boolean", "nil")
|
||||
hookMethod(self, object, method, handler, false, false)
|
||||
end
|
||||
end
|
||||
|
||||
-- ("function", handler) or (object, "method", handler)
|
||||
function AceHook:SecureHook(object, method, handler)
|
||||
if type(object) == "string" then
|
||||
method, handler = object, method
|
||||
AceHook:argCheck(handler, 3, "function", "string", "nil")
|
||||
hookFunction(self, method, handler, true)
|
||||
else
|
||||
AceHook:argCheck(object, 2, "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
hookMethod(self, object, method, handler, false, true)
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:HookScript(frame, script, handler)
|
||||
AceHook:argCheck(frame, 2, "table")
|
||||
if not frame[0] or type(frame.IsFrameType) ~= "function" then
|
||||
AceHook:error("Bad argument #2 to `HookScript'. Expected frame.")
|
||||
end
|
||||
AceHook:argCheck(script, 3, "string")
|
||||
AceHook:argCheck(handler, 4, "function", "string", "nil")
|
||||
hookMethod(self, frame, script, handler, true, false)
|
||||
end
|
||||
|
||||
-- ("function") or (object, "method")
|
||||
function AceHook:IsHooked(obj, method)
|
||||
if type(obj) == "string" then
|
||||
if registry[self][obj] and actives[registry[self][obj]] then
|
||||
return true, handlers[registry[self][obj]]
|
||||
end
|
||||
else
|
||||
AceHook:argCheck(obj, 2, "string", "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
if registry[self][obj] and registry[self][obj][method] and actives[registry[self][obj][method]] then
|
||||
return true, handlers[registry[self][obj][method]]
|
||||
end
|
||||
end
|
||||
|
||||
return false, nil
|
||||
end
|
||||
|
||||
-- ("function") or (object, "method")
|
||||
function AceHook:Unhook(obj, method)
|
||||
if type(obj) == "string" then
|
||||
unhookFunction(self, obj)
|
||||
else
|
||||
AceHook:argCheck(obj, 2, "string", "table")
|
||||
AceHook:argCheck(method, 3, "string")
|
||||
unhookMethod(self, obj, method)
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:UnhookAll()
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(key) == "table" then
|
||||
for method in pairs(value) do
|
||||
self:Unhook(key, method)
|
||||
end
|
||||
else
|
||||
self:Unhook(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:HookReport()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("This is a list of all active hooks for this object:")
|
||||
if not next(registry[self]) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("No hooks")
|
||||
end
|
||||
|
||||
for key, value in pairs(registry[self]) do
|
||||
if type(value) == "table" then
|
||||
for method, uid in pairs(value) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("object: %s method: %q |cff%s|r%s", tostring(key), method, actives[uid] and "00ff00Active" or "ffff00Inactive", not self.hooks[key][method] and " |cff7f7fff-Secure-|r" or ""))
|
||||
end
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("function: %q |cff%s|r%s", tostring(key), actives[value] and "00ff00Active" or "ffff00Inactive", not self.hooks[key] and " |cff7f7fff-Secure-|r" or ""))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceHook:OnInstanceInit(object)
|
||||
if not object.hooks then
|
||||
object.hooks = new()
|
||||
end
|
||||
if not registry[object] then
|
||||
registry[object] = new()
|
||||
end
|
||||
end
|
||||
|
||||
AceHook.OnManualEmbed = AceHook.OnInstanceInit
|
||||
|
||||
function AceHook:OnEmbedDisable(target)
|
||||
self.UnhookAll(target)
|
||||
end
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceHook = self
|
||||
|
||||
self.handlers = oldLib and oldLib.handlers or {}
|
||||
self.registry = oldLib and oldLib.registry or {}
|
||||
self.scripts = oldLib and oldLib.scripts or {}
|
||||
self.actives = oldLib and oldLib.actives or {}
|
||||
|
||||
handlers = self.handlers
|
||||
registry = self.registry
|
||||
scripts = self.scripts
|
||||
actives = self.actives
|
||||
|
||||
AceHook.super.activate(self, oldLib, oldDeactivate)
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceHook, MAJOR_VERSION, MINOR_VERSION, activate)
|
||||
Executable
+751
@@ -0,0 +1,751 @@
|
||||
--[[
|
||||
Name: AceLibrary
|
||||
Revision: $Rev: 17722 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Iriel (iriel@vigilance-committee.org)
|
||||
Tekkub (tekkub@gmail.com)
|
||||
Revision: $Rev: 17722 $
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceLibrary
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLibrary
|
||||
Description: Versioning library to handle other library instances, upgrading,
|
||||
and proper access.
|
||||
It also provides a base for libraries to work off of, providing
|
||||
proper error tools. It is handy because all the errors occur in the
|
||||
file that called it, not in the library file itself.
|
||||
Dependencies: None
|
||||
]]
|
||||
|
||||
local ACELIBRARY_MAJOR = "AceLibrary"
|
||||
local ACELIBRARY_MINOR = "$Revision: 17723 $"
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary and AceLibrary:HasInstance(ACELIBRARY_MAJOR) then return end -- lua51 check
|
||||
|
||||
local _G = getfenv(0)
|
||||
local previous = _G[ACELIBRARY_MAJOR]
|
||||
if previous and not previous:IsNewVersion(ACELIBRARY_MAJOR, ACELIBRARY_MINOR) then return end
|
||||
|
||||
local function donothing() end
|
||||
|
||||
local table_setn = string.find(GetBuildInfo(), "^2%.") and donothing or table.setn
|
||||
|
||||
local string_gfind = string.gmatch or string.gfind
|
||||
|
||||
-- The a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 are used here instead of ... (vararg)
|
||||
-- It seems ugly but in Lua 5.1, Vararg functions create a table `arg' each
|
||||
-- time the function is called
|
||||
local function safecall(func,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
local success, err = pcall(func,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
if not success then geterrorhandler()(err) end
|
||||
end
|
||||
|
||||
-- @function destroyTable
|
||||
-- @brief remove all the contents of a table
|
||||
-- @param t table to destroy
|
||||
local function destroyTable(t)
|
||||
setmetatable(t, nil)
|
||||
for k,v in pairs(t) do t[k] = nil end
|
||||
table_setn(t, 0)
|
||||
end
|
||||
|
||||
-- @table AceLibrary
|
||||
-- @brief System to handle all versioning of libraries.
|
||||
local AceLibrary = {}
|
||||
local AceLibrary_mt = {}
|
||||
setmetatable(AceLibrary, AceLibrary_mt)
|
||||
|
||||
local error
|
||||
do
|
||||
local tmp = {}
|
||||
function error(self, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if type(self) ~= "table" then
|
||||
_G.error(string.format("Bad argument #1 to `error' (table expected, got %s)", type(self)), 2)
|
||||
end
|
||||
|
||||
local stack = debugstack()
|
||||
if not message then
|
||||
local _,_,second = string.find(stack, "\n(.-)\n")
|
||||
message = "error raised! " .. second
|
||||
else
|
||||
destroyTable(tmp)
|
||||
table.insert(tmp, a1)
|
||||
table.insert(tmp, a2)
|
||||
table.insert(tmp, a3)
|
||||
table.insert(tmp, a4)
|
||||
table.insert(tmp, a5)
|
||||
table.insert(tmp, a6)
|
||||
table.insert(tmp, a7)
|
||||
table.insert(tmp, a8)
|
||||
table.insert(tmp, a9)
|
||||
table.insert(tmp, a10)
|
||||
table.insert(tmp, a11)
|
||||
table.insert(tmp, a12)
|
||||
table.insert(tmp, a13)
|
||||
table.insert(tmp, a14)
|
||||
table.insert(tmp, a15)
|
||||
table.insert(tmp, a16)
|
||||
table.insert(tmp, a17)
|
||||
table.insert(tmp, a18)
|
||||
table.insert(tmp, a19)
|
||||
table.insert(tmp, a20)
|
||||
for i = 1,table.getn(tmp) do
|
||||
tmp[i] = tostring(tmp[i])
|
||||
end
|
||||
for i = 1,10 do
|
||||
table.insert(tmp, "nil")
|
||||
end
|
||||
message = string.format(message, unpack(tmp))
|
||||
end
|
||||
|
||||
if getmetatable(self) and getmetatable(self).__tostring then
|
||||
message = string.format("%s: %s", tostring(self), message)
|
||||
elseif type(rawget(self, 'GetLibraryVersion')) == "function" and AceLibrary:HasInstance(self:GetLibraryVersion()) then
|
||||
message = string.format("%s: %s", self:GetLibraryVersion(), message)
|
||||
elseif type(rawget(self, 'class')) == "table" and type(rawget(self.class, 'GetLibraryVersion')) == "function" and AceLibrary:HasInstance(self.class:GetLibraryVersion()) then
|
||||
message = string.format("%s: %s", self.class:GetLibraryVersion(), message)
|
||||
end
|
||||
|
||||
local first = string.gsub(stack, "\n.*", "")
|
||||
local file = string.gsub(first, ".*\\(.*).lua:%d+: .*", "%1")
|
||||
file = string.gsub(file, "([%(%)%.%*%+%-%[%]%?%^%$%%])", "%%%1")
|
||||
|
||||
local i = 0
|
||||
for s in string_gfind(stack, "\n([^\n]*)") do
|
||||
i = i + 1
|
||||
if not string.find(s, file .. "%.lua:%d+:") then
|
||||
file = string.gsub(s, "^.*\\(.*).lua:%d+: .*", "%1")
|
||||
file = string.gsub(file, "([%(%)%.%*%+%-%[%]%?%^%$%%])", "%%%1")
|
||||
break
|
||||
end
|
||||
end
|
||||
local j = 0
|
||||
for s in string_gfind(stack, "\n([^\n]*)") do
|
||||
j = j + 1
|
||||
if j > i and not string.find(s, file .. "%.lua:%d+:") then
|
||||
_G.error(message, j + 1)
|
||||
return
|
||||
end
|
||||
end
|
||||
_G.error(message, 2)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local function assert(self, condition, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not condition then
|
||||
if not message then
|
||||
local stack = debugstack()
|
||||
local _,_,second = string.find(stack, "\n(.-)\n")
|
||||
message = "assertion failed! " .. second
|
||||
end
|
||||
error(self, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
return
|
||||
end
|
||||
return condition
|
||||
end
|
||||
|
||||
local function argCheck(self, arg, num, kind, kind2, kind3, kind4, kind5)
|
||||
if type(num) ~= "number" then
|
||||
error(self, "Bad argument #3 to `argCheck' (number expected, got %s)", type(num))
|
||||
elseif type(kind) ~= "string" then
|
||||
error(self, "Bad argument #4 to `argCheck' (string expected, got %s)", type(kind))
|
||||
end
|
||||
local errored = false
|
||||
arg = type(arg)
|
||||
if arg ~= kind and arg ~= kind2 and arg ~= kind3 and arg ~= kind4 and arg ~= kind5 then
|
||||
local _,_,func = string.find(debugstack(), "`argCheck'.-([`<].-['>])")
|
||||
if not func then
|
||||
_,_,func = string.find(debugstack(), "([`<].-['>])")
|
||||
end
|
||||
if kind5 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, %s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, kind4, kind5, arg)
|
||||
elseif kind4 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, kind4, arg)
|
||||
elseif kind3 then
|
||||
error(self, "Bad argument #%s to %s (%s, %s, or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, kind3, arg)
|
||||
elseif kind2 then
|
||||
error(self, "Bad argument #%s to %s (%s or %s expected, got %s)", tonumber(num) or 0/0, func, kind, kind2, arg)
|
||||
else
|
||||
error(self, "Bad argument #%s to %s (%s expected, got %s)", tonumber(num) or 0/0, func, kind, arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pcall(self, func, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20 = _G.pcall(func, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not a1 then
|
||||
error(self, string.gsub(a2, ".-%.lua:%d-: ", ""))
|
||||
else
|
||||
return a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20
|
||||
end
|
||||
end
|
||||
|
||||
local addToPositions
|
||||
do
|
||||
local recurse = {}
|
||||
function addToPositions(t, major)
|
||||
if not AceLibrary.positions[t] or AceLibrary.positions[t] == major then
|
||||
rawset(t, recurse, true)
|
||||
AceLibrary.positions[t] = major
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" and not rawget(v, recurse) then
|
||||
addToPositions(v, major)
|
||||
end
|
||||
if type(k) == "table" and not rawget(k, recurse) then
|
||||
addToPositions(k, major)
|
||||
end
|
||||
end
|
||||
local mt = getmetatable(t)
|
||||
if mt and not rawget(mt, recurse) then
|
||||
addToPositions(mt, major)
|
||||
end
|
||||
rawset(t, recurse, nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function svnRevisionToNumber(text)
|
||||
if type(text) == "string" then
|
||||
if string.find(text, "^%$Revision: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$Revision: (%d+) %$$", "%1")))
|
||||
elseif string.find(text, "^%$Rev: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$Rev: (%d+) %$$", "%1")))
|
||||
elseif string.find(text, "^%$LastChangedRevision: (%d+) %$$") then
|
||||
return tonumber((string.gsub(text, "^%$LastChangedRevision: (%d+) %$$", "%1")))
|
||||
end
|
||||
elseif type(text) == "number" then
|
||||
return text
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- @function crawlReplace
|
||||
-- @brief replace all keys/values of one value to another
|
||||
-- @param t table to modify
|
||||
-- @param to the value to replace
|
||||
-- @param from the value to be replaced
|
||||
-- @example crawlReplace({a="b",b="c"}, "d", "b") => {a="d",d="c"}
|
||||
local crawlReplace
|
||||
do
|
||||
local recurse = {}
|
||||
local function func(t, to, from)
|
||||
recurse[t] = true
|
||||
local mt = getmetatable(t)
|
||||
setmetatable(t, nil)
|
||||
rawset(t, to, rawget(t, from))
|
||||
rawset(t, from, nil)
|
||||
for k,v in pairs(t) do
|
||||
if v == from then
|
||||
t[k] = to
|
||||
elseif type(v) == "table" then
|
||||
if not recurse[v] then
|
||||
func(v, to, from)
|
||||
end
|
||||
end
|
||||
|
||||
if type(k) == "table" then
|
||||
if not recurse[k] then
|
||||
func(k, to, from)
|
||||
end
|
||||
end
|
||||
end
|
||||
setmetatable(t, mt)
|
||||
if mt then
|
||||
if mt == from then
|
||||
setmetatable(t, to)
|
||||
elseif not recurse[mt] then
|
||||
func(mt, to, from)
|
||||
end
|
||||
end
|
||||
end
|
||||
function crawlReplace(t, to, from)
|
||||
destroyTable(recurse)
|
||||
func(t, to, from)
|
||||
end
|
||||
end
|
||||
|
||||
local function isFrame(frame)
|
||||
return type(frame) == "table" and type(rawget(frame, 0)) == "userdata" and type(rawget(frame, 'IsFrameType')) == "function" and getmetatable(frame) and type(rawget(getmetatable(frame), '__index')) == "function"
|
||||
end
|
||||
|
||||
-- operator new/del with memory management
|
||||
local new, del
|
||||
do
|
||||
-- this table contains the created tables which are not in use
|
||||
local tables = setmetatable({}, {__mode = "k"})
|
||||
|
||||
function new()
|
||||
local t = next(tables)
|
||||
if t then
|
||||
tables[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
-- recursively destruct the table
|
||||
function del(t, depth)
|
||||
if depth and depth > 0 then
|
||||
for k,v in pairs(t) do
|
||||
if type(v) == "table" and not isFrame(v) then
|
||||
del(v, depth - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
destroyTable(t)
|
||||
tables[t] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- @function copyTable
|
||||
-- @brief Create a shallow copy of a table and return it.
|
||||
-- @param from The table to copy from
|
||||
-- @return A shallow copy of the table
|
||||
local function copyTable(from)
|
||||
local to = new()
|
||||
for k,v in pairs(from) do to[k] = v end
|
||||
table_setn(to, table.getn(from))
|
||||
setmetatable(to, getmetatable(from))
|
||||
return to
|
||||
end
|
||||
|
||||
-- @function deepTransfer
|
||||
-- @brief Fully transfer all data, keeping proper previous table
|
||||
-- backreferences stable.
|
||||
-- @param to The table with which data is to be injected into
|
||||
-- @param from The table whose data will be injected into the first
|
||||
-- @param saveFields If available, a shallow copy of the basic data is saved
|
||||
-- in here.
|
||||
-- @param list The account of table references
|
||||
-- @param list2 The current status on which tables have been traversed.
|
||||
local deepTransfer
|
||||
do
|
||||
-- @function examine
|
||||
-- @brief Take account of all the table references to be shared
|
||||
-- between the to and from tables.
|
||||
-- @param to The table with which data is to be injected into
|
||||
-- @param from The table whose data will be injected into the first
|
||||
-- @param list An account of the table references
|
||||
local function examine(to, from, list, major)
|
||||
list[from] = to
|
||||
for k,v in pairs(from) do
|
||||
if rawget(to, k) and type(from[k]) == "table" and type(to[k]) == "table" and not list[from[k]] then
|
||||
if from[k] == to[k] then
|
||||
list[from[k]] = to[k]
|
||||
elseif AceLibrary.positions[from[v]] ~= major and AceLibrary.positions[from[v]] then
|
||||
list[from[k]] = from[k]
|
||||
elseif not list[from[k]] then
|
||||
examine(to[k], from[k], list, major)
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function deepTransfer(to, from, saveFields, major, list, list2)
|
||||
setmetatable(to, nil)
|
||||
local createdList
|
||||
if not list then
|
||||
createdList = true
|
||||
list = new()
|
||||
list2 = new()
|
||||
examine(to, from, list, major)
|
||||
end
|
||||
list2[to] = to
|
||||
for k,v in pairs(to) do
|
||||
if type(rawget(from, k)) ~= "table" or type(v) ~= "table" or isFrame(v) then
|
||||
if saveFields then
|
||||
saveFields[k] = v
|
||||
end
|
||||
to[k] = nil
|
||||
elseif v ~= _G then
|
||||
if saveFields then
|
||||
saveFields[k] = copyTable(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
for k in pairs(from) do
|
||||
if rawget(to, k) and to[k] ~= from[k] and AceLibrary.positions[to[k]] == major and from[k] ~= _G then
|
||||
if not list2[to[k]] then
|
||||
deepTransfer(to[k], from[k], nil, major, list, list2)
|
||||
end
|
||||
to[k] = list[to[k]] or list2[to[k]]
|
||||
else
|
||||
rawset(to, k, from[k])
|
||||
end
|
||||
end
|
||||
table_setn(to, table.getn(from))
|
||||
setmetatable(to, getmetatable(from))
|
||||
local mt = getmetatable(to)
|
||||
if mt then
|
||||
if list[mt] then
|
||||
setmetatable(to, list[mt])
|
||||
elseif mt.__index and list[mt.__index] then
|
||||
mt.__index = list[mt.__index]
|
||||
end
|
||||
end
|
||||
destroyTable(from)
|
||||
if createdList then
|
||||
del(list)
|
||||
del(list2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- @method TryToLoadStandalone
|
||||
-- @brief Attempt to find and load a standalone version of the requested library
|
||||
-- @param major A string representing the major version
|
||||
-- @return If library is found, return values from the call to LoadAddOn are returned
|
||||
-- If the library has been requested previously, nil is returned.
|
||||
local function TryToLoadStandalone(major)
|
||||
if not AceLibrary.scannedlibs then AceLibrary.scannedlibs = {} end
|
||||
if AceLibrary.scannedlibs[major] then return end
|
||||
|
||||
AceLibrary.scannedlibs[major] = true
|
||||
|
||||
local name, _, _, enabled, loadable = GetAddOnInfo(major)
|
||||
if loadable then
|
||||
return LoadAddOn(name)
|
||||
end
|
||||
|
||||
for i=1,GetNumAddOns() do
|
||||
if GetAddOnMetadata(i, "X-AceLibrary-"..major) then
|
||||
local name, _, _, enabled, loadable = GetAddOnInfo(i)
|
||||
if loadable then
|
||||
return LoadAddOn(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function minorCheck(minor, func)
|
||||
if type(minor) == "string" then
|
||||
local m = svnRevisionToNumber(minor)
|
||||
if m then
|
||||
return m
|
||||
else
|
||||
_G.error(string.format("Bad argument #3 to `%s'. Must be a number or SVN revision string. %q is not appropriate", func, minor), 3)
|
||||
end
|
||||
else
|
||||
return minor
|
||||
end
|
||||
end
|
||||
|
||||
-- @method IsNewVersion
|
||||
-- @brief Obtain whether the supplied version would be an upgrade to the
|
||||
-- current version. This allows for bypass code in library
|
||||
-- declaration.
|
||||
-- @param major A string representing the major version
|
||||
-- @param minor An integer or an svn revision string representing the minor version
|
||||
-- @return whether the supplied version would be newer than what is
|
||||
-- currently available.
|
||||
function AceLibrary:IsNewVersion(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
minor = minorCheck(minor, "IsNewVersion")
|
||||
argCheck(self, minor, 3, "number")
|
||||
local data = self.libs[major]
|
||||
if not data then
|
||||
return true
|
||||
end
|
||||
return data.minor < minor
|
||||
end
|
||||
|
||||
-- @method HasInstance
|
||||
-- @brief Returns whether an instance exists. This allows for optional support of a library.
|
||||
-- @param major A string representing the major version.
|
||||
-- @param minor (optional) An integer or an svn revision string representing the minor version.
|
||||
-- @return Whether an instance exists.
|
||||
function AceLibrary:HasInstance(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
|
||||
if minor then
|
||||
minor = minorCheck(minor, "HasInstance")
|
||||
argCheck(self, minor, 3, "number")
|
||||
if not self.libs[major] then
|
||||
return
|
||||
end
|
||||
return self.libs[major].minor == minor
|
||||
end
|
||||
return self.libs[major] and true
|
||||
end
|
||||
|
||||
-- @method GetInstance
|
||||
-- @brief Returns the library with the given major/minor version.
|
||||
-- @param major A string representing the major version.
|
||||
-- @param minor (optional) An integer or an svn revision string representing the minor version.
|
||||
-- @return The library with the given major/minor version.
|
||||
function AceLibrary:GetInstance(major, minor)
|
||||
argCheck(self, major, 2, "string")
|
||||
TryToLoadStandalone(major)
|
||||
|
||||
local data = self.libs[major]
|
||||
if not data then
|
||||
_G.error(string.format("Cannot find a library instance of %s.", major), 2)
|
||||
return
|
||||
end
|
||||
if minor then
|
||||
minor = minorCheck(minor, "GetInstance")
|
||||
argCheck(self, minor, 2, "number")
|
||||
if data.minor ~= minor then
|
||||
_G.error(string.format("Cannot find a library instance of %s, minor version %d.", major, minor), 2)
|
||||
return
|
||||
end
|
||||
end
|
||||
return data.instance
|
||||
end
|
||||
|
||||
-- Syntax sugar. AceLibrary("FooBar-1.0")
|
||||
AceLibrary_mt.__call = AceLibrary.GetInstance
|
||||
|
||||
local AceEvent
|
||||
|
||||
-- @method Register
|
||||
-- @brief Registers a new version of a given library.
|
||||
-- @param newInstance the library to register
|
||||
-- @param major the major version of the library
|
||||
-- @param minor the minor version of the library
|
||||
-- @param activateFunc (optional) A function to be called when the library is
|
||||
-- fully activated. Takes the arguments
|
||||
-- (newInstance [, oldInstance, oldDeactivateFunc]). If
|
||||
-- oldInstance is given, you should probably call
|
||||
-- oldDeactivateFunc(oldInstance).
|
||||
-- @param deactivateFunc (optional) A function to be called by a newer library's
|
||||
-- activateFunc.
|
||||
-- Take the arguments
|
||||
-- (oldInstance)
|
||||
-- @param externalFunc (optional) A function to be called whenever a new
|
||||
-- library is registered.
|
||||
-- Takes the arguments
|
||||
-- (instance, otherInstanceName, otherInstance)
|
||||
-- This function will be called on two sides between the new
|
||||
-- library and old ones
|
||||
function AceLibrary:Register(newInstance, major, minor, activateFunc, deactivateFunc, externalFunc)
|
||||
argCheck(self, newInstance, 2, "table")
|
||||
argCheck(self, major, 3, "string")
|
||||
if type(minor) == "string" then
|
||||
minor = minorCheck(minor, "Register")
|
||||
end
|
||||
argCheck(self, minor, 4, "number")
|
||||
if math.floor(minor) ~= minor or minor < 0 then
|
||||
error(self, "Bad argument #4 to `Register' (integer >= 0 expected, got %s)", minor)
|
||||
end
|
||||
argCheck(self, activateFunc, 5, "function", "nil")
|
||||
argCheck(self, deactivateFunc, 6, "function", "nil")
|
||||
argCheck(self, externalFunc, 7, "function", "nil")
|
||||
if not deactivateFunc then
|
||||
deactivateFunc = donothing
|
||||
end
|
||||
local data = self.libs[major]
|
||||
local isAceLibrary = (AceLibrary == newInstance)
|
||||
|
||||
if not data then
|
||||
-- This is new
|
||||
local instance = copyTable(newInstance)
|
||||
crawlReplace(instance, instance, newInstance)
|
||||
destroyTable(newInstance)
|
||||
if isAceLibrary then
|
||||
self = instance
|
||||
AceLibrary = instance
|
||||
end
|
||||
self.libs[major] = {
|
||||
instance = instance,
|
||||
minor = minor,
|
||||
deactivateFunc = deactivateFunc,
|
||||
externalFunc = externalFunc,
|
||||
}
|
||||
rawset(instance, 'GetLibraryVersion', function(self)
|
||||
return major, minor
|
||||
end)
|
||||
if not rawget(instance, 'error') then
|
||||
rawset(instance, 'error', error)
|
||||
end
|
||||
if not rawget(instance, 'assert') then
|
||||
rawset(instance, 'assert', assert)
|
||||
end
|
||||
if not rawget(instance, 'argCheck') then
|
||||
rawset(instance, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(instance, 'pcall') then
|
||||
rawset(instance, 'pcall', pcall)
|
||||
end
|
||||
addToPositions(instance, major)
|
||||
if activateFunc then
|
||||
safecall(activateFunc, instance, nil, nil) -- no old version, so explicit nil
|
||||
end
|
||||
|
||||
if externalFunc then
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major then
|
||||
safecall(externalFunc, instance, k, data.instance)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major and data.externalFunc then
|
||||
safecall(data.externalFunc, data.instance, major, instance)
|
||||
end
|
||||
end
|
||||
if major == "AceEvent-2.0" then
|
||||
AceEvent = instance
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent.TriggerEvent(self, "AceLibrary_Register", major, instance)
|
||||
end
|
||||
|
||||
return instance
|
||||
end
|
||||
local instance = data.instance
|
||||
if minor <= data.minor then
|
||||
-- This one is already obsolete, raise an error.
|
||||
_G.error(string.format("Obsolete library registered. %s is already registered at version %d. You are trying to register version %d. Hint: if not AceLibrary:IsNewVersion(%q, %d) then return end", major, data.minor, minor, major, minor), 2)
|
||||
return
|
||||
end
|
||||
-- This is an update
|
||||
local oldInstance = new()
|
||||
|
||||
addToPositions(newInstance, major)
|
||||
|
||||
local old_error, old_assert, old_argCheck, old_pcall
|
||||
if isAceLibrary then
|
||||
self = instance
|
||||
AceLibrary = instance
|
||||
|
||||
old_error = instance.error
|
||||
old_assert = instance.assert
|
||||
old_argCheck = instance.argCheck
|
||||
old_pcall = instance.pcall
|
||||
|
||||
self.error = error
|
||||
self.assert = assert
|
||||
self.argCheck = argCheck
|
||||
self.pcall = pcall
|
||||
end
|
||||
deepTransfer(instance, newInstance, oldInstance, major)
|
||||
crawlReplace(instance, instance, newInstance)
|
||||
local oldDeactivateFunc = data.deactivateFunc
|
||||
data.minor = minor
|
||||
data.deactivateFunc = deactivateFunc
|
||||
data.externalFunc = externalFunc
|
||||
rawset(instance, 'GetLibraryVersion', function(self)
|
||||
return major, minor
|
||||
end)
|
||||
if not rawget(instance, 'error') then
|
||||
rawset(instance, 'error', error)
|
||||
end
|
||||
if not rawget(instance, 'assert') then
|
||||
rawset(instance, 'assert', assert)
|
||||
end
|
||||
if not rawget(instance, 'argCheck') then
|
||||
rawset(instance, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(instance, 'pcall') then
|
||||
rawset(instance, 'pcall', pcall)
|
||||
end
|
||||
if isAceLibrary then
|
||||
for _,v in pairs(self.libs) do
|
||||
local i = type(v) == "table" and v.instance
|
||||
if type(i) == "table" then
|
||||
if not rawget(i, 'error') or i.error == old_error then
|
||||
rawset(i, 'error', error)
|
||||
end
|
||||
if not rawget(i, 'assert') or i.assert == old_assert then
|
||||
rawset(i, 'assert', assert)
|
||||
end
|
||||
if not rawget(i, 'argCheck') or i.argCheck == old_argCheck then
|
||||
rawset(i, 'argCheck', argCheck)
|
||||
end
|
||||
if not rawget(i, 'pcall') or i.pcall == old_pcall then
|
||||
rawset(i, 'pcall', pcall)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if activateFunc then
|
||||
safecall(activateFunc, instance, oldInstance, oldDeactivateFunc)
|
||||
else
|
||||
safecall(oldDeactivateFunc, oldInstance)
|
||||
end
|
||||
del(oldInstance)
|
||||
|
||||
if externalFunc then
|
||||
for k,data in pairs(self.libs) do
|
||||
if k ~= major then
|
||||
safecall(externalFunc, instance, k, data.instance)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
do
|
||||
local function iter(t, k)
|
||||
k = next(t, k)
|
||||
if not k then
|
||||
return nil
|
||||
else
|
||||
return k, t[k].instance
|
||||
end
|
||||
end
|
||||
|
||||
-- Example
|
||||
-- for major, instance in AceLibrary:IterateLibraries() do
|
||||
-- ...
|
||||
-- end
|
||||
function AceLibrary:IterateLibraries()
|
||||
return iter, self.libs, nil
|
||||
end
|
||||
end
|
||||
|
||||
-- @function Activate
|
||||
-- @brief The activateFunc for AceLibrary itself. Called when
|
||||
-- AceLibrary properly registers.
|
||||
-- @param self Reference to AceLibrary
|
||||
-- @param oldLib (optional) Reference to an old version of AceLibrary
|
||||
-- @param oldDeactivate (optional) Function to deactivate the old lib
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
if not self.libs then
|
||||
if oldLib then
|
||||
self.libs = oldLib.libs
|
||||
self.scannedlibs = oldLib.scannedlibs
|
||||
end
|
||||
if not self.libs then
|
||||
self.libs = {}
|
||||
end
|
||||
if not self.scannedlibs then
|
||||
self.scannedlibs = {}
|
||||
end
|
||||
end
|
||||
if not self.positions then
|
||||
if oldLib then
|
||||
self.positions = oldLib.positions
|
||||
end
|
||||
if not self.positions then
|
||||
self.positions = setmetatable({}, { __mode = "k" })
|
||||
end
|
||||
end
|
||||
|
||||
-- Expose the library in the global environment
|
||||
_G[ACELIBRARY_MAJOR] = self
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
if not previous then
|
||||
previous = AceLibrary
|
||||
end
|
||||
if not previous.libs then
|
||||
previous.libs = {}
|
||||
end
|
||||
AceLibrary.libs = previous.libs
|
||||
if not previous.positions then
|
||||
previous.positions = setmetatable({}, { __mode = "k" })
|
||||
end
|
||||
AceLibrary.positions = previous.positions
|
||||
AceLibrary:Register(AceLibrary, ACELIBRARY_MAJOR, ACELIBRARY_MINOR, activate)
|
||||
Executable
+538
@@ -0,0 +1,538 @@
|
||||
--[[
|
||||
Name: AceLocale-2.2
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceLocale-2.2
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceLocale-2.2
|
||||
Description: Localization library for addons to use to handle proper
|
||||
localization and internationalization.
|
||||
Dependencies: AceLibrary
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceLocale-2.2"
|
||||
local MINOR_VERSION = "$Revision: 17638 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
local AceLocale = {}
|
||||
|
||||
local DEFAULT_LOCALE = "enUS"
|
||||
local _G = getfenv(0)
|
||||
|
||||
local BASE_TRANSLATIONS, DEBUGGING, TRANSLATIONS, BASE_LOCALE, TRANSLATION_TABLES, REVERSE_TRANSLATIONS, STRICTNESS, DYNAMIC_LOCALES, CURRENT_LOCALE, NAME
|
||||
|
||||
local rawget = rawget
|
||||
local rawset = rawset
|
||||
local type = type
|
||||
|
||||
local newRegistries = {}
|
||||
local scheduleClear
|
||||
|
||||
local lastSelf
|
||||
local __index = function(self, key)
|
||||
lastSelf = self
|
||||
local value = (rawget(self, TRANSLATIONS) or AceLocale.prototype)[key]
|
||||
rawset(self, key, value)
|
||||
return value
|
||||
end
|
||||
|
||||
local __newindex = function(self, k, v)
|
||||
if type(v) ~= "function" and type(k) ~= "table" then
|
||||
AceLocale.error(self, "Cannot change the values of an AceLocale instance.")
|
||||
end
|
||||
rawset(self, k, v)
|
||||
end
|
||||
|
||||
local __tostring = function(self)
|
||||
if type(rawget(self, 'GetLibraryVersion')) == "function" then
|
||||
return self:GetLibraryVersion()
|
||||
else
|
||||
return "AceLocale(" .. self[NAME] .. ")"
|
||||
end
|
||||
end
|
||||
|
||||
local function clearCache(self)
|
||||
if not rawget(self, BASE_TRANSLATIONS) then
|
||||
return
|
||||
end
|
||||
|
||||
local cache = self[BASE_TRANSLATIONS]
|
||||
rawset(self, REVERSE_TRANSLATIONS, nil)
|
||||
|
||||
for k in pairs(self) do
|
||||
if rawget(cache, k) ~= nil then
|
||||
self[k] = nil
|
||||
end
|
||||
end
|
||||
rawset(self, 'tmp', true)
|
||||
self.tmp = nil
|
||||
end
|
||||
|
||||
local function refixInstance(instance)
|
||||
if getmetatable(instance) then
|
||||
setmetatable(instance, nil)
|
||||
end
|
||||
local translations = instance[TRANSLATIONS]
|
||||
if translations then
|
||||
if getmetatable(translations) then
|
||||
setmetatable(translations, nil)
|
||||
end
|
||||
local baseTranslations = instance[BASE_TRANSLATIONS]
|
||||
if getmetatable(baseTranslations) then
|
||||
setmetatable(baseTranslations, nil)
|
||||
end
|
||||
if translations == baseTranslations or instance[STRICTNESS] then
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring
|
||||
})
|
||||
|
||||
setmetatable(translations, {
|
||||
__index = AceLocale.prototype
|
||||
})
|
||||
else
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring
|
||||
})
|
||||
|
||||
setmetatable(translations, {
|
||||
__index = baseTranslations,
|
||||
})
|
||||
|
||||
setmetatable(baseTranslations, {
|
||||
__index = AceLocale.prototype,
|
||||
})
|
||||
end
|
||||
else
|
||||
setmetatable(instance, {
|
||||
__index = __index,
|
||||
__newindex = __newindex,
|
||||
__tostring = __tostring,
|
||||
})
|
||||
end
|
||||
clearCache(instance)
|
||||
newRegistries[instance] = true
|
||||
scheduleClear()
|
||||
return instance
|
||||
end
|
||||
|
||||
function AceLocale:new(name)
|
||||
self:argCheck(name, 2, "string")
|
||||
|
||||
if self.registry[name] and type(rawget(self.registry[name], 'GetLibraryVersion')) ~= "function" then
|
||||
return self.registry[name]
|
||||
end
|
||||
|
||||
AceLocale.registry[name] = refixInstance({
|
||||
[STRICTNESS] = false,
|
||||
[NAME] = name,
|
||||
})
|
||||
newRegistries[AceLocale.registry[name]] = true
|
||||
return AceLocale.registry[name]
|
||||
end
|
||||
|
||||
AceLocale.prototype = { class = AceLocale }
|
||||
|
||||
function AceLocale.prototype:EnableDebugging()
|
||||
if rawget(self, BASE_TRANSLATIONS) then
|
||||
AceLocale.error(self, "Cannot enable debugging after a translation has been registered.")
|
||||
end
|
||||
rawset(self, DEBUGGING, true)
|
||||
end
|
||||
|
||||
function AceLocale.prototype:EnableDynamicLocales(override)
|
||||
AceLocale.argCheck(self, override, 2, "boolean", "nil")
|
||||
if not override and rawget(self, BASE_TRANSLATIONS) then
|
||||
AceLocale.error(self, "Cannot enable dynamic locales after a translation has been registered.")
|
||||
end
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
rawset(self, DYNAMIC_LOCALES, true)
|
||||
if rawget(self, BASE_LOCALE) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
self[TRANSLATION_TABLES][self[BASE_LOCALE]] = self[BASE_TRANSLATIONS]
|
||||
self[TRANSLATION_TABLES][self[CURRENT_LOCALE]] = self[TRANSLATIONS]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceLocale.prototype:RegisterTranslations(locale, func)
|
||||
AceLocale.argCheck(self, locale, 2, "string")
|
||||
AceLocale.argCheck(self, func, 3, "function")
|
||||
|
||||
if locale == rawget(self, BASE_LOCALE) then
|
||||
AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
|
||||
end
|
||||
|
||||
if rawget(self, BASE_TRANSLATIONS) and GetLocale() ~= locale then
|
||||
if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
if self[TRANSLATION_TABLES][locale] then
|
||||
AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
|
||||
end
|
||||
local t = func()
|
||||
func = nil
|
||||
if type(t) ~= "table" then
|
||||
AceLocale.error(self, "Bad argument #3 to `RegisterTranslations'. function did not return a table. (expected table, got %s)", type(t))
|
||||
end
|
||||
self[TRANSLATION_TABLES][locale] = t
|
||||
t = nil
|
||||
end
|
||||
func = nil
|
||||
return
|
||||
end
|
||||
local t = func()
|
||||
func = nil
|
||||
if type(t) ~= "table" then
|
||||
AceLocale.error(self, "Bad argument #3 to `RegisterTranslations'. function did not return a table. (expected table, got %s)", type(t))
|
||||
end
|
||||
|
||||
rawset(self, TRANSLATIONS, t)
|
||||
if not rawget(self, BASE_TRANSLATIONS) then
|
||||
rawset(self, BASE_TRANSLATIONS, t)
|
||||
rawset(self, BASE_LOCALE, locale)
|
||||
for key,value in pairs(t) do
|
||||
if value == true then
|
||||
t[key] = key
|
||||
end
|
||||
end
|
||||
else
|
||||
for key, value in pairs(self[TRANSLATIONS]) do
|
||||
if not rawget(self[BASE_TRANSLATIONS], key) then
|
||||
AceLocale.error(self, "Improper translation exists. %q is likely misspelled for locale %s.", key, locale)
|
||||
end
|
||||
if value == true then
|
||||
AceLocale.error(self, "Can only accept true as a value on the base locale. %q is the base locale, %q is not.", rawget(self, BASE_LOCALE), locale)
|
||||
end
|
||||
end
|
||||
end
|
||||
rawset(self, CURRENT_LOCALE, locale)
|
||||
refixInstance(self)
|
||||
if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
rawset(self, TRANSLATION_TABLES, {})
|
||||
end
|
||||
self[TRANSLATION_TABLES][locale] = t
|
||||
end
|
||||
t = nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:SetLocale(locale)
|
||||
AceLocale.argCheck(self, locale, 2, "string", "boolean")
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `SetLocale' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `SetLocale' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
if locale == true then
|
||||
locale = GetLocale()
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
locale = self[BASE_LOCALE]
|
||||
end
|
||||
end
|
||||
|
||||
if self[CURRENT_LOCALE] == locale then
|
||||
return
|
||||
end
|
||||
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
AceLocale.error(self, "Locale %q not registered.", locale)
|
||||
end
|
||||
|
||||
self[TRANSLATIONS] = self[TRANSLATION_TABLES][locale]
|
||||
self[CURRENT_LOCALE] = locale
|
||||
refixInstance(self)
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetLocale()
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `GetLocale' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
return self[CURRENT_LOCALE]
|
||||
end
|
||||
|
||||
local function iter(t, position)
|
||||
return (next(t, position))
|
||||
end
|
||||
|
||||
function AceLocale.prototype:IterateAvailableLocales()
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
if not rawget(self, TRANSLATION_TABLES) then
|
||||
AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `RegisterTranslations'.")
|
||||
end
|
||||
return iter, self[TRANSLATION_TABLES], nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasLocale(locale)
|
||||
if not rawget(self, DYNAMIC_LOCALES) then
|
||||
AceLocale.error(self, "Cannot call `HasLocale' without first calling `EnableDynamicLocales'.")
|
||||
end
|
||||
AceLocale.argCheck(self, locale, 2, "string")
|
||||
return rawget(self, TRANSLATION_TABLES) and self[TRANSLATION_TABLES][locale] ~= nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:SetStrictness(strict)
|
||||
AceLocale.argCheck(self, strict, 2, "boolean")
|
||||
local mt = getmetatable(self)
|
||||
if not mt then
|
||||
AceLocale.error(self, "Cannot call `SetStrictness' without a metatable.")
|
||||
end
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered.")
|
||||
end
|
||||
rawset(self, STRICTNESS, strict)
|
||||
refixInstance(self)
|
||||
end
|
||||
|
||||
local function initReverse(self)
|
||||
rawset(self, REVERSE_TRANSLATIONS, {})
|
||||
local alpha = self[TRANSLATIONS]
|
||||
local bravo = self[REVERSE_TRANSLATIONS]
|
||||
for base, localized in pairs(alpha) do
|
||||
bravo[localized] = base
|
||||
end
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return self[text]
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetStrictTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
local value = rawget(x, text)
|
||||
if value == nil then
|
||||
AceLocale.error(self, "Translation %q does not exist for locale %s", text, self[CURRENT_LOCALE])
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetReverseTranslation(text)
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
local translation = x[text]
|
||||
if not translation then
|
||||
AceLocale.error(self, "Reverse translation for %q does not exist", text)
|
||||
end
|
||||
return translation
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetIterator()
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return next, x, nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:GetReverseIterator()
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
return next, x, nil
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasTranslation(text)
|
||||
AceLocale.argCheck(self, text, 1, "string", "number")
|
||||
local x = rawget(self, TRANSLATIONS)
|
||||
if not x then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
return rawget(x, text) and true
|
||||
end
|
||||
|
||||
function AceLocale.prototype:HasReverseTranslation(text)
|
||||
local x = rawget(self, REVERSE_TRANSLATIONS)
|
||||
if not x then
|
||||
if not rawget(self, TRANSLATIONS) then
|
||||
AceLocale.error(self, "No translations registered")
|
||||
end
|
||||
initReverse(self)
|
||||
x = self[REVERSE_TRANSLATIONS]
|
||||
end
|
||||
return x[text] and true
|
||||
end
|
||||
|
||||
function AceLocale.prototype:Debug()
|
||||
if not rawget(self, DEBUGGING) then
|
||||
return
|
||||
end
|
||||
local words = {}
|
||||
local locales = {"enUS", "ruRU", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES"}
|
||||
local localizations = {}
|
||||
DEFAULT_CHAT_FRAME:AddMessage("--- AceLocale Debug ---")
|
||||
for _,locale in ipairs(locales) do
|
||||
if not self[TRANSLATION_TABLES][locale] then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q not found", locale))
|
||||
else
|
||||
localizations[locale] = self[TRANSLATION_TABLES][locale]
|
||||
end
|
||||
end
|
||||
local localeDebug = {}
|
||||
for locale, localization in pairs(localizations) do
|
||||
localeDebug[locale] = {}
|
||||
for word in pairs(localization) do
|
||||
if type(localization[word]) == "table" then
|
||||
if type(words[word]) ~= "table" then
|
||||
words[word] = {}
|
||||
end
|
||||
for bit in pairs(localization[word]) do
|
||||
if type(localization[word][bit]) == "string" then
|
||||
words[word][bit] = true
|
||||
end
|
||||
end
|
||||
elseif type(localization[word]) == "string" then
|
||||
words[word] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for word in pairs(words) do
|
||||
if type(words[word]) == "table" then
|
||||
for bit in pairs(words[word]) do
|
||||
for locale, localization in pairs(localizations) do
|
||||
if not rawget(localization, word) or not localization[word][bit] then
|
||||
localeDebug[locale][word .. "::" .. bit] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for locale, localization in pairs(localizations) do
|
||||
if not rawget(localization, word) then
|
||||
localeDebug[locale][word] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for locale, t in pairs(localeDebug) do
|
||||
if not next(t) then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q complete", locale))
|
||||
else
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("Locale %q missing:", locale))
|
||||
for word in pairs(t) do
|
||||
DEFAULT_CHAT_FRAME:AddMessage(string.format(" %q", word))
|
||||
end
|
||||
end
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage("--- End AceLocale Debug ---")
|
||||
end
|
||||
|
||||
setmetatable(AceLocale.prototype, {
|
||||
__index = function(self, k)
|
||||
if type(k) ~= "table" and k ~= 0 and k ~= "GetLibraryVersion" and k ~= "error" and k ~= "assert" and k ~= "argCheck" and k ~= "pcall" then -- HACK: remove "GetLibraryVersion" and such later.
|
||||
AceLocale.error(lastSelf or self, "Translation %q does not exist.", k)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
})
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceLocale = self
|
||||
|
||||
self.frame = oldLib and oldLib.frame or CreateFrame("Frame")
|
||||
self.registry = oldLib and oldLib.registry or {}
|
||||
self.BASE_TRANSLATIONS = oldLib and oldLib.BASE_TRANSLATIONS or {}
|
||||
self.DEBUGGING = oldLib and oldLib.DEBUGGING or {}
|
||||
self.TRANSLATIONS = oldLib and oldLib.TRANSLATIONS or {}
|
||||
self.BASE_LOCALE = oldLib and oldLib.BASE_LOCALE or {}
|
||||
self.TRANSLATION_TABLES = oldLib and oldLib.TRANSLATION_TABLES or {}
|
||||
self.REVERSE_TRANSLATIONS = oldLib and oldLib.REVERSE_TRANSLATIONS or {}
|
||||
self.STRICTNESS = oldLib and oldLib.STRICTNESS or {}
|
||||
self.NAME = oldLib and oldLib.NAME or {}
|
||||
self.DYNAMIC_LOCALES = oldLib and oldLib.DYNAMIC_LOCALES or {}
|
||||
self.CURRENT_LOCALE = oldLib and oldLib.CURRENT_LOCALE or {}
|
||||
|
||||
BASE_TRANSLATIONS = self.BASE_TRANSLATIONS
|
||||
DEBUGGING = self.DEBUGGING
|
||||
TRANSLATIONS = self.TRANSLATIONS
|
||||
BASE_LOCALE = self.BASE_LOCALE
|
||||
TRANSLATION_TABLES = self.TRANSLATION_TABLES
|
||||
REVERSE_TRANSLATIONS = self.REVERSE_TRANSLATIONS
|
||||
STRICTNESS = self.STRICTNESS
|
||||
NAME = self.NAME
|
||||
DYNAMIC_LOCALES = self.DYNAMIC_LOCALES
|
||||
CURRENT_LOCALE = self.CURRENT_LOCALE
|
||||
|
||||
|
||||
local GetTime = GetTime
|
||||
local timeUntilClear = GetTime() + 5
|
||||
scheduleClear = function()
|
||||
if next(newRegistries) then
|
||||
self.frame:Show()
|
||||
timeUntilClear = GetTime() + 5
|
||||
end
|
||||
end
|
||||
|
||||
if not self.registry then
|
||||
self.registry = {}
|
||||
else
|
||||
for name, instance in pairs(self.registry) do
|
||||
local name = name
|
||||
local mt = getmetatable(instance)
|
||||
setmetatable(instance, nil)
|
||||
instance[NAME] = name
|
||||
local strict
|
||||
if instance[STRICTNESS] ~= nil then
|
||||
strict = instance[STRICTNESS]
|
||||
elseif instance[TRANSLATIONS] ~= instance[BASE_TRANSLATIONS] then
|
||||
if getmetatable(instance[TRANSLATIONS]).__index == oldLib.prototype then
|
||||
strict = true
|
||||
end
|
||||
end
|
||||
instance[STRICTNESS] = strict and true or false
|
||||
refixInstance(instance)
|
||||
end
|
||||
end
|
||||
|
||||
self.frame:SetScript("OnEvent", scheduleClear)
|
||||
self.frame:SetScript("OnUpdate", function() -- (this, elapsed)
|
||||
if timeUntilClear - GetTime() <= 0 then
|
||||
self.frame:Hide()
|
||||
for k in pairs(newRegistries) do
|
||||
clearCache(k)
|
||||
newRegistries[k] = nil
|
||||
k = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
self.frame:UnregisterAllEvents()
|
||||
self.frame:RegisterEvent("ADDON_LOADED")
|
||||
self.frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
self.frame:Show()
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceLocale, MAJOR_VERSION, MINOR_VERSION, activate)
|
||||
Executable
+462
@@ -0,0 +1,462 @@
|
||||
--[[
|
||||
Name: AceModuleCore-2.0
|
||||
Revision: $Rev: 17998 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Inspired By: Ace 1.x by Turan (turan@gryphon.com)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www.wowace.com/index.php/AceModuleCore-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceModuleCore-2.0
|
||||
Description: Mixin to provide a module system so that modules or plugins can
|
||||
use an addon as its core.
|
||||
Dependencies: AceLibrary, AceOO-2.0, AceAddon-2.0, AceEvent-2.0 (optional), Compost-2.0 (optional)
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceModuleCore-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17998 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end
|
||||
|
||||
local function safecall(func,a,b,c,d,e,f,g)
|
||||
local success, err = pcall(func,a,b,c,d,e,f,g)
|
||||
if not success then geterrorhandler()(err) end
|
||||
end
|
||||
|
||||
local table_setn
|
||||
do
|
||||
local version = GetBuildInfo()
|
||||
if string.find(version, "^2%.") then
|
||||
-- 2.0.0
|
||||
table_setn = function() end
|
||||
else
|
||||
table_setn = table.setn
|
||||
end
|
||||
end
|
||||
|
||||
local new, del
|
||||
do
|
||||
local list = setmetatable({}, {__mode = 'k'})
|
||||
function new()
|
||||
local t = next(list)
|
||||
if t then
|
||||
list[t] = nil
|
||||
return t
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
function del(t)
|
||||
for k in pairs(t) do
|
||||
t[k] = nil
|
||||
end
|
||||
table_setn(t, 0)
|
||||
list[t] = true
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local AceOO = AceLibrary:GetInstance("AceOO-2.0")
|
||||
local AceModuleCore = AceOO.Mixin {
|
||||
"NewModule",
|
||||
"HasModule",
|
||||
"GetModule",
|
||||
"IsModule",
|
||||
"IterateModules",
|
||||
"SetModuleMixins",
|
||||
"SetModuleClass",
|
||||
"IsModuleActive",
|
||||
"ToggleModuleActive"
|
||||
}
|
||||
local AceEvent
|
||||
|
||||
local Compost = AceLibrary:HasInstance("Compost-2.0") and AceLibrary("Compost-2.0")
|
||||
|
||||
local function getlibrary(lib)
|
||||
if type(lib) == "string" then
|
||||
return AceLibrary(lib)
|
||||
else
|
||||
return lib
|
||||
end
|
||||
end
|
||||
|
||||
local tmp
|
||||
function AceModuleCore:NewModule(name, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if not self.modules then
|
||||
AceModuleCore:error("CreatePrototype() must be called before attempting to create a new module.", 2)
|
||||
end
|
||||
AceModuleCore:argCheck(name, 2, "string")
|
||||
if string.len(name) == 0 then
|
||||
AceModuleCore:error("Bad argument #2 to `NewModule`, string must not be empty")
|
||||
end
|
||||
if self.modules[name] then
|
||||
AceModuleCore:error("The module %q has already been registered", name)
|
||||
end
|
||||
|
||||
if not tmp then
|
||||
tmp = {}
|
||||
end
|
||||
if a1 then table.insert(tmp, a1)
|
||||
if a2 then table.insert(tmp, a2)
|
||||
if a3 then table.insert(tmp, a3)
|
||||
if a4 then table.insert(tmp, a4)
|
||||
if a5 then table.insert(tmp, a5)
|
||||
if a6 then table.insert(tmp, a6)
|
||||
if a7 then table.insert(tmp, a7)
|
||||
if a8 then table.insert(tmp, a8)
|
||||
if a9 then table.insert(tmp, a9)
|
||||
if a10 then table.insert(tmp, a10)
|
||||
if a11 then table.insert(tmp, a11)
|
||||
if a12 then table.insert(tmp, a12)
|
||||
if a13 then table.insert(tmp, a13)
|
||||
if a14 then table.insert(tmp, a14)
|
||||
if a15 then table.insert(tmp, a15)
|
||||
if a16 then table.insert(tmp, a16)
|
||||
if a17 then table.insert(tmp, a17)
|
||||
if a18 then table.insert(tmp, a18)
|
||||
if a19 then table.insert(tmp, a19)
|
||||
if a20 then table.insert(tmp, a20)
|
||||
end end end end end end end end end end end end end end end end end end end end
|
||||
for k,v in ipairs(tmp) do
|
||||
tmp[k] = getlibrary(v)
|
||||
end
|
||||
|
||||
if self.moduleMixins then
|
||||
for _,mixin in ipairs(self.moduleMixins) do
|
||||
local exists = false
|
||||
for _,v in ipairs(tmp) do
|
||||
if mixin == v then
|
||||
exists = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not exists then
|
||||
table.insert(tmp, mixin)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local module = AceOO.Classpool(self.moduleClass, unpack(tmp)):new(name)
|
||||
self.modules[name] = module
|
||||
module.name = name
|
||||
module.title = name
|
||||
|
||||
AceModuleCore.totalModules[module] = self
|
||||
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_ModuleCreated", module)
|
||||
end
|
||||
|
||||
for k in pairs(tmp) do
|
||||
tmp[k] = nil
|
||||
end
|
||||
table_setn(tmp, 0)
|
||||
return module
|
||||
end
|
||||
|
||||
function AceModuleCore:HasModule(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if a1 then if not self.modules[a1] then return false end
|
||||
if a2 then if not self.modules[a2] then return false end
|
||||
if a3 then if not self.modules[a3] then return false end
|
||||
if a4 then if not self.modules[a4] then return false end
|
||||
if a5 then if not self.modules[a5] then return false end
|
||||
if a6 then if not self.modules[a6] then return false end
|
||||
if a7 then if not self.modules[a7] then return false end
|
||||
if a8 then if not self.modules[a8] then return false end
|
||||
if a9 then if not self.modules[a9] then return false end
|
||||
if a10 then if not self.modules[a10] then return false end
|
||||
if a11 then if not self.modules[a11] then return false end
|
||||
if a12 then if not self.modules[a12] then return false end
|
||||
if a13 then if not self.modules[a13] then return false end
|
||||
if a14 then if not self.modules[a14] then return false end
|
||||
if a15 then if not self.modules[a15] then return false end
|
||||
if a16 then if not self.modules[a16] then return false end
|
||||
if a17 then if not self.modules[a17] then return false end
|
||||
if a18 then if not self.modules[a18] then return false end
|
||||
if a19 then if not self.modules[a19] then return false end
|
||||
if a20 then if not self.modules[a20] then return false end
|
||||
end end end end end end end end end end end end end end end end end end end end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function AceModuleCore:GetModule(name)
|
||||
if not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
end
|
||||
if not self.modules[name] then
|
||||
AceModuleCore:error("Cannot find module %q.", name)
|
||||
end
|
||||
return self.modules[name]
|
||||
end
|
||||
|
||||
function AceModuleCore:IsModule(module)
|
||||
if self == AceModuleCore then
|
||||
return AceModuleCore.totalModules[module]
|
||||
else
|
||||
for k,v in pairs(self.modules) do
|
||||
if v == module then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:IterateModules()
|
||||
local t = new()
|
||||
for k in pairs(self.modules) do
|
||||
table.insert(t, k)
|
||||
end
|
||||
table.sort(t)
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
local x = t[i]
|
||||
if x then
|
||||
return x, self.modules[x]
|
||||
else
|
||||
t = del(t)
|
||||
return nil
|
||||
end
|
||||
end, nil, nil
|
||||
end
|
||||
|
||||
function AceModuleCore:SetModuleMixins(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
if self.moduleMixins then
|
||||
AceModuleCore:error('Cannot call "SetModuleMixins" twice')
|
||||
elseif not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
elseif next(self.modules) then
|
||||
AceModuleCore:error('Cannot call "SetModuleMixins" after "NewModule" has been called.')
|
||||
end
|
||||
|
||||
self.moduleMixins = Compost and Compost:Acquire(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) or {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20}
|
||||
for k,v in ipairs(self.moduleMixins) do
|
||||
self.moduleMixins[k] = getlibrary(v)
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:SetModuleClass(class)
|
||||
class = getlibrary(class)
|
||||
AceModuleCore:assert(AceOO.inherits(class, AceOO.Class), "Bad argument #2 to `SetModuleClass' (Class expected)")
|
||||
if not self.modules then
|
||||
AceModuleCore:error("Error initializing class. Please report error.")
|
||||
end
|
||||
if self.customModuleClass then
|
||||
AceModuleCore:error("Cannot call `SetModuleClass' twice.")
|
||||
end
|
||||
self.customModuleClass = true
|
||||
self.moduleClass = class
|
||||
self.modulePrototype = class.prototype
|
||||
end
|
||||
|
||||
function AceModuleCore:ToggleModuleActive(module, state)
|
||||
AceModuleCore:argCheck(module, 2, "table", "string")
|
||||
AceModuleCore:argCheck(state, 3, "nil", "boolean")
|
||||
|
||||
if type(module) == "string" then
|
||||
if not self:HasModule(module) then
|
||||
AceModuleCore:error("Cannot find module %q", module)
|
||||
end
|
||||
module = self:GetModule(module)
|
||||
else
|
||||
if not self:IsModule(module) then
|
||||
AceModuleCore:error("%q is not a module", module)
|
||||
end
|
||||
end
|
||||
|
||||
local disable
|
||||
if state == nil then
|
||||
disable = self:IsModuleActive(module)
|
||||
else
|
||||
disable = not state
|
||||
if disable ~= self:IsModuleActive(module) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if type(module.ToggleActive) == "function" then
|
||||
return module:ToggleActive(not disable)
|
||||
elseif AceOO.inherits(self, "AceDB-2.0") then
|
||||
if not self.db or not self.db.raw then
|
||||
AceModuleCore:error("Cannot toggle a module until `RegisterDB' has been called and `ADDON_LOADED' has been fireed.")
|
||||
end
|
||||
if type(self.db.raw.disabledModules) ~= "table" then
|
||||
self.db.raw.disabledModules = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
local _,profile = self:GetProfile()
|
||||
if type(self.db.raw.disabledModules[profile]) ~= "table" then
|
||||
self.db.raw.disabledModules[profile] = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
if type(self.db.raw.disabledModules[profile][module.name]) ~= "table" then
|
||||
self.db.raw.disabledModules[profile][module.name] = disable or nil
|
||||
end
|
||||
if not disable then
|
||||
if not next(self.db.raw.disabledModules[profile]) then
|
||||
if Compost then
|
||||
Compost:Reclaim(self.db.raw.disabledModules[profile])
|
||||
end
|
||||
self.db.raw.disabledModules[profile] = nil
|
||||
end
|
||||
if not next(self.db.raw.disabledModules) then
|
||||
if Compost then
|
||||
Compost:Reclaim(self.db.raw.disabledModules)
|
||||
end
|
||||
self.db.raw.disabledModules = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
if type(self.disabledModules) ~= "table" then
|
||||
self.disabledModules = Compost and Compost:Acquire() or {}
|
||||
end
|
||||
self.disabledModules[module.name] = disable or nil
|
||||
end
|
||||
if AceOO.inherits(module, "AceAddon-2.0") then
|
||||
local AceAddon = AceLibrary("AceAddon-2.0")
|
||||
if not AceAddon.addonsStarted[module] then
|
||||
return
|
||||
end
|
||||
end
|
||||
if not disable then
|
||||
local current = module.class
|
||||
while true do
|
||||
if current == AceOO.Class then
|
||||
break
|
||||
end
|
||||
if current.mixins then
|
||||
for mixin in pairs(current.mixins) do
|
||||
if type(mixin.OnEmbedEnable) == "function" then
|
||||
safecall(mixin.OnEmbedEnable, mixin, module)
|
||||
end
|
||||
end
|
||||
end
|
||||
current = current.super
|
||||
end
|
||||
if type(module.OnEnable) == "function" then
|
||||
safecall(module.OnEnable, module)
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_AddonEnabled", module)
|
||||
end
|
||||
else
|
||||
local current = module.class
|
||||
while true do
|
||||
if current == AceOO.Class then
|
||||
break
|
||||
end
|
||||
if current.mixins then
|
||||
for mixin in pairs(current.mixins) do
|
||||
if type(mixin.OnEmbedDisable) == "function" then
|
||||
safecall(mixin.OnEmbedDisable, mixin, module)
|
||||
end
|
||||
end
|
||||
end
|
||||
current = current.super
|
||||
end
|
||||
if type(module.OnDisable) == "function" then
|
||||
safecall(module.OnDisable, module)
|
||||
end
|
||||
if AceEvent then
|
||||
AceEvent:TriggerEvent("Ace2_AddonDisabled", module)
|
||||
end
|
||||
end
|
||||
return not disable
|
||||
end
|
||||
|
||||
function AceModuleCore:IsModuleActive(module)
|
||||
AceModuleCore:argCheck(module, 2, "table", "string")
|
||||
|
||||
if AceModuleCore == self then
|
||||
self:argCheck(module, 2, "table")
|
||||
|
||||
local core = AceModuleCore.totalModules[module]
|
||||
if not core then
|
||||
self:error("Bad argument #2 to `IsModuleActive'. Not a module")
|
||||
end
|
||||
return core:IsModuleActive(module)
|
||||
end
|
||||
|
||||
if type(module) == "string" then
|
||||
if not self:HasModule(module) then
|
||||
AceModuleCore:error("Cannot find module %q", module)
|
||||
end
|
||||
module = self:GetModule(module)
|
||||
else
|
||||
if not self:IsModule(module) then
|
||||
AceModuleCore:error("%q is not a module", module)
|
||||
end
|
||||
end
|
||||
|
||||
if type(module.IsActive) == "function" then
|
||||
return module:IsActive()
|
||||
elseif AceOO.inherits(self, "AceDB-2.0") then
|
||||
local _,profile = self:GetProfile()
|
||||
return not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[profile] or not self.db.raw.disabledModules[profile][module.name]
|
||||
else
|
||||
return not self.disabledModules or not self.disabledModules[module.name]
|
||||
end
|
||||
end
|
||||
|
||||
function AceModuleCore:OnInstanceInit(target)
|
||||
if target.modules then
|
||||
AceModuleCore:error("OnInstanceInit cannot be called twice")
|
||||
end
|
||||
target.modules = Compost and Compost:Acquire() or {}
|
||||
|
||||
target.moduleClass = AceOO.Class("AceAddon-2.0")
|
||||
target.modulePrototype = target.moduleClass.prototype
|
||||
end
|
||||
|
||||
AceModuleCore.OnManualEmbed = AceModuleCore.OnInstanceInit
|
||||
|
||||
function AceModuleCore.OnEmbedProfileDisable(AceModuleCore, self, newProfile)
|
||||
if not AceOO.inherits(self, "AceDB-2.0") then
|
||||
return
|
||||
end
|
||||
local _,currentProfile = self:GetProfile()
|
||||
for k, module in pairs(self.modules) do
|
||||
if type(module.IsActive) == "function" or type(module.ToggleActive) == "function" then
|
||||
-- continue
|
||||
else
|
||||
local currentActive = not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[currentProfile] or not self.db.raw.disabledModules[currentProfile][module.name]
|
||||
local newActive = not self.db or not self.db.raw or not self.db.raw.disabledModules or not self.db.raw.disabledModules[newProfile] or not self.db.raw.disabledModules[newProfile][module.name]
|
||||
if currentActive ~= newActive then
|
||||
self:ToggleModuleActive(module)
|
||||
if not self.db.raw.disabledModules then
|
||||
self.db.raw.disabledModules = {}
|
||||
end
|
||||
if not self.db.raw.disabledModules[currentProfile] then
|
||||
self.db.raw.disabledModules[currentProfile] = {}
|
||||
end
|
||||
self.db.raw.disabledModules[currentProfile][module.name] = not currentActive or nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
AceModuleCore = self
|
||||
|
||||
if oldLib then
|
||||
self.totalModules = oldLib.totalModules
|
||||
end
|
||||
if not self.totalModules then
|
||||
self.totalModules = {}
|
||||
end
|
||||
|
||||
self.super.activate(self, oldLib, oldDeactivate)
|
||||
end
|
||||
|
||||
local function external(self, major, instance)
|
||||
if major == "Compost-2.0" then
|
||||
Compost = instance
|
||||
elseif major == "AceEvent-2.0" then
|
||||
AceEvent = instance
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceModuleCore, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
|
||||
AceModuleCore = AceLibrary(MAJOR_VERSION)
|
||||
Executable
+1004
File diff suppressed because it is too large
Load Diff
Executable
+328
@@ -0,0 +1,328 @@
|
||||
--[[
|
||||
Name: AceTab-2.0
|
||||
Revision: $Rev: 17638 $
|
||||
Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team)
|
||||
Website: http://www.wowace.com/
|
||||
Documentation: http://www..wowace.com/index.php/AceTab-2.0
|
||||
SVN: http://svn.wowace.com/root/trunk/Ace2/AceTab-2.0
|
||||
Description: A tab-completion library
|
||||
Dependencies: AceLibrary, AceEvent-2.0
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "AceTab-2.0"
|
||||
local MINOR_VERSION = "$Revision: 17638 $"
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary.") end
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check
|
||||
local AceEvent
|
||||
local AceTab = {}
|
||||
local _G = getfenv()
|
||||
|
||||
local hookedFrames = {}
|
||||
local framesHooked = {}
|
||||
|
||||
function AceTab:RegisterTabCompletion(descriptor, regex, wlfunc, usage, editframes)
|
||||
self:argCheck(descriptor, 2, "string")
|
||||
self:argCheck(regex, 3, "string", "table")
|
||||
self:argCheck(wlfunc, 4, "string", "function", "nil")
|
||||
self:argCheck(usage, 5, "string", "function", "boolean", "nil")
|
||||
self:argCheck(editframe, 6, "string", "table", "nil")
|
||||
|
||||
if type(regex) == "string" then regex = {regex} end
|
||||
|
||||
if type(wlfunc) == "string" and type(self[wlfunc]) ~= "function" then
|
||||
self:error("Cannot register function %q; it does not exist", wlfunc)
|
||||
end
|
||||
|
||||
if type(usage) == "string" and type(self[usage]) ~= "function" then
|
||||
self:error("Cannot register usage function %q; it does not exist", usage)
|
||||
end
|
||||
|
||||
if not editframes then editframes = {"ChatFrameEditBox"} end
|
||||
|
||||
if type(editframes) == "table" and editframes.Show then editframes = {editframes:GetName()} end
|
||||
|
||||
for _, frame in pairs(editframes) do
|
||||
local Gframe
|
||||
if type(frame) == "table" then
|
||||
Gframe = frame
|
||||
frame = frame:GetName()
|
||||
else
|
||||
Gframe = _G[frame]
|
||||
end
|
||||
|
||||
if type(Gframe) ~= "table" or not Gframe.Show then
|
||||
self:error("Cannot register frame %q; it does not exist", frame)
|
||||
frame = nil
|
||||
end
|
||||
|
||||
if frame then
|
||||
if Gframe:GetFrameType() ~= "EditBox" then
|
||||
self:error("Cannot register frame %q; it is not an EditBox", frame)
|
||||
frame = nil
|
||||
else
|
||||
if AceEvent and AceEvent:IsFullyInitialized() then
|
||||
if not framesHooked[Gframe] then
|
||||
framesHooked[Gframe] = true
|
||||
local orig = Gframe:GetScript("OnTabPressed")
|
||||
if type(orig) ~= "function" then
|
||||
orig = function() end
|
||||
end
|
||||
Gframe:SetScript("OnTabPressed", function()
|
||||
if self:OnTabPressed(Gframe) then
|
||||
return orig()
|
||||
end
|
||||
end)
|
||||
Gframe.curMatch = 0
|
||||
Gframe.matches = {}
|
||||
Gframe.pMatchLen = 0
|
||||
end
|
||||
else
|
||||
hookedFrames[frame] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not self.registry[descriptor] then
|
||||
self.registry[descriptor] = {}
|
||||
end
|
||||
|
||||
if not self.registry[descriptor][self] then
|
||||
self.registry[descriptor][self] = {}
|
||||
end
|
||||
self.registry[descriptor][self] = {patterns = regex, wlfunc = wlfunc, usage = usage, frames = editframes}
|
||||
|
||||
|
||||
if not AceEvent and AceLibrary:HasInstance("AceEvent-2.0") then
|
||||
external(AceTab, "AceEvent-2.0", AceLibrary("AceEvent-2.0"))
|
||||
end
|
||||
if AceEvent then
|
||||
if not self:IsEventRegistered("AceEvent_FullyInitialized") then
|
||||
self:RegisterEvent("AceEvent_FullyInitialized", "AceEvent_FullyInitialized", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceTab:IsTabCompletionRegistered(descriptor)
|
||||
self:argCheck(descriptor, 2, "string")
|
||||
return self.registry[descriptor] and self.registry[descriptor][self]
|
||||
end
|
||||
|
||||
function AceTab:UnregisterTabCompletion(descriptor)
|
||||
self:argCheck(descriptor, 2, "string")
|
||||
if self.registry[descriptor] and self.registry[descriptor][self] then
|
||||
self.registry[descriptor][self] = nil
|
||||
else
|
||||
self:error("Cannot unregister a tab completion (%s) that you have not registered.", descriptor)
|
||||
end
|
||||
end
|
||||
|
||||
local GCS
|
||||
GCS = function(s1, s2)
|
||||
if not s1 and not s2 then return end
|
||||
if not s1 then s1 = s2 end
|
||||
if not s2 then s2 = s1 end
|
||||
local s1len, s2len = string.len(s1), string.len(s2)
|
||||
if s2len < s1len then
|
||||
s1, s2 = s2, s1
|
||||
end
|
||||
if string.find(string.lower(s2), string.lower(s1)) then
|
||||
return s1
|
||||
else
|
||||
return GCS(string.sub(s1, 1, -2), s2)
|
||||
end
|
||||
end
|
||||
local pos
|
||||
local function CycleTab()
|
||||
this.pMatchLen = string.len(this.lMatch)
|
||||
local cMatch = 0
|
||||
local matched = false
|
||||
for desc, mList in pairs(this.matches) do
|
||||
if not matched then
|
||||
for _, m in ipairs(mList) do
|
||||
cMatch = cMatch + 1
|
||||
if cMatch == this.curMatch then
|
||||
this.lMatch = m
|
||||
this.curMatch = this.curMatch + 1
|
||||
matched = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if not matched then
|
||||
this.curMatch = 1
|
||||
this.lMatch = this.origWord
|
||||
end
|
||||
this:HighlightText(pos - this.pMatchLen, pos)
|
||||
this:Insert(this.lMatch)
|
||||
end
|
||||
|
||||
function AceTab:OnTabPressed()
|
||||
local ost = this:GetScript("OnTextSet")
|
||||
if type(ost) ~= "function" then
|
||||
ost = nil
|
||||
end
|
||||
if ost then this:SetScript("OnTextSet", nil) end
|
||||
if this:GetText() == "" then return true end
|
||||
this:Insert("\255")
|
||||
pos = string.find(this:GetText(), "\255", 1) - 1
|
||||
this:HighlightText(pos, pos+1)
|
||||
this:Insert("\0")
|
||||
if ost then this:SetScript("OnTextSet", ost) end
|
||||
local fulltext = this:GetText()
|
||||
local text = string.sub(fulltext, 0, pos) or ""
|
||||
|
||||
local left = string.find(string.sub(text, 1, pos), "%w+$")
|
||||
left = left and left-1 or pos
|
||||
if not left or left == 1 and string.sub(text, 1, 1) == "/" then return true end
|
||||
|
||||
local _, _, word = string.find(string.sub(text, left, pos), "(%w+)")
|
||||
word = word or ""
|
||||
this.lMatch = this.curMatch > 0 and (this.lMatch or this.origWord)
|
||||
|
||||
if this.lMatch and this.lMatch ~= "" and string.find(string.sub(text, 1, pos), this.lMatch.."$") then
|
||||
return CycleTab()
|
||||
else
|
||||
this.matches = {}
|
||||
this.curMatch = 0
|
||||
this.lMatch = nil
|
||||
end
|
||||
|
||||
local completions = {}
|
||||
local numMatches = 0
|
||||
local firstMatch, hasNonFallback
|
||||
|
||||
for desc, entry in pairs(AceTab.registry) do
|
||||
for _, s in pairs(entry) do
|
||||
for _, f in pairs(s.frames) do
|
||||
if _G[f] == this then
|
||||
for _, regex in ipairs(s.patterns) do
|
||||
local cands = {}
|
||||
if string.find(string.sub(text, 1, left), regex.."$") then
|
||||
local c = s.wlfunc(cands, fulltext, left)
|
||||
if c ~= false then
|
||||
local mtemp = {}
|
||||
this.matches[desc] = this.matches[desc] or {}
|
||||
for _, cand in ipairs(cands) do
|
||||
if string.find(string.lower(cand), string.lower(word), 1, 1) == 1 then
|
||||
mtemp[cand] = true
|
||||
numMatches = numMatches + 1
|
||||
if numMatches == 1 then firstMatch = cand end
|
||||
end
|
||||
end
|
||||
for i in pairs(mtemp) do
|
||||
table.insert(this.matches[desc], i)
|
||||
end
|
||||
this.matches[desc].usage = s.usage
|
||||
if regex ~= "" and this.matches[desc][1] then
|
||||
hasNonFallback = true
|
||||
this.matches[desc].notFallback = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local _, set = next(this.matches)
|
||||
if not set or numMatches == 0 and not hasNonFallback then return true end
|
||||
|
||||
this:HighlightText(left, left + string.len(word))
|
||||
if numMatches == 1 then
|
||||
this:Insert(firstMatch)
|
||||
this:Insert(" ")
|
||||
else
|
||||
if this.curMatch == 0 then
|
||||
this.curMatch = 1
|
||||
this.origWord = word
|
||||
this.lMatch = word
|
||||
CycleTab()
|
||||
end
|
||||
local gcs
|
||||
for h, c in pairs(this.matches) do
|
||||
if hasNonFallback and not c.notFallback then break end
|
||||
local u = c.usage
|
||||
c.usage = nil
|
||||
local candUsage = u and {}
|
||||
local gcs2
|
||||
if next(c) then
|
||||
if not u then DEFAULT_CHAT_FRAME:AddMessage(h..":") end
|
||||
for _, m in ipairs(c) do
|
||||
if not u then DEFAULT_CHAT_FRAME:AddMessage(m) end
|
||||
gcs2 = GCS(gcs2, m)
|
||||
end
|
||||
end
|
||||
gcs = GCS(gcs, gcs2)
|
||||
if u then
|
||||
if type(u) == "function" then
|
||||
local us = u(candUsage, c, gcs2, string.sub(text, 1, left))
|
||||
if candUsage and next(candUsage) then us = candUsage end
|
||||
if type(us) == "string" then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(us)
|
||||
elseif type(us) == "table" and numMatches > 0 then
|
||||
for _, v in ipairs(c) do
|
||||
if us[v] then DEFAULT_CHAT_FRAME:AddMessage(string.format("%s - %s", v, us[v])) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if curMatch == 0 then
|
||||
this:Insert(gcs or word)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AceTab:AceEvent_FullyInitialized()
|
||||
for frame in pairs(hookedFrames) do
|
||||
local Gframe = _G[frame]
|
||||
if not framesHooked[Gframe] then
|
||||
framesHooked[Gframe] = true
|
||||
local orig = Gframe:GetScript("OnTabPressed")
|
||||
if type(orig) ~= "function" then
|
||||
orig = function() end
|
||||
end
|
||||
Gframe:SetScript("OnTabPressed", function()
|
||||
if self:OnTabPressed(Gframe) then
|
||||
return orig()
|
||||
end
|
||||
end)
|
||||
Gframe.curMatch = 0
|
||||
Gframe.matches = {}
|
||||
Gframe.pMatchLen = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function external(self, major, instance)
|
||||
if major == "AceEvent-2.0" then
|
||||
if not AceEvent then
|
||||
AceEvent = instance
|
||||
|
||||
AceEvent:embed(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function activate(self, oldLib, oldDeactivate)
|
||||
if oldLib then
|
||||
self.registry = oldLib.registry
|
||||
end
|
||||
|
||||
if not self.registry then
|
||||
self.registry = {}
|
||||
end
|
||||
|
||||
if oldDeactivate then
|
||||
oldDeactivate(oldLib)
|
||||
end
|
||||
end
|
||||
|
||||
AceLibrary:Register(AceTab, MAJOR_VERSION, MINOR_VERSION, activate, nil, external)
|
||||
AceTab = AceLibrary(MAJOR_VERSION)
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
--[[
|
||||
Name: Babble-Class-2.2
|
||||
Revision: $Rev: 14410 $
|
||||
Author(s): ckknight (ckknight@gmail.com)
|
||||
Website: http://ckknight.wowinterface.com/
|
||||
Documentation: http://wiki.wowace.com/index.php/Babble-Class-2.2
|
||||
SVN: http://svn.wowace.com/root/trunk/Babble-2.2/Babble-Class-2.2
|
||||
Description: A library to provide localizations for classes.
|
||||
Dependencies: AceLibrary, AceLocale-2.2
|
||||
]]
|
||||
|
||||
local MAJOR_VERSION = "Babble-Class-2.2"
|
||||
local MINOR_VERSION = tonumber(string.sub("$Revision: 14410 $", 12, -3))
|
||||
|
||||
if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end
|
||||
|
||||
if not AceLibrary:HasInstance("AceLocale-2.2") then error(MAJOR_VERSION .. " requires AceLocale-2.2") end
|
||||
|
||||
local _, x = AceLibrary("AceLocale-2.2"):GetLibraryVersion()
|
||||
MINOR_VERSION = MINOR_VERSION * 100000 + x
|
||||
|
||||
if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end
|
||||
|
||||
local BabbleClass = AceLibrary("AceLocale-2.2"):new(MAJOR_VERSION)
|
||||
|
||||
-- uncomment below for debug information
|
||||
-- BabbleClass:EnableDebugging()
|
||||
|
||||
BabbleClass:RegisterTranslations("enUS", function()
|
||||
return {
|
||||
["Warlock"] = true,
|
||||
["Warrior"] = true,
|
||||
["Hunter"] = true,
|
||||
["Mage"] = true,
|
||||
["Priest"] = true,
|
||||
["Druid"] = true,
|
||||
["Paladin"] = true,
|
||||
["Shaman"] = true,
|
||||
["Rogue"] = true,
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("ruRU", function()
|
||||
return {
|
||||
["Warlock"] = "Чернокнижник",
|
||||
["Warrior"] = "Воин",
|
||||
["Hunter"] = "Охотник",
|
||||
["Mage"] = "Маг",
|
||||
["Priest"] = "Жрец",
|
||||
["Druid"] = "Друид",
|
||||
["Paladin"] = "Паладин",
|
||||
["Shaman"] = "Шаман",
|
||||
["Rogue"] = "Разбойник",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("deDE", function()
|
||||
return {
|
||||
["Warlock"] = "Hexenmeister",
|
||||
["Warrior"] = "Krieger",
|
||||
["Hunter"] = "Jäger",
|
||||
["Mage"] = "Magier",
|
||||
["Priest"] = "Priester",
|
||||
["Druid"] = "Druide",
|
||||
["Paladin"] = "Paladin",
|
||||
["Shaman"] = "Schamane",
|
||||
["Rogue"] = "Schurke",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("frFR", function()
|
||||
return {
|
||||
["Warlock"] = "D\195\169moniste",
|
||||
["Warrior"] = "Guerrier",
|
||||
["Hunter"] = "Chasseur",
|
||||
["Mage"] = "Mage",
|
||||
["Priest"] = "Pr\195\170tre",
|
||||
["Druid"] = "Druide",
|
||||
["Paladin"] = "Paladin",
|
||||
["Shaman"] = "Chaman",
|
||||
["Rogue"] = "Voleur",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("zhCN", function()
|
||||
return {
|
||||
["Warlock"] = "术士",
|
||||
["Warrior"] = "战士",
|
||||
["Hunter"] = "猎人",
|
||||
["Mage"] = "法师",
|
||||
["Priest"] = "牧师",
|
||||
["Druid"] = "德鲁伊",
|
||||
["Paladin"] = "圣骑士",
|
||||
["Shaman"] = "萨满祭司",
|
||||
["Rogue"] = "盗贼",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("zhTW", function()
|
||||
return {
|
||||
["Warlock"] = "術士",
|
||||
["Warrior"] = "戰士",
|
||||
["Hunter"] = "獵人",
|
||||
["Mage"] = "法師",
|
||||
["Priest"] = "牧師",
|
||||
["Druid"] = "德魯伊",
|
||||
["Paladin"] = "聖騎士",
|
||||
["Shaman"] = "薩滿",
|
||||
["Rogue"] = "盜賊",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:RegisterTranslations("koKR", function()
|
||||
return {
|
||||
["Warlock"] = "흑마법사",
|
||||
["Warrior"] = "전사",
|
||||
["Hunter"] = "사냥꾼",
|
||||
["Mage"] = "마법사",
|
||||
["Priest"] = "사제",
|
||||
["Druid"] = "드루이드",
|
||||
["Paladin"] = "성기사",
|
||||
["Shaman"] = "주술사",
|
||||
["Rogue"] = "도적",
|
||||
}
|
||||
end)
|
||||
|
||||
BabbleClass:Debug()
|
||||
BabbleClass:SetStrictness(true)
|
||||
|
||||
function BabbleClass:GetColor(class)
|
||||
self:argCheck(class, 2, "string")
|
||||
if self:HasReverseTranslation(class) then
|
||||
class = string.upper(self:GetReverseTranslation(class))
|
||||
else
|
||||
class = string.upper(class)
|
||||
end
|
||||
if RAID_CLASS_COLORS and RAID_CLASS_COLORS[class] then
|
||||
return RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
|
||||
end
|
||||
return 0.63, 0.63, 0.63
|
||||
end
|
||||
|
||||
function BabbleClass:GetHexColor(class)
|
||||
self:argCheck(class, 2, "string")
|
||||
local r, g, b = self:GetColor(class)
|
||||
return string.format("%02x%02x%02x", r * 255, g * 255, b * 255)
|
||||
end
|
||||
|
||||
AceLibrary:Register(BabbleClass, MAJOR_VERSION, MINOR_VERSION)
|
||||
BabbleClass = nil
|
||||
Executable
+4863
File diff suppressed because it is too large
Load Diff
Executable
+268
@@ -0,0 +1,268 @@
|
||||
--[[
|
||||
Name: Prat_Buttons
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_Buttons by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Buttons
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that toggles the chat menu and chat window buttons on and off (default=off).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratButtons")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Buttons"] = true,
|
||||
["Chat window menu and buttons options."] = true,
|
||||
["ChatMenu"] = true,
|
||||
["Toggles chat menu on and off."] = true,
|
||||
["ChatButtons"] = true,
|
||||
["Toggle chat windows buttons on and off."] = true,
|
||||
["Chat%dButtons"] = true,
|
||||
["Toggles buttons on and off for chat window %d."] = true,
|
||||
["Show Reminder Button"] = true,
|
||||
["Show reminder button when not at bottom of chat window."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Buttons"] = "Кнопки",
|
||||
["Chat window menu and buttons options."] = "Настройки кнопок меню и окна чата.",
|
||||
["ChatMenu"] = "ЧатМеню",
|
||||
["Toggles chat menu on and off."] = "Вкл/выкл кнопки чата.",
|
||||
["ChatButtons"] = "ЧатКнопка",
|
||||
["Toggle chat windows buttons on and off."] = "Вкл/Выкл кнопок окна чата",
|
||||
["Chat%dButtons"] = "ЧатКнопка%d",
|
||||
["Toggles buttons on and off for chat window %d."] = "Вкл/Выкл кнопки окна чата %d.",
|
||||
["Show Reminder Button"] = "Показать кнопку напоминания",
|
||||
["Show reminder button when not at bottom of chat window."] = "Показать кнопку напоминания не в нижней части окна.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Buttons"] = "按钮",
|
||||
["Chat window menu and buttons options."] = "聊天窗口菜单及按钮选项。",
|
||||
["ChatMenu"] = "聊天菜单",
|
||||
["Toggles chat menu on and off."] = "显示聊天菜单打开与关闭。",
|
||||
["ChatButtons"] = "聊天按钮",
|
||||
["Toggle chat windows buttons on and off."] = "切换显示聊天按钮打开与关闭。",
|
||||
["Chat%dButtons"] = "聊天%d按钮",
|
||||
["Toggles buttons on and off for chat window %d."] = "显示第 %d 聊天窗口按钮。",
|
||||
["Show Reminder Button"] = "显示提示按钮",
|
||||
["Show reminder button when not at bottom of chat window."] = "聊天窗口不在底部时显示提示按钮。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Buttons"] = "버튼",
|
||||
["Chat window menu and buttons options."] = "대화창 메뉴와 버튼을 설정합니다.",
|
||||
["ChatMenu"] = "대화 메뉴",
|
||||
["Toggles chat menu on and off."] = "대화 메뉴 켜고 끄기를 전환합니다.",
|
||||
["ChatButtons"] = "대화 버튼",
|
||||
["Toggle chat windows buttons on and off."] = "대화창 버튼 켜고 끄기를 전환합니다.",
|
||||
["Chat%dButtons"] = "대화창%d 버튼",
|
||||
["Toggles buttons on and off for chat window %d."] = "대화창%d에 대한 버튼을 켜고 끄기를 전환합니다.",
|
||||
["Show Reminder Button"] = "Show Reminder Button",
|
||||
["Show reminder button when not at bottom of chat window."] = "Show reminder button when not at bottom of chat window.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Buttons = Prat:NewModule("buttons")
|
||||
|
||||
function Prat_Buttons:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Buttons")
|
||||
Prat:RegisterDefaults("Buttons", "profile", {
|
||||
on = true,
|
||||
chatmenu = false,
|
||||
chatbutton = {false, false, false, false, false, false, false},
|
||||
showreminder = false
|
||||
})
|
||||
Prat.Options.args.buttons = {
|
||||
name = L["Buttons"],
|
||||
desc = L["Chat window menu and buttons options."],
|
||||
type = "group",
|
||||
args = {
|
||||
chatmenu = {
|
||||
name = L["ChatMenu"],
|
||||
desc = L["Toggles chat menu on and off."],
|
||||
type = "toggle",
|
||||
order = 150,
|
||||
get = function() return self.db.profile.chatmenu end,
|
||||
set = function(v)
|
||||
self.db.profile.chatmenu = v
|
||||
self:ChatMenu(v)
|
||||
end
|
||||
},
|
||||
chatbuttons = {
|
||||
name = L["ChatButtons"],
|
||||
desc = L["Toggle chat windows buttons on and off."],
|
||||
type = "group",
|
||||
order = 180,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dButtons"], 1),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[1] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[1] = v
|
||||
self:ChatButton(1,v)
|
||||
end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dButtons"], 2),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 2),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[2] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[2] = v
|
||||
self:ChatButton(2,v)
|
||||
end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dButtons"], 3),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 3),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[3] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[3] = v
|
||||
self:ChatButton(3,v)
|
||||
end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dButtons"], 4),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 4),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[4] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[4] = v
|
||||
self:ChatButton(4,v)
|
||||
end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dButtons"], 5),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 5),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[5] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[5] = v
|
||||
self:ChatButton(5,v)
|
||||
end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dButtons"], 6),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 6),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[6] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[6] = v
|
||||
self:ChatButton(6,v)
|
||||
end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dButtons"], 7),
|
||||
desc = string.format(L["Toggles buttons on and off for chat window %d."], 7),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatbutton[7] end,
|
||||
set = function(v)
|
||||
self.db.profile.chatbutton[7] = v
|
||||
self:ChatButton(7,v)
|
||||
end
|
||||
}
|
||||
},
|
||||
},
|
||||
showreminder = {
|
||||
name = L["Show Reminder Button"],
|
||||
desc = L["Show reminder button when not at bottom of chat window."],
|
||||
type = "toggle",
|
||||
order = 190,
|
||||
get = function() return self.db.profile.showreminder end,
|
||||
set = function(v) self.db.profile.showreminder = v end,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("buttons") end
|
||||
}
|
||||
}
|
||||
}
|
||||
-- create reminder buttons
|
||||
for i = 1,NUM_CHAT_WINDOWS do
|
||||
self:MakeReminder(i)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Buttons:OnEnable()
|
||||
self:Hook("ChatFrame_OnUpdate")
|
||||
end
|
||||
|
||||
function Prat_Buttons:OnDisable()
|
||||
self:ChatMenu(true)
|
||||
for i = 1,NUM_CHAT_WINDOWS do
|
||||
self:ChatButton(i,true)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Buttons:ChatFrame_OnUpdate(elapsed)
|
||||
self.hooks["ChatFrame_OnUpdate"](elapsed)
|
||||
self:ChatMenu(self.db.profile.chatmenu)
|
||||
for i = 1,NUM_CHAT_WINDOWS do
|
||||
self:ChatButton(i,self.db.profile.chatbutton[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Buttons:ChatMenu(visible)
|
||||
if visible then
|
||||
ChatFrameMenuButton:Show()
|
||||
else
|
||||
ChatFrameMenuButton:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Buttons:ChatButton(id,visible)
|
||||
local cf = getglobal("ChatFrame"..id)
|
||||
local cfup = getglobal("ChatFrame"..id.."UpButton")
|
||||
local cfdown = getglobal("ChatFrame"..id.."DownButton")
|
||||
local cfbottom = getglobal("ChatFrame"..id.."BottomButton")
|
||||
local cfreminder = getglobal("ChatFrame"..id.."ScrollDownReminder")
|
||||
if visible then
|
||||
cfup:Show()
|
||||
cfdown:Show()
|
||||
cfbottom:Show()
|
||||
else
|
||||
cfup:Hide()
|
||||
cfdown:Hide()
|
||||
cfbottom:Hide()
|
||||
if ( (not cf:AtBottom() ) and self.db.profile.showreminder) then
|
||||
cfreminder:Show()
|
||||
else
|
||||
cfreminder:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Buttons:MakeReminder(id)
|
||||
local cf = getglobal("ChatFrame"..id)
|
||||
local b = CreateFrame("Button","ChatFrame"..id.."ScrollDownReminder",cf)
|
||||
b:SetFrameStrata("BACKGROUND")
|
||||
b:SetWidth(24)
|
||||
b:SetHeight(24)
|
||||
b:SetNormalTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up")
|
||||
b:SetPushedTexture("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down")
|
||||
b:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight")
|
||||
b:SetPoint("RIGHT", cf, "RIGHT", 0, 0)
|
||||
b:SetPoint("LEFT", cf, "RIGHT", -32, 0)
|
||||
b:SetPoint("TOP", cf, "BOTTOM", 0, 28)
|
||||
b:SetPoint("BOTTOM", cf, "BOTTOM", 0, 0)
|
||||
b:SetScript("OnClick", function() this:GetParent():ScrollToBottom() end)
|
||||
b:Hide()
|
||||
end
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
--[[
|
||||
Name: Prat_ChannelColorMemory
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Sylvanaar
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#ChannelColorMemory
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that remembers the colors of channels by channel name
|
||||
Dependencies: Prat
|
||||
|
||||
Credit goes to: ConsisTint By Karl Isenberg (AnduinLothar)
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("ChannelColorMemory")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["ChannelColorMemory"] = true,
|
||||
["Remembers the colors of channels by channel name."] = true,
|
||||
["(%w+)%s?(.*)"] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["ChannelColorMemory"] = "Запомнить цвет канала",
|
||||
["Remembers the colors of channels by channel name."] = "Запоминает цвета каналов по названию канала.",
|
||||
["(%w+)%s?(.*)"] = "(%w+)%s?(.*)",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["ChannelColorMemory"] = "频道颜色储存",
|
||||
["Remembers the colors of channels by channel name."] = "还原频道名称的颜色设置",
|
||||
["(%w+)%s?(.*)"] = "(%w+)%s?(.*)",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["ChannelColorMemory"] = "채널 색상 기억",
|
||||
["Remembers the colors of channels by channel name."] = "채널명에 따른 채널의 색상을 기억합니다.",
|
||||
["(%w+)%s?(.*)"] = "(.+)%s?(.*)",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기 전환",
|
||||
} end)
|
||||
|
||||
|
||||
Prat_ChannelColorMemory = Prat:NewModule("ChannelColorMemory")
|
||||
|
||||
function Prat_ChannelColorMemory:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("ChannelColorMemory")
|
||||
Prat:RegisterDefaults("ChannelColorMemory", "profile", {
|
||||
on = true,
|
||||
colors = {},
|
||||
})
|
||||
Prat.Options.args.ChannelColorMemory = {
|
||||
name = L["ChannelColorMemory"],
|
||||
desc = L["Remembers the colors of channels by channel name."],
|
||||
type = "group",
|
||||
args = {
|
||||
Toggle = {
|
||||
type = "toggle",
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("ChannelColorMemory") end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_ChannelColorMemory:OnEnable()
|
||||
self:RegisterEvent("UPDATE_CHAT_COLOR")
|
||||
self:RegisterEvent("CHAT_MSG_CHANNEL_NOTICE")
|
||||
end
|
||||
function Prat_ChannelColorMemory:OnDisable()
|
||||
self:UnregisterEvent("UPDATE_CHAT_COLOR")
|
||||
self:UnregisterEvent("CHAT_MSG_CHANNEL_NOTICE")
|
||||
end
|
||||
|
||||
|
||||
function Prat_ChannelColorMemory:UPDATE_CHAT_COLOR(ChatType, cr,cg,cb)
|
||||
if (ChatType) then
|
||||
local number = string.gfind(arg1, "CHANNEL(%d+)")()
|
||||
if ( number ) then
|
||||
local _, name = GetChannelName(number);
|
||||
if ( name ) then
|
||||
local name, zoneSuffix = string.gfind(name, L["(%w+)%s?(.*)"])();
|
||||
|
||||
local color = self.db.profile.colors[name];
|
||||
if (not color) then
|
||||
self.db.profile.colors[name] = {r=cr, g=cg, b=cb};
|
||||
else
|
||||
color.r=cr
|
||||
color.g=cg
|
||||
color.b=cb
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_ChannelColorMemory:CHAT_MSG_CHANNEL_NOTICE(NoticeType,a2,a3,LongName,a5,a6,a7,number, cname)
|
||||
if (not strfind(LongName, "%d+%. .*")) then
|
||||
return;
|
||||
elseif (arg1 == "YOU_JOINED") then
|
||||
local name, zoneSuffix = string.gfind(cname, L["(%w+)%s?(.*)"])();
|
||||
local color = self.db.profile.colors[name];
|
||||
if (color) then
|
||||
ChangeChatColor("CHANNEL"..number, color.r, color.g, color.b);
|
||||
else
|
||||
color = ChatTypeInfo["CHANNEL"..number];
|
||||
self.db.profile.colors[name] = {r=color.r, g=color.g, b=color.b};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+999
@@ -0,0 +1,999 @@
|
||||
--[[
|
||||
Name: Prat_ChannelNames
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_ChannelNames by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#ChannelNames
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds options and keybindings for all chat channels.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratChannelNames")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["ChannelNames"] = true,
|
||||
["Channel name abbreviation options."] = true,
|
||||
["Replace"] = true,
|
||||
["Toggle replacing this channel."] = true,
|
||||
["Off"] = true,
|
||||
["Turn off this channel."] = true,
|
||||
["Set"] = true,
|
||||
["Channel %d"] = true,
|
||||
["Say"] = true,
|
||||
["Whisper"] = true,
|
||||
["Incoming Whisper"] = true,
|
||||
["Yell"] = true,
|
||||
["Guild"] = true,
|
||||
["Party"] = true,
|
||||
["Raid"] = true,
|
||||
["Raid Leader"] = true,
|
||||
["Raid Warning"] = true,
|
||||
["Officer"] = true,
|
||||
["Battleground"] = true,
|
||||
["Battleground Leader"] = true,
|
||||
["%s settings."] = true,
|
||||
["Use a custom replacement for the chat %s text."] = true,
|
||||
["Show Space"] = true,
|
||||
["Toggle adding space after channel replacement."] = true,
|
||||
["Show Colon"] = true,
|
||||
["Toggle adding colon after channel replacement."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["ChannelNames"] = "ChannelNames",
|
||||
["Channel name abbreviation options."] = "Настройки сокращения названий каналов.",
|
||||
["Replace"] = "Заменить",
|
||||
["Toggle replacing this channel."] = "Включить замену данного канала.",
|
||||
["Off"] = "Выкл",
|
||||
["Turn off this channel."] = "Выключить этот канал.",
|
||||
["Set"] = "Задать",
|
||||
["Channel %d"] = "Канал %d",
|
||||
["Say"] = "Сказать",
|
||||
["Whisper"] = "Шепот",
|
||||
["Incoming Whisper"] = "Шепот",
|
||||
["Yell"] = "Крикнуть",
|
||||
["Guild"] = "Гильдия",
|
||||
["Party"] = "Группа",
|
||||
["Raid"] = "Рейд",
|
||||
["Raid Leader"] = "Лидер рейда",
|
||||
["Raid Warning"] = "Объявление рейду",
|
||||
["Officer"] = "Офицер",
|
||||
["Battleground"] = "Поле боя",
|
||||
["Battleground Leader"] = "Лидер поля боя",
|
||||
["%s settings."] = "Настройки канала \"%s\".",
|
||||
["Use a custom replacement for the chat %s text."] = "Использовать заданную замену текста %s канала.",
|
||||
["Show Space"] = "Показывать пробел",
|
||||
["Toggle adding space after channel replacement."] = "Вкл/Выкл добавление пробела после замены канала.",
|
||||
["Show Colon"] = "Показывать двоеточие",
|
||||
["Toggle adding colon after channel replacement."] = "Вкл/Выкл добавление двоеточия после замены канала.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["ChannelNames"] = "频道名称",
|
||||
["Channel name abbreviation options."] = "频道名称缩写选项。",
|
||||
["Replace"] = "替换",
|
||||
["Toggle replacing this channel."] = "替换频道。",
|
||||
["Off"] = "关闭",
|
||||
["Turn off this channel."] = "关闭此频道。",
|
||||
["Set"] = "设置",
|
||||
["Channel %d"] = "频道 %d",
|
||||
["Say"] = "说",
|
||||
["Whisper"] = "密语",
|
||||
["Incoming Whisper"] = "密语回复",
|
||||
["Yell"] = "喊",
|
||||
["Guild"] = "公会",
|
||||
["Party"] = "队伍",
|
||||
["Raid"] = "团队",
|
||||
["Raid Leader"] = "团队领袖",
|
||||
["Raid Warning"] = "团队报警",
|
||||
["Officer"] = "官员",
|
||||
["Battleground"] = "战场",
|
||||
["Battleground Leader"] = "战场领袖",
|
||||
["%s settings."] = "%s 设置。",
|
||||
["Use a custom replacement for the chat %s text."] = "自定义替换此聊天 %s 文本。",
|
||||
["Show Space"] = "显示间隔",
|
||||
["Toggle adding space after channel replacement."] = "切换频道替换后增加间隔空间。",
|
||||
["Show Colon"] = "显示冒号",
|
||||
["Toggle adding colon after channel replacement."] = "切换频道替换后增加冒号。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["ChannelNames"] = "채널명",
|
||||
["Channel name abbreviation options."] = "채널명 생략 설정입니다.",
|
||||
["Replace"] = "대체",
|
||||
["Toggle replacing this channel."] = "해당 채널 대체를 전환합니다.",
|
||||
["Off"] = "끔",
|
||||
["Turn off this channel."] = "해당 채널를 끕니다.",
|
||||
["Set"] = "설정",
|
||||
["Channel %d"] = "채널 %d",
|
||||
["Say"] = "일반",
|
||||
["Whisper"] = "귓속말",
|
||||
["Incoming Whisper"] = "보낸 귓속말",
|
||||
["Yell"] = "외침",
|
||||
["Guild"] = "길드",
|
||||
["Party"] = "파티",
|
||||
["Raid"] = "공격대",
|
||||
["Raid Leader"] = "공격대장",
|
||||
["Raid Warning"] = "공격대 경보",
|
||||
["Officer"] = "오피서",
|
||||
["Battleground"] = "전장",
|
||||
["Battleground Leader"] = "전투대장",
|
||||
["%s settings."] = "%s 설정입니다.",
|
||||
["Use a custom replacement for the chat %s text."] = "%s 대화에 사용자 대체를 사용합니다.",
|
||||
["Show Space"] = "간격 표시",
|
||||
["Toggle adding space after channel replacement."] = "채널 대체후 간격 추가를 전환합니다.",
|
||||
["Show Colon"] = "콜론 표시",
|
||||
["Toggle adding colon after channel replacement."] = "채널 대채 후 콜론 추가를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
local chanSave = {}
|
||||
|
||||
Prat_ChannelNames = Prat:NewModule("channelnames")
|
||||
|
||||
function Prat_ChannelNames:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("ChannelNames")
|
||||
Prat:RegisterDefaults("ChannelNames", "profile", {
|
||||
on = true,
|
||||
space = true,
|
||||
colon = true,
|
||||
replace = {
|
||||
say = true,
|
||||
whisper = true,
|
||||
whisperincome = true,
|
||||
yell = true,
|
||||
party = true,
|
||||
guild = true,
|
||||
officer = true,
|
||||
raid = true,
|
||||
raidleader = true,
|
||||
raidwarning = true,
|
||||
battleground = true,
|
||||
battlegroundleader = true,
|
||||
channel1 = true,
|
||||
channel2 = true,
|
||||
channel3 = true,
|
||||
channel4 = true,
|
||||
channel5 = true,
|
||||
channel6 = true,
|
||||
channel7 = true,
|
||||
channel8 = true,
|
||||
channel9 = true,
|
||||
channel10 = true,
|
||||
},
|
||||
shortnames = {
|
||||
say = "[S]",
|
||||
whisper = "[W To]",
|
||||
whisperincome = "[W From]",
|
||||
yell = "[Y]",
|
||||
party = "[P]",
|
||||
guild = "[G]",
|
||||
officer = "[O]",
|
||||
raid = "[R]",
|
||||
raidleader = "[RL]",
|
||||
raidwarning = "[RW]",
|
||||
battleground = "[B]",
|
||||
battlegroundleader = "[BL]",
|
||||
channel1 = "[1]",
|
||||
channel2 = "[2]",
|
||||
channel3 = "[3]",
|
||||
channel4 = "[4]",
|
||||
channel5 = "[5]",
|
||||
channel6 = "[6]",
|
||||
channel7 = "[7]",
|
||||
channel8 = "[8]",
|
||||
channel9 = "[9]",
|
||||
channel10 = "[10]",
|
||||
}
|
||||
})
|
||||
Prat.Options.args.channelnames = {
|
||||
name = L["ChannelNames"],
|
||||
desc = L["Channel name abbreviation options."],
|
||||
type = "group",
|
||||
args = {
|
||||
say = {
|
||||
name = L["Say"],
|
||||
desc = string.format(L["%s settings."], L["Say"]),
|
||||
type = "group",
|
||||
order = 80,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Say"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Say"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.say end,
|
||||
set = function(v) self.db.profile.shortnames.say = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.say end,
|
||||
set = function(v) self.db.profile.replace.say = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.say = "" Prat:Print("Say text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
whisper = {
|
||||
name = L["Whisper"],
|
||||
desc = string.format(L["%s settings."], L["Whisper"]),
|
||||
type = "group",
|
||||
order = 90,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Whisper"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Whisper"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.whisper end,
|
||||
set = function(v) self.db.profile.shortnames.whisper = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.whisper end,
|
||||
set = function(v) self.db.profile.replace.whisper = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.whisper = "" Prat:Print("Whisper text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
whisperincome = {
|
||||
name = L["Incoming Whisper"],
|
||||
desc = string.format(L["%s settings."], L["Incoming Whisper"]),
|
||||
type = "group",
|
||||
order = 100,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Incoming Whisper"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Incoming Whisper"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.whisperincome end,
|
||||
set = function(v) self.db.profile.shortnames.whisperincome = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.whisperincome end,
|
||||
set = function(v) self.db.profile.replace.whisperincome = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.whisperincome = "" Prat:Print("Whisper text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
yell = {
|
||||
name = L["Yell"],
|
||||
desc = string.format(L["%s settings."], L["Yell"]),
|
||||
type = "group",
|
||||
order = 110,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Yell"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Yell"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.yell end,
|
||||
set = function(v) self.db.profile.shortnames.yell = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.yell end,
|
||||
set = function(v) self.db.profile.replace.yell = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.yell = "" Prat:Print("Yell text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
guild = {
|
||||
name = L["Guild"],
|
||||
desc = string.format(L["%s settings."], L["Guild"]),
|
||||
type = "group",
|
||||
order = 120,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Guild"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Guild"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.guild end,
|
||||
set = function(v) self.db.profile.shortnames.guild = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.guild end,
|
||||
set = function(v) self.db.profile.replace.guild = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.guild = "" Prat:Print("Guild text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
party = {
|
||||
name = L["Party"],
|
||||
desc = string.format(L["%s settings."], L["Party"]),
|
||||
type = "group",
|
||||
order = 130,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Party"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Party"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.party end,
|
||||
set = function(v) self.db.profile.shortnames.party = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.party end,
|
||||
set = function(v) self.db.profile.replace.party = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.party = "" Prat:Print("Party text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
raid = {
|
||||
name = L["Raid"],
|
||||
desc = string.format(L["%s settings."], L["Raid"]),
|
||||
type = "group",
|
||||
order = 140,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Raid"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Raid"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.raid end,
|
||||
set = function(v) self.db.profile.shortnames.raid = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.raid end,
|
||||
set = function(v) self.db.profile.replace.raid = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.raid = "" Prat:Print("Raid text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
raidleader = {
|
||||
name = L["Raid Leader"],
|
||||
desc = string.format(L["%s settings."], L["Raid Leader"]),
|
||||
type = "group",
|
||||
order = 150,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Raid Leader"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Raid Leader"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.raidleader end,
|
||||
set = function(v) self.db.profile.shortnames.raidleader = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.raidleader end,
|
||||
set = function(v) self.db.profile.replace.raidleader = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.raidleader = "" Prat:Print("Raid Leader text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
raidwarning = {
|
||||
name = L["Raid Warning"],
|
||||
desc = string.format(L["%s settings."], L["Raid Warning"]),
|
||||
type = "group",
|
||||
order = 160,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Raid Warning"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Raid Warning"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.raidwarning end,
|
||||
set = function(v) self.db.profile.shortnames.raidwarning = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.raidwarning end,
|
||||
set = function(v) self.db.profile.replace.raidwarning = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.raidwarning = "" Prat:Print("Raid Warning text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
officer = {
|
||||
name = L["Officer"],
|
||||
desc = string.format(L["%s settings."], L["Officer"]),
|
||||
type = "group",
|
||||
order = 170,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Officer"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Officer"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.officer end,
|
||||
set = function(v) self.db.profile.shortnames.officer = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.officer end,
|
||||
set = function(v) self.db.profile.replace.officer = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.officer = "" Prat:Print("Officer text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
battleground = {
|
||||
name = L["Battleground"],
|
||||
desc = string.format(L["%s settings."], L["Battleground"]),
|
||||
type = "group",
|
||||
order = 180,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Battleground"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Battleground"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.battleground end,
|
||||
set = function(v) self.db.profile.shortnames.battleground = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.battleground end,
|
||||
set = function(v) self.db.profile.replace.battleground = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.battleground = "" Prat:Print("Battleground text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
battlegroundleader = {
|
||||
name = L["Battleground Leader"],
|
||||
desc = string.format(L["%s settings."], L["Battleground Leader"]),
|
||||
type = "group",
|
||||
order = 190,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Battleground Leader"],
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], L["Battleground Leader"]),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.battlegroundleader end,
|
||||
set = function(v) self.db.profile.shortnames.battlegroundleader = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.battlegroundleader end,
|
||||
set = function(v) self.db.profile.replace.battlegroundleader = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.battlegroundleader = "" Prat:Print("Battleground Leader text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel1 = {
|
||||
name = string.format(L["Channel %d"], 1),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 1)),
|
||||
type = "group",
|
||||
order = 201,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 1),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 1)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel1 end,
|
||||
set = function(v) self.db.profile.shortnames.channel1 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel1 end,
|
||||
set = function(v) self.db.profile.replace.channel1 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel1 = "" Prat:Print("Channel 1 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel2 = {
|
||||
name = string.format(L["Channel %d"], 2),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 2)),
|
||||
type = "group",
|
||||
order = 202,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 2),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 2)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel2 end,
|
||||
set = function(v) self.db.profile.shortnames.channel2 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel2 end,
|
||||
set = function(v) self.db.profile.replace.channel2 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel2 = "" Prat:Print("Channel 2 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel3 = {
|
||||
name = string.format(L["Channel %d"], 3),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 3)),
|
||||
type = "group",
|
||||
order = 203,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 3),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 3)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel3 end,
|
||||
set = function(v) self.db.profile.shortnames.channel3 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel3 end,
|
||||
set = function(v) self.db.profile.replace.channel3 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel3 = "" Prat:Print("Channel 3 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel4 = {
|
||||
name = string.format(L["Channel %d"], 4),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 4)),
|
||||
type = "group",
|
||||
order = 204,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 4),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 4)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel4 end,
|
||||
set = function(v) self.db.profile.shortnames.channel4 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel4 end,
|
||||
set = function(v) self.db.profile.replace.channel4 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel4 = "" Prat:Print("Channel 4 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel5 = {
|
||||
name = string.format(L["Channel %d"], 5),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 5)),
|
||||
type = "group",
|
||||
order = 205,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 5),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 5)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel5 end,
|
||||
set = function(v) self.db.profile.shortnames.channel5 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel5 end,
|
||||
set = function(v) self.db.profile.replace.channel5 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel5 = "" Prat:Print("Channel 5 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel6 = {
|
||||
name = string.format(L["Channel %d"], 6),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 6)),
|
||||
type = "group",
|
||||
order = 206,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 6),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 6)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel6 end,
|
||||
set = function(v) self.db.profile.shortnames.channel6 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel6 end,
|
||||
set = function(v) self.db.profile.replace.channel6 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel6 = "" Prat:Print("Channel 6 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel7 = {
|
||||
name = string.format(L["Channel %d"], 7),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 7)),
|
||||
type = "group",
|
||||
order = 207,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 7),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 7)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel7 end,
|
||||
set = function(v) self.db.profile.shortnames.channel7 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel7 end,
|
||||
set = function(v) self.db.profile.replace.channel7 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel7 = "" Prat:Print("Channel 7 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel8 = {
|
||||
name = string.format(L["Channel %d"], 8),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 8)),
|
||||
type = "group",
|
||||
order = 208,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 8),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 8)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel8 end,
|
||||
set = function(v) self.db.profile.shortnames.channel8 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel8 end,
|
||||
set = function(v) self.db.profile.replace.channel8 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel8 = "" Prat:Print("Channel 8 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel9 = {
|
||||
name = string.format(L["Channel %d"], 9),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 9)),
|
||||
type = "group",
|
||||
order = 209,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 9),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 9)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel9 end,
|
||||
set = function(v) self.db.profile.shortnames.channel9 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel9 end,
|
||||
set = function(v) self.db.profile.replace.channel9 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel9 = "" Prat:Print("Channel 9 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
channel10 = {
|
||||
name = string.format(L["Channel %d"], 10),
|
||||
desc = string.format(L["%s settings."],string.format(L["Channel %d"], 10)),
|
||||
type = "group",
|
||||
order = 210,
|
||||
args = {
|
||||
set = {
|
||||
name = string.format(L["Channel %d"], 10),
|
||||
desc = string.format(L["Use a custom replacement for the chat %s text."], string.format(L["Channel %d"], 10)),
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.shortnames.channel10 end,
|
||||
set = function(v) self.db.profile.shortnames.channel10 = v end
|
||||
},
|
||||
replace = {
|
||||
name = L["Replace"],
|
||||
desc = L["Toggle replacing this channel."],
|
||||
type = "toggle",
|
||||
order = 175,
|
||||
get = function() return self.db.profile.replace.channel10 end,
|
||||
set = function(v) self.db.profile.replace.channel10 = v end,
|
||||
},
|
||||
off = {
|
||||
name = L["Off"],
|
||||
desc = L["Turn off this channel."],
|
||||
type = "execute",
|
||||
order = 200,
|
||||
func = function() self.db.profile.shortnames.channel10 = "" Prat:Print("Channel 10 text now turned off") end
|
||||
}
|
||||
}
|
||||
},
|
||||
spacetoggle = {
|
||||
name = L["Show Space"],
|
||||
desc = L["Toggle adding space after channel replacement."],
|
||||
type = "toggle",
|
||||
order = 230,
|
||||
get = function() return self.db.profile.space end,
|
||||
set = function(v) self.db.profile.space = v end,
|
||||
},
|
||||
colontoggle = {
|
||||
name = L["Show Colon"],
|
||||
desc = L["Toggle adding colon after channel replacement."],
|
||||
type = "toggle",
|
||||
order = 240,
|
||||
get = function() return self.db.profile.colon end,
|
||||
set = function(v) self.db.profile.colon = v end,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 250,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("channelnames"); end,
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_ChannelNames:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:Hook(getglobal("ChatFrame"..i), "AddMessage")
|
||||
end
|
||||
self:saveChanName()
|
||||
self:doReplacement()
|
||||
end
|
||||
|
||||
function Prat_ChannelNames:saveChanName()
|
||||
chanSave["guild"] = CHAT_GUILD_GET
|
||||
chanSave["officer"] = CHAT_OFFICER_GET
|
||||
chanSave["party"] = CHAT_PARTY_GET
|
||||
chanSave["raid"] = CHAT_RAID_GET
|
||||
chanSave["raidleader"] = CHAT_RAID_LEADER_GET
|
||||
chanSave["raidwarning"] = CHAT_RAID_WARNING_GET
|
||||
chanSave["battleground"] = CHAT_BATTLEGROUND_GET
|
||||
chanSave["battlegroundleader"] = CHAT_BATTLEGROUND_LEADER_GET
|
||||
chanSave["say"] = CHAT_SAY_GET
|
||||
chanSave["whisperincome"] = CHAT_WHISPER_GET
|
||||
chanSave["whisper"] = CHAT_WHISPER_INFORM_GET
|
||||
chanSave["yell"] = CHAT_YELL_GET
|
||||
end
|
||||
|
||||
function Prat_ChannelNames:doReplacement()
|
||||
local replace = self.db.profile.replace
|
||||
local shortnames = self.db.profile.shortnames
|
||||
local space = self.db.profile.space and " " or ""
|
||||
local colon = self.db.profile.colon and ":" or ""
|
||||
local default = space .. "%s" .. colon .. "\32"
|
||||
|
||||
CHAT_CHANNEL_GET = "%s" .. colon .. "\32";
|
||||
|
||||
CHAT_GUILD_GET = replace["guild"] and (shortnames["guild"] .. default) or chanSave["guild"];
|
||||
CHAT_OFFICER_GET = replace["officer"] and (shortnames["officer"] .. default) or chanSave["officer"]
|
||||
|
||||
CHAT_PARTY_GET = replace["party"] and (shortnames["party"] .. default) or chanSave["party"]
|
||||
CHAT_RAID_GET = replace["raid"] and (shortnames["raid"] .. default) or chanSave["raid"]
|
||||
CHAT_RAID_LEADER_GET = replace["raidleader"] and (shortnames["raidleader"] .. default) or chanSave["raidleader"]
|
||||
CHAT_RAID_WARNING_GET = replace["raidwarning"] and (shortnames["raidwarning"] .. default) or chanSave["raidwarning"]
|
||||
CHAT_BATTLEGROUND_GET = replace["battleground"] and (shortnames["battleground"] .. default) or chanSave["battleground"]
|
||||
CHAT_BATTLEGROUND_LEADER_GET = replace["battlegroundleader"] and (shortnames["battlegroundleader"] .. default) or chanSave["battlegroundleader"]
|
||||
|
||||
CHAT_SAY_GET = replace["say"] and (shortnames["say"] .. default) or chanSave["say"]
|
||||
CHAT_WHISPER_GET = replace["whisperincome"] and (shortnames["whisperincome"] .. default) or chanSave["whisperincome"]
|
||||
CHAT_WHISPER_INFORM_GET = replace["whisper"] and (shortnames["whisper"] .. default) or chanSave["whisper"]
|
||||
CHAT_YELL_GET = replace["yell"] and (shortnames["yell"] .. default) or chanSave["yell"]
|
||||
|
||||
-- CHAT_AFK_GET = replace[""] and (shortnames["] .. "%s is Away From Keyboard" .. colon .. "\32";
|
||||
|
||||
-- CHAT_CHANNEL_JOIN_GET = replace[""] and (shortnames["] .. "%s joined channel."; -- another player joined
|
||||
-- CHAT_CHANNEL_LEAVE_GET = replace[""] and (shortnames["] .. "%s left channel."; -- another player left
|
||||
-- CHAT_CHANNEL_LIST_GET = replace[""] and (shortnames["] .. "[%s]\32"; -- Channel user list, user list is the "message", this is the channel name.
|
||||
|
||||
-- CHAT_CHANNEL_SEND = "[%d. %s]" .. colon .. "\32";
|
||||
|
||||
-- CHAT_GUILD_SEND = "Guild" .. colon .. "\32"; -- Chat message to your guild
|
||||
-- CHAT_OFFICER_SEND = "Officer" .. colon .. "\32"; -- Chat message to officers in your guild
|
||||
-- CHAT_PARTY_SEND = "Party" .. colon .. "\32"; -- Chat message to your party
|
||||
-- CHAT_RAID_SEND = "Raid" .. colon .. "\32"; -- Chat message to your raid
|
||||
-- CHAT_RAID_WARNING_SEND = "Raid Warning" .. colon .. "\32";
|
||||
-- CHAT_BATTLEGROUND_SEND = "Battleground" .. colon .. "\32";
|
||||
|
||||
-- CHAT_SAY_SEND = "Say" .. colon .. "\32"; -- Normal chat message
|
||||
-- CHAT_WHISPER_SEND = "Tell %s" .. colon .. "\32"; -- Whisper to a particular player
|
||||
-- CHAT_YELL_SEND = "Yell" .. colon .. "\32"; -- Yell a message
|
||||
end
|
||||
|
||||
function Prat_ChannelNames:AddMessage(frame, text, ...)
|
||||
self:doReplacement()
|
||||
if text then
|
||||
local pattern = "%]%s+(.*|Hplayer)"
|
||||
local channel = string.gsub(text, ".*%[(.-)" .. pattern ..".+", "%1")
|
||||
if string.find(channel, "%d+%. ") then
|
||||
channel = string.gsub(channel, "(%d+)%..*", "channel%1")
|
||||
pattern = "%[%d+%..-" .. pattern
|
||||
end
|
||||
if ( self.db.profile.replace[channel] ) then
|
||||
local replacement = self.db.profile.shortnames[channel]
|
||||
if replacement then
|
||||
if ( (not(replacement == "")) and self.db.profile.space ) then replacement = replacement .. " " end
|
||||
text = string.gsub(text, pattern, replacement .. "%1")
|
||||
end
|
||||
end
|
||||
end
|
||||
self.hooks[frame].AddMessage(frame, text, unpack(arg))
|
||||
end
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
--[[
|
||||
Name: Prat_ChannelSeparator
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#ChannelSeparator
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that separates chat channels in the chat setting menu.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratChannelSeparator")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["ChannelSeparator"] = true,
|
||||
["Separates chat channels in chat setting menu."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["ChannelSeparator"] = "ChannelSeparator",
|
||||
["Separates chat channels in chat setting menu."] = "Разделять каналы чата в меню настроек чата.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["ChannelSeparator"] = "频道分离",
|
||||
["Separates chat channels in chat setting menu."] = "分离聊天频道设置菜单。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["ChannelSeparator"] = "채널구분",
|
||||
["Separates chat channels in chat setting menu."] = "대화 설정 메뉴에 대화 채널을 구분합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기 전환",
|
||||
} end)
|
||||
|
||||
Prat_ChannelSeparator = Prat:NewModule("channelseparator")
|
||||
|
||||
function Prat_ChannelSeparator:OnInitialize()
|
||||
self.OriginalChatTypeGroup = {}
|
||||
self.OriginalChannelMenuChatTypeGroups = {}
|
||||
self.db = Prat:AcquireDBNamespace("ChannelSeparator")
|
||||
Prat:RegisterDefaults("ChannelSeparator", "profile", {
|
||||
on = true,
|
||||
})
|
||||
Prat.Options.args.channelseparator = {
|
||||
name = L["ChannelSeparator"],
|
||||
desc = L["Separates chat channels in chat setting menu."],
|
||||
type = "group",
|
||||
args = {
|
||||
Toggle = {
|
||||
type = "toggle",
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("channelseparator") end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_ChannelSeparator:OnEnable()
|
||||
self.OriginalChatTypeGroup = ChatTypeGroup
|
||||
ChatTypeGroup["GUILD"] = {
|
||||
"CHAT_MSG_GUILD",
|
||||
"GUILD_MOTD",
|
||||
};
|
||||
ChatTypeGroup["OFFICER"] = {
|
||||
"CHAT_MSG_OFFICER",
|
||||
};
|
||||
ChatTypeGroup["PARTY"] = {
|
||||
"CHAT_MSG_PARTY",
|
||||
};
|
||||
ChatTypeGroup["RAID"] = {
|
||||
"CHAT_MSG_RAID",
|
||||
"CHAT_MSG_RAID_LEADER",
|
||||
"CHAT_MSG_RAID_WARNING",
|
||||
};
|
||||
ChatTypeGroup["BATTLEGROUND"] = {
|
||||
"CHAT_MSG_BATTLEGROUND",
|
||||
"CHAT_MSG_BATTLEGROUND_LEADER",
|
||||
};
|
||||
self.OriginalChannelMenuChatTypeGroups = ChannelMenuChatTypeGroups
|
||||
ChannelMenuChatTypeGroups = {};
|
||||
ChannelMenuChatTypeGroups[1] = "SAY";
|
||||
ChannelMenuChatTypeGroups[2] = "YELL";
|
||||
ChannelMenuChatTypeGroups[3] = "GUILD";
|
||||
ChannelMenuChatTypeGroups[4] = "OFFICER";
|
||||
ChannelMenuChatTypeGroups[5] = "WHISPER";
|
||||
ChannelMenuChatTypeGroups[6] = "PARTY";
|
||||
ChannelMenuChatTypeGroups[7] = "RAID";
|
||||
ChannelMenuChatTypeGroups[8] = "BATTLEGROUND";
|
||||
end
|
||||
|
||||
function Prat_ChannelSeparator:OnDisable()
|
||||
ChatTypeGroup = {}
|
||||
ChatTypeGroup = self.OriginalChatTypeGroup
|
||||
ChannelMenuChatTypeGroups = {}
|
||||
ChannelMenuChatTypeGroups = self.OriginalChannelMenuChatTypeGroups
|
||||
end
|
||||
Executable
+410
@@ -0,0 +1,410 @@
|
||||
---------------------------------------------------------------------------------
|
||||
--
|
||||
-- Prat - A framework for World of Warcraft chat mods
|
||||
--
|
||||
-- Copyright (C) 2006-2007 Prat Development Team
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to:
|
||||
--
|
||||
-- Free Software Foundation, Inc.,
|
||||
-- 51 Franklin Street, Fifth Floor,
|
||||
-- Boston, MA 02110-1301, USA.
|
||||
--
|
||||
--
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
Name: PratChatTabs
|
||||
Revision: $Revision: 25896 $
|
||||
Author(s): Sylvanaar (sylvanaar@mindspring.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#ChatTabs
|
||||
Subversion: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Discussions: http://groups.google.com/group/wow-prat
|
||||
Issues and feature requests: http://code.google.com/p/prat/issues/list
|
||||
Description: Module for Prat that adds chat window tab options.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
-- set prat module name
|
||||
|
||||
-- define localized strings
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratChatTabs")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["ChatTabs"] = true,
|
||||
["Chat window tab options."] = true,
|
||||
["SetMode"] = true,
|
||||
["Toggle mode"] = true,
|
||||
["SetAll"] = true,
|
||||
["Set chat tabs for all windows."] = true,
|
||||
["Individual"] = true,
|
||||
["Toggle chat tabs for each window."] = true,
|
||||
["Chat%dTab"] = true,
|
||||
["Toggles chat tab options for chat window %d."] = true,
|
||||
["Active Alpha"] = true,
|
||||
["Sets alpha of chat tab for active chat frame."] = true,
|
||||
["Not Active Alpha"] = true,
|
||||
["Sets alpha of chat tab for not active chat frame."] = true,
|
||||
["All"] = true,
|
||||
["Individual"] = true,
|
||||
["Always Visible"] = true,
|
||||
["Hidden"] = true,
|
||||
["Default"] = true,
|
||||
["Flash Selected Tab"] = true,
|
||||
["Toggle flashing the active chat tab on whispers."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
["Set chattab on login"] = true,
|
||||
["Set number of chattab to show on login."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["ChatTabs"] = "Закладки",
|
||||
["Chat window tab options."] = "Настройки закладок окошек чата",
|
||||
["SetMode"] = "Установка мода",
|
||||
["Toggle mode"] = "Переключение мода",
|
||||
["SetAll"] = "Включить все",
|
||||
["Set chat tabs for all windows."] = "Установить для всех закладок",
|
||||
["Individual"] = "Индивидуально",
|
||||
["Toggle chat tabs for each window."] = "Установить для каждой закладки",
|
||||
["Chat%dTab"] = "Закладка%d",
|
||||
["Toggles chat tab options for chat window %d."] = "Переключить настройки закладки для окна %d",
|
||||
["Active Alpha"] = "Прозрачность Активного",
|
||||
["Sets alpha of chat tab for active chat frame."] = "Установить прозрачность закладки активного окна",
|
||||
["Not Active Alpha"] = "Прозрачность НеАктивного",
|
||||
["Sets alpha of chat tab for not active chat frame."] = "Установить прозрачность закладки не активного окна",
|
||||
["All"] = "Все",
|
||||
["Individual"] = "Индивидуально",
|
||||
["Always Visible"] = "Всегда видимое",
|
||||
["Hidden"] = "Скрытое",
|
||||
["Default"] = "По умолчанию",
|
||||
["Flash Selected Tab"] = "Мерцание",
|
||||
["Toggle flashing the active chat tab on whispers."] = "Переключение мерцания закладки при личных сообщениях",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
["Set chattab on login"] = "Показать чат после входа",
|
||||
["Set number of chattab to show on login."] = "Установить номер чата который показать после входа",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["ChatTabs"] = "대화탭",
|
||||
["Chat window tab options."] = "대화탭 설정",
|
||||
["SetMode"] = "모드설정",
|
||||
["Toggle mode"] = "모드 전환",
|
||||
["SetAll"] = "모두설정",
|
||||
["Set chat tabs for all windows."] = "모든 창에대한 대화탭을 설정합니다.",
|
||||
["Individual"] = "개별",
|
||||
["Toggle chat tabs for each window."] = "각 창에 대한 대화 탭을 전환합니다.",
|
||||
["Chat%dTab"] = "대화%d탭",
|
||||
["Toggles chat tab options for chat window %d."] = "%d 대화창에 대한 대화탭 설정을 전환합니다.",
|
||||
["Active Alpha"] = "활성화 투명도",
|
||||
["Sets alpha of chat tab for active chat frame."] = "활성화된 대화창에 대한 대화탭의 투명도를 설정합니다.",
|
||||
["Not Active Alpha"] = "비활성화 투명도",
|
||||
["Sets alpha of chat tab for not active chat frame."] = "비활성화 대화창에 대한 대화탭의 투명도를 설정합니다.",
|
||||
["All"] = "모두",
|
||||
["Individual"] = "개별",
|
||||
["Always Visible"] = "항상 표시",
|
||||
["Hidden"] = "숨김",
|
||||
["Default"] = "기본값",
|
||||
["Flash Selected Tab"] = "선택된 탭 강조",
|
||||
["Toggle flashing the active chat tab on whispers."] = "귓속말시 활성화된 대화탭 강조를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
["Set chattab on login"] = true,
|
||||
["Set number of chattab to show on login."] = true,
|
||||
} end)
|
||||
|
||||
-- create prat module
|
||||
Prat_ChatTabs = Prat:NewModule("tabs")
|
||||
--Prat_ChatTabs.revision = tonumber(string.sub("$Revision: 25896 $", 12, -3))
|
||||
|
||||
|
||||
-- define the default db values
|
||||
function Prat_ChatTabs:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("ChatTabs")
|
||||
Prat:RegisterDefaults("ChatTabs", "profile", {
|
||||
on = false,
|
||||
notactivealpha = 0.5,
|
||||
activealpha = 1,
|
||||
mode = "ALL",
|
||||
cf = {"ALWAYS", "ALWAYS", "ALWAYS", "ALWAYS", "ALWAYS", "ALWAYS", "ALWAYS"},
|
||||
cfall = "ALWAYS",
|
||||
flashselected = false,
|
||||
showonlogin = 1,
|
||||
})
|
||||
Prat.Options.args.tabs = {
|
||||
name = L["ChatTabs"],
|
||||
desc = L["Chat window tab options."],
|
||||
type = "group",
|
||||
args = {
|
||||
mode = {
|
||||
name = L["SetMode"],
|
||||
desc = L["Toggle mode"],
|
||||
type = "text",
|
||||
order = 100,
|
||||
get = function() return self.db.profile.mode end,
|
||||
set = function(v) self.db.profile.mode = v self:OnUpdate() end,
|
||||
validate = {["ALL"] = L["All"], ["INDIVIDUAL"] = L["Individual"]},
|
||||
},
|
||||
all = {
|
||||
name = L["SetAll"],
|
||||
desc = L["Set chat tabs for all windows."],
|
||||
type = "text",
|
||||
disabled = function() if self.db.profile.mode == "INDIVIDUAL" then return true else return false end end,
|
||||
order = 110,
|
||||
get = function() return self.db.profile.cfall end,
|
||||
set = function(v) self.db.profile.cfall = v self:OnUpdate() end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"]},
|
||||
},
|
||||
individual = {
|
||||
name = L["Individual"],
|
||||
desc = L["Toggle chat tabs for each window."],
|
||||
type = "group",
|
||||
disabled = function() if self.db.profile.mode == "ALL" then return true else return false end end,
|
||||
order = 120,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dTab"], 1),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 1),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[1] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[1] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[1] == "DEFAULT" then
|
||||
getglobal("ChatFrame1Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dTab"], 2),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 2),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[2] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[2] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[2] == "DEFAULT" then
|
||||
getglobal("ChatFrame2Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dTab"], 3),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 3),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[3] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[3] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[3] == "DEFAULT" then
|
||||
getglobal("ChatFrame3Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dTab"], 4),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 4),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[4] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[4] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[4] == "DEFAULT" then
|
||||
getglobal("ChatFrame4Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dTab"], 5),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 5),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[5] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[5] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[5] == "DEFAULT" then
|
||||
getglobal("ChatFrame5Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dTab"], 6),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 6),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[6] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[6] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[6] == "DEFAULT" then
|
||||
getglobal("ChatFrame6Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dTab"], 7),
|
||||
desc = string.format(L["Toggles chat tab options for chat window %d."], 7),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.cf[7] end,
|
||||
set = function(v)
|
||||
self.db.profile.cf[7] = v
|
||||
self:OnUpdate()
|
||||
if self.db.profile.cf[7] == "DEFAULT" then
|
||||
getglobal("ChatFrame7Tab"):Hide()
|
||||
end
|
||||
end,
|
||||
validate = {["ALWAYS"] = L["Always Visible"], ["HIDDEN"] = L["Hidden"], ["DEFAULT"] = L["Default"]},
|
||||
},
|
||||
},
|
||||
},
|
||||
activealpha = {
|
||||
name = L["Active Alpha"],
|
||||
desc = L["Sets alpha of chat tab for active chat frame."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.activealpha end,
|
||||
set = function(v) self.db.profile.activealpha = v self:OnUpdate() end,
|
||||
min = 0.1,
|
||||
max = 1,
|
||||
step = 0.1,
|
||||
order = 200,
|
||||
},
|
||||
notactivealpha = {
|
||||
name = L["Not Active Alpha"],
|
||||
desc = L["Sets alpha of chat tab for not active chat frame."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.notactivealpha end,
|
||||
set = function(v) self.db.profile.notactivealpha = v self:OnUpdate() end,
|
||||
min = 0.1,
|
||||
max = 1,
|
||||
step = 0.1,
|
||||
order = 210,
|
||||
},
|
||||
flashselected = {
|
||||
name = L["Flash Selected Tab"],
|
||||
desc = L["Toggle flashing the active chat tab on whispers."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.flashselected end,
|
||||
set = function(v) self.db.profile.flashselected = v Prat_ChatTabs:HookFlash() end,
|
||||
order = 211
|
||||
},
|
||||
showonlogin = {
|
||||
name = L["Set chattab on login"],
|
||||
desc = L["Set number of chattab to show on login."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.showonlogin end,
|
||||
set = function(v) self.db.profile.showonlogin = v end,
|
||||
min = 1,
|
||||
max = 7,
|
||||
step = 1,
|
||||
order = 212,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 400,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("tabs") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
--[[------------------------------------------------
|
||||
Module Event Functions
|
||||
------------------------------------------------]]--
|
||||
|
||||
-- things to do when the module is enabled
|
||||
function Prat_ChatTabs:OnEnable()
|
||||
self:SecureHook("FCF_OnUpdate", "OnUpdate")
|
||||
self:HookFlash()
|
||||
local frame = getglobal("ChatFrame"..(self.db.profile.showonlogin or 1));
|
||||
SELECTED_CHAT_FRAME = frame
|
||||
FCF_SelectDockFrame(frame)
|
||||
self:OnUpdate()
|
||||
end
|
||||
|
||||
-- things to do when the module is enabled
|
||||
function Prat_ChatTabs:OnDisable()
|
||||
if self:IsHooked("FCF_OnUpdate") then
|
||||
self:Unhook("FCF_OnUpdate")
|
||||
end
|
||||
end
|
||||
|
||||
--[[------------------------------------------------
|
||||
Core Functions
|
||||
------------------------------------------------]]--
|
||||
|
||||
function Prat_ChatTabs:HookFlash()
|
||||
if self.db.profile.flashselected then
|
||||
if not self:IsHooked("FCF_FlashTab") then
|
||||
self:SecureHook("FCF_FlashTab")
|
||||
end
|
||||
else
|
||||
if self:IsHooked("FCF_FlashTab") then
|
||||
self:Unhook("FCF_FlashTab")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_ChatTabs:OnUpdate(elapsed)
|
||||
if self.db.profile.on then
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
local cftab = getglobal("ChatFrame"..i.."Tab")
|
||||
if getglobal("ChatFrame"..i):IsVisible() or getglobal("ChatFrame"..i).isDocked then
|
||||
if self.db.profile.mode == "ALL" then
|
||||
if SELECTED_CHAT_FRAME:GetID() == i then
|
||||
cftab:SetAlpha(self.db.profile.activealpha)
|
||||
else
|
||||
cftab:SetAlpha(self.db.profile.notactivealpha)
|
||||
end
|
||||
if self.db.profile.cfall == "ALWAYS" then
|
||||
cftab:Show()
|
||||
elseif self.db.profile.cfall == "HIDDEN" then
|
||||
cftab:Hide()
|
||||
end
|
||||
else
|
||||
if SELECTED_CHAT_FRAME:GetID() == i then
|
||||
cftab:SetAlpha(self.db.profile.activealpha)
|
||||
else
|
||||
cftab:SetAlpha(self.db.profile.notactivealpha)
|
||||
end
|
||||
if self.db.profile.cf[i] == "ALWAYS" then
|
||||
cftab:Show()
|
||||
elseif self.db.profile.cf[i] == "HIDDEN" then
|
||||
cftab:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_ChatTabs:FCF_FlashTab()
|
||||
local tabFlash = getglobal(this:GetName().."TabFlash");
|
||||
if ( not this.isDocked or UIFrameIsFlashing(tabFlash) ) then
|
||||
return;
|
||||
end
|
||||
tabFlash:Show();
|
||||
UIFrameFlash(tabFlash, 0.25, 0.25, 60, nil, 0.5, 0.5);
|
||||
end
|
||||
Executable
+312
@@ -0,0 +1,312 @@
|
||||
--[[
|
||||
Name: Prat_Editbox
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_Editbox by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Editbox
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds editbox options.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratEditbox")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Editbox"] = true,
|
||||
["Editbox options."] = true,
|
||||
["Alpha"] = true,
|
||||
["Set the alpha of the editbox."] = true,
|
||||
["Position"] = true,
|
||||
["Set position of editbox."] = true,
|
||||
["Width"] = true,
|
||||
["Set the width of the editbox."] = true,
|
||||
["Locked"] = true,
|
||||
["Lock editbox position is undocked."] = true,
|
||||
["Arrowkeys"] = true,
|
||||
["Toggle using arrowkeys in editbox without the alt key."] = true,
|
||||
["Sticky"] = true,
|
||||
["Toggle text clearing when editbox is closed."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Editbox"] = "Editbox",
|
||||
["Editbox options."] = "Настройки поля ввода.",
|
||||
["Alpha"] = "Альфа",
|
||||
["Set the alpha of the editbox."] = "Установить альфа в поле ввода.",
|
||||
["Position"] = "Позиция",
|
||||
["Set position of editbox."] = "Установить положение поля ввода.",
|
||||
["Width"] = "Ширина",
|
||||
["Set the width of the editbox."] = "Установить ширину поля ввода.",
|
||||
["Locked"] = "Заблокировать",
|
||||
["Lock editbox position is undocked."] = "Поле ввода будет отстыковано.",
|
||||
["Arrowkeys"] = "Стрелки",
|
||||
["Toggle using arrowkeys in editbox without the alt key."] = "Переключение поля ввода с помощью стрелок, без кнопки alt.",
|
||||
["Sticky"] = "Липкий",
|
||||
["Toggle text clearing when editbox is closed."] = "Вкл/Выкл очистку текста когда поле ввода закрыто.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Editbox"] = "输入框",
|
||||
["Editbox options."] = "输入框选项。",
|
||||
["Alpha"] = "透明度",
|
||||
["Set the alpha of the editbox."] = "设置输入框透明度。",
|
||||
["Position"] = "位置",
|
||||
["Set position of editbox."] = "设置输入框位置。",
|
||||
["Width"] = "宽度",
|
||||
["Set the width of the editbox."] = "设置输入框宽度。",
|
||||
["Locked"] = "锁定",
|
||||
["Lock editbox position is undocked."] = "锁定输入框位置。",
|
||||
["Arrowkeys"] = "方向键",
|
||||
["Toggle using arrowkeys in editbox without the alt key."] = "激活输入框使用方向键不带Alt键功能。",
|
||||
["Sticky"] = "粘滞",
|
||||
["Toggle text clearing when editbox is closed."] = "激活当聊天框关闭时清除文本。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Editbox"] = "입력창",
|
||||
["Editbox options."] = "입력창 설정입니다.",
|
||||
["Alpha"] = "투명도",
|
||||
["Set the alpha of the editbox."] = "입력창의 투명도를 설정합니다.",
|
||||
["Position"] = "위치",
|
||||
["Set position of editbox."] = "입력창의 위치를 설정합니다.",
|
||||
["Width"] = "넓이",
|
||||
["Set the width of the editbox."] = "입력창의 넓이를 설정합니다.",
|
||||
["Locked"] = "고정",
|
||||
["Lock editbox position is undocked."] = "입력창 위치를 고정시킵니다.",
|
||||
["Arrowkeys"] = "방향키",
|
||||
["Toggle using arrowkeys in editbox without the alt key."] = " ALT키를 누르지 않고 입력창에 방향키 사용을 전환합니다.",
|
||||
["Sticky"] = "고정",
|
||||
["Toggle text clearing when editbox is closed."] = "입력창을 닫았을 때 텍스트 초기화를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Editbox = Prat:NewModule("editbox")
|
||||
|
||||
function Prat_Editbox:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Editbox")
|
||||
Prat:RegisterDefaults("Editbox", "profile", {
|
||||
on = true,
|
||||
alpha = 1,
|
||||
position = "TOP",
|
||||
width = 400,
|
||||
undocked = {point = "CENTER", relativeTo="UIParent", relativePoint = "CENTER", xoff = 0, yoff = 0},
|
||||
locked = false,
|
||||
sticky = false,
|
||||
arrowkeys = true
|
||||
})
|
||||
Prat.Options.args.editbox = {
|
||||
name = L["Editbox"],
|
||||
desc = L["Editbox options."],
|
||||
type = "group",
|
||||
args = {
|
||||
alpha = {
|
||||
name = L["Alpha"],
|
||||
desc = L["Set the alpha of the editbox."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.alpha end,
|
||||
set = function(v)
|
||||
self.db.profile.alpha = v
|
||||
self:Alpha(v)
|
||||
end,
|
||||
min = 0,
|
||||
max = 1,
|
||||
step = 0.05,
|
||||
order = 195
|
||||
},
|
||||
position = {
|
||||
name = L["Position"],
|
||||
desc = L["Set position of editbox."],
|
||||
type = "text",
|
||||
get = function() return self.db.profile.position end,
|
||||
set = function(v)
|
||||
self.db.profile.position = v
|
||||
self:Position(v)
|
||||
end,
|
||||
validate = {["TOP"] = "Top", ["BOTTOM"] = "Bottom", ["UNDOCKED"] = "Undocked"},
|
||||
order = 196
|
||||
},
|
||||
width = {
|
||||
name = L["Width"],
|
||||
desc = L["Set the width of the editbox."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.width end,
|
||||
set = function(v)
|
||||
self.db.profile.width = v
|
||||
self:Position(self.db.profile.position)
|
||||
end,
|
||||
min = 267,
|
||||
max = 800,
|
||||
step = 1,
|
||||
disabled = function() if self.db.profile.position == "UNDOCKED" then return false else return true end end,
|
||||
order = 197
|
||||
},
|
||||
locked = {
|
||||
name = L["Locked"],
|
||||
desc = L["Lock editbox position is undocked."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.locked end,
|
||||
set = function(v)
|
||||
self.db.profile.locked = v
|
||||
self:Position(self.db.profile.position)
|
||||
end,
|
||||
disabled = function() if self.db.profile.position == "UNDOCKED" then return false else return true end end,
|
||||
order = 198
|
||||
},
|
||||
arrowkeys = {
|
||||
name = L["Arrowkeys"],
|
||||
desc = L["Toggle using arrowkeys in editbox without the alt key."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.arrowkeys end,
|
||||
set = function(v)
|
||||
self.db.profile.arrowkeys = v
|
||||
self:ArrowKeys(v)
|
||||
end,
|
||||
order = 199
|
||||
},
|
||||
sticky = {
|
||||
name = L["Sticky"],
|
||||
desc = L["Toggle text clearing when editbox is closed."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.sticky end,
|
||||
set = function(v)
|
||||
self.db.profile.sticky = v
|
||||
self:Sticky(v)
|
||||
end,
|
||||
order = 200
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("editbox") end,
|
||||
order = 201
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Editbox:OnEnable()
|
||||
self:Position(self.db.profile.position)
|
||||
self:Alpha(self.db.profile.alpha)
|
||||
self:ArrowKeys(self.db.profile.arrowkeys)
|
||||
self:Sticky(self.db.profile.sticky)
|
||||
end
|
||||
|
||||
function Prat_Editbox:OnDisable()
|
||||
self:Position("BOTTOM")
|
||||
self:Alpha(1)
|
||||
self:ArrowKeys(false)
|
||||
self:Sticky(false)
|
||||
end
|
||||
|
||||
function Prat_Editbox:Alpha(value)
|
||||
local eb = VisorEditbox or ChatFrameEditBox
|
||||
for i,v in ipairs({eb:GetRegions()}) do
|
||||
if i==6 or i==7 or i==8 then
|
||||
v:SetAlpha(value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Editbox:ArrowKeys(enabled)
|
||||
local eb = VisorEditBox or ChatFrameEditBox
|
||||
if enabled then eb:SetAltArrowKeyMode(false) else eb:SetAltArrowKeyMode(true) end
|
||||
end
|
||||
|
||||
function Prat_Editbox:Position(option)
|
||||
local eb = VisorEditBox or ChatFrameEditBox
|
||||
eb:ClearAllPoints()
|
||||
if option == "TOP" then
|
||||
eb:SetPoint("BOTTOMLEFT", "ChatFrame1", "TOPLEFT", -5, 0)
|
||||
eb:SetPoint("BOTTOMRIGHT", "ChatFrame1", "TOPRIGHT", 5, 0)
|
||||
end
|
||||
if option == "BOTTOM" then
|
||||
eb:SetPoint("TOPLEFT", "ChatFrame1", "BOTTOMLEFT", -5, 0)
|
||||
eb:SetPoint("TOPRIGHT", "ChatFrame1", "BOTTOMRIGHT", 5, 0)
|
||||
end
|
||||
if option == "UNDOCKED" then
|
||||
eb:SetMovable(true)
|
||||
eb:EnableMouse(true)
|
||||
eb:RegisterForDrag("LeftButton")
|
||||
eb:SetScript("OnDragStart", function() if not self.db.profile.locked then eb:StartMoving() end end)
|
||||
eb:SetScript("OnDragStop", function()
|
||||
eb:StopMovingOrSizing()
|
||||
local point, relativeTo, relativePoint, xoff, yoff = eb:GetPoint()
|
||||
self.db.profile.undocked.point = point
|
||||
-- self.db.profile.undocked.relativeTo = relativeTo:GetName() -- this causes game crash, keep commented out
|
||||
self.db.profile.undocked.relativePoint = relativePoint
|
||||
self.db.profile.undocked.xoff = xoff
|
||||
self.db.profile.undocked.yoff = yoff
|
||||
end)
|
||||
eb:SetPoint(self.db.profile.undocked.point, self.db.profile.undocked.relativeTo, self.db.profile.undocked.relativePoint, self.db.profile.undocked.xoff, self.db.profile.undocked.yoff)
|
||||
eb:SetWidth(self.db.profile.width)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Editbox:Sticky(enabled)
|
||||
if not enabled then
|
||||
DEFAULT_CHAT_FRAME.editBox:SetScript("OnEscapePressed",
|
||||
function() ChatEdit_OnEscapePressed(this) end
|
||||
)
|
||||
DEFAULT_CHAT_FRAME.editBox:SetScript("OnEnterPressed",
|
||||
function() ChatEdit_OnEnterPressed() end
|
||||
)
|
||||
self:UnhookAll()
|
||||
else
|
||||
DEFAULT_CHAT_FRAME.editBox:SetScript("OnEscapePressed",
|
||||
function()
|
||||
this.oldText = this:GetText()
|
||||
this.oldChatType = this.chatType
|
||||
ChatEdit_OnEscapePressed(this)
|
||||
end
|
||||
)
|
||||
DEFAULT_CHAT_FRAME.editBox:SetScript("OnEnterPressed",
|
||||
function()
|
||||
this.oldText = nil
|
||||
this.oldChatType = nil
|
||||
ChatEdit_OnEnterPressed()
|
||||
end
|
||||
)
|
||||
self:Hook("ChatFrame_OpenChat",
|
||||
function(text, chatFrame)
|
||||
local editBox = DEFAULT_CHAT_FRAME.editBox
|
||||
if (not chatFrame or chatFrame == DEFAULT_CHAT_FRAME) and text == "" and
|
||||
editBox.oldText and editBox.oldText ~= "" then
|
||||
editBox:SetText(editBox.oldText)
|
||||
editBox.chatType = editBox.oldChatType
|
||||
editBox:Show()
|
||||
else
|
||||
self.hooks["ChatFrame_OpenChat"](text, chatFrame)
|
||||
end
|
||||
end
|
||||
)
|
||||
self:Hook("ChatFrame_ReplyTell",
|
||||
function(chatFrame)
|
||||
if ( not chatFrame ) then
|
||||
chatFrame = DEFAULT_CHAT_FRAME;
|
||||
end
|
||||
chatFrame.editBox.oldText = nil
|
||||
self.hooks["ChatFrame_ReplyTell"](chatFrame)
|
||||
end
|
||||
)
|
||||
self:Hook("ChatFrame_ReplyTell2",
|
||||
function(chatFrame)
|
||||
if ( not chatFrame ) then
|
||||
chatFrame = DEFAULT_CHAT_FRAME;
|
||||
end
|
||||
chatFrame.editBox.oldText = nil
|
||||
self.hooks["ChatFrame_ReplyTell2"](chatFrame)
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
Executable
+182
@@ -0,0 +1,182 @@
|
||||
--[[
|
||||
Name: Prat_Fading
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_DisableFade by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Fading
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds text fading options for chat windows.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratFading")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Fading"] = true,
|
||||
["Chat window text fading options."] = true,
|
||||
["TextFade"] = true,
|
||||
["Set text fading in chat windows on and off."] = true,
|
||||
["Chat%dFading"] = true,
|
||||
["Toggles fading on and off for chat window %d."] = true,
|
||||
["FadeDuration"] = true,
|
||||
["Set duration to show text before fading."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Fading"] = "Fading",
|
||||
["Chat window text fading options."] = "Настройки затухания текста в окне чата.",
|
||||
["TextFade"] = "ЗатуханиеТекста",
|
||||
["Set text fading in chat windows on and off."] = "Вкл/Выкл затухание текста в окне чата.",
|
||||
["Chat%dFading"] = "ЗатуханиеТекста%d",
|
||||
["Toggles fading on and off for chat window %d."] = "Вкл/Выкл затухание в окне чата %d.",
|
||||
["FadeDuration"] = "ПродолжительностьЗатухания",
|
||||
["Set duration to show text before fading."] = "Установить продолжительность отображение текста, прежде чем они исчезнет.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Fading"] = "淡出",
|
||||
["Chat window text fading options."] = "聊天窗口文本淡入淡出选项。",
|
||||
["TextFade"] = "文本淡出",
|
||||
["Set text fading in chat windows on and off."] = "设置聊天窗口是否使用文本淡出。",
|
||||
["Chat%dFading"] = "窗口 %d 淡出",
|
||||
["Toggles fading on and off for chat window %d."] = "切换聊天窗口 %d 文本淡出打开与关闭。",
|
||||
["FadeDuration"] = "时间",
|
||||
["Set duration to show text before fading."] = "设置聊天窗口淡出时间。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Fading"] = "사라짐",
|
||||
["Chat window text fading options."] = "대화창 글자 사라짐 설정입니다.",
|
||||
["TextFade"] = "글자 사라짐",
|
||||
["Set text fading in chat windows on and off."] = "대화창에 글자가 사라지는 것을 켜고 끄기를 전환합니다.",
|
||||
["Chat%dFading"] = "대화창%d 사라짐",
|
||||
["Toggles fading on and off for chat window %d."] = "대화창 %d에 대한 사라짐 켜고 끄기를 전환합니다.",
|
||||
["FadeDuration"] = "사라짐 시간",
|
||||
["Set duration to show text before fading."] = "사라지기 전까지 글자를 표시할 시간을 설정합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Fading = Prat:NewModule("fading")
|
||||
|
||||
function Prat_Fading:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Fading")
|
||||
Prat:RegisterDefaults("Fading", "profile", {
|
||||
on = true,
|
||||
normal = true,
|
||||
textfade = {false, false, false, false, false, false, false},
|
||||
duration = 5
|
||||
})
|
||||
Prat.Options.args.fading = {
|
||||
name = L["Fading"],
|
||||
desc = L["Chat window text fading options."],
|
||||
type = "group",
|
||||
args = {
|
||||
textfade = {
|
||||
name = L["TextFade"],
|
||||
desc = L["Set text fading in chat windows on and off."],
|
||||
type = "group",
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[1] end,
|
||||
set = function(v) self.db.profile.textfade[1] = v; self:Fade(1,v) end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[2] end,
|
||||
set = function(v) self.db.profile.textfade[2] = v; self:Fade(2,v) end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[3] end,
|
||||
set = function(v) self.db.profile.textfade[3] = v; self:Fade(3,v) end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[4] end,
|
||||
set = function(v) self.db.profile.textfade[4] = v; self:Fade(4,v) end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[5] end,
|
||||
set = function(v) self.db.profile.textfade[5] = v; self:Fade(5,v) end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[6] end,
|
||||
set = function(v) self.db.profile.textfade[6] = v; self:Fade(6,v) end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dFading"], 1),
|
||||
desc = string.format(L["Toggles fading on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.textfade[7] end,
|
||||
set = function(v) self.db.profile.textfade[7] = v; self:Fade(7,v) end
|
||||
}
|
||||
}
|
||||
},
|
||||
fadeduration = {
|
||||
name = L["FadeDuration"],
|
||||
desc = L["Set duration to show text before fading."],
|
||||
type = "range",
|
||||
order = 190,
|
||||
get = function() return self.db.profile.duration end,
|
||||
set = function(v) self.db.profile.duration = v end,
|
||||
min = 1,
|
||||
max = 60,
|
||||
step = 1
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("fading") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Fading:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:Fade(i,self.db.profile.textfade[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Fading:OnDisable()
|
||||
for i=1,7 do
|
||||
self:Fade(i,self.db.profile.normal)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Fading:Fade(id,textfade)
|
||||
local cf = getglobal("ChatFrame"..id)
|
||||
if textfade then
|
||||
cf:SetFading(1)
|
||||
cf:SetFadeDuration(self.db.profile.duration)
|
||||
else
|
||||
cf:SetFading(nil)
|
||||
end
|
||||
end
|
||||
Executable
+250
@@ -0,0 +1,250 @@
|
||||
--[[
|
||||
Name: Prat_FontSize
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Inspired by: ChatFrameExtender by Satrina
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#FontSize
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that sets the font size for chat windows (default=12).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratFontSize")
|
||||
|
||||
UNICODEFONT = "Interface\\AddOns\\Prat\\font\\WarSansTT-Bliz-500.ttf"
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["FontSize"] = true,
|
||||
["Chat window font size options."] = true,
|
||||
["SetMode"] = true,
|
||||
["Choose mode for setting font sizes."] = true,
|
||||
["Set"] = true,
|
||||
["Set the font size for each window."] = true,
|
||||
["Chat%dFontSize"] = true,
|
||||
["Sets font size for chat window %d."] = true,
|
||||
["SetAll"] = true,
|
||||
["Sets font size for all chat windows."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
["ChatFont"] = true,
|
||||
["Choose Default WOW font or UNICODE."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["FontSize"] = "FontSize",
|
||||
["Chat window font size options."] = "Опции размера шрифта окна чата.",
|
||||
["SetMode"] = "УстановитьРежим",
|
||||
["Choose mode for setting font sizes."] = "Выберите режим для настройки размера шрифта.",
|
||||
["Set"] = "Установить",
|
||||
["Set the font size for each window."] = "Установить размер шрифта для всех окон.",
|
||||
["Chat%dFontSize"] = "РазмерШрифтаЧата%d",
|
||||
["Sets font size for chat window %d."] = "Установить размер шрифта для окна чата %d.",
|
||||
["SetAll"] = "УстановитьВсе",
|
||||
["Sets font size for all chat windows."] = "Устанавливает размер шрифта для всех окон чата.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
["ChatFont"] = "Шрифт чата",
|
||||
["Choose Default WOW font or UNICODE."] = "Выберите каой шрифт использовать для чата - поумолчанию или Юникод",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["FontSize"] = "字体尺寸",
|
||||
["Chat window font size options."] = "聊天窗口字体尺寸选项。",
|
||||
["SetMode"] = "设置模式",
|
||||
["Choose mode for setting font sizes."] = "选择设置字体尺寸模式。",
|
||||
["Set"] = "设置",
|
||||
["Set the font size for each window."] = "为每一聊天窗口设置字体尺寸。",
|
||||
["Chat%dFontSize"] = "窗口 %d 字体尺寸",
|
||||
["Sets font size for chat window %d."] = "设置聊天窗口 %d 字体尺寸。",
|
||||
["SetAll"] = "所有尺寸",
|
||||
["Sets font size for all chat windows."] = "设置所有聊天窗口字体尺寸。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块打开与关闭。",
|
||||
["ChatFont"] = "Шрифт чата",
|
||||
["Choose Default WOW font or UNICODE."] = "Выберите каой шрифт использовать для чата - поумолчанию или Юникод",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["FontSize"] = "글자크기",
|
||||
["Chat window font size options."] = "대화창 글자 크기를 설정합니다.",
|
||||
["SetMode"] = "모드설정",
|
||||
["Choose mode for setting font sizes."] = "글자 크기 설정에 대한 모드를 선택합니다.",
|
||||
["Set"] = "설정",
|
||||
["Set the font size for each window."] = "각 창에 대한 글자 크기를 설정합니다.",
|
||||
["Chat%dFontSize"] = "대화창%d 글자 크기",
|
||||
["Sets font size for chat window %d."] = "대화창 %d에 대한 글자 크기를 설정합니다.",
|
||||
["SetAll"] = "모두 설정",
|
||||
["Sets font size for all chat windows."] = "모든 대화창에 대한 글자 크기를 설정합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
["ChatFont"] = "Шрифт чата",
|
||||
["Choose Default WOW font or UNICODE."] = "Выберите каой шрифт использовать для чата - поумолчанию или Юникод",
|
||||
} end)
|
||||
|
||||
Prat_FontSize = Prat:NewModule("fontsize")
|
||||
|
||||
function Prat_FontSize:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("FontSize")
|
||||
Prat:RegisterDefaults("FontSize", "profile", {
|
||||
on = true,
|
||||
sizemode = "INDIVIDUAL",
|
||||
size = {12, 12, 12, 12, 12, 12, 12},
|
||||
sizeall = 12,
|
||||
chatfont = "Fonts\\ARIALN.ttf",
|
||||
})
|
||||
if not self.db.profile.chatfont then self.db.profile.chatfont = "Fonts\\ARIALN.ttf" end
|
||||
NAMEPLATE_FONT = self.db.profile.chatfont
|
||||
ChatFontNormal:SetFont(self.db.profile.chatfont, self.db.profile.sizeall, "")
|
||||
Prat.Options.args.fontsize = {
|
||||
name = L["FontSize"],
|
||||
desc = L["Chat window font size options."],
|
||||
type = "group",
|
||||
args = {
|
||||
setmode = {
|
||||
name = L["SetMode"],
|
||||
desc = L["Choose mode for setting font sizes."],
|
||||
type = "text",
|
||||
get = function() return self.db.profile.sizemode end,
|
||||
set = function(v) self.db.profile.sizemode = v end,
|
||||
validate = {["ALL"] = "All", ["INDIVIDUAL"] = "Individual"},
|
||||
order = 197
|
||||
},
|
||||
chatfont = {
|
||||
name = L["ChatFont"],
|
||||
desc = L["Choose Default WOW font or UNICODE."],
|
||||
type = "text",
|
||||
get = function() return self.db.profile.chatfont end,
|
||||
set = function(v) self.db.profile.chatfont = v
|
||||
NAMEPLATE_FONT = self.db.profile.chatfont
|
||||
ChatFontNormal:SetFont(self.db.profile.chatfont, self.db.profile.sizeall, "")
|
||||
end,
|
||||
validate = {["Fonts\\ARIALN.ttf"] = "Default", [UNICODEFONT] = "UNICODE"},
|
||||
order = 196
|
||||
},
|
||||
set = {
|
||||
name = L["Set"],
|
||||
desc = L["Set the font size for each window."],
|
||||
type = "group",
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dFontSize"], 1),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 1),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[1] end,
|
||||
set = function(v) self.db.profile.size[1] = v; self:SetSize(1,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dFontSize"], 2),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 2),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[2] end,
|
||||
set = function(v) self.db.profile.size[2] = v; self:SetSize(2,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dFontSize"], 3),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 3),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[3] end,
|
||||
set = function(v) self.db.profile.size[3] = v; self:SetSize(3,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dFontSize"], 4),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 4),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[4] end,
|
||||
set = function(v) self.db.profile.size[4] = v; self:SetSize(4,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dFontSize"], 5),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 5),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[5] end,
|
||||
set = function(v) self.db.profile.size[5] = v; self:SetSize(5,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dFontSize"], 6),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 6),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[6] end,
|
||||
set = function(v) self.db.profile.size[6] = v; self:SetSize(6,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dFontSize"], 7),
|
||||
desc = string.format(L["Sets font size for chat window %d."], 7),
|
||||
type = "range",
|
||||
get = function() return self.db.profile.size[7] end,
|
||||
set = function(v) self.db.profile.size[7] = v; self:SetSize(7,v) end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1
|
||||
}
|
||||
},
|
||||
disabled = function() if self.db.profile.sizemode == "ALL" then return true else return false end end,
|
||||
order = 198
|
||||
},
|
||||
setall = {
|
||||
name = L["SetAll"],
|
||||
desc = L["Sets font size for all chat windows."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.sizeall end,
|
||||
set = function(v)
|
||||
self.db.profile.sizeall = v
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self.db.profile.size[i] = v
|
||||
self:SetSize(i,self.db.profile.size[i])
|
||||
end
|
||||
end,
|
||||
min = 4,
|
||||
max = 22,
|
||||
step = 1,
|
||||
disabled = function() if self.db.profile.sizemode == "INDIVIDUAL" then return true else return false end end,
|
||||
order = 199
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("fontsize") end,
|
||||
order = 200
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_FontSize:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetSize(i,self.db.profile.size[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_FontSize:OnDisable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetSize(i,12)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_FontSize:SetSize(id, size)
|
||||
local fontFile, unused, fontFlags = getglobal("ChatFrame"..id):GetFont();
|
||||
getglobal("ChatFrame"..id):SetFont(fontFile, size, fontFlags);
|
||||
SetChatWindowSize(getglobal("ChatFrame"..id):GetID(), size);
|
||||
end
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
--[[
|
||||
Name: Prat_Highlight
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Highlight
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds options for highlighting text in chat windows.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratHighlight")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Highlight"] = true,
|
||||
["Text highlighting options."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Highlight"] = "Highlight",
|
||||
["Text highlighting options."] = "Опции подсветки текста.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Highlight"] = "高亮",
|
||||
["Text highlighting options."] = "文本高亮选项。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Highlight"] = "강조",
|
||||
["Text highlighting options."] = "텍스트 강조 설정입니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Highlight = Prat:NewModule("highlight")
|
||||
|
||||
function Prat_Highlight:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Highlight")
|
||||
Prat:RegisterDefaults("Highlight", "profile", {
|
||||
on = true
|
||||
})
|
||||
Prat.Options.args.highlight = {
|
||||
name = L["Highlight"],
|
||||
desc = L["Text highlighting options."],
|
||||
type = "group",
|
||||
args = {
|
||||
toggle = {
|
||||
type = "toggle",
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("highlight") end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function Prat_Highlight:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:Hook(getglobal("ChatFrame"..i), "AddMessage")
|
||||
end
|
||||
end
|
||||
|
||||
-- Hook
|
||||
function Prat_Highlight:AddMessage(frame, text, ...)
|
||||
if text then
|
||||
text = Prat_Highlight:ProcessText (text)
|
||||
end
|
||||
self.hooks[frame].AddMessage(frame, text, unpack(arg))
|
||||
end
|
||||
|
||||
-- Utility Function
|
||||
function Prat_Highlight:ProcessText(text)
|
||||
return text
|
||||
end
|
||||
Executable
+177
@@ -0,0 +1,177 @@
|
||||
--[[
|
||||
Name: Prat_History
|
||||
Revision: $Revision: 16026 $
|
||||
Author(s): Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#History
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds chat history options.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratHistory")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["History"] = true,
|
||||
["Chat history options."] = true,
|
||||
["Set"] = true,
|
||||
["Set number of History lines for each window."] = true,
|
||||
["Chat%dHistory"] = true,
|
||||
["Sets history for chat window %d."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["History"] = "History",
|
||||
["Chat history options."] = "Настройки истории чата.",
|
||||
["Set"] = "Установить",
|
||||
["Set number of History lines for each window."] = "Установить количество строк истории для каждого окна.",
|
||||
["Chat%dHistory"] = "ИсторияЧата%d",
|
||||
["Sets history for chat window %d."] = "Установить историю для окна чата %d.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["History"] = "历史",
|
||||
["Chat history options."] = "聊天历史选项。",
|
||||
["Set"] = "设置",
|
||||
["Set number of History lines for each window."] = "为每一聊天窗口设置历史记录行数.",
|
||||
["Chat%dHistory"] = "窗口%d历史",
|
||||
["Sets history for chat window %d."] = "设置聊天窗口%d聊天历史记录",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["History"] = "이력",
|
||||
["Chat history options."] = "대화 이력 설정입니다.",
|
||||
["Set"] = "설정",
|
||||
["Set number of History lines for each window."] = "각 창에 대한 이력 라인수를 설정합니다.",
|
||||
["Chat%dHistory"] = "대화창%d 이력",
|
||||
["Sets history for chat window %d."] = "대화창 %d에 대한 이력을 설정합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_History = Prat:NewModule("history")
|
||||
|
||||
function Prat_History:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("History")
|
||||
Prat:RegisterDefaults("History", "profile", {
|
||||
on = true,
|
||||
chatlines = {128, 128, 128, 128, 128, 128, 128, 128},
|
||||
})
|
||||
Prat.Options.args.history = {
|
||||
name = L["History"],
|
||||
desc = L["Chat history options."],
|
||||
type = "group",
|
||||
args = {
|
||||
set = {
|
||||
name = L["Set"],
|
||||
desc = L["Set number of History lines for each window."],
|
||||
type = "group",
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dHistory"], 1),
|
||||
desc = string.format(L["Sets history for chat window %d."], 1),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[1] end,
|
||||
set = function(v) Prat_History:SetHistory(1, v) end,
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dHistory"], 2),
|
||||
desc = string.format(L["Sets history for chat window %d."], 2),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[2] end,
|
||||
set = function(v) Prat_History:SetHistory(2, v) end,
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dHistory"], 3),
|
||||
desc = string.format(L["Sets history for chat window %d."], 3),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[3] end,
|
||||
set = function(v) Prat_History:SetHistory(3, v) end,
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dHistory"], 4),
|
||||
desc = string.format(L["Sets history for chat window %d."], 4),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[4] end,
|
||||
set = function(v) Prat_History:SetHistory(4, v) end,
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dHistory"], 5),
|
||||
desc = string.format(L["Sets history for chat window %d."], 5),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[5] end,
|
||||
set = function(v) Prat_History:SetHistory(5, v) end,
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dHistory"], 6),
|
||||
desc = string.format(L["Sets history for chat window %d."], 6),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[6] end,
|
||||
set = function(v) Prat_History:SetHistory(6, v) end,
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dHistory"],7),
|
||||
desc = string.format(L["Sets history for chat window %d."], 7),
|
||||
type = "range",
|
||||
min = 50,
|
||||
max = 500,
|
||||
step = 1,
|
||||
get = function() return self.db.profile.chatlines[7] end,
|
||||
set = function(v) Prat_History:SetHistory(7, v) end,
|
||||
},
|
||||
}
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("history") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_History:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetHistory(i,self.db.profile.chatlines[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_History:OnDisable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetHistory(i,128)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_History:SetHistory(id, lines)
|
||||
if lines ~= self.db.profile.chatlines[id] then
|
||||
getglobal("ChatFrame"..id):SetMaxLines(lines)
|
||||
self.db.profile.chatlines[id] = lines
|
||||
end
|
||||
end
|
||||
Executable
+163
@@ -0,0 +1,163 @@
|
||||
--[[
|
||||
Name: Prat_Justify
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Thanks to: Wubin for helping me understand variables better
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Justify
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that sets the justification for chat windows (default=Left).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratJustify")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Justify"] = true,
|
||||
["Chat window justification options."] = true,
|
||||
["Set"] = true,
|
||||
["Set justify for each window."] = true,
|
||||
["Chat%dJustify"] = true,
|
||||
["Sets justification for chat window %d."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Justify"] = "Justify",
|
||||
["Chat window justification options."] = "Опции выравнивания окна чата.",
|
||||
["Set"] = "Установить",
|
||||
["Set justify for each window."] = "Установить выравнивание для каждого окна.",
|
||||
["Chat%dJustify"] = "ВыравниваниеЧата%d",
|
||||
["Sets justification for chat window %d."] = "Установлено выравнивание окна чата %d.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Justify"] = "对齐",
|
||||
["Chat window justification options."] = "聊天窗口对齐模式.",
|
||||
["Set"] = "设置",
|
||||
["Set justify for each window."] = "为每一个聊天窗口设置对齐模式.",
|
||||
["Chat%dJustify"] = "窗口%d对齐",
|
||||
["Sets justification for chat window %d."] = "设置聊天窗口%d对齐模式.",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Justify"] = "정렬",
|
||||
["Chat window justification options."] = "대화창 정렬 설정",
|
||||
["Set"] = "설정",
|
||||
["Set justify for each window."] = "각 창에 대한 정렬 설정",
|
||||
["Chat%dJustify"] = "대화창%d 정렬",
|
||||
["Sets justification for chat window %d."] = "대화창 %d에 대한 정렬을 설정합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기 전환",
|
||||
} end)
|
||||
|
||||
Prat_Justify = Prat:NewModule("justify")
|
||||
|
||||
function Prat_Justify:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Justify")
|
||||
Prat:RegisterDefaults("Justify", "profile", {
|
||||
on = true,
|
||||
justification = {"LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "LEFT"}
|
||||
})
|
||||
Prat.Options.args.justify = {
|
||||
name = L["Justify"],
|
||||
desc = L["Chat window justification options."],
|
||||
type = "group",
|
||||
args = {
|
||||
set = {
|
||||
name = L["Set"],
|
||||
desc = L["Set justify for each window."],
|
||||
type = "group",
|
||||
order = 150,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dJustify"], 1),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 1),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[1] end,
|
||||
set = function(v) self.db.profile.justification[1] = v; self:SetJustify(1,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dJustify"], 2),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 2),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[2] end,
|
||||
set = function(v) self.db.profile.justification[2] = v; self:SetJustify(2,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dJustify"], 3),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 3),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[3] end,
|
||||
set = function(v) self.db.profile.justification[3] = v; self:SetJustify(3,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dJustify"], 4),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 4),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[4] end,
|
||||
set = function(v) self.db.profile.justification[4] = v; self:SetJustify(4,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dJustify"], 5),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 5),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[5] end,
|
||||
set = function(v) self.db.profile.justification[5] = v; self:SetJustify(5,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dJustify"], 6),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 6),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[6] end,
|
||||
set = function(v) self.db.profile.justification[6] = v; self:SetJustify(6,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dJustify"], 7),
|
||||
desc = string.format(L["Sets justification for chat window %d."], 7),
|
||||
type = "text",
|
||||
get = function() return self.db.profile.justification[7] end,
|
||||
set = function(v) self.db.profile.justification[7] = v; self:SetJustify(7,v) end,
|
||||
validate = {["LEFT"] = "Left", ["RIGHT"] = "Right", ["CENTER"] = "Center"}
|
||||
}
|
||||
}
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("justify") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Justify:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetJustify(i,self.db.profile.justification[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Justify:OnDisable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetJustify(i,"LEFT")
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Justify:SetJustify(id, justification)
|
||||
local cf = getglobal("ChatFrame"..id)
|
||||
cf:SetJustifyH(justification)
|
||||
end
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
--[[
|
||||
Name: Prat_KeyBindings
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#KeyBindings
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds keybindings for modules.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratKeyBindings")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Prat ChannelNames"] = true,
|
||||
["Officer Channel"] = true,
|
||||
["Guild Channel"] = true,
|
||||
["Party Channel"] = true,
|
||||
["Raid Channel"] = true,
|
||||
["Raid Warning Channel"] = true,
|
||||
["Battleground Channel"] = true,
|
||||
["Say"] = true,
|
||||
["Yell"] = true,
|
||||
["Whisper"] = true,
|
||||
["Channel %d"] = true,
|
||||
["Prat TellTarget"] = true,
|
||||
["TellTarget"] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Prat ChannelNames"] = "Prat ChannelNames",
|
||||
["Officer Channel"] = "Офицерский Канал",
|
||||
["Guild Channel"] = "Канал Гильдии",
|
||||
["Party Channel"] = "Канал Группы",
|
||||
["Raid Channel"] = "Канал Рейда",
|
||||
["Raid Warning Channel"] = "Канал объявлений рейду",
|
||||
["Battleground Channel"] = "Канал поля боя",
|
||||
["Say"] = "Сказать",
|
||||
["Yell"] = "Крикнуть",
|
||||
["Whisper"] = "Шепнуть",
|
||||
["Channel %d"] = "Канал %d",
|
||||
["Prat TellTarget"] = "Prat Сказать цели",
|
||||
["TellTarget"] = "Сказать цели",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Prat ChannelNames"] = "Prat 频道名称",
|
||||
["Officer Channel"] = "官员频道",
|
||||
["Guild Channel"] = "公会频道",
|
||||
["Party Channel"] = "队伍频道",
|
||||
["Raid Channel"] = "团队频道",
|
||||
["Raid Warning Channel"] = "团队警报频道",
|
||||
["Battleground Channel"] = "战场频道",
|
||||
["Say"] = "说",
|
||||
["Yell"] = "喊",
|
||||
["Whisper"] = "密语",
|
||||
["Channel %d"] = "频道 %d",
|
||||
["Prat TellTarget"] = "Prat 通知目标",
|
||||
["TellTarget"] = "通知目标",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Prat ChannelNames"] = "Prat 채널명",
|
||||
["Officer Channel"] = "오피서 채널",
|
||||
["Guild Channel"] = "길드 채널",
|
||||
["Party Channel"] = "파티 채널",
|
||||
["Raid Channel"] = "공격대 채널",
|
||||
["Raid Warning Channel"] = "공격대경보 채널",
|
||||
["Battleground Channel"] = "전장 채널",
|
||||
["Say"] = "일반대화",
|
||||
["Yell"] = "외치기",
|
||||
["Whisper"] = "귓속말",
|
||||
["Channel %d"] = "채널 %d",
|
||||
["Prat TellTarget"] = "Prat 대상대화",
|
||||
["TellTarget"] = "대상대화",
|
||||
} end)
|
||||
|
||||
Prat_Keybindings = Prat:NewModule("keybindings")
|
||||
|
||||
function Prat_Keybindings:OnInitialize()
|
||||
BINDING_HEADER_Prat_ChannelNames = L["Prat ChannelNames"]
|
||||
BINDING_NAME_officer = L["Officer Channel"]
|
||||
BINDING_NAME_guild = L["Guild Channel"]
|
||||
BINDING_NAME_party = L["Party Channel"]
|
||||
BINDING_NAME_raid = L["Raid Channel"]
|
||||
BINDING_NAME_raidwarn = L["Raid Warning Channel"]
|
||||
BINDING_NAME_battleground = L["Battleground Channel"]
|
||||
BINDING_NAME_say = L["Say"]
|
||||
BINDING_NAME_yell = L["Yell"]
|
||||
BINDING_NAME_whisper = L["Whisper"]
|
||||
BINDING_NAME_one = string.format(L["Channel %d"], 1)
|
||||
BINDING_NAME_two = string.format(L["Channel %d"], 2)
|
||||
BINDING_NAME_three = string.format(L["Channel %d"], 3)
|
||||
BINDING_NAME_four = string.format(L["Channel %d"], 4)
|
||||
BINDING_NAME_five = string.format(L["Channel %d"], 5)
|
||||
BINDING_NAME_six = string.format(L["Channel %d"], 6)
|
||||
BINDING_NAME_seven = string.format(L["Channel %d"], 7)
|
||||
BINDING_NAME_eight = string.format(L["Channel %d"], 8)
|
||||
BINDING_NAME_nine = string.format(L["Channel %d"], 9)
|
||||
BINDING_NAME_ten = string.format(L["Channel %d"], 10)
|
||||
BINDING_HEADER_Prat_TellTarget = L["Prat TellTarget"]
|
||||
BINDING_NAME_TellTarget = L["TellTarget"]
|
||||
end
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
--[[
|
||||
Name: Prat_Notification
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Notification
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds options for chat channel notification.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratNotification")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Notification"] = true,
|
||||
["Chat channel notification options."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Notification"] = "Notification",
|
||||
["Chat channel notification options."] = "Опции уведомления канала чата.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Notification"] = "通告",
|
||||
["Chat channel notification options."] = "聊天频道通告选项。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Notification"] = "알림",
|
||||
["Chat channel notification options."] = "대화 채널 알림 설정입니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Notification = Prat:NewModule("notification")
|
||||
|
||||
function Prat_Notification:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Notification")
|
||||
Prat:RegisterDefaults("Notification", "profile", {
|
||||
on = true
|
||||
})
|
||||
Prat.Options.args.highlight = {
|
||||
name = L["Notification"],
|
||||
desc = L["Chat channel notification options."],
|
||||
type = "group",
|
||||
args = {
|
||||
toggle = {
|
||||
type = "toggle",
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("notification") end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Notification:OnEnable()
|
||||
end
|
||||
|
||||
function Prat_Notification:OnDisable()
|
||||
end
|
||||
Executable
+574
@@ -0,0 +1,574 @@
|
||||
--[[
|
||||
Name: Prat_PlayerNames
|
||||
Revision: $Revision: 16689 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_PlayerNames by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#PlayerNames
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds player name options.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratPlayerNames")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["PlayerNames"] = true,
|
||||
["Player name formating options."] = true,
|
||||
["Brackets"] = true,
|
||||
["Square"] = true,
|
||||
["Angled"] = true,
|
||||
["None"] = true,
|
||||
["Class"] = true,
|
||||
["Random"] = true,
|
||||
["Sets style of brackets to use around player names."] = true,
|
||||
["Use common color"] = true,
|
||||
["Toggle useing common color for unknown player names."] = true,
|
||||
["Set common color"] = true,
|
||||
["Change the common color of PlayerNames"] = true,
|
||||
["Use TabComplete"] = true,
|
||||
["Toggle tab completion of player names."] = true,
|
||||
["Show Level"] = true,
|
||||
["Toggle level showing."] = true,
|
||||
["Show Group"] = true,
|
||||
["Toggle raid group showing."] = true,
|
||||
["Keep Info"] = true,
|
||||
["Keep player information between session."] = true,
|
||||
["Color Mode"] = true,
|
||||
["How to color Players name."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
["Use Census+"] = true,
|
||||
["Use Census+ database"] = true,
|
||||
["Mark self"] = true,
|
||||
["Toggle color marking of your nikname in chat."] = true,
|
||||
["Set mark color"] = true,
|
||||
["Change the mark color of your nikname"] = true,
|
||||
["Group acronim"] = true,
|
||||
["Simbol of raid group added to group number"] = true ,
|
||||
["Enable group number at %s"] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["PlayerNames"] = "PlayerNames",
|
||||
["Player name formating options."] = "Настройки форматирования имени собеседника.",
|
||||
["Brackets"] = "Скобки",
|
||||
["Square"] = "Квадратные",
|
||||
["Angled"] = "Треугольные",
|
||||
["None"] = "Нет",
|
||||
["Class"] = "Класс",
|
||||
["Random"] = "Случайно",
|
||||
["Sets style of brackets to use around player names."] = "Установить стиль скобок вокруг имени собеседника.",
|
||||
["Use common color"] = "Использовать общий цвет",
|
||||
["Toggle useing common color for unknown player names."] = "Вкл/Выкл использование общего цвета для неизвестных имен игроков.",
|
||||
["Set common color"] = "Установить общий цвет",
|
||||
["Change the common color of PlayerNames"] = "Изменить общий цвет имен игроков",
|
||||
["Use TabComplete"] = "Использовать TabComplete",
|
||||
["Toggle tab completion of player names."] = "Вкл/Выкл TabComplete в именах игроков.",
|
||||
["Show Level"] = "Показывать уровень",
|
||||
["Toggle level showing."] = "Вкл/выкл отображения уровня собеседника.",
|
||||
["Show Group"] = "Показывать группу",
|
||||
["Toggle raid group showing."] = "Вкл/выкл отображения рейдовой группы.",
|
||||
["Keep Info"] = "Хранить информацию",
|
||||
["Keep player information between session."] = "Хранить информацию о игроках между сессиями.",
|
||||
["Color Mode"] = "Режим цвета",
|
||||
["How to color Players name."] = "Как окрасить имя игрока.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
["Use Census+"] = "Использовать Census+",
|
||||
["Use Census+ database"] = "Использовать базу данных Census+",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["PlayerNames"] = "玩家姓名",
|
||||
["Player name formating options."] = "玩家姓名格式选项。",
|
||||
["Brackets"] = "圆弧",
|
||||
["Square"] = "方形",
|
||||
["Angled"] = "折角",
|
||||
["None"] = "无",
|
||||
["Class"] = "职业",
|
||||
["Random"] = "随机",
|
||||
["Sets style of brackets to use around player names."] = "设置玩家名字的括号。",
|
||||
["Use TabComplete"] = "标签",
|
||||
["Toggle tab completion of player names."] = "为玩家姓名作标签。",
|
||||
["Show Level"] = "显示等级",
|
||||
["Toggle level showing."] = "人物等级显示。",
|
||||
["Show Group"] = "显示小组",
|
||||
["Toggle raid group showing."] = "团队小组显示。",
|
||||
["Keep Info"] = "持续",
|
||||
["Keep player information between session."] = "在进程间保持信息。",
|
||||
["Color Mode"] = "颜色模块",
|
||||
["How to color Players name."] = "玩家名字颜色。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["PlayerNames"] = "플레이어명",
|
||||
["Player name formating options."] = "플레이어명 형식을 설정합니다.",
|
||||
["Brackets"] = "괄호",
|
||||
["Square"] = "사각형",
|
||||
["Angled"] = "각진형",
|
||||
["None"] = "없음",
|
||||
["Class"] = "직업",
|
||||
["Random"] = "무작위",
|
||||
["Sets style of brackets to use around player names."] = "플레이어명 주위 괄호의 스타일 설정",
|
||||
["Use common color"] = "공통 색상 사용",
|
||||
["Toggle useing common color for unknown player names."] = "알려지지 않은 플레이어명에 대한 공통 색상 사용을 전환합니다.",
|
||||
["Set common color"] = "공통 색상 설정",
|
||||
["Change the common color of PlayerNames"] = "플레이어명의 공통 색상을 설정합니다.",
|
||||
["Use TabComplete"] = "탭완성 사용",
|
||||
["Toggle tab completion of player names."] = "플레이어명의 탭 완성기능을 전환합니다.",
|
||||
["Show Level"] = "레벨 표시",
|
||||
["Toggle level showing."] = "레벨 표시를 전환합니다.",
|
||||
["Show Group"] = "파티 표시",
|
||||
["Toggle raid group showing."] = "공격대 파티 표시를 전환합니다.",
|
||||
["Keep Info"] = "정보 유지",
|
||||
["Keep player information between session."] = "연결 간 플레이어 정보를 유지합니다.",
|
||||
["Color Mode"] = "색상 모드",
|
||||
["How to color Players name."] = "플레이어명 색상을 변경합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
local BC = AceLibrary("Babble-Class-2.2")
|
||||
local sfind, sformat, slower, sgsub = string.find, string.format , string.lower, string.gsub
|
||||
|
||||
Prat_PlayerNames = Prat:NewModule("playernames")
|
||||
|
||||
Prat_PlayerNames.Classes = {}
|
||||
Prat_PlayerNames.Levels = {}
|
||||
Prat_PlayerNames.Subgroups = {}
|
||||
|
||||
local chatList = {[1] = {t = "SAY", n = "Say"},
|
||||
[4] = {t = "GUILD", n = "Guild"},
|
||||
[2] = {t = "PARTY", n = "Party"},
|
||||
[3] = {t = "RAID", n = "Raid"},
|
||||
[7] = {t = "WHISPER", n = "Whisper"},
|
||||
[6] = {t = "YELL", n = "Yell"},
|
||||
[5] = {t = "OFFICER", n = "Officer"},
|
||||
[93] = {t = "BATTLEGROUND", n = "Battlegground"}
|
||||
}
|
||||
Prat_chatList = chatList
|
||||
function Prat_PlayerNames:OnInitialize()
|
||||
Prat_PlayerNames.db = Prat:AcquireDBNamespace("PlayerNames")
|
||||
|
||||
local defaults = {
|
||||
on = true,
|
||||
brackets = "Angled",
|
||||
tabcomplete = true,
|
||||
level = true,
|
||||
classes = {},
|
||||
levels = {},
|
||||
subgroup = true,
|
||||
groupchan = {},
|
||||
groupAcronim = "[%s]",
|
||||
keep = true,
|
||||
census = false,
|
||||
colormode = "CLASS",
|
||||
usecommoncolor = true,
|
||||
color = {
|
||||
r = 1,
|
||||
g = 0,
|
||||
b = 1,
|
||||
},
|
||||
markself = true,
|
||||
selfcolor = {
|
||||
r = 1,
|
||||
g = 0,
|
||||
b = 1,
|
||||
},
|
||||
}
|
||||
|
||||
for id,chat in pairs( chatList) do defaults.groupchan[chat.t] = true end
|
||||
|
||||
Prat:RegisterDefaults("PlayerNames", "profile", defaults)
|
||||
Prat.Options.args.playernames = {
|
||||
name = L["PlayerNames"],
|
||||
desc = L["Player name formating options."],
|
||||
type = "group",
|
||||
args = {
|
||||
brackets = {
|
||||
name = L["Brackets"],
|
||||
desc = L["Sets style of brackets to use around player names."],
|
||||
type = "text",
|
||||
order = 140,
|
||||
get = function() return Prat_PlayerNames.db.profile.brackets end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.brackets = v end,
|
||||
validate = {["Square"] = L["Square"], ["Angled"] = L["Angled"], ["None"] = L["None"]}
|
||||
},
|
||||
colormode = {
|
||||
name = L["Color Mode"],
|
||||
desc = L["How to color Players name."],
|
||||
type = "text",
|
||||
order = 150,
|
||||
get = function() return Prat_PlayerNames.db.profile.colormode end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.colormode = v end,
|
||||
validate = {["RANDOM"] = L["Random"], ["CLASS"] = L["Class"], ["NONE"] = L["None"]}
|
||||
},
|
||||
level = {
|
||||
name = L["Show Level"],
|
||||
desc = L["Toggle level showing."],
|
||||
type = "toggle",
|
||||
order = 160,
|
||||
get = function() return Prat_PlayerNames.db.profile.level end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.level = v end
|
||||
},
|
||||
subgroup = {
|
||||
name = L["Show Group"],
|
||||
desc = L["Toggle raid group showing."],
|
||||
type = "group",
|
||||
order = 170,
|
||||
args = {
|
||||
set = {
|
||||
name = L["Group acronim"],
|
||||
desc = L["Simbol of raid group added to group number"],
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
order = 90,
|
||||
get = function() return Prat_PlayerNames.db.profile.groupAcronim end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.groupAcronim = v end
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
keep = {
|
||||
name = L["Keep Info"],
|
||||
desc = L["Keep player information between session."],
|
||||
type = "toggle",
|
||||
order = 180,
|
||||
get = function() return Prat_PlayerNames.db.profile.keep end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.keep = v end
|
||||
},
|
||||
census = {
|
||||
name = L["Use Census+"],
|
||||
desc = L["Use Census+ database"],
|
||||
type = "toggle",
|
||||
order = 185,
|
||||
get = function() return Prat_PlayerNames.db.profile.census end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.census = v end
|
||||
},
|
||||
tabcomplete = {
|
||||
name = L["Use TabComplete"],
|
||||
desc = L["Toggle tab completion of player names."],
|
||||
type = "toggle",
|
||||
order = 190,
|
||||
get = function() return Prat_PlayerNames.db.profile.tabcomplete end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.tabcomplete = v; self:TabComplete(v) end
|
||||
},
|
||||
usecommoncolor = {
|
||||
name = L["Use common color"],
|
||||
desc = L["Toggle useing common color for unknown player names."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return Prat_PlayerNames.db.profile.usecommoncolor end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.usecommoncolor = v end
|
||||
},
|
||||
setcolor = {
|
||||
name = L["Set common color"],
|
||||
desc = L["Change the common color of PlayerNames"],
|
||||
type = "color",
|
||||
order = 210,
|
||||
get = function() return Prat_PlayerNames.db.profile.color.r, Prat_PlayerNames.db.profile.color.g, Prat_PlayerNames.db.profile.color.b end,
|
||||
set = function(r, g, b, a) Prat_PlayerNames.db.profile.color.r, Prat_PlayerNames.db.profile.color.g, Prat_PlayerNames.db.profile.color.b = r, g, b end,
|
||||
disabled = function() if not Prat_PlayerNames.db.profile.usecommoncolor then return true else return false end end,
|
||||
},
|
||||
markself = {
|
||||
name = L["Mark self"],
|
||||
desc = L["Toggle color marking of your nikname in chat."],
|
||||
type = "toggle",
|
||||
order = 220,
|
||||
get = function() return Prat_PlayerNames.db.profile.markself end,
|
||||
set = function(v) Prat_PlayerNames.db.profile.markself = v end
|
||||
},
|
||||
setselfcolor = {
|
||||
name = L["Set mark color"],
|
||||
desc = L["Change the mark color of your nikname"],
|
||||
type = "color",
|
||||
order = 230,
|
||||
get = function() return Prat_PlayerNames.db.profile.selfcolor.r, Prat_PlayerNames.db.profile.selfcolor.g, Prat_PlayerNames.db.profile.selfcolor.b end,
|
||||
set = function(r, g, b, a) Prat_PlayerNames.db.profile.selfcolor.r, Prat_PlayerNames.db.profile.selfcolor.g, Prat_PlayerNames.db.profile.selfcolor.b = r, g, b end,
|
||||
disabled = function() if not Prat_PlayerNames.db.profile.markself then return true else return false end end,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 500,
|
||||
get = function() return Prat_PlayerNames.db.profile.on end,
|
||||
set = function() Prat_PlayerNames.db.profile.on = Prat:ToggleModuleActive("playernames") end
|
||||
}
|
||||
}
|
||||
}
|
||||
local ord = 100
|
||||
local menu = Prat.Options.args.playernames.args.subgroup.args
|
||||
for id,chat in pairs( chatList) do
|
||||
menu[chat.t] = {}
|
||||
menu[chat.t].name = chat.n
|
||||
menu[chat.t].desc = sformat(L["Enable group number at %s"],chat.n)
|
||||
menu[chat.t].type = "toggle"
|
||||
menu[chat.t].order = ord
|
||||
--menu[chat].get = function() return Prat_PlayerNames.db.profile.groupchan[chat] end
|
||||
--menu[chat].set = function(v) Prat_PlayerNames.db.profile.groupchan[chat] = not Prat_PlayerNames.db.profile.groupchan[chat] end
|
||||
ord = ord +10
|
||||
end
|
||||
menu["SAY"].get = function() return Prat_PlayerNames.db.profile.groupchan["SAY"] end
|
||||
menu["SAY"].set = function(v) Prat_PlayerNames.db.profile.groupchan["SAY"] = v end
|
||||
menu["GUILD"].get = function() return Prat_PlayerNames.db.profile.groupchan["GUILD"] end
|
||||
menu["GUILD"].set = function(v) Prat_PlayerNames.db.profile.groupchan["GUILD"] = v end
|
||||
menu["PARTY"].get = function() return Prat_PlayerNames.db.profile.groupchan["PARTY"] end
|
||||
menu["PARTY"].set = function(v) Prat_PlayerNames.db.profile.groupchan["PARTY"] = v end
|
||||
menu["RAID"].get = function() return Prat_PlayerNames.db.profile.groupchan["RAID"] end
|
||||
menu["RAID"].set = function(v) Prat_PlayerNames.db.profile.groupchan["RAID"] = v end
|
||||
menu["WHISPER"].get = function() return Prat_PlayerNames.db.profile.groupchan["WHISPER"] end
|
||||
menu["WHISPER"].set = function(v) Prat_PlayerNames.db.profile.groupchan["WHISPER"] = v end
|
||||
menu["YELL"].get = function() return Prat_PlayerNames.db.profile.groupchan["YELL"] end
|
||||
menu["YELL"].set = function(v) Prat_PlayerNames.db.profile.groupchan["YELL"] = v end
|
||||
menu["OFFICER"].get = function() return Prat_PlayerNames.db.profile.groupchan["OFFICER"] end
|
||||
menu["OFFICER"].set = function(v) Prat_PlayerNames.db.profile.groupchan["OFFICER"] = v end
|
||||
menu["BATTLEGROUND"].get = function() return Prat_PlayerNames.db.profile.groupchan["BATTLEGROUND"] end
|
||||
menu["BATTLEGROUND"].set = function(v) Prat_PlayerNames.db.profile.groupchan["BATTLEGROUND"] = v end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:OnEnable()
|
||||
for i = 1, NUM_CHAT_WINDOWS do
|
||||
self:Hook(getglobal("ChatFrame"..i), "AddMessage")
|
||||
end
|
||||
|
||||
self:RegisterEvent("FRIENDLIST_UPDATE", "updateFriends")
|
||||
self:RegisterEvent("GUILD_ROSTER_UPDATE", "updateGuild")
|
||||
self:RegisterEvent("RAID_ROSTER_UPDATE", "updateRaid")
|
||||
self:RegisterEvent("PARTY_MEMBERS_CHANGED", "updateParty")
|
||||
self:RegisterEvent("PLAYER_TARGET_CHANGED", "updateTarget")
|
||||
self:RegisterEvent("WHO_LIST_UPDATE", "updateWho")
|
||||
self:RegisterEvent("CHAT_MSG_SYSTEM", "updateWho") -- for short /who command
|
||||
|
||||
for name, color in pairs(Prat_PlayerNames.db.profile.classes) do Prat_PlayerNames.Classes[name] = color end
|
||||
for name, level in pairs(Prat_PlayerNames.db.profile.levels) do Prat_PlayerNames.Levels[name] = level end
|
||||
|
||||
local PlayerClass
|
||||
_, PlayerClass = UnitClass("player")
|
||||
self.playerName = UnitName("player");
|
||||
self:addName(self.playerName, Playerclass, UnitLevel("player"))
|
||||
|
||||
|
||||
self:updateParty()
|
||||
self:updateRaid()
|
||||
self:updateFriends()
|
||||
self:updateGuild()
|
||||
|
||||
self:TabComplete(Prat_PlayerNames.db.profile.tabcomplete)
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:OnDisable()
|
||||
self:TabComplete(false)
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateFriends()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumFriends() do
|
||||
Name, Level, Class = GetFriendInfo(i)
|
||||
self:addName(Name, Class, Level)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateGuild()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumGuildMembers() do
|
||||
Name, _, _, Level, Class = GetGuildRosterInfo(i)
|
||||
self:addName(Name, Class, Level)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateRaid()
|
||||
local Name, Class, SubGroup, Level
|
||||
Prat_PlayerNames.Subgroups = {}
|
||||
for i = 1, GetNumRaidMembers() do
|
||||
Name, _, SubGroup, Level, Class = GetRaidRosterInfo(i)
|
||||
self:addName(Name, Class, Level, SubGroup)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateParty()
|
||||
local Class, Unit
|
||||
for i = 1, GetNumPartyMembers() do
|
||||
Unit = "party" .. i
|
||||
_, Class = UnitClass(Unit)
|
||||
self:addName(UnitName(Unit), Class, UnitLevel(Unit))
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateTarget()
|
||||
local Class
|
||||
if not UnitIsPlayer("target") or not UnitIsFriend("player", "target") then
|
||||
return
|
||||
end
|
||||
_, Class = UnitClass("target")
|
||||
self:addName(UnitName("target"), Class, UnitLevel("target"))
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:updateWho()
|
||||
local Name, Class, Level
|
||||
for i = 1, GetNumWhoResults() do
|
||||
Name, _, Level, _, Class = GetWhoInfo(i)
|
||||
self:addName(Name, Class, Level)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:addName(Name, Class, Level, SubGroup)
|
||||
if Name then
|
||||
if Level and Level ~= 0 and ( not ( Prat_PlayerNames.Levels[Name] and Prat_PlayerNames.Levels[Name] > Level ) ) then
|
||||
Prat_PlayerNames.Levels[Name] = Level
|
||||
if ( Prat_PlayerNames.db.profile.keep) then Prat_PlayerNames.db.profile.levels[Name] = Level end
|
||||
end
|
||||
if Class then
|
||||
Prat_PlayerNames.Classes[Name] = Class
|
||||
if ( Prat_PlayerNames.db.profile.keep ) then Prat_PlayerNames.db.profile.classes[Name] = Class end
|
||||
end
|
||||
if SubGroup then
|
||||
Prat_PlayerNames.Subgroups[Name] = SubGroup
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:randomColor(Name)
|
||||
local hash = 17
|
||||
for i=1,string.len(Name) do
|
||||
hash = hash * 37 * string.byte(Name, i);
|
||||
end
|
||||
|
||||
local r = math.floor(math.mod(hash / 97, 255));
|
||||
local g = math.floor(math.mod(hash / 17, 255));
|
||||
local b = math.floor(math.mod(hash / 227, 255));
|
||||
|
||||
if ((r * 299 + g * 587 + b * 114) / 1000) < 105 then
|
||||
r = math.abs(r - 255);
|
||||
g = math.abs(g - 255);
|
||||
b = math.abs(b - 255);
|
||||
end
|
||||
|
||||
return sformat("%02x%02x%02x", r, g, b)
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:addInfo(Name, id)
|
||||
if Name then
|
||||
local returnName = Name
|
||||
|
||||
if Prat_PlayerNames.Levels[Name] and Prat_PlayerNames.db.profile.level then
|
||||
returnName = sformat("%s:%s", Prat_PlayerNames.Levels[Name], returnName)
|
||||
elseif Prat_PlayerNames.db.profile.census and CensusPlus_ForAllCharacters then
|
||||
local realmName = g_CensusPlusLocale .. GetCVar("realmName");
|
||||
CensusPlus_ForAllCharacters( realmName, UnitFactionGroup("player"), nil, nil, nil, nil, Prat_InternalWhoResult)
|
||||
end
|
||||
|
||||
if Prat_PlayerNames.Subgroups[Name] and (id == nil or (chatList[id] and Prat_PlayerNames.db.profile.groupchan[chatList[id].t])) then
|
||||
local grp = sformat(Prat_PlayerNames.db.profile.groupAcronim,Prat_PlayerNames.Subgroups[Name] or "")
|
||||
returnName = sformat("%s%s", returnName, grp )
|
||||
end
|
||||
if Prat_PlayerNames.Classes[Name] then
|
||||
if Prat_PlayerNames.db.profile.colormode == "CLASS" then
|
||||
returnName = sformat("|cff%s%s|r", BC:GetHexColor(Prat_PlayerNames.Classes[Name]), returnName)
|
||||
elseif Prat_PlayerNames.db.profile.colormode == "RANDOM" then
|
||||
returnName = sformat("|cff%s%s|r", self:randomColor(Name), returnName)
|
||||
end
|
||||
else
|
||||
if Prat_PlayerNames.db.profile.usecommoncolor then
|
||||
local color = sformat("%02x%02x%02x", Prat_PlayerNames.db.profile.color.r*255, Prat_PlayerNames.db.profile.color.g*255, Prat_PlayerNames.db.profile.color.b*255)
|
||||
returnName = sformat("|cff%s%s|r", color, returnName)
|
||||
end
|
||||
end
|
||||
|
||||
return returnName
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_InternalWhoResult(Name, Level, guild, race, Class, lastSeen )
|
||||
if Name then
|
||||
if Level and Level ~= 0 and ( not ( Prat_PlayerNames.Levels[Name] and Prat_PlayerNames.Levels[Name] > Level ) ) then
|
||||
Prat_PlayerNames.Levels[Name] = Level
|
||||
if ( Prat_PlayerNames.db.profile.keep) then Prat_PlayerNames.db.profile.levels[Name] = Level end
|
||||
end
|
||||
if Class then
|
||||
Prat_PlayerNames.Classes[Name] = Class
|
||||
if ( Prat_PlayerNames.db.profile.keep ) then Prat_PlayerNames.db.profile.classes[Name] = Class end
|
||||
end
|
||||
end
|
||||
end
|
||||
function gisub(s, pat, repl, n)
|
||||
pat = sgsub(pat, '(%a)',
|
||||
function (v) return '['..strupper(v)..strlower(v)..']' end)
|
||||
if n then
|
||||
return sgsub(s, pat, repl, n)
|
||||
else
|
||||
return sgsub(s, pat, repl)
|
||||
end
|
||||
end
|
||||
function Prat_PlayerNames:AddMessage(frame, text, r, g, b, id)
|
||||
if text and id then
|
||||
-- local Name = sgsub(text, ".*|Hplayer:(.-)|h.*", "%1")
|
||||
|
||||
-- Sender's name is always the first linked player name in the message
|
||||
local _, _, Name = sfind(text, "|Hplayer:(.-)|h%[.-]|h")
|
||||
|
||||
-- If self.playerName is a clickable link, don't color it
|
||||
local _, _, linkedName = sfind(text, sformat("Hplayer:(%s)", self.playerName))
|
||||
if not linkedName then
|
||||
_, _, linkedName = sfind(text, sformat("|h[(%s)]|h", self.playerName))
|
||||
end
|
||||
if not linkedName and Name ~= self.playerName and Prat_PlayerNames.db.profile.markself then
|
||||
local textL = slower(text)
|
||||
local playerL = slower(self.playerName)
|
||||
if sfind(textL, playerL) then
|
||||
local color = sformat("%02x%02x%02x", Prat_PlayerNames.db.profile.selfcolor.r*255, Prat_PlayerNames.db.profile.selfcolor.g*255, Prat_PlayerNames.db.profile.selfcolor.b*255)
|
||||
local returnName = sformat("|cff%s%s|r", color, self.playerName)
|
||||
text = gisub(text, self.playerName, returnName)
|
||||
PlaySound("FriendJoinGame");
|
||||
end
|
||||
end
|
||||
|
||||
local Brackets
|
||||
Name = self:addInfo(Name, id)
|
||||
|
||||
if Prat_PlayerNames.db.profile.brackets == "Angled" then
|
||||
Brackets = "<|Hplayer:%1|h" .. Name .. "|h>"
|
||||
elseif Prat_PlayerNames.db.profile.brackets == "None" then
|
||||
Brackets = "|Hplayer:%1|h" .. Name .. "|h"
|
||||
else
|
||||
Brackets = "[|Hplayer:%1|h" .. Name .. "|h]"
|
||||
end
|
||||
|
||||
-- Only replace the first instance, and leave any linked names untouched
|
||||
text = sgsub(text, "|Hplayer:(.-)|h%[.-%]|h(.-:-)", Brackets .. "%2", 1)
|
||||
end
|
||||
Prat_PlayerNames.hooks[frame].AddMessage(frame, text, r, g, b, id)
|
||||
end
|
||||
|
||||
function Prat_PlayerNames:TabComplete(enabled)
|
||||
if enabled then
|
||||
if not AceLibrary("AceTab-2.0"):IsTabCompletionRegistered("Prat_PlayerNames") then
|
||||
AceLibrary("AceTab-2.0"):RegisterTabCompletion("Prat_PlayerNames", "",
|
||||
function(t, text, pos)
|
||||
for name in pairs(Prat_PlayerNames.Classes) do
|
||||
table.insert(t, pos == 0 and name..":" or name)
|
||||
end
|
||||
end,
|
||||
function(u, cands)
|
||||
local text = ""
|
||||
for _, cand in ipairs(cands) do
|
||||
cand = sgsub(cand, ":", "")
|
||||
cand = self:addInfo(cand, nil)
|
||||
text = text .. " " .. cand
|
||||
end
|
||||
Prat:Print("Tab completion : " .. text)
|
||||
end
|
||||
)
|
||||
end
|
||||
else
|
||||
if AceLibrary("AceTab-2.0"):IsTabCompletionRegistered("Prat_PlayerNames") then
|
||||
AceLibrary("AceTab-2.0"):UnregisterTabCompletion("Prat_PlayerNames")
|
||||
end
|
||||
end
|
||||
end
|
||||
Executable
+270
@@ -0,0 +1,270 @@
|
||||
--[[
|
||||
Name: Prat_PopupMessage
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Sylvanaar
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#PopupMessage
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that displays chat with your name in a pop up window
|
||||
Dependencies: Prat
|
||||
|
||||
Credit goes to: CleanChat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PopupMessage")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["PopupMessage"] = true,
|
||||
["Shows messages with your name in a popup."] = true,
|
||||
["Toggle"] = true,
|
||||
["Show"] = true,
|
||||
["ShowAll"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
["Toggles popups on and off for chat window %d."] = true,
|
||||
["Toggle showing Popup settings for each window."] = true,
|
||||
["Chat%dPopupShow"] = true,
|
||||
["Toggles Popup on and off for all chat windows."] = true,
|
||||
["Choose mode for showing popups."] = true,
|
||||
["ShowMode"] = true,
|
||||
["All"] = true,
|
||||
["Individual"] = true,
|
||||
["An alternate name to show in popups."] = true,
|
||||
["Nickname"] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["PopupMessage"] = "PopupMessage",
|
||||
["Shows messages with your name in a popup."] = "Отображать сообщение с вашим именем в всплывающем окне.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Show"] = "Показать",
|
||||
["ShowAll"] = "Показать все",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль",
|
||||
["Toggles popups on and off for chat window %d."] = "Вкл/Выкл всплывающие окна для окна чата %d.",
|
||||
["Toggle showing Popup settings for each window."] = "Вкл/Выкл всплывающие настройки для каждого окна.",
|
||||
["Chat%dPopupShow"] = "ПоказыватьВысплывающийЧат%d",
|
||||
["Toggles Popup on and off for all chat windows."] = "Вкл/Выкл всплывание для всех окон чата.",
|
||||
["Choose mode for showing popups."] = "Выбрать режим для отображение всплывающих окон.",
|
||||
["ShowMode"] = "ПоказатьРежим",
|
||||
["All"] = "Все",
|
||||
["Individual"] = "Индивидуальный",
|
||||
["An alternate name to show in popups."] = "Альтернативное название чтобы показать всплывающие окна.",
|
||||
["Nickname"] = "Ник",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["PopupMessage"] = "弹出消息",
|
||||
["Shows messages with your name in a popup."] = "在弹出窗口中显示包含自己名字的消息.",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
["Show"] = "显示",
|
||||
["ShowAll"] = "全部显示",
|
||||
["Toggles popups on and off for chat window %d."] = "切换窗口 %d 的弹出消息.",
|
||||
["Toggle showing Popup settings for each window."] = "切换每一窗口的弹出显示设置.",
|
||||
["Chat%dPopupShow"] = "显示窗口 %d 探出消息",
|
||||
["Toggles Popup on and off for all chat windows."] = "切换全部聊天窗口弹出消息.",
|
||||
["Choose mode for showing popups."] = "选择显示弹出消息方式.",
|
||||
["ShowMode"] = "显示模式",
|
||||
["All"] = "全部",
|
||||
["Individual"] = "个别",
|
||||
["An alternate name to show in popups."] = "显示弹出消息的替换名字.",
|
||||
["Nickname"] = "昵称",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["PopupMessage"] = "팝업 메세지",
|
||||
["Shows messages with your name in a popup."] = "당신의 이름을 포함한 메세지를 팝업으로 표시합니다.",
|
||||
["Show"] = "표시",
|
||||
["ShowAll"] = "모두 표시",
|
||||
["Toggles popups on and off for chat window %d."] = "대화창 %d에 대한 팝업을 켜거나 끕니다.",
|
||||
["Toggle showing Popup settings for each window."] = "각 창에 대한 팝업 설정을 표시하거나 끕니다.",
|
||||
["Chat%dPopupShow"] = "대화%d 팝업 표시",
|
||||
["Toggles Popup on and off for all chat windows."] = "모든 대화창에 대한 팝업을 켜거나 끕니다.",
|
||||
["Choose mode for showing popups."] = "팝업 표시에 대한 모드를 선택합니다.",
|
||||
["ShowMode"] = "표시모드",
|
||||
["All"] = "모두",
|
||||
["Individual"] = "각각",
|
||||
["An alternate name to show in popups."] = "팝업으로 표시할 다른 이름",
|
||||
["Nickname"] = "별명",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기 전환",
|
||||
} end)
|
||||
|
||||
Prat_PopupMessage = Prat:NewModule("PopupMessage")
|
||||
|
||||
function Prat_PopupMessage:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("PopupMessage")
|
||||
Prat:RegisterDefaults("PopupMessage", "profile", {
|
||||
on = true,
|
||||
showmode = "INDIVIDUAL",
|
||||
show = {true, false, false, false, false, false, false},
|
||||
showall = false,
|
||||
nickname = "",
|
||||
})
|
||||
Prat.Options.args.PopupMessage = {
|
||||
name = L["PopupMessage"],
|
||||
desc = L["Shows messages with your name in a popup."],
|
||||
type = "group",
|
||||
args = {
|
||||
Toggle = {
|
||||
type = "toggle",
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("PopupMessage") end
|
||||
},
|
||||
showmode = {
|
||||
name = L["ShowMode"],
|
||||
desc = L["Choose mode for showing popups."],
|
||||
type = "text",
|
||||
order = 100,
|
||||
get = function() return self.db.profile.showmode end,
|
||||
set = function(v) self.db.profile.showmode = v end,
|
||||
validate = {["ALL"] = L["All"], ["INDIVIDUAL"] = L["Individual"]}
|
||||
},
|
||||
show = {
|
||||
name = L["Show"],
|
||||
desc = L["Toggle showing Popup settings for each window."],
|
||||
type = "group",
|
||||
order = 110,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 1),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[1] end,
|
||||
set = function(v) self.db.profile.show[1] = v; self:SetFrameStatus(1) end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 2),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 2),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[2] end,
|
||||
set = function(v) self.db.profile.show[2] = v; self:SetFrameStatus(2) end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 3),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 3),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[3] end,
|
||||
set = function(v) self.db.profile.show[3] = v; self:SetFrameStatus(3) end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 4),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 4),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[4] end,
|
||||
set = function(v) self.db.profile.show[4] = v; self:SetFrameStatus(4) end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 5),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 5),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[5] end,
|
||||
set = function(v) self.db.profile.show[5] = v; self:SetFrameStatus(5) end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 6),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 6),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[6] end,
|
||||
set = function(v) self.db.profile.show[6] = v; self:SetFrameStatus(6) end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dPopupShow"], 7),
|
||||
desc = string.format(L["Toggles popups on and off for chat window %d."], 7),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[7] end,
|
||||
set = function(v) self.db.profile.show[7] = v; self:SetFrameStatus(7) end
|
||||
},
|
||||
},
|
||||
disabled = function() if self.db.profile.showmode == "ALL" then return true else return false end end,
|
||||
},
|
||||
showall = {
|
||||
name = L["ShowAll"],
|
||||
desc = L["Toggles Popup on and off for all chat windows."],
|
||||
type = "toggle",
|
||||
order = 120,
|
||||
get = function() return self.db.profile.showall end,
|
||||
set = function(v)
|
||||
self.db.profile.showall = v
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self.db.profile.show[i] = v
|
||||
self:SetFrameStatus(i)
|
||||
end
|
||||
end,
|
||||
disabled = function() if self.db.profile.showmode == "INDIVIDUAL" then return true else return false end end,
|
||||
},
|
||||
|
||||
nick = {
|
||||
order = 130,
|
||||
name = L["Nickname"],
|
||||
desc = L["An alternate name to show in popups."],
|
||||
type = "text",
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.nickname end,
|
||||
set = function(v) self.db.profile.nickname = v end,
|
||||
hidden = function() return true end,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_PopupMessage:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:SetFrameStatus(i)
|
||||
end
|
||||
|
||||
self.playerName = UnitName("player");
|
||||
end
|
||||
function Prat_PopupMessage:OnDisable()
|
||||
|
||||
end
|
||||
|
||||
function Prat_PopupMessage:SetFrameStatus(id)
|
||||
local frame = getglobal("ChatFrame"..id)
|
||||
|
||||
if self.db.profile.show[id] then
|
||||
if not self:IsHooked(frame, "AddMessage") then self:SecureHook(frame, "AddMessage") end
|
||||
else
|
||||
if self:IsHooked(frame, "AddMessage") then self:Unhook(frame, "AddMessage") end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Prat_PopupMessage:AddMessage(frame, text, r, g, b, id)
|
||||
|
||||
if not text then return end
|
||||
local Name = string.gsub(text, ".*|Hplayer:(.-)|h.*", "%1")
|
||||
|
||||
if Name ~= self.playerName then
|
||||
local textL = string.lower(text)
|
||||
local playerL = string.lower(self.playerName)
|
||||
-- local nicknameL = string.lower(self.db.profile.nickname)
|
||||
|
||||
-- if string.find(textL, playerL) or string.find(textL, nicknameL) then
|
||||
if string.find(textL, playerL) then
|
||||
Prat_PopupFrame.fadeOut = 10;
|
||||
Prat_PopupFrame:SetAlpha(1);
|
||||
Prat_PopupFrameText:SetText(text);
|
||||
Prat_PopupFrame:Show();
|
||||
PlaySound("FriendJoinGame");
|
||||
end
|
||||
end
|
||||
|
||||
-- SecureHook no need to call original
|
||||
end
|
||||
|
||||
|
||||
function Prat_PopupMessage:PopupUpdated(elapsed)
|
||||
Prat_PopupFrame.fadeOut = Prat_PopupFrame.fadeOut - elapsed;
|
||||
if Prat_PopupFrame.fadeOut < -1 then
|
||||
Prat_PopupFrame:Hide();
|
||||
elseif Prat_PopupFrame.fadeOut < 0 then
|
||||
Prat_PopupFrame:SetAlpha(1 + Prat_PopupFrame.fadeOut);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+232
@@ -0,0 +1,232 @@
|
||||
--[[
|
||||
Name: Prat_Scroll
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_PlayerNames by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Scroll
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that enables mousewheel scrolling for chat windows (default=on).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratScrolling")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Scroll"] = true,
|
||||
["Chat window scrolling options."] = true,
|
||||
["MouseScroll"] = true,
|
||||
["Toggle mousewheel scrolling in chat windows on and off."] = true,
|
||||
["Chat%dScrolling"] = true,
|
||||
["Toggles mouse scrolling on and off for chat window %d."] = true,
|
||||
["Normal ScrollSpeed"] = true,
|
||||
["Sets number of lines mousewheel will scroll."] = true,
|
||||
["Ctrl ScrollSpeed"] = true,
|
||||
["Sets number of lines mousewheel will scroll when ctrl is pressed."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Scroll"] = "Scroll",
|
||||
["Chat window scrolling options."] = "Настройки прокрутки окна чата.",
|
||||
["MouseScroll"] = "Прокрутка мышкой",
|
||||
["Toggle mousewheel scrolling in chat windows on and off."] = "Вкл/Выкл прокрутку окна чата колесиком мышки.",
|
||||
["Chat%dScrolling"] = "ПрокруткаЧата%d",
|
||||
["Toggles mouse scrolling on and off for chat window %d."] = "Вкл/Выкл прокрутку мышкой окно чата %d.",
|
||||
["Normal ScrollSpeed"] = "Нормальная скорость прокрутки",
|
||||
["Sets number of lines mousewheel will scroll."] = "Установить кол-во строк, которое будет прокручиваться колесиком мышки.",
|
||||
["Ctrl ScrollSpeed"] = "Ctrl скорость прокрутки",
|
||||
["Sets number of lines mousewheel will scroll when ctrl is pressed."] = "Устанавливает кол-во прокрученных строки колесиком мышки при нажатии ctrl.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Scroll"] = "滚动",
|
||||
["Chat window scrolling options."] = "聊天窗口滚动选项。",
|
||||
["MouseScroll"] = "鼠标滚动",
|
||||
["Toggle mousewheel scrolling in chat windows on and off."] = "切换鼠标滚动聊天窗口功能打开与关闭。",
|
||||
["Chat%dScrolling"] = "窗口%d滚动",
|
||||
["Toggles mouse scrolling on and off for chat window %d."] = "切换聊天窗口 %d 鼠标滚动功能打开与关闭。",
|
||||
["Normal ScrollSpeed"] = "滚动速度",
|
||||
["Sets number of lines mousewheel will scroll."] = "鼠标滚动时卷动的行数。",
|
||||
["Ctrl ScrollSpeed"] = "<Ctrl>滚动速度",
|
||||
["Sets number of lines mousewheel will scroll when ctrl is pressed."] = "设置按下<Ctrl>时鼠标滚轮的滚动行数。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Scroll"] = "스크롤",
|
||||
["Chat window scrolling options."] = "대화창 스크롤 설정입니다.",
|
||||
["MouseScroll"] = "마우스 스크롤",
|
||||
["Toggle mousewheel scrolling in chat windows on and off."] = "대화창을 마우스횔로 스크롤하는 것을 켜고 끄기를 전환합니다.",
|
||||
["Chat%dScrolling"] = "대화창%d 스크롤",
|
||||
["Toggles mouse scrolling on and off for chat window %d."] = "대화창 %d에 대한 마우스 스크롤을 켜고 끄기를 전환합니다.",
|
||||
["Normal ScrollSpeed"] = "일반 스크롤 속도",
|
||||
["Sets number of lines mousewheel will scroll."] = "설정한 라인 수 만큼 스크롤됩니다.",
|
||||
["Ctrl ScrollSpeed"] = "컨트롤 스크롤 속도",
|
||||
["Sets number of lines mousewheel will scroll when ctrl is pressed."] = "컨트롤키를 눌렀을 때 설정된 라인 수만큼 스크롤됩니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Scroll = Prat:NewModule("scroll")
|
||||
|
||||
function Prat_Scroll:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Scrolling")
|
||||
Prat:RegisterDefaults("Scrolling", "profile", {
|
||||
on = true,
|
||||
chatscrolls = {true, true, true, true, true, true, true},
|
||||
normscrollspeed = 1,
|
||||
ctrlscrollspeed = 3,
|
||||
})
|
||||
Prat.Options.args.scroll = {
|
||||
name = L["Scroll"],
|
||||
desc = L["Chat window scrolling options."],
|
||||
type = "group",
|
||||
args = {
|
||||
mousescroll = {
|
||||
name = L["MouseScroll"],
|
||||
desc = L["Toggle mousewheel scrolling in chat windows on and off."],
|
||||
type = "group",
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dScrolling"], 1),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[1] end,
|
||||
set = function(v) self.db.profile.chatscrolls[1] = v; self:MouseWheel(1,v) end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dScrolling"], 2),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 2),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[2] end,
|
||||
set = function(v) self.db.profile.chatscrolls[2] = v; self:MouseWheel(2,v) end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dScrolling"], 3),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 3),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[3] end,
|
||||
set = function(v) self.db.profile.chatscrolls[3] = v; self:MouseWheel(3,v) end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dScrolling"], 4),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 4),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[4] end,
|
||||
set = function(v) self.db.profile.chatscrolls[4] = v; self:MouseWheel(4,v) end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dScrolling"], 5),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 5),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[5] end,
|
||||
set = function(v) self.db.profile.chatscrolls[5] = v; self:MouseWheel(5,v) end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dScrolling"], 6),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 6),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[6] end,
|
||||
set = function(v) self.db.profile.chatscrolls[6] = v; self:MouseWheel(6,v) end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dScrolling"], 7),
|
||||
desc = string.format(L["Toggles mouse scrolling on and off for chat window %d."], 7),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.chatscrolls[7] end,
|
||||
set = function(v) self.db.profile.chatscrolls[7] = v; self:MouseWheel(7,v) end
|
||||
}
|
||||
}
|
||||
},
|
||||
normscrollspeed = {
|
||||
name = L["Normal ScrollSpeed"],
|
||||
desc = L["Sets number of lines mousewheel will scroll."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.normscrollspeed end,
|
||||
set = function(v) self.db.profile.normscrollspeed = v end,
|
||||
min = 1,
|
||||
max = 21,
|
||||
step = 1,
|
||||
order = 180
|
||||
},
|
||||
ctrlscrollspeed = {
|
||||
name = L["Ctrl ScrollSpeed"],
|
||||
desc = L["Sets number of lines mousewheel will scroll when ctrl is pressed."],
|
||||
type = "range",
|
||||
get = function() return self.db.profile.ctrlscrollspeed end,
|
||||
set = function(v) self.db.profile.ctrlscrollspeed = v end,
|
||||
min = 3,
|
||||
max = 21,
|
||||
step = 3,
|
||||
order = 190
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("scroll") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Scroll:OnEnable()
|
||||
for i = 1,NUM_CHAT_WINDOWS do
|
||||
self:MouseWheel(i,self.db.profile.chatscrolls[i])
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Scroll:OnDisable()
|
||||
for i = 1,NUM_CHAT_WINDOWS do
|
||||
self:MouseWheel(i,false)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Scroll:MouseWheel(id, enabled)
|
||||
local cf = getglobal("ChatFrame"..id)
|
||||
if enabled then
|
||||
cf:SetScript("OnMouseWheel", function()
|
||||
if (arg1 > 0) then
|
||||
if IsShiftKeyDown() then
|
||||
cf:ScrollToTop()
|
||||
else
|
||||
if IsControlKeyDown() then
|
||||
for i = 1,self.db.profile.ctrlscrollspeed do
|
||||
cf:ScrollUp()
|
||||
end
|
||||
else
|
||||
for i = 1,self.db.profile.normscrollspeed do
|
||||
cf:ScrollUp()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (arg1 < 0) then
|
||||
if IsShiftKeyDown() then
|
||||
cf:ScrollToBottom()
|
||||
else
|
||||
if IsControlKeyDown() then
|
||||
for i = 1,self.db.profile.ctrlscrollspeed do
|
||||
cf:ScrollDown()
|
||||
end
|
||||
else
|
||||
for i = 1,self.db.profile.normscrollspeed do
|
||||
cf:ScrollDown()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
cf:EnableMouseWheel(true)
|
||||
else
|
||||
cf:SetScript("OnMouseWheel", nil)
|
||||
cf:EnableMouseWheel(false)
|
||||
end
|
||||
end
|
||||
Executable
+301
@@ -0,0 +1,301 @@
|
||||
--[[
|
||||
Name: Prat_StickyChannels
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_StickyChannels by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#StickyChannels
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that toggles sticky of different chat channel types on and off (default=on).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratStickyChannels")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["StickyChannels"] = true,
|
||||
["Chat channel sticky options."] = true,
|
||||
["ChatType"] = true,
|
||||
["Per chat type options."] = true,
|
||||
["Say"] = true,
|
||||
["Whisper"] = true,
|
||||
["Yell"] = true,
|
||||
["Party"] = true,
|
||||
["Guild"] = true,
|
||||
["Officer"] = true,
|
||||
["Raid"] = true,
|
||||
["RaidWarning"] = true,
|
||||
["Battleground"] = true,
|
||||
["Channel"] = true,
|
||||
["Emote"] = true,
|
||||
["%sSticky"] = true,
|
||||
["Toggles sticky on and off for %s."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["StickyChannels"] = "StickyChannels",
|
||||
["Chat channel sticky options."] = "Опции прилипания каналов чата.",
|
||||
["ChatType"] = "ТипЧата",
|
||||
["Per chat type options."] = "Опции чат типа.",
|
||||
["Say"] = "Сказать",
|
||||
["Whisper"] = "Шепот",
|
||||
["Yell"] = "Крикнуть",
|
||||
["Party"] = "Группа",
|
||||
["Guild"] = "Гильдия",
|
||||
["Officer"] = "Офицер",
|
||||
["Raid"] = "Рейд",
|
||||
["RaidWarning"] = "Объявление рейду",
|
||||
["Battleground"] = "Поле боя",
|
||||
["Channel"] = "Канал",
|
||||
["Emote"] = "Эмоция",
|
||||
["%sSticky"] = "Липкая \"%s\"",
|
||||
["Toggles sticky on and off for %s."] = "Вкл/Выкл липкие %s.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["StickyChannels"] = "固定频道",
|
||||
["Chat channel sticky options."] = "固定聊天频道选项。",
|
||||
["ChatType"] = "聊天分类",
|
||||
["Per chat type options."] = "聊天类型选项。",
|
||||
["Say"] = "说",
|
||||
["Whisper"] = "密语",
|
||||
["Yell"] = "喊",
|
||||
["Party"] = "队伍",
|
||||
["Guild"] = "公会",
|
||||
["Officer"] = "官员",
|
||||
["Raid"] = "团队",
|
||||
["RaidWarning"] = "团队报警",
|
||||
["Battleground"] = "战场",
|
||||
["Channel"] = "频道",
|
||||
["Emote"] = "表情",
|
||||
["%sSticky"] = "固定%s",
|
||||
["Toggles sticky on and off for %s."] = "切换固定%s频道.",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["StickyChannels"] = "채널 고정",
|
||||
["Chat channel sticky options."] = "대화 채널 고정 설정입니다.",
|
||||
["ChatType"] = "대화 종류",
|
||||
["Per chat type options."] = "대화종류에 따른 설정입니다.",
|
||||
["Say"] = "일반",
|
||||
["Whisper"] = "귓속말",
|
||||
["Yell"] = "외치기",
|
||||
["Party"] = "파티",
|
||||
["Guild"] = "길드",
|
||||
["Officer"] = "오피서",
|
||||
["Raid"] = "공격대",
|
||||
["RaidWarning"] = "공대 경보",
|
||||
["Battleground"] = "전장",
|
||||
["Channel"] = "채널",
|
||||
["Emote"] = "감정표현",
|
||||
["%sSticky"] = "%s 고정",
|
||||
["Toggles sticky on and off for %s."] = "%s에 대한 고정 켜고 끄기를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_StickyChannels = Prat:NewModule("stickychannels")
|
||||
|
||||
function Prat_StickyChannels:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("StickyChannels")
|
||||
Prat:RegisterDefaults("StickyChannels", "profile", {
|
||||
on = true,
|
||||
say = true,
|
||||
whisper = true,
|
||||
yell = true,
|
||||
party = true,
|
||||
guild = true,
|
||||
officer = true,
|
||||
raid = true,
|
||||
raid_warning = true,
|
||||
battleground = true,
|
||||
channel = true,
|
||||
emote = true,
|
||||
})
|
||||
Prat.Options.args.stickychannels = {
|
||||
name = L["StickyChannels"],
|
||||
desc = L["Chat channel sticky options."],
|
||||
type = "group",
|
||||
args = {
|
||||
chattype = {
|
||||
name = L["ChatType"],
|
||||
desc = L["Per chat type options."],
|
||||
type = "group",
|
||||
args = {
|
||||
say = {
|
||||
name = string.format(L["%sSticky"], L["Say"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Say"]),
|
||||
type = "toggle",
|
||||
order = 101,
|
||||
get = function() return self.db.profile.say end,
|
||||
set = function(v)
|
||||
self.db.profile.say = v
|
||||
self:Stickum("SAY",v)
|
||||
end
|
||||
},
|
||||
whisper = {
|
||||
name = string.format(L["%sSticky"], L["Whisper"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Whisper"]),
|
||||
type = "toggle",
|
||||
order = 102,
|
||||
get = function() return self.db.profile.whisper end,
|
||||
set = function(v)
|
||||
self.db.profile.whisper = v
|
||||
self:Stickum("WHISPER",v)
|
||||
end
|
||||
},
|
||||
yell = {
|
||||
name = string.format(L["%sSticky"], L["Yell"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Yell"]),
|
||||
type = "toggle",
|
||||
order = 103,
|
||||
get = function() return self.db.profile.yell end,
|
||||
set = function(v)
|
||||
self.db.profile.yell = v
|
||||
self:Stickum("YELL",v)
|
||||
end
|
||||
},
|
||||
party = {
|
||||
name = string.format(L["%sSticky"], L["Party"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Party"]),
|
||||
type = "toggle",
|
||||
order = 104,
|
||||
get = function() return self.db.profile.party end,
|
||||
set = function(v)
|
||||
self.db.profile.party = v
|
||||
self:Stickum("PARTY",v)
|
||||
end
|
||||
},
|
||||
guild = {
|
||||
name = string.format(L["%sSticky"], L["Guild"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Guild"]),
|
||||
type = "toggle",
|
||||
order = 105,
|
||||
get = function() return self.db.profile.guild end,
|
||||
set = function(v)
|
||||
self.db.profile.guild = v
|
||||
self:Stickum("GUILD",v)
|
||||
end
|
||||
},
|
||||
officer = {
|
||||
name = string.format(L["%sSticky"], L["Officer"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Officer"]),
|
||||
type = "toggle",
|
||||
order = 106,
|
||||
get = function() return self.db.profile.officer end,
|
||||
set = function(v)
|
||||
self.db.profile.officer = v
|
||||
self:Stickum("OFFICER",v)
|
||||
end
|
||||
},
|
||||
raid = {
|
||||
name = string.format(L["%sSticky"], L["Raid"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Raid"]),
|
||||
type = "toggle",
|
||||
order = 107,
|
||||
get = function() return self.db.profile.raid end,
|
||||
set = function(v)
|
||||
self.db.profile.raid = v
|
||||
self:Stickum("RAID",v)
|
||||
end
|
||||
},
|
||||
raidwarning = {
|
||||
name = string.format(L["%sSticky"], L["RaidWarning"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["RaidWarning"]),
|
||||
type = "toggle",
|
||||
order = 108,
|
||||
get = function() return self.db.profile.raid_warning end,
|
||||
set = function(v)
|
||||
self.db.profile.raid_warning = v
|
||||
self:Stickum("RAID_WARNING",v)
|
||||
end
|
||||
},
|
||||
battleground = {
|
||||
name = string.format(L["%sSticky"], L["Battleground"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Battleground"]),
|
||||
type = "toggle",
|
||||
order = 109,
|
||||
get = function() return self.db.profile.battleground end,
|
||||
set = function(v)
|
||||
self.db.profile.battleground = v
|
||||
self:Stickum("BATTLEGROUND",v)
|
||||
end
|
||||
},
|
||||
channel = {
|
||||
name = string.format(L["%sSticky"], L["Channel"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Channel"]),
|
||||
type = "toggle",
|
||||
order = 110,
|
||||
get = function() return self.db.profile.channel end,
|
||||
set = function(v)
|
||||
self.db.profile.channel = v
|
||||
self:Stickum("CHANNEL",v)
|
||||
end
|
||||
},
|
||||
emote = {
|
||||
name = string.format(L["%sSticky"], L["Emote"]),
|
||||
desc = string.format(L["Toggles sticky on and off for %s."], L["Emote"]),
|
||||
type = "toggle",
|
||||
order = 111,
|
||||
get = function() return self.db.profile.emote end,
|
||||
set = function(v)
|
||||
self.db.profile.emote = v
|
||||
self:Stickum("EMOTE",v)
|
||||
end
|
||||
}
|
||||
}
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("stickychannels") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_StickyChannels:OnEnable()
|
||||
self:Stickum("SAY",self.db.profile.say)
|
||||
self:Stickum("WHISPER",self.db.profile.whisper)
|
||||
self:Stickum("YELL",self.db.profile.yell)
|
||||
self:Stickum("PARTY",self.db.profile.party)
|
||||
self:Stickum("GUILD",self.db.profile.guild)
|
||||
self:Stickum("OFFICER",self.db.profile.officer)
|
||||
self:Stickum("RAID",self.db.profile.raid)
|
||||
self:Stickum("RAID_WARNING",self.db.profile.raid_warning)
|
||||
self:Stickum("BATTLEGROUND",self.db.profile.battleground)
|
||||
self:Stickum("CHANNEL",self.db.profile.channel)
|
||||
self:Stickum("EMOTE",self.db.profile.emote)
|
||||
end
|
||||
|
||||
function Prat_StickyChannels:OnDisable()
|
||||
self:Stickum("SAY",false)
|
||||
self:Stickum("WHISPER",false)
|
||||
self:Stickum("YELL",false)
|
||||
self:Stickum("PARTY",false)
|
||||
self:Stickum("GUILD",false)
|
||||
self:Stickum("OFFICER",false)
|
||||
self:Stickum("RAID",false)
|
||||
self:Stickum("RAID_WARNING",false)
|
||||
self:Stickum("BATTLEGROUND",false)
|
||||
self:Stickum("CHANNEL",false)
|
||||
self:Stickum("EMOTE",false)
|
||||
end
|
||||
|
||||
function Prat_StickyChannels:Stickum(channel,stickied)
|
||||
if stickied then
|
||||
ChatTypeInfo[channel].sticky = 1
|
||||
else
|
||||
ChatTypeInfo[channel].sticky = 0
|
||||
end
|
||||
end
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
--[[
|
||||
Name: Prat_TellTarget
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_TellTarget by Industrial
|
||||
ChatFrameExtender by Satrina
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#TellTarget
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds a slash command (/tt) to send a message to your target (default=on).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratTellTarget")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["TellTarget"] = true,
|
||||
["Adds telltarget slash command (/tt)."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
["Target does not exist."] = true,
|
||||
["Target is not a player."] = true,
|
||||
["No target selected."] = true,
|
||||
["NoTarget"] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["TellTarget"] = "TellTarget",
|
||||
["Adds telltarget slash command (/tt)."] = "Добавляет слеш-команду 'сказать о цели' (/tt).",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
["Target does not exist."] = "Цель не существует.",
|
||||
["Target is not a player."] = "Выбранная цель не является игроком.",
|
||||
["No target selected."] = "Нет выбранной цели.",
|
||||
["NoTarget"] = "Нет цели",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["TellTarget"] = "通知目标",
|
||||
["Adds telltarget slash command (/tt)."] = "添加通知目标命令(/tt)。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭",
|
||||
["Target does not exist."] = "目标不存在。",
|
||||
["Target is not a player."] = "目标非玩家。",
|
||||
["No target selected."] = "无目标选定。",
|
||||
["NoTarget"] = "无目标",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["TellTarget"] = "대상대화",
|
||||
["Adds telltarget slash command (/tt)."] = "대상대화를 위한 (/tt) 명령 추가",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기 전환",
|
||||
["Target does not exist."] = "대상이 없습니다.",
|
||||
["Target is not a player."] = "올바른 대상이 아닙니다.",
|
||||
["No target selected."] = "선택된 대상이 없습니다.",
|
||||
["NoTarget"] = "대상없음",
|
||||
} end)
|
||||
|
||||
Prat_TellTarget = Prat:NewModule("telltarget")
|
||||
|
||||
function Prat_TellTarget:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("TellTarget")
|
||||
Prat:RegisterDefaults("TellTarget", "profile", {
|
||||
on = true,
|
||||
})
|
||||
Prat.Options.args.telltarget = {
|
||||
name = L["TellTarget"],
|
||||
desc = L["Adds telltarget slash command (/tt)."],
|
||||
type = "group",
|
||||
args = {
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("telltarget") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_TellTarget:OnEnable()
|
||||
self:Hook("ChatEdit_ExtractTellTarget")
|
||||
self:Hook("ChatEdit_ParseText")
|
||||
end
|
||||
|
||||
function Prat_TellTarget:TellTarget(msg)
|
||||
if not UnitExists("target") then return end
|
||||
if not UnitIsPlayer("target") then Prat:Print(L["Target is not a player."]); return end
|
||||
if not UnitName("target") then Prat:Print(L["No target selected."]); return end
|
||||
local cf = DEFAULT_CHAT_FRAME
|
||||
cf.editBox.chatType = "WHISPER"
|
||||
cf.editBox.tellTarget = UnitName("target")
|
||||
ChatEdit_UpdateHeader(cf.editBox)
|
||||
if not cf.editBox:IsVisible() then
|
||||
ChatFrame_OpenChat("", cf)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_TellTarget:ChatEdit_ExtractTellTarget(editBox, msg)
|
||||
self.hooks["ChatEdit_ExtractTellTarget"](editBox, msg)
|
||||
if (editBox.tellTarget == "%t") then
|
||||
editBox.tellTarget = UnitName("target") or L["NoTarget"]
|
||||
ChatEdit_UpdateHeader(editBox)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_TellTarget:ChatEdit_ParseText(editBox, send)
|
||||
self.hooks["ChatEdit_ParseText"](editBox, send)
|
||||
local text = editBox:GetText()
|
||||
if not (strsub(text, 1, 1) ~= "/") then
|
||||
local command = gsub(text, "/([^%s]+)%s(.*)", "/%1", 1)
|
||||
if command == "/tt" then
|
||||
editBox.chatType = "WHISPER"
|
||||
editBox.tellTarget = UnitName("target") or L["NoTarget"]
|
||||
ChatEdit_UpdateHeader(editBox)
|
||||
editBox:SetText(strsub(text, strlen(command) + 2))
|
||||
end
|
||||
end
|
||||
end
|
||||
Executable
+468
@@ -0,0 +1,468 @@
|
||||
--[[
|
||||
Name: Prat_Timestamps
|
||||
Revision: $Revision: 16065 $
|
||||
Author(s): Curney (asml8ed@gmail.com)
|
||||
Krtek (krtek4@gmail.com)
|
||||
Inspired by: idChat2_Timestamps by Industrial
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Timestamps
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that adds timestamps to chat windows (default=on).
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratTimestamps")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Timestamps"] = true,
|
||||
["Timestamp options."] = true,
|
||||
["ShowMode"] = true,
|
||||
["Choose mode for showing timestamps."] = true,
|
||||
["All"] = true,
|
||||
["Individual"] = true,
|
||||
["Show"] = true,
|
||||
["Toggle showing timestamp settings for each window."] = true,
|
||||
["Chat%dTimestampShow"] = true,
|
||||
["Toggles timestamp on and off for chat window %d."] = true,
|
||||
["ShowAll"] = true,
|
||||
["Toggles timestamp on and off for all chat windows."] = true,
|
||||
["FormatMode"] = true,
|
||||
["Choose mode for setting timestamps."] = true,
|
||||
["Format"] = true,
|
||||
["Format the timestamp format for each window."] = true,
|
||||
["Chat%dTimestampFormat"] = true,
|
||||
["Set timestamp format for chat window %d (strftime format)."] = true,
|
||||
["FormatAll"] = true,
|
||||
["Set timestamp format for all chat windows (strftime format)."] = true,
|
||||
["Show Space"] = true,
|
||||
["Toggle adding space after timestamp."] = true,
|
||||
["Color Timestamp"] = true,
|
||||
["Toggle the coloring the timestamp on and off."] = true,
|
||||
["Set Color"] = true,
|
||||
["Change the color of the timestamp."] = true,
|
||||
["Use Local Time"] = true,
|
||||
["Toggle using local time on and off."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Timestamps"] = "Timestamps",
|
||||
["Timestamp options."] = "Настройки времени",
|
||||
["ShowMode"] = "Показать режим",
|
||||
["Choose mode for showing timestamps."] = "Выберите режим для показа времени.",
|
||||
["All"] = "Все",
|
||||
["Individual"] = "Индивидуальный ",
|
||||
["Show"] = "Показать",
|
||||
["Toggle showing timestamp settings for each window."] = "Вкл/Выкл показ настроек времени для каждого окна.",
|
||||
["Chat%dTimestampShow"] = "ПоказатьВремяЧата%d",
|
||||
["Toggles timestamp on and off for chat window %d."] = "Вкл/Выкл время для окна чата %d.",
|
||||
["ShowAll"] = "Показать все",
|
||||
["Toggles timestamp on and off for all chat windows."] = "Вкл/Выкл время для всех окон чата.",
|
||||
["FormatMode"] = "ФорматРежим",
|
||||
["Choose mode for setting timestamps."] = "Выберите режим для задания времени.",
|
||||
["Format"] = "Формат",
|
||||
["Format the timestamp format for each window."] = "Форматировать формат времени для каждого окна.",
|
||||
["Chat%dTimestampFormat"] = "ФорматВремениЧата%d",
|
||||
["Set timestamp format for chat window %d (strftime format)."] = "Установить формат времени для окна чата %d.",
|
||||
["FormatAll"] = "ФорматВсего",
|
||||
["Set timestamp format for all chat windows (strftime format)."] = "Установить формат времени для всех окон чата.",
|
||||
["Show Space"] = "Показать пробел",
|
||||
["Toggle adding space after timestamp."] = "Вкл/Выкл добавление пробела после времени.",
|
||||
["Color Timestamp"] = "Цвет времени",
|
||||
["Toggle the coloring the timestamp on and off."] = "Вкл/Выкл окраску времени.",
|
||||
["Set Color"] = "Установить цвет",
|
||||
["Change the color of the timestamp."] = "Изменить цвет времени.",
|
||||
["Use Local Time"] = "Использовать часовой пояс",
|
||||
["Toggle using local time on and off."] = "Вкл/Выкл использование локального времени.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Timestamps"] = "时间",
|
||||
["Timestamp options."] = "聊天时间显示选项。",
|
||||
["ShowMode"] = "显示模式",
|
||||
["Choose mode for showing timestamps."] = "选择聊天窗口显示时间模式。",
|
||||
["All"] = "全部",
|
||||
["Individual"] = "独立",
|
||||
["Show"] = "显示",
|
||||
["Toggle showing timestamp settings for each window."] = "切换每一聊天窗口切换显示时间标签设置。",
|
||||
["Chat%dTimestampShow"] = "窗口%d时间显示",
|
||||
["Toggles timestamp on and off for chat window %d."] = "切换聊天窗口%d时间显示功能打开与关闭。",
|
||||
["ShowAll"] = "全部显示",
|
||||
["Toggles timestamp on and off for all chat windows."] = "切换所有聊天窗口时间显示的打开与关闭。",
|
||||
["FormatMode"] = "格式模式",
|
||||
["Choose mode for setting timestamps."] = "选择时间标签的格式设置。",
|
||||
["Format"] = "格式化",
|
||||
["Format the timestamp format for each window."] = "格式化每一窗口的时间显示。",
|
||||
["Chat%dTimestampFormat"] = "窗口%d时间格式",
|
||||
["Set timestamp format for chat window %d (strftime format)."] = "设置窗口%d的时间格式 (strftime格式)。",
|
||||
["FormatAll"] = "全部格式",
|
||||
["Set timestamp format for all chat windows (strftime format)."] = "设置全部窗口的时间格式 (strftime 格式)。",
|
||||
["Show Space"] = "空格",
|
||||
["Toggle adding space after timestamp."] = "切换时间标签后的空格。",
|
||||
["Color Timestamp"] = "颜色",
|
||||
["Toggle the coloring the timestamp on and off."] = "切换时间标签颜色功能打开与关闭。",
|
||||
["Set Color"] = "设置颜色",
|
||||
["Change the color of the timestamp."] = "更改时间标签颜色.",
|
||||
["Use Local Time"] = "本地时间",
|
||||
["Toggle using local time on and off."] = "切换服务器时间和本地时间.",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Timestamps"] = "타임스탬프",
|
||||
["Timestamp options."] = "타임스탬프 설정입니다.",
|
||||
["ShowMode"] = "표시 모드",
|
||||
["Choose mode for showing timestamps."] = "타임스탬프 표시에 대한 모드를 선택합니다.",
|
||||
["All"] = "모두",
|
||||
["Individual"] = "개별",
|
||||
["Show"] = "표시",
|
||||
["Toggle showing timestamp settings for each window."] = "각 창에 대한 타임스탬프 표시 전환",
|
||||
["Chat%dTimestampShow"] = "대화%d 타임스탬프 표시",
|
||||
["Toggles timestamp on and off for chat window %d."] = "대화창%d에 대한 타임스템프를 켜고 끄기를 전환합니다.",
|
||||
["ShowAll"] = "모두 표시",
|
||||
["Toggles timestamp on and off for all chat windows."] = "모든 대화창에 대한 타임스탬프 켜고 끄기를 전환합니다.",
|
||||
["FormatMode"] = "형식 모드",
|
||||
["Choose mode for setting timestamps."] = "타임스탬프 설정에 대한 모드를 선택합니다.",
|
||||
["Format"] = "형식",
|
||||
["Format the timestamp format for each window."] = "각 창에 대한 타임스탬프 형식을 설정합니다.",
|
||||
["Chat%dTimestampFormat"] = "대화%d 타임스탬프 형식",
|
||||
["Set timestamp format for chat window %d (strftime format)."] = "대화창 %d에 대한 타임스탬프 형식을 설정합니다(strftime format).",
|
||||
["FormatAll"] = "모든 형식",
|
||||
["Set timestamp format for all chat windows (strftime format)."] = "모든 대화창에 대한 타임스탬프 형식을 설정합니다(strftime format).",
|
||||
["Show Space"] = "빈칸 표시",
|
||||
["Toggle adding space after timestamp."] = "타임스탬프 다음에 빈 칸 추가를 전환합니다.",
|
||||
["Color Timestamp"] = "타임스탬프 색상",
|
||||
["Toggle the coloring the timestamp on and off."] = "타임스탬프 색상 켜고 끄기를 전환합니다.",
|
||||
["Set Color"] = "색상 설정",
|
||||
["Change the color of the timestamp."] = "타임스탬프의 색상을 변경합니다.",
|
||||
["Use Local Time"] = "로컬 시간 사용",
|
||||
["Toggle using local time on and off."] = "로컬 시간 사용 켜고 끄기를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_Timestamps = Prat:NewModule("timestamps")
|
||||
|
||||
function Prat_Timestamps:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Timestamps")
|
||||
Prat:RegisterDefaults("Timestamps", "profile", {
|
||||
on = true,
|
||||
showmode = "ALL",
|
||||
show = {true, true, true, true, true, true, true},
|
||||
showall = true,
|
||||
formatmode = "ALL",
|
||||
format = {"%X", "%X", "%X", "%X", "%X", "%X", "%X"},
|
||||
formatall = "%X",
|
||||
colortimestamp = true,
|
||||
color = {
|
||||
r = 1,
|
||||
g = 1,
|
||||
b = 1
|
||||
},
|
||||
space = true,
|
||||
localtime = true
|
||||
})
|
||||
Prat.Options.args.timestamps = {
|
||||
name = L["Timestamps"],
|
||||
desc = L["Timestamp options."],
|
||||
type = "group",
|
||||
args = {
|
||||
showmode = {
|
||||
name = L["ShowMode"],
|
||||
desc = L["Choose mode for showing timestamps."],
|
||||
type = "text",
|
||||
order = 100,
|
||||
get = function() return self.db.profile.showmode end,
|
||||
set = function(v) self.db.profile.showmode = v end,
|
||||
validate = {["ALL"] = L["All"], ["INDIVIDUAL"] = L["Individual"]}
|
||||
},
|
||||
show = {
|
||||
name = L["Show"],
|
||||
desc = L["Toggle showing timestamp settings for each window."],
|
||||
type = "group",
|
||||
order = 110,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 1),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 1),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[1] end,
|
||||
set = function(v) self.db.profile.show[1] = v; self:SetFrameStatus(1) end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 2),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 2),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[2] end,
|
||||
set = function(v) self.db.profile.show[2] = v; self:SetFrameStatus(2) end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 3),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 3),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[3] end,
|
||||
set = function(v) self.db.profile.show[3] = v; self:SetFrameStatus(3) end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 4),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 4),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[4] end,
|
||||
set = function(v) self.db.profile.show[4] = v; self:SetFrameStatus(4) end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 5),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 5),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[5] end,
|
||||
set = function(v) self.db.profile.show[5] = v; self:SetFrameStatus(5) end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 6),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 6),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[6] end,
|
||||
set = function(v) self.db.profile.show[6] = v; self:SetFrameStatus(6) end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dTimestampShow"], 7),
|
||||
desc = string.format(L["Toggles timestamp on and off for chat window %d."], 7),
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.show[7] end,
|
||||
set = function(v) self.db.profile.show[7] = v; self:SetFrameStatus(7) end
|
||||
},
|
||||
},
|
||||
disabled = function() if self.db.profile.showmode == "ALL" then return true else return false end end,
|
||||
},
|
||||
showall = {
|
||||
name = L["ShowAll"],
|
||||
desc = L["Toggles timestamp on and off for all chat windows."],
|
||||
type = "toggle",
|
||||
order = 120,
|
||||
get = function() return self.db.profile.showall end,
|
||||
set = function(v)
|
||||
self.db.profile.showall = v
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self.db.profile.show[i] = v
|
||||
self:SetFrameStatus(i)
|
||||
end
|
||||
end,
|
||||
disabled = function() if self.db.profile.showmode == "INDIVIDUAL" then return true else return false end end,
|
||||
},
|
||||
formatmode = {
|
||||
name = L["FormatMode"],
|
||||
desc = L["Choose mode for setting timestamps."],
|
||||
type = "text",
|
||||
order = 130,
|
||||
get = function() return self.db.profile.formatmode end,
|
||||
set = function(v) self.db.profile.formatmode = v end,
|
||||
validate = {["ALL"] = L["All"], ["INDIVIDUAL"] = L["Individual"]}
|
||||
},
|
||||
format = {
|
||||
name = L["Format"],
|
||||
desc = L["Format the timestamp format for each window."],
|
||||
type = "group",
|
||||
order = 140,
|
||||
args = {
|
||||
chat1 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 1),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 1),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[1] end,
|
||||
set = function(v) self.db.profile.format[1] = v end
|
||||
},
|
||||
chat2 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 2),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 2),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[2] end,
|
||||
set = function(v) self.db.profile.format[2] = v end
|
||||
},
|
||||
chat3 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 3),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 3),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[3] end,
|
||||
set = function(v) self.db.profile.format[3] = v end
|
||||
},
|
||||
chat4 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 4),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 4),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[4] end,
|
||||
set = function(v) self.db.profile.format[4] = v end
|
||||
},
|
||||
chat5 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 5),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 5),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[5] end,
|
||||
set = function(v) self.db.profile.format[5] = v end
|
||||
},
|
||||
chat6 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 6),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 6),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[6] end,
|
||||
set = function(v) self.db.profile.format[6] = v end
|
||||
},
|
||||
chat7 = {
|
||||
name = string.format(L["Chat%dTimestampFormat"], 7),
|
||||
desc = string.format(L["Set timestamp format for chat window %d (strftime format)."], 7),
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.format[7] end,
|
||||
set = function(v) self.db.profile.format[7] = v end
|
||||
},
|
||||
},
|
||||
disabled = function() if self.db.profile.formatmode == "ALL" then return true else return false end end,
|
||||
},
|
||||
formatall = {
|
||||
name = L["FormatAll"],
|
||||
desc = L["Set timestamp format for all chat windows (strftime format)."],
|
||||
type = "text",
|
||||
order = 150,
|
||||
usage = "<string>",
|
||||
get = function() return self.db.profile.formatall end,
|
||||
set = function(v)
|
||||
self.db.profile.formatall = v
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self.db.profile.format[i] = v
|
||||
end
|
||||
end,
|
||||
disabled = function() if self.db.profile.formatmode == "INDIVIDUAL" then return true else return false end end,
|
||||
},
|
||||
showspace = {
|
||||
name = L["Show Space"],
|
||||
desc = L["Toggle adding space after timestamp."],
|
||||
type = "toggle",
|
||||
order = 160,
|
||||
get = function() return self.db.profile.space end,
|
||||
set = function(v) self.db.profile.space = v end,
|
||||
},
|
||||
colortimestamp = {
|
||||
name = L["Color Timestamp"],
|
||||
desc = L["Toggle the coloring the timestamp on and off."],
|
||||
type = "toggle",
|
||||
order = 170,
|
||||
get = function() return self.db.profile.colortimestamp end,
|
||||
set = function(v) self.db.profile.colortimestamp = v end
|
||||
},
|
||||
setcolor = {
|
||||
name = L["Set Color"],
|
||||
desc = L["Change the color of the timestamp."],
|
||||
type = "color",
|
||||
order = 180,
|
||||
get = function() return self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b end,
|
||||
set = function(r, g, b, a) self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b = r, g, b end,
|
||||
disabled = function() if not self.db.profile.colortimestamp then return true else return false end end,
|
||||
},
|
||||
localtime = {
|
||||
name = L["Use Local Time"],
|
||||
desc = L["Toggle using local time on and off."],
|
||||
type = "toggle",
|
||||
order = 190,
|
||||
get = function() return self.db.profile.localtime end,
|
||||
set = function(v) self.db.profile.localtime = v end
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("timestamps") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Timestamps:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
Prat_Timestamps:SetFrameStatus(i)
|
||||
end
|
||||
|
||||
self.secondsDifference = 0
|
||||
_,self.lastMinute = GetGameTime()
|
||||
end
|
||||
|
||||
function Prat_Timestamps:SetFrameStatus(id)
|
||||
if self.db.profile.show[id] then
|
||||
if not self:IsHooked(getglobal("ChatFrame"..id), "AddMessage") then self:Hook(getglobal("ChatFrame"..id), "AddMessage", "AddMessage"..id) end
|
||||
else
|
||||
if self:IsHooked(getglobal("ChatFrame"..id), "AddMessage") then self:Unhook(getglobal("ChatFrame"..id), "AddMessage") end
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Timestamps:AddMessage1(...)
|
||||
Prat_Timestamps:AddMessage(1, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage2(...)
|
||||
Prat_Timestamps:AddMessage(2, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage3(...)
|
||||
Prat_Timestamps:AddMessage(3, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage4(...)
|
||||
Prat_Timestamps:AddMessage(4, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage5(...)
|
||||
Prat_Timestamps:AddMessage(5, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage6(...)
|
||||
Prat_Timestamps:AddMessage(6, unpack(arg))
|
||||
end
|
||||
function Prat_Timestamps:AddMessage7(...)
|
||||
Prat_Timestamps:AddMessage(7, unpack(arg))
|
||||
end
|
||||
|
||||
function Prat_Timestamps:AddMessage(id, frame, text, ...)
|
||||
if text then
|
||||
-- get timestamp format
|
||||
local dateFormat
|
||||
dateFormat = self.db.profile.format[id]
|
||||
-- get space character useage
|
||||
if ( self.db.profile.space ) then space = " " else space = "" end
|
||||
-- get color format
|
||||
if self.db.profile.colortimestamp then
|
||||
local color = string.format("%02x%02x%02x", self.db.profile.color.r*255, self.db.profile.color.g*255, self.db.profile.color.b*255)
|
||||
text = string.format("|cff"..color.."%s|r" .. space .. "%s", self:GetTime(dateFormat), text)
|
||||
else
|
||||
text = string.format("%s".. space .. "%s", self:GetTime(dateFormat), text)
|
||||
end
|
||||
end
|
||||
self.hooks[frame].AddMessage(frame, text, unpack(arg))
|
||||
end
|
||||
|
||||
function Prat_Timestamps:GetTime(format)
|
||||
if self.db.profile.localtime then
|
||||
return date(format)
|
||||
else
|
||||
local tempDate = date("*t")
|
||||
tempDate["hour"], tempDate["min"] = GetGameTime()
|
||||
-- taken from FuBar_ClockFu
|
||||
if self.lastMinute ~= tempDate["min"] then
|
||||
_,self.lastMinute = GetGameTime()
|
||||
self.secondsDifference = mod(time(), 60)
|
||||
end
|
||||
tempDate["sec"] = mod(time() - self.secondsDifference, 60)
|
||||
return date(format, time(tempDate))
|
||||
end
|
||||
end
|
||||
Executable
+269
@@ -0,0 +1,269 @@
|
||||
--[[
|
||||
Name: Prat_UrlCopy
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#UrlCopy
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that makes it easy to copy URL"s in chat windows.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratUrlCopy")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["UrlCopy"] = true,
|
||||
["URL formating options."] = true,
|
||||
["Show Brackets"] = true,
|
||||
["Toggle showing brackets on and off."] = true,
|
||||
["Use Popup"] = true,
|
||||
["Use popup window to show URL."] = true,
|
||||
["Color URL"] = true,
|
||||
["Toggle the URL color on and off."] = true,
|
||||
["Set Color"] = true,
|
||||
["Change the color of the URL."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["UrlCopy"] = "UrlCopy",
|
||||
["URL formating options."] = "Настройки формата URL-адреса.",
|
||||
["Show Brackets"] = "Показывать скобки",
|
||||
["Toggle showing brackets on and off."] = "Вкл/Выкл отображение скобок.",
|
||||
["Use Popup"] = "Всплывающее окно",
|
||||
["Use popup window to show URL."] = "Использовать всплывающее окно для отображение ссылки.",
|
||||
["Color URL"] = "Цвет ссылки",
|
||||
["Toggle the URL color on and off."] = "Вкл/Выкл окраску ссылок.",
|
||||
["Set Color"] = "Цвет",
|
||||
["Change the color of the URL."] = "Изменение цвета ссылок.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["UrlCopy"] = "复制超链接",
|
||||
["URL formating options."] = "超链接格式选项。",
|
||||
["Show Brackets"] = "显示括号",
|
||||
["Toggle showing brackets on and off."] = "切换显示括号功能打开与关闭。",
|
||||
["Use Popup"] = "弹出",
|
||||
["Use popup window to show URL."] = "用弹出窗口显示超链接。",
|
||||
["Color URL"] = "颜色",
|
||||
["Toggle the URL color on and off."] = "切换超链接颜色打开与关闭。",
|
||||
["Set Color"] = "设置颜色",
|
||||
["Change the color of the URL."] = "更改超链接颜色。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块的打开与关闭。",
|
||||
} end)
|
||||
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["UrlCopy"] = "URL 복사",
|
||||
["URL formating options."] = "URL 형식 설정입니다.",
|
||||
["Show Brackets"] = "괄호 표시",
|
||||
["Toggle showing brackets on and off."] = "괄호 표시 켜고 끄기를 전환합니다.",
|
||||
["Use Popup"] = "팝업 사용",
|
||||
["Use popup window to show URL."] = "URL 표시를 위한 팝업창을 사용합니다.",
|
||||
["Color URL"] = "색상 URL",
|
||||
["Toggle the URL color on and off."] = "URL 색상 켜고 끄기를 전환합니다.",
|
||||
["Set Color"] = "색상 설정",
|
||||
["Change the color of the URL."] = "URL의 색상을 변경합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
} end)
|
||||
|
||||
Prat_UrlCopy = Prat:NewModule("urlcopy")
|
||||
|
||||
function Prat_UrlCopy:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("UrlCopy")
|
||||
Prat:RegisterDefaults("UrlCopy", "profile", {
|
||||
on = true,
|
||||
bracket = true,
|
||||
popup = true,
|
||||
colorurl = true,
|
||||
color = {
|
||||
r = 1,
|
||||
g = 1,
|
||||
b = 1,
|
||||
},
|
||||
})
|
||||
Prat.Options.args.urlcopy = {
|
||||
name = L["UrlCopy"],
|
||||
desc = L["URL formating options."],
|
||||
type = "group",
|
||||
args = {
|
||||
bracket = {
|
||||
name = L["Show Brackets"],
|
||||
desc = L["Toggle showing brackets on and off."],
|
||||
type = "toggle",
|
||||
order = 160,
|
||||
get = function() return self.db.profile.bracket end,
|
||||
set = function(v) self.db.profile.bracket = v end,
|
||||
},
|
||||
popup = {
|
||||
name = L["Use Popup"],
|
||||
desc = L["Use popup window to show URL."],
|
||||
type = "toggle",
|
||||
order = 170,
|
||||
get = function() return self.db.profile.popup end,
|
||||
set = function(v) self.db.profile.popup = v end,
|
||||
},
|
||||
colorurl = {
|
||||
name = L["Color URL"],
|
||||
desc = L["Toggle the URL color on and off."],
|
||||
type = "toggle",
|
||||
order = 180,
|
||||
get = function() return self.db.profile.colorurl end,
|
||||
set = function(v) self.db.profile.colorurl = v end
|
||||
},
|
||||
setcolor = {
|
||||
name = L["Set Color"],
|
||||
desc = L["Change the color of the URL."],
|
||||
type = "color",
|
||||
order = 190,
|
||||
get = function() return self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b end,
|
||||
set = function(r, g, b, a) self.db.profile.color.r, self.db.profile.color.g, self.db.profile.color.b = r, g, b end,
|
||||
disabled = function() if not self.db.profile.colorurl then return true else return false end end,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function(v) self.db.profile.on = Prat:ToggleModuleActive("urlcopy") end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function Prat_UrlCopy:OnEnable()
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
self:Hook(getglobal("ChatFrame"..i), "AddMessage")
|
||||
end
|
||||
|
||||
self:Hook("SetItemRef")
|
||||
end
|
||||
|
||||
-- Hook
|
||||
function Prat_UrlCopy:AddMessage(frame, text, ...)
|
||||
if text then
|
||||
text = Prat_UrlCopy:ProcessText (text)
|
||||
end
|
||||
self.hooks[frame].AddMessage(frame, text, unpack(arg))
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:SetItemRef(link, text, button)
|
||||
if ( strsub(link, 1, 3) == "url" ) then
|
||||
Prat_UrlCopy:ShowUrl(link)
|
||||
else
|
||||
self.hooks.SetItemRef(link, text, button);
|
||||
end
|
||||
end
|
||||
|
||||
-- Utility Function
|
||||
function Prat_UrlCopy:Link (link)
|
||||
local returnedLink = " "
|
||||
|
||||
if self.db.profile.colorurl then
|
||||
local color = string.format("%02x%02x%02x", self.db.profile.color.r*255, self.db.profile.color.g*255, self.db.profile.color.b*255)
|
||||
returnedLink = " |cff" .. color
|
||||
end
|
||||
|
||||
returnedLink = returnedLink .. "|Hurl:" .. link .. "|h"
|
||||
|
||||
if ( self.db.profile.bracket ) then
|
||||
returnedLink = returnedLink .. "[" .. link .. "]"
|
||||
else
|
||||
returnedLink = returnedLink .. link
|
||||
end
|
||||
|
||||
returnedLink = returnedLink .. "|h|r "
|
||||
|
||||
return returnedLink
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:ProcessText(text)
|
||||
text = Prat_UrlCopy:Decompose(text)
|
||||
|
||||
return text
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:Decompose (chatstring)
|
||||
if chatstring ~= nil then
|
||||
-- www.X.Y url
|
||||
chatstring = string.gsub (chatstring, " www%.([_A-Za-z0-9-]+)%.(%S+)%s?", Prat_UrlCopy:Link ("www.%1.%2"))
|
||||
|
||||
-- X://Y url
|
||||
chatstring = string.gsub (chatstring, " (%a+)://(%S+)%s?", Prat_UrlCopy:Link ("%1://%2"))
|
||||
|
||||
-- X@X.Y url (---> email)
|
||||
chatstring = string.gsub (chatstring, " ([_A-Za-z0-9-%.]+)@([_A-Za-z0-9-]+)%.([_A-Za-z0-9-%.]+)%s?", Prat_UrlCopy:Link ("%1@%2.%3"))
|
||||
|
||||
-- XXX.YYY.ZZZ.WWW:VVVV url (IP of ts server for example)
|
||||
chatstring = string.gsub (chatstring, " (%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?):(%d%d?%d?%d?%d?)%s?", Prat_UrlCopy:Link ("%1.%2.%3.%4:%5"))
|
||||
|
||||
-- XXX.YYY.ZZZ.WWW url (---> IP)
|
||||
chatstring = string.gsub (chatstring, " (%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%s?", Prat_UrlCopy:Link ("%1.%2.%3.%4"))
|
||||
|
||||
-- X.Y.Z url
|
||||
chatstring = string.gsub (chatstring, " ([_A-Za-z0-9-]+)%.([_A-Za-z0-9-]+)%.(%S+)%s?", Prat_UrlCopy:Link ("%1.%2.%3"))
|
||||
|
||||
-- X.Y.Z:WWWW url (ts server for example)
|
||||
chatstring = string.gsub (chatstring, " ([_A-Za-z0-9-]+)%.([_A-Za-z0-9-]+)%.(%S+)%:([_0-9-]+)%s?", Prat_UrlCopy:Link ("%1.%2.%3:%4"))
|
||||
|
||||
end
|
||||
return chatstring
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:StaticPopupUrl(link)
|
||||
StaticPopupDialogs["SHOW_URL"] = {
|
||||
text = "URL : %s",
|
||||
button2 = TEXT(ACCEPT),
|
||||
hasEditBox = 1,
|
||||
hasWideEditBox = 1,
|
||||
showAlert = 1, -- HACK : it"s the only way I found to make de StaticPopup have sufficient width to show WideEditBox :(
|
||||
|
||||
OnShow = function()
|
||||
local editBox = getglobal(this:GetName().."WideEditBox");
|
||||
editBox:SetText(format(link));
|
||||
editBox:SetFocus();
|
||||
editBox:HighlightText(0);
|
||||
|
||||
local button = getglobal(this:GetName().."Button2");
|
||||
button:ClearAllPoints();
|
||||
button:SetWidth(200);
|
||||
button:SetPoint("CENTER", editBox, "CENTER", 0, -30);
|
||||
|
||||
getglobal(this:GetName().."AlertIcon"):Hide(); -- HACK : we hide the false AlertIcon
|
||||
end,
|
||||
|
||||
OnHide = function() end,
|
||||
OnAccept = function() end,
|
||||
OnCancel = function() end,
|
||||
EditBoxOnEscapePressed = function() this:GetParent():Hide(); end,
|
||||
timeout = 0,
|
||||
whileDead = 1,
|
||||
hideOnEscape = 1
|
||||
};
|
||||
|
||||
StaticPopup_Show ("SHOW_URL", link);
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:EditBoxUrl(link)
|
||||
if (not ChatFrameEditBox:IsShown()) then
|
||||
ChatFrame_OpenChat(link, DEFAULT_CHAT_FRAME);
|
||||
else
|
||||
ChatFrameEditBox:Insert(link);
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_UrlCopy:ShowUrl(link)
|
||||
link = strsub(link, 5)
|
||||
if ( self.db.profile.popup ) then
|
||||
Prat_UrlCopy:StaticPopupUrl(link)
|
||||
else
|
||||
Prat_UrlCopy:EditBoxUrl(link)
|
||||
end
|
||||
end
|
||||
Executable
+417
@@ -0,0 +1,417 @@
|
||||
--[[
|
||||
Name: Prat_Who
|
||||
Revision: $Revision: 16019 $
|
||||
Author(s): Krtek (krtek4@gmail.com)
|
||||
Website: http://www.wowace.com/files/index.php?path=Prat/
|
||||
Documentation: http://www.wowace.com/wiki/Prat/Integrated_Modules#Who
|
||||
SVN: http://svn.wowace.com/wowace/trunk/Prat/
|
||||
Description: Module for Prat that makes it easy to copy URL"s in chat windows.
|
||||
Dependencies: Prat
|
||||
]]
|
||||
|
||||
PRAT_WHO_FRAME_HEIGHT = 16
|
||||
LIST_TO_DISPLAY = 20
|
||||
|
||||
local L = AceLibrary("AceLocale-2.2"):new("PratWho")
|
||||
|
||||
L:RegisterTranslations("enUS", function() return {
|
||||
["Who"] = true,
|
||||
["Adds actions for channels and /chatwho."] = true,
|
||||
["List user(s) on channel."] = true,
|
||||
["<channel name> (see /PRAT who chanlist)"] = true,
|
||||
["Chanlist"] = true,
|
||||
["Channel List."] = true,
|
||||
["Join message"] = true,
|
||||
["Toggle showing of join message."] = true,
|
||||
["Leave message"] = true,
|
||||
["Toggle showing of leave message."] = true,
|
||||
["GUI"] = true,
|
||||
["Toggle showing information in a nice GUI or in default chat window."] = true,
|
||||
["Toggle"] = true,
|
||||
["Toggle the module on and off."] = true,
|
||||
|
||||
["Channels listing"] = true,
|
||||
["Who is on that chan"] = true,
|
||||
["Back to channel list"] = true,
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("ruRU", function() return {
|
||||
["Who"] = "Who",
|
||||
["Adds actions for channels and /chatwho."] = "Добавляет действия для каналов и /chatwho.",
|
||||
["List user(s) on channel."] = "Список пользователей канала.",
|
||||
["<channel name> (see /PRAT who chanlist)"] = "<название канала> (см. /PRAT who chanlist)",
|
||||
["Chanlist"] = "Chanlist",
|
||||
["Channel List."] = "Список каналов.",
|
||||
["Join message"] = "Сообщение присоединения",
|
||||
["Toggle showing of join message."] = "Вкл/Выкл показ сообщения при присоед.",
|
||||
["Leave message"] = "Сообщение ухода",
|
||||
["Toggle showing of leave message."] = "Вкл/Выкл показ сообщения при уходе.",
|
||||
["GUI"] = "GUI",
|
||||
["Toggle showing information in a nice GUI or in default chat window."] = "Вкл/Выкл показать информации в хорошем GUI или в стандартном окне чата.",
|
||||
["Toggle"] = "Вкл/Выкл",
|
||||
["Toggle the module on and off."] = "Вкл/Выкл модуль.",
|
||||
|
||||
["Channels listing"] = "Список каналов",
|
||||
["Who is on that chan"] = "Кто сейчас в этом канале",
|
||||
["Back to channel list"] = "Вернуться к списку каналов",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("zhCN", function() return {
|
||||
["Who"] = "查询",
|
||||
["Adds actions for channels and /chatwho."] = "输入/chatwho列出频道和聊天对象.",
|
||||
["List user(s) on channel."] = "列出频道中的用户。",
|
||||
["<channel name> (see /PRAT who chanlist)"] = "<频道名称> (查看 /PRAT who chanlist)",
|
||||
["Chanlist"] = "频道列表",
|
||||
["Channel List."] = "频道列表。",
|
||||
["Join message"] = "加入信息",
|
||||
["Toggle showing of join message."] = "显示加入信息。",
|
||||
["Leave message"] = "离开信息",
|
||||
["Toggle showing of leave message."] = "显示离开信息。",
|
||||
["GUI"] = "图形界面",
|
||||
["Toggle showing information in a nice GUI or in default chat window."] = "在图形界面或默认聊天窗口显示信息。",
|
||||
["Toggle"] = "切换",
|
||||
["Toggle the module on and off."] = "切换此模块打开与关闭。",
|
||||
|
||||
["Channels listing"] = "频道列表",
|
||||
["Who is on that chan"] = "在此频道查询",
|
||||
["Back to channel list"] = "返回频道列表",
|
||||
} end)
|
||||
|
||||
L:RegisterTranslations("koKR", function() return {
|
||||
["Who"] = "누구",
|
||||
["Adds actions for channels and /chatwho."] = "채널 목록과 /chatwho에 대한 동작을 추가합니다.",
|
||||
["List user(s) on channel."] = "채널 사용자 목록입니다.",
|
||||
["<channel name> (see /PRAT who chanlist)"] = "<채널명> (명령어: /PRAT who chanlist)",
|
||||
["Chanlist"] = "채널목록",
|
||||
["Channel List."] = "채널 목록입니다.",
|
||||
["Join message"] = "참여 메세지",
|
||||
["Toggle showing of join message."] = "참여 메세지 표시를 전환합니다.",
|
||||
["Leave message"] = "나감 메세지",
|
||||
["Toggle showing of leave message."] = "나감 메세지 표시를 전환합니다.",
|
||||
["GUI"] = "GUI",
|
||||
["Toggle showing information in a nice GUI or in default chat window."] = "기본대화창이나 GUI 에 정보 표시를 전환합니다.",
|
||||
["Toggle"] = "전환",
|
||||
["Toggle the module on and off."] = "모듈 켜고 끄기를 전환합니다.",
|
||||
|
||||
["Channels listing"] = "채널 목록",
|
||||
["Who is on that chan"] = "채널 접속 목록",
|
||||
["Back to channel list"] = "목록으로 돌아가기",
|
||||
} end)
|
||||
|
||||
Prat_Who = Prat:NewModule("who")
|
||||
|
||||
function Prat_Who:OnInitialize()
|
||||
self.db = Prat:AcquireDBNamespace("Who")
|
||||
Prat:RegisterDefaults("Who", "profile", {
|
||||
on = true,
|
||||
join = false,
|
||||
leave = false,
|
||||
gui = true,
|
||||
})
|
||||
PratWhoFrame:RegisterForDrag("LeftButton");
|
||||
self.wantInfo = false;
|
||||
self.info = "";
|
||||
self.lastChannel = "";
|
||||
self.List = {};
|
||||
self.selectedInList = 1;
|
||||
Prat.Options.args.who = {
|
||||
name = L["Who"],
|
||||
desc = L["Adds actions for channels and /chatwho."],
|
||||
type = "group",
|
||||
args = {
|
||||
who = {
|
||||
name = L["Who"],
|
||||
desc = L["List user(s) on channel."],
|
||||
type = "text",
|
||||
usage = L["<channel name> (see /PRAT who chanlist)"],
|
||||
get = false,
|
||||
set = function(v) Prat_Who:Who(v); end,
|
||||
validate = function(v) return self:CheckChan(v); end,
|
||||
error = "%s is not a valid channel (see /PRAT who chanlist)",
|
||||
},
|
||||
chanlist = {
|
||||
name = L["Chanlist"],
|
||||
desc = L["Channel List."],
|
||||
type = "execute",
|
||||
func = function(v) Prat_Who:ChannelList(v); end,
|
||||
},
|
||||
join = {
|
||||
name = L["Join message"],
|
||||
desc = L["Toggle showing of join message."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.join end,
|
||||
set = function(v)self.db.profile.join = v end,
|
||||
},
|
||||
leave = {
|
||||
name = L["Leave message"],
|
||||
desc = L["Toggle showing of leave message."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.leave end,
|
||||
set = function(v)self.db.profile.leave = v end,
|
||||
},
|
||||
gui = {
|
||||
name = L["GUI"],
|
||||
desc = L["Toggle showing information in a nice GUI or in default chat window."],
|
||||
type = "toggle",
|
||||
get = function() return self.db.profile.gui end,
|
||||
set = function(v)self.db.profile.gui = v end,
|
||||
},
|
||||
toggle = {
|
||||
name = L["Toggle"],
|
||||
desc = L["Toggle the module on and off."],
|
||||
type = "toggle",
|
||||
order = 200,
|
||||
get = function() return self.db.profile.on end,
|
||||
set = function() self.db.profile.on = Prat:ToggleModuleActive("who") end
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function Prat_Who:OnEnable()
|
||||
self:Hook("ChatFrame_OnEvent")
|
||||
end
|
||||
|
||||
function Prat_Who:Who(channel)
|
||||
self.wantInfo = true;
|
||||
self.List = {};
|
||||
self.lastChannel = channel;
|
||||
|
||||
ListChannelByName(channel);
|
||||
end
|
||||
|
||||
function Prat_Who:ShowWho()
|
||||
for name in string.gfind(self.info, "([%S]+)[%s]*") do
|
||||
table.insert(self.List, Prat_Who:BeautifyName(name))
|
||||
end
|
||||
|
||||
local function whoSort(a, b)
|
||||
local aWeight = 100
|
||||
if string.find(a, ".+%(owner%)") then aWeight = 0
|
||||
elseif string.find(a, ".+%(moderator%)") then aWeight = 50
|
||||
elseif string.find(a, ".+%(muted%)") then aWeight = 200
|
||||
end
|
||||
|
||||
local bWeight = 100
|
||||
if string.find(b, ".+%(owner%)") then bWeight = 0
|
||||
elseif string.find(b, ".+%(moderator%)") then bWeight = 50
|
||||
elseif string.find(b, ".+%(muted%)") then bWeight = 200
|
||||
end
|
||||
|
||||
if ( aWeight == bWeight ) then return a < b
|
||||
else return aWeight < bWeight
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(self.List, whoSort)
|
||||
|
||||
if ( self.db.profile.gui ) then
|
||||
Prat_Who:UpdateFrame()
|
||||
else
|
||||
local text = ""
|
||||
for i,name in self.List do
|
||||
text = text .. name .. " "
|
||||
end
|
||||
text = "This feature is buggy for time, please use the GUI mode :D"
|
||||
Prat_Who:NotGuiShow(text)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Who:ChannelList()
|
||||
local chanList = self:GetChannelList();
|
||||
|
||||
self.List = {}
|
||||
for number, name in chanList do
|
||||
table.insert(self.List, number .. ". " .. name);
|
||||
end
|
||||
|
||||
if ( self.db.profile.gui ) then
|
||||
Prat_Who:UpdateFrame()
|
||||
else
|
||||
local text = ""
|
||||
for i,name in self.List do
|
||||
text = text .. name .. " "
|
||||
end
|
||||
Prat_Who:NotGuiShow(text)
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Who:GetChannelList()
|
||||
self.lastChannel = "";
|
||||
local chanList = {};
|
||||
|
||||
local id, name
|
||||
for i=1, 10 do
|
||||
id, name = GetChannelName(i)
|
||||
if ( id > 0 and name ) then table.insert(chanList, id, name) end
|
||||
end
|
||||
|
||||
return chanList
|
||||
end
|
||||
|
||||
function Prat_Who:CheckChan(channel)
|
||||
local id, name = GetChannelName(channel)
|
||||
if ( id > 0 and name ) then return true
|
||||
else return false end
|
||||
end
|
||||
|
||||
-- The Hooking method isn"t good if some other addons need the information that are kept :(
|
||||
function Prat_Who:ChatFrame_OnEvent(event)
|
||||
if ( ( event == "CHAT_MSG_CHANNEL_LIST" ) and self.wantInfo) then
|
||||
self.info = arg1
|
||||
|
||||
if not ( strsub(self.info,1,1) == "[" ) then
|
||||
self:ShowWho()
|
||||
end
|
||||
|
||||
return;
|
||||
end;
|
||||
|
||||
if ( event == "CHAT_MSG_CHANNEL_JOIN" and self.db.profile.join and not self.db.profile.leave ) then
|
||||
return;
|
||||
end
|
||||
|
||||
if ( event == "CHAT_MSG_CHANNEL_LEAVE" and self.db.profile.leave ) then
|
||||
return;
|
||||
end
|
||||
|
||||
self.hooks.ChatFrame_OnEvent(event);
|
||||
end
|
||||
|
||||
-- Utility function
|
||||
local beautifyTable = {
|
||||
{ pattern = "%*(.+)", replacement = "%1 (owner)", patternB = "(.+) %(owner%)", replacementB = "%1" },
|
||||
{ pattern = "@(.+)", replacement = "%1 (moderator)", patternB = "(.+) %(moderator%)", replacementB = "%1" },
|
||||
{ pattern = "#(.+)", replacement = "%1 (muted)", patternB = "(.+) %(muted%)", replacementB = "%1" },
|
||||
}
|
||||
|
||||
function Prat_Who:BeautifyName(name)
|
||||
-- * channel owner, @ channel moderator, # muted/unvoiced.
|
||||
if name then
|
||||
name = string.gsub(name, ",", "");
|
||||
|
||||
for id, option in beautifyTable do
|
||||
name = string.gsub(name, option["pattern"], option["replacement"]);
|
||||
end
|
||||
|
||||
return name
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Who:DebeautifyName(name)
|
||||
if name then
|
||||
for id, option in beautifyTable do
|
||||
name = string.gsub(name, option["patternB"] , option["replacementB"]);
|
||||
end
|
||||
|
||||
return name
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Who:Invite()
|
||||
InviteByName(Prat_Who:DebeautifyName(self.List[self.selectedInList]));
|
||||
end
|
||||
|
||||
function Prat_Who:Whisper()
|
||||
local name = Prat_Who:DebeautifyName(self.List[self.selectedInList]);
|
||||
if ( not ChatFrameEditBox:IsVisible() ) then
|
||||
ChatFrame_OpenChat("/w "..name.." ");
|
||||
else
|
||||
ChatFrameEditBox:SetText("/w "..name.." ");
|
||||
end
|
||||
ChatEdit_ParseText(ChatFrame1.editBox, 0);
|
||||
end
|
||||
|
||||
-- Frame function
|
||||
function Prat_Who:NotGuiShow(text)
|
||||
Prat:Print(tostring(text))
|
||||
end
|
||||
|
||||
function Prat_Who:HideFrame()
|
||||
PratWhoFrame:Hide();
|
||||
Prat_Who.wantInfo = false;
|
||||
end
|
||||
|
||||
function Prat_Who:UpdateFrame()
|
||||
local listLength = table.getn(self.List)
|
||||
local listOffset = FauxScrollFrame_GetOffset(PratWhoScrollFrame);
|
||||
local listIndex;
|
||||
local listButton;
|
||||
|
||||
if ( not PratWhoFrame:IsVisible() ) then
|
||||
PratWhoFrame:Show();
|
||||
self.selectedInList = 1;
|
||||
end
|
||||
|
||||
if ( self.lastChannel == "" ) then
|
||||
PratWhoTitle:SetText(L["Channels listing"]);
|
||||
PratWhoInviteButton:Hide();
|
||||
PratWhoWhisperButton:Hide();
|
||||
PratWhoToggleButton:SetText(L["Who is on that chan"]);
|
||||
else
|
||||
local id, name = GetChannelName(self.lastChannel)
|
||||
PratWhoTitle:SetText(listLength .. " users on " .. id .. ". " .. name);
|
||||
PratWhoInviteButton:Show();
|
||||
PratWhoWhisperButton:Show();
|
||||
PratWhoToggleButton:SetText(L["Back to channel list"]);
|
||||
end
|
||||
|
||||
for i=1, LIST_TO_DISPLAY, 1 do
|
||||
listIndex = i + listOffset
|
||||
|
||||
listButton = getglobal("PratWhoButton"..i);
|
||||
|
||||
if ( listIndex > listLength ) then
|
||||
listButton:Hide();
|
||||
else
|
||||
listButton:SetID(listIndex);
|
||||
|
||||
if ( listIndex == self.selectedInList ) then
|
||||
listButton:LockHighlight();
|
||||
else
|
||||
listButton:UnlockHighlight();
|
||||
end
|
||||
|
||||
local name = self.List[listIndex]
|
||||
|
||||
if Prat_PlayerNames then
|
||||
local nameBis = string.gsub(name, "(.+) %(.+%)", "%1")
|
||||
local nameColored = Prat_PlayerNames:addInfo(nameBis)
|
||||
name = string.gsub(name, nameBis, nameColored)
|
||||
end
|
||||
|
||||
getglobal("PratWhoButton"..i.."ButtonTextName"):SetText(name);
|
||||
listButton:Show();
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
FauxScrollFrame_Update(PratWhoScrollFrame, listLength, LIST_TO_DISPLAY, PRAT_WHO_FRAME_HEIGHT );
|
||||
end
|
||||
|
||||
function Prat_Who:RefreshFrame()
|
||||
if ( self.lastChannel == "" ) then
|
||||
Prat_Who:ChannelList();
|
||||
else
|
||||
Prat_Who:Who(self.lastChannel);
|
||||
end
|
||||
end
|
||||
|
||||
function Prat_Who:Button_OnClick()
|
||||
self.selectedInList = this:GetID();
|
||||
Prat_Who:UpdateFrame()
|
||||
end
|
||||
|
||||
function Prat_Who_UpdateFrame() -- FauxScrollFrame_OnVerticalScroll() seems to doesn"t accept member function, so I have to declare this one
|
||||
Prat_Who:UpdateFrame()
|
||||
end
|
||||
|
||||
function Prat_Who:ToggleChanListWho()
|
||||
if ( self.lastChannel ~= "" ) then
|
||||
self.lastChannel = ""
|
||||
else
|
||||
self.lastChannel = string.gsub(self.List[self.selectedInList], "(%d+)%..+", "%1")
|
||||
end
|
||||
|
||||
Prat_Who:RefreshFrame()
|
||||
end
|
||||
Reference in New Issue
Block a user