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 "pact_sheet.h"
23 #include "nel/georges/u_form_elm.h"
25 using namespace NLGEORGES
;
27 //=================================================================================
28 void CPactSheet::build(const NLGEORGES::UFormElm
&root
)
31 const UFormElm
*arrayDeathImpact
= NULL
;
32 if( root
.getNodeByName( &arrayDeathImpact
, "death_impact" ) )
34 if( arrayDeathImpact
)
37 nlverify( arrayDeathImpact
->getArraySize(size
) );
38 PactLose
.resize( size
);
42 // variable is used for calculate pact effect in differential between pacts type
43 sint16 LoseHitPoints
= 0;
44 sint16 LoseStamina
= 0;
46 sint16 LoseSkills
= 0;
50 for( uint i
= 0; i
< size
; ++i
)
53 arrayDeathImpact
->getArrayNode( &node
, i
);
57 node
->getValueByName( value
, "HitPoints" );
58 value
= 0 - value
- LoseHitPoints
;
59 LoseHitPoints
+= value
;
60 PactLose
[ i
].LoseHitPointsLevel
= value
;
62 node
->getValueByName( value
, "Stamina" );
63 value
= 0 - value
- LoseStamina
;
65 PactLose
[ i
].LoseStaminaLevel
= value
;
67 node
->getValueByName( value
, "Sap" );
68 value
= 0 - value
- LoseSap
;
70 PactLose
[ i
].LoseSapLevel
= value
;
72 node
->getValueByName( value
, "Skills" );
73 value
= 0 - value
- LoseSkills
;
75 PactLose
[ i
].LoseSkillsLevel
= value
;
77 node
->getValueByName( PactLose
[ i
].Duration
, "Duration" );
78 node
->getValueByName( PactLose
[ i
].Name
, "Name" );
82 // get bitmap for icone display
83 root
.getValueByName(Icon
, "icon");
84 root
.getValueByName(IconBackground
, "icon_background");
89 //=================================================================================
90 void CPactSheet::serial(NLMISC::IStream
&f
)
92 f
.serialCont(PactLose
);
94 f
.serial(IconBackground
);