local TraceFrame = DEFAULT_CHAT_FRAME;
--/script i = 2;
--/script i = i *2;DEFAULT_CHAT_FRAME:AddMessage(i);

DBOT_linkable_execute = true;

local DBOT_linkable_inumobjet_max = 130000;	--120000;	--110000;	--100000;	--95000;	--85000;	--75000;	--70000;	--65000;	--60000;	--55000;	--50000;	--45000;	--40000;
local DBOT_linkable_serveur = GetRealmName();
local DBOT_linkable_joueur = UnitName("player");
local DBOT_linkable_wow_build;
_, DBOT_linkable_wow_build, _, _ = GetBuildInfo();
DBOT_linkable_wow_build = tonumber(DBOT_linkable_wow_build);
local DBOT_linkable_time = 0;
DBOT_linkable_time_ecart = 2;
--DBOT_linkable_time_ecart = 1;
--DBOT_linkable_time_ecart = .5;
--DBOT_linkable_time_ecart = .1;
--/script DBOT_linkable_time_ecart = 0.1;
--/script DBOT_linkable_time_ecart = 0.5;
--/script DBOT_linkable_time_ecart = 1;
local DBOT_linkable_mode = -1;		-- arret
--local DBOT_linkable_mode = 0;		-- marche
local DBOT_linkable_inumobjet = 0;
local DBOT_linkable_inumobjet_config = 0;
local DBOT_linkable_inumobjet_connect = 1;
local DBOT_linkable_inumobjet_connect_boucle = false;

local DBOT_linkable_inumobjet14b = 1;

local DBOT_linkable_mode_objetexistepas = false;
local DBOT_linkable_mode_objetexistepasb = 1;

local DBOT_linkable_time_debabs = 0;
local DBOT_linkable_time_finabs = 0;

local DBOT_linkable_time_lag_time = 0;
local DBOT_linkable_time_lag_duree = 0;

local DBOT_linkable_time_lag_time2 = nil;
local DBOT_linkable_time_lag_time3 = nil;
local DBOT_linkable_time_lag_duree2 = nil;

local DBOT_linkable_nb = 0;
local DBOT_linkable_nb_old = 0;
local DBOT_linkable_nb_type3 = 0;
local DBOT_linkable_nb_tout = nil;

local DBOT_linkable_quelesnonlinkable = 0;

--/script DBOT_linkable["Kirin Tor"]["objetsbinaire1000"] = {};
--/script DBOT_linkable[GetRealmName()]["objetsbinaire1000"] = {};

local DBOT_linkable_inumquete_max = 40000;	--35000;	--30000;
local DBOT_linkable_inivquete_min = -2;
local DBOT_linkable_inivquete_max = 95;
local DBOT_linkable_inumquete = 0;
local DBOT_linkable_inivquete = DBOT_linkable_inivquete_min;
local DBOT_linkable_mode_quete = false;
local DBOT_linkable_mode_quete_envoi_en_cours = false;

function DBOT_linkable_OnLoad(self)

	self:RegisterEvent("VARIABLES_LOADED");
	--self:RegisterEvent("CHAT_MSG_ADDON");
	self:RegisterEvent("CHAT_MSG_WHISPER");
	self:RegisterEvent("CHAT_MSG_WHISPER_INFORM");

	DBOT_linkable = {};
	DBOT_linkable_t_serveur = {};

end

function DBOT_linkable_OnEvent(self,event)

local idate;

	if ( event == "" ) then
--	elseif ( event == "CHAT_MSG_ADDON" ) then
--		if ( arg1 == "DBOTL" ) then
--			DBOT_linkable_OnEvent_CHAT_MSG_ADDON_DBOTL();
--		end
	elseif ( event == "VARIABLES_LOADED" ) then
		if ( DBOT_linkable.tableauserveur == nil ) then
			DBOT_linkable = {};
			DBOT_linkable.tableauserveur = 1;
		end
		if ( DBOT_linkable.serveur and DBOT_linkable.serveur == DBOT_linkable_serveur ) then
		else
			DBOT_linkable_t_serveur = {};
		end
		DBOT_linkable.serveur = DBOT_linkable_serveur;
		if ( DBOT_linkable_t_serveur == nil ) then
			DBOT_linkable_t_serveur = {};
		end
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
			DBOT_linkable_t_serveur = {};
			DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
			--DBOT_linkable_time_ecart = 0.1;
		end
		DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"] = nil;
		idate = tonumber(date("%Y%m%d"));
		if ( DBOT_linkable.date and ( DBOT_linkable.date > ( idate - 7 ) ) and DBOT_linkable.wowbuild and ( DBOT_linkable.wowbuild == DBOT_linkable_wow_build ) ) then
		else
--TraceFrame:AddMessage("VARIABLES_LOADED init date etc");
			--DBOT_linkable.numobjet = nil;
			--DBOT_linkable.dernierobjetlinkable = nil;
			DBOT_linkable.date = idate;
			DBOT_linkable.wowbuild = DBOT_linkable_wow_build;
			DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
			if ( DBOT_linkable.dernierlink ) then
			else
				DBOT_linkable.dernierlink = DBOT_linkable_inumobjet_max + 1;
			end
			DBOT_linkable.numobjet_premiere_connect_date = DBOT_linkable.dernierlink;
			DBOT_linkable.toutfait = false;
			DBOT_linkable.DBOT_linkable_nb = 0;
		end
		--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart == nil ) then
		--else
		--	DBOT_linkable_time_ecart = DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart;
		--end
		--if ( DBOT_linkable["DBOT_linkable_nb"] ) then
		--	DBOT_linkable_nb = DBOT_linkable["DBOT_linkable_nb"];
		--	DBOT_linkable_nb_old = DBOT_linkable_nb;
		--end
		if ( DBOT_linkable["DBOT_linkable_inumquete"] and DBOT_linkable["DBOT_linkable_inivquete"] ) then
			DBOT_linkable_inumquete = DBOT_linkable["DBOT_linkable_inumquete"];
			DBOT_linkable_inivquete = DBOT_linkable["DBOT_linkable_inivquete"];
		end
	end

end

function DBOT_linkable_OnUpdate(self)

if ( InCombatLockdown() ) then
	return nil;
end

