namespace Assets.src.rpg
{
	public class Npc : CPlayer
	{
		public const sbyte BINH_KHI = 0;

		public const sbyte PHONG_CU = 1;

		public const sbyte TRANG_SUC = 2;

		public const sbyte DUOC_PHAM = 3;

		public const sbyte TAP_HOA = 4;

		public const sbyte THU_KHO = 5;

		public const sbyte DA_LUYEN = 6;

		public NpcTemplate template;

		public int npcId;

		public int templateId;

		public bool isFocus = true;

		public static NpcTemplate[] arrNpcTemplate;

		public int sys;

		public bool isHide;

		public int avatar;

		private int dyEff;

		private int nhun;

		public Npc(int npcId, int status, int cx, int cy, int templateId, int avatar, short head1, short body1, short leg1)
		{
			this.npcId = npcId;
			this.avatar = avatar;
			CRes.outz("npc avatar= " + this.avatar);
			x = cx;
			y = cy;
			this.templateId = templateId;
			switch (npcId)
			{
			case 0:
				name = "Quân nhu";
				break;
			case 1:
				name = "Tình báo";
				break;
			case 2:
				name = "Đội trưởng";
				break;
			case 3:
				name = "Đại úy";
				break;
			}
			head = head1;
			body = body1;
			leg = leg1;
			wp = -1;
		}

		public static void clearEffTask()
		{
		}

		public new virtual void update()
		{
			updateFrameStand();
			base.update();
		}

		public void paintHead(mGraphics g)
		{
			Part part = CCanvas.parts[template.headId];
			if (look == 0)
			{
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[cf][0][0]].id, CCanvas.w - 31 - g.getTranslateX(), 2 - g.getTranslateY(), 0, 0, false);
			}
			else
			{
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[cf][0][0]].id, CCanvas.w - 31 - g.getTranslateX(), 2 - g.getTranslateY(), 2, 24, false);
			}
		}

		public bool isClickNPC(int x1, int y1)
		{
			if (CRes.inRect(x1, y1, x - 10, y - 40, 20, 40))
			{
				PM.getMyPlayer2().charFocus = null;
				PM.getMyPlayer2().npcFocus = this;
				PM.getMyPlayer2().target = npcId;
				return true;
			}
			return false;
		}

		public new virtual void paint(mGraphics g)
		{
			bool flag = false;
			if (PM.getMyPlayer2() == null)
			{
				return;
			}
			if (PM.getMyPlayer2().npcFocus != null && PM.getMyPlayer2().target != -1 && PM.getMyPlayer2().target == npcId)
			{
				flag = true;
				g.drawImage(GameScr.imgHandThang, x, y - 60 + PM.nhun, 3, false);
			}
			if (!isHide)
			{
				paintBody(g, x, y);
				if (flag)
				{
					mFont.tahoma_7_white.drawString(g, name, x, y - 65 - mFont.tahoma_7.getHeight(), mFont.CENTER, mFont.tahoma_7);
				}
				else
				{
					mFont.tahoma_7_white.drawString(g, name, x, y - 45 - mFont.tahoma_7.getHeight(), mFont.CENTER, mFont.tahoma_7);
				}
			}
		}

		public void hide()
		{
		}
	}
}
