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
commit 7ad2ead1be
125 changed files with 1277 additions and 985 deletions

View File

@ -1,5 +1,22 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 12/15/2014 ==
Trevius: (RoF+) Implemented the 6th Augment Slot for Items.
Trevius: Player Corpses now saved attuned settings for Items.
Required SQL: utils/sql/git/required/2014_12_15_multiple_table_updates.sql
== 12/13/2014 ==
demonstar55: Fix guild rank spam on zone (needed to be in OP_PP).
Trevius: (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table.
Trevius: (RoF+) Added command #heromodel (#hm for short) - Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63)
Be sure to run this or there will be item loss:
Required SQL: utils/sql/git/required/2014_12_13_inventory_table_update.sql
== 12/12/2014 ==
demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest)
== 12/09/2014 ==
Trevius: (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example).
demonstar55: SoF+ swarm pets will no longer be F8able (without a hack!)

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;

View File

@ -21,7 +21,6 @@
#include "types.h"
#include <stdio.h>
#include <string.h>
#include <string>
#ifdef WIN32
#include <time.h>

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"

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

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
);
}
}

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;
};
}

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

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:

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

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:

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;

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);

View File

@ -101,6 +101,8 @@ F(augslot4type)
F(augslot4visible)
F(augslot5type)
F(augslot5visible)
F(augslot6type)
F(augslot6visible)
F(ldontheme)
F(ldonprice)
F(ldonsold)

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;

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
);

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;

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;

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)

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*/

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)

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*/

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];

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];

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
);

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];

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;
};
}

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;

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

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

View File

@ -314,6 +314,8 @@
9058|2014_11_26_InventoryTableUpdate.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornamenticon'|empty|
9059|2014_12_01_mercs_table_update.sql|SHOW COLUMNS FROM `mercs` LIKE 'MercSize'|empty|
9060|2014_12_09_items_table_update.sql|SHOW COLUMNS FROM `items` LIKE 'herosforgemodel'|empty|
9061|2014_12_11_inventory_table_update.sql|SHOW COLUMNS FROM `inventory` LIKE 'ornament_hero_model'|empty|
9062|2014_12_15_multiple_table_updates.sql|SHOW COLUMNS FROM `items` LIKE 'augslot6type'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,2 @@
INSERT INTO `commands` (`command`, `access`) VALUES ('heromodel', 80);
INSERT INTO `commands` (`command`, `access`) VALUES ('hm', 80);

View File

@ -0,0 +1 @@
ALTER TABLE `inventory` ADD `ornament_hero_model` int( 11 ) NOT NULL DEFAULT '0' AFTER `ornamentidfile`;

View File

@ -0,0 +1,16 @@
/* Add the new Aug Slot 6 Fields to the items table */
ALTER TABLE `items` ADD `augslot6type` tinyint( 3 ) NOT NULL DEFAULT '0' AFTER `augslot5visible`;
ALTER TABLE `items` ADD `augslot6visible` tinyint( 3 ) NOT NULL DEFAULT '0' AFTER `augslot6type`;
ALTER TABLE `items` ADD `augslot6unk2` int( 11 ) NOT NULL DEFAULT '0' AFTER `augslot5unk2`;
/* Add the new Aug Slot 6 Field to the inventory table */
ALTER TABLE `inventory` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`;
/* Add the new Aug Slot 6 Field to the sharedbank table */
ALTER TABLE `sharedbank` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`;
/* Add the new Aug Slot 6 Field to the object_contents table */
ALTER TABLE `object_contents` ADD `augslot6` mediumint( 7 ) NOT NULL DEFAULT '0' AFTER `augslot5`;
/* Add the new Aug Slot 6 Field to the sharedbank table */
ALTER TABLE `character_corpse_items` ADD `aug_6` int( 11 ) NOT NULL DEFAULT '0' AFTER `aug_5`;

View File

