-- AddonBase

-- объявление общеупотребительных глобальных переменных

--tooltip types
Global( "TOOLTIP_NONE", 0 )
Global( "TOOLTIP_UNIT", 1 )
Global( "TOOLTIP_ITEM", 2 )
Global( "TOOLTIP_ITEM_VENDOR", 3 )
Global( "TOOLTIP_MAPMARK", 4 )
Global( "TOOLTIP_SPELL", 5 )
Global( "TOOLTIP_BUFF", 6 )
Global( "TOOLTIP_ABILITY", 7 )
Global( "TOOLTIP_COMPONENT", 8 )
Global( "TOOLTIP_RECIPE", 9 )
Global( "TOOLTIP_USABLE_DEVICE", 10 )
Global( "TOOLTIP_ASTRAL_UNIT", 11 )
Global( "TOOLTIP_FAIRY", 12 )
Global( "TOOLTIP_SIMPLE", 13 )
Global( "TOOLTIP_SIMPLEDESC", 14 )
Global( "TOOLTIP_TALENT", 15 )
Global( "TOOLTIP_REPUTATION", 16 )
Global( "TOOLTIP_HEARTHSTONE", 17 )
Global( "TOOLTIP_INNATE_STAT", 18 )

-- tooltip content line types
Global( "TOOLTIP_CONTENT", {
	[ "SMART_LINE" ] = 1,
	[ "ICON_SMART_LINE" ] = 2,
	[ "RUNE_INFO_LINE" ] = 3,
	[ "DOUBLE_LINE" ] = 4,
	[ "ICON_BAR" ] = 5,
	[ "MONEY_COUNT" ] = 6,
	[ "PROGRESS_BAR" ] = 7,
	[ "SEPARATOR" ] = 8
} )

--popup types
Global( "POPUP_NONE", 0 )
Global( "POPUP_TARGET_MOB", 1 )
Global( "POPUP_TARGET_PLAYER", 2 )
Global( "POPUP_TARGET_AVATAR", 3 )
Global( "POPUP_GROUP_MEMBER", 4 )
Global( "POPUP_GROUP_OFFLINE_MEMBER", 5 )
Global( "POPUP_FRIEND_MEMBER", 6 )
Global( "POPUP_FRIEND_OFFLINE_MEMBER", 7 )
Global( "POPUP_IGNORE_MEMBER", 8 )
Global( "POPUP_GUILD_MEMBER", 9 )
Global( "POPUP_GUILD_OFFLINE_MEMBER", 10 )
Global( "POPUP_GUILD_RANK", 11 )
Global( "POPUP_RAID_RANK", 12 )
Global( "POPUP_LOOT_SCHEME", 13 )
Global( "POPUP_ITEM_QUALITY", 14 )

--message box button type
Global( "MESSAGE_BOX_BUTTON_NONE", 0 )
Global( "MESSAGE_BOX_BUTTON_ACCEPT", 1 )
Global( "MESSAGE_BOX_BUTTON_DECLINE", 2 )
Global( "MESSAGE_BOX_BUTTON_CONFIRM", 3 )

-- quest states
Global( "QUEST_IN_PROGRESS",	0 ) -- default
Global( "QUEST_READY_TO_RETURN", 1 )
Global( "QUEST_COMPLETED",	  2 )
Global( "QUEST_FAILED",				3 )

-- quest marks
Global( "QUEST_MARK_READY_TO_ACCEPT", 1 )
Global( "QUEST_MARK_SOON_TO_ACCEPT", 2 )
Global( "QUEST_MARK_READY_TO_GIVE", 3 )
Global( "QUEST_MARK_SOON_TO_GIVE", 4 )

-- quest counter type
Global( "QUEST_COUNT_KILL", 0 ) -- default
Global( "QUEST_COUNT_ITEM", 1 ) 
Global( "QUEST_COUNT_SPECIAL", 2 ) 

