mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Merge branch 'master' into resend
This commit is contained in:
@@ -55,6 +55,7 @@ SET(common_sources
|
||||
perl_eqdb.cpp
|
||||
perl_eqdb_res.cpp
|
||||
proc_launcher.cpp
|
||||
profanity_manager.cpp
|
||||
ptimer.cpp
|
||||
races.cpp
|
||||
rdtsc.cpp
|
||||
@@ -180,6 +181,7 @@ SET(common_headers
|
||||
packet_functions.h
|
||||
platform.h
|
||||
proc_launcher.h
|
||||
profanity_manager.h
|
||||
profiler.h
|
||||
ptimer.h
|
||||
queue.h
|
||||
|
||||
@@ -118,3 +118,37 @@ EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category
|
||||
|
||||
return catOther;
|
||||
}
|
||||
|
||||
const char *EQEmu::constants::GetStanceName(StanceType stance_type) {
|
||||
switch (stance_type) {
|
||||
case stanceUnknown:
|
||||
return "Unknown";
|
||||
case stancePassive:
|
||||
return "Passive";
|
||||
case stanceBalanced:
|
||||
return "Balanced";
|
||||
case stanceEfficient:
|
||||
return "Efficient";
|
||||
case stanceReactive:
|
||||
return "Reactive";
|
||||
case stanceAggressive:
|
||||
return "Aggressive";
|
||||
case stanceAssist:
|
||||
return "Assist";
|
||||
case stanceBurn:
|
||||
return "Burn";
|
||||
case stanceEfficient2:
|
||||
return "Efficient2";
|
||||
case stanceBurnAE:
|
||||
return "BurnAE";
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
|
||||
int EQEmu::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
|
||||
if (stance_type >= EQEmu::constants::stancePassive && stance_type <= EQEmu::constants::stanceBurnAE)
|
||||
return (stance_type - EQEmu::constants::stancePassive);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+21
-1
@@ -203,6 +203,26 @@ namespace EQEmu
|
||||
const size_t SAY_LINK_CLOSER_SIZE = 1;
|
||||
const size_t SAY_LINK_MAXIMUM_SIZE = (SAY_LINK_OPENER_SIZE + SAY_LINK_BODY_SIZE + SAY_LINK_TEXT_SIZE + SAY_LINK_CLOSER_SIZE);
|
||||
|
||||
enum StanceType : int {
|
||||
stanceUnknown = 0,
|
||||
stancePassive,
|
||||
stanceBalanced,
|
||||
stanceEfficient,
|
||||
stanceReactive,
|
||||
stanceAggressive,
|
||||
stanceAssist,
|
||||
stanceBurn,
|
||||
stanceEfficient2,
|
||||
stanceBurnAE
|
||||
};
|
||||
|
||||
const char *GetStanceName(StanceType stance_type);
|
||||
int ConvertStanceTypeToIndex(StanceType stance_type);
|
||||
|
||||
const int STANCE_TYPE_FIRST = stancePassive;
|
||||
const int STANCE_TYPE_LAST = stanceBurnAE;
|
||||
const int STANCE_TYPE_COUNT = stanceBurnAE;
|
||||
|
||||
} /*constants*/
|
||||
|
||||
namespace profile {
|
||||
@@ -243,7 +263,7 @@ namespace EQEmu
|
||||
};
|
||||
|
||||
using RoF2::spells::SPELL_ID_MAX;
|
||||
using SoD::spells::SPELLBOOK_SIZE;
|
||||
using RoF2::spells::SPELLBOOK_SIZE;
|
||||
using UF::spells::SPELL_GEM_COUNT; // RoF+ clients define more than UF client..but, they are not valid beyond UF
|
||||
|
||||
using RoF2::spells::LONG_BUFFS;
|
||||
|
||||
+6
-47
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "emu_versions.h"
|
||||
#include "emu_constants.h"
|
||||
|
||||
|
||||
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
|
||||
@@ -493,7 +494,7 @@ EQEmu::expansions::Expansion EQEmu::expansions::ConvertExpansionBitToExpansion(u
|
||||
}
|
||||
}
|
||||
|
||||
uint32 EQEmu::expansions::ConvertExpansionToExpansionMask(Expansion expansion)
|
||||
uint32 EQEmu::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
|
||||
{
|
||||
switch (expansion) {
|
||||
case Expansion::RoK:
|
||||
@@ -543,57 +544,15 @@ uint32 EQEmu::expansions::ConvertExpansionToExpansionMask(Expansion expansion)
|
||||
|
||||
EQEmu::expansions::Expansion EQEmu::expansions::ConvertClientVersionToExpansion(versions::ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case versions::ClientVersion::Titanium:
|
||||
return expansions::Expansion::PoR;
|
||||
case versions::ClientVersion::SoF:
|
||||
return expansions::Expansion::SoF;
|
||||
case versions::ClientVersion::SoD:
|
||||
return expansions::Expansion::SoD;
|
||||
case versions::ClientVersion::UF:
|
||||
return expansions::Expansion::UF;
|
||||
case versions::ClientVersion::RoF:
|
||||
case versions::ClientVersion::RoF2:
|
||||
return expansions::Expansion::RoF;
|
||||
default:
|
||||
return expansions::Expansion::EverQuest;
|
||||
}
|
||||
return EQEmu::constants::StaticLookup(client_version)->Expansion;
|
||||
}
|
||||
|
||||
uint32 EQEmu::expansions::ConvertClientVersionToExpansionBit(versions::ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case versions::ClientVersion::Titanium:
|
||||
return expansions::bitPoR;
|
||||
case versions::ClientVersion::SoF:
|
||||
return expansions::bitSoF;
|
||||
case versions::ClientVersion::SoD:
|
||||
return expansions::bitSoD;
|
||||
case versions::ClientVersion::UF:
|
||||
return expansions::bitUF;
|
||||
case versions::ClientVersion::RoF:
|
||||
case versions::ClientVersion::RoF2:
|
||||
return expansions::bitRoF;
|
||||
default:
|
||||
return expansions::bitEverQuest;
|
||||
}
|
||||
return EQEmu::constants::StaticLookup(client_version)->ExpansionBit;
|
||||
}
|
||||
|
||||
uint32 EQEmu::expansions::ConvertClientVersionToExpansionMask(versions::ClientVersion client_version)
|
||||
uint32 EQEmu::expansions::ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case versions::ClientVersion::Titanium:
|
||||
return expansions::maskPoR;
|
||||
case versions::ClientVersion::SoF:
|
||||
return expansions::maskSoF;
|
||||
case versions::ClientVersion::SoD:
|
||||
return expansions::maskSoD;
|
||||
case versions::ClientVersion::UF:
|
||||
return expansions::maskUF;
|
||||
case versions::ClientVersion::RoF:
|
||||
case versions::ClientVersion::RoF2:
|
||||
return expansions::maskRoF;
|
||||
default:
|
||||
return expansions::maskEverQuest;
|
||||
}
|
||||
return EQEmu::constants::StaticLookup(client_version)->ExpansionsMask;
|
||||
}
|
||||
|
||||
@@ -210,10 +210,10 @@ namespace EQEmu
|
||||
const char* ExpansionName(uint32 expansion_bit);
|
||||
uint32 ConvertExpansionToExpansionBit(Expansion expansion);
|
||||
Expansion ConvertExpansionBitToExpansion(uint32 expansion_bit);
|
||||
uint32 ConvertExpansionToExpansionMask(Expansion expansion);
|
||||
uint32 ConvertExpansionToExpansionsMask(Expansion expansion);
|
||||
Expansion ConvertClientVersionToExpansion(versions::ClientVersion client_version);
|
||||
uint32 ConvertClientVersionToExpansionBit(versions::ClientVersion client_version);
|
||||
uint32 ConvertClientVersionToExpansionMask(versions::ClientVersion client_version);
|
||||
uint32 ConvertClientVersionToExpansionsMask(versions::ClientVersion client_version);
|
||||
|
||||
} /*expansions*/
|
||||
|
||||
|
||||
@@ -43,17 +43,17 @@ static const EQEmu::constants::LookupEntry constants_static_lookup_entries[EQEmu
|
||||
{
|
||||
/*[ClientVersion::Unknown] =*/
|
||||
EQEmu::constants::LookupEntry(
|
||||
EQEmu::expansions::Expansion::EverQuest,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::constants::EXPANSION,
|
||||
ClientUnknown::constants::EXPANSION_BIT,
|
||||
ClientUnknown::constants::EXPANSIONS_MASK,
|
||||
ClientUnknown::INULL,
|
||||
ClientUnknown::INULL
|
||||
),
|
||||
/*[ClientVersion::Client62] =*/
|
||||
EQEmu::constants::LookupEntry(
|
||||
EQEmu::expansions::Expansion::EverQuest,
|
||||
Client62::INULL,
|
||||
Client62::INULL,
|
||||
Client62::constants::EXPANSION,
|
||||
Client62::constants::EXPANSION_BIT,
|
||||
Client62::constants::EXPANSIONS_MASK,
|
||||
Client62::INULL,
|
||||
Client62::INULL
|
||||
),
|
||||
@@ -1167,7 +1167,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
|
||||
/*[ClientVersion::UF] =*/
|
||||
EQEmu::spells::LookupEntry(
|
||||
UF::spells::SPELL_ID_MAX,
|
||||
SoD::spells::SPELLBOOK_SIZE,
|
||||
UF::spells::SPELLBOOK_SIZE,
|
||||
UF::spells::SPELL_GEM_COUNT,
|
||||
UF::spells::LONG_BUFFS,
|
||||
UF::spells::SHORT_BUFFS,
|
||||
@@ -1180,7 +1180,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
|
||||
/*[ClientVersion::RoF] =*/
|
||||
EQEmu::spells::LookupEntry(
|
||||
RoF::spells::SPELL_ID_MAX,
|
||||
SoD::spells::SPELLBOOK_SIZE,
|
||||
RoF::spells::SPELLBOOK_SIZE,
|
||||
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
|
||||
RoF::spells::LONG_BUFFS,
|
||||
RoF::spells::SHORT_BUFFS,
|
||||
@@ -1193,7 +1193,7 @@ static const EQEmu::spells::LookupEntry spells_static_lookup_entries[EQEmu::vers
|
||||
/*[ClientVersion::RoF2] =*/
|
||||
EQEmu::spells::LookupEntry(
|
||||
RoF2::spells::SPELL_ID_MAX,
|
||||
SoD::spells::SPELLBOOK_SIZE,
|
||||
RoF2::spells::SPELLBOOK_SIZE,
|
||||
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
|
||||
RoF2::spells::LONG_BUFFS,
|
||||
RoF2::spells::SHORT_BUFFS,
|
||||
|
||||
@@ -243,6 +243,13 @@ namespace ClientUnknown
|
||||
const int16 IINVALID = -1;
|
||||
const int16 INULL = 0;
|
||||
|
||||
namespace constants {
|
||||
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
|
||||
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
|
||||
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
|
||||
|
||||
} // namespace constants
|
||||
|
||||
} /*ClientUnknown*/
|
||||
|
||||
namespace Client62
|
||||
@@ -250,6 +257,13 @@ namespace Client62
|
||||
const int16 IINVALID = -1;
|
||||
const int16 INULL = 0;
|
||||
|
||||
namespace constants {
|
||||
const EQEmu::expansions::Expansion EXPANSION = EQEmu::expansions::Expansion::EverQuest;
|
||||
const uint32 EXPANSION_BIT = EQEmu::expansions::bitEverQuest;
|
||||
const uint32 EXPANSIONS_MASK = EQEmu::expansions::maskEverQuest;
|
||||
|
||||
} // namespace constants
|
||||
|
||||
} /*Client62*/
|
||||
|
||||
#endif /*COMMON_EQ_LIMITS_H*/
|
||||
|
||||
@@ -909,7 +909,7 @@ sed -e 's/_t//g' -e 's/MAX_AA/MAX_PP_AA_ARRAY/g' \
|
||||
|
||||
struct PlayerProfile_Struct
|
||||
{
|
||||
/*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum
|
||||
// /*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum
|
||||
/*0004*/ char name[64]; // Name of player sizes not right
|
||||
/*0068*/ char last_name[32]; // Last name of player sizes not right
|
||||
/*0100*/ uint32 gender; // Player Gender - 0 Male, 1 Female
|
||||
@@ -1091,6 +1091,18 @@ struct PlayerProfile_Struct
|
||||
/*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005)
|
||||
/*19564*/ uint32 RestTimer;
|
||||
/*19568*/
|
||||
|
||||
// All player profile packets are translated and this overhead is ignored in out-bound packets
|
||||
PlayerProfile_Struct() : m_player_profile_version(EQEmu::versions::MobVersion::Unknown) { }
|
||||
|
||||
EQEmu::versions::MobVersion PlayerProfileVersion() { return m_player_profile_version; }
|
||||
void SetPlayerProfileVersion(EQEmu::versions::MobVersion mob_version) { m_player_profile_version = EQEmu::versions::ValidateMobVersion(mob_version); }
|
||||
void SetPlayerProfileVersion(EQEmu::versions::ClientVersion client_version) { SetPlayerProfileVersion(EQEmu::versions::ConvertClientVersionToMobVersion(client_version)); }
|
||||
|
||||
private:
|
||||
// No need for gm flag since pp already has one
|
||||
// No need for lookup pointer since this struct is not tied to any one system
|
||||
EQEmu::versions::MobVersion m_player_profile_version;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+18
-7
@@ -2126,14 +2126,25 @@ namespace RoF
|
||||
|
||||
outapp->WriteUInt32(spells::SPELLBOOK_SIZE); // Spellbook slots
|
||||
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
else
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
}
|
||||
// zeroes for the rest of the spellbook slots
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
else
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
for (uint32 r = EQEmu::spells::SPELLBOOK_SIZE; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(spells::SPELL_GEM_COUNT); // Memorised spell slots
|
||||
|
||||
+18
-7
@@ -2202,14 +2202,25 @@ namespace RoF2
|
||||
|
||||
outapp->WriteUInt32(spells::SPELLBOOK_SIZE); // Spellbook slots
|
||||
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
else
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
}
|
||||
// zeroes for the rest of the spellbook slots
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
outapp->WriteUInt32(emu->spell_book[r]);
|
||||
else
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
for (uint32 r = EQEmu::spells::SPELLBOOK_SIZE; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
outapp->WriteUInt32(0xFFFFFFFFU);
|
||||
}
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(spells::SPELL_GEM_COUNT); // Memorised spell slots
|
||||
|
||||
+20
-1
@@ -1492,7 +1492,26 @@ namespace SoD
|
||||
OUT(WIS);
|
||||
OUT(face);
|
||||
// OUT(unknown02264[47]);
|
||||
OUT_array(spell_book, spells::SPELLBOOK_SIZE);
|
||||
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
memset(&eq->spell_book[EQEmu::spells::SPELLBOOK_SIZE], 0xFF, (sizeof(uint32) * (spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE)));
|
||||
}
|
||||
|
||||
// OUT(unknown4184[128]);
|
||||
OUT_array(mem_spells, spells::SPELL_GEM_COUNT);
|
||||
// OUT(unknown04396[32]);
|
||||
|
||||
+20
-1
@@ -1156,7 +1156,26 @@ namespace SoF
|
||||
OUT(WIS);
|
||||
OUT(face);
|
||||
// OUT(unknown02264[47]);
|
||||
OUT_array(spell_book, spells::SPELLBOOK_SIZE);
|
||||
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
memset(&eq->spell_book[EQEmu::spells::SPELLBOOK_SIZE], 0xFF, (sizeof(uint32) * (spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE)));
|
||||
}
|
||||
|
||||
// OUT(unknown4184[128]);
|
||||
OUT_array(mem_spells, spells::SPELL_GEM_COUNT);
|
||||
// OUT(unknown04396[32]);
|
||||
|
||||
@@ -1012,7 +1012,26 @@ namespace Titanium
|
||||
OUT(WIS);
|
||||
OUT(face);
|
||||
// OUT(unknown02264[47]);
|
||||
OUT_array(spell_book, spells::SPELLBOOK_SIZE);
|
||||
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
memset(&eq->spell_book[EQEmu::spells::SPELLBOOK_SIZE], 0xFF, (sizeof(uint32) * (spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE)));
|
||||
}
|
||||
|
||||
// OUT(unknown4184[448]);
|
||||
OUT_array(mem_spells, spells::SPELL_GEM_COUNT);
|
||||
// OUT(unknown04396[32]);
|
||||
|
||||
+20
-2
@@ -1724,8 +1724,26 @@ namespace UF
|
||||
OUT(WIS);
|
||||
OUT(face);
|
||||
// OUT(unknown02264[47]);
|
||||
memset(eq->spell_book, 0xFF, sizeof(uint32)* spells::SPELLBOOK_SIZE);
|
||||
OUT_array(spell_book, 480U);
|
||||
|
||||
if (spells::SPELLBOOK_SIZE <= EQEmu::spells::SPELLBOOK_SIZE) {
|
||||
for (uint32 r = 0; r < spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (uint32 r = 0; r < EQEmu::spells::SPELLBOOK_SIZE; r++) {
|
||||
if (emu->spell_book[r] <= spells::SPELL_ID_MAX)
|
||||
eq->spell_book[r] = emu->spell_book[r];
|
||||
else
|
||||
eq->spell_book[r] = 0xFFFFFFFFU;
|
||||
}
|
||||
// invalidate the rest of the spellbook slots
|
||||
memset(&eq->spell_book[EQEmu::spells::SPELLBOOK_SIZE], 0xFF, (sizeof(uint32) * (spells::SPELLBOOK_SIZE - EQEmu::spells::SPELLBOOK_SIZE)));
|
||||
}
|
||||
|
||||
// OUT(unknown4184[128]);
|
||||
OUT_array(mem_spells, spells::SPELL_GEM_COUNT);
|
||||
// OUT(unknown04396[32]);
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2019 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "profanity_manager.h"
|
||||
#include "dbcore.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
static std::list<std::string> profanity_list;
|
||||
static bool update_originator_flag = false;
|
||||
|
||||
bool EQEmu::ProfanityManager::LoadProfanityList(DBcore *db) {
|
||||
if (update_originator_flag == true) {
|
||||
update_originator_flag = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!load_database_entries(db))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::UpdateProfanityList(DBcore *db) {
|
||||
if (!load_database_entries(db))
|
||||
return false;
|
||||
|
||||
update_originator_flag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::DeleteProfanityList(DBcore *db) {
|
||||
if (!clear_database_entries(db))
|
||||
return false;
|
||||
|
||||
update_originator_flag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::AddProfanity(DBcore *db, const char *profanity) {
|
||||
if (!db || !profanity)
|
||||
return false;
|
||||
|
||||
std::string entry(profanity);
|
||||
|
||||
std::transform(entry.begin(), entry.end(), entry.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
|
||||
if (check_for_existing_entry(entry.c_str()))
|
||||
return true;
|
||||
|
||||
if (entry.length() < REDACTION_LENGTH_MIN)
|
||||
return false;
|
||||
|
||||
profanity_list.push_back(entry);
|
||||
|
||||
std::string query = "REPLACE INTO `profanity_list` (`word`) VALUES ('";
|
||||
query.append(entry);
|
||||
query.append("')");
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
update_originator_flag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::RemoveProfanity(DBcore *db, const char *profanity) {
|
||||
if (!db || !profanity)
|
||||
return false;
|
||||
|
||||
std::string entry(profanity);
|
||||
|
||||
std::transform(entry.begin(), entry.end(), entry.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
|
||||
if (!check_for_existing_entry(entry.c_str()))
|
||||
return true;
|
||||
|
||||
profanity_list.remove(entry);
|
||||
|
||||
std::string query = "DELETE FROM `profanity_list` WHERE `word` LIKE '";
|
||||
query.append(entry);
|
||||
query.append("'");
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
update_originator_flag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EQEmu::ProfanityManager::RedactMessage(char *message) {
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
std::string test_message(message);
|
||||
// hard-coded max length based on channel message buffer size (4096 bytes)..
|
||||
// ..will need to change or remove if other sources are used for redaction
|
||||
if (test_message.length() < REDACTION_LENGTH_MIN || test_message.length() >= 4096)
|
||||
return;
|
||||
|
||||
std::transform(test_message.begin(), test_message.end(), test_message.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
|
||||
for (const auto &iter : profanity_list) { // consider adding textlink checks if it becomes an issue
|
||||
size_t pos = 0;
|
||||
size_t start_pos = 0;
|
||||
|
||||
while (pos != std::string::npos) {
|
||||
pos = test_message.find(iter, start_pos);
|
||||
if (pos == std::string::npos)
|
||||
continue;
|
||||
|
||||
if ((pos + iter.length()) == test_message.length() || !isalpha(test_message.at(pos + iter.length()))) {
|
||||
if (pos == 0 || !isalpha(test_message.at(pos - 1)))
|
||||
memset((message + pos), REDACTION_CHARACTER, iter.length());
|
||||
}
|
||||
|
||||
start_pos = (pos + iter.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmu::ProfanityManager::RedactMessage(std::string &message) {
|
||||
if (message.length() < REDACTION_LENGTH_MIN || message.length() >= 4096)
|
||||
return;
|
||||
|
||||
std::string test_message(const_cast<const std::string&>(message));
|
||||
|
||||
std::transform(test_message.begin(), test_message.end(), test_message.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
|
||||
for (const auto &iter : profanity_list) { // consider adding textlink checks if it becomes an issue
|
||||
size_t pos = 0;
|
||||
size_t start_pos = 0;
|
||||
|
||||
while (pos != std::string::npos) {
|
||||
pos = test_message.find(iter, start_pos);
|
||||
if (pos == std::string::npos)
|
||||
continue;
|
||||
|
||||
if ((pos + iter.length()) == test_message.length() || !isalpha(test_message.at(pos + iter.length()))) {
|
||||
if (pos == 0 || !isalpha(test_message.at(pos - 1)))
|
||||
message.replace(pos, iter.length(), iter.length(), REDACTION_CHARACTER);
|
||||
}
|
||||
|
||||
start_pos = (pos + iter.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::ContainsCensoredLanguage(const char *message) {
|
||||
if (!message)
|
||||
return false;
|
||||
|
||||
return ContainsCensoredLanguage(std::string(message));
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::ContainsCensoredLanguage(const std::string &message) {
|
||||
if (message.length() < REDACTION_LENGTH_MIN || message.length() >= 4096)
|
||||
return false;
|
||||
|
||||
std::string test_message(message);
|
||||
|
||||
std::transform(test_message.begin(), test_message.end(), test_message.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
|
||||
for (const auto &iter : profanity_list) {
|
||||
if (test_message.find(iter) != std::string::npos)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::list<std::string> &EQEmu::ProfanityManager::GetProfanityList() {
|
||||
return profanity_list;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::IsCensorshipActive() {
|
||||
return (profanity_list.size() != 0);
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::load_database_entries(DBcore *db) {
|
||||
if (!db)
|
||||
return false;
|
||||
|
||||
profanity_list.clear();
|
||||
|
||||
std::string query = "SELECT `word` FROM `profanity_list`";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
if (std::strlen(row[0]) >= REDACTION_LENGTH_MIN) {
|
||||
std::string entry(row[0]);
|
||||
std::transform(entry.begin(), entry.end(), entry.begin(), [](unsigned char c) -> unsigned char { return tolower(c); });
|
||||
if (!check_for_existing_entry(entry.c_str()))
|
||||
profanity_list.push_back((std::string)entry);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::clear_database_entries(DBcore *db) {
|
||||
if (!db)
|
||||
return false;
|
||||
|
||||
profanity_list.clear();
|
||||
|
||||
std::string query = "DELETE FROM `profanity_list`";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::ProfanityManager::check_for_existing_entry(const char *profanity) {
|
||||
if (!profanity)
|
||||
return false;
|
||||
|
||||
for (const auto &iter : profanity_list) {
|
||||
if (iter.compare(profanity) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2019 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_PROFANITY_MANAGER_H
|
||||
#define COMMON_PROFANITY_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
|
||||
class DBcore;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
class ProfanityManager {
|
||||
public:
|
||||
static bool LoadProfanityList(DBcore *db);
|
||||
static bool UpdateProfanityList(DBcore *db);
|
||||
static bool DeleteProfanityList(DBcore *db);
|
||||
|
||||
static bool AddProfanity(DBcore *db, const char *profanity);
|
||||
static bool RemoveProfanity(DBcore *db, const char *profanity);
|
||||
|
||||
static void RedactMessage(char *message);
|
||||
static void RedactMessage(std::string &message);
|
||||
|
||||
static bool ContainsCensoredLanguage(const char *message);
|
||||
static bool ContainsCensoredLanguage(const std::string &message);
|
||||
|
||||
static const std::list<std::string> &GetProfanityList();
|
||||
|
||||
static bool IsCensorshipActive();
|
||||
|
||||
static const char REDACTION_CHARACTER = '*';
|
||||
static const int REDACTION_LENGTH_MIN = 3;
|
||||
|
||||
private:
|
||||
static bool load_database_entries(DBcore *db);
|
||||
static bool clear_database_entries(DBcore *db);
|
||||
static bool check_for_existing_entry(const char *profanity);
|
||||
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_PROFANITY_MANAGER_H*/
|
||||
@@ -159,6 +159,7 @@
|
||||
#define ServerOP_SetWorldTime 0x200B
|
||||
#define ServerOP_GetWorldTime 0x200C
|
||||
#define ServerOP_SyncWorldTime 0x200E
|
||||
#define ServerOP_RefreshCensorship 0x200F
|
||||
|
||||
#define ServerOP_LSZoneInfo 0x3001
|
||||
#define ServerOP_LSZoneStart 0x3002
|
||||
|
||||
+8
-8
@@ -68,16 +68,16 @@ enum SpellTypes : uint32
|
||||
SpellType_InCombatBuffSong = (1 << 18), // bard in-combat group/ae buffs
|
||||
SpellType_OutOfCombatBuffSong = (1 << 19), // bard out-of-combat group/ae buffs
|
||||
SpellType_PreCombatBuff = (1 << 20),
|
||||
SpellType_PreCombatBuffSong = (1 << 21),
|
||||
|
||||
SpellTypes_Detrimental = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow),
|
||||
SpellTypes_Beneficial = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong),
|
||||
|
||||
SpellTypes_Innate = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root),
|
||||
|
||||
SpellType_Any = 0xFFFFFFFF
|
||||
SpellType_PreCombatBuffSong = (1 << 21)
|
||||
};
|
||||
|
||||
const uint32 SPELL_TYPE_MIN = (SpellType_Nuke << 1) - 1;
|
||||
const uint32 SPELL_TYPE_MAX = (SpellType_PreCombatBuffSong << 1) - 1;
|
||||
const uint32 SPELL_TYPE_ANY = 0xFFFFFFFF;
|
||||
|
||||
const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow);
|
||||
const uint32 SPELL_TYPES_BENEFICIAL = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong);
|
||||
const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root);
|
||||
|
||||
// These should not be used to determine spell category..
|
||||
// They are a graphical affects (effects?) index only
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9135
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9136
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9021
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9022
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user