Core: pet food type from the client, .appear lands at the target's height

A hunter pet refused food the client says it eats: an item's food type
came only from item_template_addon, which lacks many of the client's
pet foods. The type is now the client's Item.ItemPetFoodID, and the
addon table fills in only an item the client gives none. A food type
outside the family's 32-bit diet mask is no food.

.appear took the close point's height from the ground the map knows at
that spot; on a bridge, an upper floor or in a cave the GM landed far
above or below the target. A close point more than 2 yards off the
target's height now takes the target's height.

Both ideas from the Everlake core and Trixx34's fork, written as our
own code; the Everlake credit is in NOTICE.md.
This commit is contained in:
Karrz1
2026-11-15 09:04:17 +00:00
parent 1bf6fd87bc
commit 6f57ea913c
4 changed files with 14 additions and 4 deletions
+2
View File
@@ -52,3 +52,5 @@ redistributing. Source files of the module do not carry per-file headers; this n
([buildthehomelab/wow-everlake-world-data](https://github.com/buildthehomelab/wow-everlake-world-data), GPL-3.0), which in turn
credits EG Link (CC BY 4.0), Polestar forever-db, QuestieDB, ForeverDB.net (GPL-3.0), NorgannonDB by zmarotrix (GPL-3.0) and Icy Veins'
WoW Forever database (db.icy-veins.com/wow-forever). Changed: compared with our world and only rows we lacked were written as ours.
- Ideas from the Everlake core (https://github.com/buildthehomelab/wow-trinitycore-everlake, GPL-2.0, a fork of this core), written
as our own code: the hunter pet's food type taken from the client's Item table (`ObjectMgr::LoadItemTemplates`).
+2 -2
View File
@@ -1598,7 +1598,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
bool Pet::HaveInDiet(ItemTemplate const* item) const
{
if (!item->FoodType)
if (!item->FoodType || item->FoodType > 32) // one bit of CreatureFamily.PetFoodMask per type
return false;
CreatureTemplate const* cInfo = GetCreatureTemplate();
@@ -1610,7 +1610,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
return false;
uint32 diet = cFamily->PetFoodMask;
uint32 FoodMask = 1 << (item->FoodType-1);
uint32 FoodMask = 1u << (item->FoodType - 1);
return (diet & FoodMask) != 0;
}
+5 -2
View File
@@ -3663,7 +3663,9 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.MaxDurability = FillMaxDurability(db2Data->ClassID, db2Data->SubclassID, sparse->InventoryType, sparse->OverallQualityID, sparse->ItemLevel);
itemTemplate.ScriptId = 0;
itemTemplate.FoodType = 0;
// The pet food type is the client's own (Item.ItemPetFoodID, a row of ItemPetFood: 1 meat .. 8 raw fish); item_template_addon
// only fills in an item the client gives none (idea from the Everlake core, GPL).
itemTemplate.FoodType = db2Data->ItemPetFoodID > 0 ? uint32(db2Data->ItemPetFoodID) : 0;
itemTemplate.MinMoneyLoot = 0;
itemTemplate.MaxMoneyLoot = 0;
itemTemplate.FlagsCu = 0;
@@ -3772,7 +3774,8 @@ void ObjectMgr::LoadItemTemplateAddon()
std::swap(minMoneyLoot, maxMoneyLoot);
}
itemTemplate->FlagsCu = fields[1].GetUInt32();
itemTemplate->FoodType = fields[2].GetUInt8();
if (!itemTemplate->BasicData || itemTemplate->BasicData->ItemPetFoodID <= 0) // the client's type wins (LoadItemTemplates)
itemTemplate->FoodType = fields[2].GetUInt8();
itemTemplate->MinMoneyLoot = minMoneyLoot;
itemTemplate->MaxMoneyLoot = maxMoneyLoot;
itemTemplate->SpellPPMRate = fields[5].GetFloat();
+5
View File
@@ -465,6 +465,11 @@ public:
// to point to see at target with same orientation
float x, y, z;
target->GetClosePoint(x, y, z, _player->GetCombatReach(), 1.0f);
// The close point takes its height from the ground the map knows at that spot. Where the target stands on a floor that
// query misses (a bridge, an upper storey, a cave under terrain) it lands far above or below him and the GM falls or is
// stuck inside the ground; the target's own height is where a person can stand there.
if (std::fabs(z - target->GetPositionZ()) > 2.0f)
z = target->GetPositionZ();
_player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAbsoluteAngle(target), TELE_TO_GM_MODE, target->GetInstanceId());
PhasingHandler::InheritPhaseShift(_player, target);