public override int CanCraft(Mobile from, BaseTool tool, Type typeItem) { if (tool == null || tool.Deleted || tool.UsesRemaining < 0) { return(1044038); // You have worn out your tool! } else if (!BaseTool.CheckAccessible(tool, from)) { return(1044263); // The tool must be on your person to use. } if (typeItem != null) { object o = Activator.CreateInstance(typeItem); if (o is SpellScroll) { SpellScroll scroll = (SpellScroll)o; Spellbook book = Spellbook.Find(from, scroll.SpellID); bool hasSpell = (book != null && book.HasSpell(scroll.SpellID)); scroll.Delete(); return(hasSpell ? 0 : 1042404); // null : You don't have that spell! } else if (o is Item) { ((Item)o).Delete(); } } return(0); }
// Use this for initialization void Start() { spellsData = new List <SpellData>(); // Get GameObjects spellBook = GameObject.Find("SpellBook"); spellScroller = GameObject.Find("SpellScroller").GetComponent <SpellScroll>(); buyButton = GameObject.Find("BuySpellButton"); // Get Spells Behaviours // TODO: maybe put spells into thier own dll files spellBehaviours = new Dictionary <string, ISpellBehaviour> { { "newcard", new NewCardSpell() }, { "fix", new FixSpell() }, { "fixall", new FixAllSpell() }, }; // Populate Spellbook JsonData spellJson = JsonHelper.LoadJsonResource(SPELLS_PATH); for (int i = 0; i < spellJson.Count; i++) { spellsData.Add((SpellData)spellJson[i]); spellScroller.AddSpell(spellsData[i]); } UpdateButton(); // Callbacks SpellScroll.OnSpellChanged += SpellChanged; GameManager.OnTileSelected += CastTargetedSpell; // Disable Spellbook spellBook.SetActive(false); }
/// Author: JT Esmond /// Date: 4/10/2021 /// <summary> /// function that turns on the different pop ups for the spell scrolls /// </summary> public void SpellPopUp(Interactable collected, SpellScroll spell) { Time.timeScale = 0f; GameIsPaused = true; transform.GetChild(0).gameObject.SetActive(true); foreach (ScriptablePopUp popUp in PopUps) { if (collected.GetType() == popUp.ObjRef.GetComponent <Interactable>().GetType()) { //checks which spell is being picked up then displays the corresponding pop up if (spell == SpellScrolls[0]) { listLocation = 10; global::PopUp.Instance.UpdateInteractableInfo(listLocation); } else if (spell == SpellScrolls[1]) { listLocation = 11; global::PopUp.Instance.UpdateInteractableInfo(listLocation); } else if (spell == SpellScrolls[2]) { listLocation = 12; global::PopUp.Instance.UpdateInteractableInfo(listLocation); } else if (spell == SpellScrolls[3]) { listLocation = 13; global::PopUp.Instance.UpdateInteractableInfo(listLocation); } } } }
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem) { if (tool.Deleted || tool.UsesRemaining < 0) { return(1044038); // You have worn out your tool! } else if (!BaseTool.CheckAccessible(tool, from)) { return(1044263); // The tool must be on your person to use. } if (typeItem != null) { object o = Activator.CreateInstance(typeItem); if (o is SpellScroll) { SpellScroll scroll = (SpellScroll)o; Spellbook book = Spellbook.Find(from, scroll.SpellID); bool hasSpell = (book != null && book.HasSpell(scroll.SpellID)); scroll.Delete(); //return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell! if (hasSpell) { //GetCastSkills Server.Spells.Spell spell = Server.Spells.SpellRegistry.NewSpell(scroll.SpellID, from, null); if (spell == null) { return(0); } else { double minmagery = 0.0; double maxmagery = 0.0; spell.GetCastSkills(out minmagery, out maxmagery); if (minmagery > from.Skills.Magery.Value) { return(1044153); // You don't have the required skills to attempt this item. } else { return(0); } } } else { return(1042404); // You don't have that spell! } } else if (o is Item) { ((Item)o).Delete(); } } return(0); }
public override int GetMana() { if (Scroll is BaseWand) { return(0); } if (Caster.AccessLevel >= AccessLevel.GameMaster) { return(0); } if (Scroll is SpellScroll) { SpellScroll scroll = Scroll as SpellScroll; if (scroll.ManaCost > 0) { return(scroll.ManaCost); } return((int)(ManaCost / 1.755)); } return(ManaCost); }
public static int DeleteNecroScrolls(Mobile m) { if (m == null) { return(0); } // On traite les bosses pour ne pas leur retiré leurs sorts if (m is NecroBoss) { return(0); } Container c = m.Backpack; if (c == null) { return(0); } int deleted = 0, count = 0; List <SpellScroll> otherScrolls = new List <SpellScroll>(); SpellScroll scroll = null; while ((scroll = c.FindItemByType(typeof(SpellScroll)) as SpellScroll) != null) { count++; if (scroll.SpellID >= 100 && scroll.SpellID <= 116) { scroll.Delete(); deleted++; } else { Container bank = m.BankBox; bank.DropItem(scroll); otherScrolls.Add(scroll); } if (count > 250) { Console.WriteLine("!!! Exception Scroll Deleter !!!"); break; } } foreach (SpellScroll ss in otherScrolls) { if (ss != null) { m.Backpack.DropItem(ss); } } return(deleted); }
public override void OnDeath(Container c) { base.OnDeath(c); switch (Utility.Random(500)) { case 0: { c.AddItem(SpellScroll.MakeMaster(new GateTravelScroll())); } break; } }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is CSpellScroll && dropped.Amount == 1) { CSpellScroll scroll = (CSpellScroll)dropped; if (!SchoolSpells.Contains(scroll.SpellType)) { return(false); } else if (HasSpell(scroll.SpellType)) { from.SendLocalizedMessage(500179); // That spell is already present in that spellbook. return(false); } else { AddSpell(scroll.SpellType); scroll.Delete(); from.Send(new PlaySound(0x249, GetWorldLocation())); return(true); } } else if (dropped is SpellScroll && dropped.Amount == 1) { SpellScroll scroll = (SpellScroll)dropped; Type type = SpellRegistry.Types[scroll.SpellID]; if (!SchoolSpells.Contains(type)) { return(false); } else if (HasSpell(type)) { from.SendLocalizedMessage(500179); // That spell is already present in that spellbook. return(false); } else { AddSpell(type); scroll.Delete(); from.Send(new PlaySound(0x249, GetWorldLocation())); return(true); } } else { return(false); } }
public BagOfScrolls( int amount, bool isEventBag ) { SpellScroll[] scrolls = new SpellScroll[] { new FlamestrikeScroll( amount ), new LightningScroll( amount ), new GreaterHealScroll( amount ), new MagicReflectScroll( amount ) }; if( isEventBag ) { EventItem = true; for( int i = 0; i < scrolls.Length; ++i ) { scrolls[i].EventItem = true; DropItem( scrolls[i] ); } } else for( int i = 0; i < scrolls.Length; ++i ) DropItem( scrolls[i] ); }
// HACK: ad-hoc placement code private void PlaceItems() { var heal = new SpellScroll(Map.GetRandomOpenPoint(), new Spell.Heal()); Map.AddItem(heal); int count = Rand.Next(2, 5); for (int i = 0; i < count; i++) { // TODO: GetRandomOpenPoint only ensures that a tile is walkable var spell = new SpellScroll(Map.GetRandomOpenPoint(), SpellHandler.RandomSpell()); Map.AddItem(spell); } // TODO: ensure heal spells get generated when prev level was full cleared }
public override int CanCraft(Mobile from, ITool tool, Type typeItem) { int num = 0; if (tool == null || tool.Deleted || tool.UsesRemaining <= 0) { return(1044038); // You have worn out your tool! } else if (!tool.CheckAccessible(from, ref num)) { return(num); // The tool must be on your person to use. } if (typeItem != null && typeItem.IsSubclassOf(typeof(SpellScroll))) { if (!_Buffer.ContainsKey(typeItem)) { object o = Activator.CreateInstance(typeItem); if (o is SpellScroll) { SpellScroll scroll = (SpellScroll)o; _Buffer[typeItem] = scroll.SpellID; scroll.Delete(); } else if (o is IEntity) { ((IEntity)o).Delete(); return(1042404); // You don't have that spell! } } int id = _Buffer[typeItem]; Spellbook book = Spellbook.Find(from, id); if (book == null || !book.HasSpell(id)) { return(1042404); // You don't have that spell! } } return(0); }
public BagOfScrolls(int amount, bool isEventBag) { SpellScroll[] scrolls = new SpellScroll[] { new FlamestrikeScroll(amount), new LightningScroll(amount), new GreaterHealScroll(amount), new MagicReflectScroll(amount), new NOSFlameStrikeScroll(amount) }; if (isEventBag) { EventItem = true; for (int i = 0; i < scrolls.Length; ++i) { scrolls[i].EventItem = true; DropItem(scrolls[i]); } } else { for (int i = 0; i < scrolls.Length; ++i) { DropItem(scrolls[i]); } } }
public static bool GetScroll(Mobile from, Type typeItem) { if (typeItem != null) { object o = Activator.CreateInstance(typeItem); if (o is SpellScroll) { SpellScroll scroll = (SpellScroll)o; Spellbook book = Spellbook.Find(from, scroll.SpellID); bool hasSpell = (book != null && book.HasSpell(scroll.SpellID)); scroll.Delete(); return(hasSpell); } else if (o is Item) { ((Item)o).Delete(); } } return(false); }
private Item RandomMasterScroll() { var scroll = m_MasterScrolls[Utility.Random(m_MasterScrolls.Length)]; return(SpellScroll.MakeMaster(Activator.CreateInstance(scroll) as SpellScroll)); }
public InternalTarget(SpellScroll scroll) : base(3, false, TargetFlags.None) { m_Scroll = scroll; }
public static void GenerateJobs(SocietiesGroupType societyGroupType) { SocietyJob societyJob = null; switch (societyGroupType) { #region Adventurer's Lodge case SocietiesGroupType.AdventurersLodge: break; #endregion #region Artificer's Enclave case SocietiesGroupType.ArtificersEnclave: //Alchemy Easy societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 2; societyJob.m_DestinationMobile = typeof(Alchemist); societyJob.m_DestinationMobileName = "Alchemist"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: societyJob.m_PrimaryType = typeof(GreaterHealPotion); societyJob.m_PrimaryTypeName = "Greater Heal Potions"; societyJob.m_TargetNumber = Utility.RandomList(350, 375, 400, 425, 450); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = 3852; societyJob.m_IconOffsetX = 55; societyJob.m_IconOffsetY = 40; break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //Alchemy Hard societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 4; societyJob.m_DestinationMobile = typeof(Alchemist); societyJob.m_DestinationMobileName = "Alchemist"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: societyJob.m_PrimaryType = typeof(LethalPoisonPotion); societyJob.m_PrimaryTypeName = "Lethal Poison Potions"; societyJob.m_TargetNumber = Utility.RandomList(40, 45, 50, 55, 60); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = 3850; societyJob.m_IconOffsetX = 55; societyJob.m_IconOffsetY = 40; break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //----- //Inscription Easy societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 2; societyJob.m_DestinationMobile = typeof(Scribe); societyJob.m_DestinationMobileName = "Scribe"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: SpellScroll spellScroll = SpellScroll.GetRandomSpellScroll(6); if (spellScroll == null) { return; } societyJob.m_PrimaryType = spellScroll.GetType(); societyJob.m_PrimaryTypeName = Utility.Capitalize(spellScroll.Name) + "s"; societyJob.m_TargetNumber = Utility.RandomList(150, 175, 200, 225, 250); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = spellScroll.IconItemId; societyJob.m_IconHue = spellScroll.IconHue; societyJob.m_IconOffsetX = spellScroll.IconOffsetX; societyJob.m_IconOffsetY = spellScroll.IconOffsetY; spellScroll.Delete(); break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //Inscription Hard societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 4; societyJob.m_DestinationMobile = typeof(Scribe); societyJob.m_DestinationMobileName = "Scribe"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: SpellScroll spellScroll = null; double randomResult = Utility.RandomDouble(); if (randomResult <= .50) { spellScroll = SpellScroll.GetRandomSpellScroll(7); societyJob.m_TargetNumber = Utility.RandomList(12, 14, 16, 18, 20); } else { spellScroll = SpellScroll.GetRandomSpellScroll(8); societyJob.m_TargetNumber = Utility.RandomList(6, 7, 8, 9, 10); } if (spellScroll == null) { return; } societyJob.m_PrimaryType = spellScroll.GetType(); societyJob.m_PrimaryTypeName = Utility.Capitalize(spellScroll.Name) + "s"; societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = spellScroll.IconItemId; societyJob.m_IconHue = spellScroll.IconHue; societyJob.m_IconOffsetX = spellScroll.IconOffsetX; societyJob.m_IconOffsetY = spellScroll.IconOffsetY; spellScroll.Delete(); break; } #endregion Societies.m_SocietyJobs.Add(societyJob); break; #endregion #region Farmer's Cooperative case SocietiesGroupType.FarmersCooperative: break; #endregion #region Fisherman's Circle case SocietiesGroupType.FishermansCircle: break; #endregion #region Monster Hunter's Society case SocietiesGroupType.MonsterHuntersSociety: break; #endregion #region Seafarer's League case SocietiesGroupType.SeafarersLeague: break; #endregion #region Smithing Order case SocietiesGroupType.SmithingOrder: break; #endregion #region Thieves Guild case SocietiesGroupType.ThievesGuild: break; #endregion #region Tradesman Union case SocietiesGroupType.TradesmanUnion: break; #endregion #region Zoological Foundation case SocietiesGroupType.ZoologicalFoundation: break; #endregion } }
public static string ComputeName(SpellScroll ss) { string name = string.IsNullOrEmpty(ss.Name) ? CliLoc.LocToString(ss.LabelNumber) : ss.Name; return(name + " scroll"); }
protected override void OnTarget(Mobile from, object target) { if (from == null) { return; } if (target is Mobile) { from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ForensicsCooldown * 1000); if (from.CheckTargetSkill(SkillName.Forensics, target, 50.0, 120.0, 1.0)) { if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild) { from.SendLocalizedMessage(501004); //That individual is a thief! } else { from.SendLocalizedMessage(501003); //You notice nothing unusual. } } else { from.SendLocalizedMessage(501001); //You cannot determain anything useful. } } else if (target is Head) { } else if (target is Corpse) { Corpse corpse = target as Corpse; if (corpse.Owner is BaseCreature && !corpse.Carved && from.Backpack != null) { BaseCreature bc_Creature = corpse.Owner as BaseCreature; bool foundBladed = false; Item oneHanded = from.FindItemOnLayer(Layer.OneHanded); Item twoHanded = from.FindItemOnLayer(Layer.TwoHanded); if (oneHanded is BaseSword || oneHanded is BaseKnife) { foundBladed = true; } if (twoHanded is BaseSword || twoHanded is BaseKnife) { foundBladed = true; } if (!foundBladed) { Item[] items = from.Backpack.FindItemsByType(typeof(BaseMeleeWeapon)); for (int a = 0; a < items.Length; a++) { if (items[a] is BaseSword || items[a] is BaseKnife) { foundBladed = true; break; } } } if (!foundBladed) { from.SendMessage("You must have a cutting weapon equipped or in your pack in order to carve this."); return; } bc_Creature.OnCarve(from, corpse); return; } if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 120.0, 1.0)) { Corpse c = (Corpse)target; if (c.Looters.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < c.Looters.Count; i++) { if (i > 0) { sb.Append(", "); } sb.Append(((Mobile)c.Looters[i]).Name); } c.LabelTo(from, 1042752, sb.ToString());//This body has been distrubed by ~1_PLAYER_NAMES~ } else { c.LabelTo(from, 501002);//The corpse has not be desecrated. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } else if (target is ILockpickable) { ILockpickable p = (ILockpickable)target; if (p.Picker != null) { from.SendLocalizedMessage(1042749, p.Picker.Name);//This lock was opened by ~1_PICKER_NAME~ } else { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } else if (target is ResearchMaterials) { ResearchMaterials researchMaterials = target as ResearchMaterials; researchMaterials.AttemptResearch(from); } else if (target is SpellScroll) { SpellScroll spellScroll = target as SpellScroll; if (spellScroll.MasterStatus == 1 || spellScroll.MasterStatus == 2) { if (from.Skills.Forensics.Value < 95) { from.SendMessage("You do not have enough forensics evaluation skill to make an appropriate research attempt on that."); return; } from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ForensicsCooldown * 1000); if (from.CheckSkill(SkillName.Forensics, 95, 120, 1.0)) { from.SendSound(0x652); from.SendMessage("You learn many a great secret whilst scrying the words held within. You may now apply this researched master scroll to an ancient mystery scroll."); spellScroll.Delete(); from.AddToBackpack(new ResearchedMasterScroll()); return; } else { if (Utility.RandomDouble() <= .33) { from.SendSound(0x5AE); from.SendMessage("The scroll crumbles to dust before your very eyes and is lost!"); spellScroll.Delete(); } else { from.SendSound(0x055); from.SendMessage("You diligently sift through the words within the scroll, but are unable to glean any secrets held within."); } return; } } } }