Mercurial > wow > emfor1
diff CensusPlus.lua @ 23:099a20159243 v4.2d FIN
Merge 4th try
| author | EmFor |
|---|---|
| date | Sun, 14 Aug 2011 17:27:33 +0200 |
| parents | 77d2c7423ed5 |
| children |
line wrap: on
line diff
--- a/CensusPlus.lua Sun Aug 14 15:23:41 2011 +0000 +++ b/CensusPlus.lua Sun Aug 14 17:27:33 2011 +0200 @@ -33,7 +33,7 @@ -- EURO vs US localization problem workaround for common server names -- --------------------------------------------------------------------------------- -local g_InterfaceVersion = 30000; +local g_InterfaceVersion = 40000; g_CensusPlusLocale = "N/A"; -- Must read either US or EU g_CensusPlusTZOffset = -999; local g_LocaleSet = false; @@ -41,24 +41,27 @@ ---------------------------------------------------------------------------------- +--rm +-- guild to search (Extra button 'Take guild') +--local CensusPlus_MYGUILD = "The Last Journey"; +--local CensusPlus_MYGUILD = "Worgengrauen"; +CensusPlus_MYGUILD = "Flieht Ihr Narren"; +--------------------------------------------------------------------------------- -- -- Constants ---rm -local CensusPlus_MYGUILD = "The Last Journey"; -- Special guild to search ---------------------------------------------------------------------------------- -local CensusPlus_VERSION = "4.2.2"; -- version +local CensusPlus_VERSION = "5.0.2"; -- version local CensusPlus_MAXBARHEIGHT = 128; -- Length of blue bars -local CensusPlus_NUMGUILDBUTTONS = 10; -- How many guild buttons are on the UI? -local MAX_CHARACTER_LEVEL = 80; -- Maximum level a PC can attain +local CensusPlus_NUMGUILDBUTTONS = 10; -- How many guild buttons are on the UI? +local MAX_CHARACTER_LEVEL = 85; -- Maximum level a PC can attain --rm local MAX_LEVEL_DISPLAY = 255; -- Maximum level a PC can attain -local MAX_WHO_RESULTS = 45; -- Maximum number of who results the server will return +local MAX_WHO_RESULTS = 49; -- Maximum number of who results the server will return CensusPlus_GUILDBUTTONSIZEY = 16; -local CensusPlus_UPDATEDELAY = 5; -- Delay time between /who messages +local CensusPlus_UPDATEDELAY = 5; -- Delay time between /who messages local CP_MAX_TIMES = 50; -local g_ServerPrefix = ""; -- US VERSION!! ---local g_ServerPrefix = "EU-"; -- EU VERSION!! +local g_ServerPrefix = ""; -- formerly only US VERSION +--local g_ServerPrefix = "EU-"; -- EU VERSION automatically local wholib ---------------------------------------------------------------------------------- @@ -203,6 +206,9 @@ g_RaceClassList[CENSUSPlus_UNDEAD] = 27; g_RaceClassList[CENSUSPlus_DRAENEI] = 28; g_RaceClassList[CENSUSPlus_BLOODELF] = 29; +g_RaceClassList[CENSUSPlus_WORGEN] = 32; +g_RaceClassList[CENSUSPlus_GOBLIN] = 31; + g_TimeDatabase[CENSUSPlus_DRUID] = 0; g_TimeDatabase[CENSUSPlus_HUNTER] = 0; @@ -229,12 +235,14 @@ g_FactionCheck[CENSUSPlus_TROLL] = CENSUSPlus_HORDE; g_FactionCheck[CENSUSPlus_UNDEAD] = CENSUSPlus_HORDE; g_FactionCheck[CENSUSPlus_BLOODELF] = CENSUSPlus_HORDE; +g_FactionCheck[CENSUSPlus_GOBLIN] = CENSUSPlus_HORDE; g_FactionCheck[CENSUSPlus_DWARF] = CENSUSPlus_ALLIANCE; g_FactionCheck[CENSUSPlus_GNOME] = CENSUSPlus_ALLIANCE; g_FactionCheck[CENSUSPlus_HUMAN] = CENSUSPlus_ALLIANCE; g_FactionCheck[CENSUSPlus_NIGHTELF] = CENSUSPlus_ALLIANCE; g_FactionCheck[CENSUSPlus_DRAENEI] = CENSUSPlus_ALLIANCE; +g_FactionCheck[CENSUSPlus_WORGEN] = CENSUSPlus_ALLIANCE; local g_ReturnedZero = false; do @@ -244,7 +252,7 @@ and there is no real harm in removing the handler entirely, that's what's happening. If and when Blizzard decides to fix it, this should be removed. Thanks to ckknight of wowace for this ]] - GuildControlPopupFrame:SetScript("OnEvent", nil) +-- GuildControlPopupFrame:SetScript("OnEvent", nil) end @@ -420,9 +428,9 @@ function CensusPlus_GetFactionRaces(faction) local ret = {}; if (faction == CENSUSPlus_HORDE) then - ret = {CENSUSPlus_ORC, CENSUSPlus_TAUREN, CENSUSPlus_TROLL, CENSUSPlus_UNDEAD, CENSUSPlus_BLOODELF}; + ret = {CENSUSPlus_ORC, CENSUSPlus_TAUREN, CENSUSPlus_TROLL, CENSUSPlus_UNDEAD, CENSUSPlus_BLOODELF, CENSUSPlus_GOBLIN}; elseif (faction == CENSUSPlus_ALLIANCE) then - ret = {CENSUSPlus_DWARF, CENSUSPlus_GNOME, CENSUSPlus_HUMAN, CENSUSPlus_NIGHTELF, CENSUSPlus_DRAENEI}; + ret = {CENSUSPlus_DWARF, CENSUSPlus_GNOME, CENSUSPlus_HUMAN, CENSUSPlus_NIGHTELF, CENSUSPlus_DRAENEI, CENSUSPlus_WORGEN}; end return ret; end @@ -450,25 +458,29 @@ local function GetRaceClasses(race) local ret = {}; if (race == CENSUSPlus_ORC) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_SHAMAN, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_MAGE, CENSUSPlus_SHAMAN, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_TAUREN) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_SHAMAN, CENSUSPlus_DRUID, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_PALADIN, CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_SHAMAN, CENSUSPlus_PRIEST, CENSUSPlus_DRUID, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_TROLL) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_SHAMAN, CENSUSPlus_MAGE, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_SHAMAN, CENSUSPlus_MAGE, CENSUSPlus_DRUID, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_UNDEAD) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_DWARF) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_PALADIN, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_PALADIN, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_MAGE, CENSUSPlus_PRIEST, CENSUSPlus_SHAMAN, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_GNOME) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_ROGUE, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_ROGUE, CENSUSPlus_MAGE, CENSUSPlus_PRIEST, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_HUMAN) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_PALADIN, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_PALADIN, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_NIGHTELF) then - ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_DRUID, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_HUNTER, CENSUSPlus_MAGE, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_DRUID, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_BLOODELF) then - ret = {CENSUSPlus_PALADIN, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; + ret = {CENSUSPlus_WARRIOR, CENSUSPlus_PALADIN, CENSUSPlus_HUNTER, CENSUSPlus_ROGUE, CENSUSPlus_PRIEST, CENSUSPlus_MAGE, CENSUSPlus_WARLOCK, CENSUSPlus_DEATHKNIGHT}; elseif (race == CENSUSPlus_DRAENEI) then ret = {CENSUSPlus_WARRIOR, CENSUSPlus_PALADIN, CENSUSPlus_HUNTER, CENSUSPlus_PRIEST, CENSUSPlus_SHAMAN, CENSUSPlus_MAGE, CENSUSPlus_DEATHKNIGHT}; + elseif (race == CENSUSPlus_WORGEN) then + ret = {CENSUSPlus_DEATHKNIGHT, CENSUSPlus_DRUID, CENSUSPlus_HUNTER, CENSUSPlus_MAGE, CENSUSPlus_PRIEST, CENSUSPlus_ROGUE, CENSUSPlus_WARLOCK, CENSUSPlus_WARRIOR}; + elseif (race == CENSUSPlus_GOBLIN) then + ret = {CENSUSPlus_DEATHKNIGHT, CENSUSPlus_HUNTER, CENSUSPlus_MAGE, CENSUSPlus_PRIEST, CENSUSPlus_ROGUE, CENSUSPlus_SHAMAN, CENSUSPlus_WARLOCK, CENSUSPlus_WARRIOR}; end return ret; end @@ -489,8 +501,8 @@ -- ----------------------------------------------------------------------------------- local function GetNameLetters() +-- return { "a", "b", "c", "d", "e", "f", "g", "i", "o", "p", "r", "s", "t", "u", "y" }; --rm --- return { "a", "b", "c", "d", "e", "f", "g", "i", "o", "p", "r", "s", "t", "u", "y" }; -- return { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\195\134", "\195\164", "\195\182", "\195\188", "\195\152" }; return { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\195\134", "\195\164", "\195\182", "\195\188", "\195\152", "\195\184" }; end @@ -565,7 +577,7 @@ -- Called once on load -- ----------------------------------------------------------------------------------- -function CensusPlus_OnLoad() +function CensusPlus_OnLoad( this ) -- -- Update the version number -- @@ -642,10 +654,9 @@ -- local updateFrame = CreateFrame("Frame"); updateFrame:SetScript("OnUpdate", CensusPlus_OnUpdate); - CensusPlusTakeGuildButton:SetText( CENSUSPlus_TAKEGUILD.." \""..CensusPlus_MYGUILD.."\"" ); end -function CensusPlus_FriendsFrame_OnEvent(...) +function CensusPlus_FriendsFrame_OnEvent(self, event, ...) -- CensusPlus_Msg( "CP_FF_OE Message =>" .. event ); @@ -697,7 +708,7 @@ end - CP_Pre_OnEvent(...); + CP_Pre_OnEvent(self, event, ...); end @@ -1180,7 +1191,7 @@ -- Display a tooltip for the take button -- ----------------------------------------------------------------------------------- -function CensusPlus_Take_OnEnter() +function CensusPlus_Take_OnEnter( this ) if (g_IsCensusPlusInProgress) then if (g_CensusPlusManuallyPaused) then GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); @@ -1202,7 +1213,7 @@ ----------------------------------------------------------------------------------- -- Display a tooltip for the take guild button ----------------------------------------------------------------------------------- -function CensusPlus_TakeGuild_OnEnter() +function CensusPlus_TakeGuild_OnEnter( this ) if (g_IsCensusPlusInProgress) then if (g_CensusPlusManuallyPaused) then GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); @@ -1506,7 +1517,9 @@ end end + CensusPlusTakeButton:SetText( CENSUSPlus_PAUSE ); + end ----------------------------------------------------------------------------------- @@ -2821,6 +2834,9 @@ return; end + --rm + CensusPlusTakeGuildButton:SetText( CENSUSPlus_TAKEGUILD.." \""..CensusPlus_MYGUILD.."\"" ); + CensusPlusFactionName:SetText(format(CENSUSPlus_FACTION, factionGroup)); if( CensusPlus_Database["Info"]["Locale"] ~= nil ) then @@ -2944,6 +2960,7 @@ for i = 1, numRaces, 1 do local race = thisFactionRaces[i]; local buttonName = "CensusPlusRaceBar"..i; + local button = getglobal(buttonName); local thisCount = g_RaceCount[i]; if ((thisCount ~= nil) and (thisCount > 0) and (maxCount > 0)) then @@ -2955,6 +2972,8 @@ button:Hide(); end local normalTextureName="Interface\\AddOns\\CensusPlus\\Skin\\CensusPlus_"..g_RaceClassList[race]; + + local legendName = "CensusPlusRaceLegend"..i; local legend = getglobal(legendName); legend:SetNormalTexture(normalTextureName); @@ -3084,7 +3103,6 @@ CensusPlus_PlayerListOnShow(); end - debugprofilestop(); end @@ -3130,7 +3148,7 @@ -- Race legend clicked -- --------------------------------------------------------------------------------- -function CensusPlus_OnClickRace() +function CensusPlus_OnClickRace( this ) local id = this:GetID(); if (id == g_RaceSelected) then g_RaceSelected = 0; @@ -3145,7 +3163,7 @@ -- Class legend clicked -- --------------------------------------------------------------------------------- -function CensusPlus_OnClickClass() +function CensusPlus_OnClickClass( this ) local id = this:GetID(); if (id == g_ClassSelected) then g_ClassSelected = 0; @@ -3161,8 +3179,8 @@ -- Level bar loaded -- --------------------------------------------------------------------------------- -function CensusPlus_OnLoadLevel() - this:RegisterForClicks("LeftButtonUp","RightButtonUp"); +function CensusPlus_OnLoadLevel( self ) + self:RegisterForClicks("LeftButtonUp","RightButtonUp"); end ---------------------------------------------------------------------------------- @@ -3170,7 +3188,7 @@ -- Level bar clicked -- --------------------------------------------------------------------------------- -function CensusPlus_OnClickLevel(button) +function CensusPlus_OnClickLevel(this, button) local id = this:GetID(); if (((button == "LeftButton") and (id == g_LevelSelected)) or ((button == "RightButton") and (id + g_LevelSelected == 0))) then g_LevelSelected = 0; @@ -3187,7 +3205,7 @@ -- Race tooltip -- --------------------------------------------------------------------------------- -function CensusPlus_OnEnterRace() +function CensusPlus_OnEnterRace( this ) local factionGroup = UnitFactionGroup("player"); local thisFactionRaces = CensusPlus_GetFactionRaces(factionGroup); local id = this:GetID(); @@ -3206,15 +3224,15 @@ -- Class tooltip -- --------------------------------------------------------------------------------- -function CensusPlus_OnEnterClass() +function CensusPlus_OnEnterClass( self ) local factionGroup = UnitFactionGroup("player"); local thisFactionClasses = CensusPlus_GetFactionClasses(factionGroup); - local id = this:GetID(); + local id = self:GetID(); local className = thisFactionClasses[id]; local count = g_ClassCount[id]; if (count ~= nil) then local percent = floor((count / g_TotalCount) * 100); - GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); + GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); GameTooltip:SetText(className.."\n"..count.."\n"..percent.."%", 1.0, 1.0, 1.0); GameTooltip:Show(); end @@ -3225,11 +3243,11 @@ -- Level tooltip -- --------------------------------------------------------------------------------- -function CensusPlus_OnEnterLevel() +function CensusPlus_OnEnterLevel( this ) local id = this:GetID(); local count = g_LevelCount[id]; if (count ~= nil) then - local percent = floor(count * 100 / g_TotalCount); + local percent = floor((count / g_TotalCount) * 100); GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); GameTooltip:SetText("Level "..id.."\n"..count.."\n"..percent.."%", 1.0, 1.0, 1.0); GameTooltip:Show(); @@ -3241,7 +3259,7 @@ -- Clicked a guild button -- --------------------------------------------------------------------------------- -function CensusPlus_GuildButton_OnClick() +function CensusPlus_GuildButton_OnClick( this ) local id = this:GetID(); local offset = FauxScrollFrame_GetOffset(CensusPlusGuildScrollFrame); local newSelection = id + offset; @@ -3940,7 +3958,7 @@ name = gsub(name, "([^%s]*)%s+([^%s]*)%s+([^%s]*)", "%3"); name = gsub(name, "([^%s]*)%s+([^%s]*)", "%2"); if ( IsShiftKeyDown() ) then - if ( not ChatFrameEditBox:IsVisible() ) then + if ( not ChatFrame1EditBox:IsVisible() ) then -- -- This is the part we need to snag -- @@ -4008,3 +4026,28 @@ SendWho( msg ); end end +function CensusPlus_Options_OnMouseUp(self,...) + CensusPlus_Msg('Mouse up'); + if ( self.isMoving ) then + self:StopMovingOrSizing(); + self.isMoving = false; + end +end +function CensusPlus_Options_OnMouseDown(self,arg1,arg2,arg3,...) + if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then + self:StartMoving(); + self.isMoving = true; + end +end +function CensusPlus_Mini_OnMouseDown( self, arg1 ) + if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then + self:StartMoving(); + self.isMoving = true; + end +end +function CensusPlus_Census_OnMouseDown( self, arg1 ) + if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then + self:StartMoving(); + self.isMoving = true; + end +end \ No newline at end of file
