Reworked EQDictionary into namespace EQEmu

This commit is contained in:
Uleat 2016-04-15 22:11:53 -04:00
parent 3a339a6646
commit 1b3cfc9a5c
37 changed files with 2204 additions and 776 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 04/15/2016 ==
Uleat: Reworked EQDictionary into namespace EQEmu
== 04/08/2016 ==
Uleat: Added Heal Rotation HOTs (Heal Override Targets) that can be set for proactive healing (default HR behavior is reactive)
Uleat: Added the ability to save/load/delete Heal Rotations based on targeted member - load is automatic when ^hrcreate is used on a bot that has a saved HR entry

View File

@ -11,15 +11,18 @@ SET(common_sources
database_conversions.cpp
database_instances.cpp
dbcore.cpp
deity.cpp
emu_constants.cpp
emu_legacy.cpp
emu_opcodes.cpp
emu_tcp_connection.cpp
emu_tcp_server.cpp
eq_dictionary.cpp
eqdb.cpp
eqdb_res.cpp
eqemu_exception.cpp
eqemu_config.cpp
eqemu_logsys.cpp
eq_limits.cpp
eq_packet.cpp
eq_stream.cpp
eq_stream_factory.cpp
@ -32,6 +35,7 @@ SET(common_sources
guilds.cpp
ipc_mutex.cpp
item.cpp
light_source.cpp
md5.cpp
memory_mapped_file.cpp
misc.cpp
@ -51,6 +55,7 @@ SET(common_sources
races.cpp
rdtsc.cpp
rulesys.cpp
say_link.cpp
serverinfo.cpp
shareddb.cpp
skills.cpp
@ -104,12 +109,13 @@ SET(common_headers
database.h
dbcore.h
deity.h
emu_constants.h
emu_legacy.h
emu_opcodes.h
emu_oplist.h
emu_tcp_connection.h
emu_tcp_server.h
eq_constants.h
eq_dictionary.h
eq_packet_structs.h
eqdb.h
eqdb_res.h
@ -117,6 +123,7 @@ SET(common_headers
eqemu_config.h
eqemu_config_elements.h
eqemu_logsys.h
eq_limits.h
eq_packet.h
eq_stream.h
eq_stream_factory.h
@ -140,6 +147,7 @@ SET(common_headers
item_fieldlist.h
item_struct.h
languages.h
light_source.h
linked_list.h
loottable.h
mail_oplist.h
@ -166,6 +174,7 @@ SET(common_headers
rdtsc.h
rulesys.h
ruletypes.h
say_link.h
seperator.h
serverinfo.h
servertalk.h

149
common/deity.cpp Normal file
View File

@ -0,0 +1,149 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "deity.h"
EQEmu::Deity::TypeBits EQEmu::Deity::ConvertDeityToDeityBit(Types deity)
{
switch (deity) {
case DeityBertoxxulous:
return BIT_DeityBertoxxulous;
case DeityBrellSirilis:
return BIT_DeityBrellSirilis;
case DeityCazicThule:
return BIT_DeityCazicThule;
case DeityErollisiMarr:
return BIT_DeityErollisiMarr;
case DeityBristlebane:
return BIT_DeityBristlebane;
case DeityInnoruuk:
return BIT_DeityInnoruuk;
case DeityKarana:
return BIT_DeityKarana;
case DeityMithanielMarr:
return BIT_DeityMithanielMarr;
case DeityPrexus:
return BIT_DeityPrexus;
case DeityQuellious:
return BIT_DeityQuellious;
case DeityRallosZek:
return BIT_DeityRallosZek;
case DeityRodcetNife:
return BIT_DeityRodcetNife;
case DeitySolusekRo:
return BIT_DeitySolusekRo;
case DeityTheTribunal:
return BIT_DeityTheTribunal;
case DeityTunare:
return BIT_DeityTunare;
case DeityVeeshan:
return BIT_DeityVeeshan;
case DeityAgnostic_LB:
case DeityAgnostic:
return BIT_DeityAgnostic;
default:
return BIT_DeityAll;
};
}
EQEmu::Deity::Types EQEmu::Deity::ConvertDeityBitToDeity(TypeBits deity_bit)
{
switch (deity_bit) {
case BIT_DeityAgnostic:
return DeityAgnostic;
case BIT_DeityBertoxxulous:
return DeityBertoxxulous;
case BIT_DeityBrellSirilis:
return DeityBrellSirilis;
case BIT_DeityCazicThule:
return DeityCazicThule;
case BIT_DeityErollisiMarr:
return DeityErollisiMarr;
case BIT_DeityBristlebane:
return DeityBristlebane;
case BIT_DeityInnoruuk:
return DeityInnoruuk;
case BIT_DeityKarana:
return DeityKarana;
case BIT_DeityMithanielMarr:
return DeityMithanielMarr;
case BIT_DeityPrexus:
return DeityPrexus;
case BIT_DeityQuellious:
return DeityQuellious;
case BIT_DeityRallosZek:
return DeityRallosZek;
case BIT_DeityRodcetNife:
return DeityRodcetNife;
case BIT_DeitySolusekRo:
return DeitySolusekRo;
case BIT_DeityTheTribunal:
return DeityTheTribunal;
case BIT_DeityTunare:
return DeityTunare;
case BIT_DeityVeeshan:
return DeityVeeshan;
default:
return DeityUnknown;
};
}
const char* EQEmu::Deity::GetDeityName(Types deity)
{
switch (deity) {
case DeityBertoxxulous:
return "Bertoxxulous";
case DeityBrellSirilis:
return "Brell Serilis";
case DeityCazicThule:
return "Cazic-Thule";
case DeityErollisiMarr:
return "Erollisi Marr";
case DeityBristlebane:
return "Bristlebane";
case DeityInnoruuk:
return "Innoruuk";
case DeityKarana:
return "Karana";
case DeityMithanielMarr:
return "Mithaniel Marr";
case DeityPrexus:
return "Prexus";
case DeityQuellious:
return "Quellious";
case DeityRallosZek:
return "Rallos Zek";
case DeityRodcetNife:
return "Rodcet Nife";
case DeitySolusekRo:
return "Solusek Ro";
case DeityTheTribunal:
return "The Tribunal";
case DeityTunare:
return "Tunare";
case DeityVeeshan:
return "Veeshan";
case DeityAgnostic_LB:
case DeityAgnostic:
return "Agnostic";
default:
return "Unknown";
};
}

View File

@ -19,148 +19,59 @@
#define DEITY_H
#include "types.h"
#include <string>
// NOTE: This code is not fully implemented since there are no references in the existing code
/*
** Diety types
**
** (ref: eqstr_us.txt)
**
** (Another orphaned enumeration...)
*/
enum DeityTypes
namespace EQEmu
{
/*----*/ DeityUnknown = 0,
/*----*/ DeityAgnostic_LB = 140,
/*3251*/ DeityBertoxxulous = 201,
/*3262*/ DeityBrellSirilis,
/*3253*/ DeityCazicThule,
/*3256*/ DeityErollisiMarr,
/*3252*/ DeityBristlebane,
/*3254*/ DeityInnoruuk,
/*3255*/ DeityKarana,
/*3257*/ DeityMithanielMarr,
/*3259*/ DeityPrexus,
/*3260*/ DeityQuellious,
/*3266*/ DeityRallosZek,
/*3258*/ DeityRodcetNife,
/*3261*/ DeitySolusekRo,
/*3263*/ DeityTheTribunal,
/*3264*/ DeityTunare,
/*3265*/ DeityVeeshan,
/*3250*/ DeityAgnostic = 396
};
class Deity {
public:
enum Types {
DeityUnknown = 0,
DeityAgnostic_LB = 140,
DeityBertoxxulous = 201,
DeityBrellSirilis,
DeityCazicThule,
DeityErollisiMarr,
DeityBristlebane,
DeityInnoruuk,
DeityKarana,
DeityMithanielMarr,
DeityPrexus,
DeityQuellious,
DeityRallosZek,
DeityRodcetNife,
DeitySolusekRo,
DeityTheTribunal,
DeityTunare,
DeityVeeshan,
DeityAgnostic = 396
};
/*
** Deity type bits
**
** (New orphan, but make use of it!)
*/
enum DeityTypeBits : uint32
{
BIT_DeityAll = 0x00000000,
BIT_DeityAgnostic = 0x00000001,
BIT_DeityBertoxxulous = 0x00000002,
BIT_DeityBrellSirilis = 0x00000004,
BIT_DeityCazicThule = 0x00000008,
BIT_DeityErollisiMarr = 0x00000010,
BIT_DeityBristlebane = 0x00000020,
BIT_DeityInnoruuk = 0x00000040,
BIT_DeityKarana = 0x00000080,
BIT_DeityMithanielMarr = 0x00000100,
BIT_DeityPrexus = 0x00000200,
BIT_DeityQuellious = 0x00000400,
BIT_DeityRallosZek = 0x00000800,
BIT_DeityRodcetNife = 0x00001000,
BIT_DeitySolusekRo = 0x00002000,
BIT_DeityTheTribunal = 0x00004000,
BIT_DeityTunare = 0x00008000,
BIT_DeityVeeshan = 0x00010000
};
enum TypeBits : uint32 {
BIT_DeityAll = 0x00000000,
BIT_DeityAgnostic = 0x00000001,
BIT_DeityBertoxxulous = 0x00000002,
BIT_DeityBrellSirilis = 0x00000004,
BIT_DeityCazicThule = 0x00000008,
BIT_DeityErollisiMarr = 0x00000010,
BIT_DeityBristlebane = 0x00000020,
BIT_DeityInnoruuk = 0x00000040,
BIT_DeityKarana = 0x00000080,
BIT_DeityMithanielMarr = 0x00000100,
BIT_DeityPrexus = 0x00000200,
BIT_DeityQuellious = 0x00000400,
BIT_DeityRallosZek = 0x00000800,
BIT_DeityRodcetNife = 0x00001000,
BIT_DeitySolusekRo = 0x00002000,
BIT_DeityTheTribunal = 0x00004000,
BIT_DeityTunare = 0x00008000,
BIT_DeityVeeshan = 0x00010000
};
static DeityTypeBits ConvertDeityToBitDeity(DeityTypes deity)
{
switch(deity)
{
case DeityBertoxxulous: { return BIT_DeityBertoxxulous; }
case DeityBrellSirilis: { return BIT_DeityBrellSirilis; }
case DeityCazicThule: { return BIT_DeityCazicThule; }
case DeityErollisiMarr: { return BIT_DeityErollisiMarr; }
case DeityBristlebane: { return BIT_DeityBristlebane; }
case DeityInnoruuk: { return BIT_DeityInnoruuk; }
case DeityKarana: { return BIT_DeityKarana; }
case DeityMithanielMarr: { return BIT_DeityMithanielMarr; }
case DeityPrexus: { return BIT_DeityPrexus; }
case DeityQuellious: { return BIT_DeityQuellious; }
case DeityRallosZek: { return BIT_DeityRallosZek; }
case DeityRodcetNife: { return BIT_DeityRodcetNife; }
case DeitySolusekRo: { return BIT_DeitySolusekRo; }
case DeityTheTribunal: { return BIT_DeityTheTribunal; }
case DeityTunare: { return BIT_DeityTunare; }
case DeityVeeshan: { return BIT_DeityVeeshan; }
case DeityAgnostic_LB:
case DeityAgnostic: { return BIT_DeityAgnostic; }
default: { break; }
static TypeBits ConvertDeityToDeityBit(Types deity);
static Types ConvertDeityBitToDeity(TypeBits deity_bit);
static const char* GetDeityName(Types deity);
};
}
return BIT_DeityAll;
};
static DeityTypes ConvertBitDeityToDeity(DeityTypeBits deity_bit)
{
switch(deity_bit)
{
case BIT_DeityAgnostic: { return DeityAgnostic; }
case BIT_DeityBertoxxulous: { return DeityBertoxxulous; }
case BIT_DeityBrellSirilis: { return DeityBrellSirilis; }
case BIT_DeityCazicThule: { return DeityCazicThule; }
case BIT_DeityErollisiMarr: { return DeityErollisiMarr; }
case BIT_DeityBristlebane: { return DeityBristlebane; }
case BIT_DeityInnoruuk: { return DeityInnoruuk; }
case BIT_DeityKarana: { return DeityKarana; }
case BIT_DeityMithanielMarr: { return DeityMithanielMarr; }
case BIT_DeityPrexus: { return DeityPrexus; }
case BIT_DeityQuellious: { return DeityQuellious; }
case BIT_DeityRallosZek: { return DeityRallosZek; }
case BIT_DeityRodcetNife: { return DeityRodcetNife; }
case BIT_DeitySolusekRo: { return DeitySolusekRo; }
case BIT_DeityTheTribunal: { return DeityTheTribunal; }
case BIT_DeityTunare: { return DeityTunare; }
case BIT_DeityVeeshan: { return DeityVeeshan; }
default: { break; }
};
return DeityUnknown;
};
static std::string GetDeityName(DeityTypes deity)
{
switch(deity)
{
case DeityBertoxxulous: { return "Bertoxxulous"; }
case DeityBrellSirilis: { return "Brell Serilis"; }
case DeityCazicThule: { return "Cazic-Thule"; }
case DeityErollisiMarr: { return "Erollisi Marr"; }
case DeityBristlebane: { return "Bristlebane"; }
case DeityInnoruuk: { return "Innoruuk"; }
case DeityKarana: { return "Karana"; }
case DeityMithanielMarr: { return "Mithaniel Marr"; }
case DeityPrexus: { return "Prexus"; }
case DeityQuellious: { return "Quellious"; }
case DeityRallosZek: { return "Rallos Zek"; }
case DeityRodcetNife: { return "Rodcet Nife"; }
case DeitySolusekRo: { return "Solusek Ro"; }
case DeityTheTribunal: { return "The Tribunal"; }
case DeityTunare: { return "Tunare"; }
case DeityVeeshan: { return "Veeshan"; }
case DeityAgnostic_LB:
case DeityAgnostic: { return "Agnostic"; }
default: { break; }
};
return "Unknown";
};
#endif
#endif /* DEITY_H */

258
common/emu_constants.cpp Normal file
View File

@ -0,0 +1,258 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "emu_constants.h"
#include "string_util.h"
uint16 EQEmu::Constants::InventoryTypeSize(int16 type_index)
{
switch (type_index) {
case TypePossessions:
return TYPE_POSSESSIONS_SIZE;
case TypeBank:
return TYPE_BANK_SIZE;
case TypeSharedBank:
return TYPE_SHARED_BANK_SIZE;
case TypeTrade:
return TYPE_TRADE_SIZE;
case TypeWorld:
return TYPE_WORLD_SIZE;
case TypeLimbo:
return TYPE_LIMBO_SIZE;
case TypeTribute:
return TYPE_TRIBUTE_SIZE;
case TypeTrophyTribute:
return TYPE_TROPHY_TRIBUTE_SIZE;
case TypeGuildTribute:
return TYPE_GUILD_TRIBUTE_SIZE;
case TypeMerchant:
return TYPE_MERCHANT_SIZE;
case TypeDeleted:
return TYPE_DELETED_SIZE;
case TypeCorpse:
return TYPE_CORPSE_SIZE;
case TypeBazaar:
return TYPE_BAZAAR_SIZE;
case TypeInspect:
return TYPE_INSPECT_SIZE;
case TypeRealEstate:
return TYPE_REAL_ESTATE_SIZE;
case TypeViewMODPC:
return TYPE_VIEW_MOD_PC_SIZE;
case TypeViewMODBank:
return TYPE_VIEW_MOD_BANK_SIZE;
case TypeViewMODSharedBank:
return TYPE_VIEW_MOD_SHARED_BANK_SIZE;
case TypeViewMODLimbo:
return TYPE_VIEW_MOD_LIMBO_SIZE;
case TypeAltStorage:
return TYPE_ALT_STORAGE_SIZE;
case TypeArchived:
return TYPE_ARCHIVED_SIZE;
case TypeMail:
return TYPE_MAIL_SIZE;
case TypeGuildTrophyTribute:
return TYPE_GUILD_TROPHY_TRIBUTE_SIZE;
case TypeKrono:
return TYPE_KRONO_SIZE;
case TypeOther:
return TYPE_OTHER_SIZE;
default:
return NOT_USED;
}
}
/*
const char* EQEmu::Constants::InventoryLocationName(Location_Struct location)
{
// not ready for implementation...
std::string ret_str;
StringFormat(ret_str, "%s, %s, %s, %s", InventoryMapName(location.map), InventoryMainName(location.main), InventorySubName(location.sub), InventoryAugName(location.aug));
return ret_str;
}
*/
const char* EQEmu::Constants::InventoryTypeName(int16 type_index)
{
switch (type_index) {
case INVALID_INDEX:
return "Invalid Type";
case TypePossessions:
return "Possessions";
case TypeBank:
return "Bank";
case TypeSharedBank:
return "SharedBank";
case TypeTrade:
return "Trade";
case TypeWorld:
return "World";
case TypeLimbo:
return "Limbo";
case TypeTribute:
return "Tribute";
case TypeTrophyTribute:
return "TrophyTribute";
case TypeGuildTribute:
return "GuildTribute";
case TypeMerchant:
return "Merchant";
case TypeDeleted:
return "Deleted";
case TypeCorpse:
return "Corpse";
case TypeBazaar:
return "Bazaar";
case TypeInspect:
return "Inspect";
case TypeRealEstate:
return "RealEstate";
case TypeViewMODPC:
return "ViewMODPC";
case TypeViewMODBank:
return "ViewMODBank";
case TypeViewMODSharedBank:
return "ViewMODSharedBank";
case TypeViewMODLimbo:
return "ViewMODLimbo";
case TypeAltStorage:
return "AltStorage";
case TypeArchived:
return "Archived";
case TypeMail:
return "Mail";
case TypeGuildTrophyTribute:
return "GuildTrophyTribute";
case TypeKrono:
return "Krono";
case TypeOther:
return "Other";
default:
return "Unknown Type";
}
}
const char* EQEmu::Constants::InventorySlotName(int16 slot_index)
{
switch (slot_index) {
case INVALID_INDEX:
return "Invalid Slot";
case SlotCharm:
return "Charm";
case SlotEar1:
return "Ear1";
case SlotHead:
return "Head";
case SlotFace:
return "Face";
case SlotEar2:
return "Ear2";
case SlotNeck:
return "Neck";
case SlotShoulders:
return "Shoulders";
case SlotArms:
return "Arms";
case SlotBack:
return "Back";
case SlotWrist1:
return "Wrist1";
case SlotWrist2:
return "Wrist2";
case SlotRange:
return "Range";
case SlotHands:
return "Hands";
case SlotPrimary:
return "Primary";
case SlotSecondary:
return "Secondary";
case SlotFinger1:
return "Finger1";
case SlotFinger2:
return "Finger2";
case SlotChest:
return "Chest";
case SlotLegs:
return "Legs";
case SlotFeet:
return "Feet";
case SlotWaist:
return "Waist";
case SlotPowerSource:
return "PowerSource";
case SlotAmmo:
return "Ammo";
case SlotGeneral1:
return "General1";
case SlotGeneral2:
return "General2";
case SlotGeneral3:
return "General3";
case SlotGeneral4:
return "General4";
case SlotGeneral5:
return "General5";
case SlotGeneral6:
return "General6";
case SlotGeneral7:
return "General7";
case SlotGeneral8:
return "General8";
/*
case SlotGeneral9:
return "General9";
case SlotGeneral10:
return "General10";
*/
case SlotCursor:
return "Cursor";
default:
return "Unknown Slot";
}
}
const char* EQEmu::Constants::InventorySubName(int16 sub_index)
{
if (sub_index == INVALID_INDEX)
return "Invalid Sub";
if ((uint16)sub_index >= ITEM_CONTAINER_SIZE)
return "Unknown Sub";
static std::string ret_str;
ret_str = StringFormat("Container%i", (sub_index + 1)); // zero-based index..but, count starts at one
return ret_str.c_str();
}
const char* EQEmu::Constants::InventoryAugName(int16 aug_index)
{
if (aug_index == INVALID_INDEX)
return "Invalid Aug";
if ((uint16)aug_index >= ITEM_COMMON_SIZE)
return "Unknown Aug";
static std::string ret_str;
ret_str = StringFormat("Augment%i", (aug_index + 1)); // zero-based index..but, count starts at one
return ret_str.c_str();
}

155
common/emu_constants.h Normal file
View File

@ -0,0 +1,155 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 EMU_CONSTANTS_H
#define EMU_CONSTANTS_H
#include "eq_limits.h"
// (future use)
//using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference)
//using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference)
#include "emu_legacy.h"
#include "light_source.h"
#include "deity.h"
#include "say_link.h"
#include <string>
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
namespace EQEmu
{
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
class Constants {
public:
// database
static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client
static const size_t CHARACTER_CREATION_LIMIT = RoF2::consts::CHARACTER_CREATION_LIMIT;
// inventory
static uint16 InventoryTypeSize(int16 type_index);
//static const char* InventoryLocationName(Location_Struct location);
static const char* InventoryTypeName(int16 type_index);
static const char* InventorySlotName(int16 slot_index);
static const char* InventorySubName(int16 sub_index);
static const char* InventoryAugName(int16 aug_index);
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
static const uint16 TYPE_POSSESSIONS_SIZE = SlotCount;
static const uint16 TYPE_BANK_SIZE = 24;
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
static const uint16 TYPE_TRADE_SIZE = 8;
static const uint16 TYPE_WORLD_SIZE = 10;
static const uint16 TYPE_LIMBO_SIZE = 36;
static const uint16 TYPE_TRIBUTE_SIZE = 5; // (need client values)
static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0;
static const uint16 TYPE_MERCHANT_SIZE = 0;
static const uint16 TYPE_DELETED_SIZE = 0;
static const uint16 TYPE_CORPSE_SIZE = SlotCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
static const uint16 TYPE_BAZAAR_SIZE = 80;
static const uint16 TYPE_INSPECT_SIZE = 22;
static const uint16 TYPE_REAL_ESTATE_SIZE = 0;
static const uint16 TYPE_VIEW_MOD_PC_SIZE = NOT_USED;
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = NOT_USED;
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = NOT_USED;
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = NOT_USED;
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
static const uint16 TYPE_ARCHIVED_SIZE = 0;
static const uint16 TYPE_MAIL_SIZE = 0;
static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0;
static const uint16 TYPE_KRONO_SIZE = 0;
static const uint16 TYPE_OTHER_SIZE = 0;
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
static const int16 EQUIPMENT_BEGIN = SlotCharm;
static const int16 EQUIPMENT_END = SlotAmmo;
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
static const int16 GENERAL_BEGIN = SlotGeneral1;
static const int16 GENERAL_END = SlotGeneral8;
static const uint16 GENERAL_SIZE = 8;
static const int16 GENERAL_BAGS_BEGIN = 251;
static const int16 GENERAL_BAGS_END_OFFSET = 79;
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
static const int16 CURSOR_BAG_BEGIN = 331;
static const int16 CURSOR_BAG_END_OFFSET = 9;
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
static const int16 BANK_BEGIN = 2000;
static const int16 BANK_END = 2023;
static const int16 BANK_BAGS_BEGIN = 2031;
static const int16 BANK_BAGS_END_OFFSET = 239;
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
static const int16 SHARED_BANK_BEGIN = 2500;
static const int16 SHARED_BANK_END = 2501;
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
static const int16 TRADE_BEGIN = 3000;
static const int16 TRADE_END = 3007;
static const int16 TRADE_NPC_END = 3003;
static const int16 TRADE_BAGS_BEGIN = 3031;
static const int16 TRADE_BAGS_END_OFFSET = 79;
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
static const int16 WORLD_BEGIN = 4000;
static const int16 WORLD_END = 4009;
static const int16 WORLD_SIZE = TYPE_WORLD_SIZE;
static const int16 TRIBUTE_BEGIN = 400;
static const int16 TRIBUTE_END = 404;
static const int16 TRIBUTE_SIZE = TYPE_TRIBUTE_SIZE;
static const int16 CORPSE_BEGIN = 22;
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
static const int16 MATERIAL_BEGIN = MaterialHead;
static const int16 MATERIAL_END = MaterialSecondary;
static const int16 MATERIAL_TINT_END = MaterialFeet;
static const int16 MATERIAL_SIZE = MaterialCount;
// items
// common and container sizes will not increase until the new 'location' struct is implemented
static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE;
static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE;
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
static const size_t BANDOLIERS_SIZE = RoF2::consts::BANDOLIERS_SIZE; // number of bandolier instances
static const size_t BANDOLIER_ITEM_COUNT = RoF2::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
static const size_t POTION_BELT_ITEM_COUNT = RoF2::consts::POTION_BELT_ITEM_COUNT;
static const size_t TEXT_LINK_BODY_LENGTH = RoF2::consts::TEXT_LINK_BODY_LENGTH;
};
}
#endif /* EMU_CONSTANTS_H */

20
common/emu_legacy.cpp Normal file
View File

@ -0,0 +1,20 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "emu_legacy.h"

109
common/emu_legacy.h Normal file
View File

@ -0,0 +1,109 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 EMU_LEGACY_H
#define EMU_LEGACY_H
#include "types.h"
namespace EQEmu
{
// this is for perl and other legacy systems
class Legacy {
public:
typedef enum {
SLOT_CHARM = 0,
SLOT_EAR01 = 1,
SLOT_HEAD = 2,
SLOT_FACE = 3,
SLOT_EAR02 = 4,
SLOT_NECK = 5,
SLOT_SHOULDER = 6,
SLOT_ARMS = 7,
SLOT_BACK = 8,
SLOT_BRACER01 = 9,
SLOT_BRACER02 = 10,
SLOT_RANGE = 11,
SLOT_HANDS = 12,
SLOT_PRIMARY = 13,
SLOT_SECONDARY = 14,
SLOT_RING01 = 15,
SLOT_RING02 = 16,
SLOT_CHEST = 17,
SLOT_LEGS = 18,
SLOT_FEET = 19,
SLOT_WAIST = 20,
SLOT_POWER_SOURCE = 9999,
SLOT_AMMO = 21,
SLOT_GENERAL_1 = 22,
SLOT_GENERAL_2 = 23,
SLOT_GENERAL_3 = 24,
SLOT_GENERAL_4 = 25,
SLOT_GENERAL_5 = 26,
SLOT_GENERAL_6 = 27,
SLOT_GENERAL_7 = 28,
SLOT_GENERAL_8 = 29,
//SLOT_GENERAL_9 = not supported
//SLOT_GENERAL_10 = not supported
SLOT_CURSOR = 30,
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
SLOT_TRADESKILL = 1000,
SLOT_AUGMENT = 1001,
SLOT_INVALID = (int16)0xFFFF,
SLOT_POSSESSIONS_BEGIN = 0,
SLOT_POSSESSIONS_END = 30,
SLOT_EQUIPMENT_BEGIN = 0,
SLOT_EQUIPMENT_END = 21,
SLOT_PERSONAL_BEGIN = 22,
SLOT_PERSONAL_END = 29,
SLOT_PERSONAL_BAGS_BEGIN = 251,
SLOT_PERSONAL_BAGS_END = 330,
SLOT_CURSOR_BAG_BEGIN = 331,
SLOT_CURSOR_BAG_END = 340,
SLOT_TRIBUTE_BEGIN = 400,
SLOT_TRIBUTE_END = 404,
SLOT_BANK_BEGIN = 2000,
SLOT_BANK_END = 2023,
SLOT_BANK_BAGS_BEGIN = 2031,
SLOT_BANK_BAGS_END = 2270,
SLOT_SHARED_BANK_BEGIN = 2500,
SLOT_SHARED_BANK_END = 2501,
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
SLOT_SHARED_BANK_BAGS_END = 2550,
SLOT_TRADE_BEGIN = 3000,
SLOT_TRADE_END = 3007,
SLOT_TRADE_BAGS_BEGIN = 3031,
SLOT_TRADE_BAGS_END = 3110,
SLOT_WORLD_BEGIN = 4000,
SLOT_WORLD_END = 4009
} InventorySlot;
};
}
#endif /* EMU_LEGACY_H */

View File

@ -21,52 +21,6 @@
#include "skills.h"
#include "types.h"
/*
** Light Types
**
*/
enum LightTypes
{
lightTypeNone = 0,
lightTypeCandle,
lightTypeTorch,
lightTypeTinyGlowingSkull,
lightTypeSmallLantern,
lightTypeSteinOfMoggok, // 5
lightTypeLargeLantern,
lightTypeFlamelessLantern,
lightTypeGlobeOfStars,
lightTypeLightGlobe,
lightTypeLightstone, // 10
lightTypeGreaterLightstone,
lightTypeFireBeetleEye,
lightTypeColdlight,
lightTypeUnknown1,
lightTypeUnknown2 // 15
};
#define LIGHT_TYPES_COUNT 16
/*
** Light Levels
**
*/
enum LightLevels
{
lightLevelUnlit = 0,
lightLevelCandle,
lightLevelTorch,
lightLevelSmallMagic,
lightLevelRedLight,
lightLevelBlueLight, // 5
lightLevelSmallLantern,
lightLevelMagicLantern,
lightLevelLargeLantern,
lightLevelLargeMagic,
lightLevelBrilliant // 10
};
#define LIGHT_LEVELS_COUNT 11
/*
** Item attributes
@ -980,86 +934,6 @@ enum PossessionsSlots : int16
#define SUB_BEGIN 0
#define AUG_BEGIN 0
namespace legacy {
// this is for perl and other legacy systems
typedef enum {
SLOT_CHARM = 0,
SLOT_EAR01 = 1,
SLOT_HEAD = 2,
SLOT_FACE = 3,
SLOT_EAR02 = 4,
SLOT_NECK = 5,
SLOT_SHOULDER = 6,
SLOT_ARMS = 7,
SLOT_BACK = 8,
SLOT_BRACER01 = 9,
SLOT_BRACER02 = 10,
SLOT_RANGE = 11,
SLOT_HANDS = 12,
SLOT_PRIMARY = 13,
SLOT_SECONDARY = 14,
SLOT_RING01 = 15,
SLOT_RING02 = 16,
SLOT_CHEST = 17,
SLOT_LEGS = 18,
SLOT_FEET = 19,
SLOT_WAIST = 20,
SLOT_POWER_SOURCE = 9999,
SLOT_AMMO = 21,
SLOT_GENERAL_1 = 22,
SLOT_GENERAL_2 = 23,
SLOT_GENERAL_3 = 24,
SLOT_GENERAL_4 = 25,
SLOT_GENERAL_5 = 26,
SLOT_GENERAL_6 = 27,
SLOT_GENERAL_7 = 28,
SLOT_GENERAL_8 = 29,
//SLOT_GENERAL_9 = not supported
//SLOT_GENERAL_10 = not supported
SLOT_CURSOR = 30,
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
SLOT_TRADESKILL = 1000,
SLOT_AUGMENT = 1001,
SLOT_INVALID = (int16)0xFFFF,
SLOT_POSSESSIONS_BEGIN = 0,
SLOT_POSSESSIONS_END = 30,
SLOT_EQUIPMENT_BEGIN = 0,
SLOT_EQUIPMENT_END = 21,
SLOT_PERSONAL_BEGIN = 22,
SLOT_PERSONAL_END = 29,
SLOT_PERSONAL_BAGS_BEGIN = 251,
SLOT_PERSONAL_BAGS_END = 330,
SLOT_CURSOR_BAG_BEGIN = 331,
SLOT_CURSOR_BAG_END = 340,
SLOT_TRIBUTE_BEGIN = 400,
SLOT_TRIBUTE_END = 404,
SLOT_BANK_BEGIN = 2000,
SLOT_BANK_END = 2023,
SLOT_BANK_BAGS_BEGIN = 2031,
SLOT_BANK_BAGS_END = 2270,
SLOT_SHARED_BANK_BEGIN = 2500,
SLOT_SHARED_BANK_END = 2501,
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
SLOT_SHARED_BANK_BAGS_END = 2550,
SLOT_TRADE_BEGIN = 3000,
SLOT_TRADE_END = 3007,
SLOT_TRADE_BAGS_BEGIN = 3031,
SLOT_TRADE_BAGS_END = 3110,
SLOT_WORLD_BEGIN = 4000,
SLOT_WORLD_END = 4009
} InventorySlot;
}
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
#endif

695
common/eq_limits.cpp Normal file
View File

@ -0,0 +1,695 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "emu_constants.h"
// client validation
bool EQEmu::Limits::IsValidPCClientVersion(ClientVersion clientVersion)
{
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
return true;
return false;
}
ClientVersion EQEmu::Limits::ValidatePCClientVersion(ClientVersion clientVersion)
{
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
return clientVersion;
return ClientVersion::Unknown;
}
// npc validation
bool EQEmu::Limits::IsValidNPCClientVersion(ClientVersion clientVersion)
{
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
return true;
return false;
}
ClientVersion EQEmu::Limits::ValidateNPCClientVersion(ClientVersion clientVersion)
{
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
return clientVersion;
return ClientVersion::Unknown;
}
// mob validation
bool EQEmu::Limits::IsValidMobClientVersion(ClientVersion clientVersion)
{
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
return true;
return false;
}
ClientVersion EQEmu::Limits::ValidateMobClientVersion(ClientVersion clientVersion)
{
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
return clientVersion;
return ClientVersion::Unknown;
}
// database
size_t EQEmu::Limits::CharacterCreationLimit(ClientVersion clientVersion)
{
static const size_t local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*Client62*/ NOT_USED,
/*Titanium*/ Titanium::consts::CHARACTER_CREATION_LIMIT,
/*SoF*/ SoF::consts::CHARACTER_CREATION_LIMIT,
/*SoD*/ SoD::consts::CHARACTER_CREATION_LIMIT,
/*UF*/ UF::consts::CHARACTER_CREATION_LIMIT,
/*RoF*/ RoF::consts::CHARACTER_CREATION_LIMIT,
/*RoF2*/ RoF2::consts::CHARACTER_CREATION_LIMIT,
/*MobNPC*/ NOT_USED,
/*MobMerc*/ NOT_USED,
/*MobBot*/ NOT_USED,
/*MobPet*/ NOT_USED
};
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
// inventory
uint16 EQEmu::Limits::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
//
// make sure that you transcribe the actual value from 'defaults' to here before updating or client crashes will ensue..and/or...
// insert older clients inside of the progression of client order
//
// TYPE_POSSESSIONS_SIZE does not reflect all actual <client>_constants size due to bitmask-use compatibility
//
// when setting NPC-based values, try to adhere to an Constants::<property> or NOT_USED value to avoid unnecessary issues
static const uint16 local[TypeCount][CLIENT_VERSION_COUNT] = {
// server and database are sync'd to current TypePossessions's client as set in 'using namespace RoF::slots;' and
// 'Constants::TYPE_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask()
// for partial range validation checks and 'Constants::TYPE_POSSESSIONS_SIZE' for full range iterations
{ // local[TypePossessions]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_POSSESSIONS_SIZE,
/*Titanium*/ Constants::TYPE_POSSESSIONS_SIZE,
/*SoF*/ Constants::TYPE_POSSESSIONS_SIZE,
/*SoD*/ Constants::TYPE_POSSESSIONS_SIZE,
/*Underfoot*/ Constants::TYPE_POSSESSIONS_SIZE,
/*RoF*/ Constants::TYPE_POSSESSIONS_SIZE,
/*RoF2*/ Constants::TYPE_POSSESSIONS_SIZE,
/*NPC*/ Constants::TYPE_POSSESSIONS_SIZE,
/*Merc*/ Constants::TYPE_POSSESSIONS_SIZE,
/*Bot*/ Constants::TYPE_POSSESSIONS_SIZE,
/*Pet*/ Constants::TYPE_POSSESSIONS_SIZE
},
{ // local[TypeBank]
/*Unknown*/ NOT_USED,
/*62*/ NOT_USED,
/*Titanium*/ Titanium::consts::TYPE_BANK_SIZE,
/*SoF*/ Constants::TYPE_BANK_SIZE,
/*SoD*/ Constants::TYPE_BANK_SIZE,
/*Underfoot*/ Constants::TYPE_BANK_SIZE,
/*RoF*/ Constants::TYPE_BANK_SIZE,
/*RoF2*/ Constants::TYPE_BANK_SIZE,
/*NPC*/ NOT_USED,
/*Merc*/ NOT_USED,
/*Bot*/ NOT_USED,
/*Pet*/ NOT_USED
},
{ // local[TypeSharedBank]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_SHARED_BANK_SIZE,
/*Titanium*/ Constants::TYPE_SHARED_BANK_SIZE,
/*SoF*/ Constants::TYPE_SHARED_BANK_SIZE,
/*SoD*/ Constants::TYPE_SHARED_BANK_SIZE,
/*Underfoot*/ Constants::TYPE_SHARED_BANK_SIZE,
/*RoF*/ Constants::TYPE_SHARED_BANK_SIZE,
/*RoF2*/ Constants::TYPE_SHARED_BANK_SIZE,
/*NPC*/ NOT_USED,
/*Merc*/ NOT_USED,
/*Bot*/ NOT_USED,
/*Pet*/ NOT_USED
},
{ // local[TypeTrade]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_TRADE_SIZE,
/*Titanium*/ Constants::TYPE_TRADE_SIZE,
/*SoF*/ Constants::TYPE_TRADE_SIZE,
/*SoD*/ Constants::TYPE_TRADE_SIZE,
/*Underfoot*/ Constants::TYPE_TRADE_SIZE,
/*RoF*/ Constants::TYPE_TRADE_SIZE,
/*RoF2*/ Constants::TYPE_TRADE_SIZE,
/*NPC*/ 4,
/*Merc*/ 4,
/*Bot*/ Constants::TYPE_TRADE_SIZE, // client thinks this is another client
/*Pet*/ 4
},
{ // local[TypeWorld]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_WORLD_SIZE,
/*Titanium*/ Constants::TYPE_WORLD_SIZE,
/*SoF*/ Constants::TYPE_WORLD_SIZE,
/*SoD*/ Constants::TYPE_WORLD_SIZE,
/*Underfoot*/ Constants::TYPE_WORLD_SIZE,
/*RoF*/ Constants::TYPE_WORLD_SIZE,
/*RoF2*/ Constants::TYPE_WORLD_SIZE,
/*NPC*/ NOT_USED,
/*Merc*/ NOT_USED,
/*Bot*/ NOT_USED,
/*Pet*/ NOT_USED
},
{ // local[TypeLimbo]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_LIMBO_SIZE,
/*Titanium*/ Constants::TYPE_LIMBO_SIZE,
/*SoF*/ Constants::TYPE_LIMBO_SIZE,
/*SoD*/ Constants::TYPE_LIMBO_SIZE,
/*Underfoot*/ Constants::TYPE_LIMBO_SIZE,
/*RoF*/ Constants::TYPE_LIMBO_SIZE,
/*RoF2*/ Constants::TYPE_LIMBO_SIZE,
/*NPC*/ NOT_USED,
/*Merc*/ NOT_USED,
/*Bot*/ NOT_USED,
/*Pet*/ NOT_USED
},
{ // local[TypeTribute]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_TRIBUTE_SIZE,
/*Titanium*/ Constants::TYPE_TRIBUTE_SIZE,
/*SoF*/ Constants::TYPE_TRIBUTE_SIZE,
/*SoD*/ Constants::TYPE_TRIBUTE_SIZE,
/*Underfoot*/ Constants::TYPE_TRIBUTE_SIZE,
/*RoF*/ Constants::TYPE_TRIBUTE_SIZE,
/*RoF2*/ Constants::TYPE_TRIBUTE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeTrophyTribute]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_TROPHY_TRIBUTE_SIZE,
/*RoF2*/ Constants::TYPE_TROPHY_TRIBUTE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeGuildTribute]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_GUILD_TRIBUTE_SIZE,
/*RoF2*/ Constants::TYPE_GUILD_TRIBUTE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeMerchant]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_MERCHANT_SIZE,
/*RoF2*/ Constants::TYPE_MERCHANT_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeDeleted]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_DELETED_SIZE,
/*RoF2*/ Constants::TYPE_DELETED_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeCorpse]
/*Unknown*/ NOT_USED,
/*62*/ NOT_USED,
/*Titanium*/ Titanium::consts::TYPE_CORPSE_SIZE,
/*SoF*/ SoF::consts::TYPE_CORPSE_SIZE,
/*SoD*/ SoD::consts::TYPE_CORPSE_SIZE,
/*Underfoot*/ UF::consts::TYPE_CORPSE_SIZE,
/*RoF*/ RoF::consts::TYPE_CORPSE_SIZE,
/*RoF2*/ RoF2::consts::TYPE_CORPSE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeBazaar]
/*Unknown*/ NOT_USED,
/*62*/ Constants::TYPE_BAZAAR_SIZE,
/*Titanium*/ Constants::TYPE_BAZAAR_SIZE,
/*SoF*/ Constants::TYPE_BAZAAR_SIZE,
/*SoD*/ Constants::TYPE_BAZAAR_SIZE,
/*Underfoot*/ Constants::TYPE_BAZAAR_SIZE,
/*RoF*/ Constants::TYPE_BAZAAR_SIZE,
/*RoF2*/ Constants::TYPE_BAZAAR_SIZE,
/*NPC*/ 0, // this may need to be 'Constants::TYPE_BAZAAR_SIZE' if offline client traders respawn as an npc
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeInspect]
/*Unknown*/ NOT_USED,
/*62*/ NOT_USED,
/*Titanium*/ Titanium::consts::TYPE_INSPECT_SIZE,
/*SoF*/ SoF::consts::TYPE_INSPECT_SIZE,
/*SoD*/ SoD::consts::TYPE_INSPECT_SIZE,
/*Underfoot*/ UF::consts::TYPE_INSPECT_SIZE,
/*RoF*/ RoF::consts::TYPE_INSPECT_SIZE,
/*RoF2*/ RoF2::consts::TYPE_INSPECT_SIZE,
/*NPC*/ NOT_USED,
/*Merc*/ NOT_USED,
/*Bot*/ NOT_USED,
/*Pet*/ NOT_USED
},
{ // local[TypeRealEstate]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_REAL_ESTATE_SIZE,
/*RoF2*/ Constants::TYPE_REAL_ESTATE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeViewMODPC]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_VIEW_MOD_PC_SIZE,
/*RoF2*/ Constants::TYPE_VIEW_MOD_PC_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeViewMODBank]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_VIEW_MOD_BANK_SIZE,
/*RoF2*/ Constants::TYPE_VIEW_MOD_BANK_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeViewMODSharedBank]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_VIEW_MOD_SHARED_BANK_SIZE,
/*RoF2*/ Constants::TYPE_VIEW_MOD_SHARED_BANK_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeViewMODLimbo]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_VIEW_MOD_LIMBO_SIZE,
/*RoF2*/ Constants::TYPE_VIEW_MOD_LIMBO_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeAltStorage]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_ALT_STORAGE_SIZE,
/*RoF2*/ Constants::TYPE_ALT_STORAGE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeArchived]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_ARCHIVED_SIZE,
/*RoF2*/ Constants::TYPE_ARCHIVED_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeMail]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_MAIL_SIZE,
/*RoF2*/ Constants::TYPE_MAIL_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeGuildTrophyTribute]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_GUILD_TROPHY_TRIBUTE_SIZE,
/*RoF2*/ Constants::TYPE_GUILD_TROPHY_TRIBUTE_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeKrono]
/*Unknown*/ NOT_USED,
/*62*/ NOT_USED,
/*Titanium*/ NOT_USED,
/*SoF*/ NOT_USED,
/*SoD*/ NOT_USED,
/*Underfoot*/ NOT_USED,
/*RoF*/ Constants::TYPE_KRONO_SIZE,
/*RoF2*/ Constants::TYPE_KRONO_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
},
{ // local[TypeOther]
/*Unknown*/ NOT_USED,
/*62*/ 0,
/*Titanium*/ 0,
/*SoF*/ 0,
/*SoD*/ 0,
/*Underfoot*/ 0,
/*RoF*/ Constants::TYPE_OTHER_SIZE,
/*RoF2*/ Constants::TYPE_OTHER_SIZE,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
}
};
if ((uint16)indexMap < TypeCount)
return local[indexMap][static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
return NOT_USED;
}
uint64 EQEmu::Limits::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[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x000000027FDFFFFF,
/*Titanium*/ 0x000000027FDFFFFF,
/*SoF*/ 0x000000027FFFFFFF,
/*SoD*/ 0x000000027FFFFFFF,
/*Underfoot*/ 0x000000027FFFFFFF,
/*RoF*/ 0x00000003FFFFFFFF,
/*RoF2*/ 0,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
};
return NOT_USED;
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQEmu::Limits::EquipmentBitmask(ClientVersion clientVersion)
{
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x00000000005FFFFF,
/*Titanium*/ 0x00000000005FFFFF,
/*SoF*/ 0x00000000007FFFFF,
/*SoD*/ 0x00000000007FFFFF,
/*Underfoot*/ 0x00000000007FFFFF,
/*RoF*/ 0x00000000007FFFFF,
/*RoF2*/ 0,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
};
return NOT_USED;
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQEmu::Limits::GeneralBitmask(ClientVersion clientVersion)
{
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x000000007F800000,
/*Titanium*/ 0x000000007F800000,
/*SoF*/ 0x000000007F800000,
/*SoD*/ 0x000000007F800000,
/*Underfoot*/ 0x000000007F800000,
/*RoF*/ 0x00000001FF800000,
/*RoF2*/ 0,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
};
return NOT_USED;
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint64 EQEmu::Limits::CursorBitmask(ClientVersion clientVersion)
{
static const uint64 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ 0x0000000200000000,
/*Titanium*/ 0x0000000200000000,
/*SoF*/ 0x0000000200000000,
/*SoD*/ 0x0000000200000000,
/*Underfoot*/ 0x0000000200000000,
/*RoF*/ 0x0000000200000000,
/*RoF2*/ 0,
/*NPC*/ 0,
/*Merc*/ 0,
/*Bot*/ 0,
/*Pet*/ 0
};
return NOT_USED;
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQEmu::Limits::AllowsEmptyBagInBag(ClientVersion clientVersion)
{
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ false,
/*62*/ false,
/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*Underfoot*/ UF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG,
/*NPC*/ false,
/*Merc*/ false,
/*Bot*/ false,
/*Pet*/ false
};
return false; // not implemented
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQEmu::Limits::AllowsClickCastFromBag(ClientVersion clientVersion)
{
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ false,
/*62*/ false,
/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*Underfoot*/ UF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG,
/*NPC*/ false,
/*Merc*/ false,
/*Bot*/ false,
/*Pet*/ false
};
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
// items
uint16 EQEmu::Limits::ItemCommonSize(ClientVersion clientVersion)
{
static const uint16 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ Constants::ITEM_COMMON_SIZE,
/*Titanium*/ Constants::ITEM_COMMON_SIZE,
/*SoF*/ Constants::ITEM_COMMON_SIZE,
/*SoD*/ Constants::ITEM_COMMON_SIZE,
/*Underfoot*/ Constants::ITEM_COMMON_SIZE,
/*RoF*/ Constants::ITEM_COMMON_SIZE,
/*RoF2*/ Constants::ITEM_COMMON_SIZE,
/*NPC*/ Constants::ITEM_COMMON_SIZE,
/*Merc*/ Constants::ITEM_COMMON_SIZE,
/*Bot*/ Constants::ITEM_COMMON_SIZE,
/*Pet*/ Constants::ITEM_COMMON_SIZE
};
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
uint16 EQEmu::Limits::ItemContainerSize(ClientVersion clientVersion)
{
static const uint16 local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ NOT_USED,
/*62*/ Constants::ITEM_CONTAINER_SIZE,
/*Titanium*/ Constants::ITEM_CONTAINER_SIZE,
/*SoF*/ Constants::ITEM_CONTAINER_SIZE,
/*SoD*/ Constants::ITEM_CONTAINER_SIZE,
/*Underfoot*/ Constants::ITEM_CONTAINER_SIZE,
/*RoF*/ Constants::ITEM_CONTAINER_SIZE,
/*RoF2*/ Constants::ITEM_CONTAINER_SIZE,
/*NPC*/ Constants::ITEM_CONTAINER_SIZE,
/*Merc*/ Constants::ITEM_CONTAINER_SIZE,
/*Bot*/ Constants::ITEM_CONTAINER_SIZE,
/*Pet*/ Constants::ITEM_CONTAINER_SIZE
};
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}
bool EQEmu::Limits::CoinHasWeight(ClientVersion clientVersion)
{
static const bool local[CLIENT_VERSION_COUNT] = {
/*Unknown*/ true,
/*62*/ true,
/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT,
/*SoF*/ SoF::limits::COIN_HAS_WEIGHT,
/*SoD*/ SoD::limits::COIN_HAS_WEIGHT,
/*Underfoot*/ UF::limits::COIN_HAS_WEIGHT,
/*RoF*/ RoF::limits::COIN_HAS_WEIGHT,
/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT,
/*NPC*/ true,
/*Merc*/ true,
/*Bot*/ true,
/*Pet*/ true
};
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
}

