Skip to content

Commit

Permalink
Added new local variable in WOPSYSTEM LOCAL.WOPTalkMode and ini setti…
Browse files Browse the repository at this point in the history
…ngs WOPTalkMode

	In some clients, different operations can be performed in return for this, for example, if this talkmode went from sphere as TALKMODE SPELL, the operation is performed according to this incoming talk mode according to the client versions. Here, the possibility of changing the talkmode according to the client version used is given. By default, TALKMODE_SPELL
	Default talk mode: TALKMODE_SPELL = 10
	Sphere.ini;
	WOPTalkMode=0/14

	Trigger;
	@spellcast
	Local.WOPTalkMode=0/14

Tested.
  • Loading branch information
canerksk committed Oct 26, 2024
1 parent f051889 commit c3692c1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3914,3 +3914,25 @@ 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: Added new local variable in WOPSYSTEM LOCAL.WOPTalkMode and ini settings WOPTalkMode=10
In some clients, different operations can be performed in return for this, for example, if this talkmode went from sphere as TALKMODE SPELL, the operation is performed according to this incoming talk mode according to the client versions. Here, the possibility of changing the talkmode according to the client version used is given. By default, TALKMODE_SPELL
Default talk mode: TALKMODE_SPELL = 10
Sphere.ini;
WOPTalkMode=0/14

Trigger;
@SpellCast
Local.WOPTalkMode=0/14

TALKMODE_SAY = 0 // A character speaking.
TALKMODE_SYSTEM = 1 // Display as system prompt
TALKMODE_EMOTE = 2 // *smiles* at object (client shortcut: :+space)
TALKMODE_ITEM = 6 // text labeling an item. Preceeded by "You see"
TALKMODE_NOSCROLL = 7 // As a status msg. Does not scroll (as reported by the packet guides)
TALKMODE_WHISPER = 8 // Only those close can here. (client shortcut: ;+space)
TALKMODE_YELL = 9 // Can be heard 2 screens away. (client shortcut: !+space)
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+\)
2 changes: 2 additions & 0 deletions src/game/CServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ enum RC_TYPE
RC_WOPFONT,
RC_WOPPLAYER,
RC_WOPSTAFF,
RC_WOPTALKMODE,
RC_WORLDSAVE,
RC_ZEROPOINT, // m_sZeroPoint
RC_QTY
Expand Down Expand Up @@ -1025,6 +1026,7 @@ const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY + 1]
{ "WOPFONT", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iWordsOfPowerFont) }},
{ "WOPPLAYER", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fWordsOfPowerPlayer) }},
{ "WOPSTAFF", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fWordsOfPowerStaff) }},
{ "WOPTALKMODE", { ELEM_INT, static_cast<uint> OFFSETOF(CServerConfig,m_iWordsOfPowerTalkMode) }},
{ "WORLDSAVE", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sWorldBaseDir) }},
{ "ZEROPOINT", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sZeroPoint) }},
{ nullptr, { ELEM_VOID, 0, }}
Expand Down
1 change: 1 addition & 0 deletions src/game/CServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ extern class CServerConfig : public CResourceHolder
int m_iWordsOfPowerFont; // Font used for Words Of Power.
bool m_fWordsOfPowerPlayer; // Words of Power for players.
bool m_fWordsOfPowerStaff; // Words of Power for staff.
TALKMODE_TYPE m_iWordsOfPowerTalkMode; // Walk mode used for Words Of Power.
bool m_fEquippedCast; // Allow casting while equipped.
bool m_fManaLossAbort; // Lose mana when spell casting aborted.
bool m_fManaLossFail; // Lose mana when spell casting failed.
Expand Down
12 changes: 10 additions & 2 deletions src/game/chars/CCharSpell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3463,6 +3463,11 @@ int CChar::Spell_CastStart()
Args.m_VarsLocal.SetNum("WOP", fWOP);
int64 WOPFont = g_Cfg.m_iWordsOfPowerFont;
int64 WOPColor;
TALKMODE_TYPE WOPTalkMode = g_Cfg.m_iWordsOfPowerTalkMode ? g_Cfg.m_iWordsOfPowerTalkMode : TALKMODE_SPELL;

if (WOPTalkMode < TALKMODE_SAY || WOPTalkMode >= TALKMODE_COMMAND)
WOPTalkMode = TALKMODE_SPELL;

if (g_Cfg.m_iWordsOfPowerColor > 0)
WOPColor = g_Cfg.m_iWordsOfPowerColor;
else if (m_SpeechHueOverride)
Expand All @@ -3471,8 +3476,10 @@ int CChar::Spell_CastStart()
WOPColor = m_pPlayer->m_SpeechHue;
else
WOPColor = HUE_TEXT_DEF;

Args.m_VarsLocal.SetNum("WOPColor", WOPColor, true);
Args.m_VarsLocal.SetNum("WOPFont", WOPFont, true);
Args.m_VarsLocal.SetNum("WOPTalkMode", WOPTalkMode, true);

if ( IsTrigUsed(TRIGGER_SPELLCAST) )
{
Expand Down Expand Up @@ -3517,11 +3524,12 @@ int CChar::Spell_CastStart()
{
WOPColor = Args.m_VarsLocal.GetKeyNum("WOPColor");
WOPFont = Args.m_VarsLocal.GetKeyNum("WOPFont");
WOPTalkMode = (TALKMODE_TYPE)Args.m_VarsLocal.GetKeyNum("WOPTalkMode");

// Correct talk mode for spells WOP is TALKMODE_SPELL, but sphere doesn't have any delay between spell casts this can allow WOP flood on screen.
if ( pSpellDef->m_sRunes[0] == '.' )
{
Speak((pSpellDef->m_sRunes.GetBuffer()) + 1, (HUE_TYPE)WOPColor, TALKMODE_SPELL, (FONT_TYPE)WOPFont);
Speak((pSpellDef->m_sRunes.GetBuffer()) + 1, (HUE_TYPE)WOPColor, (TALKMODE_TYPE)WOPTalkMode, (FONT_TYPE)WOPFont);
}
else
{
Expand All @@ -3539,7 +3547,7 @@ int CChar::Spell_CastStart()
if ( len > 0 )
{
pszTemp[len] = 0;
Speak(pszTemp, (HUE_TYPE)WOPColor, TALKMODE_SPELL, (FONT_TYPE)WOPFont);
Speak(pszTemp, (HUE_TYPE)WOPColor, (TALKMODE_TYPE)WOPTalkMode, (FONT_TYPE)WOPFont);
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/sphere.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,19 @@ WOPStaff=0
// Words of power color (0 = inherit color from char SPEECHCOLOR value)
//WOPColor=03b2

// TALKMODE_SAY = 0 // A character speaking.
// TALKMODE_SYSTEM = 1 // Display as system prompt
// TALKMODE_EMOTE = 2 // *smiles* at object (client shortcut: :+space)
// TALKMODE_ITEM = 6 // text labeling an item. Preceeded by "You see"
// TALKMODE_NOSCROLL = 7 // As a status msg. Does not scroll (as reported by the packet guides)
// TALKMODE_WHISPER = 8 // Only those close can here. (client shortcut: ;+space)
// TALKMODE_YELL = 9 // Can be heard 2 screens away. (client shortcut: !+space)
// 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+\)
// Words of power talk mode (Default: 10 = TALKMODE_SPELL)
WOPTalkMode=1

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

0 comments on commit c3692c1

Please sign in to comment.