local i;
local bstop;
local itime;
local itemName;
local itemLink;
local smessage;
local ipos;
local ipos2;
local x;
local y;
local inumobjet;
local btrouve;
local itemTexture;
local tobjet = nil;

	if ( DBOT_linkable_mode_quete == true ) then
		if ( DBOT_linkable_mode_quete_envoi_en_cours == false ) then
			if ( DBOT_linkable_inivquete == DBOT_linkable_inivquete_min ) then
			else
				DBOT_linkable_inivquete = DBOT_linkable_inivquete + 1;
				if ( DBOT_linkable_inivquete > DBOT_linkable_inivquete_max ) then
					DBOT_linkable_inumquete = DBOT_linkable_inumquete + 1;
					DBOT_linkable_inivquete = DBOT_linkable_inivquete_min;
				end
			end
			if ( DBOT_linkable_inivquete == DBOT_linkable_inivquete_min ) then
				btrouve = false;
				while ( DBOT_linkable_inumquete <= DBOT_linkable_inumquete_max and btrouve == false ) do
					if ( DBquetes2 and DBquetes2[DBOT_linkable_inumquete] and ( DBquetes2[DBOT_linkable_inumquete][-2] == nil ) and ( strfind(DBquetes2[DBOT_linkable_inumquete][0],"%[") == nil ) ) then
					--if ( DBquetes2 and DBquetes2[DBOT_linkable_inumquete] and ( strfind(DBquetes2[DBOT_linkable_inumquete][0],"%[") == nil ) ) then
						btrouve = true;
						DBOT_linkable_inivquete = DBOT_linkable_inivquete_min + 1;
					else
						DBOT_linkable_inumquete = DBOT_linkable_inumquete + 1;
					end
				end
				if ( btrouve == true and DBquetes2[DBOT_linkable_inumquete] and DBquetes2[DBOT_linkable_inumquete][0] ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("DBOT_linkable_OnUpdate , quete : "..DBOT_linkable_inumquete.." : |cffffff00|Hquest:"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."|h["..DBquetes2[DBOT_linkable_inumquete][0].."]|h|r");
end
					smessage = "@DBOT_linkable@QT01@"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."@|cffff2020|Hquest:"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."|h["..DBquetes2[DBOT_linkable_inumquete][0].."]|h|r";
					DBOT_linkable_mode_quete_envoi_en_cours = true;
					DBOT_linkable_time_lag_time = GetTime();
					SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
					DBOT_linkable_inumobjet14b = 0;
				else
					DBOT_linkable_inumquete = 0;
					DBOT_linkable_inivquete = DBOT_linkable_inivquete_min;
					DBOT_linkable_quete_modeoff();
					--DBOT_linkable_mode_quete = false;
				end
			else
				smessage = "@DBOT_linkable@QT01@"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."@|cffff2020|Hquest:"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."|h["..DBquetes2[DBOT_linkable_inumquete][0].."]|h|r";
				DBOT_linkable_mode_quete_envoi_en_cours = true;
				DBOT_linkable_time_lag_time = GetTime();
				SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
				DBOT_linkable_inumobjet14b = 0;
			end
			DBOT_linkable["DBOT_linkable_inumquete"] = DBOT_linkable_inumquete;
			DBOT_linkable["DBOT_linkable_inivquete"] = DBOT_linkable_inivquete;
		end
	elseif ( DBOT_linkable_mode == 0 ) then
		DBOT_linkable_time = GetTime();
		DBOT_linkable_mode = 11;
		--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
		--	DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
		--end
		--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] == nil ) then
		--	DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
		--	DBOT_linkable_nb = 0;
		--	DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
		--end
		--DBOT_linkable_inumobjet = DBOT_linkable_inumobjet_config;
		--DBOT_linkable_time = GetTime();
		--DBOT_linkable_mode = 14;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
		--DBOT_linkable_inumobjet = DBOT_linkable_inumobjet_config;
	elseif ( DBOT_linkable_mode == 13 ) then
		itime = GetTime();
		if ( ( itime - DBOT_linkable_time ) > 1 ) then
			if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
				DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
			end
			if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] == nil ) then
				DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
				--DBOT_linkable_nb = 0;
				--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
			end
			bstop = false;
			for i = 1 , 100 do
				if ( bstop == false ) then
					DBOT_linkable.dernierlink = DBOT_linkable.dernierlink - 1;
					y = floor((DBOT_linkable.dernierlink-1)/1000);
					x = DBOT_linkable.dernierlink - ( y * 1000 );
					y = y + 1;
					if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
						DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
					else
						if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
							DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
						end
					end
					--x = x + 1;
					--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"][DBOT_linkable_inumobjet] ) then
					if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
--						itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = GetItemInfo(snumlong);
						itemName, itemLink, _, _, _, _, _, _, _, _ = GetItemInfo(DBOT_linkable.dernierlink);
						if ( itemName ) then
						else
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode.." incorrecte.");
end
							--DBOT_linkable_time_ecart = 0.1;
							--DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart = DBOT_linkable_time_ecart;
							DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
							--DBOT_linkable_nb = 0;
							--DBOT_linkable_nb_tout = 0;
							--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
							--DBOT_linkable_inumobjet = 0;
							--DBOT_linkable_inumobjet_config = 0;
							--DBOT_linkable.numobjet = 0;
							DBOT_linkable_time = GetTime();
							DBOT_linkable_mode = 14;
							DBOT_linkable_inumobjet14b = 1;
							--if ( DBCS_mobs_model_execute == nil ) then
							--else
							--	DBCS_mobs_model_execute_OFF();
							--end
							if ( DBOT_execute == nil ) then
							else
								--DBOT_modeoff();
							end
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
							bstop = true;
						end
					end
				end
			end
			if ( bstop == false ) then
--TraceFrame:AddMessage("100 objets : "..DBOT_linkable_inumobjet);
				--if ( DBOT_linkable_inumobjet > DBOT_linkable_inumobjet_max ) then
				if ( DBOT_linkable.dernierlink < 1 ) then
					DBOT_linkable.dernierlink = DBOT_linkable_inumobjet_max + 1;
					DBOT_linkable_time = GetTime();
					DBOT_linkable_mode = 14;
					DBOT_linkable_inumobjet14b = 1;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
				end
				DBOT_linkable_time = GetTime();
			end
		end
	elseif ( DBOT_linkable_mode == 14 and DBOT_linkable_inumobjet14b == 1 ) then
	--elseif ( DBOT_linkable_mode == 14 ) then
		if ( DBOT_linkable_inumobjet14b == 1 ) then
		DBOT_linkable_time_lag_time2 = nil;
		itime = GetTime();
		--if ( GameMenuFrame:IsVisible() ) then
		--	DBOT_linkable_time = itime + 30;
		--end
