⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enchantrixbarker.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 3 页
字号:
--[[	Enchantrix v3.5.0.0917 (Platypus)	$Id: EnchantrixBarker.lua 917 2006-07-04 19:54:25Z mentalpower $	By Norganna	http://enchantrix.org/	This is an addon for World of Warcraft that add a list of what an item	disenchants into to the items that you mouse-over in the game.	License:		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(see GLP.txt); if not, write to the Free Software		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.]]local priorityList = {};local categories = { --TODO: Localize	Bracer = {search = "Bracer", print = "Bracer" },	Gloves = {search = "Gloves", print = "Gloves" },	Boots = {search = "Boots", print = "Boots" },	Shield = {search = "Shield", print = "Shield" },	Chest = {search = "Chest", print = "Chest" },	Cloak = {search = "Cloak", print = "Cloak" },	TwoHanded = {search = "2H", print = "2H Weapon"},	AnyWeapon = {search = "Enchant Weapon", print = "Any Weapon" }};local print_order = { 'Bracer', 'Gloves', 'Boots', 'Chest', 'Cloak', 'Shield', 'TwoHanded', 'AnyWeapon' }; --TODO: Localizelocal attributes = { --TODO: Localize	'intellect',	'stamina',	'spirit',	'strength',	'agility',	'fire resistance',	'resistance to fire',	'resistance',	'all stats',	'mana',	'health',	'additional armor',	'additional points of armor',	'increase armor',	'increase its armor',	'absorption',	'damage to beasts',	'points? of damage',	'\+[0-9]+ damage',	'defense'};local short_attributes = { --TODO: Localize	'INT',	'STA',	'SPI',	'STR',	'AGI',	'fire res',	'fire res',	'all res',	'all stats',	'mana',	'health',	'armour',	'armour',	'armour',	'armour',	'DMG absorb',	'Beastslayer',	'DMG',	'DMG',	'DEF'};-- UI codefunction EnchantrixBarker_OnEvent()	--Enchantrix.Util.ChatPrint("GotUIEvent...");	-- Returns "Enchanting" for enchantwindow and nil for Beast Training	local craftName, rank, maxRank = GetCraftDisplaySkillLine()	if craftName then		--Enchantrix.Util.ChatPrint("Barker config is "..tostring(Enchantrix.Config.GetFilter('barker')) );		if( event == "CRAFT_SHOW" ) then			if( Enchantrix.Config.GetFilter('barker') and GetLocale() == "enUS" ) then				Enchantrix_BarkerButton:Show();				Enchantrix_BarkerButton.tooltipText = 'Posts a sales message to the Trade channel, if available.'; --TODO: Localize				Enchantrix_BarkerOptionsButton:Show();				Enchantrix_BarkerButton.tooltipText = 'Opens the barker options window.'; --TODO: Localize			else				Enchantrix_BarkerButton:Hide();				Enchantrix_BarkerOptionsButton:Hide();				Enchantrix_BarkerOptions_Frame:Hide();			end		elseif( event == "CRAFT_CLOSE" )then			Enchantrix_BarkerButton:Hide();			Enchantrix_BarkerOptionsButton:Hide();			Enchantrix_BarkerOptions_Frame:Hide();		end	endendfunction Enchantrix_BarkerOptions_OnShow()	Enchantrix_BarkerOptions_ShowFrame(1);endfunction Enchantrix_BarkerOnClick()	--Enchantrix.Util.ChatPrint(Enchantrix_CreateBarker());	local barker = Enchantrix_CreateBarker();	local id = GetChannelName("Trade") --TODO: Localize	EnhTooltip.DebugPrint("EnxBarker: Attempting to send barker", barker, "Trade Channel ID", id)	if (barker and id and (not id == 0)) then		SendChatMessage(barker,"CHANNEL", GetDefaultLanguage("player"), id);	else		Enchantrix.Util.ChatPrint("Enchantrix: You aren't in a trade zone or you have no enchants available."); --TODO: Localize	endendfunction Enchantrix.Barker.AddonLoaded()	Enchantrix.Util.ChatPrint("Barker Loaded...");	if( not EnchantConfig.barker ) then		EnchantConfig.barker = {};	end	--EnchantConfig.barker = EnchantConfig.barker;	if( not EnchantConfig.barker.profit_margin ) then		EnchantConfig.barker.profit_margin = 10;	end	if( not EnchantConfig.barker.randomise ) then		EnchantConfig.barker.randomise = 10;	end	if( not EnchantConfig.barker.lowest_price ) then		EnchantConfig.barker.lowest_price = 100;	endendlocal function relevel(frame)	local myLevel = frame:GetFrameLevel() + 1	local children = { frame:GetChildren() }	for _,child in pairs(children) do		child:SetFrameLevel(myLevel)		relevel(child)	endendlocal function craftUILoaded()	Stubby.UnregisterAddOnHook("Blizzard_CraftUI", "Enchantrix")	Enchantrix_BarkerButton:SetParent(CraftFrame);	Enchantrix_BarkerButton:SetPoint("TOPRIGHT", CraftFrame, "TOPRIGHT", -40, -60 );	Enchantrix_BarkerOptionsButton:SetParent(CraftFrame);	Enchantrix_BarkerOptionsButton:SetPoint("BOTTOMRIGHT", Enchantrix_BarkerButton, "BOTTOMLEFT");	Enchantrix_BarkerOptions_Frame:SetParent(CraftFrame);	Enchantrix_BarkerOptions_Frame:SetPoint("TOPLEFT", CraftFrame, "TOPRIGHT");	relevel(Enchantrix_BarkerOptions_Frame)endfunction EnchantrixBarker_OnLoad()	Stubby.RegisterAddOnHook("Blizzard_CraftUI", "Enchantrix", craftUILoaded)endlocal config_defaults = {	lowest_price = 5000,	sweet_price = 50000,	high_price = 500000,	profit_margin = 10,	highest_profit = 100000,	randomise = 10,	AnyWeapon = 100,	TwoHanded = 90,	Bracer = 70,	Gloves = 70,	Boots = 70,	Chest = 70,	Cloak = 70,	Shield = 70,	INT = 90,	STA = 70,	AGI = 70,	STR = 70,	SPI = 45,	["all stats"] = 75,	["all res"] = 55,	armour = 65,	["fire res"] = 85,	mana = 35,	health = 40,	DMG = 90,	DEF = 60,	other = 70,	factor_price = 20,	factor_item = 40,	factor_stat = 40};function Enchantrix_BarkerGetConfig( key )	if( not EnchantConfig.barker ) then		EnchantConfig.barker = {};	end	local config = EnchantConfig.barker;	if( not config[key] ) then		config[key] = config_defaults[key];	end	--Enchantrix.Util.ChatPrint("Getting config: "..key.." - "..config[key]);	return config[key];endfunction Enchantrix_BarkerSetConfig( key, value )	--Enchantrix.Util.ChatPrint("Setting config: "..key.." - "..value);	if( not EnchantConfig.barker ) then		EnchantConfig.barker = {};	end	local config = EnchantConfig.barker;	config[key] = value;endfunction Enchantrix_BarkerOptions_TestButton_OnClick()	local barker = Enchantrix_CreateBarker();	if barker ~= nil then		Enchantrix.Util.ChatPrint(barker);	else		Enchantrix.Util.ChatPrint("Enchantrix: You aren't in a trade zone or you have no enchants available."); --TODO: Localize	endendfunction Enchantrix_BarkerOptions_Factors_Slider_GetValue(id)	if (not id) then		id = this:GetID();	end	return Enchantrix_BarkerGetConfig(Enchantrix_BarkerOptions_TabFrames[Enchantrix_BarkerOptions_ActiveTab].options[id].key);endfunction Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged(id)	if (not id) then		id = this:GetID();	end	Enchantrix_BarkerSetConfig(Enchantrix_BarkerOptions_TabFrames[Enchantrix_BarkerOptions_ActiveTab].options[id].key, this:GetValue());endEnchantrix_BarkerOptions_ActiveTab = -1;Enchantrix_BarkerOptions_TabFrames = { --TODO: Localize	{		title = 'Profit and Price Priorities',		options = {			{				name = 'Profit Margin',				tooltip = 'The percentage profit to add to the base mats cost.',				units = 'percentage',				min = 0,				max = 100,				step = 1,				key = 'profit_margin',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'Highest Profit',				tooltip = 'The highest total cash profit to make on an enchant.',				units = 'money',				min = 0,				max = 250000,				step = 500,				key = 'highest_profit',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'Lowest Price',				tooltip = 'The lowest cash price to quote for an enchant.',				units = 'money',				min = 0,				max = 50000,				step = 500,				key = 'lowest_price',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'Overall Price Priority',				tooltip = 'This sets how important pricing is to the overall priority for advertising.',				units = 'percentage',				min = 0,				max = 100,				step = 1,				key = 'factor_price',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'PriceFactor SweetSpot',				tooltip = 'This is used to prioritise enchants near this price for advertising.',				units = 'money',				min = 0,				max = 500000,				step = 5000,				key = 'sweet_price',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'PriceFactor Highest',				tooltip = 'Enchants receive a score of zero for price priority at or above this value.',				units = 'money',				min = 0,				max = 1000000,				step = 50000,				key = 'high_price',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			},			{				name = 'Random Factor',				tooltip = 'The amount of randomness in the enchants chosen for the trade shout.',				units = 'percentage',				min = 0,				max = 100,				step = 1,				key = 'randomise',				getvalue = Enchantrix_BarkerOptions_Factors_Slider_GetValue,				valuechanged = Enchantrix_BarkerOptions_Factors_Slider_OnValueChanged			}		}	},	{		title = 'Item Priorities',		options = {			{				name = 'Overall Items Priority',				tooltip = 'This sets how important the item is to the overall priority for advertising.',				units = 'percentage',				min = 0,				max = 100,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -