Example #1
0
void EyeOfTheStorm::DropFlag2(Player* plr, uint32 id)
{
	if(m_flagHolder != plr->GetLowGUID())
		return;

	switch(id)
	{
		case 4476:			// Blood Elf Tower
			m_dropFlag->SetPosition(LocationVector(2048.83f, 1393.65f, 1194.49f, 0.20944f));
			break;
		case 4514:			// Fel Reaver Tower
			m_dropFlag->SetPosition(LocationVector(2044.28f, 1729.68f, 1189.96f, -0.017453f));
			break;
		case 4518:			// Draenei Tower
			m_dropFlag->SetPosition(LocationVector(2286.56f, 1402.36f, 1197.11f, 3.72381f));
			break;
		case 4516:			// Mage Tower
			m_dropFlag->SetPosition(LocationVector(2284.48f, 1731.23f, 1189.99f, 2.89725f));
			break;
		default:
			m_dropFlag->SetPosition(plr->GetPosition());
			break;
	}

	plr->CastSpell(plr, 42792, true);

	m_dropFlag->SetUInt32Value(GAMEOBJECT_FLAGS, 1);
	m_dropFlag->PushToWorld(m_mapMgr);
	m_flagHolder = 0;
	sEventMgr.AddEvent(this, &EyeOfTheStorm::EventResetFlag, EVENT_EOTS_RESET_FLAG, 10000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
}
Example #2
0
void IsleOfConquest::BuildWorkshopVehicle(uint32 delay)
{
    sEventMgr.RemoveEvents(this, EVENT_IOC_BUILD_WORKSHOP_VEHICLE);

    if (delay != 0)
    {
        sEventMgr.AddEvent(this, &IsleOfConquest::BuildWorkshopVehicle, uint32(0), EVENT_IOC_BUILD_WORKSHOP_VEHICLE, delay, 1, 0);
        return;
    }

    ControlPointTypes state = controlpoint[IOC_CONTROL_POINT_WORKSHOP].state;

    switch (state)
    {
        case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
            workshopvehicle[TEAM_ALLIANCE].baselocation = LocationVector(773.72f, -884.15f, 16.727f, 1.553f);
            workshopvehicle[TEAM_ALLIANCE].c = SpawnCreature(34776, workshopvehicle[TEAM_ALLIANCE].baselocation, 1);
            break;

        case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
            workshopvehicle[TEAM_HORDE].baselocation = LocationVector(773.72f, -884.15f, 16.727f, 1.553f);
            workshopvehicle[TEAM_HORDE].c = SpawnCreature(35069, workshopvehicle[TEAM_HORDE].baselocation, 2);
            break;
    }
}
Example #3
0
LocationVector IsleOfConquest::GetStartingCoords(uint32 Team)
{
        if(Team)                // Horde
                return LocationVector(1264.06f, -736.73f, 48.91f, 3.07f);
        else                    // Alliance
                return LocationVector(303.22f, -857.02f, 48.91f, 5.99f);
}
Example #4
0
LocationVector RuinsOfLordaeron::GetStartingCoords( uint32 Team ){
	if(Team)
		return LocationVector(1277.105103f, 1743.956177f, 31.603209f);
	else
		return LocationVector(1295.322388f, 1585.953369f, 31.605387f);

}
Example #5
0
LocationVector WarsongGulch::GetStartingCoords(uint32 Team)
{
	if(Team)		// Horde
		return LocationVector(933.989685f, 1430.735840f, 345.537140f, 3.141593f);
	else			// Alliance
		return LocationVector(1519.530273f, 1481.868408f, 352.023743f, 3.141593f);
}
Example #6
0
LocationVector CircleOfBlood::GetStartingCoords(uint32 Team)
{
    if (Team)
        return LocationVector(6292.032227f, 287.570343f, 5.003577f);
    else
        return LocationVector(6184.806641f, 236.643463f, 5.037095f);
}
Example #7
0
LocationVector DalaranSewers::GetStartingCoords(uint32 Team)
{
    if (Team)
        return LocationVector(1363.3609f, 817.3569f, 14.8128f);
    else
        return LocationVector(1219.5115f, 765.0264f, 14.8253f);
}
Example #8
0
LocationVector RingOfTrials::GetStartingCoords(uint32 Team)
{
    if (Team)
        return LocationVector(4027.004883f, 2976.964844f, 11.600499f);
    else
        return LocationVector(4085.861328f, 2866.750488f, 12.417445f);
}
Example #9
0
LocationVector ArathiBasin::GetStartingCoords(uint32 Team)
{
	if(Team)
		return LocationVector(684.75629f, 681.945007f, -12.915456f, 0.881211f);
	else
		return LocationVector(1314.932495f, 1311.246948f, -9.00952f, 3.802896f);
}
Example #10
0
LocationVector EyeOfTheStorm::GetStartingCoords(uint32 Team)
{
	return LocationVector(EOTSStartLocations[Team][0],
	                      EOTSStartLocations[Team][1],
	                      EOTSStartLocations[Team][2],
	                      EOTSStartLocations[Team][3]);
}
Example #11
0
bool ChatHandler::HandleTriggerCommand(const char* args, WorldSession* m_session)
{
	if(!args)
	{
		RedSystemMessage(m_session, "No information was provided.");
		return true;
	}
	int32 instance_id;
	uint32 trigger_id;
	int valcount = sscanf(args, "%u %d", (unsigned int*)&trigger_id, (int*)&instance_id);
	if(valcount < 1)
		return false;
	if(valcount == 1)
		instance_id = 0;

	AreaTriggerEntry* entry = dbcAreaTrigger.LookupEntryForced(trigger_id);
	if(trigger_id == 0 || entry == NULL)
	{
		RedSystemMessage(m_session, "Could not find trigger %s", args);
		return true;
	}

	m_session->GetPlayer()->SafeTeleport(entry->mapid, instance_id, LocationVector(entry->x, entry->y,
	                                     entry->z, entry->o));

	BlueSystemMessage(m_session, "Teleported to trigger %u on [%u][%.2f][%.2f][%.2f]", entry->id,
	                  entry->mapid, entry->x, entry->y, entry->z);
	return true;
}
Example #12
0
LocationVector StrandOfTheAncients::GetStartingCoords(uint32 Team)
{
	uint32 sTeam = ( Team == Attackers ? 1 : 0 );
	return LocationVector( SOTAStartLocations[sTeam][0], 
		SOTAStartLocations[sTeam][1],
		SOTAStartLocations[sTeam][2] );
}
Example #13
0
bool GnomishTransporter(uint32 i, Spell *pSpell)
{
	if(!pSpell->p_caster) return true;

	pSpell->p_caster->EventAttackStop();
	pSpell->p_caster->SafeTeleport(1, 0, LocationVector(-7169.41f, -3838.63f, 8.72f));
	return true;
}
Example #14
0
bool ChatHandler::HandleRecallPortPlayerCommand(const char* args, WorldSession * m_session)
{
	char location[255];
	char player[255];
	if(sscanf(args, "%s %s", player, location) != 2)
		return false;

	Player * plr = objmgr.GetPlayer(player, false);
	if(!plr) return false;

	QueryResult *result = WorldDatabase.Query( "SELECT * FROM recall ORDER BY name" );
	if(!result)
		return false;

	do
	{
		Field *fields = result->Fetch();
		const char * locname = fields[1].GetString();
		uint32 locmap = fields[2].GetUInt32();
		float x = fields[3].GetFloat();
		float y = fields[4].GetFloat();
		float z = fields[5].GetFloat();
		float o = fields[6].GetFloat();

		if (strnicmp((char*)location,locname,strlen(args))==0)
		{	//Added Orientation and a rank/invis check for a "ported to" message. --Hemi
			sGMLog.writefromsession( m_session, "ported %s to %s ( Map: %u, X: %f, Y: %f, Z: %f, O: %f )", plr->GetName(), locname, locmap, x, y, z, o );
			if(plr->GetSession() && (plr->GetSession()->CanUseCommand('a') || !m_session->GetPlayer()->m_isGmInvisible))
				plr->GetSession()->SystemMessage("%s teleported you to location %s!", m_session->GetPlayer()->GetName(), locname);

			if(plr->GetInstanceID() != m_session->GetPlayer()->GetInstanceID())
				sEventMgr.AddEvent(plr, &Player::EventSafeTeleport, locmap, uint32(0), LocationVector(x, y, z, o), EVENT_PLAYER_TELEPORT, 1, 1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
			else
				plr->SafeTeleport(locmap, 0, LocationVector(x, y, z, o));
			delete result;
			return true;
		}
	}
	while (result->NextRow());

	delete result;
	return false;
}
Example #15
0
//*NOTE: HORRIBLE bug in GCC 3.x Linux causes a call to cin.seekg() to irreversably corrupt the input stream!
//So I've changed all the cins to use C-style stdin.
bool SimCommand(string &sCommand)
{
	if(fLeftOvers)
	{
		fseek(stdin, 0, SEEK_END);
		fLeftOvers = false;
	}

	cout << "sim> ";
	fflush(NULL);

	//Temporary string storage
	char sTempBuff[MAX_LINE+2];
	char sMessageBuffer[64];
	bool fRetVal = true;

	sTempBuff[MAX_LINE+1] = 1;
	//get a line from the assembly file
	fgets(sTempBuff, MAX_LINE+1, stdin);
	//*NOTE: MSVC's STL version of get() sets the failbit if it gets no characters.
	if(!sTempBuff[0])
		clearerr(stdin);
	fseek(stdin, 0, SEEK_END);

	if(ferror(stdin))
	{
		SimCallBack(Fatal, "Error reading command.");
		clearerr(stdin);
		return false;
	}
	if(feof(stdin))
		clearerr(stdin);
	
	//Check to see if the line was too long
	if(!sTempBuff[MAX_LINE+1])
	{
		sTempBuff[MAX_LINE] = 0;
		sprintf(sMessageBuffer, "Line exceeds %u characters. Excess ignored.", MAX_LINE);
		SimCallBack(Warning, sMessageBuffer);
	}

	//Return the input
	string sTemp = sTempBuff;
	sTemp = sTemp.substr(0, sTemp.find_first_of("\x0A\x0D\x04\xFF"));

	//Check to see if we should run the translator on it
	if(Flags.fOldLC3)
	{
		sCommand = "";
		if(!AsmConvertLC3Line(sTemp, sCommand, LocationVector(), SimMessageCallBack))
			return false;
	}

	return true;
}
Example #16
0
LocationVector StrandOfTheAncient::GetStartingCoords(uint32 team)
{
	/*
	 *	This needs to be flexible, we can't be starting players in the ocean for
	 *	late arrivals. Also Repop locations need to change as the attack progresses.
	 */

	return LocationVector(sotaStartingPosition[team][0],
		sotaStartingPosition[team][1], sotaStartingPosition[team][2],
		sotaStartingPosition[team][3]);
}
Example #17
0
bool ChatHandler::HandleRecallPortPlayerCommand(const char* args, WorldSession * m_session)
{
	char location[255];
	char player[255];
	if(sscanf(args, "%s %s", player, location) != 2)
		return false;

	Player * plr = objmgr.GetPlayer(player, false);
	if(!plr) return false;

	QueryResult *result = WorldDatabase.Query( "SELECT * FROM recall ORDER BY name" );
	if(!result)
		return false;

	do
	{
		Field *fields = result->Fetch();
		const char * locname = fields[1].GetString();
		uint32 locmap = fields[2].GetUInt32();
		float x = fields[3].GetFloat();
		float y = fields[4].GetFloat();
		float z = fields[5].GetFloat();

		if (strnicmp((char*)location,locname,strlen(args))==0)
		{
			sGMLog.writefromsession( m_session, "ported %s to %s ( map: %u, x: %f, y: %f, z: %f )", plr->GetName(), locname, locmap, x, y, z );
			if(plr->GetInstanceID() != m_session->GetPlayer()->GetInstanceID())
				sEventMgr.AddEvent(plr, &Player::EventSafeTeleport, locmap, uint32(0), LocationVector(x, y, z), EVENT_PLAYER_TELEPORT, 1, 1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
			else
				plr->SafeTeleport(locmap, 0, LocationVector(x, y, z));
			delete result;
			return true;
		}

	}while (result->NextRow());

	delete result;
	return false;
}
Example #18
0
	inline LocationVector VMapManager::convertPositionToMangosRep(Vector3 & src) const
	{
		float pos[3];
		pos[0] = src.z;
		pos[1] = src.x;
		pos[2] = src.y;
		double full = 64.0*533.33333333;
		double mid = full/2.0;
		pos[0] = -((mid+pos[0])-full);
		pos[1] = -((mid+pos[1])-full);

		return LocationVector(pos[0], pos[1], pos[2]);
	}
Example #19
0
LocationVector Arena::GetStartingCoords(uint32 Team)
{
	// 559, 562, 572
	/*
	A start
	H start
	Repop
	572 1295.322388 1585.953369 31.605387
	572 1277.105103 1743.956177 31.603209
	572 1286.112061 1668.334961 39.289127

	562 6184.806641 236.643463 5.037095
	562 6292.032227 287.570343 5.003577
	562 6241.171875 261.067322 0.891833

	559 4085.861328 2866.750488 12.417445
	559 4027.004883 2976.964844 11.600499
	559 4057.042725 2918.686523 13.051933
	*/
	switch(m_mapMgr->GetMapId())
	{
		/* loraedeon */
	case 572:
		{
			if(Team)
				return LocationVector(1277.105103f, 1743.956177f, 31.603209f);
			else
				return LocationVector(1295.322388f, 1585.953369f, 31.605387f);
		}break;

		/* blades edge arena */
	case 562:
		{
			if(Team)
				return LocationVector(6292.032227f, 287.570343f, 5.003577f);
			else
				return LocationVector(6184.806641f, 236.643463f, 5.037095f);
		}break;

		/* nagrand arena */
	case 559:
		{
			if(Team)
				return LocationVector(4027.004883f, 2976.964844f, 11.600499f);
			else
				return LocationVector(4085.861328f, 2866.750488f, 12.417445f);
		}break;
	}

	return LocationVector(0,0,0,0);
}
Example #20
0
bool ChatHandler::HandleRecallGoCommand(const char* args, WorldSession *m_session)
{
	if( args == NULL )
		return false;

	if( !*args )
		return false;

	if( m_session == NULL )
		return false;

	QueryResult *result = WorldDatabase.Query( "SELECT * FROM recall ORDER BY name" );

	if( result == NULL)
		return false;

	do
	{
		Field* fields = result->Fetch();
		const char* locname = fields[1].GetString();
		uint32 locmap = fields[2].GetUInt32();
		float x = fields[3].GetFloat();
		float y = fields[4].GetFloat();
		float z = fields[5].GetFloat();

		if( strnicmp( const_cast< char* >( args ), locname, strlen( args ) ) == 0 )
		{
			if( m_session->GetPlayer() != NULL )
			{
				m_session->GetPlayer()->SafeTeleportDelayed( locmap, 0, LocationVector(x, y, z) );
				delete result;
				result = NULL;
				return true;
			}
			else
			{
				delete result;
				result = NULL;
				return false;
			}
		}

	}while (result->NextRow());

	delete result;
	result = NULL;
	return false;
}
Example #21
0
bool ChatHandler::HandleStartCommand(const char* /*args*/, WorldSession* m_session)
{
    Player* pPlayer = getSelectedChar(m_session, false);
    if (!pPlayer)
        return false;

    uint8 raceid = pPlayer->getRace();
    uint8 classid = pPlayer->getClass();

    // find the first matching one
    PlayerCreateInfo* info = objmgr.GetPlayerCreateInfo(raceid, classid);
    if (!info)
    {
        RedSystemMessage(m_session, "Internal error: Could not find create info for race %u and class %u.", raceid, classid);
        return false;
    }

    GreenSystemMessage(m_session, "Teleporting %s to starting location.", pPlayer->GetName());

    if (pPlayer->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ)))
        return true;
    return false;
}
Example #22
0
void Transporter::TeleportTransport(uint32 newMapid, uint32 oldmap, float x, float y, float z)
{
    //sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);

    RemoveFromWorld(false);
    SetMapId(newMapid);
    SetPosition(x, y, z, m_position.o, false);
    AddToWorld();

    WorldPacket packet(SMSG_TRANSFER_PENDING, 12);
    packet << newMapid;
    packet << getEntry();
    packet << oldmap;

    for (auto passengerGuid : m_passengers)
    {
        auto passenger = objmgr.GetPlayer(passengerGuid);
        if (passenger == nullptr)
            continue;

        passenger->GetSession()->SendPacket(&packet);
        bool teleport_successful = passenger->Teleport(LocationVector(x, y, z, passenger->GetOrientation()), this->GetMapMgr());
        if (!teleport_successful)
        {
            passenger->RepopAtGraveyard(passenger->GetPositionX(), passenger->GetPositionY(), passenger->GetPositionZ(), passenger->GetMapId());
        }
        else
        {
            if (!passenger->HasUnitMovementFlag(MOVEFLAG_TRANSPORT))
            {
                passenger->AddUnitMovementFlag(MOVEFLAG_TRANSPORT);
            }
        }
    }

    this->RespawnCreaturePassengers();
}
Example #23
0
bool ChatHandler::HandleTriggerCommand(const char* args, WorldSession* m_session)
{
	int32 instance_id;
	uint32 trigger_id;
	int valcount = sscanf(args, "%u %d", (unsigned int*)&trigger_id, (int*)&instance_id);
	if(!valcount)
		return false;
	if(valcount == 1)
		instance_id = 0;

	AreaTrigger *pTrigger = AreaTriggerStorage.LookupEntry(trigger_id);
	if(trigger_id == 0 || pTrigger == NULL)
	{
		RedSystemMessage(m_session, "Could not find trigger %s", (args == NULL ? "NULL" : args));
		return true;
	}

	m_session->GetPlayer()->SafeTeleport(pTrigger->Mapid, instance_id, LocationVector(pTrigger->x, pTrigger->y,
			pTrigger->z, pTrigger->o));

	BlueSystemMessage(m_session, "Teleported to trigger %u on [%u][%.2f][%.2f][%.2f]", pTrigger->AreaTriggerID,
		pTrigger->Mapid, pTrigger->x, pTrigger->y, pTrigger->z);
	return true;
}
Example #24
0
LocationVector RingOfTrials::GetStartingCoords(uint32 Team){
    return Team == GOLD_TEAM ? LocationVector(4027.004883f, 2976.964844f, 11.600499f) : LocationVector(4085.861328f, 2866.750488f, 12.417445f);
}
Example #25
0
LocationVector Arena::GetStartingCoords(uint32 Team)
{
	return LocationVector(0, 0, 0, 0);
}
Example #26
0
LocationVector RingOfValor::GetStartingCoords( uint32 Team ){
	if(Team)
		return LocationVector(763.6011f, -294.3227f, 28.4f);
	else
		return LocationVector(763.9755f, -274.0825f, 28.4f);
}
Example #27
0
void WorldSession::_HandleAreaTriggerOpcode(uint32 id)
{		
	sLog.outDebug("AreaTrigger: %u", id);

	// Are we REALLY here?
	if( !_player->IsInWorld() )
		return;

    // Search quest log, find any exploration quests
	sQuestMgr.OnPlayerExploreArea(GetPlayer(),id);

	AreaTriggerEntry* entry = dbcAreaTrigger.LookupEntry(id);
	AreaTrigger* pAreaTrigger = AreaTriggerStorage.LookupEntry(id);

	if( entry == NULL )
	{
		sLog.outDebug("Missing AreaTrigger: %u", id);
		return;
	}

	sHookInterface.OnAreaTrigger(GetPlayer(), id);

#ifdef GM_Z_DEBUG_DIRECTLY
	if( _player->GetSession() && _player->GetSession()->CanUseCommand('z') )
		sChatHandler.BlueSystemMessage( this, "[%sSystem%s] |rEntered areatrigger: %s%u. (%s)", MSG_COLOR_WHITE, MSG_COLOR_LIGHTBLUE, MSG_COLOR_SUBWHITE, id, pAreaTrigger ? pAreaTrigger->Name : "Unknown name" );
#endif

	// if in BG handle is triggers
	if( _player->m_bg )
	{
		_player->m_bg->HookOnAreaTrigger(_player, id);
		return;
	}

	// Hook for Scripted Areatriggers
	_player->GetMapMgr()->HookOnAreaTrigger(_player, id);

	if (pAreaTrigger == NULL) return;

	switch(pAreaTrigger->Type)
	{
	case ATTYPE_INSTANCE:
		{
			if(GetPlayer()->GetPlayerStatus() == TRANSFER_PENDING)  //only ports if player is out of pendings
				return;
			if( sWorld.instance_CheckTriggerPrerequsites )
			{
				uint32 reason = CheckTriggerPrerequsites(pAreaTrigger, this, _player, WorldMapInfoStorage.LookupEntry(pAreaTrigger->Mapid));
				if(reason != AREA_TRIGGER_FAILURE_OK)
				{
					const char * pReason = GetPlayer()->GetSession()->LocalizedWorldSrv(AreaTriggerFailureMessages[reason]);
					char msg[200];
					WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 50);
					data << uint32(0);
                    
					switch (reason)
					{
					case AREA_TRIGGER_FAILURE_LEVEL:
						snprintf(msg, 200, pReason, pAreaTrigger->required_level);
						data << msg;
						break;
					case AREA_TRIGGER_FAILURE_NO_ATTUNE_I:
						{
							MapInfo * pMi = WorldMapInfoStorage.LookupEntry(pAreaTrigger->Mapid);
							ItemPrototype * pItem = ItemPrototypeStorage.LookupEntry(pMi->required_item);
							if(pItem)
								snprintf(msg, 200, GetPlayer()->GetSession()->LocalizedWorldSrv(35), pItem->Name1);
							else
								snprintf(msg, 200, GetPlayer()->GetSession()->LocalizedWorldSrv(36));

							data << msg;
						}break;
					case AREA_TRIGGER_FAILURE_NO_ATTUNE_Q:
						{
							MapInfo * pMi = WorldMapInfoStorage.LookupEntry(pAreaTrigger->Mapid);
							Quest * pQuest = QuestStorage.LookupEntry(pMi->required_quest);
							if(pQuest)
								snprintf(msg, 200, GetPlayer()->GetSession()->LocalizedWorldSrv(35), pQuest->title);
							else
								snprintf(msg, 200, GetPlayer()->GetSession()->LocalizedWorldSrv(36));

							data << msg;
						}break;
					default:
						data << pReason;
						break;
					}

					data << uint8(0);
					SendPacket(&data);
					return;
				}
			}
			GetPlayer()->SaveEntryPoint(pAreaTrigger->Mapid);
			GetPlayer()->SafeTeleport(pAreaTrigger->Mapid, 0, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
		}break;
	case ATTYPE_QUESTTRIGGER:
		{

		}break;
	case ATTYPE_INN:
		{
			// Inn
			if (!GetPlayer()->m_isResting) GetPlayer()->ApplyPlayerRestState(true);
		}break;
	case ATTYPE_TELEPORT:
		{
			if(GetPlayer()->GetPlayerStatus() != TRANSFER_PENDING) //only ports if player is out of pendings
			{
				GetPlayer()->SaveEntryPoint(pAreaTrigger->Mapid);
				GetPlayer()->SafeTeleport(pAreaTrigger->Mapid, 0, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
			}
		}break;
	default:break;
	}
}
Example #28
0
bool ChatHandler::HandleStartCommand(const char* args, WorldSession *m_session)
{
	Player* m_plyr = TO_PLAYER(getSelectedChar(m_session, false));
	if( m_plyr == NULL)
		return false;

	uint32 raceid = m_plyr->getRace();
	uint32 classid = m_plyr->getClass();
	std::string argument = args;

	//No arguments given, get race from selected player
	if(m_plyr && args && strlen(args) < 2)
	{
		switch (raceid)
		{
			case 1: argument = "human";		break;
			case 2:	argument = "orc";		break;
			case 3:	argument = "dwarf";		break;
			case 4:	argument = "nightelf";	break;
			case 5:	argument = "undead";	break;
			case 6:	argument = "tauren";	break;
			case 7: argument = "gnome";		break;
			case 8:	argument = "troll";		break;
			case 10:argument = "bloodelf";	break;
			case 11:argument = "draenei";	break;
			default:
			{
				RedSystemMessage(m_session, "Could not extract race from slected character.");
				return true;
			}

		}
	}
	//Optional argument
	else if(m_plyr && args && strlen(args) > 2)
	{
		ASCENT_TOLOWER(argument);

		// Teleport to specific race
		if(argument == "human")				raceid = 1;
		else if(argument == "orc")			raceid = 2;
		else if(argument == "dwarf")		raceid = 3;
		else if(argument == "nightelf")		raceid = 4;
		else if(argument == "undead")		raceid = 5;
		else if(argument == "tauren")		raceid = 6;
		else if(argument == "gnome")		raceid = 7;
		else if(argument == "troll")		raceid = 8;
		else if(argument == "bloodelf")		raceid = 10;
		else if(argument == "draenei")		raceid = 11;
		else if(argument == "deathknight")	classid = 6;
		else
		{
			RedSystemMessage(m_session, "Invalid start location! Valid locations are: human, dwarf, gnome, nightelf, draenei, orc, troll, tauren, undead, bloodelf");
			return true;
		}
	}
	else
		return false;

	//GetPlayerCreateInfo
	PlayerCreateInfo *info = NULL;
	info = objmgr.GetPlayerCreateInfo(raceid, classid);
	if(info == NULL)
	{
		RedSystemMessage(m_session, "Internal error: Could not find create info.");
			return true;
	}


	GreenSystemMessage(m_session, "Telporting %s to %s starting location.", m_plyr->GetName(), argument.c_str());

	m_session->GetPlayer()->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ));
	return true;
}
Example #29
0
bool ChatHandler::HandleStartCommand(const char* args, WorldSession *m_session)
{
	std::string race;
	uint32 raceid = 0;

	GET_PLAYER(RANK_COADMIN);

	PVP_CHECK(RANK_ADMIN);

	if (plr && args && strlen(args) < 2)
	{
		raceid = plr->getRace();
		switch (raceid)
		{
		case 1:
			race = "human";
		break;
		case 2:
			race = "orc";
		break;
		case 3:
			race = "dwarf";
		break;
		case 4:
			race = "nightelf";
		break;
		case 5:
			race = "undead";
		break;
		case 6:
			race = "tauren";
		break;
		case 7:
			race = "gnome";
		break;
		case 8:
			race = "troll";
		break;
		case 10:
			race = "bloodelf";
		break;
		case 11:
			race = "draenei";
		break;
		default:
			return false;
		break;
		}
	}
	else if (plr && args && strlen(args) > 2)
	{
		race = args;
		arcemu_TOLOWER(race);

		// Teleport to specific race
		if(race == "human")
			raceid = 1;
		else if(race == "orc")
			raceid = 2;
		else if(race == "dwarf")
			raceid = 3;
		else if(race == "nightelf")
			raceid = 4;
		else if(race == "undead")
			raceid = 5;
		else if(race == "tauren")
			raceid = 6;
		else if(race == "gnome")
			raceid = 7;
		else if(race == "troll")
			raceid = 8;
		else if(race == "bloodelf")
			raceid = 10;
		else if(race == "draenei")
			raceid = 11;
		else
		{
			RedSystemMessage(m_session, "Invalid start location! Valid locations are: human, dwarf, gnome, nightelf, draenei, orc, troll, tauren, undead, bloodelf");
			return true;
		}
	}
	else
	{
		return false;
	}

	// Try to find a class that works
	PlayerCreateInfo *info = NULL;
	for(uint32 i=1;i<11;i++)
	{
		 info = objmgr.GetPlayerCreateInfo(static_cast<uint8>( raceid ), static_cast<uint8>( i ));
		 if(info != NULL) break;
	}

	if(info == NULL)
	{
		RedSystemMessage(m_session, "Internal error: Could not find create info.");
		return false;
	}


	GreenSystemMessage(m_session, "Teleporting %s to %s starting location.", plr->GetName(), race.c_str());

	plr->SafeTeleport(info->mapId, 0, LocationVector(info->positionX, info->positionY, info->positionZ));
	return true;
}
Example #30
0
void WorldSession::_HandleAreaTriggerOpcode(uint32 id)
{		
	DEBUG_LOG( "WorldSession","HandleAreaTriggerOpcode: %u", id);

	// Are we REALLY here?
	CHECK_INWORLD_RETURN;

	// Search quest log, find any exploration quests
	sQuestMgr.OnPlayerExploreArea(GetPlayer(),id);

	AreaTrigger* pAreaTrigger = AreaTriggerStorage.LookupEntry( id );

	sHookInterface.OnAreaTrigger(_player, id);
	CALL_INSTANCE_SCRIPT_EVENT( _player->GetMapMgr(), OnAreaTrigger )( _player, id );

	// if in BG handle is triggers
	if( _player->m_bg )
	{
		_player->m_bg->HookOnAreaTrigger(_player, id);
		return;
	}

	// Hook for Scripted Areatriggers
	_player->GetMapMgr()->HookOnAreaTrigger(_player, id);

	if( _player->GetSession()->CanUseCommand('z') )
	{
		if( pAreaTrigger != NULL )
			sChatHandler.BlueSystemMessage( this, "[%sSystem%s] |rEntered areatrigger: %s%u (%s).", MSG_COLOR_WHITE, MSG_COLOR_LIGHTBLUE, MSG_COLOR_SUBWHITE, id, pAreaTrigger->Name );
		else
			sChatHandler.BlueSystemMessage( this, "[%sSystem%s] |rEntered areatrigger: %s%u", MSG_COLOR_WHITE, MSG_COLOR_LIGHTBLUE, MSG_COLOR_SUBWHITE, id);
	}

	if( pAreaTrigger == NULL )
	{
		OUT_DEBUG("Missing AreaTrigger: %u", id);
		return;
	}

	switch(pAreaTrigger->Type)
	{
	case ATTYPE_INSTANCE:
		{
			if(_player->GetPlayerStatus() != TRANSFER_PENDING) //only ports if player is out of pendings
			{
				MapInfo * pMi = WorldMapInfoStorage.LookupEntry(pAreaTrigger->Mapid);
				MapEntry* map = dbcMap.LookupEntry(pAreaTrigger->Mapid);
				if(!pMi)
					return;

				//do we meet the map requirements?
				uint8 reason = CheckTeleportPrerequsites(pAreaTrigger, this, _player, pAreaTrigger->Mapid);
				if(reason != AREA_TRIGGER_FAILURE_OK)
				{
					const char * pReason = AreaTriggerFailureMessages[reason];
					char msg[200];
					WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 50);
					data << uint32(0);

					switch (reason)
					{
					case AREA_TRIGGER_FAILURE_LEVEL:
						{
							snprintf(msg,200,pReason,pAreaTrigger->required_level);
							data << msg;
						}break;
					case AREA_TRIGGER_FAILURE_NO_ATTUNE_I:
						{
							ItemPrototype * pItem = ItemPrototypeStorage.LookupEntry(pMi->required_item);
							snprintf(msg, 200, pReason, pItem ? pItem->Name1 : "UNKNOWN");
							data << msg;
						}break;
					case AREA_TRIGGER_FAILURE_NO_ATTUNE_Q:
						{
							Quest * pQuest = QuestStorage.LookupEntry(pMi->required_quest);
							snprintf(msg, 200, pReason, pQuest ? pQuest->title : "UNKNOWN");

							data << msg;
						}break;
					case AREA_TRIGGER_FAILURE_NO_KEY:
						{
							string temp_msg[2];
							string tmp_msg;
							for(uint32 i = 0; i < 2; ++i) 
							{
								if (pMi->heroic_key[i] && _player->GetItemInterface()->GetItemCount(pMi->heroic_key[i], false)==0)
								{
									ItemPrototype * pKey = ItemPrototypeStorage.LookupEntry(pMi->heroic_key[i]);
									if(pKey)
										temp_msg[i] += pKey->Name1;
									else
										temp_msg[i] += "UNKNOWN";
								}
							}
							tmp_msg += temp_msg[0];
							if(temp_msg[0].size() && temp_msg[1].size())
								tmp_msg += "\" and \"";
							tmp_msg += temp_msg[1];

							snprintf(msg, 200, pReason, tmp_msg.c_str());
							data << msg;
						}break;
					case AREA_TRIGGER_FAILURE_LEVEL_HEROIC:
						{
							snprintf(msg, 200, pReason, pMi->HasFlag(WMI_INSTANCE_XPACK_02) ? 80 : 70);
							data << msg;
						}break;
					default:
						{
							data << pReason;
						}break;
					}

					data << uint8(0);
					SendPacket(&data);
					return;
				}

				if( _player->IsMounted())
					TO_UNIT(_player)->Dismount();

				uint32 InstanceID = 0;
				// Try to find a saved instance and
				// do not handle Hyjal Inn (trigger 4319), since we need a unique mapid when generating our instance_id.

				if( id != 4319 && pMi && ( map->israid() || _player->iRaidType >= MODE_NORMAL_25MEN && pMi->type == INSTANCE_MULTIMODE ) )
				{
					//Do we have a saved instance we should use?
					Instance * in = NULL;
					in = sInstanceMgr.GetSavedInstance( pMi->mapid,_player->GetLowGUID(), _player->iRaidType );
					if( in != NULL  && in->m_instanceId )
					{
						//If we are the first to enter this instance, also set our current group id.
						if( in->m_mapMgr == NULL || (!in->m_mapMgr->HasPlayers() && _player->GetGroupID() != in->m_creatorGroup))
							in->m_creatorGroup =_player->GetGroupID();
						InstanceID = in->m_instanceId;
					}
				}

				//Save our entry point and try to teleport to our instance
				_player->SaveEntryPoint(pAreaTrigger->Mapid);
				_player->SafeTeleport(pAreaTrigger->Mapid, InstanceID, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
			}
		}break;
	case ATTYPE_QUESTTRIGGER:
		{

		}break;
	case ATTYPE_INN:
		{
			if( _player->IsMounted())
				TO_UNIT(_player)->Dismount();

			// Inn
			if (!_player->m_isResting) 
				_player->ApplyPlayerRestState(true);
		}break;
	case ATTYPE_TELEPORT:
		{
			if( _player->GetPlayerStatus() != TRANSFER_PENDING) //only ports if player is out of pendings
			{
				if( _player->IsMounted() )
					TO_UNIT(_player)->Dismount();

				_player->SaveEntryPoint(pAreaTrigger->Mapid);
				_player->SafeTeleport(pAreaTrigger->Mapid, 0, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
			}
		}break;
	default:break;
	}
}