Massmove (Target)
Datum: 27/07/2011 00:59:49
Staženo: 425x
Popis:
Není to massmove jak v Yoku, ale je to massmove na Target item..
Příkazy:
- ,massmovexy
- ,massmovexy "bool specificcolor"
- ,massmovexy "graphic graphic" " uocolor color" " serial sourcecontainer" " serial destination" "ushort x" "ushort y"
Kód:
using Phoenix.WorldData;
namespace Phoenix.Plugins
{
public static partial class Commands
{
[Command]
public static void MassMovexy() { MassMovexy(true); }
[Command]
public static void MassMovexy(bool specificcolor)
{//by smoce
UO.Print("Select item type:");
UOItem typeItem = new UOItem(UIManager.TargetObject());
if (!typeItem.Exist)
ScriptErrorException.Throw("Invalid item.");
Graphic graphic = typeItem.Graphic;
UOColor color = specificcolor ? typeItem.Color : UOColor.Invariant;
UOItem source = new UOItem(typeItem.Container);
ushort x = typeItem.X;
ushort y = typeItem.Y;
if (!source.Exist)
ScriptErrorException.Throw("Invalid source container.");
UO.Print("Select destination container:");
UOItem dest = new UOItem(UIManager.TargetObject());
if (!dest.Exist)
ScriptErrorException.Throw("Invalid destination.");
MassMovexy(graphic, color, source, dest,x,y);
}
[Command]
public static void MassMovexy(Graphic graphic, UOColor color, Serial sourceContainer, Serial destination,ushort x,ushort y)
{//by smoce
UOItem source = World.GetItem(sourceContainer);
if (!source.Exist)
ScriptErrorException.Throw("Invalid source container.");
if (!destination.IsValid)
ScriptErrorException.Throw("Invalid destination.");
UO.PrintInformation("Moving items of type {0} {1} from {2} to {3}", graphic, color, sourceContainer,
destination,x,y);
UOItem serial_item = World.Player.Backpack.AllItems.FindType(graphic, color);
foreach (UOItem item in source.Items)
if (item.Graphic == graphic && item.Color == color)
item.MoveWaitxy(0, destination,x,y);
UO.PrintInformation("MassMove finished.");
}
public static void MoveWaitxy(this UOItem item, ushort amount, Serial container,ushort x, ushort y)
{
using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item))
if (!item.Move(amount, container,x,y) || ew.Wait(2000))
UO.Wait(500);
}
}
}

