diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index b44cb8f37..d3f96e6e7 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -3015,7 +3015,8 @@ ENCODE(OP_ReadBook) { eq->window = emu->window; OUT(type); eq->invslot = 0; // Set to hard 0 since it's not required for the structure to work - memcpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile)); + if(sizeof(emu->booktext) > 0 && sizeof(emu->booktext) < 8194) + strncpy(eq->txtfile, emu->booktext, sizeof(eq->txtfile)); FINISH_ENCODE(); } diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 8483b9bb0..14257fef9 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -13,7 +13,7 @@ SET(eqlaunch_headers ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) -TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(eqlaunch Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) diff --git a/eqlaunch/worldserver.cpp b/eqlaunch/worldserver.cpp index a3071f3df..1f314bd8f 100644 --- a/eqlaunch/worldserver.cpp +++ b/eqlaunch/worldserver.cpp @@ -126,7 +126,6 @@ void WorldServer::Process() { default: { _log(LAUNCHER__NET, "Unknown opcode 0x%x from World of len %d", pack->opcode, pack->size); - //DumpPacket(pack->pBuffer, pack->size); break; } } diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 96cdaf69c..4e319ddad 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -19,7 +19,7 @@ ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers}) ADD_DEFINITIONS(-DQSERV) -TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(queryserv Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 74629fdd1..902ffb2ff 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -19,7 +19,7 @@ SET(shared_memory_headers ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers}) -TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(shared_memory Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) SET_TARGET_PROPERTIES(shared_memory PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 6f0d023a0..1218541a3 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -21,7 +21,7 @@ ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers}) ADD_DEFINITIONS(-DUCS) -TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(ucs Common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index f36ba87fa..768072677 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -67,7 +67,7 @@ ADD_EXECUTABLE(world ${world_sources} ${world_headers}) ADD_DEFINITIONS(-DWORLD) -TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(world Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index e0b0d01b6..7079942ab 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -155,7 +155,7 @@ ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers}) ADD_DEFINITIONS(-DZONE) -TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE}) +TARGET_LINK_LIBRARIES(zone Common ${PERL_LIBRARY} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY}) IF(MSVC) SET_TARGET_PROPERTIES(zone PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") @@ -175,4 +175,6 @@ IF(UNIX) ADD_DEFINITIONS(-fPIC) ENDIF(UNIX) +INCLUDE_DIRECTORIES(${VLD_INCLUDE_DIR}) + SET(EXECUTABLE_OUTPUT_PATH ../Bin) diff --git a/zone/MobAI.cpp b/zone/MobAI.cpp index 4bc063998..a2030aa7d 100644 --- a/zone/MobAI.cpp +++ b/zone/MobAI.cpp @@ -1721,7 +1721,7 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) { if(!CastToNPC()->GetCombatEvent() && GetHP() > 0) { parse->EventNPC(EVENT_COMBAT, CastToNPC(), attacker, "1", 0); - uint16 emoteid = CastToNPC()->GetNPCEmoteID(); + uint16 emoteid = GetEmoteID(); if(emoteid != 0) CastToNPC()->DoNPCEmote(ENTERCOMBAT,emoteid); CastToNPC()->SetCombatEvent(true); @@ -1754,11 +1754,14 @@ void Mob::AI_Event_NoLongerEngaged() { { if(CastToNPC()->GetCombatEvent() && GetHP() > 0) { - uint16 emoteid = CastToNPC()->GetNPCEmoteID(); + if(entity_list.GetNPCByID(this->GetID())) + { + uint16 emoteid = CastToNPC()->GetEmoteID(); parse->EventNPC(EVENT_COMBAT, CastToNPC(), NULL, "0", 0); if(emoteid != 0) CastToNPC()->DoNPCEmote(LEAVECOMBAT,emoteid); CastToNPC()->SetCombatEvent(false); + } } } } diff --git a/zone/attack.cpp b/zone/attack.cpp index 1d787b0e9..141aa50ec 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1451,7 +1451,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ { if (killerMob->IsNPC()) { parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0); - uint16 emoteid = killerMob->CastToNPC()->GetNPCEmoteID(); + uint16 emoteid = killerMob->GetEmoteID(); if(emoteid != 0) killerMob->CastToNPC()->DoNPCEmote(KILLEDPC,emoteid); killerMob->TrySpellOnKill(killed_level,spell); @@ -2209,7 +2209,7 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski this->CheckMinMaxLevel(killer); } entity_list.RemoveFromAutoXTargets(this); - uint16 emoteid = this->GetNPCEmoteID(); + uint16 emoteid = this->GetEmoteID(); Corpse* corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata,level>54?RuleI(NPC,MajorNPCCorpseDecayTimeMS):RuleI(NPC,MinorNPCCorpseDecayTimeMS)); entity_list.LimitRemoveNPC(this); entity_list.AddCorpse(corpse, this->GetID()); @@ -2302,13 +2302,13 @@ void NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ski if(killerMob) { Mob *oos = killerMob->GetOwnerOrSelf(); parse->EventNPC(EVENT_DEATH, this, oos, "", 0); - uint16 emoteid = this->GetNPCEmoteID(); + uint16 emoteid = this->GetEmoteID(); if(emoteid != 0) this->DoNPCEmote(ONDEATH,emoteid); if(oos->IsNPC()) { parse->EventNPC(EVENT_NPC_SLAY, oos->CastToNPC(), this, "", 0); - uint16 emoteid = oos->CastToNPC()->GetNPCEmoteID(); + uint16 emoteid = oos->GetEmoteID(); if(emoteid != 0) oos->CastToNPC()->DoNPCEmote(KILLEDNPC,emoteid); killerMob->TrySpellOnKill(killed_level,spell); diff --git a/zone/client.cpp b/zone/client.cpp index 425309810..c582fc8a0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -5915,7 +5915,7 @@ void Client::CheckEmoteHail(Mob *target, const char* message) { return; } - uint16 emoteid = target->CastToNPC()->GetNPCEmoteID(); + uint16 emoteid = target->GetEmoteID(); if(emoteid != 0) target->CastToNPC()->DoNPCEmote(HAILED,emoteid); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c90dae9d0..ba67e4ba7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3540,7 +3540,6 @@ void Client::Handle_OP_WearChange(const EQApplicationPacket *app) { if (app->size != sizeof(WearChange_Struct)) { cout << "Wrong size: OP_WearChange, size=" << app->size << ", expected " << sizeof(WearChange_Struct) << endl; - DumpPacket(app); return; } @@ -3595,7 +3594,6 @@ void Client::Handle_OP_WhoAllRequest(const EQApplicationPacket *app) { if (app->size != sizeof(Who_All_Struct)) { cout << "Wrong size on OP_WhoAll. Got: " << app->size << ", Expected: " << sizeof(Who_All_Struct) << endl; - DumpPacket(app); return; } Who_All_Struct* whoall = (Who_All_Struct*) app->pBuffer; @@ -6484,15 +6482,6 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) database.SetGroupID(inviter->GetName(), group->GetID(), inviter->CastToClient()->CharacterID()); database.SetGroupLeaderName(group->GetID(), inviter->GetName()); - // Add the merc back into the new group - if (GetMerc()) - { - if (GetMerc()->AddMercToGroup(GetMerc(), group)) - { - database.SetGroupID(GetMerc()->GetName(), group->GetID(), inviter->CastToClient()->CharacterID(), true); - } - } - group->UpdateGroupAAs(); //Invite the inviter into the group first.....dont ask @@ -6527,11 +6516,6 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) if(!group->AddMember(this)) return; - if(GetMerc()) - { - group->AddMember(GetMerc()); - } - if(inviter->CastToClient()->IsLFP()) { // If the player who invited us to a group is LFP, have them update world now that we have joined // their group. @@ -6548,6 +6532,16 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) if(inviter->CastToClient()->GetClientVersion() >= EQClientSoD) database.RefreshGroupFromDB(inviter->CastToClient()); + // Add the merc back into the new group + if (GetMerc()) + { + if (GetMerc()->AddMercToGroup(GetMerc(), group)) + { + database.SetGroupID(GetMerc()->GetName(), group->GetID(), inviter->CastToClient()->CharacterID(), true); + } + } + + //send updates to clients out of zone... ServerPacket* pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct)); ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack->pBuffer; @@ -6663,9 +6657,9 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if(group->IsLeader(this)) // the group leader can kick other members out of the group... { - group->DelMember(memberToDisband,false); if(memberToDisband->IsClient()) { + group->DelMember(memberToDisband,false); Client* memberClient = memberToDisband->CastToClient(); Merc* memberMerc = memberToDisband->CastToClient()->GetMerc(); if(memberMerc != NULL) @@ -6674,8 +6668,22 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) if(!memberMerc->IsGrouped() && !memberClient->IsGrouped()) { Group *g = new Group(memberClient); + + if(!g) + { + delete g; + g = NULL; + return; + } + + entity_list.AddGroup(g); + + if(g->GetID() == 0) + { + safe_delete(g); + return; + } if(memberMerc->AddMercToGroup(memberMerc, g)) { - entity_list.AddGroup(g); database.SetGroupLeaderName(g->GetID(), memberClient->GetName()); g->SaveGroupLeaderAA(); database.SetGroupID(memberClient->GetName(), g->GetID(), memberClient->CharacterID()); @@ -6687,19 +6695,36 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else if(memberToDisband->IsMerc()) { + memberToDisband->CastToMerc()->RemoveMercFromGroup(memberToDisband->CastToMerc(), group); memberToDisband->CastToMerc()->Suspend(); } } else - { // ...but other members can only remove themselves + { + // ...but other members can only remove themselves group->DelMember(this,false); if(!IsGrouped() && GetMerc() != NULL) { if(!IsGrouped()) { - Group *g = new Group(this); + Group *g = new Group(this); + + if(!g) + { + delete g; + g = NULL; + return; + } + + entity_list.AddGroup(g); + + if(g->GetID() == 0) + { + safe_delete(g); + return; + } + if(GetMerc()->AddMercToGroup(GetMerc(), g)) { - entity_list.AddGroup(g); database.SetGroupLeaderName(g->GetID(), this->GetName()); g->SaveGroupLeaderAA(); database.SetGroupID(this->GetName(), g->GetID(), this->CharacterID()); @@ -7385,6 +7410,24 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) memcpy(out->message, name, len_name); memcpy(&out->message[len_name], in->message, len_msg); + /* + if (target && target->IsClient()) { + entity_list.QueueCloseClients(this, outapp, false, 100, target); + + cptr = outapp->pBuffer + 2; + + // not sure if live does this or not. thought it was a nice feature, but would take a lot to + // clean up grammatical and other errors. Maybe with a regex parser... + replacestr((char *)cptr, target->GetName(), "you"); + replacestr((char *)cptr, " he", " you"); + replacestr((char *)cptr, " she", " you"); + replacestr((char *)cptr, " him", " you"); + replacestr((char *)cptr, " her", " you"); + target->CastToClient()->QueuePacket(outapp); + + } + else + */ entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials); safe_delete(outapp); @@ -13755,9 +13798,6 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) if(merc) merc->Dismiss(); } - - SendMercMerchantResponsePacket(10); - } void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 87afcf62a..aa81f9371 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1307,7 +1307,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app) uint64 value = 0, amount_to_take = 0, amount_to_add = 0; int32 *from_bucket = 0, *to_bucket = 0; Mob* trader = trade->With(); - + // could just do a range, but this is clearer and explicit if ( diff --git a/zone/command.cpp b/zone/command.cpp index dce3257ee..8451d851f 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1867,7 +1867,7 @@ void command_npcstats(Client *c, const Seperator *sep) c->Message(0, "Gender: %i Size: %f Bodytype: %d", c->GetTarget()->GetGender(), c->GetTarget()->GetSize(), c->GetTarget()->GetBodyType()); c->Message(0, "Runspeed: %f Walkspeed: %f", c->GetTarget()->GetRunspeed(), c->GetTarget()->GetWalkspeed()); c->Message(0, "Spawn Group: %i Grid: %i", c->GetTarget()->CastToNPC()->GetSp2(), c->GetTarget()->CastToNPC()->GetGrid()); - c->Message(0, "EmoteID: %i", c->GetTarget()->CastToNPC()->GetNPCEmoteID()); + c->Message(0, "EmoteID: %i", c->GetTarget()->CastToNPC()->GetEmoteID()); c->GetTarget()->CastToNPC()->QueryLoot(c); } } @@ -11031,7 +11031,7 @@ void command_emoteview(Client *c, const Seperator *sep) if(c->GetTarget() && c->GetTarget()->IsNPC()) { int count=0; - int emoteid = c->GetTarget()->CastToNPC()->GetNPCEmoteID(); + int emoteid = c->GetTarget()->CastToNPC()->GetEmoteID(); LinkedListIterator iterator(zone->NPCEmoteList); iterator.Reset(); diff --git a/zone/doors.cpp b/zone/doors.cpp index 53315f413..c638ef746 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -148,7 +148,6 @@ void Doors::HandleClick(Client* sender, uint8 trigger) EQApplicationPacket* outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct)); MoveDoor_Struct* md = (MoveDoor_Struct*)outapp->pBuffer; - md->doorid = door_id; ///////////////////////////////////////////////////////////////// //used_pawn: Locked doors! Rogue friendly too =) diff --git a/zone/entity.cpp b/zone/entity.cpp index 393abb8ea..dc162312b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -621,7 +621,7 @@ void EntityList::AddNPC(NPC* npc, bool SendSpawnPacket, bool dontqueue) { npc->SetID(GetFreeID()); parse->EventNPC(EVENT_SPAWN, npc, NULL, "", 0); - uint16 emoteid = npc->GetNPCEmoteID(); + uint16 emoteid = npc->GetEmoteID(); if(emoteid != 0) npc->DoNPCEmote(ONSPAWN,emoteid); diff --git a/zone/groups.cpp b/zone/groups.cpp index 8457e5ad0..bcb100147 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -214,6 +214,9 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte if(!newmember && !NewMemberName) return false; + if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together. + return false; + if(!newmember) InZone = false; else diff --git a/zone/merc.cpp b/zone/merc.cpp index c385f0d1f..f6eb6bb96 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -73,6 +73,7 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) } Merc::~Merc() { + AI_Stop(); safe_delete(ourNPCData); //Since mercs are dynamically alloc'd we should probably safe_delete the data they were made from. I'm not entirely sure this is safe to delete a const. entity_list.RemoveMerc(this->GetID()); UninitializeBuffSlots(); @@ -1902,15 +1903,16 @@ void Merc::AI_Process() { } void Merc::AI_Start(int32 iMoveDelay) { - Mob::AI_Start(iMoveDelay); + NPC::AI_Start(iMoveDelay); + if (!pAIControlled) return; if (merc_spells.size() == 0) { - AIautocastspell_timer = new Timer(1000); + AIautocastspell_timer->SetTimer(1000); AIautocastspell_timer->Disable(); } else { - AIautocastspell_timer = new Timer(750); + AIautocastspell_timer->SetTimer(750); AIautocastspell_timer->Start(RandomTimer(0, 2000), false); } @@ -5594,10 +5596,6 @@ bool Merc::Suspend() { SetSuspended(true); - if(HasGroup()) { - RemoveMercFromGroup(this, GetGroup()); - } - Save(); mercOwner->GetMercInfo().IsSuspended = true; @@ -5645,31 +5643,41 @@ bool Merc::Unsuspend(bool setMaxStats) { mercOwner->GetPTimers().Clear(&database, pTimerMercSuspend); mercOwner->SendMercPersonalInfo(); + Group* g = entity_list.GetGroupByClient(mercOwner); - if(!mercOwner->IsGrouped()) - { - Group *g = new Group(mercOwner); - if(g && AddMercToGroup(this, g)) + if(!g) + { //nobody from our group is here... start a new group + g = new Group(mercOwner); + + if(!g) { - entity_list.AddGroup(g); + delete g; + g = NULL; + return false; + } + entity_list.AddGroup(g); + + if(g->GetID() == 0) { + delete g; + g = NULL; + return false; + } + + if(AddMercToGroup(this, g)) + { + entity_list.AddGroup(g, g->GetID()); database.SetGroupLeaderName(g->GetID(), mercOwner->GetName()); database.SetGroupID(mercOwner->GetName(), g->GetID(), mercOwner->CharacterID()); database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true); database.RefreshGroupFromDB(mercOwner); g->SaveGroupLeaderAA(); - loaded = true; } else { - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary failed to join the group - Suspending"); - - Suspend(); - safe_delete(g); - return false; + g->DisbandGroup(); } - } + } //else, somebody from our group is already here... else if (AddMercToGroup(this, mercOwner->GetGroup())) { database.SetGroupID(GetName(), mercOwner->GetGroup()->GetID(), mercOwner->CharacterID(), true); diff --git a/zone/mob.cpp b/zone/mob.cpp index 6c8bbc398..2d1539086 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -378,6 +378,8 @@ Mob::Mob(const char* in_name, m_DisableMelee = false; for (int i = 0; i < HIGHEST_SKILL+2; i++) { SkillDmgTaken_Mod[i] = 0; } for (int i = 0; i < HIGHEST_RESIST+2; i++) { Vulnerability_Mod[i] = 0; } + + emoteid = 0; } Mob::~Mob() @@ -1194,7 +1196,7 @@ void Mob::ShowStats(Client* client) if(n->respawn2 != 0) spawngroupid = n->respawn2->SpawnGroupID(); client->Message(0, " NPCID: %u SpawnGroupID: %u Grid: %i LootTable: %u FactionID: %i SpellsID: %u ", GetNPCTypeID(),spawngroupid, n->GetGrid(), n->GetLoottableID(), n->GetNPCFactionID(), n->GetNPCSpellsID()); - client->Message(0, " Accuracy: %i MerchantID: %i EmoteID: %i Runspeed: %f Walkspeed: %f", n->GetAccuracyRating(), n->MerchantType, n->GetNPCEmoteID(), n->GetRunspeed(), n->GetWalkspeed()); + client->Message(0, " Accuracy: %i MerchantID: %i EmoteID: %i Runspeed: %f Walkspeed: %f", n->GetAccuracyRating(), n->MerchantType, n->GetEmoteID(), n->GetRunspeed(), n->GetWalkspeed()); n->QueryLoot(client); } if (IsAIControlled()) { diff --git a/zone/mob.h b/zone/mob.h index 1b3407620..5f29227d5 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -784,6 +784,9 @@ public: void TarGlobal(const char *varname, const char *value, const char *duration, int npcid, int charid, int zoneid); void DelGlobal(const char *varname); + inline void SetEmoteID(uint16 emote) { emoteid = emote; } + inline uint16 GetEmoteID() { return emoteid; } + protected: void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillType attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic); static uint16 GetProcID(uint16 spell_id, uint8 effect_index); @@ -1110,6 +1113,7 @@ protected: bool m_targetable; int QGVarDuration(const char *fmt); void InsertQuestGlobal(int charid, int npcid, int zoneid, const char *name, const char *value, int expdate); + uint16 emoteid; private: void _StopSong(); //this is not what you think it is diff --git a/zone/npc.cpp b/zone/npc.cpp index 86efc0579..4dd24aba1 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -248,6 +248,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float npc_aggro = d->npc_aggro; + if(!IsMerc()) //memleak fix, this really shouldn't be here AI_Start(); d_meele_texture1 = d->d_meele_texture1; @@ -349,6 +350,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, float x, float y, float z, float guard_y_saved = 0; guard_z_saved = 0; guard_heading_saved = 0; + SetEmoteID(d->emoteid); InitializeBuffSlots(); CalcBonuses(); } @@ -733,7 +735,7 @@ void NPC::DumpLoot(uint32 npcdump_index, ZSDump_NPC_Loot* npclootdump, uint32* N } void NPC::Depop(bool StartSpawnTimer) { - uint16 emoteid = this->GetNPCEmoteID(); + uint16 emoteid = this->GetEmoteID(); if(emoteid != 0) this->DoNPCEmote(ONDESPAWN,emoteid); p_depop = true; diff --git a/zone/npc.h b/zone/npc.h index f2fa91116..e810cfe1f 100644 --- a/zone/npc.h +++ b/zone/npc.h @@ -327,7 +327,6 @@ public: //The corpse we make can only be looted by people who got credit for the kill const bool HasPrivateCorpse() const { return NPCTypedata->private_corpse; } const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; } - const uint32 GetNPCEmoteID() const { return NPCTypedata->emoteid; } const char* GetRawNPCTypeName() const { return NPCTypedata->name; } bool GetDepop() { return p_depop; } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 56b9de4d4..efc45175f 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -2559,7 +2559,6 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex) { tac->unknown5 = 0; // 0 for task complete or failed. _log(TASKS__UPDATE, "TaskFailed"); - _pkt(TASKS__PACKETS, outapp); QueuePacket(outapp); diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 30851b038..0f050368d 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -517,7 +517,6 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac outp->reply_code = 0x00000000; //success for finding it... user->QueuePacket(outapp); - safe_delete(outapp); @@ -664,7 +663,6 @@ void Client::TradeskillSearchResults(const char *query, unsigned long qlen, reply->recipe_id = recipe; reply->trivial = trivial; strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name)); - FastQueuePacket(&outapp); } mysql_free_result(result);