--[[
	Do NOT Edit this file!
	It is used for MORE then just text
	see localization.DE.lua localization.FR.lua etc files
	if you want to change englisch text add a localization.EN.lua
	You could consider this the "neutral" language
	Point is there are function mappings here that dont have to be touched.
	
]]--

SW_RootSlashes = {"/swstats", "/sws"};

SW_VERSION = "1.5.3";

-- 1.4.2 Found a chineese localization through google that needs a different pre filter so i added this
-- and added a localization for it 
SW_PRE_REGEX = "[%s%.%:%(]%d+[%s%.%)]";
-- 1.5 moved death regex here, makes more sense
SW_DeathRegEx = string.gsub(UNITDIESOTHER, "%%s","(.+)");

-- 1.5.1 wow 1.11 adds this var will alliviate the "drunk problem" a little
if SLURRED_SPEECH ~= nil then
	SW_DrunkRegEx = string.gsub(SLURRED_SPEECH, "%%s","(.-)");
end
-- 1.3.2 max amount of "quick option buttons"
SW_OPT_COUNT = 10;

-- startuplog
-- this should'nt need translation, but can be
SW_SL ={
	["OK"] = "...OK",
	["START"] = "Starting Init...",
	["REGEX"] = "Creating Regex from globals",
	["EVENTS"] = "Registering Events",
	["MAP"] = "Creating Event->Regex map",
	["MAP_SORT"] = "Sorting EventMap",
	["MAP_REGEX"] = "InMap/RegexRegisterd",
}

SW_CONSOLE_NOCMD = "No such command: ";
SW_CONSOLE_HELP ="Help: ";
SW_CONSOLE_NIL_TRAILER = " is not defined."; -- space at beginning
SW_CONSOLE_SORTED = "Sorted";
SW_CONSOLE_NOREGEX = "There is no regex for this event.";
SW_CONSOLE_FALLBACK = "Found a regex - added to map";
SW_FALLBACK_BLOCK_INFO = "This event is blocked from auto updating itself.";
SW_FALLBACK_IGRNORED = "This event has been ignored.";
SW_EMPTY_EVENT = "Listening to non needed event?: ";
SW_INFO_PLAYER_NF = "There is no info for: ";
SW_PRINT_INFO_FROMTO = "|cffffffffFrom:|r%s, |cffffffffTarget:|r%s,";
SW_PRINT_ITEM = "|cffffffff%s:|r%s,";
SW_PRINT_ITEM_DMG = "Dmg";
SW_PRINT_ITEM_HEAL = "Healed";
SW_PRINT_ITEM_THROUGH = "Through";
SW_PRINT_ITEM_TYPE = "Type";
SW_PRINT_ITEM_CRIT = "|cffff2020CRIT|r";
SW_PRINT_ITEM_WORLD = "WORLD";
SW_PRINT_ITEM_NORMAL = "Normal";
SW_PRINT_ITEM_RECIEVED = "Recieved";
SW_PRINT_INFO_RECIEVED = "|cffff2020Dmg:%s|r, |cff20ff20Heal:%s|r";
SW_PRINT_ITEM_TOTAL_DONE = "Total";
SW_PRINT_ITEM_NON_SCHOOL = "Other";
SW_PRINT_ITEM_IGNORED = "Ignored";
SW_PRINT_ITEM_DEATHS = "Deaths";

SW_SYNC_CHAN_JOIN = "|cff20ff20SWSync: You have joined:|r";
SW_SYNC_CHAN_FAIL= "|cffff2020SWSync: Could not join:|r";
SW_SYNC_JOINCHECK_FROM = "Join SWSyncChannel %s from: %s ?"
SW_SYNC_JOINCHECK_INFO = "Old data will be lost!"
SW_SYNC_CURRENT = "Current SyncChannel: %s";
SW_BARS_WIDTHERROR = "The Bar is to wide!"
SW_B_CONSOLE = "C";
SW_B_SETTINGS = "S";
SW_B_SYNC = "Y";
SW_B_REPORT = "R";
SW_STR_MAX = "Max";
SW_STR_EVENTCOUNT = "#";
SW_STR_AVERAGE = "ø";
SW_STR_PET_PREFIX = "[Pet] "; -- pet prefix for pet info displayed in the bars
SW_STR_VPP_PREFIX = "[All pets] "; -- pet prefix for virtual pet per player info displayed in the bars
SW_STR_VPR = "[Raid Pet]"; -- pet string for virtual pet per raid info displayed in the bars
-- 1.5.beta.1 Reset vote
SW_STR_RV = "|cffff5d5dReset Vote!|r Issued by |cffff5d5d%s|r.  Do you want the SyncChannel to reset?";
SW_STR_RV_PASSED =  "|cffffff00[SW Sync]|r |cff00ff00Reset vote passed!|r";
SW_STR_RV_FAILED = "|cffffff00[SW Sync]|r |cffff5d5dReset vote failed!|r";
SW_STR_VOTE_WARN = "|cffffff00[SW Sync]|r |cffff5d5dDon't spam votes...|r";