--		down, up, lag = GetNetStats(); 
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("down : "..down..", up : "..up..", lag : "..lag);
--	if ( up > .92 ) then
--TraceFrame:AddMessage("down : "..down..", up : "..up..", lag : "..lag);
--	end
--end
		if ( ( itime - DBOT_linkable_time ) > DBOT_linkable_time_ecart ) then
		--if ( ( itime - DBOT_linkable_time ) > 0 ) then
			--if ( DBcorps_recupenreg_ON ) then
			--	DBQS2_tester_niveau_unequete_niv();
			--end
--			smessage = "@DBQS2@QT01@"..inum..":"..i.."@|cffff2020|Hquest:"..inum..":"..i.."|h["..DBquetes2[inum][0].."]|h|r";
			bstop = false;
			for i = 1 , 100 do
				if ( bstop == false ) then
					DBOT_linkable.dernierlink = DBOT_linkable.dernierlink - 1;
					itemTexture = GetItemIcon(DBOT_linkable.dernierlink);
				if ( itemTexture ) then
					if ( DBOS01 and DBOS02 and DBOS03 ) then
						if ( DBOT_linkable.dernierlink > 100000 ) then
							tobjet = DBOS03[DBOT_linkable.dernierlink];
						elseif ( DBOT_linkable.dernierlink > 50000 ) then
							tobjet = DBOS02[DBOT_linkable.dernierlink];
						else
							tobjet = DBOS01[DBOT_linkable.dernierlink];
						end
						if ( tobjet == nil ) then
							tobjet = {};
							tobjet[8] = itemTexture;
						end
						if ( DBOT_linkable.dernierlink > 100000 ) then
							DBOS03[DBOT_linkable.dernierlink] = tobjet;
						elseif ( DBOT_linkable.dernierlink > 50000 ) then
							DBOS02[DBOT_linkable.dernierlink] = tobjet;
						else
							DBOS01[DBOT_linkable.dernierlink] = tobjet;
						end
					end
					if ( DBOT_linkable.toutfait == false and DBOT_linkable.dernierlink == DBOT_linkable.numobjet_premiere_connect_date ) then
						DBOT_linkable.toutfait = true;
						--message("DBOT_linkable.toutfait = true");
					end
					y = floor((DBOT_linkable.dernierlink-1)/1000);
					x = DBOT_linkable.dernierlink - ( y * 1000 );
					y = y + 1;
--TraceFrame:AddMessage("DBOT_linkable.dernierlink = "..DBOT_linkable.dernierlink..", y = "..y..", x = "..x);
					if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
						DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
					else
						if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
							DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
						end
					end
--					if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"][DBOT_linkable_inumobjet] == nil ) then
					if ( ( DBOT_linkable.toutfait == false ) or ( ( DBOT_linkable.toutfait == true ) and ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "0" ) ) ) then
--						itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture = GetItemInfo(snumlong);
						itemName, itemLink, _, _, _, _, _, _, _, _ = GetItemInfo(DBOT_linkable.dernierlink);
						if ( itemName and DBOT_linkable_quelesnonlinkable == 0 ) then
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("1 objet "..DBOT_linkable.dernierlink.." : "..itemLink);
--end
--	DBOT_linkable_joueur
--	DBOT_linkable_serveur
							if ( DBOS01 and DBOS02 and DBOS03 ) then
								if ( DBOT_linkable.dernierlink > 100000 ) then
									tobjet = DBOS03[DBOT_linkable.dernierlink];
								elseif ( DBOT_linkable.dernierlink > 50000 ) then
									tobjet = DBOS02[DBOT_linkable.dernierlink];
								else
									tobjet = DBOS01[DBOT_linkable.dernierlink];
								end
								if ( ( tobjet == nil ) or ( tobjet[4] == nil ) ) then
									DBobjets_initobjet(DBOT_linkable.dernierlink);
								end
							end
							--ipos = strfind(itemName,"<",1);
							--if ( ipos == nil ) then
								ipos = strfind(itemName,"%[",1);
								if ( ipos == nil ) then
									smessage = "@DBOT_linkable@OT01@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
--TraceFrame:AddMessage("smessage = "..smessage);
									DBOT_linkable_time_lag_time = GetTime();
									SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
									--smessage = "@OT01@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
									--SendAddonMessage("DBOTL",smessage,"WHISPER",DBOT_linkable_joueur);
									bstop = true;
									DBOT_linkable_inumobjet14b = 0;
								end
							--end
						elseif ( itemName == nil ) then
							tobjet = nil;
							if ( DBOT_linkable.dernierlink > 100000 ) then
								if ( DBOS03 ) then
									tobjet = DBOS03[DBOT_linkable.dernierlink];
								end
							elseif ( DBOT_linkable.dernierlink > 50000 ) then
								if ( DBOS02 ) then
									tobjet = DBOS02[DBOT_linkable.dernierlink];
								end
							else
								if ( DBOS01 ) then
									tobjet = DBOS01[DBOT_linkable.dernierlink];
								end
							end
							if ( tobjet and tobjet[1] ) then
								itemName = tobjet[1];
								itemLink = DBOT_getlinkitem(itemName,DBOT_linkable.dernierlink..":0:0:0:0:0:0:0:0:0:0",tobjet[2],"i");
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("1 objet "..DBOT_linkable.dernierlink.." : "..itemLink);
--end
								--ipos = strfind(itemName,"<",1);
								--if ( ipos == nil ) then
									ipos = strfind(itemName,"%[",1);
									if ( ipos == nil ) then
										smessage = "@DBOT_linkable@OT03@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
--TraceFrame:AddMessage("smessage = "..smessage);
										DBOT_linkable_time_lag_time = GetTime();
										SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
										--smessage = "@OT03@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
										--SendAddonMessage("DBOTL",smessage,"WHISPER",DBOT_linkable_joueur);
										bstop = true;
										DBOT_linkable_inumobjet14b = 0;
									else
										ipos2 = strfind(itemName,"%]",1);
										if ( ipos2 ) then
											if ( ipos == 1 ) then
												itemName = strsub(itemName,ipos2+1);
											else
												itemName = strsub(itemName,1,ipos-1)..strsub(itemName,ipos2+1);
											end
											itemName = strtrim(itemName," ");
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("itemName = "..DBOT_linkable.dernierlink..":["..itemName.."]");
--end
											ipos = strfind(itemName,"%[",1);
											if ( ipos == nil ) then
												itemLink = DBOT_getlinkitem(itemName,DBOT_linkable.dernierlink..":0:0:0:0:0:0:0:0:0:0",tobjet[2],"i");
												smessage = "@DBOT_linkable@OT03@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
