using System;
using Assets.src.model;
using Assets.src.player;
using Assets.src.rpg;

public class Panel : IActionListener
{
	private const sbyte BOX_BAG = 0;

	private const sbyte BAG_BOX = 1;

	private const sbyte BOX_BODY = 2;

	private const sbyte BODY_BOX = 3;

	private const sbyte BAG_BODY = 4;

	private const sbyte BODY_BAG = 5;

	private const sbyte BAG_BALO = 6;

	private const sbyte DELETE = 7;

	public const int TYPE_SHOP = 0;

	public const int TYPE_SHOP_WITH_EQUIP = 1;

	public const int TYPE_MY_INVENTORY = 2;

	public const int TYPE_MY_EQUIP = 4;

	public const int TYPE_MY_INVENTORY_WITH_EQUIP = 5;

	public const int TYPE_MAIL = 6;

	public const int TYPE_LEVEL = 7;

	public const int TYPE_ROOMLIST = 8;

	public const int TYPE_FRIEND = 9;

	public const int TYPE_TOP_PLAYER = 10;

	public const int TYPE_MISSION = 11;

	public const int TYPE_TOP_CLAN = 12;

	public const int TYPE_CLAN_MEMBER = 13;

	public const int TYPE_MONEY = 14;

	public const int TYPE_BIETDOI = 15;

	public const int TYPE_BALO = 16;

	public const int TYPE_MAP = 17;

	public const int TYPE_TOP = 18;

	public const int TYPE_KHAMNAM = 19;

	public const int TYPE_KHAMNAM_WITH_EQUIP = 20;

	public const int TYPE_CLANS = 21;

	public const int TYPE_ACHIEVEMENT = 22;

	public const int TYPE_RPG = 23;

	public const int TYPE_GIAODICH = 24;

	public const int TYPE_ZONE = 25;

	public const int TYPE_MAP_FILTER = 26;

	public const int TYPE_MONEY_FILTER = 27;

	public const int TYPE_PLAYER_INFO = 28;

	public const int TYPE_MY_INFO = 29;

	private const sbyte MAX_BODY_ITEMS = 7;

	public bool isShow;

	public int X;

	public int Y;

	public int W;

	public int H;

	public int ITEM_HEIGHT;

	public int TAB_W;

	public int cmtoY;

	public int cmy;

	public int cmdy;

	public int cmvy;

	public int cmyLim;

	public int xc;

	public int[] cmyLast;

	public int cmtoX;

	public int cmx;

	public int cmxLim;

	public int cmxMap;

	public int cmyMap;

	public int cmxMapLim;

	public int cmyMapLim;

	public int cmyQuest;

	public static Image imgMap;

	public static Image imgChamdo;

	public static Image imgBantay;

	public static Image imgX;

	public static Image imgIcon;

	public static Image imgRoomStat;

	private Command left = new Command(L.select(), 0);

	public int type;

	public int currentTabIndex;

	public int startTabPos;

	public int tabDistance;

	public int[] lastTabIndex;

	private string[][] currentTabName;

	private int[] currClanOption;

	private static int mainTabPos = 4;

	private static int shopTabPos = 50;

	private static int boxTabPos = 50;

	public static string[][] shopTabName = new string[4][]
	{
		new string[2] { "Vật", "phẩm" },
		new string[2] { "Trang", "bị" },
		new string[2] { "Đặc", "biệt" },
		new string[2] { "Biệt", "đội" }
	};

	public static string[][] topTabName;

	public static string[][] shopTabName2 = new string[5][]
	{
		new string[2] { "Vật", "phẩm" },
		new string[2] { "Trang", "bị" },
		new string[2] { "Đặc", "biệt" },
		new string[2] { "Biệt", "đội" },
		new string[2] { "Hành", "Trang" }
	};

	public static int[] maxPageShop;

	public static int[] currPageShop;

	public static int graphics = 0;

	private static string[][] tabInventory = new string[3][]
	{
		new string[2] { "Rương", "Đồ" },
		new string[2]
		{
			"Ba lô",
			string.Empty
		},
		new string[2] { "Hành", "Trang" }
	};

	private static string[][] tabInventory2 = new string[2][]
	{
		new string[2] { "Rương", "Đồ" },
		new string[2]
		{
			"Ba lô",
			string.Empty
		}
	};

	private static string[][] tabBalo = new string[2][]
	{
		new string[2]
		{
			"Ba lô",
			string.Empty
		},
		new string[2] { "Chức", "Năng" }
	};

	private static string[][] tabRPG = new string[4][]
	{
		new string[2] { "Trang", "bị" },
		new string[2]
		{
			"Ba lô",
			string.Empty
		},
		new string[2] { "Rương", "Đồ" },
		new string[2] { "Chức", "Năng" }
	};

	private static string[][] boxZone = new string[1][] { new string[2] { "Khu", "Vực" } };

	private static string[][] boxMap = new string[1][] { new string[2] { "Bản", "đồ" } };

	public static string[][] nothing = new string[1][] { new string[2]
	{
		string.Empty,
		string.Empty
	} };

	public static string[][] kham_nam1 = new string[2][]
	{
		new string[2] { "Đính", "ngọc" },
		new string[2] { "Nhập", "ngọc" }
	};

	public static string[][] kham_nam2 = new string[3][]
	{
		new string[2] { "Đính", "ngọc" },
		new string[2] { "Nhập", "ngọc" },
		new string[2] { "Hành", "Trang" }
	};

	public string[][] banghoi;

	public string[][][] tabName = new string[30][][]
	{
		shopTabName, shopTabName, tabInventory2, nothing, nothing, tabInventory, nothing, nothing, nothing, nothing,
		nothing, nothing, nothing, nothing, nothing, nothing, tabBalo, nothing, nothing, kham_nam1,
		kham_nam2, null, nothing, tabRPG, boxGD, nothing, nothing, nothing, nothing, nothing
	};

	private static int[] colorBorder0 = new int[6] { 18687, 16869, 15052, 13235, 11161, 9344 };

	private static int[] colorBorder1 = new int[6] { 45824, 39168, 32768, 26112, 19712, 13056 };

	private static int[] colorBorder2 = new int[6] { 16744192, 15037184, 13395456, 11753728, 10046464, 8404992 };

	private static int[] colorBorder3 = new int[6] { 13500671, 12058853, 10682572, 9371827, 7995545, 6684800 };

	private static int[] colorBorder4 = new int[6] { 16711705, 15007767, 13369364, 11730962, 10027023, 8388621 };

	private static int[][] colorBorder = new int[5][] { colorBorder0, colorBorder1, colorBorder2, colorBorder3, colorBorder4 };

	private static int[] size = new int[6] { 2, 1, 1, 1, 1, 1 };

	public static Image imgBroken;

	public static int hasUse;

	public static int hasUseBag;

	public int currentListLength;

	private int[] lastSelect;

	public static int[] mapId = new int[13]
	{
		21, 0, 1, 2, 24, 3, 4, 5, 6, 27,
		28, 29, 30
	};

	public static int[] mapX = new int[13]
	{
		24, 28, 92, 81, 49, 80, 131, 154, 199, 85,
		154, 208, 218
	};

	public static int[] mapY = new int[13]
	{
		27, 63, 48, 96, 98, 131, 137, 95, 36, 203,
		188, 167, 123
	};

	public static int[] mapIdNamek = new int[13]
	{
		22, 7, 8, 9, 25, 11, 12, 13, 10, 31,
		32, 33, 34
	};

	public static int[] mapXNamek = new int[13]
	{
		42, 26, 55, 29, 46, 115, 139, 188, 168, 145,
		198, 219, 203
	};

	public static int[] mapYNamek = new int[13]
	{
		62, 11, 110, 167, 208, 67, 37, 67, 9, 192,
		202, 99, 156
	};

	public static int[] mapIdSayai = new int[0];

	public static int[] mapXSayai = new int[0];

	public static int[] mapYSayai = new int[0];

	private Item currItem;

	public Clan currClan;

	public Clan[] clans;

	public Clan[] topClans;

	public MyVector member;

	public MyVector myMember;

	public Item[] clansShop;

	public Item[] clansStatus;

	public Command cmdClose;

	public Command cmdFindRoom;

	public static Image tabshop0;

	public static Image tabshop1;

	public static Image tabshop2;

	public static Image item;

	public static Image itemFocus;

	public static Image tabshopSmall0;

	public static Image tabshopSmall1;

	public static Image itemEquip;

	public static Image goc;

	public static Image coin;

	public static Image gold;

	public static Image loa;

	public static Image bua0;

	public static Image bua1;

	public static Image socket;

	public static Image[] imgUpgrade;

	public sbyte currShopPage;

	public sbyte maxShopPage;

	public static int WIDTH_PANEL = 176;

	public static int H_WIDTH_PANEL = 88;

	private int position;

	public int xScroll;

	public int yScroll;

	public int wScroll;

	public int hScroll;

	public ChatPopupNR cp;

	public int idIcon;

	public int[] partID;

	private int curFocus;

	public int w;

	private int pa;

	private int selected;

	private int cSelected;

	private bool isClanOption;

	public bool isSearchClan;

	public bool isMessage;

	private bool isInfomation;

	public bool isViewMember;

	private int pointerDownTime;

	private int pointerDownFirstX;

	private int[] pointerDownLastX = new int[3];

	private bool pointerIsDowning;

	private bool isDownWhenRunning;

	private bool wantUpdateList;

	private int waitToPerform;

	private int cmRun;

	private int tick;

	private int maxTick;

	private bool isMultiItem;

	private int pa1;

	private int pa2;

	private bool trans;

	public ClanMessage currMess;

	public int indexMouse = -1;

	public string[][] clansOption;

	public string clanInfo = string.Empty;

	public string clanReport = string.Empty;

	public int nMail;

	private int cmvx;

	private int cmdx;

	private bool justRelease;

	public static string[] strMoney = new string[4] { "0", "100-1000", "1000-10000", "10000-50000" };

	public bool[] isCheckMoneyFilter = new bool[4];

	private bool btnCannotPress;

	private int yCommand;

	private int sizeCommand;

	private int dxCommand;

	private int indexCommand;

	private int deltaH;

	private int deltaHmax;

	public MyVector listMail = new MyVector(string.Empty);

	private string[] strAbility = new string[6] { "Sinh lực", "Phòng thủ", "Tấn công", "May mắn", "Đồng đội", "Tốc độ" };

	private CPlayer plInfo;

	private int amount;

	private int pointLeft;

	private int[] currAbility;

	private int[] curPointAdd = new int[6];

	public static Image imgPopUp;

	public static Image imgPopUp2;

	private int currentButtonPress;

	public static int xstart;

	public static int ystart;

	public static int popupW = 140;

	public static int popupH = 160;

	public static int cmySK;

	public static int cmtoYSK;

	public static int cmdySK;

	public static int cmvySK;

	public static int cmyLimSK;

	public static int popupY;

	public static int popupX;

	public static int isborderIndex;

	public static int isselectedRow;

	public static int indexSize = 28;

	public static int indexTitle = 0;

	public static int indexSelect = 0;

	public static int indexRow = -1;

	public static int indexRowMax;

	public static int indexMenu = 0;

	public static int columns = 6;

	public static int rows;

	public static int inforX;

	public static int inforY;

	public static int inforW;

	public static int inforH;

	private int yPaint;

	private int xMap;

	private int yMap;

	private int xMapTask;

	private int yMapTask;

	private int xMove;

	private int yMove;

	public bool isClose;

	public bool isDetail;

	public bool updateCmy;

	private int cmvxDelta;

	private int cmdxDelta;

	public bool isFindRoom;

	private int selectedShop;

	private int tShop;

	private string[] detail;

	private string[] titleMail;

	private MyVector command;

	private string[][] splitCommand;

	private sbyte typeShop;

	public TabClanIcon tabIcon;

	private bool isLoki;

	private bool isHawk;

	private bool isUltron;

	private bool isThor;

	private static string[] strFunction = new string[4]
	{
		string.Empty,
		"Chọn chiến trường",
		"Chọn tiền cược",
		"Thoát"
	};

	public MyVector vFriend;

	public MyVector roomList;

	public MyVector vAchievement;

	private CPlayer charInfo;

	public Member currMem;

	private MyVector shopBietDoi;

	private string[] des1;

	private string[] des2;

	private int ch;

	private int cy;

	private int sayWidth = WIDTH_PANEL - 2;

	public int[] currIndexShop;

	public short[] ability = new short[6];

	public sbyte[] tisoPoint = new sbyte[6];

	private bool flagSocket;

	public bool topClanMember;

	public static string boardName;

	public static string boardName2 = string.Empty;

	private int[] zoneColor = new int[3] { 43520, 14743570, 14155776 };

	public static int[] zones;

	public static int[] pts;

	public static int[] numPlayer;

	public static int[] maxPlayer;

	public MyVector vMyGD = new MyVector("vMyGD");

	public MyVector vFriendGD = new MyVector("vFriendGD");

	public bool isLock;

	public bool isFriendLock;

	public bool isAccept;

	public bool isFriendAccep;

	private static string[][] boxGD = new string[3][]
	{
		L.inventory,
		L.item_give,
		L.item_receive
	};

	public int moneyGD;

	public int friendMoneyGD;

	public CPlayer charMenu;

	public Panel()
	{
		init();
		cmdFindRoom = new Command("Tìm khu\nvực", this, 1094, null);
		cmdClose = new Command(string.Empty, this, 1009, null);
		if (tabshop0 == null)
		{
			tabshop0 = CCanvas.loadImage("/gui2/tabshop0.png");
		}
		if (tabshop1 == null)
		{
			tabshop1 = CCanvas.loadImage("/gui2/tabshop1.png");
		}
		if (tabshop2 == null)
		{
			tabshop2 = CCanvas.loadImage("/gui2/tabshop2.png");
		}
		if (tabshopSmall0 == null)
		{
			tabshopSmall0 = CCanvas.loadImage("/gui2/tabshops0.png");
		}
		if (tabshopSmall1 == null)
		{
			tabshopSmall1 = CCanvas.loadImage("/gui2/tabshops1.png");
		}
		if (item == null)
		{
			item = CCanvas.loadImage("/gui2/it.png");
		}
		if (itemEquip == null)
		{
			itemEquip = CCanvas.loadImage("/gui2/itequip.png");
		}
		if (itemFocus == null)
		{
			itemFocus = CCanvas.loadImage("/gui2/itf.png");
		}
		if (goc == null)
		{
			goc = CCanvas.loadImage("/gui2/bd3.png");
		}
		if (coin == null)
		{
			coin = CCanvas.loadImage("/imgMoney.png");
		}
		if (gold == null)
		{
			gold = CCanvas.loadImage("/imgDiamond.png");
		}
		if (loa == null)
		{
			loa = CCanvas.loadImage("/gui2/loa.png");
		}
		if (imgBroken == null)
		{
			imgBroken = CCanvas.loadImage("/gui2/22.png");
		}
		if (bua0 == null)
		{
			bua0 = CCanvas.loadImage("/gui2/bua0.png");
		}
		if (bua1 == null)
		{
			bua1 = CCanvas.loadImage("/gui2/bua1.png");
		}
		if (socket == null)
		{
			socket = CCanvas.loadImage("/gui2/socket.png");
		}
	}

	public static void load()
	{
		if (imgUpgrade == null)
		{
			imgUpgrade = new Image[6];
			for (int i = 0; i < imgUpgrade.Length; i++)
			{
				imgUpgrade[i] = CCanvas.loadImage("/item/" + i + ".png");
			}
		}
	}

	public static void unload()
	{
		imgUpgrade = null;
	}

	public static void loadImage()
	{
		imgPopUp = CCanvas.loadImage("/gui2/imgPopup2.png");
		imgPopUp2 = CCanvas.loadImage("/gui2/imgPopup1.png");
		imgIcon = CCanvas.loadImage("/gui/icon.png");
		imgRoomStat = CCanvas.loadImage("/gui/stat.png");
	}

	public void init()
	{
		lastTabIndex = new int[tabName.Length];
		for (int i = 0; i < lastTabIndex.Length; i++)
		{
			lastTabIndex[i] = -1;
		}
	}

	public void getMaterialIcon(int id, Image img)
	{
	}

	private void setPosNoTab()
	{
		if (position == 0)
		{
			xScroll = 2;
			yScroll = 30;
			wScroll = W - 4;
			hScroll = H - 52;
			cmx = wScroll;
			cmtoX = 0;
			X = 0;
		}
		else if (position == 1)
		{
			wScroll = W - 4;
			xScroll = CCanvas.w - wScroll;
			yScroll = 30;
			hScroll = H - 52;
			X = xScroll - 2;
			cmx = -(CCanvas.w + W);
			cmtoX = CCanvas.w - W;
		}
		if (type == 4)
		{
			hScroll = H - 32;
		}
	}

	private void setPos()
	{
		if (position == 0)
		{
			xScroll = 2;
			yScroll = 60;
			wScroll = W - 4;
			hScroll = H - 81;
			cmx = wScroll;
			cmtoX = 0;
			X = 0;
		}
		else if (position == 1)
		{
			wScroll = W - 4;
			xScroll = CCanvas.w - wScroll;
			yScroll = 60;
			hScroll = H - 81;
			X = xScroll - 2;
			cmx = -(CCanvas.w + W);
			cmtoX = CCanvas.w - W;
		}
	}

	public void setType(int position)
	{
		currentTabIndex = 0;
		if (lastTabIndex[type] != -1)
		{
			currentTabIndex = lastTabIndex[type];
		}
		W = WIDTH_PANEL;
		H = CCanvas.h;
		Y = 0;
		ITEM_HEIGHT = 24;
		this.position = position;
		setPos();
		currentTabName = tabName[type];
		if (currentTabName.Length > 4)
		{
			TAB_W = 35;
		}
		else
		{
			TAB_W = 42;
		}
		startTabPos = xScroll + wScroll / 2 - currentTabName.Length * TAB_W / 2;
		tabDistance = (W - currentTabName.Length * TAB_W) / (currentTabName.Length + 1);
		lastSelect = new int[currentTabName.Length];
		cmyLast = new int[currentTabName.Length];
		for (int i = 0; i < currentTabName.Length; i++)
		{
			lastSelect[i] = (CCanvas.isTouch ? (-1) : 0);
		}
		if (type != 19 && type != 20)
		{
			if (CPlayer.arrItemKhamNam[0] != null)
			{
				CPlayer.arrItemBag[CPlayer.arrItemKhamNam[0].iInBag].isKhamNam = false;
				CPlayer.arrItemKhamNam[0] = null;
			}
			if (CPlayer.arrItemKhamNam[1] != null)
			{
				CPlayer.arrItemBag[CPlayer.arrItemKhamNam[1].iInBag].isKhamNam = false;
				CPlayer.arrItemKhamNam[1] = null;
			}
			if (CPlayer.arrItemKhamNam[2] != null)
			{
				CPlayer.arrItemBag[CPlayer.arrItemKhamNam[2].iInBag].isKhamNam = false;
				CPlayer.arrItemKhamNam[2] = null;
			}
			if (CPlayer.arrItemKhamNam[3] != null)
			{
				CPlayer.arrItemBag[CPlayer.arrItemKhamNam[3].iInBag].isKhamNam = false;
				CPlayer.arrItemKhamNam[3] = null;
			}
		}
	}

	public void show()
	{
		ch = ITEM_HEIGHT;
		tick = 0;
		maxTick = 4;
		tShop = -1;
		selectedShop = -1;
		amount = 1;
		curFocus = -1;
		if (CCanvas.isTouch)
		{
			cmdClose.x = 156;
			cmdClose.y = 3;
		}
		else
		{
			cmdClose.x = CCanvas.w - 19;
			cmdClose.y = CCanvas.h - 19;
		}
		isShow = true;
		isClose = false;
		if (this == CCanvas.panel)
		{
			Music.play(Music.POPUP, 10f);
		}
	}

	private void buy()
	{
		if (selected == -1)
		{
			return;
		}
		CCanvas.clearKeyPressed();
		CCanvas.clearKeyHold();
		switch (currentTabIndex)
		{
		case 0:
			if (CPlayer.arrItemShop[currentTabIndex][selected].price > 0)
			{
				perform(1003, null);
			}
			else if (CPlayer.arrItemShop[currentTabIndex][selected].price2 > 0)
			{
				perform(1004, null);
			}
			break;
		case 1:
			break;
		case 2:
			break;
		}
	}

	public void updateBuyMultiItems()
	{
		isMultiItem = false;
		if (CCanvas.isTouch)
		{
			if (tShop > 0)
			{
				tShop--;
			}
			else
			{
				selectedShop = -1;
			}
		}
		if ((type != 0 && type != 1) || (currentTabIndex != 0 && currentTabIndex != 2))
		{
			return;
		}
		if (CCanvas.isPointerJustRelease)
		{
			tick = 0;
			maxTick = 4;
			if (CCanvas.isPointer(36, 32, 24, 21))
			{
				CCanvas.clearAllPointerEvent();
				if (selected != -1)
				{
					amount++;
					selectedShop = 0;
					tShop = 5;
					isMultiItem = true;
				}
			}
			else
			{
				if (!CCanvas.isPointer(116, 32, 24, 21))
				{
					return;
				}
				CCanvas.clearAllPointerEvent();
				if (selected != -1)
				{
					amount--;
					if (amount < 1)
					{
						amount = 1;
					}
					selectedShop = 1;
					tShop = 5;
					isMultiItem = true;
				}
			}
		}
		else
		{
			if (!CCanvas.isPointerDown)
			{
				return;
			}
			tick++;
			if (CCanvas.isPointer(36, 32, 24, 21))
			{
				if (selected != -1 && tick > maxTick)
				{
					if (maxTick > 0)
					{
						maxTick--;
					}
					tick = 0;
					amount++;
					selectedShop = 0;
					tShop = 5;
					isMultiItem = true;
				}
			}
			else if (CCanvas.isPointer(116, 32, 24, 21) && selected != -1 && tick > maxTick)
			{
				if (maxTick > 0)
				{
					maxTick--;
				}
				tick = 0;
				amount--;
				if (amount < 1)
				{
					amount = 1;
				}
				selectedShop = 1;
				tShop = 5;
				isMultiItem = true;
			}
		}
	}

	public void updateKey()
	{
		if (isClose || !isShow || InfoDlg.isShow)
		{
			return;
		}
		if (tabIcon != null && tabIcon.isShow)
		{
			tabIcon.updateKey();
			CCanvas.clearKeyPressed();
			CCanvas.clearKeyHold();
			return;
		}
		if (CCanvas.keyPressed[13])
		{
			if (isDetail)
			{
				closeDetail();
			}
			else
			{
				hide();
			}
			CCanvas.clearKeyPressed();
			return;
		}
		if ((CCanvas.keyPressed[12] || CCanvas.keyPressed[5]) && !isDetail && selected != -1)
		{
			isDetail = true;
			updateCmy = true;
			waitToPerform = 1;
			deltaH = (deltaHmax = 0);
			indexCommand = 0;
			CCanvas.clearKeyPressed();
		}
		if ((!CCanvas.isTouch && !isClanOption) || CCanvas.isTouch)
		{
			updateKeyInTabBar();
		}
		int num = type;
		if (num == 21)
		{
			updateKeyScrollView();
			if (currentTabIndex == 0)
			{
				updateKeyClansOption();
			}
		}
		else
		{
			updateKeyScrollView();
		}
	}

	private void updateKeyTool()
	{
		updateKeyScrollView();
	}

	private void updateKeySkill()
	{
		updateKeyScrollView();
	}

	private void updateKeyMap()
	{
		if (CCanvas.keyHold[2])
		{
			yMove -= 2;
			cmyMap = yMove - (yScroll + hScroll / 2);
		}
		if (CCanvas.keyHold[8])
		{
			yMove += 2;
			cmyMap = yMove - (yScroll + hScroll / 2);
		}
		if (CCanvas.keyHold[4])
		{
			xMove -= 2;
			cmxMap = xMove - wScroll / 2;
		}
		if (CCanvas.keyHold[6])
		{
			xMove += 2;
			cmxMap = xMove - wScroll / 2;
		}
		if (CCanvas.isPointerDown)
		{
			pointerIsDowning = true;
			if (!trans)
			{
				pa1 = cmxMap;
				pa2 = cmyMap;
				trans = true;
			}
			cmxMap = pa1 + (CCanvas.pxLast - CCanvas.px);
			cmyMap = pa2 + (CCanvas.pyLast - CCanvas.py);
		}
		if (CCanvas.isPointerJustRelease)
		{
			trans = false;
			CCanvas.pxLast = CCanvas.px;
			CCanvas.pyLast = CCanvas.py;
		}
		if (CCanvas.isPointerClick)
		{
			pointerIsDowning = false;
		}
		if (cmxMap < 0)
		{
			cmxMap = 0;
		}
		if (cmxMap > cmxMapLim)
		{
			cmxMap = cmxMapLim;
		}
		if (cmyMap < 0)
		{
			cmyMap = 0;
		}
		if (cmyMap > cmyMapLim)
		{
			cmyMap = cmyMapLim;
		}
	}

	private void updateKeyInDetail()
	{
		if (!isDetail || selected == -1 || command == null || command.size() == 0 || (type == 22 && btnCannotPress))
		{
			return;
		}
		if (CCanvas.keyPressed[6])
		{
			indexCommand++;
			if (indexCommand >= command.size())
			{
				indexCommand = 0;
			}
			CCanvas.keyPressed[6] = false;
		}
		if (CCanvas.keyPressed[4])
		{
			indexCommand--;
			if (indexCommand < 0)
			{
				indexCommand = command.size() - 1;
			}
			CCanvas.keyPressed[4] = false;
		}
		if (CCanvas.keyPressed[12] || CCanvas.keyPressed[5])
		{
			if (indexCommand == -1)
			{
				indexCommand = 0;
			}
			((Command)command.elementAt(indexCommand)).performAction();
		}
		if (CCanvas.isPointerJustRelease)
		{
			int num = command.size();
			int num2 = X + dxCommand;
			for (int i = 0; i < num; i++)
			{
				int num3 = yCommand;
				if (type != 28 && type != 29)
				{
					num3 -= cmy;
				}
				if (CCanvas.isPointer(num2, num3, 42, 24))
				{
					((Command)command.elementAt(i)).performAction();
					CCanvas.isPointerJustRelease = false;
					CCanvas.clearKeyHold();
					CCanvas.clearKeyPressed();
					CCanvas.clearAllPointerEvent();
					return;
				}
				num2 = num2 + dxCommand + 42;
			}
			if (CCanvas.isPointer(X, Y, W, H) && isDetail)
			{
				isDetail = false;
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				selected = -1;
				deltaH = (deltaHmax = 0);
				pointerIsDowning = false;
				CCanvas.isPointerJustRelease = false;
				CCanvas.clearKeyHold();
				CCanvas.clearKeyPressed();
				CCanvas.clearAllPointerEvent();
			}
		}
		if (!CCanvas.isPointerDown)
		{
			return;
		}
		int num4 = command.size();
		int num5 = X + dxCommand;
		for (int j = 0; j < num4; j++)
		{
			if (CCanvas.isPointer(num5, yCommand - cmtoY, 42, 24))
			{
				indexCommand = j;
				break;
			}
			num5 = num5 + dxCommand + 42;
		}
	}

	public ClanMessage getCurrMessage()
	{
		if (selected < 2)
		{
			return null;
		}
		if (selected > ClanMessage.vMessage.size() + 1)
		{
			return null;
		}
		return (ClanMessage)ClanMessage.vMessage.elementAt(selected - 2);
	}

