//------------------------------------------------------------------------------------------------------------------------
//
// Б¦ёс : NoticeWnd  (Ж©Едё®ѕу, ДщЅєЖ®, ёЮАП, °жёЕѕЛёІ, ЗБё®№Мѕц ѕЖАМЕЫ, »эАП ѕЛёІ[ѕшАЅ] ) - SCALEFORM UI
//        »х·Оїо ГЯ°Ў --> ЅєЕі ЅАµж, Д·ЖРАО, БёДщЅєЖ®, 4Вч °ўјє
//        TutorialBtnWnd.uc + QuestBtnWnd.uc + MailBtnWnd.uc + AuctionBtnWnd.uc[ЕшЖБ №®Б¦·О ѕЖБч АЫѕчАь]
//   
//        2013(10їщ) GD3.5їЎј­ ЅєДЙАПЖы4·О єЇ°ж
//
//    ****  2015-11-26 , ЗШїЬ №цАь , їАґГАЗ ЗТАПАє єьБ® АЦАёґП ёУВЎ ЗТ¶§ БЦАЗ!!!!!!  *****
//------------------------------------------------------------------------------------------------------------------------
class NoticeWnd extends L2UIGFxScript;

const FLASH_XPOS = -7;
const FLASH_YPOS = -250;

// »иБ¦ 
const NOTICEBUTTON_DELETE = "900";
// »иБ¦ 
const NOTICEBUTTON_DELETEALL = "1000";
// А§·О ЅЧАМґВ ЅДАЗ ·№АМѕЖїф
const LAYOUT_MULTILINE = "10001";
// їЮВКАё·О ґГАМґВ ·№АМѕЖїф
const LAYOUT_ONELINE = "10002";

// јшј­ №ЩІЩёй ѕИµК, №ШАё·О ГЯ°Ў ЗПјјїд
enum ENoticeType
{
	TYPE_MAIL,
	TYPE_QUEST,
	TYPE_PREM,
	TYPE_TUTORIAL,
	TYPE_SKILL,
	TYPE_CAMPAIGN,
	TYPE_ZONE,
	TYPE_AWAKENED,
	TYPE_CURIOUSEHOUSE,
	TYPE_EVENTCAMPAIGN, // АМєҐЖ® Д·ЖдАО (ѕЖё¶µµ ЗШїЬ Б»єс АМєҐЖ®) 9
	TYPE_PLEDGEALARM, // ЗчёНѕЛ¶ч
	TYPE_WEBPETITIONALARM, // WebБшБ¤ ѕЛ¶ч  , є°µµ ѕЛёІ ѕЖАМДЬА» ЗПБц ѕК°н №Щ·О ГўА» ї­ѕо БШґЩ(їЦ АОБш ёрёЈ°Ъ°н ±Ч·ё°Ф АЫѕчЗЯґЩ)
	TYPE_SINGLEMESHZONE, // ГЦАыИ­ Б¦є№, 12
	TYPE_PVPBLOCKCHECKER, // єн·ПГјДї	
	TYPE_PVPCRATAECUBE, // ДЭ·Ојјїт »уИІЖЗ 
	TYPE_PVPMATCHRECORD, // PVP »уИІЖЗ 
	TYPE_PVPCLEFT, // Е©·№ЗБЖ® »уИІЖЗ 16 
	TYPE_PATHTOAWAKENINGALARM, // PathToAwakeningAlarm 17
	TYPE_TODOLIST, // їАґГАЗ ЗТАП 18
	TYPE_LINEAGE2HOME, // ё®ґПБц2ИЁ (АО°ФАУАҐ) 19
	TYPE_KILLER, // БЯ±№ їшјцѕЛёІ 20
	TYPE_PCROOM, // БЯ±№ pc№ж ѕЛёІ 21
	TYPE_ATTENDANCESTAMP, // Гвј®єО 22 (ЗцАзґВ БЯ±№ёё), Гвј®єОґВ БЯ±№°ъ ±№і» №цАьАМ ґЩё§(ѕЛёІАє °°АМЅбµµ №№..»у°ь ѕшАЅ)
	TYPE_CHINATUTORIAL, // БЯ±№ёё »зїлЗПґВ Ж©ЕНё®ѕу, 3№ш Ж©ЕНё®ѕуАє ґЩБЯЕёАФ, БЯ±№Ає ЗПіЄёё іЄїАґВ Ж©ЕНё®ѕу, 23
	TYPE_ABILITYPOINT, // ѕоєфё®Жј ЖчАОЖ®, 24
	TYPE_MONSTERBOOK, // ёуЅєЕН µµ°Ё, 25
	TYPE_FACTION, // јј·В(ЖејЗ) 26
	TYPE_AUCTION_FAIL, // °жёЕ АЇВы 27
	TYPE_EVENT_INFO, // АМєҐЖ® Б¤єё 28
	TYPE_NSHOPHOME, // NјҐ 29
	TYPE_OLYMPIAD_OPENSEASON, // їГёІЗЗѕЖµе ЅГБр їАЗВ 30
	TYPE_ADVENTURE_GUIDE, // БЯ±№ Аьїл, ёрЗиАЗ ЅГАЫ, 31
	TYPE_CHANGE_CLASS, // АьБч, 32
	TYPE_TELEPORTMAP, // ЕЪ·№ЖчЖ® ёК, 33
	TYPE_VITAMINMANAGER, // єсЕё№О ёЕґПАъ, 34
	TYPE_TIME_HUNTINGZONE, // 35
	TYPE_RANKING, // 36
	TYPE_YETIMODE, // 37
	TYPE_REVENGEHELP, // 38
	TYPE_LOSTPROPERTY, // 39
	TYPE_COLLECTION, // 40
	TYPE_DETHRONE, // 41
	TYPE_WORLDEXCHANGE_BUY, // 42
	TYPE_GIFT, // 43
	TYPE_ATTENDCHECK, // 44
	TYPE_HOLY_FIRE // 45
};

var int RecentlyAddedQuestID;
var int HtmlString;
var int zonetype;

var array<GFxValue> args;
var GFxValue invokeResult;

var WindowHandle Me;

var WindowHandle AlarmWnd;

var MagicSkillWnd MagicSkillWndScript;
var QuestTreeWnd QuestTreeWndScript;
var YetiPCModeChangeWnd YetiPCModeChangeWndScript;

var UserInfo currentUserInfo;

var TabHandle m_TabCtrl;

var bool bCam;
var bool bZone;
var bool bEvent;

var bool bUseSingleMesh;  // ГЦАыИ­ Б¦є№ »уЕВ АъАе
// °ўјє Е¬·ЎЅє id АъАе
var int awakeClassID;
var int awakeImmediate;

//ЗШ»уµµїл
var int currentScreenWidth;
var int currentScreenHeight;

//branch121212
var int PathToAwakeningAlarmType;
var int PathToAwakeningAlarmValue;

var int nUsePledgeV2Live;

// ·ѕѕч ЅГ ѕоєфё®Жј ЖчАОЖ® ГјЕ©ё¦ ЗП¶уґВ bool °Є
var bool bChkAbilityPoint;

// ЗБ·С·О±Ч »уЕВ ГјЕ© 
var bool isPrologueGrowTypeState;
var bool isGetPremium;
var bool isEnchantBlindState;
var ItemID collectionToFindiID;

