Planeshift

progressionmanager.h

Go to the documentation of this file.
00001 /*
00002  * progressionmanager.h
00003  *
00004  * Copyright (C) 2003 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 #ifndef __PROGRESSIONMANAGER_H__
00020 #define __PROGRESSIONMANAGER_H__
00021 
00022 //=============================================================================
00023 // Crystal Space Includes
00024 //=============================================================================
00025 #include <csutil/array.h>
00026 #include <csutil/hash.h>
00027 #include <iutil/document.h>
00028 
00029 //=============================================================================
00030 // Library Includes
00031 //=============================================================================
00032 #include "util/gameevent.h"
00033 
00034 #include "bulkobjects/psskills.h"
00035 
00036 //=============================================================================
00037 // Application Includes
00038 //=============================================================================
00039 #include "msgmanager.h"                 // Subscriber class
00040 
00041 class psCharacter;
00042 class ProgressionScript;
00043 
00048 class ProgressionManager : public MessageManager<ProgressionManager>
00049 {
00050 public:
00051 
00052     ProgressionManager(ClientConnectionSet* ccs, CacheManager* cachemanager);
00053 
00054     virtual ~ProgressionManager();
00055 
00064     void SendSkillList(Client* client, bool forceOpen, PSSKILL focus = PSSKILL_NONE, bool isTraining = false);
00065 
00066     void StartTraining(Client* client, psCharacter* trainer);
00067 
00068     csHash<csString, csString> &GetAffinityCategories()
00069     {
00070         return affinitycategories;
00071     }
00072 
00073     // Internal utility functions for the progression system
00074     void QueueEvent(psGameEvent* event);
00075     void SendMessage(MsgEntry* me);
00076     void Broadcast(MsgEntry* me);
00077 
00078     ProgressionScript* FindScript(char const* name);
00079 
00083     bool Initialize(iObjectRegistry* object_reg);
00084 
00085     bool progressionRequiresTraining;
00086     int progressionMaxSkillValue;
00087     int progressionMaxStatValue;
00088 
00089 protected:
00090 
00091     void HandleSkill(MsgEntry* me, Client* client);
00092     void HandleDeathEvent(MsgEntry* me, Client* notused);
00093     void HandleZPointEvent(MsgEntry* me, Client* client);
00094 
00095     void AllocateKillDamage(gemActor* deadActor, int exp);
00096 
00097     csHash<csString, csString> affinitycategories;
00098     ClientConnectionSet*    clients;
00099     MathScript* calc_dynamic_experience; 
00100     CacheManager* cacheManager;
00101 };
00102 
00105 #endif
00106