--1.5.3
--Raid DPS Strings
SW_RDPS_STRS = {
	["CURR"] = "RDPS Current Fight",
	["ALL"] = "RDPS",
	["LAST"] = "RDPS Last Fight",
	["MAX"] = "RDPS Max",
	["TOTAL"] = "RDPS The Ugly truth", -- a timer that keeps running, no matter if in or out of fight
}
--[[
-- devour magic ? (pet fellhunter)
-- add sheep ? 
-- add totems ?
--]]
SW_Spellnames = {
	[1] = "Remove Lesser Curse",
	[2] = "Remove Curse",
	[3] = "Dispel Magic",
	[4] = "Cure Disease",
	[5] = "Abolish Disease",
	[6] = "Purify",
	[7] = "Cleanse",
	[8] = "Cure Poison",
	[9] = "Abolish Poison",
	[10] = "Purge",
}

SW_GUI ={
	["SW_FrameConsole_Title"] = {["s"] = "SW v"..SW_VERSION, ["f"] = SW_TitleSetText },
	["SW_FrameConsole_Tab1"] = {["s"] = "General", ["f"] = SW_TabSetText },
	["SW_FrameConsole_Tab2"] = {["s"] = "Event Info", ["f"] = SW_TabSetText },
	--["SW_FrameConsole_Tab3"] = {["s"] = "Setting", ["f"] = SW_TabSetText },
	["SW_BarSettingsFrameV2_Tab1"] = {["s"] = "Data", ["f"] = SW_TabSetText },
	["SW_BarSettingsFrameV2_Tab2"] = {["s"] = "Visuals", ["f"] = SW_TabSetText },
	["SW_BarSettingsFrameV2_Tab3"] = {["s"] = "Pets", ["f"] = SW_TabSetText },
	["SW_Chk_ShowEventText"] = "Show Event->Regex",
	["SW_Chk_ShowOrigStrText"] = "Show Log Message",
	["SW_Chk_ShowRegExText"] = "Show RegEx",
	["SW_Chk_ShowMatchText"] = "Show Match",
	["SW_Chk_ShowSyncInfoText"] = "Show SyncMsgs",
	["SW_Chk_ShowOnlyFriendsText"] = "Only show 'Friends'",
	["SW_Chk_ShowSyncBText"] = "Show Sync button",
	["SW_Chk_ShowConsoleBText"] = "Show Console button",
	["SW_Chk_ShowDPSText"] = "DPS";
	["SW_Chk_MergePetsText"] = "Merge Pet to Master",
	["SW_RepTo_SayText"] = "Say",
	["SW_RepTo_GroupText"] = "Group",
	["SW_RepTo_RaidText"] = "Raid",
	["SW_RepTo_GuildText"] = "Guild",
	["SW_RepTo_ChannelText"] = "Channel",
	["SW_RepTo_WhisperText"] = "Whisper",
	["SW_RepTo_ClipboardText"] = "Textbox",
	["SW_RepTo_OfficerText"] = "Officer",
	["SW_BarReportFrame_Title_Text"] = "Report to..",
	["SW_Chk_RepMultiText"] = "Multiline",
	["SW_Filter_PCText"] = "PC",
	["SW_Filter_NPCText"] = "NPC",
	["SW_Filter_GroupText"] = "Current Group/Raid",
	["SW_Filter_EverGroupText"] = "Ever Group/Raid",
	["SW_Filter_NoneText"] = "None",
	["SW_GeneralSettings_Title_Text"] = "General Settings",
	["SW_BarSyncFrame_Title_Text"] = "SyncChannel Settings",
	["SW_BarSettingsFrameV2_Title_Text"] = "Settings",
	["SW_BarSyncFrame_SyncLeave"] =  {["s"] = "Leave", ["f"] = SetButtonText },
	["SW_BarSyncFrame_OptGroupText"] = "Group",
	["SW_BarSyncFrame_OptRaidText"] = "Raid",
	["SW_BarSyncFrame_OptGuildText"] = "Guild",
	["SW_BarSyncFrame_SyncSend"] =  {["s"] = "Send to", ["f"] = SetButtonText },
	["SW_CS_Damage"] =  {["s"] = "Damage Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_Heal"] =  {["s"] = "Heal Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_BarC"] =  {["s"] = "Bar Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_FontC"] =  {["s"] = "Font Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_OptC"] =  {["s"] = "Button Color", ["f"] = SW_SetColorSwatchText },
	["SW_TextureSlider"] =  {["s"] = "Texture:", ["f"] = SW_SetSliderPreText },
	["SW_FontSizeSlider"] =  {["s"] = "Font Size:", ["f"] = SW_SetSliderPreText },
	["SW_BarHeightSlider"] =  {["s"] = "H:", ["f"] = SW_SetSliderPreText },
	--["SW_BarWidthSlider"] =  {["s"] = "Bar Width:", ["f"] = SW_SetSliderPreText },
	["SW_ColCountSlider"] =  {["s"] = "Column Count:", ["f"] = SW_SetSliderPreText },
	["SW_OptChk_NumText"] = "Amount",
	["SW_OptChk_RankText"] = "Rank",
	["SW_OptChk_PercentText"] = "%",
	["SW_VarInfoLbl"] = "This info needs a target. Click Change to type in a name or click FromTarget to use your current target.",
	["SW_NoPetInfoLabel"] = "This info does not have any pet filter settings.",
	["SW_SetInfoVarFromTarget"] = {["s"] = "FromTarget", ["f"] = SetButtonText },
	["SW_ColorsOptUseClassText"] = "Class color",
	["SW_TextWindow_Title_Text"] = "Use Ctrl+c to copy.",
	["SW_BarSyncFrame_SyncARPY"] = {["s"] = "Allow", ["f"] = SetButtonText },
	["SW_BarSyncFrame_SyncARPN"] = {["s"] = "Prohibit", ["f"] = SetButtonText },
	-- 1.5 new pet filter labels 
	["SW_PF_InactiveText"] = "Inactive",
	["SW_PF_ActiveText"] = "Active",
	["SW_PF_MMText"] = "Merge made",
	["SW_PF_MRText"] = "Merge recieved",
	["SW_PF_MBText"] = "Merge both",
	["SW_PF_CurrentText"] = "Current",
	["SW_PF_VPPText"] = "Virtual player pet",
	["SW_PF_VPRText"] = "Virtual raid pet",
	["SW_PF_IgnoreText"] = "Ignore all pet info",
	
	-- 1.5.3 new colors
	["SW_CS_TitleBar"] =  {["s"] = "Title Bar Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_TitleFont"] =  {["s"] = "Title Bar Font Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_Backdrops"] =  {["s"] = "Frame and Tab Color", ["f"] = SW_SetColorSwatchText },
	["SW_CS_MainWinBack"] =  {["s"] = "Main Window Back", ["f"] = SW_SetColorSwatchText },
	["SW_CS_ClassCAlpha"] = {["s"] = "Class Transparency", ["f"] = SW_SetColorSwatchText },
};