function OnRegisterEvent()
{
	RegisterEvent(EV_ResolutionChanged);
	RegisterEvent(EV_Restart);

	//--------------------------------------------------------- 
	// АЇµїЗь ѕЛёІ ѕЖАМДЬ АМєҐЖ®
	//--------------------------------------------------------- 
	//ёЮАП ѕЛёІ АМєҐЖ®
	RegisterEvent(EV_ArriveNewMail);
	RegisterEvent(EV_Notice_Post_Arrived);
	RegisterEvent(EV_SetRadarZoneCode);

	//ДщЅєЖ® °ь·Г ѕЛёІ АМєҐЖ® 1520
	RegisterEvent(EV_ArriveShowQuest);

	//ЗБё®№Мѕц ѕЖАМЕЫ 3460
	RegisterEvent(EV_PremiumItemAlarm);

	//ЗС±№ »уЗ°АОєҐЕдё®.
	RegisterEvent(EV_GoodsInventoryNoti);

	//Ж©Едё®ѕу 1510, QuestionID=1, »иБ¦ µК.
	//RegisterEvent(EV_ArriveNewTutorialQuestion);

	// 2015°іј±, Ж©Едё®ѕу 1511 ID=1 Type=0 Name="ѕоВј±ёґЩ"
	RegisterEvent(EV_ArriveTutorial);

	//ЅєЕі ЅАµж 2059
	RegisterEvent(EV_SkillLearningNewArrival);

	// 4Вч АьБч (°ўјє) ѕЛ¶ч  
	RegisterEvent(EV_CallToChangeClass);

	//ЗчёН °ЎАФ ѕЛ¶ч  9630
	RegisterEvent(EV_PledgeWaitingListAlarm);

	//--------------------------------------------------------- 
	// °нБ¤ ѕЛёІ ѕЖАМДЬ АМєҐЖ®
	//--------------------------------------------------------- 
	//Д·ЖРАО 5210
	RegisterEvent(EV_CampaignArrived);

	//Д·ЖРАО їП·б 5220
	RegisterEvent(EV_CampaignFinish);

	//Бё ДщЅєЖ®
	RegisterEvent(EV_ZoneQuestArrived);

	// ИҐµ·АЗ Б¦Аь
	// АЗ№®АЗ АъЕГ state 0:±в°Ј ѕЖґФ, 1:АФАеЅЕГ», 2:АУАеґл±в
	RegisterEvent(EV_CuriousHouseWaitState);

	//АМєҐЖ® Д·ЖРАО(ЗШїЬ) Б»єс АМєҐЖ® °°Ає..
	RegisterEvent(EV_BR_Event_CampaignArrived); //branch120516

	//АЇАъ°Ў ґЬАП ёЮЅГ єј·эїЎ µйѕо°Ґ ¶§ №Я»э
	RegisterEvent(EV_EnterSingleMeshZone); //9540

	//АЇАъ°Ў ґЬАП ёЮЅГ єј·эїЎј­ іЄїГ ¶§ №Я»э
	RegisterEvent(EV_ExitSingleMeshZone); //9541

	//--------------------------------------------------------- 
	// №Щ·О UI ГўА» ї­ѕо БЦґВ АМєҐЖ®
	//--------------------------------------------------------- 
	//БшБ¤ ѕЛ¶ч 9452
	RegisterEvent(EV_WebPetitionReplyAlarm);

	//branch121212 PathToAwakening 10100
	RegisterEvent(EV_PathToAwakeningAlarm);

	// ЗЪµрАЗ єн·ПГјДї, toolTip : 2445
	RegisterEvent(EV_BlockStateTeam);
	RegisterEvent(EV_BlockStatePlayer);

	// Е¬·№ЗБЖ® »уИІЖЗ, toolTip : 2443
	RegisterEvent(EV_CleftStateTeam);
	RegisterEvent(EV_CleftStatePlayer);

	// БцЗП ДЭ·Ојјїт »уИІЖЗtoolTip : 2444
	RegisterEvent(EV_CrataeCubeRecordMyItem);
	RegisterEvent(EV_CrataeCubeRecordBegin);
	RegisterEvent(EV_CrataeCubeRecordRetire);

	//PVP »уИІЖЗ toolTip : 2442
	RegisterEvent(EV_PVPMatchRecord);

	// ДщЅєЖ® 
	RegisterEvent(EV_QuestListEnd);

	// ЅєЕЧАМЖ® 
	RegisterEvent(EV_StateChanged);

	// їАґГАЗ ЗТАП,  АПАПєё»у 160831 ЗШїЬїЎј­ Е¬·ЎЅД ГЯ°Ў
	RegisterEvent(EV_OneDayRewardCount);

	// Е¬·Ј °ЎАФ ЅГЅєЕЫ №цЖ° »иБ¦ё¦ А§ЗШј­
	RegisterEvent(EV_ClanInfo);

	// ё®ґєѕу µИ Е¬·Ј Б¤єё, ЅєДЙАП Жы АМєҐЖ®
	RegisterGFxEvent(EV_GFX_ClanInfo); //                 = 10450;

	// ѕоєфё®Жј ЖчАОЖ® ѕЛ¶чА» єёї©БЬ.
	RegisterEvent(EV_UpdateUserInfo);

	// °жёЕ АЇВы(ЅЗЖР) ѕЛёІ 
	RegisterEvent(EV_ITEM_AUCTION_UPDATED_BIDDING_INFO);

	// јј·В 
	RegisterEvent(EV_FactionLevelUpNotify);
	
	// ёуЅєЕН µµ°Ё
//	RegisterEvent(EV_MonsterBookRewardIcon);

	// Вчїш ј­№ц·О АМµї ЗТ¶§
	RegisterEvent(EV_GotoWorldRaidServer);

	// їАґГАЗ ЗТАП,  АПАПєё»у 10127
	RegisterEvent(EV_OneDayRewardCount);

	// ДЙёЇЕН Бчѕч Б¤єё°Ў №ЩІр ¶§
	RegisterEvent(EV_ChangedSubjob);

	// їГёІЗЗѕЖµе ЅГБр »уЕВ 
	RegisterEvent(EV_OlympiadInfo); // 11020

	RegisterEvent(EV_ClassChangeAlarm);
	RegisterEvent(EV_SetRadarZoneCode);
	//RegisterEvent(EV_MinimapChangeZone);
	RegisterEvent(EV_PvpbookNewPk);
	RegisterEvent(EV_ProtocolBegin + class'UIPacket'.const.S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO);
	RegisterEvent(EV_PvpbookNewPk);
	RegisterEvent(EV_CollectionRegistEnableItem);
	RegisterEvent(EV_ProtocolBegin + class'UIPacket'.const.S_EX_PENALTY_ITEM_INFO);
	RegisterEvent(EV_ProtocolBegin + class'UIPacket'.const.S_EX_DETHRONE_DAILY_MISSION_COMPLETE);
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_WORLD_EXCHANGE_SETTLE_ALARM));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_GOODS_GIFT_CHANGED_NOTI));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_NOTIFY_ATTENDANCE));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_HOLY_FIRE_NOTIFY));
	RegisterEvent(EV_Test_5);	
}

function OnLoad()
{
	RegisterState("NoticeWnd", "GamingState");
	SetContainerHUD(WINDOWTYPE_NONE, 0);
	AddState("GAMINGSTATE");
	AddState("ARENAGAMINGSTATE");
	// SetAlwaysFullAlpha(true);
	SetHavingFocus(false);
	SetDefaultShow(true);
	SetHUD();
	Me = GetWindowHandle("NoticeWnd");
	AlarmWnd = GetWindowHandle("PremiumItemAlarmWnd");
	MagicSkillWndScript = MagicSkillWnd(GetScript("MagicSkillWnd"));
	QuestTreeWndScript = QuestTreeWnd(GetScript("QuestTreeWnd"));
	YetiPCModeChangeWndScript = YetiPCModeChangeWnd(GetScript("YetiPCModeChangeWnd"));
	PathToAwakeningAlarmType = 0; //branch121212
	PathToAwakeningAlarmValue = 0; //branch121212
}

function OnShow()
{
	checkMultiLayOut();
}

function OnFlashLoaded()
{
	checkMultiLayOut();
}

function OnCallUCFunction(string functionName, string param)
{
	if(functionName == "updateButtonStateByCallUCFunction")
	{
		updateButtonStateByCallUCFunction(param);
	}
	else
	{
		clickNoticeButton(functionName, param);
	}
}

function updateButtonStateByCallUCFunction(string param)
{
	local int layerMode, Count, h, V, hGap, vGap,
		X, Y, posX, posY;

	ParseInt(param, "layerMode", layerMode);
	ParseInt(param, "count", Count);
	ParseInt(param, "h", h);
	ParseInt(param, "v", V);
	ParseInt(param, "x", X);
	ParseInt(param, "y", Y);
	ParseInt(param, "hGap", hGap);
	ParseInt(param, "vGap", vGap);
	ParseInt(param, "posX", posX);
	ParseInt(param, "posY", posY);
}