	private void updateKeyClansOption()
	{
		if (selected == -1)
		{
			cSelected = -1;
		}
		else
		{
			if (currClanOption == null)
			{
				return;
			}
			if (CCanvas.keyPressed[4])
			{
				currMess = getCurrMessage();
				cSelected--;
				if (selected == 0 && cSelected < 0)
				{
					cSelected = currClanOption.Length - 1;
				}
				if (selected > 1 && isMessage && currMess.option != null && cSelected < 0)
				{
					cSelected = currMess.option.Length - 1;
				}
				CCanvas.keyPressed[6] = false;
			}
			else if (CCanvas.keyPressed[6])
			{
				cSelected++;
				if (selected == 0 && cSelected > currClanOption.Length - 1)
				{
					cSelected = 0;
				}
			}
		}
	}

	private void checkOptionSelect()
	{
		if (currentTabIndex != 0 || type != 21 || selected == -1)
		{
			return;
		}
		int num = 0;
		if (selected == 0)
		{
			num = xScroll + wScroll / 2 - clansOption.Length * TAB_W / 2;
			cSelected = (CCanvas.px - num) / TAB_W;
		}
		else
		{
			currMess = getCurrMessage();
			if (currMess != null)
			{
				if (currMess.option != null)
				{
					num = xScroll + wScroll - 2 - currMess.option.Length * 40;
					cSelected = (CCanvas.px - num) / 40;
				}
				if (currMess.type == 2)
				{
					ch = ITEM_HEIGHT;
				}
			}
		}
		if (CCanvas.px < num)
		{
			cSelected = -1;
		}
	}

	private void updateKeyClans()
	{
		updateKeyScrollView();
		updateKeyClansOption();
	}

	public void closeDetail()
	{
		if (type == 28 || type == 29)
		{
			CCanvas.isPointerJustRelease = false;
			hide();
			return;
		}
		CCanvas.isPointerJustRelease = false;
		isDetail = false;
		if (cmtoY > cmyLim)
		{
			cmtoY = cmyLim;
		}
		deltaH = (deltaHmax = 0);
	}

	private void getCurrClanOtion()
	{
		if (type != 21 || currentTabIndex != 0)
		{
			return;
		}
		isClanOption = false;
		CRes.outz("select= " + selected);
		if (selected == 0)
		{
			currClanOption = new int[clansOption.Length];
			for (int i = 0; i < currClanOption.Length; i++)
			{
				currClanOption[i] = i;
			}
			isClanOption = true;
		}
		else if (selected == 1)
		{
			isClanOption = false;
		}
		else if (!isSearchClan && selected > 0)
		{
			currClanOption = new int[1];
			for (int j = 0; j < currClanOption.Length; j++)
			{
				currClanOption[j] = j;
			}
			isClanOption = true;
		}
	}

	public void updateScroolMouse(int a)
	{
		bool flag = false;
		if (CCanvas.pxMouse > wScroll)
		{
			return;
		}
		if (indexMouse == -1)
		{
			indexMouse = selected;
		}
		if (a > 0)
		{
			indexMouse -= a;
			flag = true;
		}
		else if (a < 0)
		{
			indexMouse += -a;
			flag = true;
		}
		if (indexMouse < 0)
		{
			indexMouse = 0;
		}
		if (flag)
		{
			cmtoY = indexMouse * 12;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			if (cmtoY < 0)
			{
				cmtoY = 0;
			}
		}
	}