--TraceFrame:AddMessage("smessagebof = "..smessage);
												DBOT_linkable_time_lag_time = GetTime();
												SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
												--smessage = "@OT03@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
												--SendAddonMessage("DBOTL",smessage,"WHISPER",DBOT_linkable_joueur);
												bstop = true;
												DBOT_linkable_inumobjet14b = 0;
											end
										end
									end
								--end
							else
--if ( DBCS_debug and DBCS_debug > 1 ) then
								if ( DBOT_linkable_mode_objetexistepasb == 1 and DBOT_linkable_mode_objetexistepas == true and DBOS01 and DBOS02 and DBOS03 and ( DBOS01[DBOT_linkable.dernierlink] or DBOS02[DBOT_linkable.dernierlink] or DBOS03[DBOT_linkable.dernierlink] ) ) then
									--itemName = "grand blabla";
									itemName = ""..DBOT_linkable.dernierlink;
									itemLink = DBOT_getlinkitem(itemName,DBOT_linkable.dernierlink..":0:0:0:0:0:0:0:0:0:0",6,"i");
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("1 objet "..DBOT_linkable.dernierlink.." : "..itemLink);
--end
									--ipos = strfind(itemName,"<",1);
									--if ( ipos == nil ) then
										ipos = strfind(itemName,"%[",1);
										if ( ipos == nil ) then
											smessage = "@DBOT_linkable@OT04@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
--TraceFrame:AddMessage("smessage = "..smessage);
											DBOT_linkable_time_lag_time = GetTime();
											SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
											bstop = true;
											DBOT_linkable_inumobjet14b = 0;
											--DBOT_linkable_time_ecart = 0.1;
										end
									--end
								end
--end
							end
						else
						end
					elseif ( 1 == 0 ) then
						--if ( DBOT_linkable_nb_tout ) then
						--	DBOT_linkable_nb_tout = DBOT_linkable_nb_tout + 1;
						--end
						itemName, itemLink, _, _, _, _, _, _, _, _ = GetItemInfo(DBOT_linkable.dernierlink);
						if ( itemName ) then
							if ( DBOS01 and DBOS02 and DBOS03 ) then
								if ( DBOT_linkable.dernierlink > 100000 ) then
									tobjet = DBOS03[DBOT_linkable.dernierlink];
								elseif ( DBOT_linkable.dernierlink > 50000 ) then
									tobjet = DBOS02[DBOT_linkable.dernierlink];
								else
									tobjet = DBOS01[DBOT_linkable.dernierlink];
								end
								if ( tobjet and tobjet[48] == nil ) then
								--itemName, _, _, _, _, _, _, _, _, _ = GetItemInfo(DBOT_linkable.dernierlink);
								--if ( itemName ) then
									DBobjets_initobjet(DBOT_linkable.dernierlink);
								--end
								end
							end
						else
							if ( DBOT_linkable.dernierlink == 39878 ) then
							else
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode.." incorrecte. objet : "..DBOT_linkable.dernierlink);
	tobjet = nil;
	if ( DBOT_linkable.dernierlink > 100000 ) then
		if ( DBOS03 ) then
			tobjet = DBOS03[DBOT_linkable.dernierlink];
		end
	elseif ( DBOT_linkable.dernierlink > 50000 ) then
		if ( DBOS02 ) then
			tobjet = DBOS02[DBOT_linkable.dernierlink];
		end
	else
		if ( DBOS01 ) then
			tobjet = DBOS01[DBOT_linkable.dernierlink];
		end
	end
	if ( tobjet and tobjet[1] ) then
TraceFrame:AddMessage("----------------------------------"..tobjet[1]);
	end
end
								--DBOT_linkable_time_ecart = 0.1;
								--DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart = DBOT_linkable_time_ecart;
								DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
								--DBOT_linkable_nb = 0;
								--DBOT_linkable_nb_tout = 0;
								--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
								--DBOT_linkable.dernierlink = 0;
								--DBOT_linkable_inumobjet_config = 0;
								--DBOT_linkable.numobjet = 0;
								DBOT_linkable_time = GetTime();
								DBOT_linkable_mode = 14;
								--if ( DBCS_mobs_model_execute == nil ) then
								--else
								--	DBCS_mobs_model_execute_OFF();
								--end
								if ( DBOT_execute == nil ) then
								else
									--DBOT_modeoff();
								end
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
								bstop = true;
							end
						end
					end
				end
				end
			end
			if ( bstop == false ) then
				--itemName = ""..DBOT_linkable.dernierlink;
				--itemLink = DBOT_getlinkitem(itemName,DBOT_linkable.dernierlink..":0:0:0:0:0:0:0:0:0",6,"i");
				--smessage = "@DBOT_linkable@OT04@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
--TraceFrame:AddMessage("DBOT_linkable.dernierlink : "..DBOT_linkable.dernierlink);
				itemName = "0";
				itemLink = DBOT_getlinkitem(itemName,"0:0:0:0:0:0:0:0:0:0",6,"i");
				smessage = "@DBOT_linkable@OT04@0@"..itemLink.."@";
				DBOT_linkable_time_lag_time = GetTime();
				SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
				DBOT_linkable_inumobjet14b = 0;
			end
			--if ( DBOT_linkable.dernierlink > DBOT_linkable_inumobjet_max ) then
			if ( DBOT_linkable.dernierlink < 1 ) then
				DBOT_linkable.dernierlink = DBOT_linkable_inumobjet_max + 1;
				--DBOT_linkable_time_ecart = 1;
				--DBOT_linkable_time_ecart = 0.1;
				--DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart = nil;
				--DBOT_linkable.numobjet = DBOT_linkable.dernierlink;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage(DBOT_linkable.DBOT_linkable_nb.." objets linkables.");
