Esempio n. 1
0
void Item::Create( uint32 itemid, PlayerPointer owner )
{
	SetUInt32Value( OBJECT_FIELD_ENTRY, itemid );
 
	if( owner != NULL )
	{
		SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() );
		SetUInt64Value( ITEM_FIELD_CONTAINED, owner->GetGUID() );
	}

	SetUInt32Value( ITEM_FIELD_STACK_COUNT, 1 );

	m_itemProto = ItemPrototypeStorage.LookupEntry( itemid );

	ASSERT( m_itemProto );
	
	for(uint8 i = 0; i < 5; ++i)
		SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+i, m_itemProto->Spells[i].Charges );

	SetUInt32Value( ITEM_FIELD_MAXDURABILITY, m_itemProto->MaxDurability );
	SetUInt32Value( ITEM_FIELD_DURABILITY, m_itemProto->MaxDurability );

	m_owner = owner;
	if( m_itemProto->LockId > 1 )
		locked = true;
	else
		locked = false;
}
	void OnQuestStart(PlayerPointer pPlayer, QuestLogEntry *pQuest)
	{
		if ( pPlayer == NULL || pPlayer->GetMapMgr() == NULL || pPlayer->GetMapMgr()->GetInterface() == NULL )
			return;

		CreaturePointer pAkida = sEAS.SpawnCreature( pPlayer, 17379, -4183.043457f, -12511.419922f, 44.361786f, 6.05629f, 0 );
		if ( pAkida == NULL )
			return;

		pAkida->m_escorter = pPlayer;   
		pAkida->GetAIInterface()->setMoveType( RUN );
		pAkida->GetAIInterface()->StopMovement( 1000 );
		pAkida->GetAIInterface()->SetAllowedToEnterCombat( false );
		pAkida->SendChatMessage( CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Follow me I shall result you on a place!" );
		pAkida->SetUInt32Value( UNIT_NPC_FLAGS, 0 );
		pAkida->CastSpell( pAkida, 25035, true ); // Apparition Effect

		sEAS.CreateCustomWaypointMap( pAkida );
		sEAS.WaypointCreate( pAkida, -4174.025879f, -12512.800781f, 44.361458f, 2.827430f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4078.135986f, -12535.500977f, 43.066765f, 5.949394f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4040.495361f, -12565.537109f, 43.698250f, 5.592041f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -4009.526367f, -12598.929688f, 53.168480f, 5.434962f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3981.581543f, -12635.541602f, 63.896046f, 5.332861f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3953.170410f, -12680.391602f, 75.433006f, 5.218981f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3924.324951f, -12741.846680f, 95.187035f, 5.124734f, 0, 256, 16995 );
		sEAS.WaypointCreate( pAkida, -3920.791260f, -12746.218750f, 96.887978f, 3.271200f, 0, 256, 16995 );
		sEAS.EnableWaypoints( pAkida );
		mAkidas.push_back( std::make_pair( pPlayer->GetGUID(), pAkida ) );
	}
Esempio n. 3
0
void Item::SetOwner( PlayerPointer owner )
{ 
	if( owner != NULL )
		SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() );
	else SetUInt64Value( ITEM_FIELD_OWNER, 0 );

	m_owner = owner; 
}
	void OnActivate( PlayerPointer pPlayer )
	{
		if ( pPlayer == NULLPLR || mPlayerGuid != 0 )
			return;

		// Do you think we should look for ai owner ?
		/*GameObjectPointer BlastCannon = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 180515 );
		if ( BlastCannon != NULLGOB )
			BlastCannon->SetUInt32Value( GAMEOBJECT_FLAGS, 33 );*/

		pPlayer->CastSpell( pPlayer, 24832, true );
		pPlayer->SetMovement( MOVE_ROOT, 1 );
		_gameobject->PlaySoundToSet( 8476 );
		mPlayerGuid = pPlayer->GetGUID();
		RegisterAIUpdateEvent( 2200 );
	};
	void OnQuestCancel(PlayerPointer pPlayer)
	{
		uint64 PlayerGuid = pPlayer->GetGUID();
		for ( QuestCreature::iterator itr = mAkidas.begin(); itr != mAkidas.end(); ++itr )
		{
			if ( itr->first == PlayerGuid )
			{
				CreaturePointer pAkida = itr->second;
				if ( pAkida != NULL )							// Can't happen, but whatever :)
				{
					pAkida->CastSpell( pAkida, 30428, true );	// Disparition Effect
					pAkida->Despawn( 5000, 0 );
				}

				mAkidas.erase( itr );
			}
		}
	}
