private void CraftEnhancedSpellbook_Callback(Mobile from, Item item, bool target) { PlayerMobile player = from as PlayerMobile; Spellbook spellbook = item as Spellbook; //Player or Item is Invalid if (player == null || item == null) { return; } //Target Non-Enhanced Spellbook if (spellbook == null || !(item is EnhancedSpellbook)) { player.SendMessage("You must target a basic spellbook."); return; } //Spellbook Isn't In Inventory or Equipped if (!spellbook.IsChildOf(player)) { player.SendMessage("You must target a spellbook that you have equipped or that is in your backpack."); return; } //Spellbook Has Spells In It if (spellbook.SpellCount > 0) { player.SendMessage("You must target an empty spellbook."); return; } double inscriptionSkillRequired = 100; switch (m_EnhancedSpellbookType) { case EnhancedSpellbookType.Wizard: inscriptionSkillRequired = 80; break; case EnhancedSpellbookType.Warlock: inscriptionSkillRequired = 80; break; case EnhancedSpellbookType.Summoner: inscriptionSkillRequired = 80; break; case EnhancedSpellbookType.Fire: inscriptionSkillRequired = 90; break; case EnhancedSpellbookType.Energy: inscriptionSkillRequired = 90; break; case EnhancedSpellbookType.Slayer: inscriptionSkillRequired = 100; break; } //Player Has Insufficient Inscription if (player.Skills[SkillName.Inscribe].Value < inscriptionSkillRequired) { player.SendMessage("You lack the neccessary Inscription skill to use this tome"); return; } EnhancedSpellbook enhancedSpellbook; if (m_EnhancedSpellbookType == EnhancedSpellbookType.Slayer) { enhancedSpellbook = new EnhancedSpellbook(EnhancedSpellbookType.Slayer, m_SlayerGroup); } else { enhancedSpellbook = new EnhancedSpellbook(m_EnhancedSpellbookType); } enhancedSpellbook.CraftedBy = player; player.Backpack.AddItem(enhancedSpellbook); player.SendMessage("You craft an enhanced spellbook"); from.PlaySound(0x249); spellbook.Delete(); Delete(); }
/// <summary> /// Overrides the Double-Click option on the item. Supplies the /// player that double-clicks on the stone with appropriate gear /// based upon their skill levels. /// </summary> /// <param name="m">PlayerMobile to be supplied</param> public override void OnDoubleClick(Mobile m) { if (m.Backpack != null) { if (((m.X) == this.X || (m.X - 1) == this.X || (m.X + 1) == this.X) && ((m.Y) == this.Y || (m.Y - 1) == this.Y || (m.Y + 1) == this.Y)) { if (!Tourney) { Supply(new BagOfPots(8, 8, 4, 4, 5), m, typeof(BagOfPots)); for (int i = 1; i <= 5; i++) { TrapableContainer con = new Pouch(); con.TrapType = TrapType.MagicTrap; con.TrapLevel = 1; con.TrapPower = 1; if (!m.AddToBackpack(con)) { con.Delete(); } } } else { for (int i = 1; i <= 10; i++) { Item item = new TotalRefreshPotion(); if (!m.AddToBackpack(item)) { item.Delete(); } } } if (m.Skills[SkillName.Magery].Value >= 50.0 || m.Str <= 50) { EquipArmor(new LeatherLegs(), true, m, typeof(LeatherLegs), m_EquipHue); EquipArmor(new LeatherGorget(), true, m, typeof(LeatherGorget), m_EquipHue); EquipArmor(new LeatherGloves(), true, m, typeof(LeatherGloves), m_EquipHue); EquipArmor(new LeatherChest(), true, m, typeof(LeatherChest), m_EquipHue); EquipArmor(new LeatherArms(), true, m, typeof(LeatherArms), m_EquipHue); EquipArmor(new LeatherCap(), true, m, typeof(LeatherCap), m_EquipHue); } else { EquipArmor(new ChainLegs(), true, m, typeof(ChainLegs), m_EquipHue); EquipArmor(new LeatherGorget(), true, m, typeof(LeatherGorget), m_EquipHue); EquipArmor(new RingmailGloves(), true, m, typeof(RingmailGloves), m_EquipHue); EquipArmor(new ChainChest(), true, m, typeof(ChainChest), m_EquipHue); EquipArmor(new RingmailArms(), true, m, typeof(RingmailArms), m_EquipHue); EquipArmor(new CloseHelm(), true, m, typeof(CloseHelm), m_EquipHue); } if (m.Skills[SkillName.Magery].Value >= 50.0) { Container pack = m.Backpack; if (pack.FindItemByType(typeof(Spellbook)) == null) { Spellbook book = new Spellbook(); book.Content = ulong.MaxValue; book.LootType = LootType.Regular; if (!m.AddToBackpack(book)) { book.Delete(); } } Supply(new BagOfReagents(50), m, typeof(BagOfReagents)); } if (m.Skills[SkillName.Healing].Value >= 50.0 || m.Skills[SkillName.Veterinary].Value >= 50) { Supply(new Bandage(50), m, typeof(Bandage)); } if (m.Skills[SkillName.Swords].Value >= 50.0) { EquipItem(new Katana(), true, m, typeof(Katana)); EquipItem(new Halberd(), false, m, typeof(Halberd)); EquipItem(new BattleAxe(), false, m, typeof(BattleAxe)); } if (m.Skills[SkillName.Fencing].Value >= 50.0) { EquipItem(new Kryss(), true, m, typeof(Kryss)); EquipItem(new ShortSpear(), false, m, typeof(ShortSpear)); EquipItem(new Spear(), false, m, typeof(Spear)); } if (m.Skills[SkillName.Macing].Value >= 50.0) { EquipItem(new Mace(), true, m, typeof(Mace)); EquipItem(new QuarterStaff(), false, m, typeof(QuarterStaff)); EquipItem(new WarHammer(), false, m, typeof(WarHammer)); } if (m.Skills[SkillName.Archery].Value >= 50.0) { EquipItem(new Bow(), false, m, typeof(Bow)); EquipItem(new Crossbow(), false, m, typeof(Crossbow)); EquipItem(new HeavyCrossbow(), false, m, typeof(HeavyCrossbow)); Supply(new Arrow(50), m, typeof(Arrow)); Supply(new Bolt(50), m, typeof(Bolt)); } } else { m.SendMessage("You reach out but cannot seem to touch the stone..."); } } else { m.SendMessage("For some reason you don't seem to have a backpack..."); } }
/// <summary> /// Overrides the Double-Click option on the item. Supplies the /// player that double-clicks on the stone with appropriate gear /// based upon their skill levels. /// </summary> /// <param name="m">PlayerMobile to be supplied</param> public override void OnDoubleClick(Mobile m) { if (m.Backpack != null) { if (((m.X) == this.X || (m.X - 1) == this.X || (m.X + 1) == this.X) && ((m.Y) == this.Y || (m.Y - 1) == this.Y || (m.Y + 1) == this.Y)) { if (!Tourney) { Supply(new BagOfPots(8, 8, 4, 4, 5), m, typeof(BagOfPots)); for (int i = 1; i <= 5; i++) { TrapableContainer con = new Pouch(); con.TrapType = TrapType.MagicTrap; con.TrapLevel = 1; con.TrapPower = 1; if (!m.AddToBackpack(con)) con.Delete(); } } else { for (int i = 1; i <= 10; i++) { Item item = new TotalRefreshPotion(); if (!m.AddToBackpack(item)) item.Delete(); } } if (m.Skills[SkillName.Magery].Value >= 50.0 || m.Str <= 50) { EquipArmor(new LeatherLegs(), true, m, typeof(LeatherLegs), m_EquipHue); EquipArmor(new LeatherGorget(), true, m, typeof(LeatherGorget), m_EquipHue); EquipArmor(new LeatherGloves(), true, m, typeof(LeatherGloves), m_EquipHue); EquipArmor(new LeatherChest(), true, m, typeof(LeatherChest), m_EquipHue); EquipArmor(new LeatherArms(), true, m, typeof(LeatherArms), m_EquipHue); EquipArmor(new LeatherCap(), true, m, typeof(LeatherCap), m_EquipHue); } else { EquipArmor(new ChainLegs(), true, m, typeof(ChainLegs), m_EquipHue); EquipArmor(new LeatherGorget(), true, m, typeof(LeatherGorget), m_EquipHue); EquipArmor(new RingmailGloves(), true, m, typeof(RingmailGloves), m_EquipHue); EquipArmor(new ChainChest(), true, m, typeof(ChainChest), m_EquipHue); EquipArmor(new RingmailArms(), true, m, typeof(RingmailArms), m_EquipHue); EquipArmor(new CloseHelm(), true, m, typeof(CloseHelm), m_EquipHue); } if (m.Skills[SkillName.Magery].Value >= 50.0) { Container pack = m.Backpack; if (pack.FindItemByType(typeof(Spellbook)) == null) { Spellbook book = new Spellbook(); book.Content = ulong.MaxValue; book.LootType = LootType.Regular; if (!m.AddToBackpack(book)) book.Delete(); } Supply(new BagOfReagents(50), m, typeof(BagOfReagents)); } if (m.Skills[SkillName.Healing].Value >= 50.0 || m.Skills[SkillName.Veterinary].Value >= 50) { Supply(new Bandage(50), m, typeof(Bandage)); } if (m.Skills[SkillName.Swords].Value >= 50.0) { EquipItem(new Katana(), true, m, typeof(Katana)); EquipItem(new Halberd(), false, m, typeof(Halberd)); EquipItem(new BattleAxe(), false, m, typeof(BattleAxe)); } if (m.Skills[SkillName.Fencing].Value >= 50.0) { EquipItem(new Kryss(), true, m, typeof(Kryss)); EquipItem(new ShortSpear(), false, m, typeof(ShortSpear)); EquipItem(new Spear(), false, m, typeof(Spear)); } if (m.Skills[SkillName.Macing].Value >= 50.0) { EquipItem(new Mace(), true, m, typeof(Mace)); EquipItem(new QuarterStaff(), false, m, typeof(QuarterStaff)); EquipItem(new WarHammer(), false, m, typeof(WarHammer)); } if (m.Skills[SkillName.Archery].Value >= 50.0) { EquipItem(new Bow(), false, m, typeof(Bow)); EquipItem(new Crossbow(), false, m, typeof(Crossbow)); EquipItem(new HeavyCrossbow(), false, m, typeof(HeavyCrossbow)); Supply(new Arrow(50), m, typeof(Arrow)); Supply(new Bolt(50), m, typeof(Bolt)); } } else { m.SendMessage("You reach out but cannot seem to touch the stone..."); } } else { m.SendMessage("For some reason you don't seem to have a backpack..."); } }
public void GoToPrison() { try { if (m_Player == null || m_Player.Deleted) { return; } Account acct = m_Player.Account as Account; // stable the players pets StablePets(m_Staff, m_Player); // drop holding Item held = m_Player.Holding; if (held != null) { held.ClearBounce(); if (m_Player.Backpack != null) { m_Player.Backpack.DropItem(held); } } m_Player.Holding = null; // move their items to the bank, overload if needed Backpack bag = new Backpack(); ArrayList equip = new ArrayList(m_Player.Items); if (m_Player.Backpack != null) { // count clothing items int WornCount = 0; foreach (Item i in equip) { if (Moongate.RestrictedItem(m_Player, i) == false) { continue; // not clothes } else { WornCount++; } } // Unequip any items being worn foreach (Item i in equip) { if (Moongate.RestrictedItem(m_Player, i) == false) { continue; } else { m_Player.Backpack.DropItem(i); } } // Get a count of all items in the player's backpack. ArrayList items = new ArrayList(m_Player.Backpack.Items); // Drop our new bag in the player's bank m_Player.BankBox.DropItem(bag); // Run through all items in player's pack, move them to the bag we just dropped in the bank foreach (Item i in items) { m_Player.Backpack.RemoveItem(i); bag.DropItem(i); } } // handle imprisoning of logged out players m_Player.MoveToWorld(m_Location, Map.Felucca); if (m_Player.NetState == null) { m_Player.LogoutLocation = m_Location; m_Player.Map = Map.Internal; } // make them an inmate m_Player.Inmate = true; // Give them a Deathrobe, Stinger dagger, and a blank spell book if (m_Player.Alive) { Item robe = new Server.Items.DeathRobe(); if (!m_Player.EquipItem(robe)) { robe.Delete(); } } Item aiStinger = new Server.Items.AIStinger(); if (!m_Player.AddToBackpack(aiStinger)) { aiStinger.Delete(); } Item spellbook = new Server.Items.Spellbook(); if (!m_Player.AddToBackpack(spellbook)) { spellbook.Delete(); } m_Player.ShortTermCriminalCounts += 3; // how long you will stay m_Player.LongTermCriminalCounts++; // how many times you've been to prison if (!m_Player.Alive && m_Player.NetState != null) { m_Player.CloseGump(typeof(Server.Gumps.ResurrectGump)); m_Player.SendGump(new Server.Gumps.ResurrectGump(m_Player, Server.Gumps.ResurrectMessage.Healer)); } int sentence = (int)m_Player.ShortTermCriminalCounts * 4; // decay time in prison is 4 hours per count m_Player.SendMessage("You have been imprisoned for {0} hours.", sentence); m_Staff.SendMessage("{0} has been imprisoned for {1} hours.", m_Player.Name, sentence); LogHelper Logger = new LogHelper("Prison.log", false, true); Logger.Log(LogType.Mobile, m_Player, string.Format("{0}:{1}:{2}:{3}", m_Staff.Name, m_Staff.Location, m_Comment, sentence)); Logger.Finish(); Commands.CommandLogging.WriteLine(m_Staff, "{0} imprisoned {1}(Username: {2}) for {4} hours with reason: {3}.", m_Staff.Name, m_Player.Name, acct.Username, m_Comment, sentence); acct.Comments.Add(new AccountComment(m_Staff.Name, DateTime.Now + "\nTag count: " + (acct.Comments.Count + 1) + "\nImprisoned for " + sentence + " hours. Reason: " + m_Comment)); } catch (Exception ex) { LogHelper.LogException(ex); } }
public void WeaponSlayerTarget(Mobile from, object obj) { if (obj is BaseWeapon) { Console.WriteLine("Test"); BaseWeapon slayertarget = (BaseWeapon)obj; if (slayertarget.Slayer2 != SlayerName.None && slayertarget.Slayer != SlayerName.None) { from.SendMessage("Cette arme a déjà des slayers, vous ne pouvez en ajouter"); return; } Console.WriteLine("Test1"); double skillmin = Math.Min(from.Skills[SkillName.ArmsLore].Value, from.Skills[SkillName.Blacksmith].Value) + 1; double malus = slayertarget.WeaponDifficulty; double bonus = 0; double superbonus = 1; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == from.Serial) { superbonus = 2; } Console.WriteLine("Test1"); if (from.Skills[SkillName.Alchemy].Value > 80) { bonus += 5; } if (from.Skills[SkillName.ItemID].Value > 80) { bonus += 5; } foreach (Mobile m in from.GetMobilesInRange(1)) { PlayerMobile pm = m as PlayerMobile; if (pm == null || pm == from) { continue; } if (pm.AccessLevel > AccessLevel.Player) { continue; // Scriptiz : évitons qu'un GM observant le procédé soit une aide } if (pm.Hidden) { continue; // Scriptiz : si le PJ est caché il sert à rien } if (!pm.Alive) { continue; // Scriptiz : un PJ mort ne sert à rien non plus } int checkBonus = 0; if (pm.Skills[SkillName.Alchemy].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.Blacksmith].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.ArmsLore].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.ItemID].Value > 80) { checkBonus += 1; } if (checkBonus > 1) { bonus += 5; } if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == pm.Serial) { superbonus = 1.5; } if (slayertarget.Resource == CraftResource.MGlowing && VialTypes[19] > 0) { superbonus += 1; } } if (bonus > 25) { bonus = 25; } if (slayertarget.PlayerConstructed) { bonus *= 2; } if (CountType > 1 || VialTypes[21] == CountVial || VialTypes[20] == CountVial || VialTypes[19] == CountVial) { malus *= 2; } if (slayertarget.Slayer != SlayerName.None) { malus *= 2; } double chances = Math.Round(((skillmin + bonus) / malus * superbonus), 2); if (chances >= 90) { chances = 100 - malus; } if (chances < Utility.Random(100)) { from.SendMessage("Vous appliquez le slayer sur l'arme."); if (slayertarget.Slayer == SlayerName.None) { slayertarget.Slayer = AddSlayer(); } else { slayertarget.Slayer2 = AddSlayer(); } } else if (Utility.Random(100) <= malus * 2) { from.SendMessage("Vous échouez. Le slayer ronge lentement l'arme, tout est perdu."); slayertarget.Delete(); } else { from.SendMessage("Vous échouez, mais parvenez à conserver l'arme."); } EmptyForge(); return; } else if (obj is Spellbook) { Spellbook slayertarget = (Spellbook)obj; if (slayertarget.SpellbookType != SpellbookType.Regular) { from.SendMessage("Seul les livres arcaniques peuvent accepter un slayer"); return; } if (slayertarget.Slayer2 != SlayerName.None && slayertarget.Slayer != SlayerName.None) { from.SendMessage("Ce livre a déjà des slayers, vous ne pouvez en ajouter"); return; } double skillmin = (Math.Min(from.Skills[SkillName.EvalInt].Value, from.Skills[SkillName.Inscribe].Value) + 1); double malus = (65 - slayertarget.SpellCount); double bonus = 0; double superbonus = 1; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == from.Serial) { superbonus = 1.8; } if (from.Skills[SkillName.Alchemy].Value > 80) { bonus += 4; } if (from.Skills[SkillName.ItemID].Value > 80) { bonus += 4; } foreach (Mobile m in from.GetMobilesInRange(1)) { PlayerMobile pm = m as PlayerMobile; if (pm == null || pm == from) { continue; } if (pm.AccessLevel > AccessLevel.Player) { continue; // Scriptiz : évitons qu'un GM observant le procédé soit une aide } if (pm.Hidden) { continue; // Scriptiz : si le PJ est caché il sert à rien } if (!pm.Alive) { continue; // Scriptiz : un PJ mort ne sert à rien non plus } int checkBonus = 0; if (pm.Skills[SkillName.Alchemy].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.Magery].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.EvalInt].Value > 80) { checkBonus += 1; } if (pm.Skills[SkillName.ItemID].Value > 80) { checkBonus += 1; } if (checkBonus > 2) { bonus += 5; } if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == pm.Serial) { superbonus = 1.4; } } if (bonus > 25) { bonus = 25; } if (CountType > 1 || VialTypes[21] == CountVial || VialTypes[20] == CountVial || VialTypes[19] == CountVial) { malus *= 2; } if (slayertarget.Slayer != SlayerName.None) { malus *= 2; } double chances = Math.Round(((skillmin + bonus) / Math.Sqrt(malus) * superbonus), 2); if (chances >= 90) { chances = 90 - malus; } if (chances < Utility.Random(100)) { from.SendMessage("Vous appliquez le slayer sur le livre."); if (slayertarget.Slayer == SlayerName.None) { slayertarget.Slayer = AddSlayer(); } else { slayertarget.Slayer2 = AddSlayer(); } } else if (Utility.Random(100) <= malus * 2) { from.SendMessage("Vous échouez. Le slayer ronge lentement le livre, tout est perdu."); slayertarget.Delete(); } else { from.SendMessage("Vous échouez, mais parvenez à conserver le livre."); } EmptyForge(); return; } else { from.SendMessage("Ceci n'est pas un livre de sorts ou une arme"); } }
public override void OnResponse(Server.Network.NetState state, RelayInfo info) { Mobile from = state.Mobile; int index = info.ButtonID; //note: 0==exit if (from == null || index < 1 || index > ms_entryCount) return; //Avoid crashing the server with faked buttonIDs if (m_deed == null || m_deed.Deleted || from.Backpack == null || !m_deed.IsChildOf(from.Backpack)) from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. else { string name = ""; switch (index) { case 1: name = "Britain's Book of Compassion"; break; case 2: name = "Buccaneer's Den's Book of Chaos"; break; case 3: name = "Cove's Book of Love"; break; case 4: name = "Jhelom's Book of Valor"; break; case 5: name = "Magincia's Book of Pride"; break; case 6: name = "Minoc's Book of Sacrifice"; break; case 7: name = "Moonglow's Book of Honesty"; break; case 8: name = "Nujel'm's Book of Pleasure"; break; case 9: name = "Occlo's Book of the Mountain"; break; case 10: name = "Serpents Hold's Book of Order"; break; case 11: name = "Skara Brae's Book of Spirituality"; break; case 12: name = "Trinsic's Book of Honor"; break; case 13: name = "Vesper's Book of Industry"; break; case 14: name = "Wind's Book of Magicka"; break; case 15: name = "Yew's Book of Justice"; break; case 16: name = "Delucia's Book of the Lost Lands"; break; case 17: name = "Papua's Book of the Swamp"; break; } if (name != "") //Check if valid name has been set { Spellbook book = new Spellbook(); book.Content = ulong.MaxValue; //Fill with all spells book.Layer = Layer.Neck; //Layer book.Name = String.Format("{0} (layered)", name); book.Hue = m_selectedHue; if (from.AddToBackpack(book)) { from.SendMessage("The book has been placed in your backpack."); m_deed.Delete(); } else { book.Delete(); from.SendMessage("An error occured while creating the book."); } } } }