end
--				if ( DBOT_linkable_nb_tout ) then
--					DBOT_linkable_nb = DBOT_linkable_nb_tout;
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage(DBOT_linkable_nb.." objets linkables total.");
--end
--					DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
--				end
				--if ( DBCS_mobs_model_execute == nil ) then
				--else
					--if ( abs(DBOT_linkable_nb_old-DBOT_linkable_nb) < 100 ) then
					--	DBCS_mobs_model_execute_ON();
					--else
					--	DBCS_mobs_model_execute_OFF();
					--end
					--if ( DBOT_linkable_mode_objetexistepasb == 1 and DBOT_linkable_nb_old == DBOT_linkable_nb ) then
						--DBOT_linkable_mode_objetexistepas = true;
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("je mets DBOT_linkable_mode_objetexistepas ON.");
--end
					--end
				--end
				--DBOT_linkable_nb_old = DBOT_linkable_nb;
				--DBOT_linkable_nb_type3 = 0;
				--DBOT_linkable_nb_tout = 0;
			end
			DBOT_linkable_time = GetTime();
		end
		else
			if ( DBOT_linkable_time_lag_time2 == nil ) then
				DBOT_linkable_time_lag_time2 = DBOT_linkable_time_lag_time;
			end
			DBOT_linkable_time_lag_time3 = GetTime();
			DBOT_linkable_time_lag_duree2 = DBOT_linkable_time_lag_time3 - DBOT_linkable_time_lag_time2;
			if ( DBOT_linkable_time_lag_duree2 > 1 ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("lag de "..(DBOT_linkable_time_lag_time3-DBOT_linkable_time_lag_time).." secondes.");
end
				DBOT_linkable_time_lag_time2 = DBOT_linkable_time_lag_time3;
			end
		end
	elseif ( DBOT_linkable_mode == 11 ) then
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
			DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
		end
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] == nil ) then
			DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
			--DBOT_linkable_nb = 0;
			--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
		end
		--inumobjet = 0;
		--if ( DBOT_linkable.dernierobjetlinkable ) then
		--	inumobjet = DBOT_linkable.dernierobjetlinkable;
		--end
		--for i = 1 , DBOT_linkable_inumobjet_max do
		--	y = floor((i-1)/1000);
		--	x = i - ( y * 1000 );
		--	y = y + 1;
		--	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] ) then
		--		if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
		--			inumobjet = i;
		--		end
		--	end
		--end
		bstop = true;
		if ( DBOT_linkable.dernierlink > 0 ) then
			itemName, itemLink, _, _, _, _, _, _, _, _ = GetItemInfo(DBOT_linkable.dernierlink);
			tobjet = nil;
			if ( DBOT_linkable.dernierlink > 100000 ) then
				if ( DBOS03 ) then
					tobjet = DBOS03[DBOT_linkable.dernierlink];
				end
			elseif ( DBOT_linkable.dernierlink > 50000 ) then
				if ( DBOS02 ) then
					tobjet = DBOS02[DBOT_linkable.dernierlink];
				end
			else
				if ( DBOS01 ) then
					tobjet = DBOS01[DBOT_linkable.dernierlink];
				end
			end
			if ( itemName or ( tobjet and tobjet[1] ) ) then
				if ( itemName ) then
				else
					itemName = tobjet[1];
					itemLink = DBOT_getlinkitem(itemName,DBOT_linkable.dernierlink..":0:0:0:0:0:0:0:0:0:0",tobjet[2],"i");
				end
				ipos = strfind(itemName,"<",1);
				if ( ipos == nil ) then
					ipos = strfind(itemName,"%[",1);
					if ( ipos == nil ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("envoi DBOT_linkable.dernierlink "..DBOT_linkable.dernierlink.." = "..itemLink);
end
						smessage = "@DBOT_linkable@OT02@"..DBOT_linkable.dernierlink.."@"..itemLink.."@";
						SendChatMessage(smessage,"WHISPER",self.language,DBOT_linkable_joueur);
						bstop = false;
						DBOT_linkable_mode = 12;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
					end
				end
			else
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode.." incorrecte.");
end
				--DBOT_linkable_time_ecart = 0.1;
				--DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart = DBOT_linkable_time_ecart;
				--DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
				--DBOT_linkable_nb = 0;
				--DBOT_linkable_nb_tout = 0;
				--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
				--DBOT_linkable_inumobjet = 0;
				--DBOT_linkable_inumobjet_config = 0;
				--DBOT_linkable.numobjet = 0;
				DBOT_linkable_time = GetTime();
				DBOT_linkable_mode = 14;
				--if ( DBCS_mobs_model_execute == nil ) then
				--else
				--	DBCS_mobs_model_execute_OFF();
				--end
				if ( DBOT_execute == nil ) then
				else
					--DBOT_modeoff();
				end
				bstop = false;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
			end
		end
		if ( bstop == true ) then
			--DBOT_linkable_time = GetTime();
			--DBOT_linkable_mode = 13;
			--DBOT_linkable_inumobjet = DBOT_linkable_inumobjet_config;
			DBOT_linkable_time = GetTime();
			DBOT_linkable_mode = 14;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
		end
	end

end

local Saved_DBOT_linkable_ChatFrame_OnEvent = ChatFrame_OnEvent;
function ChatFrame_OnEvent(self,event,...)

--if ( InCombatLockdown() ) then
--	Saved_DBOT_linkable_ChatFrame_OnEvent(self,event,...);
--	return nil;
--end

local saddon;
local ipos;
local ideb;
local scode;
local slink;
local ipos2;
local ideb2;
local inumobjet;
local x;
local y;
local sbinaire_deb;
local sbinaire_centre;
local sbinaire_fin;
local itime;

local smot;
local slienbon;
local inumquete;
local iniv;

local tobjet = nil;

local arg1 = ...;

	if ( strsub(event,1,16) == "CHAT_MSG_WHISPER" ) then
		ipos = 0;
		ideb = ipos + 1;
		ipos = strfind(arg1,"@",ideb);
		if ( ipos ) then
			ideb = ipos + 1;
			ipos = strfind(arg1,"@",ideb);
			if ( ipos ) then
				saddon = strsub(arg1,ideb,ipos-1);