// onCallUCLogic ±вБё ґлГј 
function clickNoticeButton(string logicIDStr, string param)
{
	local string strParam;
	local int logicID;

	//Д·ЖдАО №цЖ° ґ­·ИА» °жїм ЅєЕ©ёіЖ® ИЈГв А§ЗС °Н.
	local CampaignAlarmWnd campaign;
	//Бё ДщЅєЖ® №цЖ° ґ­·ИА» °жїм ЅєЕ©ёіЖ® ИЈГв А§ЗС °Н.
	local ZoneQuestAlarmWnd Zone;
	// °ўјєГўА» ї­±в А§ЗШ (µїїµ»у Аз»э №Ч °ўјєЗШБЦґВ А©µµїм)
	local GfxDialog GfxDialogScript;
	local BR_CampaignAlarmWnd br_eventcampaign; //branch120516
	local int tutorialID, tutorialType;

	//local String tutorialName;

	logicID = int(logicIDStr);
	campaign = CampaignAlarmWnd(GetScript("CampaignAlarmWnd"));
	Zone = ZoneQuestAlarmWnd(GetScript("ZoneQuestAlarmWnd"));

	br_eventcampaign = BR_CampaignAlarmWnd(GetScript("BR_CampaignAlarmWnd"));//branch120516

	// Debug("logicID" @ logicID);
	// Debug("zonetype" @ zonetype);
	if(logicID == ENoticeType.TYPE_MAIL)
	{
		PlayConsoleSound(IFST_WINDOW_OPEN);
		RequestRequestReceivedPostList();
	}
	else if(logicID == ENoticeType.TYPE_QUEST)
	{
		if(getInstanceUIData().IsAdenServer())
		{
			if(! GetWindowHandle("QuestAcceptableListWnd").IsShowWindow())
			{
				getInstanceL2Util().syncWindowLoc("QuestWnd", "QuestAcceptableListWnd");
				GetWindowHandle("QuestAcceptableListWnd").ShowWindow();					
			}
			else
			{
				GetWindowHandle("QuestAcceptableListWnd").HideWindow();
			}
			return;
		}
		ParamAdd(strParam, "QuestID", String(RecentlyAddedQuestID));
		ExecuteEvent(EV_QuestSetCurrentID, strParam);
	}
	else if(logicID == ENoticeType.TYPE_PREM)
	{
		if(IsUseGoodsInvnentory() == false)
		{
			if(!AlarmWnd.isShowWindow()) AlarmWnd.showWindow();
		}
		else
		{
			HandleShowProductInventory();
		}
	}
	else if(logicID == ENoticeType.TYPE_TUTORIAL)
	{			
		//RequestTutorialQuestionMarkPressed(HtmlString);	

		ParseInt(param, "ID", tutorialID);
		ParseInt(param, "Type", tutorialType);

		//Debug("param: " @ param);
		//Debug("--> Call API : RequestTutorialMarkPressed");
		//Debug("tutorialID: " @ tutorialID);
		//Debug("tutorialType: " @ tutorialType);

		// 2015.05.13 »х·О ГЯ°ЎµИ Ж©ЕНё®ѕу їАЗВ ЗФјц
		if(class'UIDATA_PLAYER'.static.IsInPrison())
		{
			getInstanceL2Util().showGfxScreenMessage(GetSystemMessage(13773));						
		}
		else
		{
			RequestTutorialMarkPressed(tutorialType, tutorialID);
		}	
	}
	else if(logicID == ENoticeType.TYPE_SKILL)
	{
		// MagicSkillWnd.ShowWindow();
		// m_TabCtrl.SetTopOrder(2, false);
		MagicSkillWndScript.externalCallLearnSkill();

		//MagicSkillWnd.onClickButton("TabCtrl2");
		
	}
	else if(logicID == ENoticeType.TYPE_CAMPAIGN)
	{
		bCam = false;
		campaign.RaderButtonClick();
	}
	else if(logicID == ENoticeType.TYPE_ZONE)
	{	
		bZone = false;
		zone.RaderButtonClick();
	}
	else if(logicID == ENoticeType.TYPE_AWAKENED)
	{	
		//Debug("°ўјє ѕЛёІ!");
		// °ўјє ѕЛ¶ч ґЩАМѕу·О±Ч ї­±в
		ParamAdd(strParam, "Class", String(awakeClassID));

		gfxDialogScript = GfxDialog(GetScript("GfxDialog"));
		gfxDialogScript.showGfxDialog("dialogLinkageName", "AwakeNoticeDialog", strParam);
	}
	else if(logicID == ENoticeType.TYPE_CURIOUSEHOUSE)
	{
		RequestCuriousHouseHtml();
		///parseInt(param , "state",  HouseState)
		//ГўА» ї°
	}
	//branch120516
	else if(logicID == ENoticeType.TYPE_EVENTCAMPAIGN)
	{
		bEvent = false;
		br_eventcampaign.RaderButtonClick();
	}

	else if(logicID == ENoticeType.TYPE_PLEDGEALARM)
	{
		if(!class'UIAPI_WINDOW'.static.IsShowWindow("ClanSearch")) //gfx Зь А©µµїм ¶§№®їЎ АМїН °°Ає ЗьЕВ·О јцБ¤
			class'UIAPI_WINDOW'.static.ShowWindow("ClanSearch");
	}

	//end of branch
	else if(logicID == ENoticeType.TYPE_WEBPETITIONALARM)
	{
		ExecuteEvent(EV_ShowWebPetitionListPage);
		ResponsePetitionAlarm();
	}

	else if(logicID == ENoticeType.TYPE_SINGLEMESHZONE)
	{
		// АЫѕч µЗёй on, off ЗПµµ·П
		// SwitchSingleMeshMode
		bUseSingleMesh = !bUseSingleMesh;
		
		SwitchSingleMeshMode(bUseSingleMesh);
		if(bUseSingleMesh)
		{
			createNoticeButton(	ENoticeType.TYPE_SINGLEMESHZONE, 3031); // ГЦАыИ­ Б¦є№ Іф±в
		}
		else 
		{
			createNoticeButton(	ENoticeType.TYPE_SINGLEMESHZONE, 3030); // ГЦАыИ­ Б¦є№ ДС±в
		}
	}
	// єн·ПГјДї	
	else if(logicID == ENoticeType.TYPE_PVPBLOCKCHECKER)
	{
		pvpButton(ENoticeType.TYPE_PVPBLOCKCHECKER);
	}
	// ДЭ·Ојјїт »уИІЖЗ 
	else if(logicID == ENoticeType.TYPE_PVPCRATAECUBE)
	{
		pvpButton(ENoticeType.TYPE_PVPCRATAECUBE);
	}
	// PVP »уИІЖЗ 
	else if(logicID == ENoticeType.TYPE_PVPMATCHRECORD)
	{
		pvpButton(ENoticeType.TYPE_PVPMATCHRECORD);
	}
	//branch121212
	else if(logicID == ENoticeType.TYPE_PATHTOAWAKENINGALARM)
	{
		ParamAdd(strParam, "Type", String(PathToAwakeningAlarmType));
		ParamAdd(strParam, "Value", String(PathToAwakeningAlarmValue));
		ExecuteEvent(EV_ShowWebPathMainPage, strParam);
	}
	//end of branch	
	// ё®ґПБц2ИЁ (АО °ФАУ АҐ) ї­±в
	else if(logicID == ENoticeType.TYPE_LINEAGE2HOME)
	{
		// 3471
		//showHideLineage2Home();
		showHideL2InGameWeb("main", "");
		//Debug("TYPE_LINEAGE2HOME ѕЛёІ №цЖ° Е¬ёЇ!!!");
	}
	else if(logicID == ENoticeType.TYPE_ABILITYPOINT) 
	{
		showHideAbilityWnd () ;
	}
	else if(logicID == ENoticeType.TYPE_MONSTERBOOK) 
	{
		//Debug("ёуЅєЕН µµ°Ё ѕЛёІ Е¬ёЇ!");
		showhideMonsterBookWnd();
	}
	else if(logicID == ENoticeType.TYPE_FACTION) 
	{
		//Debug("ЖСјЗ ѕЛёІ Е¬ёЇ!!");
		showHideWindow("FactionWnd") ;
	}
	else if(logicID == ENoticeType.TYPE_AUCTION_FAIL) 
	{
		//Debug("°жёЕ ѕЛёІ Е¬ёЇ!!!");	
		handleAuctionFail();
	}
	// їАґГАЗ ЗТАП
	else if(logicID == ENoticeType.TYPE_TODOLIST)
	{
		if(getInstanceUIData().getIsLiveServer ()) 
		{
			if(class'UIAPI_WINDOW'.static.isShowWindow ("ToDoListClanWnd") ) 				
				class'UIAPI_WINDOW'.static.HideWindow("ToDoListClanWnd");	
			else 
				class'UIAPI_WINDOW'.static.ShowWindow("ToDoListClanWnd");	
		}
		else if(getInstanceUIData().getIsClassicServer() || getInstanceUIData().getIsArenaServer())
		{
			ExecuteEvent(EV_TodoListShow, "forceOpen=1");
		}		
	}

	// АМєҐЖ® Б¤єё UI
	else if(logicID == ENoticeType.TYPE_EVENT_INFO)
	{
		showHideWindow("EventInfoWnd");
	}

	// nјҐ
	else if(logicID == ENoticeType.TYPE_NSHOPHOME)
	{
		showHideL2InGameWeb("nshop", "");
		// 3471
		//showHideHomePage("https://mink.ncsoft.com/");
		//Debug("TYPE_LINEAGE2HOME ѕЛёІ №цЖ° Е¬ёЇ!!!");
	}

	// nјҐ
	else if(logicID == ENoticeType.TYPE_OLYMPIAD_OPENSEASON)
	{
		//Debug("їГёІЗЗѕЖµе №цЖ° Е¬ёЇ");

		if(class'UIAPI_WINDOW'.static.isShowWindow ("OlympiadWnd") )
		{
			class'UIAPI_WINDOW'.static.HideWindow("OlympiadWnd");
		}
		else
		{
			//Debug("---> Call API : RequestOlympiadRecord()");
			RequestOlympiadRecord();
		}
	}
	else if(logicID == ENoticeType.TYPE_CHANGE_CLASS)
	{
		showHideWindow("JobChangeWnd");
		Debug("전직 버튼 클릭!!");
	}
	else if(logicID == ENoticeType.TYPE_TELEPORTMAP)
	{
		if(class'UIConstants'.const.USE_XML_TELEPORT_UI)
		{
			showHideWindow("TeleportWnd");
		}
		else if(class'UIAPI_WINDOW'.static.IsShowWindow("TeleportMapWnd"))
		{
			class'UIAPI_WINDOW'.static.HideWindow("TeleportMapWnd");
		}
		else
		{
			TeleportMapWnd(GetScript("TeleportMapWnd")).RQ_C_EX_Teleport_UI();
		}
		Debug ("TYPE_TELEPORTMAP №цЖ° Е¬ёЇ!!");
	}	

	else if(logicID == ENoticeType.TYPE_VITAMINMANAGER)
	{
		Debug ("TYPE_VITAMINMANAGER№цЖ° Е¬ёЇ!!");
		RequestOpenWndWithoutNPC(OPEN_PREMIUM_MANAGER);
	}
	else if(logicID == ENoticeType.TYPE_TIME_HUNTINGZONE)
	{
		Debug("TYPE_TIME_HUNTINGZONE ©цoЁЎЎЖ AЎюў¬?!!");
		if(Class'UIAPI_WINDOW'.static.IsShowWindow("TimeZoneWnd"))
		{
			Class'UIAPI_WINDOW'.static.HideWindow("TimeZoneWnd");
		}
		else
		{
			Class'UIAPI_WINDOW'.static.ShowWindow("TimeZoneWnd");
		}
	}
	else if(logicID == ENoticeType.TYPE_RANKING)
	{
		if(Class'UIAPI_WINDOW'.static.IsShowWindow("RankingWnd"))
		{
			Class'UIAPI_WINDOW'.static.HideWindow("RankingWnd");
		}
		else
		{
			Class'UIAPI_WINDOW'.static.ShowWindow("RankingWnd");
			Class'UIAPI_WINDOW'.static.SetFocus("RankingWnd");
		}
	}
	else if(logicID == ENoticeType.TYPE_YETIMODE)
	{
		YetiPCModeChangeWndScript.setYetiMode(true);
	}
	else if(logicID == ENoticeType.TYPE_KILLER)
	{
		if(GetLanguage() != 4)
		{
			class'UIAPI_WINDOW'.static.ShowWindow("RevengeWnd");
		}
	}
	else if(logicID == ENoticeType.TYPE_REVENGEHELP)
	{
		class'UIAPI_WINDOW'.static.ShowWindow("RevengeWnd");
		GetTabHandle("RevengeWnd.RevengeTab").SetTopOrder(1, false);																																			
	}
	else if(logicID == ENoticeType.TYPE_LOSTPROPERTY)
	{
		Debug("잃어 버린 아이템 복원! 창");
		toggleWindow("RestoreLostPropertyWnd");																																				
	}
	else if(logicID == ENoticeType.TYPE_COLLECTION)
	{
		collectionFindItem();
	}
	else if(logicID == ENoticeType.TYPE_DETHRONE)
	{
		Debug("Click TYPE_DETHRONE");
		DethroneWnd(GetScript("DethroneWnd")).gotoTabMission();
		class'UIAPI_WINDOW'.static.ShowWindow("DethroneWnd");
		class'UIAPI_WINDOW'.static.SetFocus("DethroneWnd");
	}
	else if(logicID == ENoticeType.TYPE_WORLDEXCHANGE_BUY)
	{
		ToggleWorldExchangeRegiWnd();
	}
	else if(logicID == ENoticeType.TYPE_GIFT)
	{
		if(class'UIAPI_WINDOW'.static.IsShowWindow("GiftInventoryWnd"))
		{
			GiftInventoryWnd(GetScript("GiftInventoryWnd")).refresh();
			Debug("선물 갱신");																																									
		}
		else
		{
			class'UIAPI_WINDOW'.static.ShowWindow("GiftInventoryWnd");
			class'UIAPI_WINDOW'.static.SetFocus("GiftInventoryWnd");
			Debug("선물 창 열기");
		}
	}
	else if(logicID == ENoticeType.TYPE_ATTENDCHECK)
	{
		if(class'UIAPI_WINDOW'.static.IsShowWindow("AttendCheckWnd"))
		{
			class'UIAPI_WINDOW'.static.HideWindow("AttendCheckWnd");																																										
		}
		else
		{
			AttendCheckWnd(GetScript("AttendCheckWnd"))._Rq_C_EX_VIP_ATTENDANCE_LIST();
		}
		Debug("출석부 클릭!!!!!");
	}
	else if(logicID == ENoticeType.TYPE_HOLY_FIRE)
	{
		DethroneFireEnchantWnd(GetScript("DethroneFireEnchantWnd")).API_C_EX_HOLY_FIRE_OPEN_UI();
	}
}