82
common/eq_limits.h Normal file
View File

@ -0,0 +1,82 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 EQ_LIMITS_H
#define EQ_LIMITS_H
#include "types.h"
#include "eq_constants.h"
#include "clientversions.h"
#include "../common/patches/titanium_constants.h"
#include "../common/patches/sof_constants.h"
#include "../common/patches/sod_constants.h"
#include "../common/patches/uf_constants.h"
#include "../common/patches/rof_constants.h"
#include "../common/patches/rof2_constants.h"
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
namespace EQEmu
{
// values should default to a non-beneficial value..unless value conflicts with intended operation
//
// EQEmu::Constants may be used as references..but, not every reference needs to be in EQEmu::Constants (i.e., AllowsEmptyBagInBag(), CoinHasWeight(), etc...)
class Limits {
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 IsValidPCClientVersion(ClientVersion clientVersion);
static ClientVersion ValidatePCClientVersion(ClientVersion clientVersion);
// basically..any non-client classes - do not invoke when setting a valid client
static bool IsValidNPCClientVersion(ClientVersion clientVersion);
static ClientVersion ValidateNPCClientVersion(ClientVersion clientVersion);
// these are 'universal' - do not invoke when setting a valid client
static bool IsValidMobClientVersion(ClientVersion clientVersion);
static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion);
// database
static size_t CharacterCreationLimit(ClientVersion clientVersion);
// inventory
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(ClientVersion clientVersion);
static bool AllowsClickCastFromBag(ClientVersion clientVersion);
// items
static uint16 ItemCommonSize(ClientVersion clientVersion);
static uint16 ItemContainerSize(ClientVersion clientVersion);
// player profile
static bool CoinHasWeight(ClientVersion clientVersion);
};
}
#endif /* EQ_LIMITS_H */

