public void AttemptToSolve(PlayerMobile from) { if (m_Sleuths.Contains(from)) { from.SendMessage("You have already gleaned all you can from that."); return; } double minChance = m_RequiredForensicEval; double maxChance = m_RequiredForensicEval + 30; if (from.CheckSkill(SkillName.Forensics, minChance, maxChance)) // Passed the basic { from.SendMessage(m_SuccessMessage); if (from.CheckSkill(SkillName.Forensics, minChance, maxChance)) // Try again for exceptional { from.SendMessage(m_GreatSuccessMessage); } m_Sleuths.Add(from); } else { from.SendMessage(m_FailureMessage); } }
protected override void OnTick() { if (m_Harvester.TempStashedHarvest == null) { m_Harvester.SendLocalizedMessage(500446); // That is too far away Stop(); } else if (Running) { if (m_Harvester.TempStashedHarvestDef != null) { Effects.PlaySound(m_Harvester.Location, m_Harvester.Map, Utility.RandomList(m_Harvester.TempStashedHarvestDef.EffectSounds)); m_Harvester.CheckSkill(m_Harvester.TempStashedHarvestDef.Skill, 0.0, 100.0, 1.0); // TODO : This should be resource.MinSkill / MaxSkill // Check skill each tick } } else { Item i = m_Harvester.TempStashedHarvest; m_Harvester.TempStashedHarvest = null; Server.Engines.Harvest.HarvestSystem.GiveTo(m_Harvester, i, true); m_Harvester.SendMessage("You carefully gather a good amount of resources."); if (m_Harvester.TempStashedHarvestDef != null) { Effects.PlaySound(m_Harvester.Location, m_Harvester.Map, Utility.RandomList(m_Harvester.TempStashedHarvestDef.EffectSounds)); } } base.OnTick(); }
private Item TryStealItem(Item toSteal, object root, int difficulty, ref bool ok, ref bool caught) { Item stolen = null; //if ( toSteal is KeyRing ) // toSteal.Weight = toSteal.TotalWeight = 1; if (root is BaseVendor || root is PlayerVendor) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (!m_Thief.CanSee(toSteal) || (root != null && !m_Thief.CanSee(root))) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (!toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && (((Mobile)root).AccessLevel > AccessLevel.Player || !m_Thief.CanBeHarmful((Mobile)root))) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { for (Item p = toSteal.Parent as Item; p != null; p = p.Parent as Item) { if (p is LockableContainer && ((LockableContainer)p).Locked) { m_Thief.SendAsciiMessage("That is not accessable."); return(null); } } if (toSteal.Weight + toSteal.TotalWeight > 10) { m_Thief.SendAsciiMessage("That is too heavy to steal from someone's backpack."); } else { ok = true; double w = toSteal.PileWeight + toSteal.TotalWeight; double check; if (w >= 10) { check = 10 * 3.0 * difficulty + 10.0; caught = CheckDetect((10 * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } else { check = w * 3.0 * difficulty + 10.0; if (toSteal is Key || toSteal is Multis.Deeds.HouseDeed || toSteal is KeyRing) { w += 5; } caught = CheckDetect((w * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } if (m_Thief.CheckSkill(SkillName.Stealing, check - 25, check + 25)) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. if (toSteal.Stackable && toSteal.Amount > 1) { int amount; /*int maxAmount = (int)( (m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight ); * * if ( maxAmount < 1 ) * maxAmount = 1; * else if ( maxAmount > toSteal.Amount ) * maxAmount = toSteal.Amount; * amount = Utility.Random( maxAmount ) + 1;*/ amount = Utility.Random(10) + 1; if (amount > w) { amount = toSteal.Amount; } else { amount = (toSteal.Amount * amount) / (toSteal.PileWeight + toSteal.TotalWeight); } if (amount < 1) { amount = 1; } if (amount >= toSteal.Amount) { stolen = toSteal; } else { stolen = toSteal.Dupe(amount); toSteal.Amount -= amount; } } else { stolen = toSteal; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return(stolen); }
public static bool CheckReversePickpocket(Mobile from, Item item, Item target) { if (from == null || from.Deleted || item == null || !(item is BaseBook) || item.Deleted || target == null || target.Deleted) { return(false); } if (!(from is PlayerMobile) || !(target is Container)) { return(false); } Container c = ((Container)target); PlayerMobile mark = null; if (!(c.Parent is PlayerMobile)) { return(false); } mark = ((PlayerMobile)c.Parent); if (mark.Deleted) { return(false); } PlayerMobile thief = (PlayerMobile)from; //Must be close if (thief.GetDistanceToSqrt(mark) > 1) { return(false); } //Need 100 steal and snoop to attempt if (thief.Skills.Stealing.Base < 100.0 || thief.Skills.Snooping.Base < 100.0) { return(false); } //Check perma flags if (!thief.PermaFlags.Contains(mark)) { thief.SendMessage("You many only attempt to plant books on marks who you are already criminal to."); return(false); } //Weight.. if (!c.CheckHold(mark, item, false)) { thief.SendMessage("That person cannot hold the weight!"); return(false); } //All we need to do here is the criminal action, since they will already be perma if (IsInnocentTo(thief, mark)) { thief.CriminalAction(false); } //Normal check, 75% chance to plant book successfully if (thief.CheckSkill(SkillName.Stealing, 0.75)) { thief.SendMessage("You sucessfully slip them the book."); mark.SendMessage(string.Format("You have been slipped {0} !", ((BaseBook)item).Title)); IPooledEnumerable eable = thief.GetClientsInRange(6); if (eable != null) { foreach (NetState ns in eable) { if (ns != thief.NetState && ns != mark.NetState) { ns.Mobile.SendMessage("You notice {0} slipping {1} to {2}", thief.Name, ((BaseBook)item).Title, mark.Name); } } eable.Free(); eable = null; } return(true); } else { thief.SendMessage("You fail to slip them the book."); IPooledEnumerable eable = thief.GetClientsInRange(6); if (eable != null) { foreach (NetState ns in eable) { if (ns != thief.NetState && ns != mark.NetState) { ns.Mobile.SendMessage("You notice {0} attempting to slip {1} a book", thief.Name, mark.Name); } } eable.Free(); eable = null; } } return(false); }
public override void OnResponse(NetState sender, RelayInfo info) // this is called when you click a button { Mobile m = sender.Mobile; // we want to make the person that clicked into a mobile PlayerMobile pm = m as PlayerMobile; // and we also need to make them into a playermobile if (pm == null) { return; // and if some how a critter dbl click it, this exits it out } pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); // this calls our check for skill gain possiblility // raising the 160 makes it "harder to do" and lowering it makes it easier // but since nothing else but gaining here, 160 is a good average number for it switch (info.ButtonID) // we want to go to the button pushed { case 0: default: { break; } // if right clicked or some how then use a macro on it with the wrong number set so no out of range messages case 1: // if button 1 was pushed (all other button for ansers will be the same as this set) { if (thespot == 1) // if this button was the correct answer - matches the set that was choosen { SayRandom(goodsay, pm); // gives them a random "correct" response from the list of sayings pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); // bonus skill check for getting the correct answer } else { SayRandom(badsay, pm); // if wrong answer - just says the random "incorrect" response string } } break; // end of that button case 2: { if (thespot == 2) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 3: { if (thespot == 3) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 4: { if (thespot == 4) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 5: { if (thespot == 5) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 6: { if (thespot == 6) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.Anatomy, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 7: { break; } // if the cancel button was pushed } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile m = sender.Mobile; PlayerMobile pm = m as PlayerMobile; if (pm == null) { return; } pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); switch (info.ButtonID) { case 0: default: { break; } case 1: { if (thespot == 1) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 2: { if (thespot == 2) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 3: { if (thespot == 3) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 4: { if (thespot == 4) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 5: { if (thespot == 5) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 6: { if (thespot == 6) { SayRandom(goodsay, pm); pm.CheckSkill(SkillName.AnimalLore, 0.0, 160.0); } else { SayRandom(badsay, pm); } } break; case 7: { break; } } }
private void OnTick() { DateTime now = DateTime.Now; TimeSpan age = now - this.Created; if (age >= TimeSpan.FromSeconds(100.0)) { this.Delete(); } else if (age >= TimeSpan.FromSeconds(90.0)) { this.Status = CampfireStatus.Off; } else if (age >= TimeSpan.FromSeconds(60.0)) { this.Status = CampfireStatus.Extinguishing; } if (this.Status == CampfireStatus.Off || this.Deleted) { return; } foreach (CampfireEntry entry in new ArrayList(m_Entries)) { if (!entry.Valid || entry.Player.NetState == null) { RemoveEntry(entry); } else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0)) { entry.Safe = true; entry.Player.SendAsciiMessage("The camp is now secure."); // The camp is now secure. } else { } } int Count = 0; IPooledEnumerable eable = this.GetItemsInRange(1); foreach (Object o in eable) { if (o is Campfire) { Count++; } } eable.Free(); eable = this.GetClientsInRange(SecureRange); foreach (NetState state in eable) { PlayerMobile pm = state.Mobile as PlayerMobile; if (pm != null && GetEntry(pm) == null) { CampfireEntry entry = new CampfireEntry(pm, this); m_Table[pm] = entry; m_Entries.Add(entry); pm.SendAsciiMessage("You feel it would take a few moments to secure your camp."); // You feel it would take a few moments to secure your camp. } if (pm != null && GetEntry(pm) != null && !GetEntry(pm).Safe) { if (Utility.Random(1, Count) != Count) { eable.Free(); return; } if (pm.InRange(this, 1) && m_Starter != null && pm == m_Starter) { pm.CheckSkill(SkillName.Camping, 0.5); } } } eable.Free(); }