CObjectHandler.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef COBJECTHANDLER_H
  2. #define COBJECTHANDLER_H
  3. #include <string>
  4. #include <vector>
  5. #include "CCreatureHandler.h"
  6. #include "CArtHandler.h"
  7. #include "CAbilityHandler.h"
  8. #include "CSpellHandler.h"
  9. #include "CHeroHandler.h"
  10. class CSpecObjInfo //class with object - specific info (eg. different information for creatures and heroes); use inheritance to make object - specific classes
  11. {
  12. };
  13. class CEventObjInfo : public CSpecObjInfo
  14. {
  15. public:
  16. bool areGuarders; //true if there are
  17. CCreatureSet guarders;
  18. bool isMessage; //true if there is a message
  19. std::string message;
  20. unsigned int gainedExp;
  21. int manaDiff; //amount of gained / lost mana
  22. int moraleDiff; //morale modifier
  23. int luckDiff; //luck modifier
  24. int wood, mercury, ore, sulfur, crystal, gems, gold; //gained / lost resources
  25. unsigned int attack; //added attack points
  26. unsigned int defence; //added defence points
  27. unsigned int power; //added power points
  28. unsigned int knowledge; //added knowledge points
  29. std::vector<CAbility *> abilities; //gained abilities
  30. std::vector<int> abilityLevels; //levels of gained abilities
  31. std::vector<CArtifact *> artifacts; //gained artifacts
  32. std::vector<CSpell *> spells; //gained spells
  33. CCreatureSet creatures; //gained creatures
  34. unsigned char availableFor; //players whom this event is available for
  35. bool computerActivate; //true if computre player can activate this event
  36. bool humanActivate; //true if human player can activate this event
  37. };
  38. class CHeroObjInfo : public CSpecObjInfo
  39. {
  40. public:
  41. char bytes[4]; //mysterius bytes identifying hero in a strange way
  42. int player;
  43. CHero * type;
  44. std::string name; //if nonstandard
  45. bool standardGarrison; //true if hero has standard garrison
  46. CCreatureSet garrison; //hero's army
  47. std::vector<CArtifact *> artifacts; //hero's artifacts from bag
  48. CArtifact * artHead, * artLRing, * artRRing, * artLHand, * artRhand, * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck, * artShoulders; //working artifacts
  49. bool isGuarding;
  50. int guardRange; //range of hero's guard
  51. std::string biography; //if nonstandard
  52. bool sex; //if true, reverse hero's sex
  53. std::vector<CSpell *> spells; //hero's spells
  54. int attack, defence, power, knowledge; //main hero's attributes
  55. unsigned int experience; //hero's experience points
  56. std::vector<CAbility *> abilities; //hero's abilities
  57. std::vector<int> abilityLevels; //hero ability levels
  58. };
  59. class CObject //typical object that can be encountered on a map
  60. {
  61. public:
  62. std::string name; //object's name
  63. };
  64. class CObjectInstance //instance of object
  65. {
  66. public:
  67. int defNumber; //specifies number of def file with animation of this object
  68. int id; //number of object in CObjectHandler's vector
  69. int x, y, z; // position
  70. CSpecObjInfo * info; //pointer to something with additional information
  71. };
  72. class CObjectHandler
  73. {
  74. public:
  75. std::vector<CObject> objects; //vector of objects; i-th object in vector has subnumber i
  76. std::vector<CObjectInstance> objInstances; //vector with objects on map
  77. void loadObjects();
  78. };
  79. #endif //COBJECTHANDLER_H