View File

@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
Copyright (C) 2001-2016 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
@ -33,8 +33,7 @@ static const uint32 MAX_MERC_GRADES = 10;
static const uint32 MAX_MERC_STANCES = 10;
static const uint32 BLOCKED_BUFF_COUNT = 20;
//#include "eq_constants.h"
#include "eq_dictionary.h"
#include "emu_constants.h"
/*
** Compiler override to ensure
@ -5342,23 +5341,6 @@ struct ClientMarqueeMessage_Struct {
typedef std::list<ServerLootItem_Struct*> ItemList;
struct TextLinkBody_Struct {
// Current server mask: EQClientRoF2
uint8 unknown_1; /* %1X */
uint32 item_id; /* %05X */
uint32 augment_1; /* %05X */
uint32 augment_2; /* %05X */
uint32 augment_3; /* %05X */
uint32 augment_4; /* %05X */
uint32 augment_5; /* %05X */
uint32 augment_6; /* %05X */
uint8 is_evolving; /* %1X */
uint32 evolve_group; /* %05X */
uint8 evolve_level; /* %02X */
uint32 ornament_icon; /* %05X */
int hash; /* %08X */
};
struct fling_struct {
/* 00 */ uint32 collision; // 0 collision is off, anything else it's on

View File

@ -1006,7 +1006,7 @@ uint8 Inventory::FindBrightestLightType()
auto item = inst->GetItem();
if (item == nullptr) { continue; }
if (LightProfile_Struct::IsLevelGreater(item->Light, brightest_light_type))
if (EQEmu::LightSource::IsLevelGreater(item->Light, brightest_light_type))
brightest_light_type = item->Light;
}
@ -1022,11 +1022,11 @@ uint8 Inventory::FindBrightestLightType()
if (item->ItemClass != ItemClassCommon) { continue; }
if (item->Light < 9 || item->Light > 13) { continue; }
if (LightProfile_Struct::TypeToLevel(item->Light))
if (EQEmu::LightSource::TypeToLevel(item->Light))
general_light_type = item->Light;
}
if (LightProfile_Struct::IsLevelGreater(general_light_type, brightest_light_type))
if (EQEmu::LightSource::IsLevelGreater(general_light_type, brightest_light_type))
brightest_light_type = general_light_type;
return brightest_light_type;
@ -1209,7 +1209,7 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
for (int index = AUG_BEGIN; index < EQEmu::Constants::ITEM_COMMON_SIZE; ++index) {
if (inst->GetAugmentItemID(index) == item_id && quantity <= 1)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
if (!inst->IsType(ItemClassContainer)) { continue; }
@ -1226,7 +1226,7 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
for (int index = AUG_BEGIN; index < EQEmu::Constants::ITEM_COMMON_SIZE; ++index) {
if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
}
}
@ -1257,7 +1257,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
for (int index = AUG_BEGIN; index < EQEmu::Constants::ITEM_COMMON_SIZE; ++index) {
if (inst->GetAugmentItemID(index) == item_id && quantity <= 1)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
if (!inst->IsType(ItemClassContainer)) { continue; }
@ -1274,7 +1274,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
for (int index = AUG_BEGIN; index < EQEmu::Constants::ITEM_COMMON_SIZE; ++index) {
if (bag_inst->GetAugmentItemID(index) == item_id && quantity <= 1)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
}
@ -1366,7 +1366,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
if (aug_inst == nullptr) { continue; }
if (aug_inst->GetItem()->LoreGroup == loregroup)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
if (!inst->IsType(ItemClassContainer)) { continue; }
@ -1383,7 +1383,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
if (aug_inst == nullptr) { continue; }
if (aug_inst->GetItem()->LoreGroup == loregroup)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
}
}
@ -1406,7 +1406,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
if (aug_inst == nullptr) { continue; }
if (aug_inst->GetItem()->LoreGroup == loregroup)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
if (!inst->IsType(ItemClassContainer)) { continue; }
@ -1423,7 +1423,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
if (aug_inst == nullptr) { continue; }
if (aug_inst->GetItem()->LoreGroup == loregroup)
return legacy::SLOT_AUGMENT;
return EQEmu::Legacy::SLOT_AUGMENT;
}
}
@ -3089,66 +3089,3 @@ bool Item_Struct::IsEquipable(uint16 Race, uint16 Class_) const
return (IsRace && IsClass);
}
//
// struct LightProfile_Struct
//
uint8 LightProfile_Struct::TypeToLevel(uint8 lightType)
{
switch (lightType) {
case lightTypeGlobeOfStars:
return lightLevelBrilliant; // 10
case lightTypeFlamelessLantern:
case lightTypeGreaterLightstone:
return lightLevelLargeMagic; // 9
case lightTypeLargeLantern:
return lightLevelLargeLantern; // 8
case lightTypeSteinOfMoggok:
case lightTypeLightstone:
return lightLevelMagicLantern; // 7
case lightTypeSmallLantern:
return lightLevelSmallLantern; // 6
case lightTypeColdlight:
case lightTypeUnknown2:
return lightLevelBlueLight; // 5
case lightTypeFireBeetleEye:
case lightTypeUnknown1:
return lightLevelRedLight; // 4
case lightTypeTinyGlowingSkull:
case lightTypeLightGlobe:
return lightLevelSmallMagic; // 3
case lightTypeTorch:
return lightLevelTorch; // 2
case lightTypeCandle:
return lightLevelCandle; // 1
default:
return lightLevelUnlit; // 0
}
}
bool LightProfile_Struct::IsLevelGreater(uint8 leftType, uint8 rightType)
{
static const uint8 light_levels[LIGHT_TYPES_COUNT] = {
lightLevelUnlit, /* lightTypeNone */
lightLevelCandle, /* lightTypeCandle */
lightLevelTorch, /* lightTypeTorch */
lightLevelSmallMagic, /* lightTypeTinyGlowingSkull */
lightLevelSmallLantern, /* lightTypeSmallLantern */
lightLevelMagicLantern, /* lightTypeSteinOfMoggok */
lightLevelLargeLantern, /* lightTypeLargeLantern */
lightLevelLargeMagic, /* lightTypeFlamelessLantern */
lightLevelBrilliant, /* lightTypeGlobeOfStars */
lightLevelSmallMagic, /* lightTypeLightGlobe */
lightLevelMagicLantern, /* lightTypeLightstone */
lightLevelLargeMagic, /* lightTypeGreaterLightstone */
lightLevelRedLight, /* lightTypeFireBeetleEye */
lightLevelBlueLight, /* lightTypeColdlight */
lightLevelRedLight, /* lightTypeUnknown1 */
lightLevelBlueLight /* lightTypeUnknown2 */
};
if (leftType >= LIGHT_TYPES_COUNT) { leftType = lightTypeNone; }
if (rightType >= LIGHT_TYPES_COUNT) { rightType = lightTypeNone; }
return (light_levels[leftType] > light_levels[rightType]);
}

