summaryrefslogtreecommitdiff
path: root/src/map/map.t.hpp
blob: b475f9b1c8eef21c49cfd57980b49e4937236b61 (plain) (blame)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#pragma once
//    map.t.hpp - Core of the map server.
//
//    Copyright © ????-2004 Athena Dev Teams
//    Copyright © 2004-2011 The Mana World Development Team
//    Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com>
//
//    This file is part of The Mana World (Athena server)
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include "fwd.hpp"

#include <cstdint>

#include "../strings/vstring.hpp"

#include "../generic/enum.hpp"

#include "../mmo/ids.hpp"
#include "../mmo/mmo.hpp"


namespace tmwa
{
enum class BL : uint8_t
{
    NUL,
    PC,
    NPC,
    MOB,
    ITEM,
    SPELL,
};
enum class NpcSubtype : uint8_t
{
    WARP,
    SHOP,
    SCRIPT,
    MESSAGE,

    COUNT,
};

enum class mob_stat
{
    LV,
    MAX_HP,
    STR,
    AGI,
    VIT,
    INT,
    DEX,
    LUK,
    // low and high attacks
    ATK1,
    ATK2,
    // attack delay
    ADELAY,
    DEF,
    MDEF,
    SPEED,
    // These must come last:
    // [Fate] Encoded as base to 1024: 1024 means 100%
    XP_BONUS,
    LAST,
};

enum class MS : uint8_t
{
    IDLE,
    WALK,
    ATTACK,
    DEAD,
};

enum class ATK
{
    ZERO = 0,

    LUCKY,
    FLEE,
    DEF,
};


enum class EQUIP
{
    NONE    = -1,
    MISC2   = 0,
    CAPE    = 1,
    SHOES   = 2,
    GLOVES  = 3,
    LEGS    = 4, // also called "head bottom"
    TORSO   = 5, // also called "head middle"
    HAT     = 6, // also called "head top"
    MISC1   = 7,
    SHIELD  = 8,
    WEAPON  = 9,
    ARROW   = 10,
    COUNT   = 11,
};

constexpr
EQUIP EQUIPs[] =
{
    EQUIP::MISC2,
    EQUIP::CAPE,
    EQUIP::SHOES,
    EQUIP::GLOVES,
    EQUIP::LEGS,
    EQUIP::TORSO,
    EQUIP::HAT,
    EQUIP::MISC1,
    EQUIP::SHIELD,
    EQUIP::WEAPON,
    EQUIP::ARROW,
};

constexpr
EQUIP EQUIPs_noarrow[] =
{
    EQUIP::MISC2,
    EQUIP::CAPE,
    EQUIP::SHOES,
    EQUIP::GLOVES,
    EQUIP::LEGS,
    EQUIP::TORSO,
    EQUIP::HAT,
    EQUIP::MISC1,
    EQUIP::SHIELD,
    EQUIP::WEAPON,
};

namespace e
{
enum class MobMode : uint16_t
{
    ZERO                        = 0x0000,

    CAN_MOVE                    = 0x0001,
    LOOTER                      = 0x0002,
    AGGRESSIVE                  = 0x0004,
    ASSIST                      = 0x0008,

    CAST_SENSOR                 = 0x0010,
    BOSS                        = 0x0020,
    // sometimes also called "robust"
    PLANT                       = 0x0040,
    CAN_ATTACK                  = 0x0080,

    DETECTOR                    = 0x0100,
    CHANGE_TARGET               = 0x0200,

    war                         = CAN_MOVE | AGGRESSIVE | CAN_ATTACK,

    SUMMONED                    = 0x1000,
    TURNS_AGAINST_BAD_MASTER    = 0x2000,

    // mob mode flags that Fate actually understood
    SENSIBLE_MASK               = 0xf000,
};

ENUM_BITWISE_OPERATORS(MobMode)
}
using e::MobMode;

namespace e
{
enum class MapCell : uint8_t
{
    // the usual thing
    UNWALKABLE  = 0x01,
    // not in tmwa data
    _range      = 0x04,
    // set in code, not imported
    NPC_NEAR    = 0x80,
};
ENUM_BITWISE_OPERATORS(MapCell)
}
using e::MapCell;

struct MobName : VString<23> {};
struct NpcName : VString<23> {};
struct ScriptLabel : VString<23> {};
struct ItemName : VString<23> {};

inline
BlockId account_to_block(AccountId a) { return wrap<BlockId>(unwrap<AccountId>(a)); }
inline
AccountId block_to_account(BlockId b) { return wrap<AccountId>(unwrap<BlockId>(b)); }
} // namespace tmwa