--			smessage = "@DBQS2@QT01@"..inum..":"..i.."@|cffff2020|Hquest:"..inum..":"..i.."|h["..DBquetes2[inum][0].."]|h|r";
				if ( saddon == "DBOT_linkable" ) then
					if ( event == "CHAT_MSG_WHISPER" ) then
						ideb = ipos + 1;
						ipos = strfind(arg1,"@",ideb);
						if ( ipos ) then
							scode = strsub(arg1,ideb,ipos-1);
							if ( scode == "OT01" ) then
								DBOT_linkable_inumobjet14b = 1;
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
								if ( ipos ) then
									inumobjet = tonumber(strsub(arg1,ideb,ipos-1));
									ideb = ipos + 1;
									ipos = strfind(arg1,"@",ideb);
									if ( ipos ) then
										slink = strsub(arg1,ideb,ipos-1);
										if ( strsub(slink,1,1) == "|" ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("inumobjet1 "..inumobjet.." = "..slink);
end
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."1"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
											DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb + 1;
											--if ( DBOT_linkable_nb_tout ) then
											--	DBOT_linkable_nb_tout = DBOT_linkable_nb_tout + 1;
											--end
											--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
											tobjet = nil;
											if ( inumobjet > 100000 ) then
												if ( DBOS03 ) then
													tobjet = DBOS03[inumobjet];
												end
											elseif ( inumobjet > 50000 ) then
												if ( DBOS02 ) then
													tobjet = DBOS02[inumobjet];
												end
											else
												if ( DBOS01 ) then
													tobjet = DBOS01[inumobjet];
												end
											end
											if ( tobjet and tobjet[1] and tobjet[4] ) then
											else
												--DBOT_linkable_Tooltip1:SetOwner(WorldFrame,"ANCHOR_NONE");
												--DBOT_linkable_Tooltip1:SetHyperlink("item:"..inumobjet..":0:0:0:0:0:0:0:0:0");
												if ( DBOS01 and DBOS02 and DBOS03 ) then
													DBobjets_initobjet(inumobjet);
												end
											end
											if ( DBOT_linkable_mode_objetexistepas == true ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("je mets DBOT_linkable_mode_objetexistepas OFF.");
end
											end
											DBOT_linkable_mode_objetexistepas = false;
										else
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."0"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
										end
									else
									end
								end
							elseif ( scode == "OT02" ) then
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
								if ( ipos ) then
									inumobjet = tonumber(strsub(arg1,ideb,ipos-1));
									ideb = ipos + 1;
									ipos = strfind(arg1,"@",ideb);
									if ( ipos ) then
										slink = strsub(arg1,ideb,ipos-1);
--										if ( strsub(slink,1,1) == "|" ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("reception inumobjet "..inumobjet.." = "..slink);
end
											--DBOT_linkable_time = GetTime();
											--DBOT_linkable_mode = 13;
											--DBOT_linkable_inumobjet = DBOT_linkable_inumobjet_config;
											DBOT_linkable_time = GetTime();
											DBOT_linkable_mode = 14;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
end
											--DBOT_linkable_Tooltip1:SetOwner(WorldFrame,"ANCHOR_NONE");
											--DBOT_linkable_Tooltip1:SetHyperlink("item:"..DBOT_linkable_inumobjet..":0:0:0:0:0:0:0:0:0");
											--if ( DBOS ) then
											--	DBobjets_initobjet(DBOT_linkable_inumobjet);
											--end
--										else
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("phase : "..DBOT_linkable_mode.." incorrecte.");
--end
--											DBOT_linkable_time_ecart = 0.1;
--											DBOT_linkable = {};
--											DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
--											DBOT_linkable_t_serveur[DBOT_linkable_serveur].timeecart = DBOT_linkable_time_ecart;
--											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
--											DBOT_linkable_nb = 0;
--											DBOT_linkable_nb_tout = 0;
--											DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
--											--DBOT_linkable_inumobjet = 0;
--											--DBOT_linkable_inumobjet_config = 0;
--											--DBOT_linkable.numobjet = 0;
--											DBOT_linkable_time = GetTime();
--											DBOT_linkable_mode = 14;
--											if ( DBCS_mobs_model_execute == nil ) then
--											else
--												DBCS_mobs_model_execute_OFF();
--											end
--											if ( DBOT_execute == nil ) then
--											else
--												--DBOT_modeoff();
--											end
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("phase : "..DBOT_linkable_mode);
--end
--										end
									else
									end
								end
							elseif ( scode == "OT03" ) then
								DBOT_linkable_inumobjet14b = 1;
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
								if ( ipos ) then
									inumobjet = tonumber(strsub(arg1,ideb,ipos-1));
									ideb = ipos + 1;
									ipos = strfind(arg1,"@",ideb);
									if ( ipos ) then
										slink = strsub(arg1,ideb,ipos-1);
										if ( strsub(slink,1,1) == "|" ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("inumobjet3 "..inumobjet.." = "..slink);
end
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."1"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
											DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb + 1;
											--if ( DBOT_linkable_nb_tout ) then
											--	DBOT_linkable_nb_tout = DBOT_linkable_nb_tout + 1;
											--end
											--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
											--DBOT_linkable_Tooltip1:SetOwner(WorldFrame,"ANCHOR_NONE");
											--DBOT_linkable_Tooltip1:SetHyperlink("item:"..inumobjet..":0:0:0:0:0:0:0:0:0");
											--if ( DBOS ) then
											--	DBobjets_initobjet(inumobjet);
											--end
											if ( DBOT_linkable_mode_objetexistepas == true ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("je mets DBOT_linkable_mode_objetexistepas OFF.");
end
											end
											DBOT_linkable_mode_objetexistepas = false;
											if ( DBOT_linkable_nb_type3 == -1 ) then
											else
												DBOT_linkable_nb_type3 = DBOT_linkable_nb_type3 + 1;
											end
											--if ( DBOT_linkable_nb_type3 > 10 ) then
											--	DBOT_linkable_nb_type3 = -1;
											--	if ( DBCS_mobs_model_execute == nil ) then
											--	else
											--		DBCS_mobs_model_execute_OFF();
											--	end
											--	if ( DBOT_execute == nil ) then
											--	else
											--		--DBOT_modeoff();
											--	end
											--end
										else
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."0"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
										end
									else
									end
								end
							elseif ( scode == "OT04" ) then
								DBOT_linkable_inumobjet14b = 1;
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								DBOT_linkable_time_lag_duree = GetTime() - DBOT_linkable_time_lag_time;
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
								if ( ipos ) then
									inumobjet = tonumber(strsub(arg1,ideb,ipos-1));
									ideb = ipos + 1;
									ipos = strfind(arg1,"@",ideb);
									if ( ipos ) then
										slink = strsub(arg1,ideb,ipos-1);
										if ( strsub(slink,1,1) == "|" ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("inumobjet4 "..inumobjet.." = "..slink);
end
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."1"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
											DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb + 1;
											--if ( DBOT_linkable_nb_tout ) then
											--	DBOT_linkable_nb_tout = DBOT_linkable_nb_tout + 1;
											--end
											--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
											--DBOT_linkable_Tooltip1:SetOwner(WorldFrame,"ANCHOR_NONE");
											--DBOT_linkable_Tooltip1:SetHyperlink("item:"..inumobjet..":0:0:0:0:0:0:0:0:0");
											--if ( DBOS ) then
											--	DBobjets_initobjet(inumobjet);
											--end
											if ( DBOT_linkable_mode_objetexistepas == true ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("je mets DBOT_linkable_mode_objetexistepas OFF.");
end
											end
											DBOT_linkable_mode_objetexistepas = false;
											if ( DBOT_linkable_nb_type3 == -1 ) then
											else
												DBOT_linkable_nb_type3 = DBOT_linkable_nb_type3 + 1;
											end
											--if ( DBOT_linkable_nb_type3 > 10 ) then
											--	DBOT_linkable_nb_type3 = -1;
											--	if ( DBCS_mobs_model_execute == nil ) then
											--	else
											--		DBCS_mobs_model_execute_OFF();
											--	end
											--	if ( DBOT_execute == nil ) then
											--	else
											--		--DBOT_modeoff();
											--	end
											--end
										else
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x) == "1" ) then
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb - 1;
											end
											DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."0"..sbinaire_fin;
											--DBOT_linkable.dernierobjetlinkable = inumobjet;
										end
									else
									end
								end
							elseif ( scode == "OT05" ) then
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
								if ( ipos ) then
									inumobjet = tonumber(strsub(arg1,ideb,ipos-1));
									ideb = ipos + 1;
									ipos = strfind(arg1,"@",ideb);
									if ( ipos ) then
										slink = strsub(arg1,ideb,ipos-1);
										if ( strsub(slink,1,1) == "|" ) then
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("inumobjet5 "..inumobjet.." = "..slink);
end
											y = floor((inumobjet-1)/1000);
											x = inumobjet - ( y * 1000 );
											y = y + 1;
											if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] == nil ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = strrep("0",1000);
											else
												if ( strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]) < 1000 ) then
													DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]..strrep("0",1000-strlen(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y]));
												end
											end
											sbinaire_deb = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],1,x-1);
											if ( sbinaire_deb == nil ) then
												sbinaire_deb = "";
											end
											sbinaire_centre = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x);
											if ( sbinaire_centre == nil ) then
												sbinaire_centre = "0";
											end
											sbinaire_fin = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x+1);
											if ( sbinaire_fin == nil ) then
												sbinaire_fin = "";
											end
											if ( sbinaire_centre == "0" ) then
												DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire_deb.."1"..sbinaire_fin;
												--DBOT_linkable.dernierobjetlinkable = inumobjet;
												DBOT_linkable.DBOT_linkable_nb = DBOT_linkable.DBOT_linkable_nb + 1;
												--if ( DBOT_linkable_nb_tout ) then
												--	DBOT_linkable_nb_tout = DBOT_linkable_nb_tout + 1;
												--end
												--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;
												--DBOT_linkable_Tooltip1:SetOwner(WorldFrame,"ANCHOR_NONE");
												--DBOT_linkable_Tooltip1:SetHyperlink("item:"..inumobjet..":0:0:0:0:0:0:0:0:0");
											end
										end
									else
									end
								end
							elseif ( scode == "QT01" ) then
								DBOT_linkable_inumobjet14b = 1;
								if ( self:GetName() == "ChatFrame1" ) then
								else
									return nil;
								end
								ideb = ipos + 1;
								ipos = strfind(arg1,"@",ideb);