View File

@ -525,43 +525,4 @@ public:
~EvolveInfo();
};
struct LightProfile_Struct
{
/*
Current criteria (light types):
Equipment: { 0 .. 15 }
General: { 9 .. 13 }
Notes:
- Initial character load and item movement updates use different light source update behaviors
-- Server procedure matches the item movement behavior since most updates occur post-character load
- MainAmmo is not considered when determining light sources
- No 'Sub' or 'Aug' items are recognized as light sources
- Light types '< 9' and '> 13' are not considered for general (carried) light sources
- If values > 0x0F are valid, then assignment limiters will need to be removed
- MainCursor 'appears' to be a valid light source update slot..but, have not experienced updates during debug sessions
- All clients have a bug regarding stackable items (light and sound updates are not processed when picking up an item)
-- The timer-based update cancels out the invalid light source
*/
static uint8 TypeToLevel(uint8 lightType);
static bool IsLevelGreater(uint8 leftType, uint8 rightType);
// Light types (classifications)
struct {
uint8 Innate; // Defined by db field `npc_types`.`light` - where appropriate
uint8 Equipment; // Item_Struct::light value of worn/carried equipment
uint8 Spell; // Set value of any light-producing spell (can be modded to mimic equip_light behavior)
uint8 Active; // Highest value of all light sources
} Type;
// Light levels (intensities) - used to determine which light source should be active
struct {
uint8 Innate;
uint8 Equipment;
uint8 Spell;
uint8 Active;
} Level;
};
#endif // #define __ITEM_H

