//public static void CheckLevelable( ILevelable item, Mobile killer, Mobile killed ) public static void CheckLevelable(XmlLevelItem item, Mobile killer, Mobile killed) { if ((item.Level >= LevelItems.MaxLevelsCap) || (item.Level >= item.MaxLevel)) { return; } int exp = CalcExp(killed); int oldLevel = item.Level; int expcap = CalcExpCap(oldLevel); if (LevelItems.EnableExpCap && exp > expcap) { exp = expcap; } item.Experience += exp; InvalidateLevel(item); if (item.Level != oldLevel) { OnLevel(item, oldLevel, item.Level, killer); } //if ( item is Item ) // ((Item)item).InvalidateProperties(); if (item != null) { item.InvalidateParentProperties(); } }
public void CreateItemExpList() { //ILevelable levitem = (ILevelable)m_Item; XmlLevelItem levitem = XmlAttach.FindAttachment(this.m_Item, typeof(XmlLevelItem)) as XmlLevelItem; this.AddLabel(75, 275, LabelHue, @"Max levels on item:"); this.AddLabel(198, 275, LabelHue, levitem.MaxLevel.ToString()); this.AddLabel(75, 297, LabelHue, @"Experience:"); this.AddLabel(154, 297, LabelHue, levitem.Experience.ToString()); int tolevel = 0; for (int i = 0; i < LevelItemManager.ExpTable.Length; ++i) { if (levitem.Experience < LevelItemManager.ExpTable[i]) { tolevel = LevelItemManager.ExpTable[i] - levitem.Experience; break; } } this.AddLabel(75, 319, LabelHue, @"Exp. to next level:"); this.AddLabel(191, 319, LabelHue, tolevel.ToString()); this.AddLabel(75, 341, LabelHue, @"Spending Points(sp) Avail:"); this.AddLabel(230, 341, LabelHue, levitem.Points.ToString()); }
protected override void OnTarget(Mobile from, object target) { if (target is BaseWeapon || target is BaseArmor || target is BaseClothing || target is BaseJewel) { Item item = (Item)target; XmlLevelItem a = (XmlLevelItem)XmlAttach.FindAttachment(item, typeof(XmlLevelItem)); if (a != null) { from.SendMessage("That already is levelable!"); return; } else { if (item.RootParent != from) // Make sure its in their pack or they are wearing it { from.SendMessage("You cannot make that levelable there!"); } else { // mod to attach the XmlPoints attachment automatically to new chars XmlAttach.AttachTo(item, new XmlLevelItem()); from.SendMessage("You magically make the item levelable..."); this.m_Deed.Delete(); } } } else { from.SendMessage("You cannot make that levelable"); } }
//public static void InvalidateLevel( ILevelable item ) public static void InvalidateLevel(XmlLevelItem item) { for (int i = 0; i < ExpTable.Length; ++i) { if (item.Experience < ExpTable[i]) { return; } item.Level = i + 1; } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (this.BlessedFor == from && this.BlessedBy == from && this.RootParent == from) { list.Add(new UnBlessEntry(from, this)); } XmlLevelItem levitem = XmlAttach.FindAttachment(this, typeof(XmlLevelItem)) as XmlLevelItem; if (levitem != null) { list.Add(new LevelInfoEntry(from, this, AttributeCategory.Melee)); } }
protected override void OnTarget(Mobile from, object target) { if (target is Mobile) { from.SendMessage("This scroll cannot be applied to that!"); } else if (target is Item) { Item item = (Item)target; if (item.RootParent != from || !item.IsChildOf(from.Backpack)) // Make sure its in their pack or they are wearing it { from.SendMessage("The item must be in your pack to level it up."); } else { XmlLevelItem levitem = XmlAttach.FindAttachment(item, typeof(XmlLevelItem)) as XmlLevelItem; //if (target is ILevelable) if (levitem != null) { //ILevelable b = (ILevelable)target; //if ((b.MaxLevel + m_Scroll.Value) > LevelItems.MaxLevelsCap) if ((levitem.MaxLevel + m_Scroll.Value) > LevelItems.MaxLevelsCap) { from.SendMessage("The level on this item is already too high to use this scroll!"); } else { //b.MaxLevel += m_Scroll.Value; levitem.MaxLevel += m_Scroll.Value; from.SendMessage("Your item has leveled up by " + m_Scroll.Value + " levels."); m_Scroll.Delete(); } } else { from.SendMessage("Invalid Target Type. Levelable Weapons, Armor, Jewelery and Clothing only!"); } } } else { from.SendMessage("Invalid Target Type. Levelable Weapons, Armor, Jewelery and Clothing only!"); } }
public static void CheckItems(Mobile killer, Mobile killed) { if (killer != null) { for (int i = 0; i < 25; ++i) { Item item = killer.FindItemOnLayer((Layer)i); XmlLevelItem levitem = XmlAttach.FindAttachment(item, typeof(XmlLevelItem)) as XmlLevelItem; //if ( item != null && item is ILevelable ) if (item != null && levitem != null) { CheckLevelable(levitem, killer, killed); } } } }
//public static void OnLevel(ILevelable item, int oldLevel, int newLevel, Mobile from) public static void OnLevel(XmlLevelItem item, int oldLevel, int newLevel, Mobile from) { /* This is where we control all our props * and their maximum value. */ int index; string itemdesc; index = newLevel % 10; if (index == 0) { item.Points += LevelItems.PointsPerLevel * 2; } else { item.Points += LevelItems.PointsPerLevel; } from.PlaySound(0x20F); from.FixedParticles(0x376A, 1, 31, 9961, 1160, 0, EffectLayer.Waist); from.FixedParticles(0x37C4, 1, 31, 9502, 43, 2, EffectLayer.Waist); if (item.AttachedTo is BaseWeapon) { itemdesc = "weapon"; } else if (item.AttachedTo is BaseArmor) { itemdesc = "armor"; } else if (item.AttachedTo is BaseJewel) { itemdesc = "jewelry"; } else if (item.AttachedTo is BaseClothing) { itemdesc = "clothing"; } else { itemdesc = "item"; } from.SendMessage("Your " + itemdesc + " has gained a level. It is now level {0}.", newLevel); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item)targeted; XmlLevelItem levitem = XmlAttach.FindAttachment(item, typeof(XmlLevelItem)) as XmlLevelItem; if (item.Parent != from && item.Parent != from.Backpack) { from.SendMessage("The item must be in your pack or equipped!"); return; } //if ( item is ILevelable) if (levitem != null) { if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseClothing) { from.SendGump(new ItemExperienceGump(from, item, AttributeCategory.Melee)); } else { from.SendMessage("That is not a valid levelable item"); } } else { from.SendMessage("That item is not levelable!"); } } else { from.SendMessage("That is not a valid item!"); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID <= 0) { return; // Canceled } //ILevelable levitem = (ILevelable)m_Item; XmlLevelItem levitem = XmlAttach.FindAttachment(this.m_Item, typeof(XmlLevelItem)) as XmlLevelItem; int buttonID = info.ButtonID - 1; int type = buttonID % 7; int index = buttonID / 7; int cost = 0; int attrvalue = 0; switch (type) { case 0: // Cancel { break; } case 1: // Select Attribute Type { switch (index) { case 0: // Melee { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Melee, GumpPage.AttributeList)); break; } case 1: // Magic { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Magic, GumpPage.AttributeList)); break; } case 2: // Char Stats { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Stats, GumpPage.AttributeList)); break; } case 3: // Resistances { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Resists, GumpPage.AttributeList)); break; } case 4: // Weapon Hits { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Hits, GumpPage.AttributeList)); break; } case 5: // Misc. { this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, AttributeCategory.Misc, GumpPage.AttributeList)); break; } } break; } case 2: // Attribute selected { cost = GetPointCost(this.m_Item, LevelAttributes.m_Attributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected attribute if (index >= 0 && index < LevelAttributes.m_Attributes.Length) { if (this.m_Item is BaseWeapon) { attrvalue = ((BaseWeapon)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_Attributes[index].m_MaxValue) { ((BaseWeapon)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (this.m_Item is BaseArmor) { attrvalue = ((BaseArmor)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_Attributes[index].m_MaxValue) { ((BaseArmor)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (this.m_Item is BaseJewel) { attrvalue = ((BaseJewel)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_Attributes[index].m_MaxValue) { ((BaseJewel)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (this.m_Item is BaseClothing) { attrvalue = ((BaseClothing)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_Attributes[index].m_MaxValue) { ((BaseClothing)this.m_Item).Attributes[LevelAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else { return; } } } else { this.m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, LevelAttributes.m_Attributes[index].m_Category, GumpPage.AttributeList)); break; } case 3: // WeaponAttribute selected { cost = GetPointCost(this.m_Item, LevelAttributes.m_WeaponAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < LevelAttributes.m_WeaponAttributes.Length) { if (LevelAttributes.m_WeaponAttributes[index].m_Attribute == AosWeaponAttribute.DurabilityBonus) { attrvalue = ((BaseWeapon)this.m_Item).MaxHitPoints; } else { attrvalue = ((BaseWeapon)this.m_Item).WeaponAttributes[LevelAttributes.m_WeaponAttributes[index].m_Attribute]; } if (attrvalue < LevelAttributes.m_WeaponAttributes[index].m_MaxValue) { ((BaseWeapon)this.m_Item).WeaponAttributes[LevelAttributes.m_WeaponAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } else { this.m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, LevelAttributes.m_WeaponAttributes[index].m_Category, GumpPage.AttributeList)); break; } case 4: // Armor Attributes Selected { cost = GetPointCost(this.m_Item, LevelAttributes.m_ArmorAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < LevelAttributes.m_ArmorAttributes.Length) { if (LevelAttributes.m_ArmorAttributes[index].m_Attribute == AosArmorAttribute.DurabilityBonus) { attrvalue = ((BaseArmor)this.m_Item).MaxHitPoints; } else { attrvalue = ((BaseArmor)this.m_Item).ArmorAttributes[LevelAttributes.m_ArmorAttributes[index].m_Attribute]; } if (attrvalue < LevelAttributes.m_ArmorAttributes[index].m_MaxValue) { ((BaseArmor)this.m_Item).ArmorAttributes[LevelAttributes.m_ArmorAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } else { this.m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, LevelAttributes.m_ArmorAttributes[index].m_Category, GumpPage.AttributeList)); break; } case 5: // Armor Resists Selected { cost = GetPointCost(this.m_Item, LevelAttributes.m_ResistanceTypes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < LevelAttributes.m_ResistanceTypes.Length) { if (LevelAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Physical) { attrvalue = ((BaseArmor)this.m_Item).PhysicalBonus; if (attrvalue < LevelAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)this.m_Item).PhysicalBonus += 1; levitem.Points -= cost; } } else if (LevelAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Fire) { attrvalue = ((BaseArmor)this.m_Item).FireBonus; if (attrvalue < LevelAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)this.m_Item).FireBonus += 1; levitem.Points -= cost; } } else if (LevelAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Cold) { attrvalue = ((BaseArmor)this.m_Item).ColdBonus; if (attrvalue < LevelAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)this.m_Item).ColdBonus += 1; levitem.Points -= cost; } } else if (LevelAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Poison) { attrvalue = ((BaseArmor)this.m_Item).PoisonBonus; if (attrvalue < LevelAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)this.m_Item).PoisonBonus += 1; levitem.Points -= cost; } } else if (LevelAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Energy) { attrvalue = ((BaseArmor)this.m_Item).EnergyBonus; if (attrvalue < LevelAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)this.m_Item).EnergyBonus += 1; levitem.Points -= cost; } } else { return; } } } else { this.m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, LevelAttributes.m_ResistanceTypes[index].m_Category, GumpPage.AttributeList)); break; } case 6: // Jewelry & Clothing Resists Selected { cost = GetPointCost(this.m_Item, LevelAttributes.m_ElementAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < LevelAttributes.m_ElementAttributes.Length) { if (this.m_Item is BaseJewel) { attrvalue = ((BaseJewel)this.m_Item).Resistances[LevelAttributes.m_ElementAttributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_ElementAttributes[index].m_MaxValue) { ((BaseJewel)this.m_Item).Resistances[LevelAttributes.m_ElementAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else { attrvalue = ((BaseClothing)this.m_Item).Resistances[LevelAttributes.m_ElementAttributes[index].m_Attribute]; if (attrvalue < LevelAttributes.m_ElementAttributes[index].m_MaxValue) { ((BaseClothing)this.m_Item).Resistances[LevelAttributes.m_ElementAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } } else { this.m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } this.m_From.SendGump(new ItemExperienceGump(this.m_From, this.m_Item, LevelAttributes.m_ElementAttributes[index].m_Category, GumpPage.AttributeList)); break; } } }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); XmlLevelItem levitem = XmlAttach.FindAttachment(this, typeof(XmlLevelItem)) as XmlLevelItem; if (levitem != null) { list.Add(1060658, "Level\t{0}", levitem.Level); if (LevelItems.DisplayExpProp) { list.Add(1060659, "Experience\t{0}", levitem.Experience); } } #region SF Imbuing if (this.m_TimesImbued > 0) { list.Add(1080418); // (Imbued) } /* * if (m_AosAttributes.Brittle > 0) * list.Add(1116209); // Brittle * * if (m_AosAttributes.NoRepairs > 0) * list.Add("Cannot Be Repaired"); */ #endregion #region Mondain's Legacy if (this.m_Quality == ArmorQuality.Exceptional) { list.Add(1063341); // exceptional } if (this.m_Crafter != null) { list.Add(1050043, this.m_Crafter.Name); // crafted by ~1_NAME~ } #endregion #region Mondain's Legacy Sets if (this.IsSetItem) { list.Add(1080240, this.Pieces.ToString()); // Part of a Jewelry Set (~1_val~ pieces) if (this.m_SetEquipped) { list.Add(1080241); // Full Jewelry Set Present SetHelper.GetSetProperties(list, this); } } #endregion this.m_AosSkillBonuses.GetProperties(list); int prop; #region Stygian Abyss if (this.RequiredRace == Race.Elf) { list.Add(1075086); // Elves Only } else if (this.RequiredRace == Race.Gargoyle) { list.Add(1111709); // Gargoyles Only } #endregion if ((prop = this.ArtifactRarity) > 0) { list.Add(1061078, prop.ToString()); // artifact rarity ~1_val~ } // if ((prop = this.m_AosAttributes.CritChance) != 0) // list.Add("Critical Chance Increase " + prop.ToString() + "%"); // crit chance increase ~1_val~% if ((prop = this.m_AosAttributes.WeaponDamage) != 0) { list.Add(1060401, prop.ToString()); // damage increase ~1_val~% } if ((prop = this.m_AosAttributes.DefendChance) != 0) { list.Add(1060408, prop.ToString()); // defense chance increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusDex) != 0) { list.Add(1060409, prop.ToString()); // dexterity bonus ~1_val~ } if ((prop = this.m_AosAttributes.EnhancePotions) != 0) { list.Add(1060411, prop.ToString()); // enhance potions ~1_val~% } if ((prop = this.m_AosAttributes.CastRecovery) != 0) { list.Add(1060412, prop.ToString()); // faster cast recovery ~1_val~ } if ((prop = this.m_AosAttributes.CastSpeed) != 0) { list.Add(1060413, prop.ToString()); // faster casting ~1_val~ } if ((prop = this.m_AosAttributes.AttackChance) != 0) { list.Add(1060415, prop.ToString()); // hit chance increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusHits) != 0) { list.Add(1060431, prop.ToString()); // hit point increase ~1_val~ } if ((prop = this.m_AosAttributes.BonusInt) != 0) { list.Add(1060432, prop.ToString()); // intelligence bonus ~1_val~ } if ((prop = this.m_AosAttributes.LowerManaCost) != 0) { list.Add(1060433, prop.ToString()); // lower mana cost ~1_val~% } if ((prop = this.m_AosAttributes.LowerRegCost) != 0) { list.Add(1060434, prop.ToString()); // lower reagent cost ~1_val~% } if ((prop = this.m_AosAttributes.Luck) != 0) { list.Add(1060436, prop.ToString()); // luck ~1_val~ } if ((prop = this.m_AosAttributes.BonusMana) != 0) { list.Add(1060439, prop.ToString()); // mana increase ~1_val~ } if ((prop = this.m_AosAttributes.RegenMana) != 0) { list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~ } if ((prop = this.m_AosAttributes.NightSight) != 0) { list.Add(1060441); // night sight } if ((prop = this.m_AosAttributes.ReflectPhysical) != 0) { list.Add(1060442, prop.ToString()); // reflect physical damage ~1_val~% } if ((prop = this.m_AosAttributes.RegenStam) != 0) { list.Add(1060443, prop.ToString()); // stamina regeneration ~1_val~ } if ((prop = this.m_AosAttributes.RegenHits) != 0) { list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~ } if ((prop = this.m_AosAttributes.SpellChanneling) != 0) { list.Add(1060482); // spell channeling } if ((prop = this.m_AosAttributes.SpellDamage) != 0) { list.Add(1060483, prop.ToString()); // spell damage increase ~1_val~% } if ((prop = this.m_AosAttributes.BonusStam) != 0) { list.Add(1060484, prop.ToString()); // stamina increase ~1_val~ } if ((prop = this.m_AosAttributes.BonusStr) != 0) { list.Add(1060485, prop.ToString()); // strength bonus ~1_val~ } if ((prop = this.m_AosAttributes.WeaponSpeed) != 0) { list.Add(1060486, prop.ToString()); // swing speed increase ~1_val~% } if (Core.ML && (prop = this.m_AosAttributes.IncreasedKarmaLoss) != 0) { list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~% } #region SA if ((prop = this.m_SAAbsorptionAttributes.CastingFocus) != 0) { list.Add(1113696, prop.ToString()); // Casting Focus ~1_val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterFire) != 0) { list.Add(1113593, prop.ToString()); // Fire Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterCold) != 0) { list.Add(1113594, prop.ToString()); // Cold Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterPoison) != 0) { list.Add(1113595, prop.ToString()); // Poison Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterEnergy) != 0) { list.Add(1113596, prop.ToString()); // Energy Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterKinetic) != 0) { list.Add(1113597, prop.ToString()); // Kinetic Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.EaterDamage) != 0) { list.Add(1113598, prop.ToString()); // Damage Eater ~1_Val~% } if ((prop = this.m_SAAbsorptionAttributes.ResonanceFire) != 0) { list.Add(1113691, prop.ToString()); // Fire Resonance ~1_val~% } if ((prop = this.m_SAAbsorptionAttributes.ResonanceCold) != 0) { list.Add(1113692, prop.ToString()); // Cold Resonance ~1_val~% } if ((prop = this.m_SAAbsorptionAttributes.ResonancePoison) != 0) { list.Add(1113693, prop.ToString()); // Poison Resonance ~1_val~% } if ((prop = this.m_SAAbsorptionAttributes.ResonanceEnergy) != 0) { list.Add(1113694, prop.ToString()); // Energy Resonance ~1_val~% } if ((prop = this.m_SAAbsorptionAttributes.ResonanceKinetic) != 0) { list.Add(1113695, prop.ToString()); // Kinetic Resonance ~1_val~% } #endregion base.AddResistanceProperties(list); Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list); if (this.m_HitPoints >= 0 && this.m_MaxHitPoints > 0) { list.Add(1060639, "{0}\t{1}", this.m_HitPoints, this.m_MaxHitPoints); // durability ~1_val~ / ~2_val~ } }