--smessage = "@DBOT_linkable@QT01@"..inum..":"..iniv.."@|cffff2020|Hquest:"..inum..":"..iniv.."|h["..DBquetes2[inum][0].."]|h|r";
								if ( ipos ) then
									smot = strsub(arg1,ideb,ipos-1);
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("smot = "..smot);
--end
									slienbon = strsub(arg1,ipos+1,ipos+1);
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("slienbon = "..slienbon);
--end
									if ( slienbon == "|" ) then
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("slienbon = "..slienbon);
--end
										ideb2 = 1;
										ipos2 = strfind(smot,":",ideb2);
										if ( ipos2 ) then
											DBOT_linkable_inumquete = tonumber(strsub(smot,ideb2,ipos2-1));
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("DBOT_linkable_inumquete = "..DBOT_linkable_inumquete);
--end
											DBOT_linkable_inivquete = tonumber(strsub(smot,ipos2+1,ipos-1));
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("DBOT_linkable_inivquete = "..DBOT_linkable_inivquete);
--end
											if ( DBquetes2 and DBquetes2[DBOT_linkable_inumquete] ) then
												DBquetes2[DBOT_linkable_inumquete][-2] = DBOT_linkable_inivquete;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("DBOT_linkable_OnUpdate, quete "..DBOT_linkable_inumquete..", "..DBOT_linkable_inivquete.." : |cffffff00|Hquest:"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."|h["..DBquetes2[DBOT_linkable_inumquete][0].."]|h|r");
end
											end
											DBOT_linkable_inumquete = DBOT_linkable_inumquete + 1;
											DBOT_linkable_inivquete = DBOT_linkable_inivquete_min;
										end
									else
										ideb2 = 1;
										ipos2 = strfind(smot,":",ideb2);
										if ( ipos2 ) then
											DBOT_linkable_inumquete = tonumber(strsub(smot,ideb2,ipos2-1));
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("DBOT_linkable_inumquete = "..DBOT_linkable_inumquete);
--end
											DBOT_linkable_inivquete = tonumber(strsub(smot,ipos2+1,ipos-1));
--if ( DBCS_debug and DBCS_debug > 1 ) then
--TraceFrame:AddMessage("DBOT_linkable_inivquete = "..DBOT_linkable_inivquete);
--end
											--DBOT_linkable_inivquete = DBOT_linkable_inivquete + 1;
										end
									end
								end
								DBOT_linkable_mode_quete_envoi_en_cours = false;
							end
						end
						return nil;
					else
						return nil;
					end
				end
			else
			end
		else
		end
	elseif ( strsub(event,1,15) == "CHAT_MSG_SYSTEM" ) then
		if ( strsub(arg1,1,25) == "Vous \195\170tes maintenant ABS" ) then
			itime = GetTime();
			if ( itime - DBOT_linkable_time_debabs > 30 ) then
				DBOT_linkable_time_debabs = itime;
			else
				return nil;
			end
		elseif ( strsub(arg1,1,28) == "Vous \195\170tes maintenant absent" ) then
			itime = GetTime();
			if ( itime - DBOT_linkable_time_debabs > 30 ) then
				DBOT_linkable_time_debabs = itime;
			else
				return nil;
			end
		elseif ( arg1 == "Vous n'\195\170tes plus ABS." ) then
			itime = GetTime();
			if ( itime - DBOT_linkable_time_finabs > 30 ) then
				DBOT_linkable_time_finabs = itime;
			else
				return nil;
			end
		elseif ( arg1 == "Vous n'\195\170tes plus absent." ) then
			itime = GetTime();
			if ( itime - DBOT_linkable_time_finabs > 30 ) then
				DBOT_linkable_time_finabs = itime;
			else
				return nil;
			end
		end
	end
	Saved_DBOT_linkable_ChatFrame_OnEvent(self,event,...);
end