-- Тип квеста
Global( "QUEST_TYPE_SOLO", 0 )
Global( "QUEST_TYPE_PARTY", 1 )
Global( "QUEST_TYPE_INSTANCE", 2 )
Global( "QUEST_TYPE_RAID", 3 )


-- keyboard flags
-- can be used in combinations like (KBF_SHIFT + KBF_ALT) etc.

Global( "KBF_NONE",  0 ) -- default
Global( "KBF_SHIFT", 1 )
Global( "KBF_ALT",   2 )
Global( "KBF_CTRL",  4 )
Global( "KBF_ANY",   255 )

-- additional bind parameters

Global( "BIND_ACTIVATE_ONLY",           0 ) -- default
Global( "BIND_ACTIVATE_AND_DEACTIVATE", 1 )

-- widget alignment
Global( "WIDGET_ALIGN_LOW",    0 )
Global( "WIDGET_ALIGN_HIGH",   1 )
Global( "WIDGET_ALIGN_CENTER", 2 )
Global( "WIDGET_ALIGN_BOTH",   3 )
Global( "WIDGET_ALIGN_LOW_ABS", 4 )

-- widget sizing
Global( "WIDGET_SIZING_DEFAULT", 0 )
Global( "WIDGET_SIZING_INTERNAL", 1 )
Global( "WIDGET_SIZING_CHILDREN", 2 )

-- blend effect
Global( "BLEND_EFFECT_ALPHABLND", 0 )
Global( "BLEND_EFFECT_HIGHLIGHT", 1 )
Global( "BLEND_EFFECT_ADD", 2 )
Global( "BLEND_EFFECT_MUL", 3 )
Global( "BLEND_EFFECT_REPLACE", 4 )

-- effect types
Global( "EA_MONOTONOUS_INCREASE", 0 ) -- равномерное изменение параметра
Global( "EA_SYMMETRIC_FLASH"	, 1 ) -- эффект вспышки

-- damage source
Global( "DAMAGE_SOURCE_SPELL",      0 )
Global( "DAMAGE_SOURCE_DOT",	      1 )
Global( "DAMAGE_SOURCE_MAINATTACK", 2 )
Global( "DAMAGE_SOURCE_OFFATTACK",  3 )
Global( "DAMAGE_SOURCE_OTHER",      4 )

Global( "SEX_UNKNOWN",  0 )
Global( "SEX_MALE",  1 )
Global( "SEX_FEMALE",  2 )

-- player or mob mana type
Global( "MANA_TYPE_MANA", 0 )
Global( "MANA_TYPE_ENERGY", 1 )
Global( "MANA_TYPE_HONOR", 2 )

-- action effects
Global( "EFFECT_TYPE_UNKNOWN", 0 )
Global( "EFFECT_TYPE_COOLDOWN_STARTED", 1 )
Global( "EFFECT_TYPE_COOLDOWN_FINISHED", 2 )
Global( "EFFECT_TYPE_SPELL_PREPARED", 3 )

-- dress slots
Global( "DRESS_SLOT_HELM", 0 )
Global( "DRESS_SLOT_ARMOR", 1 )
Global( "DRESS_SLOT_PANTS", 2 )
Global( "DRESS_SLOT_BOOTS", 3 )
Global( "DRESS_SLOT_MANTLE", 4 )
Global( "DRESS_SLOT_GLOVES", 5 )
Global( "DRESS_SLOT_BRACERS", 6 )
Global( "DRESS_SLOT_BELT", 7 )
Global( "DRESS_SLOT_RING1", 8 )
Global( "DRESS_SLOT_RING2", 9 )
Global( "DRESS_SLOT_EARRINGS", 10 )
Global( "DRESS_SLOT_NECKLACE", 11 )
Global( "DRESS_SLOT_CLOAK", 12 )
Global( "DRESS_SLOT_SHIRT", 13 )
Global( "DRESS_SLOT_MAINHAND", 14 )
Global( "DRESS_SLOT_OFFHAND", 15 )
Global( "DRESS_SLOT_RANGED", 16 )
Global( "DRESS_SLOT_AMMO", 17 )
Global( "DRESS_SLOT_TABARD", 18 )
Global( "DRESS_SLOT_TRINKET", 19 )
Global( "DRESS_SLOT_BAG", 20 )
Global( "DRESS_SLOT_UNDRESSABLE", 21 )
Global( "DRESS_SLOT_TWOHANDED", 22 )
Global( "DRESS_SLOT_DUALWIELD", 23 )
Global( "DRESS_SLOT_RING", 24 )