	private void updateKeyScrollView()
	{
		bool flag = false;
		if (isDetail)
		{
			updateKeyInDetail();
		}
		if (CCanvas.keyPressed[2])
		{
			flag = true;
			if (type == 0)
			{
				if (!isDetail || selected != 0)
				{
					selected--;
				}
				if (selected < 0)
				{
					if (currentTabIndex < CPlayer.arrItemShop.Length && Equals(CCanvas.panel) && maxPageShop[currentTabIndex] > 1)
					{
						if (currPageShop[currentTabIndex] <= 0)
						{
							GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(maxPageShop[currentTabIndex] - 1));
						}
						else
						{
							GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(currPageShop[currentTabIndex] - 1));
						}
						CCanvas.keyPressed[2] = false;
					}
					selected = 0;
					if (isClanOption)
					{
						selected = -1;
					}
				}
			}
			else
			{
				selected--;
				if (selected > 0 && type == 8)
				{
					RoomInfo roomInfo = (RoomInfo)roomList.elementAt(selected);
					if (roomInfo.id == -1)
					{
						selected--;
					}
				}
				if (selected < 0)
				{
					selected = currentListLength - 1;
					if (type == 21 && currentTabIndex == 2 && maxShopPage > 1)
					{
						if (currShopPage <= 0)
						{
							GameService.gI().shopClan((sbyte)(maxShopPage - 1));
						}
						else
						{
							GameService.gI().shopClan((sbyte)(currShopPage - 1));
						}
						CCanvas.keyPressed[2] = false;
						return;
					}
					if (isClanOption)
					{
						selected = -1;
					}
				}
			}
			lastSelect[currentTabIndex] = selected;
			cSelected = 0;
			isDetail = false;
			ch = ITEM_HEIGHT;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			getCurrClanOtion();
			CCanvas.keyPressed[2] = false;
		}
		else if (CCanvas.keyPressed[8])
		{
			flag = true;
			if (type == 0)
			{
				if (!isDetail || selected != currentListLength - 1)
				{
					selected++;
				}
				if (selected > currentListLength - 1)
				{
					if (currentTabIndex < CPlayer.arrItemShop.Length && Equals(CCanvas.panel) && maxPageShop[currentTabIndex] > 1)
					{
						if (currPageShop[currentTabIndex] >= maxPageShop[currentTabIndex] - 1)
						{
							GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], 0);
						}
						else
						{
							GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(currPageShop[currentTabIndex] + 1));
						}
						CCanvas.keyPressed[8] = false;
						return;
					}
					selected = 0;
				}
			}
			else
			{
				selected++;
				if (type == 8 && selected < roomList.size() - 1)
				{
					RoomInfo roomInfo2 = (RoomInfo)roomList.elementAt(selected);
					if (roomInfo2.id == -1)
					{
						selected++;
					}
				}
				if (selected > currentListLength - 1)
				{
					if (type == 21 && currentTabIndex == 2 && maxShopPage > 1)
					{
						if (currShopPage >= maxShopPage - 1)
						{
							GameService.gI().shopClan(0);
						}
						else
						{
							GameService.gI().shopClan((sbyte)(currShopPage + 1));
						}
						CCanvas.keyPressed[8] = false;
						return;
					}
					selected = 0;
				}
			}
			lastSelect[currentTabIndex] = selected;
			cSelected = 0;
			isDetail = false;
			ch = ITEM_HEIGHT;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			getCurrClanOtion();
			CCanvas.keyPressed[8] = false;
		}
		if (flag)
		{
			cmtoY = selected * ITEM_HEIGHT - hScroll / 2;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			if (cmtoY < 0)
			{
				cmtoY = 0;
			}
			if (selected == currentListLength || selected == 0)
			{
				cmy = cmtoY;
			}
		}
		if (CCanvas.isPointerDown)
		{
			justRelease = false;
			if (!pointerIsDowning && CCanvas.isPointer(xScroll, yScroll, wScroll, hScroll))
			{
				for (int i = 0; i < pointerDownLastX.Length; i++)
				{
					pointerDownLastX[0] = CCanvas.py;
				}
				pointerDownFirstX = CCanvas.py;
				pointerIsDowning = true;
				isDownWhenRunning = cmRun != 0;
				cmRun = 0;
			}
			else if (pointerIsDowning && !isDetail)
			{
				pointerDownTime++;
				if (pointerDownTime > 5 && pointerDownFirstX == CCanvas.py && !isDownWhenRunning)
				{
					selected = (cmtoY + CCanvas.py - yScroll) / ITEM_HEIGHT;
					if (selected >= currentListLength)
					{
						selected = -1;
					}
					checkOptionSelect();
					isDetail = false;
					deltaH = (deltaHmax = 0);
					if (cmtoY > cmyLim)
					{
						cmtoY = cmyLim;
					}
				}
				else
				{
					indexMouse = -1;
				}
				int num = CCanvas.py - pointerDownLastX[0];
				if (num != 0 && selected != -1)
				{
					selected = -1;
					cSelected = -1;
				}
				for (int num2 = pointerDownLastX.Length - 1; num2 > 0; num2--)
				{
					pointerDownLastX[num2] = pointerDownLastX[num2 - 1];
				}
				pointerDownLastX[0] = CCanvas.py;
				cmtoY -= num;
				if (cmtoY < 0)
				{
					cmtoY = 0;
				}
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				if (cmy < 0 || cmy > cmyLim)
				{
					num /= 2;
				}
				cmy -= num;
				if (cmy < -(CCanvas.h / 3))
				{
					wantUpdateList = true;
				}
				else
				{
					wantUpdateList = false;
				}
			}
		}
		if (!CCanvas.isPointerJustRelease || !pointerIsDowning)
		{
			return;
		}
		justRelease = true;
		int i2 = CCanvas.py - pointerDownLastX[0];
		CCanvas.isPointerJustRelease = false;
		if (CRes.abs(i2) < 20 && CRes.abs(CCanvas.py - pointerDownFirstX) < 20 && !isMultiItem)
		{
			cmRun = 0;
			cmtoY = cmy;
			pointerDownFirstX = -1000;
			if (!isDetail)
			{
				selected = (cmtoY + CCanvas.py - yScroll) / ITEM_HEIGHT;
				isDetail = true;
				updateCmy = true;
				if (selected >= currentListLength)
				{
					selected = -1;
					isDetail = false;
					if (cmtoY > cmyLim)
					{
						cmtoY = cmyLim;
					}
					deltaH = (deltaHmax = 0);
					updateCmy = false;
				}
				checkOptionSelect();
				pointerDownTime = 0;
				waitToPerform = 1;
				deltaH = (deltaHmax = 0);
			}
			else
			{
				if (type == 22)
				{
					if (!btnCannotPress && command != null)
					{
						int num3 = command.size();
						int num4 = X + dxCommand;
						for (int j = 0; j < num3; j++)
						{
							if (CCanvas.isPointer(num4, yCommand - cmtoY, 42, 24))
							{
								((Command)command.elementAt(j)).performAction();
								CCanvas.isPointerJustRelease = false;
								CCanvas.clearKeyHold();
								CCanvas.clearKeyPressed();
								CCanvas.clearAllPointerEvent();
								pointerIsDowning = false;
								pointerDownTime = 0;
								CCanvas.isPointerJustRelease = false;
								return;
							}
							num4 = num4 + dxCommand + 42;
						}
					}
				}
				else if (command != null)
				{
					int num5 = command.size();
					int num6 = X + dxCommand;
					for (int k = 0; k < num5; k++)
					{
						if (CCanvas.isPointer(num6, yCommand - cmtoY, 42, 24))
						{
							((Command)command.elementAt(k)).performAction();
							CCanvas.isPointerJustRelease = false;
							CCanvas.clearKeyHold();
							CCanvas.clearKeyPressed();
							CCanvas.clearAllPointerEvent();
							pointerIsDowning = false;
							pointerDownTime = 0;
							CCanvas.isPointerJustRelease = false;
							return;
						}
						num6 = num6 + dxCommand + 42;
					}
				}
				selected = -1;
				isDetail = false;
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				deltaH = (deltaHmax = 0);
				updateCmy = false;
			}
		}
		else if (selected != -1 && pointerDownTime > 5)
		{
			justRelease = true;
			pointerDownTime = 0;
			waitToPerform = 1;
			deltaH = (deltaHmax = 0);
		}
		else if (selected == -1 && !isDownWhenRunning)
		{
			justRelease = true;
			if (cmy < 0)
			{
				cmtoY = 0;
			}
			else if (cmy > cmyLim)
			{
				cmtoY = cmyLim;
			}
			else
			{
				int num7 = CCanvas.py - pointerDownLastX[0] + (pointerDownLastX[0] - pointerDownLastX[1]) + (pointerDownLastX[1] - pointerDownLastX[2]);
				num7 = ((num7 > 10) ? 10 : ((num7 < -10) ? (-10) : 0));
				cmRun = -num7 * 100;
			}
		}
		pointerIsDowning = false;
		pointerDownTime = 0;
		CCanvas.isPointerJustRelease = false;
	}

	private void updateKeyInTabBar()
	{
		if (pointerIsDowning)
		{
			return;
		}
		int num = currentTabIndex;
		if (!isDetail)
		{
			if (CCanvas.keyPressed[6])
			{
				currentTabIndex++;
				if (currentTabIndex >= currentTabName.Length)
				{
					if (CCanvas.panel2 != null)
					{
						currentTabIndex = currentTabName.Length - 1;
						CCanvas.isFocusPanel2 = true;
					}
					else
					{
						currentTabIndex = 0;
					}
				}
				selected = lastSelect[currentTabIndex];
				lastTabIndex[type] = currentTabIndex;
				CCanvas.keyPressed[6] = false;
			}
			if (CCanvas.keyPressed[4])
			{
				currentTabIndex--;
				if (currentTabIndex < 0)
				{
					currentTabIndex = currentTabName.Length - 1;
				}
				if (CCanvas.isFocusPanel2)
				{
					CCanvas.isFocusPanel2 = false;
				}
				selected = lastSelect[currentTabIndex];
				lastTabIndex[type] = currentTabIndex;
				CCanvas.keyPressed[4] = false;
			}
		}
		if (CCanvas.isPointerJustRelease)
		{
			int num2 = 0;
			for (int i = 0; i < currentTabName.Length; i++)
			{
				num2 += tabDistance;
				if (CCanvas.isPointer(i * TAB_W + num2, 2, TAB_W, 25))
				{
					currentTabIndex = i;
					lastTabIndex[type] = i;
					CCanvas.isPointerJustRelease = false;
					selected = lastSelect[currentTabIndex];
					break;
				}
			}
		}
		if (num == currentTabIndex)
		{
			return;
		}
		switch (type)
		{
		case 21:
			topClanMember = false;
			if (currentTabIndex == 0)
			{
				setTabClans();
			}
			if (currentTabIndex == 1)
			{
				setTabTopClans();
			}
			if (currentTabIndex == 2)
			{
				setTabShopClans();
			}
			if (currentTabIndex == 3)
			{
				setTabClansStatus();
			}
			break;
		case 0:
		{
			int num3 = cmx;
			setTabShop();
			cmx = (cmtoX = num3);
			break;
		}
		case 1:
		{
			int num4 = cmx;
			setTabShop();
			cmx = (cmtoX = num4);
			break;
		}
		case 5:
			setTabInventoryWithMyEquip();
			break;
		case 2:
			if (currentTabIndex == 0)
			{
				setTabInventory();
				break;
			}
			currentListLength = CPlayer.arrItemBalo.Length;
			setCmy();
			break;
		case 18:
			setTabTop();
			break;
		case 16:
			if (currentTabIndex == 0)
			{
				currentListLength = CPlayer.arrItemBalo.Length;
			}
			else
			{
				currentListLength = strFunction.Length;
			}
			setCmy();
			break;
		case 19:
			if (currentTabIndex == 0)
			{
				currentListLength = CPlayer.arrItemKhamNam.Length;
			}
			else
			{
				currentListLength = CPlayer.arrItemGhepNgoc.Length;
			}
			setCmy();
			break;
		case 20:
			if (currentTabIndex == 0)
			{
				currentListLength = CPlayer.arrItemKhamNam.Length;
			}
			else if (currentTabIndex == 1)
			{
				currentListLength = CPlayer.arrItemGhepNgoc.Length;
			}
			else
			{
				setTabMyEquip();
			}
			setCmy();
			break;
		case 23:
			if (currentTabIndex == 0)
			{
				setTabMyEquip();
			}
			else if (currentTabIndex == 1)
			{
				currentListLength = CPlayer.arrItemBalo.Length;
			}
			else if (currentTabIndex == 2)
			{
				currentListLength = CPlayer.arrItemBox.Length;
			}
			else
			{
				currentListLength = strFunction.Length;
			}
			setCmy();
			break;
		case 24:
			if (currentTabIndex == 0)
			{
				if (Equals(CCanvas.panel))
				{
					setTabMyEquip();
				}
				else if (Equals(CCanvas.panel2))
				{
					setTabGiaoDich(false);
				}
			}
			if (currentTabIndex == 1)
			{
				setTabGiaoDich(true);
			}
			if (currentTabIndex == 2)
			{
				setTabGiaoDich(false);
			}
			break;
		}
		selected = lastSelect[currentTabIndex];
		if (isDetail)
		{
			isDetail = false;
			deltaH = (deltaHmax = 0);
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
		}
		CCanvas.clearKeyHold();
		CCanvas.clearKeyPressed();
		CCanvas.clearAllPointerEvent();
	}

	public void setTabShopClans()
	{
		currentListLength = 0;
		if (clansShop != null)
		{
			currentListLength = clansShop.Length;
			CRes.outz("currListLent= " + clansShop.Length);
			selected = (CCanvas.isTouch ? (-1) : 0);
		}
		selected = (CCanvas.isTouch ? (-1) : 0);
		setCmy();
	}

	private void setCmy()
	{
		cmyLim = currentListLength * ITEM_HEIGHT - hScroll;
		if (cmyLim < 0)
		{
			cmyLim = 0;
		}
		cmy = (cmtoY = cmyLast[currentTabIndex]);
		if (cmy < 0)
		{
			cmy = (cmtoY = 0);
		}
		if (cmy > cmyLim)
		{
			cmy = (cmtoY = cmyLim);
		}
		selected = (CCanvas.isTouch ? (-1) : 0);
		isDetail = false;
		deltaH = (deltaHmax = 0);
		if (cmtoY > cmyLim)
		{
			cmtoY = cmyLim;
		}
	}

	public void setTabShop()
	{
		isClanOption = false;
		ITEM_HEIGHT = 24;
		if (currentTabIndex == currentTabName.Length - 1 && CCanvas.panel2 == null)
		{
			currentListLength = CPlayer.arrItemBag.Length + 7;
		}
		else
		{
			if (currentTabIndex > CPlayer.arrItemShop.Length - 1)
			{
				currentTabIndex = CPlayer.arrItemShop.Length - 1;
			}
			currentListLength = CPlayer.arrItemShop[currentTabIndex].Length;
		}
		if (CCanvas.isTouch)
		{
			selected = -1;
		}
		else
		{
			selected = 0;
		}
		cmy = (cmtoY = 0);
		setCmy();
	}

	private void setTabShopBietDoi(MyVector vShop)
	{
		shopBietDoi = vShop;
		currentListLength = shopBietDoi.size();
		setCmy();
	}

	private void setTabMyEquip()
	{
		Item[] arrItemBody = CPlayer.arrItemBody;
		Item[] arrItemBag = CPlayer.arrItemBag;
		currentListLength = 7 + arrItemBag.Length;
		setCmy();
	}

	private void setTabKhamnam()
	{
		currentListLength = 4;
		setCmy();
	}

	private void setTabInventory()
	{
		if (currentTabIndex == 0)
		{
			currentListLength = CPlayer.arrItemBox.Length;
		}
		else
		{
			currentListLength = CPlayer.arrItemBalo.Length;
		}
		setCmy();
	}

	private void setTabInventoryWithMyEquip()
	{
		if (currentTabIndex == 0)
		{
			currentListLength = CPlayer.arrItemBox.Length;
		}
		else if (currentTabIndex == 1)
		{
			currentListLength = CPlayer.arrItemBalo.Length;
		}
		else
		{
			Item[] arrItemBody = CPlayer.arrItemBody;
			Item[] arrItemBag = CPlayer.arrItemBag;
			currentListLength = 7 + arrItemBag.Length;
		}
		setCmy();
	}

	private void setTabKhamNamWithMyEquip()
	{
		if (currentTabIndex == 0)
		{
			currentListLength = 4;
		}
		else
		{
			Item[] arrItemBody = CPlayer.arrItemBody;
			Item[] arrItemBag = CPlayer.arrItemBag;
			currentListLength = 7 + arrItemBag.Length;
		}
		setCmy();
	}

	public void setTabMail()
	{
		nMail = 0;
		if (listMail.size() == 0)
		{
			MsgInfo msgInfo = new MsgInfo();
			msgInfo.fromID = -9999;
			msgInfo.fromName = "Chat thế giới";
			msgInfo.message = string.Empty;
			listMail.addElement(msgInfo);
		}
		currentListLength = listMail.size();
		setCmy();
		if (listMail.size() > 0)
		{
			titleMail = new string[listMail.size()];
			for (int i = 0; i < listMail.size(); i++)
			{
				string[] array = ((i != 0) ? mFont.tahoma_7b_white.splitFontArray(((MsgInfo)listMail.elementAt(i)).message, WIDTH_PANEL - 10) : new string[1] { string.Empty });
				titleMail[i] = array[0];
			}
		}
	}

	private void setTabLevel()
	{
		setCmy();
	}

	public void moveCamera()
	{
		if (maxShopPage > 1 && justRelease && !InfoDlg.isShow)
		{
			if (cmy < -50)
			{
				justRelease = false;
				if (currShopPage <= 0)
				{
					GameService.gI().shopClan((sbyte)(maxShopPage - 1));
				}
				else
				{
					GameService.gI().shopClan((sbyte)(currShopPage - 1));
				}
			}
			else if (cmy > cmyLim + 50)
			{
				justRelease = false;
				if (currShopPage >= maxShopPage - 1)
				{
					GameService.gI().shopClan(0);
				}
				else
				{
					GameService.gI().shopClan((sbyte)(currShopPage + 1));
				}
			}
		}
		if (type == 0 && justRelease && Equals(CCanvas.panel) && currentTabIndex < CPlayer.arrItemShop.Length && maxPageShop[currentTabIndex] > 1 && !InfoDlg.isShow && maxPageShop[currentTabIndex] > 1 && !isDetail)
		{
			if (cmy < -50)
			{
				justRelease = false;
				if (currPageShop[currentTabIndex] <= 0)
				{
					GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(maxPageShop[currentTabIndex] - 1));
				}
				else
				{
					GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(currPageShop[currentTabIndex] - 1));
				}
			}
			else if (cmy > cmyLim + 50)
			{
				justRelease = false;
				if (currPageShop[currentTabIndex] >= maxPageShop[currentTabIndex] - 1)
				{
					GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], 0);
				}
				else
				{
					GameService.gI().requestTab((sbyte)currIndexShop[currentTabIndex], (sbyte)(currPageShop[currentTabIndex] + 1));
				}
			}
		}
		if (cmx != cmtoX && !pointerIsDowning)
		{
			cmvx = cmtoX - cmx << 2;
			cmdx += cmvx;
			cmx += cmdx >> 3;
			cmdx &= 15;
		}
		if (Math.abs(cmtoX - cmx) < 10)
		{
			cmx = cmtoX;
		}
		if (isClose)
		{
			isClose = false;
			cmtoX = wScroll;
		}
		if (cmtoX >= wScroll - 10 && cmx >= wScroll - 10 && position == 0)
		{
			isShow = false;
			if (type == 7)
			{
				unload();
			}
			clearVector();
		}
		if (cmRun != 0 && !pointerIsDowning)
		{
			cmtoY += cmRun / 100;
			if (cmtoY < 0)
			{
				cmtoY = 0;
			}
			else if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			else
			{
				cmy = cmtoY;
			}
			cmRun = cmRun * 9 / 10;
			if (cmRun < 100 && cmRun > -100)
			{
				cmRun = 0;
			}
		}
		if (cmy != cmtoY && !pointerIsDowning)
		{
			cmvy = cmtoY - cmy << 2;
			cmdy += cmvy;
			cmy += cmdy >> 4;
			cmdy &= 15;
		}
		cmyLast[currentTabIndex] = cmy;
	}

	private void clearVector()
	{
	}

	public void paint(mGraphics g)
	{
		g.translate(-g.getTranslateX(), -g.getTranslateY() + mGraphics.addYWhenOpenKeyBoard);
		g.translate(-cmx, 0);
		g.translate(X, Y);
		g.setClip(-1000, -1000, 2000, 2000);
		paintFrameSimple(X, Y, W, H, g);
		paintTopInfo(g);
		paintBottomMoneyInfo(g);
		paintTab(g);
		switch (type)
		{
		case 18:
			paintTop(g);
			break;
		case 0:
		case 1:
			if (currentTabIndex == CPlayer.arrItemShop.Length)
			{
				paintMyEquip(g);
			}
			else
			{
				paintShopEquip(g);
			}
			break;
		case 4:
			paintMyEquip(g);
			break;
		case 2:
			if (currentTabIndex == 0)
			{
				paintInventory(g);
			}
			else
			{
				paintBalo(g);
			}
			break;
		case 5:
			if (currentTabIndex == 0)
			{
				paintInventory(g);
			}
			else if (currentTabIndex == 1)
			{
				paintBalo(g);
			}
			else if (currentTabIndex == 2)
			{
				paintMyEquip(g);
			}
			break;
		case 6:
			paintMail(g);
			break;
		case 7:
			paintLevel(g);
			break;
		case 8:
			paintRoomList(g);
			break;
		case 9:
		case 10:
			paintFriend(g);
			break;
		case 28:
			paintPlayerInfo(g);
			break;
		case 29:
			paintMyInfo(g);
			break;
		case 11:
			paintMission(g);
			break;
		case 12:
			paintClan(g);
			break;
		case 13:
			paintClanMember(g);
			break;
		case 14:
			paintMoney(g);
			break;
		case 17:
			paintMap(g);
			break;
		case 26:
			paintMapFilter(g);
			break;
		case 27:
			paintMoneyFilter(g);
			break;
		case 15:
			paintBietdoi(g);
			break;
		case 16:
			if (currentTabIndex == 0)
			{
				paintBalo(g);
			}
			else
			{
				paintFunction(g);
			}
			break;
		case 23:
			if (currentTabIndex == 0)
			{
				paintMyEquip(g);
			}
			else if (currentTabIndex == 1)
			{
				paintBalo(g);
			}
			else if (currentTabIndex == 2)
			{
				paintInventory(g);
			}
			else
			{
				paintFunction(g);
			}
			break;
		case 19:
			if (currentTabIndex == 0)
			{
				paintKhamNam(g);
			}
			if (currentTabIndex == 1)
			{
				paintGhepNgoc(g);
			}
			break;
		case 20:
			if (currentTabIndex == 0)
			{
				paintKhamNam(g);
			}
			if (currentTabIndex == 1)
			{
				paintGhepNgoc(g);
			}
			if (currentTabIndex == 2)
			{
				paintMyEquip(g);
			}
			break;
		case 21:
			if (currentTabIndex == 0)
			{
				if (clansOption == null)
				{
					paintTopClans(g);
				}
				else
				{
					paintClans(g);
				}
			}
			if (currentTabIndex == 1)
			{
				paintTopClans(g);
			}
			if (currentTabIndex == 2)
			{
				paintShopClans(g);
			}
			if (currentTabIndex == 3)
			{
				paintClansStatus(g);
			}
			break;
		case 22:
			paintAchievement(g);
			break;
		case 24:
			if (currentTabIndex == 0)
			{
				if (Equals(CCanvas.panel))
				{
					paintMyEquip(g);
				}
				else
				{
					paintGiaoDich(g, false);
				}
			}
			if (currentTabIndex == 1)
			{
				paintGiaoDich(g, true);
			}
			if (currentTabIndex == 2)
			{
				paintGiaoDich(g, false);
			}
			break;
		case 25:
			paintZone(g);
			break;
		}
		CCanvas.resetTrans(g);
		paintDetail(g);
		g.translate(-g.getTranslateX(), -g.getTranslateY());
		if (cmx == cmtoX)
		{
			cmdClose.paint(g);
		}
		if (tabIcon != null && tabIcon.isShow)
		{
			tabIcon.paint(g);
		}
	}

	private void paintClansStatus(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		if (currentListLength == 0)
		{
			mFont.tahoma_7_green2.drawString(g, "Chưa có item đội", xScroll + wScroll / 2, yScroll + hScroll / 2 - mFont.tahoma_7.getHeight() / 2, 2);
			return;
		}
		g.translate(0, -cmy);
		g.setColor(0);
		CRes.outz("currList lent= " + currentListLength);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (clansStatus != null)
			{
				SmallImage.drawSmallImage(g, clansStatus[i].template.iconID, num + num3 / 2 - ((clansStatus[i].quantity > 1) ? 5 : 0), num2 + num4 / 2, 0, 3, true);
				int num8 = ((clansStatus[i].template.type == 5) ? 7 : 0);
				mFont2.drawString(g, clansStatus[i].template.name + ((clansStatus[i].level <= 0) ? string.Empty : (" +" + clansStatus[i].level)), num5 + num8, num6, 0);
				if (clansStatus[i].itemOption != null)
				{
					string optionString = clansStatus[i].itemOption[1].getOptionString();
					mFont2.drawString(g, optionString, num5 + num8, num6 + 11, 0);
				}
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintShopClans(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		if (maxShopPage > 1 && CCanvas.isTouch)
		{
			if (cmy < -50)
			{
				CCanvas.paintShukiren(xScroll + wScroll / 2, yScroll + 30, g);
			}
			else if (cmy < 0)
			{
				mFont.tahoma_7_grey.drawString(g, L.getDown(), xScroll + wScroll / 2, yScroll + 15, 2);
			}
			else if (cmyLim >= 0)
			{
				if (cmy > cmyLim + 50)
				{
					CCanvas.paintShukiren(xScroll + wScroll / 2, yScroll + hScroll - 30, g);
				}
				else if (cmy > cmyLim)
				{
					mFont.tahoma_7_grey.drawString(g, L.getUp(), xScroll + wScroll / 2, yScroll + hScroll - 25, 2);
				}
			}
		}
		g.translate(0, -cmy);
		g.setColor(0);
		if (clansShop == null)
		{
			mFont.tahoma_7_green2.drawString(g, L.pleaseWait(), xScroll + wScroll / 2, yScroll + hScroll / 2 - mFont.tahoma_7.getHeight() / 2, 2);
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (i >= clansShop.Length)
			{
				continue;
			}
			Item item = clansShop[i];
			if (item == null || item.template == null)
			{
				continue;
			}
			SmallImage.drawSmallImage(g, item.template.iconID, num + num3 / 2 - ((item.quantity > 1) ? 8 : 0), num2 + num4 / 2, 0, 3, true);
			int num8 = ((item.template.type == 5) ? 7 : 0);
			mFont2.drawString(g, clansShop[i].template.name + ((clansShop[i].level <= 0) ? string.Empty : (" +" + clansShop[i].level)), num5 + num8, num6, 0);
			if (clansShop[i].itemOption != null)
			{
				string optionString = clansShop[i].itemOption[1].getOptionString();
				mFont2.drawString(g, optionString, num5 + num8, num6 + 11, 0);
			}
			if (item.buyCoin > 0)
			{
				mFont.tahoma_7_yellow.drawString(g, item.strbuyCoin, num5 + num7 - 22, num6 + 7, 1, mFont.tahoma_7_grey);
				g.drawImage(coin, num5 + num7 - 19, num6 + 5, 0, true);
				if (item.buyGold > 0 && selected == i)
				{
					mFont.tahoma_7_yellow.drawString(g, item.strbuyGold, num5 + num7 - 22, num6 + 22, 1, mFont.tahoma_7_grey);
					g.drawImage(gold, num5 + num7 - 19, num6 + 21, 0, true);
				}
			}
			else if (item.buyGold > 0)
			{
				mFont.tahoma_7_yellow.drawString(g, item.strbuyGold, num5 + num7 - 22, num6 + 7, 1, mFont.tahoma_7_grey);
				g.drawImage(gold, num5 + num7 - 19, num6 + 6, 0, true);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintTopClans(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(-cmx, -cmy);
		g.setColor(0);
		int num = xScroll + wScroll / 2 - clansOption.Length * TAB_W / 2;
		if ((topClans == null && !topClanMember) || (topClans != null && topClans.Length == 0))
		{
			mFont.tahoma_7_green2.drawString(g, L.pleaseWait(), xScroll + wScroll / 2, yScroll + hScroll / 2 - mFont.tahoma_7.getHeight() / 2, 2);
			return;
		}
		if (this.member == null && topClanMember)
		{
			mFont.tahoma_7_green2.drawString(g, L.pleaseWait(), xScroll + wScroll / 2, yScroll + hScroll / 2 - mFont.tahoma_7.getHeight() / 2, 2);
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			int num2 = xScroll;
			int num3 = yScroll + i * ITEM_HEIGHT;
			int num4 = 24;
			int num5 = ITEM_HEIGHT - 1;
			int num6 = xScroll + num4;
			int num7 = yScroll + i * ITEM_HEIGHT;
			int num8 = wScroll - num4;
			int h = ITEM_HEIGHT - 1;
			if (num7 - cmy > yScroll + hScroll || num7 - cmy < yScroll - ITEM_HEIGHT)
			{
				continue;
			}
			mFont mFont2 = mFont.tahoma_7_grey;
			mFont mFont3 = mFont.tahoma_7b_dark;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_yellow;
				mFont3 = mFont.tahoma_7b_yellow;
				g.setClip(2 + X, num7, wScroll, num5 + deltaH);
			}
			if (i > selected)
			{
				num3 += deltaH;
				num7 += deltaH;
			}
			int color = ((i == selected) ? 24725 : ((CPlayer.myPlayer.clan != null && topClans[i].ID == CPlayer.myPlayer.clan.ID) ? 5373951 : ((i >= 3) ? 11657202 : 16759377)));
			if (topClanMember)
			{
				color = ((i != selected) ? 11657202 : 24725);
			}
			g.setColor(color);
			g.fillRect(2 + X, num7, WIDTH_PANEL, h, true);
			if (!topClanMember)
			{
				if (topClans != null)
				{
					if (topClans.Length == 0)
					{
						continue;
					}
					if (topClans[i].imgID >= 0)
					{
						SmallImage.drawSmallImage(g, topClans[i].imgID, num2 + num4 / 2, num3 + num5 / 2, 0, 3, true);
					}
					else
					{
						g.setColor(0);
						if (TabClanIcon.clanColor[-topClans[i].imgID] == 0)
						{
							g.setColor(16777215);
						}
						g.fillRect(num2 + num4 / 2 - 7 - 1, num7 - 1 + 8, 14, 8, true);
						g.setColor(TabClanIcon.clanColor[-topClans[i].imgID]);
						g.fillRect(num2 + num4 / 2 - 7, num7 + 8, 12, 6, true);
					}
					mFont3.drawString(g, topClans[i].rank + "." + topClans[i].name, num6 + 5, num7, 0);
					mFont2.drawString(g, topClans[i].sloganSplit + "...", num6 + 5, num7 + 11, 0);
					mFont2.drawString(g, L.level() + string.Empty + topClans[i].level + "+" + topClans[i].percent + "%", num6 + num8 - 5, num7 + 11, mFont.RIGHT);
				}
			}
			else
			{
				Member member = ((this.member == null) ? ((Member)myMember.elementAt(i)) : ((Member)this.member.elementAt(i)));
				Part part = CCanvas.parts[59];
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[0][0][0]].id, num2 + part.pi[CPlayer.CharInfo[0][0][0]].dx, num3 + 3 + part.pi[CPlayer.CharInfo[0][0][0]].dy, 0, 0, true);
				part = CCanvas.parts[member.head];
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[0][0][0]].id, num2 + part.pi[CPlayer.CharInfo[0][0][0]].dx, num3 + 3 + part.pi[CPlayer.CharInfo[0][0][0]].dy, 0, 0, true);
				mFont mFont4 = mFont.tahoma_7b_dark;
				if (member.role == 0)
				{
					mFont4 = ((i == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_red);
				}
				else if (member.role == 1)
				{
					mFont4 = ((i == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_green);
				}
				else if (member.role == 2)
				{
					mFont4 = ((i == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_green2);
				}
				mFont4.drawString(g, member.name, num6 + 5, num7, 0);
				mFont2.drawString(g, member.powerPoint, num6 + 5, num7 + 11, 0);
				mFont2.drawString(g, member.clanPoint + " " + L.diem(), num6 + num8 - 3, num7, 1);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num7 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintClans(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(-cmx, -cmy);
		g.setColor(0);
		int num = xScroll + wScroll / 2 - clansOption.Length * TAB_W / 2;
		if (currentListLength == 2)
		{
			mFont.tahoma_7_green2.drawString(g, clanReport, xScroll + wScroll / 2, yScroll + 24 + hScroll / 2 - mFont.tahoma_7.getHeight() / 2, 2);
			if (isMessage && myMember.size() == 1)
			{
				for (int i = 0; i < L.clanEmpty().Length; i++)
				{
					mFont.tahoma_7b_dark.drawString(g, L.clanEmpty()[i], xScroll + wScroll / 2, yScroll + 24 + hScroll / 2 - L.clanEmpty().Length * 12 / 2 + i * 12, mFont.CENTER);
				}
			}
		}
		for (int j = 0; j < currentListLength; j++)
		{
			int num2 = xScroll;
			int num3 = yScroll + j * ITEM_HEIGHT;
			int num4 = 24;
			int num5 = ITEM_HEIGHT - 1;
			int num6 = xScroll + num4;
			int num7 = yScroll + j * ITEM_HEIGHT;
			int num8 = wScroll - num4;
			int num9 = ITEM_HEIGHT - 1;
			if (num7 - cmy > yScroll + hScroll || num7 - cmy < yScroll - ITEM_HEIGHT)
			{
				continue;
			}
			switch (j)
			{
			case 0:
			{
				for (int k = 0; k < clansOption.Length; k++)
				{
					g.setColor((k != cSelected || j != selected) ? 11657202 : 24725);
					g.fillRect(num + k * TAB_W, num7, TAB_W - 1, 23, true);
					for (int l = 0; l < clansOption[k].Length; l++)
					{
						((k != cSelected || j != selected) ? mFont.tahoma_7_grey : mFont.tahoma_7_white).drawString(g, clansOption[k][l], num + k * TAB_W + TAB_W / 2, yScroll + l * 11, mFont.CENTER);
					}
				}
				continue;
			}
			case 1:
				g.setColor((j != selected) ? 11657202 : 24725);
				g.fillRect(xScroll, num7, wScroll, num9, true);
				if (clanInfo != null)
				{
					((j != selected) ? mFont.tahoma_7b_dark : mFont.tahoma_7b_white).drawString(g, clanInfo, xScroll + 5, num7 + 6, mFont.LEFT);
				}
				if (isViewMember)
				{
					((j != selected) ? mFont.tahoma_7b_dark : mFont.tahoma_7b_white).drawString(g, L.diem(), xScroll + wScroll - 5, num7 + 6, mFont.RIGHT);
				}
				continue;
			}
			mFont mFont2 = mFont.tahoma_7_grey;
			if (j == selected)
			{
				num9 = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num7, wScroll, num5 + deltaH);
			}
			if (j > selected)
			{
				num3 += deltaH;
				num7 += deltaH;
			}
			g.setColor((j != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num7, WIDTH_PANEL, num9, true);
			if (isSearchClan)
			{
				if (clans != null)
				{
					if (clans.Length == 0)
					{
						continue;
					}
					if (clans[j - 2] != null)
					{
						if (clans[j - 2].imgID >= 0)
						{
							SmallImage.drawSmallImage(g, clans[j - 2].imgID, num2 + num4 / 2, num3 + num5 / 2, 0, 3, true);
						}
						else
						{
							g.setColor(0);
							if (TabClanIcon.clanColor[-clans[j - 2].imgID] == 0)
							{
								g.setColor(16777215);
							}
							g.fillRect(num2 + num4 / 2 - 7 - 1, num7 - 1 + 8, 14, 8, true);
							g.setColor(TabClanIcon.clanColor[-clans[j - 2].imgID]);
							g.fillRect(num2 + num4 / 2 - 7, num7 + 8, 12, 6, true);
						}
						mFont2.drawString(g, clans[j - 2].name, num6 + 5, num7, 0);
						mFont2.drawString(g, clans[j - 2].slogan, num6 + 5, num7 + 11, 0);
						mFont2.drawString(g, clans[j - 2].currMember + "/" + clans[j - 2].maxMember, num6 + num8 - 5, num7, mFont.RIGHT);
					}
				}
			}
			else if (isViewMember)
			{
				Member member = ((this.member == null) ? ((Member)myMember.elementAt(j - 2)) : ((Member)this.member.elementAt(j - 2)));
				Part part = CCanvas.parts[59];
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[0][0][0]].id, num2 + part.pi[CPlayer.CharInfo[0][0][0]].dx, num3 + 3 + part.pi[CPlayer.CharInfo[0][0][0]].dy, 0, 0, true);
				part = CCanvas.parts[member.head];
				SmallImage.drawSmallImage(g, part.pi[CPlayer.CharInfo[0][0][0]].id, num2 + part.pi[CPlayer.CharInfo[0][0][0]].dx, num3 + 3 + part.pi[CPlayer.CharInfo[0][0][0]].dy, 0, 0, true);
				mFont mFont3 = mFont.tahoma_7b_dark;
				if (member.role == 0)
				{
					mFont3 = ((j == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_red);
				}
				else if (member.role == 1)
				{
					mFont3 = ((j == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_green);
				}
				else if (member.role == 2)
				{
					mFont3 = ((j == selected) ? mFont.tahoma_7b_white : mFont.tahoma_7b_green2);
				}
				mFont3.drawString(g, member.name, num6 + 5, num7, 0);
				mFont2.drawString(g, L.experience() + ": " + member.powerPoint, num6 + 5, num7 + 11, 0);
				mFont2.drawString(g, CRes.formatNumber(member.clanPoint), num6 + num8 - 3, num7, 1);
			}
			else if (isMessage && ClanMessage.vMessage.size() != 0)
			{
				ClanMessage clanMessage = (ClanMessage)ClanMessage.vMessage.elementAt(j - 2);
				clanMessage.paint(g, num2, num3, (j == selected) ? true : false);
				if (clanMessage.option != null)
				{
					int num10 = xScroll + wScroll - 2 - clanMessage.option.Length * 40;
					for (int m = 0; m < clanMessage.option.Length; m++)
					{
						if (j == selected)
						{
							if (m == cSelected)
							{
								g.drawImage(GameScr.imgLbtnFocus2, num10 + m * 40 + 20, num7 + num9 / 2, 3, true);
								mFont.tahoma_7_grey.drawString(g, clanMessage.option[m], num10 + m * 40 + 20, num7 + 6, mFont.CENTER);
							}
							else
							{
								g.drawImage(GameScr.imgLbtn2, num10 + m * 40 + 20, num7 + num9 / 2, 3, true);
								mFont.tahoma_7_grey.drawString(g, clanMessage.option[m], num10 + m * 40 + 20, num7 + 6, mFont.CENTER);
							}
						}
						else
						{
							g.drawImage(GameScr.imgLbtn2, num10 + m * 40 + 20, num7 + num9 / 2, 3, true);
							mFont.tahoma_7_grey.drawString(g, clanMessage.option[m], num10 + m * 40 + 20, num7 + 6, mFont.CENTER);
						}
					}
				}
			}
			if (j == selected)
			{
				paintDetail2(g, 2 + X, num7 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
		paintScrollArrow(g);
	}

	private void paintScrollArrow(mGraphics g)
	{
		g.translate(-g.getTranslateX(), -g.getTranslateY());
		if ((cmy > 24 && currentListLength > 0) || !Equals(CCanvas.panel) || typeShop != 2 || maxPageShop[currentTabIndex] > 1)
		{
		}
		if ((cmy >= cmyLim || currentListLength <= 0) && Equals(CCanvas.panel) && typeShop == 2 && maxPageShop[currentTabIndex] <= 1)
		{
		}
	}

	private void paintGhepNgoc(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < CPlayer.arrItemGhepNgoc.Length; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (CPlayer.arrItemGhepNgoc[i] != null)
			{
				SmallImage.drawSmallImage(g, CPlayer.arrItemGhepNgoc[i].template.iconID, num + num3 / 2, num2 + num4 / 2, 0, 3, true);
				int num8 = ((CPlayer.arrItemGhepNgoc[i].template.type == 5) ? 7 : 0);
				mFont2.drawString(g, CPlayer.arrItemGhepNgoc[i].template.name + ((CPlayer.arrItemGhepNgoc[i].level <= 0) ? string.Empty : (" +" + CPlayer.arrItemGhepNgoc[i].level)), num5 + 5 + num8, num6 + 5, 0);
				if (CPlayer.arrItemGhepNgoc[i].quantity > 1)
				{
					mFont.tahoma_7_yellow.drawString(g, CPlayer.arrItemGhepNgoc[i].quantity + string.Empty, num + 21, num2 + 10, 0, mFont.tahoma_7_grey);
				}
			}
			if (i == selected)
			{
				paintDetail3(g, num6, CPlayer.arrItemGhepNgoc[i]);
			}
		}
	}

	private void paintMap(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			int num8 = 0;
			for (int j = 0; j < MM.mapFiles.size(); j++)
			{
				MapFile mapFile = (MapFile)MM.mapFiles.elementAt(j);
				if (mapFile.mapName.StartsWith("Boss"))
				{
					num8++;
				}
			}
			MapFile mapFile2 = (MapFile)MM.mapFiles.elementAt((PrepareScr.currLevel == 4) ? (MM.mapFiles.size() - num8 + i) : i);
			mFont2.drawString(g, mapFile2.mapName, xScroll + 5, num6 + 5, 0);
			mFont2.drawString(g, mapFile2.mapW + "m x" + mapFile2.mapH + "m", xScroll + wScroll - 5, num6 + 5, 1);
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintMapFilter(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				mFont2 = mFont.tahoma_7_yellow;
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			int num8 = 0;
			for (int j = 0; j < MM.mapFiles.size(); j++)
			{
				MapFile mapFile = (MapFile)MM.mapFiles.elementAt(j);
				if (mapFile.mapName.StartsWith("Boss"))
				{
					num8++;
				}
			}
			MapFile mapFile2 = (MapFile)MM.mapFiles.elementAt(i);
			if (mapFile2.isCheckFilter)
			{
				g.drawRegion(imgIcon, 0, 0, 12, 14, 0, num + 10, num2 + 11, 3, true);
			}
			mFont2.drawString(g, mapFile2.mapName, xScroll + 20, num6 + 5, 0);
			mFont2.drawString(g, mapFile2.mapW + "m x" + mapFile2.mapH + "m", xScroll + wScroll - 5, num6 + 5, 1);
		}
	}

	private void paintMoneyFilter(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				mFont2 = mFont.tahoma_7_yellow;
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			int num8 = 0;
			for (int j = 0; j < MM.mapFiles.size(); j++)
			{
				MapFile mapFile = (MapFile)MM.mapFiles.elementAt(j);
				if (mapFile.mapName.StartsWith("Boss"))
				{
					num8++;
				}
			}
			if (isCheckMoneyFilter[i])
			{
				g.drawRegion(imgIcon, 0, 0, 12, 14, 0, num + 10, num2 + 11, 3, true);
			}
			mFont2.drawString(g, strMoney[i], xScroll + 20, num6 + 5, 0);
		}
	}

	private void paintCommandInDetails(mGraphics g, int cx, int cy)
	{
		if (command == null)
		{
			return;
		}
		int num = command.size();
		if (num == 0)
		{
			return;
		}
		dxCommand = (W - num * 42) / (num + 1);
		int num2 = dxCommand;
		for (int i = 0; i < num; i++)
		{
			if (i == indexCommand)
			{
				g.drawImage(tabshop1, num2, yCommand, 0, false);
			}
			else
			{
				g.drawImage(tabshop0, num2, yCommand, 0, false);
			}
			if (splitCommand[i].Length == 1)
			{
				mFont.tahoma_7.drawString(g, splitCommand[i][0], num2 + 21, yCommand + 8, 2);
			}
			else
			{
				for (int j = 0; j < splitCommand[i].Length; j++)
				{
					mFont.tahoma_7.drawString(g, splitCommand[i][j], num2 + 21, yCommand + j * 10 + 2, 2);
				}
			}
			num2 = num2 + dxCommand + 42;
		}
	}

	private void paintDetail2(mGraphics g, int cx, int cy)
	{
		if (flagSocket)
		{
			cy += 10;
		}
		if (!isDetail)
		{
			return;
		}
		switch (type)
		{
		case 11:
			return;
		case 17:
		{
			int num = 0;
			for (int i = 0; i < MM.mapFiles.size(); i++)
			{
				MapFile mapFile = (MapFile)MM.mapFiles.elementAt(i);
				if (mapFile.mapName.StartsWith("Boss"))
				{
					num++;
				}
			}
			MapFile mapFile2 = (MapFile)MM.mapFiles.elementAt((PrepareScr.currLevel == 4) ? (MM.mapFiles.size() - num + selected) : selected);
			paintPopUp(g, cx + (W >> 1) - 50, cy, 100, 50, 16777215, false);
			g.setClip(cx + (W >> 1) - 48, cy + 2, 96, 46);
			SmallImage.drawSmallImage(g, mapFile2.iconID, cx + (W >> 1), cy + 25, 0, 3, false);
			g.setClip(xScroll, yScroll + cmy, wScroll, hScroll);
			yCommand = cy + 62;
			paintCommandInDetails(g, cx, yCommand);
			return;
		}
		}
		if (des1 == null)
		{
			return;
		}
		int num2 = cy;
		int num3 = sayWidth + 2;
		int num4 = ch;
		if (cx <= 0 || num2 <= 0)
		{
			return;
		}
		int num5 = 3;
		int num6 = -1;
		for (int j = 0; j < des1.Length; j++)
		{
			if (des1[j].StartsWith("--"))
			{
				g.setColor(16777215);
				g.fillRect(cx + 10, cy + num5 + j * 12 + 6, num3 - 20, 1, true);
				continue;
			}
			mFont mFont2 = mFont.tahoma_7;
			int num7 = 2;
			string st = des1[j];
			int num8 = 0;
			if (des1[j].StartsWith("|"))
			{
				string[] array = CRes.split(des1[j], "|", 0);
				if (array.Length == 3)
				{
					st = array[2];
				}
				if (array.Length == 4)
				{
					st = array[3];
					num7 = int.Parse(array[2]);
				}
				num8 = int.Parse(array[1]);
				num6 = num8;
			}
			else
			{
				num8 = num6;
			}
			switch (num8)
			{
			case -1:
				mFont2 = mFont.tahoma_7;
				break;
			case 0:
				mFont2 = mFont.tahoma_7_white;
				break;
			case 1:
				mFont2 = mFont.tahoma_7b_green;
				break;
			case 2:
				mFont2 = mFont.tahoma_7b_blue;
				break;
			case 3:
				mFont2 = mFont.tahoma_7_yellow;
				break;
			case 4:
				mFont2 = mFont.tahoma_7_green;
				break;
			case 5:
				mFont2 = mFont.tahoma_7_blue;
				break;
			case 7:
				mFont2 = mFont.tahoma_7b_red;
				break;
			}
			int num9 = 0;
			switch (num7)
			{
			case 2:
				mFont2.drawString(g, st, cx + sayWidth / 2, cy + num5 + j * 12 - num9, num7);
				break;
			case 1:
				mFont2.drawString(g, st, cx + sayWidth - 10, cy + num5 + j * 12 - num9, num7);
				break;
			default:
				mFont2.drawString(g, st, cx + 10, cy + num5 + j * 12 - num9, num7);
				break;
			}
		}
		yCommand = cy + des1.Length * 12 + 8;
		int num10 = command.size();
		dxCommand = (num3 - num10 * 42) / (num10 + 1);
		int num11 = cx + dxCommand;
		for (int k = 0; k < num10; k++)
		{
			if (type == 22)
			{
				if (btnCannotPress)
				{
					g.drawImage(tabshop2, num11, yCommand, 0, true);
				}
				else if (k == indexCommand)
				{
					g.drawImage(tabshop1, num11, yCommand, 0, true);
				}
				else
				{
					g.drawImage(tabshop0, num11, yCommand, 0, true);
				}
			}
			else if (k == indexCommand)
			{
				g.drawImage(tabshop1, num11, yCommand, 0, true);
			}
			else
			{
				g.drawImage(tabshop0, num11, yCommand, 0, true);
			}
			if (splitCommand[k].Length == 1)
			{
				mFont.tahoma_7.drawString(g, splitCommand[k][0], num11 + 21, yCommand + 8, 2);
			}
			else
			{
				for (int l = 0; l < splitCommand[k].Length; l++)
				{
					mFont.tahoma_7.drawString(g, splitCommand[k][l], num11 + 21, yCommand + l * 10 + 2, 2);
				}
			}
			num11 = num11 + dxCommand + 42;
		}
	}

	private void paintShopEquip(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		if (Equals(CCanvas.panel) && maxPageShop[currentTabIndex] > 1 && CCanvas.isTouch)
		{
			if (cmy < -50)
			{
				CCanvas.paintShukiren(xScroll + wScroll / 2, yScroll + 30, g);
			}
			else if (cmy < 0)
			{
				mFont.tahoma_7_grey.drawString(g, L.getDown(), xScroll + wScroll / 2, yScroll + 15, 2);
			}
			else if (cmyLim >= 0)
			{
				if (cmy > cmyLim + 50)
				{
					CCanvas.paintShukiren(xScroll + wScroll / 2, yScroll + hScroll - 30, g);
				}
				else if (cmy > cmyLim)
				{
					mFont.tahoma_7_grey.drawString(g, L.getUp(), xScroll + wScroll / 2, yScroll + hScroll - 25, 2);
				}
			}
		}
		g.translate(0, -cmy);
		g.setColor(0);
		if (CPlayer.arrItemShop[currentTabIndex] == null || CPlayer.arrItemShop[currentTabIndex].Length == 0)
		{
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (i >= CPlayer.arrItemShop[currentTabIndex].Length)
			{
				continue;
			}
			Item item = CPlayer.arrItemShop[currentTabIndex][i];
			if (item == null || item.template == null)
			{
				continue;
			}
			SmallImage.drawSmallImage(g, item.template.iconID, num + num3 / 2 + ((item.template.type == 5) ? 5 : 0), num2 + num4 / 2, 0, 3, true);
			int num8 = ((item.template.type == 5) ? 7 : 0);
			mFont2.drawString(g, item.template.name, num5 + 5 + num8 + ((item.template.type == 5) ? 5 : 0), num6 + 5, 0);
			if (item.quantity > 0)
			{
				mFont.tahoma_7_yellow.drawString(g, item.quantity + string.Empty, num + 23, num2 + 10, 0, mFont.tahoma_7_grey);
			}
			if (item.buyCoin > 0)
			{
				mFont.tahoma_7_yellow.drawString(g, item.strbuyCoin, num5 + num7 - 22, num6 + 7, 1, mFont.tahoma_7_grey);
				g.drawImage(coin, num5 + num7 - 19, num6 + 5, 0, true);
				if (item.buyGold > 0 && selected == i)
				{
					mFont.tahoma_7_yellow.drawString(g, item.strbuyGold, num5 + num7 - 22, num6 + 22, 1, mFont.tahoma_7_grey);
					g.drawImage(gold, num5 + num7 - 19, num6 + 21, 0, true);
				}
			}
			else if (item.buyGold > 0)
			{
				mFont.tahoma_7_yellow.drawString(g, item.strbuyGold, num5 + num7 - 22, num6 + 7, 1, mFont.tahoma_7_grey);
				g.drawImage(gold, num5 + num7 - 19, num6 + 6, 0, true);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintSocketing(mGraphics g, int x, int y)
	{
		if (CCanvas.gameTick % 12 < 6)
		{
			g.drawImage(bua1, x, y, 0, true);
		}
		else
		{
			g.drawImage(bua0, x - 10, y + 8, 0, true);
		}
	}

	private void paintMyEquip(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int num8 = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				num8 = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			Item item = ((i >= 7) ? CPlayer.arrItemBag[i - 7] : ((i <= CPlayer.arrItemBody.Length - 1) ? CPlayer.arrItemBody[i] : null));
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			int color = 11657202;
			if (i == selected)
			{
				color = 24725;
			}
			else if (i < 7)
			{
				color = 14281983;
			}
			else if (CPlayer.arrItemBag[i - 7] != null)
			{
				if (CPlayer.arrItemBag[i - 7].isInBalo)
				{
					color = 16755251;
				}
				else if (CCanvas.panel != null && (CCanvas.panel.type == 19 || CCanvas.panel.type == 20) && CPlayer.arrItemBag[i - 7].isKhamNam)
				{
					color = 8967679;
				}
			}
			g.setColor(color);
			g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
			if (item != null && item.template != null)
			{
				int num9 = num + num3 / 2 + ((item.template.type == 5) ? 5 : 0) + ((item.template.type == 10 || item.template.type == 12) ? (-5) : 0);
				int num10 = num2 + num4 / 2;
				SmallImage.drawSmallImage(g, item.template.iconID, num9, num10, 0, 3, true);
				paintUpgradeEffect(num9, num10, 20, 20, item.level, g);
				if (item.isSocketing)
				{
					paintSocketing(g, X + wScroll - 13, num2 + 2);
					if (i == selected)
					{
						mFont.tahoma_7_white.drawString(g, ((item.daySocket <= 0) ? string.Empty : (item.daySocket + "n")) + ((item.hourSocket <= 0) ? string.Empty : (item.hourSocket + "g")), X + wScroll - 24, num6 + 5, 1);
					}
					else
					{
						mFont.tahoma_7_grey.drawString(g, ((item.daySocket <= 0) ? string.Empty : (item.daySocket + "n")) + ((item.hourSocket <= 0) ? string.Empty : (item.hourSocket + "g")), X + wScroll - 24, num6 + 5, 1);
					}
				}
			}
			if (item != null && item.template != null)
			{
				int num11 = ((item.template.type == 5) ? 7 : 0);
				mFont2.drawString(g, item.template.name + ((item.level <= 0) ? string.Empty : (" +" + item.level)), num5 + 5 + num11 + ((item.template.type == 5) ? 5 : 0), num6 + 5, 0);
				if (item.quantity > 1)
				{
					mFont.tahoma_7_yellow.drawString(g, item.quantity + string.Empty, num + 23, num2 + 10, 0, mFont.tahoma_7_grey);
				}
				int num12 = 5 - item.HP / 20;
				if (num12 == 5)
				{
					num12 = 4;
				}
				g.drawRegion(imgBroken, 0, num12 * 15, 15, 15, 0, xScroll + wScroll + 3, num6 + num8 + 3, mGraphics.RIGHT | mGraphics.BOTTOM, true);
			}
			if (i == selected)
			{
				paintDetail3(g, num6, item);
			}
		}
	}

	private void paintBietdoi(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 28;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			ClanItem clanItem = (ClanItem)shopBietDoi.elementAt(i);
			mFont2.drawString(g, clanItem.name, xScroll + 5, num6 + 5, 0);
			if (clanItem.xu > 0)
			{
				mFont.smallFontYellow.drawString(g, clanItem.xu + string.Empty, num5 + num7 - 22, num6 + 7, 1);
				g.drawImage(coin, num5 + num7 - 19, num6 + 5, 0, true);
			}
			else if (clanItem.luong > 0)
			{
				mFont.smallFontYellow.drawString(g, clanItem.luong + string.Empty, num5 + num7 - 22, num6 + 7, 1);
				g.drawImage(gold, num5 + num7 - 19, num6 + 6, 0, true);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintMail(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		if (listMail.size() == 0)
		{
			return;
		}
		for (int i = 0; i < listMail.size(); i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (listMail.size() > 0)
			{
				if (i == 0)
				{
					g.drawImage(loa, num + 2, num2 + 2, 0, true);
					mFont.tahoma_7_yellow.drawString(g, "10", xScroll + WIDTH_PANEL - 30, num2 + 5, 0, mFont.tahoma_7_grey);
					g.drawImage(gold, xScroll + WIDTH_PANEL - 21, num2 + 6, 0, true);
				}
				MsgInfo msgInfo = (MsgInfo)listMail.elementAt(i);
				mFont2.drawString(g, msgInfo.fromName, num + ((i != 0) ? 5 : 30), num6 + ((i != 0) ? 1 : 5), 0);
				if (i != selected || !isDetail)
				{
					mFont2.drawString(g, titleMail[i] + string.Empty, num + ((i != 0) ? 5 : 30), num6 + 11, 0);
				}
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintLevel(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		for (int i = 0; i < strAbility.Length; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			mFont mFont3 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont3 = (mFont2 = mFont.tahoma_7b_white);
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (imgUpgrade != null && imgUpgrade[i] != null)
			{
				g.drawImage(imgUpgrade[i], num + 15, num2 + 11, 3, true);
			}
			mFont2.drawString(g, strAbility[i], num5 + 5, num6 + 5, 0);
			mFont3.drawString(g, currAbility[i] + ((tisoPoint[i] <= 0) ? string.Empty : (" (+" + tisoPoint[i] + ")")), W - 5, num6 + 5, 1);
			if (curPointAdd[i] > 0)
			{
				mFont.tahoma_7_red.drawString(g, "+" + curPointAdd[i], num5 + 56, num6 + 5, 0);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintRoomList(mGraphics g)
	{
		int num = cmy / ITEM_HEIGHT;
		int num2 = (cmy + hScroll) / ITEM_HEIGHT + 1;
		if (num < 0)
		{
			num = 0;
		}
		if (num2 > roomList.size())
		{
			num2 = roomList.size();
		}
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		for (int i = num; i < num2; i++)
		{
			RoomInfo roomInfo = (RoomInfo)roomList.elementAt(i);
			int num3 = xScroll;
			int num4 = yScroll + i * ITEM_HEIGHT;
			int num5 = 32;
			int num6 = ITEM_HEIGHT - 1;
			int num7 = xScroll + num5;
			int num8 = yScroll + i * ITEM_HEIGHT;
			int num9 = wScroll - num5;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_white;
				g.setClip(2 + X, num8, wScroll, num6 + deltaH);
			}
			if (i > selected)
			{
				num4 += deltaH;
				num8 += deltaH;
			}
			g.setColor((i != selected || roomInfo.id == -1) ? 11657202 : 24725);
			g.fillRect(2 + X, num8, WIDTH_PANEL, h, true);
			if (roomInfo.id == -1 && i != 0)
			{
				mFont.tahoma_7b_blue.drawString(g, roomInfo.name, xScroll + 5, num8 + 5, 0);
			}
			else
			{
				try
				{
					int num10 = mGraphics.getImageHeight(imgIcon) / 14 - roomInfo.lv;
					g.drawRegion(imgIcon, 0, 14 * (num10 - 1), 12, 14, 0, num3 + 10, num4 + 11, 3, true);
				}
				catch (Exception)
				{
					g.drawRegion(imgIcon, 0, 0 * roomInfo.lv, 12, 14, 0, num3 + 10, num4 + 11, 3, true);
				}
				mFont.tahoma_7_blue.drawString(g, roomInfo.playerMax, num3 + 21, num8 + 5, 0);
				mFont2.drawString(g, roomInfo.name, num7 + 8, num8 + 5, 0);
				if (roomInfo.id != -1)
				{
					mFont.tahoma_7_yellow.drawString(g, roomInfo.money + string.Empty, xScroll + wScroll - 5, num8 + 5, 1, mFont.tahoma_7_grey);
				}
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num8 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintTop(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		for (int i = 0; i < CPlayer.arrayTopPlayer[currentTabIndex].Length; i++)
		{
			CPlayer cPlayer = CPlayer.arrayTopPlayer[currentTabIndex][i];
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			int color = ((i == selected) ? 24725 : ((cPlayer.IDDB == MyMidlet.myInfo.IDDB) ? 5373951 : ((i >= 3) ? 11657202 : 16759377)));
			g.setColor(color);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (i != selected)
			{
				cPlayer.paintHeadOnly(g, num + 15, num2 + 11);
			}
			else if (isDetail)
			{
				cPlayer.look = 0;
				cPlayer.paintBody(g, num + 15, num2 + 35);
			}
			else
			{
				cPlayer.paintHeadOnly(g, num + 15, num2 + 11);
			}
			((i == selected) ? mFont.tahoma_7b_yellow : mFont.tahoma_7b_green2).drawString(g, cPlayer.rank + ". " + cPlayer.name, num5 + 15, num6 + 1, 0);
			int num8 = 25;
			if (cPlayer.clan != null && cPlayer.clan.imgID != 0)
			{
				num8 = 40;
			}
			mFont2.drawString(g, cPlayer.rankValue, num5 + num7 - num8, num6 + 12, 1);
			mFont2.drawString(g, cPlayer.getLevelName(), num5 + 5, num6 + 12, 0);
			if (cPlayer.status == 0)
			{
				g.drawRegion(imgRoomStat, 0, 0, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 1)
			{
				g.drawRegion(imgRoomStat, 0, 14, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 2)
			{
				g.drawRegion(imgRoomStat, 0, 7, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			SmallImage.drawSmallImage(g, cPlayer.imgLevel, wScroll - 10, num6 + num4 / 2, 0, 3, true);
			if (cPlayer.clan != null && cPlayer.clan.imgID != 0)
			{
				cPlayer.paintClanIcon(g, wScroll - 28, num6 + num4 / 2);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintFriend(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		if (vFriend.size() == 0)
		{
			mFont.tahoma_7_grey.drawString(g, "Bạn có thể kết bạn bằng cách chọn", xScroll + wScroll / 2, yScroll + hScroll / 2 - 10, 2);
			mFont.tahoma_7_grey.drawString(g, "menu Kết bạn trong phòng chờ", xScroll + wScroll / 2, yScroll + hScroll / 2 + 10, 2);
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			CPlayer cPlayer = (CPlayer)vFriend.elementAt(i);
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (i != selected)
			{
				cPlayer.paintHeadOnly(g, num + 15, num2 + 11);
			}
			else if (isDetail)
			{
				cPlayer.look = 0;
				cPlayer.paintBody(g, num + 15, num2 + 35);
			}
			else
			{
				cPlayer.paintHeadOnly(g, num + 15, num2 + 11);
			}
			((i == selected) ? mFont.tahoma_7b_yellow : mFont.tahoma_7b_green2).drawString(g, cPlayer.name, num5 + 15, num6 + 1, 0);
			mFont2.drawString(g, cPlayer.getLevelName(), num5 + 5, num6 + 12, 0);
			if (cPlayer.status == 0)
			{
				g.drawRegion(imgRoomStat, 0, 0, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 1)
			{
				g.drawRegion(imgRoomStat, 0, 14, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 2)
			{
				g.drawRegion(imgRoomStat, 0, 7, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			SmallImage.drawSmallImage(g, cPlayer.imgLevel, wScroll - 10, num6 + num4 / 2, 0, 3, true);
			if (cPlayer.clan != null && cPlayer.clan.imgID != 0)
			{
				cPlayer.paintClanIcon(g, wScroll - 28, num6 + num4 / 2);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintPlayerInfo(mGraphics g)
	{
		if (plInfo != null)
		{
			CPlayer cPlayer = plInfo;
			int num = xScroll;
			int num2 = yScroll;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll;
			int num7 = wScroll - num3;
			mFont tahoma_7_grey = mFont.tahoma_7_grey;
			g.setColor(11657202);
			g.fillRect(2 + X, num6, WIDTH_PANEL - 4, H - num6, true);
			cPlayer.look = 0;
			cPlayer.paintBody(g, num + 15, num2 + 45);
			mFont.tahoma_7b_yellow.drawString(g, cPlayer.name, num5 + 25, num6 + 1, 0);
			tahoma_7_grey.drawString(g, cPlayer.getLevelName(), num5 + 15, num6 + 12, 0);
			if (cPlayer.status == 0)
			{
				g.drawRegion(imgRoomStat, 0, 0, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 1)
			{
				g.drawRegion(imgRoomStat, 0, 14, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			if (cPlayer.status == 2)
			{
				g.drawRegion(imgRoomStat, 0, 7, 7, 7, 0, num + num3 + 5, num6 + 3, 0, true);
			}
			SmallImage.drawSmallImage(g, cPlayer.imgLevel, wScroll - 10, num6 + num4 / 2, 0, 3, true);
			if (cPlayer.clan != null && cPlayer.clan.imgID != 0)
			{
				cPlayer.paintClanIcon(g, wScroll - 28, num6 + num4 / 2);
			}
			paintDetail2(g, 2 + X, num6 + 50);
		}
	}

	private void paintClan(mGraphics g)
	{
	}

	private void paintClanMember(mGraphics g)
	{
	}

	private void paintMoney(mGraphics g)
	{
	}

	private void paintMission(mGraphics g)
	{
	}

	private void paintInventory(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (CPlayer.arrItemBox[i] != null)
			{
				int num8 = num + num3 / 2 + ((CPlayer.arrItemBox[i].template.type == 5) ? 5 : 0) + ((CPlayer.arrItemBox[i].template.type == 10 || CPlayer.arrItemBox[i].template.type == 12) ? (-5) : 0);
				int num9 = num2 + num4 / 2;
				SmallImage.drawSmallImage(g, CPlayer.arrItemBox[i].template.iconID, num8, num9, 0, 3, true);
				int num10 = ((CPlayer.arrItemBox[i].template.type == 5) ? 7 : 0);
				mFont2.drawString(g, CPlayer.arrItemBox[i].template.name + ((CPlayer.arrItemBox[i].level <= 0) ? string.Empty : (" +" + CPlayer.arrItemBox[i].level)), num5 + 5 + num10 + ((CPlayer.arrItemBox[i].template.type == 5) ? 5 : 0), num6 + 5, 0);
				if (CPlayer.arrItemBox[i].quantity > 1)
				{
					mFont.tahoma_7_yellow.drawString(g, CPlayer.arrItemBox[i].quantity + string.Empty, num + 23, num2 + 10, 0, mFont.tahoma_7_grey);
				}
			}
			if (i == selected)
			{
				paintDetail3(g, num6, CPlayer.arrItemBox[i]);
			}
		}
	}

	private void paintFunction(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		if (strFunction.Length == 0)
		{
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7b_dark;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			mFont2.drawString(g, strFunction[i], xScroll + (wScroll >> 1), num6 + 5, 2);
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num6 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	private void paintBalo(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		if (CPlayer.arrItemBalo.Length == 0)
		{
			mFont.tahoma_7_grey.drawString(g, "Balô bị hỏng", xScroll + 5, yScroll + 5, 0);
			return;
		}
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (CPlayer.arrItemBalo[i] != null)
			{
				int num8 = num + num3 / 2 + ((CPlayer.arrItemBalo[i].template.type == 5) ? 5 : 0) + ((CPlayer.arrItemBalo[i].template.type == 10 || CPlayer.arrItemBalo[i].template.type == 12) ? (-5) : 0);
				int num9 = num2 + num4 / 2;
				SmallImage.drawSmallImage(g, CPlayer.arrItemBalo[i].template.iconID, num8, num9, 0, 3, true);
				int num10 = ((CPlayer.arrItemBalo[i].template.type == 5) ? 7 : 0);
				mFont2.drawString(g, CPlayer.arrItemBalo[i].template.name + ((CPlayer.arrItemBalo[i].level <= 0) ? string.Empty : (" +" + CPlayer.arrItemBalo[i].level)), num5 + 5 + num10 + ((CPlayer.arrItemBalo[i].template.type == 5) ? 5 : 0), num6 + 5, 0);
				if (CPlayer.arrItemBalo[i].quantity > 1)
				{
					mFont.smallFontYellow.drawString(g, CPlayer.arrItemBalo[i].quantity + string.Empty, num + 23, num2 + 10, 0);
				}
			}
			if (i == selected)
			{
				paintDetail3(g, num6, CPlayer.arrItemBalo[i]);
			}
		}
	}

	private void paintKhamNam(mGraphics g)
	{
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		g.setColor(0);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7b_white;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			g.setColor((i != selected) ? 11657202 : 24725);
			g.fillRect(2 + X, num6, WIDTH_PANEL, h, true);
			if (CPlayer.arrItemKhamNam[i] != null)
			{
				SmallImage.drawSmallImage(g, CPlayer.arrItemKhamNam[i].template.iconID, num + num3 / 2, num2 + num4 / 2, 0, 3, true);
				int num8 = ((CPlayer.arrItemKhamNam[i].template.type == 5) ? 7 : 0);
				mFont2.drawString(g, CPlayer.arrItemKhamNam[i].template.name + ((CPlayer.arrItemKhamNam[i].level <= 0) ? string.Empty : (" +" + CPlayer.arrItemKhamNam[i].level)), num5 + 5 + num8, num6 + 5, 0);
			}
			if (i == selected)
			{
				paintDetail3(g, num6, CPlayer.arrItemKhamNam[i]);
			}
		}
	}

	private void paintDetail3(mGraphics g, int y, Item item)
	{
		int num = X + 45;
		if (isDetail && item != null && item.nSocket > 0)
		{
			for (int i = 0; i < item.nSocket; i++)
			{
				if (i < item.gems.size())
				{
					int id = int.Parse(item.gems.elementAt(i).ToString());
					SmallImage.drawSmallImage(g, id, num, y + 18, 0, 0, true);
				}
				else
				{
					g.drawImage(socket, num, y + 18, 0, false);
				}
				num += 14;
			}
		}
		paintDetail2(g, 2 + X, y + ITEM_HEIGHT - 1);
		g.translate(-g.getTranslateX(), -g.getTranslateY());
		g.translate(-cmx, 0);
		g.translate(X, Y);
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
	}

	private void paintFrameSimple(int x, int y, int w, int h, mGraphics g)
	{
		g.setColor(16498);
		g.fillRect(x, y, w, h, false);
		g.setColor(29357);
		g.fillRect(x + 1, y + 1, w - 2, h - 2, false);
		g.setColor(7852020);
		g.fillRect(x + 2, y + 2, w - 4, h - 4, false);
	}

	private void paintClanInfo(mGraphics g)
	{
		if (currentTabIndex != 0)
		{
			return;
		}
		if (CPlayer.myPlayer.clan == null)
		{
			mFont.tahoma_7b_white.drawString(g, L.not_join_clan(), wScroll / 2, 36, mFont.CENTER);
		}
		else if (!isMessage)
		{
			if (!isViewMember)
			{
				Clan clan = CPlayer.myPlayer.clan;
				if (clan != null)
				{
					mFont.tahoma_7b_white.drawString(g, clan.name, W / 2, 32, mFont.CENTER);
					TextInfo.paint(g, clan.slogan, 0, 44, wScroll - 5, ITEM_HEIGHT, mFont.tahoma_7_white);
				}
			}
			else
			{
				Clan clan2 = ((currClan == null) ? CPlayer.myPlayer.clan : currClan);
				mFont.tahoma_7b_white.drawString(g, clan2.name, 5, 32, mFont.LEFT);
				mFont.tahoma_7_white.drawString(g, L.level() + " " + clan2.level, W - 5, 32, mFont.RIGHT);
				mFont.tahoma_7_white.drawString(g, L.clan_leader() + ": " + clan2.leaderName, 5, 44, mFont.LEFT);
				mFont.tahoma_7_yellow.drawString(g, clan2.currMember + "/" + clan2.maxMember, W - 5, 44, mFont.RIGHT);
			}
		}
		else if (selected >= 2 && selected <= currentListLength - 1)
		{
			ClanMessage clanMessage = (ClanMessage)ClanMessage.vMessage.elementAt(selected - 2);
			clanMessage.paint(g, 5, 32, true);
		}
	}

	private void paintBuyMultiItems(string s, mGraphics g)
	{
	}

	private void paintTopInfo(mGraphics g)
	{
		g.setColor(40416);
		g.fillRect(X + 1, 30, W - 2, 28, false);
		switch (type)
		{
		case 23:
			if (currentTabIndex == 3)
			{
				mFont.tahoma_7_white.drawString(g, L.area() + " " + GameScrRPG.zone, X + (W >> 1), 38, 2);
			}
			break;
		case 24:
			if ((currentTabIndex == 0 || currentTabIndex == 1) && Equals(CCanvas.panel))
			{
				paintGiaoDichInfo(g);
			}
			break;
		case 21:
			if (currentTabIndex == 0)
			{
				paintClanInfo(g);
			}
			if (currentTabIndex == 1)
			{
				painTopClanInfo(g);
			}
			if (currentTabIndex == 2)
			{
				paintShopClanInfo(g);
			}
			break;
		case 16:
			if (currentTabIndex == 0)
			{
				mFont.tahoma_7_white.drawString(g, "Chọn một vật phẩm", X + (W >> 1), 38, 2);
			}
			if (currentTabIndex == 1)
			{
				mFont.tahoma_7_white.drawString(g, L.room() + " " + CCanvas.prepareScr.currRoom + "-" + CCanvas.prepareScr.currZone, X + (W >> 1), 38, 2);
			}
			break;
		case 0:
		case 1:
			if (currentTabIndex <= CPlayer.arrItemShop.Length - 1)
			{
				string text = "Chọn một vật phẩm";
				if (maxPageShop[currentTabIndex] > 1)
				{
					string text2 = text;
					text = text2 + " (Trang " + (currPageShop[currentTabIndex] + 1) + "/" + maxPageShop[currentTabIndex] + ")";
				}
				mFont.tahoma_7_white.drawString(g, text, X + (W >> 1), 38, 2);
			}
			else
			{
				mFont.tahoma_7_white.drawString(g, "Trang bị", X + (W >> 1), 38, 2);
			}
			break;
		case 7:
			mFont.tahoma_7_white.drawString(g, "Chọn tiềm năng", X + (W >> 1), 38, 2);
			break;
		case 2:
		case 4:
		case 5:
			mFont.tahoma_7_white.drawString(g, "Chọn một vật phẩm", X + (W >> 1), 38, 2);
			break;
		case 6:
			break;
		case 8:
			mFont.tahoma_7_white.drawString(g, "Chọn phòng để chơi", X + (W >> 1), 38, 2);
			break;
		case 9:
			if (vFriend.size() == 0)
			{
				mFont.tahoma_7_white.drawString(g, "Chưa có bạn bè", X + (W >> 1), 38, 2);
			}
			else
			{
				mFont.tahoma_7_white.drawString(g, "Chọn người chơi", X + (W >> 1), 38, 2);
			}
			break;
		case 28:
			if (plInfo != null)
			{
				mFont.tahoma_7_white.drawString(g, plInfo.name, X + (W >> 1), 38, 2);
			}
			break;
		case 29:
			mFont.tahoma_7_white.drawString(g, MyMidlet.myInfo.name, X + (W >> 1), 38, 2);
			break;
		case 10:
			mFont.tahoma_7_white.drawString(g, "Chọn người chơi", X + (W >> 1), 38, 2);
			break;
		case 12:
			mFont.tahoma_7_white.drawString(g, "Chọn đội", X + (W >> 1), 38, 2);
			break;
		case 13:
			mFont.tahoma_7_white.drawString(g, "Chọn thành viên", W >> 1, 38, 2);
			break;
		case 11:
			mFont.tahoma_7_white.drawString(g, "Chọn nhiệm vụ", X + (W >> 1), 38, 2);
			break;
		case 14:
			mFont.tahoma_7_white.drawString(g, "Chọn mệnh giá", X + (W >> 1), 38, 2);
			break;
		case 17:
		case 26:
			mFont.tahoma_7_white.drawString(g, "Chọn bản đồ chiến đấu", X + (W >> 1), 38, 2);
			break;
		case 27:
			mFont.tahoma_7_white.drawString(g, "Chọn tiền cược", X + (W >> 1), 38, 2);
			break;
		case 18:
			mFont.tahoma_7_white.drawString(g, "Bảng xếp hạng", X + (W >> 1), 38, 2);
			break;
		case 22:
			mFont.tahoma_7_white.drawString(g, "Hoàn thành nhiệm vụ để nhận thưởng", X + (W >> 1), 38, 2);
			break;
		case 25:
			if (currentTabIndex == 0)
			{
				mFont.tahoma_7_white.drawString(g, "Chọn khu vực", X + (W >> 1), 38, 2);
			}
			break;
		case 3:
		case 15:
		case 19:
		case 20:
			break;
		}
	}

	private void paintClanStatusInfo(mGraphics g)
	{
		if (clansStatus == null)
		{
			mFont.tahoma_7b_white.drawString(g, "Vật phẩm hỗ trợ đội", 5, 32, mFont.LEFT);
			mFont.tahoma_7_white.drawString(g, "Vui lòng mua tại cửa hàng", 5, 44, mFont.LEFT);
		}
		else
		{
			mFont.tahoma_7b_white.drawString(g, "Vật phẩm hỗ trợ đang dùng", W / 2, 35, mFont.CENTER);
		}
	}

	private void paintShopClanInfo(mGraphics g)
	{
		mFont.tahoma_7b_white.drawString(g, CPlayer.myPlayer.clan.name, 5, 32, mFont.LEFT);
		mFont.tahoma_7_white.drawString(g, L.level() + ": " + CPlayer.myPlayer.clan.level, 5, 44, mFont.LEFT);
		mFont.tahoma_7_yellow.drawString(g, L.page() + " " + (currShopPage + 1) + "/" + maxShopPage, W - 5, 44, mFont.RIGHT);
	}

	private void painTopClanInfo(mGraphics g)
	{
		if (!topClanMember)
		{
			mFont.tahoma_7b_white.drawString(g, L.topClan(), W / 2, 37, mFont.CENTER);
			return;
		}
		Clan clan = currClan;
		mFont.tahoma_7b_white.drawString(g, clan.name, 5, 32, mFont.LEFT);
		mFont.tahoma_7_white.drawString(g, L.clan_leader() + ": " + clan.leaderName, 5, 44, mFont.LEFT);
		mFont.tahoma_7_yellow.drawString(g, clan.currMember + "/" + clan.maxMember, W - 5, 44, mFont.RIGHT);
	}

	private void paintTab(mGraphics g)
	{
		g.setColor(14434);
		g.fillRect(X + 1, 0, W - 2, 30, false);
		switch (type)
		{
		case 0:
		case 1:
		case 2:
		case 5:
		case 16:
		case 18:
		case 19:
		case 20:
		case 21:
		case 23:
		case 24:
		{
			int num = tabDistance;
			for (int i = 0; i < currentTabName.Length; i++)
			{
				g.setColor((i != currentTabIndex) ? 16773296 : 6805896);
				if (i == currentTabIndex && CCanvas.gameTick % 8 > 1)
				{
					if (currentTabName.Length > 4)
					{
						g.drawImage(tabshopSmall1, num, 2, 0, false);
					}
					else
					{
						g.drawImage(tabshop1, num, 2, 0, false);
					}
				}
				else if (currentTabName.Length > 4)
				{
					g.drawImage(tabshopSmall0, num, 2, 0, false);
				}
				else
				{
					g.drawImage(tabshop0, num, 2, 0, false);
				}
				mFont mFont2 = ((i != currentTabIndex) ? mFont.tahoma_7 : mFont.tahoma_7);
				if (!currentTabName[i][1].Equals(string.Empty))
				{
					mFont2.drawString(g, currentTabName[i][0], num + TAB_W / 2, 4, mFont.CENTER);
					mFont2.drawString(g, currentTabName[i][1], num + TAB_W / 2, 15, mFont.CENTER);
				}
				else
				{
					mFont2.drawString(g, currentTabName[i][0], num + TAB_W / 2, 10, mFont.CENTER);
				}
				num = num + tabDistance + TAB_W;
			}
			break;
		}
		case 4:
			mFont.tahoma_7b_unfocus.drawString(g, "Hành trang", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 6:
			mFont.tahoma_7b_unfocus.drawString(g, L.message(), X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 7:
			mFont.tahoma_7b_unfocus.drawString(g, "Tiềm năng: " + pointLeft + " điểm", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 8:
			mFont.tahoma_7b_unfocus.drawString(g, "Danh sách phòng", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 9:
			mFont.tahoma_7b_unfocus.drawString(g, "Bạn bè", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 28:
		case 29:
			mFont.tahoma_7b_unfocus.drawString(g, "Thông tin cá nhân", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 10:
			mFont.tahoma_7b_unfocus.drawString(g, "Bảng xếp hạng", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 11:
			mFont.tahoma_7b_unfocus.drawString(g, "Nhiệm vụ", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 14:
			mFont.tahoma_7b_unfocus.drawString(g, "Nạp tiền", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 17:
			mFont.tahoma_7b_unfocus.drawString(g, "Chọn map", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 26:
			mFont.tahoma_7b_unfocus.drawString(g, "Chọn chiến trường", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 27:
			mFont.tahoma_7b_unfocus.drawString(g, "Tiền cược", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 13:
			break;
		case 15:
			mFont.tahoma_7b_unfocus.drawString(g, "Biệt đội", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 22:
			mFont.tahoma_7b_unfocus.drawString(g, "Thành tích", X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 25:
			mFont.tahoma_7b_unfocus.drawString(g, L.area() + " " + GameScrRPG.zone, X + (WIDTH_PANEL >> 1), 10, mFont.CENTER);
			break;
		case 3:
		case 12:
			break;
		}
	}

	public static void paintPopUp(mGraphics g, int x, int y, int w, int h, int color, bool isButton)
	{
		if (!isButton)
		{
			g.setColor(0);
			g.fillRect(x + 6, y, w - 14 + 1, h, false);
			g.fillRect(x, y + 6, w, h - 12 + 1, false);
			g.setColor(color);
			g.fillRect(x + 6, y + 1, w - 12, h - 2, false);
			g.fillRect(x + 1, y + 6, w - 2, h - 12, false);
			g.drawRegion(goc, 0, 0, 7, 6, 0, x, y, 0, false);
			g.drawRegion(goc, 0, 0, 7, 6, 2, x + w - 7, y, 0, false);
			g.drawRegion(goc, 0, 0, 7, 6, 6, x, y + h, 0, false);
			g.drawRegion(goc, 0, 0, 7, 6, 3, x + w - 7, y + h - 6, 0, false);
			return;
		}
		Image arg = ((color != 1) ? imgPopUp : imgPopUp2);
		g.drawRegion(arg, 0, 0, 10, 10, 0, x, y, 0, false);
		g.drawRegion(arg, 0, 20, 10, 10, 0, x + w - 10, y, 0, false);
		g.drawRegion(arg, 0, 50, 10, 10, 0, x, y + h - 10, 0, false);
		g.drawRegion(arg, 0, 70, 10, 10, 0, x + w - 10, y + h - 10, 0, false);
		int num = (((w - 20) % 10 != 0) ? ((w - 20) / 10 + 1) : ((w - 20) / 10));
		int num2 = (((h - 20) % 10 != 0) ? ((h - 20) / 10 + 1) : ((h - 20) / 10));
		for (int i = 0; i < num; i++)
		{
			g.drawRegion(arg, 0, 10, 10, 10, 0, x + 10 + i * 10, y, 0, false);
		}
		for (int j = 0; j < num2; j++)
		{
			g.drawRegion(arg, 0, 30, 10, 10, 0, x, y + 10 + j * 10, 0, false);
		}
		for (int k = 0; k < num; k++)
		{
			g.drawRegion(arg, 0, 60, 10, 10, 0, x + 10 + k * 10, y + h - 10, 0, false);
		}
		for (int l = 0; l < num2; l++)
		{
			g.drawRegion(arg, 0, 40, 10, 10, 0, x + w - 10, y + 10 + l * 10, 0, false);
		}
		g.setColor((color != 1) ? 15512379 : 15366185);
		g.fillRect(x + 10, y + 10, w - 20, h - 20, false);
	}

	private void paintBottomMoneyInfo(mGraphics g)
	{
		g.setColor(218230);
		g.fillRect(X + 1, H - 20, W - 2, 19, false);
		g.drawImage(coin, X + 21, H - 10, 3, false);
		g.drawImage(gold, X + 110, H - 11, 3, false);
		mFont.smallFontYellow.drawString(g, MyMidlet.myInfo.strXu, X + 34, H - mFont.smallFontYellow.getHeight() / 2 - mSystem.yMoney, mFont.LEFT);
		mFont.smallFontYellow.drawString(g, MyMidlet.myInfo.strLuong, X + 123, H - mFont.smallFontYellow.getHeight() / 2 - mSystem.yMoney, mFont.LEFT);
	}

	private void paintToolInfo(mGraphics g)
	{
		mFont.tahoma_7b_white.drawString(g, "Chức năng", 60, 4, mFont.LEFT, mFont.tahoma_7b_dark);
		mFont.tahoma_7_yellow.drawString(g, "Ngọc rồng online", 60, 16, mFont.LEFT, mFont.tahoma_7_grey);
		mFont.tahoma_7_yellow.drawString(g, "Phiên bản: 1.2.0", 60, 27, mFont.LEFT, mFont.tahoma_7_grey);
		mFont.tahoma_7_yellow.drawString(g, "Tài khoản: rrwwrr", 60, 38, mFont.LEFT, mFont.tahoma_7_grey);
	}

	private void paintMyInfo(mGraphics g)
	{
		int num = xScroll + 42;
		CPlayer myInfo = MyMidlet.myInfo;
		int num2 = yScroll - 30;
		mFont.tahoma_7_white.drawString(g, myInfo.stringLevel, num + 50, num2 + 40, 2);
		SmallImage.drawSmallImage(g, myInfo.imgLevel, num + 5, num2 + 45, 0, 0, false);
		MenuScr.paintLevelPercen(g, num + 25, num2 + 55);
		g.drawImage(MenuScr.avenger, num + 4, num2 + 61, 0, false);
		MenuScr.paintLevelPercen2(g, num + 25, num2 + 68);
		mFont tahoma_7_yellow = mFont.tahoma_7_yellow;
		mFont tahoma_7_grey = mFont.tahoma_7_grey;
		int num3 = num2 + 81;
		g.drawRegion(MenuScr.imgPow, 0, 0, 16, 16, 0, num + 6, num3, 0, false);
		tahoma_7_yellow.drawString(g, myInfo.power + string.Empty, num + 27, num3 + 2, 0, tahoma_7_grey);
		num3 += 17;
		g.drawImage(MenuScr.kda, num + 6, num3, 0, false);
		tahoma_7_yellow.drawString(g, myInfo.KDA + string.Empty, num + 27, num3 + 2, 0, tahoma_7_grey);
		num3 += 17;
		g.drawImage(coin, num + 6, num3, 0, false);
		tahoma_7_yellow.drawString(g, MyMidlet.myInfo.strXu, num + 27, num3 + 2, 0, tahoma_7_grey);
		num3 += 17;
		g.drawImage(gold, num + 6, num3, 0, false);
		tahoma_7_yellow.drawString(g, MyMidlet.myInfo.strLuong, num + 27, num3 + 2, 0, tahoma_7_grey);
		num3 += 17;
		g.drawImage(bua0, num + 6, num3, 0, false);
		tahoma_7_yellow.drawString(g, CPlayer.busyHammer + "/" + CPlayer.nHammer, num + 27, num3 + 2, 0, tahoma_7_grey);
	}

	private void paintInfomation(mGraphics g)
	{
	}

	public void paintMultiLine(mGraphics g, mFont f, string[] arr, string str, int x, int y, int align)
	{
		for (int i = 0; i < arr.Length; i++)
		{
			string text = arr[i];
			if (text.StartsWith("c"))
			{
				if (text.StartsWith("c0"))
				{
					text = text.Substring(2);
					f = mFont.tahoma_7b_dark;
				}
				else if (text.StartsWith("c1"))
				{
					text = text.Substring(2);
					f = mFont.tahoma_7b_yellow;
				}
				else if (text.StartsWith("c2"))
				{
					text = text.Substring(2);
					f = mFont.tahoma_7b_green;
				}
			}
			if (i == 0)
			{
				f.drawString(g, text, x, y, align);
				continue;
			}
			if (i < indexRow + 30 && i > indexRow - 30)
			{
				f.drawString(g, text, x, y += 12, align);
			}
			else
			{
				y += 12;
			}
			yPaint += 12;
			indexRowMax++;
		}
	}

	public void paintMultiLine(mGraphics g, mFont f, string str, int x, int y, int align)
	{
		int num = ((!CCanvas.isTouch || CCanvas.w < 320) ? 10 : 20);
		string[] array = f.splitFontArray(str, inforW - num);
		for (int i = 0; i < array.Length; i++)
		{
			if (i == 0)
			{
				f.drawString(g, array[i], x, y, align);
				continue;
			}
			if (i < indexRow + 15 && i > indexRow - 15)
			{
				f.drawString(g, array[i], x, y += 12, align);
			}
			else
			{
				y += 12;
			}
			yPaint += 12;
			indexRowMax++;
		}
	}

	public void updateRequest(int recieve, int maxCap)
	{
		cp.says[cp.says.Length - 1] = L.received() + " " + recieve + "/" + maxCap;
	}

	public void hide()
	{
		if (this == CCanvas.panel)
		{
			Music.play(Music.POPUP, 10f);
		}
		if (CCanvas.curScr is PrepareScr)
		{
			CCanvas.prepareScr.isChooseItem = false;
		}
		if (this == CCanvas.panel2)
		{
			CCanvas.panel2 = null;
		}
		isClanOption = false;
		isClose = true;
		CCanvas.clearAllPointerEvent();
		pointerDownTime = (pointerDownFirstX = 0);
		pointerIsDowning = false;
		if (type == 21 && currentTabIndex == 1 && topClanMember)
		{
			topClanMember = false;
			setTabTopClans();
			cmy = (cmtoY = 0);
			selected = (CCanvas.isTouch ? (-1) : 0);
		}
		else
		{
			isClanOption = false;
			isClose = true;
		}
	}

	public void update()
	{
		if (selected == -1)
		{
			deltaH = (deltaHmax = 0);
		}
		else if (isDetail && deltaH != deltaHmax)
		{
			cmvxDelta = deltaHmax - deltaH << 2;
			cmdxDelta += cmvxDelta;
			deltaH += cmdxDelta >> 4;
			cmdxDelta &= 15;
		}
		if (CCanvas.isTouch)
		{
			if (tShop > 0)
			{
				tShop--;
			}
			else
			{
				selectedShop = -1;
			}
		}
		moveCamera();
		if (type == 28)
		{
			isDetail = true;
			selected = 0;
		}
		else
		{
			if (InfoDlg.isShow)
			{
				return;
			}
			if (tabIcon != null && tabIcon.isShow)
			{
				tabIcon.update();
			}
			else
			{
				if (waitToPerform <= 0)
				{
					return;
				}
				waitToPerform--;
				if (waitToPerform != 0)
				{
					return;
				}
				lastSelect[currentTabIndex] = selected;
				CRes.outz("DO FIRE AT " + selected);
				switch (type)
				{
				case 21:
					if (currentTabIndex == 0)
					{
						doFireClanOption();
					}
					if (currentTabIndex == 1)
					{
						doFireTopClan();
					}
					if (currentTabIndex == 2)
					{
						doFireShopClan();
					}
					if (currentTabIndex == 3)
					{
						doFireClanStatus();
					}
					break;
				case 18:
					doFireTop();
					break;
				case 0:
				case 1:
					if (currentTabIndex == CPlayer.arrItemShop.Length)
					{
						doFireMyEquip();
					}
					else
					{
						doFireShop();
					}
					break;
				case 4:
					doFireMyEquip();
					break;
				case 5:
					if (currentTabIndex == 0)
					{
						doFireInventory();
					}
					else if (currentTabIndex == 1)
					{
						doFireBalo();
					}
					else
					{
						doFireMyEquip();
					}
					break;
				case 2:
					if (currentTabIndex == 0)
					{
						doFireInventory();
					}
					else if (currentTabIndex == 1)
					{
						doFireBalo();
					}
					break;
				case 6:
					doFireMail();
					break;
				case 7:
					doFireLevel();
					break;
				case 8:
					doFireRoomlist();
					break;
				case 9:
					doFireFriend();
					break;
				case 10:
					doFireTopPlayer();
					break;
				case 11:
					doFireMission();
					break;
				case 14:
					doFireMoney();
					break;
				case 17:
					doFireMap();
					break;
				case 26:
					doFireMapFilter();
					break;
				case 27:
					doFireMoneyFilter();
					break;
				case 13:
					doFireClanMember();
					break;
				case 15:
					doFireBietDoi();
					break;
				case 16:
					if (currentTabIndex == 0)
					{
						doFireBalo();
					}
					else
					{
						doFireFunction();
					}
					break;
				case 20:
					if (currentTabIndex == 0)
					{
						doKhamNam();
					}
					if (currentTabIndex == 1)
					{
						doFireGhepNgoc();
					}
					if (currentTabIndex == 2)
					{
						doFireMyEquip();
					}
					break;
				case 19:
					if (currentTabIndex == 0)
					{
						doKhamNam();
					}
					if (currentTabIndex == 1)
					{
						doFireGhepNgoc();
					}
					break;
				case 22:
					doFireAchievement();
					break;
				case 23:
					if (currentTabIndex == 0)
					{
						doFireMyEquip();
					}
					else if (currentTabIndex == 1)
					{
						doFireBalo();
					}
					else if (currentTabIndex == 2)
					{
						doFireInventory();
					}
					else
					{
						doFireRPG();
					}
					break;
				case 24:
					doFireGiaoDich();
					break;
				case 25:
					doFireZone();
					break;
				}
				if (selected != -1 && isDetail)
				{
					if (selected * ITEM_HEIGHT + ch > cmy + hScroll)
					{
						cmtoY = cmy + (selected * ITEM_HEIGHT + ch - cmy - hScroll);
					}
					if (selected * ITEM_HEIGHT < cmy)
					{
						cmtoY = cmy + (selected * ITEM_HEIGHT - cmy);
					}
				}
			}
		}
	}

	private void doFireClanStatus()
	{
		if (selected != -1 && selected < currentListLength)
		{
			command = new MyVector("cmd do fire shop");
			currItem = clansStatus[selected];
			if (currItem != null)
			{
				command.addElement(new Command(L.close(), this, 8000, currItem));
			}
			addShopItem(currItem);
			if (!CCanvas.isTouch)
			{
				selectedShop = 0;
			}
			else
			{
				selectedShop = -1;
			}
		}
	}

	private void doFireShopClan()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		command = new MyVector("cmd do fire shop");
		currItem = clansShop[selected];
		if (currItem != null)
		{
			if (currItem.buyCoin > 0)
			{
				command.addElement(new Command(L.buy() + " " + L.xu(), this, 6000, currItem));
			}
			if (currItem.buyGold > 0)
			{
				command.addElement(new Command(L.buy() + " " + L.luong(), this, 6001, currItem));
			}
		}
		addShopItem(currItem);
		if (!CCanvas.isTouch)
		{
			selectedShop = 0;
		}
		else
		{
			selectedShop = -1;
		}
	}

	private void doFireTopClan()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		if (!topClanMember)
		{
			currClan = getCurrTopClan();
			if (currClan != null)
			{
				command = new MyVector(string.Empty);
				command.addElement(new Command(L.view_clan_member(), this, 4001, currClan));
				command.addElement(new Command(L.close(), this, 8000, null));
				addClanDetail(currClan);
			}
		}
		else
		{
			currMem = getCurrTopClanMember();
			command = new MyVector(string.Empty);
			command.addElement(new Command(L.close(), this, 8000, null));
			addClanMemberDetail(currMem);
		}
	}

	private void doFireGhepNgoc()
	{
		if (selected != -1 && selected < currentListLength && CPlayer.arrItemGhepNgoc[selected] != null)
		{
			command = new MyVector(string.Empty);
			command.addElement(new Command("Nhập ngọc", this, 2002, null));
			command.addElement(new Command("Hủy nhập", this, 2003, null));
			addMyEquipDetail(CPlayer.arrItemGhepNgoc[selected]);
		}
	}

	private void doFireMap()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do fire map");
			command.addElement(new Command(L.ok(), this, 1092, null));
			des1 = null;
			splitCommandName();
			ch = 54 + ((command.size() > 0) ? 33 : 0) + ITEM_HEIGHT;
			deltaH = 0;
			deltaHmax = ch - (ITEM_HEIGHT - 1);
		}
	}

	private void doFireMapFilter()
	{
		if (selected != -1)
		{
			perform(1200, null);
		}
	}

	private void doFireMoneyFilter()
	{
		if (selected != -1)
		{
			perform(1201, null);
		}
	}

	private void addMapFile(MapFile map)
	{
	}

	private void doFireClanMember()
	{
	}

	private void doFireMission()
	{
	}

	private void doFireMoney()
	{
		if (selected != -1)
		{
			command = new MyVector("command fire money");
			if (selected == 3)
			{
				command.addElement(new Command("Đổi", this, 1084, null));
			}
			else
			{
				command.addElement(new Command("Nạp tiền", this, 1084, null));
			}
			initPopupDetail(string.Empty, null);
		}
	}

	private void addClanMoreDetail(Clan clan)
	{
	}

	private void doFireLevel()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		if (pointLeft <= 0)
		{
			CCanvas.startOKDlg("Bạn hãy tiếp tục chiến đấu để có thêm điểm tiềm năng.");
			return;
		}
		command = new MyVector("cmd dofire level");
		if (pointLeft > 0)
		{
			command.addElement(new Command("Tăng", this, 1060, null));
		}
		if (!CCanvas.isTouch)
		{
			selectedShop = 0;
		}
		else
		{
			selectedShop = -1;
		}
		if (pointLeft > 0)
		{
			initPopupDetail(string.Empty, null);
		}
	}

	private void doFireRoomlist()
	{
		GameScr.trainingMode = false;
		isDetail = false;
		if (cmtoY > cmyLim)
		{
			cmtoY = cmyLim;
		}
		deltaH = (deltaHmax = 0);
		if (selected == -1)
		{
			return;
		}
		if (selected == 0)
		{
			perform(1094, null);
			return;
		}
		RoomInfo roomInfo = (RoomInfo)roomList.elementAt(selected);
		if (roomInfo.id != -1)
		{
			if (roomInfo.boardID == -1)
			{
				GameService.gI().requestEmptyRoom(1, roomInfo.lv, null);
			}
			boardName2 = L.area() + " " + roomInfo.boardID;
			PrepareScr.currentRoom = roomInfo.id;
			PrepareScr.currLevel = roomInfo.lv;
			if (roomInfo.boardID != -1)
			{
				GameService.gI().joinBoard(roomInfo.id, roomInfo.boardID, string.Empty);
			}
			InfoDlg.showWait();
		}
	}

	private void doFireFriend()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do fire friend");
			CPlayer p = (CPlayer)vFriend.elementAt(selected);
			command.addElement(new Command("Chat", this, 1073, p));
			command.addElement(new Command(L.deleteFriend(), this, 1070, p));
			CPlayer cPlayer = (CPlayer)vFriend.elementAt(selected);
			initPopupDetail("|1|" + cPlayer.stringLevel, null);
		}
	}

	private void doFirePlayerInfo()
	{
		if (plInfo != null)
		{
			command = new MyVector("cmd do fire player info");
			command.addElement(new Command("Chat", this, 1073, plInfo));
			initPopupDetail("|1|" + plInfo.stringLevel, null);
		}
	}

	private void doFireTop()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do fire top player");
			CPlayer p = CPlayer.arrayTopPlayer[currentTabIndex][selected];
			command.addElement(new Command("Tán gẫu", this, 1073, p));
			command.addElement(new Command(L.makeFriend(), this, 1037, p));
			initPopupDetail(string.Empty, null);
		}
	}

	private void doFireTopPlayer()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do fire top player");
			command.addElement(new Command("Tán gẫu", this, 1073, null));
			command.addElement(new Command(L.more(), this, 1071, null));
			initPopupDetail(string.Empty, null);
		}
	}

	private void doFireInventory()
	{
		if (selected != -1 && selected < currentListLength && CPlayer.arrItemBox[selected] != null)
		{
			command = new MyVector("cmd do fire inventory");
			command.addElement(new Command("Lấy ra", this, 1053, null));
			addMyEquipDetail(CPlayer.arrItemBox[selected]);
		}
	}

	private void doFireBalo()
	{
		if (selected != -1 && selected < currentListLength && CPlayer.arrItemBalo[selected] != null)
		{
			command = new MyVector("cmd do fire balo");
			if (CCanvas.curScr is GameScr)
			{
				command.addElement(new Command("Sử dụng", this, 1057, null));
			}
			else
			{
				command.addElement(new Command("Xóa", this, 1056, null));
			}
			addMyEquipDetail(CPlayer.arrItemBalo[selected]);
		}
	}

	private void doKhamNam()
	{
		if (selected != -1 && selected < currentListLength && CPlayer.arrItemKhamNam[selected] != null)
		{
			command = new MyVector(string.Empty);
			command.addElement(new Command("Đính ngọc", this, 1098, null));
			command.addElement(new Command("Hủy đính", this, 1099, null));
			addMyEquipDetail(CPlayer.arrItemKhamNam[selected]);
		}
	}

	private void doFireRPG()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		switch (selected)
		{
		case 0:
			setTypeMail();
			break;
		case 1:
			setTypeMyInfo();
			break;
		case 2:
			GameScr.iconOn = !GameScr.iconOn;
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
			break;
		case 3:
			GameService.gI().openUIZone();
			break;
		case 4:
			GameService.gI().requestMapFilter();
			break;
		case 5:
			GameService.gI().requestMoneyFilter();
			break;
		case 6:
		{
			bool flag = Rms.loadRMSInt("graphic") == 1;
			MyVector myVector = new MyVector("menu rpg");
			myVector.addElement(new Command((!flag) ? "Đồ họa thấp" : "Đồ họa cao", CCanvas.gameScrRPG, 28, null));
			if (mSystem.clientType != mSystem.JAVA)
			{
				myVector.addElement(new Command((!mSystem.disableSound) ? "Bật âm thanh" : "Tắt âm thanh", CCanvas.gameScrRPG, 27, null));
			}
			myVector.addElement(new Command("Diễn đàn", CCanvas.gameScrRPG, 26, null));
			CCanvas.menu.startAt(myVector, 0);
			closeDetail();
			break;
		}
		case 7:
			GameScr.isDrawChat = !GameScr.isDrawChat;
			CRes.saveRMSInt("drawchat", (!GameScr.isDrawChat) ? 1 : 0);
			closeDetail();
			hide();
			break;
		case 8:
			Main.exit();
			break;
		}
	}

	private void doFireFunction()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		int num = strFunction.Length;
		if (num == 4)
		{
			switch (selected)
			{
			case 0:
				CCanvas.gameScr.perform(1003, null);
				isDetail = false;
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				deltaH = (deltaHmax = 0);
				hide();
				break;
			case 1:
				CPlayer.hasDrag = !CPlayer.hasDrag;
				CRes.saveRMSInt("drag", (!CPlayer.hasDrag) ? 1 : 0);
				isDetail = false;
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				deltaH = (deltaHmax = 0);
				hide();
				break;
			case 2:
				GameScr.isDrawChat = !GameScr.isDrawChat;
				CRes.saveRMSInt("drawchat", (!GameScr.isDrawChat) ? 1 : 0);
				closeDetail();
				hide();
				break;
			case 3:
				CCanvas.gameScr.perform(1005, null);
				isDetail = false;
				if (cmtoY > cmyLim)
				{
					cmtoY = cmyLim;
				}
				deltaH = (deltaHmax = 0);
				hide();
				break;
			}
			return;
		}
		switch (selected)
		{
		case 0:
			if (isLoki)
			{
				CCanvas.gameScr.perform(15000, PM.getMyPlayer());
			}
			else if (isHawk)
			{
				CCanvas.gameScr.perform(15002, PM.getMyPlayer());
			}
			else if (isUltron)
			{
				CCanvas.gameScr.perform(15004, PM.getMyPlayer());
			}
			else if (isThor)
			{
				CCanvas.gameScr.perform(15005, PM.getMyPlayer());
			}
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
			break;
		case 1:
			CCanvas.gameScr.perform(1003, null);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
			break;
		case 2:
			CPlayer.hasDrag = !CPlayer.hasDrag;
			CRes.saveRMSInt("drag", (!CPlayer.hasDrag) ? 1 : 0);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
			break;
		case 3:
			GameScr.isDrawChat = !GameScr.isDrawChat;
			CRes.saveRMSInt("drawchat", (!GameScr.isDrawChat) ? 1 : 0);
			closeDetail();
			hide();
			break;
		case 4:
			CCanvas.gameScr.perform(1005, null);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
			break;
		}
	}

	public void doFireMail()
	{
		if (selected == -1)
		{
			return;
		}
		MsgInfo msgInfo = (MsgInfo)listMail.elementAt(selected);
		command = new MyVector("cmd do fire mail");
		if (selected > 0)
		{
			command.addElement(new Command(L.delete(), this, 1030, null));
			command.addElement(new Command(L.deleteAll(), this, 1031, null));
			command.addElement(new Command(L.newMess(), this, 1032, msgInfo));
			if (!msgInfo.fromName.Equals("ADMIN"))
			{
				command.addElement(new Command(L.addFriend(), this, 1033, msgInfo));
			}
		}
		else
		{
			command.addElement(new Command("Chat", this, 1035, null));
		}
		msgInfo.isRead = true;
		addMailDetail(msgInfo);
	}

	private void splitCommandName()
	{
		splitCommand = new string[this.command.size()][];
		for (int i = 0; i < this.command.size(); i++)
		{
			Command command = (Command)this.command.elementAt(i);
			splitCommand[i] = mFont.tahoma_7.splitFontArray(command.caption, 36);
		}
	}

	private void doFireShop()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		command = new MyVector("cmd do fire shop");
		currItem = CPlayer.arrItemShop[currentTabIndex][selected];
		if (typeShop == 1 && currItem != null)
		{
			if (currItem.buyCoin > 0 && currItem.buyGold > 0)
			{
				command.addElement(new Command(L.buy() + " " + L.xu(), this, 1101, currItem));
				command.addElement(new Command(L.buy() + " " + L.luong(), this, 1102, currItem));
			}
			else
			{
				command.addElement(new Command(L.buy() + " 1", this, 1020, currItem));
				command.addElement(new Command(L.buy() + " 10", this, 1021, currItem));
				command.addElement(new Command(L.buy() + " 50", this, 1022, currItem));
			}
		}
		if (typeShop == 0)
		{
			if (currItem.buyCoin > 0 && currItem.buyGold > 0)
			{
				command.addElement(new Command(L.buy() + " " + L.xu(), this, 1101, currItem));
				command.addElement(new Command(L.buy() + " " + L.luong(), this, 1102, currItem));
			}
			else
			{
				command.addElement(new Command(L.buy(), this, 1020, currItem));
			}
		}
		addShopItem(currItem);
		if (!CCanvas.isTouch)
		{
			selectedShop = 0;
		}
		else
		{
			selectedShop = -1;
		}
	}

	public void doFireBietDoi()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do fire biet doi");
			ClanItem clanItem = (ClanItem)shopBietDoi.elementAt(selected);
			if (clanItem.xu != -1)
			{
				command.addElement(new Command(L.buy(), this, 1090, clanItem));
			}
			else if (clanItem.luong != -1)
			{
				command.addElement(new Command(L.buy(), this, 1091, clanItem));
			}
			addBietDoiItem(clanItem);
		}
	}

	public void doFireMyEquip()
	{
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		if (selected < 7)
		{
			if (CPlayer.arrItemBody[selected] != null)
			{
				command = new MyVector("cmd o fire my equip");
				command.addElement(new Command("Tháo ra", this, 1050, null));
				command.addElement(new Command("Sử dụng", this, 1093, null));
				addBodyDetail(CPlayer.arrItemBody[selected]);
			}
		}
		else
		{
			if (CPlayer.arrItemBag[selected - 7] == null)
			{
				return;
			}
			command = new MyVector("cmd do fire my equip");
			if (CCanvas.panel != null && (CCanvas.panel.type == 19 || CCanvas.panel.type == 20))
			{
				Item item = CPlayer.arrItemBag[selected - 7];
				if (!item.isKhamNam)
				{
					if (item.template.type != 12)
					{
						command.addElement(new Command("Trang bị", this, 1051, null));
					}
					if (item.template.type == 12 || item.template.type == 14 || item.template.type == 15)
					{
						command.addElement(new Command("Nhập ngọc", this, 2000, item));
					}
					else
					{
						command.addElement(new Command("Sử dụng", this, 1059, null));
					}
				}
				if (item == CPlayer.arrItemKhamNam[0])
				{
					command.addElement(new Command("Hủy đính", this, 1100, item));
				}
				else if (item == CPlayer.arrItemKhamNam[1])
				{
					command.addElement(new Command("Hủy đính", this, 1100, item));
				}
				else if (item == CPlayer.arrItemKhamNam[2])
				{
					command.addElement(new Command("Hủy đính", this, 1100, item));
				}
				else if (item == CPlayer.arrItemKhamNam[3])
				{
					command.addElement(new Command("Hủy đính", this, 1100, item));
				}
				else if (!item.isSocketing && item.template.type != 10)
				{
					if (!item.isKhamNam)
					{
						if (item.nSocket - item.gems.size() > 0 || item.template.type == 12)
						{
							command.addElement(new Command("Đính ngọc", this, 1097, CPlayer.arrItemBag[selected - 7]));
						}
					}
					else
					{
						command.addElement(new Command("Đóng", this, 2001, null));
					}
				}
			}
			else if (CCanvas.panel != null && CCanvas.panel.type == 24)
			{
				command.addElement(new Command(L.use_for_trade, this, 7000, CPlayer.arrItemBag[selected - 7]));
			}
			else
			{
				Item item2 = CPlayer.arrItemBag[selected - 7];
				if (item2.template.type == 10)
				{
					if (!item2.isInBalo || item2.template.id == 220 || item2.template.id == 221)
					{
						int num = calculateMaxHealingItem(item2.template.id);
						if (num < 2)
						{
							command.addElement(new Command("Cất vào balô", this, 1054, null));
						}
					}
				}
				else if (item2.template.type == 5)
				{
					command.addElement(new Command("Trang bị", this, 1051, null));
					if (!item2.isInBalo || item2.template.id == 220 || item2.template.id == 221)
					{
						int num2 = calculateMaxHealingItem(item2.template.id);
						if (num2 < 2)
						{
							command.addElement(new Command("Cất vào balô", this, 1054, null));
						}
					}
				}
				else
				{
					command.addElement(new Command("Trang bị", this, 1051, null));
				}
				command.addElement(new Command("Cất vào rương", this, 1052, null));
				if (CCanvas.panel.type == 1 || CCanvas.panel.type == 0)
				{
					command.addElement(new Command("Bán", this, 1058, null));
				}
				else
				{
					command.addElement(new Command("Sử dụng", this, 1059, null));
				}
			}
			addMyEquipDetail(CPlayer.arrItemBag[selected - 7]);
		}
	}

	private int calculateMaxHealingItem(int id)
	{
		if (id != 220 && id != 221)
		{
			return -1;
		}
		int num = 0;
		int num2 = 0;
		for (int i = 0; i < CPlayer.arrItemBalo.Length; i++)
		{
			if (CPlayer.arrItemBalo[i] != null)
			{
				if (CPlayer.arrItemBalo[i].template.id == 220)
				{
					num++;
				}
				if (CPlayer.arrItemBalo[i].template.id == 221)
				{
					num2++;
				}
			}
		}
		switch (id)
		{
		case 220:
			return num;
		case 221:
			return num2;
		default:
			return -1;
		}
	}

	private void doFireItem()
	{
		if (selected != -1)
		{
			command = new MyVector("cmd do  fire item");
			command.addElement(new Command(L.buy(), this, 1001, null));
			initPopupDetail(string.Empty, null);
			CCanvas.prepareScr.isTouchItem = false;
			perform(1000, null);
		}
	}

	public Item getCurI()
	{
		if (selected == -1)
		{
			return null;
		}
		return CPlayer.arrItemShop[currentTabIndex][selected];
	}

	public void addShopItem(Item item)
	{
		string empty = string.Empty;
		string text = string.Empty;
		if (item.itemOption != null)
		{
			ItemOption[] options = copyItemOptionArray(item.itemOption);
			for (int i = 0; i < item.itemOption.Length; i++)
			{
				if (item.itemOption[i].isCompareOption)
				{
					options = deleteOneOption(options, item.itemOption[i]);
				}
			}
			item.itemOption = copyItemOptionArray(options);
			bool flag = compareWithBodyItem(item);
			for (int j = 0; j < item.itemOption.Length; j++)
			{
				if (item.itemOption[j].optionTemplate.id == 15 || item.itemOption[j].optionTemplate.id == 16 || item.itemOption[j].optionTemplate.id == 17)
				{
					continue;
				}
				if (!flag)
				{
					empty = item.itemOption[j].getOptionString();
					if (!empty.Equals(string.Empty))
					{
						if (j != 0)
						{
							text += "\n";
						}
						text = text + "|0|0|" + empty;
					}
					continue;
				}
				empty = (item.itemOption[j].isCompareOption ? item.itemOption[j].getOptionStringForCompare() : ((item.itemOption[j].num == 0) ? item.itemOption[j].getOptionString() : (item.itemOption[j].getOptionString() + " (" + ((item.itemOption[j].num <= 0) ? string.Empty : "+") + item.itemOption[j].num + ")")));
				if (!empty.Equals(string.Empty))
				{
					if (j != 0)
					{
						text += "\n";
					}
					text = ((item.itemOption[j].num <= 0) ? ((item.itemOption[j].num >= 0) ? (text + "|0|0|" + empty) : (text + "|7|0|" + empty)) : (text + "|1|0|" + empty));
				}
			}
		}
		text = text + "\n|0|0|Cấp độ yêu cầu: " + item.template.strRequire;
		text += "\n--";
		text = text + "\n|3|" + item.template.description;
		initPopupDetail(text, item);
	}

	public void addBietDoiItem(ClanItem item)
	{
		string empty = string.Empty;
		empty = empty + "|0|1|" + item.name;
		string text = empty;
		empty = text + "\n|0|1|Thời gian: " + item.expDate + " giờ";
		empty += "\n--";
		empty = empty + "\n|3|Cấp độ yêu cầu: " + item.levelRequire;
		initPopupDetail(empty, null);
	}

	public void perform(int idAction, object p)
	{
		CRes.outz("id action=" + idAction);
		if (idAction == 7000)
		{
			if (isLock)
			{
				CCanvas.startOKDlg(L.unlock_item_to_trade);
				return;
			}
			Item item = (Item)p;
			for (int i = 0; i < CCanvas.panel.vMyGD.size(); i++)
			{
				Item item2 = (Item)CCanvas.panel.vMyGD.elementAt(i);
				if (item2.indexUI == item.indexUI)
				{
					CCanvas.startOKDlg(L.already_has_item);
					return;
				}
			}
			if (item.quantity > 1)
			{
				putQuantily();
				return;
			}
			item.isSelect = true;
			Item item3 = new Item();
			item3.template = item.template;
			item3.itemOption = item.itemOption;
			item3.indexUI = item.indexUI;
			CCanvas.panel.vMyGD.addElement(item3);
			GameService.gI().giaodich(2, -1, (sbyte)item3.indexUI, item3.quantity);
			closeDetail();
		}
		if (idAction == 7001)
		{
			Item item4 = (Item)p;
			item4.isSelect = false;
			CCanvas.panel.vMyGD.removeElement(item4);
			if (CCanvas.panel.currentTabIndex == 1)
			{
				CCanvas.panel.setTabGiaoDich(true);
			}
			GameService.gI().giaodich(4, -1, (sbyte)item4.indexUI, -1);
		}
		if (idAction == 7002)
		{
			isAccept = true;
			CCanvas.endDlg();
			GameService.gI().giaodich(7, -1, -1, -1);
			hide();
		}
		if (idAction == 7003)
		{
			int num = 0;
			try
			{
				num = int.Parse(CCanvas.inputDlg.tfInput.getText());
			}
			catch (Exception)
			{
				CCanvas.startOKDlg(L.input_money_wrong);
				CCanvas.endDlg();
				CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
				return;
			}
			if (num > MyMidlet.myInfo.xu)
			{
				CCanvas.startOKDlg(L.not_enough_money);
				CCanvas.endDlg();
				CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
				return;
			}
			moneyGD = num;
			GameService.gI().giaodich(2, -1, -1, num);
			CCanvas.endDlg();
			CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
			closeDetail();
		}
		if (idAction == 7004)
		{
			if (selected == -1 || selected < 7 || CPlayer.arrItemBag[selected - 7] == null)
			{
				return;
			}
			Item item5 = CPlayer.arrItemBag[selected - 7];
			int num2 = 0;
			try
			{
				num2 = int.Parse(CCanvas.inputDlg.tfInput.getText());
			}
			catch (Exception)
			{
				CCanvas.startOKDlg(L.input_quantity_wrong);
				CCanvas.endDlg();
				CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
				return;
			}
			if (num2 <= 0 || num2 > item5.quantity)
			{
				CCanvas.startOKDlg(L.input_quantity_wrong);
				CCanvas.endDlg();
				CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
				return;
			}
			item5.isSelect = true;
			Item item6 = new Item();
			item6.template = item5.template;
			item6.quantity = num2;
			item6.indexUI = item5.indexUI;
			item6.itemOption = item5.itemOption;
			CCanvas.panel.vMyGD.addElement(item6);
			GameService.gI().giaodich(2, -1, (sbyte)item6.indexUI, item6.quantity);
			CCanvas.endDlg();
			CCanvas.inputDlg.tfInput.setIputType(TField.INPUT_TYPE_ANY);
			closeDetail();
		}
		if (idAction == 7005)
		{
			CCanvas.endDlg();
			closeDetail();
		}
		if (idAction == 6002)
		{
			CCanvas.inputDlg.setInfo(L.input_clan_name_to_create(), new Command(string.Empty, this, 1006, null), new Command(string.Empty, this, 1007, null), TField.INPUT_TYPE_ANY);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
		if (idAction == 6003)
		{
			InfoDlg.hide();
			CCanvas.endDlg();
		}
		if (idAction == 6000)
		{
			GameService.gI().requestBuyItem(0, currItem.template.id, 1);
			closeDetail();
		}
		if (idAction == 6001)
		{
			GameService.gI().requestBuyItem(1, currItem.template.id, 1);
			closeDetail();
		}
		if (idAction == 8000)
		{
			closeDetail();
		}
		if (idAction == 5001)
		{
			Member member = (Member)p;
			GameService.gI().clanRemote(member.ID, 0);
			closeDetail();
		}
		if (idAction == 5002)
		{
			Member member2 = (Member)p;
			GameService.gI().clanRemote(member2.ID, 1);
			closeDetail();
		}
		if (idAction == 5003)
		{
			Member member3 = (Member)p;
			GameService.gI().clanRemote(member3.ID, 2);
			closeDetail();
		}
		if (idAction == 5004)
		{
			Member member4 = (Member)p;
			GameService.gI().clanRemote(member4.ID, -1);
			closeDetail();
		}
		if (idAction == 4000)
		{
			Clan clan = (Clan)p;
			if (clan != null)
			{
				CCanvas.endDlg();
				isDetail = false;
				closeDetail();
				GameService.gI().clanMessage(2, null, clan.ID);
			}
		}
		if (idAction == 4001)
		{
			Clan clan2 = (Clan)p;
			if (clan2 != null)
			{
				InfoDlg.showWait();
				clanReport = L.pleaseWait();
				GameService.gI().clanMember(clan2.ID);
			}
			closeDetail();
		}
		if (idAction == 4004)
		{
			CCanvas.startYesNoDlg(L.do_u_want_join_clan() + currClan.name, new Command(L.yes(), this, 4000, currClan), new Command(L.no(), this, 4005, currClan));
		}
		if (idAction == 4005)
		{
			CCanvas.endDlg();
			closeDetail();
		}
		if (idAction == 2007)
		{
			string text = CCanvas.inputDlg.tfInput.getText();
			if (text == null || text == string.Empty)
			{
				return;
			}
			InfoDlg.showWait();
			GameService.gI().clanMessage(0, text, -1);
			CCanvas.endDlg();
		}
		if (idAction == 2006)
		{
			string text2 = CCanvas.inputDlg.tfInput.getText();
			if (text2 == null || text2 == string.Empty)
			{
				return;
			}
			InfoDlg.showWait();
			CCanvas.endDlg();
			GameService.gI().searchClan(text2);
		}
		if (idAction == 2004)
		{
			if (CCanvas.inputDlg.tfInput.getText() == string.Empty)
			{
				CCanvas.startOKDlg(L.clan_slogan_blank());
			}
			else
			{
				string text3 = CCanvas.inputDlg.tfInput.getText();
				if (text3 == null || text3 == string.Empty)
				{
					return;
				}
				GameService.gI().getClan(4, (short)CPlayer.myPlayer.clan.imgID, text3, -1);
				CCanvas.endDlg();
			}
		}
		if (idAction == 2005)
		{
			CCanvas.endDlg();
		}
		if (idAction == 2002)
		{
			GameService.gI().ghepNgoc(CPlayer.arrItemGhepNgoc);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 2003)
		{
			if (selected == -1)
			{
				return;
			}
			for (int j = 0; j < CPlayer.arrItemBag.Length; j++)
			{
				Item item7 = CPlayer.arrItemBag[j];
				if (item7 != null && item7.template.id == CPlayer.arrItemGhepNgoc[selected].template.id)
				{
					item7.isKhamNam = false;
					break;
				}
			}
			CPlayer.arrItemGhepNgoc[selected] = null;
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 2001)
		{
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 2000)
		{
			Item item8 = (Item)p;
			for (int k = 0; k < CPlayer.arrItemGhepNgoc.Length; k++)
			{
				if (CPlayer.arrItemGhepNgoc[k] == null)
				{
					CPlayer.arrItemGhepNgoc[k] = item8;
					CPlayer.arrItemGhepNgoc[k].isKhamNam = true;
					break;
				}
			}
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1000)
		{
			CCanvas.prepareScr.perform(1013, null);
		}
		if (idAction == 1001)
		{
			buyItem(currItem, 1);
		}
		if (idAction == 1002)
		{
			CCanvas.endDlg();
		}
		if (idAction == 1003)
		{
			buyItem(getCurI(), amount);
		}
		if (idAction == 1004)
		{
			buyItem(getCurI(), amount);
		}
		if (idAction == 1005)
		{
		}
		if (idAction == 1006)
		{
			if (CCanvas.inputDlg.tfInput.getText() == string.Empty)
			{
				CCanvas.startOKDlg(L.clan_name_blank());
			}
			else
			{
				if (tabIcon == null)
				{
					tabIcon = new TabClanIcon();
				}
				tabIcon.text = CCanvas.inputDlg.tfInput.getText();
				GameService.gI().getClan(1, -1, null, 0);
			}
			CCanvas.endDlg();
			InfoDlg.hide();
		}
		if (idAction == 1007)
		{
			CCanvas.endDlg();
			InfoDlg.hide();
		}
		if (idAction == 1008)
		{
		}
		if (idAction == 1009)
		{
			hide();
		}
		if (idAction == 1010)
		{
			string empty = string.Empty;
		}
		if (idAction == 1011)
		{
		}
		if (idAction == 1012)
		{
		}
		if (idAction == 1013)
		{
		}
		if (idAction == 1020)
		{
			amount = 1;
			perform(1028, p);
		}
		if (idAction == 1021)
		{
			amount = 10;
			perform(1028, p);
		}
		if (idAction == 1022)
		{
			amount = 50;
			perform(1028, p);
		}
		if (idAction == 1026)
		{
			CCanvas.endDlg();
		}
		if (idAction == 1027)
		{
			isFindRoom = false;
			CCanvas.endDlg();
		}
		if (idAction == 1028)
		{
			CCanvas.endDlg();
			string text4 = string.Empty;
			Item item9 = (Item)p;
			if (item9.buyCoin > 0)
			{
				text4 = item9.buyCoin * amount + " " + L.xu();
			}
			else if (item9.buyGold > 0)
			{
				text4 = item9.buyGold * amount + " " + L.luong();
			}
			if (text4.Equals(string.Empty))
			{
				GameService.gI().requestBuyItem(0, item9.template.id, (sbyte)amount);
			}
			else
			{
				string text5 = ((amount <= 1) ? ("vật phẩm " + item9.template.name) : (amount + " vật phẩm " + item9.template.name));
				string info = L.bancochac1() + text5 + L.bancochac2() + text4 + L.bancochac3();
				CCanvas.startYesNoDlg(info, new Command(L.yes(), this, 1029, p), new Command(L.no(), this, 1026, null));
			}
		}
		if (idAction == 1101)
		{
			CCanvas.endDlg();
			Item item10 = (Item)p;
			GameService.gI().requestBuyItem(0, item10.template.id, 1);
		}
		if (idAction == 1102)
		{
			CCanvas.endDlg();
			Item item11 = (Item)p;
			GameService.gI().requestBuyItem(1, item11.template.id, 1);
		}
		if (idAction == 1029)
		{
			Item item12 = (Item)p;
			buyItem(item12, amount);
		}
		if (idAction == 1030 && selected != -1)
		{
			listMail.removeElementAt(selected);
			setTabMail();
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1031)
		{
			listMail.removeAllElements();
			setTabMail();
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1032)
		{
			MsgInfo msgInfo = (MsgInfo)p;
			CCanvas.inputDlg.setInfo("Tán gẫu với " + msgInfo.fromName, new Command(string.Empty, this, 1034, p), new Command(L.close(), this, 1026, null), TField.INPUT_TYPE_ANY);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
		if (idAction == 1033)
		{
			MsgInfo msgInfo2 = (MsgInfo)p;
			GameService.gI().friend(1, msgInfo2.fromID);
			InfoDlg.showWait();
		}
		if (idAction == 1034)
		{
			if (CCanvas.inputDlg.tfInput.getText().Equals(string.Empty))
			{
				clearEvent();
				return;
			}
			MsgInfo msgInfo3 = (MsgInfo)p;
			GameService.gI().chatTo(msgInfo3.fromID, CCanvas.inputDlg.tfInput.getText());
			CCanvas.endDlg();
		}
		if (idAction == 1035)
		{
			CCanvas.inputDlg.setInfo("Chat thế giới", new Command(string.Empty, this, 1036, p), new Command(L.close(), this, 1026, null), TField.INPUT_TYPE_ANY);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
		if (idAction == 1036)
		{
			if (CCanvas.inputDlg.tfInput.getText().Equals(string.Empty))
			{
				clearEvent();
				return;
			}
			GameService.gI().chatTo(-1, CCanvas.inputDlg.tfInput.getText());
			CCanvas.endDlg();
		}
		if (idAction == 1037)
		{
			CPlayer cPlayer = (CPlayer)p;
			GameService.gI().friend(1, cPlayer.IDDB);
			InfoDlg.showWait();
		}
		if (idAction == 1050)
		{
			GameService.gI().moveItem(5, (sbyte)selected);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1051)
		{
			if (PM.getMyPlayer2() != null)
			{
				if (PM.getMyPlayer2().y > 360)
				{
					CCanvas.startOKDlg("Không thể thay đổi trang phục khi đang ở dưới đất");
				}
				else
				{
					GameService.gI().moveItem(4, (sbyte)(selected - 7));
				}
			}
			else
			{
				GameService.gI().moveItem(4, (sbyte)(selected - 7));
			}
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			setCmy();
		}
		if (idAction == 1052)
		{
			GameService.gI().moveItem(1, (sbyte)(selected - 7));
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1053)
		{
			GameService.gI().moveItem(0, (sbyte)selected);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1054)
		{
			GameService.gI().moveItem(6, (sbyte)(selected - 7));
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1055)
		{
			GameService.gI().moveItem(7, (sbyte)(selected - 7));
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1056)
		{
			GameService.gI().moveItem(7, (sbyte)selected);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1057)
		{
			GameService.gI().useItem((sbyte)selected);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			hide();
		}
		if (idAction == 1058 && selected - 7 >= 0)
		{
			GameService.gI().sellItemInBag((sbyte)(selected - 7));
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1059 && selected - 7 >= 0)
		{
			GameService.gI().useItemInBag((sbyte)(selected - 7));
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1060 && pointLeft - 1 >= 0)
		{
			pointLeft--;
			perform(1063, null);
		}
		if (idAction == 1063)
		{
			GameService.gI().addPoint((sbyte)selected);
			curPointAdd[selected]++;
			currAbility[selected] += tisoPoint[selected];
			perform(1064, null);
		}
		if (idAction == 1064)
		{
			command = new MyVector("cmd action 1-64");
			if (pointLeft > 0)
			{
				command.addElement(new Command("Tăng", this, 1060, null));
			}
		}
		if (idAction == 1070)
		{
			InfoDlg.showWait();
			GameService.gI().friend(2, ((CPlayer)p).IDDB);
		}
		if (idAction == 1071)
		{
		}
		if (idAction == 1072)
		{
			setTypeClan();
		}
		if (idAction == 1073)
		{
			CPlayer cPlayer2 = (CPlayer)p;
			CCanvas.inputDlg.setInfo("Tán gẫu với " + cPlayer2.name, new Command(string.Empty, this, 1074, cPlayer2), new Command(L.close(), this, 1026, null), TField.INPUT_TYPE_ANY);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
		if (idAction == 1074)
		{
			if (CCanvas.inputDlg.tfInput.getText().Equals(string.Empty))
			{
				clearEvent();
				return;
			}
			CPlayer cPlayer3 = (CPlayer)p;
			GameService.gI().chatTo(cPlayer3.IDDB, CCanvas.inputDlg.tfInput.getText());
			CCanvas.endDlg();
		}
		if (idAction == 1083)
		{
		}
		if (idAction == 1084)
		{
		}
		if (idAction == 1086)
		{
		}
		if (idAction == 1087)
		{
		}
		if (idAction == 1088)
		{
		}
		if (idAction == 1090)
		{
			GameService.gI().getShopBietDoi(1, 0, ((ClanItem)p).id);
			CCanvas.startOKDlg(L.pleaseWait());
		}
		if (idAction == 1091)
		{
			GameService.gI().getShopBietDoi(1, 1, ((ClanItem)p).id);
			CCanvas.startOKDlg(L.pleaseWait());
		}
		if (idAction == 1092)
		{
			int num3 = 0;
			for (int l = 0; l < MM.mapFiles.size(); l++)
			{
				MapFile mapFile = (MapFile)MM.mapFiles.elementAt(l);
				if (mapFile.mapName.StartsWith("Boss"))
				{
					num3++;
				}
			}
			GameService.gI().mapSelect(MM.getMapFileByIndex((PrepareScr.currLevel == 4) ? (MM.mapFiles.size() - num3 + selected) : selected).mapID);
			hide();
		}
		if (idAction == 1093)
		{
			GameService.gI().useItemInBody((sbyte)selected);
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1094)
		{
			isFindRoom = true;
			CCanvas.inputDlg = new InputDlg();
			CCanvas.inputDlg.setInfo("Nhập số phòng", new Command(L.ok(), this, 1095, null), new Command(L.close(), this, 1027, null), TField.INPUT_TYPE_NUMERIC);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(true);
			}
		}
		if (idAction == 1095)
		{
			CCanvas.endDlg();
			if (CCanvas.inputDlg.tfInput.getText() == null || CCanvas.inputDlg.tfInput.getText().Equals(string.Empty))
			{
				clearEvent();
				return;
			}
			int num4 = int.Parse(CCanvas.inputDlg.tfInput.getText());
			CCanvas.inputDlg = new InputDlg();
			CCanvas.inputDlg.setInfo("Nhập khu vực", new Command(L.ok(), this, 1096, num4 + string.Empty), new Command(L.close(), this, 1027, null), TField.INPUT_TYPE_NUMERIC);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
		if (idAction == 1096)
		{
			int num5 = int.Parse((string)p);
			CCanvas.endDlg();
			if (CCanvas.inputDlg.tfInput.getText() == null || CCanvas.inputDlg.tfInput.getText().Equals(string.Empty))
			{
				clearEvent();
				return;
			}
			int num6 = int.Parse(CCanvas.inputDlg.tfInput.getText());
			GameService.gI().requestEmptyRoom(2, -1, num5 * 1000 + num6 + string.Empty);
			InfoDlg.showWait();
		}
		if (idAction == 1988)
		{
			Item item13 = (Item)p;
			for (int m = 0; m < CPlayer.arrItemBag.Length; m++)
			{
				if (CPlayer.arrItemBag[m] != null && CPlayer.arrItemBag[m] == item13)
				{
					CPlayer.arrItemBag[m].isKhamNam = false;
				}
			}
		}
		if (idAction == 1097)
		{
			Item item14 = (Item)p;
			item14.iInBag = selected - 7;
			item14.isKhamNam = true;
			if (item14.template.type == 12)
			{
				if (CPlayer.arrItemKhamNam[1] == null)
				{
					CPlayer.arrItemKhamNam[1] = item14;
				}
				else if (CPlayer.arrItemKhamNam[2] == null)
				{
					CPlayer.arrItemKhamNam[2] = item14;
				}
				else
				{
					if (CPlayer.arrItemKhamNam[3] != null)
					{
						perform(1988, CPlayer.arrItemKhamNam[3]);
					}
					CPlayer.arrItemKhamNam[3] = item14;
				}
			}
			else
			{
				if (CPlayer.arrItemKhamNam[0] != null)
				{
					perform(1988, CPlayer.arrItemKhamNam[0]);
				}
				CPlayer.arrItemKhamNam[0] = item14;
			}
			if (CPlayer.arrItemKhamNam[0] != null && CPlayer.arrItemKhamNam[1] != null)
			{
				int num7 = 1;
				currentTabIndex = 0;
				lastTabIndex[type] = 0;
				selected = lastSelect[currentTabIndex];
				if (type == 19)
				{
					currentListLength = CPlayer.arrItemKhamNam.Length;
					setCmy();
				}
				else if (type == 20)
				{
					if (currentTabIndex == 0)
					{
						currentListLength = CPlayer.arrItemKhamNam.Length;
					}
					else
					{
						setTabMyEquip();
					}
					setCmy();
				}
			}
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 70001)
		{
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
			GameService.gI().nhanAchievement(((Achievement)p).id);
			InfoDlg.showWait();
		}
		if (idAction == 1098)
		{
			if (CPlayer.arrItemKhamNam[0] == null)
			{
				CCanvas.startOKDlg("Vui lòng vào hành trang, chọn vật phẩm có lỗ để đính ngọc");
				return;
			}
			if (CPlayer.arrItemKhamNam[1] == null && CPlayer.arrItemKhamNam[2] == null && CPlayer.arrItemKhamNam[3] == null)
			{
				CCanvas.startOKDlg("Vui lòng vào hành trang, chọn ngọc để đính vào vật phẩm");
				return;
			}
			GameService.gI().khamNam(CPlayer.arrItemKhamNam[0].iInBag, (CPlayer.arrItemKhamNam[1] != null) ? CPlayer.arrItemKhamNam[1].iInBag : (-1), (CPlayer.arrItemKhamNam[2] != null) ? CPlayer.arrItemKhamNam[2].iInBag : (-1), (CPlayer.arrItemKhamNam[3] != null) ? CPlayer.arrItemKhamNam[3].iInBag : (-1));
			CPlayer.arrItemKhamNam = new Item[4];
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1099)
		{
			CPlayer.arrItemBag[CPlayer.arrItemKhamNam[selected].iInBag].isKhamNam = false;
			CPlayer.arrItemKhamNam[selected] = null;
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1100)
		{
			((Item)p).isKhamNam = false;
			if (((Item)p).template.type == 12)
			{
				for (int n = 0; n < CPlayer.arrItemKhamNam.Length; n++)
				{
					if (CPlayer.arrItemKhamNam[n] != null && CPlayer.arrItemKhamNam[n] == p)
					{
						if (CPlayer.arrItemKhamNam[n] != null)
						{
							perform(1988, CPlayer.arrItemKhamNam[n]);
						}
						CPlayer.arrItemKhamNam[n] = null;
						break;
					}
				}
			}
			else
			{
				if (CPlayer.arrItemKhamNam[0] != null)
				{
					perform(1988, CPlayer.arrItemKhamNam[0]);
				}
				CPlayer.arrItemKhamNam[0] = null;
			}
			isDetail = false;
			if (cmtoY > cmyLim)
			{
				cmtoY = cmyLim;
			}
			deltaH = (deltaHmax = 0);
		}
		if (idAction == 1200)
		{
			int num8 = 0;
			for (int num9 = 0; num9 < MM.mapFiles.size(); num9++)
			{
				MapFile mapFile2 = (MapFile)MM.mapFiles.elementAt(num9);
				if (mapFile2.mapName.StartsWith("Boss"))
				{
					num8++;
				}
			}
			MapFile mapFile3 = (MapFile)MM.mapFiles.elementAt(selected);
			GameService.gI().chooseMapFilter(!mapFile3.isCheckFilter, MM.getMapFileByIndex(selected).mapID);
			isDetail = false;
			if (CCanvas.isTouch)
			{
				selected = -1;
			}
		}
		if (idAction == 1201)
		{
			GameService.gI().chooseMoneyFilter(!isCheckMoneyFilter[selected], (sbyte)selected);
			isDetail = false;
			if (CCanvas.isTouch)
			{
				selected = -1;
			}
		}
		if (idAction == 1202)
		{
			GameService.gI().leaveClan();
			CCanvas.endDlg();
		}
		clearEvent();
	}

	public void setTabClansTopClanMember()
	{
		if (member == null)
		{
			currentListLength = 0;
			return;
		}
		currentListLength = member.size();
		clanInfo = L.member() + " " + ((currClan == null) ? CPlayer.myPlayer.clan.name : currClan.name);
		cmy = (cmtoY = 0);
		selected = (CCanvas.isTouch ? (-1) : 0);
		setCmy();
	}

	private void clearEvent()
	{
		pointerIsDowning = false;
		CCanvas.clearAllPointerEvent();
		CCanvas.clearKeyPressed();
		CCanvas.clearKeyHold();
	}

	private void buyItem(Item item, int amount)
	{
		if (item.buyCoin > 0)
		{
			GameService.gI().requestBuyItem(0, item.template.id, (sbyte)amount);
		}
		else if (item.buyGold > 0)
		{
			GameService.gI().requestBuyItem(1, item.template.id, (sbyte)amount);
		}
		CCanvas.endDlg();
	}

	private void restartPoint()
	{
		pointLeft = MyMidlet.myInfo.point;
		currAbility = new int[6];
		for (int i = 0; i < 6; i++)
		{
			currAbility[i] = ability[i];
		}
	}

	public void onChatFromMe(string text, string to)
	{
	}

	public void onCancelChat()
	{
	}

	public void setTypeShop(sbyte type1)
	{
		typeShop = type1;
		type = 0;
		setType(0);
		setTabShop();
	}

	public void setTypeTop()
	{
		type = 18;
		setType(0);
		setTabTop();
	}

	private void setTabTop()
	{
		ITEM_HEIGHT = 24;
		currentListLength = CPlayer.arrayTopPlayer[currentTabIndex].Length;
		CRes.outz(">>>> n top " + currentTabIndex + " = " + currentListLength);
		setCmy();
	}

	public void setTypeInventory()
	{
		type = 2;
		setType(0);
		setTabInventory();
	}

	public void setTypeInventoryWithMyEquip()
	{
		type = 5;
		setType(0);
		setTabInventoryWithMyEquip();
	}

	public void setTypeKhamNamWithMyEquip()
	{
		type = 20;
		setType(0);
		setTabKhamNamWithMyEquip();
		for (int i = 0; i < CPlayer.arrItemGhepNgoc.Length; i++)
		{
			CPlayer.arrItemGhepNgoc[i] = null;
		}
		for (int j = 0; j < CPlayer.arrItemBag.Length; j++)
		{
			if (CPlayer.arrItemBag[j] != null)
			{
				CPlayer.arrItemBag[j].isKhamNam = false;
			}
		}
	}

	public void setTypeKhamNam()
	{
		type = 19;
		setType(0);
		setTabKhamnam();
		for (int i = 0; i < CPlayer.arrItemGhepNgoc.Length; i++)
		{
			CPlayer.arrItemGhepNgoc[i] = null;
		}
		for (int j = 0; j < CPlayer.arrItemBag.Length; j++)
		{
			if (CPlayer.arrItemBag[j] != null)
			{
				CPlayer.arrItemBag[j].isKhamNam = false;
			}
		}
	}

	public void setTypeBalo()
	{
		isLoki = false;
		isHawk = false;
		isUltron = false;
		isThor = false;
		if (GameScr.pm.isYourTurn())
		{
			if (PM.getMyPlayer().isAvenger == 4 && PM.getMyPlayer().isLokiSpecial)
			{
				isLoki = true;
			}
			if (PM.getMyPlayer().isAvenger == 7)
			{
				if (PM.getMyPlayer().isHawlSpecial)
				{
					isHawk = true;
				}
			}
			else if (PM.getMyPlayer().isAvenger == 8)
			{
				if (PM.getMyPlayer().isUltronSpecial)
				{
					isUltron = true;
				}
			}
			else if (PM.getMyPlayer().isAvenger == 3 && PM.getMyPlayer().isThorSpecial)
			{
				isThor = true;
			}
		}
		if (isLoki)
		{
			strFunction = new string[5]
			{
				"Giả dạng",
				((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
				"Chế độ " + (CPlayer.hasDrag ? "bình thường" : "kéo thả"),
				(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
				"Thoát"
			};
		}
		else if (isHawk)
		{
			strFunction = new string[5]
			{
				"Chọn mục tiêu",
				((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
				"Chế độ " + (CPlayer.hasDrag ? "bình thường" : "kéo thả"),
				(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
				"Thoát"
			};
		}
		else if (isUltron)
		{
			strFunction = new string[5]
			{
				"Nhân bản",
				((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
				"Chế độ " + (CPlayer.hasDrag ? "bình thường" : "kéo thả"),
				(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
				"Thoát"
			};
		}
		else if (isThor)
		{
			strFunction = new string[5]
			{
				"Sấm sét",
				((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
				"Chế độ " + (CPlayer.hasDrag ? "bình thường" : "kéo thả"),
				(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
				"Thoát"
			};
		}
		else
		{
			strFunction = new string[4]
			{
				((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
				"Chế độ " + (CPlayer.hasDrag ? "bình thường" : "kéo thả"),
				(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
				"Thoát"
			};
		}
		type = 16;
		setType(0);
		if (currentTabIndex == 0)
		{
			currentListLength = CPlayer.arrItemBalo.Length;
		}
		else
		{
			currentListLength = strFunction.Length;
		}
		setCmy();
	}

	public void setTypeRPG()
	{
		strFunction = new string[9]
		{
			"Tin nhắn",
			"Thông tin",
			((!GameScr.iconOn) ? "Bật" : "Tắt") + " icon",
			"Đổi khu vực",
			"Chọn chiến trường",
			"Chọn tiền cược",
			"Chức năng",
			(GameScr.isDrawChat ? "Tắt" : "Bật") + " tán gẫu",
			"Thoát"
		};
		type = 23;
		setType(0);
		if (currentTabIndex == 0)
		{
			Item[] arrItemBag = CPlayer.arrItemBag;
			currentListLength = 7 + arrItemBag.Length;
		}
		else if (currentTabIndex == 1)
		{
			currentListLength = CPlayer.arrItemBalo.Length;
		}
		else
		{
			currentListLength = strFunction.Length;
		}
		setCmy();
	}

	public void setTypeMail()
	{
		type = 6;
		setType(0);
		setTabMail();
	}

	public void setTypeMyEquip()
	{
		type = 4;
		setType(1);
		setTabMyEquip();
	}

	public void setTypeMoney()
	{
	}

	public void setTypeMap()
	{
		type = 17;
		setType(0);
		int num = 0;
		for (int i = 0; i < MM.mapFiles.size(); i++)
		{
			MapFile mapFile = (MapFile)MM.mapFiles.elementAt(i);
			if (mapFile.mapName.StartsWith("Boss"))
			{
				num++;
			}
		}
		if (PrepareScr.currLevel != 4)
		{
			currentListLength = MM.mapFiles.size() - num;
		}
		else
		{
			currentListLength = num;
		}
		setCmy();
	}

	public void setTypeMapFilter()
	{
		type = 26;
		setType(0);
		currentListLength = MM.mapFiles.size();
		setCmy();
	}

	public void setTypeMoneyFilter()
	{
		type = 27;
		setType(0);
		currentListLength = strMoney.Length;
		setCmy();
	}

	public void setTypeRoomlist()
	{
		type = 8;
		setType(0);
		currentListLength = roomList.size();
		setCmy();
	}

	public void setTypeFriend(MyVector vFriend)
	{
		this.vFriend = vFriend;
		CRes.outz("set friend size= " + vFriend.size());
		type = 9;
		setType(0);
		currentListLength = vFriend.size();
		setCmy();
	}

	public void setTypePlayerInfo(CPlayer p)
	{
		plInfo = p;
		type = 28;
		setType(0);
		currentListLength = 1;
		isDetail = true;
		doFirePlayerInfo();
		selected = 0;
	}

	public void setTypeMyInfo()
	{
		type = 29;
		setType(0);
		currentListLength = 0;
	}

	public void setTypeTopPlayer()
	{
	}

	public void setTypeClan()
	{
		type = 21;
		GameService.gI().topClan();
		if (CPlayer.myPlayer.clan != null && CPlayer.myPlayer.clan.ID != -1)
		{
			GameService.gI().clanStatus();
			GameService.gI().shopClan(0);
		}
		setType(0);
		currentTabIndex = 0;
		setTabClans();
		InfoDlg.showWait();
	}

	public Clan getCurrClan()
	{
		if (selected < 2)
		{
			return null;
		}
		if (selected > clans.Length + 1)
		{
			return null;
		}
		return clans[selected - 2];
	}

	public Clan getCurrTopClan()
	{
		if (selected < 0)
		{
			return null;
		}
		if (selected > topClans.Length - 1)
		{
			return null;
		}
		return topClans[selected];
	}

	public Member getCurrMember()
	{
		if (selected < 2)
		{
			return null;
		}
		if (selected > ((member == null) ? myMember.size() : member.size()) + 1)
		{
			return null;
		}
		return (member == null) ? ((Member)myMember.elementAt(selected - 2)) : ((Member)member.elementAt(selected - 2));
	}

	public Member getCurrTopClanMember()
	{
		if (selected < 0)
		{
			return null;
		}
		if (selected > member.size() - 1)
		{
			return null;
		}
		return (member == null) ? ((Member)myMember.elementAt(selected)) : ((Member)member.elementAt(selected));
	}

	public void addClanMemberDetail(Member m)
	{
		string text = "|0|1|" + m.name;
		string text2 = "\n|1|1|";
		if (m.role == 0)
		{
			text2 = "\n|1|1|";
		}
		if (m.role == 1)
		{
			text2 = "\n|1|1|";
		}
		if (m.role == 2)
		{
			text2 = "\n|0|1|";
		}
		text = text + text2 + Member.getRole(m.role);
		text = text + "\n|3|1|" + m.powerPoint;
		text += "\n--";
		string text3 = text;
		text = text3 + "\n|3|" + L.join_date() + ": " + m.joinTime;
		initPopupDetail(text, null);
		partID = new int[3] { m.head, m.leg, m.body };
		currItem = null;
		charInfo = null;
	}

	public void addMessageDetail(ClanMessage cm)
	{
		string text = "|0|" + cm.playerName;
		text = text + "\n|1|" + Member.getRole(cm.role);
		for (int i = 0; i < myMember.size(); i++)
		{
			Member member = (Member)myMember.elementAt(i);
			if (cm.playerId == member.ID)
			{
				string text2 = text;
				text = text2 + "\n|3|" + L.clan_point() + ": " + member.clanPoint;
				partID = new int[3] { member.head, member.leg, member.body };
				break;
			}
		}
		text += "\n--";
		for (int j = 0; j < cm.chat.Length; j++)
		{
			text = text + "\n" + cm.chat[j];
		}
		initPopupDetail(text, null);
		charInfo = null;
	}

	private void doFireClanOption()
	{
		partID = null;
		charInfo = null;
		if (CPlayer.myPlayer.clan == null)
		{
			if (selected == 0)
			{
				CRes.outz("2");
				closeDetail();
				selected = -1;
				if (CCanvas.panel.isViewMember)
				{
					if (cSelected == 0)
					{
						perform(4004, currClan);
					}
				}
				else if (cSelected == 0)
				{
					searchClan();
				}
				else if (cSelected == 1)
				{
					InfoDlg.showWait();
					creatClan();
				}
			}
			else if (selected != -1)
			{
				if (selected == 1)
				{
					if (isSearchClan)
					{
						GameService.gI().searchClan(string.Empty);
					}
				}
				else if (isSearchClan)
				{
					currClan = getCurrClan();
					if (currClan != null)
					{
						command = new MyVector(string.Empty);
						command.addElement(new Command(L.request_join_clan_n(), this, 4004, currClan));
						command.addElement(new Command(L.view_clan_member(), this, 4001, currClan));
						addClanDetail(currClan);
					}
				}
				else if (isViewMember)
				{
					currMem = getCurrMember();
					if (currMem != null)
					{
						command = new MyVector(string.Empty);
						command.addElement(new Command(L.close(), this, 8000, currClan));
						addClanMemberDetail(currMem);
					}
				}
			}
		}
		else if (selected == 0)
		{
			closeDetail();
			if (isMessage)
			{
				CRes.outz("isMessage");
				if (cSelected == 0)
				{
					if (myMember.size() > 1)
					{
						chatClan();
					}
					else
					{
						member = null;
						isSearchClan = false;
						isViewMember = true;
						isMessage = false;
						currentListLength = myMember.size() + 2;
						initTabClans();
					}
				}
				if (cSelected == 1)
				{
					member = null;
					isSearchClan = false;
					isViewMember = true;
					isMessage = false;
					currentListLength = myMember.size() + 2;
					initTabClans();
				}
			}
			else if (isViewMember)
			{
				CRes.outz("isMember cSelect= " + cSelected);
				if (cSelected == 0)
				{
					isSearchClan = false;
					isViewMember = false;
					isMessage = true;
					currentListLength = ClanMessage.vMessage.size() + 2;
					initTabClans();
				}
				if (cSelected == 1)
				{
					if (myMember.size() > 1)
					{
						CCanvas.startYesNoDlg("Bạn có muốn rời đội không?", new Command(L.yes(), this, 1202, null), new Command(L.no(), this, 1026, null));
					}
					else
					{
						chagenSlogan();
					}
				}
				if (cSelected == 2)
				{
					if (myMember.size() > 1)
					{
						chagenSlogan();
					}
					else
					{
						GameService.gI().getClan(3, -1, null, 0);
					}
				}
				if (cSelected == 3)
				{
					GameService.gI().getClan(3, -1, null, 0);
				}
			}
		}
		else if (selected == 1)
		{
			if (isSearchClan)
			{
				GameService.gI().searchClan(string.Empty);
			}
		}
		else if (isSearchClan)
		{
			currClan = getCurrClan();
			if (currClan != null)
			{
				command = new MyVector(string.Empty);
				command.addElement(new Command(L.view_clan_member(), this, 4001, currClan));
				addClanDetail(getCurrClan());
			}
		}
		else if (isViewMember)
		{
			CRes.outz("TOI DAY 1");
			currMem = getCurrMember();
			if (currMem != null)
			{
				command = new MyVector(string.Empty);
				CRes.outz("TOI DAY 2");
				if (member != null)
				{
					command.addElement(new Command(L.close(), this, 8000, null));
					CRes.outz("TOI DAY 3");
				}
				else if (myMember != null)
				{
					CRes.outz("TOI DAY 4");
					CRes.outz("my role= " + CPlayer.myPlayer.role);
					if (CPlayer.myPlayer.IDDB == currMem.ID || CPlayer.myPlayer.role == 2)
					{
						command.addElement(new Command(L.close(), this, 8000, currMem));
					}
					if (CPlayer.myPlayer.role < 2 && CPlayer.myPlayer.IDDB != currMem.ID)
					{
						if (currMem.role == 0 || currMem.role == 1)
						{
							command.addElement(new Command(L.close(), this, 8000, currMem));
						}
						if (currMem.role == 2)
						{
							CRes.outz("Phong phó bang");
							command.addElement(new Command(L.create_clan_co_leader(), this, 5002, currMem));
						}
						if (CPlayer.myPlayer.role == 0)
						{
							command.addElement(new Command(L.create_clan_leader(), this, 5001, currMem));
							if (currMem.role == 1)
							{
								command.addElement(new Command(L.disable_clan_mastership(), this, 5003, currMem));
							}
						}
					}
					if (CPlayer.myPlayer.role < currMem.role)
					{
						command.addElement(new Command(L.kick_clan_mem(), this, 5004, currMem));
					}
				}
				addClanMemberDetail(currMem);
			}
		}
		else if (isMessage)
		{
			currMess = getCurrMessage();
			if (currMess != null)
			{
				CRes.outz("curr Mess type= " + currMess.type);
				if (currMess.type == 0)
				{
					command = new MyVector(string.Empty);
					command.addElement(new Command(L.close(), this, 8000, currMess));
					if (currMess.option == null)
					{
						addMessageDetail(currMess);
					}
				}
				else if (currMess.type == 2)
				{
					if (currMess.option != null)
					{
						if (cSelected == 0)
						{
							GameService.gI().joinClan(currMess.id, 1);
							closeDetail();
							selected = -1;
						}
						else if (cSelected == 1)
						{
							GameService.gI().joinClan(currMess.id, 0);
							closeDetail();
							selected = -1;
						}
					}
				}
				else if (currMess.type != 2)
				{
				}
			}
		}
		getCurrClanOtion();
	}

	private void searchClan()
	{
		CCanvas.inputDlg.setInfo(L.input_clan_name(), new Command(L.ok(), this, 2006, CCanvas.inputDlg.tfInput.getText()), new Command(L.close(), this, 2005, null), TField.INPUT_TYPE_ANY);
		CCanvas.inputDlg.tfInput.isFocus = true;
		CCanvas.inputDlg.show();
		if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
		{
			CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
		}
	}

	private void chagenSlogan()
	{
		CCanvas.inputDlg.setInfo(L.input_clan_slogan(), new Command(L.ok(), this, 2004, null), new Command(L.no(), this, 2005, null), TField.INPUT_TYPE_ANY);
		CCanvas.inputDlg.tfInput.isFocus = true;
		CCanvas.inputDlg.show();
		if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
		{
			CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
		}
	}

	private void chatClan()
	{
		CCanvas.inputDlg.setInfo(L.chat_clan(), new Command(L.ok(), this, 2007, null), new Command(L.close(), this, 2005, null), TField.INPUT_TYPE_ANY);
		CCanvas.inputDlg.tfInput.isFocus = true;
		CCanvas.inputDlg.show();
		if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
		{
			CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
		}
	}

	private void creatClan()
	{
		CCanvas.startYesNoDlg(L.clanPrice(), new Command(L.yes(), this, 6002, null), new Command(L.no(), this, 6003, null));
	}

	public void setTabTopClans()
	{
		isClanOption = false;
		currentListLength = 0;
		if (topClans != null)
		{
			currentListLength = topClans.Length;
			setCmy();
		}
	}

	public void setTabClansStatus()
	{
		isClanOption = false;
		currentListLength = 0;
		if (clansStatus != null)
		{
			currentListLength = clansStatus.Length;
			CRes.outz("currListLent= " + clansStatus.Length);
			cSelected = -1;
			selected = -1;
			setCmy();
			cmy = (cmtoY = 0);
		}
	}

	public void setTabClans()
	{
		GameScr.isNewClanMessage = false;
		ITEM_HEIGHT = 24;
		currentListLength = 2;
		if (CPlayer.myPlayer.clan != null)
		{
			isMessage = true;
			isViewMember = false;
			isSearchClan = false;
		}
		else
		{
			isMessage = false;
			isViewMember = false;
			isSearchClan = true;
		}
		if (CPlayer.myPlayer.clan != null)
		{
			currentListLength = ClanMessage.vMessage.size() + 2;
		}
		initTabClans();
		cSelected = -1;
		if (CPlayer.myPlayer.clan == null)
		{
			clanReport = L.findingClan();
			GameService.gI().searchClan(string.Empty);
		}
		selected = -1;
	}

	public void initTabClans()
	{
		if (isSearchClan)
		{
			currentListLength = ((clans != null) ? (clans.Length + 2) : 2);
			clanInfo = L.clan_list();
		}
		else if (isViewMember)
		{
			clanReport = string.Empty;
			currentListLength = ((myMember != null) ? (myMember.size() + 2) : 2);
			clanInfo = L.member();
		}
		else if (isMessage)
		{
			currentListLength = ClanMessage.vMessage.size() + 2;
			clanInfo = L.msg();
			clanReport = string.Empty;
		}
		if (CPlayer.myPlayer.clan == null)
		{
			clansOption = new string[2][]
			{
				L.findClan(),
				L.createClan()
			};
		}
		else if (!isViewMember)
		{
			if (myMember.size() > 1)
			{
				clansOption = new string[2][]
				{
					L.chatClan(),
					L.memberr()
				};
			}
			else
			{
				clansOption = new string[1][] { L.memberr() };
			}
		}
		else if (CPlayer.myPlayer.role > 0)
		{
			clansOption = new string[2][]
			{
				L.msgg(),
				L.leaveClan()
			};
		}
		else if (myMember.size() > 1)
		{
			clansOption = new string[4][]
			{
				L.msgg(),
				L.leaveClan(),
				L.khau_hieuu(),
				L.bieu_tuongg()
			};
		}
		else
		{
			clansOption = new string[3][]
			{
				L.msgg(),
				L.khau_hieuu(),
				L.bieu_tuongg()
			};
		}
		cmyLim = currentListLength * ITEM_HEIGHT - hScroll;
		if (cmyLim < 0)
		{
			cmyLim = 0;
		}
		if (cmyLast != null && currentTabIndex <= cmyLast.Length - 1)
		{
			cmy = (cmtoY = cmyLast[currentTabIndex]);
		}
		if (cmy < 0)
		{
			cmy = (cmtoY = 0);
		}
		if (cmy > cmyLim)
		{
			cmy = (cmtoY = cmyLim);
		}
	}

	public void initTabClansMemberForClanless()
	{
		CRes.outz("init tab clans for home less");
		clanReport = string.Empty;
		currentListLength = ((member != null) ? (member.size() + 2) : 2);
		clanInfo = L.member();
		if (CPlayer.myPlayer.clan == null)
		{
			clansOption = new string[1][] { L.request_join_clan_n2() };
		}
		else if (CPlayer.myPlayer.role > 0)
		{
			clansOption = new string[2][]
			{
				L.msgg(),
				L.leaveClan()
			};
		}
		else if (member.size() > 1)
		{
			clansOption = new string[4][]
			{
				L.msgg(),
				L.leaveClan(),
				L.khau_hieuu(),
				L.bieu_tuongg()
			};
		}
		else
		{
			clansOption = new string[3][]
			{
				L.msgg(),
				L.khau_hieuu(),
				L.bieu_tuongg()
			};
		}
		cmy = (cmtoY = 0);
		selected = (CCanvas.isTouch ? (-1) : 0);
		setCmy();
	}

	public void setTypeClanMember()
	{
	}

	public void setTypeMission()
	{
	}

	public void setTypeLevel()
	{
		load();
		pointLeft = MyMidlet.myInfo.point;
		currAbility = new int[6];
		for (int i = 0; i < 6; i++)
		{
			currAbility[i] = ability[i];
		}
		bool flag = false;
		if (type != 7)
		{
			flag = true;
		}
		type = 7;
		currentListLength = strAbility.Length;
		if (!isShow)
		{
			setType(0);
			setTabLevel();
			for (int j = 0; j < curPointAdd.Length; j++)
			{
				curPointAdd[j] = 0;
			}
		}
		else if (flag)
		{
			setCmy();
		}
	}

	public void setTypeShopBietDoi(MyVector vShop)
	{
		type = 15;
		setType(0);
		setTabShopBietDoi(vShop);
	}

	public void addMailDetail(MsgInfo msg)
	{
		string chat = "|0|1|" + msg.message;
		initPopupDetail(chat, null);
	}

	private bool compareWithBodyItem(Item item)
	{
		for (int i = 0; i < CPlayer.arrItemBody.Length; i++)
		{
			if (CPlayer.arrItemBody[i] != null && CPlayer.arrItemBody[i].template.type == item.template.type && item.itemOption != null && CPlayer.arrItemBody[i].itemOption != null)
			{
				item.itemOption = compareEachOption(item.itemOption, CPlayer.arrItemBody[i].itemOption);
				return true;
			}
		}
		return false;
	}

	private ItemOption[] compareEachOption(ItemOption[] options1, ItemOption[] options2)
	{
		for (int i = 0; i < options1.Length; i++)
		{
			for (int j = 0; j < options2.Length; j++)
			{
				if (options1[i] != null && options2[j] != null && options1[i].optionTemplate != null && options2[j].optionTemplate != null)
				{
					if (options1[i].optionTemplate.id == options2[j].optionTemplate.id)
					{
						options1[i].num = options1[i].param - options2[j].param;
						break;
					}
					if (j == options2.Length - 1)
					{
						options1[i].num = options1[i].param;
					}
				}
			}
		}
		ItemOption[] options3 = copyItemOptionArray(options1);
		for (int k = 0; k < options2.Length; k++)
		{
			for (int l = 0; l < options1.Length; l++)
			{
				if (options1[l] != null && options2[k] != null && options1[l].optionTemplate != null && options2[k].optionTemplate != null)
				{
					if (options2[k].optionTemplate.id == options1[l].optionTemplate.id)
					{
						break;
					}
					if (l == options1.Length - 1)
					{
						ItemOption itemOption = new ItemOption();
						itemOption.optionTemplate = options2[k].optionTemplate;
						itemOption.param = options2[k].param;
						itemOption.num = -1 * options2[k].param;
						itemOption.isCompareOption = true;
						options3 = addOneMoreOption(options3, itemOption);
					}
				}
			}
		}
		options1 = null;
		options1 = copyItemOptionArray(options3);
		return options1;
	}

	private ItemOption[] addOneMoreOption(ItemOption[] options, ItemOption newOption)
	{
		ItemOption[] array = new ItemOption[options.Length + 1];
		for (int i = 0; i < options.Length; i++)
		{
			array[i] = new ItemOption();
			array[i].optionTemplate = options[i].optionTemplate;
			array[i].param = options[i].param;
			array[i].num = options[i].num;
			array[i].isCompareOption = options[i].isCompareOption;
		}
		array[array.Length - 1] = newOption;
		return array;
	}

	private ItemOption[] deleteOneOption(ItemOption[] options, ItemOption option)
	{
		int num = 0;
		for (int i = 0; i < options.Length; i++)
		{
			if (options[i].optionTemplate == option.optionTemplate)
			{
				num = i;
				break;
			}
			if (i == options.Length - 1)
			{
				return options;
			}
		}
		ItemOption[] array = new ItemOption[options.Length - 1];
		for (int j = 0; j < array.Length; j++)
		{
			if (j < num)
			{
				array[j] = options[j];
			}
			else
			{
				array[j] = options[j + 1];
			}
		}
		return array;
	}

	private ItemOption[] copyItemOptionArray(ItemOption[] options)
	{
		ItemOption[] array = new ItemOption[options.Length];
		for (int i = 0; i < options.Length; i++)
		{
			array[i] = new ItemOption();
			array[i].optionTemplate = options[i].optionTemplate;
			array[i].param = options[i].param;
			array[i].num = options[i].num;
			array[i].isCompareOption = options[i].isCompareOption;
		}
		return array;
	}

	public void addMyEquipDetail(Item item)
	{
		string empty = string.Empty;
		string text = string.Empty;
		if (item.itemOption != null)
		{
			ItemOption[] options = copyItemOptionArray(item.itemOption);
			for (int i = 0; i < item.itemOption.Length; i++)
			{
				if (item.itemOption[i].optionTemplate.id != 15 && item.itemOption[i].optionTemplate.id != 16 && item.itemOption[i].optionTemplate.id != 17 && item.itemOption[i].isCompareOption)
				{
					options = deleteOneOption(options, item.itemOption[i]);
				}
			}
			item.itemOption = copyItemOptionArray(options);
			bool flag = compareWithBodyItem(item);
			for (int j = 0; j < item.itemOption.Length; j++)
			{
				if (item.itemOption[j].optionTemplate.id == 15 || item.itemOption[j].optionTemplate.id == 16 || item.itemOption[j].optionTemplate.id == 17)
				{
					continue;
				}
				if (!flag)
				{
					empty = item.itemOption[j].getOptionString();
					if (!empty.Equals(string.Empty))
					{
						if (j != 0)
						{
							text += "\n";
						}
						text = text + "|0|0|" + empty;
					}
					continue;
				}
				empty = (item.itemOption[j].isCompareOption ? item.itemOption[j].getOptionStringForCompare() : ((item.itemOption[j].num == 0) ? item.itemOption[j].getOptionString() : (item.itemOption[j].getOptionString() + " (" + ((item.itemOption[j].num <= 0) ? string.Empty : "+") + item.itemOption[j].num + ")")));
				if (!empty.Equals(string.Empty))
				{
					if (j != 0)
					{
						text += "\n";
					}
					text = ((item.itemOption[j].num <= 0) ? ((item.itemOption[j].num >= 0) ? (text + "|0|0|" + empty) : (text + "|7|0|" + empty)) : (text + "|1|0|" + empty));
				}
			}
		}
		text = text + "\n|0|0| Cấp độ yêu cầu: " + item.template.strRequire;
		text += "\n--";
		text = text + "\n|3|" + item.template.description;
		initPopupDetail(text, item);
	}

	public void addBodyDetail(Item item)
	{
		string empty = string.Empty;
		string text = string.Empty;
		if (item.itemOption != null)
		{
			for (int i = 0; i < item.itemOption.Length; i++)
			{
				if (item.itemOption[i].optionTemplate.id != 15 && item.itemOption[i].optionTemplate.id != 16 && item.itemOption[i].optionTemplate.id != 17)
				{
					empty = item.itemOption[i].getOptionString();
					if (!empty.Equals(string.Empty))
					{
						text = ((i != 0) ? (text + "\n|0|0|" + empty) : (text + "|0|0|" + empty));
					}
				}
			}
		}
		text = text + "\n|0|0| Cấp độ yêu cầu: " + item.template.strRequire;
		text += "\n--";
		text = text + "\n|3|" + item.template.description;
		initPopupDetail(text, item);
	}

	public void addClanDetail(Clan cl)
	{
		string text = "|0|" + cl.name;
		string[] array = mFont.tahoma_7_green.splitFontArray(cl.slogan, wScroll - 60);
		for (int i = 0; i < array.Length; i++)
		{
			text = text + "\n|1|" + array[i];
		}
		text += "\n--";
		string text2 = text;
		text = text2 + "\n|0|" + L.clan_leader() + ": " + cl.leaderName;
		text2 = text;
		text = text2 + "\n|0|" + L.member() + ": " + cl.currMember + "/" + cl.maxMember;
		text2 = text;
		text = text2 + "\n|3|" + L.clan_birthday() + ": " + NinjaUtil.getDate(cl.date);
		CRes.outz("chat= " + text);
		initPopupDetail(text, null);
	}

	public void initPopupDetail(string chat, Item item)
	{
		des1 = mFont.tahoma_7.splitFontArray(chat, sayWidth - 10);
		if (command.size() > 0)
		{
			ch = des1.Length * 12 + 33 + ITEM_HEIGHT;
		}
		else
		{
			ch = des1.Length * 12 + ITEM_HEIGHT;
		}
		if (item != null)
		{
			if (item.nSocket > 0)
			{
				ch += 10;
				flagSocket = true;
			}
			else
			{
				flagSocket = false;
			}
		}
		else
		{
			flagSocket = false;
		}
		splitCommandName();
		deltaH = 0;
		deltaHmax = ch - (ITEM_HEIGHT - 1);
	}

	public void paintDetail(mGraphics g)
	{
	}

	public int getCompare(Item item2)
	{
		return 0;
	}

	public static void setBoardName(int id, string name)
	{
		if (name != null && !name.Equals(string.Empty))
		{
			boardName = L.area() + " " + name;
			boardName2 = name;
		}
		else
		{
			boardName = L.area() + " " + id;
			boardName2 = id + string.Empty;
		}
	}

	public void changeName(int id, string name)
	{
		RoomInfo roomInfo = (RoomInfo)roomList.elementAt(id);
		roomInfo.name = name;
	}

	private void paintUpgradeEffect(int x, int y, int w, int h, int upgrade, mGraphics g)
	{
	}

	private int upgradeEffectY(int tick, int indexSize)
	{
		int num = tick % (4 * indexSize);
		if (0 <= num && num < indexSize)
		{
			return 0;
		}
		if (indexSize <= num && num < indexSize * 2)
		{
			return num % indexSize;
		}
		if (indexSize * 2 <= num && num < indexSize * 3)
		{
			return indexSize;
		}
		return indexSize - num % indexSize;
	}

	private int upgradeEffectX(int tick, int indexSize)
	{
		int num = tick % (4 * indexSize);
		if (0 <= num && num < indexSize)
		{
			return num % indexSize;
		}
		if (indexSize <= num && num < indexSize * 2)
		{
			return indexSize;
		}
		if (indexSize * 2 <= num && num < indexSize * 3)
		{
			return indexSize - num % indexSize;
		}
		return 0;
	}

	private void doFireAchievement()
	{
		CRes.outz("select= " + selected);
		if (selected == -1 || selected >= currentListLength)
		{
			return;
		}
		Achievement achievement = (Achievement)vAchievement.elementAt(selected);
		if (achievement != null)
		{
			if (achievement.received == 1)
			{
				command = new MyVector(string.Empty);
				command.addElement(new Command(L.receiveGem(), this, 70001, achievement));
				btnCannotPress = false;
				initPopupDetail(string.Empty, null);
			}
			else if (achievement.received == 0)
			{
				btnCannotPress = true;
				command = new MyVector(string.Empty);
				command.addElement(new Command(L.receiveGem(), this, 70001, achievement));
				initPopupDetail(string.Empty, null);
			}
		}
	}

	public void setTypeAchievement()
	{
		type = 22;
		setType(0);
		ITEM_HEIGHT = 50;
		currentListLength = vAchievement.size();
		setCmy();
	}

	public void paintOngMau(Image img0, Image img1, Image img2, float x, float y, int size, int percent, mGraphics g)
	{
		int num = 0;
		for (int i = 15; i <= size - 30; i += 15)
		{
			num += 15;
			if (num < percent)
			{
				int w = ((percent - num <= 15) ? (percent - num) : 15);
				g.drawRegion(img1, 0, 0, w, 7, 0, x + (float)num, y, 0, true);
			}
		}
		int num2 = size % 15;
		if (num2 > 0)
		{
			if (img1 == GameScr.frBack1)
			{
				num = size - 15 - num2;
				if (num < percent)
				{
					int w2 = ((percent - num <= num2) ? (percent - num) : num2);
					g.drawRegion(img1, 0, 0, w2, 8, 0, x + (float)num, y, 0, true);
				}
			}
			else
			{
				num = size - 15 - num2;
				if (num < percent)
				{
					int w3 = ((percent - num <= num2) ? (percent - num) : num2);
					g.drawRegion(img1, 0, 0, w3, 7, 0, x + (float)num, y, 0, true);
				}
			}
		}
		num = 0;
		if (num < percent)
		{
			int w4 = ((percent - num <= 15) ? (percent - num) : 15);
			g.drawRegion(img0, 0, 0, w4, 7, 0, x + (float)num, y, 0, true);
		}
		num = size - 15;
		if (num < percent)
		{
			int w5 = ((percent - num <= 15) ? (percent - num) : 15);
			g.drawRegion(img2, 0, 0, w5, 7, 0, x + (float)num, y, 0, true);
		}
	}

	public void paintLevelPercen(mGraphics g, int x, int y, int percen)
	{
		GameScr.paintOngMau(GameScr.frBack0, GameScr.frBack1, GameScr.frBack2, x, y, 100, g);
		paintOngMau(GameScr.frBarPow0, GameScr.frBarPow1, GameScr.frBarPow2, x, y, 100, percen, g);
	}

	private void paintAchievement(mGraphics g)
	{
		int num = cmy / ITEM_HEIGHT;
		int num2 = (cmy + hScroll) / ITEM_HEIGHT + 1;
		if (num < 0)
		{
			num = 0;
		}
		if (num2 > vAchievement.size())
		{
			num2 = vAchievement.size();
		}
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		for (int i = num; i < num2; i++)
		{
			Achievement achievement = (Achievement)vAchievement.elementAt(i);
			int num3 = xScroll;
			int num4 = yScroll + i * ITEM_HEIGHT;
			int num5 = 32;
			int num6 = ITEM_HEIGHT - 1;
			int num7 = xScroll + num5;
			int num8 = yScroll + i * ITEM_HEIGHT;
			int num9 = wScroll - num5;
			int h = ITEM_HEIGHT - 1;
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				h = ch;
				mFont2 = mFont.tahoma_7_white;
				g.setClip(2 + X, num8, wScroll, num6 + deltaH);
			}
			if (i > selected)
			{
				num4 += deltaH;
				num8 += deltaH;
			}
			int color = ((i != selected) ? 11657202 : 24725);
			g.setColor(color);
			g.fillRect(2 + X, num8, WIDTH_PANEL, h, true);
			for (int j = 0; j < achievement.star; j++)
			{
				g.drawRegion(imgIcon, 0, 14, 12, 14, 0, num3 + 9 + j * 10, num4 + 10, 3, true);
			}
			((i == selected) ? mFont.tahoma_7b_yellow : mFont.tahoma_7b_green2).drawString(g, achievement.name, xScroll + H_WIDTH_PANEL, num8 + 1, 2);
			paintLevelPercen(g, xScroll + H_WIDTH_PANEL - 50, num8 + 14, achievement.percent);
			mFont.tahoma_7_white.drawString(g, achievement.current + "/" + achievement.max, xScroll + (wScroll >> 1), num8 + 12, 2);
			mFont2.drawString(g, achievement.money + string.Empty, num7 + num9 - 17, num8 + 5, 1);
			g.drawImage(gold, num7 + num9 - 16, num8 + 1, 0, true);
			for (int k = 0; k < achievement.des.Length; k++)
			{
				mFont2.drawString(g, achievement.des[k], xScroll + H_WIDTH_PANEL, num8 + 24 + k * 12, 2);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num8 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	public void changeIcon()
	{
		if (tabIcon == null)
		{
			tabIcon = new TabClanIcon();
		}
		tabIcon.text = CCanvas.inputDlg.tfInput.getText();
		tabIcon.show(false);
	}

	private void doFireZone()
	{
		if (selected != -1 && selected < currentListLength)
		{
			if (zones[selected] != GameScrRPG.zone)
			{
				CCanvas.startWaitDlg(L.pleaseWait());
				GameService.gI().requestChangeZone(selected, -1);
			}
			CCanvas.panel.hide();
		}
	}

	public void setTypeZone()
	{
		type = 25;
		setType(0);
		setTabZone();
	}

	private void setTabZone()
	{
		currentListLength = zones.Length;
		setCmy();
	}

	private void paintZone(mGraphics g)
	{
		g.setColor(16711680);
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		for (int i = 0; i < pts.Length; i++)
		{
			int num = xScroll + 36;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = wScroll - 36;
			int h = ITEM_HEIGHT - 1;
			int num4 = xScroll;
			int y = yScroll + i * ITEM_HEIGHT;
			int num5 = 34;
			int h2 = ITEM_HEIGHT - 1;
			if (num2 - cmy > yScroll + hScroll || num2 - cmy < yScroll - ITEM_HEIGHT)
			{
				continue;
			}
			g.setColor((i != selected) ? 15196114 : 16383818);
			g.fillRect(num, num2, num3, h, true);
			g.setColor(zoneColor[pts[i]]);
			g.fillRect(num4, y, num5, h2, true);
			if (zones[i] != -1)
			{
				if (pts[i] != 1)
				{
					mFont.tahoma_7_yellow.drawString(g, zones[i] + string.Empty, num4 + num5 / 2, num2 + 6, mFont.CENTER);
				}
				else
				{
					mFont.tahoma_7_grey.drawString(g, zones[i] + string.Empty, num4 + num5 / 2, num2 + 6, mFont.CENTER);
				}
				mFont.tahoma_7_green2.drawString(g, numPlayer[i] + "/" + maxPlayer[i], num + 5, num2 + 6, 0);
			}
			if (i == selected)
			{
				paintDetail2(g, 2 + X, num2 + ITEM_HEIGHT - 1);
				g.translate(-g.getTranslateX(), -g.getTranslateY());
				g.translate(-cmx, 0);
				g.translate(X, Y);
				g.setClip(-1000, -1000, 2000, 2000);
				g.setClip(xScroll, yScroll, wScroll, hScroll);
				g.translate(0, -cmy);
			}
		}
	}

	public void setTabGiaoDich(bool isMe)
	{
		currentListLength = ((!isMe) ? (vFriendGD.size() + 3) : (vMyGD.size() + 3));
		selected = (CCanvas.isTouch ? (-1) : 0);
		setCmy();
	}

	public void setTypeGiaoDich(CPlayer cGD)
	{
		type = 24;
		tabName[type] = boxGD;
		isAccept = false;
		isLock = false;
		isFriendLock = false;
		vMyGD.removeAllElements();
		vFriendGD.removeAllElements();
		moneyGD = 0;
		friendMoneyGD = 0;
		if (Equals(CCanvas.panel))
		{
			setType(0);
		}
		if (currentTabIndex == 0)
		{
			setTabMyEquip();
		}
		if (currentTabIndex == 1)
		{
			setTabGiaoDich(true);
		}
		if (currentTabIndex == 2)
		{
			setTabGiaoDich(false);
		}
		charMenu = cGD;
	}

	public void putQuantily()
	{
		CCanvas.inputDlg.setInfo(L.input_quantity_to_trade, new Command(L.ok(), this, 7004, null), new Command(L.no(), this, 7005, null), TField.INPUT_TYPE_NUMERIC);
		CCanvas.inputDlg.tfInput.isFocus = true;
		CCanvas.inputDlg.show();
		if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
		{
			CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
		}
	}

	public void putMoney()
	{
		if (CCanvas.currentDialog == null)
		{
			CCanvas.inputDlg = new InputDlg();
			CCanvas.inputDlg.setInfo(L.input_money_to_trade, new Command(L.ok(), this, 7003, null), new Command(L.close(), this, 7005, null), TField.INPUT_TYPE_NUMERIC);
			CCanvas.inputDlg.show();
			if (CCanvas.isTouch && mGraphics.zoomLevel > 1)
			{
				CCanvas.inputDlg.tfInput.doChangeToTextBox(false);
			}
		}
	}

	private void doFireGiaoDich()
	{
		if (currentTabIndex == 0 && Equals(CCanvas.panel))
		{
			doFireMyEquip();
			return;
		}
		if ((currentTabIndex == 0 && Equals(CCanvas.panel2)) || currentTabIndex == 2)
		{
			if (Equals(CCanvas.panel2))
			{
				currItem = (Item)CCanvas.panel2.vFriendGD.elementAt(selected);
			}
			else
			{
				currItem = (Item)CCanvas.panel.vFriendGD.elementAt(selected);
			}
			command = new MyVector(string.Empty);
			command.addElement(new Command(L.close(), this, 8000, currItem));
			if (currItem != null)
			{
				addMyEquipDetail(currItem);
			}
			else
			{
				cp = null;
			}
		}
		if (currentTabIndex != 1)
		{
			return;
		}
		if (selected == currentListLength - 3)
		{
			if (!isLock)
			{
				putMoney();
			}
		}
		else if (selected == currentListLength - 2)
		{
			if (!isAccept)
			{
				isLock = !isLock;
				if (isLock)
				{
					GameService.gI().giaodich(5, -1, -1, -1);
					return;
				}
				hide();
				InfoDlg.showWait();
				GameService.gI().giaodich(3, -1, -1, -1);
			}
			else
			{
				isAccept = false;
			}
		}
		else if (selected == currentListLength - 1)
		{
			if (isLock && !isAccept && isFriendLock)
			{
				CCanvas.startYesNoDlg(L.do_u_sure_to_trade, new Command(L.yes(), this, 7002, null), new Command(L.no(), this, 4005, null));
			}
		}
		else if (!isLock)
		{
			currItem = (Item)CCanvas.panel.vMyGD.elementAt(selected);
			command = new MyVector(string.Empty);
			command.addElement(new Command(L.close(), this, 8000, currItem));
			if (currItem != null)
			{
				addMyEquipDetail(currItem);
			}
			else
			{
				cp = null;
			}
		}
	}

	private void paintGiaoDich(mGraphics g, bool isMe)
	{
		g.setColor(16711680);
		g.setClip(xScroll, yScroll, wScroll, hScroll);
		g.translate(0, -cmy);
		MyVector myVector = ((!isMe) ? vFriendGD : vMyGD);
		for (int i = 0; i < currentListLength; i++)
		{
			int num = xScroll;
			int num2 = yScroll + i * ITEM_HEIGHT;
			int num3 = 32;
			int num4 = ITEM_HEIGHT - 1;
			int num5 = xScroll + num3;
			int num6 = yScroll + i * ITEM_HEIGHT;
			int num7 = wScroll - num3;
			int num8 = ITEM_HEIGHT - 1;
			if (i == selected && i < currentListLength - 3)
			{
				num8 = ch;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			if (num6 - cmy > yScroll + hScroll || num6 - cmy < yScroll - ITEM_HEIGHT)
			{
				continue;
			}
			if (i == currentListLength - 1)
			{
				if (!isMe)
				{
					continue;
				}
				g.setColor(11657202);
				g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
				if (!isLock)
				{
					if (!isFriendLock)
					{
						mFont.tahoma_7_grey.drawString(g, L.opponent + L.not_lock_trade, xScroll + wScroll / 2, num6 + num8 / 2 - 4, mFont.CENTER);
					}
					else
					{
						mFont.tahoma_7_grey.drawString(g, L.opponent + L.locked_trade, xScroll + wScroll / 2, num6 + num8 / 2 - 4, mFont.CENTER);
					}
				}
				else if (isFriendLock)
				{
					g.setColor(11657202);
					g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
					g.drawImage((i != selected) ? GameScr.imgLbtn2 : GameScr.imgLbtnFocus2, xScroll + wScroll - 5, num6 + 2, CRes.TOP_RIGHT, false);
					((i != selected) ? mFont.tahoma_7b_dark : mFont.tahoma_7b_green2).drawString(g, L.done, xScroll + wScroll - 22, num6 + 7, 2);
					mFont.tahoma_7_grey.drawString(g, L.opponent + L.locked_trade, xScroll + 5, num6 + num8 / 2 - 4, mFont.LEFT);
				}
				else
				{
					mFont.tahoma_7_grey.drawString(g, L.opponent + L.not_lock_trade, xScroll + wScroll / 2, num6 + num8 / 2 - 4, mFont.CENTER);
				}
				continue;
			}
			if (i == currentListLength - 2)
			{
				if (isMe)
				{
					g.setColor(11657202);
					g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
					if (!isAccept)
					{
						if (!isLock)
						{
							g.drawImage((i != selected) ? GameScr.imgLbtn2 : GameScr.imgLbtnFocus2, xScroll + wScroll - 5, num6 + 2, CRes.TOP_RIGHT, false);
							((i != selected) ? mFont.tahoma_7b_dark : mFont.tahoma_7b_green2).drawString(g, L.lockz, xScroll + wScroll - 22, num6 + 7, 2);
							mFont.tahoma_7_grey.drawString(g, L.you + L.not_lock_trade, xScroll + 5, num6 + num8 / 2 - 4, mFont.LEFT);
						}
						else
						{
							g.drawImage((i != selected) ? GameScr.imgLbtn2 : GameScr.imgLbtnFocus2, xScroll + wScroll - 5, num6 + 2, CRes.TOP_RIGHT, false);
							((i != selected) ? mFont.tahoma_7b_dark : mFont.tahoma_7b_green2).drawString(g, L.cancel(), xScroll + wScroll - 22, num6 + 7, 2);
							mFont.tahoma_7_grey.drawString(g, L.you + L.locked_trade, xScroll + 5, num6 + num8 / 2 - 4, mFont.LEFT);
						}
					}
				}
				else if (!isFriendLock)
				{
					mFont.tahoma_7b_dark.drawString(g, L.not_lock_trade_upper, xScroll + wScroll / 2, num6 + num8 / 2 - 4, mFont.CENTER);
				}
				else
				{
					mFont.tahoma_7b_dark.drawString(g, L.locked_trade_upper, xScroll + wScroll / 2, num6 + num8 / 2 - 4, mFont.CENTER);
				}
				continue;
			}
			if (i == currentListLength - 3)
			{
				if (isLock)
				{
					g.setColor(8967679);
				}
				else
				{
					g.setColor((i != selected) ? 11657202 : 24725);
				}
				g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
				if (isLock)
				{
					g.setColor(8967679);
				}
				else
				{
					g.setColor((i != selected) ? 11657202 : 24725);
				}
				g.fillRect(num, num2, num3, num4, true);
				g.drawImage(coin, num + num3 / 2, num2 + num4 / 2, 3, false);
				mFont.tahoma_7_green2.drawString(g, NinjaUtil.getMoneys((!isMe) ? friendMoneyGD : moneyGD) + " " + L.xu(), num5 + 5, num6 + 11, 0);
				mFont.tahoma_7_yellow.drawString(g, L.money_trade, num5 + 5, num6, 0);
				continue;
			}
			if (myVector.size() == 0)
			{
				return;
			}
			if (isLock)
			{
				g.setColor(8967679);
			}
			else
			{
				g.setColor((i != selected) ? 11657202 : 24725);
			}
			g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
			if (isLock)
			{
				g.setColor(8967679);
			}
			else
			{
				g.setColor((i != selected) ? 11657202 : 24725);
			}
			g.fillRect(num, num2, num3, num4, true);
			mFont mFont2 = mFont.tahoma_7_grey;
			if (i == selected)
			{
				num8 = ch;
				mFont2 = mFont.tahoma_7_yellow;
				g.setClip(2 + X, num6, wScroll, num4 + deltaH);
			}
			Item item = (Item)myVector.elementAt(i);
			if (i > selected)
			{
				num2 += deltaH;
				num6 += deltaH;
			}
			int color = 11657202;
			if (i == selected)
			{
				color = 24725;
			}
			else if (i < 7)
			{
				color = 14281983;
			}
			else if (CPlayer.arrItemBag[i - 7] != null)
			{
				if (CPlayer.arrItemBag[i - 7].isInBalo)
				{
					color = 16755251;
				}
				else if (CCanvas.panel != null && (CCanvas.panel.type == 19 || CCanvas.panel.type == 20) && CPlayer.arrItemBag[i - 7].isKhamNam)
				{
					color = 8967679;
				}
			}
			g.setColor(color);
			g.fillRect(2 + X, num6, WIDTH_PANEL, num8, true);
			if (item != null && item.template != null)
			{
				int num9 = num + num3 / 2 + ((item.template.type == 5) ? 5 : 0) + ((item.template.type == 10 || item.template.type == 12) ? (-5) : 0);
				int num10 = num2 + num4 / 2;
				SmallImage.drawSmallImage(g, item.template.iconID, num9, num10, 0, 3, true);
				paintUpgradeEffect(num9, num10, 20, 20, item.level, g);
				if (item.isSocketing)
				{
					paintSocketing(g, X + wScroll - 13, num2 + 2);
					if (i == selected)
					{
						mFont.tahoma_7_white.drawString(g, ((item.daySocket <= 0) ? string.Empty : (item.daySocket + "n")) + ((item.hourSocket <= 0) ? string.Empty : (item.hourSocket + "g")), X + wScroll - 24, num6 + 5, 1);
					}
					else
					{
						mFont.tahoma_7_grey.drawString(g, ((item.daySocket <= 0) ? string.Empty : (item.daySocket + "n")) + ((item.hourSocket <= 0) ? string.Empty : (item.hourSocket + "g")), X + wScroll - 24, num6 + 5, 1);
					}
				}
			}
			if (item != null && item.template != null)
			{
				int num11 = ((item.template.type == 5) ? 7 : 0);
				mFont2.drawString(g, item.template.name + ((item.level <= 0) ? string.Empty : (" +" + item.level)), num5 + 5 + num11 + ((item.template.type == 5) ? 5 : 0), num6 + 5, 0);
				if (item.quantity > 1)
				{
					mFont.tahoma_7_yellow.drawString(g, item.quantity + string.Empty, num + 23, num2 + 10, 0, mFont.tahoma_7_grey);
				}
				int num12 = 5 - item.HP / 20;
				if (num12 == 5)
				{
					num12 = 4;
				}
				g.drawRegion(imgBroken, 0, num12 * 15, 15, 15, 0, xScroll + wScroll + 3, num6 + num8 + 3, mGraphics.RIGHT | mGraphics.BOTTOM, true);
			}
			if (i == selected)
			{
				paintDetail3(g, num6, item);
			}
		}
		paintScrollArrow(g);
	}

	private void paintGiaoDichInfo(mGraphics g)
	{
		mFont.tahoma_7_yellow.drawString(g, L.select_item + ", " + L.lock_trade, X + (WIDTH_PANEL >> 1), 32, 2, mFont.tahoma_7_grey);
		mFont.tahoma_7_yellow.drawString(g, L.wait_opp_lock_trade + ", " + L.press_done, X + (WIDTH_PANEL >> 1), 43, 2, mFont.tahoma_7_grey);
	}
}
