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

OpenDoor Macro Distance #1360

Closed
wants to merge 10 commits into from
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>

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ If you're new to the Sphere server and want to setup your first shard, [this is
| :--- | :--- |
| [![GitHub last commit on Master branch](https://img.shields.io/github/last-commit/Sphereserver/Source-X/master.svg)](https://github.com/Sphereserver/Source-X/) &nbsp; <a href="https://github.com/Sphereserver/Source-X/blob/master/Changelog.txt">Changelog</a> | [![GitHub last commit on Dev branch](https://img.shields.io/github/last-commit/Sphereserver/Source-X/dev.svg)](https://github.com/Sphereserver/Source-X/tree/dev) &nbsp; <a href="https://github.com/Sphereserver/Source-X/blob/dev/Changelog.txt">Changelog</a> |
| **Nightly builds:** | **Nightly builds:** |
| [![Build status: Windows x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml) [![Build status: Windows x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml) | [![Build status: Windows x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml) [![Build status: Windows x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml)|
| [![Build status: Linux x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml) [![Build status: Linux x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml) | [![Build status: Linux x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml) [![Build status: Linux x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml) |
| [![Build status: MacOS x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml) [![Build status: MacOS ARM](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml) | [![Build status: MacOS x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml) [![Build status: MacOS ARM](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml) |
| [![Build status: Windows x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml?query=branch%3Amaster) [![Build status: Windows x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml?query=branch%3Amaster) | [![Build status: Windows x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86_64.yml?query=branch%3Adev) [![Build status: Windows x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_win_x86.yml?query=branch%3Adev)|
| [![Build status: Linux x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml) [![Build status: Linux x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml?query=branch%3Amaster) | [![Build status: Linux x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86_64.yml?query=branch%3Adev) [![Build status: Linux x86](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_linux_x86.yml?query=branch%3Adev) |
| [![Build status: MacOS x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml?query=branch%3Amaster) [![Build status: MacOS ARM](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml/badge.svg?branch=master)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml?query=branch%3Amaster) | [![Build status: MacOS x86_64](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_x86_64.yml?query=branch%3Adev) [![Build status: MacOS ARM](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml/badge.svg?branch=dev)](https://github.com/Sphereserver/Source-X/actions/workflows/build_osx_arm.yml?query=branch%3Adev) |

**Click the badges or follow the links:**

Expand Down
8 changes: 4 additions & 4 deletions src/game/CWorldTicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ void CWorldTicker::AddCharTicking(CChar* pChar, bool fNeedsLock)
iTickOld = pChar->_iTimePeriodicTick;
}

if (iTickNext == iTickOld)
{
//if (iTickNext == iTickOld)
//{
/*
#ifdef _DEBUG
auto it = std::find_if(_mCharTickList.begin(), _mCharTickList.end(),
Expand All @@ -237,8 +237,8 @@ void CWorldTicker::AddCharTicking(CChar* pChar, bool fNeedsLock)
DEBUG_ASSERT(it == _mCharTickList.end());
#endif
*/
return;
}
// return;
//}

//if (iTickNext < CWorldGameTime::GetCurrentTime().GetTimeRaw()) // We do that to get them tick as sooner as possible
// return;
Expand Down
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
2 changes: 1 addition & 1 deletion src/sphere.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ WOPStaff=0
// TALKMODE_GUILD = 13 // Used by guild chat (client shortcut: \)
// TALKMODE_ALLIANCE = 14 // Used by alliance chat (client shortcut: shift+\)
// Words of power talk mode (Default: 10 = TALKMODE_SPELL)
WOPTalkMode=1
WOPTalkMode=10

// Mana lost when casting spell action fails or abort
ManaLossAbort=0 // Lose Mana when the spell is aborted during spell casting.
Expand Down