function ToggleWorldExchangeRegiWnd()
{
	class'WorldExchangeRegiWnd'.static.Inst()._CheckOnClickNoticeBtn();
}

function collectionFindItem()
{
	local ItemInfo iInfo;
	local CollectionSystem collectionSystemScript;

	if(! class'UIDATA_INVENTORY'.static.FindItem(collectionToFindiID.ServerID, iInfo))
	{
		return;
	}
	collectionSystemScript = CollectionSystem(GetScript("CollectionSystem"));
	collectionSystemScript.SetToFindItemInfo(iInfo);
	collectionSystemScript.API_C_EX_COLLECTION_OPEN_UI();
	collectionToFindiID.ServerID = -1;
	collectionToFindiID.ClassID = -1;
}

function ChkCreateCollectionButton()
{
	local ItemEnchantWnd itemEnchantWndscr;
	local ItemMultiEnchantWnd itemMultiEnchantWndscr;

	if(CollectionSystem(GetScript("CollectionSystem"))._GetAlarmCheck())
	{
		return;
	}
	itemMultiEnchantWndscr = ItemMultiEnchantWnd(GetScript("ItemMultiEnchantwnd"));
	if(itemMultiEnchantWndscr.m_hOwnerWnd.IsShowWindow() && itemMultiEnchantWndscr.bUseLateAnnounce)
	{
		isEnchantBlindState = true;
		return;
	}
	itemEnchantWndscr = ItemEnchantWnd(GetScript("ItemEnchantWnd"));
	if(itemEnchantWndscr.m_hOwnerWnd.IsShowWindow() && itemEnchantWndscr.GetStateName() == itemEnchantWndscr.const.STATE_COMPLETE_BLIND)
	{
		isEnchantBlindState = true;
		return;
	}
	createNoticeButton(ENoticeType.TYPE_COLLECTION, 13490);
}

function _CreateCollectionButtonBlind()
{
	if(isEnchantBlindState)
	{
		isEnchantBlindState = false;
		createNoticeButton(ENoticeType.TYPE_COLLECTION, 13490);
	}
}

function handleAuctionFail()
{
	local string strParam;
	local HelpHtmlWnd script;

	script = HelpHtmlWnd(GetScript("HelpHtmlWnd"));
	ParamAdd(strParam, "FilePath", GetLocalizedL2TextPathNameUC() $ "item_auction_rule_info002.htm");
	script.HandleShowHelp(strParam);
}

function showhideMonsterBookWnd()
{
	if(class'UIAPI_WINDOW'.static.IsShowWindow("MonsterBookWnd"))
	{
		class'UIAPI_WINDOW'.static.HideWindow("MonsterBookWnd");		
	}
	else
	{
		CallGFxFunction("MonsterBookWnd", "clearSearchCondition", "");
		CallGFxFunction("MonsterBookWnd", "ChangefactionCategroy", "0");
	}
}

function showHideWindow(string WindowName)
{
	if(class'UIAPI_WINDOW'.static.IsShowWindow(WindowName))
	{
		class'UIAPI_WINDOW'.static.HideWindow(WindowName);	
	}
	else
	{
		class'UIAPI_WINDOW'.static.ShowWindow(WindowName);
		class'UIAPI_WINDOW'.static.SetFocus(WindowName);
	}
}

function showHideAbilityWnd()
{
	showHideWindow("AbilityUIWnd");
}

//showHideLineage2Home


// АО °ФАУ АҐЖдАМБц UI ИЈГв 

// category , "main", "nshop" µО°і ЗцАз »зїл БЯ..
function showHideL2InGameWeb(string Category, string Message)
{
	local string strParam;

	ParamAdd(strParam, "Category", Category);
	ParamAdd(strParam, "Message", "");
	ExecuteEvent(EV_InGameWebWnd_Info, strParam);
}