-- don't localize these 3
SW_OVERHEAL = "SW_OverhealDummy";
SW_PETOWNER = "SW_PO_"; -- prefix to integerate 1.5 pets with current syncing
SW_PET = "SW_Pet_"; -- prefix to integerate 1.5 pets with current syncing


--tooltips
SW_GS_Tooltips ={
	["SW_Chk_ShowOnlyFriends"] = "This option is only used to filter reports sent to the console via /sws slash commands.",
	["SW_Chk_ShowSyncB"] = "Option to show an extra button for Sync settings in the title bar of the main window.",
	["SW_Chk_ShowConsoleB"] = "Option to show an extra button for the console in the title bar of the main window.",
	["SW_CS_Damage"] = "The bar color for 'damage bars'. E.g. used when looking at details.",
	["SW_CS_Heal"] = "The bar color for 'heal bars'. E.g. used when looking at details.",
	["SW_CS_BarC"] = "The bar color used in this view. This might be overridden depending on the data displayed.",
	["SW_CS_FontC"] = "The font color used in this view.",
	["SW_CS_OptC"] = "Changes the color of the button under the main window.",
	["SW_TextureSlider"] = "Changes the texture of the bars for this view", 
	["SW_FontSizeSlider"] = "Changes the font size used in the bars for this view",
	["SW_BarHeightSlider"] = "Changes the bar height for this view",
	--["SW_BarWidthSlider"] = "Changes the bar width for this view",
	["SW_ColCountSlider"] = "Changes the amount of columns for this view.",
	["SW_SetOptTxtFrame"] = "Changes the text displayed in the button under the main window.",
	["SW_SetFrameTxtFrame"] = "Changes the text displayed in the titel of the main window.",
	["SW_OptChk_Num"] = "Show the 'raw' number counted in points. (E.g. damage, heal, etc.).",
	["SW_OptChk_Rank"] = "Show the rank.",
	["SW_OptChk_Percent"] = "Show the percentage. (Percentage of the total amount of 'raw' numbers in the raid.)",
	["SW_Filter_None"] = "No pc/npc/group filter is used. All gathered data is shown in the bars",
	["SW_Filter_PC"] = "A Player char filter is used. This only works if somebody was in your group or if you had him as target once.",
	["SW_Filter_NPC"] = "A Non player char filter is used, you must have targeted it once , and it may not be player controlled.",
	["SW_Filter_Group"] = "Only people and pets currently in your group or raid are shown.",
	["SW_Filter_EverGroup"] = "Only people that have been in your group or raid are shown.",
	["SW_ClassFilterSlider"] = "Here you can set a class filter. Only data of the specified class is shown. (You must have selected them once or they must have been in your group/raid)",
	["SW_InfoTypeSlider"] = "The 'main' data selector. Select what kind of data you want to display for this tab. A (S) denotes that this setting is synced.",
	["SW_ColorsOptUseClass"] = "Use class colors. If this option is checked then the bars will be colored by the class of the player. (Overrides above bar color if the class of the player or mob is known) ",
	["SW_Chk_ShowDPS"] = "Show your DPS in the main window title?",
	["SW_OptCountSlider"] = "Changes the amount of buttons to show under the main window.",
	["SW_AllowARP"] = "Allow posting of reports in a raid.",
	["SW_DisAllowARP"] = "Prohibit posting of reports in a raid.",
	["SW_OptChk_Running"] = "Uncheck to pause data collection. Check to continue collecting data. You can not pause data collection while being in a sync channel.",
	-- 1.5 new pet filter Tooltips
	["SW_PF_Inactive"] = "The new pet filters are mostly inactive, pets will display like everything else.";
	["SW_PF_Active"] = "Pets are marked with "..SW_STR_PET_PREFIX.." and mindcontrolled / enslaved pets and players show up. Only the stats WHILE being possessd are counted. (Own players when mind controlled by a hostile mob will not show up, only controlled mobs of players in your group/raid)",
	["SW_PF_MM"] = "Pets are hidden and the damage/healing they made is added to the owner.",
	["SW_PF_MR"] = "Pets are hidden and the damage/healing they recieved is added to the owner.",
	["SW_PF_MB"] = "Pets are hidden and the damage/healing they made AND recieved is added to the owner.",
	["SW_PF_Current"] = "Similar to Active, but only currently owned pets are shown.",
	["SW_PF_VPP"] = "All pets a player had are merged to one pet.",
	["SW_PF_VPR"] = "All pets the entire raid / group had are merged to one pet.",
	["SW_PF_Ignore"] = "All pet info is ignored.",
	
	-- 1.5.3 new colors
	["SW_CS_TitleBar"] =  "This changes the color of all title bars and the buttons in them. This MAY (depending on settings) change the color of buttons under the main window.",
	["SW_CS_TitleFont"] =  "This changes the color of all title bar fonts and the button fonts in them.",
	["SW_CS_Backdrops"] =  "This changes the color of the frame around most windows. Tab color will be changed aswell, but alpha channel wil be ignored for tabs.",
	["SW_CS_MainWinBack"] = "This changes the backround of the main window.",
	["SW_CS_ClassCAlpha"] = "Only the alpha channel set here will be used for class coloring.",
};