@ -154,18 +154,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
}
/* Bind End */
/*
Character's equipped items
@merth: Haven't done bracer01/bracer02 yet.
Also: this needs a second look after items are a little more solid
NOTE: items don't have a color, players MAY have a tint, if the
use_tint part is set. otherwise use the regular color
*/
/* Load Character Material Data for Char Select */
cquery = StringFormat("SELECT slot, red, green, blue, use_tint, color FROM `character_material` WHERE `id` = %u", character_id);
auto results_b = database.QueryDatabase(cquery); uint8 slot = 0;
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b)
{
slot = atoi(row_b[0]);
pp.item_tint[slot].rgb.red = atoi(row_b[1]);
pp.item_tint[slot].rgb.green = atoi(row_b[2]);
@ -175,53 +168,70 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
/* Load Inventory */
inv = new Inventory;
if (GetInventory(account_id, cs->name[char_num], inv)) {
for (uint8 material = 0; material <= 8; material++) {
uint32 color = 0;
ItemInst *item = inv->GetItem(Inventory::CalcSlotFromMaterial(material));
if (item == 0)
continue;
if (GetInventory(account_id, cs->name[char_num], inv))
{
const Item_Struct* item = nullptr;
const ItemInst* inst = nullptr;
int16 invslot = 0;
cs->equip[char_num][material].material = item->GetItem()->Material;
cs->equip[char_num][material].material = 0;
cs->equip[char_num][material].elitematerial = item->GetItem()->EliteMaterial;
cs->equip[char_num][material].heroforgemodel = item->GetItem()->HerosForgeModel;
cs->equip[char_num][material].material2 = item->GetItem()->Material;
for (uint32 matslot = 0; matslot < _MaterialCount; matslot++)
{
invslot = Inventory::CalcSlotFromMaterial(matslot);
if (invslot == INVALID_INDEX) { continue; }
if (pp.item_tint[material].rgb.use_tint){ color = pp.item_tint[material].color; }
else{ color = item->GetItem()->Color; }
inst = inv->GetItem(invslot);
if (inst == nullptr) { continue; }
cs->equip[char_num][material].color.color = color;
item = inst->GetItem();
if (item == nullptr) { continue; }
/* Weapons are handled a bit differently */
if ((material == MaterialPrimary) || (material == MaterialSecondary)) {
if (strlen(item->GetItem()->IDFile) > 2) {
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
uint32 idfile;
if (item->GetOrnamentationAug(ornamentationAugtype)) {
idfile = atoi(&item->GetOrnamentationAug(ornamentationAugtype)->GetItem()->IDFile[2]);
}
else if (item->GetOrnamentationIcon() && item->GetOrnamentationIDFile()) {
idfile = item->GetOrnamentationIDFile();
}
else {
idfile = atoi(&item->GetItem()->IDFile[2]);
}
if (material == MaterialPrimary)
cs->primary[char_num] = idfile;
else
cs->secondary[char_num] = idfile;
if (matslot > 6)
{
uint32 idfile = 0;
// Weapon Models
if (inst->GetOrnamentationIDFile() != 0)
{
idfile = inst->GetOrnamentationIDFile();
cs->equip[char_num][matslot].material = idfile;
}
else
{
if (strlen(item->IDFile) > 2)
{
idfile = atoi(&item->IDFile[2]);
cs->equip[char_num][matslot].material = idfile;
}
}
if (matslot == MaterialPrimary)
{
cs->primary[char_num] = idfile;
}
else
{
cs->secondary[char_num] = idfile;
}
}
else
{
// Armor Materials/Models
cs->equip[char_num][matslot].material = item->Material;
cs->equip[char_num][matslot].elitematerial = item->EliteMaterial;
cs->equip[char_num][matslot].heroforgemodel = inst->GetOrnamentHeroModel(matslot);
cs->equip[char_num][matslot].color.color = inst->GetColor();
}
}
}
else {
else
{
printf("Error loading inventory for %s\n", cs->name[char_num]);
}
safe_delete(inv);
if (++char_num > 10)
{
break;
}
}
return;

View File

@ -19,7 +19,6 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
#include "../common/classes.h"
#include "../common/debug.h"
#include "../common/eq_packet_structs.h"
#include "../common/packet_dump.h"
#include "../common/races.h"
#include "../common/spdat.h"
#include "../common/string_util.h"

View File

@ -5,6 +5,7 @@
struct AA_Ability;
struct SendAA_Struct;
#define MANA_BURN 664
#include <map>
@ -2155,6 +2156,7 @@ enum { //values of AA_Action.action
};
class Timer;
class Mob;
class AA_SwarmPetInfo {
public:
AA_SwarmPetInfo();

View File

@ -39,6 +39,10 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern WorldServer worldserver;

View File

@ -23,7 +23,7 @@ target to center around.
*/
#include "../common/debug.h"
class Zone;
#ifdef _WINDOWS
#define snprintf _snprintf
@ -32,7 +32,17 @@ target to center around.
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
#include "../common/races.h"
#include "beacon.h"
#include "entity.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "../common/spdat.h"
extern EntityList entity_list;

View File

@ -19,11 +19,14 @@
#ifndef BEACON_H
#define BEACON_H
#include "entity.h"
#include "mob.h"
#include "../common/types.h"
#include "../common/timer.h"
class Group;
class Raid;
struct ExtraAttackOptions;
class Beacon : public Mob
{
public:

View File

@ -15,27 +15,29 @@
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/spdat.h"
#include "masterentity.h"
#include "../common/packet_dump.h"
#include "../common/moremath.h"
#include "../common/item.h"
#include "worldserver.h"
#include "../common/skills.h"
#include "../common/bodytypes.h"
#include "../common/classes.h"
#include "../common/debug.h"
#include "../common/item.h"
#include "../common/rulesys.h"
#include "../common/skills.h"
#include "../common/spdat.h"
#include "client.h"
#include "entity.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "quest_parser_collection.h"
#include <math.h>
#include <assert.h>
#include <iostream>
#ifndef WIN32
#include <stdlib.h>
#include "../common/unix.h"
#endif
#include "string_ids.h"
void Mob::CalcBonuses()
{

View File

@ -4173,7 +4173,7 @@ void Bot::SetBotItemInSlot(uint32 slotID, uint32 itemID, const ItemInst* inst, s
"augslot1, augslot2, augslot3, augslot4, augslot5) "
"VALUES(%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu)",
(unsigned long)this->GetBotID(), (unsigned long)slotID, (unsigned long)itemID,
(unsigned long)inst->GetCharges(), (unsigned long)(inst->IsInstNoDrop()? 1: 0),
(unsigned long)inst->GetCharges(), (unsigned long)(inst->IsAttuned()? 1: 0),
(unsigned long)inst->GetColor(), (unsigned long)augslot[0], (unsigned long)augslot[1],
(unsigned long)augslot[2], (unsigned long)augslot[3], (unsigned long)augslot[4]);
auto results = database.QueryDatabase(query);
@ -4235,7 +4235,7 @@ void Bot::GetBotItems(std::string* errorMessage, Inventory &inv) {
int16 put_slot_id = INVALID_INDEX;
if (instnodrop || ((slot_id >= EmuConstants::EQUIPMENT_BEGIN) && (slot_id <= EmuConstants::EQUIPMENT_END) && inst->GetItem()->Attuneable))
inst->SetInstNoDrop(true);
inst->SetAttuned(true);
if (color > 0)
inst->SetColor(color);
@ -4390,7 +4390,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
uint32 spawnedbotid = 0;
spawnedbotid = this->GetBotID();
for (int i = 0; i < _MaterialCount; i++)
for (int i = 0; i < MaterialPrimary; i++)
{
inst = GetBotItem(i);
if (inst)
@ -4420,6 +4420,34 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
}
}
}
inst = GetBotItem(MainPrimary);
if(inst)
{
item = inst->GetItem();
if(item)
{
if(strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]);
}
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
}
}
inst = GetBotItem(MainSecondary);
if(inst)
{
item = inst->GetItem();
if(item)
{
if(strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]);
}
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
}
}
}
}
@ -16007,11 +16035,13 @@ uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) {
uint32 Bot::GetEquipmentColor(uint8 material_slot) const
{
//Bot tints
uint32 slotid = 0;
int16 slotid = 0;
uint32 botid = this->GetBotID();
//Translate code slot # to DB slot #
slotid = Inventory::CalcSlotFromMaterial(material_slot);
if (slotid == INVALID_INDEX)
return 0;
//read from db
std::string query = StringFormat("SELECT color FROM botinventory "

View File

@ -1819,129 +1819,43 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.runspeed = (gmspeed == 0) ? runspeed : 3.125f;
if (!m_pp.showhelm) ns->spawn.showhelm = 0;
// pp also hold this info; should we pull from there or inventory?
// (update: i think pp should do it, as this holds LoY dye - plus, this is ugly code with Inventory!)
/*
// Equipment/Weapons already set from Mob::FillSpawnStruct
// Commenting this out for now
const Item_Struct* item = nullptr;
const ItemInst* inst = nullptr;
int16 invslot;
// Only Player Races Wear Armor
if (IsPlayerRace(race))
for (uint32 matslot = 0; matslot < _MaterialCount; matslot++)
{
if ((inst = m_inv[MainHands]) && inst->IsType(ItemClassCommon))
// Only Player Races Wear Armor
if (IsPlayerRace(race) || matslot > 6)
{
item = inst->GetItem();
ns->spawn.equipment[MaterialHands].material = item->Material;
ns->spawn.equipment[MaterialHands].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialHands].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialHands].color = m_pp.item_tint[MaterialHands].rgb.use_tint ? m_pp.item_tint[MaterialHands].color : item->Color;
}
if ((inst = m_inv[MainHead]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialHead].material = item->Material;
ns->spawn.equipment[MaterialHead].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialHead].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialHead].color = m_pp.item_tint[MaterialHead].rgb.use_tint ? m_pp.item_tint[MaterialHead].color : item->Color;
}
if ((inst = m_inv[MainArms]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialArms].material = item->Material;
ns->spawn.equipment[MaterialArms].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialArms].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialArms].color = m_pp.item_tint[MaterialArms].rgb.use_tint ? m_pp.item_tint[MaterialArms].color : item->Color;
}
if ((inst = m_inv[MainWrist1]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialWrist].material = item->Material;
ns->spawn.equipment[MaterialWrist].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialWrist].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialWrist].color = m_pp.item_tint[MaterialWrist].rgb.use_tint ? m_pp.item_tint[MaterialWrist].color : item->Color;
}
invslot = Inventory::CalcSlotFromMaterial(matslot);
if (invslot == INVALID_INDEX)
continue;
if ((inst = m_inv[MainChest]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialChest].material = item->Material;
ns->spawn.equipment[MaterialChest].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialChest].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialChest].color = m_pp.item_tint[MaterialChest].rgb.use_tint ? m_pp.item_tint[MaterialChest].color : item->Color;
}
if ((inst = m_inv[MainLegs]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialLegs].material = item->Material;
ns->spawn.equipment[MaterialLegs].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialLegs].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialLegs].color = m_pp.item_tint[MaterialLegs].rgb.use_tint ? m_pp.item_tint[MaterialLegs].color : item->Color;
}
if ((inst = m_inv[MainFeet]) && inst->IsType(ItemClassCommon))
{
item = inst->GetItem();
ns->spawn.equipment[MaterialFeet].material = item->Material;
ns->spawn.equipment[MaterialFeet].elitematerial = item->EliteMaterial;
ns->spawn.equipment[MaterialFeet].heroforgemodel = item->HerosForgeModel;
ns->spawn.colors[MaterialFeet].color = m_pp.item_tint[MaterialFeet].rgb.use_tint ? m_pp.item_tint[MaterialFeet].color : item->Color;
}
}
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
if ((inst = m_inv[MainPrimary]) && inst->IsType(ItemClassCommon))
{
if (inst->GetOrnamentationAug(ornamentationAugtype))
{
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (strlen(item->IDFile) > 2)
if ((inst = m_inv[invslot]) && inst->IsType(ItemClassCommon))
{
ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]);
}
}
else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile())
{
ns->spawn.equipment[MaterialPrimary].material = inst->GetOrnamentationIDFile();
}
else
{
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]);
item = inst->GetItem();
if (matslot > 6)
{
// Weapon Models
ns->spawn.equipment[matslot].material = GetEquipmentMaterial(matslot);
}
else
{
// Armor Materials/Models
ns->spawn.equipment[matslot].material = item->Material;
ns->spawn.equipment[matslot].elitematerial = item->EliteMaterial;
ns->spawn.equipment[matslot].heroforgemodel = GetHerosForgeModel(matslot);
ns->spawn.colors[matslot].color = m_pp.item_tint[matslot].rgb.use_tint ? m_pp.item_tint[matslot].color : item->Color;
}
}
}
}
if ((inst = m_inv[MainSecondary]) && inst->IsType(ItemClassCommon))
{
if (inst->GetOrnamentationAug(ornamentationAugtype))
{
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]);
}
}
else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile())
{
ns->spawn.equipment[MaterialSecondary].material = inst->GetOrnamentationIDFile();
}
else
{
item = inst->GetItem();
if (strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]);
}
}
}
//these two may be related to ns->spawn.texture
/*
ns->spawn.npc_armor_graphic = texture;
ns->spawn.npc_helm_graphic = helmtexture;
*/
//filling in some unknowns to make the client happy
// ns->spawn.unknown0002[2] = 3;
}
bool Client::GMHideMe(Client* client) {
@ -2769,48 +2683,10 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){
void Client::SetMaterial(int16 in_slot, uint32 item_id) {
const Item_Struct* item = database.GetItem(item_id);
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
if (item && (item->ItemClass==ItemClassCommon)) {
if (in_slot==MainHead)
m_pp.item_material[MaterialHead] = item->Material;
else if (in_slot==MainChest)
m_pp.item_material[MaterialChest] = item->Material;
else if (in_slot==MainArms)
m_pp.item_material[MaterialArms] = item->Material;
else if (in_slot==MainWrist1)
m_pp.item_material[MaterialWrist] = item->Material;
else if (in_slot==MainHands)
m_pp.item_material[MaterialHands] = item->Material;
else if (in_slot==MainLegs)
m_pp.item_material[MaterialLegs] = item->Material;
else if (in_slot==MainFeet)
m_pp.item_material[MaterialFeet] = item->Material;
else if (in_slot == MainPrimary) {
const ItemInst* inst = m_inv[MainPrimary];
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2);
}
else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) {
m_pp.item_material[MaterialPrimary] = inst->GetOrnamentationIDFile();
}
else {
m_pp.item_material[MaterialPrimary] = atoi(item->IDFile + 2);
}
}
else if (in_slot == MainSecondary) {
const ItemInst* inst = m_inv[MainSecondary];
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2);
}
else if (inst && inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) {
m_pp.item_material[MaterialSecondary] = inst->GetOrnamentationIDFile();
}
else {
m_pp.item_material[MaterialSecondary] = atoi(item->IDFile + 2);
}
}
if (item && (item->ItemClass==ItemClassCommon))
{
uint32 matslot = Inventory::CalcMaterialFromSlot(in_slot);
m_pp.item_material[matslot] = GetEquipmentMaterial(matslot);
}
}
@ -5859,17 +5735,18 @@ void Client::ProcessInspectRequest(Client* requestee, Client* requester) {
if(inst) {
item = inst->GetItem();
if(item) {
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
strcpy(insr->itemnames[L], item->Name);
insr->itemicons[L] = aug_weap->Icon;
strcpy(insr->itemnames[L], item->Name);
if (inst && inst->GetOrnamentationAug(ornamentationAugtype))
{
const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
insr->itemicons[L] = aug_item->Icon;
}
else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) {
strcpy(insr->itemnames[L], item->Name);
else if (inst && inst->GetOrnamentationIcon())
{
insr->itemicons[L] = inst->GetOrnamentationIcon();
}
else {
strcpy(insr->itemnames[L], item->Name);
else
{
insr->itemicons[L] = item->Icon;
}
}

View File

@ -17,7 +17,17 @@
*/
#ifndef CLIENT_H
#define CLIENT_H
class Client;
class EQApplicationPacket;
class EQStream;
class Group;
class NPC;
class Object;
class Raid;
class Seperator;
class ServerPacket;
struct Item_Struct;
#include "../common/timer.h"
#include "../common/ptimer.h"
@ -28,25 +38,21 @@ class Client;
#include "../common/eq_packet.h"
#include "../common/linked_list.h"
#include "../common/extprofile.h"
#include "../common/classes.h"
#include "../common/races.h"
#include "../common/deity.h"
#include "../common/seperator.h"
#include "../common/item.h"
#include "../common/guilds.h"
#include "../common/item_struct.h"
#include "../common/clientversions.h"
#include "common.h"
#include "zonedb.h"
#include "errno.h"
#include "mob.h"
#include "npc.h"
#include "merc.h"
#include "zone.h"
#include "aa.h"
#include "questmgr.h"
#include "common.h"
#include "merc.h"
#include "mob.h"
#include "qglobals.h"
#include "questmgr.h"
#include "zone.h"
#include "zonedb.h"
#ifdef _WINDOWS
// since windows defines these within windef.h (which windows.h include)
@ -57,7 +63,6 @@ class Client;
#include <float.h>
#include <set>
#include <string>
#include <algorithm>
@ -805,7 +810,7 @@ public:
void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false);
void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0);
bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0);
bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0);
bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = MainCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0);
void SetStats(uint8 type,int16 set_val);
void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id);

