public MetamorphoseGump(Mobile caster, Item scroll, ArrayList entries, int owner)//Owner == niveau du sort de métamorphose... : base(50, 50) { m_Caster = caster; m_Scroll = scroll; m_Entries = entries; m_Owner = owner; if (entries == null) { return; } if (m_Owner < 1 || m_Owner >= 7) { return; } int x, y; AddPage(0); AddBackground(0, 0, 427, 372, 5054); AddBackground(10, 20, 407, 342, 3000); AddLabel(15, 3, 50, "Choix de transformation"); if (owner == 5) { for (int c = 0; c < entries.Count; c++) { MetamorphoseEntry entry = (MetamorphoseEntry)entries[c]; x = 15 + (c % 4) * 100; y = 18 + (c / 4) * 67; AddLabel(x, y, 0, entry.Name); AddItem(x + 25, y + 25, entry.ArtID); AddButton(x, y + 20, 2103, 2104, c + 1, GumpButtonType.Reply, 1); AddButton(x, y + 40, 2223, 2223, c + 21, GumpButtonType.Reply, 1); } } else { for (int c = 0; c < entries.Count; c++) { MetamorphoseEntry entry = (MetamorphoseEntry)entries[c]; x = 15 + (c % 4) * 100; y = 18 + (c / 4) * 67; AddLabel(x, y, 0, entry.Name); AddItem(x + 15, y + 25, entry.ArtID); AddButton(x, y + 20, 2103, 2104, c + 1, GumpButtonType.Reply, 1); } } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID >= 21) { if ((info.ButtonID - 21) < m_Entries.Count) { int button = info.ButtonID - 21; if (state.Mobile is PlayerMobile) { PlayerMobile pm = (PlayerMobile)state.Mobile; if (pm.Transformation.MetamorphoseList != null && button < pm.Transformation.MetamorphoseList.Count && button >= 0) { pm.Transformation.MetamorphoseList.RemoveAt(button); } pm.SendGump(new MetamorphoseGump(pm, m_Scroll, pm.Transformation.MetamorphoseList, 5)); } } } else if (info.ButtonID >= 1) { if ((info.ButtonID - 1) < m_Entries.Count) { int button = info.ButtonID - 1; MetamorphoseEntry entry = (MetamorphoseEntry)m_Entries[button]; switch (m_Owner) { case 6: { Spell spell = new Spells.MutationSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.Hue); spell.Cast(); break; } case 5: { Spell spell = new Spells.MetamorphoseSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.StrMod, entry.DexMod, entry.IntMod, entry.SkillReq, entry.Hue); spell.Cast(); break; } case 4: { Spell spell = new Spells.TransmutationSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.Hue); spell.Cast(); break; } case 3: { Spell spell = new Spells.ChimereSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.Hue); spell.Cast(); break; } case 2: { Spell spell = new Spells.SubterfugeSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.Hue); spell.Cast(); break; } case 1: { Spell spell = new Spells.AlterationSpell(m_Caster, m_Scroll, entry.Name, entry.BodyID, entry.Hue); spell.Cast(); break; } } } } }