protected override void OnTarget(Mobile from, object targeted) { if (m_From is PlayerMobile) { if (m_Book.IsChildOf(m_From.Backpack)) { if (targeted is Mobile) { if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; PlayerMobile caster = (PlayerMobile)m_From; //Important aspects of returning to normal. String fromName = caster.Name; int fromBodyMod = caster.BodyMod; int fromNameHue = caster.NameHue; int fromHue = caster.Hue; int fromKills = caster.Kills; //Set all the aspects of the caster to those of the target caster.Kills = 0; caster.Criminal = true; caster.Name = creature.Name; caster.NameHue = creature.NameHue; caster.Hue = creature.Hue; caster.BodyMod = creature.Body; //Need to start a timer when impersonation starts. ImpersonationTimer DispellTimer = new ImpersonationTimer(from, fromName, fromNameHue, fromHue, fromKills, fromBodyMod, TimeSpan.FromMinutes(1.0)); DispellTimer.Start(); } else { from.SendMessage("You cannot impersonate that!"); } } else { from.SendMessage("You can only impersonate creatures."); } } else { from.SendMessage("The Spellbook must be in your pack."); } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Book.Deleted) { return; } if (m_Book.IsChildOf(m_From.Backpack)) { if (info.ButtonID == 1) { //m_From.SendMessage( "You are turning to the previous page!" ); m_Book.Page--; m_From.SendGump(new DaemonSpellGump((PlayerMobile)m_From, m_Book)); } else if (info.ButtonID == 2) { //m_From.SendMessage( "You are turning to the next page!" ); m_Book.Page++; m_From.SendGump(new DaemonSpellGump((PlayerMobile)m_From, m_Book)); } else if (info.ButtonID == 3) { m_From.SendMessage("You are casting Unholy Gate!"); //new UnholyGateSpell(m_From); } else if (info.ButtonID == 4) //DEAMON FORM { if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) || (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) || (DisguiseTimers.IsDisguised(m_From)) || (!m_From.CanBeginAction(typeof(PolymorphSpell))) || (Factions.Sigil.ExistsOn(m_From)) ) { m_From.SendMessage("You cannot obtain demonic power in that form."); } else { m_From.SendMessage("You are casting Daemon Form!"); new DaemonFormSpell(m_From); } } else if (info.ButtonID == 5) { m_From.SendMessage("You are casting Psi Explode!"); } else if (info.ButtonID == 6) { m_From.SendMessage("You are casting Soul Bleed!"); } else if (info.ButtonID == 7) { m_From.SendMessage("You are casting Possession!"); } else if (info.ButtonID == 8) { m_From.SendMessage("You are casting Mana Sheild!"); } else if (info.ButtonID == 9) //SHADOW WALK { if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) || (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) || (DisguiseTimers.IsDisguised(m_From)) || (!m_From.CanBeginAction(typeof(PolymorphSpell))) || (Factions.Sigil.ExistsOn(m_From)) ) { m_From.SendMessage("You cannot cast this spell in your current form!"); } else { m_From.SendMessage("You are casting Shadow Walk!"); new ShadowWalkSpell(m_From); } } else if (info.ButtonID == 10) //LAY AMBUSH { m_From.SendMessage("You are casting Lay Ambush!"); m_From.Target = new LayAmbushTarget(m_From, m_Book); } else if (info.ButtonID == 11) //BONE WALL { m_From.SendMessage("You are casting Bone Wall!"); m_From.Target = new BoneWallTarget(m_From, m_Book); } else if (info.ButtonID == 12) //IMPERSONATE { if ((m_From.BodyMod == 183 || m_From.BodyMod == 184) || (!m_From.CanBeginAction(typeof(IncognitoSpell)) || m_From.IsBodyMod) || (DisguiseTimers.IsDisguised(m_From)) || (!m_From.CanBeginAction(typeof(PolymorphSpell))) || (Factions.Sigil.ExistsOn(m_From)) ) { m_From.SendMessage("You cannot impersonate in that form."); } else { m_From.SendMessage("You are casting Impersonate!"); m_From.Target = new ImpersonateTarget(m_From, m_Book); } } } else { m_From.SendMessage("The Spellbook must be in your backpack."); } }