public override void OnResign(bool resignChain) { if (Owner != null) { PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(Owner); if (entry != null) { FishQuestObjective obj = GetObjective(); if (obj != null) { foreach (KeyValuePair <Type, int[]> kvp in obj.Line) { entry.OnQuestResign(kvp.Key); } } } } if (m_Crate != null) { m_Crate.Quest = null; m_Crate.Delete(); } base.OnResign(resignChain); }
public static void FishMongerStatus_OnCommand(CommandEventArgs e) { PlayerFishingEntry entry = GetEntry(e.Mobile); if (entry != null) { entry.GetFishMongerReputation(e.Mobile); } else { e.Mobile.SendMessage("You have no reputation with the Fish Mongers."); } }
public static PlayerFishingEntry GetEntry(Mobile from, bool create) { if (m_FishingEntries.ContainsKey(from)) return m_FishingEntries[from]; if (create) { PlayerFishingEntry entry = new PlayerFishingEntry(from); return entry; } return null; }
public ProfessionalFisherQuest(Mobile from, FishMonger monger, FishMonger quester, BaseBoat boat) { PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(from, true); int lines; if (boat.IsClassicBoat) { lines = 1; } else { lines = entry.CalculateLines(); } m_TurnIn = monger; m_Boat = boat; int index = 0; int amount = 10; Type type = null; List <int> hasChosen = new List <int>(); Dictionary <Type, int> types = new Dictionary <Type, int>(); for (int i = 0; i < lines; i++) { entry.GetRandomFish(ref index, ref amount, hasChosen); hasChosen.Add(index); type = FishQuestHelper.GetTypeFromIndex(index); if (amount < 5) { amount = 5; } if (amount > 20) { amount = 20; } types[type] = amount; } AddObjective(new FishQuestObjective(types)); AddReward(new BaseReward(1116510)); //A rare reward from the Order of the Dragonfish. hasChosen.Clear(); m_Title = GetTitle(quester); }
public static PlayerFishingEntry GetEntry(Mobile from, bool create) { if (m_FishingEntries.ContainsKey(from)) { return(m_FishingEntries[from]); } if (create) { PlayerFishingEntry entry = new PlayerFishingEntry(from); return(entry); } return(null); }
public override void GiveRewards() { if (Owner != null) { PlayerFishingEntry entry = PlayerFishingEntry.GetEntry(Owner); if (entry != null) { double pointsAwarded = 0; FishQuestObjective obj = GetObjective(); if (obj != null) { pointsAwarded += entry.GetPointsAwarded(obj); entry.OnQuestComplete(obj); } FishQuestHelper.GiveRewards(Owner, entry, pointsAwarded); } } DeleteQuestItems(); base.GiveRewards(); }
public static void GiveRewards(Mobile from, PlayerFishingEntry entry, double points) { Container pack = from.Backpack; if (pack == null) { pack = from.BankBox; } int tier = 1; int category = 1; double roll = Utility.RandomDouble(); if (points >= 100) { tier = 2; } else if (points >= 150) { tier = 3; } else if (points >= 210) { tier = 4; } if (roll < .10) { category = 4; } else if (roll < .25) { category = 3; } else if (roll < .50) { category = 2; } Type type = m_RewardTable[tier - 1][category - 1][Utility.Random(m_RewardTable[tier - 1][category - 1].Length)]; Item item = Loot.Construct(type); if (item != null) { if (item is PowerScroll) { int value; double chance = Utility.RandomDouble(); switch (tier) { default: case 1: if (0.01 > chance) { value = 120; } else if (0.05 > chance) { value = 115; } else if (chance > 0.25) { value = 110; } else { value = 105; } break; case 2: if (0.05 > chance) { value = 120; } else if (0.25 > chance) { value = 115; } else { value = 110; } break; case 3: if (0.10 > chance) { value = 120; } else { value = 115; } break; case 4: value = 120; break; } ((PowerScroll)item).Skill = SkillName.Fishing; ((PowerScroll)item).Value = value; from.SendLocalizedMessage(1149591); // } else if (item is BaseBook) { from.SendLocalizedMessage(1149590); //You receive a rare book. } else if (item is Bait) { Bait bait = (Bait)item; switch (tier) { case 1: bait.Index = Utility.Random(15); if (0.001 >= Utility.RandomDouble()) { bait.Enhanced = true; } break; case 2: bait.Index = Utility.Random(34); if (0.005 >= Utility.RandomDouble()) { bait.Enhanced = true; } break; case 3: bait.Index = Utility.Random(34); if (0.01 >= Utility.RandomDouble()) { bait.Enhanced = true; } break; case 4: if (Utility.RandomBool()) { bait.Index = 35; } else { bait.Index = Utility.RandomMinMax(16, 34); } if (0.05 >= Utility.RandomDouble()) { bait.Enhanced = true; } break; } if (FishInfo.GetTypeFromIndex(bait.Index) == typeof(Charydbis)) { bait.UsesRemaining = 5; from.SendLocalizedMessage(1150871); //You receive charybdis bait if (0.08 >= Utility.RandomDouble()) { bait.Enhanced = true; } } else { object label = FishInfo.GetFishLabel(bait.Index); if (label is int) { from.SendLocalizedMessage(1149588, string.Format("#{0}\t", (int)label)); //You receive bait to catch ~1_val~ } else { from.SendLocalizedMessage(1149588, (string)label); //You receive bait to catch ~1_val~ } bait.UsesRemaining = (int)Math.Min(200, points / 2); } } else if (item is PermanentBoatPaint) { from.SendMessage("You recieve permanent boat paint!"); } else { if (item is FishingPole) { BaseRunicTool.ApplyAttributesTo((FishingPole)item, false, 0, Utility.RandomMinMax(1, tier + 1), 25, 100); } from.SendLocalizedMessage(1149589); //You receive some rare fishing equipment. } pack.DropItem(item); if (entry != null) { entry.OnAfterReward(points); } } }
public static void GiveRewards(Mobile from, PlayerFishingEntry entry, double points) { Container pack = from.Backpack; if (pack == null) pack = from.BankBox; int tier = 1; int category = 1; double roll = Utility.RandomDouble(); if (points >= 100) tier = 2; else if (points >= 150) tier = 3; else if (points >= 210) tier = 4; if (roll < .10) category = 4; else if (roll < .25) category = 3; else if (roll < .50) category = 2; Type type = m_RewardTable[tier - 1][category - 1][Utility.Random(m_RewardTable[tier - 1][category - 1].Length)]; Item item = Loot.Construct(type); if (item != null) { if (item is PowerScroll) { int value; double chance = Utility.RandomDouble(); switch (tier) { default: case 1: if (0.01 > chance) value = 120; else if (0.05 > chance) value = 115; else if (chance > 0.25) value = 110; else value = 105; break; case 2: if (0.05 > chance) value = 120; else if (0.25 > chance) value = 115; else value = 110; break; case 3: if (0.10 > chance) value = 120; else value = 115; break; case 4: value = 120; break; } ((PowerScroll)item).Skill = SkillName.Fishing; ((PowerScroll)item).Value = value; from.SendLocalizedMessage(1149591); // } else if (item is BaseBook) from.SendLocalizedMessage(1149590); //You receive a rare book. else if (item is Bait) { Bait bait = (Bait)item; switch (tier) { case 1: bait.Index = Utility.Random(15); if(0.001 >= Utility.RandomDouble()) bait.Enhanced = true; break; case 2: bait.Index = Utility.Random(34); if(0.005 >= Utility.RandomDouble()) bait.Enhanced = true; break; case 3: bait.Index = Utility.Random(34); if(0.01 >= Utility.RandomDouble()) bait.Enhanced = true; break; case 4: if (Utility.RandomBool()) bait.Index = 35; else bait.Index = Utility.RandomMinMax(16, 34); if (0.05 >= Utility.RandomDouble()) bait.Enhanced = true; break; } if (FishInfo.GetTypeFromIndex(bait.Index) == typeof(Charydbis)) { bait.UsesRemaining = 5; from.SendLocalizedMessage(1150871); //You receive charybdis bait if (0.08 >= Utility.RandomDouble()) bait.Enhanced = true; } else { object label = FishInfo.GetFishLabel(bait.Index); if (label is int) from.SendLocalizedMessage(1149588, String.Format("#{0}\t", (int)label)); //You receive bait to catch ~1_val~ else from.SendLocalizedMessage(1149588, (string)label); //You receive bait to catch ~1_val~ bait.UsesRemaining = (int)Math.Min(200, points / 2); } } else if (item is PermanentBoatPaint) { from.SendMessage("You recieve permanent boat paint!"); } else { if (item is FishingPole) BaseRunicTool.ApplyAttributesTo((FishingPole)item, false, 0, Utility.RandomMinMax(1, tier + 1), 25, 100); from.SendLocalizedMessage(1149589); //You receive some rare fishing equipment. } pack.DropItem(item); if (entry != null) entry.OnAfterReward(points); } }