Planeshift
actionmanager.h
Go to the documentation of this file.
1 /*
2 * actionmanager.h
3 *
4 * Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5 *
6 * Credits :
7 * Michael Cummings <cummings.michael@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation (version 2
12 * of the License).
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Creation Date: 1/20/2005
22 * Description : server manager for clickable map object actions
23 *
24 */
25 #ifndef __ACTIONMANAGER_H__
26 #define __ACTIONMANAGER_H__
27 
28 //=============================================================================
29 // Crystal Space Includes
30 //=============================================================================
31 #include <csutil/ref.h>
32 
33 //=============================================================================
34 // Project Includes
35 //=============================================================================
36 #include "util/gameevent.h"
37 
38 //=============================================================================
39 // Local Includes
40 //=============================================================================
41 #include "msgmanager.h" // Parent class
42 #include "scripting.h"
43 
44 
45 class psDatabase;
46 class SpawnManager;
47 class psServer;
48 class psDatabase;
50 class psActionLocation;
51 class ActionManager;
52 class psSectorInfo;
53 class Client;
54 class gemActionLocation;
55 class gemActor;
56 
65 {
66 public:
75 
80 
84  virtual void Trigger();
85  virtual bool IsValid()
86  {
87  return valid;
88  }
89 
90 protected:
92  bool valid;
93 
94  EID actorEID;
96 };
97 
98 
99 //----------------------------------------------------------------------------
100 
107 class ActionManager : public MessageManager<ActionManager>
108 {
109 public:
110 
115 
119  virtual ~ActionManager();
120 
126  bool RepopulateActionLocations(psSectorInfo* sectorinfo = 0);
127 
133  bool CacheActionLocation(psActionLocation* action);
134 
141  void HandleMapAction(MsgEntry* msg, Client* client);
142 
147  bool HandleUse(gemActionLocation* actionlocation, Client* client);
148 
155  void RemoveActiveTrigger(EID actorEID, const psActionLocation* actionLocation);
156 
163  bool HasActiveTrigger(EID actorEID, const psActionLocation* actionLocation);
164 
171  void AddActiveTrigger(EID actorEID, const psActionLocation* actionLocation);
172 
178  psActionLocation* FindAction(EID id);
179 
185  psActionLocation* FindActionByID(uint32 id);
186 
192  psActionLocation* FindAvailableEntrances(csString entranceSector);
193 
197  void NotifyProximity(gemActor* actor, gemActionLocation* actionLocationObject, float range);
198 
199 protected:
200 
201  // Message Handlers
202 
209  void HandleQueryMessage(csString xml, Client* client);
210 
211  void LoadXML(iDocumentNode* topNode);
212  bool HandleSelectQuery(iDocumentNode* topNode, Client* client);
213  bool ProcessMatches(csArray<psActionLocation*> matches, Client* client);
214 
221  void HandleSaveMessage(csString xml, Client* client);
222 
229  void HandleListMessage(csString xml, Client* client);
230 
237  void HandleDeleteMessage(csString xml, Client* client);
238 
244  void HandleReloadMessage(Client* client);
245 
246  // Operation Handlers
247 
254  void HandleExamineOperation(psActionLocation* action, Client* client);
255 
262  void HandleScriptOperation(psActionLocation* action, gemActor* actor);
263 
264  // Current action location data
265  csString triggerType;
266  csString sectorName;
267  csString meshName;
268  csVector3 position;
269 
270 
272  csHash<psActionLocation*> actionLocationList;
273  csHash<psActionLocation*> actionLocation_by_name;
274  csHash<psActionLocation*> actionLocation_by_sector;
275  csHash<psActionLocation*, uint32> actionLocation_by_id;
276  csHash<const psActionLocation*> activeTriggers;
277 
278 };
279 
280 #endif
const psActionLocation * actionLocation
The action location.
Definition: actionmanager.h:95
csHash< psActionLocation * > actionLocation_by_sector
bool valid
Is this trigger still valid.
Definition: actionmanager.h:92
csHash< psActionLocation *, uint32 > actionLocation_by_id
csString meshName
csHash< const psActionLocation * > activeTriggers
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
~psActionTimeoutGameEvent()
Destructor.
The main server class.
Definition: psserver.h:102
virtual void Trigger()
Abstract event processing function.
csString triggerType
Any semi-autonomous object, either a player or an NPC.
Definition: gem.h:1170
iDataConnection * db
Global connection to the Database. Set from the psDatabase class.
ActionManager * actionManager
Reference to the action manager.
Definition: actionmanager.h:91
This is PlaneShift&#39;s XML based scripting system.
psActionTimeoutGameEvent(ActionManager *mgr, const psActionLocation *actionLocation, EID actorEID)
Constructor.
This class collects data of a netclient.
Definition: client.h:95
Time out event on interacting with an action item.
Definition: actionmanager.h:64
csString sectorName
Handles the map interaction system.
virtual bool IsValid()
Return the valid flag.
Definition: actionmanager.h:85
EID actorEID
Reference to the actor.
Definition: actionmanager.h:94
This class stores all the properties of an action location Entrance, return location, name, response type, trigger.
csHash< psActionLocation * > actionLocation_by_name
psDatabase * database
This class is a list of several CLient objects, it&#39;s designed for finding clients very fast based on ...
Definition: clients.h:58
Contains information about sectors from the server perspective.
Definition: pssectorinfo.h:46
All scheduled events must inherit from this class.
Definition: gameevent.h:36
csHash< psActionLocation * > actionLocationList
csVector3 position
This class is periodically called by the engine to ensure that monsters (and other NPCs) are respawne...
Definition: spawnmanager.h:283
Provides a manager to facilitate subscriptions.
Definition: msgmanager.h:106