Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
using System;
using Server;
namespace Server
{
public class ImbuingContext
{
public Mobile Player { get; private set; }
public Item LastImbued { get; set; }
public int Imbue_Mod { get; set; }
public int Imbue_ModInt { get; set; }
public int Imbue_ModVal { get; set; }
public int ImbMenu_Cat { get; set; }
public int ImbMenu_ModInc { get; set; }
public int Imbue_IWmax { get; set; }
public ImbuingContext(Mobile mob)
{
Player = mob;
}
public ImbuingContext(Mobile owner, GenericReader reader)
{
int v = reader.ReadInt();
Player = owner;
LastImbued = reader.ReadItem();
Imbue_Mod = reader.ReadInt();
Imbue_ModInt = reader.ReadInt();
Imbue_ModVal = reader.ReadInt();
Imbue_IWmax = reader.ReadInt();
ImbMenu_Cat = reader.ReadInt();
ImbMenu_ModInc = reader.ReadInt();
}
public void Serialize(GenericWriter writer)
{
writer.Write((int)0);
writer.Write(LastImbued);
writer.Write(Imbue_Mod);
writer.Write(Imbue_ModInt);
writer.Write(Imbue_ModVal);
writer.Write(Imbue_IWmax);
writer.Write(ImbMenu_Cat);
writer.Write(ImbMenu_ModInc);
}
}
}

View File

@@ -0,0 +1,120 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections.Generic;
namespace Server.SkillHandlers
{
public class ImbuingDefinition
{
private object m_Attribute;
private int m_AttributeName;
private int m_Weight;
private Type m_PrimaryRes;
private Type m_GemRes;
private Type m_SpecialRes;
private int m_PrimaryName;
private int m_GemName;
private int m_SpecialName;
private int m_MaxIntensity;
private int m_IncAmount;
private int m_Description;
public object Attribute { get { return m_Attribute; } }
public int AttributeName { get { return m_AttributeName; } }
public int Weight { get { return m_Weight; } }
public Type PrimaryRes { get { return m_PrimaryRes; } }
public Type GemRes { get { return m_GemRes; } }
public Type SpecialRes { get { return m_SpecialRes; } }
public int PrimaryName { get { return m_PrimaryName; } }
public int GemName { get { return m_GemName; } }
public int SpecialName { get { return m_SpecialName; } }
public int MaxIntensity { get { return m_MaxIntensity; } }
public int IncAmount { get { return m_IncAmount; } }
public int Description { get { return m_Description; } }
public bool Melee { get; set; }
public bool Ranged { get; set; }
public bool Armor { get; set; }
public bool Shield { get; set; }
public bool Jewels { get; set; }
public ImbuingDefinition(object attribute, int attributeName, int weight, Type pRes, Type gRes, Type spRes, int mInt, int inc, int desc, bool melee = false, bool ranged = false, bool armor = false, bool shield = false, bool jewels = false)
{
m_Attribute = attribute;
m_AttributeName = attributeName;
m_Weight = weight;
m_PrimaryRes = pRes;
m_GemRes = gRes;
m_SpecialRes = spRes;
m_PrimaryName = GetLocalization(pRes);
m_GemName = GetLocalization(gRes);
m_SpecialName = GetLocalization(spRes);
m_MaxIntensity = mInt;
m_IncAmount = inc;
m_Description = desc;
Melee = melee;
Ranged = ranged;
Armor = armor;
Shield = shield;
Jewels = jewels;
}
public int GetLocalization(Type type)
{
if (type == null)
return 0;
if (type == typeof(Tourmaline)) return 1023864;
if (type == typeof(Ruby)) return 1023859;
if (type == typeof(Diamond)) return 1023878;
if (type == typeof(Sapphire)) return 1023857;
if (type == typeof(Citrine)) return 1023861;
if (type == typeof(Emerald)) return 1023856;
if (type == typeof(StarSapphire)) return 1023855;
if (type == typeof(Amethyst)) return 1023862;
if (type == typeof(RelicFragment)) return 1031699;
if (type == typeof(EnchantedEssence)) return 1031698;
if (type == typeof(MagicalResidue)) return 1031697;
if (type == typeof(DarkSapphire)) return 1032690;
if (type == typeof(Turquoise)) return 1032691;
if (type == typeof(PerfectEmerald)) return 1032692;
if (type == typeof(EcruCitrine)) return 1032693;
if (type == typeof(WhitePearl)) return 1032694;
if (type == typeof(FireRuby)) return 1032695;
if (type == typeof(BlueDiamond)) return 1032696;
if (type == typeof(BrilliantAmber)) return 1032697;
if (type == typeof(ParasiticPlant)) return 1032688;
if (type == typeof(LuminescentFungi)) return 1032689;
if (LocBuffer == null)
LocBuffer = new Dictionary<Type, int>();
if (LocBuffer.ContainsKey(type))
return LocBuffer[type];
Item item = Loot.Construct(type);
if (item != null)
{
LocBuffer[type] = item.LabelNumber;
item.Delete();
return LocBuffer[type]; ;
}
if(type != null)
Console.WriteLine("Warning, missing name cliloc for type {0}.", type.Name);
return -1;
}
public Dictionary<Type, int> LocBuffer { get; set; }
}
}

View File

