Implemented 'enum class ClientVersion' -- added 'RoF2' to lua client version enumeration

This commit is contained in:
Uleat 2015-01-19 23:32:57 -05:00
parent 52eb287082
commit e70e443950
51 changed files with 311 additions and 520 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 01/19/2015 ==
Uleat: Changed 'enum EQClientVersion' to 'enum class ClientVersion.' Other light modifications were made to accomodate this namespace. Added 'RoF2' to the lua client version enumeration.
== 01/15/2015 ==
Uleat: Attempted fix for elusive inventory bug:
- Removed 'iter_queue' typedef and converted lcast to explicit or auto defines

View File

@ -17,59 +17,58 @@ static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0;
static const uint32 BIT_AllClients = 0xFFFFFFFF;
typedef enum
enum class ClientVersion
{
EQClientUnknown = 0,
EQClient62, // Build: 'Aug 4 2005 15:40:59'
EQClientTitanium, // Build: 'Oct 31 2005 10:33:37'
EQClientSoF, // Build: 'Sep 7 2007 09:11:49'
EQClientSoD, // Build: 'Dec 19 2008 15:22:49'
EQClientUnderfoot, // Build: 'Jun 8 2010 16:44:32'
EQClientRoF, // Build: 'Dec 10 2012 17:35:44'
EQClientRoF2, // Build: 'May 10 2013 23:30:08'
Unknown = 0,
Client62, // Build: 'Aug 4 2005 15:40:59'
Tit, // Build: 'Oct 31 2005 10:33:37'
SoF, // Build: 'Sep 7 2007 09:11:49'
SoD, // Build: 'Dec 19 2008 15:22:49'
Und, // Build: 'Jun 8 2010 16:44:32'
RoF, // Build: 'Dec 10 2012 17:35:44'
RoF2, // Build: 'May 10 2013 23:30:08'
_EQClientCount, // place new clients before this point (preferably, in release/attribute order)
MobNPC,
MobMerc,
MobBot,
MobPet,
};
// Values below are not implemented, as yet...
#define CLIENT_VERSION_COUNT 12
#define LAST_PC_CLIENT ClientVersion::RoF2
#define LAST_NPC_CLIENT ClientVersion::MobPet
EmuNPC = _EQClientCount,
EmuMerc,
EmuBot,
EmuPet,
_EmuClientCount // array size for EQLimits
} EQClientVersion;
static const char* EQClientVersionName(EQClientVersion version)
static const char* ClientVersionName(ClientVersion version)
{
switch (version)
{
case EQClientUnknown:
return "EQClientUnknown";
case EQClient62:
return "EQClient62";
case EQClientTitanium:
return "EQClientTitanium";
case EQClientSoF:
return "EQClientSoF";
case EQClientSoD:
return "EQClientSoD";
case EQClientUnderfoot:
return "EQClientUnderfoot";
case EQClientRoF:
return "EQClientRoF";
case EQClientRoF2:
return "EQClientRoF2";
case EmuNPC:
return "EmuNPC";
case EmuMerc:
return "EmuMerc";
case EmuBot:
return "EmuBot";
case EmuPet:
return "EmuPet";
case ClientVersion::Unknown:
return "ClientVersion::Unknown";
case ClientVersion::Client62:
return "ClientVersion::Client62";
case ClientVersion::Tit:
return "ClientVersion::Tit";
case ClientVersion::SoF:
return "ClientVersion::SoF";
case ClientVersion::SoD:
return "ClientVersion::SoD";
case ClientVersion::Und:
return "ClientVersion::Und";
case ClientVersion::RoF:
return "ClientVersion::RoF";
case ClientVersion::RoF2:
return "ClientVersion::RoF2";
case ClientVersion::MobNPC:
return "ClientVersion::MobNPC";
case ClientVersion::MobMerc:
return "ClientVersion::MobMerc";
case ClientVersion::MobBot:
return "ClientVersion::MobBot";
case ClientVersion::MobPet:
return "ClientVersion::MobPet";
default:
return "ERROR: Invalid EQClientVersion";
return "<ERROR> Invalid ClientVersion";
};
}

View File