-- edit boxes
SW_GS_EditBoxes = {
	["SW_SetOptTxtFrame"] = {"Change","Button Text: ", "New button text:" },
	["SW_SetFrameTxtFrame"] = {"Change","Frame Text: ", "New frame text:" },
	["SW_SetInfoVarTxtFrame"] = {"Change","Info for: ", "New name of player or mob:" },
	["SW_SetSyncChanTxtFrame"] = {"Change","SyncChannel: ", "New SyncChannel:" },
}

--Popups
StaticPopupDialogs["SW_Reset"] = {
	text = "Are you sure you want to reset the data?",
	button1 = YES,
	button2 = NO,
	OnAccept = function()
		SW_ResetInfo();
	end,
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};
StaticPopupDialogs["SW_ResetSync"] = {
	text = "You are in a SyncChannel and will issue a reset command to all people in the channel! Are you sure you want to reset the data?",
	button1 = YES,
	button2 = NO,
	OnAccept = function()
		SW_SyncReset();
	end,
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};
StaticPopupDialogs["SW_ResetSyncVote"] = {
	text = "TMP No need to translate (SW_STR_RV)",
	button1 = YES,
	button2 = NO,
	OnAccept = function()
		SW_SyncQueue:PushSWInfo("VA", {StaticPopupDialogs["SW_ResetSyncVote"].vID,1,math.random(100)});
	end,
	OnCancel = function (_,reason)
      if reason == "clicked" then
          SW_SyncQueue:PushSWInfo("VA", {StaticPopupDialogs["SW_ResetSyncVote"].vID,2,math.random(100)});
      end
	end,
	
	timeout = 0,
	whileDead = 1,
	hideOnEscape = false,
};

StaticPopupDialogs["SW_JoinCheck"] = {
	text = "JoinChk",
	button1 = YES,
	button2 = NO,
	OnAccept = function()
		SW_SyncJoin(StaticPopupDialogs["SW_JoinCheck"].SW_toChan);
	end,
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};
StaticPopupDialogs["SW_ResetFailInfo"] = {
	text = "You are in a SyncChannel and can not reset the data. Only the raid/group leaders can issue a reset for the SyncChannel. With '"..SW_RootSlashes[1].." rv' you can start a reset vote.",
	button1 = OKAY,
	
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};
StaticPopupDialogs["SW_PostFail"] = {
	text = "Sorry, you can't report here. The Raid leaders must allow to post stats for you to do this",
	button1 = OKAY,
	
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};
StaticPopupDialogs["SW_ChangeTxt"] = {
	text = "Tmp",
	button1 = ACCEPT,
	button2 = CANCEL,
	hasEditBox = 1,
	maxLetters = 30,
	OnAccept = function()
		
		local text = getglobal(this:GetParent():GetName().."EditBox"):GetText();
		StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"].CurrentVal=text;
		StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"]:ChangeText();
		StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateFunc"](text, StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateInfo"]);
		
	end,
	EditBoxOnEnterPressed = function()
		local text = getglobal(this:GetParent():GetName().."EditBox"):GetText();
		StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"].CurrentVal=text;
		StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"]:ChangeText();
		StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateFunc"](text, StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateInfo"]);
	end,
	OnShow = function()
		local eb = getglobal(this:GetName().."EditBox");
		eb:SetText(StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"].CurrentVal);
		eb:HighlightText();
		eb:SetFocus();
	end,
	OnHide = function()
		if ( ChatFrameEditBox:IsVisible() ) then
			ChatFrameEditBox:SetFocus();
		end
		getglobal(this:GetName().."EditBox"):SetText("");
		
		StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateFunc"] = nil;
		StaticPopupDialogs["SW_ChangeTxt"]["SWUpdateInfo"] = nil;
		StaticPopupDialogs["SW_ChangeTxt"]["SWCallingFrame"] = nil;
	end,
	timeout = 0,
	exclusive = 1,
	hideOnEscape = 1
};
StaticPopupDialogs["SW_InvalidChan"] = {
	text = "Sorry, this is an invalid channel name.",
	button1 = OKAY,
	
	timeout = 0,
	whileDead = 1,
	hideOnEscape = 1,
};

