public BagOfReagents( int amount, bool isEventBag ) { BaseReagent[] reagents = new BaseReagent[] { new BlackPearl( amount ), new Bloodmoss( amount ), new Garlic( amount ), new Ginseng( amount ), new MandrakeRoot( amount ), new Nightshade( amount ), new SulfurousAsh( amount ), new SpidersSilk( amount ) }; if( isEventBag ) { EventItem = true; for( int i = 0; i < reagents.Length; ++i ) { reagents[i].EventItem = true; DropItem( reagents[i] ); } } else for( int i = 0; i < reagents.Length; ++i ) DropItem( reagents[i] ); }
public BagOfReagents(int amount, bool isEventBag) { BaseReagent[] reagents = new BaseReagent[] { new BlackPearl(amount), new Bloodmoss(amount), new Garlic(amount), new Ginseng(amount), new MandrakeRoot(amount), new Nightshade(amount), new SulfurousAsh(amount), new SpidersSilk(amount) }; if (isEventBag) { EventItem = true; for (int i = 0; i < reagents.Length; ++i) { reagents[i].EventItem = true; DropItem(reagents[i]); } } else { for (int i = 0; i < reagents.Length; ++i) { DropItem(reagents[i]); } } }
public bool AddReagent(Mobile from, BaseReagent reagent, bool passive) { int index = GetIndex(reagent); int count = m_Reagents[index]; int amount = reagent.Amount; int total = count + amount; if (count >= 50000) { if (!passive) { from.SendMessage("This book cannot hold any more of that reagent."); } } else { bool action; if (total > 50000) { int excess = total - 50000; int toAdd = amount - excess; m_Reagents[index] += toAdd; reagent.Amount -= toAdd; if (!passive) { from.SendMessage("You were only able to add {0} of the reagents.", toAdd); } action = false; } else { m_Reagents[index] += amount; if (!passive) { from.SendMessage("You add all of the reagents into the book."); } action = true; } InvalidateProperties(); return(action); } return(false); }
public static int GetIndex(BaseReagent reagent) { if (reagent is BlackPearl) { return(0); } else if (reagent is Bloodmoss) { return(1); } else if (reagent is Garlic) { return(2); } else if (reagent is Ginseng) { return(3); } else if (reagent is MandrakeRoot) { return(4); } else if (reagent is Nightshade) { return(5); } else if (reagent is SpidersSilk) { return(6); } else if (reagent is SulfurousAsh) { return(7); } else if (reagent is BatWing) { return(8); } else if (reagent is DaemonBlood) { return(9); } else if (reagent is DaemonBone) { return(10); } else if (reagent is EyeOfNewt) { return(11); } else if (reagent is GraveDust) { return(12); } else if (reagent is NoxCrystal) { return(13); } else if (reagent is PigIron) { return(14); } return(0); }
protected override void OnTarget(Mobile from, object o) { if (o is BaseReagent) { BaseReagent reg = o as BaseReagent; if (reg.Movable && reg.IsChildOf(from)) { if (!reg.OnDroppedOnto(from, m_Container)) { from.SendMessage("You cannot move that into the container."); } } else { from.SendMessage("That must be in your backpack or bankbox to move it."); } } else if (o is BaseContainer) { BaseContainer to = o as BaseContainer; if (to.IsChildOf(from)) { bool movedItems = true; for (int i = to.Items.Count - 1; i >= 0; i--) { if (to.Items[i] is BaseReagent) { BaseReagent reg = to.Items[i] as BaseReagent; if (reg != null) { if (reg.Movable) { if (m_Amount < 0 || reg.Amount <= m_Amount) { if (!reg.OnDroppedOnto(from, m_Container)) { movedItems = false; } } else { BaseReagent newreg = Activator.CreateInstance(reg.GetType()) as BaseReagent; newreg.Amount = m_Amount; if (!newreg.OnDroppedOnto(from, m_Container)) { movedItems = false; newreg.Delete(); } else { reg.Consume(m_Amount); } } } else { movedItems = false; } } } } if (!movedItems) { from.SendMessage("Some reagents could not be moved."); } } else { from.SendMessage("That must be in your backpack or bank box to move reagents from it."); } } }