Exemple #1
0
//o---------------------------------------------------------------------------o
//|	Function	-	LoadSpawnRegions()
//|	Programmer	-	UOX3 DevTeam
//o---------------------------------------------------------------------------o
//|	Purpose		-	Loads spawning regions
//o---------------------------------------------------------------------------o
void LoadSpawnRegions( void )
{
	cwmWorldState->spawnRegions.clear();
	UI16 i					= 0;
	for( Script *spnScp = FileLookup->FirstScript( spawn_def ); !FileLookup->FinishedScripts( spawn_def ); spnScp = FileLookup->NextScript( spawn_def ) )
	{
		if( spnScp == NULL )
			continue;
		for( ScriptSection *toScan = spnScp->FirstEntry(); toScan != NULL; toScan = spnScp->NextEntry() )
		{
			if( toScan == NULL )
				continue;
			UString sectionName = spnScp->EntryName();
			if( "REGIONSPAWN" == sectionName.section( " ", 0, 0 ) ) // Is it a region spawn entry?
			{
				i = sectionName.section( " ", 1, 1 ).toUShort();
				if( cwmWorldState->spawnRegions.find( i ) == cwmWorldState->spawnRegions.end() )
				{
					cwmWorldState->spawnRegions[i] = new CSpawnRegion( i );
					cwmWorldState->spawnRegions[i]->Load( toScan );
				}
				else
					Console.Warning( "spawn.dfn has a duplicate REGIONSPAWN entry, Entry Number: %u", i );
			}
		}
	}
}
Exemple #2
0
//o---------------------------------------------------------------------------o
//|	Function	-	LoadSkills()
//|	Programmer	-	UOX3 DevTeam
//o---------------------------------------------------------------------------o
//|	Purpose		-	Load skills
//o---------------------------------------------------------------------------o
void LoadSkills( void )
{

	UString skEntry;
	UString tag, data, UTag;
	UI08 i = 0;
	for( Script *creatScp = FileLookup->FirstScript( skills_def ); !FileLookup->FinishedScripts( skills_def ); creatScp = FileLookup->NextScript( skills_def ) )
	{
		if( creatScp == NULL )
			continue;

		for( ScriptSection *SkillList = creatScp->FirstEntry(); SkillList != NULL; SkillList = creatScp->NextEntry() )
		{
			if( SkillList == NULL )
				continue;

			skEntry = creatScp->EntryName();
			if( skEntry.section( " ", 0, 0 ) == "SKILL" )
			{
				i = skEntry.section( " ", 1, 1 ).toUByte();
				if( i <= INTELLECT )
				{
					cwmWorldState->skill[i].ResetDefaults();
					for( tag = SkillList->First(); !SkillList->AtEnd(); tag = SkillList->Next() )
					{
						UTag = tag.upper();
						data = SkillList->GrabData();
						if( UTag == "STR" )
							cwmWorldState->skill[i].strength = data.toUShort();
						else if( UTag == "DEX" )
							cwmWorldState->skill[i].dexterity = data.toUShort();
						else if( UTag == "INT" )
							cwmWorldState->skill[i].intelligence = data.toUShort();
						else if( UTag == "SKILLPOINT" )
						{
							advance_st tempAdvance;
							data = data.simplifyWhiteSpace();
							tempAdvance.base	= data.section( ",", 0, 0 ).toUShort();
							tempAdvance.success = data.section( ",", 1, 1 ).toUByte();
							tempAdvance.failure = data.section( ",", 2, 2 ).toUByte();
							if( data.sectionCount( "," ) == 3 )
								tempAdvance.amtToGain = data.section( ",", 3, 3 ).toUByte();
							cwmWorldState->skill[i].advancement.push_back( tempAdvance );
						}
						else if( UTag == "MADEWORD" )
							cwmWorldState->skill[i].madeword = data.stripWhiteSpace();
						else if( UTag == "NAME" )
							cwmWorldState->skill[i].name = data.stripWhiteSpace();
						else
							Console.Warning( "Unknown tag in skills.dfn: %s", data.stripWhiteSpace().c_str() );
					}
				}
			}
		}
	}
}
Exemple #3
0
//o---------------------------------------------------------------------------o
//|	Function	-	LoadPlaces()
//|	Programmer	-	UOX3 DevTeam
//o---------------------------------------------------------------------------o
//|	Purpose		-	Load locations.dfn
//o---------------------------------------------------------------------------o
void LoadPlaces( void )
{
	cwmWorldState->goPlaces.clear();
	UString data, UTag, entryName;
	GoPlaces_st *toAdd		= NULL;

	for( Script *locScp = FileLookup->FirstScript( location_def ); !FileLookup->FinishedScripts( location_def ); locScp = FileLookup->NextScript( location_def ) )
	{
		if( locScp == NULL )
			continue;
		for( ScriptSection *toScan = locScp->FirstEntry(); toScan != NULL; toScan = locScp->NextEntry() )
		{
			if( toScan == NULL )
				continue;
			entryName			= locScp->EntryName();
			size_t entryNum		= entryName.section( " ", 1, 1 ).toULong();
			if( entryName.section( " ", 0, 0 ).upper() == "LOCATION" && entryNum )
			{
				if( cwmWorldState->goPlaces.find( entryNum ) != cwmWorldState->goPlaces.end() )
					Console.Warning( "Doubled up entry in Location.dfn (%u)", entryNum );
				toAdd = &cwmWorldState->goPlaces[entryNum];
				if( toAdd != NULL )
				{
					for( UString tag = toScan->First(); !toScan->AtEnd(); tag = toScan->Next() )
					{
						data = toScan->GrabData();
						UTag = tag.upper();
						if( UTag == "X" )
							toAdd->x = data.toShort();
						else if( UTag == "Y" )
							toAdd->y = data.toShort();
						else if( UTag == "Z" )
							toAdd->z = data.toByte();
						else if( UTag == "WORLD" )
							toAdd->worldNum = data.toUByte();
						else if( UTag == "LOCATION" )
						{
							size_t sectionCount = data.sectionCount( "," );
							if( sectionCount == 3 )
							{
								toAdd->x		= data.section( ",", 0, 0 ).toShort();
								toAdd->y		= data.section( ",", 1, 1 ).toShort();
								toAdd->z		= data.section( ",", 2, 2 ).toByte();
								toAdd->worldNum = data.section( ",", 3, 3 ).toUByte();
							}
						}
					}
				}
			}
		}
	}

	FileLookup->Dispose( location_def );
}
Exemple #4
0
//o---------------------------------------------------------------------------o
//|	Function	-	LoadCreatures()
//|	Programmer	-	UOX3 DevTeam
//o---------------------------------------------------------------------------o
//|	Purpose		-	Loads creatures from creatures.dfn
//o---------------------------------------------------------------------------o
void LoadCreatures( void )
{
	UString cEntry;
	UString tag, data, UTag;
	UI16 i = 0;
	for( Script *creatScp = FileLookup->FirstScript( creatures_def ); !FileLookup->FinishedScripts( creatures_def ); creatScp = FileLookup->NextScript( creatures_def ) )
	{
		if( creatScp == NULL )
			continue;

		for( ScriptSection *creatureData = creatScp->FirstEntry(); creatureData != NULL; creatureData = creatScp->NextEntry() )
		{
			if( creatureData == NULL )
				continue;

			cEntry = creatScp->EntryName();
			if( cEntry.section( " ", 0, 0 ) == "CREATURE" )
			{
				i = cEntry.section( " ", 1, 1 ).toUShort();

				for( tag = creatureData->First(); !creatureData->AtEnd(); tag = creatureData->Next() )
				{
					if( tag.empty() )
						continue;
					data = creatureData->GrabData();
					UTag = tag.upper();
					switch( (UTag.data()[0]) )
					{
						case 'A':
							if( UTag == "ANTIBLINK" )
								cwmWorldState->creatures[i].AntiBlink( true );
							else if( UTag == "ANIMAL" )
								cwmWorldState->creatures[i].IsAnimal( true );
							break;
						case 'B':
							if( UTag == "BASESOUND" )
								break;
							break;
						case 'F':
							if( UTag == "FLIES" )
								cwmWorldState->creatures[i].CanFly( true );
							break;
						case 'I':
							if( UTag == "ICON" )
								cwmWorldState->creatures[i].Icon( data.toUShort() );
							break;
						case 'M':
							if( UTag == "MOVEMENT" )
							{
								if( data.upper() == "WATER" )
									cwmWorldState->creatures[i].IsWater( true );
								else if( data.upper() == "BOTH" )
									cwmWorldState->creatures[i].IsAmphibian( true );
								else
								{
									cwmWorldState->creatures[i].IsWater( false );
									cwmWorldState->creatures[i].IsAmphibian( false );
								}
							}
							else if( UTag == "MOUNTID" )
								cwmWorldState->creatures[i].MountID( data.toUShort() );
							break;
						case 'S':
							if( UTag == "SOUNDFLAG" )
								break;
							else if( UTag == "SOUND_IDLE" )
								cwmWorldState->creatures[i].SetSound( SND_IDLE, data.toUShort() );
							else if( UTag == "SOUND_STARTATTACK" )
								cwmWorldState->creatures[i].SetSound( SND_STARTATTACK, data.toUShort() );
							else if( UTag == "SOUND_ATTACK" )
								cwmWorldState->creatures[i].SetSound( SND_ATTACK, data.toUShort() );
							else if( UTag == "SOUND_DEFEND" )
								cwmWorldState->creatures[i].SetSound( SND_DEFEND, data.toUShort() );
							else if( UTag == "SOUND_DIE" )
								cwmWorldState->creatures[i].SetSound( SND_DIE, data.toUShort() );
							break;
					}
				}
			}
		}
	}

	FileLookup->Dispose( creatures_def );
}
Exemple #5
0
//o---------------------------------------------------------------------------o
//|	Function	-	LoadRegions()
//|	Programmer	-	UOX3 DevTeam
//o---------------------------------------------------------------------------o
//|	Purpose		-	Load regions from regions.dfn and townregions from regions.wsc
//o---------------------------------------------------------------------------o
void LoadRegions( void )
{
	cwmWorldState->townRegions.clear();
	std::string regionsFile = cwmWorldState->ServerData()->Directory( CSDDP_SHARED ) + "regions.wsc";
	bool performLoad		= false;
	Script *ourRegions		= NULL;
	if( FileExists( regionsFile ) )
	{
		performLoad = true;
		ourRegions = new Script( regionsFile, NUM_DEFS, false );
	}

	UI08 i = 0;
	UString regEntry;
	for( Script *regScp = FileLookup->FirstScript( regions_def ); !FileLookup->FinishedScripts( regions_def ); regScp = FileLookup->NextScript( regions_def ) )
	{
		if( regScp == NULL )
			continue;

		for( ScriptSection *toScan = regScp->FirstEntry(); toScan != NULL; toScan = regScp->NextEntry() )
		{
			if( toScan == NULL )
				continue;

			regEntry = regScp->EntryName();
			if( regEntry.section( " ", 0, 0 ) == "REGION" )
			{
				i = regEntry.section( " ", 1, 1 ).toUByte();
				if( cwmWorldState->townRegions.find( i ) == cwmWorldState->townRegions.end() )
				{
					cwmWorldState->townRegions[i] = new CTownRegion( i );
					cwmWorldState->townRegions[i]->InitFromScript( toScan );
					if( performLoad )
						cwmWorldState->townRegions[i]->Load( ourRegions );
				}
				else
					Console.Warning( "regions.dfn has a duplicate REGION entry, Entry Number: %u", i );
			}
		}
	}
	if( performLoad )
	{
		delete ourRegions;
		ourRegions = NULL;
	}
	ScriptSection *InstaLog = FileLookup->FindEntry( "INSTALOG", regions_def );
	if( InstaLog == NULL ) 
		return;
	LogoutLocationEntry toAdd;
	UString data, UTag;
	for( UString tag = InstaLog->First(); !InstaLog->AtEnd(); tag = InstaLog->Next() )
	{
		UTag = tag.upper();
		data	= InstaLog->GrabData();
		if( UTag == "X1" ) 
			toAdd.x1 = data.toShort();
		else if( UTag == "Y1" ) 
			toAdd.y1 = data.toShort();
		else if( UTag == "X2" )
			toAdd.x2 = data.toShort();
		else if( UTag == "Y2" )
		{
			toAdd.y2 = data.toShort();
			cwmWorldState->logoutLocs.push_back( toAdd );
		}
	}
}