Another lightsource/saylink/skills pass

This commit is contained in:
Uleat 2016-05-30 08:39:49 -04:00
parent 16895910e4
commit 6c1af93f58
13 changed files with 321 additions and 329 deletions

View File

@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product; are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -82,12 +82,12 @@ bool EQEmu::lightsource::IsLevelGreater(uint8 left_type, uint8 right_type)
return (light_levels[left_type] > light_levels[right_type]); return (light_levels[left_type] > light_levels[right_type]);
} }
EQEmu::lightsource::Light_Struct::Light_Struct() EQEmu::LightSource_Struct::LightSource_Struct()
{ {
Clear(); Clear();
} }
void EQEmu::lightsource::Light_Struct::Clear() void EQEmu::LightSource_Struct::Clear()
{ {
memset(&Slot, 0, (sizeof(uint8) * sizeof(Slot))); memset(&Slot, 0, (sizeof(uint8) * sizeof(Slot)));
} }

View File

@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product; are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -34,7 +34,6 @@ namespace EQEmu
LightCount LightCount
}; };
enum LightType { enum LightType {
LightTypeNone = 0, LightTypeNone = 0,
LightTypeCandle, LightTypeCandle,
@ -70,21 +69,21 @@ namespace EQEmu
LightLevelCount LightLevelCount
}; };
struct Light_Struct {
uint8 Slot[LightCount];
Light_Struct();
void Clear();
inline uint8& operator[](LightSlot index) { return Slot[index]; }
};
extern uint8 TypeToLevel(uint8 light_type); extern uint8 TypeToLevel(uint8 light_type);
extern bool IsLevelGreater(uint8 left_type, uint8 right_type); extern bool IsLevelGreater(uint8 left_type, uint8 right_type);
}; /*lightsource*/ }; /*lightsource*/
struct LightSource_Struct {
uint8 Slot[lightsource::LightCount];
LightSource_Struct();
void Clear();
inline uint8& operator[](lightsource::LightSlot index) { return Slot[index]; }
};
struct LightSourceProfile { struct LightSourceProfile {
/* /*
Current criteria (light types): Current criteria (light types):
@ -103,8 +102,8 @@ namespace EQEmu
-- The timer-based update cancels out the invalid light source -- The timer-based update cancels out the invalid light source
*/ */
lightsource::Light_Struct Type; // Light types (classifications) LightSource_Struct Type; // Light types (classifications)
lightsource::Light_Struct Level; // Light levels (intensities) - used to determine which light source should be active LightSource_Struct Level; // Light levels (intensities) - used to determine which light source should be active
LightSourceProfile() { } LightSourceProfile() { }

View File

@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator /* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product; are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -26,12 +26,60 @@
#include "../zone/zonedb.h" #include "../zone/zonedb.h"
EQEmu::saylink::SayLinkEngine::SayLinkEngine() bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & say_link_body_struct.unknown_1),
(0x000FFFFF & say_link_body_struct.item_id),
(0x000FFFFF & say_link_body_struct.augment_1),
(0x000FFFFF & say_link_body_struct.augment_2),
(0x000FFFFF & say_link_body_struct.augment_3),
(0x000FFFFF & say_link_body_struct.augment_4),
(0x000FFFFF & say_link_body_struct.augment_5),
(0x000FFFFF & say_link_body_struct.augment_6),
(0x0F & say_link_body_struct.is_evolving),
(0x0000FFFF & say_link_body_struct.evolve_group),
(0xFF & say_link_body_struct.evolve_level),
(0x000FFFFF & say_link_body_struct.ornament_icon),
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
return true;
}
EQEmu::SayLinkEngine::SayLinkEngine()
{ {
Reset(); Reset();
} }
std::string EQEmu::saylink::SayLinkEngine::GenerateLink() std::string EQEmu::SayLinkEngine::GenerateLink()
{ {
m_Link.clear(); m_Link.clear();
m_LinkBody.clear(); m_LinkBody.clear();
@ -59,9 +107,9 @@ std::string EQEmu::saylink::SayLinkEngine::GenerateLink()
return m_Link; return m_Link;
} }
void EQEmu::saylink::SayLinkEngine::Reset() void EQEmu::SayLinkEngine::Reset()
{ {
m_LinkType = SayLinkBlank; m_LinkType = saylink::SayLinkBlank;
m_ItemData = nullptr; m_ItemData = nullptr;
m_LootData = nullptr; m_LootData = nullptr;
m_ItemInst = nullptr; m_ItemInst = nullptr;
@ -86,7 +134,7 @@ void EQEmu::saylink::SayLinkEngine::Reset()
m_Error = false; m_Error = false;
} }
void EQEmu::saylink::SayLinkEngine::generate_body() void EQEmu::SayLinkEngine::generate_body()
{ {
/* /*
Current server mask: EQClientRoF2 Current server mask: EQClientRoF2
@ -102,16 +150,16 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
const EQEmu::ItemBase* item_data = nullptr; const EQEmu::ItemBase* item_data = nullptr;
switch (m_LinkType) { switch (m_LinkType) {
case SayLinkBlank: case saylink::SayLinkBlank:
break; break;
case SayLinkItemData: case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; } if (m_ItemData == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemData->ID; m_LinkBodyStruct.item_id = m_ItemData->ID;
m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items m_LinkBodyStruct.evolve_group = m_ItemData->LoreGroup; // this probably won't work for all items
//m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel; //m_LinkBodyStruct.evolve_level = m_ItemData->EvolvingLevel;
// TODO: add hash call // TODO: add hash call
break; break;
case SayLinkLootItem: case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; } if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id); item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; } if (item_data == nullptr) { break; }
@ -126,7 +174,7 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
//m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel; //m_LinkBodyStruct.evolve_level = item_data->EvolvingLevel;
// TODO: add hash call // TODO: add hash call
break; break;
case SayLinkItemInst: case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; } if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; } if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID; m_LinkBodyStruct.item_id = m_ItemInst->GetItem()->ID;
@ -195,7 +243,7 @@ void EQEmu::saylink::SayLinkEngine::generate_body()
); );
} }
void EQEmu::saylink::SayLinkEngine::generate_text() void EQEmu::SayLinkEngine::generate_text()
{ {
if (m_ProxyText != nullptr) { if (m_ProxyText != nullptr) {
m_LinkText = m_ProxyText; m_LinkText = m_ProxyText;
@ -205,19 +253,19 @@ void EQEmu::saylink::SayLinkEngine::generate_text()
const EQEmu::ItemBase* item_data = nullptr; const EQEmu::ItemBase* item_data = nullptr;
switch (m_LinkType) { switch (m_LinkType) {
case SayLinkBlank: case saylink::SayLinkBlank:
break; break;
case SayLinkItemData: case saylink::SayLinkItemData:
if (m_ItemData == nullptr) { break; } if (m_ItemData == nullptr) { break; }
m_LinkText = m_ItemData->Name; m_LinkText = m_ItemData->Name;
return; return;
case SayLinkLootItem: case saylink::SayLinkLootItem:
if (m_LootData == nullptr) { break; } if (m_LootData == nullptr) { break; }
item_data = database.GetItem(m_LootData->item_id); item_data = database.GetItem(m_LootData->item_id);
if (item_data == nullptr) { break; } if (item_data == nullptr) { break; }
m_LinkText = item_data->Name; m_LinkText = item_data->Name;
return; return;
case SayLinkItemInst: case saylink::SayLinkItemInst:
if (m_ItemInst == nullptr) { break; } if (m_ItemInst == nullptr) { break; }
if (m_ItemInst->GetItem() == nullptr) { break; } if (m_ItemInst->GetItem() == nullptr) { break; }
m_LinkText = m_ItemInst->GetItem()->Name; m_LinkText = m_ItemInst->GetItem()->Name;
@ -228,51 +276,3 @@ void EQEmu::saylink::SayLinkEngine::generate_text()
m_LinkText = "null"; m_LinkText = "null";
} }
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
{
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_3 = (uint32)strtol(say_link_body.substr(16, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_4 = (uint32)strtol(say_link_body.substr(21, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_5 = (uint32)strtol(say_link_body.substr(26, 5).c_str(), nullptr, 16);
say_link_body_struct.augment_6 = (uint32)strtol(say_link_body.substr(31, 5).c_str(), nullptr, 16);
say_link_body_struct.is_evolving = (uint8)strtol(say_link_body.substr(36, 1).c_str(), nullptr, 16);
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
return true;
}
bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct)
{
say_link_body = StringFormat(
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
(0x0F & say_link_body_struct.unknown_1),
(0x000FFFFF & say_link_body_struct.item_id),
(0x000FFFFF & say_link_body_struct.augment_1),
(0x000FFFFF & say_link_body_struct.augment_2),
(0x000FFFFF & say_link_body_struct.augment_3),
(0x000FFFFF & say_link_body_struct.augment_4),
(0x000FFFFF & say_link_body_struct.augment_5),
(0x000FFFFF & say_link_body_struct.augment_6),
(0x0F & say_link_body_struct.is_evolving),
(0x0000FFFF & say_link_body_struct.evolve_group),
(0xFF & say_link_body_struct.evolve_level),
(0x000FFFFF & say_link_body_struct.ornament_icon),
(0xFFFFFFFF & say_link_body_struct.hash)
);
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
return false;
return true;
}

View File

@ -1,4 +1,4 @@
/* EQEMu: Everquest Server Emulator /* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
@ -10,7 +10,7 @@
but WITHOUT ANY WARRANTY except by those people which sell it, which but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product; are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
@ -28,112 +28,107 @@
struct ServerLootItem_Struct; struct ServerLootItem_Struct;
class ItemInst; class ItemInst;
namespace EQEmu namespace EQEmu
{ {
struct ItemBase; struct ItemBase;
struct SayLinkBody_Struct;
namespace saylink {
struct SayLinkBody_Struct; // Current server mask: EQClientRoF2
class SayLinkEngine; namespace saylink {
enum SayLinkType {
SayLinkBlank = 0,
SayLinkItemData,
SayLinkLootItem,
SayLinkItemInst
};
extern bool DegenerateLinkBody(SayLinkBody_Struct& say_Link_body_struct, const std::string& say_link_body); extern bool DegenerateLinkBody(SayLinkBody_Struct& say_Link_body_struct, const std::string& say_link_body);
extern bool GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct); extern bool GenerateLinkBody(std::string& say_link_body, const SayLinkBody_Struct& say_link_body_struct);
}
}
} /*saylink*/
struct EQEmu::saylink::SayLinkBody_Struct struct SayLinkBody_Struct {
{ uint8 unknown_1; /* %1X */
uint8 unknown_1; /* %1X */ uint32 item_id; /* %05X */
uint32 item_id; /* %05X */ uint32 augment_1; /* %05X */
uint32 augment_1; /* %05X */ uint32 augment_2; /* %05X */
uint32 augment_2; /* %05X */ uint32 augment_3; /* %05X */
uint32 augment_3; /* %05X */ uint32 augment_4; /* %05X */
uint32 augment_4; /* %05X */ uint32 augment_5; /* %05X */
uint32 augment_5; /* %05X */ uint32 augment_6; /* %05X */
uint32 augment_6; /* %05X */ uint8 is_evolving; /* %1X */
uint8 is_evolving; /* %1X */ uint32 evolve_group; /* %05X */
uint32 evolve_group; /* %05X */ uint8 evolve_level; /* %02X */
uint8 evolve_level; /* %02X */ uint32 ornament_icon; /* %05X */
uint32 ornament_icon; /* %05X */ int hash; /* %08X */
int hash; /* %08X */
};
class EQEmu::saylink::SayLinkEngine
{
public:
enum SayLinkType {
SayLinkBlank = 0,
SayLinkItemData,
SayLinkLootItem,
SayLinkItemInst
}; };
SayLinkEngine(); class SayLinkEngine {
public:
SayLinkEngine();
void SetLinkType(SayLinkType link_type) { m_LinkType = link_type; } 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::ItemBase* item_data) { m_ItemData = item_data; }
void SetLootData(const ServerLootItem_Struct* loot_data) { m_LootData = loot_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 ItemInst* item_inst) { m_ItemInst = item_inst; }
// mainly for saylinks..but, not limited to // mainly for saylinks..but, not limited to
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; } void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; } void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; }
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; } void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; }
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; } void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; }
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; } void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; }
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; } void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; }
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; } void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; }
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; } void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; }
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; } void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; }
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; } void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; }
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; } void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; }
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; } void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; }
void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; } void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; }
void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use
void SetTaskUse() { m_TaskUse = true; } void SetTaskUse() { m_TaskUse = true; }
std::string GenerateLink(); std::string GenerateLink();
bool LinkError() { return m_Error; } bool LinkError() { return m_Error; }
std::string Link() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x' std::string Link() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
std::string LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>' std::string LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
std::string LinkText() { return m_LinkText; } // contains string format: '<LinkText>' std::string LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
void Reset(); void Reset();
private: private:
void generate_body(); void generate_body();
void generate_text(); void generate_text();
int m_LinkType; int m_LinkType;
const EQEmu::ItemBase* m_ItemData; const ItemBase* m_ItemData;
const ServerLootItem_Struct* m_LootData; const ServerLootItem_Struct* m_LootData;
const ItemInst* m_ItemInst; const ItemInst* m_ItemInst;
uint8 m_Proxy_unknown_1; uint8 m_Proxy_unknown_1;
uint32 m_ProxyItemID; uint32 m_ProxyItemID;
uint32 m_ProxyAugment1ID; uint32 m_ProxyAugment1ID;
uint32 m_ProxyAugment2ID; uint32 m_ProxyAugment2ID;
uint32 m_ProxyAugment3ID; uint32 m_ProxyAugment3ID;
uint32 m_ProxyAugment4ID; uint32 m_ProxyAugment4ID;
uint32 m_ProxyAugment5ID; uint32 m_ProxyAugment5ID;
uint32 m_ProxyAugment6ID; uint32 m_ProxyAugment6ID;
uint8 m_ProxyIsEvolving; uint8 m_ProxyIsEvolving;
uint32 m_ProxyEvolveGroup; uint32 m_ProxyEvolveGroup;
uint8 m_ProxyEvolveLevel; uint8 m_ProxyEvolveLevel;
uint32 m_ProxyOrnamentIcon; uint32 m_ProxyOrnamentIcon;
int m_ProxyHash; int m_ProxyHash;
const char* m_ProxyText; const char* m_ProxyText;
bool m_TaskUse; bool m_TaskUse;
SayLinkBody_Struct m_LinkBodyStruct; SayLinkBody_Struct m_LinkBodyStruct;
std::string m_Link; std::string m_Link;
std::string m_LinkBody; std::string m_LinkBody;
std::string m_LinkText; std::string m_LinkText;
bool m_Error; bool m_Error;
}; };
} /*EQEmu*/
#endif /*COMMON_SAY_LINK_H*/ #endif /*COMMON_SAY_LINK_H*/

