Пример #1
0
void TowerDefenseInstanceScript::TowerDefenseMapInstanceScript::StartEvent(Player* player, uint32 Action)
{
    if (!player || player->isInCombat() || player->GetSession()->isLogingOut() || player->GetGroup()){
        ChatHandler(player).SendSysMessage(TD_SYSTEM_MSG_CANNOT_START_DUE);
        return;
    }
    if(GetPlayer() && player->GetGUIDLow() != GetPlayer()->GetGUIDLow()){
        ChatHandler(player).SendSysMessage(TD_SYSTEM_MSG_CANNOT_START_ALREADY);
        return;
    }else{
        SetPlayer(player);
    }

    if(!player)
        return;

    player->PlayDirectSound(TD_STARTEVENT_MUSIC,player);
    SetupEventData();
    player->AddItem(34131, 1); // add the spawning item to the player
    player->SaveToDB(); // save the player to the db in case of crash
    player->TeleportTo(GetMapId(), GetPSpawnX(), GetPSpawnY(), GetPSpawnZ(), GetPSpawnO()); // teleport to starting location
    SetEventStatus(TD_EVENT_STATUS_TELEPORT);
    switch(Action)
    {
    case 1051: // Easy
        SetEventMode(TD_EVENT_MODE_EASY);
        SendMessageToPlayer(TD_SYSTEM_MSG_STARTED_EVENT_EASY); 
        // wait for user input to start wave
        break;
    case 1052: // Hard
        SetEventMode(TD_EVENT_MODE_HARD);
        SendMessageToPlayer(TD_SYSTEM_MSG_STARTED_EVENT_HARD);
        StartNextWave(30000); // start wave from the start within 30 seconds
        break;
    case 1053: // Extreme
        SetEventMode(TD_EVENT_MODE_EXTREME);
        SendMessageToPlayer(TD_SYSTEM_MSG_STARTED_EVENT_EXTREME);
        StartNextWave(1000); // start waves right away
        break;
    }
    RecordLog("TowerDefense: Player Name: [%s] has started the tower defense event. With Event Id: [%u]",player->GetName(), GetEventId());
}
Пример #2
0
	void SwitchTo_ReplayMode() {
		SetEventMode(new ReplayingMode());
	}
Пример #3
0
	void SwitchTo_PlayMode() {
		SetEventMode(new PlayingMode());
	}
Пример #4
0
	void SwitchTo_LearnMode() {
		SetEventMode(new LearningMode());
	}