// SDrop construct public SDrop(EnchantedItem eitem, Item target, Mobile enhancer) { m_TargetItem = target; m_EItem = eitem; m_Enhancer = enhancer; }
private static void AddInv(object o) { // Handle contained objects (iterative ;) if (o is BaseContainer) { foreach (Item item in ((BaseContainer)o).Items) { if (m_ItemType == null) { AddInv(item); continue; } Type it = item.GetType(); if (it.IsSubclassOf(m_ItemType) || it == m_ItemType || item is BaseContainer) { AddInv(item); } } // Do we want to inventory this container, or return? Type ct = o.GetType(); if (!(m_ItemType == null) && !ct.IsSubclassOf(m_ItemType) && ct != m_ItemType) { return; } } // Handle this object InvItem ir = new InvItem(o.GetType()); // Determine and set inv item properties if (o is BaseWeapon) { BaseWeapon bw = (BaseWeapon)o; ir.m_accuracy = bw.AccuracyLevel.ToString(); ir.m_damage = bw.DamageLevel.ToString(); ir.m_durability = bw.DurabilityLevel.ToString(); ir.m_slayer = bw.Slayer.ToString(); } else if (o is BaseArmor) { BaseArmor ba = (BaseArmor)o; ir.m_durability = ba.Durability.ToString(); ir.m_damage = ba.ProtectionLevel.ToString(); } else if (o is EnchantedScroll) { EnchantedItem ei = (EnchantedItem)o; // ProtectionLevel, Durability if (ei.ItemType.IsSubclassOf(typeof(BaseArmor))) { ir.m_durability = ((ArmorDurabilityLevel)ei.iProps[1]).ToString(); ir.m_damage = ((ArmorProtectionLevel)(ei.iProps[0])).ToString(); } else if (ei.ItemType.IsSubclassOf(typeof(BaseWeapon))) { ir.m_accuracy = ((WeaponAccuracyLevel)ei.iProps[2]).ToString(); ir.m_damage = ((WeaponDamageLevel)ei.iProps[0]).ToString(); ir.m_durability = ((WeaponDurabilityLevel)ei.iProps[1]).ToString(); ir.m_slayer = ((SlayerName)ei.iProps[3]).ToString(); } } if (o is Item) { Item it = (Item)o; if (it.PlayerCrafted == true) { // It's playercrafted, so check for 'Quality' property string strVal = Properties.GetValue(m_from, o, "Quality"); if (strVal == "Quality = Exceptional") { ir.m_quality = "Exceptional"; } } if (it.Amount > 0) { ir.m_count = it.Amount; } ir.m_serial = it.Serial; // adam: Find the best name we can if (o is EnchantedScroll) { EnchantedItem ei = (EnchantedItem)o; ir.m_description = ei.ItemType.Name + ".scroll"; } else { if (valid(it.Name)) { ir.m_description = it.Name; } else if (valid(it.ItemData.Name) && (it.GetType().Name == null || it.GetType().Name == "Item" || it.GetType().Name == "Static")) { ir.m_description = it.ItemData.Name; } else { ir.m_description = it.GetType().Name; } } } // Make sure there are no others like this foreach (InvItem ii in m_Inv) { if (ii.m_type == ir.m_type && ii.m_accuracy == ir.m_accuracy && ii.m_damage == ir.m_damage && ii.m_quality == ir.m_quality && ii.m_durability == ir.m_durability && ii.m_slayer == ir.m_slayer && ii.m_description == ir.m_description) //pla: include new field in this check { // It exists, so increment and return ii.m_count += ir.m_count; return; } } // It doesn't exist, so add it m_Inv.Add(ir); }