CODE |
using System; using System.IO; using System.Text; using Server.Items; using System.Reflection; using System.Collections; using Server; namespace Server.Scripts.Commands { public class GrabCommand { public static void Initialize() { Server.Commands.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) ); } public static void Grab_OnCommand(CommandEventArgs e){ Mobile from = e.Mobile; ArrayList range = new ArrayList(); IPooledEnumerable eable = from.Map.GetItemsInRange( from.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ){ range.AddRange( check.Items ); } else range.Add( check ); } eable.Free(); foreach ( Item item in range ) { if ( item.Movable ) { from.Emote("*Yoink*"); from.AddToBackpack( item ); } } } } } |
QUOTE |
Mobile from = e.Mobile; ArrayList range = new ArrayList(); IPooledEnumerable eable = from.Map.GetItemsInRange( from.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ){ range.AddRange( check.Items ); } else range.Add( check ); } eable.Free(); foreach ( Item item in range ) { if ( item.Movable ) { from.Emote("*Yoink*"); from.AddToBackpack( item ); break; } } |
CODE |
using System; using System.IO; using System.Text; using Server.Items; using System.Reflection; using System.Collections; using Server; namespace Server.Scripts.Commands { public class GrabCommand { public static void Initialize() { Server.Commands.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) ); } public static void Grab_OnCommand(CommandEventArgs e){ Mobile from = e.Mobile; ArrayList range = new ArrayList(); IPooledEnumerable eable = from.Map.GetItemsInRange( from.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ){ return; } else range.Add( check ); } eable.Free(); foreach ( Item item in range ) { if ( item.Movable ) { from.Emote("*Zbiera*"); from.AddToBackpack( item ); Break; } } } } public class GrabTimer : Timer { private Mobile m; public GrabTimer( Mobile from ) : base( TimeSpan.FromSeconds( 1 ) ) { Priority = TimerPriority.OneSecond; m = from; } protected override void OnTick() { GrabTimer grabTimer = new GrabTimer( m ); PlayerMobile pm = m as PlayerMobile; if ( !(Item item in range) ) { Stop(); } } } } |
CODE |
using System; using System.IO; using System.Text; using Server.Items; using System.Reflection; using System.Collections; using Server; namespace Server.Scripts.Commands { public class GrabCommand { public static void Initialize() { Server.Commands.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) ); } public static void Grab_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; GrabTimer grabTimer = new GrabTimer( m ); } public class GrabTimer : Timer { private Mobile m; public GrabTimer( Mobile from ) : base( TimeSpan.FromSeconds( 1 ) ) { Priority = TimerPriority.OneSecond; m = from; } protected override void OnTick() { //PlayerMobile pm = m as PlayerMobile; ArrayList range = new ArrayList(); IPooledEnumerable eable = m.Map.GetItemsInRange( m.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ){ return; } else range.Add( check ); } eable.Free(); foreach ( Item item in range ) { if ( item.Movable ) { m.Emote("*Zbiera*"); m.AddToBackpack( item ); //Break; } } Stop(); } } } } |
QUOTE |
public static void Grab_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; GrabTimer grabTimer = new GrabTimer( m ); grabTimer.Start(); } |
CODE |
using System; using System.IO; using System.Text; using Server.Items; using System.Reflection; using System.Collections; using Server; namespace Server.Scripts.Commands { public class GrabCommand { public static void Initialize() { Server.Commands.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) ); } public static void Grab_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; GrabTimer grabTimer = new GrabTimer( m ); grabTimer.Start(); } public class GrabTimer : Timer { private Mobile m; public GrabTimer( Mobile from ) : base( TimeSpan.FromSeconds( 1 ) ) { Priority = TimerPriority.OneSecond; m = from; } protected override void OnTick() { ArrayList range = new ArrayList(); IPooledEnumerable eable = m.Map.GetItemsInRange( m.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ){ return; } else range.Add( check ); } eable.Free(); foreach ( Item item in range ) { if ( item.Movable ) { m.Emote("*Zbiera*"); m.AddToBackpack( item ); GrabTimer grabTimer = new GrabTimer( m ); grabTimer.Start(); break; } } Stop(); } } } } |
CODE |
public GrabTimer( Mobile from ) : base( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ) ) |
CODE |
if ( item.Movable ) { m.Emote("*Zbiera*"); m.AddToBackpack( item ); return; |
CODE |
using System; using Server.Items; using System.Collections; using Server.Misc; using Server.Mobiles; namespace Server.Scripts.Commands { public class GrabCommand { public static void Initialize() { Server.Commands.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) ); } public static void Grab_OnCommand(CommandEventArgs e) { Mobile m = e.Mobile; GrabTimer grabTimer = new GrabTimer( m ); grabTimer.Start(); } public class GrabTimer : Timer { private Mobile m; public GrabTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0 ) ) { Priority = TimerPriority.OneSecond; m = from; } protected override void OnTick() { if ( m.Alive == false ) { return; } ArrayList range = new ArrayList(); IPooledEnumerable eable = m.Map.GetItemsInRange( m.Location, 3 ); foreach ( Item check in eable ) { if ( check is Corpse ) { Corpse c = (Corpse)check; if (c.Owner != null ) { if (!(c.Owner is PlayerMobile)) { if ( NotorietyHandlers.CorpseNotoriety( m, c ) != Notoriety.Innocent ) { range.AddRange( check.Items ); } else range.Add( check ); } else range.Add( check ); } else range.Add( check ); } else range.Add( check ); } eable.Free(); m.Emote("*Zbiera*"); foreach ( Item item in range ) { if ( item.Movable && item.Visible ) { m.AddToBackpack( item ); GrabTimer grabTimer = new GrabTimer( m ); grabTimer.Start(); break; } else this.Stop(); } } } } } |