Core/Pets: Updated pet summoning for latest client version (5 Call Pet spells and stable size 200)

Port From (https://github.com/TrinityCore/TrinityCore/commit/950db60435e7e513633ff5b22ad7f0ed8b1147e4)
This commit is contained in:
hondacrx
2022-03-10 12:02:05 -05:00
parent a77e6865b2
commit c486b2a846
14 changed files with 448 additions and 218 deletions
+6 -4
View File
@@ -34,11 +34,13 @@ namespace Framework.Constants
public enum PetSaveMode
{
NotInSlot = -1, // for avoid conflict with stable size grow will use negative value
AsDeleted = -2, // not saved in fact
AsCurrent = 0, // in current slot (with player)
FirstStableSlot = 1,
LastStableSlot = SharedConst.MaxPetStables, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT
AsCurrent = -3, // in current slot (with player)
FirstActiveSlot = 0,
LastActiveSlot = FirstActiveSlot + SharedConst.MaxActivePets,
FirstStableSlot = 5,
LastStableSlot = FirstStableSlot + SharedConst.MaxPetStables, // last in DB stable slot index
NotInSlot = -1, // for avoid conflict with stable size grow will use negative value
}
public enum PetSpellState
+13 -1
View File
@@ -219,7 +219,9 @@ namespace Framework.Constants
/// <summary>
/// Pet Const
/// </summary>
public const int MaxPetStables = 4;
public const int MaxActivePets = 5;
public const int MaxPetStables = 200;
public const uint CallPetSpellId = 883;
public const float PetFollowDist = 1.0f;
public const float PetFollowAngle = MathF.PI;
public const int MaxSpellCharm = 4;
@@ -434,6 +436,16 @@ namespace Framework.Constants
{
return raceId < Race.Max && raceBits[(int)raceId] >= 0 && raceBits[(int)raceId] < 64 ? (1 << raceBits[(int)raceId]) : 0;
}
public static bool IsActivePetSlot(PetSaveMode slot)
{
return slot >= PetSaveMode.FirstActiveSlot && slot < PetSaveMode.LastActiveSlot;
}
public static bool IsStabledPetSlot(PetSaveMode slot)
{
return slot >= PetSaveMode.FirstStableSlot && slot < PetSaveMode.LastStableSlot;
}
}
public enum Locale
@@ -721,7 +721,6 @@ namespace Framework.Database
PrepareStatement(CharStatements.UPD_CHAR_PET_NAME, "UPDATE character_pet SET name = ?, renamed = 1 WHERE owner = ? AND id = ?");
PrepareStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?");
PrepareStatement(CharStatements.DEL_CHAR_PET_BY_ID, "DELETE FROM character_pet WHERE id = ?");
PrepareStatement(CharStatements.DEL_CHAR_PET_BY_SLOT, "DELETE FROM character_pet WHERE owner = ? AND slot IN (?, ?)");
PrepareStatement(CharStatements.DEL_ALL_PET_SPELLS_BY_OWNER, "DELETE FROM pet_spell WHERE guid in (SELECT id FROM character_pet WHERE owner=?)");
PrepareStatement(CharStatements.UPD_PET_SPECS_BY_OWNER, "UPDATE character_pet SET specialization = 0 WHERE owner=?");
PrepareStatement(CharStatements.INS_PET, "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType, specialization) " +
@@ -1353,7 +1352,6 @@ namespace Framework.Database
UPD_CHAR_PET_NAME,
UPD_CHAR_PET_SLOT_BY_ID,
DEL_CHAR_PET_BY_ID,
DEL_CHAR_PET_BY_SLOT,
DEL_ALL_PET_SPELLS_BY_OWNER,
UPD_PET_SPECS_BY_OWNER,
INS_PET,