cGumpsManager::getInstance()->attachGump( socket, pGump );
socket->send( pGump );
void commandSpawnRegion( cUOSocket *socket, const QString &command, QStringList &args ){	// Spawnregion respawn region_name	// Spawnregion clear   region_name	// Spawnregion fill    region_name	// Spawnregion info    region_name	// region_name can be "all"	if( args.count() == 0 )	{		socket->sysMessage( tr( "Usage: spawnregion <respawn|clear|fill>" ) );		return;	}	QString subCommand = args[0].lower();	// respawn spawnregion	if( subCommand == "respawn" )	{		if( args.count() < 2 )		{			socket->sysMessage( tr( "Usage: spawnregion respawn <region_name>" ) );		} 		else if( args[1].lower() != "all" )		{			cSpawnRegion* spawnRegion = cAllSpawnRegions::getInstance()->region( args[1] );			if( !spawnRegion )			{				socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );			}			else			{				spawnRegion->reSpawn();				socket->sysMessage( tr( "Spawnregion '%1' has respawned" ).arg( args[1] ) );			}		}		else if( args[1].lower() == "all" )		{			cAllSpawnRegions::getInstance()->reSpawn();			socket->sysMessage( tr( "All spawnregions have respawned" ) );		}	}	// clear spawnregions (despawn)	else if( subCommand == "clear" )	{		if( args.count() < 2 )		{			socket->sysMessage( tr( "Usage: spawnregion clear <region_name>" ) );		} 		else if( args[1].lower() != "all" )		{			cSpawnRegion* spawnRegion = cAllSpawnRegions::getInstance()->region( args[1] );			if( !spawnRegion )			{				socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );			}			else			{				spawnRegion->deSpawn();				socket->sysMessage( tr( "Spawnregion '%1' has been cleared" ).arg( args[1] ) );			}		}		else if( args[1].lower() == "all" )		{			cAllSpawnRegions::getInstance()->deSpawn();			socket->sysMessage( tr( "All spawnregions have been cleared" ) );		}	}	// fill spawnregions up (respawnmax)	else if( subCommand == "fill" )	{		if( args.count() < 2 )		{			socket->sysMessage( tr( "Usage: spawnregion fill <region_name>" ) );		}		else if( args[1].lower() != "all" )		{			cSpawnRegion* spawnRegion = cAllSpawnRegions::getInstance()->region( args[1] );			if( !spawnRegion )			{				socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );			}			else			{				spawnRegion->reSpawnToMax();				socket->sysMessage( tr( "Spawnregion '%1' has respawned to maximum" ).arg( args[1] ) );			}		}		else if( args[1].lower() == "all" )		{			cAllSpawnRegions::getInstance()->reSpawnToMax();			socket->sysMessage( tr( "All spawnregions have respawned to maximum" ) );		}	}	// show spawnregion info	else if( subCommand == "info" )	{		if( args.count() < 2 )		{			socket->sysMessage( tr( "Usage: spawnregion info <region_name>" ) );		}		else if( args[1].lower() != "all" )		{			cSpawnRegion* spawnRegion = cAllSpawnRegions::getInstance()->region( args[1] );			if( !spawnRegion )			{				socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );			}			else			{/*				QStringList rectangles = spawnRegion->rectangles();				UINT32 numrects = rectangles.size();				if( numrects > 10 )					numrects = 10;				// Display a gump with this information				cGump* pGump = new cGump();				// Basic .INFO Header				pGump->addResizeGump( 0, 40, 0xA28, 450, 220 + numrects * 20 ); //Background				pGump->addGump( 105, 18, 0x58B ); // Fancy top-bar				pGump->addGump( 182, 0, 0x589 ); // "Button" like gump				pGump->addTilePic( 202, 23, 0x14eb ); // Type of info menu					pGump->addText( 175, 90, tr( "Spawnregion Info" ), 0x530 );				// Give information about the spawnregion				pGump->addText( 50, 120, tr( "Name: %1" ).arg( args[1] ), 0x834 );				pGump->addText( 50, 140, tr( "NPCs: %1 of %2" ).arg( spawnRegion->npcs() ).arg( spawnRegion->maxNpcs() ), 0x834 );				pGump->addText( 50, 160, tr( "Items: %1 of %2" ).arg( spawnRegion->items() ).arg( spawnRegion->maxItems() ), 0x834 );				pGump->addText( 50, 180, tr( "Coordinates: %1" ).arg( rectangles.size() ), 0x834 );							UINT8 i;				for( i = 0; i < numrects; i++ )				{					pGump->addText( 50, 200 + i * 20, tr( "Rectangle %1: %2" ).arg( i+1 ).arg( rectangles[i] ), 0x834 );				}				// OK button				pGump->addButton( 90, 210 + numrects * 20, 0x481, 0x483, 0 ); // Only Exit possible				pGump->addText( 130, 210 + numrects * 20, tr( "Close" ), 0x834 );*/				cSpawnRegionInfoGump* pGump = new cSpawnRegionInfoGump( spawnRegion, 1 );				cGumpsManager::getInstance()->attachGump( socket, pGump );			}		}		else if( args[1].lower() == "all" )		{			// Display a gump with this information			cGump* pGump = new cGump();			// Basic .INFO Header			pGump->addResizeGump( 0, 40, 0xA28, 450, 210 ); //Background			pGump->addGump( 105, 18, 0x58B ); // Fancy top-bar			pGump->addGump( 182, 0, 0x589 ); // "Button" like gump			pGump->addTilePic( 202, 23, 0x14eb ); // Type of info menu				pGump->addText( 160, 90, tr( "Spawnregion Global Info" ), 0x530 );			// Give information about the spawnregions			pGump->addText( 50, 120, tr( "Spawnregions: %1" ).arg( cAllSpawnRegions::getInstance()->size() ), 0x834 );			pGump->addText( 50, 140, tr( "NPCs: %1 of %2" ).arg( cAllSpawnRegions::getInstance()->npcs() ).arg( cAllSpawnRegions::getInstance()->maxNpcs() ), 0x834 );			pGump->addText( 50, 160, tr( "Items: %1 of %2" ).arg( cAllSpawnRegions::getInstance()->items() ).arg( cAllSpawnRegions::getInstance()->maxItems() ), 0x834 );						// OK button			pGump->addButton( 90, 200, 0x481, 0x483, 0 ); // Only Exit possible			pGump->addText( 130, 200, tr( "Close" ), 0x834 );			cGumpsManager::getInstance()->attachGump( socket, pGump );		}	}}