Mana
Loading...
Searching...
No Matches
charhandler.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 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 "localplayer.h"
25#include "playerinfo.h"
26
27#include <vector>
28
31
32namespace Net {
33
38{
40 {
41 delete dummy;
42 }
43
44 int slot = 0;
45 LocalPlayer *dummy = nullptr;
47};
48
49using Characters = std::list<Character *>;
50
52{
53 public:
54 virtual ~CharHandler() = default;
55
56 virtual void setCharSelectDialog(CharSelectDialog *window) = 0;
57
58 virtual void setCharCreateDialog(CharCreateDialog *window) = 0;
59
60 virtual void requestCharacters() = 0;
61
62 virtual void chooseCharacter(Net::Character *character) = 0;
63
64 virtual void newCharacter(const std::string &name, int slot,
65 Gender gender, int hairstyle, int hairColor,
66 const std::vector<int> &stats) = 0;
67
68 virtual void deleteCharacter(Net::Character *character) = 0;
69
70 virtual void switchCharacter() = 0;
71
72 virtual unsigned int baseSprite() const = 0;
73
74 virtual unsigned int hairSprite() const = 0;
75
76 virtual unsigned int maxSprite() const = 0;
77
82 virtual int getCharCreateMinHairColorId() const { return 0; }
83
88 virtual int getCharCreateMaxHairColorId() const = 0;
89
94 virtual int getCharCreateMaxHairStyleId() const = 0;
95
96 protected:
97 CharHandler() = default;
98
101
104
107
110};
111
112} // namespace Net
Gender
Definition being.h:58
Character creation dialog.
Character selection dialog.
The local player character.
Definition localplayer.h:75
virtual void chooseCharacter(Net::Character *character)=0
virtual unsigned int baseSprite() const =0
CharSelectDialog * mCharSelectDialog
virtual int getCharCreateMaxHairColorId() const =0
Returns the max permitted hair color Id at character creation time, or 0 if no limit should be applie...
virtual void switchCharacter()=0
Net::Characters mCharacters
The list of available characters.
virtual unsigned int maxSprite() const =0
CharHandler()=default
Net::Character * mSelectedCharacter
The selected character.
virtual ~CharHandler()=default
virtual unsigned int hairSprite() const =0
virtual void setCharSelectDialog(CharSelectDialog *window)=0
void unlockCharSelectDialog()
virtual void newCharacter(const std::string &name, int slot, Gender gender, int hairstyle, int hairColor, const std::vector< int > &stats)=0
virtual void setCharCreateDialog(CharCreateDialog *window)=0
CharCreateDialog * mCharCreateDialog
virtual void deleteCharacter(Net::Character *character)=0
void updateCharSelectDialog()
virtual int getCharCreateMinHairColorId() const
Returns the min permitted hair color Id at character creation time, or 0 if there is no minimum.
Definition charhandler.h:82
virtual int getCharCreateMaxHairStyleId() const =0
Returns the max permitted hair style Id at character creation time, or 0 if no limit should be applie...
virtual void requestCharacters()=0
The network communication layer.
std::list< Character * > Characters
Definition charhandler.h:49
A structure to hold information about a character.
Definition charhandler.h:38
LocalPlayer * dummy
A dummy representing this character.
Definition charhandler.h:45
PlayerInfoBackend data
Definition charhandler.h:46
int slot
The index in the list of characters.
Definition charhandler.h:44
Backend for core player information.
Definition playerinfo.h:55