Mana
Loading...
Searching...
No Matches
iteminfo.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "being.h"
25
26#include "resources/spritedef.h"
27
28#include <map>
29#include <string>
30#include <vector>
31
33{
34 Strike,
35 Hit
36};
37
61
62namespace TmwAthena {
63class TaItemDB;
64}
65
66namespace ManaServ {
67class ManaServItemDB;
68}
69
76
82
84{
85 struct Item
86 {
87 int from = 0; // ID to replace (0: any)
88 int to = 0; // Replace with this ID (0: remove)
89 };
90
91 uint8_t sprite = SPRITE_ALL; // sprite slot to replace
92 uint8_t direction = DIRECTION_ALL; // direction in which to replace
93 std::vector<Item> items; // specific items to replace (empty: remove)
94};
95
100{
101 friend class ItemDB;
104
105public:
106 ItemInfo() = default;
107
108 // disable copying
109 ItemInfo(const ItemInfo &) = delete;
110 ItemInfo &operator=(const ItemInfo &) = delete;
111
112 int id = 0;
113 std::string name;
115 std::string description;
116 std::vector<std::string> effect;
117 int weight = 0;
121 int hitEffectId = 0;
123
128 std::string attackAction = SpriteAction::INVALID;
129
131 int attackRange = 0;
132
133 bool equippable = false;
134 bool activatable = false;
138 std::vector<Replacement> replacements;
139
140 const std::string &getSprite(Gender gender, int race) const;
141 const std::string &getSound(EquipmentSoundEvent event) const;
142
143private:
144 void setSprite(const std::string &animationFile, Gender gender, int race);
145 void addSound(EquipmentSoundEvent event, const std::string &filename);
146
147 int mView = 0;
150 std::map<int, std::string> mAnimationFiles;
151
153 std::map<EquipmentSoundEvent, std::vector<std::string>> mSounds;
154};
155
156/*
157 * TmwAthena specialization of the ItemInfo for TmwAthena
158 */
159namespace TmwAthena {
160
162{
163 // Equipment rules:
164 // 1 Brest equipment
166 // 1 arms equipment
168 // 1 head equipment
170 // 1 legs equipment
172 // 1 feet equipment
174 // 2 rings
177 // 1 necklace
179 // Fight:
180 // 2 one-handed weapons
181 // or 1 two-handed weapon
182 // or 1 one-handed weapon + 1 shield.
185 // Projectile:
186 // this item does not amount to one, it only indicates the chosen projectile.
190
191} // namespace TmwAthena
Gender
Definition being.h:58
Item information database generic definition.
Definition itemdb.h:73
Defines a class for storing generic item infos.
Definition iteminfo.h:100
int attackRange
Attack range, will be equal to ATTACK_RANGE_NOT_SET if no weapon.
Definition iteminfo.h:131
std::string description
Short description.
Definition iteminfo.h:115
std::map< EquipmentSoundEvent, std::vector< std::string > > mSounds
Stores the names of sounds to be played at certain event.
Definition iteminfo.h:153
std::string name
Definition iteminfo.h:113
int hitEffectId
Definition iteminfo.h:121
const std::string & getSprite(Gender gender, int race) const
Definition iteminfo.cpp:27
std::string attackAction
Attack type, in case of weapon.
Definition iteminfo.h:128
std::string missileParticleFile
Effects to be shown when weapon attacks - see also effects.xml.
Definition iteminfo.h:120
ItemInfo & operator=(const ItemInfo &)=delete
std::vector< Replacement > replacements
Definition iteminfo.h:138
SpriteDisplay display
Display info (like icon)
Definition iteminfo.h:114
int mView
Item ID of how this item looks.
Definition iteminfo.h:147
void setSprite(const std::string &animationFile, Gender gender, int race)
Definition iteminfo.cpp:57
const std::string & getSound(EquipmentSoundEvent event) const
Definition iteminfo.cpp:50
int weight
Weight in grams.
Definition iteminfo.h:117
std::vector< std::string > effect
Description of effects.
Definition iteminfo.h:116
std::map< int, std::string > mAnimationFiles
Maps gender to sprite filenames.
Definition iteminfo.h:150
bool equippable
Whether this item can be equipped.
Definition iteminfo.h:133
ItemInfo(const ItemInfo &)=delete
ItemType type
Item type.
Definition iteminfo.h:136
void addSound(EquipmentSoundEvent event, const std::string &filename)
Definition iteminfo.cpp:45
ItemInfo()=default
bool activatable
Whether this item can be activated.
Definition iteminfo.h:134
int criticalHitEffectId
Definition iteminfo.h:122
Item information database TmwAthena specific class.
Definition itemdb.h:191
Item information database TmwAthena specific class.
Definition itemdb.h:159
ItemType
Enumeration of available Item types.
Definition iteminfo.h:43
@ ITEM_EQUIPMENT_LEGS
Definition iteminfo.h:51
@ ITEM_EQUIPMENT_ARMS
Definition iteminfo.h:49
@ ITEM_EQUIPMENT_RING
Definition iteminfo.h:53
@ ITEM_EQUIPMENT_NECKLACE
Definition iteminfo.h:54
@ ITEM_SPRITE_HAIR
Definition iteminfo.h:59
@ ITEM_EQUIPMENT_ONE_HAND_WEAPON
Definition iteminfo.h:46
@ ITEM_EQUIPMENT_TORSO
Definition iteminfo.h:48
@ ITEM_EQUIPMENT_CHARM
Definition iteminfo.h:57
@ ITEM_EQUIPMENT_HEAD
Definition iteminfo.h:50
@ ITEM_SPRITE_RACE
Definition iteminfo.h:58
@ ITEM_EQUIPMENT_AMMO
Definition iteminfo.h:56
@ ITEM_UNUSABLE
Definition iteminfo.h:44
@ ITEM_EQUIPMENT_TWO_HANDS_WEAPON
Definition iteminfo.h:47
@ ITEM_EQUIPMENT_FEET
Definition iteminfo.h:55
@ ITEM_EQUIPMENT_SHIELD
Definition iteminfo.h:52
@ ITEM_USABLE
Definition iteminfo.h:45
ReplacementSprite
Definition iteminfo.h:78
@ SPRITE_UNKNOWN
Definition iteminfo.h:79
@ SPRITE_ALL
Definition iteminfo.h:80
EquipmentSoundEvent
Definition iteminfo.h:33
ReplacementDirection
Definition iteminfo.h:71
@ DIRECTION_DEAD
Definition iteminfo.h:73
@ DIRECTION_UNKNOWN
Definition iteminfo.h:74
@ DIRECTION_ALL
Definition iteminfo.h:72
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
@ EQUIP_ARMS_SLOT
Definition iteminfo.h:167
@ EQUIP_LEGS_SLOT
Definition iteminfo.h:171
@ EQUIP_FIGHT2_SLOT
Definition iteminfo.h:184
@ EQUIP_RING2_SLOT
Definition iteminfo.h:176
@ EQUIP_FEET_SLOT
Definition iteminfo.h:173
@ EQUIP_FIGHT1_SLOT
Definition iteminfo.h:183
@ EQUIP_RING1_SLOT
Definition iteminfo.h:175
@ EQUIP_HEAD_SLOT
Definition iteminfo.h:169
@ EQUIP_VECTOR_END
Definition iteminfo.h:188
@ EQUIP_NECKLACE_SLOT
Definition iteminfo.h:178
@ EQUIP_PROJECTILE_SLOT
Definition iteminfo.h:187
@ EQUIP_TORSO_SLOT
Definition iteminfo.h:165
unsigned char uint8_t
Definition sha256.cpp:81
@ DIRECTION_INVALID
Definition spritedef.h:80
@ DIRECTION_DEFAULT
Definition spritedef.h:75
uint8_t direction
Definition iteminfo.h:92
uint8_t sprite
Definition iteminfo.h:91
std::vector< Item > items
Definition iteminfo.h:93