@LabelIndex 69960
@StringIndex 11262
class 0 event_ai_alegria : citizen {
parameter:

handler:
	EventHandler CREATED(talker,ask,reply,i0,i1,c0) {
		myself.i_ai0 = 0;
		myself.i_ai1 = 0;
		myself.i_ai2 = 0;
		myself.c_ai0 = gg::GetCreatureFromID(myself.sm.param3);
		myself::EffectMusic(myself.sm,10000,"HB01");
		myself::AddTimerEx(20002,360000);
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == 20002 ) {
			myself::Despawn();
		}
		if( timer_id == 20003 ) {
			myself::Suicide();
		}
	}

	EventHandler TALKED(talker) {
		myself::ShowPage(talker,"event_alegria001.htm");
	}

	EventHandler MENU_SELECTED(talker,ask,reply,i0,i1,c0) {
		if( ask == 20001 ) {
			if( reply == 1 ) {
				if( gg::IsCreateDate(talker) == 1 ) {
					if( gg::CanGetBirthdayGift(talker) == 1 ) {
						if( gg::GetBirthdayGiftCount(talker) == 0 ) {
							if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
								myself::ShowSystemMessage(talker,1118);
								return;
							}
							myself::ShowPage(talker,"event_alegria003.htm");
							myself::GiveItem1(talker,10250,1);
							gg::SaveGetBirthdayGiftTime(talker);
							myself::CastBuffForQuestReward(talker,389939201);
						} else if( gg::GetBirthdayGiftCount(talker) == 1 ) {
							if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
								myself::ShowSystemMessage(talker,1118);
								return;
							}
							myself::ShowPage(talker,"event_alegria003.htm");
							myself::GiveItem1(talker,10250,1);
							gg::SaveGetBirthdayGiftTime(talker);
							myself::CastBuffForQuestReward(talker,389939201);
						} else if( gg::GetBirthdayGiftCount(talker) == 2 ) {
							if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
								myself::ShowSystemMessage(talker,1118);
								return;
							}
							myself::ShowPage(talker,"event_alegria003.htm");
							gg::SaveGetBirthdayGiftTime(talker);
							myself::CastBuffForQuestReward(talker,389939201);
						} else if( gg::GetBirthdayGiftCount(talker) == 3 ) {
							if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
								myself::ShowSystemMessage(talker,1118);
								return;
							}
							myself::ShowPage(talker,"event_alegria003.htm");
							gg::SaveGetBirthdayGiftTime(talker);
							myself::CastBuffForQuestReward(talker,389939201);
						} else if( gg::GetBirthdayGiftCount(talker) == 4 ) {
							if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) ) {
								myself::ShowSystemMessage(talker,1118);
								return;
							}
							myself::ShowPage(talker,"event_alegria003.htm");
							gg::SaveGetBirthdayGiftTime(talker);
							myself::CastBuffForQuestReward(talker,389939201);
						} else {
							myself::ShowPage(talker,"event_alegria006.htm");
						}
					} else {
						myself::ShowPage(talker,"event_alegria005.htm");
					}
					myself::AddTimerEx(20003,1000);
				} else {
					myself::ShowPage(talker,"event_alegria004.htm");
				}
			}
		}
	}

}
