Updates to fix taunt button on PET UI to match live behavior.

This commit is contained in:
Noudess 2020-09-02 12:50:11 -04:00
parent 29f7bc7a9c
commit 56afa0404b
9 changed files with 29 additions and 12 deletions

View File

@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9156 #define CURRENT_BINARY_DATABASE_VERSION 9157
#ifdef BOTS #ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9027 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9027

View File

@ -410,6 +410,7 @@
9154|2020_04_11_expansions_content_filters.sql|SHOW COLUMNS from `zone` LIKE 'min_expansion'|empty| 9154|2020_04_11_expansions_content_filters.sql|SHOW COLUMNS from `zone` LIKE 'min_expansion'|empty|
9155|2020_08_15_lootdrop_level_filtering.sql|SHOW COLUMNS from `lootdrop_entries` LIKE 'trivial_min_level'|empty| 9155|2020_08_15_lootdrop_level_filtering.sql|SHOW COLUMNS from `lootdrop_entries` LIKE 'trivial_min_level'|empty|
9156|2020_08_16_virtual_zonepoints.sql|SHOW COLUMNS from `zone_points` LIKE 'is_virtual'|empty| 9156|2020_08_16_virtual_zonepoints.sql|SHOW COLUMNS from `zone_points` LIKE 'is_virtual'|empty|
9157|2020_09_02_pet_taunting.sql|SHOW COLUMNS from `character_pet_info` LIKE 'taunting'|empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1 @@
ALTER TABLE `character_pet_info` ADD COLUMN `taunting` tinyint(1) NOT NULL DEFAULT '1' COMMENT '';

View File

@ -687,6 +687,7 @@ bool Client::Save(uint8 iCommitNow) {
pet->GetPetState(m_petinfo.Buffs, m_petinfo.Items, m_petinfo.Name); pet->GetPetState(m_petinfo.Buffs, m_petinfo.Items, m_petinfo.Name);
m_petinfo.petpower = pet->GetPetPower(); m_petinfo.petpower = pet->GetPetPower();
m_petinfo.size = pet->GetSize(); m_petinfo.size = pet->GetSize();
m_petinfo.taunting = pet->CastToNPC()->IsTaunting();
} else { } else {
memset(&m_petinfo, 0, sizeof(struct PetInfo)); memset(&m_petinfo, 0, sizeof(struct PetInfo));
} }
@ -5642,6 +5643,8 @@ void Client::SuspendMinion()
CurrentPet->SetMana(m_suspendedminion.Mana); CurrentPet->SetMana(m_suspendedminion.Mana);
CurrentPet->SetTaunting(m_suspendedminion.taunting);
MessageString(Chat::Magenta, SUSPEND_MINION_UNSUSPEND, CurrentPet->GetCleanName()); MessageString(Chat::Magenta, SUSPEND_MINION_UNSUSPEND, CurrentPet->GetCleanName());
memset(&m_suspendedminion, 0, sizeof(struct PetInfo)); memset(&m_suspendedminion, 0, sizeof(struct PetInfo));
@ -5653,7 +5656,8 @@ void Client::SuspendMinion()
SetPetCommandState(PET_BUTTON_REGROUP, 0); SetPetCommandState(PET_BUTTON_REGROUP, 0);
SetPetCommandState(PET_BUTTON_FOLLOW, 1); SetPetCommandState(PET_BUTTON_FOLLOW, 1);
SetPetCommandState(PET_BUTTON_GUARD, 0); SetPetCommandState(PET_BUTTON_GUARD, 0);
SetPetCommandState(PET_BUTTON_TAUNT, 1); // Taunt saved on client side for logging on with pet
// In our db for when we zone.
SetPetCommandState(PET_BUTTON_HOLD, 0); SetPetCommandState(PET_BUTTON_HOLD, 0);
SetPetCommandState(PET_BUTTON_GHOLD, 0); SetPetCommandState(PET_BUTTON_GHOLD, 0);
SetPetCommandState(PET_BUTTON_FOCUS, 0); SetPetCommandState(PET_BUTTON_FOCUS, 0);

View File

@ -904,7 +904,8 @@ void Client::CompleteConnect()
SetPetCommandState(PET_BUTTON_REGROUP, 0); SetPetCommandState(PET_BUTTON_REGROUP, 0);
SetPetCommandState(PET_BUTTON_FOLLOW, 1); SetPetCommandState(PET_BUTTON_FOLLOW, 1);
SetPetCommandState(PET_BUTTON_GUARD, 0); SetPetCommandState(PET_BUTTON_GUARD, 0);
SetPetCommandState(PET_BUTTON_TAUNT, 1); // Taunt saved on client side for logging on with pet
// In our db for when we zone.
SetPetCommandState(PET_BUTTON_HOLD, 0); SetPetCommandState(PET_BUTTON_HOLD, 0);
SetPetCommandState(PET_BUTTON_GHOLD, 0); SetPetCommandState(PET_BUTTON_GHOLD, 0);
SetPetCommandState(PET_BUTTON_FOCUS, 0); SetPetCommandState(PET_BUTTON_FOCUS, 0);
@ -1631,6 +1632,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
pet->CalcBonuses(); pet->CalcBonuses();
pet->SetHP(m_petinfo.HP); pet->SetHP(m_petinfo.HP);
pet->SetMana(m_petinfo.Mana); pet->SetMana(m_petinfo.Mana);
// 1st login, client takes care of this from button status
if (!firstlogon) {
pet->SetTaunting(m_petinfo.taunting);
}
} }
m_petinfo.SpellID = 0; m_petinfo.SpellID = 0;
} }

View File