View File

@ -18,11 +18,11 @@
#ifndef CLIENT_LOGS_H
#define CLIENT_LOGS_H
#include "../common/debug.h"
#include "../common/features.h"
#ifdef CLIENT_LOGS
#include "../common/eq_packet_structs.h"
#define CLIENT_LOG_CHANNEL MT_Chat10Echo

View File

@ -15,18 +15,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <algorithm>
#include "../common/debug.h"
#include "../common/logsys.h"
#include "../common/spdat.h"
#include "../common/rulesys.h"
#include "masterentity.h"
#include "npc_ai.h"
#include "petitions.h"
#include "string_ids.h"
#include "worldserver.h"
#include "zonedb.h"
#include "../common/spdat.h"
#include "client.h"
#include "mob.h"
#ifdef BOTS
#include "bot.h"
#endif
#include <algorithm>
int32 Client::GetMaxStat() const {

View File

@ -61,6 +61,10 @@
#include "remote_call.h"
#include "remote_call_subscribe.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;
extern Zone* zone;
extern volatile bool ZoneLoaded;
@ -1486,9 +1490,28 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
m_pp.gm = 0;
/* Load Guild */
if (!IsInAGuild()) { m_pp.guild_id = GUILD_NONE; }
else {
if (!IsInAGuild()) {
m_pp.guild_id = GUILD_NONE;
} else {
m_pp.guild_id = GuildID();
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
// FIXME: RoF guild rank
if (GetClientVersion() >= EQClientRoF) {
switch (rank) {
case 0:
rank = 5;
break;
case 1:
rank = 3;
break;
case 2:
rank = 1;
break;
default:
break;
}
}
m_pp.guildrank = rank;
if (zone->GetZoneID() == RuleI(World, GuildBankZoneID))
GuildBanker = (guild_mgr.IsGuildLeader(GuildID(), CharacterID()) || guild_mgr.GetBankerFlag(CharacterID()));
}
@ -2726,7 +2749,7 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app)
SetAlternateCurrencyValue(reclaim->currency_id, 0);
}
else {
SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, false, MainCursor);
SummonItem(item_id, reclaim->count, 0, 0, 0, 0, 0, 0, false, MainCursor);
AddAlternateCurrencyValue(reclaim->currency_id, -((int32)reclaim->count));
}
/* QS: PlayerLogAlternateCurrencyTransactions :: Cursor to Item Storage */
@ -3069,7 +3092,6 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
uint16 slot_id = in_augment->container_slot;
uint16 aug_slot_id = in_augment->augment_slot;
//Message(13, "%i AugSlot", aug_slot_id);
if (slot_id == INVALID_INDEX || aug_slot_id == INVALID_INDEX)
{
Message(13, "Error: Invalid Aug Index.");
@ -3085,6 +3107,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
(tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots)))
{
tobe_auged->PutAugment(in_augment->augment_index, *auged_with);
tobe_auged->UpdateOrnamentationInfo();
ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_index);
if (aug) {
@ -3107,15 +3130,16 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
{
DeleteItemInInventory(slot_id, 0, true);
DeleteItemInInventory(MainCursor, 0, true);
if (PutItemInInventory(slot_id, *itemOneToPush, true))
{
CalcBonuses();
//Message(13, "Sucessfully added an augment to your item!");
// Successfully added an augment to the item
return;
}
else
{
Message(13, "Error: No available slot for end result. Please free up some bag space.");
Message(13, "Error: No available slot for end result. Please free up the augment slot.");
}
}
else
@ -3169,6 +3193,7 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
return;
}
old_aug = tobe_auged->RemoveAugment(in_augment->augment_index);
tobe_auged->UpdateOrnamentationInfo();
itemOneToPush = tobe_auged->Clone();
if (old_aug)
@ -3177,9 +3202,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
{
DeleteItemInInventory(slot_id, 0, true);
DeleteItemInInventory(aug_slot_id, auged_with->IsStackable() ? 1 : 0, true);
if (!PutItemInInventory(slot_id, *itemOneToPush, true))
{
Message(15, "Shouldn't happen, contact an admin!");
Message(15, "Failed to remove augment properly!");
}
if (PutItemInInventory(MainCursor, *itemTwoToPush, true))
@ -6977,7 +7003,7 @@ void Client::Handle_OP_GuildBank(const EQApplicationPacket *app)
const Item_Struct* CursorItem = CursorItemInst->GetItem();
if (!CursorItem->NoDrop || CursorItemInst->IsInstNoDrop())
if (!CursorItem->NoDrop || CursorItemInst->IsAttuned())
{
Message_StringID(13, GUILD_BANK_CANNOT_DEPOSIT);
@ -8043,17 +8069,15 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app)
item = inst ? inst->GetItem() : nullptr;
if (item) {
strcpy(insr->itemnames[L], item->Name);
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
const Item_Struct *aug_weap = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
strcpy(insr->itemnames[L], item->Name);
insr->itemicons[L] = aug_weap->Icon;
const Item_Struct *aug_item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
insr->itemicons[L] = aug_item->Icon;
}
else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) {
strcpy(insr->itemnames[L], item->Name);
else if (inst->GetOrnamentationIcon()) {
insr->itemicons[L] = inst->GetOrnamentationIcon();
}
else {
strcpy(insr->itemnames[L], item->Name);
insr->itemicons[L] = item->Icon;
}
}
@ -8224,7 +8248,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
}
ItemInst* inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4]);
ItemInst* inst = database.CreateItem(item, item->MaxCharges, ivrs->augments[0], ivrs->augments[1], ivrs->augments[2], ivrs->augments[3], ivrs->augments[4], ivrs->augments[5]);
if (inst) {
SendItemPacket(0, inst, ItemPacketViewLink);
safe_delete(inst);
@ -8380,7 +8404,7 @@ void Client::Handle_OP_ItemPreview(const EQApplicationPacket *app)
}
outapp->WriteUInt32(0xFFFFFFFF); //Unknown but always seen as FF FF FF FF
outapp->WriteUInt32(0); //Unknown
for (spacer = 0; spacer < 5; spacer++) { //Augment stuff
for (spacer = 0; spacer < 6; spacer++) { //Augment stuff
outapp->WriteUInt32(item->AugSlotType[spacer]);
outapp->WriteUInt8(item->AugSlotVisible[spacer]);
outapp->WriteUInt8(item->AugSlotUnk2[spacer]);

View File

@ -153,6 +153,8 @@ int command_init(void) {
command_add("version","- Display current version of EQEmu server",0,command_version) ||
command_add("setfaction","[faction number] - Sets targeted NPC's faction in the database",170,command_setfaction) ||
command_add("wc","[wear slot] [material] - Sends an OP_WearChange for your target",200,command_wc) ||
command_add("heromodel", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.", 200, command_heromodel) ||
command_add("hm", "[hero model] [slot] - Full set of Hero's Forge Armor appearance. If slot is set, sends exact model just to slot.)", 200, command_heromodel) ||
command_add("setanim","[animnum] - Set target's appearance to animnum",200,command_setanim) ||
command_add("connectworldserver","- Make zone attempt to connect to worldserver",200,command_connectworldserver) ||
command_add("connectworld",nullptr,0,command_connectworldserver) ||
@ -787,6 +789,47 @@ void command_wc(Client *c, const Seperator *sep)
}
}
void command_heromodel(Client *c, const Seperator *sep)
{
if (sep->argnum < 1)
{
c->Message(0, "Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63)");
}
else if (c->GetTarget() == nullptr)
{
c->Message(13, "You must have a target to do a wear change for Hero's Forge Models.");
}
else
{
uint32 hero_forge_model = atoi(sep->arg[1]);
if (sep->argnum > 1)
{
uint8 wearslot = (uint8)atoi(sep->arg[2]);
c->GetTarget()->SendTextureWC(wearslot, 0, hero_forge_model, 0, 0, 0);
}
else
{
if (hero_forge_model > 0)
{
// Conversion to simplify the command arguments
// Hero's Forge model is actually model * 1000 + texture * 100 + wearslot
// Hero's Forge Model slot 7 is actually for Robes, but it still needs to use wearslot 1 in the packet
hero_forge_model *= 100;
for (uint8 wearslot = 0; wearslot < 7; wearslot++)
{
c->GetTarget()->SendTextureWC(wearslot, 0, (hero_forge_model + wearslot), 0, 0, 0);
}
}
else
{
c->Message(13, "Hero's Forge Model must be greater than 0.");
}
}
}
}
void command_setanim(Client *c, const Seperator *sep)
{
if (c->GetTarget() && sep->IsNumber(1)) {
@ -5513,18 +5556,20 @@ void command_summonitem(Client *c, const Seperator *sep)
if (item_status > c->Admin())
c->Message(13, "Error: Insufficient status to summon this item.");
else if (sep->argnum==2 && sep->IsNumber(2)) {
c->SummonItem(itemid, atoi(sep->arg[2]) );
} else if (sep->argnum==3) {
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]) );
} else if (sep->argnum==4)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]) );
else if (sep->argnum==2 && sep->IsNumber(2))
c->SummonItem(itemid, atoi(sep->arg[2]));
else if (sep->argnum==3)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]));
else if (sep->argnum==4)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]));
else if (sep->argnum==5)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]) );
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]));
else if (sep->argnum==6)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]) );
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]));
else if (sep->argnum==7)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]) );
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]));
else if (sep->argnum==8)
c->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]), atoi(sep->arg[8]));
else {
c->SummonItem(itemid);
}
@ -5550,18 +5595,20 @@ void command_giveitem(Client *c, const Seperator *sep)
if (item_status > c->Admin())
c->Message(13, "Error: Insufficient status to summon this item.");
else if (sep->argnum==2 && sep->IsNumber(2)) {
t->SummonItem(itemid, atoi(sep->arg[2]) );
} else if (sep->argnum==3) {
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]) );
} else if (sep->argnum==4)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]) );
else if (sep->argnum==2 && sep->IsNumber(2))
t->SummonItem(itemid, atoi(sep->arg[2]));
else if (sep->argnum==3)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]));
else if (sep->argnum==4)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]));
else if (sep->argnum==5)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]) );
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]));
else if (sep->argnum==6)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]) );
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]));
else if (sep->argnum==7)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]) );
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]));
else if (sep->argnum == 7)
t->SummonItem(itemid, atoi(sep->arg[2]), atoi(sep->arg[3]), atoi(sep->arg[4]), atoi(sep->arg[5]), atoi(sep->arg[6]), atoi(sep->arg[7]), atoi(sep->arg[8]));
else {
t->SummonItem(itemid);
}

