-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.cpp
141 lines (136 loc) · 3.32 KB
/
Item.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* Item.cpp
* TractionEdge
*
* Created by Steven Hamilton on 26/08/09.
* Copyright 2009 scorch.org. All rights reserved.
*
*/
#include <iostream>
#include "defines.h"
#include "GameWorld.h"
#include "Item.h"
#include "Logger.h"
#include "Utility.h"
Item::Item()
{
}
Item::~Item()
{
}
Item::Item(itemType_t item, int ownerId)
{
objectId=WORLD.getObjectId();
onMap = false;
ownerObjectId=ownerId;
switch (item) {
case CORPSE:
type=item;
itemAttackType=NO_ATTACK_TYPE;
gfxId=CORPSE_S;
name="Corpse";
weight=180;
break;
case PISTOL:
type=item;
itemAttackType=RANGED;
name="Pistol";
gfxId=WEAPON_S;
skill="HandGuns";
weight=40;
properties["Damage"] = 6;
properties["APCost"] = 15;
properties["Range"] = 5;
break;
case MUSKET:
type=item;
itemAttackType=RANGED;
name = "Musket";
gfxId = WEAPON_S;
skill = "LongGuns";
weight = 100;
properties["Damage"] = 14;
properties["APCost"] = 20;
properties["Range"] = 15;
break;
case MUSKETOON:
type=item;
itemAttackType=RANGED;
name = "Muskatoon";
gfxId = WEAPON_S;
skill = "Carbines";
weight = 70;
properties["Damage"] = 12;
properties["APCost"] = 15;
properties["Range"] = 10;
break;
case CUTLASS:
type=item;
itemAttackType=MELEE;
gfxId=WEAPON_S;
name="Cutlass";
skill = "ShortSwords";
weight = 35;
properties["Damage"] = 6;
properties["APCost"] = 10;
break;
case BILLYCLUB:
type=item;
itemAttackType=MELEE;
gfxId=WEAPON_S;
name="Billy Club";
skill = "Clubs";
weight = 40;
properties["Damage"] = 4;
properties["APCost"] = 8;
break;
case BRASS_FANG:
type=item;
itemAttackType=MELEE;
gfxId=WEAPON_S;
name="Brass Fang";
skill = "Knives";
weight = 20;
properties["Damage"] = 8;
properties["APCost"] = 11;
break;
case WOOD_MANDIBLE:
type=item;
itemAttackType=MELEE;
gfxId=WEAPON_S;
name="Wood Mandible";
skill = "Knives";
weight = 20;
properties["Damage"] = 4;
properties["APCost"] = 10;
break;
// case ARMOUR_IRON:
// gfxId=ARMOUR_S;
// name="Iron suit";
// properties["armourClass"]=4;
// break;
// case ARMOUR_LEATHER:
// gfxId=ARMOUR_S;
// name="Leather Jacket";
// properties["armourClass"]=2;
// break;
default:
break;
}
LOG << objectId,"Creating Item";
}
Item::Item(std::map<std::string,std::string> &attribs, Position pos, std::map<std::string, int> &propmap)
{
Utility tool;
objectId=tool.stringToInt(attribs["objectId"]);
gfxId=(gfxId_t)tool.stringToInt(attribs["gfxId"]);
ownerObjectId=tool.stringToInt(attribs["ownerObjectId"]);
name=attribs["name"];
type=(itemType_t)tool.stringToInt(attribs["type"]);
itemAttackType=(itemAttackType_t)tool.stringToInt(attribs["itemAttackType"]);
onMap=(bool)tool.stringToInt(attribs["onMap"]);
skill=attribs["skill"];
weight=tool.stringToInt(attribs["weight"]);
position = pos;
properties = propmap;
}