function OnEvent(int Event_ID, string param)
{
	local int iEffectNumber, level, statusInt;
	local string strParam;

	local string strTargetName;
	local Vector vTargetPos;
	local bool bOnlyMinimap;
	//local int nUsePledgeV2Live;//, nUsePledgeV2Classic;

	local GfxDialog GfxDialogScript;

	// 0||1 №«·б||АЇ·б
	local int UserType;

	local int clanID;
	local int nRewardCount, isNewMissionLevelReward;

	//	if(class'UIAPI_WINDOW'.static.IsShowWindow("NoticeWnd") == false) return;
	
	//ѕрБ¦ їАґВ АМєҐЖ®АОБц ѕЛ јц ѕшАЅ.
	if(Event_ID == EV_ArriveNewMail)
	{
//		Debug("EV_ArriveNewMail?? ѕрБ¦їАґВ°Ь??");
	}
	//»х·Оїо ёЮАПАМ їФА» ¶§.
	else if(Event_ID == EV_Notice_Post_Arrived) //4700
	{			
		//АМЖСЖ® іС№ц
		ParseInt(param, "IdxMail", iEffectNumber);
		createNoticeButton(ENoticeType.TYPE_MAIL, 2074);
	}
	//ЗчёН ѕЖАМДЬ
	else if(Event_ID == EV_PledgeWaitingListAlarm)
	{
		createNoticeButton(ENoticeType.TYPE_PLEDGEALARM, 3068);
	}

	//»х·Оїо ДщЅєЖ®°Ў їФА» °жїм.
	else if(Event_ID == EV_ArriveShowQuest) //1520
	{
		// SetShowWindow();
		ParseInt(param, "QuestID", RecentlyAddedQuestID);
		ParseInt(param, "QuestLevel", level);

		//Debug("EV_ArriveShowQuest : " @ param);
		//Debug("RecentlyAddedQuestID" @ RecentlyAddedQuestID);
		//Debug("level" @ level);
		
		// µф·№АМ·О Б¤єё їдГ»
		QuestAlarmWnd(GetScript("QuestAlarmWnd")).externalDelayTimerRequestAddExpandQuest(RecentlyAddedQuestID);

		///RequestAddExpandQuestAlarm(RecentlyAddedQuestID); //ё®ДщЅєЖ® ЗПї©¶у 

		ArriveShowQuest();

		GetPlayerInfo(currentUserInfo);

		// debug("RecentlyAddedQuestID" @ RecentlyAddedQuestID);
		// °ўјє °ь·Г ДщЅєЖ® ID , 10338 ґгґзАЪ : ·№є§ЖА АМєёАє їдГ»
		// °Ў БёАз ЗСґЩёй.. ѕЖ№«°Нµµ ѕИЗСґЩ.
		// Class=139 єОЕН..8°і.4Вч АьБч , °ўјє »уЕВ¶уёй..
		//if(QuestTreeWndScript.isQuestIDSearch(10338) || (currentUserInfo.nClassID <= 147 && currentUserInfo.nClassID >= 139))

		// GD3.5 -> °ўјє јјєРИ­ АМИД №жДЎµЗѕъґш°Е °°ѕЖј­ °ўјє јјєРИ­їЎ µы¶у јцБ¤
		if(RecentlyAddedQuestID == 10338 || (currentUserInfo.nClassID <= 181 && currentUserInfo.nClassID >= 148) || currentUserInfo.nClassID == 188 || currentUserInfo.nClassID == 189)
		{
			// є° °ўјє ѕЛ¶ч »иБ¦
			ChangeToAwakenedArrived(false);
		}

		// 3d №жЗв И­»мЗҐё¦ Гв·В ЗП°Ф ЗСґЩ.
		if(RecentlyAddedQuestID > 0 && Level > 0)
		{
			//TargetАМё§ Глµж
			strTargetName = class'UIDATA_QUEST'.static.GetTargetName(RecentlyAddedQuestID, Level);
			vTargetPos = class'UIDATA_QUEST'.static.GetTargetLoc(RecentlyAddedQuestID, Level);
			//ГЯ°Ў ЗФ
			ParamAdd(strParam, "X", string (vTargetPos.x));
			ParamAdd(strParam, "Y", string (vTargetPos.y));
			ParamAdd(strParam, "Z", string (vTargetPos.z));
			ParamAdd(strParam, "targetName", strTargetName);

			ParamAdd(strParam, "QuestID",  string (RecentlyAddedQuestID));
			ParamAdd(strParam, "QuestLevel",  string (Level));

			ParamAdd(strParam, "questName", class'UIDATA_QUEST'.static.GetQuestName(RecentlyAddedQuestID, Level));
			CallGFxFunction("RadarMapWnd", "showQuestTargetInfo" , strParam) ;
			// CallGFxFunction("MiniMapGfxWnd", "showQuestTargetInfo" , strParam) ;
			//ГЯ°Ў ЗФ
			
			bOnlyMinimap = class'UIDATA_QUEST'.static.IsMinimapOnly(RecentlyAddedQuestID, Level);
			QuestTreeWndScript.curQuestExpand(RecentlyAddedQuestID);
			if(bOnlyMinimap)
			{
				if(! IsPlayerOnWorldRaidServer())
				{
					class'QuestAPI'.static.SetQuestTargetInfo(true, false, false, strTargetName, vTargetPos, RecentlyAddedQuestID, Level);
				}	
			}
			else
			{
				//Debug("Notice2" @ RecentlyAddedQuestID);
				//№ЮАёёй №Щ·О И®Ае µЙ јц АЦµµ·П ДщЅєЖ® Ж®ё® И®Ае ±вґЙ ±оБц ГЯ°Ў ЗШѕЯ ЗФ.				
				if(! IsPlayerOnWorldRaidServer())
				{
					class'QuestAPI'.static.SetQuestTargetInfo(true, true, true, strTargetName, vTargetPos, RecentlyAddedQuestID, Level);
				}
			}
		}
		
		/// Debug("quest param" @ param);

	}
	//ЗБё®№Мѕо ѕЖАМЕЫАМ їФА» °жїм.
	else if(Event_ID == EV_PremiumItemAlarm  || Event_ID ==  EV_GoodsInventoryNoti)
	{
		// SetShowWindow();
		PremiumItemAlarm();
	}
	//Ж©Едё®ѕу
	//else if(Event_ID == EV_ArriveNewTutorialQuestion)
	
	else if(Event_ID == EV_ArriveTutorial)
	{
		// SetShowWindow();
		//Debug("EV_ArriveNewTutorialQuestion" @ HtmlString);
		//ParseInt(param, "QuestionID", HtmlString);		
		ArriveNewTutorialQuestion(param);
	}
	//ЅєЕі ЅАµж
	else if(Event_ID == EV_SkillLearningNewArrival)
	{
		// SetShowWindow();
		SkillLearningNewArrival();
	}
	//Д·ЖдАО ѕЛёІ ѕЖАМДЬ.
	else if(Event_ID == EV_CampaignArrived)
	{
		//SetShowWindow();
		bCam = true;

		CampaignArrived();
	}

	//Д·ЖдАО ѕЛёІ іЎ
	else if(Event_ID == EV_CampaignFinish)
	{
		ClearCampaignBtn();
	}

	//Бё ДщЅєЖ® ѕЛёІ ѕЖАМДЬ.
	else if(Event_ID == EV_ZoneQuestArrived)
	{
		// SetShowWindow();
		bZone = true;

		ZoneQuestArrived();
	}
	//АМєҐЖ®ДНЖдАОbranch120516
	else if(Event_ID == EV_BR_Event_CampaignArrived)
	{
		// SetShowWindow();
		bEvent = true;
		
		EventCampaignArrived();
	}
	//end of branch
	else if(Event_ID == EV_CallToChangeClass)
	{
		// 5470
		// SetShowWindow();
		
		ParseInt(param, "Class", awakeClassID);
		ParseInt(param, "Immediate", awakeImmediate);
		ParseInt(param, "UserType", UserType);

//		Debug("awakeClassID" @ awakeClassID);
		//№«·б °ъ±ЭБ¦ё¦ »зїл ЗТ °жїм ѕЛ¶чГўА» єёї© БЬ.
		if(UserType == 0)// GetUIUserPremiumLevel() <= 0)
		{
			strParam = "";
			ParamAdd(strParam, "Class", String(awakeClassID));

			gfxDialogScript = GfxDialog(GetScript("GfxDialog"));
			gfxDialogScript.showGfxDialog("dialogLinkageName", "DualPayDialogStep1", strParam);
		}
		// ёёѕа.. classid °Ў 0єёґЩ °°°ЕіЄ АЫґЩёй.. ЗШґз є° °ўјє ѕЛ¶чА»»иБ¦ЗСґЩ
		else if(awakeClassID <= 0)
		{
		}
		else 
		{
			// є°(°ўјє) ѕЛ¶ч ѕЖАМДЬ Е¬ёЇ ЗС °жїм
			if(awakeImmediate == 1)
			{
				strParam = "";
				ParamAdd(strParam, "Class", String(awakeClassID));
				ParamAdd(strParam, "Immediate", String(awakeImmediate));

				gfxDialogScript = GfxDialog(GetScript("GfxDialog"));
				gfxDialogScript.showGfxDialog("dialogLinkageName", "AwakeNoticeDialog", strParam);
			}
			// ·О±ЧАОЅГ №Щ·О °ўјє ґЩАМѕу·О±Чё¦ єёї© БЦ°н ЅНА»¶§..
			else
			{	
				ChangeToAwakenedArrived(true);
			}
		}
	}

	//ё®ЅєЕёЅє ЅГ №цЖ° Б¦°Е.
	else if(Event_ID == EV_Restart)
	{
		isGetPremium = false;
		isPrologueGrowTypeState = false;
		bChkAbilityPoint = false;
		removeALLNoticeButton();
	}
	else if(Event_ID == EV_ResolutionChanged)
	{
		// SendScreenSize();
		checkMultiLayOut();
	}
	else if(Event_ID == EV_CuriousHouseWaitState) //9310
	{
		CuriousHouseHandle(param);
	}
	//9452 WebБшБ¤ ѕЛ¶ч.
	else if(Event_ID == EV_WebPetitionReplyAlarm) 
	{
		WebPetitionReplyAlarm();
	}
	else if(Event_ID == EV_EnterSingleMeshZone) 
	{
		bUseSingleMesh = true;

		if(bUseSingleMesh)
		{
			createNoticeButton(	ENoticeType.TYPE_SINGLEMESHZONE, 3031); // ГЦАыИ­ Б¦є№ Іф±в
		}
		else 
		{
			createNoticeButton(	ENoticeType.TYPE_SINGLEMESHZONE, 3030); // ГЦАыИ­ Б¦є№ ДС±в
		}
	}

	else if(Event_ID == EV_ExitSingleMeshZone) 
	{
		bUseSingleMesh = false;
		// SwitchSingleMeshMode(false);
		// ГЦАыИ­ Б¦є№ ѕЖАМДЬ »иБ¦		
		removeNoticeButton(ENoticeType.TYPE_SINGLEMESHZONE);
	}

	// ЗЪµрАЗ єн·ПГјДї, toolTip : 2445
	else if(Event_ID == EV_BlockStateTeam || Event_ID == EV_BlockStatePlayer)
	{
		createNoticeButton(	ENoticeType.TYPE_PVPBLOCKCHECKER, 2445);
	}
	// БцЗП ДЭ·Ојјїт »уИІЖЗtoolTip : 2444
	else if(Event_ID == EV_CrataeCubeRecordMyItem)
	{
		createNoticeButton(	ENoticeType.TYPE_PVPCRATAECUBE, 2444);
	}
	else if(Event_ID == EV_CrataeCubeRecordBegin)
	{
		ParseInt(param, "Status", statusInt);

		if(statusInt == 0) 
		{			
			createNoticeButton(	ENoticeType.TYPE_PVPCRATAECUBE, 2444); 
		}
		else if(statusInt == 2)
		{
			removeNoticeButton(	ENoticeType.TYPE_PVPCRATAECUBE); 
		}
	}
	else if(Event_ID == EV_CrataeCubeRecordRetire)
	{
		removeNoticeButton(	ENoticeType.TYPE_PVPCRATAECUBE);
	}

	//PVP »уИІЖЗ toolTip : 2442
	else if(Event_ID == EV_PVPMatchRecord) 
	{
		ParseInt(param, "CurrentState", statusInt);	
		if(statusInt == 0) 
		{
			createNoticeButton(	ENoticeType.TYPE_PVPMATCHRECORD, 2442); 
		}
		else if(statusInt == 2)
		{
			removeNoticeButton(	ENoticeType.TYPE_PVPMATCHRECORD); 
		}
	}

	// Е¬·№ЗБЖ® »уИІЖЗ, toolTip : 2443 
	else if(Event_ID == EV_CleftStateTeam || Event_ID == EV_CleftStatePlayer) 
	{
		createNoticeButton(	ENoticeType.TYPE_PVPCLEFT, 2443); 
	}

	// ДщЅєЖ®°Ў »х·О їГ¶§ ЗцАз ДщЅєЖ® ѕЛ¶ч ѕЖАМДЬ БёАз ї©єОё¦ ГјЕ© ЗСґЩ.
	else if(Event_ID == EV_QuestListEnd)
	{
		QuestTreeWndScript.findNowQuestExist(RecentlyAddedQuestID);
	}

	//branch121212
	else if(Event_ID == EV_PathToAwakeningAlarm)
	{
		ParseInt(param, "Type", PathToAwakeningAlarmType); // 0 None 1 Level
		ParseInt(param, "Value", PathToAwakeningAlarmValue); // type 0АП¶§ґВ »зїлѕИЗФ
		
		createNoticeButton(	ENoticeType.TYPE_PATHTOAWAKENINGALARM, 5178); 
		// PathToAwakeningAlarm();
	}

	else if(Event_ID == EV_ClanInfo)
	{
		ParseInt(param, "ClanID", clanID);

		// ЗчёН Б¤єё°Ў АЦґЩёй »иБ¦ ЅГµµ
		if(clanID > 0) removeNoticeButton(ENoticeType.TYPE_PLEDGEALARM);
	}

	else if(Event_ID == EV_UpdateUserInfo) 
	{
		// ѕоєфё®Жј ЖчАОЖ®ё¦ »зїл ЗТ јц АЦЅАґПґЩ.
		chkAbilityPoint();

		// ЗчёН Б¤єё°Ў АЦґЩёй °ЎАФ ЅГЅєЕЫ ѕЛёІ »иБ¦
		ParseInt(param, "ClanID", clanID);
		if(clanID > 0) removeNoticeButton(ENoticeType.TYPE_PLEDGEALARM);
	}

	else if(Event_ID == EV_ITEM_AUCTION_UPDATED_BIDDING_INFO) 
	{
		// АЇВы±Э ГЈ±в
		createNoticeButton(	ENoticeType.TYPE_AUCTION_FAIL, 3500); 
	}
	else if(Event_ID == EV_FactionLevelUpNotify) 
	{
		// јј·В ·№є§ ѕч
		createNoticeButton(	ENoticeType.TYPE_FACTION, 3443); 
	}

	else if(Event_ID == EV_MonsterBookRewardIcon) 
	{
		// ёуЅєЕН µµ°Ё єё»у Б¶°З їП·б
		createNoticeButton(	ENoticeType.TYPE_MONSTERBOOK, 3511); 
	}	
	//їАґГАЗ ЗТ АП
	else if(Event_ID == EV_OneDayRewardCount)
	{
		ParseInt(param, "rewardCount", nRewardCount);
		ParseInt(param, "isNewMissionLevelReward", isNewMissionLevelReward);
		if(nRewardCount > 0)
		{
			createNoticeButtonWithParam(ENoticeType.TYPE_TODOLIST, 3506, param); 
			if(isNewMissionLevelReward > 0)
			{
				ToDoListWnd(GetScript("ToDoListWnd")).RequestMissionLevelRewardList();
			}		
		}
		else
			removeNoticeButton(ENoticeType.TYPE_TODOLIST);
	}
	// Вчїш ј­№ц·О АМµї ЗТ‹љ їАґГАЗ ЗТАП »иБ¦(Е¬·Ј)
	else if(Event_ID == EV_GotoWorldRaidServer)
	{		
		// GetINIBool ("Localize", "UsePledgeV2Live", nUsePledgeV2Live, "L2.ini");

		// ЗчёН ё®ґєѕу UI »зїл, Вчїш ј­№цґВ ¶уАМєкёё..
		//if(nUsePledgeV2Live > 0) removeNoticeButton(ENoticeType.TYPE_TODOLIST); 
		// ЗчёН ё®ґєѕу UI »зїл, Вчїш ј­№цґВ ¶уАМєкёё..
		if(getInstanceL2Util().isClanV2())
			removeNoticeButton(ENoticeType.TYPE_TODOLIST);
	}
	// їГёІЗЗѕЖµе °іё· БЯАМёй..
	else if(Event_ID == EV_OlympiadInfo)
	{
		/*Debug("EV_OlympiadInfo" @ param);

		ParseInt(param, "Open", nOlympiadOpenSeason);

		if(nOlympiadOpenSeason > 0) 
			createNoticeButtonWithParam(ENoticeType.TYPE_OLYMPIAD_OPENSEASON, 3845, param);  // 3845 : їГёІЗЗѕЖµе
		else
			removeNoticeButton(ENoticeType.TYPE_OLYMPIAD_OPENSEASON);*/
		HandleOlympiadEvent(param);
	}

	else if(Event_ID == EV_ChangedSubjob)
	{
		handleChangedSubjob(param);
	}
	// АО°ФАУАҐ №цЖ°, 2015-11-26 ГЯ°Ў	
	else if(Event_ID == EV_StateChanged)
	{
		// ЅєЕЧАМЖ®°Ў єЇЗП°н °ФАМ№ЦЅєЕЧАМЖ®·О µйѕо °Ґ¶§ё¶ґЩ ЖО~! ЕНБцёйј­ °»ЅЕАє µЙЕЩµҐ їшЗПБц ѕКАёёй ё®ЅєЕёЖ® ЗТ¶§ Іф°н ЗПґВ ЅДАё·О
		// ЗГ·Ў±Ч єЇјц·О ѕИЗП°Ф ЗТ јцµµ АЦґВµҐ АПґЬ ±»АМ ЗТ ЗКїд°Ў АЦіЄ ЗШј­ іЦБц ѕКАЅ.
		if(param == "GAMINGSTATE" || param == "ARENAGAMINGSTATE")
		{
			// ЕЪ·№ЖчЖ®ґВ ј­№ц №«°ь №«Б¶°З ѕЛёІ №цЖ°Аё·О єёАМµµ·П
		//	if(param != "ARENAGAMINGSTATE")
		//		createNoticeButton(ENoticeType.TYPE_TELEPORTMAP, 687);

			isPrologueGrowTypeState = getInstanceL2Util().getIsPrologueGrowType();
			//Debug ("EV_StateChanged" @ isPrologueGrowTypeState) ;
			// ё®ґПБц2ИЁ »эјє
			if(! bUseL2Button())
				return;
			/*if(bUseL2Button()) 
			{
				// Debug("NoticeButton TYPE_LINEAGE2HOME");
				createNoticeButton(	ENoticeType.TYPE_LINEAGE2HOME, 3471);    // l2ИЁ				
				createNoticeButton(	ENoticeType.TYPE_NSHOPHOME, 3634);       // nјҐ
			}*/

		//	if(IsAdenServer() || getInstanceUIData().getIsClassicServer()) createNoticeButton(	ENoticeType.TYPE_VITAMINMANAGER, 3949);       // єсЕё№О ёЕґПАъ №цЖ°

			// if(isChinaVer()) createNoticeButton(	ENoticeType.TYPE_ADVENTURE_GUIDE, 7270); // ёрЗиАЗ ѕИі» (БЯ±№ Аьїл)
		}		
	}	
	// АьБч ѕЛёІ  EVENT_ID : 11070
	else if(Event_ID == EV_ClassChangeAlarm)
	{
		// АьБч (1795)
		createNoticeButton(	ENoticeType.TYPE_CHANGE_CLASS, 1795); 
	}
	else if(Event_ID == EV_TimeRestrictFieldChargeResult || Event_ID == EV_TimeRestrictFieldUserAlarm)
	{
		createNoticeButton(ENoticeType.TYPE_TIME_HUNTINGZONE,13025);
	}
	else if(Event_ID == EV_ProtocolBegin + class'UIPacket'.const.S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO)
	{
		S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO();
	}
	else if(Event_ID == EV_ProtocolBegin + class'UIPacket'.const.S_EX_PENALTY_ITEM_INFO)
	{
		ParsePacket_S_EX_PENALTY_ITEM_INFO();
	}
	else if(Event_ID == EV_CollectionRegistEnableItem)
	{
		ParseInt(param, "classID", collectionToFindiID.ClassID);
		ParseInt(param, "ServerID", collectionToFindiID.ServerID);
		ChkCreateCollectionButton();
	}
	else if(Event_ID == EV_PacketID(class'UIPacket'.const.S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM))
	{
		RT_S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM();
	}
	else if(Event_ID == (EV_ProtocolBegin + class'UIPacket'.const.S_EX_DETHRONE_DAILY_MISSION_COMPLETE))
	{
		ParsePacket_S_EX_DETHRONE_DAILY_MISSION_COMPLETE();
	}
	else if(Event_ID == EV_PacketID(class'UIPacket'.const.S_EX_GOODS_GIFT_CHANGED_NOTI))
	{
		Debug("-> 선물 수신 동의 알람 S_EX_GOODS_GIFT_CHANGED_NOTI");
		createNoticeButton(ENoticeType.TYPE_GIFT, 14201);	
	}
	else if(Event_ID == (EV_PacketID(class'UIPacket'.const.S_EX_VIP_ATTENDANCE_NOTIFY)))
	{
		Nt_S_EX_VIP_ATTENDANCE_NOTIFY();																																															
	}
	else if(Event_ID == EV_PacketID(class'UIPacket'.const.S_EX_HOLY_FIRE_NOTIFY))
	{
		ParsePacket_S_EX_HOLY_FIRE_NOTIFY();																																															
	}
	else if(Event_ID == EV_Test_5)
	{
		Debug("-> 테스트 5 출석부");
		createNoticeButton(ENoticeType.TYPE_ATTENDCHECK, 1);
	}
}