Global( "ITEM_QUALITY_JUNK", 0 )
Global( "ITEM_QUALITY_GOODS", 1 )
Global( "ITEM_QUALITY_COMMON", 2 )
Global( "ITEM_QUALITY_UNCOMMON", 3 )
Global( "ITEM_QUALITY_RARE", 4 )
Global( "ITEM_QUALITY_EPIC", 5 )

-- item binding types
Global( "ITEM_BINDING_BIND_NONE", 0 )
Global( "ITEM_BINDING_BIND_ON_PICKUP", 1 )
Global( "ITEM_BINDING_BIND_ON_EQUIP", 2 )
Global( "ITEM_BINDING_BIND_ON_USE", 3 )

-- take items result
Global( "TAKE_ITEMS_RESULT_SUCCESS", 0 )
Global( "TAKE_ITEMS_RESULT_PARTIAL_STACK_LEFT", 1 )
Global( "TAKE_ITEMS_RESULT_FULL_STACK_LEFT", 2 )

-- itemmall account status
Global( "ITEMMALL_STATUS_NORMAL", 0 )
Global( "ITEMMALL_STATUS_LOCKED", 1 )

-- action types
Global( "ACTION_TYPE_UNKNOWN", 0 )
Global( "ACTION_TYPE_SPELL", 1 )
Global( "ACTION_TYPE_ITEM", 2 )

-- spell types
Global( "SPELL_TYPE_SELF", 0 )
Global( "SPELL_TYPE_CURRENT_TARGET", 1 )
Global( "SPELL_TYPE_POINT", 2 )
Global( "SPELL_TYPE_CURRENT_TARGET_NOT_SELF", 3 )

-- visible objects index
Global( "VIS_OBJ_QUEST_COMPLETED", 0 )
Global( "VIS_OBJ_LEVEL_UP_MARK", 1 )
Global( "VIS_OBJ_AVATAR_UP", 2 )
Global( "VIS_OBJ_AVATAR_BOTTOM", 3 )

-- visible objects position
Global( "ATTACHED_OBJECT_POS_BOTTOM", 0 )
Global( "ATTACHED_OBJECT_POS_CENTER", 1 )
Global( "ATTACHED_OBJECT_POS_UP", 2 )

-- mob qualities (eliteness)
Global( "UNIT_QUALITY_COMMON", 0 )
Global( "UNIT_QUALITY_ELITE", 1 )
Global( "UNIT_QUALITY_FLAVOR_ELITE", 2 )
Global( "UNIT_QUALITY_MINI_BOSS", 3 )
Global( "UNIT_QUALITY_BOSS", 4 )
Global( "UNIT_QUALITY_RAID_BOSS", 5 )
Global( "UNIT_QUALITY_RAID_ELITE", 6 )
Global( "UNIT_QUALITY_CRITTER", 7 )

-- bag modes
Global( "BAG_MODE_DEFAULT", 0 )
Global( "BAG_MODE_VENDOR", 1 )
Global( "BAG_MODE_TRADE", 2 )
Global( "BAG_MODE_ALCHEMY", 3 )
Global( "BAG_MODE_CRAFT", 4 )
Global( "BAG_MODE_MAIL", 5 )
Global( "BAG_MODE_AUCTION", 6 )
Global( "BAG_MODE_DEPOSITE", 7 )

