Ejemplo n.º 1
0
void ZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
    static uint32 spellids[2] = { HELLFIRE_SUPERORITY_ALLIANCE, HELLFIRE_SUPERORITY_HORDE };
    if(Zone == ZONE_HELLFIRE_PENINSULA)
    {
        if(g_superiorTeam == plr->GetTeam())
            plr->CastSpell(plr, dbcSpell.LookupEntry(spellids[plr->GetTeam()]), true);
    }
    else if(OldZone == ZONE_HELLFIRE_PENINSULA)
    {
        if(g_superiorTeam == plr->GetTeam())
            plr->RemovePositiveAura(spellids[plr->GetTeam()]);
    }
}
Ejemplo n.º 2
0
void Channel::Invite(ObjectGuid p, const char *newname)
{
    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
        return;
    }

    PlayerPointer newp = GetPlayer(newname);
    if (!newp)
    {
        WorldPacket data;
        MakePlayerNotFound(&data, newname);
        SendToOne(&data, p);
        return;
    }

    PlayerPointer plr = GetPlayer(p);
    if (!plr.get())
        return;

    if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
    {
        WorldPacket data;
        MakeInviteWrongFaction(&data);
        SendToOne(&data, p);
        return;
    }

    if (IsOn(newp->GetObjectGuid()))
    {
        WorldPacket data;
        MakePlayerAlreadyMember(&data, newp->GetObjectGuid());
        SendToOne(&data, p);
        return;
    }

    WorldPacket data;
    if (!newp->GetSocial()->HasIgnore(p))
    {
        MakeInvite(&data, p);
        SendToOne(&data, newp->GetObjectGuid());
        data.clear();
    }
    MakePlayerInvited(&data, newp->GetName());
    SendToOne(&data, p);
}
Ejemplo n.º 3
0
void TFZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
    if(!plr)
        return;

    if(Zone == ZONE_TEROKKAR_FOREST)
    {
        if(TFg_superiorTeam == plr->GetTeam())
            plr->CastSpell(plr, dbcSpell.LookupEntry(BLESSING_OF_AUCHINDOUND), true);
    }
    else if(OldZone == ZONE_TEROKKAR_FOREST)
    {
        if(TFg_superiorTeam == plr->GetTeam())
            plr->RemovePositiveAura(BLESSING_OF_AUCHINDOUND);
    }
}
Ejemplo n.º 4
0
void SilithusZoneHook(PlayerPointer plr, uint32 Zone, uint32 OldZone)
{
	if(!plr)
		return;

	if(Zone == ZONE_SILITHUS)
	{
		if(winners == plr->GetTeam())
			plr->CastSpell(plr, dbcSpell.LookupEntry(CENARION_FAVOR), true);
	}
	else if(OldZone == ZONE_SILITHUS)
	{
		if(winners == plr->GetTeam())
			plr->RemovePositiveAura(CENARION_FAVOR);
	}
}
void WorldSession::HandleCharterOffer( WorldPacket & recv_data )
{
	uint32 shit;
	uint64 item_guid, target_guid;
	Charter * pCharter;
	recv_data >> shit >> item_guid >> target_guid;
	
	if(!_player->IsInWorld()) return;
	PlayerPointer pTarget = _player->GetMapMgr()->GetPlayer((uint32)target_guid);
	pCharter = objmgr.GetCharterByItemGuid(item_guid);

	if( pCharter == NULL )
	{
		SendNotification("Charter cannot be found.");
		return;
	}

	if(pTarget == 0 || pTarget->GetTeam() != _player->GetTeam() || pTarget == _player)
	{
		SendNotification("Target is of the wrong faction.");
		return;
	}

	if(!pTarget->CanSignCharter(pCharter, _player))
	{
		SendNotification("Target player cannot sign your charter for one or more reasons.");
		return;
	}

	SendShowSignatures(pCharter, item_guid, pTarget);
}
Ejemplo n.º 6
0
void Arena::OnAddPlayer(PlayerPointer plr)
{
	plr->m_deathVision = true;

	if( plr->m_isGmInvisible )
		return;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x=0;x<MAX_AURAS;x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

	m_playersCount[plr->GetTeam()]++;
	UpdatePlayerCounts();

	/* Add the green/gold team flag */
	AuraPointer aura(new Aura(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr));
	plr->AddAura(aura);
	
	/* Set FFA PvP Flag */
	plr->SetFFAPvPFlag();

	hashmap_put(m_playersAlive, plr->GetLowGUID(), (any_t)1);
	if(Rated())
	{
		// Store the players who join so that we can change their rating even if they leave before arena finishes
		hashmap_put(m_players2[plr->GetTeam()], plr->GetLowGUID(), (any_t)1);
		if(m_teams[plr->GetTeam()] == -1 && plr->m_playerInfo && plr->m_playerInfo->arenaTeam[m_arenateamtype] != NULL)
		{
			m_teams[plr->GetTeam()] = plr->m_playerInfo->arenaTeam[m_arenateamtype]->m_id;
		}
	}
}
void WorldSession::HandleInviteToGuild(WorldPacket & recv_data)
{
	CHECK_PACKET_SIZE(recv_data, 1);

	std::string inviteeName;
	recv_data >> inviteeName;

	PlayerPointer plyr = objmgr.GetPlayer( inviteeName.c_str() , false);
	Guild *pGuild = _player->m_playerInfo->guild;
	
	if(!plyr)
	{
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,inviteeName.c_str(),GUILD_PLAYER_NOT_FOUND);
		return;
	}
	else if(!pGuild)
	{
		Guild::SendGuildCommandResult(this, GUILD_CREATE_S,"",GUILD_PLAYER_NOT_IN_GUILD);
		return;
	}

	if( plyr->GetGuildId() )
	{
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,plyr->GetName(),ALREADY_IN_GUILD);
		return;
	}
	else if( plyr->GetGuildInvitersGuid())
	{
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,plyr->GetName(),ALREADY_INVITED_TO_GUILD);
		return;
	}
	else if(!_player->m_playerInfo->guildRank->CanPerformCommand(GR_RIGHT_INVITE))
	{
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_PERMISSIONS);
		return;
	}
	else if(plyr->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0 && !sWorld.cross_faction_world)
	{
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_NOT_ALLIED);
		return;
	}
	else if(pGuild->GetNumMembers() >= MAX_GUILD_MEMBERS)
	{
		// We can't handle >= 500 members, or WoW will #132. I don't have the proper error code, so just throw the internal one.
		Guild::SendGuildCommandResult(this, GUILD_INVITE_S,"",GUILD_INTERNAL);
		return;
	}
	Guild::SendGuildCommandResult(this, GUILD_INVITE_S,inviteeName.c_str(),GUILD_U_HAVE_INVITED);
	//41
  
	WorldPacket data(SMSG_GUILD_INVITE, 100);
	data << _player->GetName();
	data << pGuild->GetGuildName();
	plyr->GetSession()->SendPacket(&data);

	plyr->SetGuildInvitersGuid( _player->GetLowGUID() );	
}
Ejemplo n.º 8
0
void Arena::HookOnPlayerDeath(PlayerPointer plr)
{
	ASSERT(plr != NULL);

	if (hashmap_get(m_playersAlive, plr->GetLowGUID(), NULL) == MAP_OK) {
		m_playersCount[plr->GetTeam()]--;
		UpdatePlayerCounts();
		hashmap_remove(m_playersAlive, plr->GetLowGUID());
	}
}
Ejemplo n.º 9
0
void WorldSession::HandleInitiateTrade(WorldPacket & recv_data)
{
	CHECK_INWORLD_RETURN;

	CHECK_PACKET_SIZE(recv_data, 8);

	uint64 guid;
	recv_data >> guid;

	uint32 TradeStatus = TRADE_STATUS_PROPOSED;

	PlayerPointer pTarget = _player->GetMapMgr()->GetPlayer((uint32)guid);
	if(pTarget == NULL || !pTarget->IsInWorld())
		TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND;
	else
	{
		// Handle possible error outcomes
		if(_player->isDead())
			TradeStatus = TRADE_STATUS_DEAD;
		if(pTarget->isDead())
			TradeStatus = TRADE_STATUS_TARGET_DEAD;
		else if(pTarget->mTradeTarget != 0)
			TradeStatus = TRADE_STATUS_ALREADY_TRADING;
		else if(pTarget->GetTeam() != _player->GetTeam() && GetPermissionCount() == 0)
			TradeStatus = TRADE_STATUS_WRONG_FACTION;
		else if(_player->CalcDistance(pTarget) > 10.0f)		// This needs to be checked
			TradeStatus = TRADE_STATUS_TOO_FAR_AWAY;
	}	

	if(TradeStatus != TRADE_STATUS_PROPOSED)
	{
		_player->ResetTradeVariables();
		SendTradeStatus(TradeStatus);
	}
	else
	{
		_player->ResetTradeVariables();
		pTarget->ResetTradeVariables();

		pTarget->mTradeTarget = _player->GetLowGUID();
		_player->mTradeTarget = pTarget->GetLowGUID();

		pTarget->mTradeStatus = TradeStatus;
		_player->mTradeStatus = TradeStatus;

		WorldPacket data(SMSG_TRADE_STATUS, 12);
		data << TradeStatus;
		data << _player->GetGUID();

		if(pTarget->m_session && pTarget->m_session->GetSocket())
			pTarget->m_session->SendPacket(&data);
	}
}
Ejemplo n.º 10
0
void AreatriggerHook(PlayerPointer pPlayer, uint32 triggerID)
{
	if(!pPlayer)
		return;

	if(triggerID == ALLIANCE_RETURN ||
	        triggerID == HORDE_RETURN)
	{
		if(pPlayer->HasAura(SILITHYST_SPELL))     // if we doesn't have it, do nothing
		{
			pPlayer->RemoveAura(SILITHYST_SPELL);

			/* Rewards */
			pPlayer->CastSpell(pPlayer, TRACES_OF_SILITHYST, true);
			pPlayer->m_honorPoints += REWARD_HONOR;
			pPlayer->ModStanding(REWARD_REPUTATION_FACTION, REWARD_REPUTATION_VALUE);

			uint32 quest = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_SILITHYST_QUEST : HORDE_SILITHYST_QUEST;
			QuestLogEntry* qle = pPlayer->GetQuestLogForEntry(quest);
			if(qle)
				qle->SendQuestComplete();
			/***********/

			if(locked)
				return;
			silithyst_gathered[ pPlayer->GetTeam() ]++;
			uint32 worldstate = pPlayer->GetTeam() == ALLIANCE ? WORLDSTATE_SILITHUS_GATHERED_ALLIANCE : WORLDSTATE_SILITHUS_GATHERED_HORDE;
			pPlayer->GetMapMgr()->GetStateManager().UpdateWorldState(worldstate , silithyst_gathered[ pPlayer->GetTeam() ]);
			if(silithyst_gathered[ pPlayer->GetTeam() ] >= SILITHYST_MAX)
			{
				locked = true; // we win, so opposite team must wait for server restart
				winners = pPlayer->GetTeam();
				pPlayer->GetMapMgr()->CastSpellOnPlayers(winners, CENARION_FAVOR);
				pPlayer->GetMapMgr()->RemovePositiveAuraFromPlayers(winners == ALLIANCE ? HORDE : ALLIANCE, CENARION_FAVOR);
			}
		}
	}
}
	void GossipHello(ObjectPointer pObject, PlayerPointer  plr, bool AutoSend)
	{
		uint32 Team = plr->GetTeam();
		if(Team > 1) Team = 1;

		GossipMenu *Menu;
		objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), Team == 0 ? 9433 : 9750, plr);

		if( pObject->GetUInt32Value(UNIT_NPC_FLAGS) & UNIT_NPC_FLAG_VENDOR )
			Menu->AddItem( 0, "I would like to browse your goods.", 3 );

		if( ZMg_superiorTeam == Team && ZMCityOwners != Team && !plr->HasAura( Team == 0 ? 32430 : 32431 ) )
			Menu->AddItem( 0, Team == 0 ? "Give me the flag, I'll take it to the Central Tower for the glory of the Alliance!" : "Give me the flag, I'll take it to the Central Tower for the glory of the Horde!" , Team+1);
		if(AutoSend)
			Menu->SendTo(plr);
    }
