Permalink
Browse files

2/01/2009 - Xuri

	Updated trainingdummy.js and pickpocketdip.js with code that will auto-fix them should their timers ever break
	Pets are removed from petlist when their stabled flag is set to true, and added again when set to false
	Players will no longer have to shove through characters that are permanently hidden
  • Loading branch information...
xuridabur
xuridabur committed Feb 1, 2009
1 parent e3c3554 commit 9fd7e1275d692852b48d98920db649ba86ef766f
Showing with 103 additions and 9 deletions.
  1. +48 −3 js/item/pickpocketdip.js
  2. +34 −4 js/item/trainingdummy.js
  3. +5 −0 source/Changelog.txt
  4. +14 −0 source/cChar.cpp
  5. +2 −2 source/movement.cpp
View
@@ -8,11 +8,17 @@ function onUseChecked( pUser, iUsed )
pUser.SysMessage( GetDictionaryEntry( 482, pSock.Language )); //You need to be closer to use that.
return false;
}
- else if( iUsed.id == 0x1EC3 || iUsed.id == 0x1EC0 ) //if pickpocket dip is motionless
+ if( iUsed.id == 0x1E2C )
+ iUsed.id == 0x1EC0; //Convert useless dummy to useful dummy
+ else if( iUsed.id == 0x1E2D )
+ iUsed.id == 0x1EC3; //convert useless dummy to useful dummy
+ else if( iUsed.id == 0x1EC0 || iUsed.id == 0x1EC3 ) //if pickpocket dip is motionless
{
//Check if the pickpocket dip is already in use (to delay how often one can use it)
if( iUsed.GetTag( "inUse" ) > 0 )
{
+ //Safety measure in case timer ever breaks.
+ safetyMeasure( iUsed );
pUser.SysMessage( GetDictionaryEntry( 1762, pSock.Language )); //You must wait before you can use that item again.
return false;
}
@@ -47,15 +53,54 @@ function onUseChecked( pUser, iUsed )
}
}
else
+ {
+ //Safety measure in case timer ever breaks.
+ safetyMeasure( iUsed );
pUser.SysMessage( GetDictionaryEntry( 483, pSock.Language )); //You must wait for it to stop swinging!
+ }
return false;
}
+function safetyMeasure( iUsed )
+{
+ var failedToUse = iUsed.GetTag( "failedToUse" );
+
+ //Check if 4 or more failed attempts have been made
+ if( failedToUse > 3 )
+ stopDummy( iUsed );
+ else
+ {
+ // Else, add to failed attempts
+ failedToUse++;
+ iUsed.SetTag( "failedToUse", failedToUse );
+ }
+}
+
function onTimer( iUsed, timerID )
{
//If timer is 1, stop the swinging pickpocket dip
if( timerID == 1 )
- iUsed.id--;
+ {
+ // Let's call the stopDummy function!
+ stopDummy( iUsed );
+ }
if( timerID == 2 )
- iUsed.SetTag( "inUse", null );
+ {
+ //player stole from dummy successfully, so it didn't move. Reset it.
+ iUsed.SetTag( "inUse", null );
+ iUsed.SetTag( "failedToUse", 0 );
+ }
+}
+
+function stopDummy( iUsed )
+{
+ if( iUsed )
+ {
+ if( iUsed.id == 0x1ec1 || iUsed.id == 0x1ec2 )
+ iUsed.id = 0x1ec0; //stop dummy from moving
+ else if( iUsed.id == 0x1ec4 || iUsed.id == 0x1ec5 )
+ iUsed.id = 0x1ec3; //stop dummy from moving
+ iUsed.SetTag( "failedToUse", 0 ); //reset values on dummy
+ iUsed.SetTag( "inUse", null ); //reset values on dummy
+ }
}
View
@@ -60,18 +60,48 @@ function onUseChecked( pUser, iUsed )
iUsed.StartTimer( 3000, 1, false );
}
else
+ {
+ //Safety measure in case timer ever breaks and dummy never stops swinging
+ safetyMeasure( iUsed );
+
pUser.SysMessage( GetDictionaryEntry( 483, pSock.Language )); //You must wait for it to stop swinging!
+ }
return false;
}
+function safetyMeasure( iUsed )
+{
+ var failedToUse = iUsed.GetTag( "failedToUse" );
+
+ //Check if 4 or more failed attempts have been made
+ if( failedToUse > 3 )
+ stopDummy( iUsed );
+ else
+ {
+ // Else, add to failed attempts
+ failedToUse++;
+ iUsed.SetTag( "failedToUse", failedToUse );
+ }
+
+}
+
function onTimer( iUsed, timerID )
{
//If timer is 1, stop the swinging dummy
if( timerID == 1 )
{
- if( iUsed.id == 0x1071 )
- iUsed.id--;
- else if( iUsed.id == 0x1075 )
- iUsed.id--;
+ stopDummy( iUsed );
}
}
+
+function stopDummy( iUsed )
+{
+ if( iUsed )
+ {
+ if( iUsed.id == 0x1071 || iUsed.id == 0x1072 || iUsed.id == 0x1073 )
+ iUsed.id = 0x1070;
+ else if( iUsed.id == 0x1075 || iUsed.id == 0x1076 || iUsed.id == 0x1077 )
+ iUsed.id = 0x1074;
+ iUsed.SetTag( "failedToUse", 0 ); //reset values on dummy
+ }
+}
View
@@ -1,3 +1,8 @@
+2/01/2009 - Xuri
+ Updated trainingdummy.js and pickpocketdip.js with code that will auto-fix them should their timers ever break
+ Pets are removed from petlist when their stabled flag is set to true, and added again when set to false
+ Players will no longer have to shove through characters that are permanently hidden
+
1/19/2009 - Xuri
Automatic worldsaves can now be disabled by setting SAVESTIMER in UOX.INI to 0
Added blank scrolls and empty books to ScribeShopping SHOPLIST
View
@@ -3873,7 +3873,21 @@ bool CChar::GetStabled( void ) const
void CChar::SetStabled( bool newValue )
{
if( IsValidNPC() )
+ {
mNPC->boolFlags.set( BIT_STABLED, newValue );
+ CChar *oldOwner = GetOwnerObj();
+ if( ValidateObject( oldOwner ))
+ {
+ if( newValue == true )
+ {
+ oldOwner->GetPetList()->Remove( this );
+ }
+ else if( newValue == false )
+ {
+ oldOwner->GetPetList()->Add( this );
+ }
+ }
+ }
}
//o---------------------------------------------------------------------------o
View
@@ -832,8 +832,8 @@ void cMovement::OutputShoveMessage( CChar *c, CSocket *mSock )
continue;
if( ourChar->GetX() == x && ourChar->GetY() == y && ourChar->GetZ() == z )
{
- if( !IsGMBody( ourChar ) && ( ourChar->IsNpc() || isOnline( (*ourChar) ) ) &&
- ourChar->GetCommandLevel() < CL_CNS )
+ if(( ourChar->GetVisible() != VT_PERMHIDDEN ) && ( !IsGMBody( ourChar ) && ( ourChar->IsNpc() || isOnline( (*ourChar) ) ) &&
+ ourChar->GetCommandLevel() < CL_CNS ))
{
didShove = true;

0 comments on commit 9fd7e12

Please sign in to comment.