View File

@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
Copyright (C) 2001-2016 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
@ -42,8 +42,7 @@
* Made ya look! Ha!
*/
//#include "eq_constants.h"
#include "eq_dictionary.h"
#include "emu_constants.h"
/*
** Child struct of Item_Struct:

94
common/light_source.cpp Normal file
View File

@ -0,0 +1,94 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "light_source.h"
void EQEmu::LightSource::impl::Clear()
{
Type.Innate = 0;
Type.Equipment = 0;
Type.Spell = 0;
Type.Active = 0;
Level.Innate = 0;
Level.Equipment = 0;
Level.Spell = 0;
Level.Active = 0;
}
uint8 EQEmu::LightSource::TypeToLevel(uint8 light_type)
{
switch (light_type) {
case TypeGlobeOfStars:
return LevelBrilliant; // 10
case TypeFlamelessLantern:
case TypeGreaterLightstone:
return LevelLargeMagic; // 9
case TypeLargeLantern:
return LevelLargeLantern; // 8
case TypeSteinOfMoggok:
case TypeLightstone:
return LevelMagicLantern; // 7
case TypeSmallLantern:
return LevelSmallLantern; // 6
case TypeColdlight:
case TypeUnknown2:
return LevelBlueLight; // 5
case TypeFireBeetleEye:
case TypeUnknown1:
return LevelRedLight; // 4
case TypeTinyGlowingSkull:
case TypeLightGlobe:
return LevelSmallMagic; // 3
case TypeTorch:
return LevelTorch; // 2
case TypeCandle:
return LevelCandle; // 1
default:
return LevelUnlit; // 0
}
}
bool EQEmu::LightSource::IsLevelGreater(uint8 left_type, uint8 right_type)
{
static const uint8 light_levels[TypeCount] = {
LevelUnlit, /* TypeNone */
LevelCandle, /* TypeCandle */
LevelTorch, /* TypeTorch */
LevelSmallMagic, /* TypeTinyGlowingSkull */
LevelSmallLantern, /* TypeSmallLantern */
LevelMagicLantern, /* TypeSteinOfMoggok */
LevelLargeLantern, /* TypeLargeLantern */
LevelLargeMagic, /* TypeFlamelessLantern */
LevelBrilliant, /* TypeGlobeOfStars */
LevelSmallMagic, /* TypeLightGlobe */
LevelMagicLantern, /* TypeLightstone */
LevelLargeMagic, /* TypeGreaterLightstone */
LevelRedLight, /* TypeFireBeetleEye */
LevelBlueLight, /* TypeColdlight */
LevelRedLight, /* TypeUnknown1 */
LevelBlueLight /* TypeUnknown2 */
};
if (left_type >= TypeCount) { left_type = TypeNone; }
if (right_type >= TypeCount) { right_type = TypeNone; }
return (light_levels[left_type] > light_levels[right_type]);
}

109
common/light_source.h Normal file
View File

@ -0,0 +1,109 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 LIGHT_SOURCE_H
#define LIGHT_SOURCE_H
#include "types.h"
namespace EQEmu
{
class LightSource {
public:
enum Types {
TypeNone = 0,
TypeCandle,
TypeTorch,
TypeTinyGlowingSkull,
TypeSmallLantern,
TypeSteinOfMoggok, // 5
TypeLargeLantern,
TypeFlamelessLantern,
TypeGlobeOfStars,
TypeLightGlobe,
TypeLightstone, // 10
TypeGreaterLightstone,
TypeFireBeetleEye,
TypeColdlight,
TypeUnknown1,
TypeUnknown2, // 15
TypeCount
};
enum Levels {
LevelUnlit = 0,
LevelCandle,
LevelTorch,
LevelSmallMagic,
LevelRedLight,
LevelBlueLight, // 5
LevelSmallLantern,
LevelMagicLantern,
LevelLargeLantern,
LevelLargeMagic,
LevelBrilliant, // 10
LevelCount
};
class impl {
/*
Current criteria (light types):
Equipment: { 0 .. 15 }
General: { 9 .. 13 }
Notes:
- Initial character load and item movement updates use different light source update behaviors
-- Server procedure matches the item movement behavior since most updates occur post-character load
- MainAmmo is not considered when determining light sources
- No 'Sub' or 'Aug' items are recognized as light sources
- Light types '< 9' and '> 13' are not considered for general (carried) light sources
- If values > 0x0F are valid, then assignment limiters will need to be removed
- MainCursor 'appears' to be a valid light source update slot..but, have not experienced updates during debug sessions
- All clients have a bug regarding stackable items (light and sound updates are not processed when picking up an item)
-- The timer-based update cancels out the invalid light source
*/
public:
impl() { Clear(); }
void Clear();
// Light types (classifications)
struct {
uint8 Innate; // Defined by db field `npc_types`.`light` - where appropriate
uint8 Equipment; // Item_Struct::light value of worn/carried equipment
uint8 Spell; // Set value of any light-producing spell (can be modded to mimic equip_light behavior)
uint8 Active; // Highest value of all light sources
} Type;
// Light levels (intensities) - used to determine which light source should be active
struct {
uint8 Innate;
uint8 Equipment;
uint8 Spell;
uint8 Active;
} Level;
};
static uint8 TypeToLevel(uint8 light_type);
static bool IsLevelGreater(uint8 left_type, uint8 right_type);
};
}
#endif /* LIGHT_SOURCE_H */