--icon menu
SW_MiniIconMenu = {
	{ 
		["text"] = "SW Stats",
		["isTitle"] = 1,
		["justifyH"] = "CENTER",
		["notCheckable"] = 1,
	},
	{ 
		["textShow"] = "Show Main Window",
		["textHide"] = "Hide Main Window",
		["checkFrame"] = "SW_BarFrame1",
		["func"] = SW_ToggleBarFrame,
		["notCheckable"] = 1,
	},
	{ 
		["textShow"] = "Show Console",
		["textHide"] = "Hide Console",
		["checkFrame"] = "SW_FrameConsole",
		["func"] = SW_ToggleConsole,
		["notCheckable"] = 1,
	},
	{ 
		["textShow"] = "Show General Settings",
		["textHide"] = "Hide General Settings",
		["checkFrame"] = "SW_GeneralSettings",
		["func"] = SW_ToggleGeneralSettings,
		["notCheckable"] = 1,
	},
	{ 
		["textShow"] = "Show Sync Settings",
		["textHide"] = "Hide Sync Settings",
		["checkFrame"] = "SW_BarSyncFrame",
		["func"] = SW_ToggleSync,
		["notCheckable"] = 1,
	},
	{ 
		["text"] = "",
		["notCheckable"] = 1,
		["notClickable"] = 1,
	},
	{ 
		["text"] = "Reset Data",
		["func"] = SW_ResetCheck,
		["notCheckable"] = 1,
	},
	{ 
		["text"] = "",
		["notCheckable"] = 1,
		["notClickable"] = 1,
	},
	{ 
		["text"] = "Update Groupinfo",
		["func"] = SW_RebuildFriendList,
		["notCheckable"] = 1,
	},

}
-- key bindig strings
BINDING_HEADER_SW_BINDINGS = "SW Stats";
BINDING_NAME_SW_BIND_TOGGLEBARS = "Show/Hide the main window.";
BINDING_NAME_SW_BIND_CONSOLE = "Show/Hide the console.";
BINDING_NAME_SW_BIND_PAGE1 = "Show info tab 1";
BINDING_NAME_SW_BIND_PAGE2 = "Show info tab 2";
BINDING_NAME_SW_BIND_PAGE3 = "Show info tab 3";
BINDING_NAME_SW_BIND_PAGE4 = "Show info tab 4";
BINDING_NAME_SW_BIND_PAGE5 = "Show info tab 5";
BINDING_NAME_SW_BIND_PAGE6 = "Show info tab 6";
BINDING_NAME_SW_BIND_PAGE7 = "Show info tab 7";
BINDING_NAME_SW_BIND_PAGE8 = "Show info tab 8";
BINDING_NAME_SW_BIND_PAGE9 = "Show info tab 9";
BINDING_NAME_SW_BIND_PAGE10 = "Show info tab 10";


local SW_SLASH_ERROR = "WTF!! I TOLD YOU NOT TO TOUCH neutral.lua";  -- not used just another reminder :P

--dont localize this, must be the same through all languages
SW_SYNC_CHAN_ANNOUNCE = "SW Stats SyncChannel (v1.5+):%s"
SW_SYNC_CHAN_REGEX = "^SW Stats SyncChannel %(v1%.5%+%):(.+)"

-- barframe class filter
-- dont localize
SW_ClassFilters = {
[1] = "NONE",
[2] = "DRUID",
[3] = "HUNTER",
[4] = "MAGE",
[5] = "PALADIN",
[6] = "PRIEST",
[7] = "ROGUE",
[8] = "SHAMAN",
[9] = "WARLOCK",
[10] = "WARRIOR",
};

