protected override void OnTarget(Mobile from, object targ) { if (targ != null && CheckMobile(from)) { if (!(targ is Mobile)) { from.SendMessage("There is Little chance of getting gifts from that!"); return; } if (!(targ is BaseVendor) || ((BaseVendor)targ).Deleted) { from.SendMessage("They dont seem to care."); return; } DateTime now = DateTime.UtcNow; BaseVendor m_Begged = targ as BaseVendor; if (CheckMobile(m_Begged)) { if (m_Begged.NextChristmasGiving > now) { from.SendMessage("They appear not to have any gifts at the moment"); return; } m_Begged.NextChristmasGiving = now + TimeSpan.FromMinutes(Utility.RandomMinMax(60, 120)); ChristmasPrize(from, targ); } } }
public static void ClearContainer_OnCommand(CommandEventArgs e) { foreach (Mobile m in World.Mobiles.Values) { if (m is BaseVendor) { BaseVendor vendor = m as BaseVendor; Container buypack = vendor.BuyPack; if (buypack != null && buypack.Items != Item.EmptyItems) { ArrayList newitemslist = new ArrayList(buypack.Items); buypack.Items.Clear(); for (int i = newitemslist.Count - 1; i >= 0; i--) { Item item = newitemslist[i] as Item; if (item != null) { item.Delete(); } } buypack.UpdateTotals(); } } } }
public static Type GetRandomTrade(City originCity, City dest, ref int worth, ref string name) { Region region = CityLoyaltySystem.GetCityInstance(originCity).Definition.Region; List <BaseVendor> list = new List <BaseVendor>(region.GetEnumeratedMobiles().OfType <BaseVendor>().Where(bv => bv.GetBuyInfo() != null && bv.GetBuyInfo().Length > 0)); if (list.Count == 0) { return(null); } do { BaseVendor vendor = list[Utility.Random(list.Count)]; IBuyItemInfo[] buyInfo = vendor.GetBuyInfo(); GenericBuyInfo info = buyInfo[Utility.Random(buyInfo.Length)] as GenericBuyInfo; if (!(info is BeverageBuyInfo) && !(info is AnimalBuyInfo) && info != null && info.Type != null && info.Args == null && info.Price < 5000) { list.Clear(); list.TrimExcess(); worth = info.Price; name = info.Name; return(info.Type); } list.Remove(vendor); }while (list.Count > 0); list.Clear(); list.TrimExcess(); return(null); }
public static bool CanExchangeBOD(Mobile from, BaseVendor vendor, IBOD bod, int cost) { if (bod.BODType != vendor.BODType) { vendor.SayTo(from, 1152298, 0x3B2); // I don't deal in those goods. return(false); } if ((bod is SmallBOD && ((SmallBOD)bod).AmountCur > 0) || (bod is LargeBOD && ((LargeBOD)bod).Entries != null && ((LargeBOD)bod).Entries.FirstOrDefault(e => e.Amount > 0) != null)) { vendor.SayTo(from, 1152299, 0x3B2); // I am sorry to say I cannot work with a deed that is even partially filled. return(false); } if (bod.AmountMax == 20 && (!CanBeExceptional(bod) || bod.RequireExceptional) && (!CanUseMaterial(bod) || (bod.Material == BulkMaterialType.Valorite || bod.Material == BulkMaterialType.Frostwood || bod.Material == BulkMaterialType.Barbed))) { vendor.SayTo(from, 1152291, 0x3B2); // I won't be able to replace that bulk order with a better one. return(false); } if (cost > -1 && !Banker.Withdraw(from, cost, true)) { vendor.SayTo(from, 1152302, 0x3B2); // I am afraid your bank box does not contain the funds needed to complete this transaction. return(false); } return(true); }
public static int AntiqueBeggingGold(int cost, Mobile player) { if (BaseVendor.BeggingPose(player) > 0) { return((int)((cost * (player.Skills[SkillName.Begging].Value * 0.01) / 4))); } return(0); }
public BrowseShopEntry(Mobile from, BaseVendor vendor) : base(1159181, 2) // Browse the Fellowship Shop { Enabled = vendor.CheckVendorAccess(from); m_From = from; m_Vendor = vendor; }
public static int GetInsuranceCost(Item item) { int cost; if (item is ICollectionItem) { cost = 600; } else if (item is ISetItem) { cost = 600; } else if (item is IFactionArtifact) { cost = 800; } else if (item is IImbuable) { int intensity = new PropCollection(item).WeightedIntensity; if (item is BaseWeapon) { BaseWeapon weapon = item as BaseWeapon; cost = intensity; if (weapon.Attributes.WeaponDamage <= 40) { cost -= (weapon.Attributes.WeaponDamage * 2); } } else if (item is BaseArmor) { BaseArmor armor = item as BaseArmor; int totalResist = armor.PhysicalResistance + armor.FireResistance + armor.ColdResistance + armor.PoisonResistance + armor.EnergyResistance; cost = (int)Math.Ceiling(intensity + (totalResist * 0.1)); if (intensity < 200) { cost += (int)Math.Ceiling(intensity * 0.35); } } else { cost = intensity; } } else { cost = BaseVendor.GetVendorPrice(item.GetType()); } Utility.FixMinMax(ref cost, 10, 800); return(cost); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.Batisseur || IsDisabled()) { return(true); } return(true); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster || IsDisabled()) { return(true); } return(!IsConstantCandidate(from)); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster || IsDisabled()) { return(true); } return(AllowReds || from.MurderCounts < Mobile.MurderCountsRequiredForMurderer); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster || IsGuarded) { return(true); } return(from.LongTermMurders < 5); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster || IsDisabled()) { return(true); } return(AllowReds || from.ShortTermMurders < 5); }
public virtual bool CheckVendorAccess(BaseVendor vendor, Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster || IsDisabled()) { return(true); } return(from.Kills < 5); }
//15% public virtual int UncommonHue() { int hue = 0; do { hue = Utility.RandomList(Utility.RandomNondyedHue(), Utility.RandomNeutralHue()); }while (BaseVendor.IsResourceHue(hue)); return(hue); }
public static bool CanExchangeBOD(Mobile from, BaseVendor vendor, IBOD bod, int cost) { if (bod.BODType != vendor.BODType) { vendor.SayTo(from, 1152298, 0x3B2); // I don't deal in those goods. return(false); } if (bod is SmallBOD sb && sb.AmountCur > 0) { vendor.SayTo(from, 1152299, 0x3B2); // I am sorry to say I cannot work with a deed that is even partially filled. return(false); } if (bod is LargeBOD lb && lb.Entries != null) { LargeBulkEntry first = null; for (var index = 0; index < lb.Entries.Length; index++) { var e = lb.Entries[index]; if (e.Amount > 0) { first = e; break; } } if (first != null) { vendor.SayTo(from, 1152299, 0x3B2); // I am sorry to say I cannot work with a deed that is even partially filled. return(false); } } if (bod.AmountMax == 20 && (!CanBeExceptional(bod) || bod.RequireExceptional) && (!CanUseMaterial(bod) || bod.Material == BulkMaterialType.Valorite || bod.Material == BulkMaterialType.Frostwood || bod.Material == BulkMaterialType.Barbed)) { vendor.SayTo(from, 1152291, 0x3B2); // I won't be able to replace that bulk order with a better one. return(false); } if (cost > -1 && !Banker.Withdraw(from, cost, true)) { vendor.SayTo(from, 1152302, 0x3B2); // I am afraid your bank box does not contain the funds needed to complete this transaction. return(false); } return(true); }
public static int AntiqueTotalValue(int cost, Mobile player, bool karma) { int gold = cost; gold = gold + AntiqueMerchantGold(cost, player); gold = gold + AntiqueBeggingGold(cost, player); gold = gold + AntiqueGuildGold(cost, player); if (BaseVendor.BeggingPose(player) > 0 && karma) { Titles.AwardKarma(player, -BaseVendor.BeggingKarma(player), false); } return(gold); }
public BuySellGump(Mobile from, BaseVendor vendor) : base(400, 100) { PlayerMobile pm = (PlayerMobile)from; m_Vendor = vendor; this.AddBackground(0, 0, 98, 71, 9270); this.AddButton(15, 13, 0x867, 0x869, 1, GumpButtonType.Reply, 0); AddLabel(18, 40, 0x903, "Buy"); this.AddButton(55, 13, 0x867, 0x869, 2, GumpButtonType.Reply, 0); AddLabel(57, 40, 0x903, "Sell"); }
public static void RemoveQuesters(Mobile m, NetState ns, Map oldMap) { if (m == null || oldMap == null) { return; } for (var index = 0; index < BaseVendor.AllVendors.Count; index++) { BaseVendor vendor = BaseVendor.AllVendors[index]; if (vendor is MondainQuester && !vendor.Deleted && vendor.Map == oldMap) { ns.Send(new RemoveWaypoint(vendor.Serial)); } } }
public static void AddQuesters(Mobile m) { if (m == null || m.Map == null || m.Deleted) { return; } for (var index = 0; index < BaseVendor.AllVendors.Count; index++) { BaseVendor vendor = BaseVendor.AllVendors[index]; if (vendor is MondainQuester && !vendor.Deleted && vendor.Map == m.Map) { Create(m, vendor, WaypointType.QuestGiver); } } }
private static void AddHealers(Mobile m) { if (m == null || m.Map == null || m.Deleted) { return; } for (var index = 0; index < BaseVendor.AllVendors.Count; index++) { BaseVendor vendor = BaseVendor.AllVendors[index]; if (vendor is BaseHealer healer && !healer.Deleted && healer.Map == m.Map) { Create(m, healer, WaypointType.Resurrection); } } }
public static bool DeliveryArrived(PlayerMobile player, BaseVendor vendor) { for (int i = 0; i < player.Quests.Count; i++) { BaseQuest quest = player.Quests[i]; for (int j = 0; j < quest.Objectives.Count; j++) { BaseObjective objective = quest.Objectives[j]; if (objective is DeliverObjective) { DeliverObjective deliver = (DeliverObjective)objective; if (deliver.Update(vendor)) { if (quest.Completed) { player.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete. player.PlaySound(quest.CompleteSound); quest.OnCompleted(); player.CloseGump(typeof(BaseQuestGump)); if (vendor is MondainQuester) { player.SendGump(new MLQuestFinishGump(player, quest, (MondainQuester)vendor)); } else { player.SendGump(new MLQuestFinishGump(player, quest)); } } return(true); } } } } return(false); }
public static void RemoveHealers(Mobile m, Map oldMap) { if (m == null || oldMap == null) { return; } NetState ns = m.NetState; if (ns == null) { return; } for (var index = 0; index < BaseVendor.AllVendors.Count; index++) { BaseVendor vendor = BaseVendor.AllVendors[index]; if (vendor is BaseHealer healer && !healer.Deleted && healer.Map == oldMap) { ns.Send(new RemoveWaypoint(healer.Serial)); } } }
public InternalItemTarget(BaseVendor vendor) : base(6, false, TargetFlags.None) { m_Vendor = vendor; }
public VendorSellEntry( Mobile from, BaseVendor vendor ) : base(6104, 8) { m_Vendor = vendor; Enabled = vendor.CheckVendorAccess( from ); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted != null && CheckMobile(from)) { if (!(targeted is Mobile)) { from.SendLocalizedMessage(1076781); /* There is little chance of getting candy from that! */ return; } if (!(targeted is BaseVendor) || ((BaseVendor)targeted).Deleted) { from.SendLocalizedMessage(1076765); /* That doesn't look friendly. */ return; } DateTime now = DateTime.UtcNow; BaseVendor m_Begged = targeted as BaseVendor; if (CheckMobile(m_Begged)) { if (m_Begged.NextTrickOrTreat > now) { from.SendLocalizedMessage(1076767); /* That doesn't appear to have any more candy. */ return; } m_Begged.NextTrickOrTreat = now + TimeSpan.FromMinutes(Utility.RandomMinMax(5, 10)); if (from.Backpack != null && !from.Backpack.Deleted) { if (Utility.RandomDouble() > .10) { switch (Utility.Random(3)) { case 0: m_Begged.Say(1076768); break; /* Oooooh, aren't you cute! */ case 1: m_Begged.Say(1076779); break; /* All right...This better not spoil your dinner! */ case 2: m_Begged.Say(1076778); break; /* Here you go! Enjoy! */ default: break; } if (Utility.RandomDouble() <= .01 && from.Skills.Begging.Value >= 100) { from.AddToBackpack(HalloweenSettings.RandomGMBeggerItem); from.SendLocalizedMessage(1076777); /* You receive a special treat! */ } else { from.AddToBackpack(HalloweenSettings.RandomTreat); from.SendLocalizedMessage(1076769); /* You receive some candy. */ } } else { m_Begged.Say(1076770); /* TRICK! */ int m_Action = Utility.Random(4); if (m_Action == 0) { Timer.DelayCall(OneSecond, OneSecond, 10, Bleeding, from); } else if (m_Action == 1) { Timer.DelayCall(TimeSpan.FromSeconds(2), SolidHueMobile, from); } else { Timer.DelayCall(TimeSpan.FromSeconds(2), MakeTwin, from); } } } } } }
public VendorBuyEntry( Mobile from, BaseVendor vendor ) : base(6103, 8) { m_Vendor = vendor; }
public SBCaddelliteTinker(BaseVendor owner) { m_BuyInfo = new InternalBuyInfo(owner); }
public InternalBuyInfo(BaseVendor owner) { Add(new GenericBuyInfo(typeof(CaddellitePickaxe), 101267, 500, 3718, 0)); Add(new GenericBuyInfo(typeof(CaddelliteHatchet), 101266, 500, 3907, 0)); Add(new GenericBuyInfo(typeof(CaddelliteFishingPole), 101265, 500, 3520, 0)); }
public static string GetJob(BaseCreature m_Mobile) { BaseVendor m = m_Mobile as BaseVendor; if (m is Alchemist) { return("alchemist"); } else if (m is AnimalTrainer) { return("animal trainer"); } else if (m is Architect) { return("architect"); } else if (m is Armorer) { return("armorer"); } else if (m is Baker) { return("baker"); } else if (m is Bard || m is BardGuildmaster) { return("bard"); } else if (m is Barkeeper) { return("tavernkeeper"); } else if (m is Beekeeper) { return("beekeeper"); } else if (m is Blacksmith || m is BlacksmithGuildmaster) { return("blacksmith"); } else if (m is Bowyer) { return("bowyer"); } else if (m is Butcher) { return("butcher"); } else if (m is Carpenter) { return("carpenter"); } else if (m is Cobbler) { return("cobbler"); } else if (m is Cook) { return("cook"); } else if (m is Farmer) { return("farmer"); } else if (m is Fisherman || m is FisherGuildmaster) { return("fisherman"); } else if (m is Furtrader) { return("furtrader"); } else if (m is Glassblower) { return("glassblower"); } else if (m is Herbalist) { return("herbalist"); } else if (m is InnKeeper) { return("innkeeper"); } else if (m is Jeweler) { return("jeweler"); } else if (m is LeatherWorker) { return("leatherworker"); } else if (m is Mage || m is MageGuildmaster) { return("mage"); } else if (m is Mapmaker) { return("mapmaker"); } else if (m is Miller) { return("miller"); } else if (m is Miner || m is MinerGuildmaster) { return("miner"); } else if (m is Provisioner) { return("provisioner"); } else if (m is Rancher) { return("rancher"); } else if (m is Scribe) { return("scribe"); } else if (m is Shipwright) { return("shipwright"); } else if (m is Tailor || m is TailorGuildmaster) { return("tailor"); } else if (m is Tanner) { return("tanner"); } else if (m is TavernKeeper) { return("tavernkeeper"); } else if (m is Thief || m is ThiefGuildmaster) { return("theif"); } else if (m is Tinker || m is TinkerGuildmaster) { return("tinker"); } else if (m is Waiter) { return("waiter"); } else if (m is Weaponsmith) { return("weaponsmith"); } else if (m is Weaver) { return("weaver"); } else if (m is HealerGuildmaster) { return("healer"); } else if (m is MerchantGuildmaster) { return("merchant"); } else if (m is RangerGuildmaster) { return("ranger"); } else if (m is WarriorGuildmaster) { return("warrior"); } else if (m_Mobile is Actor) { return("actor"); } else if (m_Mobile is Artist) { return("artist"); } else if (m_Mobile is Banker) { return("banker"); } else if (m_Mobile is BrideGroom) { return(m_Mobile.Female ? "bride" : "groom"); } else if (m_Mobile is EscortableMage) { return("mage"); } else if (m_Mobile is Gypsy) { return("gypsy"); } else if (m_Mobile is HarborMaster) { return("harbor master"); } else if (m_Mobile is Merchant) { return("merchant"); } else if (m_Mobile is Messenger) { return("runner"); } else if (m_Mobile is Minter) { return("minter"); } else if (m_Mobile is Noble) { return("noble"); } else if (m_Mobile is Peasant) { return("peasent"); } else if (m_Mobile is Sculptor) { return("sculptor"); } else if (m_Mobile is SeekerOfAdventure) { return("seeker of adventure"); } else if (m_Mobile is TownCrier) { return("town crier"); } else if (m_Mobile is BaseGuard || m_Mobile is SpawningGuard) { return("guard"); } else if (m_Mobile is Healer || m_Mobile is EvilHealer) { return("healer"); } else if (m_Mobile is WanderingHealer || m_Mobile is EvilWanderingHealer) { return("wandering healer"); } else { return("worker"); } }
public VendorSellEntry( Mobile from, BaseVendor vendor ) : base(6104, 8) { m_Vendor = vendor; }
public BulkOrderInfoEntry(Mobile from, BaseVendor vendor) : base(6152) { m_From = from; m_Vendor = vendor; }
public VendorSellEntry(Mobile from, BaseVendor vendor) : base(6104, 8) { m_Vendor = vendor; }
public VendorBuyEntry(Mobile from, BaseVendor vendor) : base(6103, 8) { m_Vendor = vendor; }
public VendorBuyEntry(Mobile from, BaseVendor vendor) : base(6103, 8) { this.m_Vendor = vendor; this.Enabled = vendor.CheckVendorAccess(from); }