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