Esempio n. 1
0
void IsleOfConquest::CaptureControlPoint( uint32 id ){
    ControlPointTypes state = controlpoint[ id ].state;

    switch( state ){
        case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
            SpawnControlPoint( id, IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED );
            PlaySoundToAll( SOUND_ALLIANCE_CAPTURE );
            SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The Alliance has taken the %s!", ControlPointNames[ id ] );
            CALL_CAPTURE_EVENT_FOR( this, id );
            break;

        case IOC_SPAWN_TYPE_HORDE_ASSAULT:
            SpawnControlPoint( id, IOC_SPAWN_TYPE_HORDE_CONTROLLED );
            PlaySoundToAll( SOUND_HORDE_CAPTURE );
            SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, 0, "The Horde has taken the %s!", ControlPointNames[ id ] );
            CALL_CAPTURE_EVENT_FOR( this, id );
            break;

        default:
            LOG_ERROR( "IOC control point %u is not in assaulted state, so it cannot be captured.", id );
            return;
            break;
    }

}
Esempio n. 2
0
void IRCSession::HandleLeft(IRCMessage& recvData)
{
	if(recvData.Nick == m_NickTarolo)
		return;

	if(FSelect(KOSZONES) == bekapcsol && FSelectChannel(KOSZONES, recvData.Channel) == bekapcsol)
	{
		string elkoszones;

		switch(rand()%2)
		{
			case 0:
				elkoszones = "Viszlát";
				break;
			case 1:
				elkoszones = "Bye";
				break;
		}

		if(Ora() >= 20)
			SendChatMessage(PRIVMSG, recvData.GetChannel(), "Jóét %s", recvData.GetNick());
		else
			SendChatMessage(PRIVMSG, recvData.GetChannel(), "%s %s", elkoszones.c_str(), recvData.GetNick());
	}
#ifdef _DEBUG_MOD
	else
		Log.Warning("Funkcio", "A %s funkcio nem uzemel!", KOSZONES);
#endif
}
void StrandOfTheAncient::CaptureControlPoint( SOTAControlPoints point ){
	if( point >= NUM_SOTA_CONTROL_POINTS )
		return;

	SOTAControlPoint &cp = controlpoint[ point ];

	if( cp.banner->GetFaction() == 14 )
		return;

	switch( cp.state ){
		case SOTA_CP_STATE_ALLY_CONTROL:
			SpawnControlPoint( point, SOTA_CP_STATE_HORDE_CONTROL );
			PlaySoundToAll( SOUND_HORDE_CAPTURE );
			SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, 0, "The horde has captured the %s!", ControlPointNames[ point ] );
			break;

		case SOTA_CP_STATE_HORDE_CONTROL:
			SpawnControlPoint( point, SOTA_CP_STATE_ALLY_CONTROL );
			PlaySoundToAll( SOUND_ALLIANCE_CAPTURE );
			SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The alliance has captured the %s!", ControlPointNames[ point ] );
			break;
	}

	cp.banner->SetFaction( 14 ); // So they cannot be recaptured as per SOTA rules

	//Spawn workshop demolisher
	switch( point ){
		case SOTA_CONTROL_POINT_EAST_GY:
			demolisher[ SOTA_EAST_WS_DEMOLISHER_INDEX ] = SpawnCreature( 28781, DemolisherLocations[ SOTA_EAST_WS_DEMOLISHER_INDEX ], TeamFactions[ Attackers ] );
			break;
		case SOTA_CONTROL_POINT_WEST_GY:
			demolisher[ SOTA_WEST_WS_DEMOLISHER_INDEX ] = SpawnCreature( 28781, DemolisherLocations[ SOTA_WEST_WS_DEMOLISHER_INDEX ], TeamFactions[ Attackers ] );
			break;
	}
}
Esempio n. 4
0
void WarsongGulch::OnStart()
{
	for(uint32 i = 0; i < 2; ++i) {
		for(set<Player*>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) {
			(*itr)->RemoveAura(BG_PREPARATION);
		}
	}

	/* open the gates */
	for(list<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
	{
		(*itr)->SetUInt32Value(GAMEOBJECT_FLAGS, 64);
		(*itr)->SetByte(GAMEOBJECT_BYTES_1, 0, 0);
	}

	DespawnGates(5000);

	/* add the flags to the world */
	for(int i = 0; i < 2; ++i)
	{
		if( !m_homeFlags[i]->IsInWorld() )
			m_homeFlags[i]->PushToWorld(m_mapMgr);
	}

	SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Alliance's flag is now placed at her base.");
	SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Horde's flag is now placed at her base.");

	/* correct? - burlex */
	PlaySoundToAll(SOUND_BATTLEGROUND_BEGIN);

	m_started = true;
}
Esempio n. 5
0
void WarsongGulch::DropFlag(Player * plr)
{
	if(!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld())
		return;

	/* drop the flag! */
	m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition());
	m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX());
	m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY());
	m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ());
	m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation());
	m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr);
	m_flagHolders[plr->GetTeam()] = 0;
	SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1);
	plr->m_bgHasFlag = false;

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

	sEventMgr.AddEvent( this, &WarsongGulch::ReturnFlag, plr->GetTeam(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );

	if( plr->GetTeam() == 1 )
		SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName() );
	else
		SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName() );
}
Esempio n. 6
0
void WarsongGulch::HookOnFlagDrop(Player* plr)
{
    if (!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld())
        return;

    // drop the flag!
    m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition());
    //    m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX());
    //    m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY());
    //    m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ());
    //    m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation());
    m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr);

    m_flagHolders[plr->GetTeam()] = 0;
    plr->m_bgHasFlag = false;
    plr->RemoveAura(23333 + (plr->GetTeam() * 2));

    SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 1);

    sEventMgr.AddEvent(this, &WarsongGulch::ReturnFlag, plr->GetTeamReal(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);

    PlaySoundToAll(SOUND_FLAG_RETURNED);

    if (plr->IsTeamHorde())
        SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName());
    else
        SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName());
}
Esempio n. 7
0
void CBattleground::EventCountdown()
{
	if(m_countdownStage == 1)
	{
		m_countdownStage = 2;
		SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "One minute until the battle for %s begins!", GetName() );
	}
	else if(m_countdownStage == 2)
	{
		m_countdownStage = 3;
		SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Thirty seconds until the battle for %s begins!", GetName() );
	}
	else if(m_countdownStage == 3)
	if(m_countdownStage==1)
	{
		m_countdownStage = 4;
		SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "Fifteen seconds until the battle for %s begins!", GetName() );
		sEventMgr.ModifyEventTime(this, EVENT_BATTLEGROUND_COUNTDOWN, 15000);
		sEventMgr.ModifyEventTimeLeft(this, EVENT_BATTLEGROUND_COUNTDOWN, 15000);
	}
	else
	{
		SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The battle for %s has begun!", GetName() );
		sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_COUNTDOWN);
		Start();
	}
}
Esempio n. 8
0
void IsleOfConquest::AssaultControlPoint(Player *player, uint32 id)
{
    ControlPointTypes state = controlpoint[id].state;
    uint32 team = player->GetTeam();

    if (state > IOC_SPAWN_TYPE_HORDE_CONTROLLED)
    {
        LOG_ERROR("IOC control point %u is in an invalid state, cannot be assaulted.", id);
        return;
    }

    sEventMgr.RemoveEvents(this, EVENT_IOC_CAPTURE_CP_1 + id);

    switch (state)
    {
        case IOC_SPAWN_TYPE_NEUTRAL:
            if (team == TEAM_ALLIANCE)
                SpawnControlPoint(id, IOC_SPAWN_TYPE_ALLIANCE_ASSAULT);
            else
                SpawnControlPoint(id, IOC_SPAWN_TYPE_HORDE_ASSAULT);
            break;

        case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
        case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
            if (team == TEAM_HORDE)
                SpawnControlPoint(id, IOC_SPAWN_TYPE_HORDE_ASSAULT);
            break;

        case IOC_SPAWN_TYPE_HORDE_ASSAULT:
        case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
            if (team == TEAM_ALLIANCE)
                SpawnControlPoint(id, IOC_SPAWN_TYPE_ALLIANCE_ASSAULT);
            break;
    }

    switch (state)
    {
        case IOC_SPAWN_TYPE_NEUTRAL:
        case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
        case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
            player->m_bgScore.MiscData[BG_SCORE_IOC_BASES_ASSAULTED]++;
            break;

        case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
        case IOC_SPAWN_TYPE_HORDE_ASSAULT:
            player->m_bgScore.MiscData[BG_SCORE_IOC_BASES_DEFENDED]++;
            break;
    }

    if (player->GetTeam() == TEAM_ALLIANCE)
        SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, 0, "%s has assaulted the %s! If it remains uncontested, the alliance will take it within a minute!", player->GetName(), ControlPointNames[id]);
    else
        if (player->GetTeam() == TEAM_HORDE)
            SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, 0, "%s has assaulted the %s! If it remains uncontested, the horde will take it within a minute!", player->GetName(), ControlPointNames[id]);

    sEventMgr.AddEvent(this, &IsleOfConquest::CaptureControlPoint, id, EVENT_IOC_CAPTURE_CP_1 + id, 60 * 1 * 1000, 1, 0);
}
Esempio n. 9
0
void WarsongGulch::HookFlagDrop(Player * plr, GameObject * obj)
{
	/* picking up a dropped flag */
	if(m_dropFlags[plr->GetTeam()] != obj)
	{
		/* are we returning it? */
		if( (obj->GetEntry() == 179785 && plr->GetTeam() == 0) ||
			(obj->GetEntry() == 179786 && plr->GetTeam() == 1) )
		{
			uint32 x = plr->GetTeam() ? 0 : 1;
			sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam());

			if( m_dropFlags[x]->IsInWorld() )
				m_dropFlags[x]->RemoveFromWorld(false);

			if(m_homeFlags[x]->IsInWorld() == false)
				m_homeFlags[x]->PushToWorld(m_mapMgr);

			plr->m_bgScore.Misc2++;
			UpdatePvPData();

			if( plr->GetTeam() == 1 )
				SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was returned to its base by %s!", plr->GetName() );
			else
				SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was returned to its base by %s!", plr->GetName() );

			SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1);
			PlaySoundToAll(plr->GetTeam() ? SOUND_HORDE_RETURNED : SOUND_ALLIANCE_RETURNED);
		}
		return;
	}

	if( plr->GetTeam() == 0 )
		sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG);
	else
		sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + 1);

	if( m_dropFlags[plr->GetTeam()]->IsInWorld() )
		m_dropFlags[plr->GetTeam()]->RemoveFromWorld(false);

	m_flagHolders[plr->GetTeam()] = plr->GetLowGUID();
	plr->m_bgHasFlag = true;

	/* This is *really* strange. Even though the A9 create sent to the client is exactly the same as the first one, if
	 * you spawn and despawn it, then spawn it again it will not show. So we'll assign it a new guid, hopefully that
	 * will work.
	 * - Burlex
	 */
	m_dropFlags[plr->GetTeam()]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
	
	SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2));
	Spell * sp = new Spell(plr, pSp, true, 0);
	SpellCastTargets targets(plr->GetGUID());
	sp->prepare(&targets);
	SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2);
}
Esempio n. 10
0
void WarsongGulch::EventReturnFlags()
{
	for (uint32 x = 0; x < 2; x++)
	{
		if (m_homeFlags[x] != NULL)
			m_homeFlags[x]->PushToWorld(m_mapMgr);
	}
	SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Alliance's flag is now placed at her base.");
	SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Horde's flag is now placed at her base.");
}
Esempio n. 11
0
void WarsongGulch::ReturnFlag(uint32 team)
{
	if (m_dropFlags[team]->IsInWorld())
		m_dropFlags[team]->RemoveFromWorld(false);
	
	if( !m_homeFlags[team]->IsInWorld() )
		m_homeFlags[team]->PushToWorld(m_mapMgr);
	
	if( team )
		SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The Alliance flag was returned to its base!" );
	else
		SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, 0, "The Horde flag was returned to its base!" );
}
Esempio n. 12
0
void WarsongGulch::ReturnFlag(PlayerTeam team)
{
    if (m_dropFlags[team]->IsInWorld())
        m_dropFlags[team]->RemoveFromWorld(false);

    if (!m_homeFlags[team]->IsInWorld())
        m_homeFlags[team]->PushToWorld(m_mapMgr);

    PlaySoundToAll(SOUND_FLAG_RESPAWN);

    if (team)
        SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Alliance flag was returned to its base!");
    else
        SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The Horde flag was returned to its base!");
}
void ArathiBasin::CaptureControlPoint(uint32 Id, uint32 Team)
{
	if(m_basesOwnedBy[Id] != -1)
	{
		// there is a very slim chance of this happening, 2 teams evnets could clash..
		// just in case...
		return;
	}

	// anticheat, not really necessary because this is a server method but anyway
	if(m_basesAssaultedBy[Id] != (int32)Team)
		return;

	
	m_basesLastOwnedBy[Id] = Team;

	m_flagIsVirgin[Id] = false;

	m_basesOwnedBy[Id] = Team;
	m_basesAssaultedBy[Id]=-1;

	// remove the other spirit guide (if it exists) // burlex: shouldnt' happen
	if(m_spiritGuides[Id] != NULL)
	{
		RemoveSpiritGuide(m_spiritGuides[Id]);
		m_spiritGuides[Id]->Despawn(0,0);
	}

	// spawn the spirit guide for our faction
	m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team);
	AddSpiritGuide(m_spiritGuides[Id]);

	// send the chat message/sounds out
	PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES);
	SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]);
	
	// update the overhead display on the clients (world states)
	m_capturedBases[Team]++;
	m_mapMgr->GetStateManager().UpdateWorldState(Team ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Team]);

	// respawn the control point with the correct aura
	SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_CONTROLLED : AB_SPAWN_TYPE_ALLIANCE_CONTROLLED);

	// update the map
	m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team], 0);
	m_mapMgr->GetStateManager().UpdateWorldState(OwnedFields[Id][Team], 1);

	// resource update event. :)
	if(m_capturedBases[Team]==1)
	{
		// first
		sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()),&ArathiBasin::EventUpdateResources, (uint32)Team, EVENT_AB_RESOURCES_UPDATE_TEAM_0+Team, ResourceUpdateIntervals[1], 0,
			EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
	}
	else
	{
		// not first
		event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0+Team, ResourceUpdateIntervals[m_capturedBases[Team]]);
	}
}
Esempio n. 14
0
void IsleOfConquest::ApplyCaptureBonus(uint32 Id, uint32 team) //todo make this loop and apply bonuses that haven't been aplied.
{
	ActiveBonuses[team][Id] = true;
	switch(Id)
	{
		case IOC_CONTROL_POINT_AIRSHIPHANGAR:
		{
			SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "%s's resources now come by air, reinforcement gain time cut in half!", team ? "Horde" : "Alliance");
			sEventMgr.ModifyEventTime(this, EVENT_IOC_RESOURCES_UPDATE_TEAM_0 + team, 30000);
		}break;
		case IOC_CONTROL_POINT_DOCKS:
		{
			SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The %s have broken through the dock blockade! Demolisher's rams have been repaired!", team ? "Horde" : "Alliance");
		}break;
	}
}
Esempio n. 15
0
void WarsongGulch::OnStart()
{
    for (uint8 i = 0; i < 2; ++i)
    {
        for (std::set<Player*>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
        {
            (*itr)->RemoveAura(BG_PREPARATION);
        }
    }

    // open the gates
    for (std::list<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
    {
        (*itr)->SetFlags(GO_FLAG_TRIGGERED);
        (*itr)->SetState(GO_STATE_OPEN);
    }

    DespawnGates(5000);

    // add the flags to the world
    for (uint8 i = 0; i < 2; ++i)
    {
        if (!m_homeFlags[i]->IsInWorld())
            m_homeFlags[i]->PushToWorld(m_mapMgr);
    }

    PlaySoundToAll(SOUND_BATTLEGROUND_BEGIN);
    SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flags are now placed at their bases.");

    sEventMgr.AddEvent(this, &WarsongGulch::TimeLeft, EVENT_UNK, 60000, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);

    m_started = true;
}
Esempio n. 16
0
void ChatSession::OnIncomingTextChannelReady(Tp::PendingOperation* op)
{
    if (op->isError())
    {
        state_ = STATE_ERROR;
        LogError("Incoming text channel cannot become ready state");
        return;
    }
    LogDebug("Incoming text channel ready.");
    Tp::PendingReady *pr = qobject_cast<Tp::PendingReady *>(op);
    Tp::TextChannelPtr channel = Tp::TextChannelPtr(qobject_cast<Tp::TextChannel *>(pr->object()));
    tp_text_channel_ = channel;

    connect(tp_text_channel_.data(),
            SIGNAL( messageReceived(const Tp::ReceivedMessage &) ),
            SLOT( OnMessageReceived(const Tp::ReceivedMessage &) ));

    connect(tp_text_channel_.data(),
            SIGNAL( pendingMessageRemoved(const Tp::ReceivedMessage &) ),
            SLOT( OnChannelPendingMessageRemoved(const Tp::ReceivedMessage &) ));

    //! @HACK and memory leak here. We should have a contact object from Connection object!
    ChatSessionParticipant* p = new ChatSessionParticipant( new Contact(tp_text_channel_->initiatorContact()) );
    participants_.push_back(p);

    HandlePendingMessage();
    state_ = STATE_OPEN;
    emit Ready(this);
    emit Opened(this);
    for (QStringList::iterator i = send_buffer_.begin(); i != send_buffer_.end(); ++i)
        SendChatMessage( *i);
}
void IRCSession::HandleSuccessfulAuth(IRCMessage& recvData)
{
	// We're good to go.
	mConnState = CONN_REGISTERED;
	Log.Notice("IRCSession", "Authentication successful.");
	mServerRealName = recvData.hostmask;

	// Nickserv identification
	if(mUseNickServ)
	{
		Log.Notice("NickServ", "Sending NickServ identification.");
		SendChatMessage( PRIVMSG, "NickServ", "identify %s", mNickServPassword.c_str());
	}

	// Join the default channels
	std::map<string,string>::iterator itr = mChannelList.begin();
	for(; itr != mChannelList.end(); itr++)
	{
		string join = itr->first;
		if(itr->second != "")
			join += " " + itr->second;

		WriteLine("JOIN %s", join.c_str());
	}
}
Esempio n. 18
0
void MessageWnd::MessageEntered() {
    std::string trimmed_text = boost::trim_copy(m_edit->Text());
    if (trimmed_text.empty())
        return;

    m_display_show_time = GG::GUI::GetGUI()->Ticks();

    // update history
    if (m_history.size() == 1 || m_history[1] != trimmed_text) {
        m_history[0] = trimmed_text;
        m_history.push_front("");
    } else {
        m_history[0] = "";
    }
    while (12 < static_cast<int>(m_history.size()) + 1)
        m_history.pop_back();
    m_history_position = 0;

    // if message starts with / treat it as a command
    if (trimmed_text[0] == '/') {
        HandleTextCommand(trimmed_text);
    } else {
        // otherwise, treat message as chat and send to recipients
        std::set<int> recipients;
        if (PlayerListWnd* player_list_wnd = ClientUI::GetClientUI()->GetPlayerListWnd())
            recipients = player_list_wnd->SelectedPlayerIDs();
        SendChatMessage(trimmed_text, recipients);
    }

    m_edit->Clear();
}
Esempio n. 19
0
// Simple messages for the formula guys.
// Use f$chat as "the_MessageIndex".
void RegisterChatMessage(double message_index) {
	int the_chat_index = floor(message_index + 0.1);
  if ((the_chat_index < first_chat_message) || (the_chat_index > last_chat_message)) {
		return;
	}
  char* the_message = _message_table[the_chat_index];
	SendChatMessage(the_message);
}
Esempio n. 20
0
void IsleOfConquest::RemoveCaptureBonus(uint32 Id, uint32 team)
{
	ActiveBonuses[team][Id] = false;
	switch(Id)
	{
		case IOC_CONTROL_POINT_AIRSHIPHANGAR:
		{
			SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "%s's resources no longer come by air, reinforcement gain time is now normal!", team ? "Horde" : "Alliance");
			sEventMgr.ModifyEventTime(this, EVENT_IOC_RESOURCES_UPDATE_TEAM_0 + team, 60000);
		}break;
		case IOC_CONTROL_POINT_DOCKS:
		{
			SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The dock has been blocked by %s demolishers rams no longer function!", team ? "Horde" : "Alliance");
		}break;

	}
}
Esempio n. 21
0
void Server::handleCommand_Password(NetworkPacket* pkt) {
	const auto peer_id = pkt->getPeerId();
	auto & packet = *(pkt->packet);
	auto player = m_env->getPlayer(pkt->getPeerId());
	if (!player) {
		m_con.DisconnectPeer(pkt->getPeerId());
		return;
	}
	std::string oldpwd, newpwd;
	packet[TOSERVER_CHANGE_PASSWORD_OLD].convert(oldpwd);
	packet[TOSERVER_CHANGE_PASSWORD_NEW].convert(newpwd);

	if(!base64_is_valid(newpwd)) {
		infostream << "Server: " << player->getName() << " supplied invalid password hash" << std::endl;
		// Wrong old password supplied!!
		SendChatMessage(peer_id, "Invalid new password hash supplied. Password NOT changed.");
		return;
	}

	infostream << "Server: Client requests a password change from "
	           << "'" << oldpwd << "' to '" << newpwd << "'" << std::endl;

	std::string playername = player->getName();

	std::string checkpwd;
	m_script->getAuth(playername, &checkpwd, NULL);

	if(oldpwd != checkpwd) {
		infostream << "Server: invalid old password" << std::endl;
		// Wrong old password supplied!!
		SendChatMessage(peer_id, "Invalid old password supplied. Password NOT changed.");
		return;
	}

	bool success = m_script->setPassword(playername, newpwd);
	if(success) {
		actionstream << player->getName() << " changes password" << std::endl;
		SendChatMessage(peer_id, "Password change successful.");
	} else {
		actionstream << player->getName() << " tries to change password but "
		             << "it fails" << std::endl;
		SendChatMessage(peer_id, "Password change failed or inavailable.");
	}

}
Esempio n. 22
0
void WarsongGulch::HookFlagStand(Player* plr, GameObject* obj)
{
#ifdef ANTI_CHEAT
    if (!m_started)
    {
        Anticheat_Log->writefromsession(plr->GetSession(), "%s tryed to hook the flag in warsong gluch before battleground (ID %u) started.", plr->GetName(), this->m_id);
        SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, plr->GetGUID(), "%s will be removed from the game for cheating.", plr->GetName());
        // Remove player from battleground.
        this->RemovePlayer(plr, false);
        // Kick player from server.
        plr->Kick(6000);
        return;
    }
#endif
    if (m_flagHolders[plr->GetTeam()] || m_homeFlags[plr->GetTeam()] != obj || m_dropFlags[plr->GetTeam()]->IsInWorld())
    {
        // cheater!
        return;
    }

    std::map<uint32, uint32>::iterator itr = plr->m_forcedReactions.find(1059);
    if (itr != plr->m_forcedReactions.end())
    {
        return;
    }

    SpellInfo* pSp = sSpellCustomizations.GetSpellInfo(23333 + (plr->GetTeam() * 2));
    Spell* sp = sSpellFactoryMgr.NewSpell(plr, pSp, true, 0);
    SpellCastTargets targets(plr->GetGUID());
    sp->prepare(&targets);

    // set the flag holder
    plr->m_bgHasFlag = true;
    m_flagHolders[plr->GetTeam()] = plr->GetLowGUID();
    if (m_homeFlags[plr->GetTeam()]->IsInWorld())
        m_homeFlags[plr->GetTeam()]->RemoveFromWorld(false);

    PlaySoundToAll(plr->IsTeamHorde() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
    SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 2);
    if (plr->IsTeamHorde())
        SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Alliance's flag has been taken by %s !", plr->GetName());
    else
        SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Horde's flag has been taken by %s !", plr->GetName());
}
Esempio n. 23
0
void WarsongGulch::EventReturnFlags()
{
    for (uint8 x = 0; x < 2; x++)
    {
        if (m_homeFlags[x] != NULL)
            m_homeFlags[x]->PushToWorld(m_mapMgr);
    }
    PlaySoundToAll(SOUND_FLAG_RESPAWN);
    SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flags are now placed at their bases.");
}
Esempio n. 24
0
void ChatSession::OnOutgoingTextChannelReady(Tp::PendingOperation* op)
{
    if (op->isError())
    {
        state_ = STATE_ERROR;
        QString message = "Text channel cannot become ready for ChatSession object.";
        LogError(message.toStdString());
        return;
    }
    LogDebug("Outgoing text channel is ready.");

    Tp::PendingReady *pr = qobject_cast<Tp::PendingReady *>(op);
    Tp::TextChannelPtr channel = Tp::TextChannelPtr(qobject_cast<Tp::TextChannel *>(pr->object()));
    tp_text_channel_ = channel;

    QStringList interfaces = tp_text_channel_->interfaces();
    for (QStringList::iterator i = interfaces.begin(); i != interfaces.end(); ++i)
    {
        QString line = "Text channel have interface: ";
        line.append(*i);
        LogDebug(line.toStdString());
    }

//        Tp::ContactPtr initiator = tp_text_channel_->initiatorContact();

    bool have_message_capabilities = tp_text_channel_->isReady(Tp::TextChannel::FeatureMessageCapabilities);
    bool have_message_queue = tp_text_channel_->isReady(Tp::TextChannel::FeatureMessageQueue);
    bool have_message_sent_signal = tp_text_channel_->isReady(Tp::TextChannel::FeatureMessageSentSignal);
    UNREFERENCED_PARAM(have_message_capabilities);
    UNREFERENCED_PARAM(have_message_queue);
    UNREFERENCED_PARAM(have_message_sent_signal);
    //if (!have_message_capabilities)
    //{
    //    LogError("Text channel doesn't have the message capabilities!");
    //    state_ = STATE_ERROR;
    //    return;
    //}

    connect(tp_text_channel_.data(),
            SIGNAL( messageReceived(const Tp::ReceivedMessage &) ),
            SLOT( OnMessageReceived(const Tp::ReceivedMessage &) ));

    connect(tp_text_channel_.data(),
            SIGNAL( pendingMessageRemoved(const Tp::ReceivedMessage &) ),
            SLOT( OnChannelPendingMessageRemoved(const Tp::ReceivedMessage &) ));

    HandlePendingMessage();
    state_ = STATE_OPEN;
    emit Opened(this);
    for (QStringList::iterator i = send_buffer_.begin(); i != send_buffer_.end(); ++i)
    {
        QString text = *i;
        SendChatMessage(text);
    }
}
Esempio n. 25
0
void EyeOfTheStorm::EventResetFlag()
{
	if(!m_dropFlag->IsInWorld())
		return;

	m_dropFlag->RemoveFromWorld(false);
	m_standFlag->PushToWorld(m_mapMgr);

	SetWorldState( 2757, 1 );
	PlaySoundToAll( 8192 );
	SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset." );
	m_flagHolder = 0;
}
Esempio n. 26
0
void EyeOfTheStorm::EventResetFlag()
{
    if(!m_dropFlag->IsInWorld())
        return;

    m_dropFlag->RemoveFromWorld(false);
    m_standFlag->PushToWorld(m_mapMgr);

    m_mapMgr->GetStateManager().UpdateWorldState( WORLDSTATE_EOTS_FLAG_NEUTRAL_DISPLAY, 1 );
    PlaySoundToAll( 8192 );
    SendChatMessage( CHAT_MSG_BG_SYSTEM_NEUTRAL, 0, "The flag has been reset." );
    m_flagHolder = 0;
}
Esempio n. 27
0
bool EyeOfTheStorm::HookSlowLockOpen(GameObject* pGo, Player* pPlayer, Spell* pSpell)
{
	if(m_flagHolder != 0)
		return false;

	m_standFlag->RemoveFromWorld(false);
	pPlayer->CastSpell(pPlayer->GetGUID(), EOTS_NETHERWING_FLAG_SPELL, true);

	SetWorldState(2757, 0);
	PlaySoundToAll(pPlayer->IsTeamHorde() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
	SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE + pPlayer->GetTeam(), pPlayer->GetGUID(), "$N has taken the flag!");
	m_flagHolder = pPlayer->GetLowGUID();
	return true;
}
Esempio n. 28
0
void EyeOfTheStorm::EventResetFlag()
{
	if(!m_dropFlag->IsInWorld())
		return;

	m_dropFlag->RemoveFromWorld(false);
	m_dropFlag->SetUInt32Value(GAMEOBJECT_FLAGS, 0);
	m_standFlag->PushToWorld(m_mapMgr);

	SetWorldState(2757, 1);
	PlaySoundToAll(SOUND_ALLIANCE_RETURNED);
	SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset.");
	m_flagHolder = 0;
}
Esempio n. 29
0
void IsleOfConquest::CaptureControlPoint(uint32 Id, uint32 Team)
{
	if(m_basesOwnedBy[Id] != -1)
	{
		// there is a very slim chance of this happening, 2 teams evnets could clash..
		// just in case...
		return;
	}

	// anticheat, not really necessary because this is a server method but anyway
	if(m_basesAssaultedBy[Id] != (int32)Team)
		return;


	m_basesLastOwnedBy[Id] = Team;

	m_flagIsVirgin[Id] = false;

	m_basesOwnedBy[Id] = Team;
	m_basesAssaultedBy[Id]=-1;

	// remove the other spirit guide (if it exists) // burlex: shouldnt' happen
	if(m_spiritGuides[Id] != NULL)
	{
		RemoveSpiritGuide(m_spiritGuides[Id]);
		m_spiritGuides[Id]->Despawn(0,0);
	}

	// spawn the spirit guide for our faction
	m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team);
	AddSpiritGuide(m_spiritGuides[Id]);

	// send the chat message/sounds out
	PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES);
	SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]);

	// update the overhead display on the clients (world states)
	m_capturedBases[Team]++;
	// respawn the control point with the correct aura
	SpawnControlPoint(Id, Team ? IOC_SPAWN_TYPE_HORDE_CONTROLLED : IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED);

	// update the map
	SetWorldState(AssaultFields[Id][Team], 0);
	SetWorldState(OwnedFields[Id][Team], 1);
	AddHonorToTeam(5, Team);
	ApplyCaptureBonus(Id, Team);
	if(Id == 5)
		Updateworkshop(Team);
}
Esempio n. 30
0
void EyeOfTheStorm::HookOnFlagDrop(Player* plr)
{
	if(m_flagHolder != plr->GetLowGUID())
		return;

	plr->RemoveAura(EOTS_NETHERWING_FLAG_SPELL);

	m_dropFlag->SetPosition(plr->GetPosition());
	m_dropFlag->PushToWorld(m_mapMgr);
	m_flagHolder = 0;

	SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE + plr->GetTeam(), plr->GetGUID(), "$N has dropped the flag!");

	sEventMgr.AddEvent(this, &EyeOfTheStorm::EventResetFlag, EVENT_EOTS_RESET_FLAG, 10000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
}