@@ -0,0 +1,520 @@
using System;
using System.Linq;
using Server;
using Server.Mobiles;
using Server.Network;
using Server.Items;
using Server.SkillHandlers;
namespace Server.Gumps
{
public class ImbueGump : BaseGump
{
private const int LabelColor = 0x7FFF;
private const int IceHue = 0x481;
private const int Green = 0x41;
private const int Yellow = 0x36;
private const int DarkYellow = 0x2E;
private const int Red = 0x26;
private int m_ID, m_Value;
private Item m_Item;
private int m_TotalItemWeight;
private int m_TotalProps;
private int m_MaxWeight;
private ItemPropertyInfo m_Info;
public ImbueGump(PlayerMobile pm, Item item, int id, int value)
: base(pm, 50, 50)
{
pm.CloseGump(typeof(ImbuingGump));
pm.CloseGump(typeof(ImbueSelectGump));
pm.CloseGump(typeof(RunicReforgingGump));
m_ID = id;
m_Value = value;
m_Item = item;
}
public override void AddGumpLayout()
{
double bonus = 0.0;
if (!Imbuing.CheckSoulForge(User, 2, out bonus))
return;
ImbuingContext context = Imbuing.GetContext(User);
if (!ItemPropertyInfo.Table.ContainsKey(m_ID))
return;
m_Info = ItemPropertyInfo.Table[m_ID];
int minInt = ItemPropertyInfo.GetMinIntensity(m_Item, m_ID);
int maxInt = ItemPropertyInfo.GetMaxIntensity(m_Item, m_ID, true);
int weight = m_Info.Weight;
if (m_Value < minInt)
{
m_Value = minInt;
}
if (m_Value > maxInt)
{
m_Value = maxInt;
}
double currentIntensity = Math.Floor((m_Value / (double)maxInt) * 100);
// Set context
context.LastImbued = m_Item;
context.Imbue_Mod = m_ID;
context.Imbue_ModVal = weight;
context.ImbMenu_ModInc = ItemPropertyInfo.GetScale(m_Item, m_ID);
// Current Mod Weight
m_TotalItemWeight = Imbuing.GetTotalWeight(m_Item, m_ID, false, true);
m_TotalProps = Imbuing.GetTotalMods(m_Item, m_ID);
if (maxInt <= 1)
currentIntensity = 100;
var propWeight = (int)Math.Floor(((double)weight / (double)maxInt) * m_Value);
// Maximum allowed Property Weight & Item Mod Count
m_MaxWeight = Imbuing.GetMaxWeight(m_Item);
// Times Item has been Imbued
int timesImbued = Imbuing.TimesImbued(m_Item);
// Check Ingredients needed at the current Intensity
var gemAmount = Imbuing.GetGemAmount(m_Item, m_ID, m_Value);
var primResAmount = Imbuing.GetPrimaryAmount(m_Item, m_ID, m_Value);
var specResAmount = Imbuing.GetSpecialAmount(m_Item, m_ID, m_Value);
AddPage(0);
AddBackground(0, 0, 520, 440, 5054);
AddImageTiled(10, 10, 500, 420, 2624);
AddImageTiled(10, 30, 500, 10, 5058);
AddImageTiled(250, 40, 10, 290, 5058);
AddImageTiled(10, 180, 500, 10, 5058);
AddImageTiled(10, 330, 500, 10, 5058);
AddImageTiled(10, 400, 500, 10, 5058);
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 520, 20, 1079717, LabelColor, false, false); // <CENTER>IMBUING CONFIRMATION</CENTER>
AddHtmlLocalized(50, 50, 200, 20, 1114269, LabelColor, false, false); // PROPERTY INFORMATION
AddHtmlLocalized(25, 80, 80, 20, 1114270, LabelColor, false, false); // Property:
if (m_Info.AttributeName != null)
{
AddHtmlLocalized(95, 80, 150, 20, 1114057, m_Info.AttributeName.ToString(), LabelColor, false, false);
}
AddHtmlLocalized(25, 100, 80, 20, 1114271, LabelColor, false, false); // Replaces:
var replace = WhatReplacesWhat(m_ID, m_Item);
if (replace != null)
{
AddHtmlLocalized(95, 100, 150, 20, 1114057, replace.ToString(), LabelColor, false, false);
}
// Weight Modifier
AddHtmlLocalized(25, 120, 80, 20, 1114272, 0xFFFFFF, false, false); // Weight:
AddLabel(95, 120, IceHue, String.Format("{0}x", ((double)m_Info.Weight / 100.0).ToString("0.0")));
AddHtmlLocalized(25, 140, 80, 20, 1114273, LabelColor, false, false); // Intensity:
AddLabel(95, 140, IceHue, String.Format("{0}%", currentIntensity));
// Materials needed
AddHtmlLocalized(10, 200, 245, 20, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>
AddHtmlLocalized(40, 230, 180, 20, m_Info.PrimaryName, LabelColor, false, false);
AddLabel(210, 230, IceHue, primResAmount.ToString());
AddHtmlLocalized(40, 255, 180, 20, m_Info.GemName, LabelColor, false, false);
AddLabel(210, 255, IceHue, gemAmount.ToString());
if (specResAmount > 0)
{
AddHtmlLocalized(40, 280, 180, 17, m_Info.SpecialName, LabelColor, false, false);
AddLabel(210, 280, IceHue, specResAmount.ToString());
}
// Mod Description
AddHtmlLocalized(280, 55, 200, 110, m_Info.Description, LabelColor, false, false);
AddHtmlLocalized(350, 200, 150, 20, 1113650, LabelColor, false, false); // RESULTS
AddHtmlLocalized(280, 220, 150, 20, 1113645, LabelColor, false, false); // Properties:
AddLabel(430, 220, GetColor(m_TotalProps + 1, 5), String.Format("{0}/{1}", m_TotalProps + 1, Imbuing.GetMaxProps(m_Item)));
int projWeight = m_TotalItemWeight + propWeight;
AddHtmlLocalized(280, 240, 150, 20, 1113646, LabelColor, false, false); // Total Property Weight:
AddLabel(430, 240, GetColor(projWeight, m_MaxWeight), String.Format("{0}/{1}", projWeight, m_MaxWeight));
AddHtmlLocalized(280, 260, 150, 20, 1113647, LabelColor, false, false); // Times Imbued:
AddLabel(430, 260, GetColor(timesImbued, 20), String.Format("{0}/20", timesImbued));
// ===== CALCULATE DIFFICULTY =====
var truePropWeight = (int)(((double)propWeight / (double)weight) * 100);
var trueTotalWeight = Imbuing.GetTotalWeight(m_Item, -1, true, true);
double suc = Imbuing.GetSuccessChance(User, m_Item, trueTotalWeight, truePropWeight, bonus);
AddHtmlLocalized(300, 300, 150, 20, 1044057, 0xFFFFFF, false, false); // Success Chance:
AddLabel(420, 300, GetSuccessChanceHue(suc), String.Format("{0}%", suc.ToString("0.0")));
// - Attribute Level
if (maxInt > 1)
{
AddHtmlLocalized(235, 350, 100, 17, 1062300, LabelColor, false, false); // New Value:
if (m_ID == 41) // - Mage Weapon Value ( i.e [Mage Weapon -25] )
{
AddLabel(250, 370, IceHue, String.Format("-{0}", 30 - m_Value));
}
else if (maxInt <= 8 || m_ID == 21 || m_ID == 17) // - Show Property Value as just Number ( i.e [Mana Regen 2] )
{
AddLabel(256, 370, IceHue, String.Format("{0}", m_Value)); // - Show Property Value as % ( i.e [Hit Fireball 25%] )
}
else
{
int val = m_Value;
if (m_ID >= 51 && m_ID <= 55)
{
var resistances = Imbuing.GetBaseResists(m_Item);
switch (m_ID)
{
case 51: val += resistances[0]; break;
case 52: val += resistances[1]; break;
case 53: val += resistances[2]; break;
case 54: val += resistances[3]; break;
case 55: val += resistances[4]; break;
}
}
AddLabel(256, 370, IceHue, String.Format("{0}%", val));
}
// Buttons
AddButton(179, 372, 0x1464, 0x1464, 10053, GumpButtonType.Reply, 0);
AddButton(187, 372, 0x1466, 0x1466, 10053, GumpButtonType.Reply, 0);
AddButton(199, 372, 0x1464, 0x1464, 10052, GumpButtonType.Reply, 0);
AddButton(207, 372, 0x1466, 0x1466, 10052, GumpButtonType.Reply, 0);
AddButton(221, 372, 0x1464, 0x1464, 10051, GumpButtonType.Reply, 0);
AddButton(229, 372, 0x1466, 0x1466, 10051, GumpButtonType.Reply, 0);
AddButton(280, 372, 0x1464, 0x1464, 10054, GumpButtonType.Reply, 0);
AddButton(288, 372, 0x1466, 0x1466, 10054, GumpButtonType.Reply, 0);
AddButton(300, 372, 0x1464, 0x1464, 10055, GumpButtonType.Reply, 0);
AddButton(308, 372, 0x1466, 0x1466, 10055, GumpButtonType.Reply, 0);
AddButton(320, 372, 0x1464, 0x1464, 10056, GumpButtonType.Reply, 0);
AddButton(328, 372, 0x1466, 0x1466, 10056, GumpButtonType.Reply, 0);
AddLabel(322, 370, 0, ">");
AddLabel(326, 370, 0, ">");
AddLabel(330, 370, 0, ">");
AddLabel(304, 370, 0, ">");
AddLabel(308, 370, 0, ">");
AddLabel(286, 370, 0, ">");
AddLabel(226, 370, 0, "<");
AddLabel(203, 370, 0, "<");
AddLabel(207, 370, 0, "<");
AddLabel(181, 370, 0, "<");
AddLabel(185, 370, 0, "<");
AddLabel(189, 370, 0, "<");
}
AddButton(15, 410, 4005, 4007, 10099, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 410, 100, 18, 1114268, LabelColor, false, false); // Back
AddButton(390, 410, 4005, 4007, 10100, GumpButtonType.Reply, 0);
AddHtmlLocalized(425, 410, 120, 18, 1114267, LabelColor, false, false); // Imbue Item
}
private int GetColor(int value, int limit)
{
if (value < limit)
return Green;
else if (value == limit)
return Yellow;
else
return Red;
}
private int GetSuccessChanceHue(double suc)
{
if (suc >= 100)
return IceHue;
else if (suc >= 80)
return Green;
else if (suc >= 50)
return Yellow;
else if (suc >= 10)
return DarkYellow;
else
return Red;
}
public override void OnResponse(RelayInfo info)
{
ImbuingContext context = Imbuing.GetContext(User);
switch (info.ButtonID)
{
case 0: //Close
{
User.EndAction(typeof(Imbuing));
break;
}
case 10051: // Decrease Mod Value [<]
{
m_Value = Math.Max(ItemPropertyInfo.GetMinIntensity(m_Item, m_Info.ID), m_Value - 1);
Refresh();
break;
}
case 10052:// Decrease Mod Value [<<]
{
m_Value = Math.Max(ItemPropertyInfo.GetMinIntensity(m_Item, m_Info.ID), m_Value - 10);
Refresh();
break;
}
case 10053:// Minimum Mod Value [<<<]
{
m_Value = ItemPropertyInfo.GetMinIntensity(m_Item, m_Info.ID);
Refresh();
break;
}
case 10054: // Increase Mod Value [>]
{
m_Value = Math.Min(ItemPropertyInfo.GetMaxIntensity(m_Item, m_Info.ID, true), m_Value + 1);
Refresh();
break;
}
case 10055: // Increase Mod Value [>>]
{
m_Value = Math.Min(ItemPropertyInfo.GetMaxIntensity(m_Item, m_Info.ID, true), m_Value + 10);
Refresh();
break;
}
case 10056: // Maximum Mod Value [>>>]
{
m_Value = ItemPropertyInfo.GetMaxIntensity(m_Item, m_Info.ID, true);
Refresh();
break;
}
case 10099: // Back
{
BaseGump.SendGump(new ImbueSelectGump(User, context.LastImbued));
break;
}
case 10100: // Imbue the Item
{
context.Imbue_IWmax = m_MaxWeight;
if (Imbuing.OnBeforeImbue(User, m_Item, m_ID, m_Value, m_TotalProps, Imbuing.GetMaxProps(m_Item), m_TotalItemWeight, m_MaxWeight))
{
Imbuing.TryImbueItem(User, m_Item, m_ID, m_Value);
SendGumpDelayed(User);
}
break;
}
}
}
public static void SendGumpDelayed(PlayerMobile pm)
{
Timer.DelayCall(TimeSpan.FromSeconds(1.5), () =>
{
BaseGump.SendGump(new ImbuingGump(pm));
});
}
// =========== Check if Choosen Attribute Replaces Another =================
public static TextDefinition WhatReplacesWhat(int id, Item item)
{
if (Imbuing.GetValueForID(item, id) > 0)
{
return ItemPropertyInfo.GetAttributeName(id);
}
if (item is BaseWeapon)
{
BaseWeapon i = item as BaseWeapon;
// Slayers replace Slayers
if (id >= 101 && id <= 127)
{
if (i.Slayer != SlayerName.None)
return GetNameForAttribute(i.Slayer);
if (i.Slayer2 != SlayerName.None)
return GetNameForAttribute(i.Slayer2);
}
// OnHitEffect replace OnHitEffect
if (id >= 35 && id <= 39)
{
if (i.WeaponAttributes.HitMagicArrow > 0)
return GetNameForAttribute(AosWeaponAttribute.HitMagicArrow);
else if (i.WeaponAttributes.HitHarm > 0)
return GetNameForAttribute(AosWeaponAttribute.HitHarm);
else if (i.WeaponAttributes.HitFireball > 0)
return GetNameForAttribute(AosWeaponAttribute.HitFireball);
else if (i.WeaponAttributes.HitLightning > 0)
return GetNameForAttribute(AosWeaponAttribute.HitLightning);
else if (i.WeaponAttributes.HitDispel > 0)
return GetNameForAttribute(AosWeaponAttribute.HitDispel);
}
// OnHitArea replace OnHitArea
if (id >= 30 && id <= 34)
{
if (i.WeaponAttributes.HitPhysicalArea > 0)
return GetNameForAttribute(AosWeaponAttribute.HitPhysicalArea);
else if (i.WeaponAttributes.HitColdArea > 0)
return GetNameForAttribute(AosWeaponAttribute.HitFireArea);
else if (i.WeaponAttributes.HitFireArea > 0)
return GetNameForAttribute(AosWeaponAttribute.HitColdArea);
else if (i.WeaponAttributes.HitPoisonArea > 0)
return GetNameForAttribute(AosWeaponAttribute.HitPoisonArea);
else if (i.WeaponAttributes.HitEnergyArea > 0)
return GetNameForAttribute(AosWeaponAttribute.HitEnergyArea);
}
}
if (item is BaseJewel)
{
BaseJewel jewel = item as BaseJewel;
if (id >= 151 && id <= 183)
{
var bonuses = jewel.SkillBonuses;
var group = Imbuing.GetSkillGroup((SkillName)ItemPropertyInfo.GetAttribute(id));
for (int i = 0; i < 5; i++)
{
if (bonuses.GetBonus(i) > 0 && group.Any(sk => sk == bonuses.GetSkill(i)))
{
return GetNameForAttribute(bonuses.GetSkill(i));
}
}
}
// SkillGroup1 replace SkillGroup1
/*if (id >= 151 && id <= 155)
{
if (i.SkillBonuses.GetBonus(0) > 0)
{
foreach (SkillName sk in Imbuing.PossibleSkills)
{
if (i.SkillBonuses.GetSkill(0) == sk)
return GetNameForAttribute(sk);
}
}
}
// SkillGroup2 replace SkillGroup2
if (id >= 156 && id <= 160)
{
if (i.SkillBonuses.GetBonus(1) > 0)
{
foreach (SkillName sk in Imbuing.PossibleSkills)
{
if (i.SkillBonuses.GetSkill(1) == sk)
return GetNameForAttribute(sk);
}
}
}
// SkillGroup3 replace SkillGroup3
if (id >= 161 && id <= 166)
{
if (i.SkillBonuses.GetBonus(2) > 0)
{
foreach (SkillName sk in Imbuing.PossibleSkills)
{
if (i.SkillBonuses.GetSkill(2) == sk)
return GetNameForAttribute(sk);
}
}
}
// SkillGroup4 replace SkillGroup4
if (id >= 167 && id <= 172)
{
if (i.SkillBonuses.GetBonus(3) > 0)
{
foreach (SkillName sk in Imbuing.PossibleSkills)
{
if (i.SkillBonuses.GetSkill(3) == sk)
return GetNameForAttribute(sk);
}
}
}
// SkillGroup5 replace SkillGroup5
if (id >= 173 && id <= 178)
{
if (i.SkillBonuses.GetBonus(4) > 0)
{
foreach (SkillName sk in Imbuing.PossibleSkills)
{
if (i.SkillBonuses.GetSkill(4) == sk)
return GetNameForAttribute(sk);
}
}
}*/
}
return null;
}
public static TextDefinition GetNameForAttribute(object attribute)
{
if (attribute is AosArmorAttribute && (AosArmorAttribute)attribute == AosArmorAttribute.LowerStatReq)
attribute = AosWeaponAttribute.LowerStatReq;
if (attribute is AosArmorAttribute && (AosArmorAttribute)attribute == AosArmorAttribute.DurabilityBonus)
attribute = AosWeaponAttribute.DurabilityBonus;
foreach (var info in ItemPropertyInfo.Table.Values)
{
if (attribute is SlayerName && info.Attribute is SlayerName && (SlayerName)attribute == (SlayerName)info.Attribute)
return info.AttributeName;
if (attribute is AosAttribute && info.Attribute is AosAttribute && (AosAttribute)attribute == (AosAttribute)info.Attribute)
return info.AttributeName;
if (attribute is AosWeaponAttribute && info.Attribute is AosWeaponAttribute && (AosWeaponAttribute)attribute == (AosWeaponAttribute)info.Attribute)
return info.AttributeName;
if (attribute is SkillName && info.Attribute is SkillName && (SkillName)attribute == (SkillName)info.Attribute)
return info.AttributeName;
if (info.Attribute == attribute)
return info.AttributeName;
}
return null;
}
}
}

View File

