mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Skill Caps] Further improvements (#4205)
This commit is contained in:
parent
823a5956de
commit
cf7f0f4321
@ -83,6 +83,7 @@ SET(common_sources
|
|||||||
shared_tasks.cpp
|
shared_tasks.cpp
|
||||||
shareddb.cpp
|
shareddb.cpp
|
||||||
skills.cpp
|
skills.cpp
|
||||||
|
skill_caps.cpp
|
||||||
spdat.cpp
|
spdat.cpp
|
||||||
strings.cpp
|
strings.cpp
|
||||||
struct_strategy.cpp
|
struct_strategy.cpp
|
||||||
@ -492,7 +493,7 @@ SET(repositories
|
|||||||
repositories/zone_repository.h
|
repositories/zone_repository.h
|
||||||
repositories/zone_points_repository.h
|
repositories/zone_points_repository.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(common_headers
|
SET(common_headers
|
||||||
additive_lagged_fibonacci_engine.h
|
additive_lagged_fibonacci_engine.h
|
||||||
@ -592,7 +593,7 @@ SET(common_headers
|
|||||||
ptimer.h
|
ptimer.h
|
||||||
queue.h
|
queue.h
|
||||||
races.h
|
races.h
|
||||||
raid.h
|
raid.h
|
||||||
random.h
|
random.h
|
||||||
rdtsc.h
|
rdtsc.h
|
||||||
rulesys.h
|
rulesys.h
|
||||||
@ -606,6 +607,7 @@ SET(common_headers
|
|||||||
shared_tasks.h
|
shared_tasks.h
|
||||||
shareddb.h
|
shareddb.h
|
||||||
skills.h
|
skills.h
|
||||||
|
skill_caps.h
|
||||||
spdat.h
|
spdat.h
|
||||||
strings.h
|
strings.h
|
||||||
struct_strategy.h
|
struct_strategy.h
|
||||||
@ -681,13 +683,13 @@ SOURCE_GROUP(Event FILES
|
|||||||
event/event_loop.h
|
event/event_loop.h
|
||||||
event/timer.h
|
event/timer.h
|
||||||
event/task.h
|
event/task.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Json FILES
|
SOURCE_GROUP(Json FILES
|
||||||
json/json.h
|
json/json.h
|
||||||
json/jsoncpp.cpp
|
json/jsoncpp.cpp
|
||||||
json/json-forwards.h
|
json/json-forwards.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Net FILES
|
SOURCE_GROUP(Net FILES
|
||||||
net/console_server.cpp
|
net/console_server.cpp
|
||||||
@ -724,7 +726,7 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/websocket_server.h
|
net/websocket_server.h
|
||||||
net/websocket_server_connection.cpp
|
net/websocket_server_connection.cpp
|
||||||
net/websocket_server_connection.h
|
net/websocket_server_connection.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Patches FILES
|
SOURCE_GROUP(Patches FILES
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
@ -768,12 +770,12 @@ SOURCE_GROUP(Patches FILES
|
|||||||
patches/titanium_limits.cpp
|
patches/titanium_limits.cpp
|
||||||
patches/uf.cpp
|
patches/uf.cpp
|
||||||
patches/uf_limits.cpp
|
patches/uf_limits.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(StackWalker FILES
|
SOURCE_GROUP(StackWalker FILES
|
||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
StackWalker/StackWalker.cpp
|
StackWalker/StackWalker.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Util FILES
|
SOURCE_GROUP(Util FILES
|
||||||
util/memory_stream.h
|
util/memory_stream.h
|
||||||
@ -781,7 +783,7 @@ SOURCE_GROUP(Util FILES
|
|||||||
util/directory.h
|
util/directory.h
|
||||||
util/uuid.cpp
|
util/uuid.cpp
|
||||||
util/uuid.h
|
util/uuid.h
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
|
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
|
||||||
|
|
||||||
@ -794,6 +796,6 @@ ENDIF (UNIX)
|
|||||||
|
|
||||||
IF (WIN32 AND EQEMU_BUILD_PCH)
|
IF (WIN32 AND EQEMU_BUILD_PCH)
|
||||||
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
|
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
|
||||||
ENDIF()
|
ENDIF ()
|
||||||
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@ -1914,24 +1914,3 @@ void SharedDatabase::SetSharedSpellsCount(uint32 shared_spells_count)
|
|||||||
{
|
{
|
||||||
SharedDatabase::m_shared_spells_count = shared_spells_count;
|
SharedDatabase::m_shared_spells_count = shared_spells_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 SharedDatabase::GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
|
||||||
{
|
|
||||||
const auto& l = SkillCapsRepository::GetWhere(
|
|
||||||
*this,
|
|
||||||
fmt::format(
|
|
||||||
"`class_id` = {} AND `skill_id` = {} AND `level` = {} LIMIT 1",
|
|
||||||
class_id,
|
|
||||||
static_cast<uint16>(skill_id),
|
|
||||||
level
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (l.empty()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& e = l.front();
|
|
||||||
|
|
||||||
return e.cap;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -160,8 +160,6 @@ public:
|
|||||||
uint32 GetSharedItemsCount() { return m_shared_items_count; }
|
uint32 GetSharedItemsCount() { return m_shared_items_count; }
|
||||||
uint32 GetItemsCount();
|
uint32 GetItemsCount();
|
||||||
|
|
||||||
uint16 GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spells
|
* spells
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,17 +1,24 @@
|
|||||||
#include "zone.h"
|
#include "skill_caps.h"
|
||||||
|
|
||||||
SkillCapsRepository::SkillCaps Zone::GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
SkillCaps *SkillCaps::SetContentDatabase(Database *db)
|
||||||
|
{
|
||||||
|
m_content_database = db;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillCapsRepository::SkillCaps SkillCaps::GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
||||||
{
|
{
|
||||||
if (!IsPlayerClass(class_id)) {
|
if (!IsPlayerClass(class_id)) {
|
||||||
return SkillCapsRepository::NewEntity();
|
return SkillCapsRepository::NewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& e : m_skill_caps) {
|
for (const auto &e: m_skill_caps) {
|
||||||
if (
|
if (
|
||||||
e.class_id == class_id &&
|
e.class_id == class_id &&
|
||||||
e.level == level &&
|
e.level == level &&
|
||||||
static_cast<EQ::skills::SkillType>(e.skill_id) == skill_id
|
static_cast<EQ::skills::SkillType>(e.skill_id) == skill_id
|
||||||
) {
|
) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,31 +26,31 @@ SkillCapsRepository::SkillCaps Zone::GetSkillCap(uint8 class_id, EQ::skills::Ski
|
|||||||
return SkillCapsRepository::NewEntity();
|
return SkillCapsRepository::NewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 Zone::GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
uint8 SkillCaps::GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!IsPlayerClass(class_id) ||
|
!IsPlayerClass(class_id) ||
|
||||||
class_id > Class::PLAYER_CLASS_COUNT ||
|
class_id > Class::PLAYER_CLASS_COUNT ||
|
||||||
static_cast<uint32>(skill_id) > (EQ::skills::HIGHEST_SKILL + 1)
|
static_cast<uint32>(skill_id) > (EQ::skills::HIGHEST_SKILL + 1)
|
||||||
) {
|
) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8 skill_cap_max_level = (
|
const uint8 skill_cap_max_level = (
|
||||||
RuleI(Character, SkillCapMaxLevel) > 0 ?
|
RuleI(Character, SkillCapMaxLevel) > 0 ?
|
||||||
RuleI(Character, SkillCapMaxLevel) :
|
RuleI(Character, SkillCapMaxLevel) :
|
||||||
RuleI(Character, MaxLevel)
|
RuleI(Character, MaxLevel)
|
||||||
);
|
);
|
||||||
|
|
||||||
const uint8 max_level = level > skill_cap_max_level ? level : skill_cap_max_level;
|
const uint8 max_level = level > skill_cap_max_level ? level : skill_cap_max_level;
|
||||||
|
|
||||||
for (const auto& e : m_skill_caps) {
|
for (const auto &e: m_skill_caps) {
|
||||||
for (uint8 current_level = 1; current_level <= max_level; current_level++) {
|
for (uint8 current_level = 1; current_level <= max_level; current_level++) {
|
||||||
if (
|
if (
|
||||||
e.class_id == class_id &&
|
e.class_id == class_id &&
|
||||||
static_cast<EQ::skills::SkillType>(e.skill_id) == skill_id &&
|
static_cast<EQ::skills::SkillType>(e.skill_id) == skill_id &&
|
||||||
e.level == current_level
|
e.level == current_level
|
||||||
) {
|
) {
|
||||||
return current_level;
|
return current_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,18 +59,18 @@ uint8 Zone::GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::LoadSkillCaps()
|
void SkillCaps::LoadSkillCaps()
|
||||||
{
|
{
|
||||||
const auto& l = SkillCapsRepository::All(content_db);
|
const auto &l = SkillCapsRepository::All(*m_content_database);
|
||||||
|
|
||||||
m_skill_caps.reserve(l.size());
|
m_skill_caps.reserve(l.size());
|
||||||
|
|
||||||
for (const auto& e : l) {
|
for (const auto &e: l) {
|
||||||
if (
|
if (
|
||||||
e.level < 1 ||
|
e.level < 1 ||
|
||||||
!IsPlayerClass(e.class_id) ||
|
!IsPlayerClass(e.class_id) ||
|
||||||
static_cast<EQ::skills::SkillType>(e.skill_id) >= EQ::skills::SkillCount
|
static_cast<EQ::skills::SkillType>(e.skill_id) >= EQ::skills::SkillCount
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +84,7 @@ void Zone::LoadSkillCaps()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::ReloadSkillCaps()
|
void SkillCaps::ReloadSkillCaps()
|
||||||
{
|
{
|
||||||
ClearSkillCaps();
|
ClearSkillCaps();
|
||||||
LoadSkillCaps();
|
LoadSkillCaps();
|
||||||
26
common/skill_caps.h
Normal file
26
common/skill_caps.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef CODE_SKILL_CAPS_H
|
||||||
|
#define CODE_SKILL_CAPS_H
|
||||||
|
|
||||||
|
#include "repositories/skill_caps_repository.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "classes.h"
|
||||||
|
#include "skills.h"
|
||||||
|
|
||||||
|
class SkillCaps {
|
||||||
|
public:
|
||||||
|
inline void ClearSkillCaps() { m_skill_caps.clear(); }
|
||||||
|
SkillCapsRepository::SkillCaps GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
||||||
|
uint8 GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
||||||
|
void LoadSkillCaps();
|
||||||
|
void ReloadSkillCaps();
|
||||||
|
|
||||||
|
SkillCaps *SetContentDatabase(Database *db);
|
||||||
|
private:
|
||||||
|
Database *m_content_database{};
|
||||||
|
std::vector<SkillCapsRepository::SkillCaps> m_skill_caps = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
extern SkillCaps skill_caps;
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CODE_SKILL_CAPS_H
|
||||||
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "skills.h"
|
#include "skills.h"
|
||||||
|
#include "classes.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
bool EQ::skills::IsTradeskill(SkillType skill)
|
bool EQ::skills::IsTradeskill(SkillType skill)
|
||||||
{
|
{
|
||||||
switch (skill) {
|
switch (skill) {
|
||||||
|
|||||||
@ -26,7 +26,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ
|
||||||
{
|
{
|
||||||
namespace skills {
|
namespace skills {
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
#include "../common/content/world_content_service.h"
|
#include "../common/content/world_content_service.h"
|
||||||
#include "../common/repositories/group_id_repository.h"
|
#include "../common/repositories/group_id_repository.h"
|
||||||
#include "../common/repositories/character_data_repository.h"
|
#include "../common/repositories/character_data_repository.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -2133,7 +2134,7 @@ void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
|
|||||||
i == EQ::skills::SkillAlcoholTolerance || i == EQ::skills::SkillBindWound)
|
i == EQ::skills::SkillAlcoholTolerance || i == EQ::skills::SkillBindWound)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pp->skills[i] = content_db.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1);
|
pp->skills[i] = skill_caps.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,8 +86,9 @@
|
|||||||
#include "world_boot.h"
|
#include "world_boot.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
|
SkillCaps skill_caps;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
ClientList client_list;
|
ClientList client_list;
|
||||||
GroupLFPList LFPGroupList;
|
GroupLFPList LFPGroupList;
|
||||||
@ -193,6 +194,8 @@ int main(int argc, char **argv)
|
|||||||
->SetExpansionContext()
|
->SetExpansionContext()
|
||||||
->ReloadContentFlags();
|
->ReloadContentFlags();
|
||||||
|
|
||||||
|
skill_caps.SetContentDatabase(&content_db)->LoadSkillCaps();
|
||||||
|
|
||||||
std::unique_ptr<EQ::Net::ServertalkServer> server_connection;
|
std::unique_ptr<EQ::Net::ServertalkServer> server_connection;
|
||||||
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
|
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "../common/patches/patches.h"
|
#include "../common/patches/patches.h"
|
||||||
#include "../zone/data_bucket.h"
|
#include "../zone/data_bucket.h"
|
||||||
#include "../common/repositories/guild_tributes_repository.h"
|
#include "../common/repositories/guild_tributes_repository.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern GroupLFPList LFPGroupList;
|
extern GroupLFPList LFPGroupList;
|
||||||
@ -1411,7 +1412,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_ReloadNPCEmotes:
|
case ServerOP_ReloadNPCEmotes:
|
||||||
case ServerOP_ReloadObjects:
|
case ServerOP_ReloadObjects:
|
||||||
case ServerOP_ReloadPerlExportSettings:
|
case ServerOP_ReloadPerlExportSettings:
|
||||||
case ServerOP_ReloadSkillCaps:
|
|
||||||
case ServerOP_ReloadStaticZoneData:
|
case ServerOP_ReloadStaticZoneData:
|
||||||
case ServerOP_ReloadTitles:
|
case ServerOP_ReloadTitles:
|
||||||
case ServerOP_ReloadTraps:
|
case ServerOP_ReloadTraps:
|
||||||
@ -1437,6 +1437,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ServerOP_ReloadSkillCaps: {
|
||||||
|
zoneserver_list.SendPacket(pack);
|
||||||
|
skill_caps.ReloadSkillCaps();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ServerOP_ReloadRules: {
|
case ServerOP_ReloadRules: {
|
||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
RuleManager::Instance()->LoadRules(&database, "default", true);
|
RuleManager::Instance()->LoadRules(&database, "default", true);
|
||||||
|
|||||||
@ -166,7 +166,6 @@ SET(zone_sources
|
|||||||
zone_event_scheduler.cpp
|
zone_event_scheduler.cpp
|
||||||
zone_npc_factions.cpp
|
zone_npc_factions.cpp
|
||||||
zone_reload.cpp
|
zone_reload.cpp
|
||||||
zone_skill_caps.cpp
|
|
||||||
zoning.cpp
|
zoning.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#include "../common/repositories/bot_starting_items_repository.h"
|
#include "../common/repositories/bot_starting_items_repository.h"
|
||||||
#include "../common/data_verification.h"
|
#include "../common/data_verification.h"
|
||||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
// This constructor is used during the bot create command
|
// This constructor is used during the bot create command
|
||||||
Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) {
|
Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm::vec4(), Ground, false), rest_timer(1), ping_timer(1) {
|
||||||
@ -1171,7 +1172,7 @@ uint16 Bot::GetPrimarySkillValue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16 Bot::MaxSkill(EQ::skills::SkillType skillid, uint16 class_, uint16 level) const {
|
uint16 Bot::MaxSkill(EQ::skills::SkillType skillid, uint16 class_, uint16 level) const {
|
||||||
return(content_db.GetSkillCap(class_, skillid, level));
|
return skill_caps.GetSkillCap(class_, skillid, level).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetTotalATK() {
|
uint32 Bot::GetTotalATK() {
|
||||||
@ -6758,7 +6759,7 @@ void Bot::CalcBotStats(bool showtext) {
|
|||||||
SetLevel(GetBotOwner()->GetLevel());
|
SetLevel(GetBotOwner()->GetLevel());
|
||||||
|
|
||||||
for (int sindex = 0; sindex <= EQ::skills::HIGHEST_SKILL; ++sindex) {
|
for (int sindex = 0; sindex <= EQ::skills::HIGHEST_SKILL; ++sindex) {
|
||||||
skills[sindex] = content_db.GetSkillCap(GetClass(), (EQ::skills::SkillType)sindex, GetLevel());
|
skills[sindex] = skill_caps.GetSkillCap(GetClass(), (EQ::skills::SkillType)sindex, GetLevel()).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
taunt_timer.Start(1000);
|
taunt_timer.Start(1000);
|
||||||
|
|||||||
@ -73,6 +73,7 @@ extern volatile bool RunLoops;
|
|||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "dialogue_window.h"
|
#include "dialogue_window.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
@ -2771,7 +2772,7 @@ bool Client::CanHaveSkill(EQ::skills::SkillType skill_id) const
|
|||||||
skill_id = EQ::skills::Skill2HPiercing;
|
skill_id = EQ::skills::Skill2HPiercing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return zone->GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)).cap > 0;
|
return skill_caps.GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)).cap > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 Client::MaxSkill(EQ::skills::SkillType skill_id, uint8 class_id, uint8 level) const
|
uint16 Client::MaxSkill(EQ::skills::SkillType skill_id, uint8 class_id, uint8 level) const
|
||||||
@ -2784,7 +2785,7 @@ uint16 Client::MaxSkill(EQ::skills::SkillType skill_id, uint8 class_id, uint8 le
|
|||||||
skill_id = EQ::skills::Skill2HPiercing;
|
skill_id = EQ::skills::Skill2HPiercing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(content_db.GetSkillCap(class_id, skill_id, level));
|
return skill_caps.GetSkillCap(class_id, skill_id, level).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 Client::SkillTrainLevel(EQ::skills::SkillType skill_id, uint8 class_id)
|
uint8 Client::SkillTrainLevel(EQ::skills::SkillType skill_id, uint8 class_id)
|
||||||
@ -2797,7 +2798,7 @@ uint8 Client::SkillTrainLevel(EQ::skills::SkillType skill_id, uint8 class_id)
|
|||||||
skill_id = EQ::skills::Skill2HPiercing;
|
skill_id = EQ::skills::Skill2HPiercing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return zone->GetTrainLevel(class_id, skill_id, RuleI(Character, MaxLevel));
|
return skill_caps.GetTrainLevel(class_id, skill_id, RuleI(Character, MaxLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 Client::GetMaxSkillAfterSpecializationRules(EQ::skills::SkillType skillid, uint16 maxSkill)
|
uint16 Client::GetMaxSkillAfterSpecializationRules(EQ::skills::SkillType skillid, uint16 maxSkill)
|
||||||
@ -11795,7 +11796,7 @@ void Client::MaxSkills()
|
|||||||
auto current_skill_value = (
|
auto current_skill_value = (
|
||||||
EQ::skills::IsSpecializedSkill(s.first) ?
|
EQ::skills::IsSpecializedSkill(s.first) ?
|
||||||
MAX_SPECIALIZED_SKILL :
|
MAX_SPECIALIZED_SKILL :
|
||||||
content_db.GetSkillCap(GetClass(), s.first, GetLevel())
|
skill_caps.GetSkillCap(GetClass(), s.first, GetLevel()).cap
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GetSkill(s.first) < current_skill_value) {
|
if (GetSkill(s.first) < current_skill_value) {
|
||||||
|
|||||||
@ -86,6 +86,7 @@ extern volatile bool is_zone_loaded;
|
|||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
#include "../common/database/database_update.h"
|
#include "../common/database/database_update.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
#include "zone_event_scheduler.h"
|
#include "zone_event_scheduler.h"
|
||||||
#include "zone_cli.h"
|
#include "zone_cli.h"
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ WorldContentService content_service;
|
|||||||
PathManager path;
|
PathManager path;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
DatabaseUpdate database_update;
|
DatabaseUpdate database_update;
|
||||||
|
SkillCaps skill_caps;
|
||||||
|
|
||||||
const SPDat_Spell_Struct* spells;
|
const SPDat_Spell_Struct* spells;
|
||||||
int32 SPDAT_RECORDS = -1;
|
int32 SPDAT_RECORDS = -1;
|
||||||
@ -307,6 +309,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
player_event_logs.SetDatabase(&database)->Init();
|
player_event_logs.SetDatabase(&database)->Init();
|
||||||
|
|
||||||
|
skill_caps.SetContentDatabase(&content_db)->LoadSkillCaps();
|
||||||
|
|
||||||
const auto c = EQEmuConfig::get();
|
const auto c = EQEmuConfig::get();
|
||||||
if (c->auto_database_updates) {
|
if (c->auto_database_updates) {
|
||||||
if (database_update.SetDatabase(&database)->HasPendingUpdates()) {
|
if (database_update.SetDatabase(&database)->HasPendingUpdates()) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
#include "string_ids.h"
|
#include "string_ids.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
extern volatile bool is_zone_loaded;
|
extern volatile bool is_zone_loaded;
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
|||||||
|
|
||||||
int r;
|
int r;
|
||||||
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
||||||
skills[r] = content_db.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, GetLevel());
|
skills[r] = skill_caps.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, GetLevel()).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = d->size;
|
size = d->size;
|
||||||
@ -770,16 +771,16 @@ void Merc::CalcRestState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Merc::HasSkill(EQ::skills::SkillType skill_id) const {
|
bool Merc::HasSkill(EQ::skills::SkillType skill_id) const {
|
||||||
return((GetSkill(skill_id) > 0) && CanHaveSkill(skill_id));
|
return ((GetSkill(skill_id) > 0) && CanHaveSkill(skill_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Merc::CanHaveSkill(EQ::skills::SkillType skill_id) const {
|
bool Merc::CanHaveSkill(EQ::skills::SkillType skill_id) const {
|
||||||
return(content_db.GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)) > 0);
|
return skill_caps.GetSkillCap(GetClass(), skill_id, RuleI(Character, MaxLevel)).cap > 0;
|
||||||
//if you don't have it by max level, then odds are you never will?
|
//if you don't have it by max level, then odds are you never will?
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 Merc::MaxSkill(EQ::skills::SkillType skillid, uint16 class_, uint16 level) const {
|
uint16 Merc::MaxSkill(EQ::skills::SkillType skillid, uint16 class_, uint16 level) const {
|
||||||
return(content_db.GetSkillCap(class_, skillid, level));
|
return skill_caps.GetSkillCap(class_, skillid, level).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||||
|
|||||||
@ -48,6 +48,7 @@
|
|||||||
#include "npc_scale_manager.h"
|
#include "npc_scale_manager.h"
|
||||||
|
|
||||||
#include "bot.h"
|
#include "bot.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -363,7 +364,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
|
|||||||
//give NPCs skill values...
|
//give NPCs skill values...
|
||||||
int r;
|
int r;
|
||||||
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
||||||
skills[r] = content_db.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, moblevel);
|
skills[r] = skill_caps.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, moblevel).cap;
|
||||||
}
|
}
|
||||||
// some overrides -- really we need to be able to set skills for mobs in the DB
|
// some overrides -- really we need to be able to set skills for mobs in the DB
|
||||||
// There are some known low level SHM/BST pets that do not follow this, which supports
|
// There are some known low level SHM/BST pets that do not follow this, which supports
|
||||||
@ -3437,7 +3438,7 @@ void NPC::RecalculateSkills()
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
for (r = 0; r <= EQ::skills::HIGHEST_SKILL; r++) {
|
||||||
skills[r] = content_db.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, level);
|
skills[r] = skill_caps.GetSkillCap(GetClass(), (EQ::skills::SkillType)r, level).cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// some overrides -- really we need to be able to set skills for mobs in the DB
|
// some overrides -- really we need to be able to set skills for mobs in the DB
|
||||||
|
|||||||
@ -59,6 +59,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "../common/repositories/guild_tributes_repository.h"
|
#include "../common/repositories/guild_tributes_repository.h"
|
||||||
#include "../common/patches/patches.h"
|
#include "../common/patches/patches.h"
|
||||||
|
#include "../common/skill_caps.h"
|
||||||
|
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
@ -2101,7 +2102,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
{
|
{
|
||||||
if (zone && zone->IsLoaded()) {
|
if (zone && zone->IsLoaded()) {
|
||||||
zone->SendReloadMessage("Skill Caps");
|
zone->SendReloadMessage("Skill Caps");
|
||||||
zone->ReloadSkillCaps();
|
skill_caps.ReloadSkillCaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1185,8 +1185,6 @@ bool Zone::Init(bool is_static) {
|
|||||||
|
|
||||||
LoadBaseData();
|
LoadBaseData();
|
||||||
|
|
||||||
LoadSkillCaps();
|
|
||||||
|
|
||||||
//Load merchant data
|
//Load merchant data
|
||||||
LoadMerchants();
|
LoadMerchants();
|
||||||
|
|
||||||
|
|||||||
@ -453,12 +453,6 @@ public:
|
|||||||
void LoadBaseData();
|
void LoadBaseData();
|
||||||
void ReloadBaseData();
|
void ReloadBaseData();
|
||||||
|
|
||||||
// Skill Caps
|
|
||||||
inline void ClearSkillCaps() { m_skill_caps.clear(); }
|
|
||||||
SkillCapsRepository::SkillCaps GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
|
||||||
uint8 GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
|
||||||
void LoadSkillCaps();
|
|
||||||
void ReloadSkillCaps();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool allow_mercs;
|
bool allow_mercs;
|
||||||
@ -523,9 +517,6 @@ private:
|
|||||||
|
|
||||||
// Base Data
|
// Base Data
|
||||||
std::vector<BaseDataRepository::BaseData> m_base_data = { };
|
std::vector<BaseDataRepository::BaseData> m_base_data = { };
|
||||||
|
|
||||||
// Skill Caps
|
|
||||||
std::vector<SkillCapsRepository::SkillCaps> m_skill_caps = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user