Merge fix

This commit is contained in:
KimLS
2016-11-19 15:54:31 -08:00
144 changed files with 8239 additions and 6580 deletions
+8 -18
View File
@@ -33,9 +33,13 @@ SET(common_sources
faction.cpp
guild_base.cpp
guilds.cpp
inventory_profile.cpp
inventory_slot.cpp
ipc_mutex.cpp
item.cpp
item_base.cpp
item_data.cpp
item_instance.cpp
json_config.cpp
light_source.cpp
md5.cpp
@@ -163,10 +167,12 @@ SET(common_headers
global_define.h
guild_base.h
guilds.h
inventory_profile.h
inventory_slot.h
ipc_mutex.h
item.h
item_base.h
item_data.h
item_fieldlist.h
item_instance.h
json_config.h
languages.h
light_source.h
@@ -239,37 +245,29 @@ SET(common_headers
net/tcp_server.h
patches/patches.h
patches/sod.h
# patches/sod_itemfields.h
patches/sod_limits.h
patches/sod_ops.h
patches/sod_structs.h
patches/sof.h
# patches/sof_itemfields.h
patches/sof_limits.h
# patches/sof_opcode_list.h
patches/sof_ops.h
patches/sof_structs.h
patches/ss_declare.h
patches/ss_define.h
patches/ss_register.h
patches/rof.h
# patches/rof_itemfields.h
patches/rof_limits.h
patches/rof_ops.h
patches/rof_structs.h
patches/rof2.h
# patches/rof2_itemfields.h
patches/rof2_limits.h
patches/rof2_ops.h
patches/rof2_structs.h
patches/titanium.h
# patches/titanium_itemfields_a.h
# patches/titanium_itemfields_b.h
patches/titanium_limits.h
patches/titanium_ops.h
patches/titanium_structs.h
patches/uf.h
# patches/uf_itemfields.h
patches/uf_limits.h
patches/uf_ops.h
patches/uf_structs.h
@@ -337,37 +335,29 @@ SOURCE_GROUP(Net FILES
SOURCE_GROUP(Patches FILES
patches/patches.h
patches/sod.h
# patches/sod_itemfields.h
patches/sod_limits.h
patches/sod_ops.h
patches/sod_structs.h
patches/sof.h
# patches/sof_itemfields.h
patches/sof_limits.h
# patches/sof_opcode_list.h
patches/sof_ops.h
patches/sof_structs.h
patches/ss_declare.h
patches/ss_define.h
patches/ss_register.h
patches/rof.h
# patches/rof_itemfields.h
patches/rof_limits.h
patches/rof_ops.h
patches/rof_structs.h
patches/rof2.h
# patches/rof2_itemfields.h
patches/rof2_limits.h
patches/rof2_ops.h
patches/rof2_structs.h
patches/titanium.h
# patches/titanium_itemfields_a.h
# patches/titanium_itemfields_b.h
patches/titanium_limits.h
patches/titanium_ops.h
patches/titanium_structs.h
patches/uf.h
# patches/uf_itemfields.h
patches/uf_limits.h
patches/uf_ops.h
patches/uf_structs.h
+11 -4
View File
@@ -638,6 +638,13 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
); results = QueryDatabase(query);
/* HoTT Ability */
if(RuleB(Character, GrantHoTTOnCreate))
{
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, rank) VALUES (%u, %i, %i)", character_id, 14, 1);
results = QueryDatabase(query);
}
/* Save Skills */
int firstquery = 0;
for (int i = 0; i < MAX_PP_SKILL; i++){
@@ -672,7 +679,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
}
/* This only for new Character creation storing */
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) {
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
uint32 charid = 0;
char zone[50];
float x, y, z;
@@ -701,7 +708,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
/* Insert starting inventory... */
std::string invquery;
for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) {
const ItemInst* newinv = inv->GetItem(i);
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
if (newinv) {
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
@@ -709,7 +716,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
auto results = QueryDatabase(invquery);
}
if (i == EQEmu::legacy::SlotCursor) {
if (i == EQEmu::inventory::slotCursor) {
i = EQEmu::legacy::GENERAL_BAGS_BEGIN;
continue;
}
@@ -2157,4 +2164,4 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
}
return 0;
}
}
+6 -2
View File
@@ -37,10 +37,14 @@
//atoi is not uint32 or uint32 safe!!!!
#define atoul(str) strtoul(str, nullptr, 10)
class Inventory;
class MySQLRequestResult;
class Client;
namespace EQEmu
{
class InventoryProfile;
}
struct EventLogDetails_Struct {
uint32 id;
char accountname[64];
@@ -109,7 +113,7 @@ public:
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
bool UpdateName(const char* oldname, const char* newname);
/* General Information Queries */
+4 -4
View File
@@ -186,7 +186,7 @@ namespace Convert {
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[EQEmu::textures::TextureCount];
/*510*/ uint32 Items[EQEmu::textures::materialCount];
/*546*/ char Name[64];
/*610*/
};
@@ -227,9 +227,9 @@ namespace Convert {
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ uint32 item_material[EQEmu::textures::TextureCount]; // Item texture/material of worn/held items
/*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::TextureCount];
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount];
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
/*2348*/ float unknown2384; //seen ~128, ~47
/*2352*/ char servername[32]; // length probably not right
@@ -1403,7 +1403,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Material Color Convert */
first_entry = 0; rquery = "";
for (i = 0; i < EQEmu::textures::TextureCount; i++){
for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){
if (pp->item_tint[i].color > 0){
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
+88
View File
@@ -35,6 +35,79 @@ namespace EQEmu
//using namespace RoF2::invbag;
//using namespace RoF2::invaug;
enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary
enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary
enum PossessionsSlots : int16 { // temporary
slotCharm = 0,
slotEar1,
slotHead,
slotFace,
slotEar2,
slotNeck, // 5
slotShoulders,
slotArms,
slotBack,
slotWrist1,
slotWrist2, // 10
slotRange,
slotHands,
slotPrimary,
slotSecondary,
slotFinger1, // 15
slotFinger2,
slotChest,
slotLegs,
slotFeet,
slotWaist, // 20
slotPowerSource = 9999,
slotAmmo = 21,
slotGeneral1,
slotGeneral2,
slotGeneral3,
slotGeneral4, // 25
slotGeneral5,
slotGeneral6,
slotGeneral7,
slotGeneral8,
slotCursor, // 30
slotCount
};
enum InventoryTypes : int16 { // temporary
typePossessions = 0,
typeBank,
typeSharedBank,
typeTrade,
typeWorld,
typeLimbo, // 5
typeTribute,
typeTrophyTribute,
typeGuildTribute,
typeMerchant,
typeDeleted, // 10
typeCorpse,
typeBazaar,
typeInspect,
typeRealEstate,
typeViewMODPC, // 15
typeViewMODBank,
typeViewMODSharedBank,
typeViewMODLimbo,
typeAltStorage,
typeArchived, // 20
typeMail,
typeGuildTrophyTribute,
typeKrono,
typeOther,
typeCount
};
static int16 SlotCount(int16 type_index) { return 0; } // temporary
const int16 ContainerCount = 10; // temporary
const int16 SocketCount = 6; // temporary
} /*inventory*/
namespace constants {
@@ -43,7 +116,16 @@ namespace EQEmu
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
const int LongBuffs = RoF2::constants::LongBuffs;
const int ShortBuffs = RoF2::constants::ShortBuffs;
const int DiscBuffs = RoF2::constants::DiscBuffs;
const int TotalBuffs = RoF2::constants::TotalBuffs;
const int NPCBuffs = RoF2::constants::NPCBuffs;
const int PetBuffs = RoF2::constants::PetBuffs;
const int MercBuffs = RoF2::constants::MercBuffs;
} /*constants*/
enum class CastingSlot : uint32 {
Gem1 = 0,
Gem2 = 1,
@@ -68,3 +150,9 @@ namespace EQEmu
} /*EQEmu*/
#endif /*COMMON_EMU_CONSTANTS_H*/
/* hack list to prevent circular references
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
*/
+15 -89
View File
@@ -61,8 +61,6 @@ namespace EQEmu
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,
@@ -96,75 +94,8 @@ namespace EQEmu
SLOT_WORLD_END = 4009
};
enum InventoryTypes : int16 {
TypePossessions = 0,
TypeBank,
TypeSharedBank,
TypeTrade,
TypeWorld,
TypeLimbo, // 5
TypeTribute,
TypeTrophyTribute,
TypeGuildTribute,
TypeMerchant,
TypeDeleted, // 10
TypeCorpse,
TypeBazaar,
TypeInspect,
TypeRealEstate,
TypeViewMODPC, // 15
TypeViewMODBank,
TypeViewMODSharedBank,
TypeViewMODLimbo,
TypeAltStorage,
TypeArchived, // 20
TypeMail,
TypeGuildTrophyTribute,
TypeKrono,
TypeOther,
TypeCount
};
enum PossessionsSlots : int16 {
SlotCharm = 0,
SlotEar1,
SlotHead,
SlotFace,
SlotEar2,
SlotNeck, // 5
SlotShoulders,
SlotArms,
SlotBack,
SlotWrist1,
SlotWrist2, // 10
SlotRange,
SlotHands,
SlotPrimary,
SlotSecondary,
SlotFinger1, // 15
SlotFinger2,
SlotChest,
SlotLegs,
SlotFeet,
SlotWaist, // 20
SlotPowerSource = 9999, // temp
SlotAmmo = 21, // temp
SlotGeneral1,
SlotGeneral2,
SlotGeneral3,
SlotGeneral4, // 25
SlotGeneral5,
SlotGeneral6,
SlotGeneral7,
SlotGeneral8,
//SlotGeneral9,
//SlotGeneral10,
SlotCursor, // 30
SlotCount
};
// 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_POSSESSIONS_SIZE = 31;
static const uint16 TYPE_BANK_SIZE = 24;
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
static const uint16 TYPE_TRADE_SIZE = 8;
@@ -175,14 +106,14 @@ namespace EQEmu
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_CORPSE_SIZE = 31; // 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 = 0;//NOT_USED;
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;//NOT_USED;
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;//NOT_USED;
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;//NOT_USED;
static const uint16 TYPE_VIEW_MOD_PC_SIZE = 0;
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
static const uint16 TYPE_ARCHIVED_SIZE = 0;
static const uint16 TYPE_MAIL_SIZE = 0;
@@ -192,12 +123,12 @@ namespace EQEmu
// 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 int16 EQUIPMENT_BEGIN = 0;
static const int16 EQUIPMENT_END = 21;
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 int16 GENERAL_BEGIN = 22;
static const int16 GENERAL_END = 29;
static const uint16 GENERAL_SIZE = 8;
static const int16 GENERAL_BAGS_BEGIN = 251;
static const int16 GENERAL_BAGS_END_OFFSET = 79;
@@ -235,22 +166,17 @@ namespace EQEmu
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
// items
// common and container sizes will not increase until the new 'location' struct is implemented
static const uint16 ITEM_COMMON_SIZE = 6;//RoF::consts::ITEM_COMMON_SIZE;
static const uint16 ITEM_CONTAINER_SIZE = 10;//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 = 20;//RoF2::consts::BANDOLIERS_SIZE; // number of bandolier instances
static const size_t BANDOLIER_ITEM_COUNT = 4;//RoF2::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance
static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances
static const size_t BANDOLIER_ITEM_COUNT = 4; // 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 = 5;//RoF2::consts::POTION_BELT_ITEM_COUNT;
static const size_t POTION_BELT_ITEM_COUNT = 5;
static const size_t TEXT_LINK_BODY_LENGTH = 56;//RoF2::consts::TEXT_LINK_BODY_LENGTH;
static const size_t TEXT_LINK_BODY_LENGTH = 56;
}
}
#endif /* COMMON_EMU_LEGACY_H */
+113 -113
View File
@@ -127,244 +127,244 @@ uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_ver
}
}
bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version)
bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidPCInventoryVersion(InventoryVersion inventory_version)
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidNonPCInventoryVersion(InventoryVersion inventory_version)
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return false;
return true;
}
bool EQEmu::versions::IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version)
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
{
if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion)
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return false;
return true;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)
return InventoryVersion::Unknown;
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
return MobVersion::Unknown;
return inventory_version;
return mob_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidatePCInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version)
{
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastPCInventoryVersion)
return InventoryVersion::Unknown;
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
return MobVersion::Unknown;
return inventory_version;
return mob_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateNonPCInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version)
{
if (inventory_version <= LastPCInventoryVersion || inventory_version > LastNonPCInventoryVersion)
return InventoryVersion::Unknown;
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
return MobVersion::Unknown;
return inventory_version;
return mob_version;
}
EQEmu::versions::InventoryVersion EQEmu::versions::ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
{
if (inventory_version <= LastNonPCInventoryVersion || inventory_version > LastOfflinePCInventoryVersion)
return InventoryVersion::Unknown;
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
return MobVersion::Unknown;
return inventory_version;
return mob_version;
}
const char* EQEmu::versions::InventoryVersionName(InventoryVersion inventory_version)
const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
switch (mob_version) {
case MobVersion::Unknown:
return "Unknown Version";
case InventoryVersion::Client62:
case MobVersion::Client62:
return "Client 6.2";
case InventoryVersion::Titanium:
case MobVersion::Titanium:
return "Titanium";
case InventoryVersion::SoF:
case MobVersion::SoF:
return "SoF";
case InventoryVersion::SoD:
case MobVersion::SoD:
return "SoD";
case InventoryVersion::UF:
case MobVersion::UF:
return "UF";
case InventoryVersion::RoF:
case MobVersion::RoF:
return "RoF";
case InventoryVersion::RoF2:
case MobVersion::RoF2:
return "RoF2";
case InventoryVersion::NPC:
case MobVersion::NPC:
return "NPC";
case InventoryVersion::NPCMerchant:
case MobVersion::NPCMerchant:
return "NPC Merchant";
case InventoryVersion::Merc:
case MobVersion::Merc:
return "Merc";
case InventoryVersion::Bot:
case MobVersion::Bot:
return "Bot";
case InventoryVersion::ClientPet:
case MobVersion::ClientPet:
return "Client Pet";
case InventoryVersion::NPCPet:
case MobVersion::NPCPet:
return "NPC Pet";
case InventoryVersion::MercPet:
case MobVersion::MercPet:
return "Merc Pet";
case InventoryVersion::BotPet:
case MobVersion::BotPet:
return "Bot Pet";
case InventoryVersion::OfflineTitanium:
case MobVersion::OfflineTitanium:
return "Offline Titanium";
case InventoryVersion::OfflineSoF:
case MobVersion::OfflineSoF:
return "Offline SoF";
case InventoryVersion::OfflineSoD:
case MobVersion::OfflineSoD:
return "Offline SoD";
case InventoryVersion::OfflineUF:
case MobVersion::OfflineUF:
return "Offline UF";
case InventoryVersion::OfflineRoF:
case MobVersion::OfflineRoF:
return "Offline RoF";
case InventoryVersion::OfflineRoF2:
case MobVersion::OfflineRoF2:
return "Offline RoF2";
default:
return "Invalid Version";
};
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version)
EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
{
switch (inventory_version) {
case InventoryVersion::Unknown:
case InventoryVersion::Client62:
switch (mob_version) {
case MobVersion::Unknown:
case MobVersion::Client62:
return ClientVersion::Unknown;
case InventoryVersion::Titanium:
case MobVersion::Titanium:
return ClientVersion::Titanium;
case InventoryVersion::SoF:
case MobVersion::SoF:
return ClientVersion::SoF;
case InventoryVersion::SoD:
case MobVersion::SoD:
return ClientVersion::SoD;
case InventoryVersion::UF:
case MobVersion::UF:
return ClientVersion::UF;
case InventoryVersion::RoF:
case MobVersion::RoF:
return ClientVersion::RoF;
case InventoryVersion::RoF2:
case MobVersion::RoF2:
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToInventoryVersion(ClientVersion client_version)
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Unknown:
case ClientVersion::Client62:
return InventoryVersion::Unknown;
return MobVersion::Unknown;
case ClientVersion::Titanium:
return InventoryVersion::Titanium;
return MobVersion::Titanium;
case ClientVersion::SoF:
return InventoryVersion::SoF;
return MobVersion::SoF;
case ClientVersion::SoD:
return InventoryVersion::SoD;
return MobVersion::SoD;
case ClientVersion::UF:
return InventoryVersion::UF;
return MobVersion::UF;
case ClientVersion::RoF:
return InventoryVersion::RoF;
return MobVersion::RoF;
case ClientVersion::RoF2:
return InventoryVersion::RoF2;
return MobVersion::RoF2;
default:
return InventoryVersion::Unknown;
return MobVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
{
switch (inventory_version) {
case InventoryVersion::Titanium:
return InventoryVersion::OfflineTitanium;
case InventoryVersion::SoF:
return InventoryVersion::OfflineSoF;
case InventoryVersion::SoD:
return InventoryVersion::OfflineSoD;
case InventoryVersion::UF:
return InventoryVersion::OfflineUF;
case InventoryVersion::RoF:
return InventoryVersion::OfflineRoF;
case InventoryVersion::RoF2:
return InventoryVersion::OfflineRoF2;
switch (mob_version) {
case MobVersion::Titanium:
return MobVersion::OfflineTitanium;
case MobVersion::SoF:
return MobVersion::OfflineSoF;
case MobVersion::SoD:
return MobVersion::OfflineSoD;
case MobVersion::UF:
return MobVersion::OfflineUF;
case MobVersion::RoF:
return MobVersion::OfflineRoF;
case MobVersion::RoF2:
return MobVersion::OfflineRoF2;
default:
return InventoryVersion::Unknown;
return MobVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version)
EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
{
switch (inventory_version) {
case InventoryVersion::OfflineTitanium:
return InventoryVersion::Titanium;
case InventoryVersion::OfflineSoF:
return InventoryVersion::SoF;
case InventoryVersion::OfflineSoD:
return InventoryVersion::SoD;
case InventoryVersion::OfflineUF:
return InventoryVersion::UF;
case InventoryVersion::OfflineRoF:
return InventoryVersion::RoF;
case InventoryVersion::OfflineRoF2:
return InventoryVersion::RoF2;
switch (mob_version) {
case MobVersion::OfflineTitanium:
return MobVersion::Titanium;
case MobVersion::OfflineSoF:
return MobVersion::SoF;
case MobVersion::OfflineSoD:
return MobVersion::SoD;
case MobVersion::OfflineUF:
return MobVersion::UF;
case MobVersion::OfflineRoF:
return MobVersion::RoF;
case MobVersion::OfflineRoF2:
return MobVersion::RoF2;
default:
return InventoryVersion::Unknown;
return MobVersion::Unknown;
}
}
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version)
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
{
switch (inventory_version) {
case InventoryVersion::OfflineTitanium:
switch (mob_version) {
case MobVersion::OfflineTitanium:
return ClientVersion::Titanium;
case InventoryVersion::OfflineSoF:
case MobVersion::OfflineSoF:
return ClientVersion::SoF;
case InventoryVersion::OfflineSoD:
case MobVersion::OfflineSoD:
return ClientVersion::SoD;
case InventoryVersion::OfflineUF:
case MobVersion::OfflineUF:
return ClientVersion::UF;
case InventoryVersion::OfflineRoF:
case MobVersion::OfflineRoF:
return ClientVersion::RoF;
case InventoryVersion::OfflineRoF2:
case MobVersion::OfflineRoF2:
return ClientVersion::RoF2;
default:
return ClientVersion::Unknown;
}
}
EQEmu::versions::InventoryVersion EQEmu::versions::ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version)
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
{
switch (client_version) {
case ClientVersion::Titanium:
return InventoryVersion::OfflineTitanium;
return MobVersion::OfflineTitanium;
case ClientVersion::SoF:
return InventoryVersion::OfflineSoF;
return MobVersion::OfflineSoF;
case ClientVersion::SoD:
return InventoryVersion::OfflineSoD;
return MobVersion::OfflineSoD;
case ClientVersion::UF:
return InventoryVersion::OfflineUF;
return MobVersion::OfflineUF;
case ClientVersion::RoF:
return InventoryVersion::OfflineRoF;
return MobVersion::OfflineRoF;
case ClientVersion::RoF2:
return InventoryVersion::OfflineRoF2;
return MobVersion::OfflineRoF2;
default:
return InventoryVersion::Unknown;
return MobVersion::Unknown;
}
}
+27 -29
View File
@@ -64,17 +64,15 @@ namespace EQEmu
const ClientVersion LastClientVersion = ClientVersion::RoF2;
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
extern bool IsValidClientVersion(ClientVersion client_version);
extern ClientVersion ValidateClientVersion(ClientVersion client_version);
extern const char* ClientVersionName(ClientVersion client_version);
extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
bool IsValidClientVersion(ClientVersion client_version);
ClientVersion ValidateClientVersion(ClientVersion client_version);
const char* ClientVersionName(ClientVersion client_version);
uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
} /*versions*/
namespace versions {
enum class InventoryVersion {
enum class MobVersion {
Unknown = 0,
Client62,
Titanium,
@@ -99,29 +97,29 @@ namespace EQEmu
OfflineRoF2
};
const InventoryVersion LastInventoryVersion = InventoryVersion::OfflineRoF2;
const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2;
const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::BotPet;
const InventoryVersion LastOfflinePCInventoryVersion = InventoryVersion::OfflineRoF2;
const size_t InventoryVersionCount = (static_cast<size_t>(LastInventoryVersion) + 1);
const MobVersion LastMobVersion = MobVersion::OfflineRoF2;
const MobVersion LastPCMobVersion = MobVersion::RoF2;
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2;
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
extern bool IsValidInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version);
extern bool IsValidOfflinePCInventoryVersion(InventoryVersion inventory_version);
bool IsValidMobVersion(MobVersion mob_version);
bool IsValidPCMobVersion(MobVersion mob_version);
bool IsValidNonPCMobVersion(MobVersion mob_version);
bool IsValidOfflinePCMobVersion(MobVersion mob_version);
extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ValidateOfflinePCInventoryVersion(InventoryVersion inventory_version);
MobVersion ValidateMobVersion(MobVersion mob_version);
MobVersion ValidatePCMobVersion(MobVersion mob_version);
MobVersion ValidateNonPCMobVersion(MobVersion mob_version);
MobVersion ValidateOfflinePCMobVersion(MobVersion mob_version);
extern const char* InventoryVersionName(InventoryVersion inventory_version);
extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version);
extern InventoryVersion ConvertPCInventoryVersionToOfflinePCInventoryVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertOfflinePCInventoryVersionToPCInventoryVersion(InventoryVersion inventory_version);
extern ClientVersion ConvertOfflinePCInventoryVersionToClientVersion(InventoryVersion inventory_version);
extern InventoryVersion ConvertClientVersionToOfflinePCInventoryVersion(ClientVersion client_version);
const char* MobVersionName(MobVersion mob_version);
ClientVersion ConvertMobVersionToClientVersion(MobVersion mob_version);
MobVersion ConvertClientVersionToMobVersion(ClientVersion client_version);
MobVersion ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version);
MobVersion ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version);
ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version);
MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version);
} /*versions*/
-8
View File
@@ -516,14 +516,6 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
*/
#define INVALID_INDEX -1
#define NO_ITEM 0
// yes..these are redundant... but, they help to identify and define what is actually being performed
// plus, since they're pre-op's, they don't affect the actual binary size
#define TYPE_BEGIN 0
#define SLOT_BEGIN 0
#define SUB_INDEX_BEGIN 0
#define AUG_INDEX_BEGIN 0
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
+791 -189
View File
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -38,6 +38,13 @@ namespace EQEmu
class LookupEntry {
public:
size_t CharacterCreationLimit;
int LongBuffs;
int ShortBuffs;
int DiscBuffs;
int TotalBuffs;
int NPCBuffs;
int PetBuffs;
int MercBuffs;
};
const LookupEntry* Lookup(versions::ClientVersion client_version);
@@ -47,7 +54,7 @@ namespace EQEmu
namespace inventory {
class LookupEntry {
public:
size_t InventoryTypeSize[legacy::TypeCount];
size_t InventoryTypeSize[25]; // should reflect EQEmu::inventory::typeCount referenced in emu_constants.h
uint64 PossessionsBitmask;
size_t ItemBagSize;
@@ -59,7 +66,7 @@ namespace EQEmu
bool AllowOverLevelEquipment;
};
const LookupEntry* Lookup(versions::InventoryVersion inventory_version);
const LookupEntry* Lookup(versions::MobVersion mob_version);
} /*inventory*/
@@ -69,7 +76,7 @@ namespace EQEmu
bool CoinHasWeight;
};
const LookupEntry* Lookup(versions::InventoryVersion inventory_version);
const LookupEntry* Lookup(versions::MobVersion mob_version);
} /*behavior*/
+20 -6
View File
@@ -127,7 +127,7 @@ struct LDoNTrapTemplate
// All clients translate the character select information to some degree
struct CharSelectEquip : EQEmu::Texture_Struct, EQEmu::Tint_Struct {};
struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {};
// RoF2-based hybrid struct
struct CharacterSelectEntry_Struct
@@ -142,7 +142,7 @@ struct CharacterSelectEntry_Struct
uint16 Instance;
uint8 Gender;
uint8 Face;
CharSelectEquip Equip[EQEmu::textures::TextureCount];
CharSelectEquip Equip[EQEmu::textures::materialCount];
uint8 Unknown15; // Seen FF
uint8 Unknown19; // Seen FF
uint32 DrakkinTattoo;
@@ -834,7 +834,7 @@ struct SuspendedMinion_Struct
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ EQEmu::TextureShortProfile Items;
/*510*/ EQEmu::TextureMaterialProfile Items;
/*546*/ char Name[64];
/*610*/
};
@@ -942,7 +942,7 @@ struct PlayerProfile_Struct
/*0304*/ uint8 ability_time_minutes;
/*0305*/ uint8 ability_time_hours; //place holder
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
/*0312*/ EQEmu::TextureShortProfile item_material; // Item texture/material of worn/held items
/*0312*/ EQEmu::TextureMaterialProfile item_material; // Item texture/material of worn/held items
/*0348*/ uint8 unknown0348[44];
/*0392*/ EQEmu::TintProfile item_tint;
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
@@ -1179,7 +1179,7 @@ struct WearChange_Struct{
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
/*014*/ uint32 hero_forge_model; // New to VoA
/*018*/ uint32 unknown18; // New to RoF
/*022*/ EQEmu::Tint_Struct color;
/*022*/ EQEmu::textures::Tint_Struct color;
/*026*/ uint8 wear_slot_id;
/*027*/
};
@@ -2071,7 +2071,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
EQEmu::ItemBase item;
EQEmu::ItemData item;
uint8 iss_unknown001[6];
};*/
@@ -3517,6 +3517,20 @@ struct RecipeAutoCombine_Struct {
// f5 ff ff ff in 'you dont have all the stuff' reply
};
// this is the "value#a" data
enum EParticlePoint {
eDefault,
eChest,
eHead,
eLeftHand,
eRigthHand,
eLeftFoot,
eRightFood,
eLeftEye,
eRightEye,
eMouth
};
struct LevelAppearance_Struct { //Sends a little graphic on level up
uint32 spawn_id;
uint32 parm1;
+2 -2
View File
@@ -19,7 +19,7 @@
#define EXTENDED_PROFILE_H
#include "eq_packet_structs.h"
#include "item.h"
#include "inventory_profile.h"
#pragma pack(1)
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
uint16 old_pet_hp; /* Not Used */
uint16 old_pet_mana; /* Not Used */
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
EQEmu::TextureShortProfile pet_items; /* Not Used */
EQEmu::TextureMaterialProfile pet_items; /* Not Used */
char merc_name[64]; /* Used */
uint32 aa_effects; /* Used */
File diff suppressed because it is too large Load Diff
+230
View File
@@ -0,0 +1,230 @@
/* 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 04111-1307 USA
*/
// @merth notes:
// These classes could be optimized with database reads/writes by storing
// a status flag indicating how object needs to interact with database
#ifndef COMMON_INVENTORY_PROFILE_H
#define COMMON_INVENTORY_PROFILE_H
#include "item_instance.h"
#include <list>
//FatherNitwit: location bits for searching specific
//places with HasItem() and HasItemByUse()
enum {
invWhereWorn = 0x01,
invWherePersonal = 0x02, //in the character's inventory
invWhereBank = 0x04,
invWhereSharedBank = 0x08,
invWhereTrading = 0x10,
invWhereCursor = 0x20
};
// ########################################
// Class: Queue
// Queue that allows a read-only iterator
class ItemInstQueue
{
public:
~ItemInstQueue();
/////////////////////////
// Public Methods
/////////////////////////
inline std::list<EQEmu::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); }
inline std::list<EQEmu::ItemInstance*>::const_iterator cend() { return m_list.cend(); }
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
inline bool empty() { return m_list.empty(); }
void push(EQEmu::ItemInstance* inst);
void push_front(EQEmu::ItemInstance* inst);
EQEmu::ItemInstance* pop();
EQEmu::ItemInstance* pop_back();
EQEmu::ItemInstance* peek_front() const;
protected:
/////////////////////////
// Protected Members
/////////////////////////
std::list<EQEmu::ItemInstance*> m_list;
};
// ########################################
// Class: EQEmu::InventoryProfile
// Character inventory
namespace EQEmu
{
class InventoryProfile
{
friend class ItemInstance;
public:
///////////////////////////////
// Public Methods
///////////////////////////////
InventoryProfile() { m_mob_version = versions::MobVersion::Unknown; m_mob_version_set = false; }
~InventoryProfile();
bool SetInventoryVersion(versions::MobVersion inventory_version) {
if (!m_mob_version_set) {
m_mob_version = versions::ValidateMobVersion(inventory_version);
return (m_mob_version_set = true);
}
else {
return false;
}
}
bool SetInventoryVersion(versions::ClientVersion client_version) { return SetInventoryVersion(versions::ConvertClientVersionToMobVersion(client_version)); }
versions::MobVersion InventoryVersion() { return m_mob_version; }
static void CleanDirty();
static void MarkDirty(ItemInstance *inst);
// Retrieve a writeable item at specified slot
ItemInstance* GetItem(int16 slot_id) const;
ItemInstance* GetItem(int16 slot_id, uint8 bagidx) const;
inline std::list<ItemInstance*>::const_iterator cursor_cbegin() { return m_cursor.cbegin(); }
inline std::list<ItemInstance*>::const_iterator cursor_cend() { return m_cursor.cend(); }
inline int CursorSize() { return m_cursor.size(); }
inline bool CursorEmpty() { return m_cursor.empty(); }
// Retrieve a read-only item from inventory
inline const ItemInstance* operator[](int16 slot_id) const { return GetItem(slot_id); }
// Add item to inventory
int16 PutItem(int16 slot_id, const ItemInstance& inst);
// Add item to cursor queue
int16 PushCursor(const ItemInstance& inst);
// Get cursor item in front of queue
ItemInstance* GetCursorItem();
// Swap items in inventory
bool SwapItem(int16 slot_a, int16 slot_b);
// Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity = 0);
// Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id);
// Remove item from inventory (and take control of memory)
ItemInstance* PopItem(int16 slot_id);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const ItemData *ItemToTry, int16 Quantity);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByUse(uint8 use, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByLoreGroup(uint32 loregroup, uint8 where = 0xFF);
// Locate an available inventory slot
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
int16 FindFreeSlotForTradeItem(const ItemInstance* inst);
// Calculate slot_id for an item within a bag
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag
static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id
static int16 CalcSlotFromMaterial(uint8 material);
static uint8 CalcMaterialFromSlot(int16 equipslot);
static bool CanItemFitInContainer(const ItemData *ItemToTry, const ItemData *Container);
// Test for valid inventory casting slot
bool SupportsClickCasting(int16 slot_id);
bool SupportsPotionBeltCasting(int16 slot_id);
// Test whether a given slot can support a container item
static bool SupportsContainers(int16 slot_id);
int GetSlotByItemInst(ItemInstance *inst);
uint8 FindBrightestLightType();
void dumpEntireInventory();
void dumpWornItems();
void dumpInventory();
void dumpBankItems();
void dumpSharedBankItems();
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
protected:
///////////////////////////////
// Protected Methods
///////////////////////////////
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
void dumpItemCollection(const std::map<int16, ItemInstance*> &collection);
void dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it);
// Retrieves item within an inventory bucket
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
// Private "put" item into bucket, without regard for what is currently in bucket
int16 _PutItem(int16 slot_id, ItemInstance* inst);
// Checks an inventory bucket for a particular item
int16 _HasItem(std::map<int16, ItemInstance*>& bucket, uint32 item_id, uint8 quantity);
int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity);
int16 _HasItemByUse(std::map<int16, ItemInstance*>& bucket, uint8 use, uint8 quantity);
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
int16 _HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup);
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
// Player inventory
std::map<int16, ItemInstance*> m_worn; // Items worn by character
std::map<int16, ItemInstance*> m_inv; // Items in character personal inventory
std::map<int16, ItemInstance*> m_bank; // Items in character bank
std::map<int16, ItemInstance*> m_shbank; // Items in character shared bank
std::map<int16, ItemInstance*> m_trade; // Items in a trade session
::ItemInstQueue m_cursor; // Items on cursor: FIFO
private:
// Active mob version
versions::MobVersion m_mob_version;
bool m_mob_version_set;
};
}
#endif /*COMMON_INVENTORY_PROFILE_H*/
+397
View File
@@ -0,0 +1,397 @@
/* 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 "inventory_slot.h"
#include "textures.h"
#include "string_util.h"
int8 EQEmu::inventory::ConvertEquipmentIndexToTextureIndex(int16 slot_index)
{
switch (slot_index) {
case slotHead:
return textures::armorHead;
case slotChest:
return textures::armorChest;
case slotArms:
return textures::armorArms;
case slotWrist1:
return textures::armorWrist;
case slotHands:
return textures::armorHands;
case slotLegs:
return textures::armorLegs;
case slotFeet:
return textures::armorFeet;
case slotPrimary:
return textures::weaponPrimary;
case slotSecondary:
return textures::weaponSecondary;
default:
return textures::textureInvalid;
}
}
int8 EQEmu::inventory::ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot)
{
if ((!inventory_slot.Typeless() && !inventory_slot.IsTypeIndex(typePossessions)) || !inventory_slot.IsContainerIndex(containerInvalid) || !inventory_slot.IsSocketIndex(socketInvalid))
return textures::textureInvalid;
return ConvertEquipmentIndexToTextureIndex(inventory_slot.SlotIndex());
}
int16 EQEmu::inventory::ConvertTextureIndexToEquipmentIndex(int8 texture_index)
{
switch (texture_index) {
case textures::armorHead:
return slotHead;
case textures::armorChest:
return slotChest;
case textures::armorArms:
return slotArms;
case textures::armorWrist:
return slotWrist1;
case textures::armorHands:
return slotHands;
case textures::armorLegs:
return slotLegs;
case textures::armorFeet:
return slotFeet;
case textures::weaponPrimary:
return slotPrimary;
case textures::weaponSecondary:
return slotSecondary;
default:
return slotInvalid;
}
}
bool EQEmu::InventorySlot::IsValidSlot() const
{
if (_typeless)
return false;
int16 slot_count = inventory::SlotCount(_type_index);
if (!slot_count || _slot_index < inventory::slotBegin || _slot_index >= slot_count)
return false;
if (_container_index < inventory::containerInvalid || _container_index >= inventory::ContainerCount)
return false;
if (_socket_index < inventory::socketInvalid || _socket_index >= inventory::SocketCount)
return false;
return true;
}
bool EQEmu::InventorySlot::IsDeleteSlot() const
{
if (_typeless)
return (_slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid);
else
return (_type_index == inventory::typeInvalid && _slot_index == inventory::slotInvalid && _container_index == inventory::containerInvalid && _socket_index == inventory::socketInvalid);
}
bool EQEmu::InventorySlot::IsEquipmentIndex(int16 slot_index)
{
/*if (slot_index < inventory::EquipmentBegin || slot_index > inventory::EquipmentEnd)
return false;*/
if ((slot_index < legacy::EQUIPMENT_BEGIN || slot_index > legacy::EQUIPMENT_END) && slot_index != legacy::SLOT_POWER_SOURCE)
return false;
return true;
}
bool EQEmu::InventorySlot::IsGeneralIndex(int16 slot_index)
{
/*if (slot_index < inventory::GeneralBegin || slot_index > inventory::GeneralEnd)
return false;*/
if (slot_index < legacy::GENERAL_BEGIN || slot_index > legacy::GENERAL_END)
return false;
return true;
}
bool EQEmu::InventorySlot::IsCursorIndex(int16 slot_index)
{
/*if (slot_index != inventory::slotCursor)
return false;*/
if (slot_index != legacy::SLOT_CURSOR)
return false;
return true;
}
bool EQEmu::InventorySlot::IsWeaponIndex(int16 slot_index)
{
/*if ((slot_index != inventory::slotRange) && (slot_index != inventory::slotPrimary) && (slot_index != inventory::slotSecondary))
return false;*/
if ((slot_index != legacy::SLOT_RANGE) && (slot_index != legacy::SLOT_PRIMARY) && (slot_index != legacy::SLOT_SECONDARY))
return false;
return true;
}
bool EQEmu::InventorySlot::IsTextureIndex(int16 slot_index)
{
switch (slot_index) {
case inventory::slotHead:
case inventory::slotChest:
case inventory::slotArms:
case inventory::slotWrist1:
case inventory::slotHands:
case inventory::slotLegs:
case inventory::slotFeet:
case inventory::slotPrimary:
case inventory::slotSecondary:
return true;
default:
return false;
}
}
bool EQEmu::InventorySlot::IsTintableIndex(int16 slot_index)
{
switch (slot_index) {
case inventory::slotHead:
case inventory::slotChest:
case inventory::slotArms:
case inventory::slotWrist1:
case inventory::slotHands:
case inventory::slotLegs:
case inventory::slotFeet:
return true;
default:
return false;
}
}
bool EQEmu::InventorySlot::IsEquipmentSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsEquipmentIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsGeneralSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsGeneralIndex(_socket_index);
}
bool EQEmu::InventorySlot::IsCursorSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsCursorIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsWeaponSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsWeaponIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsTextureSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsTextureIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsTintableSlot() const
{
if (!_typeless && (_type_index != inventory::typePossessions))
return false;
if ((_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
return false;
return IsTintableIndex(_slot_index);
}
bool EQEmu::InventorySlot::IsSlot() const
{
if (!_typeless && (_type_index == inventory::typeInvalid))
return false;
if (_slot_index == inventory::slotInvalid)
return false;
if (_container_index != inventory::containerInvalid)
return false;
if (_socket_index != inventory::socketInvalid)
return false;
return true;
}
bool EQEmu::InventorySlot::IsSlotSocket() const
{
if (!_typeless && (_type_index == inventory::typeInvalid))
return false;
if (_slot_index == inventory::slotInvalid)
return false;
if (_container_index != inventory::containerInvalid)
return false;
if (_socket_index == inventory::socketInvalid)
return false;
return true;
}
bool EQEmu::InventorySlot::IsContainer() const
{
if (!_typeless && (_type_index == inventory::typeInvalid))
return false;
if (_slot_index == inventory::slotInvalid)
return false;
if (_container_index == inventory::containerInvalid)
return false;
if (_socket_index != inventory::socketInvalid)
return false;
return true;
}
bool EQEmu::InventorySlot::IsContainerSocket() const
{
if (!_typeless && (_type_index == inventory::typeInvalid))
return false;
if (_slot_index == inventory::slotInvalid)
return false;
if (_container_index == inventory::containerInvalid)
return false;
if (_socket_index == inventory::socketInvalid)
return false;
return true;
}
EQEmu::InventorySlot EQEmu::InventorySlot::ToTopOwner() const
{
return InventorySlot(_type_index, _slot_index);
}
EQEmu::InventorySlot EQEmu::InventorySlot::ToOwner() const
{
if (IsSlot() || IsSlotSocket() || IsContainer())
return InventorySlot(_type_index, _slot_index);
if (IsContainerSocket())
return InventorySlot(_type_index, _slot_index, _container_index);
return InventorySlot();
}
const std::string EQEmu::InventorySlot::ToString() const
{
return StringFormat("(%i%s, %i, %i, %i)", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
}
const std::string EQEmu::InventorySlot::ToName() const
{
return StringFormat("InventorySlot - _type_index: %i%s, _slot_index: %i, _container_index: %i, _socket_index: %i", _type_index, (_typeless ? " [typeless]" : ""), _slot_index, _container_index, _socket_index);
}
void EQEmu::InventorySlot::SetInvalidSlot()
{
_type_index = inventory::typeInvalid;
_slot_index = inventory::slotInvalid;
_container_index = inventory::containerInvalid;
_socket_index = inventory::socketInvalid;
}
//bool EQEmu::InventorySlot::IsBonusIndex(int16 slot_index)
//{
// if ((slot_index >= inventory::EquipmentBegin) && (slot_index <= inventory::EquipmentEnd) && (slot_index != inventory::slotAmmo))
// return true;
//
// return false;
//}
//bool EQEmu::InventorySlot::IsBonusSlot() const
//{
// if ((_type_index != inventory::typePossessions) || (_container_index != inventory::containerInvalid) || (_socket_index != inventory::socketInvalid))
// return false;
//
// return IsBonusIndex(_slot_index);
//}
bool inventory_slot_typeless_lessthan(const EQEmu::InventorySlot& lhs, const EQEmu::InventorySlot& rhs)
{
if (lhs.SlotIndex() < rhs.SlotIndex())
return true;
if ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() < rhs.ContainerIndex()))
return true;
if ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() < rhs.SocketIndex()))
return true;
return false;
}
bool EQEmu::InventorySlot::operator<(const InventorySlot& rhs) const
{
if (Typeless() || rhs.Typeless())
return inventory_slot_typeless_lessthan(*this, rhs);
if (TypeIndex() < rhs.TypeIndex())
return true;
if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() < rhs.SlotIndex()))
return true;
if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() == rhs.SlotIndex()) && (ContainerIndex() < rhs.ContainerIndex()))
return true;
if ((TypeIndex() == rhs.TypeIndex()) && (SlotIndex() == rhs.SlotIndex()) && (ContainerIndex() == rhs.ContainerIndex()) && (SocketIndex() < rhs.SocketIndex()))
return true;
return false;
}
bool EQEmu::operator==(const InventorySlot& lhs, const InventorySlot& rhs)
{
if (lhs.Typeless() || rhs.Typeless())
return ((lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
return ((lhs.TypeIndex() == rhs.TypeIndex()) && (lhs.SlotIndex() == rhs.SlotIndex()) && (lhs.ContainerIndex() == rhs.ContainerIndex()) && (lhs.SocketIndex() == rhs.SocketIndex()));
}
+133
View File
@@ -0,0 +1,133 @@
/* 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 COMMON_INVENTORY_SLOT
#define COMMON_INVENTORY_SLOT
#include "emu_constants.h"
namespace EQEmu
{
class InventorySlot;
namespace inventory {
int8 ConvertEquipmentIndexToTextureIndex(int16 slot_index);
int8 ConvertEquipmentSlotToTextureIndex(const InventorySlot& inventory_slot);
int16 ConvertTextureIndexToEquipmentIndex(int8 texture_index);
}
class InventorySlot {
public:
InventorySlot() : _type_index(inventory::typeInvalid), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { }
InventorySlot(int16 type_index) : _type_index(type_index), _slot_index(inventory::slotInvalid), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { }
InventorySlot(int16 type_index, int16 parent_index) : _type_index(type_index), _slot_index(parent_index), _container_index(inventory::containerInvalid), _socket_index(inventory::socketInvalid), _typeless(false) { }
InventorySlot(int16 type_index, int16 parent_index, int16 bag_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(inventory::socketInvalid), _typeless(false) { }
InventorySlot(int16 type_index, int16 parent_index, int16 bag_index, int16 aug_index) : _type_index(type_index), _slot_index(parent_index), _container_index(bag_index), _socket_index(aug_index), _typeless(false) { }
InventorySlot(const InventorySlot& r) : _type_index(r._type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(r._typeless) { }
InventorySlot(int16 type_index, const InventorySlot& r) : _type_index(type_index), _slot_index(r._slot_index), _container_index(r._container_index), _socket_index(r._socket_index), _typeless(false) { }
inline int16 TypeIndex() const { return _type_index; }
inline int16 SlotIndex() const { return _slot_index; }
inline int16 ContainerIndex() const { return _container_index; }
inline int16 SocketIndex() const { return _socket_index; }
bool Typeless() const { return _typeless; }
bool IsValidSlot() const;
bool IsDeleteSlot() const;
static bool IsEquipmentIndex(int16 slot_index);
static bool IsGeneralIndex(int16 slot_index);
static bool IsCursorIndex(int16 slot_index);
static bool IsWeaponIndex(int16 slot_index);
static bool IsTextureIndex(int16 slot_index);
static bool IsTintableIndex(int16 slot_index);
bool IsEquipmentSlot() const;
bool IsGeneralSlot() const;
bool IsCursorSlot() const;
bool IsWeaponSlot() const;
bool IsTextureSlot() const;
bool IsTintableSlot() const;
bool IsSlot() const;
bool IsSlotSocket() const;
bool IsContainer() const;
bool IsContainerSocket() const;
InventorySlot ToTopOwner() const;
InventorySlot ToOwner() const;
const std::string ToString() const;
const std::string ToName() const;
bool IsTypeIndex(int16 type_index) const { return (_type_index == type_index); }
bool IsSlotIndex(int16 slot_index) const { return (_slot_index == slot_index); }
bool IsContainerIndex(int16 container_index) const { return (_container_index == container_index); }
bool IsSocketIndex(int16 socket_index) const { return (_socket_index == socket_index); }
void SetType(int16 type_index) { _type_index = type_index; }
void SetSlot(int16 slot_index) { _slot_index = slot_index; }
void SetContainer(int16 container_index) { _container_index = container_index; }
void SetSocket(int16 socket_index) { _socket_index = socket_index; }
void SetInvalidSlot();
void SetTypeInvalid() { _type_index = inventory::typeInvalid; }
void SetSlotInvalid() { _slot_index = inventory::slotInvalid; }
void SetContainerInvalid() { _container_index = inventory::containerInvalid; }
void SetSocketInvalid() { _socket_index = inventory::socketInvalid; }
void SetTypeBegin() { _type_index = inventory::typeBegin; }
void SetSlotBegin() { _slot_index = inventory::slotBegin; }
void SetContainerBegin() { _container_index = inventory::containerBegin; }
void SetSocketBegin() { _socket_index = inventory::socketBegin; }
void IncrementType() { ++_type_index; }
void IncrementSlot() { ++_slot_index; }
void IncrementContainer() { ++_container_index; }
void IncrementSocket() { ++_socket_index; }
void SetTypeless() { _typeless = true; }
void ClearTypeless() { _typeless = false; }
// these two methods should really check for all bonus-valid slots..currently checks for equipment only (rework needed)
//static bool IsBonusIndex(int16 slot_index);
//bool IsBonusSlot() const;
bool operator<(const InventorySlot& rhs) const;
private:
int16 _type_index;
//int16 _unknown2; // not implemented
int16 _slot_index;
int16 _container_index;
int16 _socket_index;
//int16 _unknown1; // not implemented
bool _typeless;
};
bool operator==(const InventorySlot& lhs, const InventorySlot& rhs);
bool operator!=(const InventorySlot& lhs, const InventorySlot& rhs) { return (!(lhs == rhs)); }
} /*EQEmu*/
#endif /*COMMON_INVENTORY_SLOT*/
-3073
View File
File diff suppressed because it is too large Load Diff
-544
View File
@@ -1,544 +0,0 @@
/* 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 04111-1307 USA
*/
// @merth notes:
// These classes could be optimized with database reads/writes by storing
// a status flag indicating how object needs to interact with database
#ifndef COMMON_ITEM_H
#define COMMON_ITEM_H
class ItemParse; // Parses item packets
class EvolveInfo; // Stores information about an evolving item family
#include "../common/eq_constants.h"
#include "../common/item_base.h"
#include "../common/timer.h"
#include "../common/bodytypes.h"
#include "../common/deity.h"
#include "../common/memory_buffer.h"
#include <list>
#include <map>
namespace ItemField
{
enum
{
source = 0,
#define F(x) x,
#include "item_fieldlist.h"
#undef F
updated
};
};
// Specifies usage type for item inside ItemInst
enum ItemInstTypes
{
ItemInstNormal = 0,
ItemInstWorldContainer
};
typedef enum {
byFlagIgnore, //do not consider this flag
byFlagSet, //apply action if the flag is set
byFlagNotSet //apply action if the flag is NOT set
} byFlagSetting;
//FatherNitwit: location bits for searching specific
//places with HasItem() and HasItemByUse()
enum {
invWhereWorn = 0x01,
invWherePersonal = 0x02, //in the character's inventory
invWhereBank = 0x04,
invWhereSharedBank = 0x08,
invWhereTrading = 0x10,
invWhereCursor = 0x20
};
class ItemInst;
// ########################################
// Class: Queue
// Queue that allows a read-only iterator
class ItemInstQueue
{
public:
~ItemInstQueue();
/////////////////////////
// Public Methods
/////////////////////////
inline std::list<ItemInst*>::const_iterator cbegin() { return m_list.cbegin(); }
inline std::list<ItemInst*>::const_iterator cend() { return m_list.cend(); }
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
inline bool empty() { return m_list.empty(); }
void push(ItemInst* inst);
void push_front(ItemInst* inst);
ItemInst* pop();
ItemInst* pop_back();
ItemInst* peek_front() const;
protected:
/////////////////////////
// Protected Members
/////////////////////////
std::list<ItemInst*> m_list;
};
// ########################################
// Class: Inventory
// Character inventory
class Inventory
{
friend class ItemInst;
public:
///////////////////////////////
// Public Methods
///////////////////////////////
Inventory() { m_inventory_version = EQEmu::versions::InventoryVersion::Unknown; m_inventory_version_set = false; }
~Inventory();
// inv2 creep
bool SetInventoryVersion(EQEmu::versions::InventoryVersion inventory_version) {
if (!m_inventory_version_set) {
m_inventory_version = EQEmu::versions::ValidateInventoryVersion(inventory_version);
return (m_inventory_version_set = true);
}
else {
return false;
}
}
bool SetInventoryVersion(EQEmu::versions::ClientVersion client_version) { return SetInventoryVersion(EQEmu::versions::ConvertClientVersionToInventoryVersion(client_version)); }
EQEmu::versions::InventoryVersion InventoryVersion() { return m_inventory_version; }
static void CleanDirty();
static void MarkDirty(ItemInst *inst);
// Retrieve a writeable item at specified slot
ItemInst* GetItem(int16 slot_id) const;
ItemInst* GetItem(int16 slot_id, uint8 bagidx) const;
inline std::list<ItemInst*>::const_iterator cursor_cbegin() { return m_cursor.cbegin(); }
inline std::list<ItemInst*>::const_iterator cursor_cend() { return m_cursor.cend(); }
inline int CursorSize() { return m_cursor.size(); }
inline bool CursorEmpty() { return m_cursor.empty(); }
// Retrieve a read-only item from inventory
inline const ItemInst* operator[](int16 slot_id) const { return GetItem(slot_id); }
// Add item to inventory
int16 PutItem(int16 slot_id, const ItemInst& inst);
// Add item to cursor queue
int16 PushCursor(const ItemInst& inst);
// Get cursor item in front of queue
ItemInst* GetCursorItem();
// Swap items in inventory
bool SwapItem(int16 slot_a, int16 slot_b);
// Remove item from inventory
bool DeleteItem(int16 slot_id, uint8 quantity=0);
// Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id);
// Remove item from inventory (and take control of memory)
ItemInst* PopItem(int16 slot_id);
// Check whether there is space for the specified number of the specified item.
bool HasSpaceForItem(const EQEmu::ItemBase *ItemToTry, int16 Quantity);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItem(uint32 item_id, uint8 quantity = 0, uint8 where = 0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByUse(uint8 use, uint8 quantity=0, uint8 where=0xFF);
// Check whether item exists in inventory
// where argument specifies OR'd list of invWhere constants to look
int16 HasItemByLoreGroup(uint32 loregroup, uint8 where=0xFF);
// Locate an available inventory slot
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
int16 FindFreeSlotForTradeItem(const ItemInst* inst);
// Calculate slot_id for an item within a bag
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
static int16 CalcSlotId(int16 bagslot_id, uint8 bagidx); // Calc slot_id for item inside bag
static uint8 CalcBagIdx(int16 slot_id); // Calc bagidx for slot_id
static int16 CalcSlotFromMaterial(uint8 material);
static uint8 CalcMaterialFromSlot(int16 equipslot);
static bool CanItemFitInContainer(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container);
// Test for valid inventory casting slot
bool SupportsClickCasting(int16 slot_id);
bool SupportsPotionBeltCasting(int16 slot_id);
// Test whether a given slot can support a container item
static bool SupportsContainers(int16 slot_id);
int GetSlotByItemInst(ItemInst *inst);
uint8 FindBrightestLightType();
void dumpEntireInventory();
void dumpWornItems();
void dumpInventory();
void dumpBankItems();
void dumpSharedBankItems();
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, std::string value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, int value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, float value);
void SetCustomItemData(uint32 character_id, int16 slot_id, std::string identifier, bool value);
std::string GetCustomItemData(int16 slot_id, std::string identifier);
protected:
///////////////////////////////
// Protected Methods
///////////////////////////////
int GetSlotByItemInstCollection(const std::map<int16, ItemInst*> &collection, ItemInst *inst);
void dumpItemCollection(const std::map<int16, ItemInst*> &collection);
void dumpBagContents(ItemInst *inst, std::map<int16, ItemInst*>::const_iterator *it);
// Retrieves item within an inventory bucket
ItemInst* _GetItem(const std::map<int16, ItemInst*>& bucket, int16 slot_id) const;
// Private "put" item into bucket, without regard for what is currently in bucket
int16 _PutItem(int16 slot_id, ItemInst* inst);
// Checks an inventory bucket for a particular item
int16 _HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, uint8 quantity);
int16 _HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity);
int16 _HasItemByUse(std::map<int16, ItemInst*>& bucket, uint8 use, uint8 quantity);
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
int16 _HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32 loregroup);
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
// Player inventory
std::map<int16, ItemInst*> m_worn; // Items worn by character
std::map<int16, ItemInst*> m_inv; // Items in character personal inventory
std::map<int16, ItemInst*> m_bank; // Items in character bank
std::map<int16, ItemInst*> m_shbank; // Items in character shared bank
std::map<int16, ItemInst*> m_trade; // Items in a trade session
ItemInstQueue m_cursor; // Items on cursor: FIFO
private:
// Active inventory version
EQEmu::versions::InventoryVersion m_inventory_version;
bool m_inventory_version_set;
};
class SharedDatabase;
// ########################################
// Class: ItemInst
// Base class for an instance of an item
// An item instance encapsulates item data + data specific
// to an item instance (includes dye, augments, charges, etc)
class ItemInst
{
public:
/////////////////////////
// Methods
/////////////////////////
// Constructors/Destructor
ItemInst(const EQEmu::ItemBase* item = nullptr, int16 charges = 0);
ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0);
ItemInst(ItemInstTypes use_type);
ItemInst(const ItemInst& copy);
~ItemInst();
// Query item type
bool IsType(EQEmu::item::ItemClass item_class) const;
bool IsClassCommon();
bool IsClassBag();
bool IsClassBook();
bool IsClassCommon() const { return const_cast<ItemInst*>(this)->IsClassCommon(); }
bool IsClassBag() const { return const_cast<ItemInst*>(this)->IsClassBag(); }
bool IsClassBook() const { return const_cast<ItemInst*>(this)->IsClassBook(); }
// Can item be stacked?
bool IsStackable() const;
bool IsCharged() const;
// Can item be equipped by/at?
bool IsEquipable(uint16 race, uint16 class_) const;
bool IsEquipable(int16 slot_id) const;
//
// Augments
//
bool IsAugmentable() const;
bool AvailableWearSlot(uint32 aug_wear_slots) const;
int8 AvailableAugmentSlot(int32 augtype) const;
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : NO_ITEM); }
inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == EQEmu::item::ItemEffectExpendable) || (m_item->ItemType == EQEmu::item::ItemTypePotion)) : false); }
//
// Contents
//
ItemInst* GetItem(uint8 slot) const;
uint32 GetItemID(uint8 slot) const;
inline const ItemInst* operator[](uint8 slot) const { return GetItem(slot); }
void PutItem(uint8 slot, const ItemInst& inst);
void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere...
void DeleteItem(uint8 slot);
ItemInst* PopItem(uint8 index);
void Clear();
void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent);
uint8 FirstOpenSlot() const;
uint8 GetTotalItemCount() const;
bool IsNoneEmptyContainer();
std::map<uint8, ItemInst*>* GetContents() { return &m_contents; }
//
// Augments
//
ItemInst* GetAugment(uint8 slot) const;
uint32 GetAugmentItemID(uint8 slot) const;
void PutAugment(uint8 slot, const ItemInst& inst);
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
void DeleteAugment(uint8 slot);
ItemInst* RemoveAugment(uint8 index);
bool IsAugmented();
ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const EQEmu::ItemBase *ItemToTry, const EQEmu::ItemBase *Container, bool AllowAll = false);
// Has attack/delay?
bool IsWeapon() const;
bool IsAmmo() const;
// Accessors
const uint32 GetID() const { return ((m_item) ? m_item->ID : NO_ITEM); }
const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : NO_ITEM); }
const EQEmu::ItemBase* GetItem() const;
const EQEmu::ItemBase* GetUnscaledItem() const;
int16 GetCharges() const { return m_charges; }
void SetCharges(int16 charges) { m_charges = charges; }
uint32 GetPrice() const { return m_price; }
void SetPrice(uint32 price) { m_price = price; }
void SetColor(uint32 color) { m_color = color; }
uint32 GetColor() const { return m_color; }
uint32 GetMerchantSlot() const { return m_merchantslot; }
void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; }
int32 GetMerchantCount() const { return m_merchantcount; }
void SetMerchantCount(int32 count) { m_merchantcount = count; }
int16 GetCurrentSlot() const { return m_currentslot; }
void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; }
// Is this item already attuned?
bool IsAttuned() const { return m_attuned; }
void SetAttuned(bool flag) { m_attuned=flag; }
std::string GetCustomDataString() const;
std::string GetCustomData(std::string identifier);
void SetCustomData(std::string identifier, std::string value);
void SetCustomData(std::string identifier, int value);
void SetCustomData(std::string identifier, float value);
void SetCustomData(std::string identifier, bool value);
void DeleteCustomData(std::string identifier);
// Allows treatment of this object as though it were a pointer to m_item
operator bool() const { return (m_item != nullptr); }
// Compare inner Item_Struct of two ItemInst objects
bool operator==(const ItemInst& right) const { return (this->m_item == right.m_item); }
bool operator!=(const ItemInst& right) const { return (this->m_item != right.m_item); }
// Clone current item
ItemInst* Clone() const;
bool IsSlotAllowed(int16 slot_id) const;
bool IsScaling() const { return m_scaling; }
bool IsEvolving() const { return (m_evolveLvl >= 1); }
uint32 GetExp() const { return m_exp; }
void SetExp(uint32 exp) { m_exp = exp; }
void AddExp(uint32 exp) { m_exp += exp; }
bool IsActivated() { return m_activated; }
void SetActivated(bool activated) { m_activated = activated; }
int8 GetEvolveLvl() const { return m_evolveLvl; }
void SetScaling(bool v) { m_scaling = v; }
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; }
void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; }
uint32 GetOrnamentHeroModel(int32 material_slot = -1) const;
void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; }
uint32 GetRecastTimestamp() const { return m_recast_timestamp; }
void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; }
void Initialize(SharedDatabase *db = nullptr);
void ScaleItem();
bool EvolveOnAllKills() const;
int8 GetMaxEvolveLvl() const;
uint32 GetKillsNeeded(uint8 currentlevel);
std::string Serialize(int16 slot_id) const { EQEmu::InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(EQEmu::InternalSerializedItem_Struct)); return ser; }
void Serialize(EQEmu::OutBuffer& ob, int16 slot_id) const { EQEmu::InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
inline int32 GetSerialNumber() const { return m_SerialNumber; }
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
std::map<std::string, Timer>& GetTimers() { return m_timers; }
void SetTimer(std::string name, uint32 time);
void StopTimer(std::string name);
void ClearTimers();
// Get a total of a stat, including augs
// These functions should be used in place of other code manually totaling
// to centralize where it is done to make future changes easier (ex. whenever powersources come around)
// and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance
// by default these do not recurse into augs
int GetItemArmorClass(bool augments = false) const;
int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const;
// These two differ in the fact that they're quick checks (they are checked BEFORE the one above
int GetItemElementalFlag(bool augments = false) const;
int GetItemElementalDamage(bool augments = false) const;
int GetItemRecommendedLevel(bool augments = false) const;
int GetItemRequiredLevel(bool augments = false) const;
int GetItemWeaponDamage(bool augments = false) const;
int GetItemBackstabDamage(bool augments = false) const;
// these two are just quick checks
int GetItemBaneDamageBody(bool augments = false) const;
int GetItemBaneDamageRace(bool augments = false) const;
int GetItemBaneDamageBody(bodyType against, bool augments = false) const;
int GetItemBaneDamageRace(uint16 against, bool augments = false) const;
int GetItemMagical(bool augments = false) const;
int GetItemHP(bool augments = false) const;
int GetItemMana(bool augments = false) const;
int GetItemEndur(bool augments = false) const;
int GetItemAttack(bool augments = false) const;
int GetItemStr(bool augments = false) const;
int GetItemSta(bool augments = false) const;
int GetItemDex(bool augments = false) const;
int GetItemAgi(bool augments = false) const;
int GetItemInt(bool augments = false) const;
int GetItemWis(bool augments = false) const;
int GetItemCha(bool augments = false) const;
int GetItemMR(bool augments = false) const;
int GetItemFR(bool augments = false) const;
int GetItemCR(bool augments = false) const;
int GetItemPR(bool augments = false) const;
int GetItemDR(bool augments = false) const;
int GetItemCorrup(bool augments = false) const;
int GetItemHeroicStr(bool augments = false) const;
int GetItemHeroicSta(bool augments = false) const;
int GetItemHeroicDex(bool augments = false) const;
int GetItemHeroicAgi(bool augments = false) const;
int GetItemHeroicInt(bool augments = false) const;
int GetItemHeroicWis(bool augments = false) const;
int GetItemHeroicCha(bool augments = false) const;
int GetItemHeroicMR(bool augments = false) const;
int GetItemHeroicFR(bool augments = false) const;
int GetItemHeroicCR(bool augments = false) const;
int GetItemHeroicPR(bool augments = false) const;
int GetItemHeroicDR(bool augments = false) const;
int GetItemHeroicCorrup(bool augments = false) const;
int GetItemHaste(bool augments = false) const;
protected:
//////////////////////////
// Protected Members
//////////////////////////
std::map<uint8, ItemInst*>::const_iterator _cbegin() { return m_contents.cbegin(); }
std::map<uint8, ItemInst*>::const_iterator _cend() { return m_contents.cend(); }
friend class Inventory;
void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; }
ItemInstTypes m_use_type; // Usage type for item
const EQEmu::ItemBase* m_item; // Ptr to item data
int16 m_charges; // # of charges for chargeable items
uint32 m_price; // Bazaar /trader price
uint32 m_color;
uint32 m_merchantslot;
int16 m_currentslot;
bool m_attuned;
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
uint32 m_exp;
int8 m_evolveLvl;
bool m_activated;
EQEmu::ItemBase* m_scaledItem;
EvolveInfo* m_evolveInfo;
bool m_scaling;
uint32 m_ornamenticon;
uint32 m_ornamentidfile;
uint32 m_ornament_hero_model;
uint32 m_recast_timestamp;
//
// Items inside of this item (augs or contents);
std::map<uint8, ItemInst*> m_contents; // Zero-based index: min=0, max=9
std::map<std::string, std::string> m_custom_data;
std::map<std::string, Timer> m_timers;
};
class EvolveInfo {
public:
friend class ItemInst;
//temporary
uint16 LvlKills[9];
uint32 FirstItem;
uint8 MaxLvl;
bool AllKills;
EvolveInfo();
EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10);
~EvolveInfo();
};
#endif /*COMMON_ITEM_H*/
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "item_base.h"
#include "item_data.h"
#include "classes.h"
#include "races.h"
//#include "deity.h"
@@ -167,7 +167,7 @@ uint8 EQEmu::item::ConvertAugTypeBitToAugType(uint32 aug_type_bit)
}
}
bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id)
bool EQEmu::ItemData::IsEquipable(uint16 race_id, uint16 class_id) const
{
if (!(Races & GetPlayerRaceBit(race_id)))
return false;
@@ -178,32 +178,32 @@ bool EQEmu::ItemBase::IsEquipable(uint16 race_id, uint16 class_id)
return true;
}
bool EQEmu::ItemBase::IsClassCommon()
bool EQEmu::ItemData::IsClassCommon() const
{
return (ItemClass == item::ItemClassCommon);
}
bool EQEmu::ItemBase::IsClassBag()
bool EQEmu::ItemData::IsClassBag() const
{
return (ItemClass == item::ItemClassBag);
}
bool EQEmu::ItemBase::IsClassBook()
bool EQEmu::ItemData::IsClassBook() const
{
return (ItemClass == item::ItemClassBook);
}
bool EQEmu::ItemBase::IsType1HWeapon()
bool EQEmu::ItemData::IsType1HWeapon() const
{
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing));
}
bool EQEmu::ItemBase::IsType2HWeapon()
bool EQEmu::ItemData::IsType2HWeapon() const
{
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
}
bool EQEmu::ItemBase::IsTypeShield()
bool EQEmu::ItemData::IsTypeShield() const
{
return (ItemType == item::ItemTypeShield);
}
+16 -36
View File
@@ -17,8 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
*/
#ifndef COMMON_ITEM_BASE_H
#define COMMON_ITEM_BASE_H
#ifndef COMMON_ITEM_DATA_H
#define COMMON_ITEM_DATA_H
/*
@@ -50,17 +50,6 @@
namespace EQEmu
{
namespace item {
enum ItemAttributeBit : uint32 {
bit_ItemAttributeNone = 0x00000000,
bit_ItemAttributeLore = 0x00000001,
bit_ItemAttributeArtifact = 0x00000002,
bit_ItemAttributeSummoned = 0x00000004,
bit_ItemAttributeMagic = 0x00000008,
bit_ItemAttributeAugment = 0x00000010,
bit_ItemAttributePendingLore = 0x00000020,
bit_ItemAttributeUnknown = 0xFFFFFFFF
};
enum ItemClass {
ItemClassCommon = 0,
ItemClassBag,
@@ -354,8 +343,8 @@ namespace EQEmu
//ProcRate
};
extern uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type);
extern uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit);
uint32 ConvertAugTypeToAugTypeBit(uint8 aug_type);
uint8 ConvertAugTypeBitToAugType(uint32 aug_type_bit);
} /*item*/
@@ -364,10 +353,9 @@ namespace EQEmu
const void * inst;
};
struct ItemBase {
struct ItemData {
// Non packet based fields
uint8 MinStatus;
uint8 ItemDataType; // memset to item::ItemDataBase ('0') during mmf load
// Packet based fields
uint8 ItemClass; // Item Type: 0=common, 1=container, 2=book
@@ -476,9 +464,9 @@ namespace EQEmu
int32 FactionAmt4; // Faction Amt 4
char CharmFile[32]; // ?
uint32 AugType;
uint8 AugSlotType[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type
uint8 AugSlotVisible[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible
uint8 AugSlotUnk2[EQEmu::legacy::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related
uint8 AugSlotType[inventory::SocketCount]; // RoF: Augment Slot 1-6 Type
uint8 AugSlotVisible[inventory::SocketCount]; // RoF: Augment Slot 1-6 Visible
uint8 AugSlotUnk2[inventory::SocketCount]; // RoF: Augment Slot 1-6 Unknown Most likely Powersource related
uint32 LDoNTheme;
uint32 LDoNPrice;
uint32 LDoNSold;
@@ -543,23 +531,15 @@ namespace EQEmu
char ScrollName[65];
//BardName
bool IsEquipable(uint16 Race, uint16 Class);
bool IsClassCommon();
bool IsClassBag();
bool IsClassBook();
bool IsType1HWeapon();
bool IsType2HWeapon();
bool IsTypeShield();
bool IsEquipable(uint16 Race, uint16 Class) const { return const_cast<ItemBase*>(this)->IsEquipable(Race, Class); }
bool IsClassCommon() const { return const_cast<ItemBase*>(this)->IsClassCommon(); }
bool IsClassBag() const { return const_cast<ItemBase*>(this)->IsClassBag(); }
bool IsClassBook() const { return const_cast<ItemBase*>(this)->IsClassBook(); }
bool IsType1HWeapon() const { return const_cast<ItemBase*>(this)->IsType1HWeapon(); }
bool IsType2HWeapon() const { return const_cast<ItemBase*>(this)->IsType2HWeapon(); }
bool IsTypeShield() const { return const_cast<ItemBase*>(this)->IsTypeShield(); }
bool IsEquipable(uint16 Race, uint16 Class) const;
bool IsClassCommon() const;
bool IsClassBag() const;
bool IsClassBook() const;
bool IsType1HWeapon() const;
bool IsType2HWeapon() const;
bool IsTypeShield() const;
};
} /*EQEmu*/
#endif /*COMMON_ITEM_BASE_H*/
#endif /*COMMON_ITEM_DATA_H*/
File diff suppressed because it is too large Load Diff
+332
View File
@@ -0,0 +1,332 @@
/* 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 04111-1307 USA
*/
// @merth notes:
// These classes could be optimized with database reads/writes by storing
// a status flag indicating how object needs to interact with database
#ifndef COMMON_ITEM_INSTANCE_H
#define COMMON_ITEM_INSTANCE_H
class ItemParse; // Parses item packets
class EvolveInfo; // Stores information about an evolving item family
#include "../common/eq_constants.h"
#include "../common/item_data.h"
#include "../common/timer.h"
#include "../common/bodytypes.h"
#include "../common/deity.h"
#include "../common/memory_buffer.h"
#include <map>
// Specifies usage type for item inside EQEmu::ItemInstance
enum ItemInstTypes
{
ItemInstNormal = 0,
ItemInstWorldContainer
};
typedef enum {
byFlagIgnore, //do not consider this flag
byFlagSet, //apply action if the flag is set
byFlagNotSet //apply action if the flag is NOT set
} byFlagSetting;
class SharedDatabase;
// ########################################
// Class: EQEmu::ItemInstance
// Base class for an instance of an item
// An item instance encapsulates item data + data specific
// to an item instance (includes dye, augments, charges, etc)
namespace EQEmu
{
class InventoryProfile;
class ItemInstance {
public:
/////////////////////////
// Methods
/////////////////////////
// Constructors/Destructor
ItemInstance(const ItemData* item = nullptr, int16 charges = 0);
ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges = 0);
ItemInstance(ItemInstTypes use_type);
ItemInstance(const ItemInstance& copy);
~ItemInstance();
// Query item type
bool IsType(item::ItemClass item_class) const;
bool IsClassCommon() const;
bool IsClassBag() const;
bool IsClassBook() const;
// Can item be stacked?
bool IsStackable() const;
bool IsCharged() const;
// Can item be equipped by/at?
bool IsEquipable(uint16 race, uint16 class_) const;
bool IsEquipable(int16 slot_id) const;
//
// Augments
//
bool IsAugmentable() const;
bool AvailableWearSlot(uint32 aug_wear_slots) const;
int8 AvailableAugmentSlot(int32 augtype) const;
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
inline int32 GetAugmentType() const { return ((m_item) ? m_item->AugType : 0); }
inline bool IsExpendable() const { return ((m_item) ? ((m_item->Click.Type == item::ItemEffectExpendable) || (m_item->ItemType == item::ItemTypePotion)) : false); }
//
// Contents
//
ItemInstance* GetItem(uint8 slot) const;
uint32 GetItemID(uint8 slot) const;
inline const ItemInstance* operator[](uint8 slot) const { return GetItem(slot); }
void PutItem(uint8 slot, const ItemInstance& inst);
void PutItem(SharedDatabase *db, uint8 slot, uint32 item_id) { return; } // not defined anywhere...
void DeleteItem(uint8 slot);
ItemInstance* PopItem(uint8 index);
void Clear();
void ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent);
uint8 FirstOpenSlot() const;
uint8 GetTotalItemCount() const;
bool IsNoneEmptyContainer();
std::map<uint8, ItemInstance*>* GetContents() { return &m_contents; }
//
// Augments
//
ItemInstance* GetAugment(uint8 slot) const;
uint32 GetAugmentItemID(uint8 slot) const;
void PutAugment(uint8 slot, const ItemInstance& inst);
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
void DeleteAugment(uint8 slot);
ItemInstance* RemoveAugment(uint8 index);
bool IsAugmented();
ItemInstance* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const ItemData *ItemToTry, const ItemData *Container, bool AllowAll = false);
// Has attack/delay?
bool IsWeapon() const;
bool IsAmmo() const;
// Accessors
const uint32 GetID() const { return ((m_item) ? m_item->ID : 0); }
const uint32 GetItemScriptID() const { return ((m_item) ? m_item->ScriptFileID : 0); }
const ItemData* GetItem() const;
const ItemData* GetUnscaledItem() const;
int16 GetCharges() const { return m_charges; }
void SetCharges(int16 charges) { m_charges = charges; }
uint32 GetPrice() const { return m_price; }
void SetPrice(uint32 price) { m_price = price; }
void SetColor(uint32 color) { m_color = color; }
uint32 GetColor() const { return m_color; }
uint32 GetMerchantSlot() const { return m_merchantslot; }
void SetMerchantSlot(uint32 slot) { m_merchantslot = slot; }
int32 GetMerchantCount() const { return m_merchantcount; }
void SetMerchantCount(int32 count) { m_merchantcount = count; }
int16 GetCurrentSlot() const { return m_currentslot; }
void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; }
// Is this item already attuned?
bool IsAttuned() const { return m_attuned; }
void SetAttuned(bool flag) { m_attuned = flag; }
std::string GetCustomDataString() const;
std::string GetCustomData(std::string identifier);
void SetCustomData(std::string identifier, std::string value);
void SetCustomData(std::string identifier, int value);
void SetCustomData(std::string identifier, float value);
void SetCustomData(std::string identifier, bool value);
void DeleteCustomData(std::string identifier);
// Allows treatment of this object as though it were a pointer to m_item
operator bool() const { return (m_item != nullptr); }
// Compare inner Item_Struct of two ItemInstance objects
bool operator==(const ItemInstance& right) const { return (this->m_item == right.m_item); }
bool operator!=(const ItemInstance& right) const { return (this->m_item != right.m_item); }
// Clone current item
ItemInstance* Clone() const;
bool IsSlotAllowed(int16 slot_id) const;
bool IsScaling() const { return m_scaling; }
bool IsEvolving() const { return (m_evolveLvl >= 1); }
uint32 GetExp() const { return m_exp; }
void SetExp(uint32 exp) { m_exp = exp; }
void AddExp(uint32 exp) { m_exp += exp; }
bool IsActivated() { return m_activated; }
void SetActivated(bool activated) { m_activated = activated; }
int8 GetEvolveLvl() const { return m_evolveLvl; }
void SetScaling(bool v) { m_scaling = v; }
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
uint32 GetOrnamentationIDFile() const { return m_ornamentidfile; }
void SetOrnamentationIDFile(uint32 ornament_idfile) { m_ornamentidfile = ornament_idfile; }
uint32 GetOrnamentHeroModel(int32 material_slot = -1) const;
void SetOrnamentHeroModel(uint32 ornament_hero_model) { m_ornament_hero_model = ornament_hero_model; }
uint32 GetRecastTimestamp() const { return m_recast_timestamp; }
void SetRecastTimestamp(uint32 in) { m_recast_timestamp = in; }
void Initialize(SharedDatabase *db = nullptr);
void ScaleItem();
bool EvolveOnAllKills() const;
int8 GetMaxEvolveLvl() const;
uint32 GetKillsNeeded(uint8 currentlevel);
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
inline int32 GetSerialNumber() const { return m_SerialNumber; }
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
std::map<std::string, Timer>& GetTimers() { return m_timers; }
void SetTimer(std::string name, uint32 time);
void StopTimer(std::string name);
void ClearTimers();
// Get a total of a stat, including augs
// These functions should be used in place of other code manually totaling
// to centralize where it is done to make future changes easier (ex. whenever powersources come around)
// and to minimize errors. CalcItemBonuses however doesn't use these in interest of performance
// by default these do not recurse into augs
int GetItemArmorClass(bool augments = false) const;
int GetItemElementalDamage(int &magic, int &fire, int &cold, int &poison, int &disease, int &chromatic, int &prismatic, int &physical, int &corruption, bool augments = false) const;
// These two differ in the fact that they're quick checks (they are checked BEFORE the one above
int GetItemElementalFlag(bool augments = false) const;
int GetItemElementalDamage(bool augments = false) const;
int GetItemRecommendedLevel(bool augments = false) const;
int GetItemRequiredLevel(bool augments = false) const;
int GetItemWeaponDamage(bool augments = false) const;
int GetItemBackstabDamage(bool augments = false) const;
// these two are just quick checks
int GetItemBaneDamageBody(bool augments = false) const;
int GetItemBaneDamageRace(bool augments = false) const;
int GetItemBaneDamageBody(bodyType against, bool augments = false) const;
int GetItemBaneDamageRace(uint16 against, bool augments = false) const;
int GetItemMagical(bool augments = false) const;
int GetItemHP(bool augments = false) const;
int GetItemMana(bool augments = false) const;
int GetItemEndur(bool augments = false) const;
int GetItemAttack(bool augments = false) const;
int GetItemStr(bool augments = false) const;
int GetItemSta(bool augments = false) const;
int GetItemDex(bool augments = false) const;
int GetItemAgi(bool augments = false) const;
int GetItemInt(bool augments = false) const;
int GetItemWis(bool augments = false) const;
int GetItemCha(bool augments = false) const;
int GetItemMR(bool augments = false) const;
int GetItemFR(bool augments = false) const;
int GetItemCR(bool augments = false) const;
int GetItemPR(bool augments = false) const;
int GetItemDR(bool augments = false) const;
int GetItemCorrup(bool augments = false) const;
int GetItemHeroicStr(bool augments = false) const;
int GetItemHeroicSta(bool augments = false) const;
int GetItemHeroicDex(bool augments = false) const;
int GetItemHeroicAgi(bool augments = false) const;
int GetItemHeroicInt(bool augments = false) const;
int GetItemHeroicWis(bool augments = false) const;
int GetItemHeroicCha(bool augments = false) const;
int GetItemHeroicMR(bool augments = false) const;
int GetItemHeroicFR(bool augments = false) const;
int GetItemHeroicCR(bool augments = false) const;
int GetItemHeroicPR(bool augments = false) const;
int GetItemHeroicDR(bool augments = false) const;
int GetItemHeroicCorrup(bool augments = false) const;
int GetItemHaste(bool augments = false) const;
protected:
//////////////////////////
// Protected Members
//////////////////////////
friend class InventoryProfile;
std::map<uint8, ItemInstance*>::const_iterator _cbegin() { return m_contents.cbegin(); }
std::map<uint8, ItemInstance*>::const_iterator _cend() { return m_contents.cend(); }
void _PutItem(uint8 index, ItemInstance* inst) { m_contents[index] = inst; }
ItemInstTypes m_use_type; // Usage type for item
const ItemData* m_item; // Ptr to item data
int16 m_charges; // # of charges for chargeable items
uint32 m_price; // Bazaar /trader price
uint32 m_color;
uint32 m_merchantslot;
int16 m_currentslot;
bool m_attuned;
int32 m_merchantcount; //number avaliable on the merchant, -1=unlimited
int32 m_SerialNumber; // Unique identifier for this instance of an item. Needed for Bazaar.
uint32 m_exp;
int8 m_evolveLvl;
bool m_activated;
ItemData* m_scaledItem;
::EvolveInfo* m_evolveInfo;
bool m_scaling;
uint32 m_ornamenticon;
uint32 m_ornamentidfile;
uint32 m_ornament_hero_model;
uint32 m_recast_timestamp;
//
// Items inside of this item (augs or contents);
std::map<uint8, ItemInstance*> m_contents; // Zero-based index: min=0, max=9
std::map<std::string, std::string> m_custom_data;
std::map<std::string, Timer> m_timers;
};
}
class EvolveInfo {
public:
friend class EQEmu::ItemInstance;
//temporary
uint16 LvlKills[9];
uint32 FirstItem;
uint8 MaxLvl;
bool AllKills;
EvolveInfo();
EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10);
~EvolveInfo();
};
#endif /*COMMON_ITEM_INSTANCE_H*/
+98 -83
View File
@@ -29,7 +29,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../inventory_profile.h"
#include "rof_structs.h"
#include "../rulesys.h"
@@ -45,7 +45,7 @@ namespace RoF
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters
static inline structs::InventorySlot_Struct ServerToRoFSlot(uint32 serverSlot);
@@ -66,6 +66,9 @@ namespace RoF
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot);
static inline int ServerToRoFBuffSlot(int index);
static inline int RoFToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -423,15 +426,8 @@ namespace RoF
OUT(buff.y);
OUT(buff.x);
OUT(buff.z);
uint16 buffslot = emu->slotid;
// Not sure if this is needs amending for RoF yet.
if (buffslot >= 25)
{
buffslot += 17;
}
// TODO: implement slot_data stuff
eq->slotid = buffslot;
eq->slotid = ServerToRoFBuffSlot(emu->slotid);
if (emu->bufffade == 1)
eq->bufffade = 1;
@@ -447,10 +443,10 @@ namespace RoF
outapp->WriteUInt32(0); // tic timer
outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ?
outapp->WriteUInt16(1); // 1 buff in this packet
outapp->WriteUInt32(buffslot);
outapp->WriteUInt32(eq->slotid);
outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove)
outapp->WriteUInt32(0); // Duration
outapp->WriteUInt32(0); // ?
outapp->WriteUInt32(0); // numhits
outapp->WriteUInt8(0); // Caster name
outapp->WriteUInt8(0); // Type
}
@@ -474,17 +470,9 @@ namespace RoF
__packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff)
__packet->WriteUInt16(emu->count);
for (uint16 i = 0; i < emu->count; ++i)
for (int i = 0; i < emu->count; ++i)
{
uint16 buffslot = emu->entries[i].buff_slot;
if (emu->type == 0) { // only correct for self packets
if (emu->entries[i].buff_slot >= 25)
buffslot += 17;
if (buffslot == 54)
buffslot = 62;
}
__packet->WriteUInt32(buffslot);
__packet->WriteUInt32(emu->type == 0 ? ServerToRoFBuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot);
__packet->WriteUInt32(emu->entries[i].spell_id);
__packet->WriteUInt32(emu->entries[i].tics_remaining);
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
@@ -596,7 +584,7 @@ namespace RoF
ob.write((const char*)&item_count, sizeof(uint32));
for (int index = 0; index < item_count; ++index, ++eq) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -1533,7 +1521,7 @@ namespace RoF
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -2079,7 +2067,7 @@ namespace RoF
outapp->WriteUInt32(22); // Equipment count
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++)
{
outapp->WriteUInt32(emu->item_material.Slot[r].Material);
outapp->WriteUInt32(0);
@@ -2099,9 +2087,9 @@ namespace RoF
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Equipment2 count
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2110,7 +2098,7 @@ namespace RoF
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint Count
for (int r = 0; r < 7; r++)
{
@@ -2120,7 +2108,7 @@ namespace RoF
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint2 Count
for (int r = 0; r < 7; r++)
{
@@ -3059,12 +3047,12 @@ namespace RoF
eq_cse->Gender = emu_cse->Gender;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::materialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HerosForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
@@ -4096,7 +4084,7 @@ namespace RoF
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
@@ -4105,15 +4093,15 @@ namespace RoF
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Material2;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HerosForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2;
}
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
}
else
{
@@ -4312,7 +4300,7 @@ namespace RoF
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
IN(slotid);
emu->slotid = RoFToServerBuffSlot(eq->slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
@@ -4325,7 +4313,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct);
SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct);
emu->SlotID = (eq->SlotID < 42) ? eq->SlotID : (eq->SlotID - 17);
emu->SlotID = RoFToServerBuffSlot(eq->SlotID);
IN(EntityID);
@@ -4829,10 +4817,9 @@ namespace RoF
IN(item_id);
int r;
for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) {
for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) {
IN(augments[r]);
}
// Max Augs is now 6, but no code to support that many yet
IN(link_hash);
IN(icon);
@@ -5209,9 +5196,9 @@ namespace RoF
return NextItemInstSerialNumber;
}
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
const EQEmu::ItemData *item = inst->GetUnscaledItem();
RoF::structs::ItemSerializationHeader hdr;
@@ -5265,7 +5252,7 @@ namespace RoF
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in));
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
@@ -5622,18 +5609,18 @@ namespace RoF
ob.write((const char*)&subitem_count, sizeof(uint32));
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
ItemInst* sub = inst->GetItem(index);
for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) {
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
int SubSlotNumber = INVALID_INDEX;
if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1);
SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1);
else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
else
SubSlotNumber = slot_id_in;
@@ -5659,17 +5646,17 @@ namespace RoF
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor
if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor
RoFSlot.Type = invtype::InvTypePossessions;
RoFSlot.Slot = serverSlot;
if (serverSlot == EQEmu::legacy::SlotPowerSource)
if (serverSlot == EQEmu::inventory::slotPowerSource)
RoFSlot.Slot = invslot::PossessionsPowerSource;
else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory
RoFSlot.Slot += 3;
else if (serverSlot >= EQEmu::legacy::SlotAmmo) // (> 20)
else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20)
RoFSlot.Slot += 1;
}
@@ -5681,8 +5668,8 @@ namespace RoF
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341)
RoFSlot.Type = invtype::InvTypePossessions;
TempSlot = serverSlot - 1;
RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount);
if (RoFSlot.Slot >= invslot::PossessionsGeneral9) // (> 30)
RoFSlot.Slot = invslot::PossessionsCursor;
@@ -5699,8 +5686,8 @@ namespace RoF
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
}
@@ -5710,8 +5697,8 @@ namespace RoF
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
}
@@ -5721,8 +5708,8 @@ namespace RoF
RoFSlot.Slot = TempSlot;
if (TempSlot > 30) {
RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
/*
@@ -5760,16 +5747,16 @@ namespace RoF
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // (< 52)
if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52)
RoFSlot.Slot = serverSlot;
if (serverSlot == EQEmu::legacy::SlotPowerSource)
if (serverSlot == EQEmu::inventory::slotPowerSource)
RoFSlot.Slot = invslot::PossessionsPowerSource;
else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory
RoFSlot.Slot += 3;
else if (serverSlot >= EQEmu::legacy::SlotAmmo) // Ammo and Personl Inventory
else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory
RoFSlot.Slot += 1;
/*else if (ServerSlot >= MainCursor) { // Cursor
@@ -5782,8 +5769,8 @@ namespace RoF
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) {
TempSlot = serverSlot - 1;
RoFSlot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoFSlot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2;
RoFSlot.SubIndex = TempSlot - ((RoFSlot.Slot + 2) * EQEmu::inventory::ContainerCount);
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoFSlot.Slot, RoFSlot.SubIndex, RoFSlot.AugIndex, RoFSlot.Unknown01);
@@ -5803,7 +5790,7 @@ namespace RoF
if (rofSlot.Type == invtype::InvTypePossessions && rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rofSlot.Slot == invslot::PossessionsPowerSource)
TempSlot = EQEmu::legacy::SlotPowerSource;
TempSlot = EQEmu::inventory::slotPowerSource;
else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.Slot - 3;
@@ -5825,8 +5812,8 @@ namespace RoF
else // Worn Slots
TempSlot = rofSlot.Slot;
if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1;
if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1;
ServerSlot = TempSlot;
}
@@ -5834,8 +5821,8 @@ namespace RoF
else if (rofSlot.Type == invtype::InvTypeBank) {
TempSlot = EQEmu::legacy::BANK_BEGIN;
if (rofSlot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1;
if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1;
else
TempSlot += rofSlot.Slot;
@@ -5846,8 +5833,8 @@ namespace RoF
else if (rofSlot.Type == invtype::InvTypeSharedBank) {
TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN;
if (rofSlot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1;
if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1;
else
TempSlot += rofSlot.Slot;
@@ -5858,10 +5845,10 @@ namespace RoF
else if (rofSlot.Type == invtype::InvTypeTrade) {
TempSlot = EQEmu::legacy::TRADE_BEGIN;
if (rofSlot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1;
if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rofSlot.Slot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1;
// OLD CODE:
//TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::legacy::ITEM_CONTAINER_SIZE) + RoFSlot.SubSlot;
//TempSlot += 100 + (RoFSlot.MainSlot * EQEmu::inventory::ContainerCount) + RoFSlot.SubSlot;
else
TempSlot += rofSlot.Slot;
@@ -5872,7 +5859,7 @@ namespace RoF
else if (rofSlot.Type == invtype::InvTypeWorld) {
TempSlot = EQEmu::legacy::WORLD_BEGIN;
if (rofSlot.Slot >= SUB_INDEX_BEGIN)
if (rofSlot.Slot >= EQEmu::inventory::containerBegin)
TempSlot += rofSlot.Slot;
ServerSlot = TempSlot;
@@ -5903,7 +5890,7 @@ namespace RoF
if (rofSlot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rofSlot.Slot == invslot::PossessionsPowerSource)
TempSlot = EQEmu::legacy::SlotPowerSource;
TempSlot = EQEmu::inventory::slotPowerSource;
else if (rofSlot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory
TempSlot = rofSlot.Slot - 3;
@@ -5920,8 +5907,8 @@ namespace RoF
else
TempSlot = rofSlot.Slot;
if (rofSlot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rofSlot.SubIndex + 1;
if (rofSlot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rofSlot.SubIndex + 1;
ServerSlot = TempSlot;
}
@@ -6085,4 +6072,32 @@ namespace RoF
return EQEmu::CastingSlot::Discipline;
}
}
// these should be optimized out for RoF since they should all boil down to return index :P
// but lets leave it here for future proofing
static inline int ServerToRoFBuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int RoFToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*RoF*/
+97 -88
View File
@@ -29,7 +29,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../inventory_profile.h"
#include "rof2_structs.h"
#include "../rulesys.h"
@@ -45,7 +45,7 @@ namespace RoF2
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth, ItemPacketType packet_type);
// server to client inventory location converters
static inline structs::InventorySlot_Struct ServerToRoF2Slot(uint32 serverSlot, ItemPacketType PacketType = ItemPacketInvalid);
@@ -66,6 +66,9 @@ namespace RoF2
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot);
static inline int ServerToRoF2BuffSlot(int index);
static inline int RoF2ToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -492,18 +495,7 @@ namespace RoF2
OUT(buff.y);
OUT(buff.x);
OUT(buff.z);
uint16 buffslot = emu->slotid;
// Not sure if this is needs amending for RoF2 yet.
if (buffslot >= 25)
{
buffslot += 17;
}
// TODO: We should really just deal with these "server side"
// so we can have clients not limited to other clients.
// This fixes discs, songs were changed to 20
if (buffslot == 54)
buffslot = 62;
eq->slotid = buffslot;
eq->slotid = ServerToRoF2BuffSlot(emu->slotid);
// TODO: implement slot_data stuff
if (emu->bufffade == 1)
eq->bufffade = 1;
@@ -519,10 +511,10 @@ namespace RoF2
outapp->WriteUInt32(0); // tic timer
outapp->WriteUInt8(0); // Type of OP_BuffCreate packet ?
outapp->WriteUInt16(1); // 1 buff in this packet
outapp->WriteUInt32(buffslot);
outapp->WriteUInt32(eq->slotid);
outapp->WriteUInt32(0xffffffff); // SpellID (0xffff to remove)
outapp->WriteUInt32(0); // Duration
outapp->WriteUInt32(0); // ?
outapp->WriteUInt32(0); // numhits
outapp->WriteUInt8(0); // Caster name
outapp->WriteUInt8(0); // Type
}
@@ -546,20 +538,9 @@ namespace RoF2
__packet->WriteUInt8(emu->all_buffs); // 1 indicates all buffs on the player (0 to add or remove a single buff)
__packet->WriteUInt16(emu->count);
for (uint16 i = 0; i < emu->count; ++i)
for (int i = 0; i < emu->count; ++i)
{
uint16 buffslot = emu->entries[i].buff_slot;
if (emu->type == 0) { // only correct for self packets
if (emu->entries[i].buff_slot >= 25)
buffslot += 17;
// TODO: We should really just deal with these "server side"
// so we can have clients not limited to other clients.
// This fixes discs, songs were changed to 20
if (buffslot == 54)
buffslot = 62;
}
__packet->WriteUInt32(buffslot);
__packet->WriteUInt32(emu->type == 0 ? ServerToRoF2BuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot);
__packet->WriteUInt32(emu->entries[i].spell_id);
__packet->WriteUInt32(emu->entries[i].tics_remaining);
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
@@ -671,7 +652,7 @@ namespace RoF2
ob.write((const char*)&item_count, sizeof(uint32));
for (int index = 0; index < item_count; ++index, ++eq) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0, ItemPacketCharInventory);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -1609,7 +1590,7 @@ namespace RoF2
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -2164,7 +2145,7 @@ namespace RoF2
outapp->WriteUInt32(22); // Equipment count
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++)
{
outapp->WriteUInt32(emu->item_material.Slot[r].Material);
outapp->WriteUInt32(0);
@@ -2184,9 +2165,9 @@ namespace RoF2
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Equipment2 count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Equipment2 count
for (int r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++)
for (int r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++)
{
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
@@ -2195,7 +2176,7 @@ namespace RoF2
outapp->WriteUInt32(0);
}
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint Count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint Count
for (int r = 0; r < 7; r++)
{
@@ -2205,7 +2186,7 @@ namespace RoF2
outapp->WriteUInt32(0);
outapp->WriteUInt32(0);
outapp->WriteUInt32(EQEmu::textures::TextureCount); // Tint2 Count
outapp->WriteUInt32(EQEmu::textures::materialCount); // Tint2 Count
for (int r = 0; r < 7; r++)
{
@@ -3154,12 +3135,12 @@ namespace RoF2
eq_cse->Gender = emu_cse->Gender;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
for (int equip_index = 0; equip_index < EQEmu::textures::materialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HeroForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Material2;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel;
eq_cse->Equip[equip_index].HeroForgeModel = emu_cse->Equip[equip_index].HerosForgeModel;
eq_cse->Equip[equip_index].Material2 = emu_cse->Equip[equip_index].Unknown2;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
@@ -4321,7 +4302,7 @@ namespace RoF2
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
@@ -4330,15 +4311,15 @@ namespace RoF2
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HeroForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Material2;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel;
Equipment[k].HeroForgeModel = emu->equipment.Slot[k].HerosForgeModel;
Equipment[k].Material2 = emu->equipment.Slot[k].Unknown2;
}
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
}
else
{
@@ -4550,7 +4531,7 @@ namespace RoF2
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
IN(slotid);
emu->slotid = RoF2ToServerBuffSlot(eq->slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
@@ -4563,7 +4544,7 @@ namespace RoF2
DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct);
SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct);
emu->SlotID = (eq->SlotID < 42) ? eq->SlotID : (eq->SlotID - 17);
emu->SlotID = RoF2ToServerBuffSlot(eq->SlotID);
IN(EntityID);
@@ -5066,7 +5047,7 @@ namespace RoF2
IN(item_id);
int r;
for (r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) {
for (r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) {
IN(augments[r]);
}
IN(link_hash);
@@ -5499,9 +5480,9 @@ namespace RoF2
return NextItemInstSerialNumber;
}
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth, ItemPacketType packet_type)
{
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
const EQEmu::ItemData *item = inst->GetUnscaledItem();
RoF2::structs::ItemSerializationHeader hdr;
@@ -5555,7 +5536,7 @@ namespace RoF2
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
heroModel = inst->GetOrnamentHeroModel(EQEmu::InventoryProfile::CalcMaterialFromSlot(slot_id_in));
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
@@ -5922,18 +5903,18 @@ namespace RoF2
ob.write((const char*)&subitem_count, sizeof(uint32));
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
ItemInst* sub = inst->GetItem(index);
for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) {
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
int SubSlotNumber = INVALID_INDEX;
if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1);
SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1);
else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
else
SubSlotNumber = slot_id_in;
@@ -5959,7 +5940,7 @@ namespace RoF2
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // Main Inventory and Cursor
if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // Main Inventory and Cursor
if (PacketType == ItemPacketLoot)
{
RoF2Slot.Type = invtype::InvTypeCorpse;
@@ -5971,13 +5952,13 @@ namespace RoF2
RoF2Slot.Slot = serverSlot;
}
if (serverSlot == EQEmu::legacy::SlotPowerSource)
if (serverSlot == EQEmu::inventory::slotPowerSource)
RoF2Slot.Slot = invslot::PossessionsPowerSource;
else if (serverSlot >= EQEmu::legacy::SlotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory
else if (serverSlot >= EQEmu::inventory::slotCursor && PacketType != ItemPacketLoot) // Cursor and Extended Corpse Inventory
RoF2Slot.Slot += 3;
else if (serverSlot >= EQEmu::legacy::SlotAmmo) // (> 20)
else if (serverSlot >= EQEmu::inventory::slotAmmo) // (> 20)
RoF2Slot.Slot += 1;
}
@@ -5989,8 +5970,8 @@ namespace RoF2
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) { // (> 250 && < 341)
RoF2Slot.Type = invtype::InvTypePossessions;
TempSlot = serverSlot - 1;
RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount);
if (RoF2Slot.Slot >= invslot::PossessionsGeneral9) // (> 30)
RoF2Slot.Slot = invslot::PossessionsCursor;
@@ -6007,8 +5988,8 @@ namespace RoF2
RoF2Slot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
}
@@ -6018,8 +5999,8 @@ namespace RoF2
RoF2Slot.Slot = TempSlot;
if (TempSlot > 30) { // (> 30)
RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
}
@@ -6029,8 +6010,8 @@ namespace RoF2
RoF2Slot.Slot = TempSlot;
if (TempSlot > 30) {
RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 3;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 3) * EQEmu::inventory::ContainerCount);
}
/*
@@ -6068,16 +6049,16 @@ namespace RoF2
uint32 TempSlot = 0;
if (serverSlot < 56 || serverSlot == EQEmu::legacy::SlotPowerSource) { // (< 52)
if (serverSlot < 56 || serverSlot == EQEmu::inventory::slotPowerSource) { // (< 52)
RoF2Slot.Slot = serverSlot;
if (serverSlot == EQEmu::legacy::SlotPowerSource)
if (serverSlot == EQEmu::inventory::slotPowerSource)
RoF2Slot.Slot = invslot::PossessionsPowerSource;
else if (serverSlot >= EQEmu::legacy::SlotCursor) // Cursor and Extended Corpse Inventory
else if (serverSlot >= EQEmu::inventory::slotCursor) // Cursor and Extended Corpse Inventory
RoF2Slot.Slot += 3;
else if (serverSlot >= EQEmu::legacy::SlotAmmo) // Ammo and Personl Inventory
else if (serverSlot >= EQEmu::inventory::slotAmmo) // Ammo and Personl Inventory
RoF2Slot.Slot += 1;
/*else if (ServerSlot >= MainCursor) { // Cursor
@@ -6090,8 +6071,8 @@ namespace RoF2
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END) {
TempSlot = serverSlot - 1;
RoF2Slot.Slot = int(TempSlot / EQEmu::legacy::ITEM_CONTAINER_SIZE) - 2;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::legacy::ITEM_CONTAINER_SIZE);
RoF2Slot.Slot = int(TempSlot / EQEmu::inventory::ContainerCount) - 2;
RoF2Slot.SubIndex = TempSlot - ((RoF2Slot.Slot + 2) * EQEmu::inventory::ContainerCount);
}
Log.Out(Logs::General, Logs::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", serverSlot, RoF2Slot.Slot, RoF2Slot.SubIndex, RoF2Slot.AugIndex, RoF2Slot.Unknown01);
@@ -6111,7 +6092,7 @@ namespace RoF2
if (rof2Slot.Type == invtype::InvTypePossessions && rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 51)
if (rof2Slot.Slot == invslot::PossessionsPowerSource)
TempSlot = EQEmu::legacy::SlotPowerSource;
TempSlot = EQEmu::inventory::slotPowerSource;
else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory
TempSlot = rof2Slot.Slot - 3;
@@ -6133,8 +6114,8 @@ namespace RoF2
else // Worn Slots
TempSlot = rof2Slot.Slot;
if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1;
if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1;
ServerSlot = TempSlot;
}
@@ -6142,8 +6123,8 @@ namespace RoF2
else if (rof2Slot.Type == invtype::InvTypeBank) {
TempSlot = EQEmu::legacy::BANK_BEGIN;
if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1;
if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1;
else
TempSlot += rof2Slot.Slot;
@@ -6154,8 +6135,8 @@ namespace RoF2
else if (rof2Slot.Type == invtype::InvTypeSharedBank) {
TempSlot = EQEmu::legacy::SHARED_BANK_BEGIN;
if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1;
if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1;
else
TempSlot += rof2Slot.Slot;
@@ -6166,8 +6147,8 @@ namespace RoF2
else if (rof2Slot.Type == invtype::InvTypeTrade) {
TempSlot = EQEmu::legacy::TRADE_BEGIN;
if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1;
if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin)
TempSlot += ((rof2Slot.Slot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1;
// OLD CODE:
//TempSlot += 100 + (RoF2Slot.MainSlot * EmuConstants::ITEM_CONTAINER_SIZE) + RoF2Slot.SubSlot;
@@ -6180,7 +6161,7 @@ namespace RoF2
else if (rof2Slot.Type == invtype::InvTypeWorld) {
TempSlot = EQEmu::legacy::WORLD_BEGIN;
if (rof2Slot.Slot >= SUB_INDEX_BEGIN)
if (rof2Slot.Slot >= EQEmu::inventory::containerBegin)
TempSlot += rof2Slot.Slot;
ServerSlot = TempSlot;
@@ -6215,7 +6196,7 @@ namespace RoF2
if (rof2Slot.Slot < 57) { // Worn/Personal Inventory and Cursor (< 33)
if (rof2Slot.Slot == invslot::PossessionsPowerSource)
TempSlot = EQEmu::legacy::SlotPowerSource;
TempSlot = EQEmu::inventory::slotPowerSource;
else if (rof2Slot.Slot >= invslot::PossessionsCursor) // Cursor and Extended Corpse Inventory
TempSlot = rof2Slot.Slot - 3;
@@ -6232,8 +6213,8 @@ namespace RoF2
else
TempSlot = rof2Slot.Slot;
if (rof2Slot.SubIndex >= SUB_INDEX_BEGIN) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + rof2Slot.SubIndex + 1;
if (rof2Slot.SubIndex >= EQEmu::inventory::containerBegin) // Bag Slots
TempSlot = ((TempSlot + 3) * EQEmu::inventory::ContainerCount) + rof2Slot.SubIndex + 1;
ServerSlot = TempSlot;
}
@@ -6388,4 +6369,32 @@ namespace RoF2
return EQEmu::CastingSlot::Discipline;
}
}
// these should be optimized out for RoF2 since they should all boil down to return index :P
// but lets leave it here for future proofing
static inline int ServerToRoF2BuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int RoF2ToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*RoF2*/
+8
View File
@@ -277,6 +277,14 @@ namespace RoF2
const size_t SayLinkBodySize = 56;
const int LongBuffs = 42;
const int ShortBuffs = 20;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 97;
const int PetBuffs = NPCBuffs;
const int MercBuffs = LongBuffs;
} /*constants*/
namespace behavior {
+3 -3
View File
@@ -190,7 +190,7 @@ struct TintProfile
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -1082,7 +1082,7 @@ union
/*00184*/ Texture_Struct equipment[22]; // Total Slots
};
/*00624*/ uint32 equip2_count; // Seen 9
/*00628*/ Texture_Struct equipment2[EQEmu::textures::TextureCount]; // Appears to be Visible slots, but all 0s
/*00628*/ Texture_Struct equipment2[EQEmu::textures::materialCount]; // Appears to be Visible slots, but all 0s
/*00808*/ uint32 tint_count; // Seen 9
/*00812*/ TintProfile item_tint; // RR GG BB 00
/*00848*/ uint32 tint_count2; // Seen 9
@@ -2423,7 +2423,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
ItemBase item;
ItemData item;
uint8 iss_unknown001[6];
};*/
+8
View File
@@ -268,6 +268,14 @@ namespace RoF
const size_t SayLinkBodySize = 55;
const int LongBuffs = 42;
const int ShortBuffs = 20;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 97;
const int PetBuffs = NPCBuffs;
const int MercBuffs = LongBuffs;
} /*constants*/
namespace behavior {
+2 -2
View File
@@ -190,7 +190,7 @@ struct TintProfile
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -2450,7 +2450,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
ItemBase item;
ItemData item;
uint8 iss_unknown001[6];
};*/
+54 -25
View File
@@ -29,7 +29,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../item_instance.h"
#include "sod_structs.h"
#include "../rulesys.h"
@@ -43,7 +43,7 @@ namespace SoD
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters
static inline uint32 ServerToSoDSlot(uint32 ServerSlot);
@@ -62,6 +62,9 @@ namespace SoD
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
static inline int ServerToSoDBuffSlot(int index);
static inline int SoDToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -315,7 +318,7 @@ namespace SoD
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
eq->slotid = ServerToSoDBuffSlot(emu->slotid);
OUT(bufffade);
FINISH_ENCODE();
@@ -396,7 +399,7 @@ namespace SoD
ob.write((const char*)&item_count, sizeof(uint32));
for (int index = 0; index < item_count; ++index, ++eq) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -1060,7 +1063,7 @@ namespace SoD
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -1558,7 +1561,7 @@ namespace SoD
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
@@ -1998,10 +2001,10 @@ namespace SoD
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
@@ -2568,7 +2571,7 @@ namespace SoD
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
{
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
if (emu->size == 0)
{
@@ -2765,7 +2768,7 @@ namespace SoD
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
@@ -2792,13 +2795,13 @@ namespace SoD
{
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
Equipment[k].Material = emu->equipment.Slot[k].Material;
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel;
}
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
}
if (strlen(emu->title))
{
@@ -2921,8 +2924,8 @@ namespace SoD
IN(buff.bard_modifier);
IN(buff.spellid);
IN(buff.duration);
IN(buff.counters)
IN(slotid);
IN(buff.counters);
emu->slotid = SoDToServerBuffSlot(eq->slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
@@ -3553,9 +3556,9 @@ namespace SoD
return NextItemInstSerialNumber;
}
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
const EQEmu::ItemData *item = inst->GetUnscaledItem();
SoD::structs::ItemSerializationHeader hdr;
@@ -3869,18 +3872,18 @@ namespace SoD
ob.write((const char*)&subitem_count, sizeof(uint32));
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
ItemInst* sub = inst->GetItem(index);
for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) {
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
int SubSlotNumber = INVALID_INDEX;
if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1);
SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1);
else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
else
SubSlotNumber = slot_id_in;
@@ -3898,7 +3901,7 @@ namespace SoD
{
uint32 SoDSlot = 0;
if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoDSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END)
SoDSlot = serverSlot + 11;
@@ -3906,7 +3909,7 @@ namespace SoD
SoDSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END)
SoDSlot = serverSlot + 1;
else if (serverSlot == EQEmu::legacy::SlotPowerSource)
else if (serverSlot == EQEmu::inventory::slotPowerSource)
SoDSlot = invslot::PossessionsPowerSource;
else
SoDSlot = serverSlot;
@@ -3932,7 +3935,7 @@ namespace SoD
else if (sodSlot >= invbag::SharedBankBagsBegin && sodSlot <= invbag::SharedBankBagsEnd)
ServerSlot = sodSlot - 1;
else if (sodSlot == invslot::PossessionsPowerSource)
ServerSlot = EQEmu::legacy::SlotPowerSource;
ServerSlot = EQEmu::inventory::slotPowerSource;
else
ServerSlot = sodSlot;
return ServerSlot;
@@ -4088,4 +4091,30 @@ namespace SoD
return EQEmu::CastingSlot::Discipline;
}
}
static inline int ServerToSoDBuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int SoDToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*SoD*/
+8
View File
@@ -295,6 +295,14 @@ namespace SoD
const size_t SayLinkBodySize = 50;
const int LongBuffs = 25;
const int ShortBuffs = 15;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 85;
const int PetBuffs = NPCBuffs;
const int MercBuffs = LongBuffs;
} /*constants*/
namespace behavior {
+4 -4
View File
@@ -149,7 +149,7 @@ struct TintProfile
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -178,7 +178,7 @@ struct TextureProfile
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
Texture_Struct Slot[EQEmu::textures::materialCount];
};
TextureProfile();
@@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
@@ -1970,7 +1970,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
ItemBase item;
ItemData item;
uint8 iss_unknown001[6];
};*/
+51 -22
View File
@@ -29,7 +29,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../item_instance.h"
#include "sof_structs.h"
#include "../rulesys.h"
@@ -43,7 +43,7 @@ namespace SoF
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters
static inline uint32 ServerToSoFSlot(uint32 serverSlot);
@@ -62,6 +62,9 @@ namespace SoF
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
static inline int ServerToSoFBuffSlot(int index);
static inline int SoFToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -297,7 +300,7 @@ namespace SoF
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
eq->slotid = ServerToSoFBuffSlot(emu->slotid);
OUT(bufffade);
FINISH_ENCODE();
@@ -378,7 +381,7 @@ namespace SoF
ob.write((const char*)&item_count, sizeof(uint32));
for (int index = 0; index < item_count; ++index, ++eq) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -857,7 +860,7 @@ namespace SoF
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -1230,7 +1233,7 @@ namespace SoF
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
@@ -1670,10 +1673,10 @@ namespace SoF
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
@@ -2101,10 +2104,10 @@ namespace SoF
eq->deity = emu->deity;
eq->drakkin_heritage = emu->drakkin_heritage;
eq->gender = emu->gender;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material;
eq->equipment.Slot[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
eq->equipment.Slot[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
eq->equipment.Slot[k].EliteMaterial = emu->equipment.Slot[k].EliteModel;
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
eq->StandState = emu->StandState;
@@ -2167,7 +2170,7 @@ namespace SoF
strcpy(eq->name, emu->name);
eq->petOwnerId = emu->petOwnerId;
eq->pvp = 0; // 0 = non-pvp colored name, 1 = red pvp name
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
eq->anon = emu->anon;
@@ -2375,7 +2378,7 @@ namespace SoF
IN(buff.duration);
IN(buff.counters);
IN(buff.player_id);
IN(slotid);
emu->slotid = SoFToServerBuffSlot(eq->slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
@@ -2923,9 +2926,9 @@ namespace SoF
return NextItemInstSerialNumber;
}
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
const EQEmu::ItemData *item = inst->GetUnscaledItem();
SoF::structs::ItemSerializationHeader hdr;
@@ -3237,18 +3240,18 @@ namespace SoF
ob.write((const char*)&subitem_count, sizeof(uint32));
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
ItemInst* sub = inst->GetItem(index);
for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) {
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
int SubSlotNumber = INVALID_INDEX;
if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1);
SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1);
else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
else
SubSlotNumber = slot_id_in;
@@ -3266,7 +3269,7 @@ namespace SoF
{
uint32 SoFSlot = 0;
if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
SoFSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END)
SoFSlot = serverSlot + 11;
@@ -3274,7 +3277,7 @@ namespace SoF
SoFSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END)
SoFSlot = serverSlot + 1;
else if (serverSlot == EQEmu::legacy::SlotPowerSource)
else if (serverSlot == EQEmu::inventory::slotPowerSource)
SoFSlot = invslot::PossessionsPowerSource;
else
SoFSlot = serverSlot;
@@ -3301,7 +3304,7 @@ namespace SoF
else if (sofSlot >= invbag::SharedBankBagsBegin && sofSlot <= invbag::SharedBankBagsEnd)
ServerSlot = sofSlot - 1;
else if (sofSlot == invslot::PossessionsPowerSource)
ServerSlot = EQEmu::legacy::SlotPowerSource;
ServerSlot = EQEmu::inventory::slotPowerSource;
else
ServerSlot = sofSlot;
@@ -3461,4 +3464,30 @@ namespace SoF
return EQEmu::CastingSlot::Discipline;
}
}
static inline int ServerToSoFBuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int SoFToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*SoF*/
+8
View File
@@ -295,6 +295,14 @@ namespace SoF
const size_t SayLinkBodySize = 50;
const int LongBuffs = 25;
const int ShortBuffs = 15;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 60;
const int PetBuffs = 30;
const int MercBuffs = 0;
} /*constants*/
namespace behavior {
+3 -3
View File
@@ -149,7 +149,7 @@ struct TintProfile
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -178,7 +178,7 @@ struct TextureProfile
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
Texture_Struct Slot[EQEmu::textures::materialCount];
};
TextureProfile();
@@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
+45 -16
View File
@@ -30,7 +30,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../item_instance.h"
#include "titanium_structs.h"
#include <sstream>
@@ -42,7 +42,7 @@ namespace Titanium
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth);
// server to client inventory location converters
static inline int16 ServerToTitaniumSlot(uint32 serverSlot);
@@ -61,6 +61,9 @@ namespace Titanium
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
static inline int ServerToTitaniumBuffSlot(int index);
static inline int TitaniumToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
auto Config = EQEmuConfig::get();
@@ -270,7 +273,7 @@ namespace Titanium
OUT(buff.duration);
OUT(buff.counters);
OUT(buff.player_id);
OUT(slotid);
eq->slotid = ServerToTitaniumBuffSlot(emu->slotid);
OUT(bufffade);
FINISH_ENCODE();
@@ -329,7 +332,7 @@ namespace Titanium
EQEmu::OutBuffer::pos_type last_pos = ob.tellp();
for (int r = 0; r < itemcount; r++, eq++) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -815,7 +818,7 @@ namespace Titanium
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -981,7 +984,7 @@ namespace Titanium
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) {
OUT(item_material.Slot[r].Material);
OUT(item_tint.Slot[r].Color);
}
@@ -1301,14 +1304,14 @@ namespace Titanium
if (eq->Race[char_index] > 473)
eq->Race[char_index] = 1;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
eq->CS_Colors[char_index].Slot[index].Color = emu_cse->Equip[index].Color;
}
eq->BeardColor[char_index] = emu_cse->BeardColor;
eq->HairStyle[char_index] = emu_cse->HairStyle;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
eq->Equip[char_index].Slot[index].Material = emu_cse->Equip[index].Material;
}
@@ -1338,14 +1341,14 @@ namespace Titanium
for (; char_index < 10; ++char_index) {
eq->Race[char_index] = 0;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
eq->CS_Colors[char_index].Slot[index].Color = 0;
}
eq->BeardColor[char_index] = 0;
eq->HairStyle[char_index] = 0;
for (int index = 0; index < EQEmu::textures::TextureCount; ++index) {
for (int index = 0; index < EQEmu::textures::materialCount; ++index) {
eq->Equip[char_index].Slot[index].Material = 0;
}
@@ -1677,7 +1680,7 @@ namespace Titanium
eq->petOwnerId = emu->petOwnerId;
eq->guildrank = emu->guildrank;
// eq->unknown0194[3] = emu->unknown0194[3];
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
eq->equipment.Slot[k].Material = emu->equipment.Slot[k].Material;
eq->equipment_tint.Slot[k].Color = emu->equipment_tint.Slot[k].Color;
}
@@ -1779,7 +1782,7 @@ namespace Titanium
IN(buff.duration);
IN(buff.counters);
IN(buff.player_id);
IN(slotid);
emu->slotid = TitaniumToServerBuffSlot(eq->slotid);
IN(bufffade);
FINISH_DIRECT_DECODE();
@@ -2216,10 +2219,10 @@ namespace Titanium
}
// file scope helper methods
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
{
const char* protection = "\\\\\\\\\\";
const EQEmu::ItemBase* item = inst->GetUnscaledItem();
const EQEmu::ItemData* item = inst->GetUnscaledItem();
ob << StringFormat("%.*s%s", (depth ? (depth - 1) : 0), protection, (depth ? "\"" : "")); // For leading quotes (and protection) if a subitem;
@@ -2437,10 +2440,10 @@ namespace Titanium
ob << StringFormat("%.*s\"", depth, protection); // Quotes (and protection, if needed) around static data
// Sub data
for (int index = SUB_INDEX_BEGIN; index < invbag::ItemBagSize; ++index) {
for (int index = EQEmu::inventory::containerBegin; index < invbag::ItemBagSize; ++index) {
ob << '|';
ItemInst* sub = inst->GetItem(index);
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
@@ -2632,4 +2635,30 @@ namespace Titanium
return EQEmu::CastingSlot::Discipline;
}
}
static inline int ServerToTitaniumBuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int TitaniumToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*Titanium*/
+8
View File
@@ -294,6 +294,14 @@ namespace Titanium
const size_t SayLinkBodySize = 45;
const int LongBuffs = 25;
const int ShortBuffs = 12;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 60;
const int PetBuffs = 30;
const int MercBuffs = 0;
} /*constants*/
namespace behavior {
+2 -2
View File
@@ -144,7 +144,7 @@ struct TintProfile {
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -167,7 +167,7 @@ struct TextureProfile
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
Texture_Struct Slot[EQEmu::textures::materialCount];
};
TextureProfile();
+57 -44
View File
@@ -29,7 +29,7 @@
#include "../eq_packet_structs.h"
#include "../misc_functions.h"
#include "../string_util.h"
#include "../item.h"
#include "../item_instance.h"
#include "uf_structs.h"
#include "../rulesys.h"
@@ -43,7 +43,7 @@ namespace UF
static OpcodeManager *opcodes = nullptr;
static Strategy struct_strategy;
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id, uint8 depth);
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id, uint8 depth);
// server to client inventory location converters
static inline uint32 ServerToUFSlot(uint32 serverSlot);
@@ -62,6 +62,9 @@ namespace UF
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot);
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot);
static inline int ServerToUFBuffSlot(int index);
static inline int UFToServerBuffSlot(int index);
void Register(EQStreamIdentifier &into)
{
//create our opcode manager if we havent already
@@ -377,17 +380,8 @@ namespace UF
OUT(buff.spellid);
OUT(buff.duration);
OUT(buff.num_hits);
uint16 buffslot = emu->slotid;
if (buffslot >= 25 && buffslot < 37)
{
buffslot += 5;
}
else if (buffslot >= 37)
{
buffslot += 14;
}
// TODO: implement slot_data stuff
eq->slotid = buffslot;
eq->slotid = ServerToUFBuffSlot(emu->slotid);
OUT(bufffade); // Live (October 2011) sends a 2 rather than 0 when a buff is created, but it doesn't seem to matter.
FINISH_ENCODE();
@@ -407,17 +401,9 @@ namespace UF
__packet->WriteUInt8(emu->all_buffs); // 1 = all buffs, 0 = 1 buff
__packet->WriteUInt16(emu->count);
for (uint16 i = 0; i < emu->count; ++i)
for (int i = 0; i < emu->count; ++i)
{
uint16 buffslot = emu->entries[i].buff_slot;
if (emu->type == 0) { // only correct for self packets
if (emu->entries[i].buff_slot >= 25 && emu->entries[i].buff_slot < 37)
buffslot += 5;
else if (emu->entries[i].buff_slot >= 37)
buffslot += 14;
}
__packet->WriteUInt32(buffslot);
__packet->WriteUInt32(emu->type == 0 ? ServerToUFBuffSlot(emu->entries[i].buff_slot) : emu->entries[i].buff_slot);
__packet->WriteUInt32(emu->entries[i].spell_id);
__packet->WriteUInt32(emu->entries[i].tics_remaining);
__packet->WriteUInt32(emu->entries[i].num_hits);
@@ -541,7 +527,7 @@ namespace UF
ob.write((const char*)&item_count, sizeof(uint32));
for (int index = 0; index < item_count; ++index, ++eq) {
SerializeItem(ob, (const ItemInst*)eq->inst, eq->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)eq->inst, eq->slot_id, 0);
if (ob.tellp() == last_pos)
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
@@ -1293,7 +1279,7 @@ namespace UF
ob.write((const char*)__emu_buffer, 4);
SerializeItem(ob, (const ItemInst*)int_struct->inst, int_struct->slot_id, 0);
SerializeItem(ob, (const EQEmu::ItemInstance*)int_struct->inst, int_struct->slot_id, 0);
if (ob.tellp() == last_pos) {
Log.Out(Logs::General, Logs::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
@@ -1817,7 +1803,7 @@ namespace UF
OUT(hairstyle);
OUT(beard);
// OUT(unknown00178[10]);
for (r = EQEmu::textures::TextureBegin; r < EQEmu::textures::TextureCount; r++) {
for (r = EQEmu::textures::textureBegin; r < EQEmu::textures::materialCount; r++) {
eq->equipment.Slot[r].Material = emu->item_material.Slot[r].Material;
eq->equipment.Slot[r].Unknown1 = 0;
eq->equipment.Slot[r].EliteMaterial = 0;
@@ -2301,10 +2287,10 @@ namespace UF
eq_cse->HairColor = emu_cse->HairColor;
eq_cse->Face = emu_cse->Face;
for (int equip_index = 0; equip_index < EQEmu::textures::TextureCount; equip_index++) {
for (int equip_index = EQEmu::textures::textureBegin; equip_index < EQEmu::textures::materialCount; equip_index++) {
eq_cse->Equip[equip_index].Material = emu_cse->Equip[equip_index].Material;
eq_cse->Equip[equip_index].Unknown1 = emu_cse->Equip[equip_index].Unknown1;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteMaterial;
eq_cse->Equip[equip_index].EliteMaterial = emu_cse->Equip[equip_index].EliteModel;
eq_cse->Equip[equip_index].Color = emu_cse->Equip[equip_index].Color;
}
@@ -2869,7 +2855,7 @@ namespace UF
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522)))
{
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
PacketSize -= (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
if (emu->size == 0)
{
@@ -3068,7 +3054,7 @@ namespace UF
if ((emu->NPC == 0) || (emu->race <= 12) || (emu->race == 128) || (emu->race == 130) || (emu->race == 330) || (emu->race == 522))
{
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; ++k)
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; ++k)
{
{
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, emu->equipment_tint.Slot[k].Color);
@@ -3104,17 +3090,17 @@ namespace UF
{
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
for (k = EQEmu::textures::TextureBegin; k < EQEmu::textures::TextureCount; k++) {
for (k = EQEmu::textures::textureBegin; k < EQEmu::textures::materialCount; k++) {
if (emu->equipment.Slot[k].Material > 99999) {
Equipment[k].Material = 63;
} else {
Equipment[k].Material = emu->equipment.Slot[k].Material;
}
Equipment[k].Unknown1 = emu->equipment.Slot[k].Unknown1;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteMaterial;
Equipment[k].EliteMaterial = emu->equipment.Slot[k].EliteModel;
}
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::TextureCount);
Buffer += (sizeof(structs::Texture_Struct) * EQEmu::textures::materialCount);
}
if (strlen(emu->title))
{
@@ -3236,6 +3222,7 @@ namespace UF
IN(buff.unknown003);
IN(buff.spellid);
IN(buff.duration);
emu->slotid = UFToServerBuffSlot(eq->slotid);
IN(slotid);
IN(bufffade);
@@ -3249,7 +3236,7 @@ namespace UF
DECODE_LENGTH_EXACT(structs::BuffRemoveRequest_Struct);
SETUP_DIRECT_DECODE(BuffRemoveRequest_Struct, structs::BuffRemoveRequest_Struct);
emu->SlotID = (eq->SlotID < 30) ? eq->SlotID : (eq->SlotID - 5);
emu->SlotID = UFToServerBuffSlot(eq->SlotID);
IN(EntityID);
@@ -3847,9 +3834,9 @@ namespace UF
return NextItemInstSerialNumber;
}
void SerializeItem(EQEmu::OutBuffer& ob, const ItemInst *inst, int16 slot_id_in, uint8 depth)
void SerializeItem(EQEmu::OutBuffer& ob, const EQEmu::ItemInstance *inst, int16 slot_id_in, uint8 depth)
{
const EQEmu::ItemBase *item = inst->GetUnscaledItem();
const EQEmu::ItemData *item = inst->GetUnscaledItem();
UF::structs::ItemSerializationHeader hdr;
@@ -3893,7 +3880,7 @@ namespace UF
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
uint16 ornaIcon = 0;
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
const EQEmu::ItemBase *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
const EQEmu::ItemData *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
ornaIcon = aug_weap->Icon;
ob.write(aug_weap->IDFile, strlen(aug_weap->IDFile));
@@ -4224,18 +4211,18 @@ namespace UF
ob.write((const char*)&subitem_count, sizeof(uint32));
for (uint32 index = SUB_INDEX_BEGIN; index < EQEmu::legacy::ITEM_CONTAINER_SIZE; ++index) {
ItemInst* sub = inst->GetItem(index);
for (uint32 index = EQEmu::inventory::containerBegin; index < EQEmu::inventory::ContainerCount; ++index) {
EQEmu::ItemInstance* sub = inst->GetItem(index);
if (!sub)
continue;
int SubSlotNumber = INVALID_INDEX;
if (slot_id_in >= EQEmu::legacy::GENERAL_BEGIN && slot_id_in <= EQEmu::legacy::GENERAL_END)
SubSlotNumber = (((slot_id_in + 3) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + index + 1);
SubSlotNumber = (((slot_id_in + 3) * EQEmu::inventory::ContainerCount) + index + 1);
else if (slot_id_in >= EQEmu::legacy::BANK_BEGIN && slot_id_in <= EQEmu::legacy::BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::BANK_BAGS_BEGIN + index);
else if (slot_id_in >= EQEmu::legacy::SHARED_BANK_BEGIN && slot_id_in <= EQEmu::legacy::SHARED_BANK_END)
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::legacy::ITEM_CONTAINER_SIZE) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
SubSlotNumber = (((slot_id_in - EQEmu::legacy::SHARED_BANK_BEGIN) * EQEmu::inventory::ContainerCount) + EQEmu::legacy::SHARED_BANK_BAGS_BEGIN + index);
else
SubSlotNumber = slot_id_in;
@@ -4253,7 +4240,7 @@ namespace UF
{
uint32 UnderfootSlot = 0;
if (serverSlot >= EQEmu::legacy::SlotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
if (serverSlot >= EQEmu::inventory::slotAmmo && serverSlot <= 53) // Cursor/Ammo/Power Source and Normal Inventory Slots
UnderfootSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::GENERAL_BAGS_BEGIN && serverSlot <= EQEmu::legacy::CURSOR_BAG_END)
UnderfootSlot = serverSlot + 11;
@@ -4261,7 +4248,7 @@ namespace UF
UnderfootSlot = serverSlot + 1;
else if (serverSlot >= EQEmu::legacy::SHARED_BANK_BAGS_BEGIN && serverSlot <= EQEmu::legacy::SHARED_BANK_BAGS_END)
UnderfootSlot = serverSlot + 1;
else if (serverSlot == EQEmu::legacy::SlotPowerSource)
else if (serverSlot == EQEmu::inventory::slotPowerSource)
UnderfootSlot = invslot::PossessionsPowerSource;
else
UnderfootSlot = serverSlot;
@@ -4288,7 +4275,7 @@ namespace UF
else if (ufSlot >= invbag::SharedBankBagsBegin && ufSlot <= invbag::SharedBankBagsEnd)
ServerSlot = ufSlot - 1;
else if (ufSlot == invslot::PossessionsPowerSource)
ServerSlot = EQEmu::legacy::SlotPowerSource;
ServerSlot = EQEmu::inventory::slotPowerSource;
else
ServerSlot = ufSlot;
@@ -4453,4 +4440,30 @@ namespace UF
return EQEmu::CastingSlot::Discipline;
}
}
static inline int ServerToUFBuffSlot(int index)
{
// we're a disc
if (index >= EQEmu::constants::LongBuffs + EQEmu::constants::ShortBuffs)
return index - EQEmu::constants::LongBuffs - EQEmu::constants::ShortBuffs +
constants::LongBuffs + constants::ShortBuffs;
// we're a song
if (index >= EQEmu::constants::LongBuffs)
return index - EQEmu::constants::LongBuffs + constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
static inline int UFToServerBuffSlot(int index)
{
// we're a disc
if (index >= constants::LongBuffs + constants::ShortBuffs)
return index - constants::LongBuffs - constants::ShortBuffs + EQEmu::constants::LongBuffs +
EQEmu::constants::ShortBuffs;
// we're a song
if (index >= constants::LongBuffs)
return index - constants::LongBuffs + EQEmu::constants::LongBuffs;
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*UF*/
+24 -16
View File
@@ -64,7 +64,7 @@ namespace UF
InvTypeOther,
InvTypeCount
};
} /*invtype*/
namespace invslot {
@@ -115,21 +115,21 @@ namespace UF
const int GeneralBegin = PossessionsGeneral1;
const int GeneralEnd = PossessionsGeneral8;
const int GeneralCount = (GeneralEnd - GeneralBegin + 1);
} /*invslot*/
namespace invbag {
inline EQEmu::versions::ClientVersion GetInvBagRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvBagInvalid = -1, InvBagBegin };
} /*invbag*/
namespace invaug {
inline EQEmu::versions::ClientVersion GetInvAugRef() { return EQEmu::versions::ClientVersion::UF; }
enum : int { InvAugInvalid = -1, InvAugBegin };
} /*invaug*/
namespace item {
@@ -148,27 +148,27 @@ namespace UF
ItemPacketCharmUpdate = 110,
ItemPacket11 = 111
};
} /*item*/
namespace profile {
inline EQEmu::versions::ClientVersion GetProfileRef() { return EQEmu::versions::ClientVersion::UF; }
} /*profile*/
namespace constants {
inline EQEmu::versions::ClientVersion GetConstantsRef() { return EQEmu::versions::ClientVersion::UF; }
} /*constants*/
namespace behavior {
inline EQEmu::versions::ClientVersion GetBehaviorRef() { return EQEmu::versions::ClientVersion::UF; }
} /*behavior*/
namespace skills {
inline EQEmu::versions::ClientVersion GetSkillsRef() { return EQEmu::versions::ClientVersion::UF; }
} /*skills*/
@@ -208,7 +208,7 @@ namespace UF
extern const char* GetInvTypeName(int inv_type);
extern bool IsInvTypePersistent(int inv_type);
} /*invtype*/
namespace invslot {
@@ -237,7 +237,7 @@ namespace UF
extern const char* GetInvPossessionsSlotName(int inv_slot);
extern const char* GetInvCorpseSlotName(int inv_slot);
extern const char* GetInvSlotName(int inv_type, int inv_slot);
} /*invslot*/
namespace invbag {
@@ -264,7 +264,7 @@ namespace UF
const int TradeBagsEnd = (TradeBagsBegin + TradeBagsSize) - 1;
extern const char* GetInvBagIndexName(int bag_index);
} /*invbag*/
namespace invaug {
@@ -288,24 +288,32 @@ namespace UF
const size_t PotionBeltSize = 5;
const size_t SkillArraySize = 100;
} /*profile*/
namespace constants {
const size_t CharacterCreationLimit = 12;
const size_t SayLinkBodySize = 50;
const int LongBuffs = 30;
const int ShortBuffs = 20;
const int DiscBuffs = 1;
const int TotalBuffs = LongBuffs + ShortBuffs + DiscBuffs;
const int NPCBuffs = 85;
const int PetBuffs = NPCBuffs;
const int MercBuffs = LongBuffs;
} /*constants*/
namespace behavior {
const bool CoinHasWeight = false;
} /*behavior*/
namespace skills {
const size_t LastUsableSkill = EQEmu::skills::SkillTripleAttack;
} /*skills*/
}; /*UF*/
+4 -4
View File
@@ -149,7 +149,7 @@ struct TintProfile
Tint_Struct Primary;
Tint_Struct Secondary;
};
Tint_Struct Slot[EQEmu::textures::TextureCount];
Tint_Struct Slot[EQEmu::textures::materialCount];
};
};
@@ -178,7 +178,7 @@ struct TextureProfile
Texture_Struct Primary;
Texture_Struct Secondary;
};
Texture_Struct Slot[EQEmu::textures::TextureCount];
Texture_Struct Slot[EQEmu::textures::materialCount];
};
TextureProfile();
@@ -195,7 +195,7 @@ struct CharacterSelectEntry_Struct
/*0000*/ uint8 Beard; //
/*0001*/ uint8 HairColor; //
/*0000*/ uint8 Face; //
/*0000*/ CharSelectEquip Equip[EQEmu::textures::TextureCount];
/*0000*/ CharSelectEquip Equip[EQEmu::textures::materialCount];
/*0000*/ uint32 PrimaryIDFile; //
/*0000*/ uint32 SecondaryIDFile; //
/*0000*/ uint8 Unknown15; // 0xff
@@ -2011,7 +2011,7 @@ struct AdventureLeaderboard_Struct
/*struct Item_Shop_Struct {
uint16 merchantid;
uint8 itemtype;
ItemBase item;
ItemData item;
uint8 iss_unknown001[6];
};*/
+8 -6
View File
@@ -55,6 +55,7 @@ RULE_REAL(Character, AAExpMultiplier, 0.5)
RULE_REAL(Character, GroupExpMultiplier, 0.5)
RULE_REAL(Character, RaidExpMultiplier, 0.2)
RULE_BOOL(Character, UseXPConScaling, true)
RULE_INT(Character, ShowExpValues, 0) //0 - normal, 1 - Show raw experience values, 2 - Show raw experience values AND percent.
RULE_INT(Character, LightBlueModifier, 40)
RULE_INT(Character, BlueModifier, 90)
RULE_INT(Character, WhiteModifier, 100)
@@ -146,7 +147,7 @@ RULE_BOOL(Character, EnableAvoidanceCap, false)
RULE_INT(Character, AvoidanceCap, 750) // 750 Is a pretty good value, seen people dodge all attacks beyond 1,000 Avoidance
RULE_BOOL(Character, AllowMQTarget, false) // Disables putting players in the 'hackers' list for targeting beyond the clip plane or attempting to target something untargetable
RULE_BOOL(Character, UseOldBindWound, false) // Uses the original bind wound behavior
RULE_BOOL(Character, GrantHoTTOnCreate, false) // Grant Health of Target's Target leadership AA on character creation
RULE_CATEGORY_END()
RULE_CATEGORY(Mercs)
@@ -332,11 +333,11 @@ RULE_INT(Spells, SacrificeMinLevel, 46) //first level Sacrifice will work on
RULE_INT(Spells, SacrificeMaxLevel, 69) //last level Sacrifice will work on
RULE_INT(Spells, SacrificeItemID, 9963) //Item ID of the item Sacrifice will return (defaults to an EE)
RULE_BOOL(Spells, EnableSpellGlobals, false) // If Enabled, spells check the spell_globals table and compare character data from the quest globals before allowing that spell to scribe with scribespells
RULE_INT(Spells, MaxBuffSlotsNPC, 25)
RULE_INT(Spells, MaxSongSlotsNPC, 10)
RULE_INT(Spells, MaxDiscSlotsNPC, 1)
RULE_INT(Spells, MaxTotalSlotsNPC, 36)
RULE_INT(Spells, MaxTotalSlotsPET, 30) // do not set this higher than 25 until the player profile is removed from the blob
RULE_INT(Spells, MaxBuffSlotsNPC, 60) // default to Tit's limit
RULE_INT(Spells, MaxSongSlotsNPC, 0) // NPCs don't have songs ...
RULE_INT(Spells, MaxDiscSlotsNPC, 0) // NPCs don't have discs ...
RULE_INT(Spells, MaxTotalSlotsNPC, 60) // default to Tit's limit
RULE_INT(Spells, MaxTotalSlotsPET, 30) // default to Tit's limit
RULE_BOOL (Spells, EnableBlockedBuffs, true)
RULE_INT(Spells, ReflectType, 1) //0 = disabled, 1 = single target player spells only, 2 = all player spells, 3 = all single target spells, 4 = all spells
RULE_INT(Spells, VirusSpreadDistance, 30) // The distance a viral spell will jump to its next victim
@@ -490,6 +491,7 @@ RULE_BOOL(Combat, UseLiveCombatRounds, true) // turn this false if you don't wan
RULE_INT(Combat, NPCAssistCap, 5) // Maxiumium number of NPCs that will assist another NPC at once
RULE_INT(Combat, NPCAssistCapTimer, 6000) // Time in milliseconds a NPC will take to clear assist aggro cap space
RULE_BOOL(Combat, UseRevampHandToHand, false) // use h2h revamped dmg/delays I believe this was implemented during SoF
RULE_BOOL(Combat, ClassicMasterWu, false) // classic master wu uses a random special, modern doesn't
RULE_CATEGORY_END()
RULE_CATEGORY(NPC)
+4 -4
View File
@@ -21,8 +21,8 @@
#include "emu_constants.h"
#include "string_util.h"
#include "item.h"
#include "item_base.h"
#include "item_instance.h"
#include "item_data.h"
#include "../zone/zonedb.h"
@@ -147,7 +147,7 @@ void EQEmu::SayLinkEngine::generate_body()
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
const EQEmu::ItemBase* item_data = nullptr;
const EQEmu::ItemData* item_data = nullptr;
switch (m_LinkType) {
case saylink::SayLinkBlank:
@@ -250,7 +250,7 @@ void EQEmu::SayLinkEngine::generate_text()
return;
}
const EQEmu::ItemBase* item_data = nullptr;
const EQEmu::ItemData* item_data = nullptr;
switch (m_LinkType) {
case saylink::SayLinkBlank:
+6 -6
View File
@@ -26,11 +26,11 @@
struct ServerLootItem_Struct;
class ItemInst;
namespace EQEmu
{
struct ItemBase;
struct ItemData;
class ItemInstance;
struct SayLinkBody_Struct;
namespace saylink {
@@ -67,9 +67,9 @@ namespace EQEmu
SayLinkEngine();
void SetLinkType(saylink::SayLinkType link_type) { m_LinkType = link_type; }
void SetItemData(const EQEmu::ItemBase* item_data) { m_ItemData = item_data; }
void SetItemData(const EQEmu::ItemData* 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; }
void SetItemInst(const ItemInstance* 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; }
@@ -103,9 +103,9 @@ namespace EQEmu
void generate_text();
int m_LinkType;
const ItemBase* m_ItemData;
const ItemData* m_ItemData;
const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst;
const ItemInstance* m_ItemInst;
uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID;
+78 -67
View File
@@ -29,7 +29,7 @@
#include "faction.h"
#include "features.h"
#include "ipc_mutex.h"
#include "item.h"
#include "inventory_profile.h"
#include "loottable.h"
#include "memory_mapped_file.h"
#include "mysql.h"
@@ -38,6 +38,17 @@
#include "string_util.h"
#include "eqemu_config.h"
namespace ItemField
{
enum {
source = 0,
#define F(x) x,
#include "item_fieldlist.h"
#undef F
updated
};
}
SharedDatabase::SharedDatabase()
: Database()
{
@@ -99,13 +110,13 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
return EntitledTime;
}
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iterator &start, std::list<ItemInst*>::const_iterator &end)
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end)
{
// Delete cursor items
std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i "
"AND ((slotid >= 8000 AND slotid <= 8999) "
"OR slotid = %i OR (slotid >= %i AND slotid <= %i) )",
char_id, EQEmu::legacy::SlotCursor,
char_id, EQEmu::inventory::slotCursor,
EQEmu::legacy::CURSOR_BAG_BEGIN, EQEmu::legacy::CURSOR_BAG_END);
auto results = QueryDatabase(query);
if (!results.Success()) {
@@ -116,8 +127,8 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iter
int i = 8000;
for(auto it = start; it != end; ++it, i++) {
if (i > 8999) { break; } // shouldn't be anything in the queue that indexes this high
ItemInst *inst = *it;
int16 use_slot = (i == 8000) ? EQEmu::legacy::SlotCursor : i;
EQEmu::ItemInstance *inst = *it;
int16 use_slot = (i == 8000) ? EQEmu::inventory::slotCursor : i;
if (!SaveInventory(char_id, inst, use_slot)) {
return false;
}
@@ -126,7 +137,7 @@ bool SharedDatabase::SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iter
return true;
}
bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst)
bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst)
{
// Delete cursor items
std::string query = StringFormat("SELECT itemid, charges FROM sharedbank "
@@ -159,7 +170,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite
return true;
}
bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id) {
bool SharedDatabase::SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
//never save tribute slots:
if (slot_id >= EQEmu::legacy::TRIBUTE_BEGIN && slot_id <= EQEmu::legacy::TRIBUTE_END)
@@ -173,7 +184,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
else {
// Needed to clear out bag slots that 'REPLACE' in UpdateSharedBankSlot does not overwrite..otherwise, duplication occurs
// (This requires that parent then child items be sent..which should be how they are currently passed)
if (Inventory::SupportsContainers(slot_id))
if (EQEmu::InventoryProfile::SupportsContainers(slot_id))
DeleteSharedBankSlot(char_id, slot_id);
return UpdateSharedBankSlot(char_id, inst, slot_id);
}
@@ -184,18 +195,18 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
// Needed to clear out bag slots that 'REPLACE' in UpdateInventorySlot does not overwrite..otherwise, duplication occurs
// (This requires that parent then child items be sent..which should be how they are currently passed)
if (Inventory::SupportsContainers(slot_id))
if (EQEmu::InventoryProfile::SupportsContainers(slot_id))
DeleteInventorySlot(char_id, slot_id);
return UpdateInventorySlot(char_id, inst, slot_id);
}
bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
// need to check 'inst' argument for valid pointer
uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 };
uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 };
if (inst->IsClassCommon()) {
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
ItemInst *auginst = inst->GetItem(i);
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) {
EQEmu::ItemInstance *auginst = inst->GetItem(i);
augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
}
}
@@ -221,12 +232,12 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id))
if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id))
// Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID'
// messages through attrition (and the modded code in SaveInventory)
for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) {
const ItemInst* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx));
}
if (!results.Success()) {
@@ -236,13 +247,13 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
return true;
}
bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id) {
// need to check 'inst' argument for valid pointer
uint32 augslot[EQEmu::legacy::ITEM_COMMON_SIZE] = { 0, 0, 0, 0, 0, 0 };
uint32 augslot[EQEmu::inventory::SocketCount] = { 0, 0, 0, 0, 0, 0 };
if (inst->IsClassCommon()) {
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
ItemInst *auginst = inst->GetItem(i);
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) {
EQEmu::ItemInstance *auginst = inst->GetItem(i);
augslot[i] = (auginst && auginst->GetItem()) ? auginst->GetItem()->ID : 0;
}
}
@@ -267,12 +278,12 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst,
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
if (inst->IsClassBag() && Inventory::SupportsContainers(slot_id)) {
if (inst->IsClassBag() && EQEmu::InventoryProfile::SupportsContainers(slot_id)) {
// Limiting to bag slot count will get rid of 'hidden' duplicated items and 'Invalid Slot ID'
// messages through attrition (and the modded code in SaveInventory)
for (uint8 idx = SUB_INDEX_BEGIN; idx < inst->GetItem()->BagSlots && idx < EQEmu::legacy::ITEM_CONTAINER_SIZE; idx++) {
const ItemInst* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, Inventory::CalcSlotId(slot_id, idx));
for (uint8 idx = EQEmu::inventory::containerBegin; idx < inst->GetItem()->BagSlots && idx < EQEmu::inventory::ContainerCount; idx++) {
const EQEmu::ItemInstance* baginst = inst->GetItem(idx);
SaveInventory(char_id, baginst, EQEmu::InventoryProfile::CalcSlotId(slot_id, idx));
}
}
@@ -293,10 +304,10 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) {
}
// Delete bag slots, if need be
if (!Inventory::SupportsContainers(slot_id))
if (!EQEmu::InventoryProfile::SupportsContainers(slot_id))
return true;
int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_INDEX_BEGIN);
int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid >= %i AND slotid < %i",
char_id, base_slot_id, (base_slot_id+10));
results = QueryDatabase(query);
@@ -319,10 +330,10 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) {
}
// Delete bag slots, if need be
if (!Inventory::SupportsContainers(slot_id))
if (!EQEmu::InventoryProfile::SupportsContainers(slot_id))
return true;
int16 base_slot_id = Inventory::CalcSlotId(slot_id, SUB_INDEX_BEGIN);
int16 base_slot_id = EQEmu::InventoryProfile::CalcSlotId(slot_id, EQEmu::inventory::containerBegin);
query = StringFormat("DELETE FROM sharedbank WHERE acctid = %i "
"AND slotid >= %i AND slotid < %i",
account_id, base_slot_id, (base_slot_id+10));
@@ -362,9 +373,9 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
return true;
}
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
const EQEmu::ItemBase* myitem;
const EQEmu::ItemData* myitem;
std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items "
"WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND "
@@ -385,7 +396,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv,
if(!myitem)
continue;
ItemInst* myinst = CreateBaseItem(myitem, charges);
EQEmu::ItemInstance* myinst = CreateBaseItem(myitem, charges);
if(slot < 0)
slot = inv->FindFreeSlot(0, 0);
@@ -399,7 +410,7 @@ bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv,
// Retrieve shared bank inventory based on either account or character
bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool is_charid)
{
std::string query;
@@ -428,7 +439,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
uint32 item_id = (uint32)atoi(row[1]);
int8 charges = (int8)atoi(row[2]);
uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE];
uint32 aug[EQEmu::inventory::SocketCount];
aug[0] = (uint32)atoi(row[3]);
aug[1] = (uint32)atoi(row[4]);
aug[2] = (uint32)atoi(row[5]);
@@ -436,7 +447,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
aug[4] = (uint32)atoi(row[7]);
aug[5] = (uint32)atoi(row[8]);
const EQEmu::ItemBase *item = GetItem(item_id);
const EQEmu::ItemData *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,
@@ -447,9 +458,9 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
int16 put_slot_id = INVALID_INDEX;
ItemInst *inst = CreateBaseItem(item, charges);
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
if (inst && item->IsClassCommon()) {
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) {
if (aug[i])
inst->PutAugment(this, i, aug[i]);
}
@@ -500,7 +511,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid)
}
// Overloaded: Retrieve character inventory based on character id
bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
{
// Retrieve character inventory
std::string query =
@@ -524,7 +535,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
uint16 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE];
uint32 aug[EQEmu::inventory::SocketCount];
aug[0] = (uint32)atoul(row[4]);
aug[1] = (uint32)atoul(row[5]);
@@ -539,7 +550,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const EQEmu::ItemBase *item = GetItem(item_id);
const EQEmu::ItemData *item = GetItem(item_id);
if (!item) {
Log.Out(Logs::General, Logs::Error,
@@ -550,7 +561,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
int16 put_slot_id = INVALID_INDEX;
ItemInst *inst = CreateBaseItem(item, charges);
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
if (inst == nullptr)
continue;
@@ -587,7 +598,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
if (instnodrop ||
(((slot_id >= EQEmu::legacy::EQUIPMENT_BEGIN && slot_id <= EQEmu::legacy::EQUIPMENT_END) ||
slot_id == EQEmu::legacy::SlotPowerSource) &&
slot_id == EQEmu::inventory::slotPowerSource) &&
inst->GetItem()->Attuneable))
inst->SetAttuned(true);
@@ -609,7 +620,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
}
if (item->IsClassCommon()) {
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) {
if (aug[i])
inst->PutAugment(this, i, aug[i]);
}
@@ -642,7 +653,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory *inv)
}
// Overloaded: Retrieve character inventory based on account_id and character name
bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::InventoryProfile *inv)
{
// Retrieve character inventory
std::string query =
@@ -666,7 +677,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
int8 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
uint32 aug[EQEmu::legacy::ITEM_COMMON_SIZE];
uint32 aug[EQEmu::inventory::SocketCount];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
@@ -679,12 +690,12 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const EQEmu::ItemBase *item = GetItem(item_id);
const EQEmu::ItemData *item = GetItem(item_id);
int16 put_slot_id = INVALID_INDEX;
if (!item)
continue;
ItemInst *inst = CreateBaseItem(item, charges);
EQEmu::ItemInstance *inst = CreateBaseItem(item, charges);
if (inst == nullptr)
continue;
@@ -727,7 +738,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, Inventory *inv)
inst->SetCharges(charges);
if (item->IsClassCommon()) {
for (int i = AUG_INDEX_BEGIN; i < EQEmu::legacy::ITEM_COMMON_SIZE; i++) {
for (int i = EQEmu::inventory::socketBegin; i < EQEmu::inventory::SocketCount; i++) {
if (aug[i])
inst->PutAugment(this, i, aug[i]);
}
@@ -816,7 +827,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
mutex.Lock();
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
items_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
mutex.Unlock();
} catch(std::exception& ex) {
Log.Out(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what());
@@ -828,7 +839,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id)
{
EQEmu::FixedMemoryHashSet<EQEmu::ItemBase> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
EQEmu::FixedMemoryHashSet<EQEmu::ItemData> hash(reinterpret_cast<uint8 *>(data), size, items, max_item_id);
std::string ndbuffer;
bool disableNoRent = false;
@@ -856,7 +867,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
}
EQEmu::ItemBase item;
EQEmu::ItemData item;
const std::string query = "SELECT source,"
#define F(x) "`"#x"`,"
@@ -869,7 +880,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
for (auto row = results.begin(); row != results.end(); ++row) {
memset(&item, 0, sizeof(EQEmu::ItemBase));
memset(&item, 0, sizeof(EQEmu::ItemData));
item.ItemClass = (uint8)atoi(row[ItemField::itemclass]);
strcpy(item.Name, row[ItemField::name]);
@@ -1086,7 +1097,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
}
const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) {
const EQEmu::ItemData* SharedDatabase::GetItem(uint32 id) {
if (id == 0)
{
return nullptr;
@@ -1105,7 +1116,7 @@ const EQEmu::ItemBase* SharedDatabase::GetItem(uint32 id) {
return nullptr;
}
const EQEmu::ItemBase* SharedDatabase::IterateItems(uint32* id) {
const EQEmu::ItemData* SharedDatabase::IterateItems(uint32* id) {
if(!items_hash || !id) {
return nullptr;
}
@@ -1250,18 +1261,18 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
return true;
}
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
// Create appropriate EQEmu::ItemInstance class
EQEmu::ItemInstance* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
const EQEmu::ItemBase* item = nullptr;
ItemInst* inst = nullptr;
const EQEmu::ItemData* item = nullptr;
EQEmu::ItemInstance* inst = nullptr;
item = GetItem(item_id);
if (item) {
inst = CreateBaseItem(item, charges);
if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()");
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
return nullptr;
}
@@ -1279,15 +1290,15 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
}
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
// Create appropriate EQEmu::ItemInstance class
EQEmu::ItemInstance* SharedDatabase::CreateItem(const EQEmu::ItemData* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
ItemInst* inst = nullptr;
EQEmu::ItemInstance* inst = nullptr;
if (item) {
inst = CreateBaseItem(item, charges);
if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()");
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
return nullptr;
}
@@ -1304,8 +1315,8 @@ ItemInst* SharedDatabase::CreateItem(const EQEmu::ItemBase* item, int16 charges,
return inst;
}
ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 charges) {
ItemInst* inst = nullptr;
EQEmu::ItemInstance* SharedDatabase::CreateBaseItem(const EQEmu::ItemData* item, int16 charges) {
EQEmu::ItemInstance* inst = nullptr;
if (item) {
// if maxcharges is -1 that means it is an unlimited use item.
// set it to 1 charge so that it is usable on creation
@@ -1315,10 +1326,10 @@ ItemInst* SharedDatabase::CreateBaseItem(const EQEmu::ItemBase* item, int16 char
if(charges <= 0 && item->Stackable)
charges = 1;
inst = new ItemInst(item, charges);
inst = new EQEmu::ItemInstance(item, charges);
if (inst == nullptr) {
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
Log.Out(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()");
Log.Out(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
return nullptr;
}
+19 -19
View File
@@ -33,8 +33,6 @@
#include <memory>
class EvolveInfo;
class Inventory;
class ItemInst;
struct BaseDataStruct;
struct InspectMessage_Struct;
struct PlayerProfile_Struct;
@@ -45,7 +43,9 @@ struct LootDrop_Struct;
namespace EQEmu
{
struct ItemBase;
struct ItemData;
class ItemInstance;
class InventoryProfile;
class MemoryMappedFile;
}
@@ -74,24 +74,24 @@ class SharedDatabase : public Database
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
/*
Character Inventory
Character InventoryProfile
*/
bool SaveCursor(uint32 char_id, std::list<ItemInst*>::const_iterator &start, std::list<ItemInst*>::const_iterator &end);
bool SaveInventory(uint32 char_id, const ItemInst* inst, int16 slot_id);
bool SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end);
bool SaveInventory(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
bool DeleteSharedBankSlot(uint32 char_id, int16 slot_id);
bool DeleteInventorySlot(uint32 char_id, int16 slot_id);
bool UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id);
bool UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id);
bool VerifyInventory(uint32 account_id, int16 slot_id, const ItemInst* inst);
bool GetSharedBank(uint32 id, Inventory* inv, bool is_charid);
bool UpdateInventorySlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
bool UpdateSharedBankSlot(uint32 char_id, const EQEmu::ItemInstance* inst, int16 slot_id);
bool VerifyInventory(uint32 account_id, int16 slot_id, const EQEmu::ItemInstance* inst);
bool GetSharedBank(uint32 id, EQEmu::InventoryProfile* inv, bool is_charid);
int32 GetSharedPlatinum(uint32 account_id);
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
bool GetInventory(uint32 char_id, Inventory* inv);
bool GetInventory(uint32 account_id, char* name, Inventory* inv);
bool GetInventory(uint32 char_id, EQEmu::InventoryProfile* inv);
bool GetInventory(uint32 account_id, char* name, EQEmu::InventoryProfile* inv);
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
void ClearOldRecastTimestamps(uint32 char_id);
bool SetStartingItems(PlayerProfile_Struct* pp, Inventory* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin);
bool SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin);
std::string GetBook(const char *txtfile);
@@ -99,9 +99,9 @@ class SharedDatabase : public Database
/*
Item Methods
*/
ItemInst* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateItem(const EQEmu::ItemBase* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
ItemInst* CreateBaseItem(const EQEmu::ItemBase* item, int16 charges = 0);
EQEmu::ItemInstance* CreateItem(uint32 item_id, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
EQEmu::ItemInstance* CreateItem(const EQEmu::ItemData* item, int16 charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
EQEmu::ItemInstance* CreateBaseItem(const EQEmu::ItemData* item, int16 charges = 0);
/*
Shared Memory crap
@@ -111,8 +111,8 @@ class SharedDatabase : public Database
void GetItemsCount(int32 &item_count, uint32 &max_id);
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
bool LoadItems(const std::string &prefix);
const EQEmu::ItemBase* IterateItems(uint32* id);
const EQEmu::ItemBase* GetItem(uint32 id);
const EQEmu::ItemData* IterateItems(uint32* id);
const EQEmu::ItemData* GetItem(uint32 id);
const EvolveInfo* GetEvolveInfo(uint32 loregroup);
//faction lists
@@ -149,7 +149,7 @@ class SharedDatabase : public Database
std::unique_ptr<EQEmu::MemoryMappedFile> skill_caps_mmf;
std::unique_ptr<EQEmu::MemoryMappedFile> items_mmf;
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemBase>> items_hash;
std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>> items_hash;
std::unique_ptr<EQEmu::MemoryMappedFile> faction_mmf;
std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>> faction_hash;
std::unique_ptr<EQEmu::MemoryMappedFile> loot_table_mmf;
+1 -1
View File
@@ -485,7 +485,7 @@ typedef enum {
#define SE_ManaAbsorbPercentDamage 329 // implemented
#define SE_CriticalDamageMob 330 // implemented
#define SE_Salvage 331 // implemented - chance to recover items that would be destroyed in failed tradeskill combine
//#define SE_SummonToCorpse 332 // *not implemented AA - Call of the Wild (Druid/Shaman Res spell with no exp)
#define SE_SummonToCorpse 332 // *not implemented AA - Call of the Wild (Druid/Shaman Res spell with no exp)
#define SE_CastOnRuneFadeEffect 333 // implemented
#define SE_BardAEDot 334 // implemented
#define SE_BlockNextSpellFocus 335 // implemented - base1 chance to block next spell ie Puratus (8494)
-79
View File
@@ -18,82 +18,3 @@
*/
#include "textures.h"
//#include "inventory_slot.h"
#include <string.h> // temp
//int EQEmu::textures::ConvertEquipmentSlotToTextureSlot(int equipment_slot)
//{
// switch (equipment_slot) {
// case inventory::PossessionsHead:
// return textures::TextureHead;
// case inventory::PossessionsChest:
// return textures::TextureChest;
// case inventory::PossessionsArms:
// return textures::TextureArms;
// case inventory::PossessionsWrist1:
// return textures::TextureWrist;
// case inventory::PossessionsHands:
// return textures::TextureHands;
// case inventory::PossessionsLegs:
// return textures::TextureLegs;
// case inventory::PossessionsFeet:
// return textures::TextureFeet;
// case inventory::PossessionsPrimary:
// return textures::TexturePrimary;
// case inventory::PossessionsSecondary:
// return textures::TextureSecondary;
// default:
// return textures::TextureInvalid;
// }
//}
//int EQEmu::textures::ConvertEquipmentSlotToTextureSlot(const InventorySlot &equipment_slot)
//{
// if (equipment_slot.Type() != inventory::InvTypePossessions || equipment_slot.Bag() != inventory::InvBagInvalid || equipment_slot.Aug() != inventory::InvAugInvalid)
// return textures::TextureInvalid;
//
// return ConvertEquipmentSlotToTextureSlot(equipment_slot.Slot());
//}
//EQEmu::InventorySlot EQEmu::textures::ConvertTextureSlotToEquipmentSlot(int texture_slot)
//{
// switch (texture_slot) {
// case textures::TextureHead:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsHead);
// case textures::TextureChest:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsChest);
// case textures::TextureArms:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsArms);
// case textures::TextureWrist:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsWrist1);
// case textures::TextureHands:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsHands);
// case textures::TextureLegs:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsLegs);
// case textures::TextureFeet:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsFeet);
// case textures::TexturePrimary:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsPrimary);
// case textures::TextureSecondary:
// return EQEmu::InventorySlot(inventory::InvTypePossessions, inventory::PossessionsSecondary);
// default:
// return EQEmu::InventorySlot();
// }
//}
EQEmu::TextureProfile::TextureProfile()
{
memset(&Slot, 0, (sizeof(Texture_Struct) * textures::TextureCount));
}
EQEmu::TextureShortProfile::TextureShortProfile()
{
memset(&Slot, 0, (sizeof(uint32) * textures::TextureCount));
}
EQEmu::TintProfile::TintProfile()
{
memset(&Slot, 0, (sizeof(uint32) * textures::TextureCount));
}
+81 -84
View File
@@ -25,116 +25,113 @@
namespace EQEmu
{
//class InventorySlot;
namespace textures {
//enum : int { TextureInvalid = -1, TextureBegin };
enum : uint8 { TextureInvalid = 255, TextureBegin = 0 };
enum : int8 { textureInvalid = -1, textureBegin };
//enum TextureSlot : int {
enum TextureSlot : uint8 {
TextureHead = TextureBegin,
TextureChest,
TextureArms,
TextureWrist,
TextureHands,
TextureLegs,
TextureFeet,
TexturePrimary,
TextureSecondary,
TextureCount
enum TextureSlot : int8 {
armorHead = textureBegin,
armorChest,
armorArms,
armorWrist,
armorHands,
armorLegs,
armorFeet,
weaponPrimary,
weaponSecondary,
materialCount,
materialInvalid = textureInvalid
};
const int LastTexture = TextureSecondary;
const int LastTintableTexture = TextureFeet;
enum TintSlot : int8 {
tintHead = textureBegin,
tintChest,
tintArms,
tintWrist,
tintHands,
tintLegs,
tintFeet,
tintCount,
tintInvalid = textureInvalid
};
//extern int ConvertEquipmentSlotToTextureSlot(int equipment_slot);
//extern int ConvertEquipmentSlotToTextureSlot(const InventorySlot &equipment_slot);
//extern InventorySlot ConvertTextureSlotToEquipmentSlot(int texture_slot);
const int8 LastTexture = weaponSecondary;
const int8 LastTintableTexture = tintFeet;
struct Texture_Struct {
uint32 Material;
uint32 Unknown1;
uint32 EliteModel;
uint32 HerosForgeModel;
uint32 Unknown2; // same as material?
};
struct TextureMaterial_Struct {
uint32 Material;
};
struct Tint_Struct {
union {
struct {
uint8 Blue;
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint, this is FF
};
uint32 Color;
};
};
} /*textures*/
struct Texture_Struct {
uint32 Material;
uint32 Unknown1;
uint32 EliteMaterial;
uint32 HeroForgeModel;
uint32 Material2; // Same as material?
};
struct TextureProfile {
union {
struct {
Texture_Struct Head;
Texture_Struct Chest;
Texture_Struct Arms;
Texture_Struct Wrist;
Texture_Struct Hands;
Texture_Struct Legs;
Texture_Struct Feet;
Texture_Struct Primary;
Texture_Struct Secondary;
textures::Texture_Struct Head;
textures::Texture_Struct Chest;
textures::Texture_Struct Arms;
textures::Texture_Struct Wrist;
textures::Texture_Struct Hands;
textures::Texture_Struct Legs;
textures::Texture_Struct Feet;
textures::Texture_Struct Primary;
textures::Texture_Struct Secondary;
};
Texture_Struct Slot[textures::TextureCount];
textures::Texture_Struct Slot[textures::materialCount];
};
TextureProfile();
};
struct TextureShort_Struct {
uint32 Material;
};
struct TextureShortProfile {
struct TextureMaterialProfile {
union {
struct {
TextureShort_Struct Head;
TextureShort_Struct Chest;
TextureShort_Struct Arms;
TextureShort_Struct Wrist;
TextureShort_Struct Hands;
TextureShort_Struct Legs;
TextureShort_Struct Feet;
TextureShort_Struct Primary;
TextureShort_Struct Secondary;
textures::TextureMaterial_Struct Head;
textures::TextureMaterial_Struct Chest;
textures::TextureMaterial_Struct Arms;
textures::TextureMaterial_Struct Wrist;
textures::TextureMaterial_Struct Hands;
textures::TextureMaterial_Struct Legs;
textures::TextureMaterial_Struct Feet;
textures::TextureMaterial_Struct Primary;
textures::TextureMaterial_Struct Secondary;
};
TextureShort_Struct Slot[textures::TextureCount];
textures::TextureMaterial_Struct Slot[textures::materialCount];
};
TextureShortProfile();
};
struct Tint_Struct {
union {
struct {
uint8 Blue;
uint8 Green;
uint8 Red;
uint8 UseTint; // if there's a tint this is FF
};
uint32 Color;
};
//Tint_Struct();
};
struct TintProfile {
union {
struct {
Tint_Struct Head;
Tint_Struct Chest;
Tint_Struct Arms;
Tint_Struct Wrist;
Tint_Struct Hands;
Tint_Struct Legs;
Tint_Struct Feet;
Tint_Struct Primary;
Tint_Struct Secondary;
textures::Tint_Struct Head;
textures::Tint_Struct Chest;
textures::Tint_Struct Arms;
textures::Tint_Struct Wrist;
textures::Tint_Struct Hands;
textures::Tint_Struct Legs;
textures::Tint_Struct Feet;
textures::Tint_Struct Primary;
textures::Tint_Struct Secondary;
};
Tint_Struct Slot[textures::TextureCount];
textures::Tint_Struct Slot[textures::materialCount]; // materialCount is correct..but, {[weaponPrimary],[weaponSecondary]} are not tintable...
};
TintProfile();
};
} /*EQEmu*/