Esempio n. 6
0
bool ChatHandler::HandleKillByPlrCommand( const char *args , WorldSession *m_session )
{
	PlayerPointer plr = objmgr.GetPlayer(args, false);
	if(!plr)
	{
		RedSystemMessage(m_session, "Player %s is not online or does not exist.", args);
		return true;
	}

	if(plr->isDead())
	{
		RedSystemMessage(m_session, "Player %s is already dead.", args);
	} else {
		plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0); // Die, insect
		plr->KillPlayer();
		BlueSystemMessageToPlr(plr, "You were killed by %s with a GM command.", m_session->GetPlayer()->GetName());
		GreenSystemMessage(m_session, "Killed player %s.", args);
		sGMLog.writefromsession(m_session, "remote killed "I64FMT" (Name: %s)", plr->GetGUID(), plr->GetNameString() );

	}
	return true;
}
void ArathiBasin::AssaultControlPoint(PlayerPointer pPlayer, uint32 Id)
{
#if defined(BG_ANTI_CHEAT) && !defined(_DEBUG)
	if(!m_started)
	{
		SendChatMessage(CHAT_MSG_BG_SYSTEM_NEUTRAL, pPlayer->GetGUID(), "%s has been removed from the game for cheating.", pPlayer->GetName());
		pPlayer->SoftDisconnect();
		return;
	}
#endif

	bool isVirgin = false;

	uint32 Team = pPlayer->m_bgTeam;
	uint32 Owner;

	if(m_basesOwnedBy[Id]==-1 && m_basesAssaultedBy[Id]==-1)
	{
		isVirgin = true;
		// omgwtfbbq our flag is a virgin?
		m_mapMgr->GetStateManager().UpdateWorldState(NeutralFields[Id], 0);
	}

	if(m_basesOwnedBy[Id] != -1)
	{
		Owner = m_basesOwnedBy[Id];

		// set it to uncontrolled for now
		m_basesOwnedBy[Id] = -1;

		// this control point just got taken over by someone! oh noes!
		if( m_spiritGuides[Id] != NULL )
		{
			map<CreaturePointer,set<uint32> >::iterator itr = m_resurrectMap.find(m_spiritGuides[Id]);
			if( itr != m_resurrectMap.end() )
			{
				for( set<uint32>::iterator it2 = itr->second.begin(); it2 != itr->second.end(); ++it2 )
				{
					PlayerPointer r_plr = m_mapMgr->GetPlayer( *it2 );
					if( r_plr != NULL && r_plr->isDead() )
					{
						HookHandleRepop( r_plr );
						QueueAtNearestSpiritGuide(r_plr, itr->first);
					}
				}
			}
			m_resurrectMap.erase( itr );
			m_spiritGuides[Id]->Despawn( 0, 0 );
			m_spiritGuides[Id] = NULLCREATURE;
		}

		// detract one from the teams controlled points
		m_capturedBases[Owner] -= 1;
		m_mapMgr->GetStateManager().UpdateWorldState(Owner ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Owner]);

		// reset the world states
		m_mapMgr->GetStateManager().UpdateWorldState(OwnedFields[Id][Owner], 0);

		// modify the resource update time period
		if(m_capturedBases[Owner]==0)
			this->event_RemoveEvents(EVENT_AB_RESOURCES_UPDATE_TEAM_0+Owner);
		else
			this->event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner, ResourceUpdateIntervals[m_capturedBases[Owner]]);
	}

	// Contested Flag, not ours, and is not virgin
	uint32 otherTeam = Team ? 0 : 1;
	if( !isVirgin && m_basesLastOwnedBy[Id] == Team && m_basesOwnedBy[Id] == -1 )
	{
		m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team ? 0 : 1], 0);
		this->event_RemoveEvents(EVENT_AB_CAPTURE_CP_1 + Id);
		SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, pPlayer->GetGUID(), "$N has defended the %s!", ControlPointNames[Id]);
		m_basesAssaultedBy[Id] = Team;
		CaptureControlPoint( Id, Team );
		return;
	}

	// n***a stole my flag!
	if(m_basesAssaultedBy[Id] != -1)
	{
		Owner = m_basesAssaultedBy[Id];

		// woah! vehicle hijack!
		m_basesAssaultedBy[Id] = Team;
		m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Owner], 0);

		// make sure the event does not trigger
		sEventMgr.RemoveEvents(shared_from_this(), EVENT_AB_CAPTURE_CP_1 + Id);

		// no need to remove the spawn, SpawnControlPoint will do this.
	} 

	m_basesAssaultedBy[Id] = Team;

	// spawn the new control point gameobject
	SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_ASSAULT : AB_SPAWN_TYPE_ALLIANCE_ASSAULT);

	// send out the chat message and sound
	SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, pPlayer->GetGUID(), "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", ControlPointNames[Id],
		Team ? "Horde" : "Alliance");

	// guessed
	PlaySoundToAll(Team ? SOUND_ALLIANCE_CAPTURE : SOUND_HORDE_CAPTURE);

	// update the client's map with the new assaulting field
	m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team], 1);

	// create the 60 second event.
	sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()), &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, 60000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);

	// update players info
	pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASE_ASSAULTED]++;
	UpdatePvPData();
}
void ArathiBasin::HookOnAreaTrigger(PlayerPointer plr, uint32 id)
{
	uint32 spellid=0;
	int32 buffslot = -1;
	switch(id)
	{
	case 3866:			// stables
		buffslot=AB_BUFF_STABLES;
		break;

	case 3867:			// farm
		buffslot=AB_BUFF_FARM;		
		break;

	case 3870:			// blacksmith
		buffslot=AB_BUFF_BLACKSMITH;
		break;

	case 3869:			// mine
		buffslot=AB_BUFF_MINE;
		break;

	case 3868:			// lumbermill
		buffslot=AB_BUFF_LUMBERMILL;
		break;

	case 3948:			// alliance/horde exits
	case 3949:
		{
			RemovePlayer(plr,false);
			return;
		}break;

	default:
		Log.Error("ArathiBasin", "Encountered unhandled areatrigger id %u", id);
		return;
		break;
	}

	if(plr->isDead())		// dont apply to dead players... :P
		return;	

	uint32 x = (uint32)buffslot;
	if(m_buffs[x] && m_buffs[x]->IsInWorld())
	{
		// apply the spell
		spellid = m_buffs[x]->GetInfo()->sound3;
		m_buffs[x]->RemoveFromWorld(false);

		// respawn it in buffrespawntime
		sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()),&ArathiBasin::SpawnBuff,x,EVENT_AB_RESPAWN_BUFF,AB_BUFF_RESPAWN_TIME,1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);

		// cast the spell on the player
		SpellEntry * sp = dbcSpell.LookupEntryForced(spellid);
		if(sp)
		{
			SpellPointer pSpell(new Spell(plr, sp, true, NULLAURA));
			SpellCastTargets targets(plr->GetGUID());
			pSpell->prepare(&targets);
		}
	}
}