Renamed SetPKItem to SetPlayerKillItemID

Renamed AllowMobLoot to AllowPlayerLoot
Renamed DepopCorpse (PC) to DepopPlayerCorpse
Renamed GetPKItem to GetPlayerKillItem
Renamed Corpse class variable 'orgname' to 'corpse_name'
Renamed CompleteRezz to CompleteResurrection
Renamed GetDBID to GetCorpseDBID

Removed CorpseToServerSlot as it is unnecessary
Removed ServerToCorpseSlot as it is unnecessary

Reogrganized corpse.h header
This commit is contained in:
Akkadius 2014-11-25 23:54:59 -06:00
parent fbaae2b1e4
commit b43cfa126f
13 changed files with 131 additions and 234 deletions

View File

@ -1631,14 +1631,14 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
database.GetVariable("PvPitem", tmp2, 9);
int pvpitem = atoi(tmp2);
if(pvpitem>0 && pvpitem<200000)
new_corpse->SetPKItem(pvpitem);
new_corpse->SetPlayerKillItemID(pvpitem);
}
else if(reward==2)
new_corpse->SetPKItem(-1);
new_corpse->SetPlayerKillItemID(-1);
else if(reward==1)
new_corpse->SetPKItem(1);
new_corpse->SetPlayerKillItemID(1);
else
new_corpse->SetPKItem(0);
new_corpse->SetPlayerKillItemID(0);
if(killerMob->CastToClient()->isgrouped) {
Group* group = entity_list.GetGroupByClient(killerMob->CastToClient());
if(group != 0)
@ -1647,7 +1647,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
{
if(group->members[i] != nullptr)
{
new_corpse->AllowMobLoot(group->members[i],i);
new_corpse->AllowPlayerLoot(group->members[i],i);
}
}
}
@ -2301,13 +2301,13 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
if(killer != 0 && emoteid != 0)
corpse->CastToNPC()->DoNPCEmote(AFTERDEATH, emoteid);
if(killer != 0 && killer->IsClient()) {
corpse->AllowMobLoot(killer, 0);
corpse->AllowPlayerLoot(killer, 0);
if(killer->IsGrouped()) {
Group* group = entity_list.GetGroupByClient(killer->CastToClient());
if(group != 0) {
for(int i=0;i<6;i++) { // Doesnt work right, needs work
if(group->members[i] != nullptr) {
corpse->AllowMobLoot(group->members[i],i);
corpse->AllowPlayerLoot(group->members[i],i);
}
}
}
@ -2323,30 +2323,30 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
case 0:
case 1:
if(r->members[x].member && r->members[x].IsRaidLeader){
corpse->AllowMobLoot(r->members[x].member, i);
corpse->AllowPlayerLoot(r->members[x].member, i);
i++;
}
break;
case 2:
if(r->members[x].member && r->members[x].IsRaidLeader){
corpse->AllowMobLoot(r->members[x].member, i);
corpse->AllowPlayerLoot(r->members[x].member, i);
i++;
}
else if(r->members[x].member && r->members[x].IsGroupLeader){
corpse->AllowMobLoot(r->members[x].member, i);
corpse->AllowPlayerLoot(r->members[x].member, i);
i++;
}
break;
case 3:
if(r->members[x].member && r->members[x].IsLooter){
corpse->AllowMobLoot(r->members[x].member, i);
corpse->AllowPlayerLoot(r->members[x].member, i);
i++;
}
break;
case 4:
if(r->members[x].member)
{
corpse->AllowMobLoot(r->members[x].member, i);
corpse->AllowPlayerLoot(r->members[x].member, i);
i++;
}
break;

View File

@ -2174,7 +2174,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
corpse->IsRezzed(true);
corpse->CompleteRezz();
corpse->CompleteResurrection();
}
}
else //Not rez

View File