--default Vals for "BarFrames"
SW_DefaultBar = {
	["IN"] = 1, -- Info type
	--["BW"] = 128, --bar width 1.4.2 removed
	["COLC"] = 1; -- columnCount
	["BH"] = 10,  -- bar height
	["BC"] = {0,0.8,0,1}, -- bar vertex color
	["BT"] = 3, -- bar texture num
	["BFC"] = {1,1,1,1}; -- bar font color
	["BFS"] = 10, -- bar font height
	["OC"] = {1,0,0,1}; -- option button color
};
-- default color vars
SW_Default_Colors = {
	["Damage"] = {1,0,0,1},
	["Heal"] = {0,1,0,1},
	["DRUID"] = {1, 0.49, 0.04, 1},
	["HUNTER"] = {0.66, 0.83, 0.45, 1},
	["MAGE"] = {0.41, 0.8, 0.94, 1},
	["PALADIN"] = {0.96, 0.55, 0.73, 1},
	["PRIEST"] = {0.8, 0.8, 0.8, 1},
	["ROGUE"] = {1, 0.96, 0.41, 1},
	["SHAMAN"] = {0.96, 0.55, 0.73, 1},
	["WARLOCK"] = {0.58, 0.51, 0.79, 1},
	["WARRIOR"] = {0.78, 0.61, 0.43, 1},
};

function SW_GetSpellList()
	local sOut = "";
	for i,v in SW_Spellnames do
		sOut = sOut..v.."; "
	end
	return sOut;
end
-- Names and functions for available analysis
SW_InfoTypes = {
	[1] = {
		["f"] = SW_GetDmgInfo,
		["t"] = "Damage Done (S)",
		["synced"] = 1,
		["d"] = "Shows a simple damage list.",
		["cc"] = 1,
		["showPF"] = true,
	},
	[2] = {
		["f"] = SW_GetHealInfo,
		["t"] = "Raw Healing (S)",
		["synced"] = 1,
		["d"] = "Shows a simple heal list. (Overheals are counted towards the numbers displayed here).",
		["cc"] = 1,
		["showPF"] = true,
	},
	[3] = {
		["f"] = SW_GetDmgGotInfo,
		["t"] = "Damage Taken (S)",
		["synced"] = 1,
		["d"] = "Shows a list of the damage recieved. (Who got the most damage?)",
		["showPF"] = true,
	},
	[4] = {
		["f"] = SW_GetHealGotInfo,
		["t"] = "Healing Taken (S)",
		["synced"] = 1,
		["d"] = "Shows a list of healed targets. (Who got the most healing?)",
		["showPF"] = true,
	},
	[5] = {
		["f"] = SW_GetHealInfoHealer,
		["t"] = "Healing Breakdown (S)",
		["varType"] = "TEXT",
		["synced"] = 1,
		["d"] = "Shows detail healing info. (Who did this person heal?)",
	},
	[6] = {
		["f"] = SW_GetHealInfoTarget,
		["t"] = "Healing Info (S)",
		["varType"] = "TEXT",
		["synced"] = 1,
		["d"] = "Shows detail healing info for target. (Who was this person healed by?)",
	},
	[7] = {
		["f"] = SW_GetDetails,
		["t"] = "Skill Details (NotS)",
		["varType"] = "TEXT",
		["d"] = "Shows detail skill info. (What skills is this person using?) The number in () next to the name indicates the maximum hit/heal with this skill",
	},
	[8] = {
		["f"] = SW_GetDetailsPerTick,
		["t"] = "Average Effects (NotS)",
		["varType"] = "TEXT",
		["d"] = "Shows averaged skill info. (What's that persons average damage with frostbolt?) The number next to the name indicates usage count. Note: Can have odd numbers for spells with one large damage part with a following low damage DOT.",
	},
	[9] = {
		["f"] = SW_GetSchoolMade,
		["t"] = "Damage Type (NotS)",
		["varType"] = "TEXT",
		["d"] = "Shows school info. (What's the main part of this players damage? E.g. fire, ice, etc.)",
	},
	[10] = {
		["f"] = SW_GetSchoolGot,
		["t"] = "Damage Taken Type (NotS)",
		["varType"] = "TEXT",
		["d"] = "Shows school info recieved. (Whats the main source of damage to this player? E.g. fire, ice, etc.)",
	},
	[11] = {
		["f"] = SW_GetSchoolMadeSummary,
		["t"] = "Damage Done Summary (NotS)",
		["d"] = "Shows school info. (What's the main part of the raid damage? E.g. fire, ice, etc.) Note: Make sure to use filters.",
	},
	[12] = {
		["f"] = SW_GetSchoolGotSummary,
		["t"] = "Damage Taken Summary (NotS)",
		["d"] = "Shows school info recieved. (What's the main part the raid was damaged by? E.g. fire, ice, etc.) Note: Make sure to use filters.",
	},
	[13] = {
		["f"] = SW_GetOverHealInfo,
		["t"] = "Over-Healing (S)",
		["synced"] = 1,
		["d"] = "Shows overheal info. The percentage next to the name is his OH%, If you use the % option above that percentage is his portion of the total raid overheal.",
	},
	[14] = {
		["f"] = SW_GetEffectiveHealInfo,
		["t"] = "Effective Healing (S)",
		["synced"] = 1,
		["d"] = "Shows the heal list. Overheals are SUBTRACTED giving you a 'real' heal list.",
	},
	[15] = {
		["f"] = SW_GetManaRatio,
		["t"] = "Mana Efficiency",
		["varType"] = "SELF",
		["d"] = "Shows the amount of damage/healing per manapoint. A higher number indicates a higher mana efficiency (This ONLY works for yourself)",
	},
	[16] = {
		["f"] = SW_GetEffectiveHealManaInfo,
		["t"] = "Healing Mana Efficiency (S)",
		["synced"] = 1,
		["d"] = "To compare people that aren't in the SyncChannel use other infos to compare healing. A ratio of 2 means: 1 mana used to heal 2 points. (Higher values are better)",
	},
	[17] = {
		["f"] = SW_GetDeathInfo,
		["t"] = "Death Counter (S)",
		["synced"] = 1,
		["d"] = "How often did somebody or something die? This counts all deaths not just the ones you killed!",
	},
	[18] = {
		["f"] = SW_GetDamageManaInfo,
		["t"] = "Damage Mana Efficiency (S)",
		["synced"] = 1,
		["d"] = "To compare people that aren't in the SyncChannel use other infos to compare damage. A ratio of 2 means: 1 mana used to make 2 points of damage. (Higher values are better)",
	},
	[19] = {
		["f"] = SW_DecurseCountInfo,
		["t"] = "Decurse Count (S v1.5.1+)",
		["d"] = "How often did somebody 'decurse'?:"..SW_GetSpellList(),
	},
	[20] = {
		["f"] = SW_PowerGainInfo,
		["t"] = "Power gain (NotS)",
		["varType"] = "TEXT",
		["d"] = "This is EXPERIMENTAL, it just counts the # of powergains and non damage/heal events (not sure if this will show procs that don't heal or do dmg)",
	},
	[21] = {
		["f"] = SW_GetRaidPS,
		["t"] = "Raid Info per Second (S)",
		["varType"] = "SELF",
		["d"] = "Show various DPS values for the entire raid/group. If you are alone these values are slightly different to the DPS value you can display in the title bar. (In combat time is calculated differently)",
	},
	[22] = {
		["f"] = SW_GetMaxHitList,
		["t"] = "Max Hit List (NotS)",
		["d"] = "Shows the maximum damage made per hit / per person. (Max crit list)",
	},
	[23] = {
		["f"] = SW_GetMaxHealList,
		["t"] = "Max Heal List (NotS)",
		["d"] = "Shows the maximum heal done per spell / per person. (This does not include OH - It's a max crit list)",
	},
	[24] = {
		["f"] = SW_GetTopDmgDelta,
		["t"] = "Top Damage Interval(S)",
		["varType"] = "SELF",
		["d"] = "This only works with people in a SyncChannel. It shows the maximum increase in damage the player reported (for himself) in a 5 second interval.",
	},
	[25] = {
		["f"] = SW_GetTopHealDelta,
		["t"] = "Top Heal Interval (S)",
		["varType"] = "SELF",
		["d"] = "This only works with people in a SyncChannel. It shows the maximum increase in healing the player reported (for himself) in a 5 second interval.",
	},
	--[[ added and removed in 1.5.3.beta 1 the behavior is not "natural"
		people joining late will still be measured mit total raid time
	[26] = {
		["f"] = SW_GetDmgInfoDPS,
		["t"] = "DPS Per Player (S)",
		["varType"] = "PETONLY",
		["d"] = "This may differ from personal DPS info. The timer used for 'in fight' is the time the RAID has been in fight. (You should be doing something while the raid is, and if people kill rats, blame them not me)",
		["showPF"] = true,
	},
	--]]
}