-- drag & drop
Global( "DND_CONTAINER_STEP", 1000 )
Global( "DND_INVALID_ID", -1 )
Global( "DND_EQUIPMENT", 0 )
Global( "DND_INVENTORY", 1 )
Global( "DND_ACTIONBAR", 2 )
Global( "DND_SPELLBOOK", 3 )
Global( "DND_VENDOR", 4 )
Global( "DND_DEPOSITE", 5 )
Global( "DND_WORLD", 6 )
Global( "DND_ALCHEMY", 7 )
Global( "DND_ARMOR_CRAFT", 8 )
Global( "DND_CHARACTER_CONTROL3D", 9 )
Global( "DND_MAIL", 10 )
Global( "DND_AUCTION", 11 )
Global( "DND_LOOTBAG", 12 )
Global( "DND_PLAYER_TRADE", 13 )
Global( "DND_WIDGET_MOVE", 14 )
Global( "DND_WIDGET_RESIZE", 15 )

-- chat
Global( "CHAT_TYPE_ASK", -2 )
Global( "CHAT_TYPE_NOTICE", -1 )
Global( "CHAT_TYPE_WHISPER", 0 )
Global( "CHAT_TYPE_PARTY", 1 )
Global( "CHAT_TYPE_SAY", 2 )
Global( "CHAT_TYPE_ZONE", 4 )
Global( "CHAT_TYPE_YELL_ZONE", 5 )
Global( "CHAT_TYPE_WORLD", 6 )
Global( "CHAT_TYPE_EMOTE", 7 )
Global( "CHAT_TYPE_CHANNEL", 8 )
Global( "CHAT_TYPE_GUILD", 9 )
Global( "CHAT_TYPE_GUILD_OFFICER", 10 )
Global( "CHAT_TYPE_RAID", 11 )

-- pet movement type
Global( "PET_MOVE_FOLLOW", 0 )
Global( "PET_MOVE_STAY", 1 )

-- pet aggro type
Global( "PET_AGGRO_AGGRESIVE", 0 )
Global( "PET_AGGRO_DEFENSIVE", 1 )
Global( "PET_AGGRO_PASSIVE", 2 )

-- Zone PvP Type
Global( "ZONE_PVP_TYPE_ARENA", 0 )
Global( "ZONE_PVP_TYPE_CONTESTED", 1 )
Global( "ZONE_PVP_TYPE_HOMELAND", 2 )
Global( "ZONE_PVP_TYPE_SANCTUARY", 3 )

-- Choice Greed/Need for loot
Global( "CHOICE_GREED_NEED_PASS", 0 )
Global( "CHOICE_GREED_NEED_GREED", 1 )
Global( "CHOICE_GREED_NEED_NEED", 2 )

-- LootScheme
Global( "LOOT_SCHEME_TYPE_FREE_FOR_ALL", 0 )
Global( "LOOT_SCHEME_TYPE_MASTER", 1 )
Global( "LOOT_SCHEME_TYPE_GROUP", 2 )

-- ValuedObject type
Global( "VAL_OBJ_TYPE_UNKNOWN", 0 )
Global( "VAL_OBJ_TYPE_ITEM", 1 )
Global( "VAL_OBJ_TYPE_SPELL", 2 )
Global( "VAL_OBJ_TYPE_ABILITY", 3 )
Global( "VAL_OBJ_TYPE_CREATURE", 4 )
Global( "VAL_OBJ_TYPE_PLAYER", 5 )

