Skip to content

Commit

Permalink
Add OpenDoorMacro and Search Distance as Local Variables in Trigger
Browse files Browse the repository at this point in the history
	LOCAL.DoorAutoDist <distance> (R/W)
	Default Distance = 2
	eg;
	@UserExtCmd
	Serv.Log <DLOCAL.DoorAutoDist>
	Local.DoorAutoDist=10
	Serv.Log <DLOCAL.DoorAutoDist>
  • Loading branch information
canerksk committed Dec 24, 2024
1 parent 6a036d5 commit a441eb8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3985,3 +3985,14 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
TALKMODE_SPELL = 10 // Used by spells
TALKMODE_GUILD = 13 // Used by guild chat (client shortcut: \)
TALKMODE_ALLIANCE = 14 // Used by alliance chat (client shortcut: shift+\)

24-12-2024,canerksk
- Added: Add OpenDoorMacro and World Search Distance as Local Variables to @UserExtCmd Trigger
LOCAL.DoorAutoDist <distance> (R/W)
Default Distance = 2
eg;
@UserExtCmd
Serv.Log <DLOCAL.DoorAutoDist>
Local.DoorAutoDist=10
Serv.Log <DLOCAL.DoorAutoDist>

14 changes: 12 additions & 2 deletions src/game/clients/CClientEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2975,14 +2975,19 @@ void CClient::Event_ExtCmd( EXTCMD_TYPE type, tchar *pszName )
g_Log.EventWarn("%0x:Event_ExtCmd received too long argument\n", GetSocketID());
return;
}

byte bDoorAutoDist = 2;
if ( IsTrigUsed(TRIGGER_USEREXTCMD) )
{
CScriptTriggerArgs Args(pszName);
Args.m_iN1 = type;
if (type == EXTCMD_DOOR_AUTO)
Args.m_VarsLocal.SetNumNew("DoorAutoDist", bDoorAutoDist);

if ( m_pChar->OnTrigger(CTRIG_UserExtCmd, m_pChar, &Args) == TRIGRET_RET_TRUE )
return;
Str_CopyLimitNull(pszName, Args.m_s1, MAX_TALK_BUFFER);
if (type == EXTCMD_DOOR_AUTO)
bDoorAutoDist = (byte)(Args.m_VarsLocal.GetKeyNum("DoorAutoDist"));
}

tchar *ppArgs[2];
Expand Down Expand Up @@ -3075,8 +3080,13 @@ void CClient::Event_ExtCmd( EXTCMD_TYPE type, tchar *pszName )
CPointMap pt = m_pChar->GetTopPoint();
char iCharZ = pt.m_z;

if (bDoorAutoDist > UO_MAP_VIEW_SIGHT)
bDoorAutoDist = UO_MAP_VIEW_SIGHT;
else if (bDoorAutoDist <= 0)
bDoorAutoDist = 1;

pt.Move(m_pChar->m_dirFace);
auto Area = CWorldSearchHolder::GetInstance(pt, 1);
auto Area = CWorldSearchHolder::GetInstance(pt, bDoorAutoDist);
for (;;)
{
CItem *pItem = Area->GetItem();
Expand Down

0 comments on commit a441eb8

Please sign in to comment.