Merge from master, fixed conflicts

This commit is contained in:
KimLS
2015-02-18 13:18:21 -08:00
40 changed files with 2266 additions and 1747 deletions
+11 -11
View File
@@ -4395,24 +4395,24 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if (item != 0)
{
ns->spawn.equipment[i].material = item->Material;
ns->spawn.equipment[i].elitematerial = item->EliteMaterial;
ns->spawn.equipment[i].heroforgemodel = item->HerosForgeModel;
ns->spawn.equipment[i].Material = item->Material;
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];
ns->spawn.colors[i].Color = armor_tint[i];
}
else
{
ns->spawn.colors[i].color = item->Color;
ns->spawn.colors[i].Color = item->Color;
}
}
else
{
if (armor_tint[i])
{
ns->spawn.colors[i].color = armor_tint[i];
ns->spawn.colors[i].Color = armor_tint[i];
}
}
}
@@ -4426,9 +4426,9 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
{
if(strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialPrimary].material = atoi(&item->IDFile[2]);
ns->spawn.equipment[MaterialPrimary].Material = atoi(&item->IDFile[2]);
}
ns->spawn.colors[MaterialPrimary].color = GetEquipmentColor(MaterialPrimary);
ns->spawn.colors[MaterialPrimary].Color = GetEquipmentColor(MaterialPrimary);
}
}
@@ -4440,9 +4440,9 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
{
if(strlen(item->IDFile) > 2)
{
ns->spawn.equipment[MaterialSecondary].material = atoi(&item->IDFile[2]);
ns->spawn.equipment[MaterialSecondary].Material = atoi(&item->IDFile[2]);
}
ns->spawn.colors[MaterialSecondary].color = GetEquipmentColor(MaterialSecondary);
ns->spawn.colors[MaterialSecondary].Color = GetEquipmentColor(MaterialSecondary);
}
}
}
@@ -5061,7 +5061,7 @@ void Bot::SendBotArcheryWearChange(uint8 material_slot, uint32 material, uint32
wc->spawn_id = GetID();
wc->material = material;
wc->color.color = color;
wc->color.Color = color;
wc->wear_slot_id = material_slot;
entity_list.QueueClients(this, outapp);
+5 -5
View File
@@ -250,7 +250,7 @@ Client::Client(EQStreamInterface* ieqs)
AttemptedMessages = 0;
TotalKarma = 0;
m_ClientVersion = ClientVersion::Unknown;
ClientVersionBit = 0;
m_ClientVersionBit = 0;
AggroCount = 0;
RestRegenHP = 0;
RestRegenMana = 0;
@@ -3039,7 +3039,7 @@ void Client::Tell_StringID(uint32 string_id, const char *who, const char *messag
void Client::SetTint(int16 in_slot, uint32 color) {
Color_Struct new_color;
new_color.color = color;
new_color.Color = color;
SetTint(in_slot, new_color);
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color);
}
@@ -3050,8 +3050,8 @@ void Client::SetTint(int16 in_slot, Color_Struct& color) {
uint8 matslot = InventoryOld::CalcMaterialFromSlot(in_slot);
if (matslot != _MaterialInvalid)
{
m_pp.item_tint[matslot].color = color.color;
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.color);
m_pp.item_tint[matslot].Color = color.Color;
database.SaveCharacterMaterialColor(this->CharacterID(), in_slot, color.Color);
}
}
@@ -7468,7 +7468,7 @@ void Client::SendClearMercInfo()
void Client::DuplicateLoreMessage(uint32 ItemID)
{
if(!(ClientVersionBit & BIT_RoFAndLater))
if (!(m_ClientVersionBit & BIT_RoFAndLater))
{
Message_StringID(0, PICK_LORE);
return;
+3 -3
View File
@@ -1022,7 +1022,7 @@ public:
inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
inline const ClientVersion GetClientVersion() const { return m_ClientVersion; }
inline const uint32 GetClientVersionBit() const { return ClientVersionBit; }
inline const uint32 GetClientVersionBit() const { return m_ClientVersionBit; }
inline void SetClientVersion(ClientVersion in) { m_ClientVersion = in; }
/** Adventure Stuff **/
@@ -1140,7 +1140,7 @@ public:
void HandleLFGuildResponse(ServerPacket *pack);
void SendLFGuildStatus();
void SendGuildLFGuildStatus();
inline bool XTargettingAvailable() const { return ((ClientVersionBit & BIT_UFAndLater) && RuleB(Character, EnableXTargetting)); }
inline bool XTargettingAvailable() const { return ((m_ClientVersionBit & BIT_UFAndLater) && RuleB(Character, EnableXTargetting)); }
inline uint8 GetMaxXTargets() const { return MaxXTargets; }
void SetMaxXTargets(uint8 NewMax);
bool IsXTarget(const Mob *m) const;
@@ -1517,7 +1517,7 @@ private:
uint32 AttemptedMessages;
ClientVersion m_ClientVersion;
uint32 ClientVersionBit;
uint32 m_ClientVersionBit;
int XPRate;
+18 -19
View File
@@ -1191,8 +1191,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
conn_state = ReceivedZoneEntry;
SetClientVersion(Connection()->GetClientVersion());
if (m_ClientVersion != ClientVersion::Unknown)
ClientVersionBit = 1 << (static_cast<unsigned int>(m_ClientVersion) - 1);
m_ClientVersionBit = ClientBitFromVersion(Connection()->GetClientVersion());
bool siv = m_inv.SetInventoryVersion(m_ClientVersion);
Log.Out(Logs::General, Logs::None, "%s inventory version to %s(%i)", (siv ? "Succeeded in setting" : "Failed to set"), ClientVersionName(m_ClientVersion), m_ClientVersion);
@@ -1307,9 +1306,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
/* Set item material tint */
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
{
if (m_pp.item_tint[i].rgb.use_tint == 1 || m_pp.item_tint[i].rgb.use_tint == 255)
if (m_pp.item_tint[i].RGB.UseTint == 1 || m_pp.item_tint[i].RGB.UseTint == 255)
{
m_pp.item_tint[i].rgb.use_tint = 0xFF;
m_pp.item_tint[i].RGB.UseTint = 0xFF;
}
}
@@ -1736,7 +1735,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
safe_delete(outapp);
}
if (ClientVersionBit & BIT_UFAndLater) {
if (m_ClientVersionBit & BIT_UFAndLater) {
outapp = new EQApplicationPacket(OP_XTargetResponse, 8);
outapp->WriteUInt32(GetMaxXTargets());
outapp->WriteUInt32(0);
@@ -3171,7 +3170,6 @@ void Client::Handle_OP_AutoFire(const EQApplicationPacket *app)
void Client::Handle_OP_Bandolier(const EQApplicationPacket *app)
{
// Although there are three different structs for OP_Bandolier, they are all the same size.
//
if (app->size != sizeof(BandolierCreate_Struct)) {
@@ -3183,19 +3181,20 @@ void Client::Handle_OP_Bandolier(const EQApplicationPacket *app)
BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer;
switch (bs->action) {
case BandolierCreate:
switch (bs->Action)
{
case bandolierCreate:
CreateBandolier(app);
break;
case BandolierRemove:
case bandolierRemove:
RemoveBandolier(app);
break;
case BandolierSet:
case bandolierSet:
SetBandolier(app);
break;
default:
Log.Out(Logs::General, Logs::None, "Uknown Bandolier action %i", bs->action);
Log.Out(Logs::General, Logs::None, "Unknown Bandolier action %i", bs->Action);
break;
}
}
@@ -10442,16 +10441,16 @@ void Client::Handle_OP_PotionBelt(const EQApplicationPacket *app)
if (mptbs->Action == 0) {
const ItemData *BaseItem = database.GetItem(mptbs->ItemID);
if (BaseItem) {
m_pp.potionbelt.items[mptbs->SlotNumber].item_id = BaseItem->ID;
m_pp.potionbelt.items[mptbs->SlotNumber].icon = BaseItem->Icon;
strn0cpy(m_pp.potionbelt.items[mptbs->SlotNumber].item_name, BaseItem->Name, sizeof(BaseItem->Name));
database.SaveCharacterPotionBelt(this->CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.items[mptbs->SlotNumber].item_id, m_pp.potionbelt.items[mptbs->SlotNumber].icon);
m_pp.potionbelt.Items[mptbs->SlotNumber].ID = BaseItem->ID;
m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = BaseItem->Icon;
strn0cpy(m_pp.potionbelt.Items[mptbs->SlotNumber].Name, BaseItem->Name, sizeof(BaseItem->Name));
database.SaveCharacterPotionBelt(this->CharacterID(), mptbs->SlotNumber, m_pp.potionbelt.Items[mptbs->SlotNumber].ID, m_pp.potionbelt.Items[mptbs->SlotNumber].Icon);
}
}
else {
m_pp.potionbelt.items[mptbs->SlotNumber].item_id = 0;
m_pp.potionbelt.items[mptbs->SlotNumber].icon = 0;
strncpy(m_pp.potionbelt.items[mptbs->SlotNumber].item_name, "\0", 1);
m_pp.potionbelt.Items[mptbs->SlotNumber].ID = 0;
m_pp.potionbelt.Items[mptbs->SlotNumber].Icon = 0;
m_pp.potionbelt.Items[mptbs->SlotNumber].Name[0] = '\0';
}
}
+1 -1
View File
@@ -968,7 +968,7 @@ void Client::BulkSendInventoryItems()
void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
const ItemData* handyitem = nullptr;
uint32 numItemSlots = 80; //The max number of items passed in the transaction.
if (ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items
if (m_ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items
numItemSlots = 200;
}
const ItemData *item;
+1 -1
View File
@@ -7020,7 +7020,7 @@ void Client::Undye() {
database.SaveInventory(CharacterID(), inst, slot2);
}
m_pp.item_tint[cur_slot].color = 0;
m_pp.item_tint[cur_slot].Color = 0;
SendWearChange(cur_slot);
}
+11 -11
View File
@@ -113,15 +113,15 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std:
pc->Lock();
/* Load Item Tints */
pc->item_tint[0].color = pcs->item_tint[0].color;
pc->item_tint[1].color = pcs->item_tint[1].color;
pc->item_tint[2].color = pcs->item_tint[2].color;
pc->item_tint[3].color = pcs->item_tint[3].color;
pc->item_tint[4].color = pcs->item_tint[4].color;
pc->item_tint[5].color = pcs->item_tint[5].color;
pc->item_tint[6].color = pcs->item_tint[6].color;
pc->item_tint[7].color = pcs->item_tint[7].color;
pc->item_tint[8].color = pcs->item_tint[8].color;
pc->item_tint[0].Color = pcs->item_tint[0].Color;
pc->item_tint[1].Color = pcs->item_tint[1].Color;
pc->item_tint[2].Color = pcs->item_tint[2].Color;
pc->item_tint[3].Color = pcs->item_tint[3].Color;
pc->item_tint[4].Color = pcs->item_tint[4].Color;
pc->item_tint[5].Color = pcs->item_tint[5].Color;
pc->item_tint[6].Color = pcs->item_tint[6].Color;
pc->item_tint[7].Color = pcs->item_tint[7].Color;
pc->item_tint[8].Color = pcs->item_tint[8].Color;
/* Load Physical Appearance */
pc->haircolor = pcs->haircolor;
@@ -1413,8 +1413,8 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
item = database.GetItem(GetEquipment(material_slot));
if(item != NO_ITEM) {
return item_tint[material_slot].rgb.use_tint ?
item_tint[material_slot].color :
return item_tint[material_slot].RGB.UseTint ?
item_tint[material_slot].Color :
item->Color;
}
+5 -5
View File
@@ -282,14 +282,14 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center)
return nullptr;
Mob* top_hate = nullptr;
int32 hate = -1;
int64 hate = -1;
if (center == nullptr)
return nullptr;
if (RuleB(Aggro, SmartAggroList)){
Mob* top_client_type_in_range = nullptr;
int32 hate_client_type_in_range = -1;
int64 hate_client_type_in_range = -1;
int skipped_count = 0;
auto iterator = list.begin();
@@ -337,7 +337,7 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center)
continue;
}
int32 current_hate = cur->stored_hate_amount;
int64 current_hate = cur->stored_hate_amount;
if (cur->entity_on_hatelist->IsClient()){
@@ -459,13 +459,13 @@ Mob *HateList::GetEntWithMostHateOnList(Mob *center)
Mob *HateList::GetEntWithMostHateOnList(){
Mob* top = nullptr;
int32 hate = -1;
int64 hate = -1;
auto iterator = list.begin();
while (iterator != list.end())
{
struct_HateList *cur = (*iterator);
if (cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate))
if (cur && cur->entity_on_hatelist != nullptr && (cur->stored_hate_amount > hate))
{
top = cur->entity_on_hatelist;
hate = cur->stored_hate_amount;
+54 -52
View File
@@ -1984,9 +1984,9 @@ void Client::QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call) {
void Client::DyeArmor(DyeStruct* dye){
int16 slot=0;
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_TINT_END; i++) {
if (m_pp.item_tint[i].rgb.blue != dye->dye[i].rgb.blue ||
m_pp.item_tint[i].rgb.red != dye->dye[i].rgb.red ||
m_pp.item_tint[i].rgb.green != dye->dye[i].rgb.green
if (m_pp.item_tint[i].RGB.Blue != dye->dye[i].RGB.Blue ||
m_pp.item_tint[i].RGB.Red != dye->dye[i].RGB.Red ||
m_pp.item_tint[i].RGB.Green != dye->dye[i].RGB.Green
) {
slot = m_inv.HasItem(32557, 1, invWherePersonal);
if (slot != INVALID_INDEX){
@@ -1994,18 +1994,18 @@ void Client::DyeArmor(DyeStruct* dye){
uint8 slot2=SlotConvert(i);
ItemInst* inst = this->m_inv.GetItem(slot2);
if(inst){
uint32 armor_color = ((uint32)dye->dye[i].rgb.red << 16) | ((uint32)dye->dye[i].rgb.green << 8) | ((uint32)dye->dye[i].rgb.blue);
uint32 armor_color = ((uint32)dye->dye[i].RGB.Red << 16) | ((uint32)dye->dye[i].RGB.Green << 8) | ((uint32)dye->dye[i].RGB.Blue);
inst->SetColor(armor_color);
database.SaveCharacterMaterialColor(this->CharacterID(), i, armor_color);
database.SaveInventory(CharacterID(),inst,slot2);
if(dye->dye[i].rgb.use_tint)
m_pp.item_tint[i].rgb.use_tint = 0xFF;
if(dye->dye[i].RGB.UseTint)
m_pp.item_tint[i].RGB.UseTint = 0xFF;
else
m_pp.item_tint[i].rgb.use_tint=0x00;
m_pp.item_tint[i].RGB.UseTint=0x00;
}
m_pp.item_tint[i].rgb.blue=dye->dye[i].rgb.blue;
m_pp.item_tint[i].rgb.red=dye->dye[i].rgb.red;
m_pp.item_tint[i].rgb.green=dye->dye[i].rgb.green;
m_pp.item_tint[i].RGB.Blue=dye->dye[i].RGB.Blue;
m_pp.item_tint[i].RGB.Red=dye->dye[i].RGB.Red;
m_pp.item_tint[i].RGB.Green=dye->dye[i].RGB.Green;
SendWearChange(i);
}
else{
@@ -2420,7 +2420,7 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const
const ItemData *item = database.GetItem(GetEquipment(material_slot));
if(item != nullptr)
return ((m_pp.item_tint[material_slot].rgb.use_tint) ? m_pp.item_tint[material_slot].color : item->Color);
return ((m_pp.item_tint[material_slot].RGB.UseTint) ? m_pp.item_tint[material_slot].Color : item->Color);
return 0;
}
@@ -2476,97 +2476,99 @@ EQApplicationPacket* Client::ReturnItemPacket(int16 slot_id, const ItemInst* ins
return outapp;
}
static int16 BandolierSlotToWeaponSlot(int BandolierSlot) {
switch(BandolierSlot) {
case bandolierMainHand:
return MainPrimary;
case bandolierOffHand:
return MainSecondary;
case bandolierRange:
return MainRange;
default:
return MainAmmo;
static int16 BandolierSlotToWeaponSlot(int BandolierSlot)
{
switch (BandolierSlot)
{
case bandolierPrimary:
return MainPrimary;
case bandolierSecondary:
return MainSecondary;
case bandolierRange:
return MainRange;
default:
return MainAmmo;
}
}
void Client::CreateBandolier(const EQApplicationPacket *app) {
void Client::CreateBandolier(const EQApplicationPacket *app)
{
// Store bandolier set with the number and name passed by the client, along with the items that are currently
// in the players weapon slots.
BandolierCreate_Struct *bs = (BandolierCreate_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->number, bs->name);
strcpy(m_pp.bandoliers[bs->number].name, bs->name);
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s Creating Bandolier Set %i, Set Name: %s", GetName(), bs->Number, bs->Name);
strcpy(m_pp.bandoliers[bs->Number].Name, bs->Name);
const ItemInst* InvItem = nullptr;
const ItemData *BaseItem = nullptr;
int16 WeaponSlot;
for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot);
InvItem = GetInv()[WeaponSlot];
if(InvItem) {
BaseItem = InvItem->GetItem();
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s adding item %s to slot %i", GetName(),BaseItem->Name, WeaponSlot);
m_pp.bandoliers[bs->number].items[BandolierSlot].item_id = BaseItem->ID;
m_pp.bandoliers[bs->number].items[BandolierSlot].icon = BaseItem->Icon;
database.SaveCharacterBandolier(this->CharacterID(), bs->number, BandolierSlot, m_pp.bandoliers[bs->number].items[BandolierSlot].item_id, m_pp.bandoliers[bs->number].items[BandolierSlot].icon, bs->name);
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = BaseItem->ID;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = BaseItem->Icon;
database.SaveCharacterBandolier(this->CharacterID(), bs->Number, BandolierSlot, m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID, m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon, bs->Name);
}
else {
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s no item in slot %i", GetName(), WeaponSlot);
m_pp.bandoliers[bs->number].items[BandolierSlot].item_id = 0;
m_pp.bandoliers[bs->number].items[BandolierSlot].icon = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].ID = 0;
m_pp.bandoliers[bs->Number].Items[BandolierSlot].Icon = 0;
}
}
}
void Client::RemoveBandolier(const EQApplicationPacket *app) {
void Client::RemoveBandolier(const EQApplicationPacket *app)
{
BandolierDelete_Struct *bds = (BandolierDelete_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->number);
memset(m_pp.bandoliers[bds->number].name, 0, 32);
for(int i = bandolierMainHand; i <= bandolierAmmo; i++) {
m_pp.bandoliers[bds->number].items[i].item_id = 0;
m_pp.bandoliers[bds->number].items[i].icon = 0;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s removing set", GetName(), bds->Number);
memset(m_pp.bandoliers[bds->Number].Name, 0, 32);
for(int i = bandolierPrimary; i <= bandolierAmmo; i++) {
m_pp.bandoliers[bds->Number].Items[i].ID = 0;
m_pp.bandoliers[bds->Number].Items[i].Icon = 0;
}
database.DeleteCharacterBandolier(this->CharacterID(), bds->number);
database.DeleteCharacterBandolier(this->CharacterID(), bds->Number);
}
void Client::SetBandolier(const EQApplicationPacket *app) {
void Client::SetBandolier(const EQApplicationPacket *app)
{
// Swap the weapons in the given bandolier set into the character's weapon slots and return
// any items currently in the weapon slots to inventory.
BandolierSet_Struct *bss = (BandolierSet_Struct*)app->pBuffer;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->number);
int16 slot;
int16 WeaponSlot;
Log.Out(Logs::Detail, Logs::Inventory, "Char: %s activating set %i", GetName(), bss->Number);
int16 slot = 0;
int16 WeaponSlot = 0;
ItemInst *BandolierItems[4]; // Temporary holding area for the weapons we pull out of their inventory
// First we pull the items for this bandolier set out of their inventory, this makes space to put the
// currently equipped items back.
for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
// If this bandolier set has an item in this position
if(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id) {
if(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID) {
WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot);
// Check if the player has the item specified in the bandolier set on them.
//
slot = m_inv.HasItem(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id, 1,
slot = m_inv.HasItem(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID, 1,
invWhereWorn|invWherePersonal);
// removed 'invWhereCursor' argument from above and implemented slots 30, 331-340 checks here
if (slot == INVALID_INDEX) {
if (m_inv.GetItem(MainCursor)) {
if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
m_inv.GetItem(MainCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches InventoryOld::_HasItem conditional check
if (m_inv.GetItem(MainCursor)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID &&
m_inv.GetItem(MainCursor)->GetCharges() >= 1) { // '> 0' the same, but this matches Inventory::_HasItem conditional check
slot = MainCursor;
}
else if (m_inv.GetItem(MainCursor)->GetItem()->ItemClass == 1) {
for(int16 CursorBagSlot = EmuConstants::CURSOR_BAG_BEGIN; CursorBagSlot <= EmuConstants::CURSOR_BAG_END; CursorBagSlot++) {
if (m_inv.GetItem(CursorBagSlot)) {
if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->number].items[BandolierSlot].item_id &&
if (m_inv.GetItem(CursorBagSlot)->GetItem()->ID == m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID &&
m_inv.GetItem(CursorBagSlot)->GetCharges() >= 1) { // ditto
slot = CursorBagSlot;
break;
@@ -2630,14 +2632,14 @@ void Client::SetBandolier(const EQApplicationPacket *app) {
// Now we move the required weapons into the character weapon slots, and return any items we are replacing
// back to inventory.
//
for(int BandolierSlot = bandolierMainHand; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
for(int BandolierSlot = bandolierPrimary; BandolierSlot <= bandolierAmmo; BandolierSlot++) {
// Find the inventory slot corresponding to this bandolier slot
WeaponSlot = BandolierSlotToWeaponSlot(BandolierSlot);
// if there is an item in this Bandolier slot ?
if(m_pp.bandoliers[bss->number].items[BandolierSlot].item_id) {
if(m_pp.bandoliers[bss->Number].Items[BandolierSlot].ID) {
// if the player has this item in their inventory, and it is not already where it needs to be
if(BandolierItems[BandolierSlot]) {
// Pull the item that we are going to replace
+9 -9
View File
@@ -961,10 +961,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
// Only Player Races Wear Armor
if (Mob::IsPlayerRace(race) || i > 6)
{
ns->spawn.equipment[i].material = GetEquipmentMaterial(i);
ns->spawn.equipment[i].elitematerial = IsEliteMaterialItem(i);
ns->spawn.equipment[i].heroforgemodel = GetHerosForgeModel(i);
ns->spawn.colors[i].color = GetEquipmentColor(i);
ns->spawn.equipment[i].Material = GetEquipmentMaterial(i);
ns->spawn.equipment[i].EliteMaterial = IsEliteMaterialItem(i);
ns->spawn.equipment[i].HeroForgeModel = GetHerosForgeModel(i);
ns->spawn.colors[i].Color = GetEquipmentColor(i);
}
}
@@ -2562,7 +2562,7 @@ void Mob::SendWearChange(uint8 material_slot)
wc->material = GetEquipmentMaterial(material_slot);
wc->elite_material = IsEliteMaterialItem(material_slot);
wc->hero_forge_model = GetHerosForgeModel(material_slot);
wc->color.color = GetEquipmentColor(material_slot);
wc->color.Color = GetEquipmentColor(material_slot);
wc->wear_slot_id = material_slot;
entity_list.QueueClients(this, outapp);
@@ -2577,9 +2577,9 @@ void Mob::SendTextureWC(uint8 slot, uint16 texture, uint32 hero_forge_model, uin
wc->spawn_id = this->GetID();
wc->material = texture;
if (this->IsClient())
wc->color.color = GetEquipmentColor(slot);
wc->color.Color = GetEquipmentColor(slot);
else
wc->color.color = this->GetArmorTint(slot);
wc->color.Color = this->GetArmorTint(slot);
wc->wear_slot_id = slot;
wc->unknown06 = unknown06;
@@ -2607,7 +2607,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 = GetHerosForgeModel(material_slot);
wc->color.color = color;
wc->color.Color = color;
wc->wear_slot_id = material_slot;
entity_list.QueueClients(this, outapp);
@@ -2624,7 +2624,7 @@ void Mob::WearChange(uint8 material_slot, uint16 texture, uint32 color, uint32 h
wc->spawn_id = this->GetID();
wc->material = texture;
wc->hero_forge_model = hero_forge_model;
wc->color.color = color;
wc->color.Color = color;
wc->wear_slot_id = material_slot;
entity_list.QueueClients(this, outapp);
+1 -1
View File
@@ -3742,7 +3742,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
return false;
}
if (IsValidSpell(spells[spell_id].RecourseLink))
if (IsValidSpell(spells[spell_id].RecourseLink) && spells[spell_id].RecourseLink != spell_id)
SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff);
if (IsDetrimentalSpell(spell_id)) {
+69 -52
View File
@@ -1167,29 +1167,47 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile
for (auto row = results.begin(); row != results.end(); ++row) {
r = 0;
i = atoi(row[r]); /* Slot */ r++;
pp->item_tint[i].rgb.blue = atoi(row[r]); r++;
pp->item_tint[i].rgb.green = atoi(row[r]); r++;
pp->item_tint[i].rgb.red = atoi(row[r]); r++;
pp->item_tint[i].rgb.use_tint = atoi(row[r]);
pp->item_tint[i].RGB.Blue = atoi(row[r]); r++;
pp->item_tint[i].RGB.Green = atoi(row[r]); r++;
pp->item_tint[i].RGB.Red = atoi(row[r]); r++;
pp->item_tint[i].RGB.UseTint = atoi(row[r]);
}
return true;
}
bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp){
std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT 16", character_id);
bool ZoneDatabase::LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp)
{
std::string query = StringFormat("SELECT `bandolier_id`, `bandolier_slot`, `item_id`, `icon`, `bandolier_name` FROM `character_bandolier` WHERE `id` = %u LIMIT %u",
character_id, EmuConstants::BANDOLIERS_SIZE);
auto results = database.QueryDatabase(query); int i = 0; int r = 0; int si = 0;
for (i = 0; i < EmuConstants::BANDOLIERS_COUNT; i++)
for (int si = 0; si < EmuConstants::BANDOLIER_SIZE; si++)
pp->bandoliers[i].items[si].icon = 0;
for (i = 0; i < EmuConstants::BANDOLIERS_SIZE; i++) {
pp->bandoliers[i].Name[0] = '\0';
for (int si = 0; si < EmuConstants::BANDOLIER_ITEM_COUNT; si++) {
pp->bandoliers[i].Items[si].ID = 0;
pp->bandoliers[i].Items[si].Icon = 0;
pp->bandoliers[i].Items[si].Name[0] = '\0';
}
}
for (auto row = results.begin(); row != results.end(); ++row) {
r = 0;
i = atoi(row[r]); /* Bandolier ID */ r++;
si = atoi(row[r]); /* Bandolier Slot */ r++;
pp->bandoliers[i].items[si].item_id = atoi(row[r]); r++;
pp->bandoliers[i].items[si].icon = atoi(row[r]); r++;
strcpy(pp->bandoliers[i].name, row[r]); r++;
si++;
const ItemData* item_data = database.GetItem(atoi(row[r]));
if (item_data) {
pp->bandoliers[i].Items[si].ID = item_data->ID; r++;
pp->bandoliers[i].Items[si].Icon = atoi(row[r]); r++; // Must use db value in case an Ornamentation is assigned
strncpy(pp->bandoliers[i].Items[si].Name, item_data->Name, 64);
}
else {
pp->bandoliers[i].Items[si].ID = 0; r++;
pp->bandoliers[i].Items[si].Icon = 0; r++;
pp->bandoliers[i].Items[si].Name[0] = '\0';
}
strcpy(pp->bandoliers[i].Name, row[r]); r++;
si++; // What is this for!?
}
return true;
}
@@ -1213,26 +1231,23 @@ bool ZoneDatabase::LoadCharacterTribute(uint32 character_id, PlayerProfile_Struc
return true;
}
bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp){
std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT 4", character_id);
bool ZoneDatabase::LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp)
{
std::string query = StringFormat("SELECT `potion_id`, `item_id`, `icon` FROM `character_potionbelt` WHERE `id` = %u LIMIT %u",
character_id, EmuConstants::POTION_BELT_ITEM_COUNT);
auto results = database.QueryDatabase(query); int i = 0;
for (i = 0; i < EmuConstants::POTION_BELT_SIZE; i++){
pp->potionbelt.items[i].icon = 0;
pp->potionbelt.items[i].item_id = 0;
strncpy(pp->potionbelt.items[i].item_name, "\0", 1);
for (i = 0; i < EmuConstants::POTION_BELT_ITEM_COUNT; i++){
pp->potionbelt.Items[i].Icon = 0;
pp->potionbelt.Items[i].ID = 0;
pp->potionbelt.Items[i].Name[0] = '\0';
}
for (auto row = results.begin(); row != results.end(); ++row) {
i = atoi(row[0]); /* Potion belt slot number */
uint32 item_id = atoi(row[1]);
const ItemData *item = database.GetItem(item_id);
if(!item)
continue;
pp->potionbelt.items[i].item_id = item_id;
pp->potionbelt.items[i].icon = atoi(row[2]);
strncpy(pp->potionbelt.items[i].item_name, item->Name, 64);
const ItemData *item_data = database.GetItem(atoi(row[1]));
if (item_data == nullptr) { continue; }
pp->potionbelt.Items[i].ID = item_data->ID;
pp->potionbelt.Items[i].Icon = atoi(row[2]);
strncpy(pp->potionbelt.Items[i].Name, item_data->Name, 64);
}
return true;
@@ -1326,7 +1341,8 @@ bool ZoneDatabase::SaveCharacterTribute(uint32 character_id, PlayerProfile_Struc
return true;
}
bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name){
bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name)
{
char bandolier_name_esc[64];
DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name));
std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc);
@@ -1335,7 +1351,8 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
return true;
}
bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) {
bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon)
{
std::string query = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%u, %u, %u, %u)", character_id, potion_id, item_id, icon);
auto results = QueryDatabase(query);
return true;
@@ -3529,9 +3546,9 @@ uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const c
dbpc->plat, dbpc->haircolor, dbpc->beardcolor, dbpc->eyecolor1,
dbpc->eyecolor2, dbpc->hairstyle, dbpc->face, dbpc->beard,
dbpc->drakkin_heritage, dbpc->drakkin_tattoo, dbpc->drakkin_details,
dbpc->item_tint[0].color, dbpc->item_tint[1].color, dbpc->item_tint[2].color,
dbpc->item_tint[3].color, dbpc->item_tint[4].color, dbpc->item_tint[5].color,
dbpc->item_tint[6].color, dbpc->item_tint[7].color, dbpc->item_tint[8].color,
dbpc->item_tint[0].Color, dbpc->item_tint[1].Color, dbpc->item_tint[2].Color,
dbpc->item_tint[3].Color, dbpc->item_tint[4].Color, dbpc->item_tint[5].Color,
dbpc->item_tint[6].Color, dbpc->item_tint[7].Color, dbpc->item_tint[8].Color,
db_id);
auto results = QueryDatabase(query);
@@ -3622,15 +3639,15 @@ uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, ui
dbpc->drakkin_heritage,
dbpc->drakkin_tattoo,
dbpc->drakkin_details,
dbpc->item_tint[0].color,
dbpc->item_tint[1].color,
dbpc->item_tint[2].color,
dbpc->item_tint[3].color,
dbpc->item_tint[4].color,
dbpc->item_tint[5].color,
dbpc->item_tint[6].color,
dbpc->item_tint[7].color,
dbpc->item_tint[8].color
dbpc->item_tint[0].Color,
dbpc->item_tint[1].Color,
dbpc->item_tint[2].Color,
dbpc->item_tint[3].Color,
dbpc->item_tint[4].Color,
dbpc->item_tint[5].Color,
dbpc->item_tint[6].Color,
dbpc->item_tint[7].Color,
dbpc->item_tint[8].Color
);
auto results = QueryDatabase(query);
uint32 last_insert_id = results.LastInsertedID();
@@ -3802,15 +3819,15 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
pcs->drakkin_heritage = atoul(row[i++]); // drakkin_heritage,
pcs->drakkin_tattoo = atoul(row[i++]); // drakkin_tattoo,
pcs->drakkin_details = atoul(row[i++]); // drakkin_details,
pcs->item_tint[0].color = atoul(row[i++]); // wc_1,
pcs->item_tint[1].color = atoul(row[i++]); // wc_2,
pcs->item_tint[2].color = atoul(row[i++]); // wc_3,
pcs->item_tint[3].color = atoul(row[i++]); // wc_4,
pcs->item_tint[4].color = atoul(row[i++]); // wc_5,
pcs->item_tint[5].color = atoul(row[i++]); // wc_6,
pcs->item_tint[6].color = atoul(row[i++]); // wc_7,
pcs->item_tint[7].color = atoul(row[i++]); // wc_8,
pcs->item_tint[8].color = atoul(row[i++]); // wc_9
pcs->item_tint[0].Color = atoul(row[i++]); // wc_1,
pcs->item_tint[1].Color = atoul(row[i++]); // wc_2,
pcs->item_tint[2].Color = atoul(row[i++]); // wc_3,
pcs->item_tint[3].Color = atoul(row[i++]); // wc_4,
pcs->item_tint[4].Color = atoul(row[i++]); // wc_5,
pcs->item_tint[5].Color = atoul(row[i++]); // wc_6,
pcs->item_tint[6].Color = atoul(row[i++]); // wc_7,
pcs->item_tint[7].Color = atoul(row[i++]); // wc_8,
pcs->item_tint[8].Color = atoul(row[i++]); // wc_9
}
query = StringFormat(
"SELECT \n"