@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// class EmuConstants
//
uint16 EmuConstants::InventoryMapSize(int16 map) {
switch (map) {
uint16 EmuConstants::InventoryMapSize(int16 indexMap) {
switch (indexMap) {
case MapPossessions:
return MAP_POSSESSIONS_SIZE;
case MapBank:
@ -91,8 +91,8 @@ std::string EmuConstants::InventoryLocationName(Location_Struct location) {
}
*/
std::string EmuConstants::InventoryMapName(int16 map) {
switch (map) {
std::string EmuConstants::InventoryMapName(int16 indexMap) {
switch (indexMap) {
case INVALID_INDEX:
return "Invalid Map";
case MapPossessions:
@ -150,8 +150,8 @@ std::string EmuConstants::InventoryMapName(int16 map) {
}
}
std::string EmuConstants::InventoryMainName(int16 main) {
switch (main) {
std::string EmuConstants::InventoryMainName(int16 indexMain) {
switch (indexMain) {
case INVALID_INDEX:
return "Invalid Main";
case MainCharm:
@ -229,293 +229,83 @@ std::string EmuConstants::InventoryMainName(int16 main) {
}
}
std::string EmuConstants::InventorySubName(int16 sub) {
if (sub == INVALID_INDEX)
std::string EmuConstants::InventorySubName(int16 indexSub) {
if (indexSub == INVALID_INDEX)
return "Invalid Sub";
if ((uint16)sub >= ITEM_CONTAINER_SIZE)
if ((uint16)indexSub >= ITEM_CONTAINER_SIZE)
return "Unknown Sub";
std::string ret_str;
ret_str = StringFormat("Container %i", (sub + 1)); // zero-based index..but, count starts at one
ret_str = StringFormat("Container %i", (indexSub + 1)); // zero-based index..but, count starts at one
return ret_str;
}
std::string EmuConstants::InventoryAugName(int16 aug) {
if (aug == INVALID_INDEX)
std::string EmuConstants::InventoryAugName(int16 indexAug) {
if (indexAug == INVALID_INDEX)
return "Invalid Aug";
if ((uint16)aug >= ITEM_COMMON_SIZE)
if ((uint16)indexAug >= ITEM_COMMON_SIZE)
return "Unknown Aug";
std::string ret_str;
ret_str = StringFormat("Augment %i", (aug + 1)); // zero-based index..but, count starts at one
ret_str = StringFormat("Augment %i", (indexAug + 1)); // zero-based index..but, count starts at one
return ret_str;
}
// legacy-related functions
//
// these should work for the first-stage coversions..but, once the new system is up and going..conversions will be incompatible
// without limiting server functions and other aspects, such as augment control, bag size, etc. A complete remapping will be
// required when bag sizes over 10 and direct manipulation of augments are implemented, due to the massive increase in range usage.
//
// (current personal/cursor bag range {251..340}, or 90 slots ... conversion translated range would be {10000..12804}, or 2805 slots...
// these would have to be hard-coded into all perl code to allow access to full range of the new system - actual limits would be
// less, based on bag size..but, the range must be full and consistent to avoid translation issues -- similar changes to other ranges
// (240 versus 6120 slots for bank bags, for example...))
/*
int EmuConstants::ServerToPerlSlot(int server_slot) { // set r/s
switch (server_slot) {
case legacy::SLOT_CURSOR_END:
return legacy::SLOT_CURSOR_END;
case INVALID_INDEX:
return legacy::SLOT_INVALID;
case MainPowerSource:
return legacy::SLOT_POWER_SOURCE;
case MainAmmo:
return legacy::SLOT_AMMO;
case MainCursor:
return legacy::SLOT_CURSOR;
case legacy::SLOT_TRADESKILL:
return legacy::SLOT_TRADESKILL;
case legacy::SLOT_AUGMENT:
return legacy::SLOT_AUGMENT;
default:
int perl_slot = legacy::SLOT_INVALID;
// activate the internal checks as needed
if (server_slot >= EmuConstants::EQUIPMENT_BEGIN && server_slot <= MainWaist) {
perl_slot = server_slot;
}
else if (server_slot >= EmuConstants::GENERAL_BEGIN && server_slot <= EmuConstants::GENERAL_END) {
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BEGIN - EmuConstants::GENERAL_BEGIN;
//if (perl_slot < legacy::SLOT_PERSONAL_BEGIN || perl_slot > legacy::SLOT_PERSONAL_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::GENERAL_BAGS_BEGIN && server_slot <= EmuConstants::GENERAL_BAGS_END) {
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BAGS_BEGIN - EmuConstants::GENERAL_BAGS_BEGIN;
//if (perl_slot < legacy::SLOT_PERSONAL_BAGS_BEGIN || perl_slot > legacy::SLOT_PERSONAL_BAGS_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) {
perl_slot = server_slot;// + legacy::SLOT_CURSOR_BAG_BEGIN - EmuConstants::CURSOR_BAG_BEGIN;
//if (perl_slot < legacy::SLOT_CURSOR_BAG_BEGIN || perl_slot > legacy::SLOT_CURSOR_BAG_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::TRIBUTE_BEGIN && server_slot <= EmuConstants::TRIBUTE_END) {
perl_slot = server_slot;// + legacy::SLOT_TRIBUTE_BEGIN - EmuConstants::TRADE_BEGIN;
//if (perl_slot < legacy::SLOT_TRIBUTE_BEGIN || perl_slot > legacy::SLOT_TRIBUTE_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::BANK_BEGIN && server_slot <= EmuConstants::BANK_END) {
perl_slot = server_slot;// + legacy::SLOT_BANK_BEGIN - EmuConstants::BANK_BEGIN;
//if (perl_slot < legacy::SLOT_BANK_BEGIN || perl_slot > legacy::SLOT_BANK_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::BANK_BAGS_BEGIN && server_slot <= EmuConstants::BANK_BAGS_END) {
perl_slot = server_slot;// + legacy::SLOT_BANK_BAGS_BEGIN - EmuConstants::BANK_BAGS_BEGIN;
//if (perl_slot < legacy::SLOT_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_BANK_BAGS_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::SHARED_BANK_BEGIN && server_slot <= EmuConstants::SHARED_BANK_END) {
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BEGIN - EmuConstants::SHARED_BANK_BEGIN;
//if (perl_slot < legacy::SLOT_SHARED_BANK_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && server_slot <= EmuConstants::SHARED_BANK_BAGS_END) {
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BAGS_BEGIN - EmuConstants::SHARED_BANK_BAGS_BEGIN;
//if (perl_slot < legacy::SLOT_SHARED_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_BAGS_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::TRADE_BEGIN && server_slot <= EmuConstants::TRADE_END) {
perl_slot = server_slot;// + legacy::SLOT_TRADE_BEGIN - EmuConstants::TRADE_BEGIN;
//if (perl_slot < legacy::SLOT_TRADE_BEGIN || perl_slot > legacy::SLOT_TRADE_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::TRADE_BAGS_BEGIN && server_slot <= EmuConstants::TRADE_BAGS_END) {
perl_slot = server_slot;// + legacy::SLOT_TRADE_BAGS_BEGIN - EmuConstants::TRADE_BAGS_BEGIN;
//if (perl_slot < legacy::SLOT_TRADE_BAGS_BEGIN || perl_slot > legacy::SLOT_TRADE_BAGS_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= EmuConstants::WORLD_BEGIN && server_slot <= EmuConstants::WORLD_END) {
perl_slot = server_slot;// + legacy::SLOT_WORLD_BEGIN - EmuConstants::WORLD_BEGIN;
//if (perl_slot < legacy::SLOT_WORLD_BEGIN || perl_slot > legacy::SLOT_WORLD_END)
// perl_slot = legacy::SLOT_INVALID;
}
else if (server_slot >= 8000 && server_slot <= 8999) { // this range may be limited to 36 in the future (client size)
perl_slot = server_slot;
}
return perl_slot;
}
}
*/
/*
int EmuConstants::PerlToServerSlot(int perl_slot) { // set r/s
switch (perl_slot) {
case legacy::SLOT_CURSOR_END:
return legacy::SLOT_CURSOR_END;
case legacy::SLOT_INVALID:
return INVALID_INDEX;
case legacy::SLOT_POWER_SOURCE:
return MainPowerSource;
case legacy::SLOT_AMMO:
return MainAmmo;
case legacy::SLOT_CURSOR:
return MainCursor;
case legacy::SLOT_TRADESKILL:
return legacy::SLOT_TRADESKILL;
case legacy::SLOT_AUGMENT:
return legacy::SLOT_AUGMENT;
default:
int server_slot = INVALID_INDEX;
// activate the internal checks as needed
if (perl_slot >= legacy::SLOT_EQUIPMENT_BEGIN && perl_slot <= legacy::SLOT_WAIST) {
server_slot = perl_slot;
}
else if (perl_slot >= legacy::SLOT_PERSONAL_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_END) {
server_slot = perl_slot;// + EmuConstants::GENERAL_BEGIN - legacy::SLOT_PERSONAL_BEGIN;
//if (server_slot < EmuConstants::GENERAL_BEGIN || server_slot > EmuConstants::GENERAL_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_PERSONAL_BAGS_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_BAGS_END) {
server_slot = perl_slot;// + EmuConstants::GENERAL_BAGS_BEGIN - legacy::SLOT_PERSONAL_BAGS_BEGIN;
//if (server_slot < EmuConstants::GENERAL_BAGS_BEGIN || server_slot > EmuConstants::GENERAL_BAGS_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_CURSOR_BAG_BEGIN && perl_slot <= legacy::SLOT_CURSOR_BAG_END) {
server_slot = perl_slot;// + EmuConstants::CURSOR_BAG_BEGIN - legacy::SLOT_CURSOR_BAG_BEGIN;
//if (server_slot < EmuConstants::CURSOR_BAG_BEGIN || server_slot > EmuConstants::CURSOR_BAG_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_TRIBUTE_BEGIN && perl_slot <= legacy::SLOT_TRIBUTE_END) {
server_slot = perl_slot;// + EmuConstants::TRIBUTE_BEGIN - legacy::SLOT_TRIBUTE_BEGIN;
//if (server_slot < EmuConstants::TRIBUTE_BEGIN || server_slot > EmuConstants::TRIBUTE_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_BANK_BEGIN && perl_slot <= legacy::SLOT_BANK_END) {
server_slot = perl_slot;// + EmuConstants::BANK_BEGIN - legacy::SLOT_BANK_BEGIN;
//if (server_slot < EmuConstants::BANK_BEGIN || server_slot > EmuConstants::BANK_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_BANK_BAGS_END) {
server_slot = perl_slot;// + EmuConstants::BANK_BAGS_BEGIN - legacy::SLOT_BANK_BAGS_BEGIN;
//if (server_slot < EmuConstants::BANK_BAGS_BEGIN || server_slot > EmuConstants::BANK_BAGS_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_END) {
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BEGIN - legacy::SLOT_SHARED_BANK_BEGIN;
//if (server_slot < EmuConstants::SHARED_BANK_BEGIN || server_slot > EmuConstants::SHARED_BANK_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_BAGS_END) {
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BAGS_BEGIN - legacy::SLOT_SHARED_BANK_BAGS_END;
//if (server_slot < EmuConstants::SHARED_BANK_BAGS_BEGIN || server_slot > EmuConstants::SHARED_BANK_BAGS_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_TRADE_BEGIN && perl_slot <= legacy::SLOT_TRADE_END) {
server_slot = perl_slot;// + EmuConstants::TRADE_BEGIN - legacy::SLOT_TRADE_BEGIN;
//if (server_slot < EmuConstants::TRADE_BEGIN || server_slot > EmuConstants::TRADE_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_TRADE_BAGS_BEGIN && perl_slot <= legacy::SLOT_TRADE_BAGS_END) {
server_slot = perl_slot;// + EmuConstants::TRADE_BAGS_BEGIN - legacy::SLOT_TRADE_BAGS_BEGIN;
//if (server_slot < EmuConstants::TRADE_BAGS_BEGIN || server_slot > EmuConstants::TRADE_BAGS_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= legacy::SLOT_WORLD_BEGIN && perl_slot <= legacy::SLOT_WORLD_END) {
server_slot = perl_slot;// + EmuConstants::WORLD_BEGIN - legacy::SLOT_WORLD_BEGIN;
//if (server_slot < EmuConstants::WORLD_BEGIN || server_slot > EmuConstants::WORLD_END)
// server_slot = INVALID_INDEX;
}
else if (perl_slot >= 8000 && perl_slot <= 8999) { // this range may be limited to 36 in the future (client size)
server_slot = perl_slot;
}
return server_slot;
}
}
*/
//
// class EQLimits
//
// client validation
bool EQLimits::IsValidClientVersion(uint32 version) {
if (version < _EQClientCount)
bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion) {
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
return true;
return false;
}
uint32 EQLimits::ValidateClientVersion(uint32 version) {
if (version < _EQClientCount)
return version;
ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) {
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
return clientVersion;
return EQClientUnknown;
}
EQClientVersion EQLimits::ValidateClientVersion(EQClientVersion version) {
if (version >= EQClientUnknown)
if (version < _EQClientCount)
return version;
return EQClientUnknown;
return ClientVersion::Unknown;
}
// npc validation
bool EQLimits::IsValidNPCVersion(uint32 version) {
if (version >= _EQClientCount)
if (version < _EmuClientCount)
return true;
return false;
}
uint32 EQLimits::ValidateNPCVersion(uint32 version) {
if (version >= _EQClientCount)
if (version < _EmuClientCount)
return version;
return EQClientUnknown;
}
EQClientVersion EQLimits::ValidateNPCVersion(EQClientVersion version) {
if (version >= _EQClientCount)
if (version < _EmuClientCount)
return version;
return EQClientUnknown;
}
// mob validation
bool EQLimits::IsValidMobVersion(uint32 version) {
if (version < _EmuClientCount)
bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion) {
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
return true;
return false;
}
uint32 EQLimits::ValidateMobVersion(uint32 version) {
if (version < _EmuClientCount)
return version;
ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) {
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
return clientVersion;
return EQClientUnknown;
return ClientVersion::Unknown;
}
EQClientVersion EQLimits::ValidateMobVersion(EQClientVersion version) {
if (version >= EQClientUnknown)
if (version < _EmuClientCount)
return version;
// mob validation
bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion) {
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
return true;
return EQClientUnknown;
return false;
}
ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) {
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
return clientVersion;
return ClientVersion::Unknown;
}
// inventory
uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) {
// not all maps will have an instantiated container..some are references for queue generators (i.e., bazaar, mail, etc...)
// a zero '0' indicates a needed value..otherwise, change to '_NOTUSED' for a null value so indices requiring research can be identified
// ALL of these values need to be verified before pushing to live
@ -527,7 +317,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
//
// when setting NPC-based values, try to adhere to an EmuConstants::<property> or NOT_USED value to avoid unnecessary issues
static const uint16 local[_MapCount][_EmuClientCount] = {
static const uint16 local[_MapCount][CLIENT_VERSION_COUNT] = {
// server and database are sync'd to current MapPossessions's client as set in 'using namespace RoF::slots;' and
// 'EmuConstants::MAP_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask()
// for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations
@ -908,19 +698,19 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
}
};
if ((uint16)map < _MapCount)
return local[map][ValidateMobVersion(version)];
if ((uint16)indexMap < _MapCount)
return local[indexMap][static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
return NOT_USED;
}
uint64 EQLimits::PossessionsBitmask(uint32 version) {
uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion) {
// these are for the new inventory system (RoF)..not the current (Ti) one...
// 0x0000000000200000 is SlotPowerSource (SoF+)
// 0x0000000080000000 is SlotGeneral9 (RoF+)
// 0x0000000100000000 is SlotGeneral10 (RoF+)
static const uint64 local[_EmuClientCount] = {
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x000000027FDFFFFF,
/*Titanium*/ 0x000000027FDFFFFF,
@ -937,11 +727,11 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) {
};
return NOT_USED;
//return local[ValidateMobVersion(version)];
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQLimits::EquipmentBitmask(uint32 version) {
static const uint64 local[_EmuClientCount] = {
uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) {
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x00000000005FFFFF,
/*Titanium*/ 0x00000000005FFFFF,
@ -958,11 +748,11 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) {
};
return NOT_USED;
//return local[ValidateMobVersion(version)];
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQLimits::GeneralBitmask(uint32 version) {
static const uint64 local[_EmuClientCount] = {
uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) {
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x000000007F800000,
/*Titanium*/ 0x000000007F800000,
@ -979,11 +769,11 @@ uint64 EQLimits::GeneralBitmask(uint32 version) {
};
return NOT_USED;
//return local[ValidateMobVersion(version)];
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQLimits::CursorBitmask(uint32 version) {
static const uint64 local[_EmuClientCount] = {
uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) {
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x0000000200000000,
/*Titanium*/ 0x0000000200000000,
@ -1000,11 +790,11 @@ uint64 EQLimits::CursorBitmask(uint32 version) {
};
return NOT_USED;
//return local[ValidateMobVersion(version)];
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQLimits::AllowsEmptyBagInBag(uint32 version) {
static const bool local[_EmuClientCount] = {
bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) {
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ false,
/*62*/ false,
/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG,
@ -1021,11 +811,11 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) {
};
return false; // not implemented
//return local[ValidateMobVersion(version)];
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQLimits::AllowsClickCastFromBag(uint32 version) {
static const bool local[_EmuClientCount] = {
bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) {
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ false,
/*62*/ false,
/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG,
@ -1041,12 +831,12 @@ bool EQLimits::AllowsClickCastFromBag(uint32 version) {
/*Pet*/ false
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
// items
uint16 EQLimits::ItemCommonSize(uint32 version) {
static const uint16 local[_EmuClientCount] = {
uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) {
static const uint16 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ EmuConstants::ITEM_COMMON_SIZE,
/*Titanium*/ EmuConstants::ITEM_COMMON_SIZE,
@ -1062,11 +852,11 @@ uint16 EQLimits::ItemCommonSize(uint32 version) {
/*Pet*/ EmuConstants::ITEM_COMMON_SIZE
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint16 EQLimits::ItemContainerSize(uint32 version) {
static const uint16 local[_EmuClientCount] = {
uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) {
static const uint16 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ EmuConstants::ITEM_CONTAINER_SIZE,
/*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE,
@ -1082,11 +872,11 @@ uint16 EQLimits::ItemContainerSize(uint32 version) {
/*Pet*/ EmuConstants::ITEM_CONTAINER_SIZE
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQLimits::CoinHasWeight(uint32 version) {
static const bool local[_EmuClientCount] = {
bool EQLimits::CoinHasWeight(ClientVersion clientVersion) {
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ true,
/*62*/ true,
/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT,
@ -1102,11 +892,11 @@ bool EQLimits::CoinHasWeight(uint32 version) {
/*Pet*/ true
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint32 EQLimits::BandoliersCount(uint32 version) {
static const uint32 local[_EmuClientCount] = {
uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) {
static const uint32 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ EmuConstants::BANDOLIERS_COUNT,
/*Titanium*/ EmuConstants::BANDOLIERS_COUNT,
@ -1122,11 +912,11 @@ uint32 EQLimits::BandoliersCount(uint32 version) {
/*Pet*/ NOT_USED
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint32 EQLimits::BandolierSize(uint32 version) {
static const uint32 local[_EmuClientCount] = {
uint32 EQLimits::BandolierSize(ClientVersion clientVersion) {
static const uint32 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ EmuConstants::BANDOLIER_SIZE,
/*Titanium*/ EmuConstants::BANDOLIER_SIZE,
@ -1142,11 +932,11 @@ uint32 EQLimits::BandolierSize(uint32 version) {
/*Pet*/ NOT_USED
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint32 EQLimits::PotionBeltSize(uint32 version) {
static const uint32 local[_EmuClientCount] = {
uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) {
static const uint32 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ EmuConstants::POTION_BELT_SIZE,
/*Titanium*/ EmuConstants::POTION_BELT_SIZE,
@ -1162,5 +952,5 @@ uint32 EQLimits::PotionBeltSize(uint32 version) {
/*Pet*/ NOT_USED
};
return local[ValidateMobVersion(version)];
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}

View File

@ -46,15 +46,15 @@ class EmuConstants {
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
public:
// database
static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client
static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client
// inventory
static uint16 InventoryMapSize(int16 map);
static uint16 InventoryMapSize(int16 indexMap);
//static std::string InventoryLocationName(Location_Struct location);
static std::string InventoryMapName(int16 map);
static std::string InventoryMainName(int16 main);
static std::string InventorySubName(int16 sub);
static std::string InventoryAugName(int16 aug);
static std::string InventoryMapName(int16 indexMap);
static std::string InventoryMainName(int16 indexMain);
static std::string InventorySubName(int16 indexSub);
static std::string InventoryAugName(int16 indexAug);
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
static const uint16 MAP_POSSESSIONS_SIZE = _MainCount;
@ -163,44 +163,41 @@ class EQLimits {
public:
// client version validation (checks to avoid crashing zone server when accessing reference arrays)
// use this inside of class Client (limits to actual clients)
static bool IsValidClientVersion(uint32 version);
static uint32 ValidateClientVersion(uint32 version);
static EQClientVersion ValidateClientVersion(EQClientVersion version);
static bool IsValidPCClientVersion(ClientVersion clientVersion);
static ClientVersion ValidatePCClientVersion(ClientVersion clientVersion);
// basically..any non-client classes - do not when setting a valid client
static bool IsValidNPCVersion(uint32 version);
static uint32 ValidateNPCVersion(uint32 version);
static EQClientVersion ValidateNPCVersion(EQClientVersion version);
static bool IsValidNPCClientVersion(ClientVersion clientVersion);
static ClientVersion ValidateNPCClientVersion(ClientVersion clientVersion);
// these are 'universal' - do not when setting a valid client
static bool IsValidMobVersion(uint32 version);
static uint32 ValidateMobVersion(uint32 version);
static EQClientVersion ValidateMobVersion(EQClientVersion version);
static bool IsValidMobClientVersion(ClientVersion clientVersion);
static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion);
// inventory
static uint16 InventoryMapSize(int16 map, uint32 version);
static uint64 PossessionsBitmask(uint32 version);
static uint64 EquipmentBitmask(uint32 version);
static uint64 GeneralBitmask(uint32 version);
static uint64 CursorBitmask(uint32 version);
static uint16 InventoryMapSize(int16 indexMap, ClientVersion clientVersion);
static uint64 PossessionsBitmask(ClientVersion clientVersion);
static uint64 EquipmentBitmask(ClientVersion clientVersion);
static uint64 GeneralBitmask(ClientVersion clientVersion);
static uint64 CursorBitmask(ClientVersion clientVersion);
static bool AllowsEmptyBagInBag(uint32 version);
static bool AllowsClickCastFromBag(uint32 version);
static bool AllowsEmptyBagInBag(ClientVersion clientVersion);
static bool AllowsClickCastFromBag(ClientVersion clientVersion);
// items
static uint16 ItemCommonSize(uint32 version);
static uint16 ItemContainerSize(uint32 version);
static uint16 ItemCommonSize(ClientVersion clientVersion);
static uint16 ItemContainerSize(ClientVersion clientVersion);
// player profile
static bool CoinHasWeight(uint32 version);
static bool CoinHasWeight(ClientVersion clientVersion);
static uint32 BandoliersCount(uint32 version);
static uint32 BandolierSize(uint32 version);
static uint32 BandoliersCount(ClientVersion clientVersion);
static uint32 BandolierSize(ClientVersion clientVersion);
static uint32 PotionBeltSize(uint32 version);
static uint32 PotionBeltSize(ClientVersion clientVersion);
};
#endif /* EQ_LIMITS_H */
#endif /* EQ_DICTIONARY_H */
/*
Working Notes:

View File

@ -35,7 +35,7 @@ public:
virtual const uint32 GetBytesRecieved() const { return 0; }
virtual const uint32 GetBytesSentPerSecond() const { return 0; }
virtual const uint32 GetBytesRecvPerSecond() const { return 0; }
virtual const EQClientVersion ClientVersion() const { return EQClientUnknown; }
virtual const ClientVersion GetClientVersion() const { return ClientVersion::Unknown; }
};
#endif /*EQSTREAMINTF_H_*/

View File

@ -22,9 +22,9 @@ std::string EQStreamProxy::Describe() const {
return(m_structs->Describe());
}
const EQClientVersion EQStreamProxy::ClientVersion() const
const ClientVersion EQStreamProxy::GetClientVersion() const
{
return m_structs->ClientVersion();
return m_structs->GetClientVersion();
}
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {

View File

@ -27,7 +27,7 @@ public:
virtual void RemoveData();
virtual bool CheckState(EQStreamState state);
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
virtual const uint32 GetBytesSent() const;
virtual const uint32 GetBytesRecieved() const;

View File

@ -117,11 +117,11 @@ public:
// Public Methods
///////////////////////////////
Inventory() { m_version = EQClientUnknown; m_versionset = false; }
Inventory() { m_version = ClientVersion::Unknown; m_versionset = false; }
~Inventory();
// Inventory v2 creep
bool SetInventoryVersion(EQClientVersion version) {
bool SetInventoryVersion(ClientVersion version) {
if (!m_versionset) {
m_version = version;
return (m_versionset = true);
@ -131,7 +131,7 @@ public:
}
}
EQClientVersion GetInventoryVersion() { return m_version; }
ClientVersion GetInventoryVersion() { return m_version; }
static void CleanDirty();
static void MarkDirty(ItemInst *inst);
@ -252,7 +252,7 @@ protected:
private:
// Active inventory version
EQClientVersion m_version;
ClientVersion m_version;
bool m_versionset;
};

View File

@ -114,9 +114,9 @@ namespace RoF
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientRoF;
return ClientVersion::RoF;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace RoF {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -114,9 +114,9 @@ namespace RoF2
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientRoF2;
return ClientVersion::RoF2;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace RoF2 {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -112,9 +112,9 @@ namespace SoD
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientSoD;
return ClientVersion::SoD;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace SoD {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -112,9 +112,9 @@ namespace SoF
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientSoF;
return ClientVersion::SoF;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace SoF {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -110,9 +110,9 @@ namespace Titanium
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientTitanium;
return ClientVersion::Tit;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace Titanium {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -112,9 +112,9 @@ namespace Underfoot
return(r);
}
const EQClientVersion Strategy::ClientVersion() const
const ClientVersion Strategy::GetClientVersion() const
{
return EQClientUnderfoot;
return ClientVersion::Und;
}
#include "ss_define.h"

View File

@ -23,7 +23,7 @@ namespace Underfoot {
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
virtual const ClientVersion GetClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"

View File

@ -24,7 +24,7 @@ public:
void Decode(EQApplicationPacket *p) const;
virtual std::string Describe() const = 0;
virtual const EQClientVersion ClientVersion() const = 0;
virtual const ClientVersion GetClientVersion() const = 0;
protected:
//some common coders:

View File

@ -24,7 +24,7 @@
extern ErrorLog *server_log;
extern LoginServer server;
Client::Client(EQStream *c, ClientVersion v)
Client::Client(EQStream *c, LSClientVersion v)
{
connection = c;
version = v;

View File

@ -30,13 +30,13 @@
using namespace std;
enum ClientVersion
enum LSClientVersion
{
cv_titanium,
cv_sod
};
enum ClientStatus
enum LSClientStatus
{
cs_not_sent_session_ready,
cs_waiting_for_login,
@ -59,7 +59,7 @@ public:
/**
* Constructor, sets our connection to c and version to v
*/
Client(EQStream *c, ClientVersion v);
Client(EQStream *c, LSClientVersion v);
/**
* Destructor.
@ -134,8 +134,8 @@ public:
EQEmu::Random random;
private:
EQStream *connection;
ClientVersion version;
ClientStatus status;
LSClientVersion version;
LSClientStatus status;
string account_name;
unsigned int account_id;

View File

@ -89,7 +89,8 @@ Client::Client(EQStreamInterface* ieqs)
ClientVersionBit = 0;
numclients++;
ClientVersionBit = 1 << (eqs->ClientVersion() - 1);
if (eqs->GetClientVersion() != ClientVersion::Unknown)
ClientVersionBit = 1 << (static_cast<unsigned int>(eqs->GetClientVersion()) - 1);
}
Client::~Client() {

View File

@ -155,7 +155,7 @@ void Client::CalcItemBonuses(StatBonuses* newbon) {
}
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
if (GetClientVersion() >= ClientVersion::SoF)
{
const ItemInst* inst = m_inv[MainPowerSource];
if(inst)
@ -3086,7 +3086,7 @@ void Client::CalcItemScale() {
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
if (GetClientVersion() >= ClientVersion::SoF)
{
if(CalcItemScale(MainPowerSource, MainPowerSource))
changed = true;
@ -3180,7 +3180,7 @@ void Client::DoItemEnterZone() {
changed = true;
//Power Source Slot
if (GetClientVersion() >= EQClientSoF)
if (GetClientVersion() >= ClientVersion::SoF)
{
if(DoItemEnterZone(MainPowerSource, MainPowerSource))
changed = true;

View File

@ -1375,7 +1375,7 @@ int32 Bot::GenerateBaseHitPoints()
uint32 Post255;
uint32 NormalSTA = GetSTA();
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd))
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd))
{
float SoDPost255;
@ -9332,7 +9332,7 @@ int32 Bot::GenerateBaseManaPoints()
{
case 'I':
WisInt = INT;
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(WisInt > 100) {
ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
if(WisInt > 201) {
@ -9375,7 +9375,7 @@ int32 Bot::GenerateBaseManaPoints()
case 'W':
WisInt = WIS;
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(WisInt > 100) {
ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
if(WisInt > 201) {
@ -9614,7 +9614,7 @@ int32 Bot::GetMaxStat() {
if (level < 61) {
base = 255;
}
else if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoF) {
else if (GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoF) {
base = 255 + 5 * (level - 60);
}
else if (level < 71) {
@ -10234,7 +10234,7 @@ int32 Bot::CalcBaseEndurance()
int32 sta_end = 0;
int Stats = 0;
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetOwner() && GetOwner()->CastToClient() && GetOwner()->CastToClient()->GetClientVersion() >= ClientVersion::SoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
int HeroicStats = 0;
Stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4);

View File

@ -246,7 +246,7 @@ Client::Client(EQStreamInterface* ieqs)
GlobalChatLimiterTimer = new Timer(RuleI(Chat, IntervalDurationMS));
AttemptedMessages = 0;
TotalKarma = 0;
ClientVersion = EQClientUnknown;
ClientVersion = ClientVersion::Unknown;
ClientVersionBit = 0;
AggroCount = 0;
RestRegenHP = 0;
@ -1440,7 +1440,7 @@ void Client::UpdateWho(uint8 remove) {
else if (m_pp.anon >= 2)
scl->anon = 2;
scl->ClientVersion = GetClientVersion();
scl->ClientVersion = static_cast<unsigned int>(GetClientVersion());
scl->tellsoff = tellsoff;
scl->guild_id = guild_id;
scl->LFG = LFG;
@ -1698,7 +1698,7 @@ void Client::SendManaUpdatePacket() {
if (!Connected() || IsCasting())
return;
if (GetClientVersion() >= EQClientSoD) {
if (GetClientVersion() >= ClientVersion::SoD) {
SendManaUpdate();
SendEnduranceUpdate();
}
@ -1734,7 +1734,7 @@ void Client::SendManaUpdatePacket() {
for(int i = 0; i < MAX_GROUP_MEMBERS; ++i)
if(g->members[i] && g->members[i]->IsClient() && (g->members[i] != this) && (g->members[i]->CastToClient()->GetClientVersion() >= EQClientSoD))
if(g->members[i] && g->members[i]->IsClient() && (g->members[i] != this) && (g->members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD))
{
g->members[i]->CastToClient()->QueuePacket(outapp);
g->members[i]->CastToClient()->QueuePacket(outapp2);
@ -1914,7 +1914,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
BookText_Struct *out = (BookText_Struct *) outapp->pBuffer;
out->window = book->window;
if(GetClientVersion() >= EQClientSoF)
if(GetClientVersion() >= ClientVersion::SoF)
{
const ItemInst *inst = m_inv[book->invslot];
if(inst)
@ -4065,7 +4065,7 @@ bool Client::GroupFollow(Client* inviter) {
group->UpdateGroupAAs();
//Invite the inviter into the group first.....dont ask
if (inviter->GetClientVersion() < EQClientSoD)
if (inviter->GetClientVersion() < ClientVersion::SoD)
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
GroupJoin_Struct* outgj = (GroupJoin_Struct*)outapp->pBuffer;
@ -4111,13 +4111,13 @@ bool Client::GroupFollow(Client* inviter) {
return false;
}
if (GetClientVersion() >= EQClientSoD)
if (GetClientVersion() >= ClientVersion::SoD)
{
SendGroupJoinAcknowledge();
}
// Temporary hack for SoD, as things seem to work quite differently
if (inviter->IsClient() && inviter->GetClientVersion() >= EQClientSoD)
if (inviter->IsClient() && inviter->GetClientVersion() >= ClientVersion::SoD)
{
database.RefreshGroupFromDB(inviter);
}
@ -4351,7 +4351,7 @@ void Client::IncrementAggroCount() {
if (AggroCount == 1)
SavedRaidRestTimer = rest_timer.GetRemainingTime();
if(GetClientVersion() >= EQClientSoF) {
if(GetClientVersion() >= ClientVersion::SoF) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 1);
char *Buffer = (char *)outapp->pBuffer;
@ -4396,7 +4396,7 @@ void Client::DecrementAggroCount() {
rest_timer.Start(time_until_rest);
if(GetClientVersion() >= EQClientSoF) {
if(GetClientVersion() >= ClientVersion::SoF) {
EQApplicationPacket *outapp = new EQApplicationPacket(OP_RestState, 5);
char *Buffer = (char *)outapp->pBuffer;
@ -6805,7 +6805,7 @@ void Client::SendStatsWindow(Client* client, bool use_window)
if(use_window) {
if(final_stats.size() < 4096)
{
uint32 Buttons = (client->GetClientVersion() < EQClientSoD) ? 0 : 1;
uint32 Buttons = (client->GetClientVersion() < ClientVersion::SoD) ? 0 : 1;
client->SendWindow(0, POPUPID_UPDATE_SHOWSTATSWINDOW, Buttons, "Cancel", "Update", 0, 1, this, "", "%s", final_stats.c_str());
goto Extra_Info;
}
@ -6841,7 +6841,7 @@ void Client::SendStatsWindow(Client* client, bool use_window)
}
void Client::SendAltCurrencies() {
if(GetClientVersion() >= EQClientSoF) {
if(GetClientVersion() >= ClientVersion::SoF) {
uint32 count = zone->AlternateCurrencies.size();
if(count == 0) {
return;
@ -7332,7 +7332,7 @@ void Client::SendMercPersonalInfo()
if(mercData)
{
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
if (mercCount > 0)
{

View File

@ -1019,7 +1019,7 @@ public:
inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); }
inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
inline const EQClientVersion GetClientVersion() const { return ClientVersion; }
inline const ClientVersion GetClientVersion() const { return ClientVersion; }
inline const uint32 GetClientVersionBit() const { return ClientVersionBit; }
/** Adventure Stuff **/
@ -1506,7 +1506,7 @@ private:
Timer *GlobalChatLimiterTimer; //60 seconds
uint32 AttemptedMessages;
EQClientVersion ClientVersion;
ClientVersion ClientVersion;
uint32 ClientVersionBit;
int XPRate;

View File

@ -43,7 +43,7 @@ int32 Client::GetMaxStat() const {
if (level < 61) {
base = 255;
}
else if (GetClientVersion() >= EQClientSoF) {
else if (GetClientVersion() >= ClientVersion::SoF) {
base = 255 + 5 * (level - 60);
}
else if (level < 71) {
@ -367,7 +367,7 @@ uint32 Mob::GetClassLevelFactor(){
int32 Client::CalcBaseHP()
{
if(GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
int stats = GetSTA();
if(stats > 255) {
stats = (stats - 255) / 2;
@ -973,7 +973,7 @@ int32 Client::CalcBaseMana()
case 'I':
WisInt = GetINT();
if (GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if (GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if (WisInt > 100) {
ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
@ -1008,7 +1008,7 @@ int32 Client::CalcBaseMana()
case 'W':
WisInt = GetWIS();
if (GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if (GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if (WisInt > 100) {
ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
@ -1925,7 +1925,7 @@ int32 Client::CalcBaseEndurance()
{
int32 base_end = 0;
if(GetClientVersion() >= EQClientSoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetClientVersion() >= ClientVersion::SoF && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
double heroic_stats = (GetHeroicSTR() + GetHeroicSTA() + GetHeroicDEX() + GetHeroicAGI()) / 4.0f;
double stats = (GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4.0f;

View File

@ -509,7 +509,7 @@ void Client::CompleteConnect()
if (IsInAGuild()){
uint8 rank = GuildRank();
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
switch (rank) {
case 0: { rank = 5; break; } // GUILD_MEMBER 0
@ -823,7 +823,7 @@ void Client::CompleteConnect()
if (zone->GetZoneID() == RuleI(World, GuildBankZoneID) && GuildBanks)
GuildBanks->SendGuildBank(this);
if (GetClientVersion() >= EQClientSoD)
if (GetClientVersion() >= ClientVersion::SoD)
entity_list.SendFindableNPCList(this);
if (IsInAGuild()) {
@ -1035,7 +1035,7 @@ void Client::Handle_Connect_OP_ReqClientSpawn(const EQApplicationPacket *app)
outapp = new EQApplicationPacket(OP_SendExpZonein, 0);
FastQueuePacket(&outapp);
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
outapp = new EQApplicationPacket(OP_ClientReady, 0);
FastQueuePacket(&outapp);
@ -1309,14 +1309,12 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
conn_state = ReceivedZoneEntry;
ClientVersion = Connection()->ClientVersion();
if (ClientVersion != EQClientUnknown)
ClientVersionBit = 1 << (ClientVersion - 1);
else
ClientVersionBit = 0;
ClientVersion = Connection()->GetClientVersion();
if (ClientVersion != ClientVersion::Unknown)
ClientVersionBit = 1 << (static_cast<unsigned int>(ClientVersion) - 1);
bool siv = m_inv.SetInventoryVersion(ClientVersion);
LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), EQClientVersionName(ClientVersion), ClientVersion);
LogFile->write(EQEmuLog::Debug, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(ClientVersion), ClientVersion);
/* Antighost code
tmp var is so the search doesnt find this object
@ -1499,7 +1497,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
m_pp.guild_id = GuildID();
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
// FIXME: RoF guild rank
if (GetClientVersion() >= EQClientRoF) {
if (GetClientVersion() >= ClientVersion::RoF) {
switch (rank) {
case 0:
rank = 5;
@ -1850,7 +1848,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
/* Task Packets */
LoadClientTaskState();
if (GetClientVersion() >= EQClientRoF) {
if (GetClientVersion() >= ClientVersion::RoF) {
outapp = new EQApplicationPacket(OP_ReqNewZone, 0);
Handle_Connect_OP_ReqNewZone(outapp);
safe_delete(outapp);
@ -3079,7 +3077,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
// Delegate to tradeskill object to perform combine
AugmentItem_Struct* in_augment = (AugmentItem_Struct*)app->pBuffer;
bool deleteItems = false;
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
ItemInst *itemOneToPush = nullptr, *itemTwoToPush = nullptr;
@ -5162,7 +5160,7 @@ void Client::Handle_OP_DeleteItem(const EQApplicationPacket *app)
int16 AlcoholTolerance = GetSkill(SkillAlcoholTolerance);
int16 IntoxicationIncrease;
if (GetClientVersion() < EQClientSoD)
if (GetClientVersion() < ClientVersion::SoD)
IntoxicationIncrease = (200 - AlcoholTolerance) * 30 / 200 + 10;
else
IntoxicationIncrease = (270 - AlcoholTolerance) * 0.111111108 + 10;
@ -5479,7 +5477,7 @@ void Client::Handle_OP_EndLootRequest(const EQApplicationPacket *app)
Entity* entity = entity_list.GetID(*((uint16*)app->pBuffer));
if (entity == 0) {
Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)");
if (GetClientVersion() >= EQClientSoD)
if (GetClientVersion() >= ClientVersion::SoD)
Corpse::SendEndLootErrorPacket(this);
else
Corpse::SendLootReqErrorPacket(this);
@ -6845,7 +6843,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app)
uint32 Action = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
uint32 sentAction = Action;
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
Action += 1;
/*
@ -7412,7 +7410,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
GuildInviteAccept_Struct* gj = (GuildInviteAccept_Struct*)app->pBuffer;
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
if (gj->response > 9)
{
@ -7472,7 +7470,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
uint32 guildrank = gj->response;
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
if (gj->response == 8)
{
@ -8081,7 +8079,7 @@ void Client::Handle_OP_InspectRequest(const EQApplicationPacket *app)
Mob* tmp = entity_list.GetMob(ins->TargetID);
if (tmp != 0 && tmp->IsClient()) {
if (tmp->CastToClient()->GetClientVersion() < EQClientSoF) { tmp->CastToClient()->QueuePacket(app); } // Send request to target
if (tmp->CastToClient()->GetClientVersion() < ClientVersion::SoF) { tmp->CastToClient()->QueuePacket(app); } // Send request to target
// Inspecting an SoF or later client will make the server handle the request
else { ProcessInspectRequest(tmp->CastToClient(), this); }
}
@ -8601,7 +8599,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
}
else
{
if (GetClientVersion() >= EQClientSoD && !inst->IsEquipable(GetBaseRace(), GetClass()))
if (GetClientVersion() >= ClientVersion::SoD && !inst->IsEquipable(GetBaseRace(), GetClass()))
{
if (item->ItemType != ItemTypeFood && item->ItemType != ItemTypeDrink && item->ItemType != ItemTypeAlcohol)
{
@ -9436,14 +9434,14 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app)
return;
}
mercTypeCount = tar->GetNumMercTypes(GetClientVersion());
mercCount = tar->GetNumMercs(GetClientVersion());
mercTypeCount = tar->GetNumMercTypes(static_cast<unsigned int>(GetClientVersion()));
mercCount = tar->GetNumMercs(static_cast<unsigned int>(GetClientVersion()));
if (mercCount > MAX_MERC)
return;
std::list<MercType> mercTypeList = tar->GetMercTypesList(GetClientVersion());
std::list<MercData> mercDataList = tar->GetMercsList(GetClientVersion());
std::list<MercType> mercTypeList = tar->GetMercTypesList(static_cast<unsigned int>(GetClientVersion()));
std::list<MercData> mercDataList = tar->GetMercsList(static_cast<unsigned int>(GetClientVersion()));
int i = 0;
int StanceCount = 0;
@ -11343,7 +11341,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app)
}
BookRequest_Struct* book = (BookRequest_Struct*)app->pBuffer;
ReadBook(book);
if (GetClientVersion() >= EQClientSoF)
if (GetClientVersion() >= ClientVersion::SoF)
{
EQApplicationPacket EndOfBook(OP_FinishWindow, 0);
QueuePacket(&EndOfBook);
@ -12660,7 +12658,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
{
if (!HasSkill(SkillHide) && GetSkill(SkillHide) == 0)
{
if (GetClientVersion() < EQClientSoF)
if (GetClientVersion() < ClientVersion::SoF)
{
char *hack_str = nullptr;
MakeAnyLenString(&hack_str, "Player sent OP_SpawnAppearance with AT_Invis: %i", sa->parameter);
@ -13497,7 +13495,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app)
this->Trader_StartTrader();
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderStatus_Struct));
TraderStatus_Struct* tss = (TraderStatus_Struct*)outapp->pBuffer;

View File

@ -124,7 +124,7 @@ bool Client::Process() {
HandleRespawnFromHover(0);
}
if(IsTracking() && (GetClientVersion() >= EQClientSoD) && TrackingTimer.Check())
if(IsTracking() && (GetClientVersion() >= ClientVersion::SoD) && TrackingTimer.Check())
DoTracking();
if(hpupdate_timer.Check())
@ -871,7 +871,7 @@ void Client::BulkSendInventoryItems() {
}
// Power Source
if(GetClientVersion() >= EQClientSoF) {
if(GetClientVersion() >= ClientVersion::SoF) {
const ItemInst* inst = m_inv[MainPowerSource];
if(inst) {
std::string packet = inst->Serialize(MainPowerSource);
@ -1792,7 +1792,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app)
}
}
if(GetClientVersion() >= EQClientSoF) {
if(GetClientVersion() >= ClientVersion::SoF) {
// The following packet decreases the skill points left in the Training Window and
// produces the 'You have increased your skill / learned the basics of' message.
//

View File

@ -2632,7 +2632,7 @@ void command_peekinv(Client *c, const Seperator *sep)
indexMain, ((item_data == nullptr) ? 0 : item_data->ID), item_link.c_str(), ((inst_main == nullptr) ? 0 : inst_main->GetCharges()));
}
if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= EQClientSoF)) {
if ((scopeWhere & peekWorn) && (targetClient->GetClientVersion() >= ClientVersion::SoF)) {
inst_main = targetClient->GetInv().GetItem(MainPowerSource);
item_data = (inst_main == nullptr) ? nullptr : inst_main->GetItem();
linker.SetItemInst(inst_main);

View File

@ -298,7 +298,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
// cash
// Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't.
// (change to first client that supports 'death hover' mode, if not SoF.)
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < EQClientSoF) {
if (!RuleB(Character, RespawnFromHover) || client->GetClientVersion() < ClientVersion::SoF) {
SetCash(pp->copper, pp->silver, pp->gold, pp->platinum);
pp->copper = 0;
pp->silver = 0;
@ -317,7 +317,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
std::list<uint32> removed_list;
//bool cursor = false;
for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) {
if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) {
if(i == MainAmmo && client->GetClientVersion() >= ClientVersion::SoF) {
item = client->GetInv().GetItem(MainPowerSource);
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) {
std::list<uint32> slot_list = MoveItemToCorpse(client, item, MainPowerSource);
@ -1041,7 +1041,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
// This is required for the 'Loot All' feature to work for SoD clients. I expect it is to tell the client that the
// server has now sent all the items on the corpse.
if(client->GetClientVersion() >= EQClientSoD) { SendLootReqErrorPacket(client, 6); }
if(client->GetClientVersion() >= ClientVersion::SoD) { SendLootReqErrorPacket(client, 6); }
}
void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {

View File

@ -4378,7 +4378,7 @@ void EntityList::UpdateFindableNPCState(NPC *n, bool Remove)
auto it = client_list.begin();
while (it != client_list.end()) {
Client *c = it->second;
if (c && (c->GetClientVersion() >= EQClientSoD))
if (c && (c->GetClientVersion() >= ClientVersion::SoD))
c->QueuePacket(outapp);
++it;

View File

@ -393,7 +393,7 @@ void Group::SendHPPacketsTo(Mob *member)
{
members[i]->CreateHPPacket(&hpapp);
member->CastToClient()->QueuePacket(&hpapp, false);
if(member->CastToClient()->GetClientVersion() >= EQClientSoD)
if(member->CastToClient()->GetClientVersion() >= ClientVersion::SoD)
{
outapp.SetOpcode(OP_MobManaUpdate);
MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer;
@ -424,7 +424,7 @@ void Group::SendHPPacketsFrom(Mob *member)
if(members[i] && members[i] != member && members[i]->IsClient())
{
members[i]->CastToClient()->QueuePacket(&hp_app);
if(members[i]->CastToClient()->GetClientVersion() >= EQClientSoD)
if(members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD)
{
outapp.SetOpcode(OP_MobManaUpdate);
MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer;
@ -564,7 +564,7 @@ bool Group::DelMemberOOZ(const char *Name) {
if(GroupCount() < 3)
{
UnDelegateMarkNPC(NPCMarkerName.c_str());
if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < EQClientSoD) {
if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < ClientVersion::SoD) {
UnDelegateMainAssist(MainAssistName.c_str());
}
ClearAllNPCMarks();
@ -722,7 +722,7 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
if(GroupCount() < 3)
{
UnDelegateMarkNPC(NPCMarkerName.c_str());
if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < EQClientSoD) {
if(GetLeader() && GetLeader()->IsClient() && GetLeader()->CastToClient()->GetClientVersion() < ClientVersion::SoD) {
UnDelegateMainAssist(MainAssistName.c_str());
}
ClearAllNPCMarks();
@ -1567,7 +1567,7 @@ void Group::NotifyMainTank(Client *c, uint8 toggle)
if(!MainTankName.size())
return;
if(c->GetClientVersion() < EQClientSoD)
if(c->GetClientVersion() < ClientVersion::SoD)
{
if(toggle)
c->Message(0, "%s is now Main Tank.", MainTankName.c_str());
@ -1607,7 +1607,7 @@ void Group::NotifyMainAssist(Client *c, uint8 toggle)
if(!MainAssistName.size())
return;
if(c->GetClientVersion() < EQClientSoD)
if(c->GetClientVersion() < ClientVersion::SoD)
{
EQApplicationPacket *outapp = new EQApplicationPacket(OP_DelegateAbility, sizeof(DelegateAbility_Struct));
@ -1662,7 +1662,7 @@ void Group::NotifyPuller(Client *c, uint8 toggle)
if(!PullerName.size())
return;
if(c->GetClientVersion() < EQClientSoD)
if(c->GetClientVersion() < ClientVersion::SoD)
{
if(toggle)
c->Message(0, "%s is now Puller.", PullerName.c_str());
@ -2228,7 +2228,7 @@ void Group::ChangeLeader(Mob* newleader)
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) {
if (members[i] && members[i]->IsClient())
{
if(members[i]->CastToClient()->GetClientVersion() >= EQClientSoD)
if(members[i]->CastToClient()->GetClientVersion() >= ClientVersion::SoD)
members[i]->CastToClient()->SendGroupLeaderChangePacket(newleader->GetName());
members[i]->CastToClient()->QueuePacket(outapp);

View File

@ -64,7 +64,7 @@ void Client::SendGuildMOTD(bool GetGuildMOTDReply) {
void Client::SendGuildURL()
{
if(GetClientVersion() < EQClientSoF)
if(GetClientVersion() < ClientVersion::SoF)
return;
if(IsInAGuild())
@ -85,7 +85,7 @@ void Client::SendGuildURL()
void Client::SendGuildChannel()
{
if(GetClientVersion() < EQClientSoF)
if(GetClientVersion() < ClientVersion::SoF)
return;
if(IsInAGuild())
@ -107,7 +107,7 @@ void Client::SendGuildChannel()
void Client::SendGuildRanks()
{
if(GetClientVersion() < EQClientRoF)
if(GetClientVersion() < ClientVersion::RoF)
return;
int permissions = 30 + 1; //Static number of permissions in all EQ clients as of May 2014
@ -150,7 +150,7 @@ void Client::SendGuildSpawnAppearance() {
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
mlog(GUILDS__OUT_PACKETS, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank);
SendAppearancePacket(AT_GuildID, GuildID());
if(GetClientVersion() >= EQClientRoF)
if(GetClientVersion() >= ClientVersion::RoF)
{
switch (rank) {
case 0: { rank = 5; break; } // GUILD_MEMBER 0

View File

@ -322,7 +322,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
else if(c != nullptr && s->guild_id != GUILD_NONE) {
//char is in zone, and has changed into a new guild, send MOTD.
c->SendGuildMOTD();
if(c->GetClientVersion() >= EQClientRoF)
if(c->GetClientVersion() >= ClientVersion::RoF)
{
c->SendGuildRanks();
}

View File

@ -55,7 +55,7 @@ uint32 Client::NukeItem(uint32 itemnum, uint8 where_to_check) {
x++;
}
if (GetClientVersion() >= EQClientSoF)
if (GetClientVersion() >= ClientVersion::SoF)
DeleteItemInInventory(MainPowerSource, 0, true);
else
DeleteItemInInventory(MainPowerSource, 0, false); // Prevents Titanium crash
@ -683,7 +683,7 @@ void Client::SendCursorBuffer() {
// Temporary work-around for the RoF+ Client Buffer
// Instead of dealing with client moving items in cursor buffer,
// we can just send the next item in the cursor buffer to the cursor.
if (GetClientVersion() >= EQClientRoF)
if (GetClientVersion() >= ClientVersion::RoF)
{
if (!GetInv().CursorEmpty())
{
@ -937,7 +937,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs
for (int16 i = EmuConstants::EQUIPMENT_BEGIN; i < MainPowerSource; i++) { // originally (i < 22)
if (i == EmuConstants::GENERAL_BEGIN) {
// added power source check for SoF+ clients
if (this->GetClientVersion() >= EQClientSoF)
if (this->GetClientVersion() >= ClientVersion::SoF)
i = MainPowerSource;
else
break;
@ -2083,7 +2083,7 @@ void Client::RemoveNoRent(bool client_update)
auto inst = m_inv[MainPowerSource];
if (inst && !inst->GetItem()->NoRent) {
mlog(INVENTORY__SLOTS, "NoRent Timer Lapse: Deleting %s from slot %i", inst->GetItem()->Name, MainPowerSource);
DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= EQClientSoF) ? client_update : false); // Ti slot non-existent
DeleteItemInInventory(MainPowerSource, 0, (GetClientVersion() >= ClientVersion::SoF) ? client_update : false); // Ti slot non-existent
}
}
@ -2301,7 +2301,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
bool is_arrow = (inst->GetItem()->ItemType == ItemTypeArrow) ? true : false;
int16 free_slot_id = m_inv.FindFreeSlot(inst->IsType(ItemClassContainer), true, inst->GetItem()->Size, is_arrow);
mlog(INVENTORY__ERROR, "Slot Assignment Error: Moving %s from slot %i to %i", inst->GetItem()->Name, MainPowerSource, free_slot_id);
PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= EQClientSoF) ? client_update : false);
PutItemInInventory(free_slot_id, *inst, (GetClientVersion() >= ClientVersion::SoF) ? client_update : false);
database.SaveInventory(character_id, nullptr, MainPowerSource);
safe_delete(inst);
}

View File

@ -834,7 +834,7 @@ void Lua_Client::SetAATitle(const char *title) {
int Lua_Client::GetClientVersion() {
Lua_Safe_Call_Int();
return self->GetClientVersion();
return static_cast<unsigned int>(self->GetClientVersion());
}
uint32 Lua_Client::GetClientVersionBit() {

View File

@ -1758,12 +1758,15 @@ luabind::scope lua_register_client_version() {
return luabind::class_<ClientVersions>("ClientVersion")
.enum_("constants")
[
luabind::value("Unknown", static_cast<int>(EQClientUnknown)),
luabind::value("Titanium", static_cast<int>(EQClientTitanium)),
luabind::value("SoF", static_cast<int>(EQClientSoF)),
luabind::value("SoD", static_cast<int>(EQClientSoD)),
luabind::value("Underfoot", static_cast<int>(EQClientUnderfoot)),
luabind::value("RoF", static_cast<int>(EQClientRoF))
luabind::value("Unknown", static_cast<int>(ClientVersion::Unknown)),
luabind::value("Titanium", static_cast<int>(ClientVersion::Tit)), // deprecated
luabind::value("Tit", static_cast<int>(ClientVersion::Tit)),
luabind::value("SoF", static_cast<int>(ClientVersion::SoF)),
luabind::value("SoD", static_cast<int>(ClientVersion::SoD)),
luabind::value("Underfoot", static_cast<int>(ClientVersion::Und)), // deprecated
luabind::value("Und", static_cast<int>(ClientVersion::Und)),
luabind::value("RoF", static_cast<int>(ClientVersion::RoF)),
luabind::value("RoF2", static_cast<int>(ClientVersion::RoF2))
];
}

View File

@ -41,7 +41,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
_baseFR = d->FR;
_basePR = d->PR;
_baseCorrup = d->Corrup;
_OwnerClientVersion = EQClientTitanium;
_OwnerClientVersion = static_cast<unsigned int>(ClientVersion::Tit);
RestRegenHP = 0;
RestRegenMana = 0;
RestRegenEndurance = 0;
@ -1008,7 +1008,7 @@ int32 Merc::CalcBaseEndurance()
int32 sta_end = 0;
int Stats = 0;
if(GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
if(GetClientVersion() >= static_cast<unsigned int>(ClientVersion::SoD) && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
int HeroicStats = 0;
Stats = ((GetSTR() + GetSTA() + GetDEX() + GetAGI()) / 4);
@ -4956,109 +4956,109 @@ void Client::SendMercResponsePackets(uint32 ResponseType)
SendMercMerchantResponsePacket(6);
break;
case 7: //You must dismiss your suspended mercenary before purchasing a new one!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(7);
else
//You have the maximum number of mercenaries. You must dismiss one before purchasing a new one!
SendMercMerchantResponsePacket(6);
break;
case 8: //You can not purchase a mercenary because your group is full!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(8);
else
SendMercMerchantResponsePacket(7);
break;
case 9: //You can not purchase a mercenary because you are in combat!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//Mercenary failed to spawn!
SendMercMerchantResponsePacket(3);
else
SendMercMerchantResponsePacket(8);
break;
case 10: //You have recently dismissed a mercenary and must wait a few more seconds before you can purchase a new one!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//Mercenary failed to spawn!
SendMercMerchantResponsePacket(3);
else
SendMercMerchantResponsePacket(9);
break;
case 11: //An error occurred created your mercenary!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(9);
else
SendMercMerchantResponsePacket(10);
break;
case 12: //Upkeep Charge Message
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(10);
else
SendMercMerchantResponsePacket(11);
break;
case 13: // ???
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(11);
else
SendMercMerchantResponsePacket(12);
break;
case 14: //You ran out of funds to pay for your mercenary!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(12);
else
SendMercMerchantResponsePacket(13);
break;
case 15: // ???
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(13);
else
SendMercMerchantResponsePacket(14);
break;
case 16: //Your mercenary is about to be suspended due to insufficient funds!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(14);
else
SendMercMerchantResponsePacket(15);
break;
case 17: //There is no mercenary liaison nearby!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(15);
else
SendMercMerchantResponsePacket(16);
break;
case 18: //You are too far from the liaison!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(16);
else
SendMercMerchantResponsePacket(17);
break;
case 19: //You do not meet the requirements for that mercenary!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
SendMercMerchantResponsePacket(17);
else
SendMercMerchantResponsePacket(18);
break;
case 20: //You are unable to interact with the liaison!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//You are too far from the liaison!
SendMercMerchantResponsePacket(16);
else
SendMercMerchantResponsePacket(19);
break;
case 21: //You do not have a high enough membership level to purchase this mercenary!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//You do not meet the requirements for that mercenary!
SendMercMerchantResponsePacket(17);
else
SendMercMerchantResponsePacket(20);
break;
case 22: //Your purchase has failed because this mercenary requires a Gold membership!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//You do not meet the requirements for that mercenary!
SendMercMerchantResponsePacket(17);
else
SendMercMerchantResponsePacket(21);
break;
case 23: //Your purchase has failed because this mercenary requires at least a Silver membership!
if (GetClientVersion() < EQClientRoF)
if (GetClientVersion() < ClientVersion::RoF)
//You do not meet the requirements for that mercenary!
SendMercMerchantResponsePacket(17);
else
@ -5211,7 +5211,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) {
}
// Check client version
if(GetClientVersion() < mercTemplate->ClientVersion)
if(static_cast<unsigned int>(GetClientVersion()) < mercTemplate->ClientVersion)
{
SendMercResponsePackets(3);
return false;
@ -5904,7 +5904,7 @@ void Client::UpdateMercLevel() {
void Client::SendMercMerchantResponsePacket(int32 response_type) {
// This response packet brings up the Mercenary Manager window
if(GetClientVersion() >= EQClientSoD)
if(GetClientVersion() >= ClientVersion::SoD)
{
EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryHire, sizeof(MercenaryMerchantResponse_Struct));
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;

View File

@ -118,7 +118,7 @@ Object::Object(Client* client, const ItemInst* inst)
m_data.heading = client->GetHeading();
m_data.x = client->GetX();
m_data.y = client->GetY();
if (client->GetClientVersion() >= EQClientRoF2)
if (client->GetClientVersion() >= ClientVersion::RoF2)
{
// RoF2 places items at player's Z, which is 0.625 of their height.
m_data.z = client->GetZ() - (client->GetSize() * 0.625f);

View File

@ -3899,7 +3899,7 @@ XS(XS_Client_GetClientVersion)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetClientVersion();
RETVAL = static_cast<unsigned int>(THIS->GetClientVersion());
XSprePUSH; PUSHu((UV)RETVAL);
}
XSRETURN(1);

View File

@ -1529,7 +1529,7 @@ void Raid::SendHPPacketsTo(Client *c)
{
members[x].member->CreateHPPacket(&hpapp);
c->QueuePacket(&hpapp, false);
if(c->GetClientVersion() >= EQClientSoD)
if(c->GetClientVersion() >= ClientVersion::SoD)
{
outapp.SetOpcode(OP_MobManaUpdate);
MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer;
@ -1565,7 +1565,7 @@ void Raid::SendHPPacketsFrom(Mob *m)
if(!m->IsClient() || ((members[x].member != m->CastToClient()) && (members[x].GroupNumber == gid)))
{
members[x].member->QueuePacket(&hpapp, false);
if(members[x].member->GetClientVersion() >= EQClientSoD)
if(members[x].member->GetClientVersion() >= ClientVersion::SoD)
{
outapp.SetOpcode(OP_MobManaUpdate);
MobManaUpdate_Struct *mmus = (MobManaUpdate_Struct *)outapp.pBuffer;

View File

@ -3408,7 +3408,7 @@ void Mob::BuffProcess()
{
CastToClient()->SendBuffDurationPacket(buffs[buffs_i]);
// Hack to get UF to play nicer, RoF seems fine without it
if (CastToClient()->GetClientVersion() == EQClientUnderfoot && buffs[buffs_i].numhits > 0)
if (CastToClient()->GetClientVersion() == ClientVersion::Und && buffs[buffs_i].numhits > 0)
CastToClient()->SendBuffNumHitPacket(buffs[buffs_i], buffs_i);
buffs[buffs_i].UpdateClient = false;
}

View File

@ -255,7 +255,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
bitmask = bitmask << (CastToClient()->GetClass() - 1);
if( itm && itm->GetItem()->Classes != 65535 ) {
if ((itm->GetItem()->Click.Type == ET_EquipClick) && !(itm->GetItem()->Classes & bitmask)) {
if (CastToClient()->GetClientVersion() < EQClientSoF) {
if (CastToClient()->GetClientVersion() < ClientVersion::SoF) {
// They are casting a spell from an item that requires equipping but shouldn't let them equip it
LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!",
CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID);
@ -267,14 +267,14 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
return(false);
}
if ((itm->GetItem()->Click.Type == ET_ClickEffect2) && !(itm->GetItem()->Classes & bitmask)) {
if (CastToClient()->GetClientVersion() < EQClientSoF) {
if (CastToClient()->GetClientVersion() < ClientVersion::SoF) {
// They are casting a spell from an item that they don't meet the race/class requirements to cast
LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!",
CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID);
database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class");
}
else {
if (CastToClient()->GetClientVersion() >= EQClientRoF)
if (CastToClient()->GetClientVersion() >= ClientVersion::RoF)
{
// Line 181 in eqstr_us.txt was changed in RoF+
Message(15, "Your race, class, or deity cannot use this item.");
@ -288,7 +288,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
}
}
if( itm && (itm->GetItem()->Click.Type == ET_EquipClick) && !(item_slot <= MainAmmo || item_slot == MainPowerSource) ){
if (CastToClient()->GetClientVersion() < EQClientSoF) {
if (CastToClient()->GetClientVersion() < ClientVersion::SoF) {
// They are attempting to cast a must equip clicky without having it equipped
LogFile->write(EQEmuLog::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) without equiping it!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID);
database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item without equiping it");
@ -5251,7 +5251,7 @@ void Client::SendBuffDurationPacket(Buffs_Struct &buff)
void Client::SendBuffNumHitPacket(Buffs_Struct &buff, int slot)
{
// UF+ use this packet
if (GetClientVersion() < EQClientUnderfoot)
if (GetClientVersion() < ClientVersion::Und)
return;
EQApplicationPacket *outapp;
outapp = new EQApplicationPacket(OP_BuffCreate, sizeof(BuffIcon_Struct) + sizeof(BuffIconEntry_Struct));

View File

@ -975,7 +975,7 @@ void TaskManager::TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, i
void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *TaskList) {
if (c->GetClientVersion() >= EQClientRoF)
if (c->GetClientVersion() >= ClientVersion::RoF)
{
SendTaskSelectorNew(c, mob, TaskCount, TaskList);
return;
@ -2516,7 +2516,7 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i
void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, int ClientTaskIndex, bool Optional, bool TaskComplete) {
if (c->GetClientVersion() >= EQClientRoF)
if (c->GetClientVersion() >= ClientVersion::RoF)
{
SendTaskActivityNew(c, TaskID, ActivityID, ClientTaskIndex, Optional, TaskComplete);
return;

View File

@ -2665,7 +2665,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity);
VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price);
if(GetClientVersion() >= EQClientSoD)
if(GetClientVersion() >= ClientVersion::SoD)
{
VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price
}
@ -2690,7 +2690,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app) {
VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity);
VARSTRUCT_ENCODE_TYPE(uint32, Buf, Quantity * Price);
if(Buyer->GetClientVersion() >= EQClientSoD)
if(Buyer->GetClientVersion() >= ClientVersion::SoD)
{
VARSTRUCT_ENCODE_TYPE(uint32, Buf, 0); // Think this is the upper 32 bits of a 64 bit price
}

View File

@ -874,7 +874,7 @@ void WorldServer::Process() {
database.SetGroupLeaderName(group->GetID(), Inviter->GetName());
group->UpdateGroupAAs();
if(Inviter->CastToClient()->GetClientVersion() < EQClientSoD)
if(Inviter->CastToClient()->GetClientVersion() < ClientVersion::SoD)
{
EQApplicationPacket* outapp=new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
GroupJoin_Struct* outgj=(GroupJoin_Struct*)outapp->pBuffer;

View File

@ -2631,7 +2631,7 @@ void ZoneDatabase::RefreshGroupFromDB(Client *client){
client->QueuePacket(outapp);
safe_delete(outapp);
if(client->GetClientVersion() >= EQClientSoD) {
if(client->GetClientVersion() >= ClientVersion::SoD) {
group->NotifyMainTank(client, 1);
group->NotifyPuller(client, 1);
}

View File

@ -555,7 +555,7 @@ void Client::ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z
if (entity == 0)
{
Message(13, "Error: OP_EndLootRequest: Corpse not found (ent = 0)");
if (GetClientVersion() >= EQClientSoD)
if (GetClientVersion() >= ClientVersion::SoD)
Corpse::SendEndLootErrorPacket(this);
else
Corpse::SendLootReqErrorPacket(this);