View File

@ -17,7 +17,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "types.h"
#include "skills.h" #include "skills.h"
#include <string.h> #include <string.h>
@ -291,142 +290,9 @@ const std::map<EQEmu::skills::SkillType, std::string>& EQEmu::skills::GetSkillTy
return skill_type_map; return skill_type_map;
} }
struct EQEmu::SkillProfile // prototype - not implemented
{
union {
struct {
uint32 _1HBlunt;
uint32 _1HSlashing;
uint32 _2HBlunt;
uint32 _2HSlashing;
uint32 Abjuration;
uint32 Alteration;
uint32 ApplyPoison;
uint32 Archery;
uint32 Backstab;
uint32 BindWound;
uint32 Bash;
uint32 Block;
uint32 BrassInstruments;
uint32 Channeling;
uint32 Conjuration;
uint32 Defense;
uint32 Disarm;
uint32 DisarmTraps;
uint32 Divination;
uint32 Dodge;
uint32 DoubleAttack;
union {
uint32 DragonPunch;
uint32 TailRake;
};
uint32 DualWield;
uint32 EagleStrike;
uint32 Evocation;
uint32 FeignDeath;
uint32 FlyingKick;
uint32 Forage;
uint32 HandtoHand;
uint32 Hide;
uint32 Kick;
uint32 Meditate;
uint32 Mend;
uint32 Offense;
uint32 Parry;
uint32 PickLock;
uint32 _1HPiercing;
uint32 Riposte;
uint32 RoundKick;
uint32 SafeFall;
uint32 SenseHeading;
uint32 Singing;
uint32 Sneak;
uint32 SpecializeAbjure;
uint32 SpecializeAlteration;
uint32 SpecializeConjuration;
uint32 SpecializeDivination;
uint32 SpecializeEvocation;
uint32 PickPockets;
uint32 StringedInstruments;
uint32 Swimming;
uint32 Throwing;
uint32 TigerClaw;
uint32 Tracking;
uint32 WindInstruments;
uint32 Fishing;
uint32 MakePoison;
uint32 Tinkering;
uint32 Research;
uint32 Alchemy;
uint32 Baking;
uint32 Tailoring;
uint32 SenseTraps;
uint32 Blacksmithing;
uint32 Fletching;
uint32 Brewing;
uint32 AlcoholTolerance;
uint32 Begging;
uint32 JewelryMaking;
uint32 Pottery;
uint32 PercussionInstruments;
uint32 Intimidation;
uint32 Berserking;
uint32 Taunt;
uint32 Frenzy;
uint32 RemoveTraps;
uint32 TripleAttack;
uint32 _2HPiercing;
uint32 unused1;
uint32 unused2;
uint32 unused3;
uint32 unused4;
uint32 unused5;
uint32 unused6;
uint32 unused7;
uint32 unused8;
uint32 unused9;
uint32 unused10;
uint32 unused11;
uint32 unused12;
uint32 unused13;
uint32 unused14;
uint32 unused15;
uint32 unused16;
uint32 unused17;
uint32 unused18;
uint32 unused19;
uint32 unused20;
uint32 unused21;
uint32 unused22;
};
uint32 skill[PACKET_SKILL_ARRAY_SIZE];
};
SkillProfile();
uint32* GetSkills() { return reinterpret_cast<uint32*>(&skill); }
skills::SkillType GetLastUseableSkill() { return EQEmu::skills::Skill2HPiercing; }
size_t GetSkillsArraySize() { return PACKET_SKILL_ARRAY_SIZE; }
uint32 GetSkill(int skill_id);
uint32 operator[](int skill_id) { return GetSkill(skill_id); }
// const
uint32* GetSkills() const { return const_cast<SkillProfile*>(this)->GetSkills(); }
skills::SkillType GetLastUseableSkill() const { return const_cast<SkillProfile*>(this)->GetLastUseableSkill(); }
size_t GetSkillsArraySize() const { return const_cast<SkillProfile*>(this)->GetSkillsArraySize(); }
uint32 GetSkill(int skill_id) const { return const_cast<SkillProfile*>(this)->GetSkill(skill_id); }
uint32 operator[](int skill_id) const { return const_cast<SkillProfile*>(this)->GetSkill(skill_id); }
};
EQEmu::SkillProfile::SkillProfile() EQEmu::SkillProfile::SkillProfile()
{ {
memset(&skill, 0, (sizeof(uint32) * PACKET_SKILL_ARRAY_SIZE)); memset(&Skill, 0, (sizeof(uint32) * PACKET_SKILL_ARRAY_SIZE));
} }
uint32 EQEmu::SkillProfile::GetSkill(int skill_id) uint32 EQEmu::SkillProfile::GetSkill(int skill_id)
@ -434,5 +300,5 @@ uint32 EQEmu::SkillProfile::GetSkill(int skill_id)
if (skill_id < 0 || skill_id >= PACKET_SKILL_ARRAY_SIZE) if (skill_id < 0 || skill_id >= PACKET_SKILL_ARRAY_SIZE)
return 0; return 0;
return skill[skill_id]; return Skill[skill_id];
} }

