Planeshift

serversongmngr.h

Go to the documentation of this file.
00001 /*
00002  * serversongmngr.h, Author: Andrea Rizzi <[email protected]>
00003  *
00004  * Copyright (C) 2001-2011 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef SERVER_SONG_MANAGER_H
00021 #define SERVER_SONG_MANAGER_H
00022 
00023 
00024 //====================================================================================
00025 // Project Includes
00026 //====================================================================================
00027 #include <util/gameevent.h>
00028 
00029 //====================================================================================
00030 // Local Includes
00031 //====================================================================================
00032 #include "msgmanager.h"
00033 
00034 //------------------------------------------------------------------------------------
00035 // Forward Declarations
00036 //------------------------------------------------------------------------------------
00037 class psItem;
00038 class MathScript;
00039 class psCharacter;
00040 struct ScoreStatistics;
00041 
00042 
00046 class psEndSongEvent: public psGameEvent
00047 {
00048 public:
00054     psEndSongEvent(gemActor* charActor, int songLength);
00055 
00059     virtual ~psEndSongEvent();
00060 
00061 
00062     //From psGameEvent
00063     //------------------
00064     virtual bool CheckTrigger();
00065     virtual void Trigger();
00066 
00067 private:
00068     gemActor* charActor;        
00069     csTicks startingTime;       
00070 };
00071 
00072 
00073 //--------------------------------------------------
00074 
00075 
00080 class ServerSongManager: public MessageManager<ServerSongManager>, public Singleton<ServerSongManager>
00081 {
00082 public:
00083     ServerSongManager();    
00084     ~ServerSongManager();   
00085 
00086     bool Initialize();
00087 
00093     void HandlePlaySongMessage(MsgEntry* me, Client* client);
00094 
00100     void HandleStopSongMessage(MsgEntry* me, Client* client);
00101 
00108     void OnStopSong(gemActor* charActor, bool isEnded);
00109 
00119     void StopSong(gemActor* charActor, bool skillRanking);
00120 
00121 private:
00122     bool isProcessedSongEnded;                         
00123     MathScript* calcSongPar;                 
00124     MathScript* calcSongExp;                 
00125     unsigned int instrumentsCategory;                  
00126     csHash<int, unsigned int> scoreRanks;              
00127 
00133     psItem* GetEquippedInstrument(psCharacter* charData) const;
00134 };
00135 
00136 #endif // SERVER_SONG_MANAGER_H
00137