function ParsePacket_S_EX_HOLY_FIRE_NOTIFY()
{
	local UIPacket._S_EX_HOLY_FIRE_NOTIFY packet;

	if(! class'UIPacket'.static.Decode_S_EX_HOLY_FIRE_NOTIFY(packet))
	{
		return;
	}
	Debug("_S_EX_HOLY_FIRE_NOTIFY packet.cState" @ string(packet.cState));
	switch(packet.cState)
	{
		case 0:
		case 2:
		case 3:
			createNoticeButton(ENoticeType.TYPE_HOLY_FIRE, 14329);
			break;
	}	
}

function Nt_S_EX_VIP_ATTENDANCE_NOTIFY()
{
	createNoticeButton(ENoticeType.TYPE_ATTENDCHECK, 5190);
}

function RemoveAttendCheckNotice()
{
	removeNoticeButton(ENoticeType.TYPE_ATTENDCHECK);
}

function RT_S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM()
{
	local UIPacket._S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM packet;
	local string param;

	if(! class'UIPacket'.static.Decode_S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM(packet))
	{
		return;
	}
	if(class'WorldExchangeRegiWnd'.static.Inst().m_hOwnerWnd.IsShowWindow())
	{
		class'WorldExchangeRegiWnd'.static.Inst().HandleCancelCancel();
		class'WorldExchangeRegiWnd'.static.Inst().historyScr.HandleRefresh();
	}
	ParamAdd(param, "rewardCount", string(class'WorldExchangeRegiWnd'.static.Inst().historyScr.receivedNum));
	_CreateWorldExchangeBuyNotice(param);
	Debug("RT_S_EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM" @ param);
}

function RT_S_EX_WORLD_EXCHANGE_SETTLE_ALARM()
{
	local UIPacket._S_EX_WORLD_EXCHANGE_SETTLE_ALARM packet;
	local string param;

	if(! class'UIPacket'.static.Decode_S_EX_WORLD_EXCHANGE_SETTLE_ALARM(packet))
	{
		return;
	}
	if(class'WorldExchangeRegiWnd'.static.Inst().m_hOwnerWnd.IsShowWindow())
	{
		class'WorldExchangeRegiWnd'.static.Inst().HandleCancelCancel();
		class'WorldExchangeRegiWnd'.static.Inst().historyScr.HandleRefresh();
	}
	param = "";
	ParamAdd(param, "rewardCount", string(packet.nCount));
	_CreateWorldExchangeBuyNotice(param);	
}

function _CreateWorldExchangeBuyNotice(optional string param)
{
	createNoticeButtonWithParam(ENoticeType.TYPE_WORLDEXCHANGE_BUY, 14063, param);
}

function _RemoveNoticButtonWorldExchangeBuy()
{
	removeNoticeButton(ENoticeType.TYPE_WORLDEXCHANGE_BUY);
}

function _RemoveNoticButtonGift()
{
	removeNoticeButton(ENoticeType.TYPE_GIFT);	
}

function _RemoveNoticButtonProductInventory()
{
	removeNoticeButton(ENoticeType.TYPE_PREM);	
}

function ParsePacket_S_EX_DETHRONE_DAILY_MISSION_COMPLETE()
{
	local UIPacket._S_EX_DETHRONE_DAILY_MISSION_COMPLETE packet;
	local string param;

	if(! class'UIPacket'.static.Decode_S_EX_DETHRONE_DAILY_MISSION_COMPLETE(packet))
	{
		return;
	}
	Debug(" -->  Decode_S_EX_DETHRONE_DAILY_MISSION_COMPLETE : " @ string(packet.nCompleteMissionCount));
	ParamAdd(param, "rewardCount", string(packet.nCompleteMissionCount));
	if(packet.nCompleteMissionCount > 0)
	{
		createNoticeButtonWithParam(ENoticeType.TYPE_DETHRONE, 13733, param);		
	}
	else
	{
		removeNoticeButton(ENoticeType.TYPE_DETHRONE);
	}
}

function removeNoticeDethroneMissionNotice()
{
	removeNoticeButton(ENoticeType.TYPE_DETHRONE);
}

function ParsePacket_S_EX_PENALTY_ITEM_INFO()
{
	local UIPacket._S_EX_PENALTY_ITEM_INFO packet;

	if(! class'UIPacket'.static.Decode_S_EX_PENALTY_ITEM_INFO(packet))
	{
		return;
	}
	LostPropertyArrived(packet.nCount);
}

