Skip to content

Commit

Permalink
Couple of Fixes and Feature Updates
Browse files Browse the repository at this point in the history
02-10-2023, xwerswoodx
- Fixed: Re-Coded @KarmaChange and @FameChange triggers not setting variables correctly. (Issue #1118)
	ARGN1 now return as the amount of Karma/Fame being added.
	LOCAL.OLD and LOCAL.NEW removed, while ARGN1 is writeable, it's impossible to track that values in the trigger.
	ARGO now return the source of karma/fame income if exists.
- Added: @KarmaChanged and @FameChanged triggers to track Karma/Fame changes after @KarmaChange/@FameChange triggered.
	ARGN1 returns the amount of Karma/Fame being added.
	LOCAL.OLD returns the karma value before added anything.
	LOCAL.NEW returns the current player karma.
	This trigger has no RETURN value to block hardcoded events while it triggers after everything finished.
- Fixed: f_onchar_create_init is not called. (Issue: #1117)
- Fixed: IF and QVAL statements cannot evaluate correctly 32bit+ bitwise conditions. (Issue: #1078)
- Added: @PartyAdd trigger. (Feature Request: #1054)
	I: The player who is joining to the party.
	SRC: The player who is inviting.
	Return 1: Cancels the action.
- Added: LOCAL.SOUND and LOCAL.ANIM under @start (Skill) and @SkillStart triggers to override sound and animations before start crafting or gathering.
  • Loading branch information
xwerswoodx committed Oct 4, 2023
1 parent 05f3103 commit ebd9be4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3362,9 +3362,10 @@ Additionally, the problem of zig-zag issue following in the South direction has
LOCAL.OLD returns the karma value before added anything.
LOCAL.NEW returns the current player karma.
This trigger has no RETURN value to block hardcoded events while it triggers after everything finished.
- Fixed: f_onchar_create_init is not called. (Issue: #1116)
- Fixed: f_onchar_create_init is not called. (Issue: #1117)
- Fixed: IF and QVAL statements cannot evaluate correctly 32bit+ bitwise conditions. (Issue: #1078)
- Added: @PartyAdd trigger. (Feature Request: #1054)
I: The player who is joining to the party.
SRC: The player who is inviting.
Return 1: Cancels the action.
- Added: LOCAL.SOUND and LOCAL.ANIM under @Start (Skill) trigger to override sound and animations before start crafting or gathering.
22 changes: 19 additions & 3 deletions src/game/chars/CCharSkill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4235,8 +4235,21 @@ bool CChar::Skill_Start( SKILL_TYPE skill, int iDifficultyIncrease )
// (like ACTARG1/2 for magery, they are respectively m_atMagery.m_iSpell and m_atMagery.m_iSummonID and are set in
// CClient::OnTarg_Skill_Magery, which then calls Skill_Start).
// Skill_Cleanup();
SOUND_TYPE sound = SOUND_NONE;
ANIM_TYPE anim = ANIM_WALK_UNARM;
if (!g_Cfg.IsSkillFlag(skill, SKF_NOSFX))
{
sound = Skill_GetSound(skill);
}
if (!g_Cfg.IsSkillFlag(skill, SKF_NOANIM))
{
anim = Skill_GetAnim(skill);
}

CScriptTriggerArgs pArgs;
pArgs.m_iN1 = skill;
pArgs.m_VarsLocal.SetNumNew("Sound", sound);
pArgs.m_VarsLocal.SetNumNew("Anim", anim);

// Some skill can start right away. Need no targetting.
// 0-100 scale of Difficulty
Expand Down Expand Up @@ -4306,7 +4319,6 @@ bool CChar::Skill_Start( SKILL_TYPE skill, int iDifficultyIncrease )
pArgs.m_VarsLocal.SetNum("GatherStrokeCnt", m_atResource.m_dwStrokeCount);
}


if ( IsTrigUsed(TRIGGER_SKILLSTART) )
{
//If we are using a combat skill and m_Act_Difficult(actdiff) is < 0 combat will be blocked.
Expand All @@ -4315,6 +4327,8 @@ bool CChar::Skill_Start( SKILL_TYPE skill, int iDifficultyIncrease )
Skill_Cleanup();
return false;
}
sound = (SOUND_TYPE)(pArgs.m_VarsLocal.GetKeyNum("Sound"));
anim = static_cast<ANIM_TYPE>(pArgs.m_VarsLocal.GetKeyNum("Anim"));
}

if ( IsTrigUsed(TRIGGER_START) )
Expand All @@ -4325,6 +4339,8 @@ bool CChar::Skill_Start( SKILL_TYPE skill, int iDifficultyIncrease )
Skill_Cleanup();
return false;
}
sound = (SOUND_TYPE)(pArgs.m_VarsLocal.GetKeyNum("Sound"));
anim = static_cast<ANIM_TYPE>(pArgs.m_VarsLocal.GetKeyNum("Anim"));
}
iWaitTime = (int)pArgs.m_iN2;
if (IsSkillBase(skill) && iWaitTime > 0)
Expand Down Expand Up @@ -4353,10 +4369,10 @@ bool CChar::Skill_Start( SKILL_TYPE skill, int iDifficultyIncrease )
skActive = Skill_GetActive();

if ( !g_Cfg.IsSkillFlag(skActive, SKF_NOSFX) )
Sound(Skill_GetSound(skActive));
Sound(sound);

if ( !g_Cfg.IsSkillFlag(skActive, SKF_NOANIM) )
UpdateAnimate(Skill_GetAnim(skActive));
UpdateAnimate(anim);
}


Expand Down

0 comments on commit ebd9be4

Please sign in to comment.