Mana
Loading...
Searching...
No Matches
playerinfo.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2010-2012 The Mana Developers
4 *
5 * This file is part of The Mana Client.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <map>
24
39
43struct Stat
44{
45 int base;
46 int mod;
47 int exp;
49};
50
55{
56 std::map<int, int> mAttributes;
57 std::map<int, Stat> mStats;
58};
59
60class Equipment;
61class Inventory;
62class Item;
63
71
75struct Ability
76{
80};
81
87namespace PlayerInfo
88{
89
90// --- Attributes -------------------------------------------------------------
91
95 int getAttribute(int id);
96
100 void setAttribute(int id, int value, bool notify = true);
101
102// --- Stats ------------------------------------------------------------------
103
107 int getStatBase(int id);
108
112 void setStatBase(int id, int value, bool notify = true);
113
117 int getStatMod(int id);
118
122 void setStatMod(int id, int value, bool notify = true);
123
128 int getStatEffective(int id);
129
133 void setStatLevel(int id, int value, bool notify = true);
134
138 std::pair<int, int> getStatExperience(int id);
139
143 void setStatExperience(int id, int have, int need, bool notify = true);
144
145// --- Inventory / Equipment / Storage ----------------------------------------
146
151
155 void clearInventory();
156
160 void setInventoryItem(int index, int id, int amount);
161
166
170 Item *getEquipment(unsigned int slot);
171
175 int getStorageCount();
176
180 void setStorageCount(int count);
181
182// -- NPC ---------------------------------------------------------------------
183
188
192 void setNPCInteractionCount(int count);
193
197 int getNPCPostCount();
198
202 void setNPCPostCount(int count);
203
204// -- Buy/Sell/Trade ----------------------------------------------------------
205
211
216 void setBuySellState(BuySellState buySellState);
217
218// --- Abilities --------------------------------------------------------------
219
223 void clearAbilityStatus(int id);
224
228 void setAbilityStatus(int id, int current, int max, int recharge);
229
233 const std::map<int, Ability> &getAbilityStatus();
234
235// --- Misc -------------------------------------------------------------------
236
240 void setBackend(const PlayerInfoBackend &backend);
241
246 bool isTalking();
247
251 void logic();
252
256 void init();
257
258} // namespace PlayerInfo
Represents one or more instances of a certain item type.
Definition item.h:35
A database like namespace which holds global info about the localplayer.
int getStatBase(int id)
Returns the base value of the given stat.
Inventory * getInventory()
Returns the player's inventory.
int getStatEffective(int id)
Returns the current effective value of the given stat.
int getStorageCount()
Returns the number of currently open storage windows.
void setStatLevel(int id, int value, bool notify=true)
Changes the level of the given stat.
void setBackend(const PlayerInfoBackend &backend)
Changes the internal PlayerInfoBackend reference;.
const std::map< int, Ability > & getAbilityStatus()
Returns the status all abilities.
void setBuySellState(BuySellState buySellState)
Sets which buy, sell, or related interaction the player is currently involved in.
void setNPCInteractionCount(int count)
Sets the number of currently open NPC interaction windows.
Equipment * getEquipment()
Returns the player's equipment.
void logic()
Does necessary updates every tick.
bool isTalking()
Returns true if the player is involved in a NPC interaction, false otherwise.
void setNPCPostCount(int count)
Sets the number of currently open NPC post windows.
void init()
Initializes some internals.
void setStatExperience(int id, int have, int need, bool notify)
Changes the experience of the given stat.
void setAbilityStatus(int id, int current, int max, int recharge)
Changes the status of the given ability.
void setStatBase(int id, int value, bool notify)
Changes the base value of the given stat.
BuySellState getBuySellState()
Returns the current buy, sell, or related interaction the player is involved in.
void setAttribute(int id, int value, bool notify)
Changes the value of the given attribute.
void clearInventory()
Clears the player's inventory and equipment.
void clearAbilityStatus(int id)
Removes the status for the given ability.
int getNPCPostCount()
Returns the number of currently open NPC post windows.
int getAttribute(int id)
Returns the value of the given attribute.
void setStorageCount(int count)
Sets the number of currently open storage windows.
int getStatMod(int id)
Returns the modifier for the given stat.
void setInventoryItem(int index, int id, int amount)
Changes the inventory item at the given slot.
std::pair< int, int > getStatExperience(int id)
Returns the experience of the given stat.
void setStatMod(int id, int value, bool notify)
Changes the modifier for the given stat.
int getNPCInteractionCount()
Returns the number of currently open NPC interaction windows.
Attribute
Standard attributes for players.
Definition playerinfo.h:29
@ MAX_WEIGHT
Definition playerinfo.h:35
@ EXP
Definition playerinfo.h:33
@ HP
Definition playerinfo.h:31
@ CORR_POINTS
Definition playerinfo.h:37
@ TOTAL_WEIGHT
Definition playerinfo.h:35
@ MAX_HP
Definition playerinfo.h:31
@ LEVEL
Definition playerinfo.h:30
@ EXP_NEEDED
Definition playerinfo.h:33
@ CHAR_POINTS
Definition playerinfo.h:37
@ MP
Definition playerinfo.h:32
@ MAX_MP
Definition playerinfo.h:32
@ SKILL_POINTS
Definition playerinfo.h:36
@ MONEY
Definition playerinfo.h:34
BuySellState
Definition playerinfo.h:65
@ BUYSELL_NONE
Definition playerinfo.h:66
@ BUYSELL_CHOOSING
Definition playerinfo.h:67
@ BUYSELL_BUYING
Definition playerinfo.h:68
@ BUYSELL_SELLING
Definition playerinfo.h:69
Ability information storage structure.
Definition playerinfo.h:76
int currentMana
Definition playerinfo.h:77
int neededMana
Definition playerinfo.h:78
int recharge
Definition playerinfo.h:79
Backend for core player information.
Definition playerinfo.h:55
std::map< int, Stat > mStats
Definition playerinfo.h:57
std::map< int, int > mAttributes
Definition playerinfo.h:56
Stat information storage structure.
Definition playerinfo.h:44
int base
Definition playerinfo.h:45
int mod
Definition playerinfo.h:46
int expNeed
Definition playerinfo.h:48
int exp
Definition playerinfo.h:47