function S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO()
{
	local UIPacket._S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO packet;

	if(! class'UIPacket'.static.Decode_S_EX_PVPBOOK_SHARE_REVENGE_NEW_REVENGEINFO(packet))
	{
		return;
	}
	if(packet.nShareType != 1)
	{
		RevengeHelpArrived();
	}
	if(packet.nShareType != 2 && packet.nShareType != 4)
	{
		getInstanceL2Util().showGfxScreenMessage(MakeFullSystemMsg(GetSystemMessage(13049), packet.sKillUserName));
		createNoticeButton(ENoticeType.TYPE_KILLER, 0, MakeFullSystemMsg(GetSystemMessage(13049), packet.sKillUserName));
	}
}

function chkAbilityPoint()
{
	local userinfo userInfo;

	GetPlayerInfo(userInfo);

	// ·ѕ ѕч ЅГ ЗС№шёё bChkAbilityPoint flagё¦ °ЎБц°н АЦґВґЩ.
	if(getInstanceUIData().isLevelUP()) bChkAbilityPoint = true ;
	
	// Debug ( "chkAbilityPoint" @ getInstanceUIData().isLevelUP() @ userInfo.nRemainAbilityPoint @ bChkAbilityPoint);

	if(bChkAbilityPoint) 
	{
		if( userInfo.nRemainAbilityPoint > 0)
		{
			//Debug("·№є§ѕч, ѕоєфё®Жј ѕЛёІ, TYPE_ABILITYPOINT!!!");
			createNoticeButton(	ENoticeType.TYPE_ABILITYPOINT, 3151);
			bChkAbilityPoint = false;
		}
	}
}

function bool isChinaVer ()
{
	local ELanguageType Language;	 //branch121212
    local bool flag;
	Language = GetLanguage();
	if(Language == LANG_Chinese)
	{
		flag = true;
	}
	return flag;
}

// ЗС±№, Е¬·ЎЅДј­№цёё іЄїА°Ф
function bool bUseL2Button()
{
	local ELanguageType Language;	 //branch121212
	local bool flag;

	Language = GetLanguage();
	if(Language == LANG_Korean && !getInstanceUIData().getIsArenaServer())
	{
		flag = true;
	}

	return flag;
}

function toggleWindow(string windowName)
{
	if(!GetWindowHandle(windowName).IsShowWindow())
	{
		GetWindowHandle(windowName).ShowWindow();
		GetWindowHandle(windowName).SetFocus();		
	}
	else 
		GetWindowHandle(windowName).HideWindow();
}

/**
 *  PVP №цЖ°А» Е¬ёЇ ЗЯА»¶§ 
 **/ 
function pvpButton(int SelectPVP)
{
	// єн·ПГјДї		
	if(SelectPVP == ENoticeType.TYPE_PVPBLOCKCHECKER)
	{
		toggleWindow("BlockCurWnd");		
	}
	// ДЭ·Ојјїт »уИІЖЗ 
	else if(SelectPVP == ENoticeType.TYPE_PVPCRATAECUBE)
	{		
		if(!GetWindowHandle("KillPointRankWnd").IsShowWindow())
		{
			RequestStartShowCrataeCubeRank();
		}
		toggleWindow("KillPointRankWnd");
	}
	// PVP »уИІЖЗ 
	else if(SelectPVP == ENoticeType.TYPE_PVPMATCHRECORD)
	{
		toggleWindow("PVPDetailedWnd");
	}
	// Е©·№ЗБЖ®
	else if(SelectPVP == ENoticeType.TYPE_PVPCLEFT)
	{
		toggleWindow("CleftCurWnd");
	}
}

function CuriousHouseHandle (string param)
{
	local int HouseState;

	ParseInt(param, "State", HouseState);

	//ґл±в ГлјТ єТ°ЎґЙ »уЕВАП °жїм ѕЛёІ ѕЖАМДЬ ГлјТ
	switch (HouseState) 
	{
		case 1 :
			createNoticeButton(ENoticeType.TYPE_CURIOUSEHOUSE, 2804);
			//ѕЛёІ ѕЖАМДЬА» єёї© БЬ
			break;
		case 0 :	
		case 2 :  
		case 3 :
			//eventID = 900;
			// args[1].SetMemberInt("Num", ENoticeType.TYPE_CURIOUSEHOUSE);//ѕЛёІАЗ №шИЈ
			// createNoticeButton(ENoticeType.TYPE_PLEDGEALARM);
			removeNoticeButton(ENoticeType.TYPE_CURIOUSEHOUSE);
			//ѕЛёІ ѕЖАМДЬА» јыЕґ
			break;		
	}
}

function PledgeAlarm()
{	
	createNoticeButton(ENoticeType.TYPE_PLEDGEALARM, 3068);	
}

//WebБшБ¤ ЅГ ѕЛ¶ч.9452
function WebPetitionReplyAlarm()
{	
	createNoticeButton(ENoticeType.TYPE_WEBPETITIONALARM, 3109);
}

function HandleOlympiadEvent (string param)
{
	local int nOlympiadOpenSeason;

	if(getInstanceUIData().getIsClassicServer())
	{
		NoticeHUD(GetScript("NoticeHUD")).HandleOlympiadNotice(param);
	}
	else
	{
		ParseInt(param,"Open",nOlympiadOpenSeason);
		if(nOlympiadOpenSeason > 0)
			createNoticeButtonWithParam(ENoticeType.TYPE_OLYMPIAD_OPENSEASON,3845,param);
		else
			removeNoticeButton(ENoticeType.TYPE_OLYMPIAD_OPENSEASON);
	}
}

/**
 * »х·Оїо ёЮАПАМ їФА» ¶§.
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "0"
 * ENoticeType.TYPE_MAIL
 */
function Notice_Post_Arrived()
{
	createNoticeButton(ENoticeType.TYPE_MAIL, 2074);
}

/**
 * »х·Оїо ДщЅєЖ®°Ў їФА» ¶§.
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "1"
 * ENoticeType.TYPE_QUEST
 */
function ArriveShowQuest()
{
	if(IsAdenServer())
	{
		createNoticeButton(ENoticeType.TYPE_QUEST, 14405);		
	}
	else
	{
		createNoticeButton(ENoticeType.TYPE_QUEST, 118);
	}	
}

/**
 * ЗБё®№Мѕо ѕЖАМЕЫАМ їФА» °жїм »уЗ°АОєҐЕдё®.?
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "2"
 * ENoticeType.TYPE_PREM
 */
function PremiumItemAlarm()
{	
	if(IsUseGoodsInvnentory() == false)
	{
		createNoticeButton(ENoticeType.TYPE_PREM, 1738); // єсЕё№О ѕЖАМЕЫ
		AddSystemMessage(2313); // єсЕё№О ѕЖАМЕЫАМ µµВшЗПїґЅАґПґЩ.
	}
	else
	{
		createNoticeButton(ENoticeType.TYPE_PREM, 2680); // »уЗ°АМ µµВшЗЯЅАґПґЩ. ѕЖАМДЬА» Е¬ёЇЗПЅГёй »уЗ° АОєҐЕдё®їЎј­ №Щ·О »уЗ°А» И®АОЗПЅЗ јц АЦЅАґПґЩ.
	}	
}

/**
 * ЅєЕі ЅАµж
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "4"
 * ENoticeType.TYPE_SKILL
 */
function SkillLearningNewArrival()
{
	createNoticeButton(ENoticeType.TYPE_SKILL, 2369);
}

/**
 * Д·ЖдАО ЅАµж
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "5"
 * ENoticeType.TYPE_CAMPAIGN
 */
function CampaignArrived()
{
	createNoticeButton(ENoticeType.TYPE_CAMPAIGN, 2440);
}


/**
 * Бё ДщЅєЖ® ЅАµж
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "6"
 * ENoticeType.TYPE_ZONE
 */
function ZoneQuestArrived()
{
	createNoticeButton(ENoticeType.TYPE_ZONE, 2441);
}

function RevengeHelpArrived()
{
	createNoticeButton(ENoticeType.TYPE_REVENGEHELP, 13502);
}

function LostPropertyArrived(int nCount)
{
	local string param;

	ParamAdd(param, "rewardCount", string(nCount));
	if(nCount > 0)
	{
		createNoticeButtonWithParam(ENoticeType.TYPE_LOSTPROPERTY, 13526, param);		
	}
	else
	{
		removeNoticeButton(ENoticeType.TYPE_LOSTPROPERTY);
	}
}

//branch120516
/**
 * АМєҐЖ® Д·ЖдАО ЅАµж
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "7"
 * ENoticeType.TYPE_EVENTCAMPAIGN
 */
function EventCampaignArrived()
{
	createNoticeButton(ENoticeType.TYPE_EVENTCAMPAIGN, 5143);
}
//end of branch


// АМєҐЖ® Б¤єё №цЖ° єёАМ±в
function EventInfoArrived()
{
	// createNoticeButton(ENoticeType.TYPE_EVENT_INFO, 3004);

	local SideBar SideBarScript;

	if(GetLanguage() == LANG_Korean)
	{
		SideBarScript = SideBar(GetScript("SideBar"));
		SideBarScript.SetWindowShowHideByIndex(SideBarScript.SIDEBAR_WINDOWS.TYPE_EVENTINFO, true);
	}
}

// АМєҐЖ® Б¤єё №цЖ° »иБ¦
function hideNoticeButton_EventInfo()
{
	removeNoticeButton(ENoticeType.TYPE_EVENT_INFO);
}


//Д·ЖдАО №цЖ° »иБ¦.
function ClearCampaignBtn()
{
	//Debug("bCam>>>>>>>>>" $ string(bCam));
	if(bCam == true)
	{
		removeNoticeButton(int(ENoticeType.TYPE_CAMPAIGN));

		bCam = false;
	}
}

//Бё ДщЅєЖ® №цЖ° »иБ¦.
function ClearZoneQuestBtn()
{
	if(bZone == true)
	{
		removeNoticeButton(int(ENoticeType.TYPE_ZONE));

		bZone = false;
	}
}

//branch121212
/**
 * АМєҐЖ® Д·ЖдАО ЅАµж
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "10"
 * ENoticeType.TYPE_PATHTOAWAKENINGALARM
 */