-- Usable device type
Global( "USDEV_NOT_USABLE_DEVICE", -1 )
Global( "USDEV_USABLE_DEVICE", 0 )
Global( "USDEV_REACTOR", 1 )
Global( "USDEV_ENGINE_HORIZONTAL", 2 )
Global( "USDEV_ENGINE_VERTICAL", 3 )
Global( "USDEV_RUDDER", 4 )
Global( "USDEV_CANNON", 5 )
Global( "USDEV_BEAM_CANNON", 6 )
Global( "USDEV_TORPEDO", 7 )
Global( "USDEV_SHIELD", 8 )
Global( "USDEV_NAVIGATOR", 9 )
Global( "USDEV_REPAIR", 10 )
Global( "USDEV_TELEPORT", 11 )
Global( "USDEV_LAZARETH", 12 )
Global( "USDEV_TREASURE", 13 )
Global( "USDEV_REMOTE_RUDDER", 14 )
Global( "USDEV_REMOTE_ENGINE", 15 )
Global( "USDEV_REMOTE_ENGINE_HORIZONTAL", 16 )
Global( "USDEV_REMOTE_ENGINE_VERTICAL", 17 )
Global( "USDEV_BOARDING", 18 )
Global( "USDEV_SCANER", 19 )
Global( "USDEV_DECOR_SAILS", 20 )
Global( "USDEV_DECOR_NAME", 21 )
Global( "USDEV_DECOR_FLAG", 22 )
Global( "USDEV_DECOR_STERN", 23 )
Global( "USDEV_DECOR_LIGHTHOUSE", 24 )
Global( "USDEV_DECOR_STATUE", 25 )
Global( "USDEV_DECOR_FIGUREHEAD", 26 )

-- Psionic contact type
Global( "PSIONIC_CONTACT_NORMAL", 0 )
Global( "PSIONIC_CONTACT_CRUDE", 1 )

-- Ship sides
Global( "SHIP_SIDE_NONE", 0 )
Global( "SHIP_SIDE_GENERAL", 1 )
Global( "SHIP_SIDE_FRONT", 2 )
Global( "SHIP_SIDE_REAR", 3 )
Global( "SHIP_SIDE_LEFT", 4 )
Global( "SHIP_SIDE_RIGHT", 5 )

-- Options data type
Global( "UI_OPTION_DATA_FIXED", 0 )
Global( "UI_OPTION_DATA_BOOLEAN", 1 )
Global( "UI_OPTION_DATA_DISCRETE", 2 )
Global( "UI_OPTION_DATA_DISCRETE_FLOAT", 3 )

-- Options view types
Global( "UI_OPTION_VIEW_LABEL", 0 )
Global( "UI_OPTION_VIEW_CHECKBOX", 1 )
Global( "UI_OPTION_VIEW_RADIO", 2 )
Global( "UI_OPTION_VIEW_SLIDER", 3 )
Global( "UI_OPTION_VIEW_LIST", 4 )
Global( "UI_OPTION_VIEW_PUSH_BUTTON", 5 )

-- effect types
Global( "ET_MOVE", 0 )
Global( "ET_FADE", 1 )
Global( "ET_RESIZE", 2 )
Global( "ET_TEXTURE_ROTATION", 3 )
Global( "ET_TEXT_SCALE", 4 )


-- Client detectors types
Global( "CLIENT_DETECTOR_QUEST_NPC", 0 )
Global( "CLIENT_DETECTOR_TRAINER_NPC", 1 )
Global( "CLIENT_DETECTOR_VENDOR_NPC", 2 )
Global( "CLIENT_DETECTOR_SERVICE_NPC", 3 )
Global( "CLIENT_DETECTOR_PLAYER", 4 )

-- Vendor types
Global( "VENDOR_NO_VENDOR", 0 )
Global( "VENDOR_GENERAL", 1 )
Global( "VENDOR_WEAPON_ARMOR", 2 )
Global( "VENDOR_CRAFTING_COMPONENTS", 3 )
Global( "VENDOR_USABLE_ITEMS", 4 )
Global( "VENDOR_GUILD", 5 )
Global( "VENDOR_MYRRH", 6 )

-- MessageBox ENUMs

Global( "MSG_BOX_OK", 0 )
Global( "MSG_BOX_OK_CANCEL", 1 )
Global( "MSG_BOX_YES_NO", 2 )
Global( "MSG_BOX_YES_NO_CANCEL", 3 )