View File

@ -5101,7 +5101,7 @@ namespace RoF
int16 slot_id = RoFToServerSlot(eq->container_slot);
if (slot_id == 4000) {
slot_id = legacy::SLOT_TRADESKILL; // 1000
slot_id = EQEmu::Legacy::SLOT_TRADESKILL; // 1000
}
emu->container_slot = slot_id;
emu->guildtribute_slot = RoFToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented

View File

@ -5372,7 +5372,7 @@ namespace RoF2
int16 slot_id = RoF2ToServerSlot(eq->container_slot);
if (slot_id == 4000) {
slot_id = legacy::SLOT_TRADESKILL; // 1000
slot_id = EQEmu::Legacy::SLOT_TRADESKILL; // 1000
}
emu->container_slot = slot_id;
emu->guildtribute_slot = RoF2ToServerSlot(eq->guildtribute_slot); // this should only return INVALID_INDEX until implemented

272
common/say_link.cpp Normal file
View File

@ -0,0 +1,272 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 "emu_constants.h"
#include "string_util.h"
#include "item.h"
#include "item_struct.h"
#include "../zone/zonedb.h"
std::string EQEmu::SayLink::impl::GenerateLink()
{
m_Link.clear();
m_LinkBody.clear();
m_LinkText.clear();
generate_body();
generate_text();
if ((m_LinkBody.length() == EQEmu::Constants::TEXT_LINK_BODY_LENGTH) && (m_LinkText.length() > 0)) {
m_Link.push_back(0x12);
m_Link.append(m_LinkBody);
m_Link.append(m_LinkText);
m_Link.push_back(0x12);
}
if ((m_Link.length() == 0) || (m_Link.length() > 250)) {
m_Error = true;
m_Link = "<LINKER ERROR>";
Log.Out(Logs::General, Logs::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})",
m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length());
Log.Out(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str());
Log.Out(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str());
}
return m_Link;
}
void EQEmu::SayLink::impl::Reset()
{
m_LinkType = LinkBlank;
m_ItemData = nullptr;
m_LootData = nullptr;
m_ItemInst = nullptr;
m_Proxy_unknown_1 = NOT_USED;
m_ProxyItemID = NOT_USED;
m_ProxyAugment1ID = NOT_USED;
m_ProxyAugment2ID = NOT_USED;
m_ProxyAugment3ID = NOT_USED;
m_ProxyAugment4ID = NOT_USED;
m_ProxyAugment5ID = NOT_USED;
m_ProxyAugment6ID = NOT_USED;
m_ProxyIsEvolving = NOT_USED;
m_ProxyEvolveGroup = NOT_USED;
m_ProxyEvolveLevel = NOT_USED;
m_ProxyOrnamentIcon = NOT_USED;
m_ProxyHash = NOT_USED;
m_ProxyText = nullptr;
m_TaskUse = false;
m_Link.clear();
m_LinkBody.clear();
m_LinkText.clear();
m_Error = false;
}
void EQEmu::SayLink::impl::generate_body()
{
/*
Current server mask: EQClientRoF2
RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X" (56)
RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55)
SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50)
6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45)
*/
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
const Item_Struct* item_data = nullptr;
switch (m_LinkType) {
case LinkBlank:
break;
case LinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call
break;
case LinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkBodyStruct.item_id = item_data->ID;
m_LinkBodyStruct.augment_1 = m_LootData->aug_1;
m_LinkBodyStruct.augment_2 = m_LootData->aug_2;
m_LinkBodyStruct.augment_3 = m_LootData->aug_3;
m_LinkBodyStruct.augment_4 = m_LootData->aug_4;
m_LinkBodyStruct.augment_5 = m_LootData->aug_5;
m_LinkBodyStruct.augment_6 = m_LootData->aug_6;
m_LinkBodyStruct.evolve_group = item_data->LoreGroup; // see note above
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call
break;
case LinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
m_LinkBodyStruct.augment_1 = m_ItemInst->GetAugmentItemID(0);
m_LinkBodyStruct.augment_2 = m_ItemInst->GetAugmentItemID(1);
m_LinkBodyStruct.augment_3 = m_ItemInst->GetAugmentItemID(2);
m_LinkBodyStruct.augment_4 = m_ItemInst->GetAugmentItemID(3);
m_LinkBodyStruct.augment_5 = m_ItemInst->GetAugmentItemID(4);
m_LinkBodyStruct.augment_6 = m_ItemInst->GetAugmentItemID(5);
m_LinkBodyStruct.is_evolving = (m_ItemInst->IsEvolving() ? 1 : 0);
m_LinkBodyStruct.evolve_group = m_ItemInst->GetItem()->LoreGroup; // see note above
m_LinkBodyStruct.evolve_level = m_ItemInst->GetEvolveLvl();
m_LinkBodyStruct.ornament_icon = m_ItemInst->GetOrnamentationIcon();
// TODO: add hash call
break;
default:
break;
}
if (m_Proxy_unknown_1)
m_LinkBodyStruct.unknown_1 = m_Proxy_unknown_1;
if (m_ProxyItemID)
m_LinkBodyStruct.item_id = m_ProxyItemID;
if (m_ProxyAugment1ID)
m_LinkBodyStruct.augment_1 = m_ProxyAugment1ID;
if (m_ProxyAugment2ID)
m_LinkBodyStruct.augment_2 = m_ProxyAugment2ID;
if (m_ProxyAugment3ID)
m_LinkBodyStruct.augment_3 = m_ProxyAugment3ID;
if (m_ProxyAugment4ID)
m_LinkBodyStruct.augment_4 = m_ProxyAugment4ID;
if (m_ProxyAugment5ID)
m_LinkBodyStruct.augment_5 = m_ProxyAugment5ID;
if (m_ProxyAugment6ID)
m_LinkBodyStruct.augment_6 = m_ProxyAugment6ID;
if (m_ProxyIsEvolving)
m_LinkBodyStruct.is_evolving = m_ProxyIsEvolving;
if (m_ProxyEvolveGroup)
m_LinkBodyStruct.evolve_group = m_ProxyEvolveGroup;
if (m_ProxyEvolveLevel)
m_LinkBodyStruct.evolve_level = m_ProxyEvolveLevel;
if (m_ProxyOrnamentIcon)
m_LinkBodyStruct.ornament_icon = m_ProxyOrnamentIcon;
if (m_ProxyHash)
m_LinkBodyStruct.hash = m_ProxyHash;
if (m_TaskUse)
m_LinkBodyStruct.hash = 0x14505DC2;
m_LinkBody = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & m_LinkBodyStruct.unknown_1),
(0x000FFFFF & m_LinkBodyStruct.item_id),
(0x000FFFFF & m_LinkBodyStruct.augment_1),
(0x000FFFFF & m_LinkBodyStruct.augment_2),
(0x000FFFFF & m_LinkBodyStruct.augment_3),
(0x000FFFFF & m_LinkBodyStruct.augment_4),
(0x000FFFFF & m_LinkBodyStruct.augment_5),
(0x000FFFFF & m_LinkBodyStruct.augment_6),
(0x0F & m_LinkBodyStruct.is_evolving),
(0x0000FFFF & m_LinkBodyStruct.evolve_group),
(0xFF & m_LinkBodyStruct.evolve_level),
(0x000FFFFF & m_LinkBodyStruct.ornament_icon),
(0xFFFFFFFF & m_LinkBodyStruct.hash)
);
}
void EQEmu::SayLink::impl::generate_text()
{
if (m_ProxyText != nullptr) {
m_LinkText = m_ProxyText;
return;
}
const Item_Struct* item_data = nullptr;
switch (m_LinkType) {
case LinkBlank:
break;
case LinkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name;
return;
case LinkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkText = item_data->Name;
return;
case LinkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name;
return;
default:
break;
}
m_LinkText = "null";
}
bool EQEmu::SayLink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::Constants::TEXT_LINK_BODY_LENGTH)
return false;
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::SayLink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & say_link_body_struct.unknown_1),
(0x000FFFFF & say_link_body_struct.item_id),
(0x000FFFFF & say_link_body_struct.augment_1),
(0x000FFFFF & say_link_body_struct.augment_2),
(0x000FFFFF & say_link_body_struct.augment_3),
(0x000FFFFF & say_link_body_struct.augment_4),
(0x000FFFFF & say_link_body_struct.augment_5),
(0x000FFFFF & say_link_body_struct.augment_6),
(0x0F & say_link_body_struct.is_evolving),
(0x0000FFFF & say_link_body_struct.evolve_group),
(0xFF & say_link_body_struct.evolve_level),
(0x000FFFFF & say_link_body_struct.ornament_icon),
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::Constants::TEXT_LINK_BODY_LENGTH)
return false;
return true;
}

130
common/say_link.h Normal file
View File

@ -0,0 +1,130 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 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 SAY_LINK_H
#define SAY_LINK_H
#include "types.h"
#include <string>
class ItemInst;
class Item_Struct;
class ServerLootItem_Struct;
namespace EQEmu
{
class SayLink {
public:
enum Type { LinkBlank = 0, LinkItemData, LinkLootItem, LinkItemInst };
// Current server mask: EQClientRoF2
struct SayLinkBody_Struct {
uint8 unknown_1; /* %1X */
uint32 item_id; /* %05X */
uint32 augment_1; /* %05X */
uint32 augment_2; /* %05X */
uint32 augment_3; /* %05X */
uint32 augment_4; /* %05X */
uint32 augment_5; /* %05X */
uint32 augment_6; /* %05X */
uint8 is_evolving; /* %1X */
uint32 evolve_group; /* %05X */
uint8 evolve_level; /* %02X */
uint32 ornament_icon; /* %05X */
int hash; /* %08X */
};
class impl {
public:
impl() { Reset(); }
void SetLinkType(Type link_type) { m_LinkType = link_type; }
void SetItemData(const Item_Struct* item_data) { m_ItemData = item_data; }
void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_data; }
void SetItemInst(const ItemInst* item_inst) { m_ItemInst = item_inst; }
// mainly for saylinks..but, not limited to
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; }
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; }
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; }
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; }
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; }
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; }
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; }
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; }
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; }
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; }
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; }
void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; }
void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use
void SetTaskUse() { m_TaskUse = true; }
std::string GenerateLink();
bool LinkError() { return m_Error; }
std::string GetLink() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
std::string GetLinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
std::string GetLinkText() { return m_LinkText; } // contains string format: '<LinkText>'
void Reset();
private:
void generate_body();
void generate_text();
int m_LinkType;
const Item_Struct* m_ItemData;
const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst;
uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID;
uint32 m_ProxyAugment1ID;
uint32 m_ProxyAugment2ID;
uint32 m_ProxyAugment3ID;
uint32 m_ProxyAugment4ID;
uint32 m_ProxyAugment5ID;
uint32 m_ProxyAugment6ID;
uint8 m_ProxyIsEvolving;
uint32 m_ProxyEvolveGroup;
uint8 m_ProxyEvolveLevel;
uint32 m_ProxyOrnamentIcon;
int m_ProxyHash;
const char* m_ProxyText;
bool m_TaskUse;
SayLinkBody_Struct m_LinkBodyStruct;
std::string m_Link;
std::string m_LinkBody;
std::string m_LinkText;
bool m_Error;
};
static bool DegenerateLinkBody(SayLinkBody_Struct& say_Link_body_struct, const std::string& say_link_body);
static bool GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct);
};
}
#endif /* SAY_LINK_H */

View File

@ -23,7 +23,6 @@ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
#include "../common/races.h"
#include "../common/spdat.h"
#include "../common/string_util.h"
#include "../common/deity.h"
#include "aa.h"
#include "client.h"
#include "corpse.h"
@ -1434,7 +1433,7 @@ bool Mob::CanUseAlternateAdvancementRank(AA::Rank *rank) {
return false;
}
auto deity = ConvertDeityToBitDeity((DeityTypes)GetDeity());
auto deity = GetDeityBit();
if(!(ability->deities & deity)) {
return false;
}

View File

@ -93,7 +93,7 @@ Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm
timers[i] = 0;
strcpy(this->name, this->GetCleanName());
memset(&m_Light, 0, sizeof(LightProfile_Struct));
memset(&m_Light, 0, sizeof(EQEmu::LightSource::impl));
memset(&_botInspectMessage, 0, sizeof(InspectMessage_Struct));
}
@ -8469,8 +8469,8 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
uint32 saylink_id = database.LoadSaylinkID(escaped_string);
safe_delete_array(escaped_string);
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
linker.SetProxyItemID(SAYLINK_ITEM_ID);
linker.SetProxyAugment1ID(saylink_id);
linker.SetProxyText(name);

View File

