public void CreateItemExpList() { IGiftable levitem = (IGiftable)m_Item; AddLabel(75, 275, LabelHue, @"Points Avail:"); AddLabel(198, 275, LabelHue, levitem.Points.ToString()); }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID <= 0) { return; // Canceled } IGiftable levitem = (IGiftable)m_Item; 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 { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Melee, GumpPage.AttributeList)); break; } case 1: // Magic { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Magic, GumpPage.AttributeList)); break; } case 2: // Char Stats { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Stats, GumpPage.AttributeList)); break; } case 3: // Resistances { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Resists, GumpPage.AttributeList)); break; } case 4: // Weapon Hits { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Hits, GumpPage.AttributeList)); break; } case 5: // Misc. { m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributeCategory.Misc, GumpPage.AttributeList)); break; } } break; } case 2: // Attribute selected { cost = GetPointCost(m_Item, GiftAttributes.m_Attributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected attribute if (index >= 0 && index < GiftAttributes.m_Attributes.Length) { if (m_Item is BaseWeapon) { attrvalue = ((BaseWeapon)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_Attributes[index].m_MaxValue) { ((BaseWeapon)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (m_Item is BaseArmor) { attrvalue = ((BaseArmor)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_Attributes[index].m_MaxValue) { ((BaseArmor)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (m_Item is BaseJewel) { attrvalue = ((BaseJewel)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_Attributes[index].m_MaxValue) { ((BaseJewel)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else if (m_Item is BaseClothing) { attrvalue = ((BaseClothing)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_Attributes[index].m_MaxValue) { ((BaseClothing)m_Item).Attributes[GiftAttributes.m_Attributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else { return; } } } else { m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributes.m_Attributes[index].m_Category, GumpPage.AttributeList)); break; } case 3: // WeaponAttribute selected { cost = GetPointCost(m_Item, GiftAttributes.m_WeaponAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < GiftAttributes.m_WeaponAttributes.Length) { if (GiftAttributes.m_WeaponAttributes[index].m_Attribute == AosWeaponAttribute.DurabilityBonus) { attrvalue = ((BaseWeapon)m_Item).MaxHitPoints; } else { attrvalue = ((BaseWeapon)m_Item).WeaponAttributes[GiftAttributes.m_WeaponAttributes[index].m_Attribute]; } if (attrvalue < GiftAttributes.m_WeaponAttributes[index].m_MaxValue) { ((BaseWeapon)m_Item).WeaponAttributes[GiftAttributes.m_WeaponAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } else { m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributes.m_WeaponAttributes[index].m_Category, GumpPage.AttributeList)); break; } case 4: // Armor Attributes Selected { cost = GetPointCost(m_Item, GiftAttributes.m_ArmorAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < GiftAttributes.m_ArmorAttributes.Length) { if (GiftAttributes.m_ArmorAttributes[index].m_Attribute == AosArmorAttribute.DurabilityBonus) { attrvalue = ((BaseArmor)m_Item).MaxHitPoints; } else { attrvalue = ((BaseArmor)m_Item).ArmorAttributes[GiftAttributes.m_ArmorAttributes[index].m_Attribute]; } if (attrvalue < GiftAttributes.m_ArmorAttributes[index].m_MaxValue) { ((BaseArmor)m_Item).ArmorAttributes[GiftAttributes.m_ArmorAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } else { m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributes.m_ArmorAttributes[index].m_Category, GumpPage.AttributeList)); break; } case 5: // Armor Resists Selected { cost = GetPointCost(m_Item, GiftAttributes.m_ResistanceTypes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < GiftAttributes.m_ResistanceTypes.Length) { if (GiftAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Physical) { attrvalue = ((BaseArmor)m_Item).PhysicalBonus; if (attrvalue < GiftAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)m_Item).PhysicalBonus += 1; levitem.Points -= cost; } } else if (GiftAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Fire) { attrvalue = ((BaseArmor)m_Item).FireBonus; if (attrvalue < GiftAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)m_Item).FireBonus += 1; levitem.Points -= cost; } } else if (GiftAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Cold) { attrvalue = ((BaseArmor)m_Item).ColdBonus; if (attrvalue < GiftAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)m_Item).ColdBonus += 1; levitem.Points -= cost; } } else if (GiftAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Poison) { attrvalue = ((BaseArmor)m_Item).PoisonBonus; if (attrvalue < GiftAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)m_Item).PoisonBonus += 1; levitem.Points -= cost; } } else if (GiftAttributes.m_ResistanceTypes[index].m_Attribute == ResistanceType.Energy) { attrvalue = ((BaseArmor)m_Item).EnergyBonus; if (attrvalue < GiftAttributes.m_ResistanceTypes[index].m_MaxValue) { ((BaseArmor)m_Item).EnergyBonus += 1; levitem.Points -= cost; } } else { return; } } } else { m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributes.m_ResistanceTypes[index].m_Category, GumpPage.AttributeList)); break; } case 6: // Jewelry & Clothing Resists Selected { cost = GetPointCost(m_Item, GiftAttributes.m_ElementAttributes[index].m_XP); if ((levitem.Points - cost) >= 0) { //add point to selected weapon attribute if (index >= 0 && index < GiftAttributes.m_ElementAttributes.Length) { if (m_Item is BaseJewel) { attrvalue = ((BaseJewel)m_Item).Resistances[GiftAttributes.m_ElementAttributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_ElementAttributes[index].m_MaxValue) { ((BaseJewel)m_Item).Resistances[GiftAttributes.m_ElementAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } else { attrvalue = ((BaseClothing)m_Item).Resistances[GiftAttributes.m_ElementAttributes[index].m_Attribute]; if (attrvalue < GiftAttributes.m_ElementAttributes[index].m_MaxValue) { ((BaseClothing)m_Item).Resistances[GiftAttributes.m_ElementAttributes[index].m_Attribute] += 1; levitem.Points -= cost; } } } } else { m_From.SendMessage("You don't have enough points available! This attribute costs " + cost + " points."); } m_From.SendGump(new GiftGump(m_From, m_Item, GiftAttributes.m_ElementAttributes[index].m_Category, GumpPage.AttributeList)); break; } } }