-- Crafting skill ENUMs

Global( "CRAFTING_SKILL_UNKNOWN", 0 ) 
Global( "CRAFTING_SKILL_ALCHEMY", 1 ) 
Global( "CRAFTING_SKILL_ARMOR_CRAFT", 2 ) 

-- Armor craft ENUMs

Global( "ARMOR_CRAFT_PROP_LVL_ADD", 0 ) 
Global( "ARMOR_CRAFT_PROP_LVL_SUB", 1 ) 
Global( "ARMOR_CRAFT_PROP_QLT_ADD", 2 ) 
Global( "ARMOR_CRAFT_PROP_QLT_SUB", 3 ) 
Global( "ARMOR_CRAFT_PROP_SCS_ADD", 4 ) 
Global( "ARMOR_CRAFT_PROP_SCS_SUB", 5 ) 

-- Guild member rights

Global( "GUILD_MEMBER_RIGHT_CHAT", 0 ) 
Global( "GUILD_MEMBER_RIGHT_OFFICER_CHAT", 1 ) 
Global( "GUILD_MEMBER_RIGHT_RECRUIT", 2 ) 
Global( "GUILD_MEMBER_RIGHT_PROMOTE_DEMOTE", 3 ) 
Global( "GUILD_MEMBER_RIGHT_KICK", 4 ) 
Global( "GUILD_MEMBER_RIGHT_WEAR_SYMBOLICS", 5 ) 
Global( "GUILD_MEMBER_RIGHT_MODIFY_SYMBOLICS", 6 ) 
Global( "GUILD_MEMBER_RIGHT_MODIFY_MESSAGE", 7 ) 
Global( "GUILD_MEMBER_RIGHT_MODIFY_DESCRIPTION", 8 ) 
Global( "GUILD_MEMBER_RIGHT_MODIFY_MEMBER_DESCRIPTION", 9 ) 

-- Ability and spell learn failed conditions

Global( "LEARN_ERROR_LOW_LEVEL", 0 ) 
Global( "LEARN_ERROR_NO_CASH", 1 ) 
Global( "LEARN_ERROR_NO_PREVIOS_RANKS", 2 ) 
Global( "LEARN_ERROR_ALREADY_KNOWN", 3 ) 
Global( "LEARN_ERROR_PREVIOS_TRAINING_UNFINISHED", 4 ) 

-- Reputation levels
Global( "REPUTATION_LEVEL_HOSTILITY", 0 ) 
Global( "REPUTATION_LEVEL_ENEMY", 1 ) 
Global( "REPUTATION_LEVEL_UNFRIENDLY", 2 ) 
Global( "REPUTATION_LEVEL_NEUTRAL", 3 ) 
Global( "REPUTATION_LEVEL_KINDLY", 4 ) 
Global( "REPUTATION_LEVEL_FRIENDLY", 5 ) 
Global( "REPUTATION_LEVEL_CONFIDENTIAL", 6 ) 

-- Honor ranks
Global( "HONOR_RANK_NONE", 0 ) 
Global( "HONOR_RANK_WHIPPERSNAPPER", 1 ) 
Global( "HONOR_RANK_KILLER", 2 ) 
Global( "HONOR_RANK_BUTCHER", 3 ) 
Global( "HONOR_RANK_JUDGE", 4 ) 

-- Auction search result sorting order
Global( "AUCTION_ORDERFIELD_NAME", 0 )
Global( "AUCTION_ORDERFIELD_CLASS", 1 )
Global( "AUCTION_ORDERFIELD_SLOT", 2 )
Global( "AUCTION_ORDERFIELD_RARETY", 3 )
Global( "AUCTION_ORDERFIELD_LEVEL", 4 )
Global( "AUCTION_ORDERFIELD_TYPE", 5 )
Global( "AUCTION_ORDERFIELD_BID", 6 )
Global( "AUCTION_ORDERFIELD_BUYOUT", 7 )
Global( "AUCTION_ORDERFIELD_LEFTTIME", 8 )
Global( "AUCTION_ORDERFIELD_NONE", 9 )

