Planeshift
|
00001 /* 00002 * psquest.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 00020 #ifndef __PSQUEST_H__ 00021 #define __PSQUEST_H__ 00022 //============================================================================= 00023 // Crystal Space Includes 00024 //============================================================================= 00025 #include <csutil/csstring.h> 00026 #include <csutil/weakreferenced.h> 00027 00028 //============================================================================= 00029 // Project Includes 00030 //============================================================================= 00031 #include <idal.h> 00032 00033 //============================================================================= 00034 // Local Includes 00035 //============================================================================= 00036 00037 using namespace CS; 00038 00039 00040 #define QUEST_OPT_SAVEONCOMPLETE 0x01 00041 00043 #define PSQUEST_DISABLED_QUEST 0x00000001 00044 00045 00046 class psQuestPrereqOp; 00047 class psCharacter; 00048 class NpcResponse; 00049 class NpcTrigger; 00050 class NpcDialogMenu; 00051 class psQuest; 00052 00061 bool LoadPrerequisiteXML(csRef<psQuestPrereqOp> &prerequisite, psQuest* self, csString script); 00062 00066 class psQuest : public CS::Utility::WeakReferenced 00067 { 00068 public: 00075 psQuest(int id = 0, const char* name = ""); 00076 virtual ~psQuest(); 00077 00082 bool Load(iResultRow &row); 00086 bool PostLoad(); 00087 00094 int GetID() const 00095 { 00096 return id; 00097 } 00101 const char* GetName() const 00102 { 00103 return name; 00104 } 00105 const char* GetImage() const 00106 { 00107 return image; 00108 } 00109 const char* GetTask() const 00110 { 00111 return task; 00112 } 00113 00119 bool hasTaskText() 00120 { 00121 return task.Length() > 0; 00122 } 00123 void SetTask(csString mytask) 00124 { 00125 task = mytask; 00126 } 00127 psQuest* GetParentQuest() const 00128 { 00129 return parent_quest; 00130 } 00131 void SetParentQuest(psQuest* parent) 00132 { 00133 parent_quest=parent; 00134 } 00135 int GetStep() const 00136 { 00137 return step_id; 00138 } 00139 bool HasInfinitePlayerLockout() const 00140 { 00141 return infinitePlayerLockout; 00142 } 00143 unsigned int GetPlayerLockoutTime() const 00144 { 00145 return player_lockout_time; 00146 } 00147 unsigned int GetQuestLockoutTime() const 00148 { 00149 return quest_lockout_time; 00150 } 00151 unsigned int GetQuestLastActivatedTime() const 00152 { 00153 return quest_last_activated; 00154 } 00155 void SetQuestLastActivatedTime(unsigned int when) 00156 { 00157 quest_last_activated=when; 00158 } 00159 // csString QuestToXML() const; 00160 bool AddPrerequisite(csString prerequisitescript); 00161 bool AddPrerequisite(csRef<psQuestPrereqOp> op); 00162 00170 void AddTriggerResponse(NpcTrigger* trigger, NpcResponse* response); 00177 //void AddMenu(NpcDialogMenu* menu); 00178 00179 //csArray<NpcDialogMenu*> &GetMenuList(); 00180 00187 void AddSubQuest(int id) 00188 { 00189 subquests.Push(id); 00190 } 00191 00197 csArray<int> &GetSubQuests() 00198 { 00199 return subquests; 00200 } 00201 00207 csRef<psQuestPrereqOp>& GetPrerequisite() 00208 { 00209 return prerequisite; 00210 } 00211 csString GetPrerequisiteStr(); 00212 const csString &GetCategory() const 00213 { 00214 return category; 00215 } 00216 00225 bool Active() 00226 { 00227 return active ? (parent_quest ? parent_quest->Active() : active) : active; 00228 } 00229 00233 void Active(bool state) 00234 { 00235 active = state; 00236 } 00237 00238 protected: 00239 int id; 00240 csString name; 00241 csString task; 00242 csString image; 00243 int flags; 00244 psQuest* parent_quest; 00245 int step_id; 00246 csRef<psQuestPrereqOp> prerequisite; 00247 csString category; 00248 csString prerequisiteStr; 00249 bool infinitePlayerLockout; 00250 00251 unsigned int player_lockout_time; 00252 unsigned int quest_lockout_time; 00253 unsigned int quest_last_activated; 00254 00255 struct TriggerResponse 00256 { 00257 NpcTrigger* trigger; 00258 int responseID; 00259 }; 00260 00261 // this stuff is needed for cleanup when destroying the object 00262 csArray<TriggerResponse> triggerPairs; 00263 csArray<int> subquests; 00264 00265 bool active; 00266 }; 00267 00268 #endif