void EntertainingSessionImplementation::startPlayingMusic(const String& song, const String& instrumentAnimation, int instrid) { ManagedReference<CreatureObject*> entertainer = this->entertainer.get(); Locker locker(entertainer); ManagedReference<GroupObject*> group = entertainer->getGroup(); if (group != NULL) { if (group->getBandSong() != song) { Locker clocker(group, entertainer); group->setBandSong(song); } } sendEntertainingUpdate(entertainer, 0.0125, instrumentAnimation, 0x07352BAC, instrid); performanceName = song; playingMusic = true; entertainer->sendSystemMessage("@performance:music_start_self"); entertainer->setListenToID(entertainer->getObjectID(), true); externalInstrument = getInstrument(entertainer); if (externalInstrument != NULL) externalInstrument->setBeingUsed(true); updateEntertainerMissionStatus(true, MissionObject::MUSICIAN); entertainer->notifyObservers(ObserverEventType::STARTENTERTAIN, entertainer); startEntertaining(); }
void EntertainingSessionImplementation::stopDancing() { ManagedReference<CreatureObject*> entertainer = this->entertainer.get(); if (entertainer == NULL) return; Locker locker(entertainer); if (!dancing) return; dancing = false; entertainer->sendSystemMessage("@performance:dance_stop_self"); performanceName = ""; sendEntertainingUpdate(entertainer, 0.8025000095f, entertainer->getPerformanceAnimation(), 0, 0); if (entertainer->getPosture() == CreaturePosture::SKILLANIMATING) entertainer->setPosture(CreaturePosture::UPRIGHT); ManagedReference<PlayerManager*> playerManager = entertainer->getZoneServer()->getPlayerManager(); while (watchers.size() > 0) { ManagedReference<CreatureObject*> watcher = watchers.elementAt(0).getKey(); Locker clocker(watcher, entertainer); playerManager->stopWatch(watcher, entertainer->getObjectID(), true, true, false); if (!watcher->isWatching()) sendEntertainmentUpdate(watcher, 0, "", true); watchers.drop(watcher); } if (tickTask != NULL && tickTask->isScheduled()) tickTask->cancel(); updateEntertainerMissionStatus(false, MissionObject::DANCER); entertainer->notifyObservers(ObserverEventType::STOPENTERTAIN, entertainer); entertainer->dropObserver(ObserverEventType::POSTURECHANGED, observer); if (!dancing && !playingMusic) { ManagedReference<PlayerObject*> entPlayer = entertainer->getPlayerObject(); if (entPlayer != NULL && entPlayer->getPerformanceBuffTarget() != 0) entPlayer->setPerformanceBuffTarget(0); entertainer->dropActiveSession(SessionFacadeType::ENTERTAINING); } }
void EntertainingSessionImplementation::startDancing(const String& dance, const String& animation) { ManagedReference<CreatureObject*> entertainer = this->entertainer.get(); Locker locker(entertainer); sendEntertainingUpdate(entertainer, /*0x3C4CCCCD*/0.0125, animation, 0x07339FF8, 0xDD); performanceName = dance; dancing = true; entertainer->sendSystemMessage("@performance:dance_start_self"); updateEntertainerMissionStatus(true, MissionObject::DANCER); startEntertaining(); }
void EntertainingSessionImplementation::stopPlayingMusic() { ManagedReference<CreatureObject*> entertainer = this->entertainer.get(); Locker locker(entertainer); if (!playingMusic) return; playingMusic = false; entertainer->sendSystemMessage("@performance:music_stop_self"); sendEntertainingUpdate(entertainer, 0.8025000095f, entertainer->getPerformanceAnimation(), 0, 0); performanceName = ""; entertainer->setListenToID(0); if (entertainer->getPosture() == CreaturePosture::SKILLANIMATING) entertainer->setPosture(CreaturePosture::UPRIGHT); if (externalInstrument != NULL && externalInstrument->isBeingUsed()) externalInstrument->setBeingUsed(false); externalInstrument = NULL; ManagedReference<PlayerManager*> playerManager = entertainer->getZoneServer()->getPlayerManager(); while (listeners.size() > 0) { ManagedReference<CreatureObject*> listener = listeners.elementAt(0).getKey(); Locker clocker(listener, entertainer); playerManager->stopListen(listener, entertainer->getObjectID(), true, true, false); if (!listener->isWatching()) sendEntertainmentUpdate(listener, 0, "", true); listeners.drop(listener); } if (tickTask != NULL && tickTask->isScheduled()) tickTask->cancel(); targetInstrument = false; updateEntertainerMissionStatus(false, MissionObject::MUSICIAN); entertainer->notifyObservers(ObserverEventType::STOPENTERTAIN, entertainer); entertainer->dropObserver(ObserverEventType::POSTURECHANGED, observer); ManagedReference<GroupObject*> group = entertainer->getGroup(); if (group != NULL) { bool otherPlaying = group->isOtherMemberPlayingMusic(entertainer); if (!otherPlaying) { Locker locker(group); group->setBandSong(""); } } if (!dancing && !playingMusic) { ManagedReference<PlayerObject*> entPlayer = entertainer->getPlayerObject(); if (entPlayer != NULL && entPlayer->getPerformanceBuffTarget() != 0) entPlayer->setPerformanceBuffTarget(0); entertainer->dropActiveSession(SessionFacadeType::ENTERTAINING); } }