-- Auction life time
Global( "AUCTION_CREATETIME_HOURS3", 0 )
Global( "AUCTION_CREATETIME_HOURS12", 1 )
Global( "AUCTION_CREATETIME_HOURS24", 2 )

-- Group member state
Global( "GROUP_MEMBER_STATE_OFFLINE", 0 ) 
Global( "GROUP_MEMBER_STATE_NEAR", 1 ) 
Global( "GROUP_MEMBER_STATE_FAR", 2 ) 

-- Reason of target changing
Global( "CHANGE_TARGET_UNKNOWN", 0 ) 
Global( "CHANGE_TARGET_DEAD_TARGET", 1 ) 

-- Creature InnateStats
Global( "INNATE_STAT_STRENGTH", 0 )
Global( "INNATE_STAT_MIGHT", 1 )
Global( "INNATE_STAT_DEXTERITY", 2 )
Global( "INNATE_STAT_AGILITY", 3 )
Global( "INNATE_STAT_STAMINA", 4 )
Global( "INNATE_STAT_PRECISION", 5 )
Global( "INNATE_STAT_HARDINESS", 6 )
Global( "INNATE_STAT_INTELLECT", 7 )
Global( "INNATE_STAT_INTUITION", 8 )
Global( "INNATE_STAT_SPIRIT", 9 )
Global( "INNATE_STAT_WILL", 10 )
Global( "INNATE_STAT_RESOLVE", 11 )
Global( "INNATE_STAT_WISDOM", 12 )
Global( "INNATE_STAT_LETHALITY", 13 )

-- Creature resistances
Global( "RESISTANCE_ELEMENTAL", 0 )
Global( "RESISTANCE_DIVINE", 1 )
Global( "RESISTANCE_NATURE", 2 )

-- Raid member state
Global( "RAID_MEMBER_STATE_OFFLINE", 0 ) 
Global( "RAID_MEMBER_STATE_NEAR", 1 ) 
Global( "RAID_MEMBER_STATE_FAR", 2 ) 

-- Raid member rights
Global( "RAID_MEMBER_RIGHT_LEADER_HELPER", 0 ) 
Global( "RAID_MEMBER_RIGHT_LOOT_MASTER", 1 ) 

-- Pet types
Global( "PET_TYPE_UNKNOWN", -1 ) 
Global( "PET_TYPE_NECROMANCER", 0 ) 
Global( "PET_TYPE_DRUID", 1 ) 
Global( "PET_TYPE_PSIONIC", 2 ) 

-- Spell Requirements types
Global( "AFCT_Or", 2 ) 
Global( "AFCT_And", 3 ) 
Global( "AFCT_Not", 4 ) 

-- ItemMall banners types
Global( "BANNER_TYPE_ITEM", 0 ) 
Global( "BANNER_TYPE_CATEGORY", 1 ) 
Global( "BANNER_TYPE_STATUS", 2 ) 

Global( "ITEMMALL_ITEM_NOTITEMMALLABLE", 0 )
Global( "ITEMMALL_ITEM_ITEMMALLABLE", 1 )
Global( "ITEMMALL_ITEM_SELLABLE", 2 )

Global( "TTT_Talents", 0 )
Global( "TTT_Stats", 1 )

Global( "INTERACTION_BINDING_STONE", 1 )
Global( "INTERACTION_HERALD", 2 )

-- MailBox template parameter type
Global( "MAIL_TEMPLATE_PARAM_TYPE_TEXT", 0 ) 
Global( "MAIL_TEMPLATE_PARAM_TYPE_MONEY", 1 ) 
Global( "MAIL_TEMPLATE_PARAM_TYPE_GAME_ITEM", 2 ) 

