Example #1
0
        void WaypointReached(uint32 waypointId)
        {
            if (!instance)
                return;

            switch (waypointId)
            {
                case 0:
                    DoCast(me, SPELL_TUXEDO, false);
                    instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT));
                    break;
                case 4:
                    TalkCount = 0;
                    SetEscortPaused(true);

                    if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
                        me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
                        TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
                    {
                        pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
                        m_uiSpotlightGUID = pSpotlight->GetGUID();
                    }
                    break;
                case 8:
                    instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_STAGEDOORLEFT));
                    PerformanceReady = true;
                    break;
                case 9:
                    PrepareEncounter();
                    instance->DoUseDoorOrButton(instance->GetData64(DATA_GO_CURTAINS));
                    break;
            }
        }
Example #2
0
    void WaypointReached(uint32 i)
    {
        if (!pInstance)
            return;

        switch (i)
        {
        case 0:
            DoCast(me, SPELL_TUXEDO, true);
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
            break;
        case 2:
            TalkCount = 0;
            SetEscortPaused(true);

            if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
                                       me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
                                       TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
            {
                pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
                m_uiSpotlightGUID = pSpotlight->GetGUID();
            }
            switch (m_uiEventId)
            {
            case EVENT_OZ:
                for (int i = 0; i < 5; i++)
                    me->SummonGameObject(GameObjects_OZ[i][0], GameObjects_OZ[i][1], GameObjects_OZ[i][2], GameObjects_OZ[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            case EVENT_HOOD:
                for (int i = 0; i < 5; i++)
                    me->SummonGameObject(GameObjects_Wolf[i][0], GameObjects_Wolf[i][1], GameObjects_Wolf[i][2], GameObjects_Wolf[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            case EVENT_RAJ:
                for (int i = 0; i < 1; i++)
                    me->SummonGameObject(GameObjects_RomeJulia[i][0], GameObjects_RomeJulia[i][1], GameObjects_RomeJulia[i][2], GameObjects_RomeJulia[i][3], 4.63f, 0, 0, 0.73f, -0.68f, 60000);
                break;
            }
            break;
        case 5:
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
            PerformanceReady = true;
            PrepareEncounter();
            pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS));
            me->SetFacingTo(1.41372f);
            break;
        }
    }
Example #3
0
void Game_Map::UpdateEncounterSteps() {
	if (Player::debug_flag &&
		Input::IsPressed(Input::DEBUG_THROUGH)) {
			return;
	}

	int x = Main_Data::game_player->GetX();
	int y = Main_Data::game_player->GetY();
	int terrain_id = GetTerrainTag(x, y);
	const RPG::Terrain& terrain = Data::terrains[terrain_id - 1];

	location.encounter_steps -= terrain.encounter_rate;

	if (location.encounter_steps <= 0) {
		ResetEncounterSteps();
		PrepareEncounter();
	}
}
Example #4
0
void Game_Map::UpdateEncounterSteps() {
	if (Player::debug_flag &&
		Input::IsPressed(Input::DEBUG_THROUGH)) {
			return;
	}

	if(Main_Data::game_player->InAirship()) {
		return;
	}

	if (GetEncounterRate() <= 0) {
		location.encounter_steps = 0;
		return;
	}

	int x = Main_Data::game_player->GetX();
	int y = Main_Data::game_player->GetY();

	const RPG::Terrain* terrain = ReaderUtil::GetElement(Data::terrains, GetTerrainTag(x,y));
	if (!terrain) {
		Output::Warning("UpdateEncounterSteps: Invalid terrain at (%d, %d)", x, y);
		return;
	}

	location.encounter_steps += terrain->encounter_rate;

	struct Row {
		int ratio;
		float pmod;
	};

#if 1
	static constexpr Row enc_table[] = {
		{ 0, 0.0625},
		{ 20, 0.125 },
		{ 40, 0.25 },
		{ 60, 0.5 },
		{ 100, 2.0 },
		{ 140, 4.0 },
		{ 160, 8.0 },
		{ 180, 16.0 },
		{ INT_MAX, 16.0 }
	};
#else
	//Old versions of RM2k used this table.
	//Left here for posterity.
	static constexpr Row enc_table[] = {
		{ 0, 0.5 },
		{ 20, 2.0 / 3.0 },
		{ 50, 5.0 / 6.0 },
		{ 100, 6.0 / 5.0 },
		{ 200, 3.0 / 2.0 },
		{ INT_MAX, 3.0 / 2.0 }
	};
#endif
	const auto encounter_rate = GetEncounterRate();
	const auto ratio = location.encounter_steps / encounter_rate;

	auto& idx = last_encounter_idx;
	while (ratio > enc_table[idx+1].ratio) {
		++idx;
	}
	const auto& row = enc_table[idx];

	const auto pmod = row.pmod;
	const auto p = (1.0f / float(encounter_rate)) * pmod * (float(terrain->encounter_rate) / 100.0f);

	if (Utils::PercentChance(p)) {
		SetEncounterSteps(0);
		PrepareEncounter();
	}
}