예제 #1
0
// Handle the zone reset when the timer expires
void OutdoorPvPTF::UnlockZone()
{
    // remove buffs
    BuffTeam(m_zoneOwner, SPELL_AUCHINDOUN_BLESSING, true);

    m_zoneOwner = TEAM_NONE;

    // reset world states and towers
    SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
    m_zoneWorldState = WORLD_STATE_TF_TOWERS_CONTROLLED;
    SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_ADD);

    // reset tower states
    m_towerWorldState[0] = WORLD_STATE_TF_WEST_TOWER_NEUTRAL;
    m_towerWorldState[1] = WORLD_STATE_TF_NORTH_TOWER_NEUTRAL;
    m_towerWorldState[2] = WORLD_STATE_TF_EAST_TOWER_NEUTRAL;
    m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL;
    m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
    for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
        SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD);

    // update tower count
    m_towersAlliance = 0;
    m_towersHorde = 0;
    SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
    SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde);

    for (GuidZoneMap::const_iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
    {
        // Find player who is in main zone (Terokkar Forest) to get correct map reference
        if (!itr->second)
            continue;

        if (Player* player = sObjectMgr.GetPlayer(itr->first))
        {
            ResetTowers(player);
            break;
        }
    }
}
예제 #2
0
void Climber_Class::AutoClimb(int state)
{	
	bool climb;
	bool reach;
	bool pushOut;
	bool safety;
	bool release;
	
	switch(state)
	{
	case AUTO_CLIMB_STATE_1:
		//brings the towers stationary hooks all the way up
		//The towers need to be reset, but only once
		/*if(firstReach)
		{
			ResetTowers();
			firstReach = false;
		}*/
		if(startCC)
		{
			ResetTowers();
			startCC = false;
		}
		inState = ReachDistance(LEVEL_1A_REACH_POS);
		break;
	case AUTO_CLIMB_STATE_2:
		//pushes the candy cane out
		inState = (bool)candyCane->PushOut();
		//The startCC boolean only allows the CC functions to be called once per state
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_3:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Grab the pole
		if(startCC)
		{
			candyCane->StartGrab(LEVEL_1_GRAB_POS);
			//This line makes the CC only grab once
			startCC = false;
		}
		//If we're done grabbing, inState will be false and we can go to the next state otherwise it will be true
		inState = (bool)candyCane->Grab();
		break;
	case AUTO_CLIMB_STATE_4:
		//climb until arms grab the horizontal bar
		
		//If we're still climbing inState is set to true, otherwise it is set to false
		inState = (bool)ClimbDistance(LEVEL_1A_CLIMB_POS);
		//Tell the CC it can move in the next state
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_5:
		//Release the CC
		if(startCC)
		{
			//Reset the towers so we know we can move them in the next state
			ResetTowers();
			TowersStop();
			candyCane->StartRelease();
			startCC = false;
			release = true;
			climb = true;
		}
		//If we're done releasing, inState will be set to false so we can go to the next state, otherwise it will be true
		release = (bool)candyCane->Release();
		climb = (bool)Climb();
		
		if(!climb && !release)
		{
			inState = false;
		}
		break;
	/*case AUTO_CLIMB_STATE_6:	
		//Climb until the hooks transition
		//Check to see if we're still climbing
		inState = (bool)Climb();
		break;*/
	case AUTO_CLIMB_STATE_6:
		//Reach until the CC is clear
		if(startCC)
		{
			reach = true;
			pushOut = true;
			startCC = false;
			bringOutCC = true;
		}
		//Check to see if we're still reaching
		reach = (bool)ReachDistance(LEVEL_2A_REACH_POS);

		//Once the towers reached a certain distance, push out the CC
		if((leftTower->GetDistance() >= DISTANCE_FOR_EXTENDEING_CC) && bringOutCC)
		{
			candyCane->StartSafety(LEVEL_2A_SAFETY_POS);
			bringOutCC = false;
		}
		pushOut = candyCane->Safety();
		//If we're not reaching or pushing out, we're not in the state anymore
		if(!reach && !pushOut)
		{
			inState = false;
		}
		/*//Check to see if we're still reaching
		inState = (bool)ReachDistance(LEVEL_2A_REACH_POS);
		//Tell the CC it can move in the next state
		startCC = true;*/
		break;
	//Level 2
	/*case AUTO_CLIMB_STATE_7:
		//CC safety position
		if(startCC)
		{
			candyCane->StartSafety(LEVEL_2A_SAFETY_POS);
			//This line makes the CC go into the safety position only once
			startCC = false;
		}
		inState = (bool)candyCane->Safety();
		break;*/
	case AUTO_CLIMB_STATE_7:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Bring in the CC so the servo turns
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_2A_SAFETY_LEAN_POS);
			startCC = false;
		}
		inState = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_8:
		//Reach until the CC grabs the vertical bar
		//Check to see if we're still reaching
		inState = (bool)ReachDistance(LEVEL_2B_REACH_POS);
		//Tell the CC it can move in the next state
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_9:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Lean a little bit
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_2A_LEAN_POS);
			startCC = false;
		}
		//Check to see if we're still leaning in
		inState = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_10:
		//Reach all the way
		//Check to see if we're still reaching
		inState = (bool)Reach();
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_11:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Lean in until the arms touch the horizontal bars
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_2B_LEAN_POS);
			startCC = false;
		}
		//Check to see if we're still leaning in
		inState = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_12:
		//climb until the arms grab the horizontal bars
		//Check to see if we're still climbing
		inState = (bool)ClimbDistance(LEVEL_2A_CLIMB_POS);
		startCC = true;
		break;
	/*case AUTO_CLIMB_STATE_14:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//CC safety
		if(startCC)
		{
			candyCane->StartSafety(LEVEL_2B_SAFETY);
			startCC = false;
		}
		//Check to see if we're still safetying
		inState = (bool)candyCane->Safety();
		break;*/
	case AUTO_CLIMB_STATE_13:
		//Release the CC
		if(startCC)
		{
			//Reset the towers so we know we can move them in the next state
			ResetTowers();
			TowersStop();
			candyCane->StartRelease();
			startCC = false;
			climb = true;
			release = true;
		}
		//Climb until the hooks transition
		//Check to see if we're still climbing
		climb = (bool)Climb();
		release = (bool)candyCane->Release();
		
		if(!climb && !release)
		{
			inState = false;
		}
		break;
	/*case AUTO_CLIMB_STATE_16:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Release the CC
		if(startCC)
		{
			candyCane->StartRelease();
			startCC = false;
		}
		//Check to see if we're still releasing
		inState = (bool)candyCane->Release();
		break;*/
	//Level 3
	case AUTO_CLIMB_STATE_14:
		//Reach until the CC is clear
		if(startCC)
		{
			reach = true;
			pushOut = true;
			bringOutCC = true;
			startCC = false;
		}
		//Check to see if we're still reaching
		reach = (bool)ReachDistance(LEVEL_3A_REACH_POS);

		//Once the towers reached a certain distance, push out the CC
		if((leftTower->GetDistance() >= DISTANCE_FOR_EXTENDEING_CC) && bringOutCC)
		{
			candyCane->StartSafety(LEVEL_3A_SAFETY_POS);
			bringOutCC = false;
		}
		pushOut = candyCane->Safety();
		
		//If we're not reaching or pushing out, we're not in the state anymore
		if(!reach && !pushOut)
		{
			inState = false;
		}
		/*//Check to see if we're still reaching
		inState = (bool)ReachDistance(LEVEL_3A_REACH_POS);
		startCC = true;*/
		break;
	/*case AUTO_CLIMB_STATE_16:
		//CC safety
		if(startCC)
		{
			candyCane->StartSafety(LEVEL_3A_SAFETY_POS);
			startCC = false;
		}
		//Check to see if we're still safetying
		inState = (bool)candyCane->Safety();
		break;*/
	case AUTO_CLIMB_STATE_15:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Bring in the CC so the servo turns
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_3A_SAFETY_LEAN_POS);
			startCC = false;
		}
		inState = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_16:
		//Reach until the CC grabs the verticle bar
		//Check to see if we're still reaching
		inState = (bool)ReachDistance(LEVEL_3B_REACH_POS);
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_17:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Lean in
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_3A_LEAN_POS);
			startCC = false;
		}
		//Check to see if we're still leaning in
		inState  = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_18:
		//Reach all the way
		//Check to see if we're still reaching
		inState = (bool)Reach();
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_19:
		//Reset the towers so we know we can move them in the next state
		ResetTowers();
		TowersStop();
		//Lean in until the arms hit the horizontal bar
		if(startCC)
		{
			candyCane->StartLeanIn(LEVEL_3B_LEAN_POS);
			startCC = false;
		}
		//Check to see if we're still leaning in
		inState = (bool)candyCane->LeanIn();
		break;
	case AUTO_CLIMB_STATE_20:
		//climb until the arms grab the horizontal bars
		//Check to see if we're still climbing
		inState = (bool)ClimbDistance(LEVEL_3A_CLIMB_POS);
		startCC = true;
		break;
	case AUTO_CLIMB_STATE_21:
		//CC safety
		if(startCC)
		{
			//Reset the towers so we know we can move them in the next state
			ResetTowers();
			TowersStop();
			candyCane->StartSafety(LEVEL_3B_SAFETY_POS);
			startCC = false;
			safety = true;
			climb = true;
		}
		//Check to see if we're still safetying
		safety = (bool)candyCane->Safety();
		climb = (bool)ClimbDistance(LEVEL_3B_CLIMB_POS);
		
		if(!safety && !climb)
		{
			inState = false;
		}
		break;
	/*case AUTO_CLIMB_STATE_27:
		//Climb until we want to stop and win
		////Check to see if we're still climbing
		inState = (bool)ClimbDistance(LEVEL_3B_CLIMB_POS);
		break;*/
	}
	/*grabbing = (bool)candyCane->Grab();
	safetying = (bool)candyCane->Safety();
	releasing = (bool)candyCane->Release();
	leaningIn = (bool)candyCane->LeanIn();*/
}