public override void OnResponse(NetState sender, RelayInfo info) { int index = info.ButtonID - 1; if (index >= 0 && index < m_SellList.Length) { HairstylistBuyInfo buyInfo = m_SellList[index]; int balance = Banker.GetBalance(m_From, m_Vendor.TypeOfCurrency); bool isFemale = (m_From.Female || m_From.Body.IsFemale); if (buyInfo.FacialHair && isFemale) { // You cannot place facial hair on a woman! m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState); } else if (balance >= buyInfo.Price) { try { object[] origArgs = buyInfo.GumpArgs; var args = new object[origArgs.Length]; for (int i = 0; i < args.Length; ++i) { if (origArgs[i] == CustomHairstylist.Price) { args[i] = m_SellList[index].Price; } else if (origArgs[i] == CustomHairstylist.From) { args[i] = m_From; } else if (origArgs[i] == CustomHairstylist.Vendor) { args[i] = m_Vendor; } else { args[i] = origArgs[i]; } } var g = Activator.CreateInstance(buyInfo.GumpType, args) as Gump; m_From.SendGump(g); } catch { } } else { // You cannot afford my services for that style. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0] % m_Entries.Length; int offset = switches[0] / m_Entries.Length; if (index >= 0 && index < m_Entries.Length) { if (offset >= 0 && offset < m_Entries[index].Hues.Length) { if (m_Hair && m_From.HairItemID > 0 || m_FacialHair && m_From.FacialHairItemID > 0) { if (!Banker.Withdraw(m_From, m_Vendor.TypeOfCurrency, m_Price)) { // You cannot afford my services for that style. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); return; } int hue = m_Entries[index].Hues[offset]; if (m_Hair) { m_From.HairHue = hue; } if (m_FacialHair) { m_From.FacialHairHue = hue; } } else { // You have no hair to dye and you cannot use this. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502623, m_From.NetState); } } } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_FacialHair && (m_From.Female || m_From.Body.IsFemale)) { return; } if (m_From.Race == Race.Elf) { m_From.SendMessage("This isn't implemented for elves yet. Sorry!"); return; } if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_Entries.Length) { ChangeHairstyleEntry entry = m_Entries[index]; if (m_From is PlayerMobile) { ((PlayerMobile)m_From).SetHairMods(-1, -1); } int hairID = m_From.HairItemID; int facialHairID = m_From.FacialHairItemID; if (entry.ItemID == 0) { if (m_FacialHair ? (facialHairID == 0) : (hairID == 0)) { return; } if (Banker.Withdraw(m_From, m_Vendor.TypeOfCurrency, m_Price)) { if (m_FacialHair) { m_From.FacialHairItemID = 0; } else { m_From.HairItemID = 0; } } else { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); // You cannot afford my services for that style. } } else { if (m_FacialHair) { if (facialHairID > 0 && facialHairID == entry.ItemID) { return; } } else { if (hairID > 0 && hairID == entry.ItemID) { return; } } if (Banker.Withdraw(m_From, m_Vendor.TypeOfCurrency, m_Price)) { if (m_FacialHair) { m_From.FacialHairItemID = entry.ItemID; } else { m_From.HairItemID = entry.ItemID; } } else { m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState); // You cannot afford my services for that style. } } } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } }