Merge remote-tracking branch 'remotes/origin/master' into web_interface

Conflicts:
	common/shareddb.cpp
	zone/corpse.cpp
	zone/worldserver.cpp
	zone/zone.cpp
This commit is contained in:
Akkadius
2014-12-15 20:15:16 -06:00
125 changed files with 1277 additions and 985 deletions
+1 -2
View File
@@ -15,13 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "debug.h"
#include "base_packet.h"
#include "misc.h"
#include "packet_dump.h"
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
{
this->pBuffer=nullptr;
-1
View File
@@ -21,7 +21,6 @@
#include "types.h"
#include <stdio.h>
#include <string.h>
#include <string>
#ifdef WIN32
#include <time.h>
+1 -1
View File
@@ -14,7 +14,7 @@
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 "../common/debug.h"
#include "../common/classes.h"
-1
View File
@@ -16,7 +16,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "debug.h"
#include "condition.h"
#ifdef _WINDOWS
+24 -15
View File
@@ -15,13 +15,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include "../common/rulesys.h"
#include <cmath>
#include <ctype.h>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <mysqld_error.h>
#include <stdio.h>
@@ -42,8 +42,8 @@
#include "database.h"
#include "eq_packet_structs.h"
#include "string_util.h"
#include "extprofile.h"
#include "string_util.h"
extern Client client;
@@ -2099,6 +2099,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
"`aug_3` int(11) unsigned DEFAULT '0', "
"`aug_4` int(11) unsigned DEFAULT '0', "
"`aug_5` int(11) unsigned DEFAULT '0', "
"`aug_6` int(11) unsigned DEFAULT '0', "
"`attuned` smallint(5) NOT NULL DEFAULT '0', "
"PRIMARY KEY(`corpse_id`, `equip_slot`) "
") ENGINE = InnoDB DEFAULT CHARSET = latin1; "
@@ -2276,8 +2277,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
for (unsigned int i = 0; i < dbpc->itemcount; i++) {
if (first_entry != 1){
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n"
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
atoi(row2[0]),
dbpc->items[i].equipSlot,
dbpc->items[i].item_id,
@@ -2286,12 +2287,14 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc->items[i].aug2,
dbpc->items[i].aug3,
dbpc->items[i].aug4,
dbpc->items[i].aug5
dbpc->items[i].aug5,
dbpc->items[i].aug6,
dbpc->items[i].attuned
);
first_entry = 1;
}
else{
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
atoi(row2[0]),
dbpc->items[i].equipSlot,
dbpc->items[i].item_id,
@@ -2300,7 +2303,9 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc->items[i].aug2,
dbpc->items[i].aug3,
dbpc->items[i].aug4,
dbpc->items[i].aug5
dbpc->items[i].aug5,
dbpc->items[i].aug6,
dbpc->items[i].attuned
);
}
}
@@ -2310,7 +2315,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
/* Classic Converter */
scquery = StringFormat("UPDATE `character_corpses` SET \n"
"`is_locked` = %d,\n"
"`exp` = %u,\n"
"`exp` = %u,\n"
"`size` = %f,\n"
"`level` = %u,\n"
"`race` = %u,\n"
@@ -2338,7 +2343,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
"`wc_6` = %u,\n"
"`wc_7` = %u,\n"
"`wc_8` = %u,\n"
"`wc_9` = %u \n"
"`wc_9` = %u \n"
"WHERE `id` = %u \n",
dbpc_c->locked,
dbpc_c->exp,
@@ -2381,8 +2386,8 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
for (unsigned int i = 0; i < dbpc_c->itemcount; i++) {
if (first_entry != 1){
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n"
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
atoi(row2[0]),
dbpc_c->items[i].equipSlot,
dbpc_c->items[i].item_id,
@@ -2391,12 +2396,14 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc_c->items[i].aug2,
dbpc_c->items[i].aug3,
dbpc_c->items[i].aug4,
dbpc_c->items[i].aug5
dbpc_c->items[i].aug5,
dbpc_c->items[i].aug6,
dbpc_c->items[i].attuned
);
first_entry = 1;
}
else{
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
atoi(row2[0]),
dbpc_c->items[i].equipSlot,
dbpc_c->items[i].item_id,
@@ -2405,7 +2412,9 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
dbpc_c->items[i].aug2,
dbpc_c->items[i].aug3,
dbpc_c->items[i].aug4,
dbpc_c->items[i].aug5
dbpc_c->items[i].aug5,
dbpc_c->items[i].aug6,
dbpc_c->items[i].attuned
);
}
}
+6 -21
View File
@@ -26,6 +26,8 @@
#include "dbcore.h"
#include "linked_list.h"
#include "eq_packet_structs.h"
#include <cmath>
#include <string>
#include <vector>
#include <map>
@@ -33,23 +35,9 @@
//atoi is not uint32 or uint32 safe!!!!
#define atoul(str) strtoul(str, nullptr, 10)
//class Spawn;
class Corpse;
class Spawn2;
class NPC;
class SpawnGroupList;
class Petition;
class Client;
class Merc;
class MySQLRequestResult;
struct Combine_Struct;
//struct Faction;
//struct FactionMods;
//struct FactionValue;
struct ZonePoint;
struct NPCType;
class Inventory;
class ItemInst;
class MySQLRequestResult;
class Client;
struct EventLogDetails_Struct {
uint32 id;
@@ -81,11 +69,6 @@ struct VarCache_Struct {
char value[0];
};
struct PlayerProfile_Struct;
struct GuildRankLevel_Struct;
struct GuildRanks_Struct;
struct ExtendedProfile_Struct;
struct GuildMember_Struct;
class PTimerList;
#pragma pack(1)
@@ -426,6 +409,8 @@ namespace Convert {
uint32 aug3;
uint32 aug4;
uint32 aug5;
uint32 aug6;
uint8 attuned;
};
}
+5 -7
View File
@@ -1,18 +1,16 @@
#include "../common/debug.h"
#ifdef _WINDOWS
#include <winsock2.h>
#endif
#include "../common/misc_functions.h"
#include "dbcore.h"
#include <errmsg.h>
#include <fstream>
#include <iostream>
#include <errmsg.h>
#include <mysqld_error.h>
#include <limits.h>
#include "dbcore.h"
#include <string.h>
#include "../common/misc_functions.h"
#include <cstdlib>
#ifdef _WINDOWS
#define snprintf _snprintf
+4 -7
View File
@@ -6,15 +6,12 @@
#include <windows.h>
#endif
#include "../common/mutex.h"
#include "../common/mysql_request_result.h"
#include "../common/types.h"
#include <mysql.h>
#include <string.h>
#include "../common/types.h"
#include "../common/mutex.h"
#include "../common/linked_list.h"
#include "../common/queue.h"
#include "../common/timer.h"
#include "../common/condition.h"
#include "../common/mysql_request_result.h"
class DBcore {
public:
+2 -2
View File
@@ -138,8 +138,8 @@ public:
// items
// common and container sizes will not increase until the new 'location' struct is implemented
static const uint16 ITEM_COMMON_SIZE = Underfoot::consts::ITEM_COMMON_SIZE;
static const uint16 ITEM_CONTAINER_SIZE = Underfoot::consts::ITEM_CONTAINER_SIZE;
static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE;
static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE;
// player profile
//static const uint32 CLASS_BITMASK = 0; // needs value
+5 -3
View File
@@ -2919,7 +2919,7 @@ uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts
*/
struct ItemViewRequest_Struct {
/*000*/ uint32 item_id;
/*004*/ uint32 augments[5];
/*004*/ uint32 augments[6];
/*024*/ uint32 link_hash;
/*028*/ uint32 unknown028;
/*032*/ char unknown032[12]; //probably includes loregroup & evolving info. see Client::MakeItemLink() in zone/inventory.cpp:469
@@ -5242,8 +5242,10 @@ struct ServerLootItem_Struct {
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint8 min_level; //
uint8 max_level; //
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint8 min_level;
uint8 max_level;
};
//Found in client near a ref to the string:
+78 -13
View File
@@ -24,6 +24,7 @@
#include "races.h"
#include "shareddb.h"
#include "classes.h"
#include "rulesys.h"
#include <limits.h>
@@ -1125,10 +1126,12 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst)
m_trade[slot_id] = inst;
result = slot_id;
}
else {
else
{
// Slot must be within a bag
ItemInst* baginst = GetItem(Inventory::CalcSlotId(slot_id)); // Get parent bag
if (baginst && baginst->IsType(ItemClassContainer)) {
if (baginst && baginst->IsType(ItemClassContainer))
{
baginst->_PutItem(Inventory::CalcBagIdx(slot_id), inst);
result = slot_id;
}
@@ -1397,7 +1400,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
m_item = item;
m_charges = charges;
m_price = 0;
m_instnodrop = false;
m_attuned = false;
m_merchantslot = 0;
if(m_item &&m_item->ItemClass == ItemClassCommon)
m_color = m_item->Color;
@@ -1414,6 +1417,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
m_scaling = false;
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
}
ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
@@ -1422,7 +1426,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
m_charges = charges;
m_price = 0;
m_merchantslot = 0;
m_instnodrop=false;
m_attuned=false;
if(m_item && m_item->ItemClass == ItemClassCommon)
m_color = m_item->Color;
else
@@ -1438,6 +1442,7 @@ ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) {
m_scaling = false;
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
}
ItemInst::ItemInst(ItemInstTypes use_type) {
@@ -1445,7 +1450,7 @@ ItemInst::ItemInst(ItemInstTypes use_type) {
m_item = nullptr;
m_charges = 0;
m_price = 0;
m_instnodrop = false;
m_attuned = false;
m_merchantslot = 0;
m_color = 0;
@@ -1457,6 +1462,7 @@ ItemInst::ItemInst(ItemInstTypes use_type) {
m_scaling = false;
m_ornamenticon = 0;
m_ornamentidfile = 0;
m_ornament_hero_model = 0;
}
// Make a copy of an ItemInst object
@@ -1469,7 +1475,7 @@ ItemInst::ItemInst(const ItemInst& copy)
m_color=copy.m_color;
m_merchantslot=copy.m_merchantslot;
m_currentslot=copy.m_currentslot;
m_instnodrop=copy.m_instnodrop;
m_attuned=copy.m_attuned;
m_merchantcount=copy.m_merchantcount;
// Copy container contents
iter_contents it;
@@ -1509,6 +1515,7 @@ ItemInst::ItemInst(const ItemInst& copy)
m_scaling = copy.m_scaling;
m_ornamenticon = copy.m_ornamenticon;
m_ornamentidfile = copy.m_ornamentidfile;
m_ornament_hero_model = copy.m_ornament_hero_model;
}
// Clean up container contents
@@ -1782,21 +1789,79 @@ ItemInst* ItemInst::GetAugment(uint8 slot) const
return nullptr;
}
ItemInst* ItemInst::GetOrnamentationAug(int ornamentationAugtype) const
ItemInst* ItemInst::GetOrnamentationAug(int32 ornamentationAugtype) const
{
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype) {
const char *item_IDFile = GetAugment(i)->GetItem()->IDFile;
if (strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0 || strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0)
continue;
if (ornamentationAugtype > 0)
{
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++)
{
if (GetAugment(i) && m_item->AugSlotType[i] == ornamentationAugtype)
{
const char *item_IDFile = GetAugment(i)->GetItem()->IDFile;
if (
(strncmp(item_IDFile, "IT64", strlen(item_IDFile)) == 0
|| strncmp(item_IDFile, "IT63", strlen(item_IDFile)) == 0)
&& GetAugment(i)->GetItem()->HerosForgeModel == 0
)
{
continue;
}
return this->GetAugment(i);
}
}
}
return nullptr;
}
uint32 ItemInst::GetOrnamentHeroModel(int32 material_slot) const {
uint32 HeroModel = 0;
if (m_ornament_hero_model > 0)
{
HeroModel = m_ornament_hero_model;
if (material_slot >= 0)
{
HeroModel = (m_ornament_hero_model * 100) + material_slot;
}
}
return HeroModel;
}
bool ItemInst::UpdateOrnamentationInfo() {
bool ornamentSet = false;
if (IsType(ItemClassCommon))
{
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
if (GetOrnamentationAug(ornamentationAugtype))
{
const Item_Struct* ornamentItem;
ornamentItem = GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (ornamentItem != nullptr)
{
SetOrnamentIcon(ornamentItem->Icon);
SetOrnamentHeroModel(ornamentItem->HerosForgeModel);
if (strlen(ornamentItem->IDFile) > 2)
{
SetOrnamentationIDFile(atoi(&ornamentItem->IDFile[2]));
}
else
{
SetOrnamentationIDFile(0);
}
ornamentSet = true;
}
}
else
{
SetOrnamentIcon(0);
SetOrnamentHeroModel(0);
SetOrnamentationIDFile(0);
}
}
return ornamentSet;
}
bool ItemInst::CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll) {
if (!ItemToTry || !Container) return false;
+13 -9
View File
@@ -294,7 +294,7 @@ public:
//
// Augements
//
inline bool IsAugmentable() const { return m_item->AugSlotType[0]!=0 || m_item->AugSlotType[1]!=0 || m_item->AugSlotType[2]!=0 || m_item->AugSlotType[3]!=0 || m_item->AugSlotType[4]!=0; }
inline bool IsAugmentable() const { return m_item->AugSlotType[0] != 0 || m_item->AugSlotType[1] != 0 || m_item->AugSlotType[2] != 0 || m_item->AugSlotType[3] != 0 || m_item->AugSlotType[4] != 0 || m_item->AugSlotType[5] != 0; }
bool AvailableWearSlot(uint32 aug_wear_slots) const;
int8 AvailableAugmentSlot(int32 augtype) const;
bool IsAugmentSlotAvailable(int32 augtype, uint8 slot) const;
@@ -329,7 +329,8 @@ public:
void DeleteAugment(uint8 slot);
ItemInst* RemoveAugment(uint8 index);
bool IsAugmented();
ItemInst* GetOrnamentationAug(int ornamentationAugtype) const;
ItemInst* GetOrnamentationAug(int32 ornamentationAugtype) const;
bool UpdateOrnamentationInfo();
static bool CanTransform(const Item_Struct *ItemToTry, const Item_Struct *Container, bool AllowAll = false);
// Has attack/delay?
@@ -361,8 +362,8 @@ public:
void SetCurrentSlot(int16 curr_slot) { m_currentslot = curr_slot; }
// Is this item already attuned?
bool IsInstNoDrop() const { return m_instnodrop; }
void SetInstNoDrop(bool flag) { m_instnodrop=flag; }
bool IsAttuned() const { return m_attuned; }
void SetAttuned(bool flag) { m_attuned=flag; }
std::string GetCustomDataString() const;
std::string GetCustomData(std::string identifier);
@@ -393,10 +394,12 @@ public:
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 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; }
void Initialize(SharedDatabase *db = nullptr);
void ScaleItem();
@@ -432,7 +435,7 @@ protected:
uint32 m_color;
uint32 m_merchantslot;
int16 m_currentslot;
bool m_instnodrop;
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;
@@ -443,6 +446,7 @@ protected:
bool m_scaling;
uint32 m_ornamenticon;
uint32 m_ornamentidfile;
uint32 m_ornament_hero_model;
//
// Items inside of this item (augs or contents);
+2
View File
@@ -101,6 +101,8 @@ F(augslot4type)
F(augslot4visible)
F(augslot5type)
F(augslot5visible)
F(augslot6type)
F(augslot6visible)
F(ldontheme)
F(ldonprice)
F(ldonsold)
+3 -3
View File
@@ -183,9 +183,9 @@ struct Item_Struct {
int32 FactionAmt4; // Faction Amt 4
char CharmFile[32]; // ?
uint32 AugType;
uint8 AugSlotType[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Type
uint8 AugSlotVisible[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Visible
uint8 AugSlotUnk2[EmuConstants::ITEM_COMMON_SIZE]; // LDoN: Augment Slot 1-5 Unknown
uint8 AugSlotType[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Type
uint8 AugSlotVisible[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Visible
uint8 AugSlotUnk2[EmuConstants::ITEM_COMMON_SIZE]; // RoF: Augment Slot 1-6 Unknown
uint32 LDoNTheme;
uint32 LDoNPrice;
uint32 LDoNSold;
+1 -1
View File
@@ -1249,7 +1249,7 @@ namespace Client62
//merchant_slot, //instance ID, bullshit for now
// The 'Merchant Slot' needs to be some unique id for bazaar to work properly
(merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot,
inst->IsInstNoDrop() ? 1 : 0, //not sure where this field is
inst->IsAttuned() ? 1 : 0, //not sure where this field is
(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? charges : 0) : charges),
0
);
+26 -14
View File
@@ -3812,8 +3812,8 @@ namespace RoF
Equipment[k].material = emu->equipment[k].material;
Equipment[k].unknown1 = emu->equipment[k].unknown1;
Equipment[k].elitematerial = emu->equipment[k].elitematerial;
Equipment[k].material2 = emu->equipment[k].heroforgemodel;
Equipment[k].elitematerial = emu->equipment[k].material2;
Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel;
Equipment[k].material2 = emu->equipment[k].material2;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
@@ -4406,7 +4406,7 @@ namespace RoF
IN(item_id);
int r;
for (r = 0; r < 5; r++) {
for (r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) {
IN(augments[r]);
}
// Max Augs is now 6, but no code to support that many yet
@@ -4847,7 +4847,6 @@ namespace RoF
hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot;
hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff;
hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff;
//hdr.unknown013 = 0xffff;
hdr.price = inst->GetPrice();
hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount();
//hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff;
@@ -4856,7 +4855,7 @@ namespace RoF
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
@@ -4877,6 +4876,8 @@ namespace RoF
}
//ORNAMENT IDFILE / ICON
uint16 ornaIcon = 0;
int32 heroModel = 0;
/*
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
//Mainhand
@@ -4887,8 +4888,16 @@ namespace RoF
ss.write((const char*)&null_term, sizeof(uint8));
//Icon
ornaIcon = aug_weap->Icon;
if (aug_weap->HerosForgeModel > 0)
{
heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in);
}
}
else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
else
*/
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon())
{
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
//Mainhand
ss.write(tmp, strlen(tmp));
@@ -4897,10 +4906,12 @@ namespace RoF
ss.write(tmp, strlen(tmp));
ss.write((const char*)&null_term, sizeof(uint8));
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
}
else {
ss.write((const char*)&null_term, sizeof(uint8)); //no mh
ss.write((const char*)&null_term, sizeof(uint8));//no of
else
{
ss.write((const char*)&null_term, sizeof(uint8)); // no main hand Ornamentation
ss.write((const char*)&null_term, sizeof(uint8)); // no off hand Ornamentation
}
RoF::structs::ItemSerializationHeaderFinish hdrf;
@@ -4908,12 +4919,13 @@ namespace RoF
hdrf.unknown061 = 0;
hdrf.unknown062 = 0;
hdrf.unknowna1 = 0xffffffff;
hdrf.unknowna2 = 0;
hdrf.ornamentHeroModel = heroModel;
hdrf.unknown063 = 0;
hdrf.unknowna3 = 0;
hdrf.unknowna4 = 0xffffffff;
hdrf.unknowna5 = 0;
hdrf.ItemClass = item->ItemClass;
ss.write((const char*)&hdrf, sizeof(RoF::structs::ItemSerializationHeaderFinish));
if (strlen(item->Name) > 0)
@@ -5062,7 +5074,7 @@ namespace RoF
isbs.augdistiller = 65535;
isbs.augrestrict = item->AugRestrict;
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < consts::ITEM_COMMON_SIZE; x++)
{
isbs.augslots[x].type = item->AugSlotType[x];
isbs.augslots[x].visible = item->AugSlotVisible[x];
@@ -5070,9 +5082,9 @@ namespace RoF
}
// Increased to 6 max aug slots
isbs.augslots[5].type = 0;
isbs.augslots[5].visible = 1;
isbs.augslots[5].unknown = 0;
//isbs.augslots[5].type = 0;
//isbs.augslots[5].visible = 1;
//isbs.augslots[5].unknown = 0;
isbs.ldonpoint_type = item->PointType;
isbs.ldontheme = item->LDoNTheme;
+30 -18
View File
@@ -3816,8 +3816,8 @@ namespace RoF2
Equipment[k].material = emu->equipment[k].material;
Equipment[k].unknown1 = emu->equipment[k].unknown1;
Equipment[k].elitematerial = emu->equipment[k].elitematerial;
Equipment[k].material2 = emu->equipment[k].heroforgemodel;
Equipment[k].elitematerial = emu->equipment[k].material2;
Equipment[k].heroforgemodel = emu->equipment[k].heroforgemodel;
Equipment[k].material2 = emu->equipment[k].material2;
}
Buffer += (sizeof(structs::EquipStruct) * 9);
@@ -4410,10 +4410,9 @@ namespace RoF2
IN(item_id);
int r;
for (r = 0; r < 5; r++) {
for (r = 0; r < EmuConstants::ITEM_COMMON_SIZE; r++) {
IN(augments[r]);
}
// Max Augs is now 6, but no code to support that many yet
IN(link_hash);
IN(icon);
@@ -4851,7 +4850,6 @@ namespace RoF2
hdr.main_slot = (merchant_slot == 0) ? slot_id.MainSlot : merchant_slot;
hdr.sub_slot = (merchant_slot == 0) ? slot_id.SubSlot : 0xffff;
hdr.unknown013 = (merchant_slot == 0) ? slot_id.AugSlot : 0xffff;
//hdr.unknown013 = 0xffff;
hdr.price = inst->GetPrice();
hdr.merchant_slot = (merchant_slot == 0) ? 1 : inst->GetMerchantCount();
//hdr.merchant_slot = (merchant_slot == 0) ? 1 : 0xffffffff;
@@ -4860,10 +4858,10 @@ namespace RoF2
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
hdr.unknown048 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0;
hdr.unknown052 = 7300 + Inventory::CalcMaterialFromSlot(slot_id_in); //0;
hdr.isEvolving = item->EvolvingLevel > 0 ? 1 : 0;
ss.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader));
@@ -4881,7 +4879,10 @@ namespace RoF2
}
//ORNAMENT IDFILE / ICON
uint16 ornaIcon = 0;
if (inst->GetOrnamentationAug(ornamentationAugtype)) {
int32 heroModel = 0;
/*
if (inst->GetOrnamentationAug(ornamentationAugtype))
{
const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
//Mainhand
ss.write(aug_weap->IDFile, strlen(aug_weap->IDFile));
@@ -4891,8 +4892,16 @@ namespace RoF2
ss.write((const char*)&null_term, sizeof(uint8));
//Icon
ornaIcon = aug_weap->Icon;
if (aug_weap->HerosForgeModel > 0)
{
heroModel = (aug_weap->HerosForgeModel * 100) + Inventory::CalcMaterialFromSlot(slot_id_in);
}
}
else if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon()) {
else
*/
if (inst->GetOrnamentationIDFile() && inst->GetOrnamentationIcon())
{
char tmp[30]; memset(tmp, 0x0, 30); sprintf(tmp, "IT%d", inst->GetOrnamentationIDFile());
//Mainhand
ss.write(tmp, strlen(tmp));
@@ -4901,10 +4910,12 @@ namespace RoF2
ss.write(tmp, strlen(tmp));
ss.write((const char*)&null_term, sizeof(uint8));
ornaIcon = inst->GetOrnamentationIcon();
heroModel = inst->GetOrnamentHeroModel(Inventory::CalcMaterialFromSlot(slot_id_in));
}
else {
ss.write((const char*)&null_term, sizeof(uint8)); //no mh
ss.write((const char*)&null_term, sizeof(uint8));//no of
else
{
ss.write((const char*)&null_term, sizeof(uint8)); // no main hand Ornamentation
ss.write((const char*)&null_term, sizeof(uint8)); // no off hand Ornamentation
}
RoF2::structs::ItemSerializationHeaderFinish hdrf;
@@ -4912,12 +4923,13 @@ namespace RoF2
hdrf.unknown061 = 0;
hdrf.unknown062 = 0;
hdrf.unknowna1 = 0xffffffff;
hdrf.unknowna2 = 0;
hdrf.ornamentHeroModel = heroModel;
hdrf.unknown063 = 0;
hdrf.unknowna3 = 0;
hdrf.unknowna4 = 0xffffffff;
hdrf.unknowna5 = 0;
hdrf.ItemClass = item->ItemClass;
ss.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish));
if (strlen(item->Name) > 0)
@@ -5066,7 +5078,7 @@ namespace RoF2
isbs.augdistiller = 65535;
isbs.augrestrict = item->AugRestrict;
for (int x = AUG_BEGIN; x < EmuConstants::ITEM_COMMON_SIZE; ++x)
for (int x = AUG_BEGIN; x < consts::ITEM_COMMON_SIZE; x++)
{
isbs.augslots[x].type = item->AugSlotType[x];
isbs.augslots[x].visible = item->AugSlotVisible[x];
@@ -5074,9 +5086,9 @@ namespace RoF2
}
// Increased to 6 max aug slots
isbs.augslots[5].type = 0;
isbs.augslots[5].visible = 1;
isbs.augslots[5].unknown = 0;
//isbs.augslots[5].type = 0;
//isbs.augslots[5].visible = 1;
//isbs.augslots[5].unknown = 0;
isbs.ldonpoint_type = item->PointType;
isbs.ldontheme = item->LDoNTheme;
+3
View File
@@ -332,6 +332,9 @@ These fields must be in the order of how they are serialized!
/* 091 */ I(AugSlotType[4])
/* 092 */ I(AugSlotVisible[4])
/* 092 */ I(AugSlotUnk2[4])
/* 091 */ I(AugSlotType[5])
/* 092 */ I(AugSlotVisible[5])
/* 092 */ I(AugSlotUnk2[5])
/* 093 */ I(PointType)
/* 093 */ I(LDoNTheme)
/* 094 */ I(LDoNPrice)
+4 -4
View File
@@ -4425,14 +4425,14 @@ struct EvolvingItem {
struct ItemSerializationHeaderFinish
{
uint16 ornamentIcon;
/*079*/ uint16 ornamentIcon;
/*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0?
/*082*/ uint8 unknown062; // 0
/*083*/ uint32 unknowna1; // 0xffffffff
/*087*/ uint32 unknowna2; // 0
/*083*/ int32 unknowna1; // 0xffffffff
/*087*/ uint32 ornamentHeroModel; // 0
/*091*/ uint8 unknown063; // 0
/*092*/ uint32 unknowna3; // 0
/*096*/ uint32 unknowna4; // 0xffffffff
/*096*/ int32 unknowna4; // 0xffffffff
/*100*/ uint32 unknowna5; // 0
/*104*/ uint8 ItemClass; //0, 1, or 2
/*105*/
+3
View File
@@ -332,6 +332,9 @@ These fields must be in the order of how they are serialized!
/* 091 */ I(AugSlotType[4])
/* 092 */ I(AugSlotVisible[4])
/* 092 */ I(AugSlotUnk2[4])
/* 091 */ I(AugSlotType[5])
/* 092 */ I(AugSlotVisible[5])
/* 092 */ I(AugSlotUnk2[5])
/* 093 */ I(PointType)
/* 093 */ I(LDoNTheme)
/* 094 */ I(LDoNPrice)
+4 -4
View File
@@ -4422,14 +4422,14 @@ struct EvolvingItem {
struct ItemSerializationHeaderFinish
{
uint16 ornamentIcon;
/*079*/ uint16 ornamentIcon;
/*081*/ uint8 unknown061; // 0 - Add Evolving Item struct if this isn't set to 0?
/*082*/ uint8 unknown062; // 0
/*083*/ uint32 unknowna1; // 0xffffffff
/*087*/ uint32 unknowna2; // 0
/*083*/ int32 unknowna1; // 0xffffffff
/*087*/ uint32 ornamentHeroModel; // 0
/*091*/ uint8 unknown063; // 0
/*092*/ uint32 unknowna3; // 0
/*096*/ uint32 unknowna4; // 0xffffffff
/*096*/ int32 unknowna4; // 0xffffffff
/*100*/ uint32 unknowna5; // 0
/*104*/ uint8 ItemClass; //0, 1, or 2
/*105*/
+2 -2
View File
@@ -3223,7 +3223,7 @@ namespace SoD
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
@@ -3370,7 +3370,7 @@ namespace SoD
isbs.augtype = item->AugType;
isbs.augrestrict = item->AugRestrict;
for (int x = 0; x < 5; ++x)
for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++)
{
isbs.augslots[x].type = item->AugSlotType[x];
isbs.augslots[x].visible = item->AugSlotVisible[x];
+2 -2
View File
@@ -2547,7 +2547,7 @@ namespace SoF
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
@@ -2693,7 +2693,7 @@ namespace SoF
isbs.augtype = item->AugType;
isbs.augrestrict = item->AugRestrict;
for (int x = 0; x < 5; ++x)
for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++)
{
isbs.augslots[x].type = item->AugSlotType[x];
isbs.augslots[x].visible = item->AugSlotVisible[x];
+1 -1
View File
@@ -1678,7 +1678,7 @@ namespace Titanium
(merchant_slot == 0) ? inst->GetSerialNumber() : merchant_slot,
0, // item recast timer timestamp field (aka..last_cast_time field in SoF+ clients)
(stackable ? ((inst->GetItem()->ItemType == ItemTypePotion) ? 1 : 0) : charges),
inst->IsInstNoDrop() ? 1 : 0,
inst->IsAttuned() ? 1 : 0,
0
);
+2 -2
View File
@@ -3637,7 +3637,7 @@ namespace Underfoot
hdr.unknown028 = 0;
hdr.last_cast_time = ((item->RecastDelay > 1) ? 1212693140 : 0);
hdr.charges = (stackable ? (item->MaxCharges ? 1 : 0) : charges);
hdr.inst_nodrop = inst->IsInstNoDrop() ? 1 : 0;
hdr.inst_nodrop = inst->IsAttuned() ? 1 : 0;
hdr.unknown044 = 0;
hdr.unknown048 = 0;
hdr.unknown052 = 0;
@@ -3817,7 +3817,7 @@ namespace Underfoot
isbs.augtype = item->AugType;
isbs.augrestrict = item->AugRestrict;
for (int x = 0; x < 5; ++x)
for (int x = 0; x < consts::ITEM_COMMON_SIZE; x++)
{
isbs.augslots[x].type = item->AugSlotType[x];
isbs.augslots[x].visible = item->AugSlotVisible[x];
+23 -6
View File
@@ -21,6 +21,9 @@
#include <random>
#include <utility>
#include <algorithm>
#include <iterator>
#include <type_traits>
/* This uses mt19937 seeded with the std::random_device
* The idea is to have this be included as a member of another class
@@ -33,35 +36,45 @@ namespace EQEmu {
class Random {
public:
// AKA old MakeRandomInt
const int Int(int low, int high)
int Int(int low, int high)
{
if (low > high)
std::swap(low, high);
return std::uniform_int_distribution<int>(low, high)(m_gen); // [low, high]
return int_dist(m_gen, int_param_t(low, high)); // [low, high]
}
// AKA old MakeRandomFloat
const double Real(double low, double high)
double Real(double low, double high)
{
if (low > high)
std::swap(low, high);
return std::uniform_real_distribution<double>(low, high)(m_gen); // [low, high)
return real_dist(m_gen, real_param_t(low, high)); // [low, high)
}
// example Roll(50) would have a 50% success rate
// Roll(100) 100%, etc
// valid values 0-100 (well, higher works too but ...)
const bool Roll(const int required)
bool Roll(const int required)
{
return Int(0, 99) < required;
}
// valid values 0.0 - 1.0
const bool Roll(const double required)
bool Roll(const double required)
{
return Real(0.0, 1.0) <= required;
}
// std::shuffle requires a RNG engine passed to it, so lets provide a wrapper to use our engine
template<typename RandomAccessIterator>
void Shuffle(RandomAccessIterator first, RandomAccessIterator last)
{
static_assert(std::is_same<std::random_access_iterator_tag,
typename std::iterator_traits<RandomAccessIterator>::iterator_category>::value,
"EQEmu::Random::Shuffle requires random access iterators");
std::shuffle(first, last, m_gen);
}
void Reseed()
{
// We could do the seed_seq thing here too if we need better seeding
@@ -76,7 +89,11 @@ namespace EQEmu {
}
private:
typedef std::uniform_int_distribution<int>::param_type int_param_t;
typedef std::uniform_real_distribution<double>::param_type real_param_t;
std::mt19937 m_gen;
std::uniform_int_distribution<int> int_dist;
std::uniform_real_distribution<double> real_dist;
};
}
+120 -119
View File
@@ -183,7 +183,7 @@ bool SharedDatabase::SaveInventory(uint32 char_id, const ItemInst* inst, int16 s
bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
if (inst->IsType(ItemClassCommon))
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
ItemInst *auginst=inst->GetItem(i);
@@ -197,16 +197,17 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
charges = 0x7FFF;
// Update/Insert item
std::string query = StringFormat("REPLACE INTO inventory "
"(charid, slotid, itemid, charges, instnodrop, custom_data, color, "
"augslot1, augslot2, augslot3, augslot4, augslot5, ornamenticon, ornamentidfile) "
"VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, "
"%lu, %lu, %lu, %lu, %lu, %lu, %lu)",
(unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID,
(unsigned long)charges, (unsigned long)(inst->IsInstNoDrop()? 1: 0),
inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(),
(unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2],
(unsigned long)augslot[3],(unsigned long)augslot[4], (unsigned long)inst->GetOrnamentationIcon(), (unsigned long)inst->GetOrnamentationIDFile());
std::string query = StringFormat("REPLACE INTO inventory "
"(charid, slotid, itemid, charges, instnodrop, custom_data, color, "
"augslot1, augslot2, augslot3, augslot4, augslot5, augslot6, ornamenticon, ornamentidfile, ornament_hero_model) "
"VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %lu, "
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)",
(unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID,
(unsigned long)charges, (unsigned long)(inst->IsAttuned()? 1: 0),
inst->GetCustomDataString().c_str(), (unsigned long)inst->GetColor(),
(unsigned long)augslot[0], (unsigned long)augslot[1], (unsigned long)augslot[2],
(unsigned long)augslot[3], (unsigned long)augslot[4], (unsigned long)augslot[5], (unsigned long)inst->GetOrnamentationIcon(),
(unsigned long)inst->GetOrnamentationIDFile(), (unsigned long)inst->GetOrnamentHeroModel());
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
@@ -226,7 +227,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, int16 slot_id) {
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
uint32 augslot[EmuConstants::ITEM_COMMON_SIZE] = { NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM, NO_ITEM };
if (inst->IsType(ItemClassCommon))
for(int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
ItemInst *auginst=inst->GetItem(i);
@@ -241,15 +242,16 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst,
else
charges = 0x7FFF;
std::string query = StringFormat("REPLACE INTO sharedbank "
"(acctid, slotid, itemid, charges, custom_data, "
"augslot1, augslot2, augslot3, augslot4, augslot5) "
"VALUES( %lu, %lu, %lu, %lu, '%s', "
"%lu, %lu, %lu, %lu, %lu)",
(unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID,
(unsigned long)charges, inst->GetCustomDataString().c_str(), (unsigned long)augslot[0],
(unsigned long)augslot[1],(unsigned long)augslot[2],(unsigned long)augslot[3],(unsigned long)augslot[4]);
auto results = QueryDatabase(query);
std::string query = StringFormat("REPLACE INTO sharedbank "
"(acctid, slotid, itemid, charges, custom_data, "
"augslot1, augslot2, augslot3, augslot4, augslot5, augslot6) "
"VALUES( %lu, %lu, %lu, %lu, '%s', "
"%lu, %lu, %lu, %lu, %lu, %lu)",
(unsigned long)account_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID,
(unsigned long)charges, inst->GetCustomDataString().c_str(), (unsigned long)augslot[0],
(unsigned long)augslot[1], (unsigned long)augslot[2], (unsigned long)augslot[3], (unsigned long)augslot[4],
(unsigned long)augslot[5]);
auto results = QueryDatabase(query);
// Save bag contents, if slot supports bag contents
if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id))
@@ -393,20 +395,20 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
if (is_charid)
query = StringFormat("SELECT sb.slotid, sb.itemid, sb.charges, "
"sb.augslot1, sb.augslot2, sb.augslot3, "
"sb.augslot4, sb.augslot5, sb.custom_data "
"FROM sharedbank sb INNER JOIN character_data ch "
"ON ch.account_id=sb.acctid WHERE ch.id = %i", id);
"sb.augslot1, sb.augslot2, sb.augslot3, "
"sb.augslot4, sb.augslot5, sb.augslot6, sb.custom_data "
"FROM sharedbank sb INNER JOIN character_data ch "
"ON ch.account_id=sb.acctid WHERE ch.id = %i", id);
else
query = StringFormat("SELECT slotid, itemid, charges, "
"augslot1, augslot2, augslot3, "
"augslot4, augslot5, custom_data "
"FROM sharedbank WHERE acctid=%i", id);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
return false;
}
"augslot1, augslot2, augslot3, "
"augslot4, augslot5, augslot6, custom_data "
"FROM sharedbank WHERE acctid=%i", id);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = (int16)atoi(row[0]);
@@ -414,11 +416,12 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
int8 charges = (int8)atoi(row[2]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[3]);
aug[1] = (uint32)atoi(row[4]);
aug[2] = (uint32)atoi(row[5]);
aug[3] = (uint32)atoi(row[6]);
aug[4] = (uint32)atoi(row[7]);
aug[0] = (uint32)atoi(row[3]);
aug[1] = (uint32)atoi(row[4]);
aug[2] = (uint32)atoi(row[5]);
aug[3] = (uint32)atoi(row[6]);
aug[4] = (uint32)atoi(row[7]);
aug[5] = (uint32)atoi(row[8]);
const Item_Struct* item = GetItem(item_id);
@@ -440,13 +443,13 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
}
}
if(!row[8])
continue;
if(!row[9])
continue;
std::string data_str(row[8]);
std::string idAsString;
std::string value;
bool use_id = true;
std::string data_str(row[9]);
std::string idAsString;
std::string value;
bool use_id = true;
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
@@ -488,14 +491,14 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
// Retrieve character inventory
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
"augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile "
"FROM inventory WHERE charid = %i ORDER BY slotid", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
return false;
}
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
"FROM inventory WHERE charid = %i ORDER BY slotid", char_id);
auto results = QueryDatabase(query);
if (!results.Success()) {
LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
return false;
}
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
@@ -505,16 +508,18 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoul(row[4]);
aug[1] = (uint32)atoul(row[5]);
aug[2] = (uint32)atoul(row[6]);
aug[3] = (uint32)atoul(row[7]);
aug[4] = (uint32)atoul(row[8]);
aug[0] = (uint32)atoul(row[4]);
aug[1] = (uint32)atoul(row[5]);
aug[2] = (uint32)atoul(row[6]);
aug[3] = (uint32)atoul(row[7]);
aug[4] = (uint32)atoul(row[8]);
aug[5] = (uint32)atoul(row[9]);
bool instnodrop = (row[9] && (uint16)atoi(row[9]))? true: false;
bool instnodrop = (row[10] && (uint16)atoi(row[10]))? true: false;
uint32 ornament_icon = (uint32)atoul(row[11]);
uint32 ornament_idfile = (uint32)atoul(row[12]);
uint32 ornament_icon = (uint32)atoul(row[12]);
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const Item_Struct* item = GetItem(item_id);
@@ -527,11 +532,11 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
ItemInst* inst = CreateBaseItem(item, charges);
if(row[10]) {
std::string data_str(row[10]);
std::string idAsString;
std::string value;
bool use_id = true;
if(row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
@@ -552,14 +557,13 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
value.push_back(v);
}
}
if (ornament_icon > 0)
inst->SetOrnamentIcon(ornament_icon);
if (ornament_idfile > 0)
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable))
inst->SetInstNoDrop(true);
if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable))
inst->SetAttuned(true);
if (color > 0)
inst->SetColor(color);
@@ -599,12 +603,12 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) {
// Retrieve character inventory
std::string query = StringFormat("SELECT slotid, itemid, charges, color, augslot1, "
"augslot2, augslot3, augslot4, augslot5, instnodrop, custom_data, ornamenticon, ornamentidfile "
"FROM inventory INNER JOIN character_data ch "
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
name, account_id);
auto results = QueryDatabase(query);
if (!results.Success()){
"augslot2, augslot3, augslot4, augslot5, augslot6, instnodrop, custom_data, ornamenticon, ornamentidfile, ornament_hero_model "
"FROM inventory INNER JOIN character_data ch "
"ON ch.id = charid WHERE ch.name = '%s' AND ch.account_id = %i ORDER BY slotid",
name, account_id);
auto results = QueryDatabase(query);
if (!results.Success()){
LogFile->write(EQEMuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
LogFile->write(EQEMuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
return false;
@@ -617,30 +621,32 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
int8 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
aug[3] = (uint32)atoi(row[7]);
aug[4] = (uint32)atoi(row[8]);
uint32 aug[EmuConstants::ITEM_COMMON_SIZE];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
aug[3] = (uint32)atoi(row[7]);
aug[4] = (uint32)atoi(row[8]);
aug[5] = (uint32)atoi(row[9]);
bool instnodrop = (row[9] && (uint16)atoi(row[9])) ? true : false;
uint32 ornament_icon = (uint32)atoul(row[11]);
uint32 ornament_idfile = (uint32)atoul(row[12]);
bool instnodrop = (row[10] && (uint16)atoi(row[10])) ? true : false;
uint32 ornament_icon = (uint32)atoul(row[12]);
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
const Item_Struct* item = GetItem(item_id);
int16 put_slot_id = INVALID_INDEX;
if(!item)
continue;
ItemInst* inst = CreateBaseItem(item, charges);
inst->SetInstNoDrop(instnodrop);
ItemInst* inst = CreateBaseItem(item, charges);
inst->SetAttuned(instnodrop);
if(row[10]) {
std::string data_str(row[10]);
std::string idAsString;
std::string value;
bool use_id = true;
if(row[11]) {
std::string data_str(row[11]);
std::string idAsString;
std::string value;
bool use_id = true;
for(int i = 0; i < data_str.length(); ++i) {
if(data_str[i] == '^') {
@@ -663,11 +669,9 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
}
}
if (ornament_icon > 0)
inst->SetOrnamentIcon(ornament_icon);
if (ornament_idfile > 0)
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
if (color > 0)
inst->SetColor(color);
@@ -854,23 +858,6 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
item.ItemType = (uint8)atoi(row[ItemField::itemtype]);
item.Material = (uint8)atoi(row[ItemField::material]);
item.HerosForgeModel = (uint32)atoi(row[ItemField::herosforgemodel]);
if (item.HerosForgeModel > 0)
{
item.HerosForgeModel *= 100;
uint32 HeroSlot = 0;
switch (item.Slots)
{
case 4: { HeroSlot = 0; break; } // Head
case 131072: { HeroSlot = 1; break; } // Chest
case 128: { HeroSlot = 2; break; } // Arms
case 1536: { HeroSlot = 3; break; } // Bracers
case 4096: { HeroSlot = 4; break; } // Hands
case 262144: { HeroSlot = 5; break; } // Legs
case 524288: { HeroSlot = 6; break; } // Feet
default: { HeroSlot = 1; break; } // Chest
}
item.HerosForgeModel += HeroSlot;
}
item.SellRate = (float)atof(row[ItemField::sellrate]);
item.CastTime = (uint32)atoul(row[ItemField::casttime]);
item.EliteMaterial = (uint32)atoul(row[ItemField::elitematerial]);
@@ -912,6 +899,9 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
item.AugSlotType[4] = (uint8)atoi(row[ItemField::augslot5type]);
item.AugSlotVisible[4] = (uint8)atoi(row[ItemField::augslot5visible]);
item.AugSlotUnk2[4] = 0;
item.AugSlotType[5] = (uint8)atoi(row[ItemField::augslot6type]);
item.AugSlotVisible[5] = (uint8)atoi(row[ItemField::augslot6visible]);
item.AugSlotUnk2[5] = 0;
item.LDoNTheme = (uint32)atoul(row[ItemField::ldontheme]);
item.LDoNPrice = (uint32)atoul(row[ItemField::ldonprice]);
@@ -1024,11 +1014,18 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
}
const Item_Struct* SharedDatabase::GetItem(uint32 id) {
if(!items_hash || id > items_hash->max_key()) {
if (id == 0)
{
return nullptr;
}
if(items_hash->exists(id)) {
if(!items_hash || id > items_hash->max_key())
{
return nullptr;
}
if(items_hash->exists(id))
{
return &(items_hash->at(id));
}
@@ -1197,7 +1194,7 @@ bool SharedDatabase::LoadNPCFactionLists() {
}
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
const Item_Struct* item = nullptr;
ItemInst* inst = nullptr;
@@ -1209,6 +1206,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
inst->PutAugment(this, 2, aug3);
inst->PutAugment(this, 3, aug4);
inst->PutAugment(this, 4, aug5);
inst->PutAugment(this, 5, aug6);
inst->SetAttuned(attuned);
}
return inst;
@@ -1216,7 +1215,7 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
// Create appropriate ItemInst class
ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5)
ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned)
{
ItemInst* inst = nullptr;
if (item) {
@@ -1226,6 +1225,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin
inst->PutAugment(this, 2, aug3);
inst->PutAugment(this, 3, aug4);
inst->PutAugment(this, 4, aug5);
inst->PutAugment(this, 5, aug6);
inst->SetAttuned(attuned);
}
return inst;
+2 -2
View File
@@ -71,8 +71,8 @@ public:
/*
* 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);
ItemInst* CreateItem(const Item_Struct* item, int16 charges=0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
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 Item_Struct* 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 Item_Struct* item, int16 charges=0);
// Web Token Verification
+1 -1
View File
@@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9060
#define CURRENT_BINARY_DATABASE_VERSION 9062
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
#ifndef WIN32