--/script DBOT_linkable_creerchamptexte40000()
function DBOT_linkable_creerchamptexte40000()

--DBOT_linkable_inumobjet_max

local sbinaire;
local i;

	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
		DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
	end
	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"] == nil ) then
		DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"] = {};
	end
	--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire"] == nil ) then
	--end
	sbinaire = "";
	for i = 1 , DBOT_linkable_inumobjet_max do
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"][i] == nil ) then
			sbinaire = sbinaire.."0";
		else
			sbinaire = sbinaire.."1";
		end
	end
	DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire40000"] = sbinaire;

end

--/script DBOT_linkable_creerchamptexte1000()
function DBOT_linkable_creerchamptexte1000()

local i;
local x;
local y = -1;
local sbinaire;

	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] == nil ) then
		DBOT_linkable_t_serveur[DBOT_linkable_serveur] = {};
	end
	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"] == nil ) then
		DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"] = {};
	end
	--if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] == nil ) then
	DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
	--end
	for i = 1 , DBOT_linkable_inumobjet_max do
		y = floor((i-1)/1000);
		x = i - ( y * 1000 );
		--x = x + 1;
		if ( x == 1 ) then
			if ( y > 0 ) then
				DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire;
			end
			sbinaire = "";
		end
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objets"][i] == nil ) then
			sbinaire = sbinaire.."0";
		else
			sbinaire = sbinaire.."1";
		end
	end
	if ( y > -1 ) then
		DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] = sbinaire;
	end
	
end

function DBOT_linkable_objet_linkable(inumobjet)

local blinkable = false;
local x;
local y;
local scarac;

	if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur] ) then
		if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] ) then
			y = floor((inumobjet-1)/1000);
			x = inumobjet - ( y * 1000 );
			y = y + 1;
			if ( DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y] ) then
				scarac = strsub(DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"][y],x,x);
				if ( scarac == "1" ) then
					blinkable = true;
				end
			end
		end
	end
	return blinkable;

end

--/script DBOT_linkable_reinit();
function DBOT_linkable_reinit()

	DBOT_linkable_t_serveur[DBOT_linkable_serveur]["objetsbinaire1000"] = {};
	--DBOT_linkable.dernierlink = 0;
	DBOT_linkable.dernierlink = DBOT_linkable_inumobjet_max + 1;
	DBOT_linkable.numobjet_premiere_connect_date = 1;
	DBOT_linkable.toutfait = false;
	--DBOT_linkable_time_ecart = 0.1;
	DBOT_linkable.DBOT_linkable_nb = 0;
	--DBOT_linkable_nb = 0;
	--DBOT_linkable["DBOT_linkable_nb"] = DBOT_linkable_nb;

end

--/script DBOT_linkable_modeon();
function DBOT_linkable_modeon()

	DBOT_linkable_mode = 0;

end

--/script DBOT_linkable_modeoff();
function DBOT_linkable_modeoff()

	DBOT_linkable_mode = -1;

end

--/script DBOT_linkable_init_numobjet(39000);
--/script DBOT_linkable_init_numobjet(40600);
--/script DBOT_linkable_init_numobjet(46000);
--/script DBOT_linkable_init_numobjet(49000);
--/script DBOT_linkable_init_numobjet(70000);
function DBOT_linkable_init_numobjet(inumobjet)

	DBOT_linkable.dernierlink = inumobjet;

end

--/script DBOT_linkable_afficher_numobjet();
function DBOT_linkable_afficher_numobjet()

TraceFrame:AddMessage("DBOT_linkable.dernierlink = "..DBOT_linkable.dernierlink);

end

--/script DBOT_linkable_quete_modeon();
function DBOT_linkable_quete_modeon()

	DBOT_linkable_mode_quete_envoi_en_cours = false;
	DBOT_linkable_mode_quete = true;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("je lance DBOT_linkable_quete_modeon");
if ( DBquetes2[DBOT_linkable_inumquete] ) then
	TraceFrame:AddMessage("DBOT_linkable_quete_modeon, quete "..DBOT_linkable_inumquete..", "..DBOT_linkable_inivquete.." : |cffffff00|Hquest:"..DBOT_linkable_inumquete..":"..DBOT_linkable_inivquete.."|h["..DBquetes2[DBOT_linkable_inumquete][0].."]|h|r");
end
end

end

--/script DBOT_linkable_quete_modeoff();
function DBOT_linkable_quete_modeoff()

	DBOT_linkable_mode_quete = false;
if ( DBCS_debug and DBCS_debug > 1 ) then
TraceFrame:AddMessage("je lance DBOT_linkable_quete_modeoff");
end

end

--/script DBOT_linkable_quete_init_numquete(000);
--/script DBOT_linkable_quete_init_numquete(616);
--/script DBOT_linkable_quete_init_numquete(660);
--/script DBOT_linkable_quete_init_numquete(9446);
--/script DBOT_linkable_quete_init_numquete(14000);
--/script DBOT_linkable_quete_init_numquete(15000);
--/script DBOT_linkable_quete_init_numquete(20000);
--/script DBOT_linkable_quete_init_numquete(23000);
--/script DBOT_linkable_quete_init_numquete(24000);
--/script DBOT_linkable_quete_init_numquete(24900);
--/script DBOT_linkable_quete_init_numquete(25000);
--/script DBOT_linkable_quete_init_numquete(28000);
--/script DBOT_linkable_quete_init_numquete(29000);
--/script DBOT_linkable_quete_init_numquete(30000);
function DBOT_linkable_quete_init_numquete(inumquete)

	if ( inumquete ) then
		DBOT_linkable_inumquete = inumquete;
		DBOT_linkable_inivquete = DBOT_linkable_inivquete_min;
		DBOT_linkable["DBOT_linkable_inumquete"] = DBOT_linkable_inumquete;
		DBOT_linkable["DBOT_linkable_inivquete"] = DBOT_linkable_inivquete;
	end

end

function DBOT_linkable_time_lag()

	return DBOT_linkable_time_lag_duree,DBOT_linkable_time_lag_time;

end

function DBOT_getlinkitem(snom,snumlong,icoul,stype)

local shexcouleuritem;
local r,g,b,hex;

	shexcouleuritem = "|cffffffff";
	r, g, b, hex = GetItemQualityColor(icoul);
	if ( hex ) then
		shexcouleuritem = hex;
	end

	if ( stype == "i" ) then
		return shexcouleuritem.."|Hitem:"..snumlong.."|h["..snom.."]|h|r";
	else
		return "|cffffd000|Henchant:"..snumlong.."|h["..snom.."]|h|r";
	end

end
