public RaceChangeConfirmGump(IRaceChanger owner, PlayerMobile from, Race targetRace) : base(50, 50) { from.CloseGump <RaceChangeConfirmGump>(); m_Owner = owner; m_From = from; m_Race = targetRace; AddPage(0); AddBackground(0, 0, 240, 135, 0x2422); if (targetRace == Race.Human) { AddHtmlLocalized(15, 15, 210, 75, 1073643, 0); // Are you sure you wish to embrace your humanity? } else if (targetRace == Race.Elf) { AddHtmlLocalized(15, 15, 210, 75, 1073642, 0); // Are you sure you want to follow the elven ways? } else { AddHtml(15, 15, 210, 75, $"Are you sure you want to change your race to {targetRace.Name}?"); } AddButton(160, 95, 0xF7, 0xF8, 1); AddButton(90, 95, 0xF2, 0xF1, 0); }
private static void Offer(IRaceChanger owner, PlayerMobile from, Race targetRace) { var ns = from.NetState; if (ns == null || !CanChange(from, targetRace)) { return; } CloseCurrent(ns); m_Pending[ns] = new RaceChangeState(owner, ns, targetRace); ns.SendRaceChanger(from.Female, targetRace); }
public RaceChangeConfirmGump( IRaceChanger owner, PlayerMobile from, Race targetRace ) : base( 50, 50 ) { from.CloseGump( Type ); m_Owner = owner; m_From = from; m_Race = targetRace; AddPage( 0 ); AddBackground( 0, 0, 240, 135, 0x2422 ); if ( targetRace == Race.Human ) AddHtmlLocalized( 15, 15, 210, 75, 1073643, 0, false, false ); // Are you sure you wish to embrace your humanity? else if ( targetRace == Race.Elf ) AddHtmlLocalized( 15, 15, 210, 75, 1073642, 0, false, false ); // Are you sure you want to follow the elven ways? else AddHtml( 15, 15, 210, 75, String.Format( "Are you sure you want to change your race to {0}?", targetRace.Name ), false, false ); AddButton( 160, 95, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 ); AddButton( 90, 95, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 ); }
public RaceChangeState(IRaceChanger owner, NetState ns, Race targetRace) { m_Owner = owner; m_TargetRace = targetRace; Timer.StartTimer(m_TimeoutDelay, () => Timeout(ns), out _timeoutToken); }
public RaceChangeState(IRaceChanger owner, NetState ns, Race targetRace) { m_Owner = owner; m_TargetRace = targetRace; m_Timeout = Timer.DelayCall <NetState>(m_TimeoutDelay, m_TimeoutCallback, ns); }
private static void RaceChangeReply(NetState state, PacketReader pvSrc) { RaceChangeState raceChangeState; if (!m_Pending.TryGetValue(state, out raceChangeState)) { return; } CloseCurrent(state); PlayerMobile pm = state.Mobile as PlayerMobile; if (pm == null) { return; } IRaceChanger owner = raceChangeState.m_Owner; Race targetRace = raceChangeState.m_TargetRace; if (pvSrc.Size == 5) { if (owner != null) { owner.OnCancel(pm); } return; } if (!CanChange(pm, targetRace) || (owner != null && !owner.CheckComplete(pm))) { return; } int hue = pvSrc.ReadUInt16(); int hairItemId = pvSrc.ReadUInt16(); int hairHue = pvSrc.ReadUInt16(); int facialHairItemId = pvSrc.ReadUInt16(); int facialHairHue = pvSrc.ReadUInt16(); pm.Race = targetRace; pm.Hue = targetRace.ClipSkinHue(hue) | 0x8000; if (targetRace.ValidateHair(pm, hairItemId)) { pm.HairItemID = hairItemId; pm.HairHue = targetRace.ClipHairHue(hairHue); } else { pm.HairItemID = 0; } if (targetRace.ValidateFacialHair(pm, facialHairItemId)) { pm.FacialHairItemID = facialHairItemId; pm.FacialHairHue = targetRace.ClipHairHue(facialHairHue); } else { pm.FacialHairItemID = 0; } if (targetRace == Race.Human) { pm.SendLocalizedMessage(1073654); // You are now fully human. } else if (targetRace == Race.Elf) { pm.SendLocalizedMessage(1073653); // You are now fully initiated into the Elven culture. } else { pm.SendMessage("You have fully changed your race to {0}.", targetRace.Name); } if (owner != null) { owner.ConsumeNeeded(pm); } }
public RaceChangeState( IRaceChanger owner, NetState ns, Race targetRace ) { m_Owner = owner; m_TargetRace = targetRace; m_Timeout = Timer.DelayCall<NetState>( m_TimeoutDelay, m_TimeoutCallback, ns ); }
private static void Offer( IRaceChanger owner, PlayerMobile from, Race targetRace ) { NetState ns = from.NetState; if ( ns == null || !CanChange( from, targetRace ) ) return; CloseCurrent( ns ); m_Pending[ns] = new RaceChangeState( owner, ns, targetRace ); ns.Send( new RaceChanger( from.Female, targetRace ) ); }