]> git.localhorst.tv Git - l2e.git/blob - src/loader/Caster.cpp
moved Hero and Stats to common
[l2e.git] / src / loader / Caster.cpp
1 /*
2  * Caster.cpp
3  *
4  *  Created on: Sep 19, 2012
5  *      Author: holy
6  */
7
8 #include "Caster.h"
9
10 #include "TypeDescription.h"
11
12 using battle::Monster;
13 using battle::PartyLayout;
14 using common::Hero;
15 using common::Item;
16 using common::Spell;
17 using std::string;
18
19
20 namespace loader {
21
22 Caster::Caster(Interpreter &intp)
23 : intp(intp)
24 , battleResourcesId(TypeDescription::GetTypeId("BattleResources"))
25 , heroId(TypeDescription::GetTypeId("Hero"))
26 , itemId(TypeDescription::GetTypeId("Item"))
27 , monsterId(TypeDescription::GetTypeId("Monster"))
28 , partyLayoutId(TypeDescription::GetTypeId("PartyLayout"))
29 , spellId(TypeDescription::GetTypeId("Spell")) {
30
31 }
32
33
34 battle::Resources *Caster::GetBattleResources(const string &ident) {
35         return reinterpret_cast<battle::Resources *>(intp.GetObject(battleResourcesId, ident));
36 }
37
38 Hero *Caster::GetHero(const string &ident) {
39         return reinterpret_cast<Hero *>(intp.GetObject(heroId, ident));
40 }
41
42 Item *Caster::GetItem(const string &ident) {
43         return reinterpret_cast<Item *>(intp.GetObject(itemId, ident));
44 }
45
46 Monster *Caster::GetMonster(const string &ident) {
47         return reinterpret_cast<Monster *>(intp.GetObject(monsterId, ident));
48 }
49
50 PartyLayout *Caster::GetPartyLayout(const string &ident) {
51         return reinterpret_cast<PartyLayout *>(intp.GetObject(partyLayoutId, ident));
52 }
53
54 Spell *Caster::GetSpell(const string &ident) {
55         return reinterpret_cast<Spell *>(intp.GetObject(spellId, ident));
56 }
57
58 }