Skip to content

Commit

Permalink
Add @petrelease trigger (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean authored Oct 14, 2024
1 parent 621c62d commit 8d57444
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3911,3 +3911,6 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
CURFOLLOWER.DELUID: The same as .DEL/DELETE, just removed the pet via its UID.
CURFOLLOWER.DELINDEX: Removes the pet via its id in the (cur)follower list for that owner.
- Added: spells with SPELLFLAG_SUMMON now accept LOCAL.FollowerSlotsOverride in the triggers @Success and @SpellSuccess. Default value (do not override): -1.

13-10-2024, Jhobean
- Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released.
1 change: 1 addition & 0 deletions src/game/CObjBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ enum CTRIG_TYPE : short
CTRIG_PayGold, // I'm going to give out money for a service (Skill Training, hiring...).
CTRIG_PersonalSpace, // i just got stepped on by other char.
CTRIG_PetDesert, // I'm deserting from my owner ( starving, being hit by him ...).
CTRIG_PetRelease, // I have been released by my owner.
CTRIG_Profile, // someone hit the profile button for me.
CTRIG_ReceiveItem, // I was just handed an item (Not yet checked if i want it).
CTRIG_RegenStat, // Hits/mana/stam/food regeneration.
Expand Down
1 change: 1 addition & 0 deletions src/game/chars/CChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ lpctstr const CChar::sm_szTrigName[CTRIG_QTY+1] = // static
"@PayGold", // I'm going to give out money for a service (Skill Training, hiring...).
"@PersonalSpace", // +i just got stepped on by other char.
"@PetDesert", // I just went wild again
"@PetRelease", // I just been released by my master
"@Profile", // someone hit the profile button for me.
"@ReceiveItem", // I was just handed an item (Not yet checked if i want it)
"@RegenStat", // Regenerating any stat
Expand Down
10 changes: 10 additions & 0 deletions src/game/chars/CCharNPCPet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,16 @@ void CChar::NPC_PetRelease()
if (!m_pNPC)
return;

CChar* pCharOwn = NPC_PetGetOwner();
if (!pCharOwn)
return;

if (IsTrigUsed(TRIGGER_PETRELEASE))
{
if (OnTrigger(CTRIG_PetRelease, pCharOwn, nullptr) == TRIGRET_RET_TRUE)
return;
}

if (IsStatFlag(STATF_CONJURED) || (m_pNPC->m_bonded && IsStatFlag(STATF_DEAD)))
{
Effect(EFFECT_XYZ, ITEMID_FX_TELE_VANISH, this, 10, 15);
Expand Down
1 change: 1 addition & 0 deletions src/tables/triggers.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ ADD(PARTYREMOVE)
ADD(PAYGOLD)
ADD(PERSONALSPACE)
ADD(PETDESERT)
ADD(PETRELEASE)
ADD(PICKUP_GROUND)
ADD(PICKUP_PACK)
ADD(PICKUP_SELF)
Expand Down

0 comments on commit 8d57444

Please sign in to comment.