/* * pstrade.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 __PSTRADE_H__ #define __PSTRADE_H__ #include #include "../iserver/idal.h" class psTradeCombinations; //----------------------------------------------------------------------------- /** Each item has a list of items required for its construction.*/ struct CombinationConstruction { uint32 resultItem; int resultQuantity; csPDelArray combinations; }; //----------------------------------------------------------------------------- /** Item Combinations stored by pattern ID's. */ struct CombinationSet { unsigned int patternID; csPDelArray set; }; //----------------------------------------------------------------------------- /** * This class holds the master list of all trade combinations possible in the game. */ class psTradeCombinations { public: psTradeCombinations(); ~psTradeCombinations(); bool Load(iResultRow& row); uint32 GetId() const { return id; } uint32 GetPatternId() const { return patternId; } uint32 GetResultId() const { return resultId; } int GetResultQty() const { return resultQty; } uint32 GetItemId() const { return itemId; } int GetMinQty() const { return minQty; } int GetMaxQty() const { return maxQty; } protected: uint32 id; uint32 patternId; uint32 resultId; int resultQty; uint32 itemId; int minQty; int maxQty; }; /** * This class holds the master list of all trade transformatations possible in the game. * This class is read only since it is cached and shared by multiple users. */ class psTradeTransformations { public: psTradeTransformations(); psTradeTransformations(uint32 rId, int rQty, uint32 iId, int iQty, int tPoints); ~psTradeTransformations(); bool Load(iResultRow& row); uint32 GetId() const { return id; } uint32 GetPatternId() const { return patternId; } uint32 GetProcessId() const { return processId; } uint32 GetResultId() const { return resultId; } int GetResultQty() const { return resultQty; } uint32 GetItemId() const { return itemId; } void SetItemId(uint32 newItemId) { itemId = newItemId; } int GetItemQty() const { return itemQty; } void SetItemQty(int newItemQty) { itemQty = newItemQty; } float GetItemQualityPeniltyPercent() const { return peniltyPct; } int GetTransPoints() const { return transPoints; } // Cache flag is used for garbage collection // If true transformation is cached and should not be deleted after use // otherwise it needs to be cleaned up int GetTransformationCacheFlag() { return transCached; } protected: uint32 id; uint32 patternId; uint32 processId; uint32 resultId; int resultQty; uint32 itemId; int itemQty; float peniltyPct; int transPoints; private: // Cache flag is used for garbage collection // If true transformation is cached and should not be deleted after use // otherwise it needs to be cleaned up bool transCached; }; /** * This class holds the master list of all trade processes possible in the game. * This class is read only since it is cached and shared by multiple users. */ class psTradeProcesses { public: psTradeProcesses(); ~psTradeProcesses(); bool Load(iResultRow& row); uint32 GetProcessId() const { return processId; } csString GetAnimation() const { return animation; } uint32 GetWorkItemId() const { return workItemId; } uint32 GetEquipementId() const { return equipmentId; } const char* GetConstraintString() const { return constraints; } uint32 GetGarbageId() const { return garbageId; } int GetGarbageQty() const { return garbageQty; } int GetPrimarySkillId() const { return priSkillId; } int GetMinPrimarySkill() const { return minPriSkill; } int GetMaxPrimarySkill() const { return maxPriSkill; } int GetPrimaryPracticePts() const { return priPracticePts; } int GetPrimaryQualFactor() const { return priQualFactor; } int GetSecondarySkillId() const { return secSkillId; } int GetMinSecondarySkill() const { return minSecSkill; } int GetMaxSecondarySkill() const { return maxSecSkill; } int GetSecondaryPracticePts() const { return secPracticePts; } int GetSecondaryQualFactor() const { return secQualFactor; } csString& GetRenderEffect() { return renderEffect; } protected: uint32 processId; csString animation; uint32 workItemId; uint32 equipmentId; csString constraints; uint32 garbageId; int garbageQty; int priSkillId; int minPriSkill; int maxPriSkill; int priPracticePts; int priQualFactor; int secSkillId; int minSecSkill; int maxSecSkill; int secPracticePts; int secQualFactor; csString renderEffect; }; /** * This class holds the master list of all trade patterns possible in the game. */ class psTradePatterns { public: psTradePatterns(); ~psTradePatterns(); bool Load(iResultRow& row); uint32 GetId() const { return id; } uint32 GetGroupPatternId() const { return groupPatternId; } const char* GetPatternString() const { return patternName; } uint32 GetDesignItemId() const { return designItemId; } float GetKFactor() const { return KFactor; } protected: uint32 id; uint32 groupPatternId; csString patternName; uint32 designItemId; float KFactor; }; #endif