Skip to content

Commit

Permalink
Add @petrelease trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Oct 5, 2024
1 parent 7c83f5f commit 3383edf
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 @@ -3902,3 +3902,6 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
- Changed: added desired FollowerSlots as a second argument to CURFOLLOWER.ADD. Default value: its FollowerSlots.
- Changed: @FollowerUpdate ARGN1 and ARGN2 are now read-only. Having them RW and actually get them working would have meant many other changes, breaking script compatibility.
- Fixed: CURFOLLOWER.DEL/DELETE/CLEAR not working properly.

05-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 3383edf

Please sign in to comment.