View File

@ -20,6 +20,8 @@
#ifndef COMMON_SKILLS_H #ifndef COMMON_SKILLS_H
#define COMMON_SKILLS_H #define COMMON_SKILLS_H
#include "types.h"
#include <string> #include <string>
#include <map> #include <map>
@ -168,7 +170,137 @@ namespace EQEmu
} /*skills*/ } /*skills*/
struct SkillProfile; struct SkillProfile { // prototype - not implemented
union {
struct {
uint32 _1HBlunt;
uint32 _1HSlashing;
uint32 _2HBlunt;
uint32 _2HSlashing;
uint32 Abjuration;
uint32 Alteration;
uint32 ApplyPoison;
uint32 Archery;
uint32 Backstab;
uint32 BindWound;
uint32 Bash;
uint32 Block;
uint32 BrassInstruments;
uint32 Channeling;
uint32 Conjuration;
uint32 Defense;
uint32 Disarm;
uint32 DisarmTraps;
uint32 Divination;
uint32 Dodge;
uint32 DoubleAttack;
union {
uint32 DragonPunch;
uint32 TailRake;
};
uint32 DualWield;
uint32 EagleStrike;
uint32 Evocation;
uint32 FeignDeath;
uint32 FlyingKick;
uint32 Forage;
uint32 HandtoHand;
uint32 Hide;
uint32 Kick;
uint32 Meditate;
uint32 Mend;
uint32 Offense;
uint32 Parry;
uint32 PickLock;
uint32 _1HPiercing;
uint32 Riposte;
uint32 RoundKick;
uint32 SafeFall;
uint32 SenseHeading;
uint32 Singing;
uint32 Sneak;
uint32 SpecializeAbjure;
uint32 SpecializeAlteration;
uint32 SpecializeConjuration;
uint32 SpecializeDivination;
uint32 SpecializeEvocation;
uint32 PickPockets;
uint32 StringedInstruments;
uint32 Swimming;
uint32 Throwing;
uint32 TigerClaw;
uint32 Tracking;
uint32 WindInstruments;
uint32 Fishing;
uint32 MakePoison;
uint32 Tinkering;
uint32 Research;
uint32 Alchemy;
uint32 Baking;
uint32 Tailoring;
uint32 SenseTraps;
uint32 Blacksmithing;
uint32 Fletching;
uint32 Brewing;
uint32 AlcoholTolerance;
uint32 Begging;
uint32 JewelryMaking;
uint32 Pottery;
uint32 PercussionInstruments;
uint32 Intimidation;
uint32 Berserking;
uint32 Taunt;
uint32 Frenzy;
uint32 RemoveTraps;
uint32 TripleAttack;
uint32 _2HPiercing;
uint32 unused1;
uint32 unused2;
uint32 unused3;
uint32 unused4;
uint32 unused5;
uint32 unused6;
uint32 unused7;
uint32 unused8;
uint32 unused9;
uint32 unused10;
uint32 unused11;
uint32 unused12;
uint32 unused13;
uint32 unused14;
uint32 unused15;
uint32 unused16;
uint32 unused17;
uint32 unused18;
uint32 unused19;
uint32 unused20;
uint32 unused21;
uint32 unused22;
};
uint32 Skill[PACKET_SKILL_ARRAY_SIZE];
};
SkillProfile();
uint32* GetSkills() { return reinterpret_cast<uint32*>(&Skill); }
skills::SkillType GetLastUseableSkill() { return EQEmu::skills::Skill2HPiercing; }
size_t GetSkillsArraySize() { return PACKET_SKILL_ARRAY_SIZE; }
uint32 GetSkill(int skill_id);
uint32 operator[](int skill_id) { return GetSkill(skill_id); }
// const
uint32* GetSkills() const { return const_cast<SkillProfile*>(this)->GetSkills(); }
skills::SkillType GetLastUseableSkill() const { return const_cast<SkillProfile*>(this)->GetLastUseableSkill(); }
size_t GetSkillsArraySize() const { return const_cast<SkillProfile*>(this)->GetSkillsArraySize(); }
uint32 GetSkill(int skill_id) const { return const_cast<SkillProfile*>(this)->GetSkill(skill_id); }
uint32 operator[](int skill_id) const { return const_cast<SkillProfile*>(this)->GetSkill(skill_id); }
};
} /*EQEmu*/ } /*EQEmu*/

