OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loadmgef.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_MGEF_H
2 #define OPENMW_ESM_MGEF_H
3 
4 #include <string>
5 #include <map>
6 
7 namespace ESM
8 {
9 
10 class ESMReader;
11 class ESMWriter;
12 
14 {
15  static unsigned int sRecordId;
17  static std::string getRecordType() { return "MagicEffect"; }
18 
19  std::string mId;
20 
21  enum Flags
22  {
23  // Originally fixed flags (HardcodedFlags array consists of just these)
24  TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure.
25  TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure.
26  NoDuration = 0x4, // Has no duration. Only runs effect once on cast.
27  NoMagnitude = 0x8, // Has no magnitude.
28  Harmful = 0x10, // Counts as a negative effect. Interpreted as useful for attack, and is treated as a bad effect in alchemy.
29  ContinuousVfx = 0x20, // The effect's hit particle VFX repeats for the full duration of the spell, rather than occuring once on hit.
30  CastSelf = 0x40, // Allows range - cast on self.
31  CastTouch = 0x80, // Allows range - cast on touch.
32  CastTarget = 0x100, // Allows range - cast on target.
33  UncappedDamage = 0x1000, // Negates multiple cap behaviours. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second.
34  NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target.
35  Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally.
36  CasterLinked = 0x20000, // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
37 
38  // Originally modifiable flags
39  AllowSpellmaking = 0x200, // Can be used for spellmaking
40  AllowEnchanting = 0x400, // Can be used for enchanting
41  NegativeLight = 0x800 // Negative light source
42  };
43 
45  {
52  };
53 
54  struct MEDTstruct
55  {
56  int mSchool; // SpellSchool, see defs.hpp
57  float mBaseCost;
58  int mFlags;
59  // Glow color for enchanted items with this effect
60  int mRed, mGreen, mBlue;
61 
62  float mUnknown1; // Called "Size X" in CS
63  float mSpeed; // Speed of fired projectile
64  float mUnknown2; // Called "Size Cap" in CS
65  }; // 36 bytes
66 
67  static const std::map<short,std::string> sNames;
68 
69  static const std::string &effectIdToString(short effectID);
70  static short effectStringToId(const std::string &effect);
71 
73  static short getResistanceEffect(short effect);
75  static short getWeaknessEffect(short effect);
76 
78 
79 
81 
82  std::string mIcon, mParticle; // Textures
83  std::string mCasting, mHit, mArea; // ESM::Static
84  std::string mBolt; // ESM::Weapon
85  std::string mCastSound, mBoltSound, mHitSound, mAreaSound; // Sounds
86  std::string mDescription;
87 
88  // Index of this magical effect. Corresponds to one of the
89  // hard-coded effects in the original engine:
90  // 0-136 in Morrowind
91  // 137 in Tribunal
92  // 138-140 in Bloodmoon (also changes 64?)
93  // 141-142 are summon effects introduced in bloodmoon, but not used
94  // there. They can be redefined in mods by setting the name in GMST
95  // sEffectSummonCreature04/05 creature id in
96  // sMagicCreature04ID/05ID.
97  int mIndex;
98 
99  void load(ESMReader &esm, bool &isDeleted);
100  void save(ESMWriter &esm, bool isDeleted = false) const;
101 
103  void blank();
104 
105  enum Effects
106  {
110  Shield = 3,
114  Burden = 7,
115  Feather = 8,
116  Jump = 9,
117  Levitate = 10,
118  SlowFall = 11,
119  Lock = 12,
120  Open = 13,
134  Poison = 27,
147  Chameleon = 40,
148  Light = 41,
149  Sanctuary = 42,
150  NightEye = 43,
151  Charm = 44,
152  Paralyze = 45,
153  Silence = 46,
154  Blind = 47,
155  Sound = 48,
164  Dispel = 57,
165  Soultrap = 58,
167  Mark = 60,
168  Recall = 61,
173  DetectKey = 66,
175  Reflect = 68,
207  RemoveCurse = 100,
208  TurnUndead = 101,
209  SummonScamp = 102,
227  BoundDagger = 120,
229  BoundMace = 122,
231  BoundSpear = 124,
233  ExtraSpell = 126,
235  BoundHelm = 128,
236  BoundBoots = 129,
237  BoundShield = 130,
238  BoundGloves = 131,
239  Corprus = 132,
240  Vampirism = 133,
242  SunDamage = 135,
244 
245  // Tribunal only
247 
248  // Bloodmoon only
249  SummonWolf = 138,
250  SummonBear = 139,
254 
256  };
257 
258  static std::string indexToId (int index);
259 };
260 }
261 #endif
Definition: loadmgef.hpp:142
std::string mHit
Definition: loadmgef.hpp:83
Definition: loadmgef.hpp:190
Definition: loadmgef.hpp:116
MagnitudeDisplayType
Definition: loadmgef.hpp:44
std::string mCasting
Definition: loadmgef.hpp:83
void load(ESMReader &esm, bool &isDeleted)
Definition: loadmgef.cpp:192
Definition: loadmgef.hpp:191
Definition: loadmgef.hpp:236
Definition: loadmgef.hpp:179
Definition: loadmgef.hpp:49
Definition: loadmgef.hpp:27
Definition: loadmgef.hpp:215
Definition: loadmgef.hpp:151
Definition: loadmgef.hpp:31
Definition: loadmgef.hpp:199
int mRed
Definition: loadmgef.hpp:60
Definition: loadmgef.hpp:181
std::string mId
Definition: loadmgef.hpp:19
Definition: loadmgef.hpp:141
Definition: loadmgef.hpp:129
Definition: loadmgef.hpp:195
Definition: loadmgef.hpp:123
Definition: esmreader.hpp:21
float mBaseCost
Definition: loadmgef.hpp:57
Definition: loadmgef.hpp:46
Definition: loadmgef.hpp:174
Definition: loadmgef.hpp:167
int mIndex
Definition: loadmgef.hpp:97
Definition: loadmgef.hpp:125
void blank()
Set record to default state (does not touch the ID/index).
Definition: loadmgef.cpp:576
Definition: loadmgef.hpp:161
Definition: loadmgef.hpp:162
Definition: loadmgef.hpp:211
Definition: loadmgef.hpp:223
Definition: loadmgef.hpp:239
Definition: loadmgef.hpp:224
Definition: loadmgef.hpp:147
Definition: loadmgef.hpp:227
Definition: loadmgef.hpp:120
Definition: loadmgef.hpp:237
Definition: loadmgef.hpp:205
int mBlue
Definition: loadmgef.hpp:60
Definition: loadmgef.hpp:108
Definition: loadmgef.hpp:149
Definition: loadmgef.hpp:121
Definition: loadmgef.hpp:172
Definition: loadmgef.hpp:218
Definition: loadmgef.hpp:175
Definition: loadmgef.hpp:128
Definition: loadmgef.hpp:137
Definition: loadmgef.hpp:50
Definition: loadmgef.hpp:157
Definition: loadmgef.hpp:26
Definition: loadmgef.hpp:230
Definition: loadmgef.hpp:119
Definition: loadmgef.hpp:180
Definition: loadmgef.hpp:115
Definition: loadmgef.hpp:234
Definition: loadmgef.hpp:233
Definition: loadmgef.hpp:113
Definition: loadmgef.hpp:186
Definition: loadmgef.hpp:48
Definition: loadmgef.hpp:243
Definition: loadmgef.hpp:152
Definition: loadmgef.hpp:229
Definition: loadmgef.hpp:221
Definition: loadmgef.hpp:213
float mUnknown2
Definition: loadmgef.hpp:64
Definition: loadmgef.hpp:238
float mSpeed
Definition: loadmgef.hpp:63
Definition: loadmgef.hpp:29
Definition: loadmgef.hpp:30
Definition: loadmgef.hpp:163
Definition: loadmgef.hpp:193
Definition: loadmgef.hpp:188
Definition: loadmgef.hpp:255
MagnitudeDisplayType getMagnitudeDisplayType() const
Definition: loadmgef.cpp:557
Definition: loadmgef.hpp:177
Definition: loadmgef.hpp:240
Definition: esmwriter.hpp:17
Definition: loadmgef.hpp:178
Definition: loadmgef.hpp:202
static std::string indexToId(int index)
Definition: loadmgef.cpp:599
Definition: loadmgef.hpp:228
float mUnknown1
Definition: loadmgef.hpp:62
Definition: loadmgef.hpp:241
int mGreen
Definition: loadmgef.hpp:60
Definition: loadmgef.hpp:166
Definition: loadmgef.hpp:219
Definition: loadmgef.hpp:183
Definition: loadmgef.hpp:164
Definition: loadmgef.hpp:143
Definition: loadmgef.hpp:226
Definition: loadmgef.hpp:35
Definition: loadmgef.hpp:222
static const std::string & effectIdToString(short effectID)
Definition: loadmgef.cpp:523
Definition: loadmgef.hpp:139
Definition: loadmgef.hpp:253
Definition: loadmgef.hpp:207
Definition: loadmgef.hpp:200
Definition: loadmgef.hpp:133
Definition: loadmgef.hpp:24
Definition: loadmgef.hpp:114
Definition: loadmgef.hpp:118
Definition: loadmgef.hpp:112
Definition: loadmgef.hpp:153
Definition: loadmgef.hpp:216
Definition: loadmgef.hpp:41
std::string mArea
Definition: loadmgef.hpp:83
Definition: loadmgef.hpp:156
Definition: loadmgef.hpp:135
int mSchool
Definition: loadmgef.hpp:56
Definition: loadmgef.hpp:140
Definition: loadmgef.hpp:36
Definition: loadmgef.hpp:110
std::string mBoltSound
Definition: loadmgef.hpp:85
std::string mHitSound
Definition: loadmgef.hpp:85
Definition: loadmgef.hpp:201
Definition: loadmgef.hpp:40
Definition: loadmgef.hpp:32
int mFlags
Definition: loadmgef.hpp:58
Definition: loadmgef.hpp:192
Definition: loadmgef.hpp:168
Definition: loadmgef.hpp:231
Definition: loadmgef.hpp:13
Definition: loadsoun.hpp:17
Definition: loadmgef.hpp:194
Definition: loadmgef.hpp:197
Flags
Definition: loadmgef.hpp:21
Definition: loadmgef.hpp:182
static short effectStringToId(const std::string &effect)
Definition: loadmgef.cpp:546
Definition: loadmgef.hpp:25
Definition: loadmgef.hpp:249
Definition: loadmgef.hpp:185
static short getWeaknessEffect(short effect)
Returns the effect that induces weakness against effect (or -1 if there's none)
Definition: loadmgef.cpp:323
std::string mParticle
Definition: loadmgef.hpp:82
Definition: loadmgef.hpp:176
std::string mBolt
Definition: loadmgef.hpp:84
Definition: loadmgef.hpp:150
Definition: loadmgef.hpp:51
Definition: loadmgef.hpp:203
Definition: loadmgef.hpp:154
Definition: loadmgef.hpp:208
std::string mDescription
Definition: loadmgef.hpp:86
Definition: loadmgef.hpp:242
static short getResistanceEffect(short effect)
Returns the effect that provides resistance against effect (or -1 if there's none) ...
Definition: loadmgef.cpp:275
Definition: loadmgef.hpp:173
Definition: loadmgef.hpp:209
Definition: loadmgef.hpp:252
Definition: loadmgef.hpp:204
Definition: loadmgef.hpp:146
Definition: loadmgef.hpp:130
Definition: loadmgef.hpp:126
Definition: loadmgef.hpp:28
Definition: loadmgef.hpp:165
Definition: loadmgef.hpp:206
Definition: loadmgef.hpp:158
Definition: loadmgef.hpp:198
Definition: loadmgef.hpp:138
void save(ESMWriter &esm, bool isDeleted=false) const
Definition: loadmgef.cpp:254
Definition: loadmgef.hpp:189
Definition: loadmgef.hpp:54
Definition: loadmgef.hpp:210
Definition: loadmgef.hpp:33
Definition: loadmgef.hpp:250
Definition: loadmgef.hpp:127
Definition: loadmgef.hpp:131
Effects
Definition: loadmgef.hpp:105
Definition: loadmgef.hpp:246
std::string mAreaSound
Definition: loadmgef.hpp:85
Definition: loadmgef.hpp:235
Definition: loadmgef.hpp:124
std::string mIcon
Definition: loadmgef.hpp:82
Definition: loadmgef.hpp:160
Definition: loadmgef.hpp:134
Definition: loadmgef.hpp:109
Definition: loadmgef.hpp:132
Definition: loadmgef.hpp:159
Definition: loadmgef.hpp:217
Definition: loadmgef.hpp:220
Definition: loadmgef.hpp:170
Definition: loadmgef.hpp:187
Definition: loadmgef.hpp:145
std::string mCastSound
Definition: loadmgef.hpp:85
Definition: loadmgef.hpp:171
Definition: loadmgef.hpp:144
Definition: loadmgef.hpp:136
Definition: loadmgef.hpp:117
Definition: loadmgef.hpp:225
Definition: loadmgef.hpp:169
static const std::map< short, std::string > sNames
Definition: loadmgef.hpp:67
static unsigned int sRecordId
Definition: loadmgef.hpp:15
Definition: loadmgef.hpp:196
Definition: loadmgef.hpp:107
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loadmgef.hpp:17
MEDTstruct mData
Definition: loadmgef.hpp:80
Definition: loadmgef.hpp:47
Definition: loadmgef.hpp:251
Definition: loadmgef.hpp:212
Definition: loadmgef.hpp:111
Definition: loadligh.hpp:17
Definition: loadmgef.hpp:122
Definition: loadmgef.hpp:39
Definition: loadmgef.hpp:232
Definition: loadmgef.hpp:214
Definition: loadmgef.hpp:34
Definition: loadmgef.hpp:184