@ -386,7 +386,7 @@ public:
void BotTradeAddItem(uint32 id, const ItemInst* inst, int16 charges, uint32 equipableSlots, uint16 lootSlot, std::string* errorMessage, bool addToDb = true);
void EquipBot(std::string* errorMessage);
bool CheckLoreConflict(const Item_Struct* item);
virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); }
virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment); }
// Static Class Methods
//static void DestroyBotRaidObjects(Client* client); // Can be removed after bot raids are dumped

View File

@ -7066,8 +7066,8 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
bool is2Hweapon = false;
std::string item_link;
Client::TextLink linker;
linker.SetLinkType(linker.linkItemInst);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemInst);
uint32 inventory_count = 0;
for (int i = EQEmu::Constants::EQUIPMENT_BEGIN; i <= (EQEmu::Constants::EQUIPMENT_END + 1); ++i) {

View File

@ -8416,252 +8416,6 @@ void Client::SendColoredText(uint32 color, std::string message)
}
//
// class Client::TextLink
//
std::string Client::TextLink::GenerateLink()
{
m_Link.clear();
m_LinkBody.clear();
m_LinkText.clear();
generate_body();
generate_text();
if ((m_LinkBody.length() == EQEmu::Constants::TEXT_LINK_BODY_LENGTH) && (m_LinkText.length() > 0)) {
m_Link.push_back(0x12);
m_Link.append(m_LinkBody);
m_Link.append(m_LinkText);
m_Link.push_back(0x12);
}
if ((m_Link.length() == 0) || (m_Link.length() > 250)) {
m_Error = true;
m_Link = "<LINKER ERROR>";
Log.Out(Logs::General, Logs::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})",
m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length());
Log.Out(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str());
Log.Out(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str());
}
return m_Link;
}
void Client::TextLink::Reset()
{
m_LinkType = linkBlank;
m_ItemData = nullptr;
m_LootData = nullptr;
m_ItemInst = nullptr;
m_Proxy_unknown_1 = NOT_USED;
m_ProxyItemID = NOT_USED;
m_ProxyAugment1ID = NOT_USED;
m_ProxyAugment2ID = NOT_USED;
m_ProxyAugment3ID = NOT_USED;
m_ProxyAugment4ID = NOT_USED;
m_ProxyAugment5ID = NOT_USED;
m_ProxyAugment6ID = NOT_USED;
m_ProxyIsEvolving = NOT_USED;
m_ProxyEvolveGroup = NOT_USED;
m_ProxyEvolveLevel = NOT_USED;
m_ProxyOrnamentIcon = NOT_USED;
m_ProxyHash = NOT_USED;
m_ProxyText = nullptr;
m_TaskUse = false;
m_Link.clear();
m_LinkBody.clear();
m_LinkText.clear();
m_Error = false;
}
void Client::TextLink::generate_body()
{
/*
Current server mask: EQClientRoF2
RoF2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X" (56)
RoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (55)
SoF: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X" (50)
6.2: "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%08X" (45)
*/
memset(&m_LinkBodyStruct, 0, sizeof(TextLinkBody_Struct));
const Item_Struct* item_data = nullptr;
switch (m_LinkType) {
case linkBlank:
break;
case linkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call
break;
case linkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkBodyStruct.item_id = item_data->ID;
m_LinkBodyStruct.augment_1 = m_LootData->aug_1;
m_LinkBodyStruct.augment_2 = m_LootData->aug_2;
m_LinkBodyStruct.augment_3 = m_LootData->aug_3;
m_LinkBodyStruct.augment_4 = m_LootData->aug_4;
m_LinkBodyStruct.augment_5 = m_LootData->aug_5;
m_LinkBodyStruct.augment_6 = m_LootData->aug_6;
m_LinkBodyStruct.evolve_group = item_data->LoreGroup; // see note above
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call
break;
case linkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
m_LinkBodyStruct.augment_1 = m_ItemInst->GetAugmentItemID(0);
m_LinkBodyStruct.augment_2 = m_ItemInst->GetAugmentItemID(1);
m_LinkBodyStruct.augment_3 = m_ItemInst->GetAugmentItemID(2);
m_LinkBodyStruct.augment_4 = m_ItemInst->GetAugmentItemID(3);
m_LinkBodyStruct.augment_5 = m_ItemInst->GetAugmentItemID(4);
m_LinkBodyStruct.augment_6 = m_ItemInst->GetAugmentItemID(5);
m_LinkBodyStruct.is_evolving = (m_ItemInst->IsEvolving() ? 1 : 0);
m_LinkBodyStruct.evolve_group = m_ItemInst->GetItem()->LoreGroup; // see note above
m_LinkBodyStruct.evolve_level = m_ItemInst->GetEvolveLvl();
m_LinkBodyStruct.ornament_icon = m_ItemInst->GetOrnamentationIcon();
// TODO: add hash call
break;
default:
break;
}
if (m_Proxy_unknown_1)
m_LinkBodyStruct.unknown_1 = m_Proxy_unknown_1;
if (m_ProxyItemID)
m_LinkBodyStruct.item_id = m_ProxyItemID;
if (m_ProxyAugment1ID)
m_LinkBodyStruct.augment_1 = m_ProxyAugment1ID;
if (m_ProxyAugment2ID)
m_LinkBodyStruct.augment_2 = m_ProxyAugment2ID;
if (m_ProxyAugment3ID)
m_LinkBodyStruct.augment_3 = m_ProxyAugment3ID;
if (m_ProxyAugment4ID)
m_LinkBodyStruct.augment_4 = m_ProxyAugment4ID;
if (m_ProxyAugment5ID)
m_LinkBodyStruct.augment_5 = m_ProxyAugment5ID;
if (m_ProxyAugment6ID)
m_LinkBodyStruct.augment_6 = m_ProxyAugment6ID;
if (m_ProxyIsEvolving)
m_LinkBodyStruct.is_evolving = m_ProxyIsEvolving;
if (m_ProxyEvolveGroup)
m_LinkBodyStruct.evolve_group = m_ProxyEvolveGroup;
if (m_ProxyEvolveLevel)
m_LinkBodyStruct.evolve_level = m_ProxyEvolveLevel;
if (m_ProxyOrnamentIcon)
m_LinkBodyStruct.ornament_icon = m_ProxyOrnamentIcon;
if (m_ProxyHash)
m_LinkBodyStruct.hash = m_ProxyHash;
if (m_TaskUse)
m_LinkBodyStruct.hash = 0x14505DC2;
m_LinkBody = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & m_LinkBodyStruct.unknown_1),
(0x000FFFFF & m_LinkBodyStruct.item_id),
(0x000FFFFF & m_LinkBodyStruct.augment_1),
(0x000FFFFF & m_LinkBodyStruct.augment_2),
(0x000FFFFF & m_LinkBodyStruct.augment_3),
(0x000FFFFF & m_LinkBodyStruct.augment_4),
(0x000FFFFF & m_LinkBodyStruct.augment_5),
(0x000FFFFF & m_LinkBodyStruct.augment_6),
(0x0F & m_LinkBodyStruct.is_evolving),
(0x0000FFFF & m_LinkBodyStruct.evolve_group),
(0xFF & m_LinkBodyStruct.evolve_level),
(0x000FFFFF & m_LinkBodyStruct.ornament_icon),
(0xFFFFFFFF & m_LinkBodyStruct.hash)
);
}
void Client::TextLink::generate_text()
{
if (m_ProxyText != nullptr) {
m_LinkText = m_ProxyText;
return;
}
const Item_Struct* item_data = nullptr;
switch (m_LinkType) {
case linkBlank:
break;
case linkItemData:
if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name;
return;
case linkLootItem:
if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; }
m_LinkText = item_data->Name;
return;
case linkItemInst:
if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name;
return;
default:
break;
}
m_LinkText = "null";
}
bool Client::TextLink::DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruct, const std::string& textLinkBody)
{
memset(&textLinkBodyStruct, 0, sizeof(TextLinkBody_Struct));
if (textLinkBody.length() != EQEmu::Constants::TEXT_LINK_BODY_LENGTH) { return false; }
textLinkBodyStruct.unknown_1 = (uint8)strtol(textLinkBody.substr(0, 1).c_str(), nullptr, 16);
textLinkBodyStruct.item_id = (uint32)strtol(textLinkBody.substr(1, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_1 = (uint32)strtol(textLinkBody.substr(6, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_2 = (uint32)strtol(textLinkBody.substr(11, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_3 = (uint32)strtol(textLinkBody.substr(16, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_4 = (uint32)strtol(textLinkBody.substr(21, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_5 = (uint32)strtol(textLinkBody.substr(26, 5).c_str(), nullptr, 16);
textLinkBodyStruct.augment_6 = (uint32)strtol(textLinkBody.substr(31, 5).c_str(), nullptr, 16);
textLinkBodyStruct.is_evolving = (uint8)strtol(textLinkBody.substr(36, 1).c_str(), nullptr, 16);
textLinkBodyStruct.evolve_group = (uint32)strtol(textLinkBody.substr(37, 4).c_str(), nullptr, 16);
textLinkBodyStruct.evolve_level = (uint8)strtol(textLinkBody.substr(41, 2).c_str(), nullptr, 16);
textLinkBodyStruct.ornament_icon = (uint32)strtol(textLinkBody.substr(43, 5).c_str(), nullptr, 16);
textLinkBodyStruct.hash = (int)strtol(textLinkBody.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct)
{
textLinkBody = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & textLinkBodyStruct.unknown_1),
(0x000FFFFF & textLinkBodyStruct.item_id),
(0x000FFFFF & textLinkBodyStruct.augment_1),
(0x000FFFFF & textLinkBodyStruct.augment_2),
(0x000FFFFF & textLinkBodyStruct.augment_3),
(0x000FFFFF & textLinkBodyStruct.augment_4),
(0x000FFFFF & textLinkBodyStruct.augment_5),
(0x000FFFFF & textLinkBodyStruct.augment_6),
(0x0F & textLinkBodyStruct.is_evolving),
(0x0000FFFF & textLinkBodyStruct.evolve_group),
(0xFF & textLinkBodyStruct.evolve_level),
(0x000FFFFF & textLinkBodyStruct.ornament_icon),
(0xFFFFFFFF & textLinkBodyStruct.hash)
);
if (textLinkBody.length() != EQEmu::Constants::TEXT_LINK_BODY_LENGTH) { return false; }
return true;
}
void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Sound, sizeof(QuestReward_Struct));

View File

@ -736,7 +736,7 @@ public:
#endif
uint32 GetEquipment(uint8 material_slot) const; // returns item id
uint32 GetEquipmentColor(uint8 material_slot) const;
virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment); }
virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = m_inv.FindBrightestLightType(); m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment); }
inline bool AutoSplitEnabled() { return m_pp.autosplit != 0; }
@ -818,81 +818,6 @@ public:
void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id);
//
// class Client::TextLink
//
class TextLink {
public:
enum LinkType { linkBlank = 0, linkItemData, linkLootItem, linkItemInst };
TextLink() { Reset(); }
void SetLinkType(LinkType linkType) { m_LinkType = linkType; }
void SetItemData(const Item_Struct* itemData) { m_ItemData = itemData; }
void SetLootData(const ServerLootItem_Struct* lootData) { m_LootData = lootData; }
void SetItemInst(const ItemInst* itemInst) { m_ItemInst = itemInst; }
// mainly for saylinks..but, not limited to
void SetProxyUnknown1(uint8 proxyUnknown1) { m_Proxy_unknown_1 = proxyUnknown1; }
void SetProxyItemID(uint32 proxyItemID) { m_ProxyItemID = proxyItemID; }
void SetProxyAugment1ID(uint32 proxyAugmentID) { m_ProxyAugment1ID = proxyAugmentID; }
void SetProxyAugment2ID(uint32 proxyAugmentID) { m_ProxyAugment2ID = proxyAugmentID; }
void SetProxyAugment3ID(uint32 proxyAugmentID) { m_ProxyAugment3ID = proxyAugmentID; }
void SetProxyAugment4ID(uint32 proxyAugmentID) { m_ProxyAugment4ID = proxyAugmentID; }
void SetProxyAugment5ID(uint32 proxyAugmentID) { m_ProxyAugment5ID = proxyAugmentID; }
void SetProxyAugment6ID(uint32 proxyAugmentID) { m_ProxyAugment6ID = proxyAugmentID; }
void SetProxyIsEvolving(uint8 proxyIsEvolving) { m_ProxyIsEvolving = proxyIsEvolving; }
void SetProxyEvolveGroup(uint32 proxyEvolveGroup) { m_ProxyEvolveGroup = proxyEvolveGroup; }
void SetProxyEvolveLevel(uint8 proxyEvolveLevel) { m_ProxyEvolveLevel = proxyEvolveLevel; }
void SetProxyOrnamentIcon(uint32 proxyOrnamentIcon) { m_ProxyOrnamentIcon = proxyOrnamentIcon; }
void SetProxyHash(int proxyHash) { m_ProxyHash = proxyHash; }
void SetProxyText(const char* proxyText) { m_ProxyText = proxyText; } // overrides standard text use
void SetTaskUse() { m_TaskUse = true; }
std::string GenerateLink();
bool LinkError() { return m_Error; }
std::string GetLink() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
std::string GetLinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
std::string GetLinkText() { return m_LinkText; } // contains string format: '<LinkText>'
void Reset();
static bool DegenerateLinkBody(TextLinkBody_Struct& textLinkBodyStruct, const std::string& textLinkBody);
static bool GenerateLinkBody(std::string& textLinkBody, const TextLinkBody_Struct& textLinkBodyStruct);
private:
void generate_body();
void generate_text();
int m_LinkType;
const Item_Struct* m_ItemData;
const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst;
uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID;
uint32 m_ProxyAugment1ID;
uint32 m_ProxyAugment2ID;
uint32 m_ProxyAugment3ID;
uint32 m_ProxyAugment4ID;
uint32 m_ProxyAugment5ID;
uint32 m_ProxyAugment6ID;
uint8 m_ProxyIsEvolving;
uint32 m_ProxyEvolveGroup;
uint8 m_ProxyEvolveLevel;
uint32 m_ProxyOrnamentIcon;
int m_ProxyHash;
const char* m_ProxyText;
bool m_TaskUse;
TextLinkBody_Struct m_LinkBodyStruct;
std::string m_Link;
std::string m_LinkBody;
std::string m_LinkText;
bool m_Error;
};
int GetItemLinkHash(const ItemInst* inst); // move to Item_Struct..or make use of the pre-calculated database field
void SendItemLink(const ItemInst* inst, bool sendtoall=false);

View File

@ -2545,8 +2545,8 @@ void command_peekinv(Client *c, const Seperator *sep)
const ItemInst* inst_sub = nullptr;
const Item_Struct* item_data = nullptr;
std::string item_link;
Client::TextLink linker;
linker.SetLinkType(linker.linkItemInst);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemInst);
c->Message(0, "Displaying inventory for %s...", targetClient->GetName());
@ -4341,8 +4341,8 @@ void command_iteminfo(Client *c, const Seperator *sep)
c->Message(13, "Error: This item has no data reference");
}
Client::TextLink linker;
linker.SetLinkType(linker.linkItemInst);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemInst);
linker.SetItemInst(inst);
auto item_link = linker.GenerateLink();
@ -5492,8 +5492,8 @@ void command_summonitem(Client *c, const Seperator *sep)
size_t link_open = cmd_msg.find('\x12');
size_t link_close = cmd_msg.find_last_of('\x12');
if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::Constants::TEXT_LINK_BODY_LENGTH) {
TextLinkBody_Struct link_body;
Client::TextLink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::Constants::TEXT_LINK_BODY_LENGTH));
EQEmu::SayLink::SayLinkBody_Struct link_body;
EQEmu::SayLink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::Constants::TEXT_LINK_BODY_LENGTH));
itemid = link_body.item_id;
}
else if (!sep->IsNumber(1)) {
@ -5603,8 +5603,8 @@ void command_itemsearch(Client *c, const Seperator *sep)
const Item_Struct* item = nullptr;
std::string item_link;
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
if (Seperator::IsNumber(search_criteria)) {
item = database.GetItem(atoi(search_criteria));

View File

@ -1225,8 +1225,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
}
/* Send message with item link to groups and such */
Client::TextLink linker;
linker.SetLinkType(linker.linkItemInst);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemInst);
linker.SetItemInst(inst);
auto item_link = linker.GenerateLink();
@ -1442,7 +1442,7 @@ void Corpse::UpdateEquipmentLight()
auto item = database.GetItem((*iter)->item_id);
if (item == nullptr) { continue; }
if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment))
if (EQEmu::LightSource::IsLevelGreater(item->Light, m_Light.Type.Equipment))
m_Light.Type.Equipment = item->Light;
}
@ -1456,14 +1456,14 @@ void Corpse::UpdateEquipmentLight()
if (item->ItemClass != ItemClassCommon) { continue; }
if (item->Light < 9 || item->Light > 13) { continue; }
if (m_Light.TypeToLevel(item->Light))
if (EQEmu::LightSource::TypeToLevel(item->Light))
general_light_type = item->Light;
}
if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment))
if (EQEmu::LightSource::IsLevelGreater(general_light_type, m_Light.Type.Equipment))
m_Light.Type.Equipment = general_light_type;
m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment);
m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment);
}
void Corpse::AddLooter(Mob* who) {

View File

@ -1799,8 +1799,8 @@ luabind::scope lua_register_slot() {
luabind::value("PersonalEnd", static_cast<int>(EQEmu::Constants::GENERAL_END)), // deprecated
luabind::value("GeneralEnd", static_cast<int>(EQEmu::Constants::GENERAL_END)),
luabind::value("CursorEnd", 0xFFFE), // deprecated
luabind::value("Tradeskill", static_cast<int>(legacy::SLOT_TRADESKILL)), // deprecated
luabind::value("Augment", static_cast<int>(legacy::SLOT_AUGMENT)), // deprecated
luabind::value("Tradeskill", static_cast<int>(EQEmu::Legacy::SLOT_TRADESKILL)), // deprecated
luabind::value("Augment", static_cast<int>(EQEmu::Legacy::SLOT_AUGMENT)), // deprecated
luabind::value("Invalid", INVALID_INDEX)
];
}