View File

@ -8463,8 +8463,8 @@ std::string Bot::CreateSayLink(Client* c, const char* message, const char* name)
uint32 saylink_id = database.LoadSaylinkID(escaped_string); uint32 saylink_id = database.LoadSaylinkID(escaped_string);
safe_delete_array(escaped_string); safe_delete_array(escaped_string);
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemData); linker.SetLinkType(EQEmu::saylink::SayLinkItemData);
linker.SetProxyItemID(SAYLINK_ITEM_ID); linker.SetProxyItemID(SAYLINK_ITEM_ID);
linker.SetProxyAugment1ID(saylink_id); linker.SetProxyAugment1ID(saylink_id);
linker.SetProxyText(name); linker.SetProxyText(name);

View File

@ -7067,8 +7067,8 @@ void bot_subcommand_inventory_list(Client *c, const Seperator *sep)
bool is2Hweapon = false; bool is2Hweapon = false;
std::string item_link; std::string item_link;
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemInst); linker.SetLinkType(EQEmu::saylink::SayLinkItemInst);
uint32 inventory_count = 0; uint32 inventory_count = 0;
for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) { for (int i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= (EQEmu::legacy::EQUIPMENT_END + 1); ++i) {

View File

@ -2548,8 +2548,8 @@ void command_peekinv(Client *c, const Seperator *sep)
const ItemInst* inst_sub = nullptr; const ItemInst* inst_sub = nullptr;
const EQEmu::ItemBase* item_data = nullptr; const EQEmu::ItemBase* item_data = nullptr;
std::string item_link; std::string item_link;
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemInst); linker.SetLinkType(EQEmu::saylink::SayLinkItemInst);
c->Message(0, "Displaying inventory for %s...", targetClient->GetName()); c->Message(0, "Displaying inventory for %s...", targetClient->GetName());
@ -4346,8 +4346,8 @@ void command_iteminfo(Client *c, const Seperator *sep)
c->Message(13, "Error: This item has no data reference"); c->Message(13, "Error: This item has no data reference");
} }
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemInst); linker.SetLinkType(EQEmu::saylink::SayLinkItemInst);
linker.SetItemInst(inst); linker.SetItemInst(inst);
auto item_link = linker.GenerateLink(); auto item_link = linker.GenerateLink();
@ -5497,7 +5497,7 @@ void command_summonitem(Client *c, const Seperator *sep)
size_t link_open = cmd_msg.find('\x12'); size_t link_open = cmd_msg.find('\x12');
size_t link_close = cmd_msg.find_last_of('\x12'); size_t link_close = cmd_msg.find_last_of('\x12');
if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::legacy::TEXT_LINK_BODY_LENGTH) { if (link_open != link_close && (cmd_msg.length() - link_open) > EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
EQEmu::saylink::SayLinkBody_Struct link_body; EQEmu::SayLinkBody_Struct link_body;
EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::legacy::TEXT_LINK_BODY_LENGTH)); EQEmu::saylink::DegenerateLinkBody(link_body, cmd_msg.substr(link_open + 1, EQEmu::legacy::TEXT_LINK_BODY_LENGTH));
itemid = link_body.item_id; itemid = link_body.item_id;
} }
@ -5608,8 +5608,8 @@ void command_itemsearch(Client *c, const Seperator *sep)
const EQEmu::ItemBase* item = nullptr; const EQEmu::ItemBase* item = nullptr;
std::string item_link; std::string item_link;
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemData); linker.SetLinkType(EQEmu::saylink::SayLinkItemData);
if (Seperator::IsNumber(search_criteria)) { if (Seperator::IsNumber(search_criteria)) {
item = database.GetItem(atoi(search_criteria)); item = database.GetItem(atoi(search_criteria));

View File

@ -1223,8 +1223,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
} }
/* Send message with item link to groups and such */ /* Send message with item link to groups and such */
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemInst); linker.SetLinkType(EQEmu::saylink::SayLinkItemInst);
linker.SetItemInst(inst); linker.SetItemInst(inst);
auto item_link = linker.GenerateLink(); auto item_link = linker.GenerateLink();

View File

@ -530,8 +530,8 @@ void NPC::QueryLoot(Client* to)
continue; continue;
} }
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemData); linker.SetLinkType(EQEmu::saylink::SayLinkItemData);
linker.SetItemData(item); linker.SetItemData(item);
auto item_link = linker.GenerateLink(); auto item_link = linker.GenerateLink();

View File

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

View File

@ -2778,8 +2778,8 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, int SequenceN
if(ItemID) { if(ItemID) {
const EQEmu::ItemBase* reward_item = database.GetItem(ItemID); const EQEmu::ItemBase* reward_item = database.GetItem(ItemID);
EQEmu::saylink::SayLinkEngine linker; EQEmu::SayLinkEngine linker;
linker.SetLinkType(linker.SayLinkItemData); linker.SetLinkType(EQEmu::saylink::SayLinkItemData);
linker.SetItemData(reward_item); linker.SetItemData(reward_item);
linker.SetTaskUse(); linker.SetTaskUse();
if (strlen(Tasks[TaskID]->Reward) != 0) if (strlen(Tasks[TaskID]->Reward) != 0)