1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "attack_sheet.h"
22 #include "nel/georges/u_form_elm.h"
23 #include "nel/georges/u_form.h"
24 #include "nel/georges/u_form_loader.h"
27 // *********************************************************************************************************
28 CAttackSheet::CAttackSheet()
30 ProjectileDelay
= 0.f
;
31 ProjectileMode
= MAGICFX::Bomb
;
32 PlayImpactFXOnlyOnMainTarget
= false;
33 PlayImpactAnim
= true;
34 LetProjectileStickedOnTarget
= false;
35 ForceUseProjectileDelay
= false;
36 ApplyItemOffsetToWeaponBone
= true;
37 AdditionnalStartOffset
.set(0.f
, 0.f
, 0.f
);
40 // *********************************************************************************************************
41 void CAttackSheet::build(const NLGEORGES::UFormElm
&item
, const std::string
&prefix
)
44 ok
&= item
.getValueByName(AttackBeginFX
, (prefix
+ "AttackBeginFX").c_str());
45 ok
&= item
.getValueByName(AttackLoopFX
, (prefix
+ "AttackLoopFX").c_str());
46 ok
&= item
.getValueByName(AttackEndFX
, (prefix
+ "AttackEndFX").c_str());
47 ok
&= item
.getValueByName(AttackStaticObjectCastFX
, (prefix
+ "AttackStaticObjectCastFX").c_str());
48 ok
&= item
.getValueByName(AttackFailFX
, (prefix
+ "AttackFailFX").c_str());
49 ok
&= item
.getValueByName(ProjectileFX
, (prefix
+ "ProjectileFX").c_str());
50 ok
&= item
.getValueByName(ImpactFX
, (prefix
+ "ImpactFX").c_str());
52 ok
&= item
.getValueByName(ProjectileDelay
, (prefix
+ "ProjectileDelay").c_str());
53 ok
&= item
.getValueByName(StaticObjectProjectileDelay
, (prefix
+ "StaticObjectProjectileDelay").c_str());
54 uint32 projectileMode
= 0;
55 ok
&= item
.getValueByName(projectileMode
, (prefix
+ "ProjectileMode").c_str());
56 ProjectileMode
= (MAGICFX::TSpellMode
) projectileMode
;
57 ok
&= item
.getValueByName(IsImpactLocalised
, (prefix
+ "IsImpactLocalised").c_str());
58 ok
&= item
.getValueByName(PlayImpactFXOnlyOnMainTarget
, (prefix
+ "PlayImpactFXOnlyOnMainTarget").c_str());
59 ok
&= item
.getValueByName(PlayImpactAnim
, (prefix
+ "PlayImpactAnim").c_str());
60 ok
&= DefaultCastingPoint
.build(item
, prefix
+ "DefaultCastingPoint.");
61 ok
&= DefaultAimingPoint
.build(item
, prefix
+ "DefaultAimingPoint.");
62 ok
&= item
.getValueByName(LetProjectileStickedOnTarget
, (prefix
+ "LetProjectileStickedOnTarget").c_str());
63 ok
&= item
.getValueByName(ForceUseProjectileDelay
, (prefix
+ "ForceUseProjectileDelay").c_str());
64 ok
&= item
.getValueByName(ApplyItemOffsetToWeaponBone
, (prefix
+ "ApplyItemOffsetToWeaponBone").c_str());
65 ok
&= item
.getValueByName(AdditionnalStartOffset
.x
, (prefix
+ "AdditionnalStartOffsetX").c_str());
66 ok
&= item
.getValueByName(AdditionnalStartOffset
.y
, (prefix
+ "AdditionnalStartOffsetY").c_str());
67 ok
&= item
.getValueByName(AdditionnalStartOffset
.z
, (prefix
+ "AdditionnalStartOffsetZ").c_str());
70 nlwarning("Couldn't read all fields");
74 // *********************************************************************************************************
75 void CAttackSheet::serial(NLMISC::IStream
&f
)
77 f
.serialEnum(ProjectileMode
);
78 f
.serial(AttackBeginFX
);
79 f
.serial(AttackLoopFX
);
80 f
.serial(AttackEndFX
);
81 f
.serial(AttackStaticObjectCastFX
);
82 f
.serial(AttackFailFX
);
83 f
.serial(ProjectileFX
);
85 f
.serial(ProjectileDelay
);
86 f
.serial(StaticObjectProjectileDelay
);
87 f
.serial(PlayImpactFXOnlyOnMainTarget
); // Only may target play the impact fx (but other target play the impact anim)
88 f
.serial(IsImpactLocalised
);
89 f
.serial(DefaultCastingPoint
);
90 f
.serial(DefaultAimingPoint
);
91 f
.serial(PlayImpactAnim
);
92 f
.serial(LetProjectileStickedOnTarget
);
93 f
.serial(ForceUseProjectileDelay
);
94 f
.serial(ApplyItemOffsetToWeaponBone
);
95 f
.serial(AdditionnalStartOffset
);