@Override
	@SuppressWarnings("unchecked")
	public String alterHoliday(String oldName, HolidayData newData)
	{
		final TriadList<String,String,Integer> settings=newData.settings();
		final TriadList<String,String,Integer> behaviors=newData.behaviors();
		final TriadList<String,String,Integer> properties=newData.properties();
		final TriadList<String,String,Integer> stats=newData.stats();
		//List stepV=(List)data.elementAt(4);
		final int pricingMobIndex=newData.pricingMobIndex().intValue();

		final int holidayNumber=getHolidayIndex(oldName);
		final Object resp=getHolidayFile();
		if(resp instanceof String)
			return (String)resp;
		List<String> steps=null;
		if(resp instanceof List)
			steps=(List<String>)resp;
		else
			return "Unknown error.";

		String step = null;
		List<String> stepV = null;
		HolidayData encodedData = null;
		final StringBuffer buf=new StringBuffer("");
		for(int v=0;v<steps.size();v++)
		{
			step=steps.get(v);
			if(v==holidayNumber)
			{
				encodedData=getEncodedHolidayData(step);
				final TriadList<String,String,Integer> oldBehaviors=new TriadVector<String,String,Integer>(encodedData.behaviors());
				final TriadList<String,String,Integer> oldProperties=new TriadVector<String,String,Integer>(encodedData.properties());
				stepV=encodedData.stepV();

				int index=startLineIndex(stepV,"SET NAME");
				stepV.set(index,"SET NAME "+settings.get(settings.indexOfFirst("NAME")).second);
				index=startLineIndex(stepV,"SET DURATION");
				stepV.set(index,"SET DURATION "+settings.get(settings.indexOfFirst("DURATION")).second);
				int intervalLine=startLineIndex(stepV,"SET MUDDAY");
				if(intervalLine<0)
					intervalLine=startLineIndex(stepV,"SET DATE");
				if(intervalLine<0)
					intervalLine=startLineIndex(stepV,"SET WAIT");
				final int mudDayIndex=settings.indexOfFirst("MUDDAY");
				final int dateIndex=settings.indexOfFirst("DATE");
				final int waitIndex=settings.indexOfFirst("WAIT");
				if(mudDayIndex>=0)
					stepV.set(intervalLine,"SET MUDDAY "+(settings.get(mudDayIndex).second));
				else
				if(dateIndex>=0)
					stepV.set(intervalLine,"SET DATE "+(settings.get(dateIndex).second));
				else
					stepV.set(intervalLine,"SET WAIT "+(settings.get(waitIndex).second));

				index=settings.indexOfFirst("AREAGROUP");
				if(index>=0)
				{
					index=startLineIndex(stepV,"SET AREAGROUP");
					if(index>=0)
						stepV.set(index,"SET AREAGROUP "+settings.get(settings.indexOfFirst("AREAGROUP")).second);
				}

				index=settings.indexOfFirst("MOBGROUP");
				if(index>=0)
				{
					index=startLineIndex(stepV,"SET MOBGROUP");
					stepV.set(index,"SET MOBGROUP RESELECT MASK="+settings.get(settings.indexOfFirst("MOBGROUP")).second);
				}
				if((pricingMobIndex>0)&&(stats.indexOfFirst("PRICEMASKS")>=0))
				{
					index=startLineIndex(stepV,"GIVE STAT PRICEMASKS");
					final String s=stats.get(stats.indexOfFirst("PRICEMASKS")).second;
					if(s.trim().length()==0)
					{
						if(index>=0)
							stepV.remove(index);
					}
					else
					{
						if(index>=0)
							stepV.set(index,"GIVE STAT PRICEMASKS "+s);
						else
							stepV.add(pricingMobIndex+1,"GIVE STAT PRICEMASKS "+s);
					}
				}
				int mobGroupIndex=startLineIndex(stepV,"SET MOBGROUP");
				index=behaviors.indexOfFirst("AGGRESSIVE");
				if(index>=0)
				{
					index=startLineIndex(stepV,"GIVE BEHAVIOR AGGRESSIVE");
					final String s=behaviors.get(behaviors.indexOfFirst("AGGRESSIVE")).second;
					if(s.trim().length()==0)
					{
						if(index>=0)
							stepV.remove(index);
					}
					else
					{
						if(index>=0)
							stepV.set(index,"GIVE BEHAVIOR AGGRESSIVE "+s);
						else
							stepV.add(mobGroupIndex+1,"GIVE BEHAVIOR AGGRESSIVE "+s);
					}
				}

				mobGroupIndex=startLineIndex(stepV,"SET MOBGROUP");
				index=behaviors.indexOfFirst("MUDCHAT");
				if(index>=0)
				{
					index=startLineIndex(stepV,"GIVE BEHAVIOR MUDCHAT");
					final String s=behaviors.get(behaviors.indexOfFirst("MUDCHAT")).second;
					if(s.trim().length()<2)
					{
						if(index>=0)
							stepV.remove(index);
					}
					else
					{
						if(index>=0)
							stepV.set(index,"GIVE BEHAVIOR MUDCHAT "+s);
						else
							stepV.add(mobGroupIndex+1,"GIVE BEHAVIOR MUDCHAT "+s);
					}
				}

				mobGroupIndex=startLineIndex(stepV,"SET MOBGROUP");
				index=properties.indexOfFirst("MOOD");
				if(index>=0)
				{
					index=startLineIndex(stepV,"GIVE AFFECT MOOD");
					final String s=properties.get(properties.indexOfFirst("MOOD")).second;
					if(s.trim().length()==0)
					{
						if(index>=0)
							stepV.remove(index);
					}
					else
					{
						if(index>=0)
							stepV.set(index,"GIVE AFFECT MOOD "+s);
						else
							stepV.add(mobGroupIndex+1,"GIVE AFFECT MOOD "+s);
					}
				}

				// look for newly missing stuff
				for(int p=0;p<oldProperties.size();p++)
				{
					final String prop=oldProperties.get(p).first;
					if(properties.indexOfFirst(prop)<0)
					{
						index=startLineIndex(stepV,"GIVE AFFECT "+prop);
						if(index>=0)
							stepV.remove(index);
					}
				}
				// look for newly missing stuff
				for(int p=0;p<oldBehaviors.size();p++)
				{
					final String behav=oldBehaviors.get(p).first;
					if(behaviors.indexOfFirst(behav)<0)
					{
						index=startLineIndex(stepV,"GIVE BEHAVIOR "+behav);
						if(index>=0)
							stepV.remove(index);
					}
				}
				// now changed/added stuff
				for(int p=0;p<properties.size();p++)
				{
					final String prop=properties.get(p).first;
					if(prop.equalsIgnoreCase("MOOD"))
						continue;
					mobGroupIndex=startLineIndex(stepV,"SET MOBGROUP");
					index=startLineIndex(stepV,"GIVE AFFECT "+prop);
					if(index>=0)
						stepV.set(index,"GIVE AFFECT "+prop.toUpperCase().trim()+" "+(properties.get(p).second));
					else
						stepV.add(mobGroupIndex+1,"GIVE AFFECT "+prop.toUpperCase().trim()+" "+(properties.get(p).second));
				}
				// now changed/added stuff
				for(int p=0;p<behaviors.size();p++)
				{
					final String behav=behaviors.get(p).first;
					if(behav.equalsIgnoreCase("AGGRESSIVE")||behav.equalsIgnoreCase("MUDCHAT"))
						continue;
					mobGroupIndex=startLineIndex(stepV,"SET MOBGROUP");
					index=startLineIndex(stepV,"GIVE BEHAVIOR "+behav);
					if(index>=0)
						stepV.set(index,"GIVE BEHAVIOR "+behav.toUpperCase().trim()+" "+(behaviors.get(p).second));
					else
						stepV.add(mobGroupIndex+1,"GIVE BEHAVIOR "+behav.toUpperCase().trim()+" "+(behaviors.get(p).second));
				}

				for(int v1=0;v1<stepV.size();v1++)
				{
					if(stepV.get(v1).trim().length()>0)
						buf.append(CMStrings.replaceAll((stepV.get(v1)+"\n\r"),";","\\;"));
				}
				buf.append("\n\r");
			}
			else
				buf.append(step+"\n\r");
		}
		final CMFile F=new CMFile(Resources.makeFileResourceName(holidayFilename),null);
		F.saveText(buf);
		final Quest Q=fetchQuest("holidays");
		if(Q!=null)
			Q.setScript(holidayDefinition,true);
		return "";
	}