Planeshift

events.h

Go to the documentation of this file.
00001 /*
00002  * events.h
00003  *
00004  * Copyright (C) 2004 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  * Author: Keith Fulton <[email protected]>
00019  */
00020 
00021 #ifndef EVENTS_H_Z
00022 #define EVENTS_H_Z
00023 
00024 //=============================================================================
00025 // Crystal Space Includes
00026 //=============================================================================
00027 
00028 //=============================================================================
00029 // Project Includes
00030 //=============================================================================
00031 #include "net/messages.h"
00032 #include "economymanager.h"
00033 
00034 //=============================================================================
00035 // Local Includes
00036 //=============================================================================
00037 
00038 
00039 class gemActor;
00040 class gemObject;
00041 
00042 class psDamageEvent : public psMessageCracker
00043 {
00044 public:
00045     gemActor* attacker;
00046     gemActor* target;
00047     float     damage;
00048 
00049     psDamageEvent(gemActor* attack,gemActor* victim,float dmg);
00050     psDamageEvent(MsgEntry* event);
00051 
00052     PSF_DECLARE_MSG_FACTORY();
00053 
00060     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00061 };
00062 
00063 
00064 class psDeathEvent : public psMessageCracker
00065 {
00066 public:
00067     gemActor* deadActor;
00068     gemActor* killer;
00069 
00070     psDeathEvent(gemActor* dead, gemActor* killer);
00071     psDeathEvent(MsgEntry* event);
00072 
00073     PSF_DECLARE_MSG_FACTORY();
00074 
00081     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00082 };
00083 
00084 
00085 class psTargetChangeEvent : public psMessageCracker
00086 {
00087 public:
00088     gemActor* character;
00089     gemObject* target;
00090 
00091     psTargetChangeEvent(gemActor* targeter, gemObject* targeted);
00092     psTargetChangeEvent(MsgEntry* event);
00093 
00094     PSF_DECLARE_MSG_FACTORY();
00095 
00102     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00103 };
00104 
00105 
00108 class psZPointsGainedEvent : public psMessageCracker
00109 {
00110 public:
00111     psZPointsGainedEvent(gemActor* actor, const char* name, int gained, bool rankup);
00112     psZPointsGainedEvent(MsgEntry* event);
00113 
00114     PSF_DECLARE_MSG_FACTORY();
00115 
00122     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00123 
00124 public:
00125     gemActor* actor;        
00126     int amountGained;       
00127     bool rankUp;            
00128     csString skillName;     
00129 };
00130 
00131 
00132 class psBuyEvent : public psMessageCracker
00133 {
00134 public:
00135     psBuyEvent(PID from, const char* fromName, PID to, const char* toName, unsigned int item, const char* itemName, int stack, int quality, unsigned int price);
00136     psBuyEvent(MsgEntry* event);
00137 
00138     PSF_DECLARE_MSG_FACTORY();
00139 
00146     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00147 
00151     csRef<TransactionEntity> trans;
00152 };
00153 
00154 
00155 class psSellEvent : public psMessageCracker
00156 {
00157 public:
00158     psSellEvent(PID from, const char* fromName, PID to, const char* toName, unsigned int item, const char* itemName, int stack, int quality, unsigned int price);
00159     psSellEvent(MsgEntry* event);
00160 
00161     PSF_DECLARE_MSG_FACTORY();
00162 
00169     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00170 
00174     csRef<TransactionEntity> trans;
00175 };
00176 class psPickupEvent : public psMessageCracker
00177 {
00178 public:
00179     psPickupEvent(PID to, const char* toName, unsigned int item, const char* itemName, int stack, int quality,unsigned int price);
00180     psPickupEvent(MsgEntry* event);
00181 
00182     PSF_DECLARE_MSG_FACTORY();
00183 
00190     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00191 
00195     csRef<TransactionEntity> trans;
00196 };
00197 
00198 class psDropEvent : public psMessageCracker
00199 {
00200 public:
00201     psDropEvent(PID from, const char* fromName, unsigned int item, const char* itemName, int stack, int quality,unsigned int price);
00202     psDropEvent(MsgEntry* event);
00203 
00204     PSF_DECLARE_MSG_FACTORY();
00205 
00212     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00213 
00217     csRef<TransactionEntity> trans;
00218 };
00219 
00220 class psLootEvent : public psMessageCracker
00221 {
00222 public:
00223     psLootEvent(PID from, const char* fromName, PID to, const char* toName, unsigned int item, const char* itemName, int stack, int quality, unsigned int price);
00224     psLootEvent(MsgEntry* event);
00225 
00226     PSF_DECLARE_MSG_FACTORY();
00227 
00234     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00235 
00239     csRef<TransactionEntity> trans;
00240 };
00241 
00242 
00247 class psConnectEvent : public psMessageCracker
00248 {
00249 protected:
00250     int client_id;
00251 
00252 public:
00253     psConnectEvent(int clientID);
00254     psConnectEvent(MsgEntry* event);
00255 
00256     PSF_DECLARE_MSG_FACTORY();
00257 
00264     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00265 };
00266 
00267 
00272 class psMovementEvent : public psMessageCracker
00273 {
00274 protected:
00275     int client_id;
00276 
00277 public:
00278     psMovementEvent(int clientID);
00279     psMovementEvent(MsgEntry* event);
00280 
00281     PSF_DECLARE_MSG_FACTORY();
00282 
00289     virtual csString ToString(NetBase::AccessPointers*  accessPointers);
00290 };
00291 
00292 
00297 class psGenericEvent : public psMessageCracker
00298 {
00299 public:
00300     enum Type
00301     {
00302         UNKNOWN=0,
00303         QUEST_ASSIGN,
00304         SPAWN_MOVE
00305     };
00306 
00307     Type eventType;
00308     int client_id;
00309 
00310 
00311     psGenericEvent(int clientID, psGenericEvent::Type type);
00312     psGenericEvent(MsgEntry* event);
00313 
00314     PSF_DECLARE_MSG_FACTORY();
00315 
00322     virtual csString ToString(NetBase::AccessPointers* accessPointers);
00323 
00324 };
00325 
00326 #endif