annotate CensusPlusPVP.lua @ 0:edfa01041183

Census+ Mod : - TLJ guild search - searchstart at Level 1 for community events
author EmFor <EmFor.hg@mroe.de>
date Tue, 30 Mar 2010 13:42:05 +0200
parents
children 10c85be19b56
rev   line source
EmFor@0 1 --[[
EmFor@0 2 CensusPlus for World of Warcraft(tm).
EmFor@0 3
EmFor@0 4 Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com
EmFor@0 5
EmFor@0 6 License:
EmFor@0 7 This program is free software; you can redistribute it and/or
EmFor@0 8 modify it under the terms of the GNU General Public License
EmFor@0 9 as published by the Free Software Foundation; either version 2
EmFor@0 10 of the License, or (at your option) any later version.
EmFor@0 11
EmFor@0 12 This program is distributed in the hope that it will be useful,
EmFor@0 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
EmFor@0 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
EmFor@0 15 GNU General Public License for more details.
EmFor@0 16
EmFor@0 17 You should have received a copy of the GNU General Public License
EmFor@0 18 along with this program(see GLP.txt); if not, write to the Free Software
EmFor@0 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
EmFor@0 20 ]]
EmFor@0 21
EmFor@0 22
EmFor@0 23 ------------------------------------------------------------------------------------
EmFor@0 24 --
EmFor@0 25 -- CensusPlus - PVP section
EmFor@0 26 -- A WoW UI customization by Cooper Sellers
EmFor@0 27 --
EmFor@0 28 --
EmFor@0 29 ------------------------------------------------------------------------------------
EmFor@0 30
EmFor@0 31 local damagedTable = { };
EmFor@0 32
EmFor@0 33 -----------------------------------------------------------------------------------
EmFor@0 34 --
EmFor@0 35 -- CensusPlus_PVPDeath -- Someone dies
EmFor@0 36 --
EmFor@0 37 -----------------------------------------------------------------------------------
EmFor@0 38 function CensusPlus_PVPDeath( msg )
EmFor@0 39
EmFor@0 40
EmFor@0 41 -- CensusPlus_Msg( "Msg = " .. msg );
EmFor@0 42 -- local value = string.sub( msg, 0, index-1 );
EmFor@0 43 end
EmFor@0 44
EmFor@0 45 -----------------------------------------------------------------------------------
EmFor@0 46 --
EmFor@0 47 -- CensusPlus_PVPDamage -- Damage is done
EmFor@0 48 --
EmFor@0 49 -----------------------------------------------------------------------------------
EmFor@0 50 function CensusPlus_PVPDamage( victim, dmg )
EmFor@0 51 local dealer = "player";
EmFor@0 52 local vict = "target";
EmFor@0 53 if( victim == "player" ) then
EmFor@0 54 -- Hit us instead
EmFor@0 55 end
EmFor@0 56 end
EmFor@0 57
EmFor@0 58
EmFor@0 59 -----------------------------------------------------------------------------------
EmFor@0 60 --
EmFor@0 61 -- CensusPlus_ProcefssHonorInpsect -- Process honor inspect
EmFor@0 62 --
EmFor@0 63 -----------------------------------------------------------------------------------
EmFor@0 64 function CensusPlus_ProcessHonorInpsect()
EmFor@0 65 local todayHK, todayDK,
EmFor@0 66 yesterdayHK, yesterdayDK,
EmFor@0 67 thisweekHK, thisweekHonor,
EmFor@0 68 lastweekHK, lastweekHonor, lastweekStanding,
EmFor@0 69 lifetimeHK, lifetimeDK, lifetimeHighestRank = GetInspectHonorData()
EmFor@0 70
EmFor@0 71 if( g_CensusPlusLastTarget ~= nil ) then
EmFor@0 72 g_CensusPlusLastTarget[4] = lifetimeHK;
EmFor@0 73 g_CensusPlusLastTarget[5] = CensusPlus_DetermineServerDate() .. "&" .. lastweekHonor .. "&" .. lastweekStanding;
EmFor@0 74 g_CensusPlusLastTarget[6] = lifetimeHighestRank;
EmFor@0 75
EmFor@0 76 g_CensusPlusLastTarget[7] = CensusPlus_DetermineServerDate() .. "";
EmFor@0 77 end
EmFor@0 78
EmFor@0 79 local unit = InspectFrame.unit;
EmFor@0 80
EmFor@0 81 -- ClearInspectPlayer();
EmFor@0 82 g_CensusPlusLastTargetName = nil;
EmFor@0 83 g_CensusPlusLastTarget = nil;
EmFor@0 84 -- InspectFrame.unit = nil;
EmFor@0 85 end
EmFor@0 86
EmFor@0 87 -----------------------------------------------------------------------------------
EmFor@0 88 --
EmFor@0 89 -- CensusPlus_ProcessMyHonor -- Process player honor
EmFor@0 90 --
EmFor@0 91 -----------------------------------------------------------------------------------
EmFor@0 92 function CensusPlus_ProcessMyHonor()
EmFor@0 93 --
EmFor@0 94 -- Get the portion of the database for this server
EmFor@0 95 --
EmFor@0 96 local realmName = g_CensusPlusLocale .. GetCVar("realmName");
EmFor@0 97 local realmDatabase = CensusPlus_Database["Servers"][realmName];
EmFor@0 98 if (realmDatabase == nil) then
EmFor@0 99 CensusPlus_Database["Servers"][realmName] = {};
EmFor@0 100 realmDatabase = CensusPlus_Database["Servers"][realmName];
EmFor@0 101 end
EmFor@0 102
EmFor@0 103 --
EmFor@0 104 -- Get the portion of the database for this faction
EmFor@0 105 --
EmFor@0 106 local factionGroup = UnitFactionGroup("player");
EmFor@0 107 local factionDatabase = realmDatabase[factionGroup];
EmFor@0 108 if (factionDatabase == nil) then
EmFor@0 109 realmDatabase[factionGroup] = {};
EmFor@0 110 factionDatabase = realmDatabase[factionGroup];
EmFor@0 111 end
EmFor@0 112
EmFor@0 113 --
EmFor@0 114 -- Get racial database
EmFor@0 115 --
EmFor@0 116 local raceGroup = UnitRace("player");
EmFor@0 117 local raceDatabase = factionDatabase[raceGroup];
EmFor@0 118 if (raceDatabase == nil) then
EmFor@0 119 factionDatabase[raceGroup] = {};
EmFor@0 120 raceDatabase = factionDatabase[raceGroup];
EmFor@0 121 end
EmFor@0 122
EmFor@0 123 --
EmFor@0 124 -- Get class database
EmFor@0 125 --
EmFor@0 126 local classGroup = UnitClass( "player" );
EmFor@0 127 local classDatabase = raceDatabase[classGroup];
EmFor@0 128 if (classDatabase == nil) then
EmFor@0 129 raceDatabase[classGroup] = {};
EmFor@0 130 classDatabase = raceDatabase[classGroup];
EmFor@0 131 end
EmFor@0 132
EmFor@0 133 --
EmFor@0 134 -- Get this player's entry
EmFor@0 135 --
EmFor@0 136 local playerName = UnitName( "player" );
EmFor@0 137 local entry = classDatabase[playerName];
EmFor@0 138 if (entry == nil) then
EmFor@0 139 classDatabase[playerName] = {};
EmFor@0 140 entry = classDatabase[playerName];
EmFor@0 141 end
EmFor@0 142
EmFor@0 143 local honorableKills, dishonorableKills, highestRank = GetPVPLifetimeStats();
EmFor@0 144 local lwhk, lwdk, lwcontribution, lwrank = GetPVPLastWeekStats()
EmFor@0 145
EmFor@0 146 --
EmFor@0 147 -- Update the information
EmFor@0 148 --
EmFor@0 149
EmFor@0 150 entry[1] = UnitLevel("player");
EmFor@0 151 entry[2], rank, index = GetGuildInfo("player");
EmFor@0 152 entry[3] = CensusPlus_DetermineServerDate() .. "";
EmFor@0 153 entry[4] = honorableKills;
EmFor@0 154
EmFor@0 155
EmFor@0 156 entry[5] = CensusPlus_DetermineServerDate() .. "&" .. lwcontribution .. "&" .. lwrank;
EmFor@0 157 -- entry[5] = dishonorableKills;
EmFor@0 158 entry[6] = highestRank;
EmFor@0 159
EmFor@0 160 entry[7] = CensusPlus_DetermineServerDate() .. "";
EmFor@0 161
EmFor@0 162 if( entry ~= nil ) then
EmFor@0 163 rankNumber = UnitPVPRank("player");
EmFor@0 164 if( rankNumber ~= 0 ) then
EmFor@0 165 -- rankName= GetPVPRankInfo( rankNumber )
EmFor@0 166 entry[8] = rankNumber; -- slot 8 will be current rank
EmFor@0 167 else
EmFor@0 168 entry[8] = 0; -- slot 8 will be current rank
EmFor@0 169 end
EmFor@0 170 end
EmFor@0 171 end