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/>.
21 #include "nel/misc/debug.h"
22 #include "nel/misc/string_conversion.h"
24 #include "brick_flags.h"
27 using namespace NLMISC
;
31 // The conversion table
32 NL_BEGIN_STRING_CONVERSION_TABLE (TBrickFlag
)
33 NL_STRING_CONVERSION_TABLE_ENTRY (Miss
)
34 NL_STRING_CONVERSION_TABLE_ENTRY (Fumble
)
35 NL_STRING_CONVERSION_TABLE_ENTRY (Hit
)
36 NL_STRING_CONVERSION_TABLE_ENTRY (CriticalHit
)
37 NL_STRING_CONVERSION_TABLE_ENTRY (Parry
)
38 NL_STRING_CONVERSION_TABLE_ENTRY (Dodge
)
39 NL_STRING_CONVERSION_TABLE_ENTRY (ShieldUsed
)
40 NL_STRING_CONVERSION_TABLE_ENTRY (Head
)
41 NL_STRING_CONVERSION_TABLE_ENTRY (Chest
)
42 NL_STRING_CONVERSION_TABLE_ENTRY (Arms
)
43 NL_STRING_CONVERSION_TABLE_ENTRY (Hands
)
44 NL_STRING_CONVERSION_TABLE_ENTRY (Legs
)
45 NL_STRING_CONVERSION_TABLE_ENTRY (Feet
)
47 NL_STRING_CONVERSION_TABLE_ENTRY (Feint
)
49 NL_STRING_CONVERSION_TABLE_ENTRY (Stun
)
50 NL_STRING_CONVERSION_TABLE_ENTRY (Bleed
)
51 NL_STRING_CONVERSION_TABLE_ENTRY (SlowMove
)
52 NL_STRING_CONVERSION_TABLE_ENTRY (SlowAttacks
)
54 NL_STRING_CONVERSION_TABLE_ENTRY (Taunt
)
55 NL_STRING_CONVERSION_TABLE_ENTRY (SpeedingUp
)
56 NL_STRING_CONVERSION_TABLE_ENTRY (LifeConcentration
)
57 NL_STRING_CONVERSION_TABLE_ENTRY (StaminaConcentration
)
58 NL_STRING_CONVERSION_TABLE_ENTRY (SapConcentration
)
59 NL_STRING_CONVERSION_TABLE_ENTRY (ConvertStamina
)
60 NL_STRING_CONVERSION_TABLE_ENTRY (ConvertSap
)
61 NL_STRING_CONVERSION_TABLE_ENTRY (Berserk
)
62 NL_STRING_CONVERSION_TABLE_ENTRY (BalanceHp
)
63 NL_STRING_CONVERSION_TABLE_ENTRY (Heal
)
64 NL_STRING_CONVERSION_TABLE_ENTRY (Shielding
)
65 NL_STRING_CONVERSION_TABLE_ENTRY (Invulnerability
)
66 NL_STRING_CONVERSION_TABLE_ENTRY (EnchantWeapon
)
67 NL_STRING_CONVERSION_TABLE_ENTRY (ChgCharac
)
68 NL_STRING_CONVERSION_TABLE_ENTRY (ModDefense
)
69 NL_STRING_CONVERSION_TABLE_ENTRY (ModMeleeSuccess
)
70 NL_STRING_CONVERSION_TABLE_ENTRY (ModRangeSuccess
)
71 NL_STRING_CONVERSION_TABLE_ENTRY (ModMagicSuccess
)
72 NL_STRING_CONVERSION_TABLE_ENTRY (ModMeleeSuccess
)
73 NL_STRING_CONVERSION_TABLE_ENTRY (ModRangeSuccess
)
74 NL_STRING_CONVERSION_TABLE_ENTRY (ModMagicSuccess
)
75 NL_STRING_CONVERSION_TABLE_ENTRY (ModForageSuccess
)
76 NL_STRING_CONVERSION_TABLE_ENTRY (HealHpC
)
77 NL_STRING_CONVERSION_TABLE_ENTRY (HealSapC
)
78 NL_STRING_CONVERSION_TABLE_ENTRY (HealStaC
)
79 NL_STRING_CONVERSION_TABLE_ENTRY (HealFocusC
)
81 NL_STRING_CONVERSION_TABLE_ENTRY (Aura
)
83 NL_STRING_CONVERSION_TABLE_ENTRY (UnknownFlag
)
84 NL_END_STRING_CONVERSION_TABLE(TBrickFlag
, FlagConversion
, UnknownFlag
)
87 const string
&toString(TBrickFlag flag
)
90 nlassert( NbCombatFlags
< 32);
91 nlassert( NbPowerFlags
< 31);
93 return FlagConversion
.toString(flag
);
96 TBrickFlag
toBrickFlag( const string
&str
)
99 nlassert( NbCombatFlags
< 32);
100 nlassert( NbPowerFlags
< 31);
102 return FlagConversion
.fromString(str
);
105 TBrickFlag
powerTypeToFlag( POWERS::TPowerType powerType
)
107 if (powerType
>= POWERS::BeginAuras
&& powerType
<= POWERS::EndAuras
)
112 if (powerType
>= POWERS::BeginPower
&& powerType
<= POWERS::EndPower
)
114 return (TBrickFlag
)(BeginPowerFlags
+ powerType
- POWERS::BeginPower
);
121 /// convert a slot to a combat flag
122 TBrickFlag
slotToFlag( SLOT_EQUIPMENT::TSlotEquipment slot
)
126 case SLOT_EQUIPMENT::HEAD
:
128 case SLOT_EQUIPMENT::CHEST
:
130 case SLOT_EQUIPMENT::ARMS
:
132 case SLOT_EQUIPMENT::HANDS
:
134 case SLOT_EQUIPMENT::LEGS
:
136 case SLOT_EQUIPMENT::FEET
:
143 /// convert an effect family to a flag
144 TBrickFlag
effectFamilyToFlag( EFFECT_FAMILIES::TEffectFamily family
)
148 case EFFECT_FAMILIES::CombatBleed
:
150 case EFFECT_FAMILIES::CombatStun
:
152 case EFFECT_FAMILIES::CombatMvtSlow
:
154 case EFFECT_FAMILIES::CombatAttackSlow
: