protected String getGStatValue(Environmental E, String arg2)
	{
		if(E==null)
			return null;
		boolean found=false;
		String val="";
		for(int i=0;i<E.getStatCodes().length;i++)
		{
			if(E.getStatCodes()[i].equalsIgnoreCase(arg2))
			{
				val=E.getStat(arg2);
				found=true; break;
			}
		}
		if(!found)
		if(E instanceof MOB)
		{
			arg2=arg2.toUpperCase().trim();
			final GenericBuilder.GenMOBCode element = (GenericBuilder.GenMOBCode)CMath.s_valueOf(GenericBuilder.GenMOBCode.class,arg2);
			if(element != null)
			{
				val=CMLib.coffeeMaker().getGenMobStat((MOB)E,element.name());
				found=true; 
			}
			if(!found)
			{
				final MOB M=(MOB)E;
				for(final int i : CharStats.CODES.ALLCODES())
				{
					if(CharStats.CODES.NAME(i).equals(arg2)||CharStats.CODES.DESC(i).equals(arg2))
					{
						val=""+M.charStats().getStat(CharStats.CODES.NAME(i));
						found=true;
						break;
					}
				}
				if(!found)
				{
					for(int i=0;i<M.curState().getStatCodes().length;i++)
					{
						if(M.curState().getStatCodes()[i].equals(arg2))
						{
							val=M.curState().getStat(M.curState().getStatCodes()[i]);
							found=true;
							break;
						}
					}
				}
				if(!found)
				{
					for(int i=0;i<M.phyStats().getStatCodes().length;i++)
					{
						if(M.phyStats().getStatCodes()[i].equals(arg2))
						{
							val=M.phyStats().getStat(M.phyStats().getStatCodes()[i]);
							found=true;
							break;
						}
					}
				}
				if((!found)&&(M.playerStats()!=null))
				{
					for(int i=0;i<M.playerStats().getStatCodes().length;i++)
					{
						if(M.playerStats().getStatCodes()[i].equals(arg2))
						{
							val=M.playerStats().getStat(M.playerStats().getStatCodes()[i]);
							found=true;
							break;
						}
					}
				}
				if((!found)&&(arg2.toUpperCase().startsWith("BASE")))
				{
					for(int i=0;i<M.baseState().getStatCodes().length;i++)
					{
						if(M.baseState().getStatCodes()[i].equals(arg2.substring(4)))
						{
							val=M.baseState().getStat(M.baseState().getStatCodes()[i]);
							found=true;
							break;
						}
					}
				}
				if((!found)&&(gstatH.containsKey(arg2)))
				{
					found=true;
					switch(gstatH.get(arg2).intValue())
					{
						case GSTATADD_DEITY:
							val = M.getWorshipCharID();
							break;
						case GSTATADD_CLAN:
						{
							Clan C = CMLib.clans().findRivalrousClan(M);
							if (C == null)
								C = M.clans().iterator().hasNext() ? M.clans().iterator().next().first : null;
							val = (C != null) ? C.clanID() : "";
							break;
						}
						case GSTATADD_CLANROLE:
						{
							Clan C = CMLib.clans().findRivalrousClan(M);
							if (C == null)
								C = M.clans().iterator().hasNext() ? M.clans().iterator().next().first : null;
							if (C != null)
							{
								final Pair<Clan, Integer> p = M.getClanRole(C.clanID());
								val = (p != null) ? p.second.toString() : "";
							}
							break;
						}
					}
				}
			}
		}
		else
		if(E instanceof Item)
		{
			final GenericBuilder.GenItemCode code = (GenericBuilder.GenItemCode)CMath.s_valueOf(GenericBuilder.GenItemCode.class, arg2.toUpperCase().trim());
			if(code != null)
			{
				val=CMLib.coffeeMaker().getGenItemStat((Item)E,code.name());
				found=true; 
			}
		}
		if(found)
			return val;
		return null;
	}