uox3/data/js/skill/stealth.js
Xoduz 46b82842ac Fix for onSkill scripts
- [FIX] Fixed incorrect parameter order in all scripts that use onSkill JS event
2025-08-22 06:15:17 +08:00

41 lines
1.1 KiB
JavaScript

/// <reference path="../definitions.d.ts" />
// @ts-check
function SkillRegistration()
{
RegisterSkill( 47, true ); // Stealth
}
/** @type { ( skillUse: BaseObject, skillUsed: number, objType: 0 | 1 ) => boolean } */
function onSkill( pUser, skillUsed, objType )
{
var pSock = pUser.socket;
if( pSock )
{
if( pUser.isonhorse )
{
pSock.SysMessage( GetDictionaryEntry( 837, pSock.language )); // You cannot stealth while mounted.
}
else if( pUser.visible != 1 )
{
pSock.SysMessage( GetDictionaryEntry( 836, pSock.language )); // You must hide first.
}
else if( pUser.skills.hiding < 700 )
{
pSock.SysMessage( GetDictionaryEntry( 838, pSock.language )); // You are not hidden well enough. Become better at hiding.
pUser.visible = 0;
pUser.stealth = -1;
}
else if( !pUser.CheckSkill( 47, 0, pUser.skillCaps.stealth ))
{
pUser.visible = 0;
pUser.stealth = -1;
}
else
{
pSock.SysMessage( GetDictionaryEntry( 839, pSock.language )); // You begin to move quietly.
pUser.visible = 1;
pUser.stealth = 0;
}
}
return true;
}