@@ -0,0 +1,843 @@
using System;
using Server;
using Server.Mobiles;
using Server.Network;
using Server.Items;
using Server.SkillHandlers;
namespace Server.Gumps
{
public class ImbueSelectGump : BaseGump
{
public Item m_Item;
private const int LabelColor = 0x7FFF;
public ImbueSelectGump(PlayerMobile pm, Item item)
: base(pm, 50, 50)
{
pm.CloseGump(typeof(ImbuingGump));
pm.CloseGump(typeof(ImbueGump));
m_Item = item;
}
public override void AddGumpLayout()
{
// SoulForge Check
if (!Imbuing.CheckSoulForge(User, 2))
return;
ImbuingContext context = Imbuing.GetContext(User);
context.LastImbued = m_Item;
var itemType = ItemPropertyInfo.GetItemType(m_Item);
bool twoHanded = m_Item.Layer == Layer.TwoHanded;
AddPage(0);
AddBackground(0, 0, 520, 520, 5054);
AddImageTiled(10, 10, 500, 500, 2624);
AddImageTiled(10, 30, 500, 10, 5058);
AddImageTiled(230, 40, 10, 440, 5058);
AddImageTiled(10, 480, 500, 10, 5058);
AddAlphaRegion(10, 10, 520, 500);
AddHtmlLocalized(10, 12, 520, 20, 1079588, LabelColor, false, false); //IMBING MENU
int yOffset = 0;
// ===== Attribute Catagories ========================================
AddHtmlLocalized(10, 60, 220, 20, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
AddHtmlLocalized(240, 60, 270, 20, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10001, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114248, LabelColor, false, false); //Casting
yOffset += 1;
int itemRef = (int)itemType;
if (itemRef == 1 || itemRef == 2 || itemRef == 4 || itemRef == 6)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10002, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114249, LabelColor, false, false); //Combat
yOffset += 1;
}
if (itemRef == 1 || itemRef == 2)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10006, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114250, LabelColor, false, false); //Hit Area Effects
yOffset += 1;
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10007, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114251, LabelColor, false, false); //Hit Effects
yOffset += 1;
}
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10003, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114252, LabelColor, false, false); //Misc.
yOffset += 1;
if (itemRef == 2)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10015, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114253, LabelColor, false, false); //Ranged
yOffset += 1;
}
if (itemRef == 1 || itemRef == 2 || itemRef == 3 || itemRef == 5 || itemRef == 6)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10004, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114254, LabelColor, false, false); //Resists
yOffset += 1;
}
if (itemRef == 1 || itemRef == 2)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10008, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114263, LabelColor, false, false); //Slayers
yOffset += 1;
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10009, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114264, LabelColor, false, false); //Super Slayers
yOffset += 1;
}
if (itemRef == 6)
{
for (int i = 0; i < 5; i++)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10010 + i, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114255 + i, LabelColor, false, false); //Skill Group 1
yOffset += 1;
}
}
if (itemRef == 3 || itemRef == 5 || itemRef == 6)
{
AddButton(15, 90 + (yOffset * 25), 4005, 4007, 10005, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90 + (yOffset * 25), 150, 18, 1114262, LabelColor, false, false); //Stats
yOffset += 1;
}
// ===== Attribute Catagories ========================================
yOffset = 0;
int menuCat = context.ImbMenu_Cat;
if (menuCat == 1) // == CASTING ==
{
if (itemRef == 1 || itemRef == 2)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10122, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079766, LabelColor, false, false); //Spell Channeling
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10141, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079759, LabelColor, false, false); //Mage Weapon
yOffset += 1;
if (m_Item is BaseWeapon && (((BaseWeapon)m_Item).Attributes.SpellChanneling == 0 || ((BaseWeapon)m_Item).Attributes.CastSpeed < 0))
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10116, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075617, LabelColor, false, false); //Faster Casting
yOffset += 1;
}
}
else if (itemRef == 3 || itemRef == 5)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10118, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075625, LabelColor, false, false); //Lower Reg Cost
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10117, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075621, LabelColor, false, false); //Lower Mana Cost
yOffset += 1;
}
else if (itemRef == 4)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10122, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079766, LabelColor, false, false); //Spell Channeling
yOffset += 1;
if (m_Item is BaseShield && (((BaseShield)m_Item).Attributes.SpellChanneling == 0 || ((BaseShield)m_Item).Attributes.CastSpeed < 0))
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10116, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075617, LabelColor, false, false); //Faster Casting
yOffset += 1;
}
}
else if (itemRef == 6)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10114, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075628, LabelColor, false, false); //Spell Damage Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10118, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075625, LabelColor, false, false); //Lower Reg Cost
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10117, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075621, LabelColor, false, false); //Lower Mana Cost
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10116, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075617, LabelColor, false, false); //Faster Casting
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10115, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075618, LabelColor, false, false); //Faster Cast Recovery
yOffset += 1;
}
}
else if (menuCat == 2) // == COMBAT ==
{
if (itemRef == 1)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10112, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079399, LabelColor, false, false); //Damage Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10113, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075629, LabelColor, false, false); //Swing Speed Increase
yOffset += 1;
if (twoHanded)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10161, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1072792, LabelColor, false, false); //Balanced
yOffset += 1;
}
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10102, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075616, LabelColor, false, false); //Hit Chance Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10101, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075620, LabelColor, false, false); //Defense Chance Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10140, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079592, LabelColor, false, false); //Use Best Weapon Skill
yOffset += 1;
}
else if (itemRef == 2)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10112, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079399, LabelColor, false, false); //Damage Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10113, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075629, LabelColor, false, false); //Swing Speed Increase
yOffset += 1;
}
else if (itemRef == 4)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10101, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075620, LabelColor, false, false); //Defense Chance Increase
yOffset += 1;
}
else if (itemRef == 6)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10112, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079399, LabelColor, false, false); //Damage Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10102, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075616, LabelColor, false, false); //Hit Chance Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10101, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075620, LabelColor, false, false); //Defense Chance Increase
yOffset += 1;
}
}
else if (menuCat == 3) // == MISC ==
{
if (itemRef == 1 || itemRef == 2)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10121, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061153, LabelColor, false, false); //Luck
yOffset += 1;
}
else if (itemRef == 3 || itemRef == 5)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10119, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075626, LabelColor, false, false); //Reflect Physical Damage
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10123, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1015168, LabelColor, false, false); //Night Sight
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10121, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061153, LabelColor, false, false); //Luck
yOffset += 1;
}
else if (itemRef == 4)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10119, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075626, LabelColor, false, false); //Reflect Physical Damage
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10124, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079757, LabelColor, false, false); //Lower Requirements
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10142, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1017323, LabelColor, false, false); //Durability
yOffset += 1;
}
else if (itemRef == 6)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10123, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1015168, LabelColor, false, false); //Night Sight
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10121, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061153, LabelColor, false, false); //Luck
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10120, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075624, LabelColor, false, false); //Enhance Potions
yOffset += 1;
}
}
else if (menuCat == 15) // == Ranged ==
{
if (itemRef == 2)
{
if (twoHanded)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10160, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1080416, LabelColor, false, false); //Velocity
yOffset += 1;
}
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10102, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075616, LabelColor, false, false); //Hit Chance Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10101, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075620, LabelColor, false, false); //Defense Chance Increase
yOffset += 1;
if (twoHanded)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10161, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1072792, LabelColor, false, false); //Balanced
yOffset += 1;
}
}
}
else if (menuCat == 4) // == RESISTS ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10154, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061161, LabelColor, false, false); //Poison Resist
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10151, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061158, LabelColor, false, false); //Physcial Resist
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10152, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061159, LabelColor, false, false); //Fire Resist
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10155, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061162, LabelColor, false, false); //Energy Resist
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10153, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061160, LabelColor, false, false); //Cold Resist
yOffset += 1;
}
else if (menuCat == 5) // == STATS ==
{
if (itemRef == 3 || itemRef == 5)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10110, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075632, LabelColor, false, false); //Stamina Increase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10103, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075627, LabelColor, false, false); //Hit Points Regeneration
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10104, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079411, LabelColor, false, false); //Stamina Regeneration
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10105, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079410, LabelColor, false, false); //Mana Regeneration
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10111, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075631, LabelColor, false, false); //Mana Increaase
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10109, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1075630, LabelColor, false, false); //Hit Point Increase
yOffset += 1;
}
else if (itemRef == 6)
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10106, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079767, LabelColor, false, false); //Strength Bonus
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10108, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079756, LabelColor, false, false); //Intelligence Bonus
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10107, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079732, LabelColor, false, false); //Dexterity Bonus
yOffset += 1;
}
}
else if (menuCat == 6) // == HIT AREA EFFECTS ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10133, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079697, LabelColor, false, false); //Hit Poison Area
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10130, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079696, LabelColor, false, false); //Hit Physical Area
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10131, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079695, LabelColor, false, false); //Hit Fire Area
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10134, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079694, LabelColor, false, false); //Hit Energy Area
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10132, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079693, LabelColor, false, false); //Hit Cold Area
yOffset += 1;
}
else if (menuCat == 7) // == ON HIT EFFECTS ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10126, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079707, LabelColor, false, false); // Hit Stam Leech
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10127, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079701, LabelColor, false, false); //Hit Mana Leech
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10135, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079706, LabelColor, false, false); //Hit Magic Arrow
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10129, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079700, LabelColor, false, false); //Hit Lower Defense
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10128, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079699, LabelColor, false, false); //Hit Lower Attack
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10138, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079705, LabelColor, false, false); //Hit Lightning
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10125, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079698, LabelColor, false, false); //Hit Life Leeach
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10136, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079704, LabelColor, false, false); //Hit Harm
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10137, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079703, LabelColor, false, false); //Hit Fireball
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10139, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079702, LabelColor, false, false); //Hit Dispel
yOffset += 1;
}
else if (menuCat == 8) // == SLAYERS ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10215, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079755, LabelColor, false, false); //Water Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10202, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079754, LabelColor, false, false); //Troll Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10205, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079753, LabelColor, false, false); //Terathan Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10212, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079746, LabelColor, false, false); //Spider Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10220, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079745, LabelColor, false, false); //Snow Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10206, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079744, LabelColor, false, false); //Snake Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10213, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079743, LabelColor, false, false); //Scorpion Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10217, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079742, LabelColor, false, false); //Poison Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10201, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079741, LabelColor, false, false); //Orc Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10211, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079740, LabelColor, false, false); //Ophidian Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10203, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079739, LabelColor, false, false); //Ogre Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10207, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079738, LabelColor, false, false); //Lizardman Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10208, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079737, LabelColor, false, false); //Gargoyle Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10214, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079736, LabelColor, false, false); //Fire Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10218, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079735, LabelColor, false, false); //Earth Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10204, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1061284, LabelColor, false, false); //Dragon Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10219, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079734, LabelColor, false, false); //Blood Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10216, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079733, LabelColor, false, false); //Air Elemental Slayer
yOffset += 1;
}
else if (menuCat == 9) // == SUPER SLAYERS ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10221, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079752, LabelColor, false, false); //Undead Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10223, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079751, LabelColor, false, false); //Reptile Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10222, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079750, LabelColor, false, false); //Repond Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10227, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1154652, LabelColor, false, false); //Fey Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10226, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079749, LabelColor, false, false); //Elemental Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10224, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079748, LabelColor, false, false); //Demon Slayer
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10225, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1079747, LabelColor, false, false); //Arachnid Slayer
yOffset += 1;
}
else if (menuCat == 10) // == SKILL GROUP 1 ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10251, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044102, LabelColor, false, false); //Fencing
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10252, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044101, LabelColor, false, false); //Mace Fighting
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10253, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044100, LabelColor, false, false); //Swordsmanship
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10254, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044089, LabelColor, false, false); //Musicianship
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10255, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044085, LabelColor, false, false); //Magery
yOffset += 1;
}
else if (menuCat == 11) // == SKILL GROUP 2 ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10256, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044103, LabelColor, false, false); //Wrestling
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10257, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044095, LabelColor, false, false); //Animal Taming
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10258, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044092, LabelColor, false, false); //Spirit Speak
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10259, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044087, LabelColor, false, false); //Tactics
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10260, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044082, LabelColor, false, false); //Provocation
yOffset += 1;
}
else if (menuCat == 12) // == SKILL GROUP 3 ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10261, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044110, LabelColor, false, false); //Focus
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10262, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044065, LabelColor, false, false); //Parrying
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10263, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044107, LabelColor, false, false); //Stealth
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10264, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044106, LabelColor, false, false); //Meditation
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10265, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044062, LabelColor, false, false); //Animal Lore
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10266, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044075, LabelColor, false, false); //Discordance
yOffset += 1;
}
else if (menuCat == 13) // == SKILL GROUP 4 ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10267, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044115, LabelColor, false, false); //Mysticism
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10268, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044112, LabelColor, false, false); //Bushido
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10269, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044109, LabelColor, false, false); //Necromancy
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10270, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044099, LabelColor, false, false); //Veterinary
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10271, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044093, LabelColor, false, false); //Stealing
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10272, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044076, LabelColor, false, false); //Eval Intelligence
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10273, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044061, LabelColor, false, false); //Anatomy
yOffset += 1;
}
else if (menuCat == 14) // == SKILL GROUP 5 ==
{
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10274, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044069, LabelColor, false, false); //Peacemaking
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10280, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044117, LabelColor, false, false); //Throwing
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10275, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044113, LabelColor, false, false); //Ninjitsu
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10276, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044111, LabelColor, false, false); //Chivalary
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10277, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044091, LabelColor, false, false); //Archery
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10278, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044086, LabelColor, false, false); //Resist Spells
yOffset += 1;
AddButton(250, 90 + (yOffset * 20), 4005, 4007, 10279, GumpButtonType.Reply, 0);
AddHtmlLocalized(295, 90 + (yOffset * 20), 150, 18, 1044077, LabelColor, false, false); //Healing
yOffset += 1;
}
AddButton(15, 490, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 490, 150, 20, 1011012, LabelColor, false, false); //Cancel
}
public override void OnResponse(RelayInfo info)
{
ImbuingContext context = Imbuing.GetContext(User);
switch (info.ButtonID)
{
case 0: // Close/Cancel
case 1:
{
User.EndAction(typeof(Imbuing));
break;
}
case 10001:
{
context.ImbMenu_Cat = 1;
Refresh();
break;
}
case 10002:
{
context.ImbMenu_Cat = 2;
Refresh();
break;
}
case 10003:
{
context.ImbMenu_Cat = 3;
Refresh();
break;
}
case 10004:
{
context.ImbMenu_Cat = 4;
Refresh();
break;
}
case 10005:
{
context.ImbMenu_Cat = 5;
Refresh();
break;
}
case 10006:
{
context.ImbMenu_Cat = 6;
Refresh();
break;
}
case 10007:
{
context.ImbMenu_Cat = 7;
Refresh();
break;
}
case 10008:
{
context.ImbMenu_Cat = 8;
Refresh();
break;
}
case 10009:
{
context.ImbMenu_Cat = 9;
Refresh();
break;
}
case 10010:
{
context.ImbMenu_Cat = 10;
Refresh();
break;
}
case 10011:
{
context.ImbMenu_Cat = 11;
Refresh();
break;
}
case 10012:
{
context.ImbMenu_Cat = 12;
Refresh();
break;
}
case 10013:
{
context.ImbMenu_Cat = 13;
Refresh();
break;
}
case 10014:
{
context.ImbMenu_Cat = 14;
Refresh();
break;
}
case 10015:
{
context.ImbMenu_Cat = 15;
Refresh();
break;
}
default: // = Proceed to Attribute Intensity Menu [ImbuingC.cs]
{
int id = info.ButtonID - 10100;
// Converts AosElementalAttribute (used as elemental damage on weapons) to WeaponAttributes Elemental resists
if (m_Item is BaseWeapon && id >= 51 && id <= 55)
{
id += 182;
}
context.Imbue_Mod = id;
if (Imbuing.OnBeforeImbue(User, context.LastImbued, id, -1))
{
BaseGump.SendGump(new ImbueGump(User, context.LastImbued, id, -1));
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,466 @@
using System;
using Server.Mobiles;
using Server.Network;
using Server.Items;
using System.Collections.Generic;
using Server.Targeting;
using Server.SkillHandlers;
using System.Linq;
namespace Server.Gumps
{
public class ImbuingGump : BaseGump
{
private const int LabelColor = 0x7FFF;
public ImbuingGump(PlayerMobile pm)
: base(pm, 25, 50)
{
User.CloseGump(typeof(ImbueSelectGump));
User.CloseGump(typeof(ImbueGump));
}
public override void AddGumpLayout()
{
ImbuingContext context = Imbuing.GetContext(User);
context.Imbue_ModVal = 0;
context.ImbMenu_Cat = 0;
AddPage(0);
AddBackground(0, 0, 520, 310, 5054);
AddImageTiled(10, 10, 500, 290, 2624);
AddImageTiled(10, 30, 500, 10, 5058);
AddImageTiled(10, 270, 500, 10, 5058);
AddAlphaRegion(10, 10, 520, 310);
AddHtmlLocalized(10, 12, 520, 20, 1079588, LabelColor, false, false); //<CENTER>IMBUING MENU</CENTER>
AddButton(15, 60, 4005, 4007, 10005, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 60, 430, 20, 1080432, LabelColor, false, false); //Imbue Item - Adds or modifies an item property on an item
AddButton(15, 90, 4005, 4007, 10006, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 90, 430, 20, 1113622, LabelColor, false, false); //Reimbue Last - Repeats the last imbuing attempt
AddButton(15, 120, 4005, 4007, 10007, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 120, 430, 20, 1113571, LabelColor, false, false); //Imbue Last Item - Auto targets the last imbued item
AddButton(15, 150, 4005, 4007, 10008, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 150, 430, 20, 1114274, LabelColor, false, false); //Imbue Last Property - Imbues a new item with the last property
AddButton(15, 180, 4005, 4007, 10010, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 180, 470, 20, 1080431, LabelColor, false, false); //Unravel Item - Extracts magical ingredients User an item, destroying it
AddButton(15, 210, 4005, 4007, 10011, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 210, 430, 20, 1114275, LabelColor, false, false); //Unravel Container - Unravels all items in a container
AddButton(15, 280, 4017, 4019, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(50, 280, 50, 20, 1011012, LabelColor, false, false); //CANCEL
}
public override void OnResponse(RelayInfo info)
{
ImbuingContext context = Imbuing.GetContext(User);
switch (info.ButtonID)
{
case 0: // Close
case 1:
{
User.EndAction(typeof(Imbuing));
break;
}
case 10005: // Imbue Item
{
User.SendLocalizedMessage(1079589); //Target an item you wish to imbue.
User.Target = new ImbueItemTarget();
User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));
break;
}
case 10006: // Reimbue Last
{
Item item = context.LastImbued;
int mod = context.Imbue_Mod;
int modint = context.Imbue_ModInt;
if (item == null || mod < 0 || modint == 0)
{
User.SendLocalizedMessage(1113572); // You haven't imbued anything yet!
User.EndAction(typeof(Imbuing));
break;
}
if (Imbuing.CanImbueItem(User, item) && Imbuing.OnBeforeImbue(User, item, mod, modint))
{
Imbuing.TryImbueItem(User, item, mod, modint);
ImbueGump.SendGumpDelayed(User);
}
break;
}
case 10007: // Imbue Last Item
{
Item item = context.LastImbued;
int mod = context.Imbue_Mod;
int modint = context.Imbue_ModInt;
if (context.LastImbued == null)
{
User.SendLocalizedMessage(1113572); // You haven't imbued anything yet!
User.EndAction(typeof(Imbuing));
break;
}
else
{
ImbueStep1(User, item);
}
break;
}
case 10008: // Imbue Last Property
{
context.LastImbued = null;
int mod = context.Imbue_Mod;
int modint = context.Imbue_ModInt;
if (modint < 0)
modint = 0;
if (mod < 0)
{
User.SendLocalizedMessage(1113572); // You haven't imbued anything yet!
User.EndAction(typeof(Imbuing));
break;
}
else
{
ImbueLastProp(User, mod, modint);
}
break;
}
case 10010: // Unravel Item
{
User.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.
User.Target = new UnravelTarget();
User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));
break;
}
case 10011: // Unravel Container
{
User.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel.
User.Target = new UnravelContainerTarget();
User.Target.BeginTimeout(User, TimeSpan.FromSeconds(10.0));
break;
}
}
return;
}
private class UnravelTarget : Target
{
public UnravelTarget()
: base(-1, false, TargetFlags.None)
{
AllowNonlocal = true;
}
protected override void OnTarget(Mobile m, object o)
{
m.EndAction(typeof(Imbuing));
Item item = o as Item;
if (item == null)
{
m.SendLocalizedMessage(1080425); // You cannot magically unravel this item.
}
else if (m is PlayerMobile && Imbuing.CanUnravelItem(m, item))
{
m.BeginAction(typeof(Imbuing));
BaseGump.SendGump(new UnravelGump((PlayerMobile)m, item));
}
}
protected override void OnTargetCancel(Mobile User, TargetCancelType cancelType)
{
User.EndAction(typeof(Imbuing));
}
private class UnravelGump : BaseGump
{
private Item m_Item;
public UnravelGump(PlayerMobile pm, Item item)
: base(pm, 60, 36)
{
m_Item = item;
}
public override void AddGumpLayout()
{
AddPage(0);
AddBackground(0, 0, 520, 245, 5054);
AddImageTiled(10, 10, 500, 225, 2624);
AddImageTiled(10, 30, 500, 10, 5058);
AddImageTiled(10, 202, 500, 10, 5058);
AddAlphaRegion(10, 10, 500, 225);
AddHtmlLocalized(10, 12, 520, 20, 1112402, LabelColor, false, false); // <CENTER>UNRAVEL MAGIC ITEM CONFIRMATION</CENTER>
AddHtmlLocalized(15, 58, 490, 113, 1112403, true, true); // WARNING! You have targeted an item made out of special material.<BR><BR>This item will be DESTROYED.<BR><BR>Are you sure you wish to unravel this item?
AddButton(10, 180, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 180, 430, 20, 1114292, LabelColor, false, false); // Unravel Item
AddButton(10, 212, 4017, 4019, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 212, 50, 20, 1011012, LabelColor, false, false); // CANCEL
}
public override void OnResponse(RelayInfo info)
{
User.EndAction(typeof(Imbuing));
if (info.ButtonID == 0 || m_Item.Deleted)
return;
if (Imbuing.CanUnravelItem(User, m_Item) && Imbuing.UnravelItem(User, m_Item))
{
Effects.SendPacket(User, User.Map, new GraphicalEffect(EffectType.FixedFrom, User.Serial, Server.Serial.Zero, 0x375A, User.Location, User.Location, 1, 17, true, false));
User.PlaySound(0x1EB);
User.SendLocalizedMessage(1080429); // You magically unravel the item!
User.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
}
}
}
}
private class UnravelContainerTarget : Target
{
public UnravelContainerTarget() : base(-1, false, TargetFlags.None)
{
}
protected override void OnTarget(Mobile m, object o)
{
m.EndAction(typeof(Imbuing));
Container cont = o as Container;
if (cont == null)
return;
if (!cont.IsChildOf(m.Backpack))
{
m.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
m.EndAction(typeof(Imbuing));
}
else if (cont == null || (cont is LockableContainer && ((LockableContainer)cont).Locked))
{
m.SendLocalizedMessage(1111814, "0\t0"); // Unraveled: ~1_COUNT~/~2_NUM~ items
m.EndAction(typeof(Imbuing));
}
else if (m is PlayerMobile)
{
bool unraveled = cont.Items.FirstOrDefault(x => Imbuing.CanUnravelItem(m, x, false)) != null;
if (unraveled)
{
m.BeginAction(typeof(Imbuing));
BaseGump.SendGump(new UnravelContainerGump((PlayerMobile)m, cont));
}
else
{
TryUnravelContainer(m, cont);
m.EndAction(typeof(Imbuing));
}
}
}
protected override void OnTargetCancel(Mobile User, TargetCancelType cancelType)
{
User.EndAction(typeof(Imbuing));
}
public static void TryUnravelContainer(Mobile User, Container c)
{
c.Items.ForEach(y =>
{
Imbuing.CanUnravelItem(User, y, true);
});
User.SendLocalizedMessage(1111814, String.Format("{0}\t{1}", 0, c.Items.Count)); // Unraveled: ~1_COUNT~/~2_NUM~ items
}
private class UnravelContainerGump : BaseGump
{
private Container m_Container;
private List<Item> m_List;
public UnravelContainerGump(PlayerMobile pm, Container c)
: base(pm, 25, 50)
{
m_Container = c;
m_List = new List<Item>(c.Items);
}
public override void AddGumpLayout()
{
AddPage(0);
AddBackground(0, 0, 520, 245, 5054);
AddImageTiled(10, 10, 500, 225, 2624);
AddImageTiled(10, 30, 500, 10, 5058);
AddImageTiled(10, 202, 500, 10, 5058);
AddAlphaRegion(10, 10, 500, 225);
AddHtmlLocalized(10, 12, 520, 20, 1112402, LabelColor, false, false); // <CENTER>UNRAVEL MAGIC ITEM CONFIRMATION</CENTER>
AddHtmlLocalized(15, 58, 490, 113, 1112404, true, true); // WARNING! The selected container contains items made with a special material.<BR><BR>These items will be DESTROYED.<BR><BR>Do you wish to unravel these items as well?
AddButton(10, 180, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 180, 430, 20, 1049717, LabelColor, false, false); // YES
AddButton(10, 212, 4017, 4019, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 212, 50, 20, 1049718, LabelColor, false, false); // NO
}
public override void OnResponse(RelayInfo info)
{
User.EndAction(typeof(Imbuing));
if (m_Container == null || m_List == null)
return;
if (info.ButtonID == 0)
{
TryUnravelContainer(User, m_Container);
return;
}
int count = 0;
m_List.ForEach(x =>
{
if (Imbuing.CanUnravelItem(User, x, true) && Imbuing.UnravelItem(User, x, true))
{
count++;
}
});
if (count > 0)
{
User.SendLocalizedMessage(1080429); // You magically unravel the item!
User.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
}
User.SendLocalizedMessage(1111814, String.Format("{0}\t{1}", count, m_List.Count));
ColUtility.Free(m_List);
}
}
}
private class ImbueItemTarget : Target
{
public ImbueItemTarget()
: base(-1, false, TargetFlags.None)
{
AllowNonlocal = true;
}
protected override void OnTarget(Mobile m, object o)
{
Item item = o as Item;
if (item == null)
{
m.SendLocalizedMessage(1079576); // You cannot imbue this item.
return;
}
ImbuingContext context = Imbuing.GetContext(m);
var itemType = ItemPropertyInfo.GetItemType(item);
if (itemType == ItemType.Invalid)
{
m.SendLocalizedMessage(1079576); // You cannot imbue this item.
return;
}
ImbueStep1(m, item);
}
protected override void OnTargetCancel(Mobile m, TargetCancelType cancelType)
{
m.EndAction(typeof(Imbuing));
}
}
public static void ImbueStep1(Mobile m, Item item)
{
if (m is PlayerMobile && Imbuing.CanImbueItem(m, item))
{
ImbuingContext context = Imbuing.GetContext(m);
context.LastImbued = item;
if (context.ImbMenu_Cat == 0)
context.ImbMenu_Cat = 1;
m.CloseGump(typeof(ImbuingGump));
BaseGump.SendGump(new ImbueSelectGump((PlayerMobile)m, item));
}
}
public static void ImbueLastProp(Mobile m, int Mod, int Mint)
{
m.Target = new ImbueLastModTarget();
}
private class ImbueLastModTarget : Target
{
public ImbueLastModTarget()
: base(-1, false, TargetFlags.None)
{
AllowNonlocal = true;
}
protected override void OnTarget(Mobile m, object o)
{
Item item = o as Item;
if (item == null || !(m is PlayerMobile))
{
m.SendLocalizedMessage(1079576); // You cannot imbue this item.
return;
}
ImbuingContext context = Imbuing.GetContext(m);
int mod = context.Imbue_Mod;
int modInt = context.Imbue_ModInt;
if (!Imbuing.CanImbueItem(m, item) || !Imbuing.OnBeforeImbue(m, item, mod, modInt) || !Imbuing.CanImbueProperty(m, item, mod))
{
ImbueGump.SendGumpDelayed((PlayerMobile)m);
}
else
{
Imbuing.TryImbueItem(m, item, mod, modInt);
ImbueGump.SendGumpDelayed((PlayerMobile)m);
}
}
protected override void OnTargetCancel(Mobile m, TargetCancelType cancelType)
{
m.EndAction(typeof(Imbuing));
}
}
}
}

View File

@@ -0,0 +1,252 @@
using Server;
using System;
using System.Collections.Generic;
using Server.Mobiles;
namespace Server.Items
{
public class IngredientDropEntry
{
private Type m_CreatureType;
private bool m_DropMultiples;
private string m_Region;
private double m_Chance;
private Type[] m_Ingredients;
public Type CreatureType { get { return m_CreatureType; } }
public bool DropMultiples { get { return m_DropMultiples; } }
public string Region { get { return m_Region; } }
public double Chance { get { return m_Chance; } }
public Type[] Ingredients { get { return m_Ingredients; } }
public IngredientDropEntry(Type creature, bool dropMultiples, double chance, params Type[] ingredients)
: this(creature, dropMultiples, null, chance, ingredients)
{
}
public IngredientDropEntry(Type creature, bool dropMultiples, string region, double chance, params Type[] ingredients)
{
m_CreatureType = creature;
m_Ingredients = ingredients;
m_DropMultiples = dropMultiples;
m_Region = region;
m_Chance = chance;
}
private static List<IngredientDropEntry> m_IngredientTable;
public static List<IngredientDropEntry> IngredientTable { get { return m_IngredientTable; } }
public static void Initialize()
{
EventSink.CreatureDeath += OnCreatureDeath;
m_IngredientTable = new List<IngredientDropEntry>();
// Imbuing Gems
m_IngredientTable.Add(new IngredientDropEntry(typeof(AncientLichRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(DevourerRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(FireElementalRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GrayGoblinMageRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GreenGoblinAlchemistRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(PixieRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(RakktaviRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(SkeletalDragonRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(TikitaviRenowned), true, .5, ImbuingGems));
m_IngredientTable.Add(new IngredientDropEntry(typeof(VitaviRenowned), true, .5, ImbuingGems));
//Bottle of Ichor/Spider Carapace
m_IngredientTable.Add(new IngredientDropEntry(typeof(TrapdoorSpider), true, .05, typeof(SpiderCarapace)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(WolfSpider), true, .15, typeof(BottleIchor)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(SentinelSpider), true, .15, typeof(BottleIchor)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(Navrey), true, .5, typeof(BottleIchor), typeof(SpiderCarapace)));
//Reflective wolf eye
m_IngredientTable.Add(new IngredientDropEntry(typeof(ClanSSW), true, .2, typeof(ReflectiveWolfEye)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(LeatherWolf), true, .2, typeof(ReflectiveWolfEye)));
//Faery Dust - drop from silver sapling mini champ
m_IngredientTable.Add(new IngredientDropEntry(typeof(FairyDragon), true, "Abyss", .25, typeof(FaeryDust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(Pixie), true, "Abyss", .25, typeof(FaeryDust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(SAPixie), true, "Abyss", .25, typeof(FaeryDust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(Wisp), true, "Abyss", .25, typeof(FaeryDust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(DarkWisp), true, "Abyss", .25, typeof(FaeryDust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(FairyDragon), true, "Abyss", .25, typeof(FeyWings)));
//Boura Pelt
m_IngredientTable.Add(new IngredientDropEntry(typeof(RuddyBoura), true, .05, typeof(BouraPelt)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(LowlandBoura), true, .05, typeof(BouraPelt)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(HighPlainsBoura), true, 1.0, typeof(BouraPelt)));
//Silver snake skin
m_IngredientTable.Add(new IngredientDropEntry(typeof(SilverSerpent), true, "TerMur", .10, typeof(SilverSnakeSkin)));
//Harpsichord Roll
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), true, "TerMur", .05, typeof(HarpsichordRoll)));
//Void Orb/Vial of Vitriol
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseVoidCreature), true, .05, typeof(VoidOrb)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(UnboundEnergyVortex), true, .25, typeof(VoidOrb), typeof(VialOfVitriol)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(AcidSlug), true, .10, typeof(VialOfVitriol)));
//Slith Tongue
m_IngredientTable.Add(new IngredientDropEntry(typeof(Slith), true, .05, typeof(SlithTongue)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(StoneSlith), true, .05, typeof(SlithTongue)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(ToxicSlith), true, .05, typeof(SlithTongue)));
//Raptor Teeth
m_IngredientTable.Add(new IngredientDropEntry(typeof(Raptor), true, .05, typeof(RaptorTeeth)));
//Daemon Claw
m_IngredientTable.Add(new IngredientDropEntry(typeof(FireDaemon), true, .6, typeof(DaemonClaw)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(FireDaemonRenowned), true, 1.0, typeof(DaemonClaw)));
//Goblin Blood
m_IngredientTable.Add(new IngredientDropEntry(typeof(GreenGoblin), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GreenGoblinAlchemist), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GreenGoblinScout), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GrayGoblin), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GrayGoblinKeeper), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GrayGoblinMage), true, .10, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGoblinKeeper), true, .25, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGoblinMage), true, .25, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGoblinScout), true, .25, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGrayGoblin), true, .25, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGreenGoblin), true, .25, typeof(GoblinBlood)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(EnslavedGreenGoblinAlchemist), true, .25, typeof(GoblinBlood)));
//Lava Serpent Crust
m_IngredientTable.Add(new IngredientDropEntry(typeof(LavaElemental), true, .25, typeof(LavaSerpentCrust)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(FireElementalRenowned), true, 1.0, typeof(LavaSerpentCrust)));
//Undying Flesh
m_IngredientTable.Add(new IngredientDropEntry(typeof(UndeadGuardian), true, .10, typeof(UndyingFlesh)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(Niporailem), true, 1.0, typeof(UndyingFlesh)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(ChaosVortex), true, .25, typeof(UndyingFlesh)));
//Crystaline Blackrock
m_IngredientTable.Add(new IngredientDropEntry(typeof(AgapiteElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BronzeElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(CopperElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(GoldenElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(ShadowIronElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(ValoriteElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(VeriteElemental), true, .25, typeof(CrystallineBlackrock)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(ChaosVortex), true, .25, typeof(ChagaMushroom)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Cavern of the Discarded", .05, typeof(DelicateScales),
typeof(ArcanicRuneStone), typeof(PowderedIron), typeof(EssenceBalance), typeof(CrushedGlass), typeof(CrystallineBlackrock),
typeof(ElvenFletching), typeof(CrystalShards), typeof(Lodestone), typeof(AbyssalCloth), typeof(SeedOfRenewal)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Passage of Tears", .05, typeof(EssenceSingularity)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Fairy Dragon Lair", .05, typeof(EssenceDiligence)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Abyssal Lair", .05, typeof(EssenceAchievement)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Crimson Veins", .05, typeof(EssencePrecision)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Lava Caldera", .05, typeof(EssencePassion)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Fire Temple Ruins", .05, typeof(EssenceOrder)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Enslaved Goblins", .05, typeof(GoblinBlood), typeof(EssenceControl)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Lands of the Lich", .05, typeof(EssenceDirection)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Secret Garden", .05, typeof(EssenceFeeling)));
m_IngredientTable.Add(new IngredientDropEntry(typeof(BaseCreature), false, "Skeletal Dragon", .05, typeof(EssencePersistence)));
}
public static void OnCreatureDeath(CreatureDeathEventArgs e)
{
BaseCreature bc = e.Creature as BaseCreature;
Container c = e.Corpse;
if (bc != null && c != null && !c.Deleted && !bc.Controlled && !bc.Summoned)
{
CheckDrop(bc, c);
}
if (e.Killer is BaseVoidCreature)
{
((BaseVoidCreature)e.Killer).Mutate(VoidEvolution.Killing);
}
}
public static void CheckDrop(BaseCreature bc, Container c)
{
if (m_IngredientTable != null)
{
foreach (IngredientDropEntry entry in m_IngredientTable)
{
if (entry == null)
continue;
if (entry.Region != null)
{
string reg = entry.Region;
if (reg == "TerMur" && c.Map != Map.TerMur)
{
continue;
}
else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
{
continue;
}
else if (reg != "TerMur" && reg != "Abyss")
{
Server.Region r = Server.Region.Find(c.Location, c.Map);
if (r == null || !r.IsPartOf(entry.Region))
continue;
}
}
if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
{
continue;
}
double toBeat = entry.Chance;
List<Item> drops = new List<Item>();
if (bc is BaseVoidCreature)
{
toBeat *= ((BaseVoidCreature)bc).Stage + 1;
}
if (entry.DropMultiples)
{
foreach (Type type in entry.Ingredients)
{
if (toBeat >= Utility.RandomDouble())
{
Item drop = Loot.Construct(type);
if (drop != null)
drops.Add(drop);
}
}
}
else if (toBeat >= Utility.RandomDouble())
{
Item drop = Loot.Construct(entry.Ingredients);
if (drop != null)
drops.Add(drop);
}
foreach (Item item in drops)
{
c.DropItem(item);
}
ColUtility.Free(drops);
}
}
}
public static Type[] ImbuingGems =
{
typeof(FireRuby),
typeof(WhitePearl),
typeof(BlueDiamond),
typeof(Turquoise)
};
}
}

View File

@@ -0,0 +1,374 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Items;
using Server.Commands;
using Server.Mobiles;
namespace Server.Gumps
{
public class ItemPropertiesGump : BaseGump
{
public static void Initialize()
{
CommandSystem.Register("ItemProps", AccessLevel.GameMaster, e =>
{
BaseGump.SendGump(new ItemPropertiesGump((PlayerMobile)e.Mobile));
});
}
public enum PropFilter
{
All,
AosAttributes,
AosWeaponAttributes,
AosArmorAttributes,
Slayer,
AosElemental,
SkillName,
SAAbsorption,
ExtendedWeapon,
Other,
}
public PropFilter Filter { get; set; }
public ItemType TypeFilter { get; set; }
public List<ItemPropertyInfo> Infos { get; set; }
public ItemPropertiesGump(PlayerMobile pm)
: base(pm, 0, 0)
{
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 900, 600, 0x2454);
AddPage(0);
AddHtml(0, 5, 900, 20, String.Format("Item Properties: {0}", Filter.ToString()), false, false);
AddHtml(275, 15, 625, 20, Center("Item Description: (Imbuing/Runic Cap) - (Loot Cap) [Scale]"), false, false);
AddButton(5, 550, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtml(40, 550, 200, 20, String.Format("Filter: {0}", Filter.ToString()), false, false);
//
AddButton(105, 575, TypeFilter == ItemType.Melee ? 4006 : 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtml(140, 575, 200, 20, "Melee", false, false);
AddButton(205, 575, TypeFilter == ItemType.Ranged ? 4006 : 4005, 4007, 3, GumpButtonType.Reply, 0);
AddHtml(240, 575, 200, 20, "Ranged", false, false);
AddButton(305, 575, TypeFilter == ItemType.Armor ? 4006 : 4005, 4007, 4, GumpButtonType.Reply, 0);
AddHtml(340, 575, 200, 20, "Armor", false, false);
AddButton(405, 575, TypeFilter == ItemType.Shield ? 4006 : 4005, 4007, 5, GumpButtonType.Reply, 0);
AddHtml(440, 575, 200, 20, "Shields", false, false);
AddButton(505, 575, TypeFilter == ItemType.Hat ? 4006 : 4005, 4007, 6, GumpButtonType.Reply, 0);
AddHtml(540, 575, 200, 20, "Hats", false, false);
AddButton(605, 575, TypeFilter == ItemType.Jewel ? 4006 : 4005, 4007, 7, GumpButtonType.Reply, 0);
AddHtml(640, 575, 200, 20, "Jewels", false, false);
AddLabel(5, 30, 0, "Property");
AddLabel(125, 30, 0, "Max");
AddLabel(175, 30, 0, "Start");
AddLabel(225, 30, 0, "Scale");
AddLabel(275, 30, 0, "Melee");
AddLabel(375, 30, 0, "Ranged");
AddLabel(475, 30, 0, "Armor");
AddLabel(575, 30, 0, "Shields");
AddLabel(675, 30, 0, "Hats");
AddLabel(775, 30, 0, "Jewels");
Infos = CompileList().ToList();
int index = 0;
int page = 1;
int y = 50;
int perPage = 25;
AddPage(page);
for (int i = 0; i < Infos.Count; i++)
{
var info = Infos[i];
int scale = info.Scale;
//AddLabel(5, y, 0, info.Attribute.ToString());
AddHtmlLocalized(5, y, 120, 20, 1114057, info.AttributeName.ToString(), 0x1, false, false);
AddLabel(125, y, 0, info.MaxIntensity.ToString());
AddLabel(175, y, 0, info.Start.ToString());
AddLabel(225, y, 0, scale.ToString());
LoadTypeInfo(ItemType.Melee, info, scale, 275, y);
LoadTypeInfo(ItemType.Ranged, info, scale, 375, y);
LoadTypeInfo(ItemType.Armor, info, scale, 475, y);
LoadTypeInfo(ItemType.Shield, info, scale, 575, y);
LoadTypeInfo(ItemType.Hat, info, scale, 675, y);
LoadTypeInfo(ItemType.Jewel, info, scale, 775, y);
AddButton(868, y, 4011, 4012, 10 + i, GumpButtonType.Reply, 0);
if (++index % perPage == 0)
{
y = 50;
AddButton(868, 0, 4005, 4007, 0, GumpButtonType.Page, page + 1);
AddPage(++page);
AddButton(838, 0, 4014, 4016, 0, GumpButtonType.Page, page - 1);
}
else
{
y += 20;
}
}
}
private void LoadTypeInfo(ItemType type, ItemPropertyInfo info, int scale, int x, int y)
{
var typeInfo = info.GetItemTypeInfo(type);
if (typeInfo != null)
{
AddLabel(x, y, TypeFilter == type ? 0x9E : 0, String.Format("{0}-{1}[{2}]", typeInfo.StandardMax, typeInfo.LootMax, typeInfo.Scale > 1 ? typeInfo.Scale.ToString() : scale.ToString()));
}
else
{
AddLabel(x, y, 0, "N/A");
}
}
private IEnumerable<ItemPropertyInfo> CompileList()
{
if (TypeFilter > ItemType.Invalid)
{
foreach (var i in ItemPropertyInfo.LootTable[TypeFilter])
{
yield return ItemPropertyInfo.GetInfo(i);
}
yield break;
}
foreach (var info in ItemPropertyInfo.Table.Values)
{
switch (Filter)
{
case PropFilter.All:
yield return info;
break;
case PropFilter.AosAttributes:
if (info.Attribute is AosAttribute)
{
yield return info;
}
break;
case PropFilter.AosWeaponAttributes:
if (info.Attribute is AosWeaponAttribute)
{
yield return info;
}
break;
case PropFilter.AosArmorAttributes:
if (info.Attribute is AosArmorAttribute)
{
yield return info;
}
break;
case PropFilter.Slayer:
if (info.Attribute is SlayerName)
{
yield return info;
}
break;
case PropFilter.AosElemental:
if (info.Attribute is AosElementAttribute)
{
yield return info;
}
break;
case PropFilter.SkillName:
if (info.Attribute is SkillName)
{
yield return info;
}
break;
case PropFilter.SAAbsorption:
if (info.Attribute is SAAbsorptionAttribute)
{
yield return info;
}
break;
case PropFilter.ExtendedWeapon:
if (info.Attribute is ExtendedWeaponAttribute)
{
yield return info;
}
break;
case PropFilter.Other:
if (info.Attribute is string)
{
yield return info;
}
break;
}
}
}
public override void OnResponse(RelayInfo info)
{
if (info.ButtonID == 0)
{
return;
}
else if (info.ButtonID == 1)
{
if (Filter == PropFilter.Other)
{
Filter = PropFilter.All;
}
else
{
Filter++;
}
TypeFilter = ItemType.Invalid;
Refresh();
}
else if (info.ButtonID < 10)
{
switch (info.ButtonID)
{
case 2:
TypeFilter = ItemType.Melee;
break;
case 3:
TypeFilter = ItemType.Ranged;
break;
case 4:
TypeFilter = ItemType.Armor;
break;
case 5:
TypeFilter = ItemType.Shield;
break;
case 6:
TypeFilter = ItemType.Hat;
break;
case 7:
TypeFilter = ItemType.Jewel;
break;
}
Refresh();
}
else
{
Refresh();
int id = info.ButtonID - 10;
if (id >= 0 && id < Infos.Count)
{
var propInfo = Infos[id];
BaseGump.SendGump(new InfoSpecificGump(User, propInfo, TypeFilter));
}
}
}
}
public class InfoSpecificGump : BaseGump
{
public ItemPropertyInfo Info { get; set; }
public ItemType ItemType { get; set; }
public InfoSpecificGump(PlayerMobile pm, ItemPropertyInfo info, ItemType type)
: base(pm, 100, 100)
{
Info = info;
ItemType = type;
}
public override void AddGumpLayout()
{
AddBackground(0, 0, 600, 400, 0x2454);
AddHtmlLocalized(0, 10, 600, 20, CenterLoc, Info.AttributeName.ToString(), 0x1, false, false);
AddLabel(5, 30, 0, "Weight:");
AddLabel(5, 50, 0, "Primary Resource:");
AddLabel(5, 70, 0, "Gem Resource:");
AddLabel(5, 90, 0, "Special Resource:");
AddLabel(5, 110, 0, "Default Scale:");
AddLabel(5, 130, 0, "Start Intensity:");
AddLabel(5, 150, 0, "Default Max Intensity:");
AddLabel(225, 30, 0, Info.Weight.ToString());
AddHtmlLocalized(225, 50, 250, 20, 1114057, Info.PrimaryName != null ? Info.PrimaryName.ToString() : "N/A", 0x1, false, false);
AddHtmlLocalized(225, 70, 250, 20, 1114057, Info.GemName != null ? Info.GemName.ToString() : "N/A", 0x1, false, false);
AddHtmlLocalized(225, 90, 250, 20, 1114057, Info.SpecialName != null ? Info.SpecialName.ToString() : "N/A", 0x1, false, false);
AddLabel(225, 110, 0, Info.Scale.ToString());
AddLabel(225, 130, 0, Info.Start.ToString());
AddLabel(225, 150, 0, Info.MaxIntensity.ToString());
AddLabel(5, 190, 0, "Item Type");
AddLabel(125, 190, 0, "Scale");
AddLabel(225, 190, 0, "Standard Max");
AddLabel(325, 190, 0, "Loot Max");
AddLabel(425, 190, 0, "Over Cap");
int y = 210;
foreach (var i in Enum.GetValues(typeof(ItemType)))
{
var type = (ItemType)i;
if (type == ItemType.Invalid || (ItemType != ItemType.Invalid && type != ItemType))
{
continue;
}
AddLabel(5, y, 0, type.ToString());
var typeInfo = Info.GetItemTypeInfo(type);
if (typeInfo != null)
{
AddLabel(125, y, 0, typeInfo.Scale.ToString());
AddLabel(225, y, 0, typeInfo.StandardMax.ToString());
AddLabel(325, y, 0, typeInfo.LootMax.ToString());
if (typeInfo.PowerfulLootRange != null)
{
var str = String.Empty;
for (int j = 0; j < typeInfo.PowerfulLootRange.Length; j++)
{
int v = typeInfo.PowerfulLootRange[j];
if (j == typeInfo.PowerfulLootRange.Length - 1)
{
str += String.Format(" {0}", v.ToString());
}
else
{
str += String.Format(" {0},", v.ToString());
}
}
AddLabel(425, y, 0, str);
}
else
{
AddLabel(425, y, 0, "N/A");
}
}
else
{
AddLabel(125, y, 0, "No Info");
}
y += 20;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,152 @@
using System;
using Server;
using Server.Items;
using System.Linq;
using System.Collections.Generic;
using Server.Engines.Despise;
using Server.Engines.Shadowguard;
using Server.Mobiles;
namespace Server.Items
{
public class RandomItemGenerator
{
public static bool Enabled { get { return Core.HS; } }
public static int FeluccaLuckBonus { get; private set; }
public static int FeluccaBudgetBonus { get; private set; }
public static int MaxBaseBudget { get; private set; }
public static int MinBaseBudget { get; private set; }
public static int MaxProps { get; private set; }
public static int MaxAdjustedBudget { get; private set; }
public static int MinAdjustedBudget { get; private set; }
public static void Configure()
{
FeluccaLuckBonus = Config.Get("Loot.FeluccaLuckBonus", 1000);
FeluccaBudgetBonus = Config.Get("Loot.FeluccaBudgetBonus", 100);
MaxBaseBudget = Config.Get("Loot.MaxBaseBudget", 700);
MinBaseBudget = Config.Get("Loot.MinBaseBudget", 150);
MaxProps = Config.Get("Loot.MaxProps", 11);
MaxAdjustedBudget = Config.Get("Loot.MaxAdjustedBudget", 1450);
MinAdjustedBudget = Config.Get("Loot.MinAdjustedBudget", 150);
}
private RandomItemGenerator()
{
}
/// <summary>
/// This is called for every item that is dropped to a loot pack.
/// Change the conditions here to add/remove Random Item Drops with REGULAR loot.
/// </summary>
/// <param name="item">item to be mutated</param>
/// <param name="killer">Mobile.LastKiller</param>
/// <param name="victim">the victim</param>
public static bool GenerateRandomItem(Item item, Mobile killer, BaseCreature victim)
{
if(Enabled)
return RunicReforging.GenerateRandomItem(item, killer, victim);
return false;
}
/// <summary>
/// This is called in BaseRunicTool to ensure all items use the new system, as long as its not palyermade.
/// </summary>
/// <param name="item"></param>
/// <param name="luckChance">adjusted luck chance</param>
/// <param name="attributeCount"></param>
/// <param name="minIntensity"></param>
/// <param name="maxIntensity"></param>
public static void GenerateRandomItem(Item item, int luckChance, int attributeCount, int minIntensity, int maxIntensity)
{
int min = (attributeCount * 2) * minIntensity;
min = min + (int)((double)min * ((double)Utility.RandomMinMax(1, 4) / 10));
int max = (attributeCount * 2) * maxIntensity;
max = max + (int)((double)max * ((double)Utility.RandomMinMax(1, 4) / 10));
RunicReforging.GenerateRandomItem(item, luckChance, min, max);
}
/// <summary>
/// 24000 is the normalized fame for MaxBaseBudget, ie Balron.
/// Called in BaseCreature.cs virtual BaseLootBudget Property
/// </summary>
/// <param name="bc">Creature to be evaluated</param>
/// <returns></returns>
public static int GetBaseBudget(BaseCreature bc)
{
if (bc is BaseRenowned)
return MaxBaseBudget;
return bc.Fame / (20500 / MaxBaseBudget);
}
public static int GetDifficultyFor(BaseCreature bc)
{
if (bc == null)
return 0;
int fame = bc.Fame;
if (fame > 0)
{
int budget = Math.Min(MaxBaseBudget, GetBaseBudget(bc));
BossEntry.CheckBoss(bc, ref budget);
return Math.Max(MinBaseBudget, budget);
}
return 0;
}
}
public class BossEntry
{
public int Bonus { get; private set; }
public List<Type> List { get; private set; }
public BossEntry(int bonus, params Type[] list)
{
Bonus = bonus;
List = list.ToList();
}
public static List<BossEntry> Entries { get; set; }
public static void CheckBoss(BaseCreature bc, ref int budget)
{
foreach (var entry in Entries)
{
if (entry.List.FirstOrDefault(t => t == bc.GetType() || bc.GetType().IsSubclassOf(t)) != null)
{
budget += entry.Bonus;
return;
}
}
}
public static void Initialize()
{
Entries = new List<BossEntry>();
Entries.Add(
new BossEntry(100, typeof(BaseRenowned), typeof(TRex), typeof(BaseShipCaptain), typeof(Navrey)));
Entries.Add(
new BossEntry(150, typeof(BaseChampion), typeof(Impaler), typeof(DarknightCreeper), typeof(FleshRenderer),
typeof(ShadowKnight), typeof(AbysmalHorror), typeof(AdrianTheGloriousLord), typeof(AndrosTheDreadLord)));
Entries.Add(
new BossEntry(250, typeof(BasePeerless), typeof(Harrower), typeof(DemonKnight), typeof(ShadowguardBoss), typeof(Osiredon)));
Entries.Add(
new BossEntry(350, typeof(ClockworkExodus), typeof(CoraTheSorceress), typeof(Charydbis), typeof(Zipactriotl), typeof(MyrmidexQueen)));
}
}
}

View File

@@ -0,0 +1,624 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Engines.Quests;
namespace Server.Gumps
{
[Flags]
public enum ReforgingOption
{
None = 0x00000000,
Powerful = 0x00000001,
Structural = 0x00000002,
Fortified = 0x00000004,
Fundamental = 0x00000008,
Integral = 0x00000010,
GrandArtifice = 0x00000020,
InspiredArtifice = 0x00000040,
ExaltedArtifice = 0x00000080,
SublimeArtifice = 0x00000100,
PowerfulAndStructural = Powerful | Structural,
PowerfulAndFundamental = Powerful | Fundamental,
StructuralAndFundamental = Structural | Fundamental,
PowerfulStructuralAndFundamental = PowerfulAndStructural | Fundamental
}
public class RunicReforgingGump : Gump
{
private BaseRunicTool m_Tool;
private Item m_ToReforge;
private ReforgingOption m_Options;
private ReforgedPrefix m_Prefix;
private ReforgedSuffix m_Suffix;
private ReforgingContext m_Context;
private ReforgingOption[] Options =
{
ReforgingOption.Powerful,
ReforgingOption.Structural,
ReforgingOption.Fortified,
ReforgingOption.Fundamental,
ReforgingOption.Integral,
ReforgingOption.GrandArtifice,
ReforgingOption.InspiredArtifice,
ReforgingOption.ExaltedArtifice,
ReforgingOption.SublimeArtifice,
};
public RunicReforgingGump(Mobile from, Item toReforge, BaseRunicTool tool)
: base(100, 100)
{
from.CloseGump(typeof(RunicReforgingGump));
from.CloseGump(typeof(ImbueGump));
m_Context = ReforgingContext.GetContext(from);
if (!m_Context.Contexts.ContainsKey(tool))
m_Context.Contexts[tool] = ReforgingOption.None;
m_Tool = tool;
m_ToReforge = toReforge;
m_Options = m_Context.Contexts[tool];
m_Prefix = m_Context.Prefix;
m_Suffix = m_Context.Suffix;
AddBackground(0, 0, 370, 440, 83);
AddHtmlLocalized(10, 10, 350, 18, 1114513, "#1151952", 0x4BB7, false, false); // Runic Crafting Options
int buttonHue = 0x4BB2;
int buttonID = 0x4005;
int y = 40;
int idx = 0;
for(int i = 0; i < Options.Length; i++)
{
ReforgingOption option = Options[i];
if ((m_Options & option) != 0)
{
if (CanReforge(from, option) && HasMetPrerequisite(option))
{
buttonHue = 0x4BB2;
buttonID = 4006;
}
else
{
buttonHue = 0x7652;
buttonID = 4006;
}
}
else
{
if (CanReforge(from, option) && HasMetPrerequisite(option))
{
buttonHue = 0x6F7B;
buttonID = 4005;
}
else
{
buttonHue = 0x7652;
buttonID = 4006;
}
}
if(HasMetPrerequisite(option) && CanReforge(from, option))
AddButton(15, y, buttonID, buttonID, i + 100, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, y, 250, 20, GetCliloc(option), buttonHue, false, false);
y += 25;
idx++;
}
int totalCharges = GetTotalCharges();
if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
{
AddButton(15, 305, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 305, 250, 20, 1152087, 0x6F7B, false, false);
AddHtmlLocalized(190, 305, 250, 20, RunicReforging.GetName((int)m_Prefix), 0x5757, false, false);
}
if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
{
AddButton(15, 330, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 330, 250, 20, 1152088, 0x6F7B, false, false);
AddHtmlLocalized(190, 330, 250, 20, RunicReforging.GetName((int)m_Suffix), 0x5757, false, false);
}
AddHtmlLocalized(10, 363, 140, 22, 1114514, "#1152078", 0x4BB2, false, false); // CHARGES NEEDED:
AddLabel(160, 363, 0x113, totalCharges.ToString());
AddHtmlLocalized(10, 385, 140, 22, 1114514, "#1152077", 0x6F7B, false, false); // TOOL CHARGES:
AddLabel(160, 385, 0x44E, m_Tool.UsesRemaining.ToString());
AddButton(10, 412, 4017, 4018, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 410, 200, 20, 1060675, 0x6F7B, false, false); // CLOSE
AddButton(330, 363, 4014, 4016, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(190, 363, 135, 22, 1114514, "#1152080", 0x6F7B, false, false); // REFORGE ITEM
AddButton(330, 412, 4011, 4013, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(185, 412, 140, 18, 1114514, "#1149735", 0x6F7B, false, false); // HELP
}
private bool HasMetPrerequisite(ReforgingOption option)
{
switch (option)
{
case ReforgingOption.None: return true;
case ReforgingOption.Powerful: return true;
case ReforgingOption.Structural: return true;
case ReforgingOption.Fortified: return (m_Options & ReforgingOption.Structural) != 0;
case ReforgingOption.Fundamental: return true;
case ReforgingOption.Integral: return (m_Options & ReforgingOption.Fundamental) != 0;
case ReforgingOption.GrandArtifice: return true;
case ReforgingOption.InspiredArtifice: return (m_Options & ReforgingOption.GrandArtifice) != 0;
case ReforgingOption.ExaltedArtifice: return (m_Options & ReforgingOption.GrandArtifice) != 0;
case ReforgingOption.SublimeArtifice: return (m_Options & ReforgingOption.ExaltedArtifice) != 0 && (m_Options & ReforgingOption.GrandArtifice) != 0;
}
return true;
}
private void InvalidatePrerequisite(ReforgingOption option)
{
switch (option)
{
case ReforgingOption.None:
case ReforgingOption.Powerful: break;
case ReforgingOption.Structural:
if ((m_Options & ReforgingOption.Fortified) != 0)
m_Options ^= ReforgingOption.Fortified;
break;
case ReforgingOption.Fortified: break;
case ReforgingOption.Fundamental:
if ((m_Options & ReforgingOption.Integral) != 0)
m_Options ^= ReforgingOption.Integral;
break;
case ReforgingOption.Integral: break;
case ReforgingOption.GrandArtifice:
if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
m_Options ^= ReforgingOption.InspiredArtifice;
if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
m_Options ^= ReforgingOption.ExaltedArtifice;
if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
m_Options ^= ReforgingOption.SublimeArtifice;
break;
case ReforgingOption.InspiredArtifice: break;
case ReforgingOption.ExaltedArtifice:
if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
m_Options ^= ReforgingOption.SublimeArtifice;
break;
case ReforgingOption.SublimeArtifice: break;
}
}
private bool CanReforge(Mobile from, ReforgingOption option)
{
double skill = from.Skills[SkillName.Imbuing].Value;
switch (option)
{
default:
case ReforgingOption.None:
case ReforgingOption.Powerful: return skill >= 65.0;
case ReforgingOption.Structural:
case ReforgingOption.Fortified: return skill >= 85.0;
case ReforgingOption.Fundamental:
case ReforgingOption.Integral: return skill >= 97.0;
case ReforgingOption.GrandArtifice:
case ReforgingOption.InspiredArtifice: return skill >= 100.1;
case ReforgingOption.ExaltedArtifice:
case ReforgingOption.SublimeArtifice: return skill >= 110.1;
}
}
private int GetCliloc(ReforgingOption option)
{
switch (option)
{
default:
case ReforgingOption.None: return 0;
case ReforgingOption.Powerful: return 1151954;
case ReforgingOption.Structural: return 1151955;
case ReforgingOption.Fortified: return 1151956;
case ReforgingOption.Fundamental: return 1151957;
case ReforgingOption.Integral: return 1151958;
case ReforgingOption.GrandArtifice: return 1151961;
case ReforgingOption.InspiredArtifice: return 1151962;
case ReforgingOption.ExaltedArtifice: return 1151963;
case ReforgingOption.SublimeArtifice: return 1151964;
}
}
private int GetTotalCharges()
{
int count = 1;
foreach (var option in Options)
{
if ((m_Options & option) != 0)
count++;
}
return Math.Min(10, count);
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (!BaseTool.CheckAccessible(m_Tool, from, true))
{
return;
}
switch (info.ButtonID)
{
case 0: break;
case 1: // prefix
from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, true));
break;
case 2: // suffix
from.SendGump(new ItemNameGump(m_ToReforge, m_Tool, m_Options, m_Prefix, m_Suffix, false));
break;
case 3: // Reforge Item
{
if (!RunicReforging.CanReforge(from, m_ToReforge, m_Tool.CraftSystem))
{
return;
}
int totalCharges = GetTotalCharges();
if (m_Tool.UsesRemaining >= totalCharges)
{
CraftResourceInfo resInfo = CraftResources.GetInfo(m_Tool.Resource);
if (resInfo == null)
return;
CraftAttributeInfo attrs = resInfo.AttributeInfo;
int min = 10;
int max = 80;
if (min < 10) min = 10;
if (max > 100) max = 100;
int budget = GetBudget();
ReforgedPrefix prefix = ReforgedPrefix.None;
ReforgedSuffix suffix = ReforgedSuffix.None;
if ((m_Options & ReforgingOption.GrandArtifice) != 0)
{
// choosing name 1
if ((m_Options & ReforgingOption.InspiredArtifice) != 0)
{
prefix = m_Prefix;
if (prefix == ReforgedPrefix.None)
{
from.SendLocalizedMessage(1152287); // Re-forging failed. You did not choose a name! Please try again.
return;
}
}
else
{
// Not choosing name 1 or 2
if ((m_Options & ReforgingOption.SublimeArtifice) == 0)
{
// random prefix AND suffix
if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
{
prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge, budget);
suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
}
else // random prefix OR suffix
{
if (0.5 > Utility.RandomDouble())
{
prefix = RunicReforging.ChooseRandomPrefix(m_ToReforge, budget);
}
else
{
suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
}
}
}
}
}
if ((m_Options & ReforgingOption.ExaltedArtifice) != 0)
{
if ((m_Options & ReforgingOption.SublimeArtifice) != 0)
{
suffix = m_Suffix;
if (suffix == ReforgedSuffix.None)
{
from.SendLocalizedMessage(1152287); // Re-forging failed. You did not choose a name! Please try again.
return;
}
}
else
{
suffix = RunicReforging.ChooseRandomSuffix(m_ToReforge, budget, m_Prefix);
budget = Math.Min(800, budget + 50);
}
}
// 50% chance to switch prefix/suffix around
if ((prefix != ReforgedPrefix.None || suffix != ReforgedSuffix.None) && 0.5 > Utility.RandomDouble())
{
int pre = (int)prefix;
int suf = (int)suffix;
prefix = (ReforgedPrefix)suf;
suffix = (ReforgedSuffix)pre;
}
RunicReforging.ApplyReforgedProperties(m_ToReforge, prefix, suffix, budget, min, max, RunicReforging.GetPropertyCount(m_Tool), 0, m_Tool, m_Options);
OnAfterReforged(m_ToReforge);
from.SendLocalizedMessage(1152286); // You re-forge the item!
from.PlaySound(0x665);
m_Tool.UsesRemaining -= totalCharges;
if (m_Tool.UsesRemaining <= 0)
{
m_Tool.Delete();
from.SendLocalizedMessage(1044038); // You have worn out your tool!
}
}
break;
}
case 4:
from.SendGump(new ReforgingHelpGump());
break;
default: // Option
{
ReforgingOption option = Options[info.ButtonID - 100];
if (HasMetPrerequisite(option))
{
if ((m_Options & option) == 0)
{
m_Options |= option;
if (m_Prefix != ReforgedPrefix.None && !RunicReforging.HasSelection((int)m_Prefix, m_ToReforge, m_Tool, m_Options, -1, -1))
{
m_Prefix = ReforgedPrefix.None;
m_Context.Prefix = ReforgedPrefix.None;
}
if (m_Suffix != ReforgedSuffix.None && !RunicReforging.HasSelection((int)m_Suffix, m_ToReforge, m_Tool, m_Options, -1, -1))
{
m_Suffix = ReforgedSuffix.None;
m_Context.Suffix = ReforgedSuffix.None;
}
}
else
{
m_Options ^= option;
InvalidatePrerequisite(option);
}
m_Context.Contexts[m_Tool] = m_Options;
}
from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool));
break;
}
}
}
private int GetBudget()
{
int budget;
switch (m_Tool.Resource)
{
default:
case CraftResource.DullCopper:
case CraftResource.ShadowIron:
case CraftResource.SpinedLeather:
case CraftResource.OakWood:
budget = 140; break;
case CraftResource.Copper:
case CraftResource.AshWood:
budget = 350; break;
case CraftResource.Bronze:
case CraftResource.YewWood:
case CraftResource.HornedLeather:
budget = 500; break;
case CraftResource.Gold:
case CraftResource.Agapite:
case CraftResource.Heartwood:
case CraftResource.Bloodwood:
budget = 600; break;
case CraftResource.Verite:
case CraftResource.Frostwood:
case CraftResource.BarbedLeather:
budget = 700; break;
case CraftResource.Valorite:
budget = 750; break;
}
if ((m_Options & ReforgingOption.Powerful) != 0)
budget += 60;
if ((m_Options & ReforgingOption.Structural) != 0)
budget += 60;
if ((m_Options & ReforgingOption.Fundamental) != 0)
budget += 100;
return budget;
}
public void OnAfterReforged(Item item)
{
AosAttributes attr = RunicReforging.GetAosAttributes(item);
NegativeAttributes neg = RunicReforging.GetNegativeAttributes(item);
int durability = 0;
if (item is BaseWeapon)
attr = ((BaseWeapon)item).Attributes;
else if (item is BaseArmor)
attr = ((BaseArmor)item).Attributes;
if (attr != null && (m_Options & ReforgingOption.Structural) != 0)
{
if(neg != null)
neg.Brittle = 1;
if ((m_Options & ReforgingOption.Fortified) != 0)
durability = 150;
if (item is BaseArmor || item is BaseClothing)
item.Hue = 2500;
}
if ((m_Options & ReforgingOption.Fundamental) != 0)
{
if (neg != null)
neg.NoRepair = 1;
durability = (m_Options & ReforgingOption.Integral) != 0 ? 255 : 200;
if (item.Hue == 0 && (item is BaseArmor || item is BaseClothing))
item.Hue = 2500;
}
if (durability > 0 && item is IDurability)
{
((IDurability)item).MaxHitPoints = durability;
((IDurability)item).HitPoints = durability;
}
RunicReforging.ApplyItemPower(item, true);
}
public class ItemNameGump : Gump
{
private BaseRunicTool m_Tool;
private Item m_ToReforge;
private ReforgingOption m_Options;
private ReforgedPrefix m_Prefix;
private ReforgedSuffix m_Suffix;
private bool m_IsPrefix;
private static int White = 0x6F7B;
private static int Green = 0x4BB2;
private static int Yellow = 0x6B55;
public ItemNameGump(Item toreforge, BaseRunicTool tool, ReforgingOption options, ReforgedPrefix prefix, ReforgedSuffix suffix, bool isprefix)
: base(100, 100)
{
m_Tool = tool;
m_ToReforge = toreforge;
m_Options = options;
m_Prefix = prefix;
m_Suffix = suffix;
m_IsPrefix = isprefix;
AddBackground(0, 0, 370, 440, 83);
AddHtmlLocalized(10, 10, 350, 18, 1114513, "#1152089", 0x4BB7, false, false); // Runic Crafting - Item Name Selection
int buttonID = 4005;
int buttonHue = 0x4BB2;
int y = 50;
foreach (int i in Enum.GetValues(typeof(ReforgedPrefix)))
{
if (i == 0)
continue;
if ((isprefix && prefix == (ReforgedPrefix)i) || (!isprefix && suffix == (ReforgedSuffix)i))
{
buttonID = 4006;
buttonHue = Green;
}
else
{
buttonID = 4005;
buttonHue = White;
}
if (RunicReforging.HasSelection(i, toreforge, tool, m_Options, (int)m_Prefix, (int)m_Suffix))
{
AddButton(15, y, buttonID, buttonID, 100 + i, GumpButtonType.Reply, 0);
}
else
{
buttonHue = Yellow;
}
AddHtmlLocalized(55, y, 250, 20, RunicReforging.GetName(i), buttonHue, false, false);
y += 25;
}
AddHtmlLocalized(45, 412, 100, 20, 1060675, White, false, false);
AddButton(10, 412, 4017, 4019, 0, GumpButtonType.Reply, 0);
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
if (info.ButtonID == 0)
return;
int index = info.ButtonID - 100;
if (index >= 0 && index <= 12 && RunicReforging.HasSelection(index, m_ToReforge, m_Tool, m_Options, (int)m_Prefix, (int)m_Suffix))
{
var context = ReforgingContext.GetContext(from);
if (m_IsPrefix)
{
context.Prefix = (ReforgedPrefix)index;
m_Prefix = (ReforgedPrefix)index;
}
else
{
context.Suffix = (ReforgedSuffix)index;
m_Suffix = (ReforgedSuffix)index;
}
}
from.SendGump(new RunicReforgingGump(from, m_ToReforge, m_Tool));
}
}
private class ReforgingHelpGump : Gump
{
public ReforgingHelpGump()
: base(100, 100)
{
AddBackground(0, 0, 370, 440, 83);
AddHtmlLocalized(10, 10, 350, 18, 1114513, "#1151966", 0x4BB7, false, false); // Runc Crafting Help
AddHtmlLocalized(10, 40, 353, 365, 1151965, 0xFFE0, false, true);
AddHtmlLocalized(45, 412, 100, 20, 1060675, 0x6F7B, false, false);
AddButton(10, 412, 4017, 4019, 0, GumpButtonType.Reply, 0);
}
}
}
}

View File

@@ -0,0 +1,27 @@
-Random Item Generator: http://www.uoguide.com/Random_Magic_Item_Generation_System
-This is active for ALL loot on EA servers, however is not active by default. Here is how to activate it. All edits will be in RandomItemGenerator.cs.
-To drop items via random item generator system on specific monsters, such as hard creatures, etc, you will need to create a drop entry for that creature type in the Initialize() Method.
For example:
m_Table[typeof(Server.Engines.Despise.AndrosTheDreadLord)] = new List<DropEntry>();
m_Table[typeof(Server.Engines.Despise.AndrosTheDreadLord)].Add(new DropEntry(null, 50, 15));
This will give a 50% drop rate, rolled 15 times when Adros the Dreadlord dies. This is in addition to his normal lootpack.
-To drop items via random item generator system as regular loot from loot packs, you will need to edit GenerateRandomItem(Item item, Mobile killer, BaseCreature victim) method.
For example:
GenerateRandomItem(Item item, Mobile killer, BaseCreature victim)
{
if(victim != null && victim.Map == Map.Felucca && .10 > Utility.RandomDouble())
return RunicReforging.GenerateRandomItem(item, killer, victim);
if(victim.Region != null && victim.Region.IsPartOf<DespiseRegion>())
return RunicReforging.GenerateRandomItem(item, killer, victim);
}
this will drop the new named items 10% of the time as regular loot in Felucca, and everytime as loot in DespiseRegion.

View File

@@ -0,0 +1,121 @@
using System;
using Server;
using System.Collections.Generic;
using Server.Items;
using Server.Gumps;
using System.IO;
namespace Server.Items
{
public class ReforgingContext
{
public Dictionary<BaseTool, ReforgingOption> Contexts { get; set; }
public ReforgedPrefix Prefix { get; set; }
public ReforgedSuffix Suffix { get; set; }
public ReforgingContext(Mobile m)
{
Contexts = new Dictionary<BaseTool, ReforgingOption>();
ReforgingContexts[m] = this;
}
public ReforgingContext(GenericReader reader)
{
Contexts = new Dictionary<BaseTool, ReforgingOption>();
int version = reader.ReadInt();
Prefix = (ReforgedPrefix)reader.ReadInt();
Suffix = (ReforgedSuffix)reader.ReadInt();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
BaseTool tool = reader.ReadItem() as BaseTool;
ReforgingOption option = (ReforgingOption)reader.ReadInt();
if (tool != null)
Contexts[tool] = option;
}
}
public void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write((int)Prefix);
writer.Write((int)Suffix);
writer.Write(Contexts.Count);
foreach (var kvp in Contexts)
{
writer.Write(kvp.Key);
writer.Write((int)kvp.Value);
}
}
#region Serialize/Deserialize Persistence
private static string FilePath = Path.Combine("Saves", "CraftContext", "ReforgingContexts.bin");
public static Dictionary<Mobile, ReforgingContext> ReforgingContexts { get; set; }
public static ReforgingContext GetContext(Mobile m)
{
if (ReforgingContexts.ContainsKey(m))
{
return ReforgingContexts[m];
}
return new ReforgingContext(m);
}
public static void Configure()
{
EventSink.WorldSave += OnSave;
EventSink.WorldLoad += OnLoad;
}
public static void OnSave(WorldSaveEventArgs e)
{
Persistence.Serialize(
FilePath,
writer =>
{
writer.Write(0); // version
writer.Write(ReforgingContexts.Count);
foreach (var kvp in ReforgingContexts)
{
writer.Write(kvp.Key);
kvp.Value.Serialize(writer);
}
});
}
public static void OnLoad()
{
ReforgingContexts = new Dictionary<Mobile, ReforgingContext>();
Persistence.Deserialize(
FilePath,
reader =>
{
int version = reader.ReadInt();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
Mobile m = reader.ReadMobile();
var context = new ReforgingContext(reader);
if (m != null)
ReforgingContexts[m] = context;
}
});
}
#endregion
}
}

File diff suppressed because it is too large Load Diff