]> git.localhorst.tv Git - l2e.git/blob - src/loader/Caster.cpp
152c8b298dfa1958a793800c35f7cd8d0a760f20
[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 map::Map;
18 using std::string;
19
20
21 namespace loader {
22
23 Caster::Caster(Interpreter &intp)
24 : intp(intp)
25 , battleResourcesId(TypeDescription::GetTypeId("BattleResources"))
26 , heroId(TypeDescription::GetTypeId("Hero"))
27 , itemId(TypeDescription::GetTypeId("Item"))
28 , mapId(TypeDescription::GetTypeId("Map"))
29 , monsterId(TypeDescription::GetTypeId("Monster"))
30 , partyLayoutId(TypeDescription::GetTypeId("PartyLayout"))
31 , spellId(TypeDescription::GetTypeId("Spell")) {
32
33 }
34
35
36 battle::Resources *Caster::GetBattleResources(const string &ident) {
37         return reinterpret_cast<battle::Resources *>(intp.GetObject(battleResourcesId, ident));
38 }
39
40 Hero *Caster::GetHero(const string &ident) {
41         return reinterpret_cast<Hero *>(intp.GetObject(heroId, ident));
42 }
43
44 Item *Caster::GetItem(const string &ident) {
45         return reinterpret_cast<Item *>(intp.GetObject(itemId, ident));
46 }
47
48 Map *Caster::GetMap(const string &ident) {
49         return reinterpret_cast<Map *>(intp.GetObject(mapId, ident));
50 }
51
52 Monster *Caster::GetMonster(const string &ident) {
53         return reinterpret_cast<Monster *>(intp.GetObject(monsterId, ident));
54 }
55
56 PartyLayout *Caster::GetPartyLayout(const string &ident) {
57         return reinterpret_cast<PartyLayout *>(intp.GetObject(partyLayoutId, ident));
58 }
59
60 Spell *Caster::GetSpell(const string &ident) {
61         return reinterpret_cast<Spell *>(intp.GetObject(spellId, ident));
62 }
63
64 }