//////////////////////////////////////////////////////////////////////////////
// This file is part of the Journey MMORPG client //
// Copyright © 2015-2016 Daniel Allendorf //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU Affero 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 Affero General Public License for more details. //
// //
// You should have received a copy of the GNU Affero General Public License //
// along with this program. If not, see . //
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "ItemData.h"
#include "../Character/Look/EquipSlot.h"
#include "../Character/EquipStat.h"
#include "../Character/MapleStat.h"
#include "../Template/EnumMap.h"
namespace jrc
{
class CharStats;
// Contains information about an equip.
class EquipData : public Cache
{
public:
// Returns wether the equip was loaded correctly.
bool is_valid() const;
// Returns wether the equip was loaded correctly.
explicit operator bool() const;
// Returns wether this equip has equipslot WEAPON.
bool is_weapon() const;
// Returns a required base stat.
int16_t get_reqstat(Maplestat::Id stat) const;
// Share requirement checks between the tooltip and equip actions.
bool meets_requirement(Maplestat::Id stat, const CharStats& stats) const;
bool can_equip(const CharStats& stats) const;
// Returns a default stat.
int16_t get_defstat(Equipstat::Id stat) const;
// Returns base upgrade slots for this equip.
uint8_t get_slots() const;
// Returns the equip slot.
Equipslot::Id get_eqslot() const;
// Returns the category name.
const std::string& get_type() const;
// Returns the general item data (name, price, etc.).
const ItemData& get_itemdata() const;
private:
// Allow the cache to use the constructor.
friend Cache;
// Load an equip from the game files.
EquipData(int32_t id);
const ItemData& itemdata;
EnumMap reqstats;
EnumMap defstats;
std::string type;
Equipslot::Id eqslot;
uint8_t slots;
bool cash;
bool tradeblock;
};
}