@ -433,7 +433,7 @@ Pet::Pet(NPCType *type_data, Mob *owner, PetType type, uint16 spell_id, int16 po
petpower = power; petpower = power;
SetOwnerID(owner->GetID()); SetOwnerID(owner->GetID());
SetPetSpellID(spell_id); SetPetSpellID(spell_id);
taunting = true; taunting = false;
// Class should use npc constructor to set light properties // Class should use npc constructor to set light properties
} }

View File

@ -1245,7 +1245,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
MakePet(spell_id, spell.teleport_zone); MakePet(spell_id, spell.teleport_zone);
// TODO: we need to sync the states for these clients ... // TODO: we need to sync the states for these clients ...
// Will fix buttons for now // Will fix buttons for now
if (IsClient()) { Mob *pet=GetPet();
if (IsClient() && pet) {
auto c = CastToClient(); auto c = CastToClient();
if (c->ClientVersionBit() & EQ::versions::maskUFAndLater) { if (c->ClientVersionBit() & EQ::versions::maskUFAndLater) {
c->SetPetCommandState(PET_BUTTON_SIT, 0); c->SetPetCommandState(PET_BUTTON_SIT, 0);
@ -1253,7 +1254,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
c->SetPetCommandState(PET_BUTTON_REGROUP, 0); c->SetPetCommandState(PET_BUTTON_REGROUP, 0);
c->SetPetCommandState(PET_BUTTON_FOLLOW, 1); c->SetPetCommandState(PET_BUTTON_FOLLOW, 1);
c->SetPetCommandState(PET_BUTTON_GUARD, 0); c->SetPetCommandState(PET_BUTTON_GUARD, 0);
c->SetPetCommandState(PET_BUTTON_TAUNT, 1); // Creating pet from spell - taunt always false
// If suspended pet - that will be restore there
// If logging in, client will send toggle
c->SetPetCommandState(PET_BUTTON_HOLD, 0); c->SetPetCommandState(PET_BUTTON_HOLD, 0);
c->SetPetCommandState(PET_BUTTON_GHOLD, 0); c->SetPetCommandState(PET_BUTTON_GHOLD, 0);
c->SetPetCommandState(PET_BUTTON_FOCUS, 0); c->SetPetCommandState(PET_BUTTON_FOCUS, 0);

View File

@ -3788,13 +3788,14 @@ void ZoneDatabase::SavePetInfo(Client *client)
continue; continue;
query = StringFormat("INSERT INTO `character_pet_info` " query = StringFormat("INSERT INTO `character_pet_info` "
"(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`) " "(`char_id`, `pet`, `petname`, `petpower`, `spell_id`, `hp`, `mana`, `size`, `taunting`) "
"VALUES (%u, %u, '%s', %i, %u, %u, %u, %f) " "VALUES (%u, %u, '%s', %i, %u, %u, %u, %f, %u) "
"ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, " "ON DUPLICATE KEY UPDATE `petname` = '%s', `petpower` = %i, `spell_id` = %u, "
"`hp` = %u, `mana` = %u, `size` = %f", "`hp` = %u, `mana` = %u, `size` = %f, `taunting` = %u",
client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID, client->CharacterID(), pet, petinfo->Name, petinfo->petpower, petinfo->SpellID,
petinfo->HP, petinfo->Mana, petinfo->size, // and now the ON DUPLICATE ENTRIES petinfo->HP, petinfo->Mana, petinfo->size, (petinfo->taunting) ? 1 : 0,
petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size); // and now the ON DUPLICATE ENTRIES
petinfo->Name, petinfo->petpower, petinfo->SpellID, petinfo->HP, petinfo->Mana, petinfo->size, (petinfo->taunting) ? 1 : 0);
results = database.QueryDatabase(query); results = database.QueryDatabase(query);
if (!results.Success()) if (!results.Success())
return; return;
@ -3866,7 +3867,7 @@ void ZoneDatabase::LoadPetInfo(Client *client)
memset(suspended, 0, sizeof(PetInfo)); memset(suspended, 0, sizeof(PetInfo));
std::string query = StringFormat("SELECT `pet`, `petname`, `petpower`, `spell_id`, " std::string query = StringFormat("SELECT `pet`, `petname`, `petpower`, `spell_id`, "
"`hp`, `mana`, `size` FROM `character_pet_info` " "`hp`, `mana`, `size` , `taunting` FROM `character_pet_info` "
"WHERE `char_id` = %u", "WHERE `char_id` = %u",
client->CharacterID()); client->CharacterID());
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
@ -3891,6 +3892,7 @@ void ZoneDatabase::LoadPetInfo(Client *client)
pi->HP = atoul(row[4]); pi->HP = atoul(row[4]);
pi->Mana = atoul(row[5]); pi->Mana = atoul(row[5]);
pi->size = atof(row[6]); pi->size = atof(row[6]);
pi->taunting = (bool) atoi(row[7]);
} }
query = StringFormat("SELECT `pet`, `slot`, `spell_id`, `caster_level`, `castername`, " query = StringFormat("SELECT `pet`, `slot`, `spell_id`, `caster_level`, `castername`, "

View File

@ -155,6 +155,7 @@ struct PetInfo {
SpellBuff_Struct Buffs[PET_BUFF_COUNT]; SpellBuff_Struct Buffs[PET_BUFF_COUNT];
uint32 Items[EQ::invslot::EQUIPMENT_COUNT]; uint32 Items[EQ::invslot::EQUIPMENT_COUNT];
char Name[64]; char Name[64];
bool taunting;
}; };
struct ZoneSpellsBlocked { struct ZoneSpellsBlocked {