function PathToAwakeningAlarm()
{
	// ЗГ·ЎЅГ ЕёАФ µҐАМЕё АОЅєЕПЅє »эјє
	AllocGFxValues(args, 2);		
	AllocGFxValue(invokeResult);

	// ѕЛёІ »эјє : АМєҐЖ® №шИЈ 10№ш
	args[0].SetInt(ENoticeType.TYPE_PATHTOAWAKENINGALARM);
	CreateObject(args[1]);
	
	args[1].SetMemberInt("toolTipNum", 5178); //ЅГЅєЕЫ ЅєЖ®ёµ 5152  PathToAwakening
	
	Invoke("_root.onEvent", args, invokeResult);

	DeallocGFxValue(invokeResult);
	DeallocGFxValues(args);
}
//end of branch


//АМєҐЖ® Д·ЖдАО №цЖ° »иБ¦.
//branch120516
function ClearBRCampaignBtn()
{
	if(bEvent == true)
	{
		removeNoticeButton(int(ENoticeType.TYPE_EVENTCAMPAIGN));

		bEvent = false;
	}
}
//end of branch

/**
 * 
 * °ўјє ѕЛ¶ч 
 * 
 */
function ChangeToAwakenedArrived(bool bOnOff)
{
	// SetShowWindow();

	if(bOnOff)
	{
		//CallGFxFunction("noticeWnd", String(ENoticeType.TYPE_AWAKENED), "toolTipNum=" $ string(2491));
		createNoticeButton(ENoticeType.TYPE_AWAKENED, 2491);
	}
	else
	{
		removeNoticeButton(int(ENoticeType.TYPE_AWAKENED));
	}
}

//»уЗ° АОєҐЕдё® ї­±в
function HandleShowProductInventory()
{
	local WindowHandle win;

	win = GetWindowHandle("ProductInventoryWnd");
	if(! win.IsShowWindow())
	{
		win.ShowWindow();
		win.SetFocus();
	}
	else
	{
		ProductInventoryWnd(GetScript("ProductInventoryWnd")).refresh();
	}	
}

function SetShowWindow()
{
	//branch GD35_0828 2014-2-7 luciper3 - °ФАУ»уЕВАП¶§ёё єёї©БШґЩ. ИЖ·ГјТ »уЕВ ¶§№®їЎ јцБ¤ЗФ.
	local bool bStateCheck;

	bStateCheck = GetGameStateName() == "GAMINGSTATE";
	bStateCheck = (bStateCheck || GetGameStateName() == "ARENAGAMINGSTATE");
	//end of branch

	if(IsShowWindow() == false && bStateCheck)
	{
		ShowWindow();
	}	
}

function OnEnterState(name a_CurrentStateName)
{	
	SetShowWindow();
}

// јфДЖ А§ДЎїЎ µы¶уј­, ѕЛёІ А§ДЎ єЇ°ж
function checkMultiLayOut()
{
	local string param;

	SetAnchor("",EAnchorPointType.ANCHORPOINT_BottomRight,EAnchorPointType.ANCHORPOINT_TopLeft,0,0);
	ParamAdd(param, "w", "-46");
	ParamAdd(param, "h", "-140");
	CallGFxFunction("noticeWnd", LAYOUT_ONELINE,param);
}

/**
 * Ж©Едё®ѕу , °іј±ЖЗ (ЖЇјц ЕёАФ) Д«їоЖГ µЗґВ..
 * ЗГ·ЎЅГ·О єёі»ґВ АМєҐЖ® іС№ц "3"
 * ENoticeType.TYPE_TUTORIAL
 */

function ArriveNewTutorialQuestion(string param)
{
	local int toolTipNum;

	ParseInt(param, "toolTipNum", toolTipNum);

	// param їЎ toolTipNum АМ ѕшАёёй.. іЦѕоБЬ.
	if(toolTipNum <= 0) 
	{
		// Ж©Едё®ѕу ЕшЖБ ЗҐЅГ
		toolTipNum = 448;
	}

	createNoticeButtonWithParam(ENoticeType.TYPE_TUTORIAL, toolTipNum, param); 
}

// ѕЛёІ №цЖ° »эјє, »иБ¦, АьГј »иБ¦
function createNoticeButton(int nType, int nTooltipString, optional string forceTooltipString)
{
	local string paramStr;

	if(checkIisPrologueGrowType(nType))
	{
		return;
	}

	// ЗчёН ё®ґєѕу №цАьАє їАґГАЗ ЗТАП(Е¬·Ј№цАь)А» Вчїшј­№цїЎј­ ѕЛёІА» »эјєЗПБц ѕКАЅ.
	//GetINIBool ("Localize", "UsePledgeV2Live", nUsePledgeV2Live, "L2.ini");
	
	//if(nUsePledgeV2Live > 0 && IsPlayerOnWorldRaidServer() && nType == ENoticeType.TYPE_TODOLIST) return;
	if(getInstanceL2Util().isClanV2() && IsPlayerOnWorldRaidServer() && nType == ENoticeType.TYPE_TODOLIST) return;

	ParamAdd(paramStr, "toolTipNum", string(nTooltipString));
	if(forceTooltipString != "")
	{
		paramStr = "";
		ParamAdd(paramStr,"toolTipString",forceTooltipString);
	}
	
	CallGFxFunction("noticeWnd", String(nType), paramStr);
}

// ѕЛёІ №цЖ° »эјє, »иБ¦, АьГј »иБ¦
function createNoticeButtonWithParam(int nType, int nTooltipString, string paramStr)
{	
	if(checkIisPrologueGrowType(nType))
	{
		return;
	}

	// ЗчёН ё®ґєѕу №цАьАє їАґГАЗ ЗТАП(Е¬·Ј№цАь)А» Вчїшј­№цїЎј­ ѕЛёІА» »эјєЗПБц ѕКАЅ.
	//GetINIBool ("Localize", "UsePledgeV2Live", nUsePledgeV2Live, "L2.ini");
	
	//if(nUsePledgeV2Live > 0 && IsPlayerOnWorldRaidServer() && nType == ENoticeType.TYPE_TODOLIST) return;
	if(getInstanceL2Util().isClanV2() && IsPlayerOnWorldRaidServer() && nType == ENoticeType.TYPE_TODOLIST) return;

	ParamAdd(paramStr, "toolTipNum", string(nTooltipString));
	CallGFxFunction("noticeWnd", String(nType), paramStr);
}

function removeNoticeButton(int nType)
{
	local string paramStr;

	if(IsShowWindow()) 
	{
		ParamAdd(paramStr, "type", string(nType));
		CallGFxFunction("noticeWnd", NOTICEBUTTON_DELETE, paramStr);
	}
}

function removeALLNoticeButton()
{
	//SetShowWindow();
	if(IsShowWindow()) CallGFxFunction("noticeWnd", NOTICEBUTTON_DELETEALL, "");
}

// ДщЅєЖ® 	
function hideNoticeButton_QUEST()
{
	removeNoticeButton(ENoticeType.TYPE_QUEST);
}

// єн·ПГјДї	
function hideNoticeButton_PVPBLOCKCHECKER()
{
	removeNoticeButton(ENoticeType.TYPE_PVPBLOCKCHECKER);
}

// ДЭ·Ојјїт »уИІЖЗ 
function hideNoticeButton_PVPCRATAECUBE()
{
	removeNoticeButton(ENoticeType.TYPE_PVPCRATAECUBE);
}

// PVP »уИІЖЗ 
function hideNoticeButton_PVPMATCHRECORD()
{
	removeNoticeButton(ENoticeType.TYPE_PVPMATCHRECORD);
}

// Е©·№ЗБЖ® »уИІЖЗ 
function hideNoticeButton_PVPCLEFT()
{
	removeNoticeButton(ENoticeType.TYPE_PVPCLEFT);
}

// Д·ЖРАО
function hideNoticeButton_CAMPAIGN()
{
	removeNoticeButton(ENoticeType.TYPE_CAMPAIGN);
}


// Бё ДщЅєЖ®
function hideNoticeButton_ZONE()
{
	removeNoticeButton(ENoticeType.TYPE_ZONE);
}


/* ////////////////////////////////////////////////////////////////////////////////////////////////////
 * ЗБ·С·О±Ч АьБч  
 */////////////////////////////////////////////////////////////////////////////////////////////////////
// 1. ЗчёН ГКґл, 2. їЈ? 3. АМєҐЖ®, 4. BM »уЗ° АОєҐЕдё® (»уЗ° АЦА» ЅГ) 			
function handleChangedSubjob(string param) 
{
	local bool tmpIsPrologueGrowTypeState ;
	local UserInfo info ;
		
	tmpIsPrologueGrowTypeState = getisPrologueGrowTypeState(param) ;
	if(tmpIsPrologueGrowTypeState != isPrologueGrowTypeState)
	{
		isPrologueGrowTypeState = tmpIsPrologueGrowTypeState;
		if(! isPrologueGrowTypeState)
		{
			// АМєҐЖ®
			if(EventInfoWnd(GetScript("EventInfoWnd")).hasNoticeIcon)
			{
				EventInfoArrived();
			}

			// ЗчёН ГКґл
			if(GetPlayerInfo(Info))
			{
				if(Info.nClanID <= 0)
				{
					createNoticeButton(ENoticeType.TYPE_PLEDGEALARM, 3068);
				}
			}

			// їЈ?
			//	if(bUseL2Button())
			//		createNoticeButton(ENoticeType.TYPE_NSHOPHOME, 3634) ;

			// ЗБё®№Мѕц ѕЛ¶ч
			if(isGetPremium)
			{
				PremiumItemAlarm();
			}
		}
	}
}

function bool getisPrologueGrowTypeState(string param)
{
	local int currentClassID;

	if(param != "")
	{
		ParseInt(param, "CurrentSubjobClassID", currentClassID);
	}
	return getInstanceL2Util().getIsPrologueGrowType(currentClassID);
}

function bool checkIisPrologueGrowType(int nType)
{
	if(isPrologueGrowTypeState) //getInstanceL2Util().getIsPrologueGrowType()) 
	{
		switch(nType)
		{
			case ENoticeType.TYPE_PREM: // ЗБё®№Мѕц »уЗ°
				isGetPremium = true;
			case ENoticeType.TYPE_TUTORIAL:
			case ENoticeType.TYPE_PLEDGEALARM: // ЗчёНѕЛ¶ч
			case ENoticeType.TYPE_EVENT_INFO: // АМєҐЖ® Б¤єё 28
			case ENoticeType.TYPE_NSHOPHOME: // NјҐ 29	
				return true;
		}
    }

	return false;
}