-- Chargen
Global( "CHARGEN_EQUIP_TYPE_NONE", 0 )
Global( "CHARGEN_EQUIP_TYPE_HIGH_LEVEL", 1 )

-- EVENT_AVATAR_ITEM_TAKEN source
Global( "ITEM_TAKEN_TYPE_QUEST", 1 )
Global( "ITEM_TAKEN_TYPE_SPELL", 2 )
Global( "ITEM_TAKEN_TYPE_VENDOR", 3 )
Global( "ITEM_TAKEN_TYPE_СRAFT", 4 )

-- EVENT_QUEST_ACCEPT_ERROR 
Global( "ACCEPT_ERROR_SUCCESS", 0 )
Global( "ACCEPT_ERROR_FAIL_SYSTEM", 1 )
Global( "ACCEPT_ERROR_QUEST_IS_STARTED", 2 )
Global( "ACCEPT_ERROR_QUEST_IS_FINISHED", 3 )
Global( "ACCEPT_ERROR_QUEST_ON_COOLDOWN", 4 )
Global( "ACCEPT_ERROR_TOO_MANY_ACTIVE_QUESTS", 5 )
Global( "ACCEPT_ERROR_TO_MANY_QUESTS_ON_COOLDOWN", 6 )

-- WIDGET_3D_BIND_POINT_...
Global( "WIDGET_3D_BIND_POINT_LOW", 0 )
Global( "WIDGET_3D_BIND_POINT_CENTER", 1 )
Global( "WIDGET_3D_BIND_POINT_HIGH", 2 )

--/////////////////////////////////////////////////////////////////////////////////////////////
function GetDNDId( container, item )
	return container * DND_CONTAINER_STEP + item
end

function GetDNDContainer( id )
	return math.floor( id / DND_CONTAINER_STEP )
end

function GetDNDItem( id )
	return math.mod( id, DND_CONTAINER_STEP )
end

function GetTableSize( t )
	if not t then
		return 0
	end
	local count = 0
	for k, v in t do
		count = count + 1
	end
	return count
end

--------------------------------------------------------------------------------
function CloneTable ( value )
	if type( value ) == "table" then
		local new = {}
		for id, entry in value do
			new[ id ] = CloneTable( entry )
		end
		return new
	else
		return value
	end
end
--------------------------------------------------------------------------------
function Sign( number )
	return number < 0 and -1 or 1
end
--------------------------------------------------------------------------------
function Clamp( number, min, max )
	if min and max then
		max = math.max ( min, max )
		min = math.min ( min, max )
	end
	return number and ( ( max and number > max and max ) or ( min and number < min and min ) ) or number
end
--------------------------------------------------------------------------------

function Round( number, limit )
	local multiplier = 10 ^ ( limit or 0 )
	return math.floor( number * multiplier + 0.5 ) / multiplier
end

function Ms2Sec( number )
	return Round( number / 1000 )
end

-- Logging helpers
function GetStringListByArguments( argList )
	local newArgList = {}
	
	for i = 1, argList.n do
		local arg = argList[ i ]
		if common.IsWString( arg ) then
			newArgList[ i ] = arg
		else
			newArgList[ i ] = tostring( arg )
		end
	end

	return newArgList
end

function LogInfo( ... )
	common.LogInfo( common.GetAddonName(), unpack( GetStringListByArguments( arg ) ) )
end

function LogInfoCommon( ... )
	common.LogInfo( "common", unpack( GetStringListByArguments( arg ) ) )
end


function LogWarning( ... )
	common.LogWarning( "common", unpack( GetStringListByArguments( arg ) ) )
end


function LogError( ... )
	common.LogError( "common", unpack( GetStringListByArguments( arg ) ) )
end

function LogMemoryUsage()
	local used, treshold = gcinfo()
	common.LogInfo( common.GetAddonName(), tostring( used ), "Kb of memory used, ", tostring( treshold ), "Kb available" )
end
