/* EQ2Emulator: Everquest II Server Emulator Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net) This file is part of EQ2Emulator. EQ2Emulator 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, either version 3 of the License, or (at your option) any later version. EQ2Emulator 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 EQ2Emulator. If not, see . */ #ifndef __Traits__ #define __Traits__ #include #include #include "../../common/Mutex.h" #include "../../common/types.h" #include "../../common/EQPacket.h" class Client; struct TraitData { int32 spellID; int8 level; int8 classReq; int8 raceReq; bool isTrait; bool isInate; bool isFocusEffect; bool isTraining; int8 tier; int8 group; int32 item_id; }; #define TRAITS_ATTRIBUTES 0 #define TRAITS_COMBAT 1 #define TRAITS_NONCOMBAT 2 #define TRAITS_POOLS 3 #define TRAITS_RESIST 4 #define TRAITS_TRADESKILL 5 class MasterTraitList { public: MasterTraitList(); ~MasterTraitList(); bool IdentifyNextTrait(Client* client, map >* traitList, vector* collectTraits, vector* tieredTraits, std::map* previousMatchedSpells, bool omitFoundMatches = false); bool ChooseNextTrait(Client* client); int16 GetSpellCount(Client* client, map >* traits, bool onlyCharTraits = false); bool IsPlayerAllowedTrait(Client* client, TraitData* trait); bool GenerateTraitLists(Client* client, map > >* sortedTraitList, map >* classTraining, map >* raceTraits, map >* innateRaceTraits, map >* focusEffects, int16 max_level = 0, int8 trait_group = 255); /// Sorts the traits for the given client and creats and sends the trait packet. /// The Client calling this function /// EQ2Packet* EQ2Packet* GetTraitListPacket(Client* client); /// Add trait data to the global list. /// The trait data to add. void AddTrait(TraitData* data); /// Get the total number of traits in the global list. int Size(); /// Get the trait data for the given spell. /// Spell ID to get trait data for. TraitData* GetTrait(int32 spellID); /// Get the trait data for the given item. /// Item ID to map to the trait data. TraitData* GetTraitByItemID(int32 itemID); /// Empties the master trait list void DestroyTraits(); private: vector TraitList; Mutex MMasterTraitList; }; #endif