--[[ SW_checkSIOI
	SW_checkSINeeded
	1.5.3.beta.1
	Added the above two Delta vals as standard info already because they are interesting if you aren't looking for cheaters aswell.
	
	For those reading code - im not ready with this, but I want to add a "sanity check" for numbers
	that come through the sync channel
	Essentially it's a cheat protection measure
	Under normal circumstance:
	-on average only a certain percent (on average) will be needed for SI msgs
	if the percentage is to high this person is most likely using a personal dmg/heal modifier
	- once things "setteled" in the sync channel very few SIOI msgs are needed
	if somebody is spamming these he most likely is using a "global" dmg/heal modifier
	(add dmg to my guildies)
	
	It's not bad to have high numbers here the question is how they compare to others in sync
	
	If you want to use this already - i discuourage it, I havent been able to check myself whats "normal"
	Eg in certain encounters where you HAVE to split up, needed will be higher
	In encounters where all should be cuddeled up in one spot needed should be very low
	on average though, it should level out again
	
	But, if one person shows up very high on both lists this is VERY suspicious
	
	All in all the basic idea is that every client in sync will try to identify unnormal data
	for full msg track info do
	/script SW_DumpTable(SW_Sync_MsgTrack) - that works even with the following funcs disabeled
	
	And BTW it sucks mokey balls i even have to do this, cause people go through lengths to enlarge their epeen

function SW_SYNCCHECK()
	return SW_checkSIOI();
end
function SW_SYNCCHECKNEEDED()
	return SW_checkSINeeded();
end
table.insert(SW_InfoTypes, {["f"] = SW_SYNCCHECK,
		["t"] = "SIOICheck",
		["varType"] = "SELF",
		["d"] = "For now this is just for DEV - Checks how often somebody triggered an SIOI",
});
table.insert(SW_InfoTypes, {["f"] = SW_SYNCCHECKNEEDED,
		["t"] = "SI Needed Check",
		["varType"] = "SELF",
		["d"] = "For now this is just for DEV - Checks how many SI where really needed",
});
--]]
SW_SlashCommands = {
	["help"] = {	["c"] = "?",
					["si"] = "Show console help.",
					["aC"] = 0,
					["f"] = SW_PrintHelp, 
	},
	["console"] = {	["c"] = "con",
					["si"] = "Brings up the SW Stats console",
					["aC"] = 0,
					["f"] = SW_ToggleConsole, 
	},
	["dumpVar"] = {	["c"] = "dump",
					["si"] = "dumps a var",
					["u"] = "Usage:"..SW_RootSlashes[1].." dump nameOfVar",
					["aC"] = 1,
					["f"] = SW_DumpVar, 
	},
	["reset"] = {	["c"] = "reset",
					["si"] = "Empty the Stat tables",
					["aC"] = 0,
					["f"] = SW_ResetCheck, 
	},
	["toggleBars"]={["c"] = "bars",
					["si"] = "Shows or hides the main window.",
					["aC"] = 0,
					["f"] = SW_ToggleBarFrame, 
	},
	["toggleGS"] = {["c"] = "gs",
					["si"] = "Shows or hides the General Settings.",
					["aC"] = 0,
					["f"] = SW_ToggleGeneralSettings, 
	},
	["skillUsage"] = {["c"] = "su",
					["si"] = "Shows Skill usage of people in the SyncChannel in the console. The name of the skill has to be EXACTLY the way it is in game.",
					["u"] = "Usage:"..SW_RootSlashes[1].." su Name of Skill",
					["aC"] = 1,
					["f"] = SW_GetSkillUsage, 
	},
	["versionCheck"] = {["c"] = "vc",
					["si"] = "Does a SW_Stats version check for people in the SyncChannel.",
					["aC"] = 0,
					["f"] = SW_VersionCheck, 
	},
	["syncKick"] = {["c"] = "kick",
					["si"] = "Kicks a player from the SyncChannel.",
					["u"] = "Usage:"..SW_RootSlashes[1].." kick NameOfPlayer",
					["aC"] = 1,
					["f"] = SW_KickPlayer, 
	},
	["resetVote"]={ ["c"] = "rv",
					["si"] = "Starts a vote to reset the SyncChannel.",
					["aC"] = 0,
					["f"]= SW_InitResetVote,
	},
	["syncJoin"] = {["c"] = "join",
					["si"] = "Manually join a SyncChannel",
					["u"] = "Usage:"..SW_RootSlashes[1].." join NameOfChannel",
					["aC"] = 1,
					["f"] = SW_ManualSyncJoin, 
	},
	["resetWindows"] = {["c"] = "resetwin",
					["si"] = "Resets the position of all windows.",
					["aC"] = 0,
					["f"] = SW_ResetAllWindows, 
	},
	["lockFrame"] = {["c"] = "tlock",
					["si"] = "Locks or unlocks the windows.",
					["aC"] = 0,
					["f"] = SW_ToggleLocks, 
	},
}

