diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index c234e303a..6e853b4bd 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -305,6 +305,7 @@ union uint8 DestructibleUnk8; uint32 DestructibleUnk9; bool targetable_with_hotkey; + bool show_name; }; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 7ae5a0296..56542c07d 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -87,6 +87,7 @@ enum LogCategory { Client_Login, Headless_Client, HP_Update, + FixZ, MaxCategoryID /* Don't Remove this*/ }; @@ -138,7 +139,8 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = { "Login Server", "Client Login", "Headless Client", - "HP Update" + "HP Update", + "FixZ" }; } diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index 283f8f93d..095fab525 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -382,13 +382,8 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) return; } - if (p.GetInt8(0) != 0) { - LogF(Logs::Detail, Logs::Netcode, "Error parsing packet, did not start with a 0 frame, not a valid protocol packet."); - return; - } - auto opcode = p.GetInt8(1); - if (opcode == OP_KeepAlive || opcode == OP_OutboundPing) { + if (p.GetInt8(0) == 0 && (opcode == OP_KeepAlive || opcode == OP_OutboundPing)) { return; } @@ -407,10 +402,16 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) for (int i = 1; i >= 0; --i) { switch (m_encode_passes[i]) { case EncodeCompression: - Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + if(temp.GetInt8(0) == 0) + Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + else + Decompress(temp, 1, temp.Length() - 1); break; case EncodeXOR: - Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + if (temp.GetInt8(0) == 0) + Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + else + Decode(temp, 1, temp.Length() - 1); break; default: break; @@ -425,7 +426,10 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) for (int i = 1; i >= 0; --i) { switch (m_encode_passes[i]) { case EncodeXOR: - Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + if (temp.GetInt8(0) == 0) + Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); + else + Decode(temp, 1, temp.Length() - 1); break; default: break; @@ -1187,24 +1191,21 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) if (PacketCanBeEncoded(p)) { DynamicPacket out; - - if (p.GetUInt8(0) != 0) { - out.PutUInt8(0, 0); - out.PutUInt8(1, OP_Combined); - out.PutUInt8(2, p.Length()); - out.PutPacket(3, p); - } - else { - out.PutPacket(0, p); - } + out.PutPacket(0, p); for (int i = 0; i < 2; ++i) { switch (m_encode_passes[i]) { case EncodeCompression: - Compress(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); + if(out.GetInt8(0) == 0) + Compress(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); + else + Compress(out, 1, out.Length() - 1); break; case EncodeXOR: - Encode(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); + if (out.GetInt8(0) == 0) + Encode(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); + else + Encode(out, 1, out.Length() - 1); break; default: break; diff --git a/common/net/eqstream.cpp b/common/net/eqstream.cpp index 26fdf1d8e..ffa441939 100644 --- a/common/net/eqstream.cpp +++ b/common/net/eqstream.cpp @@ -81,7 +81,12 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req) break; } - m_connection->QueuePacket(out); + if (ack_req) { + m_connection->QueuePacket(out); + } + else { + m_connection->QueuePacket(out, 0, false); + } } } diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 23e521a57..7ce6f900f 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -3930,7 +3930,7 @@ namespace RoF if (strlen(emu->suffix)) PacketSize += strlen(emu->suffix) + 1; - bool ShowName = 1; + bool ShowName = emu->show_name; if (emu->bodytype >= 66) { emu->race = 127; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 5befaf08c..30efa95b9 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4086,7 +4086,7 @@ namespace RoF2 PacketSize += strlen(emu->DestructibleString) + 1; } - bool ShowName = 1; + bool ShowName = emu->show_name; if (emu->bodytype >= 66) { emu->race = 127; diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index f6d85f2bb..276f939e5 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -2560,7 +2560,7 @@ namespace SoD PacketSize += strlen(emu->DestructibleString) + 1; } - bool ShowName = 1; + bool ShowName = emu->show_name; if (emu->bodytype >= 66) { emu->race = 127; diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp index 44f093044..77d65ce16 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -2097,7 +2097,7 @@ namespace SoF int k; for (r = 0; r < entrycount; r++, eq++, emu++) { - eq->showname = 1; //New Field - Toggles Name Display on or off - 0 = off, 1 = on + eq->showname = emu->show_name ? 1 : 0; //New Field - Toggles Name Display on or off - 0 = off, 1 = on eq->linkdead = 0; //New Field - Toggles LD on or off after name - 0 = off, 1 = on eq->statue = 0; //New Field - 1 freezes animation eq->showhelm = emu->showhelm; @@ -2136,10 +2136,10 @@ namespace SoF eq->findable = emu->findable; if (emu->bodytype >= 66) { - eq->bodytype = 11; //non-targetable - eq->showname = 0; //no visible name - eq->race = 127; //invisible man - eq->gender = 0; //invisible men are gender 0 + eq->bodytype = 11; //non-targetable + eq->showname = 0; //no visible name + eq->race = 127; //invisible man + eq->gender = 0; //invisible men are gender 0 } else { diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index b6d251953..8b0c86cc5 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -2844,7 +2844,7 @@ namespace UF PacketSize += strlen(emu->DestructibleString) + 1; } - bool ShowName = 1; + bool ShowName = emu->show_name; if (emu->bodytype >= 66) { emu->race = 127; diff --git a/common/version.h b/common/version.h index 2391862a1..a1cfbce16 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9112 +#define CURRENT_BINARY_DATABASE_VERSION 9113 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9017 #else diff --git a/utils/scripts/eqemu_server.pl b/utils/scripts/eqemu_server.pl index ef7e56a35..42d956edd 100644 --- a/utils/scripts/eqemu_server.pl +++ b/utils/scripts/eqemu_server.pl @@ -1454,7 +1454,7 @@ sub map_files_fetch_bulk{ get_remote_file("http://github.com/Akkadius/EQEmuMaps/archive/master.zip", "maps/maps.zip", 1); unzip('maps/maps.zip', 'maps/'); my @files; - my $start_dir = "maps/EQEmuMaps-master/maps"; + my $start_dir = "maps/EQEmuMaps-master/"; find( sub { push @files, $File::Find::name unless -d; }, $start_dir @@ -2179,4 +2179,5 @@ sub generate_random_password { map $alphanumeric[rand @alphanumeric], 0..$passwordsize; return $randpassword; -} \ No newline at end of file +} + diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 5586b9848..8070c328e 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -366,6 +366,7 @@ 9110|2017_04_10_graveyard.sql|show index from graveyard WHERE key_name = 'zone_id_nonunique'|empty| 9111|2017_06_24_saylink_index.sql|SHOW INDEX FROM `saylink` WHERE `key_name` = 'phrase_index'|empty| 9112|2017_06_24_rule_values_expand.sql|SHOW COLUMNS FROM rule_values WHERE Field = 'rule_value' and Type = 'varchar(30)'|empty| +9113|2017_07_19_show_name.sql|SHOW COLUMNS FROM `npc_types` LIKE 'show_name'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2017_07_19_show_name.sql b/utils/sql/git/required/2017_07_19_show_name.sql new file mode 100644 index 000000000..e5bda11cf --- /dev/null +++ b/utils/sql/git/required/2017_07_19_show_name.sql @@ -0,0 +1,3 @@ +ALTER TABLE `npc_types` ADD COLUMN `show_name` TINYINT(2) NOT NULL DEFAULT 1; +ALTER TABLE `npc_types` ADD COLUMN `untargetable` TINYINT(2) NOT NULL DEFAULT 0; +UPDATE `npc_types` SET `show_name` = 0, `untargetable` = 1 WHERE `bodytype` >= 66; diff --git a/world/client.cpp b/world/client.cpp index 4fd157088..aaf7d4c9c 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1281,6 +1281,10 @@ void Client::Clearance(int8 response) } else { zs_addr = zs->GetIP().c_str(); + if (!zs_addr[0]) { + zs_addr = WorldConfig::get()->LocalAddress.c_str(); + } + if(strcmp(zs_addr, "127.0.0.1") == 0) { Log(Logs::Detail, Logs::World_Server, "Local zone address was %s, setting local address to: %s", zs_addr, WorldConfig::get()->LocalAddress.c_str()); diff --git a/zone/client.cpp b/zone/client.cpp index 12988450b..4866013a3 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1944,6 +1944,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.guildID = GuildID(); // ns->spawn.linkdead = IsLD() ? 1 : 0; // ns->spawn.pvp = GetPVP() ? 1 : 0; + ns->spawn.show_name = true; strcpy(ns->spawn.title, m_pp.title); diff --git a/zone/entity.cpp b/zone/entity.cpp index d5c558a7b..81852d07c 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -659,6 +659,8 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue) QueueClients(npc, app); npc->SendArmorAppearance(); npc->SetAppearance(npc->GetGuardPointAnim(),false); + if (!npc->IsTargetable()) + npc->SendTargetable(false); safe_delete(app); } else { auto ns = new NewSpawn_Struct; @@ -799,6 +801,8 @@ void EntityList::CheckSpawnQueue() NPC *pnpc = it->second; pnpc->SendArmorAppearance(); pnpc->SetAppearance(pnpc->GetGuardPointAnim(), false); + if (!pnpc->IsTargetable()) + pnpc->SendTargetable(false); } safe_delete(outapp); iterator.RemoveCurrent(); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index a3a39993c..573783fbc 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -175,7 +175,5 @@ void Mob::CalculateNewFearpoint() if (currently_fleeing) m_FearWalkTarget = glm::vec3(ranx, rany, ranz); - else //Break fear - BuffFadeByEffect(SE_Fear); } diff --git a/zone/npc.cpp b/zone/npc.cpp index 8ddd9b2e3..a4e6c4214 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -375,6 +375,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if CalcBonuses(); raid_target = d->raid_target; ignore_despawn = d->ignore_despawn; + m_targetable = !d->untargetable; } NPC::~NPC() @@ -1906,6 +1907,7 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) ns->spawn.is_npc = 1; UpdateActiveLight(); ns->spawn.light = GetActiveLightType(); + ns->spawn.show_name = NPCTypedata->show_name; } void NPC::PetOnSpawn(NewSpawn_Struct* ns) diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 3be00c473..a915a73a0 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -120,4 +120,4 @@ void Client::SendPathPacket(std::vector &points) { fpr->dest = *cur; FastQueuePacket(&outapp); -} \ No newline at end of file +} diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 42b50edf3..2f0d65907 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -3640,7 +3640,7 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster) case SE_Fear: { if (zone->random.Roll(RuleI(Spells, FearBreakCheckChance))) { - float resist_check = ResistSpell(spells[buff.spellid].resisttype, buff.spellid, caster); + float resist_check = ResistSpell(spells[buff.spellid].resisttype, buff.spellid, caster,0,0,true); if (resist_check == 100) break; diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index ad423113a..d54e5d51e 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -774,7 +774,7 @@ void Mob::FixZ() { Log( Logs::Moderate, - Logs::Pathing, + Logs::FixZ, "Mob::FixZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf", this->GetCleanName(), new_z, @@ -794,7 +794,7 @@ void Mob::FixZ() { if (RuleB(Map, MobZVisualDebug)) this->SendAppearanceEffect(103, 0, 0, 0, 0); - Log(Logs::General, Logs::Debug, "%s is failing to find Z %f", this->GetCleanName(), std::abs(m_Position.z - new_z)); + Log(Logs::General, Logs::FixZ, "%s is failing to find Z %f", this->GetCleanName(), std::abs(m_Position.z - new_z)); } last_z = m_Position.z; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index d647dcbf7..c90b30ce7 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1967,7 +1967,9 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load "npc_types.handtexture, " "npc_types.legtexture, " "npc_types.feettexture, " - "npc_types.ignore_despawn " + "npc_types.ignore_despawn, " + "npc_types.show_name, " + "npc_types.untargetable " "FROM npc_types %s", where_condition.c_str() ); @@ -2143,6 +2145,8 @@ const NPCType* ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load temp_npctype_data->legtexture = atoi(row[95]); temp_npctype_data->feettexture = atoi(row[96]); temp_npctype_data->ignore_despawn = atoi(row[97]) == 1 ? true : false; + temp_npctype_data->show_name = atoi(row[98]) != 0 ? true : false; + temp_npctype_data->untargetable = atoi(row[99]) != 0 ? true : false; // If NPC with duplicate NPC id already in table, // free item we attempted to add. diff --git a/zone/zonedump.h b/zone/zonedump.h index 713bfca7e..2bd78c2d8 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -133,6 +133,8 @@ struct NPCType uint8 legtexture; uint8 feettexture; bool ignore_despawn; + bool show_name; // should default on + bool untargetable; }; namespace player_lootitem {