private void CopyFromLayer(Mobile from, Mobile mimic, Layer layer) { Item newItem; Item oldItem = from.FindItemOnLayer(layer); if (oldItem != null) { Type t = oldItem.GetType(); ConstructorInfo c = t.GetConstructor(Type.EmptyTypes); if (c != null) { try { object o = c.Invoke(null); if (o != null && o is Item) { newItem = (Item)o; Dupe.CopyProperties(newItem, oldItem);//copy.Dupe( item, copy.Amount ); mimic.AddItem(newItem); newItem.LootType = LootType.Newbied; } } catch { from.SendMessage("Error! Please check Charm.cs!"); return; } } } }
protected virtual void Morph(Mobile m) { Body = m.Body; Hue = m.Hue; Female = m.Female; Name = m.Name; NameHue = m.NameHue; Title = m.Title; Kills = m.Kills; HairItemID = m.HairItemID; HairHue = m.HairHue; FacialHairItemID = m.FacialHairItemID; FacialHairHue = m.FacialHairHue; MorphSkills(m); foreach (Item item in m.Items) { Item newItem; Type t; ConstructorInfo c; object o; if (item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank) { t = item.GetType(); c = t.GetConstructor(Type.EmptyTypes); if (c != null) { o = c.Invoke(null); if (o != null && o is Item) { //TODO: How to copy ASHammer newItem = (Item)o; Dupe.CopyProperties(newItem, item); newItem.LootType = LootType.Newbied; item.OnAfterDuped(newItem); newItem.Parent = null; AddItem(newItem); newItem.InvalidateProperties(); } } } } PlaySound(0x511); FixedParticles(0x376A, 1, 14, 5045, EffectLayer.Waist); }
/// <summary> /// Rewards the top 3 place winners by giving the specified item(s) and /// placing them in thier banks.Notifies the winners that thier winnings /// have been placed in thier bank. /// Loads the previous tournaments.xml file /// Saves the results to the tournaments.xml file /// Removes the spectator gates. /// Moves the winners so they may leave. /// Stops the tournament timer to officially end the tournament. /// </summary> /// <param name="first"> First place contestant</param> /// <param name="second"> Second place contestant</param> /// <param name="third"> Third place contestant</param> public static void TournamentReward(Tournament t, string place, Teams team) { BankBox bank; Item prize = (Item)Activator.CreateInstance(t.Prizes[place].GetType(), false); Dupe.CopyProperties(prize, t.Prizes[place]); foreach (Mobile m in team.getOwners()) { bank = m.BankBox; bank.AddItem(prize); m.SendMessage("Your winnings have been sent to your bankbox."); if (place.Contains("first")) { World.Broadcast(0, false, m.Name + " has won the " + t.TeamSize + " tournament."); } } }
public static void CopyProps(Item dest, Item src) { Dupe.CopyProperties(dest, src, dest.GetType(), m_PropsToNotChange); }
protected override void OnTarget(Mobile from, object targeted) { Item target = ((Item)targeted); Container pack = from.Backpack; if (pack == null) { from.SendMessage("Please ensure you have a pack."); return; } if (target == null || target.Deleted || !(target is Runebook) || ((Runebook)target).Entries.Count > 0) { from.SendMessage("You can only copy to an empty runebook."); return; } if (target.RootParent != from) { from.SendMessage("The runebook you wish to write to must be in your backpack."); return; } if (ConsumeTotal(pack, ((Runebook)m_Source).Entries.Count, true) > -1) { from.SendMessage("This operation requires unmarked recall runes and mark scrolls."); from.SendMessage("Total of each needed: {0}.", ((Runebook)m_Source).Entries.Count); return; } Type t = typeof(Runebook); ConstructorInfo c = t.GetConstructor(Type.EmptyTypes); if (c != null) { try { from.SendMessage("Writing Copy..."); object o = c.Invoke(null); if (o != null && o is Item) { Item newItem = (Item)o; Dupe.CopyProperties(newItem, m_Source); m_Source.OnAfterDuped(newItem); newItem.Parent = null; pack.DropItem(newItem); newItem.InvalidateProperties(); from.SendMessage("Done"); m_Pen.UsesRemaining -= 1; m_Pen.InvalidateProperties(); target.Delete(); } } catch { from.SendMessage("Error, please notify a GM!"); } } }