1 #ifndef OPENMW_ESM_WEAP_H 2 #define OPENMW_ESM_WEAP_H 3 4 #include <string> 5 6 #include "loadskil.hpp" 7 8 namespace ESM 9 { 10 11 class ESMReader; 12 class ESMWriter; 13 14 /* 15 * Weapon definition 16 */ 17 18 struct Weapon 19 { 20 static unsigned int sRecordId; 21 /// Return a string descriptor for this record type. Currently used for debugging / error logs only. getRecordTypeESM::Weapon22 static std::string getRecordType() { return "Weapon"; } 23 24 enum Type 25 { 26 PickProbe = -4, 27 HandToHand = -3, 28 Spell = -2, 29 None = -1, 30 ShortBladeOneHand = 0, 31 LongBladeOneHand = 1, 32 LongBladeTwoHand = 2, 33 BluntOneHand = 3, 34 BluntTwoClose = 4, 35 BluntTwoWide = 5, 36 SpearTwoWide = 6, 37 AxeOneHand = 7, 38 AxeTwoHand = 8, 39 MarksmanBow = 9, 40 MarksmanCrossbow = 10, 41 MarksmanThrown = 11, 42 Arrow = 12, 43 Bolt = 13 44 }; 45 46 enum AttackType 47 { 48 AT_Chop, 49 AT_Slash, 50 AT_Thrust 51 }; 52 53 enum Flags 54 { 55 Magical = 0x01, 56 Silver = 0x02 57 }; 58 59 #pragma pack(push) 60 #pragma pack(1) 61 struct WPDTstruct 62 { 63 float mWeight; 64 int mValue; 65 short mType; 66 unsigned short mHealth; 67 float mSpeed, mReach; 68 unsigned short mEnchant; // Enchantment points. The real value is mEnchant/10.f 69 unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max 70 int mFlags; 71 }; // 32 bytes 72 #pragma pack(pop) 73 74 WPDTstruct mData; 75 76 std::string mId, mName, mModel, mIcon, mEnchant, mScript; 77 78 void load(ESMReader &esm, bool &isDeleted); 79 void save(ESMWriter &esm, bool isDeleted = false) const; 80 81 void blank(); 82 ///< Set record to default state (does not touch the ID). 83 }; 84 85 struct WeaponType 86 { 87 enum Flags 88 { 89 TwoHanded = 0x01, 90 HasHealth = 0x02 91 }; 92 93 enum Class 94 { 95 Melee = 0, 96 Ranged = 1, 97 Thrown = 2, 98 Ammo = 3 99 }; 100 101 //std::string mDisplayName; // TODO: will be needed later for editor 102 std::string mShortGroup; 103 std::string mLongGroup; 104 std::string mSoundId; 105 std::string mAttachBone; 106 std::string mSheathingBone; 107 ESM::Skill::SkillEnum mSkill; 108 Class mWeaponClass; 109 int mAmmoType; 110 int mFlags; 111 }; 112 113 } 114 #endif 115