Skip to content

Commit

Permalink
add MeditationMovementAbort to make meditation fail on movement
Browse files Browse the repository at this point in the history
  • Loading branch information
raydienull committed Nov 19, 2023
1 parent 648bea7 commit 1cc65b9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/game/CServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ CServerConfig::CServerConfig()
_uiExperimentalFlags= 0;
_uiOptionFlags = (OF_Command_Sysmsgs|OF_NoHouseMuteSpeech);
_uiAreaFlags = AREAF_RoomInheritsFlags;
_bMeditationMovementAbort = false;

m_iMaxSkill = SKILL_QTY;
m_iWalkBuffer = 15;
Expand Down Expand Up @@ -591,6 +592,7 @@ enum RC_TYPE
RC_MAXSIZECLIENTOUT, // _uiMaxSizeClientOut
RC_MAXSIZEPERTICK, // _uiNetMaxLengthPerTick
RC_MD5PASSWORDS, // m_fMd5Passwords
RC_MEDITATIONMOVEMENTABORT, // _bMeditationMovementAbort
RC_MEDIUMCANHEARGHOSTS, // m_iMediumCanHearGhosts
RC_MINCHARDELETETIME,
RC_MINKARMA, // m_iMinKarma
Expand Down Expand Up @@ -699,6 +701,7 @@ enum RC_TYPE
RC_QTY
};

// NOTE: Need to be alphabetized order
const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY+1]
{
{ "ACCTFILES", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sAcctBaseDir) }},
Expand Down Expand Up @@ -860,6 +863,7 @@ const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY+1]
{ "MAXSIZECLIENTOUT", { ELEM_INT64, static_cast<uint>OFFSETOF(CServerConfig,_iMaxSizeClientOut) }},
{ "MAXSIZEPERTICK", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,_uiNetMaxLengthPerTick) }},
{ "MD5PASSWORDS", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fMd5Passwords) }},
{ "MEDITATIONMOVEMENTABORT",{ ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,_bMeditationMovementAbort) }},
{ "MEDIUMCANHEARGHOSTS", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iMediumCanHearGhosts) }},
{ "MINCHARDELETETIME", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iMinCharDeleteTime) }},
{ "MINKARMA", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iMinKarma) }},
Expand Down Expand Up @@ -1419,8 +1423,9 @@ bool CServerConfig::r_LoadVal( CScript &s )
case RC_WALKBUFFER:
m_iWalkBuffer = s.GetArgVal() * MSECS_PER_TENTH;
break;


case RC_MEDITATIONMOVEMENTABORT:
_bMeditationMovementAbort = s.GetArgVal() > 0 ? true : false;
break;
default:
return( sm_szLoadKeys[i].m_elem.SetValStr( this, s.GetArgRaw()));
}
Expand Down
3 changes: 2 additions & 1 deletion src/game/CServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ extern class CServerConfig : public CResourceHolder
bool m_iPacketDeathAnimation; // packet 02c
bool m_fDisplayPercentAr; // Display the ARMOR value in the tooltip as the %
bool m_fDisplayElementalResistance; //Display the Elemental and MAxElemental Resistances on the paperdoll and tooltips (RESFIRE/RESCOLD/RESENERGY/RESPOISON) even if combat flag Elemental Engine is disabled.

bool _bMeditationMovementAbort; // Meditation fails if the player moves.

// Flags for controlling pvp/pvm behaviour of players
uint m_iCombatFlags; // combat flags
uint m_iMagicFlags; // magic flags
Expand Down
8 changes: 8 additions & 0 deletions src/game/chars/CCharAct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,14 @@ void CChar::UpdateMove( const CPointMap & ptOld, CClient * pExcludeClient, bool
m_fStatusUpdate &= ~SU_UPDATE_MODE;

EXC_TRY("UpdateMove");

// if skill is meditation, cancel it if we move
if (g_Cfg._bMeditationMovementAbort && Skill_GetActive() == SKILL_MEDITATION)
{
//cancel meditation if we move
Skill_Fail(true);
}

EXC_SET_BLOCK("FOR LOOP");
ClientIterator it;
for ( CClient* pClient = it.next(); pClient != nullptr; pClient = it.next() )
Expand Down
5 changes: 5 additions & 0 deletions src/sphere.ini
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ SpeedScaleFactor=15000
// PARRYERA_ARSCALING 080 // Shields AR scales with Parrying skill, not compatible with Combat Elemental Engine.
CombatParryingEra=01|010
// Meditation behaviour
// 0 = Meditation allow movement
// 1 = Meditation abort on movement
MeditationMovementAbort=0
//When enabled, display, in the tooltip, the Armor of the item as a percentage of its full armor value, the percentage is based upon the body parts the item covers.
DisplayArmorAsPercent = 0
Expand Down

0 comments on commit 1cc65b9

Please sign in to comment.