More restructures, non-working state

This commit is contained in:
Akkadius 2014-11-22 23:28:20 -06:00
parent d1b0564698
commit f328853251
7 changed files with 160 additions and 147 deletions

View File

@ -5209,17 +5209,17 @@ struct MercenaryMerchantResponse_Struct {
}; };
struct ServerLootItem_Struct { struct ServerLootItem_Struct {
uint32 item_id; uint32 item_id; // uint32 item_id;
int16 equipSlot; int16 equip_slot; // int16 equip_slot;
uint8 charges; uint8 charges; // uint8 charges;
uint16 lootslot; uint16 lootslot; // uint16 lootslot;
uint32 aug1; uint32 aug_1; // uint32 aug_1;
uint32 aug2; uint32 aug_2; // uint32 aug_2;
uint32 aug3; uint32 aug_3; // uint32 aug_3;
uint32 aug4; uint32 aug_4; // uint32 aug_4;
uint32 aug5; uint32 aug_5; // uint32 aug_5;
uint8 minlevel; uint8 min_level; //
uint8 maxlevel; uint8 max_level; //
}; };
//Found in client near a ref to the string: //Found in client near a ref to the string:

View File

@ -73,35 +73,35 @@ Corpse* Corpse::LoadFromDBData(uint32 in_dbid, uint32 in_charid, char* in_charna
for (unsigned int i = 0; i < pcs.itemcount; i++) { for (unsigned int i = 0; i < pcs.itemcount; i++) {
tmp = new ServerLootItem_Struct; tmp = new ServerLootItem_Struct;
memcpy(tmp, &pcs.items[i], sizeof(player_lootitem::ServerLootItem_Struct)); memcpy(tmp, &pcs.items[i], sizeof(player_lootitem::ServerLootItem_Struct));
tmp->equipSlot = CorpseToServerSlot(tmp->equipSlot); tmp->equip_slot = CorpseToServerSlot(tmp->equip_slot);
itemlist.push_back(tmp); itemlist.push_back(tmp);
} }
/* Create Corpse Entity */ /* Create Corpse Entity */
Corpse* pc = new Corpse( Corpse* pc = new Corpse(
in_dbid, in_dbid, // uint32 in_dbid
in_charid, in_charid, // uint32 in_charid
in_charname, in_charname, // char* in_charname
&itemlist, &itemlist, // ItemList* in_itemlist
pcs.copper, pcs.copper, // uint32 in_copper
pcs.silver, pcs.silver, // uint32 in_silver
pcs.gold, pcs.gold, // uint32 in_gold
pcs.plat, pcs.plat, // uint32 in_plat
in_x, in_x, // float in_x
in_y, in_y, // float in_y
in_z, in_z, // float in_z
in_heading, in_heading, // float in_heading
pcs.size, pcs.size, // float in_size
pcs.gender, pcs.gender, // uint8 in_gender
pcs.race, pcs.race, // uint16 in_race
pcs.class_, pcs.class_, // uint8 in_class
pcs.deity, pcs.deity, // uint8 in_deity
pcs.level, pcs.level, // uint8 in_level
pcs.texture, pcs.texture, // uint8 in_texture
pcs.helmtexture, pcs.helmtexture, // uint8 in_helmtexture
pcs.exp, pcs.exp, // uint32 in_rezexp
was_at_graveyard was_at_graveyard // bool wasAtGraveyard
); );
if (pcs.locked) if (pcs.locked)
pc->Lock(); pc->Lock();
@ -184,70 +184,66 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
this->rezzexp = 0; this->rezzexp = 0;
} }
// To be used on PC death Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
// Mongrel: added see_invis and see_invis_undead "Unnamed_Corpse", // const char* in_name,
Corpse::Corpse(Client* client, int32 in_rezexp) "", // const char* in_lastname,
// vesuvias - appearence fix 0, // int32 in_cur_hp,
: Mob 0, // int32 in_max_hp,
( client->GetGender(), // uint8 in_gender,
"Unnamed_Corpse", client->GetRace(), // uint16 in_race,
"", client->GetClass(), // uint8 in_class,
0, BT_Humanoid, // bodyType in_bodytype,
0, client->GetDeity(), // uint8 in_deity,
client->GetGender(), client->GetLevel(), // uint8 in_level,
client->GetRace(), 0, // uint32 in_npctype_id,
client->GetClass(), client->GetSize(), // float in_size,
BT_Humanoid, // bodytype added 0, // float in_runspeed,
client->GetDeity(), client->GetHeading(), // float in_heading,
client->GetLevel(), client->GetX(), // float in_x_pos,
0, client->GetY(), // float in_y_pos,
client->GetSize(), client->GetZ(), // float in_z_pos,
0, 0, // uint8 in_light,
client->GetHeading(), // heading client->GetTexture(), // uint8 in_texture,
client->GetX(), client->GetHelmTexture(), // uint8 in_helmtexture,
client->GetY(), 0, // uint16 in_ac,
client->GetZ(), 0, // uint16 in_atk,
0, 0, // uint16 in_str,
client->GetTexture(), 0, // uint16 in_sta,
client->GetHelmTexture(), 0, // uint16 in_dex,
0, // AC 0, // uint16 in_agi,
0, 0, // uint16 in_int,
0, 0, // uint16 in_wis,
0, 0, // uint16 in_cha,
0, client->GetPP().haircolor, // uint8 in_haircolor,
0, client->GetPP().beardcolor, // uint8 in_beardcolor,
0, client->GetPP().eyecolor1, // uint8 in_eyecolor1, // the eyecolors always seem to be the same, maybe left and right eye?
0, client->GetPP().eyecolor2, // uint8 in_eyecolor2,
0, // CHA client->GetPP().hairstyle, // uint8 in_hairstyle,
client->GetPP().haircolor, client->GetPP().face, // uint8 in_luclinface,
client->GetPP().beardcolor, client->GetPP().beard, // uint8 in_beard,
client->GetPP().eyecolor1, client->GetPP().drakkin_heritage, // uint32 in_drakkin_heritage,
client->GetPP().eyecolor2, client->GetPP().drakkin_tattoo, // uint32 in_drakkin_tattoo,
client->GetPP().hairstyle, client->GetPP().drakkin_details, // uint32 in_drakkin_details,
client->GetPP().face, 0, // uint32 in_armor_tint[_MaterialCount],
client->GetPP().beard, 0xff, // uint8 in_aa_title,
client->GetPP().drakkin_heritage, 0, // uint8 in_see_invis, // see through invis
client->GetPP().drakkin_tattoo, 0, // uint8 in_see_invis_undead, // see through invis vs. undead
client->GetPP().drakkin_details, 0, // uint8 in_see_hide,
0, 0, // uint8 in_see_improved_hide,
0xff, // aa title 0, // int32 in_hp_regen,
0, 0, // int32 in_mana_regen,
0, 0, // uint8 in_qglobal,
0, 0, // uint8 in_maxlevel,
0, 0 // uint32 in_scalerate
0, ),
0,
0, // qglobal
0, // maxlevel
0 // scalerate
),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)), corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_res_timer(RuleI(Character, CorpseResTimeMS)), corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)), corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)), corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)),
loot_cooldown_timer(10) loot_cooldown_timer(10)
{ {
int i; int i;
PlayerProfile_Struct *pp = &client->GetPP(); PlayerProfile_Struct *pp = &client->GetPP();
ItemInst *item; ItemInst *item;
@ -256,7 +252,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
} }
memset(item_tint, 0, sizeof(item_tint)); memset(item_tint, 0, sizeof(item_tint));
for (i=0; i<MAX_LOOTERS; i++) for (i=0; i < MAX_LOOTERS; i++)
looters[i] = 0; looters[i] = 0;
pIsChanged = true; pIsChanged = true;
@ -266,21 +262,23 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
pLocked = false; pLocked = false;
BeingLootedBy = 0xFFFFFFFF; BeingLootedBy = 0xFFFFFFFF;
charid = client->CharacterID(); charid = client->CharacterID();
corpse_db_id = 0; corpse_db_id = 0;
p_depop = false; p_depop = false;
copper = 0; copper = 0;
silver = 0; silver = 0;
gold = 0; gold = 0;
platinum = 0; platinum = 0;
strcpy(orgname, pp->name); strcpy(orgname, pp->name);
strcpy(name, pp->name); strcpy(name, pp->name);
//become_npc was not being initialized which led to some pretty funky things with newly created corpses //become_npc was not being initialized which led to some pretty funky things with newly created corpses
become_npc = false; become_npc = false;
SetPKItem(0); SetPKItem(0);
if(!RuleB(Character, LeaveNakedCorpses) || RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) { if(!RuleB(Character, LeaveNakedCorpses) ||
RuleB(Character, LeaveCorpses) &&
GetLevel() >= RuleI(Character, DeathItemLossLevel)) {
// cash // cash
// Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't. // Let's not move the cash when 'RespawnFromHover = true' && 'client->GetClientVersion() < EQClientSoF' since the client doesn't.
// (change to first client that supports 'death hover' mode, if not SoF.) // (change to first client that supports 'death hover' mode, if not SoF.)
@ -301,8 +299,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp)
// worn + inventory + cursor // worn + inventory + cursor
std::list<uint32> removed_list; std::list<uint32> removed_list;
bool cursor = false; bool cursor = false;
for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) for(i = MAIN_BEGIN; i < EmuConstants::MAP_POSSESSIONS_SIZE; i++) {
{
if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) { if(i == MainAmmo && client->GetClientVersion() >= EQClientSoF) {
item = client->GetInv().GetItem(MainPowerSource); item = client->GetInv().GetItem(MainPowerSource);
if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) { if((item && (!client->IsBecomeNPC())) || (item && client->IsBecomeNPC() && !item->GetItem()->NoRent)) {
@ -492,7 +489,11 @@ bool Corpse::Save() {
return true; return true;
uint32 tmp = this->CountItems(); uint32 tmp = this->CountItems();
uint32 tmpsize = sizeof(PlayerCorpse_Struct)+(tmp * sizeof(player_lootitem::ServerLootItem_Struct)); uint32 tmpsize = sizeof(PlayerCorpse_Struct) + (tmp * sizeof(player_lootitem::ServerLootItem_Struct));
std::cout << "tmp: " << tmp << std::endl;
std::cout << "tmpsize: " << tmpsize << std::endl;
PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize]; PlayerCorpse_Struct* dbpc = (PlayerCorpse_Struct*) new uchar[tmpsize];
memset(dbpc, 0, tmpsize); memset(dbpc, 0, tmpsize);
dbpc->itemcount = tmp; dbpc->itemcount = tmp;
@ -522,14 +523,17 @@ bool Corpse::Save() {
dbpc->drakkin_tattoo = drakkin_tattoo; dbpc->drakkin_tattoo = drakkin_tattoo;
dbpc->drakkin_details = drakkin_details; dbpc->drakkin_details = drakkin_details;
std::cout << "SLI1: " << sizeof(player_lootitem::ServerLootItem_Struct) << std::endl;
std::cout << "SLI2: " << sizeof(ServerLootItem_Struct) << std::endl;
uint32 x = 0; uint32 x = 0;
ItemList::iterator cur, end; ItemList::iterator cur, end;
cur = itemlist.begin(); cur = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
for (; cur != end; ++cur) { for (; cur != end; ++cur) {
ServerLootItem_Struct* item = *cur; ServerLootItem_Struct* item = *cur;
item->equipSlot = ServerToCorpseSlot(item->equipSlot); // temp hack until corpse blobs are removed item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed
memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(player_lootitem::ServerLootItem_Struct)); memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct));
} }
if (corpse_db_id == 0) { if (corpse_db_id == 0) {
@ -539,6 +543,8 @@ bool Corpse::Save() {
corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed()); corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, charid, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed());
} }
safe_delete_array(dbpc);
return true; return true;
} }
@ -579,12 +585,12 @@ void Corpse::AddItem(uint32 itemnum, uint16 charges, int16 slot, uint32 aug1, ui
memset(item, 0, sizeof(ServerLootItem_Struct)); memset(item, 0, sizeof(ServerLootItem_Struct));
item->item_id = itemnum; item->item_id = itemnum;
item->charges = charges; item->charges = charges;
item->equipSlot = slot; item->equip_slot = slot;
item->aug1=aug1; item->aug_1=aug1;
item->aug2=aug2; item->aug_2=aug2;
item->aug3=aug3; item->aug_3=aug3;
item->aug4=aug4; item->aug_4=aug4;
item->aug5=aug5; item->aug_5=aug5;
itemlist.push_back(item); itemlist.push_back(item);
} }
@ -603,17 +609,17 @@ ServerLootItem_Struct* Corpse::GetItem(uint16 lootslot, ServerLootItem_Struct**
} }
} }
if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equipSlot)) if (sitem && bag_item_data && Inventory::SupportsContainers(sitem->equip_slot))
{ {
int16 bagstart = Inventory::CalcSlotId(sitem->equipSlot, SUB_BEGIN); int16 bagstart = Inventory::CalcSlotId(sitem->equip_slot, SUB_BEGIN);
cur = itemlist.begin(); cur = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
for(; cur != end; ++cur) { for(; cur != end; ++cur) {
sitem2 = *cur; sitem2 = *cur;
if(sitem2->equipSlot >= bagstart && sitem2->equipSlot < bagstart + 10) if(sitem2->equip_slot >= bagstart && sitem2->equip_slot < bagstart + 10)
{ {
bag_item_data[sitem2->equipSlot - bagstart] = sitem2; bag_item_data[sitem2->equip_slot - bagstart] = sitem2;
} }
} }
} }
@ -627,7 +633,7 @@ uint32 Corpse::GetWornItem(int16 equipSlot) const {
end = itemlist.end(); end = itemlist.end();
for(; cur != end; ++cur) { for(; cur != end; ++cur) {
ServerLootItem_Struct* item = *cur; ServerLootItem_Struct* item = *cur;
if (item->equipSlot == equipSlot) if (item->equip_slot == equipSlot)
{ {
return item->item_id; return item->item_id;
} }
@ -665,7 +671,7 @@ void Corpse::RemoveItem(ServerLootItem_Struct* item_data){
pIsChanged = true; pIsChanged = true;
itemlist.erase(cur); itemlist.erase(cur);
material = Inventory::CalcMaterialFromSlot(sitem->equipSlot); material = Inventory::CalcMaterialFromSlot(sitem->equip_slot);
if(material != _MaterialInvalid) if(material != _MaterialInvalid)
SendWearChange(material); SendWearChange(material);
@ -924,12 +930,12 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
// Dont display the item if it's in a bag // Dont display the item if it's in a bag
// Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse. // Added cursor queue slots to corpse item visibility list. Nothing else should be making it to corpse.
if(!IsPlayerCorpse() || item_data->equipSlot <= MainCursor || item_data->equipSlot == MainPowerSource || tCanLoot>=3 || if(!IsPlayerCorpse() || item_data->equip_slot <= MainCursor || item_data->equip_slot == MainPowerSource || tCanLoot>=3 ||
(item_data->equipSlot >= 8000 && item_data->equipSlot <= 8999)) { (item_data->equip_slot >= 8000 && item_data->equip_slot <= 8999)) {
if(i < corpselootlimit) { if(i < corpselootlimit) {
item = database.GetItem(item_data->item_id); item = database.GetItem(item_data->item_id);
if(client && item) { if(client && item) {
ItemInst* inst = database.CreateItem(item, item_data->charges, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5); 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);
if(inst) { if(inst) {
// MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor // MainGeneral1 is the corpse inventory start offset for Ti(EMu) - CORPSE_END = MainGeneral1 + MainCursor
client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot); client->SendItemPacket(i + EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot);
@ -1046,7 +1052,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app)
if (item != 0) if (item != 0)
{ {
if(item_data) if(item_data)
inst = database.CreateItem(item, item_data?item_data->charges:0, item_data->aug1, item_data->aug2, item_data->aug3, item_data->aug4, item_data->aug5); 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);
else else
inst = database.CreateItem(item); inst = database.CreateItem(item);
} }
@ -1257,7 +1263,7 @@ void Corpse::QueryLoot(Client* to) {
ServerLootItem_Struct* sitem = *cur; ServerLootItem_Struct* sitem = *cur;
if (IsPlayerCorpse()) { if (IsPlayerCorpse()) {
if (sitem->equipSlot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equipSlot <= EmuConstants::CURSOR_BAG_END) if (sitem->equip_slot >= EmuConstants::GENERAL_BAGS_BEGIN && sitem->equip_slot <= EmuConstants::CURSOR_BAG_END)
sitem->lootslot = 0xFFFF; sitem->lootslot = 0xFFFF;
else else
x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF; x < corpselootlimit ? sitem->lootslot = x : sitem->lootslot = 0xFFFF;
@ -1265,7 +1271,7 @@ void Corpse::QueryLoot(Client* to) {
const Item_Struct* item = database.GetItem(sitem->item_id); const Item_Struct* item = database.GetItem(sitem->item_id);
if (item) if (item)
to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast<int16>(sitem->lootslot), sitem->equipSlot, item->Name, item->ID, sitem->charges); to->Message((sitem->lootslot == 0xFFFF), "LootSlot: %i (EquipSlot: %i) Item: %s (%d), Count: %i", static_cast<int16>(sitem->lootslot), sitem->equip_slot, item->Name, item->ID, sitem->charges);
else else
to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id); to->Message((sitem->lootslot == 0xFFFF), "Error: 0x%04x", sitem->item_id);

View File

@ -858,7 +858,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
{ {
if(bag_item_data[i] == nullptr) if(bag_item_data[i] == nullptr)
continue; continue;
const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug1, bag_item_data[i]->aug2, bag_item_data[i]->aug3, bag_item_data[i]->aug4, bag_item_data[i]->aug5); 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);
interior_slot = Inventory::CalcSlotId(slot_id, i); 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); 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); PutLootInInventory(interior_slot, *bagitem);

View File

@ -195,13 +195,13 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
item->item_id = item2->ID; item->item_id = item2->ID;
item->charges = charges; item->charges = charges;
item->aug1 = 0; item->aug_1 = 0;
item->aug2 = 0; item->aug_2 = 0;
item->aug3 = 0; item->aug_3 = 0;
item->aug4 = 0; item->aug_4 = 0;
item->aug5 = 0; item->aug_5 = 0;
item->minlevel = minlevel; item->min_level = minlevel;
item->maxlevel = maxlevel; item->max_level = maxlevel;
if (equipit) { if (equipit) {
uint8 eslot = 0xFF; uint8 eslot = 0xFF;
char newid[20]; char newid[20];
@ -339,7 +339,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
if (found) { if (found) {
CalcBonuses(); // This is less than ideal for bulk adding of items CalcBonuses(); // This is less than ideal for bulk adding of items
} }
item->equipSlot = item2->Slots; item->equip_slot = item2->Slots;
} }
if(itemlist != nullptr) if(itemlist != nullptr)

View File

@ -429,7 +429,7 @@ ServerLootItem_Struct* NPC::GetItem(int slot_id) {
end = itemlist.end(); end = itemlist.end();
for(; cur != end; ++cur) { for(; cur != end; ++cur) {
ServerLootItem_Struct* item = *cur; ServerLootItem_Struct* item = *cur;
if (item->equipSlot == slot_id) { if (item->equip_slot == slot_id) {
return item; return item;
} }
} }
@ -446,7 +446,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) {
itemlist.erase(cur); itemlist.erase(cur);
return; return;
} }
else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) { else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) {
//std::cout<<"NPC::RemoveItem"<<" equipSlot:"<<iterator.GetData()->equipSlot<<" quantity:"<< quantity<<std::endl; // iterator undefined [CODEBUG] //std::cout<<"NPC::RemoveItem"<<" equipSlot:"<<iterator.GetData()->equipSlot<<" quantity:"<< quantity<<std::endl; // iterator undefined [CODEBUG]
if (item->charges <= quantity) if (item->charges <= quantity)
itemlist.erase(cur); itemlist.erase(cur);
@ -471,9 +471,9 @@ void NPC::CheckMinMaxLevel(Mob *them)
if(!(*cur)) if(!(*cur))
return; return;
if(themlevel < (*cur)->minlevel || themlevel > (*cur)->maxlevel) if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level)
{ {
material = Inventory::CalcMaterialFromSlot((*cur)->equipSlot); material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot);
if(material != 0xFF) if(material != 0xFF)
SendWearChange(material); SendWearChange(material);
@ -508,15 +508,15 @@ void NPC::QueryLoot(Client* to) {
if (item) if (item)
if (to->GetClientVersion() >= EQClientRoF) if (to->GetClientVersion() >= EQClientRoF)
{ {
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
} }
else if (to->GetClientVersion() >= EQClientSoF) else if (to->GetClientVersion() >= EQClientSoF)
{ {
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
} }
else else
{ {
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12); to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
} }
else else
LogFile->write(EQEMuLog::Error, "Database error, invalid item"); LogFile->write(EQEMuLog::Error, "Database error, invalid item");

View File

@ -3858,20 +3858,24 @@ bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct
); );
results = QueryDatabase(query); results = QueryDatabase(query);
i = 0; i = 0;
pcs->itemcount = results.RowCount();
uint16 r = 0; uint16 r = 0;
// Allocate memory for items.
pcs->items = reinterpret_cast<player_lootitem::ServerLootItem_Struct*>(new char[pcs->itemcount * sizeof(player_lootitem::ServerLootItem_Struct)]);
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot, pcs->items[i].equip_slot = atoi(row[r]); r++; // equip_slot,
pcs->items[i].item_id = atoi(row[r]); r++; // item_id, pcs->items[i].item_id = atoi(row[r]); r++; // item_id,
pcs->items[i].charges = atoi(row[r]); r++; // charges, pcs->items[i].charges = atoi(row[r]); r++; // charges,
pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1, pcs->items[i].aug_1 = atoi(row[r]); r++; // aug_1,
pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2, pcs->items[i].aug_2 = atoi(row[r]); r++; // aug_2,
pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3, pcs->items[i].aug_3 = atoi(row[r]); r++; // aug_3,
pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4, pcs->items[i].aug_4 = atoi(row[r]); r++; // aug_4,
pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5, pcs->items[i].aug_5 = atoi(row[r]); r++; // aug_5,
r = 0; r = 0;
i++; i++;
} }
pcs->itemcount = i;
return true; return true;
} }

View File

@ -139,6 +139,8 @@ namespace player_lootitem {
uint32 aug_3; uint32 aug_3;
uint32 aug_4; uint32 aug_4;
uint32 aug_5; uint32 aug_5;
uint8 min_level; //
uint8 max_level; //
}; };
} }
@ -170,7 +172,8 @@ struct PlayerCorpse_Struct {
uint32 drakkin_heritage; uint32 drakkin_heritage;
uint32 drakkin_tattoo; uint32 drakkin_tattoo;
uint32 drakkin_details; uint32 drakkin_details;
player_lootitem::ServerLootItem_Struct items[0]; player_lootitem::ServerLootItem_Struct* items[0];
//std::list<player_lootitem::ServerLootItem_Struct*> items;
}; };
struct Door { struct Door {