/* * questmanager.h * * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org) * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation (version 2 of the License) * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef __QUESTMANAGER_H__ #define __QUESTMANAGER_H__ #include "msgmanager.h" // Subscriber class #include "net/messages.h" // Message definitions #include "net/msghandler.h" // Network access #include "util/eventmanager.h" #include "bulkobjects/psquest.h" class Client; class psItemStats; struct QuestRewardOffer { int clientID; csArray items; }; class gemNPC; class NpcResponse; class WordArray; /** * This class handles quest management for the player, * tracking who has what quests assigned, etc. */ class QuestManager : public MessageManager { protected: csArray offers; /** * Load all scripts from db */ bool LoadQuestScripts(); bool ParseQuestScript(int id,const char *script); bool GetResponseText(csString& block,csString& response,csString& error, csString& him, csString& her, csString& it, csString& them); bool BuildTriggerList(csString& block,csStringArray& list); bool ParseItemList(WordArray& words,size_t startWord,csString& itemlist); int GetNPCFromBlock(WordArray words,csString& current_npc); void FormatItem(csString& itemlist,size_t count, csString& item_name); NpcResponse *AddResponse(csString& current_npc,const char *response_text, int& last_response_id, psQuest * quest, csString him, csString her, csString it, csString them); bool AddTrigger(csString& current_npc,const char *trigger, int prior_response_id,int trig_response, psQuest* quest); public: QuestManager(); virtual ~QuestManager(); bool Initialize(); virtual void HandleMessage(MsgEntry *pMsg,Client *client); void Assign(psQuest *quest, Client *who, gemNPC *assigner); bool Complete(psQuest *quest, Client *who); void OfferRewardsToPlayer(Client *who, csArray &offer); bool GiveRewardToPlayer(Client *who, psItemStats* item); bool LoadQuestScript(int id); }; #endif