@ -3421,7 +3421,7 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(0, "Error: Target must be a player corpse.");
else if (c->Admin() >= commandEditPlayerCorpses && target->IsPlayerCorpse()) {
c->Message(0, "Depoping %s.", target->GetName());
target->CastToCorpse()->DepopCorpse();
target->CastToCorpse()->DepopPlayerCorpse();
if(!sep->arg[2][0] || atoi(sep->arg[2]) != 0)
target->CastToCorpse()->Bury();
}
@ -3906,7 +3906,7 @@ void command_save(Client *c, const Seperator *sep)
}
else if (c->GetTarget()->IsPlayerCorpse()) {
if (c->GetTarget()->CastToMob()->Save())
c->Message(0, "%s successfully saved. (dbid=%u)", c->GetTarget()->GetName(), c->GetTarget()->CastToCorpse()->GetDBID());
c->Message(0, "%s successfully saved. (dbid=%u)", c->GetTarget()->GetName(), c->GetTarget()->CastToCorpse()->GetCorpseDBID());
else
c->Message(0, "Manual save for %s failed.", c->GetTarget()->GetName());
}

View File

@ -69,13 +69,12 @@ Corpse* Corpse::LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std:
PlayerCorpse_Struct *pcs = (PlayerCorpse_Struct*)buffer;
database.LoadCharacterCorpseData(in_dbid, pcs);
/* Load Items */
/* Load Items */
ItemList itemlist;
ServerLootItem_Struct* tmp = 0;
for (unsigned int i = 0; i < pcs->itemcount; i++) {
tmp = new ServerLootItem_Struct;
memcpy(tmp, &pcs->items[i], sizeof(player_lootitem::ServerLootItem_Struct));
tmp->equip_slot = CorpseToServerSlot(tmp->equip_slot);
itemlist.push_back(tmp);
}
@ -191,7 +190,7 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
0 // uint32 in_scalerate
),
corpse_decay_timer(in_decaytime),
corpse_res_timer(0),
corpse_rez_timer(0),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(0),
loot_cooldown_timer(10)
@ -212,13 +211,13 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum());
npctype_id = in_npctypeid;
SetPKItem(0);
SetPlayerKillItemID(0);
char_id = 0;
corpse_db_id = 0;
player_corpse_depop = false;
strcpy(orgname, in_npc->GetName());
strcpy(corpse_name, in_npc->GetName());
strcpy(name, in_npc->GetName());
// Added By Hogie
for(int count = 0; count < 100; count++) {
if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
@ -293,7 +292,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
0 // uint32 in_scalerate
),
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
corpse_rez_timer(RuleI(Character, CorpseResTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)),
loot_cooldown_timer(10)
@ -328,13 +327,13 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
gold = 0;
platinum = 0;
strcpy(orgname, pp->name);
strcpy(corpse_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 = false;
SetPKItem(0);
SetPlayerKillItemID(0);
/* Check Rule to see if we can leave corpses */
if(!RuleB(Character, LeaveNakedCorpses) ||
@ -521,7 +520,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi
0, // uint8 in_maxlevel,
0), // uint32 in_scalerate
corpse_decay_timer(RuleI(Character, CorpseDecayTimeMS)),
corpse_res_timer(RuleI(Character, CorpseResTimeMS)),
corpse_rez_timer(RuleI(Character, CorpseResTimeMS)),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(RuleI(Zone, GraveyardTimeMS)),
loot_cooldown_timer(10)
@ -545,7 +544,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi
itemlist = *in_itemlist;
in_itemlist->clear();
strcpy(orgname, in_charname);
strcpy(corpse_name, in_charname);
strcpy(name, in_charname);
this->copper = in_copper;
@ -558,7 +557,7 @@ Corpse::Corpse(uint32 in_dbid, uint32 in_charid, const char* in_charname, ItemLi
for (int i = 0; i < MAX_LOOTERS; i++){
allowed_looters[i] = 0;
}
SetPKItem(0);
SetPlayerKillItemID(0);
}
Corpse::~Corpse() {
@ -636,17 +635,16 @@ bool Corpse::Save() {
end = itemlist.end();
for (; cur != end; ++cur) {
ServerLootItem_Struct* item = *cur;
item->equip_slot = ServerToCorpseSlot(item->equip_slot); // temp hack until corpse blobs are removed
memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct));
}
/* Create New Corpse*/
if (corpse_db_id == 0) {
corpse_db_id = database.SaveCharacterCorpse(char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading);
corpse_db_id = database.SaveCharacterCorpse(char_id, corpse_name, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading);
}
/* Update Corpse Data */
else{
corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, orgname, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed());
corpse_db_id = database.UpdateCharacterCorpse(corpse_db_id, char_id, corpse_name, zone->GetZoneID(), zone->GetInstanceID(), dbpc, x_pos, y_pos, z_pos, heading, IsRezzed());
}
safe_delete_array(dbpc);
@ -670,12 +668,12 @@ void Corpse::Bury() {
player_corpse_depop = true;
}
void Corpse::Depop() {
void Corpse::DepopNPCCorpse() {
if (IsNPCCorpse())
player_corpse_depop = true;
}
void Corpse::DepopCorpse() {
void Corpse::DepopPlayerCorpse() {
player_corpse_depop = true;
}
@ -903,7 +901,7 @@ bool Corpse::CanPlayerLoot(int charid) {
return false;
}
void Corpse::AllowMobLoot(Mob *them, uint8 slot) {
void Corpse::AllowPlayerLoot(Mob *them, uint8 slot) {
if(slot >= MAX_LOOTERS)
return;
if(them == nullptr || !them->IsClient())
@ -959,13 +957,13 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
else if ((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) {
Loot_Request_Type = 2;
}
else if (GetPKItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */
else if (GetPlayerKillItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */
Loot_Request_Type = 3;
}
else if (GetPKItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */
else if (GetPlayerKillItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */
Loot_Request_Type = 4;
}
else if (GetPKItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */
else if (GetPlayerKillItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */
Loot_Request_Type = 5;
}
@ -1010,14 +1008,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
client->QueuePacket(outapp);
safe_delete(outapp);
if(Loot_Request_Type == 5) {
int pkitem = GetPKItem();
int pkitem = GetPlayerKillItem();
const Item_Struct* item = database.GetItem(pkitem);
ItemInst* inst = database.CreateItem(item, item->MaxCharges);
if(inst) {
client->SendItemPacket(EmuConstants::CORPSE_BEGIN, inst, ItemPacketLoot);
safe_delete(inst);
}
else { client->Message(13, "Could not find item number %i to send!!", GetPKItem()); }
else { client->Message(13, "Could not find item number %i to send!!", GetPlayerKillItem()); }
client->QueuePacket(app);
return;
@ -1068,14 +1066,14 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
if(IsPlayerCorpse() && i == 0 && itemlist.size() > 0) { // somehow, player corpse contains items, but client doesn't see them...
client->Message(13, "This corpse contains items that are inaccessable!");
client->Message(15, "Contact a GM for item replacement, if necessary.");
client->Message(15, "BUGGED CORPSE [DBID: %i, Name: %s, Item Count: %i]", GetDBID(), GetName(), itemlist.size());
client->Message(15, "BUGGED CORPSE [DBID: %i, Name: %s, Item Count: %i]", GetCorpseDBID(), GetName(), itemlist.size());
cur = itemlist.begin();
end = itemlist.end();
for(; cur != end; ++cur) {
ServerLootItem_Struct* item_data = *cur;
item = database.GetItem(item_data->item_id);
LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner");
LogFile->write(EQEMuLog::Debug, "Corpse Looting: %s was not sent to client loot window (corpse_dbid: %i, charname: %s(%s))", item->Name, GetCorpseDBID(), client->GetName(), client->GetGM() ? "GM" : "Owner");
client->Message(0, "Inaccessable Corpse Item: %s", item->Name);
}
}
@ -1131,7 +1129,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
client->Message(13, "Error: Corpse locked by GM.");
return;
}
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPKItem() == 0){
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPlayerKillItem() == 0){
client->Message(13, "Error: You cannot loot any more items from this corpse.");
SendEndLootErrorPacket(client);
being_looted_by = 0xFFFFFFFF;
@ -1142,17 +1140,17 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
ServerLootItem_Struct* item_data = nullptr, *bag_item_data[10];
memset(bag_item_data, 0, sizeof(bag_item_data));
if (GetPKItem() > 1){
item = database.GetItem(GetPKItem());
if (GetPlayerKillItem() > 1){
item = database.GetItem(GetPlayerKillItem());
}
else if (GetPKItem() == -1 || GetPKItem() == 1){
else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1){
item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward
}
else{
item_data = GetItem(lootitem->slot_id - EmuConstants::CORPSE_BEGIN, bag_item_data);
}
if (GetPKItem()<=1 && item_data != 0) {
if (GetPlayerKillItem()<=1 && item_data != 0) {
item = database.GetItem(item_data->item_id);
}
@ -1191,7 +1189,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
char buf[88];
char corpse_name[64];
strcpy(corpse_name, orgname);
strcpy(corpse_name, corpse_name);
snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(corpse_name));
buf[87] = '\0';
std::vector<EQEmu::Any> args;
@ -1236,7 +1234,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
}
/* Remove Bag Contents */
if (item->ItemClass == ItemClassContainer && (GetPKItem() != -1 || GetPKItem() != 1)) {
if (item->ItemClass == ItemClassContainer && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) {
for (int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) {
if (bag_item_data[i]) {
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */
@ -1247,8 +1245,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
}
}
if (GetPKItem() != -1){
SetPKItem(0);
if (GetPlayerKillItem() != -1){
SetPlayerKillItemID(0);
}
/* Send message with item link to groups and such */
@ -1361,7 +1359,7 @@ void Corpse::QueryLoot(Client* to) {
}
if (IsPlayerCorpse()) {
to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetDBID());
to->Message(0, "%i visible %s (%i total) on %s (DBID: %i).", x, x==1?"item":"items", y, this->GetName(), this->GetCorpseDBID());
}
else {
to->Message(0, "%i %s on %s.", y, y==1?"item":"items", this->GetName());
@ -1416,7 +1414,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
return true;
}
void Corpse::CompleteRezz(){
void Corpse::CompleteResurrection(){
rez_experience = 0;
is_corpse_changed = true;
this->Save();
@ -1461,7 +1459,7 @@ uint32 Corpse::GetEquipmentColor(uint8 material_slot) const {
}
void Corpse::AddLooter(Mob* who) {
for (int i=0; i<MAX_LOOTERS; i++) {
for (int i = 0; i < MAX_LOOTERS; i++) {
if (allowed_looters[i] == 0) {
allowed_looters[i] = who->CastToClient()->CharacterID();
break;
@ -1486,111 +1484,4 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){
else {
corpse_graveyard_timer.SetTimer(3000);
}
}
/*
** Corpse slot translations are needed until corpse database blobs are converted
**
** To account for the addition of MainPowerSource, MainGeneral9 and MainGeneral10 into
** the contiguous possessions slot enumeration, the following designations will be used:
**
** Designatiom Server Corpse Offset
** --------------------------------------------------
** MainCharm 0 0 0
** ... ... ... 0
** MainWaist 20 20 0
** MainPowerSource 21 9999 +9978
** MainAmmo 22 21 -1
**
** MainGeneral1 23 22 -1
** ... ... ... -1
** MainGeneral8 30 29 -1
** MainGeneral9 31 9997 +9966
** MainGeneral10 32 9998 +9966
**
** MainCursor 33 30 -3
**
** MainGeneral1_1 251 251 0
** ... ... ... 0
** MainGeneral8_10 330 330 0
** MainGeneral9_1 331 341 +10
** ... ... ... +10
** MainGeneral10_10 350 360 +10
**
** MainCursor_1 351 331 -20
** ... ... ... -20
** MainCursor_10 360 340 -20
**
** (Not all slot designations are valid to all clients..see <client>##_constants.h files for valid slot enumerations)
*/
int16 Corpse::ServerToCorpseSlot(int16 server_slot)
{
return server_slot; // temporary return
/*
switch (server_slot)
{
case MainPowerSource:
return 9999;
case MainGeneral9:
return 9997;
case MainGeneral10:
return 9998;
case MainCursor:
return 30;
case MainAmmo:
case MainGeneral1:
case MainGeneral2:
case MainGeneral3:
case MainGeneral4:
case MainGeneral5:
case MainGeneral6:
case MainGeneral7:
case MainGeneral8:
return server_slot - 1;
default:
if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END)
return server_slot - 20;
else if (server_slot >= EmuConstants::GENERAL_BAGS_END - 19 && server_slot <= EmuConstants::GENERAL_BAGS_END)
return server_slot + 10;
else
return server_slot;
}
*/
}
int16 Corpse::CorpseToServerSlot(int16 corpse_slot)
{
return corpse_slot; // temporary return
/*
switch (corpse_slot)
{
case 9999:
return MainPowerSource;
case 9997:
return MainGeneral9;
case 9998:
return MainGeneral10;
case 30:
return MainCursor;
case 21: // old SLOT_AMMO
case 22: // old PERSONAL_BEGIN
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29: // old PERSONAL_END
return corpse_slot + 1;
default:
if (corpse_slot >= 331 && corpse_slot <= 340)
return corpse_slot + 20;
else if (corpse_slot >= 341 && corpse_slot <= 360)
return corpse_slot - 10;
else
return corpse_slot;
}
*/
}

View File

@ -27,7 +27,7 @@ class NPC;
#define MAX_LOOTERS 72
class Corpse : public Mob {
public:
public:
static void SendEndLootErrorPacket(Client* client);
static void SendLootReqErrorPacket(Client* client, uint8 response = 2);
@ -35,85 +35,91 @@ public:
Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000);
Corpse(Client* client, int32 in_rezexp);
Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false);
~Corpse();
~Corpse();
static Corpse* LoadCharacterCorpseEntity(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard);
//abstract virtual function implementations requird by base abstract class
/* Corpse: General */
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; }
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false,
bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; }
virtual bool HasRaid() { return false; }
virtual bool HasGroup() { return false; }
virtual Raid* GetRaid() { return 0; }
virtual Group* GetGroup() { return 0; }
void LoadPlayerCorpseDecayTime(uint32 dbid);
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false,
bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) {
return false;
}
virtual bool HasRaid() { return false; }
virtual bool HasGroup() { return false; }
virtual Raid* GetRaid() { return 0; }
virtual Group* GetGroup() { return 0; }
inline uint32 GetCorpseDBID() { return corpse_db_id; }
inline char* GetOwnerName() { return corpse_name; }
bool IsEmpty() const;
bool IsCorpse() const { return true; }
bool IsPlayerCorpse() const { return is_player_corpse; }
bool IsNPCCorpse() const { return !is_player_corpse; }
bool IsBecomeNPCCorpse() const { return become_npc; }
virtual void DepopNPCCorpse();
virtual void DepopPlayerCorpse();
bool Process();
bool Save();
uint32 GetCharID() { return char_id; }
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; };
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); }
uint32 GetCharID() { return char_id; }
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; };
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
uint32 GetRezTime() { if (!corpse_rez_timer.Enabled()) return 0; else return corpse_rez_timer.GetRemainingTime(); }
void SetDecayTimer(uint32 decay_time);
void Delete();
void Bury();
void CalcCorpseName();
inline void Lock() { is_locked = true; }
inline void UnLock() { is_locked = false; }
inline bool IsLocked() { return is_locked; }
inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; }
inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); }
inline uint32 GetDBID() { return corpse_db_id; }
inline char* GetOwnerName() { return orgname;}
void LoadPlayerCorpseDecayTime(uint32 dbid);
void SetDecayTimer(uint32 decay_time);
bool IsEmpty() const;
void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
/* Corpse: Items */
uint32 GetWornItem(int16 equipSlot) const;
ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
void RemoveItem(uint16 lootslot);
void RemoveItem(ServerLootItem_Struct* item_data);
void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum);
void RemoveCash();
void QueryLoot(Client* to);
uint32 CountItems();
void Delete();
void Bury();
virtual void Depop();
virtual void DepopCorpse();
ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
void SetPlayerKillItemID(int32 pk_item_id) { player_kill_item = pk_item_id; }
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);
/* Corpse: Coin */
void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum);
void RemoveCash();
uint32 GetCopper() { return copper; }
uint32 GetSilver() { return silver; }
uint32 GetGold() { return gold; }
uint32 GetPlatinum() { return platinum; }
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
void MakeLootRequestPackets(Client* client, const EQApplicationPacket* app);
void LootItem(Client* client, const EQApplicationPacket* app);
void EndLoot(Client* client, const EQApplicationPacket* app);
bool Summon(Client* client, bool spell, bool CheckDistance);
void CastRezz(uint16 spellid, Mob* Caster);
void CompleteRezz();
void SetPKItem(int32 id) { player_kill_item = id; }
int32 GetPKItem() { return player_kill_item; }
bool CanPlayerLoot(int charid);
void AllowMobLoot(Mob *them, uint8 slot);
void AddLooter(Mob *who);
/* Corpse: Resurrection */
bool IsRezzed() { return rez; }
void IsRezzed(bool in_rez) { rez = in_rez; }
void Spawn();
void CastRezz(uint16 spellid, Mob* Caster);
void CompleteResurrection();
char orgname[64];
uint32 GetEquipment(uint8 material_slot) const; // returns item id
/* Corpse: Loot */
void QueryLoot(Client* to);
void LootItem(Client* client, const EQApplicationPacket* app);
void EndLoot(Client* client, const EQApplicationPacket* app);
void MakeLootRequestPackets(Client* client, const EQApplicationPacket* app);
void AllowPlayerLoot(Mob *them, uint8 slot);
void AddLooter(Mob *who);
uint32 CountItems();
bool CanPlayerLoot(int charid);
inline void Lock() { is_locked = true; }
inline void UnLock() { is_locked = false; }
inline bool IsLocked() { return is_locked; }
inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; }
inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); }
/* Mob */
void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho);
bool Summon(Client* client, bool spell, bool CheckDistance);
void Spawn();
char corpse_name[64];
uint32 GetEquipment(uint8 material_slot) const;
uint32 GetEquipmentColor(uint8 material_slot) const;
inline int GetRezzExp() { return rez_experience; }
// these are a temporary work-around until corpse inventory is removed from the database blob
static int16 ServerToCorpseSlot(int16 server_slot); // encode
static int16 CorpseToServerSlot(int16 corpse_slot); // decode
inline int GetRezExp() { return rez_experience; }
protected:
std::list<uint32> MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot);
@ -138,7 +144,7 @@ private:
bool become_npc;
int allowed_looters[MAX_LOOTERS]; /* People allowed to loot the corpse, character id */
Timer corpse_decay_timer; /* The amount of time in millseconds in which a corpse will take to decay (Depop/Poof) */
Timer corpse_res_timer; /* The amount of time in millseconds in which a corpse can be rezzed */
Timer corpse_rez_timer; /* The amount of time in millseconds in which a corpse can be rezzed */
Timer corpse_delay_timer;
Timer corpse_graveyard_timer;
Timer loot_cooldown_timer; /* Delay between loot actions on the corpse entity */

