Planeshift

hiresession.h

Go to the documentation of this file.
00001 /*
00002  * hiresession.h  creator <[email protected]>
00003  *
00004  * Copyright (C) 2013 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 HIRE_SESSION_HEADER
00020 #define HIRE_SESSION_HEADER
00021 //====================================================================================
00022 // Crystal Space Includes
00023 //====================================================================================
00024 
00025 //====================================================================================
00026 // Project Includes
00027 //====================================================================================
00028 
00029 //====================================================================================
00030 // Local Includes
00031 //====================================================================================
00032 #include <gem.h>
00033 
00034 //------------------------------------------------------------------------------------
00035 // Forward Declarations
00036 //------------------------------------------------------------------------------------
00037 
00045 class HireSession
00046 {
00047 public:
00050     HireSession();
00051 
00056     HireSession(gemActor* owner);
00057 
00060     virtual ~HireSession();
00061 
00064     bool Load(iResultRow &row);
00065 
00070     bool Save(bool newSession = false);
00071 
00074     bool Delete();
00075 
00081     void SetHireType(const csString &name, const csString &npcType);
00082 
00087     const csString &GetHireTypeName() const;
00088 
00093     const csString &GetHireTypeNPCType() const;
00094 
00099     void SetMasterPID(PID masterPID);
00100 
00105     PID GetMasterPID() const;
00106 
00111     void SetOwner(gemActor* owner);
00112 
00115     gemActor* GetOwner() const;
00116 
00121     void SetHiredNPC(gemNPC* hiredNPC);
00122 
00125     gemNPC* GetHiredNPC() const;
00126 
00131     bool VerifyPendingHireConfigured();
00132 
00137     PID GetOwnerPID();
00138 
00143     PID GetHiredPID();
00144 
00147     const csString &GetScript() const;
00148 
00151     void SetScript(const csString &newScript);
00152 
00155     int GetWorkLocationId();
00156 
00159     Location* GetWorkLocation();
00160 
00163     void SetWorkLocation(Location* location);
00164 
00167     bool IsVerified();
00168 
00171     void SetVerified(bool state);
00172 
00173 
00176     const csString &GetVerifiedScript() const;
00177 
00180     void SetVerifiedScript(const csString &newVerifiedScript);
00181 
00184     csString GetWorkLocationString();
00185 
00188     csString GetTempWorkLocationString();
00189 
00192     Location* GetTempWorkLocation();
00193 
00196     void SetTempWorkLocation(Location* location);
00197 
00200     void SetTempWorkLocationValid(bool valid);
00201 
00204     bool GetTempWorkLocationValid();
00205 
00208     int ApplyScript();
00209 
00212     bool ShouldLoad();
00213 
00214 protected:
00215 private:
00216     PID                 ownerPID;           
00217     PID                 hiredPID;           
00218     bool                guild;              
00219     csString            script;             
00220     int                 workLocationID;     
00221 
00222     // Data for pending hires.
00223     csString            hireTypeName;       
00224     csString            hireTypeNPCType;    
00225     PID                 masterPID;          
00226 
00227     // Data for pending confirmation of verified scripts.
00228     bool                verified;           
00229     csString            verifiedScript;     
00230     Location*           tempWorkLocation;   
00231     bool                tempWorkLocationValid; 
00232 
00233     csWeakRef<gemActor> owner;              
00234     csWeakRef<gemNPC>   hiredNPC;           
00235     Location*           workLocation;       
00236     bool                shouldLoad;         
00237 };
00238 
00239 #endif