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/>.
17 #include "skill_tree.h"
20 using namespace NLMISC
;
21 using namespace NLGEORGES
;
24 //-----------------------------------------------
25 // readGeorges for CStaticSkillsTree
27 //-----------------------------------------------
28 void CStaticSkillsTree::readGeorges( const NLMISC::CSmartPtr
<NLGEORGES::UForm
> &form
, const NLMISC::CSheetId
&sheetId
)
32 UFormElm
& root
= form
->getRootNode();
34 UFormElm
*arraySkillElt
= NULL
;
35 if( root
.getNodeByName( &arraySkillElt
, "SkillData" ) )
40 nlverify( arraySkillElt
->getArraySize( NbSkills
) );
42 nlassertex( NbSkills
== SKILLS::NUM_SKILLS
, ("(%u != %u) Please synchronise game_share/skill.* with leveldesign/game_element/xp_table/skills.skill_tree (use skill_extractor.exe)", NbSkills
, SKILLS::NUM_SKILLS
));
44 SkillsTree
.resize( NbSkills
);
46 for( uint i
= 0; i
< NbSkills
; ++i
)
48 UFormElm
* SkillElt
= NULL
;
49 if( ! ( arraySkillElt
->getArrayNode( &SkillElt
, i
) && SkillElt
) )
51 nlwarning("<CStaticSkillsTree::readGeorges> can't get array node of SkillElt in sheet %s", sheetId
.toString().c_str() );
57 SkillElt
->getValueByName( SkillName
, "Skill" );
58 SKILLS::ESkills skill
= SKILLS::toSkill( SkillName
);
59 nlassert( skill
!= SKILLS::unknown
);
60 if (skill
== SKILLS::unknown
)
64 SkillsTree
[ skill
].Skill
= skill
;
66 if( ! SkillElt
->getValueByName( SkillsTree
[ skill
].SkillCode
, "SkillCode" ) )
68 nlwarning("<CStaticSkillsTree::readGeorges> can't get node SkillCode in sheet %s", sheetId
.toString().c_str() );
72 if( ! SkillElt
->getValueByName( SkillsTree
[ skill
].SkillCode
, "SkillCode" ) )
74 nlwarning("<CStaticSkillsTree::readGeorges> can't get node SkillCode in sheet %s", sheetId
.toString().c_str() );
78 if( ! SkillElt
->getValueByName( SkillsTree
[ skill
].MaxSkillValue
, "MaxSkillValue" ) )
80 nlwarning("<CStaticSkillsTree::readGeorges> can't get node MaxSkillValue in sheet %s", sheetId
.toString().c_str() );
84 if( ! SkillElt
->getValueByName( SkillsTree
[ skill
].StageType
, "Type of Stage" ) )
86 nlwarning("<CStaticSkillsTree::readGeorges> can't get node 'Type of Stage' in sheet %s", sheetId
.toString().c_str() );
90 if( ! SkillElt
->getValueByName( SkillName
, "ParentSkill" ) )
92 nlwarning("<CStaticSkillsTree::readGeorges> can't get node ParentSkills in sheet %s", sheetId
.toString().c_str() );
96 SkillsTree
[ skill
].ParentSkill
= SKILLS::toSkill( SkillName
);
100 UFormElm
*arrayChildSkillElt
= NULL
;
101 if( SkillElt
->getNodeByName( &arrayChildSkillElt
, "ChildSkills" ) )
103 if( arrayChildSkillElt
)
106 nlverify( arrayChildSkillElt
->getArraySize( NbChildSkills
) );
108 SkillsTree
[ skill
].ChildSkills
.resize( NbChildSkills
);
110 for( uint i
= 0; i
< NbChildSkills
; ++i
)
112 string childSkillName
;
113 arrayChildSkillElt
->getArrayValue( childSkillName
, i
);
114 SKILLS::ESkills childSkill
= SKILLS::toSkill( childSkillName
);
115 nlassert( childSkill
!= SKILLS::unknown
);
116 if (skill
== SKILLS::unknown
)
120 SkillsTree
[ skill
].ChildSkills
[ i
] = childSkill
;