View File

@ -5050,9 +5050,9 @@ void Merc::UpdateEquipmentLight()
auto item = database.GetItem(equipment[index]);
if (item == nullptr) { continue; }
if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) {
if (EQEmu::LightSource::IsLevelGreater(item->Light, m_Light.Type.Equipment)) {
m_Light.Type.Equipment = item->Light;
m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment);
m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment);
}
}
@ -5064,14 +5064,14 @@ void Merc::UpdateEquipmentLight()
if (item->ItemClass != ItemClassCommon) { continue; }
if (item->Light < 9 || item->Light > 13) { continue; }
if (m_Light.TypeToLevel(item->Light))
if (EQEmu::LightSource::TypeToLevel(item->Light))
general_light_type = item->Light;
}
if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment))
if (EQEmu::LightSource::IsLevelGreater(general_light_type, m_Light.Type.Equipment))
m_Light.Type.Equipment = general_light_type;
m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment);
m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment);
}
void Merc::AddItem(uint8 slot, uint32 item_id) {

View File

@ -179,7 +179,7 @@ Mob::Mob(const char* in_name,
runspeed = 1.25f;
m_Light.Type.Innate = in_light;
m_Light.Level.Innate = m_Light.TypeToLevel(m_Light.Type.Innate);
m_Light.Level.Innate = EQEmu::LightSource::TypeToLevel(m_Light.Type.Innate);
m_Light.Level.Equipment = m_Light.Type.Equipment = 0;
m_Light.Level.Spell = m_Light.Type.Spell = 0;
m_Light.Type.Active = m_Light.Type.Innate;
@ -2232,11 +2232,11 @@ bool Mob::UpdateActiveLight()
m_Light.Type.Active = 0;
m_Light.Level.Active = 0;
if (m_Light.IsLevelGreater((m_Light.Type.Innate & 0x0F), m_Light.Type.Active)) { m_Light.Type.Active = m_Light.Type.Innate; }
if (EQEmu::LightSource::IsLevelGreater((m_Light.Type.Innate & 0x0F), m_Light.Type.Active)) { m_Light.Type.Active = m_Light.Type.Innate; }
if (m_Light.Level.Equipment > m_Light.Level.Active) { m_Light.Type.Active = m_Light.Type.Equipment; } // limiter in property handler
if (m_Light.Level.Spell > m_Light.Level.Active) { m_Light.Type.Active = m_Light.Type.Spell; } // limiter in property handler
m_Light.Level.Active = m_Light.TypeToLevel(m_Light.Type.Active);
m_Light.Level.Active = EQEmu::LightSource::TypeToLevel(m_Light.Type.Active);
return (m_Light.Level.Active != old_light_level);
}

View File

@ -364,6 +364,7 @@ public:
virtual inline uint16 GetBaseRace() const { return base_race; }
virtual inline uint8 GetBaseGender() const { return base_gender; }
virtual inline uint16 GetDeity() const { return deity; }
virtual inline EQEmu::Deity::TypeBits GetDeityBit() { return EQEmu::Deity::ConvertDeityToDeityBit((EQEmu::Deity::Types)deity); }
inline uint16 GetRace() const { return race; }
inline uint8 GetGender() const { return gender; }
inline uint8 GetTexture() const { return texture; }
@ -707,12 +708,12 @@ public:
inline uint8 GetSpellLightType() { return m_Light.Type.Spell; }
virtual void UpdateEquipmentLight() { m_Light.Type.Equipment = 0; m_Light.Level.Equipment = 0; }
inline void SetSpellLightType(uint8 lightType) { m_Light.Type.Spell = (lightType & 0x0F); m_Light.Level.Spell = m_Light.TypeToLevel(m_Light.Type.Spell); }
inline void SetSpellLightType(uint8 light_type) { m_Light.Type.Spell = (light_type & 0x0F); m_Light.Level.Spell = EQEmu::LightSource::TypeToLevel(m_Light.Type.Spell); }
inline uint8 GetActiveLightType() { return m_Light.Type.Active; }
bool UpdateActiveLight(); // returns true if change, false if no change
LightProfile_Struct* GetLightProfile() { return &m_Light; }
EQEmu::LightSource::impl* GetLightProfile() { return &m_Light; }
Mob* GetPet();
void SetPet(Mob* newpet);
@ -1184,7 +1185,7 @@ protected:
glm::vec4 m_Delta;
LightProfile_Struct m_Light;
EQEmu::LightSource::impl m_Light;
float fixedZ;
EmuAppearance _appearance;

View File

@ -529,8 +529,8 @@ void NPC::QueryLoot(Client* to)
continue;
}
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
linker.SetItemData(item);
auto item_link = linker.GenerateLink();
@ -754,9 +754,9 @@ void NPC::UpdateEquipmentLight()
auto item = database.GetItem(equipment[index]);
if (item == nullptr) { continue; }
if (m_Light.IsLevelGreater(item->Light, m_Light.Type.Equipment)) {
if (EQEmu::LightSource::IsLevelGreater(item->Light, m_Light.Type.Equipment)) {
m_Light.Type.Equipment = item->Light;
m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment);
m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment);
}
}
@ -768,14 +768,14 @@ void NPC::UpdateEquipmentLight()
if (item->ItemClass != ItemClassCommon) { continue; }
if (item->Light < 9 || item->Light > 13) { continue; }
if (m_Light.TypeToLevel(item->Light))
if (EQEmu::LightSource::TypeToLevel(item->Light))
general_light_type = item->Light;
}
if (m_Light.IsLevelGreater(general_light_type, m_Light.Type.Equipment))
if (EQEmu::LightSource::IsLevelGreater(general_light_type, m_Light.Type.Equipment))
m_Light.Type.Equipment = general_light_type;
m_Light.Level.Equipment = m_Light.TypeToLevel(m_Light.Type.Equipment);
m_Light.Level.Equipment = EQEmu::LightSource::TypeToLevel(m_Light.Type.Equipment);
}
void NPC::Depop(bool StartSpawnTimer) {

View File

@ -1307,8 +1307,8 @@ void QuestManager::itemlink(int item_id) {
if (item == nullptr)
return;
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
linker.SetItemData(item);
auto item_link = linker.GenerateLink();
@ -2535,8 +2535,8 @@ const char* QuestManager::varlink(char* perltext, int item_id) {
if (!item)
return "INVALID ITEM ID IN VARLINK";
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
linker.SetItemData(item);
auto item_link = linker.GenerateLink();
@ -2761,7 +2761,7 @@ const char* QuestManager::saylink(char* Phrase, bool silent, const char* LinkNam
safe_delete_array(escaped_string);
//Create the say link as an item link hash
Client::TextLink linker;
EQEmu::SayLink::impl linker;
linker.SetProxyItemID(SAYLINK_ITEM_ID);
if (silent)
linker.SetProxyAugment2ID(sayid);

View File

@ -2779,8 +2779,8 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN
if(ItemID) {
const Item_Struct* reward_item = database.GetItem(ItemID);
Client::TextLink linker;
linker.SetLinkType(linker.linkItemData);
EQEmu::SayLink::impl linker;
linker.SetLinkType(EQEmu::SayLink::LinkItemData);
linker.SetItemData(reward_item);
linker.SetTaskUse();
if (strlen(Tasks[TaskID]->Reward) != 0)

View File

@ -264,7 +264,7 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
uint32 some_id = 0;
bool worldcontainer=false;
if (in_combine->container_slot == legacy::SLOT_TRADESKILL) {
if (in_combine->container_slot == EQEmu::Legacy::SLOT_TRADESKILL) {
if(!worldo) {
user->Message(13, "Error: Server is not aware of the tradeskill container you are attempting to use");
return;