Ejemplo n.º 12
0
void Channel::SetOwner(ObjectGuid p, const char *newname)
{
    PlayerPointer plr = GetPlayer(p);
    if (!plr.get())
        return;

    uint32 sec = plr->GetSession()->GetSecurity();

    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
        return;
    }

    if (sec < SEC_GAMEMASTER && p != m_ownerGuid)
    {
        WorldPacket data;
        MakeNotOwner(&data);
        SendToOne(&data, p);
        return;
    }

    Player *newp = sObjectMgr.GetPlayer(newname);
    if (!newp || !IsOn(newp->GetObjectGuid()))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, newname);
        SendToOne(&data, p);
        return;
    }

    if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
    {
        WorldPacket data;
        MakePlayerNotFound(&data, newname);
        SendToOne(&data, p);
        return;
    }

    if (HasFlag(CHANNEL_FLAG_GENERAL) && newp->GetSession()->GetSecurity() < SEC_GAMEMASTER)
        return;

    m_players[newp->GetObjectGuid()].SetModerator(true);
    SetOwner(newp->GetObjectGuid());
}
Ejemplo n.º 13
0
void DropFlag(PlayerPointer  pPlayer, uint32 spellID)
{
	if(!pPlayer || spellID != SILITHYST_SPELL)
		return;
	uint32 triggerID = pPlayer->GetTeam() == ALLIANCE ? ALLIANCE_RETURN : HORDE_RETURN;
	// we have to use AreaTrigger.dbc here
	AreaTrigger* pAreaTrigger = AreaTriggerStorage.LookupEntry(triggerID);
	if(pAreaTrigger)
		if(pPlayer->CalcDistance(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z) > 10.0f)
		{
			GameObjectPointer pGo = pPlayer->GetMapMgr()->GetInterface()->SpawnGameObject(SILITHYST_MOUND, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0, true, 0, 0);
			if(pGo == NULL)
			{
				pGo->Destructor();
				pGo = NULLGOB;
			}
		};
}
Ejemplo n.º 14
0
void HonorHandler::OnPlayerKilledUnit( PlayerPointer pPlayer, UnitPointer pVictim )
{
	if( pVictim == NULL || pPlayer == NULL || !pVictim->IsPlayer() || !pPlayer->IsPlayer() )
		return;

	if( TO_PLAYER( pVictim )->m_honorless )
		return;

    if( pVictim->IsPlayer() )
	{
		if( pPlayer->m_bg )
		{
			if( TO_PLAYER( pVictim )->m_bgTeam == pPlayer->m_bgTeam )
				return;

			// patch 2.4, players killed >50 times in battlegrounds won't be worth honor for the rest of that bg
			if( TO_PLAYER(pVictim)->m_bgScore.Deaths >= 50 )
				return;
		}
		else
		{
			if( pPlayer->GetTeam() == TO_PLAYER( pVictim )->GetTeam() )
				return;
		}
	}

	// Calculate points
	int32 Points = CalculateHonorPointsForKill(pPlayer, pVictim);

	if( Points > 0 )
	{
		if( pPlayer->m_bg )
		{
			// hackfix for battlegrounds (since the gorups there are disabled, we need to do this manually)
			vector<PlayerPointer  > toadd;
			uint32 t = pPlayer->m_bgTeam;
			toadd.reserve(15);		// shouldnt have more than this
			pPlayer->m_bg->Lock();
			set<PlayerPointer  > * s = &pPlayer->m_bg->m_players[t];

			for(set<PlayerPointer  >::iterator itr = s->begin(); itr != s->end(); ++itr)
			{
				if((*itr) == pPlayer || (*itr)->isInRange(pPlayer,40.0f))
					toadd.push_back(*itr);
			}

			if( toadd.size() > 0 )
			{
				uint32 pts = Points / (uint32)toadd.size();
				for(vector<PlayerPointer  >::iterator vtr = toadd.begin(); vtr != toadd.end(); ++vtr)
				{
					AddHonorPointsToPlayer(*vtr, pts);

					(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
					(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
					(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );

					(*vtr)->m_killsToday++;
					(*vtr)->m_killsLifetime++;
					pPlayer->m_bg->HookOnHK(*vtr);
					if(pVictim)
					{
						// Send PVP credit
						WorldPacket data(SMSG_PVP_CREDIT, 12);
						uint32 pvppoints = pts * 10;
						data << pvppoints << pVictim->GetGUID() << uint32(TO_PLAYER(pVictim)->GetPVPRank());
						(*vtr)->GetSession()->SendPacket(&data);
					}
				}
			}

			pPlayer->m_bg->Unlock();
		}
		else if(pPlayer->GetGroup())
        {
            Group *pGroup = pPlayer->GetGroup();
            PlayerPointer gPlayer = NULLPLR;
            int32 GroupPoints;
			pGroup->Lock();
            GroupPoints = (Points / (pGroup->MemberCount() ? pGroup->MemberCount() : 1));
            GroupMembersSet::iterator gitr;
			for(uint32 k = 0; k < pGroup->GetSubGroupCount(); k++)
			{
				for(gitr = pGroup->GetSubGroup(k)->GetGroupMembersBegin(); gitr != pGroup->GetSubGroup(k)->GetGroupMembersEnd(); ++gitr)
				{
					gPlayer = (*gitr)->m_loggedInPlayer;
                    
                    if(gPlayer && (gPlayer == pPlayer || gPlayer->isInRange(pPlayer,100.0f))) // visible range
                    {
						gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
						gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
						gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
                        gPlayer->m_killsToday++;
                        gPlayer->m_killsLifetime++;
						if(gPlayer->m_bg)
							gPlayer->m_bg->HookOnHK(gPlayer);

						sHookInterface.OnHonorableKill(gPlayer, TO_PLAYER(pVictim));
		                AddHonorPointsToPlayer(gPlayer, GroupPoints);
                        if(pVictim)
		                {
			                // Send PVP credit
			                WorldPacket data(SMSG_PVP_CREDIT, 12);
			                uint32 pvppoints = GroupPoints * 10;
			                data << pvppoints << pVictim->GetGUID() << uint32(TO_PLAYER(pVictim)->GetPVPRank());
			                gPlayer->GetSession()->SendPacket(&data);
		                }
						//patch by emsy
                        // If we are in Halaa
                        if(pPlayer->GetZoneId() == 3518)
                        {
                            // Add Halaa Battle Token
                            SpellEntry * pvp_token_spell = dbcSpell.LookupEntry(gPlayer->GetTeam()? 33004 : 33005);
                            gPlayer->CastSpell(gPlayer, pvp_token_spell, true);
                        }
                        // If we are in Hellfire Peninsula
                        if(pPlayer->GetZoneId() == 3483)
                        {
                            // Add Mark of Thrallmar/Honor Hold
                            SpellEntry * pvp_token_spell = dbcSpell.LookupEntry(gPlayer->GetTeam()? 32158 : 32155);
                            gPlayer->CastSpell(gPlayer, pvp_token_spell, true);
                        }
                    }

                }
            }
			pGroup->Unlock();
        
        }
        else
        {
			pPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
			pPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
			pPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
		    pPlayer->m_killsToday++;
		    pPlayer->m_killsLifetime++;
		    AddHonorPointsToPlayer(pPlayer, Points);
    		
			if(pPlayer->m_bg)
				pPlayer->m_bg->HookOnHK(pPlayer);

			sHookInterface.OnHonorableKill(pPlayer, TO_PLAYER(pVictim));
		    if(pVictim)
		    {
			    // Send PVP credit
			    WorldPacket data(SMSG_PVP_CREDIT, 12);
			    uint32 pvppoints = Points * 10;
			    data << pvppoints << pVictim->GetGUID() << uint32(TO_PLAYER(pVictim)->GetPVPRank());
			    pPlayer->GetSession()->SendPacket(&data);
		    }
			//patch by emsy
            // If we are in Halaa
            if(pPlayer->GetZoneId() == 3518)
            {
                // Add Halaa Battle Token
                SpellEntry * halaa_spell = dbcSpell.LookupEntry(pPlayer->GetTeam()? 33004 : 33005);
                pPlayer->CastSpell(pPlayer, halaa_spell, true);
            }
        }
	}
}
Ejemplo n.º 15
0
void Channel::SetMode(ObjectGuid p, const char *p2n, bool mod, bool set)
{
    PlayerPointer plr = GetPlayer(p);
    if (!plr.get())
        return;

    uint32 sec = plr->GetSession()->GetSecurity();

    if (!IsOn(p))
    {
        WorldPacket data;
        MakeNotMember(&data);
        SendToOne(&data, p);
    }
    else if (!m_players[p].IsModerator() && sec < SEC_GAMEMASTER)
    {
        WorldPacket data;
        MakeNotModerator(&data);
        SendToOne(&data, p);
    }
    else
    {
        PlayerPointer newp = GetPlayer(p2n);
        if (!newp.get())
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        PlayerInfo inf = m_players[newp->GetObjectGuid()];
        if (p == m_ownerGuid && newp->GetObjectGuid() == m_ownerGuid && mod)
            return;

        if (!IsOn(newp->GetObjectGuid()))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        // allow make moderator from another team only if both is GMs
        // at this moment this only way to show channel post for GM from another team
        if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
                plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
        {
            WorldPacket data;
            MakePlayerNotFound(&data, p2n);
            SendToOne(&data, p);
            return;
        }

        if (m_ownerGuid == newp->GetObjectGuid() && m_ownerGuid != p)
        {
            WorldPacket data;
            MakeNotOwner(&data);
            SendToOne(&data, p);
            return;
        }

        if (mod)
        {
            if (HasFlag(CHANNEL_FLAG_GENERAL) && newp->GetSession()->GetSecurity() < SEC_GAMEMASTER)
                return;

            SetModerator(newp->GetObjectGuid(), set);
        }
        else
            SetMute(newp->GetObjectGuid(), set);
    }
}
Ejemplo n.º 16
0
//////////////////////////////////////////////////////////////
/// This function handles CMSG_GROUP_INVITE
//////////////////////////////////////////////////////////////
void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
{
	if(!_player->IsInWorld())
		return;

	CHECK_PACKET_SIZE(recv_data, 1);
	WorldPacket data(100);
	std::string membername;
	PlayerPointer player = NULLPLR;
	Group *group = NULL;

	recv_data >> membername;
	if(_player->HasBeenInvited())return;

	player = objmgr.GetPlayer(membername.c_str(), false);

	if ( player == NULL)
	{
		SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND);
		return;
	}

	if (player == _player)
	{
		return;
	}

	if ( _player->InGroup() && (!_player->IsGroupLeader() || _player->GetGroup()->HasFlag(GROUP_FLAG_BATTLEGROUND_GROUP) ) )
	{
		SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER);
		return;
	}

	group = _player->GetGroup();
	if ( group != NULL )
	{
		if (group->IsFull())
		{
			SendPartyCommandResult(_player, 0, "", ERR_PARTY_IS_FULL);
			return;
		}
	}

	if ( player->InGroup() )
	{
		SendPartyCommandResult(_player, player->GetGroup()->GetGroupType(), membername, ERR_PARTY_ALREADY_IN_GROUP);
		data.SetOpcode(SMSG_GROUP_INVITE);
		data << uint8(0);
		data << GetPlayer()->GetName();
		player->GetSession()->SendPacket(&data);
		return;
	}
	
	if(player->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0 && !sWorld.cross_faction_world)
	{
		SendPartyCommandResult(_player, 0, membername, ERR_PARTY_WRONG_FACTION);
		return;
	}

	if ( player->HasBeenInvited() )
	{
		SendPartyCommandResult(_player, 0, membername, ERR_PARTY_ALREADY_IN_GROUP);
		return;
	}

	if( player->Social_IsIgnoring( _player->GetLowGUID() ) )
	{
		SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_IGNORING_YOU);
		return;
	}

	if( player->bGMTagOn && !_player->GetSession()->HasPermissions())
	{
		SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND);
		return;
	}

	// 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc
	_player->SetInviter(_player->GetLowGUID());//bugfix if player invtied 2 people-> he can be in 2 parties

	data.SetOpcode(SMSG_GROUP_INVITE);
	data << uint8(1);
	data << GetPlayer()->GetName();

	player->GetSession()->SendPacket(&data);

	uint32 gtype = 0;
	if(group)
		gtype = group->GetGroupType();

	SendPartyCommandResult(_player, gtype, membername, ERR_PARTY_NO_ERROR);

	// 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc
	player->SetInviter(_player->GetLowGUID());
}