NWNX:EE  8193.36.12
nwnx_effect.nss
Go to the documentation of this file.
1 #include "nwnx"
6 
7 const string NWNX_Effect = "NWNX_Effect";
8 
16 const int DURATION_TYPE_EQUIPPED = 3;
17 
21 const int DURATION_TYPE_INNATE = 4;
22 
25 {
26  string sID;
27  int nType;
28  int nSubType;
29 
30  float fDuration;
33 
34  object oCreator;
35  int nSpellId;
36  int bExpose;
37  int bShowIcon;
39 
40  effect eLinkLeft;
42  effect eLinkRight;
44 
46  int nParam0;
47  int nParam1;
48  int nParam2;
49  int nParam3;
50  int nParam4;
51  int nParam5;
52  int nParam6;
53  int nParam7;
54  float fParam0;
55  float fParam1;
56  float fParam2;
57  float fParam3;
58  string sParam0;
59  string sParam1;
60  string sParam2;
61  string sParam3;
62  string sParam4;
63  string sParam5;
64  object oParam0;
65  object oParam1;
66  object oParam2;
67  object oParam3;
68  vector vParam0;
69  vector vParam1;
70 
71  string sTag;
72 
73  string sItemProp;
74 };
75 
80 
85 
90 int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew);
91 
95 int NWNX_Effect_GetTrueEffectCount(object oObject);
96 
101 struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex);
102 
108 void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_EffectUnpacked e);
109 
114 int NWNX_Effect_RemoveEffectById(object oObject, string sID);
115 
119 void NWNX_Effect_Apply(effect eEffect, object oObject);
120 
125 effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject);
126 
130 int NWNX_Effect_GetIsEffectValid(effect eEffect);
131 
135 int NWNX_Effect_GetAppliedEffectCount(object oObject);
136 
142 effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth);
143 
145 
146 struct NWNX_EffectUnpacked __NWNX_Effect_ResolveUnpack(string sFunc, int bLink=TRUE)
147 {
148  struct NWNX_EffectUnpacked n;
149 
151 
153 
154  float fZ = NWNX_GetReturnValueFloat();
155  float fY = NWNX_GetReturnValueFloat();
156  float fX = NWNX_GetReturnValueFloat();
157  n.vParam1 = Vector(fX, fY, fZ);
161  n.vParam0 = Vector(fX, fY, fZ);
185 
186  if(bLink)
187  {
192  }
193  else
194  {
195  n.bLinkRightValid = FALSE;
196  n.bLinkLeftValid = FALSE;
197  }
198 
204 
208 
212 
213  return n;
214 }
215 
216 void __NWNX_Effect_ResolvePack(string sFunc, struct NWNX_EffectUnpacked e, int bReplace=FALSE)
217 {
218  if(!bReplace)
220 
222 
226 
232 
233  if(!bReplace)
234  {
239  }
240 
264 
268 
272 
274 
276 }
277 
279 {
280  string sFunc = "UnpackEffect";
281 
283  NWNX_CallFunction(NWNX_Effect, sFunc);
284 
285  return __NWNX_Effect_ResolveUnpack(sFunc);
286 }
288 {
289  string sFunc = "PackEffect";
290 
291  __NWNX_Effect_ResolvePack(sFunc, e);
292 
293  NWNX_CallFunction(NWNX_Effect, sFunc);
294  return NWNX_GetReturnValueEffect();
295 }
296 
297 int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew)
298 {
299  string sFunc = "ReplaceEffect";
300 
304 
305  NWNX_CallFunction(NWNX_Effect, sFunc);
306 
307  return NWNX_GetReturnValueInt();
308 }
309 
311 {
312  string sFunc = "GetTrueEffectCount";
313  NWNX_PushArgumentObject(oObject);
314  NWNX_CallFunction(NWNX_Effect, sFunc);
315 
316  return NWNX_GetReturnValueInt();
317 }
318 
319 struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex)
320 {
321  string sFunc = "GetTrueEffect";
322  NWNX_PushArgumentInt(nIndex);
323  NWNX_PushArgumentObject(oObject);
324  NWNX_CallFunction(NWNX_Effect, sFunc);
325 
326  return __NWNX_Effect_ResolveUnpack(sFunc, FALSE);
327 }
328 
329 void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_EffectUnpacked e)
330 {
331  string sFunc = "ReplaceEffectByIndex";
332 
333  __NWNX_Effect_ResolvePack(sFunc, e, TRUE);
334 
335  NWNX_PushArgumentInt(nIndex);
336  NWNX_PushArgumentObject(oObject);
337  NWNX_CallFunction(NWNX_Effect, sFunc);
338 }
339 
340 int NWNX_Effect_RemoveEffectById(object oObject, string sID)
341 {
342  string sFunc = "RemoveEffectById";
344  NWNX_PushArgumentObject(oObject);
345  NWNX_CallFunction(NWNX_Effect, sFunc);
346 
347  return NWNX_GetReturnValueInt();
348 }
349 
350 void NWNX_Effect_Apply(effect eEffect, object oObject)
351 {
352  string sFunc = "Apply";
353  NWNX_PushArgumentObject(oObject);
354  NWNX_PushArgumentEffect(eEffect);
355  NWNX_CallFunction(NWNX_Effect, sFunc);
356 }
357 
358 effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject)
359 {
360  string sFunc = "SetEffectCreator";
361 
362  NWNX_PushArgumentObject(oObject);
363  NWNX_PushArgumentEffect(eEffect);
364 
365  NWNX_CallFunction(NWNX_Effect, sFunc);
366 
367  return NWNX_GetReturnValueEffect();
368 }
369 
370 int NWNX_Effect_GetIsEffectValid(effect eEffect)
371 {
372  string sFunc = "GetIsEffectValid";
373 
374  NWNX_PushArgumentEffect(eEffect);
375 
376  NWNX_CallFunction(NWNX_Effect, sFunc);
377 
378  return NWNX_GetReturnValueInt();
379 }
380 
382 {
383  string sFunc = "GetAppliedEffectCount";
384 
385  NWNX_PushArgumentObject(oObject);
386 
387  NWNX_CallFunction(NWNX_Effect, sFunc);
388 
389  return NWNX_GetReturnValueInt();
390 }
391 
392 effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth)
393 {
394  string sFunc = "GetAppliedEffect";
395 
396  NWNX_PushArgumentInt(nNth);
397  NWNX_PushArgumentObject(oObject);
398 
399  NWNX_CallFunction(NWNX_Effect, sFunc);
400 
401  return NWNX_GetReturnValueEffect();
402 }
NWNX_EffectUnpacked::vParam1
vector vParam1
Definition: nwnx_effect.nss:69
NWNX_EffectUnpacked::oParam0
object oParam0
Definition: nwnx_effect.nss:64
NWNX_Effect_RemoveEffectById
int NWNX_Effect_RemoveEffectById(object oObject, string sID)
Removes effect by ID.
Definition: nwnx_effect.nss:340
NWNX_EffectUnpacked::bShowIcon
int bShowIcon
Definition: nwnx_effect.nss:37
NWNX_EffectUnpacked::nNumIntegers
int nNumIntegers
Definition: nwnx_effect.nss:45
NWNX_GetReturnValueInt
int NWNX_GetReturnValueInt()
Returns the specified type from the c++ side.
Definition: nwnx.nss:94
NWNX_Effect_GetTrueEffectCount
int NWNX_Effect_GetTrueEffectCount(object oObject)
Gets the true effect count.
Definition: nwnx_effect.nss:310
NWNX_EffectUnpacked::nSubType
int nSubType
Definition: nwnx_effect.nss:28
NWNX_GetReturnValueEffect
effect NWNX_GetReturnValueEffect()
Returns the specified type from the c++ side.
Definition: nwnx.nss:114
NWNX_EffectUnpacked::sParam4
string sParam4
Definition: nwnx_effect.nss:62
NWNX_EffectUnpacked::nParam2
int nParam2
Definition: nwnx_effect.nss:48
NWNX_EffectUnpacked::fParam0
float fParam0
Definition: nwnx_effect.nss:54
NWNX_EffectUnpacked::sParam1
string sParam1
Definition: nwnx_effect.nss:59
NWNX_EffectUnpacked::nParam4
int nParam4
Definition: nwnx_effect.nss:50
NWNX_EffectUnpacked::bLinkRightValid
int bLinkRightValid
Definition: nwnx_effect.nss:43
NWNX_Effect_ReplaceEffect
int NWNX_Effect_ReplaceEffect(object obj, effect eOld, effect eNew)
replace an already applied effect on an object Only duration, subtype, tag and spell related fields c...
Definition: nwnx_effect.nss:297
NWNX_EffectUnpacked::sParam0
string sParam0
Definition: nwnx_effect.nss:58
NWNX_Effect_Apply
void NWNX_Effect_Apply(effect eEffect, object oObject)
Applys an effect, bypassing any processing done by ApplyEffectToObject.
Definition: nwnx_effect.nss:350
NWNX_EffectUnpacked::nParam0
int nParam0
Definition: nwnx_effect.nss:46
__NWNX_Effect_ResolveUnpack
struct NWNX_EffectUnpacked __NWNX_Effect_ResolveUnpack(string sFunc, int bLink=TRUE)
Definition: nwnx_effect.nss:146
NWNX_Effect_GetAppliedEffectCount
int NWNX_Effect_GetAppliedEffectCount(object oObject)
Returns the number of applied effects on the given object.
Definition: nwnx_effect.nss:381
DURATION_TYPE_EQUIPPED
const int DURATION_TYPE_EQUIPPED
Definition: nwnx_effect.nss:16
NWNX_EffectUnpacked::fDuration
float fDuration
Definition: nwnx_effect.nss:30
NWNX_EffectUnpacked::fParam1
float fParam1
Definition: nwnx_effect.nss:55
NWNX_Effect_UnpackEffect
struct NWNX_EffectUnpacked NWNX_Effect_UnpackEffect(effect e)
Convert native effect type to unpacked structure.
Definition: nwnx_effect.nss:278
NWNX_EffectUnpacked::bLinkLeftValid
int bLinkLeftValid
Definition: nwnx_effect.nss:41
NWNX_EffectUnpacked::oParam1
object oParam1
Definition: nwnx_effect.nss:65
NWNX_EffectUnpacked::nCasterLevel
int nCasterLevel
Definition: nwnx_effect.nss:38
NWNX_GetReturnValueFloat
float NWNX_GetReturnValueFloat()
Returns the specified type from the c++ side.
Definition: nwnx.nss:99
NWNX_EffectUnpacked::vParam0
vector vParam0
Definition: nwnx_effect.nss:68
NWNX_EffectUnpacked::sTag
string sTag
Definition: nwnx_effect.nss:71
NWNX_CallFunction
void NWNX_CallFunction(string pluginName, string functionName)
Scripting interface to NWNX.
Definition: nwnx.nss:54
NWNX_EffectUnpacked::nExpiryTimeOfDay
int nExpiryTimeOfDay
Definition: nwnx_effect.nss:32
NWNX_GetReturnValueString
string NWNX_GetReturnValueString()
Returns the specified type from the c++ side.
Definition: nwnx.nss:109
NWNX_EffectUnpacked::nParam1
int nParam1
Definition: nwnx_effect.nss:47
NWNX_PushArgumentString
void NWNX_PushArgumentString(string value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:74
NWNX_EffectUnpacked::eLinkRight
effect eLinkRight
Definition: nwnx_effect.nss:42
NWNX_EffectUnpacked::nParam6
int nParam6
Definition: nwnx_effect.nss:52
NWNX_EffectUnpacked::fParam3
float fParam3
Definition: nwnx_effect.nss:57
NWNX_EffectUnpacked::nParam3
int nParam3
Definition: nwnx_effect.nss:49
NWNX_PushArgumentObject
void NWNX_PushArgumentObject(object value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:69
NWNX_EffectUnpacked::sID
string sID
Definition: nwnx_effect.nss:26
NWNX_Effect_GetAppliedEffect
effect NWNX_Effect_GetAppliedEffect(object oObject, int nNth)
Returns the nNth applied effect on a object.
Definition: nwnx_effect.nss:392
NWNX_PushArgumentInt
void NWNX_PushArgumentInt(int value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:59
NWNX_EffectUnpacked
An unpacked effect.
Definition: nwnx_effect.nss:24
NWNX_PushArgumentEffect
void NWNX_PushArgumentEffect(effect value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:79
NWNX_EffectUnpacked::sParam5
string sParam5
Definition: nwnx_effect.nss:63
NWNX_EffectUnpacked::bExpose
int bExpose
Definition: nwnx_effect.nss:36
NWNX_EffectUnpacked::nType
int nType
Definition: nwnx_effect.nss:27
NWNX_EffectUnpacked::oParam2
object oParam2
Definition: nwnx_effect.nss:66
NWNX_EffectUnpacked::oCreator
object oCreator
Definition: nwnx_effect.nss:34
NWNX_EffectUnpacked::eLinkLeft
effect eLinkLeft
Definition: nwnx_effect.nss:40
NWNX_EffectUnpacked::sItemProp
string sItemProp
Definition: nwnx_effect.nss:73
NWNX_Effect_GetIsEffectValid
int NWNX_Effect_GetIsEffectValid(effect eEffect)
Checks if the given effect is valid. Unlike the game builtin, this call considers internal types too.
Definition: nwnx_effect.nss:370
NWNX_EffectUnpacked::nSpellId
int nSpellId
Definition: nwnx_effect.nss:35
NWNX_Effect_PackEffect
effect NWNX_Effect_PackEffect(struct NWNX_EffectUnpacked e)
Convert unpacked effect structure to native type.
Definition: nwnx_effect.nss:287
__NWNX_Effect_ResolvePack
void __NWNX_Effect_ResolvePack(string sFunc, struct NWNX_EffectUnpacked e, int bReplace=FALSE)
Definition: nwnx_effect.nss:216
NWNX_EffectUnpacked::nExpiryCalendarDay
int nExpiryCalendarDay
Definition: nwnx_effect.nss:31
NWNX_GetReturnValueObject
object NWNX_GetReturnValueObject()
Returns the specified type from the c++ side.
Definition: nwnx.nss:104
NWNX_EffectUnpacked::nParam5
int nParam5
Definition: nwnx_effect.nss:51
NWNX_EffectUnpacked::sParam2
string sParam2
Definition: nwnx_effect.nss:60
NWNX_EffectUnpacked::sParam3
string sParam3
Definition: nwnx_effect.nss:61
NWNX_Effect_SetEffectCreator
effect NWNX_Effect_SetEffectCreator(effect eEffect, object oObject)
Sets an effect creator.
Definition: nwnx_effect.nss:358
NWNX_PushArgumentFloat
void NWNX_PushArgumentFloat(float value)
Pushes the specified type to the c++ side.
Definition: nwnx.nss:64
NWNX_Effect_GetTrueEffect
struct NWNX_EffectUnpacked NWNX_Effect_GetTrueEffect(object oObject, int nIndex)
Gets a specific effect on an object. This can grab effects normally hidden from developers,...
Definition: nwnx_effect.nss:319
NWNX_Effect_ReplaceEffectByIndex
void NWNX_Effect_ReplaceEffectByIndex(object oObject, int nIndex, struct NWNX_EffectUnpacked e)
Replaces an already applied effect with another.
Definition: nwnx_effect.nss:329
NWNX_EffectUnpacked::fParam2
float fParam2
Definition: nwnx_effect.nss:56
NWNX_EffectUnpacked::oParam3
object oParam3
Definition: nwnx_effect.nss:67
DURATION_TYPE_INNATE
const int DURATION_TYPE_INNATE
Definition: nwnx_effect.nss:21
NWNX_EffectUnpacked::nParam7
int nParam7
Definition: nwnx_effect.nss:53