Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New @Deposit/@ItemDeposit trigger #1324

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3914,3 +3914,11 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.

13-10-2024, Jhobean
- Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released.

26-10-2024, canerksk
- Added: New @Deposit/@ItemDeposit trigger,
SRC/I = Char (Player)
ARGO = Gold
RETURN 1 = Prevents depositing gold into the bank.
It works just like DROPON_ITEM/ITEMDROPON_ITEM.
When using the virtual gold feature, there was no trigger triggered when physical gold was deposited into the bank, the Dropon_Item was not working because it was triggered lower down, and instead of moving the Dropon_Item up, a separate trigger was added to track the money on the server more easily from another location.
2 changes: 2 additions & 0 deletions src/game/CObjBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ enum ITRIG_TYPE
ITRIG_DELOBJ, // For t_spawn when obj is remove from list
ITRIG_DELREDCANDLE,
ITRIG_DELWHITECANDLE,
ITRIG_DEPOSIT, // IT_GOLD dropon bank deposit trigger
ITRIG_DESTROY, //+I am nearly destroyed.
ITRIG_DROPON_CHAR, // I have been dropped on this char.
ITRIG_DROPON_GROUND, // I have been dropped on the ground here.
Expand Down Expand Up @@ -1106,6 +1107,7 @@ enum CTRIG_TYPE : short
CTRIG_itemCreate, // Created one item.
CTRIG_itemDamage, // Damaged one item.
CTRIG_itemDCLICK, // I have dclicked item.
CTRIG_itemDeposit, // IT_GOLD dropon bank deposit trigger
CTRIG_itemDestroy, // Item is nearly destroyed.
CTRIG_itemDROPON_CHAR, // I have been dropped on this char.
CTRIG_itemDROPON_GROUND, // I dropped an item on the ground.
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 @@ -105,6 +105,7 @@ lpctstr const CChar::sm_szTrigName[CTRIG_QTY+1] = // static
"@itemCreate", //?
"@itemDamage", //?
"@itemDCLICK", // I have dclicked item
"@itemDeposit", // IT_GOLD deposited virtualgold
"@itemDestroy", //+I am nearly destroyed
"@itemDropOn_Char", // I have been dropped on this char
"@itemDropOn_Ground", // I dropped an item on the ground
Expand Down
16 changes: 16 additions & 0 deletions src/game/clients/CClientEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,22 @@ void CClient::Event_Item_Drop( CUID uidItem, CPointMap pt, CUID uidOn, uchar gri
// Convert physical gold into virtual gold when drop it on bankbox
if ( pItem->IsType(IT_GOLD) && (g_Cfg.m_iFeatureTOL & FEATURE_TOL_VIRTUALGOLD) )
{
if (IsTrigUsed(TRIGGER_DEPOSIT) || IsTrigUsed(TRIGGER_ITEMDEPOSIT))
{
CScriptTriggerArgs args(pItem);
TRIGRET_TYPE ttResult = pItem->OnTrigger(ITRIG_DEPOSIT, m_pChar, &args);
if (pItem->IsDeleted())
{
SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_BVBOX_DEPOSITED_FAIL));
return;
}
if (ttResult == TRIGRET_RET_TRUE)
{
SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_BVBOX_DEPOSITED_FAIL));
Event_Item_Drop_Fail(pItem);
return;
}
}
pChar->m_virtualGold += pItem->GetAmount();
SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_BVBOX_DEPOSITED), pItem->GetAmount());
addSound(pItem->GetDropSound(pObjOn));
Expand Down
1 change: 1 addition & 0 deletions src/game/items/CItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ lpctstr const CItem::sm_szTrigName[ITRIG_QTY+1] = // static
"@DelObj", // For t_spawn when obj is remove from list
"@DelRedCandle",
"@DelWhiteCandle",
"@Deposit", // IT_GOLD deposited virtualgold
"@Destroy", //+I am nearly destroyed
"@DropOn_Char", // I have been dropped on this char
"@DropOn_Ground", // I have been dropped on the ground here
Expand Down
1 change: 1 addition & 0 deletions src/tables/defmessages.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ MSG(AXIS_INFO_ERROR, "ERROR: Unable to retrieve Axis' database info")
MSG(AXIS_NOT_PRIV, "This account does not exist or is not privileged to access Axis' database.")
MSG(BEGGING_START, "You grovel at %s's feet")
MSG(BVBOX_DEPOSITED, "%d gold was deposited in your account.")
MSG(BVBOX_DEPOSITED_FAIL, "Gold could not be deposited into your account")
MSG(BVBOX_FULL_ITEMS, "Your bankbox can't hold more items.")
MSG(BVBOX_FULL_WEIGHT, "Your bankbox can't hold more weight.")
MSG(BVBOX_OPEN_OTHER, "%s has %d stones in %s %s")
Expand Down
2 changes: 2 additions & 0 deletions src/tables/triggers.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ADD(DELMULTI)
ADD(DELOBJ)
ADD(DELREDCANDLE)
ADD(DELWHITECANDLE)
ADD(DEPOSIT)
ADD(DESTROY)
ADD(DISMOUNT)
ADD(DRINK)
Expand Down Expand Up @@ -95,6 +96,7 @@ ADD(ITEMCONTEXTMENUSELECT)
ADD(ITEMCREATE)
ADD(ITEMDAMAGE)
ADD(ITEMDCLICK)
ADD(ITEMDEPOSIT)
ADD(ITEMDESTROY)
ADD(ITEMDROPON_CHAR)
ADD(ITEMDROPON_GROUND)
Expand Down