View File

@ -76,6 +76,7 @@ void command_serversidename(Client *c, const Seperator *sep);
void command_testspawnkill(Client *c, const Seperator *sep);
void command_testspawn(Client *c, const Seperator *sep);
void command_wc(Client *c, const Seperator *sep);
void command_heromodel(Client *c, const Seperator *sep);
void command_numauths(Client *c, const Seperator *sep);
void command_setanim(Client *c, const Seperator *sep);
void command_connectworldserver(Client *c, const Seperator *sep);

View File

@ -134,8 +134,8 @@ enum {
DISABLE_MELEE = 39,
NPC_CHASE_DISTANCE = 40,
ALLOW_TO_TANK = 41,
MAX_SPECIAL_ATTACK = 42
IGNORE_ROOT_AGGRO_RULES = 42,
MAX_SPECIAL_ATTACK = 43
};
typedef enum { //fear states

View File

@ -20,12 +20,7 @@ New class for handeling corpses and everything associated with them.
Child of the Mob class.
-Quagmire
*/
#include "../common/debug.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <sstream>
#ifdef _WINDOWS
#define snprintf _snprintf
#define vsnprintf _vsnprintf
@ -33,14 +28,25 @@ Child of the Mob class.
#define strcasecmp _stricmp
#endif
#include "masterentity.h"
#include "../common/packet_functions.h"
#include "../common/debug.h"
#include "../common/rulesys.h"
#include "../common/string_util.h"
#include "../common/crc32.h"
#include "client.h"
#include "corpse.h"
#include "entity.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
#ifdef BOTS
#include "bot.h"
#endif
#include "quest_parser_collection.h"
#include "string_ids.h"
#include "worldserver.h"
#include "../common/rulesys.h"
#include "quest_parser_collection.h"
#include <iostream>
#include "remote_call_subscribe.h"
@ -446,7 +452,7 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
ItemInst *interior_item;
std::list<uint32> returnlist;
AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4));
AddItem(item->GetItem()->ID, item->GetCharges(), equipslot, item->GetAugmentItemID(0), item->GetAugmentItemID(1), item->GetAugmentItemID(2), item->GetAugmentItemID(3), item->GetAugmentItemID(4), item->GetAugmentItemID(5), item->IsAttuned());
returnlist.push_back(equipslot);
// Qualified bag slot iterations. processing bag slots that don't exist is probably not a good idea.
@ -457,7 +463,7 @@ std::list<uint32> Corpse::MoveItemToCorpse(Client *client, ItemInst *item, int16
interior_item = client->GetInv().GetItem(interior_slot);
if (interior_item) {
AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4));
AddItem(interior_item->GetItem()->ID, interior_item->GetCharges(), interior_slot, interior_item->GetAugmentItemID(0), interior_item->GetAugmentItemID(1), interior_item->GetAugmentItemID(2), interior_item->GetAugmentItemID(3), interior_item->GetAugmentItemID(4), interior_item->GetAugmentItemID(5), item->IsAttuned());
returnlist.push_back(Inventory::CalcSlotId(equipslot, bagindex));
client->DeleteItemInInventory(interior_slot, 0, true, false);
}
@ -689,7 +695,7 @@ uint32 Corpse::CountItems() {
return itemlist.size();
}
void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5) {
void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, uint8 attuned) {
if (!database.GetItem(itemnum))
return;
@ -706,6 +712,8 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui
item->aug_3=aug3;
item->aug_4=aug4;
item->aug_5=aug5;
item->aug_6=aug6;
item->attuned=attuned;
itemlist.push_back(item);
}
@ -1049,7 +1057,7 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(i < corpselootlimit) {
item = database.GetItem(item_data->item_id);
if(client && item) {
ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5);
ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned);
if(inst) {
// MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor
client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot);
@ -1164,7 +1172,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (item != 0) {
if (item_data){
inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5);
inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned);
}
else {
inst = database.CreateItem(item);
@ -1436,7 +1444,7 @@ void Corpse::Spawn() {
}
uint32 Corpse::GetEquipment(uint8 material_slot) const {
int invslot;
int16 invslot;
if(material_slot > EmuConstants::MATERIAL_END) {
return NO_ITEM;

View File

@ -22,7 +22,14 @@
#include "mob.h"
class Client;
class EQApplicationPacket;
class Group;
class ItemInst;
class NPC;
class Raid;
struct ExtraAttackOptions;
struct NPCType;
#define MAX_LOOTERS 72
@ -79,7 +86,7 @@ class Corpse : public Mob {
int32 GetPlayerKillItem() { return player_kill_item; }
void RemoveItem(uint16 lootslot);
void RemoveItem(ServerLootItem_Struct* item_data);
void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0);
void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, uint8 attuned = 0);
/* Corpse: Coin */
void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum);

View File

@ -15,18 +15,21 @@
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 <iostream>
#include <stdlib.h>
#include <string.h>
#include "masterentity.h"
#include "worldserver.h"
#include "string_ids.h"
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/string_util.h"
#include "client.h"
#include "doors.h"
#include "entity.h"
#include "guild_mgr.h"
#include "mob.h"
#include "string_ids.h"
#include "worldserver.h"
#include "zonedb.h"
#include <iostream>
#include <string.h>
#define OPEN_DOOR 0x02
#define CLOSE_DOOR 0x03

View File

@ -1,14 +1,18 @@
#ifndef DOORS_H
#define DOORS_H
#include "../common/types.h"
#include "../common/linked_list.h"
#include "../common/timer.h"
#include "../common/emu_opcodes.h"
#include "../common/eq_packet_structs.h"
#include "entity.h"
#include "../common/linked_list.h"
#include "mob.h"
#include "zonedump.h"
class Client;
class Mob;
class NPC;
struct Door;
class Doors : public Entity
{
public:

View File

@ -15,20 +15,17 @@
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 "masterentity.h"
#include "../common/spdat.h"
#include "client.h"
#include "entity.h"
#include "mob.h"
#include "string_ids.h"
#include "worldserver.h"
#include "zonedb.h"
#include "../common/spdat.h"
#include "../common/packet_dump.h"
#include "../common/packet_functions.h"
#include "petitions.h"
#include "../common/serverinfo.h"
#include "../common/zone_numbers.h"
#include "../common/moremath.h"
#include "../common/guilds.h"
#include "string_ids.h"
#include "npc_ai.h"
float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard)
{

View File

@ -1146,7 +1146,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
temp_var_name = var_name;
temp_var_name += "_attuned";
ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->IsInstNoDrop());
ExportVar(package_name.c_str(), temp_var_name.c_str(), inst->IsAttuned());
} else {
ExportVar(package_name.c_str(), var_name.c_str(), 0);

View File

@ -23,12 +23,13 @@
#include "../common/debug.h"
#include "../common/misc_functions.h"
#include "embparser.h"
#include "questmgr.h"
#include "embxs.h"
#include "entity.h"
#include "zone.h"
#include "queryserv.h"
#include "questmgr.h"
#include "zone.h"
extern Zone* zone;
extern QueryServ* QServ;

View File

@ -32,7 +32,7 @@
#include "../common/features.h"
#include "../common/guilds.h"
#include "../common/spdat.h"
#include "guild_mgr.h"
#include "net.h"
#include "petitions.h"
@ -49,6 +49,10 @@
#define strcasecmp _stricmp
#endif
#ifdef BOTS
#include "bot.h"
#endif
extern Zone *zone;
extern volatile bool ZoneLoaded;
extern WorldServer worldserver;

View File

@ -17,6 +17,7 @@
*/
#ifndef ENTITY_H
#define ENTITY_H
#include <unordered_map>
#include <queue>
@ -26,26 +27,30 @@
#include "../common/bodytypes.h"
#include "../common/eq_constants.h"
#include "zonedb.h"
#include "zonedump.h"
#include "qglobals.h"
class EQApplicationPacket;
class Client;
class Mob;
class NPC;
class Merc;
class Corpse;
class Beacon;
class Petition;
class Object;
class Group;
class Raid;
class Client;
class Corpse;
class Doors;
class Trap;
class EQApplicationPacket;
class Entity;
class EntityList;
class Group;
class Merc;
class Mob;
class NPC;
class Object;
class Petition;
class Raid;
class Spawn2;
class Trap;
struct GuildBankItemUpdate_Struct;
struct NewSpawn_Struct;
struct QGlobal;
struct UseAA_Struct;
struct Who_All_Struct;
#ifdef BOTS
class Bot;

View File

@ -15,14 +15,24 @@
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/features.h"
#include "masterentity.h"
#include "string_ids.h"
#include "../common/string_util.h"
#include "../common/rulesys.h"
#include "quest_parser_collection.h"
#include "../common/string_util.h"
#include "client.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
#include "queryserv.h"
#include "quest_parser_collection.h"
#include "string_ids.h"
#ifdef BOTS
#include "bot.h"
#endif
extern QueryServ* QServ;

View File

@ -16,17 +16,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include "../common/rulesys.h"
#include "../common/misc_functions.h"
#include "map.h"
#include "zone.h"
#include "pathing.h"
#include "zone.h"
#ifdef _WINDOWS
#define snprintf _snprintf
#endif

View File

@ -22,6 +22,7 @@
#include "../common/packet_dump.h"
#include "../common/string_util.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;

View File

@ -18,14 +18,14 @@
#ifndef GROUPS_H
#define GROUPS_H
#include "../common/types.h"
#include "../common/linked_list.h"
#include "../common/emu_opcodes.h"
#include "../common/eq_packet_structs.h"
#include "entity.h"
#include "../common/types.h"
#include "mob.h"
#include "../common/features.h"
#include "../common/servertalk.h"
class Client;
class EQApplicationPacket;
class Mob;
#define MAX_MARKED_NPCS 3

View File

@ -15,14 +15,15 @@
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 "guild_mgr.h"
#include "zonedb.h"
#include "worldserver.h"
#include "../common/servertalk.h"
#include "../common/string_util.h"
#include "client.h"
#include "entity.h"
#include "guild_mgr.h"
#include "worldserver.h"
#include "zonedb.h"
ZoneGuildManager guild_mgr;
GuildBankManager *GuildBanks;

View File

@ -16,19 +16,22 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/debug.h"
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <list>
#include "masterentity.h"
#include "client.h"
#include "entity.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
#include "../common/rulesys.h"
#include "../common/misc_functions.h"
#include "hate_list.h"
#include "quest_parser_collection.h"
#include "zone.h"
#include "water_map.h"
#include <stdlib.h>
#include <list>
extern Zone *zone;
HateList::HateList()

View File

@ -19,6 +19,12 @@
#ifndef HATELIST_H
#define HATELIST_H
class Client;
class Group;
class Mob;
class Raid;
struct ExtraAttackOptions;
struct tHateEntry
{
Mob *ent;

View File

@ -17,13 +17,13 @@
*/
#include "../common/debug.h"
#include "masterentity.h"
#include "../common/item.h"
#include "../common/linked_list.h"
#include "../common/string_util.h"
#include <math.h>
#include <assert.h>
#include "worldserver.h"
#include "client.h"
#include "entity.h"
#include "horse.h"
#include "mob.h"
std::map<uint16, const NPCType *> Horse::horse_types;
LinkedList<NPCType *> horses_auto_delete;

View File

@ -18,11 +18,15 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#ifndef HORSES_H
#define HORSES_H
#include "../common/debug.h"
#include "npc.h"
#include <map>
class Client;
class Mob;
struct NPCType;
struct NewSpawn_Struct;
class Horse : public NPC {
public:
Horse(Client *owner, uint16 spell_id, float x, float y, float z, float heading);

View File

@ -189,7 +189,7 @@ bool Client::CheckLoreConflict(const Item_Struct* item) {
return (m_inv.HasItemByLoreGroup(item->LoreGroup, ~invWhereSharedBank) != INVALID_INDEX);
}
bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile) {
bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned, uint16 to_slot, uint32 ornament_icon, uint32 ornament_idfile, uint32 ornament_hero_model) {
this->EVENT_ITEM_ScriptStopReturn();
// TODO: update calling methods and script apis to handle a failure return
@ -199,8 +199,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// make sure the item exists
if(item == nullptr) {
Message(13, "Item %u does not exist.", item_id);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item_id, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -212,10 +212,10 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
return false;
}
// check to make sure we are augmenting an augmentable item
else if(((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5)) {
else if (((item->ItemClass != ItemClassCommon) || (item->AugType > 0)) && (aug1 | aug2 | aug3 | aug4 | aug5 | aug6)) {
Message(13, "You can not augment an augment or a non-common class item.");
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an augment or a non-common class item.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -228,14 +228,14 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
/*
else if(item->MinStatus && ((this->Admin() < item->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(13, "You are not a GM or do not have the status to summon this item.");
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n",
GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, item->MinStatus);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only item with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u, MinStatus: %u)\n",
GetName(), account_name, this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false;
}
*/
uint32 augments[EmuConstants::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5 };
uint32 augments[EmuConstants::ITEM_COMMON_SIZE] = { aug1, aug2, aug3, aug4, aug5, aug6 };
uint32 classes = item->Classes;
uint32 races = item->Races;
@ -251,8 +251,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(augtest == nullptr) {
if(augments[iter]) {
Message(13, "Augment %u (Aug%i) does not exist.", augments[iter], iter + 1);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an augment (Aug%i) with an invalid id.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -268,8 +268,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check that augment is an actual augment
else if(augtest->AugType == 0) {
Message(13, "%s (%u) (Aug%i) is not an actual augment.", augtest->Name, augtest->ID, iter + 1);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to use a non-augment item (Aug%i) as an augment.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item->ID, (iter + 1), aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -281,7 +281,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
else if(augtest->MinStatus && ((this->Admin() < augtest->MinStatus) || (this->Admin() < RuleI(GM, MinStatusToSummonItem)))) {
Message(13, "You are not a GM or do not have the status to summon this augment.");
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create a GM-only augment (Aug%i) with a status of %i.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, MinStatus: %u)\n",
GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, item->MinStatus);
GetName(), account_name, (iter + 1), this->Admin(), item->ID, aug1, aug2, aug3, aug4, aug5, aug6, item->MinStatus);
return false;
}
@ -291,16 +291,16 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(enforcewear) {
if((item->AugSlotType[iter] == AugTypeNone) || !(((uint32)1 << (item->AugSlotType[iter] - 1)) & augtest->AugType)) {
Message(13, "Augment %u (Aug%i) is not acceptable wear on Item %u.", augments[iter], iter + 1, item->ID);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with an unacceptable augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
if(item->AugSlotVisible[iter] == 0) {
Message(13, "Item %u has not evolved enough to accept Augment %u (Aug%i).", item->ID, augments[iter], iter + 1);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an unevolved item with augment type (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -476,8 +476,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(restrictfail) {
Message(13, "Augment %u (Aug%i) is restricted from wear on Item %u.", augments[iter], (iter + 1), item->ID);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to augment an item with a restricted augment (Aug%i).\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, (iter + 1), item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -487,8 +487,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for class usability
if(item->Classes && !(classes &= augtest->Classes)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable by any class.", augments[iter], (iter + 1));
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any class.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -496,8 +496,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for race usability
if(item->Races && !(races &= augtest->Races)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable by any race.", augments[iter], (iter + 1));
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable by any race.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -505,8 +505,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// check for slot usability
if(item->Slots && !(slots &= augtest->Slots)) {
Message(13, "Augment %u (Aug%i) will result in an item not usable in any slot.", augments[iter], (iter + 1));
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to create an item unusable in any slot.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -532,8 +532,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(inst == nullptr) {
Message(13, "An unknown server error has occurred and your item was not created.");
// this goes to logfile since this is a major error
LogFile->write(EQEMuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5);
LogFile->write(EQEMuLog::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
return false;
}
@ -546,12 +546,11 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
// attune item
if(attuned && inst->GetItem()->Attuneable)
inst->SetInstNoDrop(true);
inst->SetAttuned(true);
if(ornament_icon > 0 && ornament_idfile > 0) {
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
}
inst->SetOrnamentIcon(ornament_icon);
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(ornament_hero_model);
// check to see if item is usable in requested slot
if(enforceusable && (((to_slot >= MainCharm) && (to_slot <= MainAmmo)) || (to_slot == MainPowerSource))) {
@ -559,8 +558,8 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if(!(slots & ((uint32)1 << slottest))) {
Message(0, "This item is not equipable at slot %u - moving to cursor.", to_slot);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u)\n",
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5);
mlog(INVENTORY__ERROR, "Player %s on account %s attempted to equip an item unusable in slot %u - moved to cursor.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n",
GetName(), account_name, to_slot, item->ID, aug1, aug2, aug3, aug4, aug5, aug6);
to_slot = MainCursor;
}
@ -581,11 +580,13 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
if((RuleB(Character, EnableDiscoveredItems)) && !GetGM()) {
if(!IsDiscovered(item_id))
DiscoverItem(item_id);
/*
// Augments should have been discovered prior to being placed on an item.
for (int iter = AUG_BEGIN; iter < EmuConstants::ITEM_COMMON_SIZE; ++iter) {
if(augments[iter] && !IsDiscovered(augments[iter]))
DiscoverItem(augments[iter]);
}
*/
}
return true;
@ -819,7 +820,11 @@ bool Client::PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client
m_inv.PutItem(slot_id, inst);
if (client_update)
{
SendItemPacket(slot_id, &inst, ((slot_id == MainCursor) ? ItemPacketSummonItem : ItemPacketTrade));
//SendWearChange(Inventory::CalcMaterialFromSlot(slot_id));
}
if (slot_id == MainCursor) {
std::list<ItemInst*>::const_iterator s = m_inv.cursor_begin(), e = m_inv.cursor_end();
@ -853,7 +858,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
{
if(bag_item_data[i] == nullptr)
continue;
const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5);
const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5, bag_item_data[i]->aug_6, bag_item_data[i]->attuned);
interior_slot = Inventory::CalcSlotId(slot_id, i);
mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i);
PutLootInInventory(interior_slot, *bagitem);
@ -1617,13 +1622,13 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
// Not dealing with charges - just do direct swap
if(src_inst && (dst_slot_id <= EmuConstants::EQUIPMENT_END || dst_slot_id == MainPowerSource) && dst_slot_id >= EmuConstants::EQUIPMENT_BEGIN) {
if (src_inst->GetItem()->Attuneable) {
src_inst->SetInstNoDrop(true);
src_inst->SetAttuned(true);
}
if (src_inst->IsAugmented()) {
for (int i = AUG_BEGIN; i < EmuConstants::ITEM_COMMON_SIZE; i++) {
if (src_inst->GetAugment(i)) {
if (src_inst->GetAugment(i)->GetItem()->Attuneable) {
src_inst->GetAugment(i)->SetInstNoDrop(true);
src_inst->GetAugment(i)->SetAttuned(true);
}
}
}
@ -2292,7 +2297,7 @@ void Client::MoveSlotNotAllowed(bool client_update) {
// these functions operate with a material slot, which is from 0 to 8
uint32 Client::GetEquipment(uint8 material_slot) const
{
int invslot;
int16 invslot;
const ItemInst *item;
if(material_slot > EmuConstants::MATERIAL_END)
@ -2301,7 +2306,7 @@ uint32 Client::GetEquipment(uint8 material_slot) const
}
invslot = Inventory::CalcSlotFromMaterial(material_slot);
if(invslot == -1)
if (invslot == INVALID_INDEX)
{
return 0;
}

View File

@ -15,15 +15,20 @@
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 <stdio.h>
#include <iostream>
#include <stdlib.h>
#include "npc.h"
#include "masterentity.h"
#include "zonedb.h"
#include "../common/loottable.h"
#include "../common/misc_functions.h"
#include "client.h"
#include "entity.h"
#include "mob.h"
#include "npc.h"
#include "zonedb.h"
#include <iostream>
#include <stdlib.h>
#ifdef _WINDOWS
#define snprintf _snprintf
#endif
@ -201,6 +206,8 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
item->aug_3 = 0;
item->aug_4 = 0;
item->aug_5 = 0;
item->aug_6 = 0;
item->attuned = 0;
item->min_level = minlevel;
item->max_level = maxlevel;
if (equipit) {

View File

@ -703,13 +703,13 @@ void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5,
bool attuned) {
Lua_Safe_Call_Void();
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned);
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned);
}
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5,
bool attuned, int to_slot) {
Lua_Safe_Call_Void();
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attuned, to_slot);
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot);
}
void Lua_Client::SetStats(int type, int value) {

View File

@ -166,12 +166,12 @@ uint32 Lua_ItemInst::GetColor() {
bool Lua_ItemInst::IsInstNoDrop() {
Lua_Safe_Call_Bool();
return self->IsInstNoDrop();
return self->IsAttuned();
}
void Lua_ItemInst::SetInstNoDrop(bool flag) {
Lua_Safe_Call_Void();
return self->SetInstNoDrop(flag);
return self->SetAttuned(flag);
}
std::string Lua_ItemInst::GetCustomDataString() {

View File

@ -1,15 +1,15 @@
#include "../common/debug.h"
#include "../common/misc_functions.h"
#include "map.h"
#include "raycast_mesh.h"
#include "zone.h"
#include <stdint.h>
#include <algorithm>
#include <locale>
#include <vector>
#include <map>
#include <memory>
#include <tuple>
#include <map>
#include <vector>
#include <zlib.h>
uint32 InflateData(const char* buffer, uint32 len, char* out_buffer, uint32 out_len_max) {

View File

@ -23,7 +23,6 @@
#define ZONE_MAP_H
#include <stdio.h>
#include <string>
#define BEST_Z_INVALID -99999

View File

@ -1,18 +1,21 @@
#include "merc.h"
#include "masterentity.h"
#include "npc_ai.h"
#include "../common/packet_dump.h"
#include "client.h"
#include "corpse.h"
#include "entity.h"
#include "groups.h"
#include "mob.h"
#include "../common/eq_packet_structs.h"
#include "../common/eq_constants.h"
#include "../common/skills.h"
#include "../common/spdat.h"
#include "zone.h"
#include "string_ids.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/rulesys.h"
#include "quest_parser_collection.h"
#include "water_map.h"
extern volatile bool ZoneLoaded;

View File

@ -1,9 +1,18 @@
#ifndef MERC_H
#define MERC_H
#include "mob.h"
#include "zonedb.h"
#include "npc.h"
class Client;
class Corpse;
class Group;
class Mob;
class Raid;
struct Item_Struct;
struct MercTemplate;
struct NPCType;
struct NewSpawn_Struct;
#define MERC_DEBUG 0
#define MAXMERCS 1
#define TANK 1

View File

@ -27,6 +27,10 @@
#include <math.h>
#include <sstream>
#ifdef BOTS
#include "bot.h"
#endif
extern EntityList entity_list;
extern Zone* zone;
@ -972,36 +976,15 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
const Item_Struct *item;
for (i = 0; i < _MaterialCount; i++)
{
// Only Player Races Wear Armor
if (IsPlayerRace(race) || i > 6)
if (Mob::IsPlayerRace(race) || i > 6)
{
ns->spawn.equipment[i].material = GetEquipmentMaterial(i);
item = database.GetItem(GetEquipment(i));
if (item != 0)
{
ns->spawn.equipment[i].elitematerial = item->EliteMaterial;
ns->spawn.equipment[i].heroforgemodel = item->HerosForgeModel;
if (armor_tint[i])
{
ns->spawn.colors[i].color = armor_tint[i];
}
else
{
ns->spawn.colors[i].color = item->Color;
}
}
else
{
if (armor_tint[i])
{
ns->spawn.colors[i].color = armor_tint[i];
}
}
ns->spawn.equipment[i].elitematerial = IsEliteMaterialItem(i);
ns->spawn.equipment[i].heroforgemodel = GetHerosForgeModel(i);
ns->spawn.colors[i].color = GetEquipmentColor(i);
}
}
@ -1023,7 +1006,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
//ns->spawn.DestructibleAppearance = static_cast<EmuAppearance>(_appearance);
// #appearance 44 1 makes it jump but no visible damage
// #appearance 44 2 makes it look completely broken but still visible
// #appearnace 44 3 makes it jump but not visible difference to 3
// #appearance 44 3 makes it jump but not visible difference to 3
// #appearance 44 4 makes it disappear altogether
// #appearance 44 5 makes the client crash.
@ -2627,8 +2610,8 @@ uint32 NPC::GetEquipment(uint8 material_slot) const
{
if(material_slot > 8)
return 0;
int invslot = Inventory::CalcSlotFromMaterial(material_slot);
if (invslot == -1)
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
return 0;
return equipment[invslot];
}
@ -2640,20 +2623,9 @@ void Mob::SendWearChange(uint8 material_slot)
wc->spawn_id = GetID();
wc->material = GetEquipmentMaterial(material_slot);
const Item_Struct *item;
item = database.GetItem(GetEquipment(material_slot));
if (item != 0)
{
wc->elite_material = item->EliteMaterial;
wc->hero_forge_model = item->HerosForgeModel;
wc->color.color = item->Color;
}
else
{
wc->elite_material = 0;
wc->hero_forge_model = 0;
wc->color.color = 0;
}
wc->elite_material = IsEliteMaterialItem(material_slot);
wc->hero_forge_model = GetHerosForgeModel(material_slot);
wc->color.color = GetEquipmentColor(material_slot);
wc->wear_slot_id = material_slot;
entity_list.QueueClients(this, outapp);
@ -2697,7 +2669,7 @@ void Mob::SetSlotTint(uint8 material_slot, uint8 red_tint, uint8 green_tint, uin
wc->spawn_id = this->GetID();
wc->material = GetEquipmentMaterial(material_slot);
wc->hero_forge_model = GetHeroForgeModel(material_slot);
wc->hero_forge_model = GetHerosForgeModel(material_slot);
wc->color.color = color;
wc->wear_slot_id = material_slot;
@ -2724,48 +2696,99 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h
int32 Mob::GetEquipmentMaterial(uint8 material_slot) const
{
uint32 equipmaterial = 0;
int32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
const Item_Struct *item;
int ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
item = database.GetItem(GetEquipment(material_slot));
if(item != 0)
if (item != 0)
{
if // for primary and secondary we need the model, not the material
(
material_slot == MaterialPrimary ||
material_slot == MaterialSecondary
)
// For primary and secondary we need the model, not the material
if (material_slot == MaterialPrimary || material_slot == MaterialSecondary)
{
if (this->IsClient()){
int currMatslot = MaterialPrimary == material_slot ? MainPrimary : MainSecondary;
const ItemInst* inst = CastToClient()->m_inv[currMatslot];
if (inst && inst->GetOrnamentationAug(ornamentationAugtype)) {
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
return atoi(&item->IDFile[2]);
if (this->IsClient())
{
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
{
return 0;
}
else if (inst->GetOrnamentationIcon() && inst->GetOrnamentationIDFile()) {
return inst->GetOrnamentationIDFile();
}
else {
if (strlen(item->IDFile) > 2)
return atoi(&item->IDFile[2]);
else //may as well try this, since were going to 0 anyways
return item->Material;
const ItemInst* inst = CastToClient()->m_inv[invslot];
if (inst)
{
if (inst->GetOrnamentationAug(ornamentationAugtype))
{
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
if (item && strlen(item->IDFile) > 2)
{
equipmaterial = atoi(&item->IDFile[2]);
}
}
else if (inst->GetOrnamentationIDFile())
{
equipmaterial = inst->GetOrnamentationIDFile();
}
}
}
else {
if (strlen(item->IDFile) > 2)
return atoi(&item->IDFile[2]);
else //may as well try this, since were going to 0 anyways
return item->Material;
if (equipmaterial == 0 && strlen(item->IDFile) > 2)
{
equipmaterial = atoi(&item->IDFile[2]);
}
}
else
{
return item->Material;
equipmaterial = item->Material;
}
}
return 0;
return equipmaterial;
}
int32 Mob::GetHerosForgeModel(uint8 material_slot) const
{
uint32 HeroModel = 0;
if (material_slot >= 0 && material_slot < MaterialPrimary)
{
uint32 ornamentationAugtype = RuleI(Character, OrnamentationAugmentType);
const Item_Struct *item;
item = database.GetItem(GetEquipment(material_slot));
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
if (item != 0 && invslot != INVALID_INDEX)
{
if (this->IsClient())
{
const ItemInst* inst = CastToClient()->m_inv[invslot];
if (inst)
{
if (inst->GetOrnamentationAug(ornamentationAugtype))
{
item = inst->GetOrnamentationAug(ornamentationAugtype)->GetItem();
HeroModel = item->HerosForgeModel;
}
else if (inst->GetOrnamentHeroModel())
{
HeroModel = inst->GetOrnamentHeroModel();
}
}
}
if (HeroModel == 0)
{
HeroModel = item->HerosForgeModel;
}
}
}
if (HeroModel > 0)
{
HeroModel *= 100;
HeroModel += material_slot;
}
return HeroModel;
}
uint32 Mob::GetEquipmentColor(uint8 material_slot) const
@ -2794,19 +2817,6 @@ uint32 Mob::IsEliteMaterialItem(uint8 material_slot) const
return 0;
}
uint32 Mob::GetHeroForgeModel(uint8 material_slot) const
{
const Item_Struct *item;
item = database.GetItem(GetEquipment(material_slot));
if (item != 0)
{
return item->HerosForgeModel;
}
return 0;
}
// works just like a printf
void Mob::Say(const char *format, ...)
{

View File

@ -312,9 +312,9 @@ public:
virtual uint16 GetSkill(SkillUseTypes skill_num) const { return 0; }
virtual uint32 GetEquipment(uint8 material_slot) const { return(0); }
virtual int32 GetEquipmentMaterial(uint8 material_slot) const;
virtual int32 GetHerosForgeModel(uint8 material_slot) const;
virtual uint32 GetEquipmentColor(uint8 material_slot) const;
virtual uint32 IsEliteMaterialItem(uint8 material_slot) const;
virtual uint32 GetHeroForgeModel(uint8 material_slot) const;
bool AffectedBySpellExcludingSlot(int slot, int effect);
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) = 0;
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill,

View File

@ -15,27 +15,27 @@
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 <iostream>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include "npc.h"
#include "masterentity.h"
#include "npc_ai.h"
#include "map.h"
#include "../common/moremath.h"
#include "string_ids.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/rulesys.h"
#include "../common/features.h"
#include "../common/rulesys.h"
#include "../common/string_util.h"
#include "client.h"
#include "entity.h"
#include "map.h"
#include "mob.h"
#include "npc.h"
#include "quest_parser_collection.h"
#include "string_ids.h"
#include "water_map.h"
#include "remote_call.h"
#include "remote_call_subscribe.h"
#include <algorithm>
#include <iostream>
#include <math.h>
extern EntityList entity_list;
extern Zone *zone;
@ -1090,7 +1090,7 @@ void Mob::AI_Process() {
{
// we are prevented from getting here if we are blind and don't have a target in range
// from above, so no extra blind checks needed
if (IsRooted() || IsBlind())
if ((IsRooted() && !GetSpecialAbility(IGNORE_ROOT_AGGRO_RULES)) || IsBlind())
SetTarget(hate_list.GetClosest(this));
else
{

View File

@ -1322,11 +1322,14 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
if (material_slot >= _MaterialCount)
return 0;
int inv_slot = Inventory::CalcSlotFromMaterial(material_slot);
if (inv_slot == -1)
int16 invslot = Inventory::CalcSlotFromMaterial(material_slot);
if (invslot == INVALID_INDEX)
return 0;
if(equipment[inv_slot] == 0) {
switch(material_slot) {
if (equipment[invslot] == 0)
{
switch(material_slot)
{
case MaterialHead:
return helmtexture;
case MaterialChest:
@ -1342,7 +1345,7 @@ int32 NPC::GetEquipmentMaterial(uint8 material_slot) const
}
//they have some loot item in this slot, pass it up to the default handler
return(Mob::GetEquipmentMaterial(material_slot));
return (Mob::GetEquipmentMaterial(material_slot));
}
uint32 NPC::GetMaxDamage(uint8 tlevel)

View File

@ -17,19 +17,17 @@
*/
#include "../common/debug.h"
#include <iostream>
#include <stdlib.h>
#include "masterentity.h"
#include "zonedb.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/misc_functions.h"
#include "../common/string_util.h"
#include "../common/features.h"
#include "string_ids.h"
#include "client.h"
#include "entity.h"
#include "mob.h"
#include "object.h"
#include "quest_parser_collection.h"
#include "zonedb.h"
#include <iostream>
const char DEFAULT_OBJECT_NAME[] = "IT63_ACTORDEF";
const char DEFAULT_OBJECT_NAME_SUFFIX[] = "_ACTORDEF";

View File

@ -21,16 +21,15 @@
// Object Class:
// Represents Zone Objects (forges, ovens, brew barrels, items dropped to ground, etc)
#include "../common/types.h"
#include "../common/linked_list.h"
#include "../common/emu_opcodes.h"
#include "../common/eq_packet_structs.h"
#include "../common/item.h"
#include "client.h"
#include "mob.h"
#include "npc.h"
#include "entity.h"
#include "../common/timer.h"
#include "../common/types.h"
#include "entity.h"
class Client;
class EQApplicationPacket;
class ItemInst;
/*
item icon numbers (showeq)

View File

@ -1,22 +1,22 @@
#include "../common/debug.h"
#include <string.h>
#include <math.h>
#include <list>
#include <algorithm>
#include <sstream>
#include <fstream>
#include "client.h"
#include "doors.h"
#include "pathing.h"
#include "water_map.h"
#include "../common/misc_functions.h"
#include "doors.h"
#include "client.h"
#include "zone.h"
#include <fstream>
#include <list>
#include <math.h>
#include <sstream>
#include <string.h>
#ifdef _WINDOWS
#define snprintf _snprintf
#endif
//#define PATHDEBUG
//#define PATHDEBUG
#define ABS(x) ((x)<0?-(x):(x))
extern Zone *zone;

View File

@ -1,13 +1,12 @@
#ifndef PATHING_H
#define PATHING_H
#include <algorithm>
#include "map.h"
#include "../common/timer.h"
#include <list>
#include <vector>
#include <algorithm>
class Client;
class Mob;
#define PATHNODENEIGHBOURS 50

View File

@ -3134,7 +3134,7 @@ XS(XS_Client_SummonItem)
slot_id = (uint16)SvUV(ST(9));
}
THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, attune, slot_id);
THIS->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attune, slot_id);
}
XSRETURN_EMPTY;
}

View File

@ -160,7 +160,7 @@ XS(XS_QuestItem_IsAttuned)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsInstNoDrop();
RETVAL = THIS->IsAttuned();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}

View File

@ -33,6 +33,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/eq_packet_structs.h"
#include "../common/servertalk.h"
#include "../common/string_util.h"
#include "entity.h"
#include "petitions.h"
#include "worldserver.h"

View File

@ -22,6 +22,7 @@
#include "../common/misc_functions.h"
#include "../common/mutex.h"
#include "../common/types.h"
#include "client.h"
#include "zonedb.h"

View File

@ -17,7 +17,6 @@
*/
#include "../common/debug.h"
#include "../common/misc_functions.h"
#include "../common/spdat.h"
#include "../common/string_util.h"
#include "../common/types.h"
@ -27,7 +26,6 @@
#include "mob.h"
#include "pets.h"
#include "worldserver.h"
#include "zonedb.h"
#ifndef WIN32

View File

@ -1,28 +1,31 @@
#ifndef PETS_H
#define PETS_H
#define PET_BACKOFF 1
#define PET_GETLOST 2
#define PET_HEALTHREPORT 4
#define PET_GUARDHERE 5
#define PET_GUARDME 6
#define PET_ATTACK 7
#define PET_FOLLOWME 8
#define PET_SITDOWN 9
#define PET_STANDUP 10
#define PET_TAUNT 11
#define PET_HOLD 12
#define PET_NOTAUNT 14
#define PET_LEADER 16
#define PET_SLUMBER 17
#define PET_NOCAST 18
#define PET_FOCUS 19
#define PET_FOCUS_ON 25
#define PET_FOCUS_OFF 26
#define PET_HOLD_ON 27
#define PET_HOLD_OFF 28
#define PET_BACKOFF 1
#define PET_GETLOST 2
#define PET_HEALTHREPORT 4
#define PET_GUARDHERE 5
#define PET_GUARDME 6
#define PET_ATTACK 7
#define PET_FOLLOWME 8
#define PET_SITDOWN 9
#define PET_STANDUP 10
#define PET_TAUNT 11
#define PET_HOLD 12
#define PET_NOTAUNT 14
#define PET_LEADER 16
#define PET_SLUMBER 17
#define PET_NOCAST 18
#define PET_FOCUS 19
#define PET_FOCUS_ON 25
#define PET_FOCUS_OFF 26
#define PET_HOLD_ON 27
#define PET_HOLD_OFF 28
class Pet : public NPC {
class Mob;
struct NPCType;
class Pet : public NPC {
public:
Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 power);

View File

@ -1,9 +1,8 @@
#include "../common/debug.h"
#include "../common/string_util.h"
#include "qglobals.h"
#include "masterentity.h"
#include "client.h"
#include "zone.h"
#include "zonedb.h"
void QGlobalCache::AddGlobal(uint32 id, QGlobal global)
{

View File

@ -2,9 +2,6 @@
#define __QGLOBALS__H
#include <list>
#include <string>
#include <stdlib.h>
#include "../common/timer.h"
class NPC;
class Client;

View File

@ -23,7 +23,6 @@ Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
#include "worldserver.h"
#include "net.h"
#include <iostream>
extern WorldServer worldserver;
extern QueryServ* QServ;

View File

@ -19,14 +19,13 @@
#include "../common/debug.h"
#include "../common/misc_functions.h"
#include "../common/features.h"
#include "quest_parser_collection.h"
#include "quest_interface.h"
#include "zone.h"
#include "questmgr.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
extern Zone* zone;
extern void MapOpcodes();

View File

@ -20,19 +20,32 @@
#define _EQE_QUESTPARSERCOLLECTION_H
#include "../common/types.h"
#include "../common/item.h"
#include "masterentity.h"
#include "beacon.h"
#include "client.h"
#include "corpse.h"
#include "doors.h"
#include "groups.h"
#include "mob.h"
#include "object.h"
#include "raids.h"
#include "trap.h"
#include "quest_interface.h"
#include <string.h>
#include <string>
#include <list>
#include <map>
#define QuestFailedToLoad 0xFFFFFFFF
#define QuestUnloaded 0x00
class Client;
class ItemInst;
class Mob;
class NPC;
class QuestInterface;
namespace EQEmu { class Any; }
class QuestParserCollection {
public:
QuestParserCollection();

View File

@ -22,18 +22,19 @@
#include "../common/skills.h"
#include "../common/spdat.h"
#include "../common/string_util.h"
#include "entity.h"
#include "event_codes.h"
#include "guild_mgr.h"
#include "net.h"
#include "qglobals.h"
#include "queryserv.h"
#include "questmgr.h"
#include "quest_parser_collection.h"
#include "questmgr.h"
#include "spawn2.h"
#include "worldserver.h"
#include "zone.h"
#include "zonedb.h"
#include <iostream>
#include <limits.h>
#include <list>

View File

@ -21,7 +21,6 @@
#include "../common/timer.h"
#include "tasks.h"
#include <string>
#include <list>
#include <stack>

View File

@ -15,13 +15,17 @@
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 "masterentity.h"
#include "npc_ai.h"
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "../common/string_util.h"
#include "client.h"
#include "entity.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
#include "worldserver.h"
extern EntityList entity_list;
extern WorldServer worldserver;

View File

@ -19,14 +19,11 @@
#define RAIDS_H
#include "../common/types.h"
#include "../common/linked_list.h"
#include "groups.h"
#include <vector>
#include <string>
#include <queue>
class Client;
class EQApplicationPacket;
class Mob;
enum { //raid packet types:
raidAdd = 0,

View File

@ -15,16 +15,17 @@
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/string_util.h"
#include <stdlib.h>
#include "spawn2.h"
#include "client.h"
#include "entity.h"
#include "masterentity.h"
#include "zone.h"
#include "spawn2.h"
#include "spawngroup.h"
#include "zonedb.h"
#include "worldserver.h"
#include "zone.h"
#include "zonedb.h"
extern EntityList entity_list;
extern Zone* zone;

Some files were not shown because too many files have changed in this diff Show More