comparison CensusPlus.lua @ 11:663f782bd903

rebase on CensusPlus-40000-5.0.2.zip ; toc update
author EmFor
date Sun, 14 Aug 2011 12:10:07 +0200
parents 10c85be19b56
children 77d2c7423ed5
comparison
equal deleted inserted replaced
9:95760e155db2 11:663f782bd903
46 --rm 46 --rm
47 -- Special guild to search 47 -- Special guild to search
48 --local CensusPlus_MYGUILD = "The Last Journey"; 48 --local CensusPlus_MYGUILD = "The Last Journey";
49 local CensusPlus_MYGUILD = "Worgengrauen"; 49 local CensusPlus_MYGUILD = "Worgengrauen";
50 --------------------------------------------------------------------------------- 50 ---------------------------------------------------------------------------------
51 local CensusPlus_VERSION = "4.3.2"; -- version 51 local CensusPlus_VERSION = "5.0.2"; -- version
52 local CensusPlus_MAXBARHEIGHT = 128; -- Length of blue bars 52 local CensusPlus_MAXBARHEIGHT = 128; -- Length of blue bars
53 local CensusPlus_NUMGUILDBUTTONS = 10; -- How many guild buttons are on the UI? 53 local CensusPlus_NUMGUILDBUTTONS = 10; -- How many guild buttons are on the UI?
54 local MAX_CHARACTER_LEVEL = 85; -- Maximum level a PC can attain 54 local MAX_CHARACTER_LEVEL = 85; -- Maximum level a PC can attain
55 --rm 55 --rm
56 local MAX_LEVEL_DISPLAY = 255; -- Maximum level a PC can attain 56 local MAX_LEVEL_DISPLAY = 255; -- Maximum level a PC can attain
57 local MAX_WHO_RESULTS = 48; -- Maximum number of who results the server will return 57 local MAX_WHO_RESULTS = 49; -- Maximum number of who results the server will return
58 CensusPlus_GUILDBUTTONSIZEY = 16; 58 CensusPlus_GUILDBUTTONSIZEY = 16;
59 local CensusPlus_UPDATEDELAY = 5; -- Delay time between /who messages 59 local CensusPlus_UPDATEDELAY = 5; -- Delay time between /who messages
60 local CP_MAX_TIMES = 50; 60 local CP_MAX_TIMES = 50;
61 61
62 local g_ServerPrefix = ""; -- US VERSION!! 62 local g_ServerPrefix = ""; -- US VERSION!!
203 g_RaceClassList[CENSUSPlus_TAUREN] = 25; 203 g_RaceClassList[CENSUSPlus_TAUREN] = 25;
204 g_RaceClassList[CENSUSPlus_TROLL] = 26; 204 g_RaceClassList[CENSUSPlus_TROLL] = 26;
205 g_RaceClassList[CENSUSPlus_UNDEAD] = 27; 205 g_RaceClassList[CENSUSPlus_UNDEAD] = 27;
206 g_RaceClassList[CENSUSPlus_DRAENEI] = 28; 206 g_RaceClassList[CENSUSPlus_DRAENEI] = 28;
207 g_RaceClassList[CENSUSPlus_BLOODELF] = 29; 207 g_RaceClassList[CENSUSPlus_BLOODELF] = 29;
208 g_RaceClassList[CENSUSPlus_WORGEN] = 31; 208 g_RaceClassList[CENSUSPlus_WORGEN] = 32;
209 g_RaceClassList[CENSUSPlus_GOBLIN] = 32; 209 g_RaceClassList[CENSUSPlus_GOBLIN] = 31;
210
210 211
211 g_TimeDatabase[CENSUSPlus_DRUID] = 0; 212 g_TimeDatabase[CENSUSPlus_DRUID] = 0;
212 g_TimeDatabase[CENSUSPlus_HUNTER] = 0; 213 g_TimeDatabase[CENSUSPlus_HUNTER] = 0;
213 g_TimeDatabase[CENSUSPlus_MAGE] = 0; 214 g_TimeDatabase[CENSUSPlus_MAGE] = 0;
214 g_TimeDatabase[CENSUSPlus_PRIEST] = 0; 215 g_TimeDatabase[CENSUSPlus_PRIEST] = 0;
497 -- Return common letters found in names, may override this for other languages 498 -- Return common letters found in names, may override this for other languages
498 -- Worst case scenario is to do it for every letter in the alphabet 499 -- Worst case scenario is to do it for every letter in the alphabet
499 -- 500 --
500 ----------------------------------------------------------------------------------- 501 -----------------------------------------------------------------------------------
501 local function GetNameLetters() 502 local function GetNameLetters()
503 -- return { "a", "b", "c", "d", "e", "f", "g", "i", "o", "p", "r", "s", "t", "u", "y" };
502 --rm 504 --rm
503 -- return { "a", "b", "c", "d", "e", "f", "g", "i", "o", "p", "r", "s", "t", "u", "y" };
504 -- 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" }; 505 -- 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" };
505 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" }; 506 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" };
506 end 507 end
507 508
508 --------------------------------------------------------------------------------- 509 ---------------------------------------------------------------------------------
674 -- g_Pre_WhoList_UpdateOverride(); 675 -- g_Pre_WhoList_UpdateOverride();
675 676
676 677
677 g_WaitingForWhoUpdate = false; 678 g_WaitingForWhoUpdate = false;
678 CP_Pre_OnEvent(...); 679 CP_Pre_OnEvent(...);
679
680 -- 680 --
681 -- If we opened the who window, do a manual pause and open a dialog 681 -- If we opened the who window, do a manual pause and open a dialog
682 -- 682 --
683 g_CensusPlusManuallyPaused = true; 683 g_CensusPlusManuallyPaused = true;
684 CensusPlusTakeButton:SetText( CENSUSPlus_UNPAUSE ); 684 CensusPlusTakeButton:SetText( CENSUSPlus_UNPAUSE );
1515 1515
1516 --wholib.RegisterCallback("CensusPlus", "WHOLIB_QUERY_RESULT", CensusPlus_WhoLibEvent) 1516 --wholib.RegisterCallback("CensusPlus", "WHOLIB_QUERY_RESULT", CensusPlus_WhoLibEvent)
1517 1517
1518 end 1518 end
1519 end 1519 end
1520
1520 CensusPlusTakeButton:SetText( CENSUSPlus_PAUSE ); 1521 CensusPlusTakeButton:SetText( CENSUSPlus_PAUSE );
1522
1521 end 1523 end
1522 1524
1523 ----------------------------------------------------------------------------------- 1525 -----------------------------------------------------------------------------------
1524 -- 1526 --
1525 -- Stop a CensusPlus 1527 -- Stop a CensusPlus
2953 -- Update race bars 2955 -- Update race bars
2954 -- 2956 --
2955 for i = 1, numRaces, 1 do 2957 for i = 1, numRaces, 1 do
2956 local race = thisFactionRaces[i]; 2958 local race = thisFactionRaces[i];
2957 local buttonName = "CensusPlusRaceBar"..i; 2959 local buttonName = "CensusPlusRaceBar"..i;
2960
2958 local button = getglobal(buttonName); 2961 local button = getglobal(buttonName);
2959 local thisCount = g_RaceCount[i]; 2962 local thisCount = g_RaceCount[i];
2960 if ((thisCount ~= nil) and (thisCount > 0) and (maxCount > 0)) then 2963 if ((thisCount ~= nil) and (thisCount > 0) and (maxCount > 0)) then
2961 local height = floor((thisCount * CensusPlus_MAXBARHEIGHT / maxCount) ); 2964 local height = floor((thisCount * CensusPlus_MAXBARHEIGHT / maxCount) );
2962 if (height < 2 or height == nil ) then height = 2; end 2965 if (height < 2 or height == nil ) then height = 2; end
2964 button:Show(); 2967 button:Show();
2965 else 2968 else
2966 button:Hide(); 2969 button:Hide();
2967 end 2970 end
2968 local normalTextureName="Interface\\AddOns\\CensusPlus\\Skin\\CensusPlus_"..g_RaceClassList[race]; 2971 local normalTextureName="Interface\\AddOns\\CensusPlus\\Skin\\CensusPlus_"..g_RaceClassList[race];
2972
2973
2969 local legendName = "CensusPlusRaceLegend"..i; 2974 local legendName = "CensusPlusRaceLegend"..i;
2970 local legend = getglobal(legendName); 2975 local legend = getglobal(legendName);
2971 legend:SetNormalTexture(normalTextureName); 2976 legend:SetNormalTexture(normalTextureName);
2972 if (g_RaceSelected == i) then 2977 if (g_RaceSelected == i) then
2973 legend:LockHighlight(); 2978 legend:LockHighlight();
4017 wholib:AskWho({query = msg, queue = wholib.WHOLIB_QUEUE_QUIET, callback = CP_ProcessWhoEvent }) 4022 wholib:AskWho({query = msg, queue = wholib.WHOLIB_QUEUE_QUIET, callback = CP_ProcessWhoEvent })
4018 else 4023 else
4019 SendWho( msg ); 4024 SendWho( msg );
4020 end 4025 end
4021 end 4026 end
4022
4023 function CensusPlus_Options_OnMouseUp(self,...) 4027 function CensusPlus_Options_OnMouseUp(self,...)
4024 CensusPlus_Msg('Mouse up'); 4028 CensusPlus_Msg('Mouse up');
4025
4026 if ( self.isMoving ) then 4029 if ( self.isMoving ) then
4027 self:StopMovingOrSizing(); 4030 self:StopMovingOrSizing();
4028 self.isMoving = false; 4031 self.isMoving = false;
4029 end 4032 end
4030 end 4033 end
4031
4032 function CensusPlus_Options_OnMouseDown(self,arg1,arg2,arg3,...) 4034 function CensusPlus_Options_OnMouseDown(self,arg1,arg2,arg3,...)
4033 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then 4035 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
4034 self:StartMoving(); 4036 self:StartMoving();
4035 self.isMoving = true; 4037 self.isMoving = true;
4036 end 4038 end
4037 end 4039 end
4038
4039 function CensusPlus_Mini_OnMouseDown( self, arg1 ) 4040 function CensusPlus_Mini_OnMouseDown( self, arg1 )
4040 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then 4041 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
4041 self:StartMoving(); 4042 self:StartMoving();
4042 self.isMoving = true; 4043 self.isMoving = true;
4043 end 4044 end
4044 end 4045 end
4045
4046 function CensusPlus_Census_OnMouseDown( self, arg1 ) 4046 function CensusPlus_Census_OnMouseDown( self, arg1 )
4047 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then 4047 if ( ( ( not self.isLocked ) or ( self.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
4048 self:StartMoving(); 4048 self:StartMoving();
4049 self.isMoving = true; 4049 self.isMoving = true;
4050 end 4050 end