|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
I added packs to all mounts (execpt ethereals of course) and am trying to think of a way to add the snooping in.
So far I have come up with this: A thief can single click a mounted player to bring up the "Open Paperdoll" context menu. From there, they can snoop the mounted players pack. A thief can double click a mounted player to attempt to snoop the MOUNTS pack. The problem is, Im not sure where to do this. I thought it would be in the playermobile.cs in the OnDoubleClick override. At the moment, it looks like this: Code:
public override void OnDoubleClick( Mobile from )
{
if ( this == from && !Warmode )
{
IMount mount = Mount;
if ( mount != null && !DesignContext.Check( this ) )
return;
}
base.OnDoubleClick( from );
}
Code:
public override void OnDoubleClick( Mobile from )
{
IMount mount = Mount;
if ( this == from && !Warmode )
{
if ( mount != null && !DesignContext.Check( this ) )
return;
}
if ( this != from && this.Mount != null )
{
BaseCreature themount = mount as BaseCreature;
TryPackOpen( themount, from );
}
base.OnDoubleClick( from );
}
public static void TryPackOpen( BaseCreature animal, Mobile from )
{
if ( animal.IsDeadPet )
return;
Container item = animal.Backpack;
if ( item != null )
from.Use( item );
}
__________________
Aeternum Shard |
|
|
|
|
|
#2 (permalink) |
|
Forum Master
Join Date: Feb 2005
Location: ShatteredSosaria.com
Posts: 9,260
|
Code:
public override void OnDoubleClick( Mobile from )
{
IMount mount = from.Mount;
if ( this == from && !Warmode )
{
if ( mount != null && !DesignContext.Check( this ) )
return;
}
if ( this != from && mount != null )
{
BaseCreature theMount = mount as BaseCreature;
if( theMount != null )
this.TryPackOpen( theMount );
}
base.OnDoubleClick( from );
}
public void TryPackOpen( BaseCreature animal )
{
if ( animal.IsDeadPet )
return;
Container item = animal.Backpack;
if ( item != null )
this.Use( item );
}
|
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
I finally got around to testing it, it compiles fine, but does the same as I had before. If you double click someone with a pack mount, it just opens their paperdoll.
Im doing some in depth testing now to see exactly what its doing. Ill post more info once Im done with that ![]()
__________________
Aeternum Shard |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
I put messages in all areas to see what was being done, but not a single message popped up. It looks like the whole ondoubleclick block is ignored.
What other possibilities are open to get this working?
__________________
Aeternum Shard |
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
Ok, Im trying to accomplish this through a command "[snoop"
This compiles fine, I can target players, but when I target a player riding a mount that has a pack, it says: you glance casually into the animals pack. you try to peek. Which leads me to believe that from.Use( item ); is not working as It should be, or I have the wrong command entirely. Thoughts? I have also tried item.DisplayTo( from ); with no luck. Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Commands
{
public class Snoop
{
public static void Initialize()
{
CommandSystem.Register( "snoop", AccessLevel.Player, new CommandEventHandler( Snoop_OnCommand ) );
}
[Usage( "snoop" )]
[Description( "Use this command to attempt to snoop from a players mount while they are on it!")]
public static void Snoop_OnCommand( CommandEventArgs e )
{
e.Mobile.Target = new SnoopTarget();
}
private class SnoopTarget : Target
{
public SnoopTarget() : base( -1, true, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object target )
{
if ( target is PlayerMobile )
{
PlayerMobile dude = target as PlayerMobile;
IMount mount = ((PlayerMobile)target).Mount;
if ( mount != null )
{
BaseCreature theMount = mount as BaseCreature;
if( theMount != null )
{
from.SendMessage("you glance casually into the animals pack.");
if ( theMount.IsDeadPet )
return;
Container item = theMount.Backpack;
if ( item != null )
{
from.Use( item );
from.SendMessage("you try to peek.");
}
else
{
from.SendMessage("you dont see a pack");
}
}
}
}
}
}
}
}
__________________
Aeternum Shard Last edited by Jarrod; 11-10-2006 at 10:29 AM. |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
Im sure Im overlooking something trivial here... anyone?
__________________
Aeternum Shard |
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
Im trying a second command that is identical to the current snooping skill handler.
It does everything its supposed to EXCEPT opening the mounts pack. The players fail and gain snooping as if it were a regular snoop attempt, and when they succeed, nothing happens. What is causing "cont.DisplayTo( from );" to not be executed? Code:
using System;
using Server;
using Server.Misc;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Regions;
using Server.Targeting;
using System.Collections;
namespace Server.Commands
{
public class SnoopTwo
{
public static void Initialize()
{
CommandSystem.Register( "snooptwo", AccessLevel.Player, new CommandEventHandler( SnoopTwo_OnCommand ) );
}
[Usage( "snooptwo" )]
[Description( "Use this command to attempt to snooptwo from a players mount while they are on it!")]
public static void SnoopTwo_OnCommand( CommandEventArgs e )
{
e.Mobile.Target = new SnoopTwoTarget();
}
public static bool CheckSnoopAllowed( Mobile from, Mobile to )
{
Map map = from.Map;
if ( to.Player )
return from.CanBeHarmful( to, false, true ); // normal restrictions
if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
return true; // felucca you can snoop anybody
GuardedRegion reg = (GuardedRegion) to.Region.GetRegion( typeof( GuardedRegion ) );
if ( reg == null || reg.IsDisabled() )
return true; // not in town? we can snoop any npc
BaseCreature cret = to as BaseCreature;
if ( to.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
return false; // in town we cannot snoop blue human npcs
return true;
}
private class SnoopTwoTarget : Target
{
public SnoopTwoTarget() : base( -1, true, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object target )
{
if ( target is PlayerMobile )
{
PlayerMobile dude = target as PlayerMobile;
BaseCreature mount = dude.Mount as BaseCreature;
Container cont = mount.Backpack;
if ( cont != null)
{
if ( from.AccessLevel > AccessLevel.Player || from.InRange( cont.GetWorldLocation(), 1 ) )
{
Mobile root = cont.RootParent as Mobile;
if ( root != null && !root.Alive )
return;
if ( root != null && root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player )
{
from.SendLocalizedMessage( 500209 ); // You can not peek into the container.
return;
}
if ( root != null && from.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed( from, root ) )
{
from.SendLocalizedMessage( 1001018 ); // You cannot perform negative acts on your target.
return;
}
if ( root != null && from.AccessLevel == AccessLevel.Player && from.Skills[SkillName.Snooping].Value < Utility.Random( 100 ) )
{
Map map = from.Map;
if ( map != null )
{
string message = String.Format( "You notice {0} attempting to peek into {1}'s belongings.", from.Name, root.Name );
IPooledEnumerable eable = map.GetClientsInRange( from.Location, 8 );
foreach ( NetState ns in eable )
{
if ( ns != from.NetState )
ns.Mobile.SendMessage( message );
}
eable.Free();
}
}
if ( from.AccessLevel == AccessLevel.Player )
Titles.AwardKarma( from, -4, true );
if ( from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill( SkillName.Snooping, cont, 0.0, 100.0 ) )
{
if ( cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap( from ) )
return;
cont.DisplayTo( from );
}
else
{
from.SendLocalizedMessage( 500210 ); // You failed to peek into the container.
}
}
else
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
}
}
}
}
}
}
__________________
Aeternum Shard |
|
|
|
|
|
#9 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
I still need assistance with this. Has anyone been able to check into it?
__________________
Aeternum Shard |
|
|
|
|
|
#10 (permalink) | |
|
Forum Expert
|
Quote:
__________________
Vaughn Peterson, Kate Maclellan, Drew Cook, William Soverino, rest in peace. |
|
|
|
|
|
|
#11 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
yes, thats where the routines are from. Something appears to be wrong with the cont.DisplayTo( from ); function in this case. Im guessing it has something to do with a distance check, but I cant be sure.
__________________
Aeternum Shard |
|
|
|
|
|
#12 (permalink) |
|
Forum Expert
Join Date: Oct 2002
Location: Germany (american though)
Age: 33
Posts: 957
|
Quick question, when a player mounts an animal, does it go to map.internal?
If yes, then I think that there might not be a feasible way of snooping from that mounts pack. This would also mean that all of the above posted code is in fact, correct IF the mount were not in the internal map. I hope that RunUO doesnt use the old "horse barn" method, but if so, then distance is the issue in this case.
__________________
Aeternum Shard |
|
|
|
|
|
#13 (permalink) | |
|
Forum Master
Join Date: Feb 2005
Location: ShatteredSosaria.com
Posts: 9,260
|
Quote:
It actually goes to the mobile's "Mount Layer" but that's still the internal map. So... yeah. You can't do this the conventional way. You'll probably have to edit Backpack.cs and override the IsAccessibleTo method. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|