public boolean executeImporter(MOB mob, List<Object> commands) throws java.io.IOException
	{
		boolean prompt=true;
		boolean nodelete=false;
		final Map<String,Item> doneItems=new Hashtable<String,Item>();
		final Hashtable<String,Room> doneRooms=new Hashtable<String,Room>();
		final Hashtable<String,MOB> doneMOBS=new Hashtable<String,MOB>();
		final Vector<String> nextResetData=new Vector<String>();
		final Hashtable<String,String> laterLinks=new Hashtable<String,String>();
		boolean multiArea=false;
		final List<CMObject> custom=new Vector<CMObject>();
		final Hashtable<String,String> externalFiles=new Hashtable<String,String>();
		final Set<String> customBotherChecker=new HashSet<String>();
		boolean compileErrors=false;
		String areaType=null;
		commands.remove(0);
		for(int i=0;i<commands.size();i++)
		{
			if(commands.get(i) instanceof String)
			{
				String s=(String)commands.get(i);
				if(s.equalsIgnoreCase("nodelete"))
				{
					commands.remove(i);
					i--;
					nodelete=true;
				}
				else
				if(s.equalsIgnoreCase("noprompt"))
				{
					commands.remove(i);
					i--;
					prompt=false;
				}
				else
				if(s.toLowerCase().startsWith("areatype="))
				{
					s=s.substring(9);
					if(CMClass.getAreaType(s)!=null)
						areaType=s;
					else
					{
						mob.tell(L("Unknown area type : @x1",s));
						return false;
					}
					commands.remove(i);
					i--;
				}
				else
					break;
			}
			else
				break;
		}
		Session session=mob.session();
		if((commands.size()>0)&&(commands.get(commands.size()-1) instanceof StringBuffer))
		{
			compileErrors=true;
			session=null;
		}
		else
		{
			if(session==null)
				return false;
			if(commands.size()<1)
				return returnAnError(session,"Import what?  Specify the path/filename!",compileErrors,commands);
			// continue pre-processing
			for(int areaFile=commands.size()-1;areaFile>=0;areaFile--)
			{
				final String areaFileName=(String)commands.get(areaFile);
				final CMFile F=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
				final CMFile[] FF=F.listFiles();
				if((FF!=null)&&(FF.length>0))
				{
					for (final CMFile element : FF)
						commands.add(element.getAbsolutePath());
					commands.remove(areaFile);
				}
			}
		}

		final Vector mobData=new Vector(); // outside the for loop -- why?
		final Vector objectData=new Vector(); // outside the for loop -- why?

		multiArea=commands.size()>1;
		final HashSet<String> baseFilesAlreadyDone=new HashSet<String>();
		while(commands.size()>0)
		{
			final Object O=commands.remove(0);
			final Vector areaData=new Vector();
			final Vector roomData=new Vector();
			final Vector<String> resetData=new Vector<String>();
			final Vector mobProgData=new Vector();
			final Vector roomProgData=new Vector();
			final Vector objProgData=new Vector();
			final Vector shopData=new Vector();
			final Vector specialData=new Vector();
			final Vector<Room> newRooms=new Vector<Room>();
			final Vector<String> socialData=new Vector<String>();
			Vector<String> reLinkTable=null;
	
			StringBuffer buf=null;
			String areaFileName=null;
			CMFile CF=null;
			boolean zonFormat=false;
			if(O instanceof StringBuffer)
			{
				areaFileName="memory.cmare";
				buf=(StringBuffer)O;
			}
			else
			if(O instanceof Pair)
			{
				areaFileName=((Pair)O).first.toString();
				buf=(StringBuffer)((Pair)O).second;
			}
			else
			if(O instanceof java.util.zip.ZipInputStream)
			{
				final java.util.zip.ZipInputStream i=(java.util.zip.ZipInputStream)O;
				final java.util.zip.ZipEntry entry=i.getNextEntry();
				if(entry==null)
				{
					i.close();
					continue;
				}
				final byte[] data = new byte[(int)entry.getSize()];
				int dex=0;
				int read=i.read(data);
				while((read>=0)&&(dex < entry.getSize()))
				{
					dex+=read;
					read=i.read(data, dex, (int)entry.getSize()-dex);
				}
				i.closeEntry();
				if(commands.size()==0)
				{
					commands.add(new Pair<String,StringBuffer>("unzip:"+entry.getName(),new StringBuffer(new String(data))));
					commands.add(i);
				}
				else
				{
					commands.add(0,new Pair<String,StringBuffer>("unzip:"+entry.getName(),new StringBuffer(new String(data))));
					commands.add(1,i);
				}
				continue;
			}
			else
			{
				areaFileName=(String)O;
				final int x=areaFileName.lastIndexOf('.');
				final String ext=(x>0)?areaFileName.toLowerCase().substring(x+1):"";
				// read in the .are file
	
				if(ext.equalsIgnoreCase("zip"))
				{
					final java.util.zip.ZipInputStream i=new java.util.zip.ZipInputStream(new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS).getRawStream());
					if(commands.size()==0)
						commands.add(i);
					else
						commands.add(0,i);
					continue;
				}
				if(ext.equals("zon")
				|| ext.endsWith("wld")
				|| ext.endsWith("obj")
				|| ext.endsWith("mob")
				|| ext.endsWith("shp")
				|| ext.endsWith("doc"))
				{
					final String baseAreaFileName=areaFileName.substring(0,x);
					if(baseFilesAlreadyDone.contains(baseAreaFileName.toLowerCase()))
						continue;
					baseFilesAlreadyDone.add(baseAreaFileName.toLowerCase());
					areaFileName=baseAreaFileName+".zon";
					CF=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
					buf=CF.text();
					final StringBuffer finalBuf=new StringBuffer("");
					final String eoln=CMStrings.determineEOLN(buf);
					String resetsStr="";
					if((buf!=null)&&(buf.length()>0))
					{
						final int wldDivDex=buf.indexOf(eoln+eoln);
						if(wldDivDex<0)
							return returnAnError(session,"Malformed Zone at: '"+areaFileName+"'!",compileErrors,commands);
						int startDex=0;
						if(buf.charAt(0)=='#')
							startDex=buf.indexOf(eoln)+eoln.length();
						finalBuf.append("#AREA").append(eoln).append(buf.substring(startDex,wldDivDex)).append(eoln).append(eoln);
						resetsStr=L("#RESETS@x1@x2@x3@x4",eoln,buf.substring(wldDivDex+(eoln.length()*2)),eoln,eoln);
						areaFileName=baseAreaFileName+".wld";
						CF=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
						buf=CF.text();
					}
					if((buf!=null)&&(buf.length()>0))
					{
						finalBuf.append("#ROOMS").append(eoln).append(buf.toString()).append(eoln).append(eoln);
						areaFileName=baseAreaFileName+".mob";
						CF=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
						buf=CF.text();
					}
					if((buf!=null)&&(buf.length()>0))
					{
						finalBuf.append("#MOBILES").append(eoln).append(buf.toString()).append(eoln).append(eoln);
						areaFileName=baseAreaFileName+".obj";
						CF=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
						buf=CF.text();
					}
					if((buf!=null)&&(buf.length()>0))
					{
						finalBuf.append("#OBJECTS").append(eoln).append(buf.toString()).append(eoln).append(eoln);
						finalBuf.append(resetsStr);
						areaFileName=baseAreaFileName+".zon";
					}
					buf=finalBuf;
					zonFormat=true;
				}
				else
				{
					CF=new CMFile(areaFileName,mob,CMFile.FLAG_LOGERRORS);
					buf=CF.text();
				}
				if((buf==null)||(buf.length()==0))
					return returnAnError(session,"File not found at: '"+areaFileName+"'!",compileErrors,commands);
			}
			try
			{
				if((areaFileName!=null)&&(areaFileName.toUpperCase().trim().endsWith(".LST")))
				{
					if(session!=null)
						session.println(L("Unpacking areas lists from file : '@x1'...",areaFileName));
					String filePrefix="";
					int c=areaFileName.lastIndexOf('/');
					if(c>=0)
						filePrefix=areaFileName.substring(0,c+1);
					c=0;
					String fn="";
					while((buf!=null)&&(buf.length()>0)&&(c<buf.length()))
					{
						switch(buf.charAt(c))
						{
						case '\n':
						case '\r':
							if((fn.length()>0)&&(!fn.startsWith("#"))&&(!fn.startsWith("$")))
								commands.add(filePrefix+fn);
							buf.delete(0,c+1);
							c=0;
							fn="";
							break;
						default:
							fn+=buf.charAt(c);
							c++;
							break;
						}
					}
					if((fn.length()>0)&&(!fn.startsWith("#"))&&(!fn.startsWith("$")))
						commands.add(filePrefix+fn);
					continue;
				}
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<AREAS>")>=0))
				{
					if(!CMSecurity.isAllowedEverywhere(mob,CMSecurity.SecFlag.IMPORTROOMS))
					{
						returnAnError(session,"You are not allowed to import areas in '"+areaFileName+"'.",compileErrors,commands);
						continue;
					}
	
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					final List<List<XMLLibrary.XMLTag>> areas=new Vector<List<XMLLibrary.XMLTag>>();
					if(session!=null)
						session.rawPrint(L("Unpacking area(s) from file: '@x1'...",areaFileName));
					String error=CMLib.coffeeMaker().fillAreasVectorFromXML(buf.toString(),areas,custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()>0)
						return false;
					if(session!=null)
						session.rawPrintln("!");
					if(session!=null)
						session.println(L("Found @x1 areas.",""+areas.size()));
					final int num=areas.size();
					int a=0;
					while(areas.size()>0)
					{
						if(session!=null)
							session.rawPrint(L("Unpacking area #@x1/@x2...",""+(a+1),""+num));
						final List<XMLLibrary.XMLTag> area=areas.get(0);
						error=CMLib.coffeeMaker().unpackAreaFromXML(area,session,areaType,true);
						if(session!=null)
							session.rawPrintln("!");
						if(error.startsWith("Area Exists: "))
						{
							final String areaName=error.substring(13).trim();
							if((nodelete)&&(!prompt))
								return returnAnError(session,"Area '"+areaName+"' already exists.",compileErrors,commands);
							else
							if(((!prompt)||((session!=null)&&session.confirm(L("Area: \"@x1\" exists, obliterate first?",areaName),"N"))))
							{
								if(reLinkTable==null)
									reLinkTable=new Vector<String>();
								if((mob.location()!=null)
								&&(mob.location().getArea().Name().equalsIgnoreCase(areaName)))
								{
									try
									{
										for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
										{
											final Room R=r.nextElement();
											if((R!=null)&&(!R.getArea().Name().equalsIgnoreCase(areaName)))
											{
												R.bringMobHere(mob,true);
												break;
											}
										}
									}catch(final NoSuchElementException e){}
								}
								if(!temporarilyDeleteArea(mob,reLinkTable,areaName))
									return false;
							}
							else
								return false;
						}
						else
						if(error.length()>0)
							return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
						else
						{
							areas.remove(area);
							a++;
						}
					}
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("Area(s) successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<AREA>")>=0))
				{
					if(!CMSecurity.isAllowedEverywhere(mob,CMSecurity.SecFlag.IMPORTROOMS))
					{
						returnAnError(session,"You are not allowed to import area in '"+areaFileName+"'.",compileErrors,commands);
						continue;
					}
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.rawPrint(L("Unpacking area from file: '@x1'...",areaFileName));
					final Vector<XMLLibrary.XMLTag> areaD=new Vector<XMLLibrary.XMLTag>();
					String error=CMLib.coffeeMaker().fillAreaAndCustomVectorFromXML(buf.toString(),areaD,custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						error=CMLib.coffeeMaker().unpackAreaFromXML(areaD,session,areaType,true);
					if(session!=null)
						session.rawPrintln("!");
					if(error.startsWith("Area Exists: "))
					{
						final String areaName=error.substring(13).trim();
						if((nodelete)&&(!prompt))
							return returnAnError(session,"Area '"+areaName+"' already exists.",compileErrors,commands);
						else
						if((!prompt)
						||((session!=null)&&session.confirm(L("Area: \"@x1\" exists, obliterate first?",areaName),"N")))
						{
							reLinkTable=new Vector<String>();
							if(!temporarilyDeleteArea(mob,reLinkTable,areaName))
								return false;
						}
						else
							return false;
						if(session!=null)
							session.rawPrint(L("Unpacking area from file: '@x1'...",areaFileName));
						error=CMLib.coffeeMaker().unpackAreaFromXML(areaD,session,areaType,true);
						if(session!=null)
							session.rawPrintln("!");
					}
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("Area successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<AROOM>")>=0))
				{
					if(!CMSecurity.isAllowedEverywhere(mob,CMSecurity.SecFlag.IMPORTROOMS))
					{
						returnAnError(session,"You are not allowed to import room in '"+areaFileName+"'.",compileErrors,commands);
						continue;
					}
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.println(L("Unpacking room from file: '@x1'...",areaFileName));
					String error=CMLib.coffeeMaker().fillCustomVectorFromXML(buf.toString(),custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						error=CMLib.coffeeMaker().unpackRoomFromXML(buf.toString(),true);
					if(error.startsWith("Room Exists: "))
					{
						final Room R=CMLib.map().getRoom(error.substring(13).trim());
						if(R!=null)
						{
							if((nodelete)&&(!prompt))
								return returnAnError(session,"Room '"+R.ID()+"' already exists.",compileErrors,commands);
							reLinkTable=new Vector<String>();
							try
							{
								for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
								{
									final Room R2=r.nextElement();
									if(R2!=R)
									{
										for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
										{
											final Room dirR=R2.rawDoors()[d];
											if((dirR!=null)&&(dirR==R))
												reLinkTable.add(R2.roomID()+"/"+d+"/"+dirR.roomID());
										}
									}
								}
							}
							catch (final NoSuchElementException e)
							{
							}
							CMLib.map().obliterateRoom(R);
						}
						error=CMLib.coffeeMaker().unpackRoomFromXML(buf.toString(),true);
					}
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("Room successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<CATALOG")>=0))
				{
					if((!CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.IMPORTMOBS))
					||(!CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.CATALOG)))
					{
						returnAnError(session,"You are not allowed to import catalog items in '"+areaFileName+"' here.",compileErrors,commands);
						continue;
					}
					boolean hasBoth = buf.substring(0,30).indexOf("<CATALOG HASBOTH")>=0;
					boolean hasMobs = hasBoth || buf.substring(0,30).indexOf("<CATALOG HASMOBS")>=0;
					boolean hasItems = hasBoth || buf.substring(0,30).indexOf("<CATALOG HASITEMS")>=0;
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.rawPrint(L("Unpacking stuff from file: '@x1'...",areaFileName));
					final List<XMLLibrary.XMLTag> xmlFirst=CMLib.xml().parseAllXML(buf);
					if((xmlFirst.size()==0)||(!xmlFirst.get(0).tag().equalsIgnoreCase("CATALOG")))
					{
						returnAnError(session,"No catalog data in '"+areaFileName+"' here.",compileErrors,commands);
						continue;
					}
					buf = new StringBuffer(xmlFirst.get(0).value());
					xmlFirst.clear();
					
					String error=CMLib.coffeeMaker().fillCustomVectorFromXML(buf.toString(),custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					final Vector<MOB> mobs=new Vector<MOB>();
					final Vector<CataData> mobCatData=new Vector<CataData>();
					if((error.length()==0)&&(hasMobs))
					{
						error=CMLib.coffeeMaker().addMOBsFromXML(buf.toString(),mobs,session);
						if(error.length()==0)
							error=CMLib.coffeeMaker().addCataDataFromXML(buf.toString(),mobCatData,mobs,session);
					}
					final Vector<Item> items=new Vector<Item>();
					final Vector<CataData> itemCatData=new Vector<CataData>();
					if((error.length()==0)&&(hasItems))
					{
						error=CMLib.coffeeMaker().addItemsFromXML(buf.toString(),items,session);
						if(error.length()==0)
							error=CMLib.coffeeMaker().addCataDataFromXML(buf.toString(),itemCatData,items,session);
					}
					if(session!=null)
						session.rawPrintln("!");
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
					for(int m=0;m<mobs.size();m++)
					{
						final MOB M=mobs.get(m);
						if(CMLib.catalog().isCatalogObj(M))
						{
							if((!prompt)||((session!=null)&&(session.confirm(L("Replace existing catalog mob '@x1' with imported one?",M.name()), L("Y")))))
								CMLib.catalog().updateCatalog(M);
							else
								continue;
						}
						else
						{
							CMLib.catalog().addCatalog(M);
						}
						Log.sysOut("Import",mob.Name()+" imported catalog mob "+M.Name());
						if(m<mobCatData.size())
						{
							CataData dat = CMLib.catalog().getCatalogData(M);
							dat.build(mobCatData.get(m).data(null));
						}
						M.destroy();
					}
					for(int m=0;m<items.size();m++)
					{
						final Item I=items.get(m);
						if(CMLib.catalog().isCatalogObj(I))
						{
							if((!prompt)||((session!=null)&&(session.confirm(L("Replace existing catalog item '@x1' with imported one?",I.name()), L("Y")))))
								CMLib.catalog().updateCatalog(I);
							else
								continue;
						}
						else
						{
							CMLib.catalog().addCatalog(I);
						}
						Log.sysOut("Import",mob.Name()+" imported catalog item "+I.Name());
						if(m<itemCatData.size())
						{
							CataData dat = CMLib.catalog().getCatalogData(I);
							dat.build(mobCatData.get(m).data(null));
						}
						I.destroy();
					}
					mob.location().recoverRoomStats();
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("MOB(s) successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<MOBS>")>=0))
				{
					if(!CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.IMPORTMOBS))
					{
						returnAnError(session,"You are not allowed to import mobs in '"+areaFileName+"' here.",compileErrors,commands);
						continue;
					}
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.rawPrint(L("Unpacking mobs from file: '@x1'...",areaFileName));
					final Vector<MOB> mobs=new Vector<MOB>();
					String error=CMLib.coffeeMaker().fillCustomVectorFromXML(buf.toString(),custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						error=CMLib.coffeeMaker().addMOBsFromXML(buf.toString(),mobs,session);
					if(session!=null)
						session.rawPrintln("!");
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
					if(mob.location()==null)
						return returnAnError(session,"You must be in a room to import mobs.",compileErrors,commands);
					for(int m=0;m<mobs.size();m++)
					{
						final MOB M=mobs.get(m);
						M.setStartRoom(mob.location());
						M.setLocation(mob.location());
						M.bringToLife(mob.location(),true);
					}
					mob.location().recoverRoomStats();
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("MOB(s) successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&((buf.substring(0,20).indexOf("<PLAYERS>")>=0)||(buf.substring(0,20).indexOf("<ACCOUNTS>")>=0)))
				{
					if(!CMSecurity.isAllowedEverywhere(mob,CMSecurity.SecFlag.IMPORTPLAYERS))
					{
						returnAnError(session,"You are not allowed to import players in '"+areaFileName+"' here.",compileErrors,commands);
						continue;
					}
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.rawPrint(L("Unpacking players from file: '@x1'...",areaFileName));
					final List<MOB> mobs=new Vector<MOB>();
					final List<PlayerAccount> accounts=new Vector<PlayerAccount>();
					String error=CMLib.coffeeMaker().fillCustomVectorFromXML(buf.toString(),custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						error=CMLib.coffeeMaker().addPlayersAndAccountsFromXML(buf.toString(),accounts,mobs,session);
					if(session!=null)
						session.rawPrintln("!");
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
	
					Vector<String> names=null;
					if(accounts.size()>0)
					{
						for(int m=0;m<accounts.size();m++)
						{
							final PlayerAccount A=accounts.get(m);
							for(int af=0;af<commands.size();af++)
							{
								if((commands.get(af) instanceof String)
								&&(A.getAccountName().equalsIgnoreCase((String)commands.get(af))))
								{
									if(names==null)
										names=new Vector<String>();
									names.add((String)commands.get(af));
								}
							}
						}
					}
					else
					for(int m=0;m<mobs.size();m++)
					{
						final MOB M=mobs.get(m);
						for(int af=0;af<commands.size();af++)
							if((commands.get(af) instanceof String)
							&&(M.Name().equalsIgnoreCase((String)commands.get(af))))
							{
								if(names==null)
									names=new Vector<String>();
								names.add((String)commands.get(af));
							}
					}
					if(names!=null)
					{
						for(int n=0;n<names.size();n++)
							commands.remove(names.get(n));
					}
					for(int m=0;m<accounts.size();m++)
					{
						final PlayerAccount A=accounts.get(m);
						if(CMLib.players().accountExists(A.getAccountName()))
						{
							if(!prompt)
							{
								returnAnError(session,"Account '"+A.getAccountName()+"' already exists.  Skipping.",compileErrors,commands);
								continue;
							}
							else
							if((session!=null)&&(!session.confirm(L("Account: \"@x1\" exists, obliterate first?",A.getAccountName()),"Y")))
								continue;
							else
								CMLib.players().obliterateAccountOnly(CMLib.players().getLoadAccount(A.getAccountName()));
						}
						A.setLastUpdated(System.currentTimeMillis());
						Log.sysOut("Import","Imported account: "+A.getAccountName());
						CMLib.database().DBCreateAccount(A);
						CMLib.players().addAccount(A);
					}
					for(int m=0;m<mobs.size();m++)
					{
						final MOB M=mobs.get(m);
						if(names!=null)
						{
							boolean found=false;
							for(int n=0;n<names.size();n++)
							{
								if(M.Name().equalsIgnoreCase(names.get(n)))
									found=true;
							}
							if(!found)
								continue;
						}
						if(CMLib.players().playerExists(M.Name()))
						{
							if(!prompt)
							{
								returnAnError(session,"Player '"+M.Name()+"' already exists.  Skipping.",compileErrors,commands);
								continue;
							}
							else
							if((session!=null)&&(!session.confirm(L("Player: \"@x1\" exists, obliterate first?",M.Name()),"Y")))
								continue;
							else
								CMLib.players().obliteratePlayer(CMLib.players().getLoadPlayer(M.Name()),false,false);
						}
						if(M.playerStats()!=null)
							M.playerStats().setLastUpdated(System.currentTimeMillis());
						CMLib.achievements().loadPlayerSkillAwards(M, M.playerStats());
						CMLib.achievements().loadAccountAchievements(M,AchievementLoadFlag.NORMAL);
						CMLib.database().DBCreateCharacter(M);
						CMLib.players().addPlayer(M);
						Log.sysOut("Import","Imported user: "+M.Name());
						CMLib.login().notifyFriends(M,L("^X@x1 has just been created.^.^?",M.Name()));
						final List<String> channels=CMLib.channels().getFlaggedChannelNames(ChannelsLibrary.ChannelFlag.NEWPLAYERS);
						for(int i=0;i<channels.size();i++)
							CMLib.commands().postChannel(channels.get(i),M.clans(),L("@x1 has just been created.",M.Name()),true);
						if(M.getStartRoom()==null)
							M.setStartRoom(CMLib.login().getDefaultStartRoom(M));
						if(M.location()==null)
							M.setLocation(mob.location());
						if(M.playerStats().getBirthday()==null)
						{
							M.baseCharStats().setStat(CharStats.STAT_AGE,M.playerStats().initializeBirthday(CMLib.time().localClock(mob.getStartRoom()),(int)Math.round(CMath.div(M.getAgeMinutes(),60.0)),M.baseCharStats().getMyRace()));
							M.recoverCharStats();
						}
						CMLib.database().DBUpdatePlayer(M);
						M.removeFromGame(false,true);
					}
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("Player(s)/Account(s) successfully imported!"));
					continue;
				}
				else
				if((buf!=null)&&(buf.length()>20)&&(buf.substring(0,20).indexOf("<ITEMS>")>=0))
				{
					if(!CMSecurity.isAllowed(mob,mob.location(),CMSecurity.SecFlag.IMPORTITEMS))
					{
						returnAnError(session,"You are not allowed to import items in '"+areaFileName+"' here.",compileErrors,commands);
						continue;
					}
					if(CF!=null)
						buf=CF.textUnformatted();
					if(buf == null)
						buf = new StringBuffer("");
					if(session!=null)
						session.rawPrint(L("Unpacking items from file: '@x1'...",areaFileName));
					final Vector<Item> items=new Vector<Item>();
					String error=CMLib.coffeeMaker().fillCustomVectorFromXML(buf.toString(),custom,externalFiles);
					if(error.length()==0)
						importCustomObjects(mob,custom,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						importCustomFiles(mob,externalFiles,customBotherChecker,!prompt,nodelete);
					if(error.length()==0)
						error=CMLib.coffeeMaker().addItemsFromXML(buf.toString(),items,session);
					if(session!=null)
						session.rawPrintln("!");
					if(error.length()>0)
						return returnAnError(session,"An error occurred on import: "+error+"\n\rPlease correct the problem and try the import again.",compileErrors,commands);
					if(mob.location()==null)
						return returnAnError(session,"You must be in a room to import items.",compileErrors,commands);
					for(int i=0;i<items.size();i++)
					{
						final Item I=items.get(i);
						mob.location().addItem(I,ItemPossessor.Expire.Player_Drop);
					}
					mob.location().recoverRoomStats();
					Log.sysOut("Import",mob.Name()+" imported "+areaFileName);
					if(session!=null)
						session.println(L("Item(s) successfully imported!"));
					continue;
				}
			}
			catch(final Exception e)
			{
				Log.errOut("Import-",e);
				return returnAnError(session,e.getMessage(),compileErrors,commands);
			}
	
	
			final List<String> V=Resources.getFileLineVector(buf);
	
			// sort the data into general blocks, and identify area
			if(session!=null)
				session.println(L("\n\rSorting data from file '@x1'...",areaFileName));
			Log.sysOut("Import","Importing data from file '"+areaFileName+"'");
			readBlocks(V,areaData,roomData,mobData,resetData,objectData,mobProgData,objProgData,shopData,specialData,socialData,roomProgData);
			boolean didSocials=false;
			try
			{
				while(socialData.size()>0)
				{
					final String codeLine=eatNextLine(socialData);
					if((!codeLine.startsWith("#"))&&(codeLine.trim().length()>0))
					{
						didSocials=true;
						String word=codeLine.trim().toUpperCase();
						final int x=word.indexOf(' ');
						if(x>0)
							word=word.substring(0,x).trim();
	
						Social S1=CMLib.socials().fetchSocial(word,true);
						Social S2=CMLib.socials().fetchSocial(word+" <T-NAME>",true);
						Social S3=CMLib.socials().fetchSocial(word+" SELF",true);
						boolean changing=true;
						if((S1==null)||(!S1.name().toUpperCase().equals(word)))
						{
							S1=(Social)CMClass.getCommon("DefaultSocial");
							S1.setName(word);
							CMLib.socials().addSocial(S1);
							changing=false;
						}
	
						String str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S1.You_see()==null)||(!S1.You_see().equals(str)))
						{
							if((changing)&&prompt&&(session!=null))
								session.rawPrint(L("Change Social '@x1' from '@x2', you see, to: '@x3'",S1.name(),S1.You_see(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S1.setYou_see(str);
						}
	
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S1.Third_party_sees()==null)||(!S1.Third_party_sees().equals(str)))
						{
							if((changing)&&prompt&&(session!=null))
								session.rawPrint(L("Change Social '@x1' from '@x2', others see, to: '@x3'",S1.name(),S1.Third_party_sees(),str));
							if((!changing)||((session!=null)&&prompt&&(session.confirm("?","Y"))))
								S1.setThird_party_sees(str);
						}
	
						changing=true;
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
						if(S2==null)
						{
							S2=(Social)CMClass.getCommon("DefaultSocial");
							S2.setName(word+" <T-NAME>");
							CMLib.socials().addSocial(S2);
							changing=false;
						}
	
						if((S2.You_see()==null)||(!S2.You_see().equals(str)))
						{
							if((changing)&&prompt&&(session!=null))
								session.rawPrint(L("Change Social '@x1' from '@x2', you see, to: '@x3'",S2.name(),S2.You_see(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S2.setYou_see(str);
						}
	
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S2.Third_party_sees()==null)||(!S2.Third_party_sees().equals(str)))
						{
							if((session!=null)&&prompt&&changing)
								session.rawPrint(L("Change Social '@x1', others see from '@x2', to: '@x3'",S2.name(),S2.Third_party_sees(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S2.setThird_party_sees(str);
						}
	
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S2.Target_sees()==null)||(!S2.Target_sees().equals(str)))
						{
							if((session!=null)&&prompt&&changing)
								session.rawPrint(L("Change Social '@x1', target sees from '@x2', to: '@x3'",S2.name(),S2.Target_sees(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S2.setTarget_sees(str);
						}
	
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S2.See_when_no_target()==null)||(!S2.See_when_no_target().equals(str)))
						{
							if((session!=null)&&prompt&&changing)
								session.rawPrint(L("Change Social '@x1', no target sees from '@x2', to: '@x3'",S2.name(),S2.See_when_no_target(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S2.setSee_when_no_target(str);
						}
	
						changing=true;
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
						if(S3==null)
						{
							S3=(Social)CMClass.getCommon("DefaultSocial");
							S3.setName(L("@x1 SELF",word));
							CMLib.socials().addSocial(S3);
							changing=false;
						}
	
						if((S3.You_see()==null)||(!S3.You_see().equals(str)))
						{
							if((session!=null)&&prompt&&changing)
								session.rawPrint(L("Change Social '@x1', you see from '@x2', to: '@x3''",S3.name(),S3.You_see(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S3.setYou_see(str);
						}
	
						str=socialFix(eatNextLine(socialData));
						if(str.startsWith("#"))
							continue;
	
						if((S3.Third_party_sees()==null)||(!S3.Third_party_sees().equals(str)))
						{
							if((session!=null)&&prompt&&changing)
								session.rawPrint(L("Change Social '@x1', others see from '@x2', to: '@x3'",S3.name(),S3.Third_party_sees(),str));
							if((!changing)||((session!=null)&&prompt&&session.confirm("?","Y")))
								S3.setThird_party_sees(str);
						}
	
					}
				}
				if(didSocials)
				{
					Log.sysOut("Import",mob.Name()+" imported socials from "+areaFileName);
					CMLib.socials().save(mob);
				}
			}
			catch(final Exception e)
			{
				Log.errOut("Import",e);
				return returnAnError(session,e.getMessage(),compileErrors,commands);
			}
	
			if((roomData.size()==0)||(areaData.size()==0))
			{
				if(!didSocials)
				{
					if(multiArea)
					{
						returnAnError(session,"No data in "+areaFileName,compileErrors,commands);
						if((prompt)&&(session!=null))
						{
							try
							{
							if(!session.confirm(L("Would you like to continue (y/N)"),"N"))
								return false;
							}catch(final Exception e){}
						}
						continue;
					}
					returnAnError(session,"Missing data! It is very unlikely this is an .are file.",compileErrors,commands);
					return false;
				}
			}
			String areaName=getAreaName(areaData);
			final String areaAuthor=getAreaAuthor(areaData);
			if((areaName==null)||(areaName.length()==0))
			{
				if(!didSocials)
					returnAnError(session,"#AREA tag not found!",compileErrors,commands);
				if(multiArea)
					continue;
				return false;
			}
			if((areaName.toUpperCase().startsWith(areaAuthor.toUpperCase()+" "))
			&&(areaName.substring(areaAuthor.length()+1).trim().length()>0))
				areaName=areaName.substring(areaAuthor.length()+1).trim();
			if((areaName!=null)&&(areaName.endsWith("~")))
				areaName=areaName.substring(0,areaName.length()-1);
	
			try
			{
				// confirm area creation/overwrite
				boolean exists=false;
				try
				{
					for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
					{
						final Room R=r.nextElement();
						if(R.getArea().Name().equalsIgnoreCase(areaName))
						{
							exists=true;
							break;
						}
					}
				}
				catch (final NoSuchElementException e)
				{
				}
				if(exists)
				{
					if((nodelete)&&(!prompt))
						return returnAnError(session,"Area '"+areaName+"' already exists.",compileErrors,commands);
					else
					if((!prompt)
					||((session!=null)&&(session.confirm(L("Area: \"@x1\" exists, obliterate first?",areaName),"N"))))
					{
						reLinkTable=new Vector<String>();
						if(!temporarilyDeleteArea(mob,reLinkTable,areaName))
						{
							if(multiArea)
								continue;
							return false;
						}
					}
					else
					{
						if(multiArea)
							continue;
						return false;
					}
				}
				else
				if((prompt)&&((session!=null)&&(!session.confirm(L("Found area: \"@x1\", is this ok?",areaName),"Y"))))
				{
					if(multiArea)
						continue;
					return false;
				}
	
				if(session!=null)
					session.println(L("Loading and Linking Rooms..."));
				Log.sysOut("Import",mob.Name()+" imported "+areaName+" from "+areaFileName);
				// begin initial room-read
				// build first room structures, leaving rest for later.
				Room lastRoom=null;
				final Hashtable<Room,Room> petShops=new Hashtable<Room,Room>();
				final Hashtable<String,Room> areaRooms=new Hashtable<String,Room>();
				final Hashtable<String,Item> areaItems=new Hashtable<String,Item>();
				final Hashtable<String,MOB> areaMOBS=new Hashtable<String,MOB>();
	
				for(int r=0;r<roomData.size();r++)
				{
					List<String> roomV=null;
					if(roomData.get(r) instanceof List)
					{
						roomV=(List)roomData.get(r);
						if((roomV.size()==1)
						&&(roomV.get(1).toUpperCase().trim().startsWith("#ROOM")))
							continue;
					}
					else
					if(roomData.get(r) instanceof String)
					{
						final String s=(String)roomData.get(r);
						if(!s.toUpperCase().trim().startsWith("#ROOM"))
							returnAnError(session,"Eating immaterial line: "+roomData.get(r)+", area="+areaName,compileErrors,commands);
						continue;
					}
					else
						continue;
	
					Area A=CMLib.map().getArea(areaName);
					if(A==null)
					{
						if(areaType==null)
							A=CMClass.getAreaType("StdArea");
						else
							A=CMClass.getAreaType(areaType);
						A.setName(areaName);
						A.setAuthorID(areaAuthor);
						CMLib.map().addArea(A);
						CMLib.database().DBCreateArea(A);
					}
					else
						A.setAreaState(Area.State.FROZEN);
	
					Room R=CMClass.getLocale("StdRoom");
					String plainRoomID=eatNextLine(roomV);
					if(isBadID(plainRoomID))
					{
						Log.errOut("IMPORT","Eating bad room id "+plainRoomID);
						roomData.remove(r);
						r--;
						continue;
					}
	
					R.setRoomID(plainRoomID);
	
					//if(CMSecurity.isDebugging(CMSecurity.DbgFlag.IMPORT))
					//	Log.debugOut("IMPORT","Found: "+plainRoomID+" ("+areaName+")");
	
					if((roomV.size()>2)
					&&(roomV.get(0).trim().equals("~"))
					&&(roomV.get(1).trim().equals("~")))
					{
						eatLineSquiggle(roomV);
						eatLineSquiggle(roomV);
						R.setDisplayText(L("Emptiness..."));
						R.setDescription("");
					}
					else
					{
						R.setDisplayText(CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV)));
						R.setDescription(CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV)));
					}
					if(R.expirationDate()!=0)
						R.setExpirationDate(R.expirationDate()+(360000));
	
					final String codeLine=eatNextLine(roomV);
					if((!R.roomID().startsWith("#"))
					||(R.displayText().length()==0)
					||(CMParms.numBits(codeLine)<2)
					||((CMParms.numBits(codeLine)>6)&&(!zonFormat)))
					{
						returnAnError(session,"Malformed room! Aborting this room "+R.roomID()+", display="+R.displayText()+", description="+R.description()+", numBits="+CMParms.numBits(codeLine)+", area="+areaName,compileErrors,commands);
						continue;
					}
	
					R.setRoomID(areaName+R.roomID());
					R.setArea(A);
					long codeBits=getBitMask(codeLine,0);
					int sectorType=(int)getBitMask(codeLine,1);
					final String[][] secTypes={
						{ "inside",		"0"},
						{ "city",		"1"},
						{ "field",		"2"},
						{ "forest",		"3"},
						{ "hills",		"4"},
						{ "mountain",	"5"},
						{ "swim",		"6"}, // means it is swimmable
						{ "noswim",		"7"}, // means it requires a boat
						{ "unused",		"8"},
						{ "air",		"9"},
						{ "desert",		"10"}
					};
					boolean circleFormat=false;
					if((CMParms.numBits(codeLine)>=6)||(CMParms.numBits(codeLine)==4)) // wierder circlemud exception
					{
						codeBits=(getBitMask(codeLine,2)<<16)|getBitMask(codeLine,1); // ignoring 3 & 4
						sectorType=CMath.s_int(CMParms.getBit(codeLine,5));
						circleFormat=true;
					}
					else
					if(CMParms.numBits(codeLine)==5) // wierd circlemud exception
					{
						codeBits=sectorType;
						codeBits=(getBitMask(codeLine,2)<<16)|getBitMask(codeLine,1); // ignoring 3
						sectorType=CMath.s_int(CMParms.getBit(codeLine,4));
						circleFormat=true;
					}
					else
					if(CMParms.numBits(codeLine)==3)
					{
						codeBits=sectorType;
						final String secType=CMParms.getBit(codeLine,2);
						sectorType=(int)getBitMask(codeLine,2);
						for (final String[] secType2 : secTypes)
						{
							if(secType.equalsIgnoreCase(secType2[0]))
							{
								sectorType=CMath.s_int(secType2[1]);
								break;
							}
						}
					}
					if(circleFormat)
					{
						switch(sectorType)
						{
						case 0:
							R = changeRoomClass(R, "StoneRoom");
							break;
						case 1:
							R = changeRoomClass(R, "CityStreet");
							break;
						case 2:
							R = changeRoomClass(R, "Plains");
							break;
						case 3:
							R = changeRoomClass(R, "Woods");
							break;
						case 4:
							R = changeRoomClass(R, "Hills");
							break;
						case 5:
							R = changeRoomClass(R, "Mountains");
							break;
						case 6:
							R = changeRoomClass(R, "ShallowWater");
							break;
						case 7:
							R = changeRoomClass(R, "WaterSurface");
							break;
						case 8:
							R = changeRoomClass(R, "UnderWater");
							break;
						case 9:
							R = changeRoomClass(R, "InTheAir");
							break;
						case 10:
							R = changeRoomClass(R, "Desert");
							break;
						case 11:
							R = changeRoomClass(R, "FrozenPlains");
							break;
						case 12:
							R = changeRoomClass(R, "FrozenMountains");
							break;
						}
					}
					else
					if((codeBits&8)==0)
					{
						switch(sectorType)
						{
						case 0:
							R = changeRoomClass(R, "CityStreet");
							break;
						case 1:
							R = changeRoomClass(R, "CityStreet");
							break;
						case 2:
							R = changeRoomClass(R, "Plains");
							break;
						case 3:
							R = changeRoomClass(R, "Woods");
							break;
						case 4:
							R = changeRoomClass(R, "Hills");
							break;
						case 5:
							R = changeRoomClass(R, "Mountains");
							break;
						case 6:
							R = changeRoomClass(R, "ShallowWater");
							break;
						case 7:
							R = changeRoomClass(R, "WaterSurface");
							break;
						case 8:
							R = changeRoomClass(R, "FrozenPlains");
							break;
						case 9:
							R = changeRoomClass(R, "InTheAir");
							break;
						case 10:
							R = changeRoomClass(R, "Desert");
							break;
						case 11:
							R = changeRoomClass(R, "FrozenPlains");
							break;
						case 12:
							R = changeRoomClass(R, "FrozenMountains");
							break;
						}
					}
					else
					{
						switch(sectorType)
						{
						case 0:
							R = changeRoomClass(R, "StoneRoom");
							break;
						case 1:
							R = changeRoomClass(R, "StoneRoom");
							break;
						case 2:
							R = changeRoomClass(R, "WoodRoom");
							break;
						case 3:
							R = changeRoomClass(R, "WoodRoom");
							break;
						case 4:
							R = changeRoomClass(R, "StoneRoom");
							break;
						case 5:
							R = changeRoomClass(R, "StoneRoom");
							break;
						case 6:
							R = changeRoomClass(R, "IndoorShallowWater");
							break;
						case 7:
							R = changeRoomClass(R, "IndoorWaterSurface");
							break;
						case 8:
							R = changeRoomClass(R, "IceRoom");
							break;
						case 9:
							R = changeRoomClass(R, "IndoorInTheAir");
							break;
						case 10:
							R = changeRoomClass(R, "HotRoom");
							break;
						case 11:
							R = changeRoomClass(R, "IceRoom");
							break;
						case 12:
							R = changeRoomClass(R, "IceRoom");
							break;
						}
						switch(sectorType)
						{
						case 0:
						case 1:
						case 2:
						case 3:
						case 4:
						case 5:
						case 10:
						case 11:
						case 12:
							if((R.displayText().toUpperCase().indexOf("CAVE")>=0)
							||(R.description().toUpperCase().indexOf("CAVE")>=0))
								R=changeRoomClass(R,"CaveRoom");
							break;
						}
	
					}
	
					R=applyRoomCodeBits(R,lastRoom,petShops,codeBits,circleFormat);
	
					roomV.add(0,R.roomID());
					newRooms.add(R);
					if(plainRoomID.startsWith("#"))
					{
						while(plainRoomID.startsWith("#0")&&(plainRoomID.length()>2))
							plainRoomID="#"+plainRoomID.substring(2);
						doneRooms.put(areaName+plainRoomID,R);
						areaRooms.put(areaName+plainRoomID,R);
					}
					else
					{
						if(CMSecurity.isDebugging(CMSecurity.DbgFlag.IMPORT))
							Log.debugOut("Non-# room ID: "+plainRoomID);
						while(plainRoomID.startsWith("0")&&(plainRoomID.length()>1))
							plainRoomID=plainRoomID.substring(1);
						doneRooms.put(areaName+"#"+plainRoomID,R);
						areaRooms.put(areaName+"#"+plainRoomID,R);
					}
	
					lastRoom=R;
				}
	
				//if(CMSecurity.isDebugging(CMSecurity.DbgFlag.IMPORT)) Log.debugOut("IMPORT","Pass 2: exits, mobs, object");
	
				// begin second pass through rooms
				// handle exits, mobs, objects, etc.
				for(int r=0;r<roomData.size();r++)
				{
					List<String> roomV=null;
					if(roomData.get(r) instanceof List)
						roomV=(List)roomData.get(r);
					else
						continue;
					final String roomID=eatLine(roomV);
					Room R=getRoom(areaRooms,doneRooms,areaName,roomID);
					if(R==null)
					{
						Log.errOut("Import","Unhashed room "+roomID+"! Aborting!");
						return false;
					}
	
					// handle exits, and 'E' tags
					while(roomV.size()>0)
					{
						String nextLine=eatNextLine(roomV);
						if(nextLine.toUpperCase().startsWith("S"))
							continue;
						else
						if(nextLine.toUpperCase().startsWith("E"))
						{
							final String nameString=CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV));
							final String descString=CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV));
							Item I=null;
							if(hasReadableContent(nameString))
							{
								I=CMClass.getBasicItem("GenWallpaper");
								CMLib.flags().setReadable(I,true);
								I.setReadableText(fixReadableContent(descString));
							}
							else
								I=CMClass.getBasicItem("GenWallpaper");
							I.setName(nameString);
							I.setDisplayText("");
							I.setDescription(descString);
							R.addItem(I);
						}
						else
						if(nextLine.toUpperCase().startsWith("D"))
						{
							int dirCode=CMath.s_int(CMParms.getCleanBit(nextLine,0).substring(1).trim());
							final String descStr=CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV));
							final String nameStr=CMLib.coffeeFilter().safetyFilter(eatLineSquiggle(roomV));
							String codeStr=eatLine(roomV);
							if(codeStr.equalsIgnoreCase("~"))
								codeStr=eatLine(roomV);
							if(dirCode<Directions.NUM_DIRECTIONS())
							switch(dirCode)
							{
							case 0:
								dirCode = Directions.NORTH;
								break;
							case 1:
								dirCode = Directions.EAST;
								break;
							case 2:
								dirCode = Directions.SOUTH;
								break;
							case 3:
								dirCode = Directions.WEST;
								break;
							case 4:
								dirCode = Directions.UP;
								break;
							case 5:
								dirCode = Directions.DOWN;
								break;
							case 6:
								dirCode = Directions.NORTHWEST;
								break;
							case 7:
								dirCode = Directions.NORTHEAST;
								break;
							case 8:
								dirCode = Directions.SOUTHWEST;
								break;
							case 9:
								dirCode = Directions.SOUTHEAST;
								break;
							case 10:
								dirCode = Directions.GATE;
								break;
							default:
								for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
									if(R.rawDoors()[d]==null)
									{
										dirCode=d;
										break;
									}
								break;
							}
							else
							if((dirCode==10)&&(Directions.NUM_DIRECTIONS()<10))
								dirCode=Directions.GATE;
							else
							for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
								if(R.rawDoors()[d]==null)
								{
									dirCode=d;
									break;
								}
							if((dirCode<0)||(dirCode>=Directions.NUM_DIRECTIONS()))
							{
								returnAnError(session,"Room: "+R.roomID()+", Unknown direction code: "+dirCode+", aborting exit, area="+areaName,compileErrors,commands);
								continue;
							}
							if((R.getRawExit(dirCode)!=null)||(R.rawDoors()[dirCode]!=null))
							{
								returnAnError(session,"Room: "+R.roomID()+", Redundant exit codeStr "+nextLine+"/"+codeStr+", dircode="+dirCode+".  Aborting exit, area="+areaName,compileErrors,commands);
								continue;
							}
							if(codeStr.length()==0)
							{
								final String nextStr=nextLine(roomV);
								if((CMParms.numBits(nextStr)==3)&&(CMath.isInteger(CMParms.getCleanBit(nextStr,0))))
									codeStr=eatLine(roomV);
							}
							if((CMParms.numBits(codeStr)==1)&&(CMath.isInteger(codeStr.trim())))
							{
								final String nextStr=nextLine(roomV);
								if((CMParms.numBits(nextStr)==2)&&(CMath.isInteger(CMParms.getCleanBit(nextStr,0))))
									codeStr+=" "+eatLine(roomV);
							}
							final long exitFlag=getBitMask(codeStr,0) & 31;
							final long doorState=getBitMask(codeStr,1);
							final long linkRoomID=getBitMask(codeStr,2);
							if(CMParms.numBits(codeStr)==11) // wierd circle format
							{ /* all is well */}
							else
							if(CMParms.numBits(codeStr)==4)
							{ /* all is still well -- from the wld format I guess. */ }
							else
							if(CMParms.numBits(codeStr)==5)
							{
								/*TODO:BZ all is still well -- from wierd modified rom. */ 
							}
							else
							if(CMParms.numBits(codeStr)!=3)
							{
								returnAnError(session,"Room: "+R.roomID()+", Malformed exit codeStr "+codeStr+".  Aborting exit, area="+areaName,compileErrors,commands);
								continue;
							}
							final Exit X=CMClass.getExit("GenExit");
							Room linkRoom=getRoom(areaRooms,doneRooms,areaName,""+linkRoomID);
							if(linkRoomID>=0)
							{
								boolean hasDoor=false;
								boolean hasLock=false;
								boolean defaultsClosed=false;
								boolean defaultsLocked=false;
	
								if((exitFlag==1)
								||(exitFlag==6)
								||((exitFlag==3)&&(CMParms.numBits(codeStr)==5)))
								{
									hasDoor=true;
									defaultsClosed=true;
									if(exitFlag==6)
									{
										X.basePhyStats().setLevel(100);
										X.recoverPhyStats();
									}
								}
								if(doorState<0)
									defaultsClosed=false;
								else
								if(doorState>0)
								{
									hasDoor=true;
									defaultsClosed=true;
									if(doorState>1)
									{
										hasLock=true;
										defaultsLocked=true;
										X.setKeyName(areaName+"#"+doorState);
									}
								}
								X.setDoorsNLocks(hasDoor,!defaultsClosed,defaultsClosed,
												 hasLock,defaultsLocked,defaultsLocked);
							}
							X.setDisplayText(descStr);
							String name=CMParms.getCleanBit(nameStr,0).trim();
							if(name.equalsIgnoreCase("SECRET"))
							{
								name="secret door";
								X.basePhyStats().setDisposition(X.basePhyStats().disposition()|PhyStats.IS_HIDDEN);
								X.recoverPhyStats();
							}
	
							if(name.length()>0)
								X.setName(CMLib.english().startWithAorAn(name));
							else
							{
								if(X.hasADoor())
								{
									X.setName(L("a door"));
									name="door";
								}
								else
								{
									X.setName(L("the ground"));
									name="ground";
								}
							}
							X.setExitParams(name,X.closeWord(),X.openWord(),X.Name()+", closed");
							X.setDescription(descStr);
							R.setRawExit(dirCode,X);
							Exit opExit=null;
							if(((linkRoom==null)||(linkRoom.getArea().Name()!=R.getArea().Name()))&&(linkRoomID>=0))
							{
								try
								{
									for(final Enumeration<Room> r2=CMLib.map().rooms();r2.hasMoreElements();)
									{
										Room R2=r2.nextElement();
										if((R2.roomID().endsWith("#"+linkRoomID))&&(R2!=R))
										{
											synchronized(("SYNC"+R2.roomID()).intern())
											{
												R2=CMLib.map().getRoom(R2);
												for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
												{
													final Exit E3=R2.getRawExit(d);
													if((E3!=null)
													&&(E3.temporaryDoorLink().length()>0)
													&&(R.roomID().endsWith(E3.temporaryDoorLink())))
													{
														opExit=E3;
														R2.rawDoors()[d]=R;
													}
												}
												if(opExit==null)
												{
													if((prompt)
													&&(session!=null)
													&&(!session.confirm(L("@x1 links to #@x2. Found @x3. Link?",R.roomID(),""+linkRoomID,R2.roomID()),"Y")))
														continue;
												}
												linkRoom=R2;
												if(opExit!=null)
													opExit.setTemporaryDoorLink("");
												if((!doneRooms.containsValue(linkRoom))&&(!doneRooms.contains(linkRoom)))
													CMLib.database().DBUpdateExits(linkRoom);
											}
											break;
										}
									}
								}catch(final NoSuchElementException e){}
								if(linkRoom==null)
									X.setTemporaryDoorLink("#"+linkRoomID);
								else
									X.setTemporaryDoorLink("");
	
							}
							if((linkRoom==null)&&(R.rawDoors()[dirCode]!=null))
								returnAnError(session,"Room: "+R.roomID()+" re-linked "+CMLib.directions().getDirectionName(dirCode)+"ward to unknown room #"+linkRoomID+", area="+areaName,compileErrors,commands);
							R.rawDoors()[dirCode]=linkRoom;
							if((linkRoom==null)&&(linkRoomID>=0))
							{
								if(multiArea)
									laterLinks.put((R.roomID()+"/"+dirCode),"#"+linkRoomID);
								else
									returnAnError(session,"Room: "+R.roomID()+" links "+CMLib.directions().getDirectionName(dirCode)+"ward to unknown room #"+linkRoomID+", area="+areaName,compileErrors,commands);
							}
						}
						else
						if(nextLine.toUpperCase().startsWith("M"))
						{
							// mana heal rate
							// not important enough to generate an error from
						}
						else
						if(nextLine.toUpperCase().startsWith("R"))
						{
							// R ERROR 700 100~
							// No idea what this is.  Not important enough to generate an error from
						}
						else
						if(nextLine.toUpperCase().startsWith("C"))
						{
							if(!nextLine.endsWith("~"))
								nextLine+= eatLineSquiggle(roomV);
							if(nextLine.startsWith("C "))
								nextLine=nextLine.substring(2).trim();
							if(nextLine.endsWith("~"))
								nextLine=nextLine.substring(0,nextLine.length()-1);
							final long codeBits=getBitMask(nextLine,0);
							R=applyRoomCodeBits(R,lastRoom,petShops,codeBits,true);
						}
						else
						if(nextLine.toUpperCase().startsWith("H"))
						{
							// hit point heal rate
							// not important enough to generate an error from
						}
						else
						if(nextLine.startsWith(">"))
						{
							String scriptStuff="";
							if(!nextLine.substring(1).trim().toUpperCase().startsWith("IN_FILE_PROG"))
							{
								scriptStuff+=nextLine.substring(1).trim()+";";
								nextLine=nextLine(roomV);
								while(nextLine.indexOf('~')<0)
								{
									scriptStuff+=nextLine.trim()+";";
									eatLine(roomV);
									nextLine=nextLine(roomV);
								}
								nextLine=eatLineSquiggle(roomV).trim();
								scriptStuff+=nextLine+"~";
							}
							nextLine=scriptStuff;
							// nothing done with the script. :(
						}
						else
						if(nextLine.toUpperCase().startsWith("O"))
						{
							// ?
							// not important enough to generate an error from
						}
						else
						if(nextLine.startsWith("Rd"))
						{
							// some sort of eos thang
							// not important enough to generate an error from
						}
						else
						if(nextLine.trim().equals("|"))
						{
							// ?
							// not important enough to generate an error from
						}
						else
						if((!nextLine.equalsIgnoreCase("#0"))&&(nextLine.trim().length()>0))
							returnAnError(session,"Unknown room code: "+nextLine+", area="+areaName,compileErrors,commands);
					}
				}
	
				if(session!=null)
					session.print(L("Loading objects.."));
				final Hashtable<String,Container> containerHash=new Hashtable<String,Container>();
				MOB M=null;
				Room R=null;
				for(int nrd=0;nrd<nextResetData.size();nrd++)
					resetData.add(nextResetData.get(nrd));
				nextResetData.clear();
				while(resetData.size()>0)
				{
					if(session!=null)
						session.print(".");
					final String s=eatNextLine(resetData).trim();
					if((s.startsWith("#RE"))||(s.startsWith("*"))||(s.startsWith("S")))
					{
					}
					else
					if(s.startsWith("M "))
					{
						final String mobID=CMParms.getCleanBit(s,2).trim();
						final String roomID=CMParms.getCleanBit(s,4).trim();
						R=getRoom(areaRooms,doneRooms,areaName,roomID);
						if(R==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
								returnAnError(session,"Reset error (no room) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						{
							M=getMOB("#"+mobID,R,session,CMParms.copyFlattenList(mobData),CMParms.copyFlattenList(mobProgData),CMParms.copyFlattenList(specialData),CMParms.copyFlattenList(shopData),areaMOBS,doneMOBS,areaFileName,compileErrors,commands);
							if(M==null)
							{
								if(multiArea)
									nextResetData.add(s);
								else
									returnAnError(session,"Reset error (no mob) on line: "+s+", area="+areaName,compileErrors,commands);
							}
							else
								M.bringToLife(R,true);
						}
					}
					else
					if(s.startsWith("G "))
					{
						if(M==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
								returnAnError(session,"Reset error (no mob) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						{
							final String itemID=CMParms.getCleanBit(s,2).trim();
							final Item I=getItem("#"+itemID,session,areaName,CMParms.copyFlattenList(objectData),CMParms.copyFlattenList(objProgData),areaItems,doneItems,areaRooms,doneRooms,compileErrors,commands);
							if(I==null)
							{
								if(multiArea)
									nextResetData.add(s);
								else
								returnAnError(session,"Reset error (no item) on line: "+s+", area="+areaName,compileErrors,commands);
							}
							else
							{
								I.recoverPhyStats();
								if(M instanceof ShopKeeper)
								{
									if(I.basePhyStats().level()<1)
									{
										I.basePhyStats().setLevel(1);
										I.recoverPhyStats();
									}
									int num=CMath.s_int(CMParms.getCleanBit(s,3).trim());
									if(num<0)
										num=100;
									((ShopKeeper)M).getShop().addStoreInventory(I,num,-1);
									if((I instanceof Light)&&(!((ShopKeeper)M).getShop().doIHaveThisInStock("OilFlask",null)))
										((ShopKeeper)M).getShop().addStoreInventory(CMClass.getBasicItem("OilFlask"),num*2,-1);
									else
									if(((I.ID().equals("GenReadable"))
									||(I instanceof com.planet_ink.coffee_mud.Items.interfaces.RoomMap))
									&&(!((ShopKeeper)M).getShop().doIHaveThisInStock("Parchment",null)))
									{
										((ShopKeeper)M).setWhatIsSoldMask(0);
										((ShopKeeper)M).addSoldType(ShopKeeper.DEAL_INVENTORYONLY);
										((ShopKeeper)M).getShop().addStoreInventory(CMClass.getBasicItem("Parchment"),num,-1);
										final Item journal2=CMClass.getBasicItem("GenJournal");
										journal2.setName(L("the adventurers journal"));
										journal2.setBaseValue(250);
										journal2.recoverPhyStats();
										journal2.text();
										((ShopKeeper)M).getShop().addStoreInventory(journal2,num,-1);
									}
									else
									if(((ShopKeeper)M).isSold(ShopKeeper.DEAL_WEAPONS))
									{
										final Item arrows=CMClass.getBasicItem("GenAmmunition");
										((Ammunition)arrows).setAmmunitionType("arrows");
										arrows.setName(L("a pack of 20 arrows"));
										((Ammunition)arrows).setAmmoRemaining(20);
										arrows.setBaseValue(50);
										arrows.setDescription(L("They are sturdy and wooden, but probably not much use without a bow."));
										arrows.setDisplayText(L("Some arrows have been left here."));
										arrows.recoverPhyStats();
										arrows.text();
										((ShopKeeper)M).getShop().addStoreInventory(arrows,num,-1);
									}
								}
								else
								{
									if(I.basePhyStats().level()<1)
									{
										I.basePhyStats().setLevel(M.basePhyStats().level());
										I.recoverPhyStats();
									}
									M.addItem(I);
								}
								I.recoverPhyStats();
								M.recoverCharStats();
								M.recoverPhyStats();
								M.recoverMaxState();
								M.text();
								if(I instanceof Container)
									containerHash.put(itemID,(Container)I);
							}
						}
					}
					else
					if(s.startsWith("EC "))
					{
						String roomID=CMParms.getCleanBit(s,1).trim();
						final String mobID=CMParms.getCleanBit(s,2).trim();
						final int x=roomID.lastIndexOf('#');
						if(x>=0)
							roomID=roomID.substring(x);
						final Room R2=getRoom(areaRooms,doneRooms,areaName,roomID);
						MOB M2=null;
						if(R2!=null)
							M2=R2.fetchInhabitant(mobID);
						if((R2==null)||(M2==null))
						{
							if(multiArea)
								nextResetData.add(s);
							else
								returnAnError(session,"Reset error (no mob) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						{
							final String itemID=CMParms.getCleanBit(s,5).trim();
							final Item I=getItem("#"+itemID,session,areaName,CMParms.copyFlattenList(objectData),CMParms.copyFlattenList(objProgData),areaItems,doneItems,areaRooms,doneRooms,compileErrors,commands);
							if(I==null)
							{
								if(multiArea)
									nextResetData.add(s);
								else
									returnAnError(session,"Reset error (no item) on line: "+s+", area="+areaName,compileErrors,commands);
							}
							else
							{
								if(I.basePhyStats().level()<1)
									I.basePhyStats().setLevel(M2.basePhyStats().level());
								M2.addItem(I);
								I.wearIfPossible(M2);
								I.recoverPhyStats();
								M2.recoverCharStats();
								M2.recoverPhyStats();
								M2.recoverMaxState();
								M2.text();
								if(I instanceof Container)
									containerHash.put(itemID,(Container)I);
							}
						}
					}
					else
					if(s.startsWith("E "))
					{
						if(M==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no mob) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						{
							final String itemID=CMParms.getCleanBit(s,2).trim();
							final Item I=getItem("#"+itemID,session,areaName,CMParms.copyFlattenList(objectData),CMParms.copyFlattenList(objProgData),areaItems,doneItems,areaRooms,doneRooms,compileErrors,commands);
							if(I==null)
							{
								if(multiArea)
								{
									if(M.location()!=null)
										nextResetData.add("EC '"+M.location().roomID()+"' '"+M.Name()+"' "+s);
									else
										nextResetData.add(s);
								}
								else
									returnAnError(session,"Reset error (no item) on line: "+s+", area="+areaName,compileErrors,commands);
							}
							else
							{
								if(I.basePhyStats().level()<1)
									I.basePhyStats().setLevel(M.basePhyStats().level());
								M.addItem(I);
								I.wearIfPossible(M);
								I.recoverPhyStats();
								M.recoverCharStats();
								M.recoverPhyStats();
								M.recoverMaxState();
								M.text();
								if(I instanceof Container)
									containerHash.put(itemID,(Container)I);
							}
						}
					}
					else
					if(s.startsWith("O "))
					{
						final String itemID=CMParms.getCleanBit(s,2).trim();
						final String roomID=CMParms.getCleanBit(s,4).trim();
						R=getRoom(areaRooms,doneRooms,areaName,roomID);
						if(R==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no room) on line: "+s+"/"+roomID+"/"+roomID.length()+", area="+areaName,compileErrors,commands);
						}
						else
						{
							final Item I=getItem("#"+itemID,session,areaName,CMParms.copyFlattenList(objectData),CMParms.copyFlattenList(objProgData),areaItems,doneItems,areaRooms,doneRooms,compileErrors,commands);
							if(I==null)
							{
								if(multiArea)
									nextResetData.add(s);
								else
								returnAnError(session,"Reset error (no item) on line: "+s+", area="+areaName,compileErrors,commands);
							}
							else
							{
								if(I.basePhyStats().level()<1)
									I.basePhyStats().setLevel(1);
								R.addItem(I);
								if(CMLib.flags().isGettable(I))
								{
									final int rejuv=(int)Math.round(CMath.div((long)60000,CMProps.getTickMillis())*4.0);
									I.basePhyStats().setRejuv(rejuv*I.basePhyStats().level());
								}
								I.recoverPhyStats();
								if(I instanceof Container)
								{
									containerHash.remove(itemID);
									containerHash.put(itemID,(Container)I);
								}
							}
						}
					}
					else
					if(s.startsWith("P "))
					{
						final String itemID=CMParms.getCleanBit(s,2).trim();
						final String containerID=CMParms.getCleanBit(s,4).trim();
						final Item I=getItem("#"+itemID,session,areaName,CMParms.copyFlattenList(objectData),CMParms.copyFlattenList(objProgData),areaItems,doneItems,areaRooms,doneRooms,compileErrors,commands);
						final Container C=containerHash.get(containerID);
						if(I==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no item) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						if(C==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no container) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						if(C.owner()==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no container owner) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						if(C.owner() instanceof Room)
						{
							final Room RR=(Room)C.owner();
							if(I.basePhyStats().level()<1)
								I.basePhyStats().setLevel(1);
							RR.addItem(I);
							I.setContainer(C);
							if(CMLib.flags().isGettable(I))
								I.basePhyStats().setRejuv(1000);
							I.recoverPhyStats();
							if(I instanceof Container)
								containerHash.put(itemID,(Container)I);
						}
						else
						if(C.owner() instanceof MOB)
						{
							final MOB MM=(MOB)C.owner();
							if(I.basePhyStats().level()<1)
								I.basePhyStats().setLevel(MM.basePhyStats().level());
							MM.addItem(I);
							I.setContainer(C);
							MM.text();
							I.recoverPhyStats();
							if(I instanceof Container)
								containerHash.put(itemID,(Container)I);
						}
					}
					else
					if(s.startsWith("D "))
					{
						final String roomID=CMParms.getCleanBit(s,2).trim();
						int dirCode=(int)getBitMask(s,3);
						R=getRoom(areaRooms,doneRooms,areaName,roomID);
						if(R==null)
						{
							if(multiArea)
								nextResetData.add(s);
							else
							returnAnError(session,"Reset error (no room) on line: "+s+", area="+areaName,compileErrors,commands);
						}
						else
						{
							switch(dirCode)
							{
							case 0:
								dirCode = Directions.NORTH;
								break;
							case 1:
								dirCode = Directions.EAST;
								break;
							case 2:
								dirCode = Directions.SOUTH;
								break;
							case 3:
								dirCode = Directions.WEST;
								break;
							case 4:
								dirCode = Directions.UP;
								break;
							case 5:
								dirCode = Directions.DOWN;
								break;
							case 6:
							case 7:
							case 8:
							case 9:
								for (int d = Directions.NUM_DIRECTIONS() - 1; d >= 0; d--)
								{
									if ((R.getRawExit(d) != null) && (!R.getRawExit(d).hasADoor()))
									{
										dirCode = d;
										break;
									}
								}
								break;
							case 10:
								dirCode = Directions.GATE;
								break;
							default:
								returnAnError(session,"Room: "+R.roomID()+", Unknown direction code: "+dirCode+" (not so bad at this point, it was probably aborted earlier, area="+areaName,compileErrors,commands);
							}
							if(dirCode<Directions.NUM_DIRECTIONS())
							{
								final Exit E=R.getRawExit(dirCode);
								if(E==null)
									returnAnError(session,"Room: "+R.roomID()+", Unknown exit in dir: "+dirCode+" very confusing!, area="+areaName,compileErrors,commands);
								else
								{
									final int lockBit=(int)getBitMask(s,4);
									boolean HasDoor=E.hasADoor();
									final boolean HasLock=E.hasALock();
									boolean DefaultsClosed=E.defaultsClosed();
									boolean DefaultsLocked=E.defaultsLocked();
									boolean Open=E.isOpen();
									boolean Locked=E.isLocked();
									switch(lockBit)
									{
									case 0:
										HasDoor=true;
										Locked=false;
										DefaultsLocked=false;
										Open=true;
										DefaultsClosed=false;
										break;
									case 1:
										HasDoor=true;
										Locked=false;
										DefaultsLocked=false;
										Open=false;
										DefaultsClosed=true;
										break;
									case 2:
										HasDoor=true;
										Locked=true;
										DefaultsLocked=true;
										Open=false;
										DefaultsClosed=true;
										break;
									default:
										returnAnError(session,"Room: "+R.roomID()+", Unknown door code: "+lockBit+", area="+areaName,compileErrors,commands);
										break;
									}
									E.setDoorsNLocks(HasDoor,Open,DefaultsClosed,HasLock,Locked,DefaultsLocked);
									if(E.hasADoor()&&E.name().equals("the ground"))
									{
										E.setName(L("a door"));
										E.setExitParams("door","close","open","a door, closed.");
									}
								}
							}
						}
					}
					else
					if(s.startsWith("R "))
					{
						// have no idea what this is, but its not important.
					}
					else
					if(s.startsWith("*"))
					{
						// usually a comment of some sort
					}
					else
					if(s.length()>0)
						returnAnError(session,"Reset, unknown command: "+s+", area="+areaName,compileErrors,commands);
	
				}
				// now fix the pet shops!
				for(final Enumeration<Room> e=petShops.keys();e.hasMoreElements();)
				{
					final Room storeRoom=e.nextElement();
					final Room shopRoom=petShops.get(storeRoom);
					ShopKeeper shopKeeper=null;
					if(shopRoom==null)
						returnAnError(session,"Unknown store room: "+storeRoom.roomID()+", area="+areaName,compileErrors,commands);
					else
					for(int i=0;i<shopRoom.numInhabitants();i++)
					{
						final MOB sk=shopRoom.fetchInhabitant(i);
						if((sk!=null)&&(sk instanceof ShopKeeper))
						{ shopKeeper=(ShopKeeper)sk; break;	}
					}
					if(shopKeeper==null)
						returnAnError(session,"Unknown shopkeeper not in room: "+storeRoom.roomID()+", area="+areaName,compileErrors,commands);
					else
					while(storeRoom.numInhabitants()>0)
					{
						shopKeeper.setWhatIsSoldMask(0);
						shopKeeper.addSoldType(ShopKeeper.DEAL_PETS);
						final MOB pet=storeRoom.fetchInhabitant(0);
						if(pet!=null)
						{
							shopKeeper.getShop().addStoreInventory(pet,20,-1);
							pet.setFollowing(null);
							pet.destroy();
						}
					}
				}
				// now fix the smurfy wells
				for(int r=0;r<newRooms.size();r++)
				{
					final Room smurfRoom=newRooms.get(r);
					for(int ei=0;ei<smurfRoom.numItems();ei++)
					{
						final Item lookItem=smurfRoom.getItem(ei);
						if((lookItem!=null)&&(lookItem.displayText().length()==0))
						{
							for(int i=0;i<smurfRoom.numItems();i++)
							{
								final Item I=smurfRoom.getItem(i);
								if((I!=null)
								&&(I.displayText().length()>0)
								&&(I.displayText().indexOf(lookItem.Name())>=0))
								{
									final String description=lookItem.description();
									smurfRoom.delItem(lookItem);
	
									final Item testItem=CMClass.getItem(I.ID());
									if((testItem!=null)&&(testItem.description().equals(I.description())))
										I.setDescription(description);
									else
										I.setDescription(L("@x1%0D@x2",I.description(),description));
									ei=ei-1;
									break;
								}
							}
						}
					}
				}
				if(session!=null)
					session.print(L("\n\rResets..."));
	
				processRoomRelinks(reLinkTable,areaName,areaRooms,doneRooms);
	
				if(newRooms.size()==0)
				{
					if(session!=null)
						session.println(L("\nDone? No Room!\n\r"));
				}
				else
				if(!multiArea)
				{
					if(session!=null)
						session.println(L("\nDone!!!!!!  A good room to look at would be @x1\n\r",newRooms.get(0).roomID()));
				}
				else
				{
					if(session!=null)
						session.println(L("Done!!!\n\r"));
				}
			}
			catch(final Exception e)
			{
				Log.errOut("Import",e);
				return returnAnError(session,e.getMessage(),compileErrors,commands);
			}
		}

		if(nextResetData.size()>0)
		{
			final StringBuffer nrf=new StringBuffer("Import bad resets:\n\r");
			for(int nrd=0;nrd<nextResetData.size();nrd++)
				nrf.append(nextResetData.get(nrd)+"\n\r");
			returnAnError(session,nrf.toString(),compileErrors,commands);
			Log.errOut("Import",nrf.toString());
		}

		if((doneRooms.size()>0)&&(session!=null))
			session.print(L("\n\nSaving all areas imported..."));
		for(final Enumeration<Room> e=doneRooms.elements();e.hasMoreElements();)
		{
			final Room saveRoom=e.nextElement();
			CMLib.database().DBCreateRoom(saveRoom);
			// final exit clean-up optimization
			for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
			{
				final Exit X=saveRoom.getRawExit(d);
				if((X!=null)
				&&(X.isGeneric())
				&&(!X.hasADoor())
				&&(!X.hasALock())
				&&(X.name().equalsIgnoreCase("the ground"))
				&&(!X.isReadable())
				&&(X.numEffects()==0)
				&&(X.numBehaviors()==0)
				&&(X.temporaryDoorLink().length()==0)
				&&(X.displayText().equals(X.description())))
				{
					final Exit E2=CMClass.getExit("OpenDescriptable");
					E2.setMiscText(X.displayText());
					saveRoom.setRawExit(d,E2);
				}
			}
			CMLib.threads().clearDebri(saveRoom,0);
			CMLib.database().DBUpdateExits(saveRoom);
			CMLib.database().DBUpdateMOBs(saveRoom);
			CMLib.database().DBUpdateItems(saveRoom);
			saveRoom.startItemRejuv();
			saveRoom.recoverRoomStats();
			if(session!=null)
				session.print(".");
		}
		if(session!=null)
			session.println("!");

		if(laterLinks.size()>0)
		{
			for(final Enumeration<String> e=laterLinks.keys();e.hasMoreElements();)
			{
				final String key=e.nextElement();
				final String dcode=laterLinks.get(key);
				String roomID="";
				String dirID="";
				final int x=key.lastIndexOf('/');
				if(x>=0)
				{
					roomID=key.substring(0,x);
					dirID=key.substring(x+1);
				}
				else
					continue;

				Room R1=getRoom(doneRooms,doneRooms,"NOAREA",roomID);
				if(R1!=null)
				{
					final int dir=CMath.s_int(dirID);
					Room RR=null;
					Exit RE=null;
					if(dir<Directions.NUM_DIRECTIONS())
					{
						RR=R1.rawDoors()[dir];
						RE=R1.getRawExit(dir);
					}
					final Room TR=getRoom(doneRooms,doneRooms,"NOAREA",dcode);
					if((RR==null)&&(TR==null))
						returnAnError(session,"Room "+R1.roomID()+" links to unknown room "+dcode+" in direction "+CMLib.directions().getDirectionName(dir)+".",compileErrors,commands);
					else
					if(RR==null)
					{
						synchronized(("SYNC"+R1.roomID()).intern())
						{
							R1=CMLib.map().getRoom(R1);
							R1.rawDoors()[dir]=TR;
							if(RE!=null)
								RE.setTemporaryDoorLink("");
							CMLib.database().DBUpdateExits(R1);
						}
					}
				}
			}
		}

		Area A=null;
		for(final Enumeration<Room> e=doneRooms.elements();e.hasMoreElements();)
		{
			A=e.nextElement().getArea();
			A.setAreaState(Area.State.ACTIVE);
		}
		if(doneRooms.elements().hasMoreElements())
		{
			for(final Enumeration<Area> a=CMLib.map().areas();a.hasMoreElements();)
				a.nextElement().fillInAreaRooms();
		}
		if(session!=null)
			session.println(L("done!"));
		return true;
	}