Planeshift

paladinjr.h

Go to the documentation of this file.
00001 /*
00002  * paladinjr.h - Author: Andrew Dai
00003  *
00004  * Copyright (C) 2002 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 __PALADIN_H__
00021 #define __PALADIN_H__
00022 //#define PALADIN_DEBUG
00023 
00024 #include <iutil/cfgmgr.h>
00025 
00026 #ifdef PALADIN_DEBUG
00027 #define PALADIN_MAX_SWITCH_TIME 0
00028 #else
00029 #define PALADIN_MAX_SWITCH_TIME 5000
00030 #endif
00031 
00032 #define PALADIN_VERSION "0.13"
00033 
00034 class PaladinJr
00035 {
00036 public:
00037 
00039     bool ValidateMovement(Client* client, gemActor* actor, psDRMessage &drmsg);
00040 
00044     bool CheckCollDetection(Client* client, gemActor* actor);
00045 
00046     void Initialize(EntityManager* celbase, CacheManager* cachemanager);
00047 
00048     ~PaladinJr()
00049     {  }
00050 
00051     bool IsEnabled()
00052     {
00053         return enabled;
00054     }
00055 
00056 private:
00057 
00058     enum // possible cheat checks as bitmask
00059     {
00060         NOVIOLATION    = 0x0,
00061         WARPVIOLATION  = 0x1,
00062         SPEEDVIOLATION = 0x2,
00063         DISTVIOLATION  = 0x4,
00064         CDVIOLATION    = 0x8
00065     };
00066 
00067     bool enabled;
00068     bool enforcing;
00069     int checks; 
00070     unsigned int watchTime;
00071     unsigned int warnCount; 
00072     unsigned int maxCount; 
00073 
00074     bool SpeedCheck(Client* client, gemActor* actor, psDRMessage &currUpdate);
00075 
00076 
00077     EntityManager*         entitymanager;
00078 
00080     csSet<uint32_t> checked;
00081 
00083     Client* target;
00084 
00086     csTicks started;
00087 
00089     csVector3 predictedPos;
00090 
00092     csVector3 origPos;
00093     csVector3 vel;
00094     csVector3 angVel;
00095 
00097     csVector3 maxmove;
00098 
00100     bool checkClient;
00101 
00103     psDRMessage lastUpdate;
00104 
00106     csVector3 maxVelocity;
00107 
00109     float maxSpeed;
00110 };
00111 
00112 
00113 #endif