View File

@ -1606,7 +1606,7 @@ Corpse *EntityList::GetCorpseByDBID(uint32 dbid)
{
auto it = corpse_list.begin();
while (it != corpse_list.end()) {
if (it->second->GetDBID() == dbid)
if (it->second->GetCorpseDBID() == dbid)
return it->second;
++it;
}
@ -1660,7 +1660,7 @@ void EntityList::RemoveCorpseByDBID(uint32 dbid)
{
auto it = corpse_list.begin();
while (it != corpse_list.end()) {
if (it->second->GetDBID() == dbid) {
if (it->second->GetCorpseDBID() == dbid) {
safe_delete(it->second);
free_ids.push(it->first);
it = corpse_list.erase(it);
@ -1677,9 +1677,9 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid)
auto it = corpse_list.begin();
while (it != corpse_list.end()) {
if (it->second->GetCharID() == charid) {
RezzExp += it->second->GetRezzExp();
RezzExp += it->second->GetRezExp();
it->second->IsRezzed(true);
it->second->CompleteRezz();
it->second->CompleteResurrection();
}
++it;
}
@ -2655,7 +2655,7 @@ int32 EntityList::DeleteNPCCorpses()
auto it = corpse_list.begin();
while (it != corpse_list.end()) {
if (it->second->IsNPCCorpse()) {
it->second->Depop();
it->second->DepopNPCCorpse();
x++;
}
++it;

View File

@ -39,7 +39,7 @@ void Lua_Corpse::ResetLooter() {
uint32 Lua_Corpse::GetDBID() {
Lua_Safe_Call_Int();
return self->GetDBID();
return self->GetCorpseDBID();
}
bool Lua_Corpse::IsRezzed() {
@ -119,7 +119,7 @@ bool Lua_Corpse::CanMobLoot(int charid) {
void Lua_Corpse::AllowMobLoot(Lua_Mob them, uint8 slot) {
Lua_Safe_Call_Void();
self->AllowMobLoot(them, slot);
self->AllowPlayerLoot(them, slot);
}
bool Lua_Corpse::Summon(Lua_Client client, bool spell, bool checkdistance) {

View File

@ -1255,7 +1255,7 @@ void Mob::ShowStats(Client* client)
}
else if (IsCorpse()) {
if (IsPlayerCorpse()) {
client->Message(0, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetDBID());
client->Message(0, " CharID: %i PlayerCorpse: %i", CastToCorpse()->GetCharID(), CastToCorpse()->GetCorpseDBID());
}
else {
client->Message(0, " NPCCorpse", GetID());

View File

@ -208,7 +208,7 @@ XS(XS_Corpse_GetDBID)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetDBID();
RETVAL = THIS->GetCorpseDBID();
XSprePUSH; PUSHu((UV)RETVAL);
}
XSRETURN(1);
@ -662,7 +662,7 @@ XS(XS_Corpse_CompleteRezz)
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->CompleteRezz();
THIS->CompleteResurrection();
}
XSRETURN_EMPTY;
}
@ -723,7 +723,7 @@ XS(XS_Corpse_AllowMobLoot)
if(them == nullptr)
Perl_croak(aTHX_ "them is nullptr, avoiding crash.");
THIS->AllowMobLoot(them, slot);
THIS->AllowPlayerLoot(them, slot);
}
XSRETURN_EMPTY;
}

View File

@ -1786,7 +1786,7 @@ bool QuestManager::buryplayercorpse(uint32 char_id)
if(corpse)
{
corpse->Save();
corpse->DepopCorpse();
corpse->DepopPlayerCorpse();
}
else
{

View File

@ -3825,7 +3825,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster)
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct));
Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer;
// Why are we truncating these names to 30 characters ?
memcpy(rezz->your_name,this->orgname,30);
memcpy(rezz->your_name,this->corpse_name,30);
memcpy(rezz->corpse_name,this->name,30);
memcpy(rezz->rezzer_name,Caster->GetName(),30);
rezz->zone_id = zone->GetZoneID();

View File

@ -705,7 +705,7 @@ void WorldServer::Process() {
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
// I don't know why Rezzed is not set to true in CompleteRezz().
corpse->IsRezzed(true);
corpse->CompleteRezz();
corpse->CompleteResurrection();
}
}

View File

@ -3652,7 +3652,7 @@ uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) {
if (tmp) {
itemid = tmp->GetWornItem(slotid);
tmp->DepopCorpse();
tmp->DepopPlayerCorpse();
}
return itemid;
}
@ -3800,7 +3800,7 @@ Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_z
entity_list.AddCorpse(NewCorpse);
NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
NewCorpse->Spawn();
if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading))
if (!UnburyCharacterCorpse(NewCorpse->GetCorpseDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading))
LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
}
}