Mana
Loading...
Searching...
No Matches
charhandler.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
25
26#include "net/charhandler.h"
27
29
30#include <map.h>
31
32class LoginData;
33
34namespace ManaServ {
35
39class CharHandler final : public MessageHandler, public Net::CharHandler
40{
41 public:
43
44 ~CharHandler() override;
45
46 void handleMessage(MessageIn &msg) override;
47
48 void setCharSelectDialog(CharSelectDialog *window) override;
49
55 void setCharCreateDialog(CharCreateDialog *window) override;
56
57 void requestCharacters() override;
58
59 void chooseCharacter(Net::Character *character) override;
60
61 void newCharacter(const std::string &name, int slot,
62 Gender gender, int hairstyle, int hairColor,
63 const std::vector<int> &stats) override;
64
65 void deleteCharacter(Net::Character *character) override;
66
67 void switchCharacter() override;
68
69 unsigned int baseSprite() const override;
70
71 unsigned int hairSprite() const override;
72
73 unsigned int maxSprite() const override;
74
75 // No limitation on Manaserv
76 int getCharCreateMaxHairColorId() const override
77 { return 0; }
78
79 // No limitation on Manaserv
80 int getCharCreateMaxHairStyleId() const override
81 { return 0; }
82
83 void clear();
84
85 private:
92 double base;
93 double mod;
94 };
95
97 int id;
98 int itemId;
99 };
100
102 int slot;
103 std::string name;
109 std::vector<EquipmentSlot> equipment;
110 std::map<int, CachedAttribute> attributes;
111 };
112
117
118 void updateCharacters();
119
121 std::vector<CachedCharacterInfo> mCachedCharacterInfos;
122};
123
124} // namespace ManaServ
Gender
Definition being.h:58
Character creation dialog.
Character selection dialog.
Deals with incoming messages related to character selection.
Definition charhandler.h:40
unsigned int hairSprite() const override
void newCharacter(const std::string &name, int slot, Gender gender, int hairstyle, int hairColor, const std::vector< int > &stats) override
void deleteCharacter(Net::Character *character) override
void handleCharacterCreateResponse(MessageIn &msg)
unsigned int baseSprite() const override
unsigned int maxSprite() const override
int getCharCreateMaxHairStyleId() const override
Returns the max permitted hair style Id at character creation time, or 0 if no limit should be applie...
Definition charhandler.h:80
void requestCharacters() override
void handleMessage(MessageIn &msg) override
void handleCharacterInfo(MessageIn &msg)
void switchCharacter() override
void setCharSelectDialog(CharSelectDialog *window) override
void handleCharacterDeleteResponse(MessageIn &msg)
void setCharCreateDialog(CharCreateDialog *window) override
Sets the character create dialog.
int getCharCreateMaxHairColorId() const override
Returns the max permitted hair color Id at character creation time, or 0 if no limit should be applie...
Definition charhandler.h:76
void handleCharacterSelectResponse(MessageIn &msg)
void chooseCharacter(Net::Character *character) override
std::vector< CachedCharacterInfo > mCachedCharacterInfos
Cached character information.
Used for parsing an incoming message from manaserv.
Definition messagein.h:37
Character information needs to be cached since we receive it before we have loaded the dynamic data,...
Definition charhandler.h:91
std::map< int, CachedAttribute > attributes
std::vector< EquipmentSlot > equipment
A structure to hold information about a character.
Definition charhandler.h:38