-- GFT = Good For Target
-- Y = yes N = no B= both (depends on target)
-- as of 1.5.1 im not using this info yet
SW_SpellTypes = {
	[1] = {
		["GFT"] = "Y",
	},
	[2] = {
		["GFT"] = "Y",
	},
	[3] = {
		["GFT"] = "B",
	},
	[4] = {
		["GFT"] = "Y",
	},
	[5] = {
		["GFT"] = "Y",
	},
	[6] = {
		["GFT"] = "Y",
	},
	[7] = {
		["GFT"] = "Y",
	},
	[8] = {
		["GFT"] = "Y",
	},
	[9] = {
		["GFT"] = "Y",
	},
	[10] = {
		["GFT"] = "N",
	},
	
};


-- does nothing for english, but a stub for other languages
function SW_FixLogStrings(str)
	return str;
end

function SW_mergeLocalization()
	
	local locInfo = SW_LocalizedCommands;
	
	if locInfo ~= nil then
		for k,v in pairs(SW_SlashCommands) do
			if locInfo[k] ~= nil then
				if locInfo[k]["c"] ~= nil then
					SW_SlashCommands[k]["c"] = locInfo[k]["c"];
				end
				if locInfo[k]["si"] ~= nil then
					SW_SlashCommands[k]["si"] = locInfo[k]["si"];
				end
				if locInfo[k]["u"] ~= nil then
					SW_SlashCommands[k]["u"] = locInfo[k]["u"];
				end
			end
		end
	end
	if SW_LocalizedGUI ~= nil then
		for k,v in pairs(SW_GUI) do
			if SW_LocalizedGUI[k] ~=nil then
				if type(SW_GUI[k]) == "table" then
					SW_GUI[k]["s"] = SW_LocalizedGUI[k];
				else
					SW_GUI[k] = SW_LocalizedGUI[k];
				end
			end
		end
	end
	
	-- k we are done merging dump the tables
	SW_LocalizedCommands = nil;
	SW_LocalizedGUI = nil;
end