public bool RetractBid(Mobile from) { Account acct = from.Account as Account; for (int i = 0; i < acct.Length; i++) { Mobile m = acct[i]; if (m == null) { continue; } if (m_Auctioners.ContainsKey(m)) { BidEntry entry = m_Auctioners[m]; if (entry != null && Banker.Deposit(m, entry.Amount)) { m_Auctioners.Remove(m); return(true); } } } return(false); }
private static void ConsoleBanker() { var banker = new Banker(new ConsoleLogger()); banker.Deposit("12345", 500); banker.Withdraw("12345", 1500); }
private static void MessageBoxBanker() { var banker = new Banker(new MessageBoxLogger()); banker.Deposit("12345", 500); banker.Withdraw("12345", 1500); }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); } else { Banker.Deposit(m_Mobile, m_House.Price, true); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); return; } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do } } else if (info.ButtonID == 0) { m_Mobile.CloseGump(typeof(ConfirmHouseResize)); m_Mobile.SendGump(new HouseGump(HouseGumpPage.Customize, m_Mobile, m_House)); } }
/** * Give gold back to each player. */ private void EventSink_ServerCrashed(CrashedEventArgs e) { //is the mobile already in game? for (int i = 0; i < this.playerCnt; i++) { //since it's crashing anyways, we just deposit, in hopes it gets saved Banker.Deposit(dicePlayers[i].getMobile(), dicePlayers[i].GetTableBalance()); } }
public override void OnDoubleClick(Mobile from) { Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Gold), 250)) { m_GamblePot += 150; InvalidateProperties(); int roll = Utility.Random(1200); if (roll == 0) // Jackpot { int maxCheck = 1000000; from.SendMessage(0x35, "You win the {0}gp jackpot!", m_GamblePot); while (m_GamblePot > maxCheck) { Banker.Deposit(from, maxCheck, true); m_GamblePot -= maxCheck; } Banker.Deposit(from, m_GamblePot, true); m_GamblePot = 2500; } else if (roll <= 20) // Chance for a regbag { from.SendMessage(0x35, "You win a bag of reagents!"); from.AddToBackpack(new BagOfReagents(50)); } else if (roll <= 40) // Chance for gold { from.SendMessage(0x35, "You win 1500gp!"); Banker.Deposit(from, 1500, true); } else if (roll <= 100) // Another chance for gold { from.SendMessage(0x35, "You win 1000gp!"); Banker.Deposit(from, 1000, true); } else // Loser! { from.SendMessage(0x22, "You lose!"); } } else { from.SendMessage(0x22, "You need at least 250gp in your backpack to use "); } }
public override void Destroy(bool toBackpack) { if (RentalGold > 0 && House?.IsAosRules == true) { House.MovingCrate ??= new MovingCrate(House); Banker.Deposit(House.MovingCrate, RentalGold); RentalGold = 0; } base.Destroy(toBackpack); }
private bool TryPayFunds(Mobile from, StorageEntry entry) { int amount = entry.Funds; if (Banker.Deposit(from, amount, true)) { entry.Funds = 0; return(true); } return(false); }
public static void RemoveEntry(BountyBoardEntry be, bool refund) { m_Entries.Remove(be); ArrayList instances = BountyBoard.Instances; for (int i = 0; i < instances.Count; ++i) { ((BountyBoard)instances[i]).InvalidateProperties(); } if (refund && be.Owner != null) { string msg = String.Format("Your bounty in the amount of {0} on {1}'s head has ended.", be.Price, be.Wanted.Name); if (NetState.Instances.Contains(be.Owner.NetState)) { be.Owner.SendMessage(msg); } else { ((PlayerMobile)be.Owner).ShowBountyUpdate = true; ((PlayerMobile)be.Owner).BountyUpdateList.Add(msg); } if (Banker.Deposit(be.Owner, be.Price)) { be.Owner.SendLocalizedMessage(1060397, be.Price.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } else { be.Owner.AddToBackpack(new Gold(be.Price)); be.Owner.SendMessage("The bounty of {0} has been added to your backpack.", be.Price); } } else if (be.Owner != null) { string msg = String.Format("Your bounty in the amount of {0} on {1}'s head has been claimed.", be.Price, be.Wanted.Name); if (NetState.Instances.Contains(be.Owner.NetState)) { be.Owner.SendMessage(msg); } else { ((PlayerMobile)be.Owner).ShowBountyUpdate = true; ((PlayerMobile)be.Owner).BountyUpdateList.Add(msg); } } NotifyBountyEnd(be); }
public void TryWithdrawFunds(Mobile from, int amount) { if (m_BankBalance < amount || !Banker.Deposit(from, amount)) { from.SendLocalizedMessage(1150214); // Transfer of funds from the broker to your bank box failed. Please check the amount to transfer is available in the broker's account, and make sure your bank box is able to hold the new funds without becoming overloaded. } else { m_BankBalance -= amount; from.SendMessage("You withdraw {0}gp to your broker.", amount); from.PlaySound(0x37); } }
public void CancelDuel(bool refund = false) { Timer.DelayCall <ArenaTeam>(TimeSpan.FromSeconds(5), RemovePlayers, null); Complete = true; if (refund && EntryFee > EntryFee.Zero) { foreach (var part in GetParticipants()) { Banker.Deposit(part.Key, (int)EntryFee, true); PVPArenaSystem.SendMessage(part.Key, 1149606); // The entry fee has been refunded to your bank box. } } }
public void EndDuel(ArenaTeam winner) { Timer.DelayCall(KickTime, RemovePlayers, winner); Complete = true; SendResults(winner); if (winner != null) { foreach (PlayerMobile pm in winner.Players.Keys) { if (Pot > 0) { Banker.Deposit(pm, Pot / winner.Count, true); } PVPArenaSystem.SendMessage(pm, 1115975); // Congratulations! You have won the duel! Timer.DelayCall(TimeSpan.FromSeconds(1), player => { DoWinEffects(player); }, pm); } } foreach (ArenaTeam team in Teams) { if (team != winner) { foreach (PlayerMobile pm in team.Players.Keys) { PVPArenaSystem.SendMessage(pm, team.Count == 1 ? 1116489 : 1116488); // You have lost the duel... : Your team has lost the duel... } } } RecordStats(winner); if (Ranked) { Arena.RecordRankings(this, winner); } PVPArenaSystem.SendParticipantMessage(this, 1115965); // All participants will be ejected from this arena in 40 seconds. }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (!m_Vendor.CanInteractWith(from, true) || !m_Vendor.CanInteractWith(m_Landlord, false) || !m_Vendor.IsLandlord(m_Landlord)) { return; } if (info.ButtonID == 1) { if (Banker.Withdraw(m_Landlord, m_RefundAmount)) { m_Landlord.SendLocalizedMessage(1060398, m_RefundAmount.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. int depositedGold = Banker.DepositUpTo(from, m_RefundAmount); if (depositedGold > 0) { from.SendLocalizedMessage(1060397, depositedGold.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } m_Vendor.HoldGold += m_RefundAmount - depositedGold; //deposit any held gold for vendor owner to bank before destroying Banker.Deposit(from, m_Vendor.HoldGold); m_Vendor.HoldGold = 0; m_Vendor.Destroy(true); } else { m_Landlord.SendLocalizedMessage(1062507); // You do not have that much money in your bank account. } } else { m_Landlord.SendLocalizedMessage(1062513); // The renter declined your offer. } }
// Called when a player SELLs the commodity from teh broker...this is f*****g confusing public void TrySellCommodity(Mobile from, CommodityBrokerEntry entry, int amount) { int totalCost = entry.BuyPricePer * amount; Type type = entry.CommodityType; if (BankBalance < totalCost) { //No message, this should have already been handled elsewhere } else if (from.Backpack != null) { int total = amount; int typeAmount = from.Backpack.GetAmount(type); int commodityAmount = GetCommodityType(from.Backpack, type); if (typeAmount + commodityAmount < total) { from.SendLocalizedMessage(1150667); // You do not have the requested amount of that commodity (either in item or deed form) in your backpack to trade. Note that commodities cannot be traded from your bank box. } else if (Banker.Deposit(from, totalCost)) { TakeItems(from.Backpack, type, ref total); if (total > 0) { TakeCommodities(from.Backpack, type, ref total); } BankBalance -= totalCost + (int)(totalCost * (ComissionFee / 100.0)); from.SendLocalizedMessage(1150668, string.Format("{0}\t#{1}", amount.ToString(), entry.Label)); // You have sold ~1_QUANTITY~ units of ~2_COMMODITY~ to the broker. These have been transferred from deeds and/or items in your backpack. } else { from.SendLocalizedMessage(1150265); // Your bank box cannot hold the proceeds from this transaction. } } }
static void Main(string[] args) { var banker = new Banker(); banker.Deposit("12345", 500); }
public override void OnResponse(NetState sender, RelayInfo info) { #region Validate Mobiles Involved //Validate Mobiles bool crafterValid = true; bool mobileTargetValid = true; if (m_Crafter == null) { crafterValid = false; } else if (m_Crafter.Deleted || !m_Crafter.Alive) { crafterValid = false; } if (m_MobileTarget == null) { mobileTargetValid = false; } else if (m_MobileTarget.Deleted || !m_MobileTarget.Alive) { mobileTargetValid = false; } if (!crafterValid || !mobileTargetValid) { if (m_Crafter != null) { if (m_Crafter.HasGump(typeof(DungeonMouldWeaponGump))) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); } m_Crafter.SendMessage("You can no longer proceed with the crafting of that dungeon weapon."); } if (m_MobileTarget != null && m_Crafter != m_MobileTarget) { if (m_MobileTarget.HasGump(typeof(DungeonMouldWeaponGump))) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); } m_MobileTarget.SendMessage("You can no longer proceed with the crafting of that dungeon weapon."); } return; } if (crafterValid && mobileTargetValid && m_Crafter != m_MobileTarget) { if (Utility.GetDistance(m_Crafter.Location, m_MobileTarget.Location) > 2) { if (m_Crafter.HasGump(typeof(DungeonMouldWeaponGump))) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); } m_Crafter.SendMessage("You are too far away from the target to proceed with the crafting."); if (m_MobileTarget.HasGump(typeof(DungeonMouldWeaponGump))) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); } m_MobileTarget.SendMessage("You are too far away from the crafter to proceed with the crafting."); return; } if (!m_Crafter.InLOS(m_MobileTarget)) { if (m_Crafter.HasGump(typeof(DungeonMouldWeaponGump))) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); } m_Crafter.SendMessage("You are out of sight of the target and cannot continue crafting."); if (m_MobileTarget.HasGump(typeof(DungeonMouldWeaponGump))) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); } m_MobileTarget.SendMessage("You are out of sight of the crafter and cannot continue crafting."); return; } } #endregion bool selfCraft = (m_Crafter == m_MobileTarget); bool attemptCraft = false; //Close Gumps For Other Player if One Party Closes Theirs if (info.ButtonID == 0) { if (!selfCraft) { if (m_GumpTarget == m_Crafter) { if (m_MobileTarget.HasGump(typeof(DungeonMouldWeaponGump))) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendMessage("They have canceled the offer."); return; } } if (m_GumpTarget == m_MobileTarget) { if (m_Crafter.HasGump(typeof(DungeonMouldWeaponGump))) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); m_Crafter.SendMessage("They have declined the offer."); return; } } } } //Confirm / Accept if (info.ButtonID == 1) { if (selfCraft) { attemptCraft = true; } else if (m_GumpTarget == m_MobileTarget) { if (!m_Confirmed) { if (m_Crafter != null) { m_MobileTarget.SendMessage(m_Crafter.Name + " has not confirmed their offer price yet."); } m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); return; } else { attemptCraft = true; } } else { m_GumpTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_GumpTarget.SendGump(new DungeonMouldWeaponGump(m_Crafter, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); return; } } //Ready if (info.ButtonID == 2) { if (!selfCraft && m_GumpTarget == m_Crafter) { m_Confirmed = !m_Confirmed; m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); } m_GumpTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_GumpTarget.SendGump(new DungeonMouldWeaponGump(m_Crafter, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); return; } //Adjust Price if (info.ButtonID == 3) { if (!selfCraft && m_GumpTarget == m_Crafter) { //Set Gold Amount TextRelay demandAmountTextRelay = info.GetTextEntry(4); string demandAmountText = demandAmountTextRelay.Text.Trim(); try { m_AmountDemanded = Convert.ToInt32(demandAmountText); } catch (Exception e) { m_AmountDemanded = 0; } if (m_AmountDemanded > 500000) { m_AmountDemanded = 500000; } if (m_AmountDemanded < 0) { m_AmountDemanded = 0; } m_Confirmed = false; m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); m_MobileTarget.SendMessage("They have changed the asking price for their service."); m_GumpTarget.SendMessage("You change the asking price for your services. Click 'Confirm' to proceed."); } m_GumpTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_GumpTarget.SendGump(new DungeonMouldWeaponGump(m_Crafter, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); return; } //Special Effect if (info.ButtonID == 4) { DungeonWeaponDetail weaponDetail = DungeonWeapon.GetDungeonWeaponDetail(m_Dungeon); m_GumpTarget.SendMessage(weaponDetail.m_EffectDisplayName + ": " + weaponDetail.m_EffectDescription); m_GumpTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_GumpTarget.SendGump(new DungeonMouldWeaponGump(m_Crafter, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); return; } //Dungeon Selection if (info.ButtonID >= 10 && info.ButtonID <= 18) { if (m_NewWeapon) { if (selfCraft || m_GumpTarget == m_MobileTarget) { switch (info.ButtonID) { case 10: m_Dungeon = DungeonEnum.Covetous; break; case 11: m_Dungeon = DungeonEnum.Deceit; break; case 12: m_Dungeon = DungeonEnum.Despise; break; case 13: m_Dungeon = DungeonEnum.Destard; break; case 14: m_Dungeon = DungeonEnum.Fire; break; case 15: m_Dungeon = DungeonEnum.Hythloth; break; case 16: m_Dungeon = DungeonEnum.Ice; break; case 17: m_Dungeon = DungeonEnum.Shame; break; case 18: m_Dungeon = DungeonEnum.Wrong; break; } } } m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); m_Crafter.SendGump(new DungeonMouldWeaponGump(m_Crafter, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); if (m_Crafter != m_MobileTarget) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); } return; } //Attempt Crafting if (attemptCraft) { bool mouldValid = true; if (m_DungeonMould == null) { mouldValid = false; } else if (m_DungeonMould.Deleted) { mouldValid = false; } if (m_DungeonMould.RootParent != m_Crafter) { mouldValid = false; } if (!mouldValid) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); m_Crafter.SendMessage("The dungeon mould being used is no longer accessible."); if (m_Crafter != m_MobileTarget) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendMessage("The dungeon mould being used is no longer accessible."); } return; } bool weaponValid = true; if (m_Weapon == null) { weaponValid = false; } else if (m_Weapon.Deleted) { weaponValid = false; } if (selfCraft) { if (m_Weapon.RootParent != m_Crafter) { weaponValid = false; } } else { if (m_Weapon.RootParent != m_MobileTarget) { weaponValid = false; } } if (m_Weapon.TierLevel == DungeonWeapon.MaxDungeonTier) { weaponValid = false; } if (m_NewWeapon) { if (m_Weapon.TierLevel > 0) { weaponValid = false; } if (m_Weapon.CrafterName == "" || m_Weapon.Quality != Quality.Exceptional) { weaponValid = false; } if (m_Weapon.DamageLevel != WeaponDamageLevel.Regular || m_Weapon.AccuracyLevel != WeaponAccuracyLevel.Regular || m_Weapon.DurabilityLevel != WeaponDurabilityLevel.Regular) { weaponValid = false; } } if (!weaponValid) { m_Crafter.CloseGump(typeof(DungeonMouldWeaponGump)); m_Crafter.SendMessage("The weapon being targeted is no longer accessible."); if (m_Crafter != m_MobileTarget) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendMessage("The weapon being targeted is no longer accessible."); } return; } if (!selfCraft && m_AmountDemanded > 0) { if (Banker.GetBalance(m_MobileTarget) < m_AmountDemanded) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); m_MobileTarget.SendMessage("You do not have the gold amount requested for this transaction in your bankbox."); return; } } if (!HasRequiredMaterials(m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Dungeon)) { m_MobileTarget.CloseGump(typeof(DungeonMouldWeaponGump)); m_MobileTarget.SendGump(new DungeonMouldWeaponGump(m_MobileTarget, m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Weapon, m_Dungeon, m_AmountDemanded, m_Confirmed)); if (m_NewWeapon) { m_MobileTarget.SendMessage("You must have " + DungeonWeapon.CoresNeededForCreation.ToString() + " dungeon cores and " + DungeonWeapon.DistillationNeededForCreation.ToString() + " dungeon distillation of the matching dungeon in your backpack to create this dungeon weapon."); } else { m_MobileTarget.SendMessage("You must have " + DungeonWeapon.CoresNeededForUpgrade.ToString() + " dungeon cores and " + DungeonWeapon.DistillationNeededForUpgrade.ToString() + " dungeon distillation of the matching dungeon in your backpack to upgrade it's tier."); } return; } ConsumeMaterials(m_Crafter, m_MobileTarget, m_DungeonMould, m_NewWeapon, m_Dungeon); if (!selfCraft && m_AmountDemanded > 0) { Banker.Withdraw(m_MobileTarget, m_AmountDemanded); Banker.Deposit(m_Crafter, m_AmountDemanded); m_MobileTarget.SendSound(0x037); if (m_NewWeapon) { m_Crafter.SendMessage("You convert their weapon into a dungeon weapon and receive " + m_AmountDemanded.ToString() + " gold for your services."); m_MobileTarget.SendMessage("You pay " + m_AmountDemanded.ToString() + " gold for them to create a dungeon weapon for you."); } else { m_Crafter.SendMessage("You upgrade their dugneon weapon's tier and receive " + m_AmountDemanded.ToString() + " gold for your services."); m_MobileTarget.SendMessage("You pay " + m_AmountDemanded.ToString() + " gold for them to upgrade your dungeon weapon."); } } else { if (selfCraft) { if (m_NewWeapon) { m_Crafter.SendMessage("You convert your weapon into a dungeon weapon."); } else { m_Crafter.SendMessage("You upgrade your dungeon weapon's tier."); } } else { if (m_NewWeapon) { m_Crafter.SendMessage("You convert their weapon into a dungeon weapon."); m_MobileTarget.SendMessage("They create a dungeon weapon for you."); } else { m_Crafter.SendMessage("You upgrade their dungeon weapon's tier."); m_MobileTarget.SendMessage("They upgrade your dungeon weapon's tier for you."); } } } m_Crafter.PlaySound(0x2A); if (m_NewWeapon) { m_Weapon.Quality = Quality.Regular; m_Weapon.ArcaneCharges = DungeonWeapon.ArcaneMaxCharges; m_Weapon.ArcaneChargesMax = DungeonWeapon.ArcaneMaxCharges; m_Weapon.Dungeon = m_Dungeon; m_Weapon.TierLevel = 1; } else { m_Weapon.TierLevel++; } m_Weapon.Experience = 0; m_Weapon.MaxHitPoints = DungeonWeapon.BaselineDurability + (DungeonWeapon.IncreasedDurabilityPerTier * m_Weapon.TierLevel); m_Weapon.HitPoints = m_Weapon.MaxHitPoints; return; } }
public override bool OnDragDrop(Mobile from, Item dropped) { PlayerMobile player = from as PlayerMobile; if (player != null) { QuestSystem qs = player.Quest; if (qs is UzeraanTurmoilQuest) { if (dropped is UzeraanTurmoilHorn) { if (player.Young) { UzeraanTurmoilHorn horn = (UzeraanTurmoilHorn)dropped; if (horn.Charges < 10) { this.SayTo(from, 1049384); // I have recharged the item for you. horn.Charges = 10; } else { this.SayTo(from, 1049385); // That doesn't need recharging yet. } } else { player.SendLocalizedMessage(1114333); //You must be young to have this item recharged. } return(false); } if (dropped is SchmendrickScrollOfPower) { QuestObjective obj = qs.FindObjective(typeof(ReturnScrollOfPowerObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); cont.DropItem(new TreasureMap(player.Young ? 0 : 1, Map.Trammel)); cont.DropItem(new Shovel()); cont.DropItem(new UzeraanTurmoilHorn()); if (!player.PlaceInBackpack(cont)) { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return(false); } else { dropped.Delete(); obj.Complete(); return(true); } } } else if (dropped is QuestFertileDirt) { QuestObjective obj = qs.FindObjective(typeof(ReturnFertileDirtObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); if (player.Profession == 2) // magician { cont.DropItem(new BlackPearl(20)); cont.DropItem(new Bloodmoss(20)); cont.DropItem(new Garlic(20)); cont.DropItem(new Ginseng(20)); cont.DropItem(new MandrakeRoot(20)); cont.DropItem(new Nightshade(20)); cont.DropItem(new SulfurousAsh(20)); cont.DropItem(new SpidersSilk(20)); for (int i = 0; i < 3; i++) { cont.DropItem(Loot.RandomScroll(0, 23, SpellbookType.Regular)); } } else { cont.DropItem(new Gold(300)); cont.DropItem(new Bandage(25)); for (int i = 0; i < 5; i++) { cont.DropItem(new LesserHealPotion()); } } if (!player.PlaceInBackpack(cont)) { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return(false); } else { dropped.Delete(); obj.Complete(); return(true); } } } else if (dropped is QuestDaemonBlood) { QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBloodObjective)); if (obj != null && !obj.Completed) { Item reward; if (player.Profession == 2) // magician { Container cont = GetNewContainer(); cont.DropItem(new ExplosionScroll(4)); cont.DropItem(new MagicWizardsHat()); reward = cont; } else { BaseWeapon weapon; switch (Utility.Random(6)) { case 0: weapon = new Broadsword(); break; case 1: weapon = new Cutlass(); break; case 2: weapon = new Katana(); break; case 3: weapon = new Longsword(); break; case 4: weapon = new Scimitar(); break; default: weapon = new VikingSword(); break; } if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40); } else { weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4); weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4); weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4); } weapon.Slayer = SlayerName.Silver; reward = weapon; } if (!player.PlaceInBackpack(reward)) { reward.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return(false); } else { dropped.Delete(); obj.Complete(); return(true); } } } else if (dropped is QuestDaemonBone) { QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBoneObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); if (!Core.TOL) { cont.DropItem(new BankCheck(2000)); } else { Banker.Deposit(from, 2000, true); } cont.DropItem(new EnchantedSextant()); if (!player.PlaceInBackpack(cont)) { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. return(false); } else { dropped.Delete(); obj.Complete(); return(true); } } } } } return(base.OnDragDrop(from, dropped)); }
public void RunBanker() { var banker = new Banker(new ConsoleLogger()); banker.Deposit("12345", 500); }
private void OnAccept() { Type cType = Head.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold); if (Head == null || Head.Deleted) { _Victim.SendMessage( "Your head was turned over to the authorities by {0} during negotations.", User.RawName); User.SendMessage("You turned over {0}'s to the authorities during negotations and cannot accept this offer.", User.RawName); return; } if (Head.RootParentEntity != User) { _Victim.SendMessage( "Your head does not appear to be possessed by {0} any longer.", User.RawName); User.SendMessage("You must retain the head in your pack or bank to engage in negotations for {0}'s head.", User.RawName); return; } if (!Banker.Withdraw(_Victim, cType, _Offer)) { User.SendMessage("{0} could not afford this price. Please make another offer later.", _Victim.RawName); _Victim.SendMessage( "You could not afford to pay the counteroffer you made. The amount of {0} in your bank has declined since you made the counteroffer.", cType.Name); LoggingCustom.Log( "MurdererNegotiate.txt", String.Format( "[Killer -> Victim][FAILED][{0}]:\t[{1} -> {2}]\t[{3}]\t[{4:#,0} {5}]\t\"{6}\"", ServerTime.ShortDateTimeNow, User, _Victim, Head, _Offer, cType.Name, _Message)); return; } _Victim.SendMessage( "{0:#,0} {1} has been withdrawn from your bank and paid to {2}.", _Offer, cType.Name, User.RawName); User.SendMessage("{0:#,0} {1} has been paid and added to your bank box by {2}.", _Offer, cType.Name, _Victim.RawName); Banker.Deposit(User, cType, _Offer); BankBox bank = _Victim.FindBank(Head.Expansion) ?? _Victim.BankBox; if (bank != null) { bank.DropItem(Head); } if (Head is Head2) { Head2.AllHeads.Remove((Head2)Head); } foreach (var g in GetInstances <HeadNegotiateGump>(_Victim, true).Where(g => g.Head == Head)) { g.Close(true); } _Victim.SendMessage("Your severed head has been deposited into your bank box."); LoggingCustom.Log( "MurdererNegotiate.txt", String.Format( "[Killer -> Victim][ACCEPTED][{0}]:\t[{1} -> {2}]\t[{3}]\t[{4:#,0} {5}]\t\"{6}\"", ServerTime.ShortDateTimeNow, User, _Victim, Head, _Offer, cType.Name, _Message)); }
public override void OnResponse(NetState state, RelayInfo info) { Account acct = User.Account as Account; switch (info.ButtonID) { case 0: break; case 1: case 2: case 3: case 4: User.SendMessage("This feature is currenlty disabled."); Refresh(false); break; case 5: User.SendLocalizedMessage(1155865); // Enter amount to deposit: User.BeginPrompt( (from, text, account) => { int v = 0; if (account != null) { int canHold = Account.MaxSecureAmount - account.GetSecureAccountAmount(from); if (text != null && !string.IsNullOrEmpty(text)) { v = Utility.ToInt32(text); if (v <= 0 || v > canHold || v > Banker.GetBalance(from)) { from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. } else if (account != null) { Banker.Withdraw(from, v, true); account.DepositToSecure(from, v); from.SendLocalizedMessage(1153188); // Transaction successful: Timer.DelayCall(TimeSpan.FromSeconds(2), SendGump); } } else { from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. } } }, (from, text, a) => { User.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. User.SendGump(new BankerGump(User)); }, acct); break; case 6: User.SendLocalizedMessage(1155866); // Enter amount to withdraw: User.BeginPrompt( (from, text, ac) => { int v = 0; if (ac != null) { if (text != null && !string.IsNullOrEmpty(text)) { v = Utility.ToInt32(text); if (ac != null) { if (v <= 0 || v > acct.GetSecureAccountAmount(from)) { from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. } else { Banker.Deposit(from, v, true); ac.WithdrawFromSecure(from, v); from.SendLocalizedMessage(1153188); // Transaction successful: } Timer.DelayCall(TimeSpan.FromSeconds(2), SendGump); } } else { from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. } } }, (from, text, act) => { User.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction. User.SendGump(new BankerGump(User)); }, acct); break; case 7: User.CloseGump(typeof(NewCurrencyHelpGump)); User.SendGump(new NewCurrencyHelpGump()); Refresh(); break; } }
public void EndAuction() { if (m_Plot == null) { return; } if (m_Plot.HasTempMulti()) { m_Plot.RemoveTempPlot(); } Mobile winner = null; int highest = 0; Dictionary <Mobile, BidEntry> combined = new Dictionary <Mobile, BidEntry>(m_Auctioners); //Combine auction bids with the bids for next available plot foreach (KeyValuePair <Mobile, BidEntry> kvp in MaginciaBazaar.NextAvailable) { combined.Add(kvp.Key, kvp.Value); } //Get highest bid foreach (BidEntry entry in combined.Values) { if (entry.Amount > highest) { highest = entry.Amount; } } // Check for owner, and if the owner has a match bad AND hasn't bidded on another plot! if (m_Plot.Owner != null && MaginciaBazaar.Reserve.ContainsKey(m_Plot.Owner) && MaginciaBazaar.Instance != null && !MaginciaBazaar.Instance.HasActiveBid(m_Plot.Owner)) { int matching = MaginciaBazaar.GetBidMatching(m_Plot.Owner); if (matching >= highest) { MaginciaBazaar.DeductReserve(m_Plot.Owner, highest); int newreserve = MaginciaBazaar.GetBidMatching(m_Plot.Owner); winner = m_Plot.Owner; /*You extended your lease on Stall ~1_STALLNAME~ at the ~2_FACET~ New Magincia * Bazaar. You matched the top bid of ~3_BIDAMT~gp. That amount has been deducted * from your Match Bid of ~4_MATCHAMT~gp. Your Match Bid balance is now *~5_NEWMATCH~gp. You may reclaim any additional match bid funds or adjust * your match bid for next week at the bazaar.*/ MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150427), string.Format("@{0}@{1}@{2}@{3}@{4}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString(), highest.ToString("N0"), matching.ToString("N0"), newreserve.ToString("N0")))); } else { /*You lost the bid to extend your lease on Stall ~1_STALLNAME~ at the ~2_FACET~ * New Magincia Bazaar. Your match bid amount of ~3_BIDAMT~gp is held in escrow * at the Bazaar. You may obtain a full refund there at any time. Your hired * merchant, if any, has deposited your proceeds and remaining inventory at the * Warehouse in New Magincia. You must retrieve these within one week or they * will be destroyed.*/ MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150528), string.Format("@{0}@{1}@{2}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString(), matching.ToString("N0")))); } } else if (m_Plot.Owner != null) { /*Your lease has expired on Stall ~1_STALLNAME~ at the ~2_FACET~ New Magincia Bazaar.*/ MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150430), string.Format("@{0}@{1}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString()))); } if (winner == null) { //Get list of winners List <BidEntry> winners = new List <BidEntry>(); foreach (KeyValuePair <Mobile, BidEntry> kvp in combined) { if (kvp.Value.Amount >= highest) { winners.Add(kvp.Value); } } // One winner! if (winners.Count == 1) { winner = winners[0].Bidder; } else { // get a list of specific type (as opposed to next available) List <BidEntry> specifics = new List <BidEntry>(); foreach (BidEntry bid in winners) { if (bid.BidType == BidType.Specific) { specifics.Add(bid); } } // one 1 specific! if (specifics.Count == 1) { winner = specifics[0].Bidder; } else if (specifics.Count > 1) { //gets oldest specific BidEntry oldest = null; foreach (BidEntry entry in specifics) { if (oldest == null || entry.DatePlaced < oldest.DatePlaced) { oldest = entry; } } winner = oldest.Bidder; } else { //no specifics! gets oldest of list of winners BidEntry oldest = null; foreach (BidEntry entry in winners) { if (oldest == null || entry.DatePlaced < oldest.DatePlaced) { oldest = entry; } } if (oldest != null) { winner = oldest.Bidder; } } } } //Give back gold foreach (KeyValuePair <Mobile, BidEntry> kvp in m_Auctioners) { Mobile m = kvp.Key; if (m != winner) { if (!Banker.Deposit(m, kvp.Value.Amount, true) && m.Backpack != null) { int total = kvp.Value.Amount; while (total > 60000) { m.Backpack.DropItem(new BankCheck(60000)); total -= 60000; } if (total > 0) { m.Backpack.DropItem(new BankCheck(total)); } } } } //Does actual changes to plots if (winner != null) { MaginciaBazaar.AwardPlot(this, winner, highest); } else { m_Plot.Reset(); // lease expires m_Plot.NewAuction(MaginciaBazaar.GetShortAuctionTime); } }
public override void OnResponse(NetState state, RelayInfo info) { switch (info.ButtonID) { case 1: this.Section = Section.Buying; Refresh(); break; case 2: this.Section = Section.Selling; Refresh(); break; case 3: TextRelay tr = info.GetTextEntry(0); if (tr != null) { string text = tr.Text; int num = Utility.ToInt32(text); if (num > 0) { if (Banker.Withdraw(User, num * CasinoData.ChipCost, true)) { PointsSystem.CasinoData.AwardPoints(User, num); Bought = num; Section = Section.None; Refresh(); } else { this.Section = Section.Error; Message = 1153178; // Your bank does not have sufficient gold Refresh(); } } else { this.Section = Section.Error; Message = 1153187; // You entered an invalid value Refresh(); } } else { this.Section = Section.Error; Message = 1153187; // You entered an invalid value Refresh(); } break; case 4: TextRelay tr2 = info.GetTextEntry(1); if (tr2 != null) { string text2 = tr2.Text; int num2 = Utility.ToInt32(text2); if (num2 > 0) { if (num2 <= (int)PointsSystem.CasinoData.GetPoints(User)) { Banker.Deposit(User, num2 * CasinoData.ChipCost); PointsSystem.CasinoData.DeductPoints(User, num2, false); User.SendLocalizedMessage(1060397, (num2 * CasinoData.ChipCost).ToString(CultureInfo.GetCultureInfo("en-US"))); // ~1_AMOUNT~ gold has been deposited into your bank box. Section = Section.None; CashedOut = num2; Refresh(); } else { this.Section = Section.Error; Message = 1153180; // You do not have enough casino chips Refresh(); } } else { this.Section = Section.None; Refresh(); } } else { this.Section = Section.Error; Message = 1153187; // You entered an invalid value Refresh(); } break; case 5: this.Section = Section.None; Refresh(); break; } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { m_Mobile.SendLocalizedMessage(1080455); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } else if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } else if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); } else { Item toGive = null; if (m_House.IsAosRules) { if (m_House.Price > 0) { Banker.Deposit(m_Mobile, m_House.Price, true); m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); return; } else { toGive = m_House.GetDeed(); } } else { toGive = m_House.GetDeed(); if (toGive == null && m_House.Price > 0) { toGive = new BankCheck(m_House.Price); } } if (toGive != null) { BankBox box = m_Mobile.BankBox; if (box.TryDropItem(m_Mobile, toGive, false)) { if (toGive is BankCheck) { m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. } m_House.RemoveKeys(m_Mobile); new TempNoHousingRegion(m_House, m_Mobile); m_House.Delete(); } else { toGive.Delete(); m_Mobile.SendLocalizedMessage(500390); // Your bank box is full. } } else { m_Mobile.SendMessage("Unable to refund house."); } } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do } } else if (info.ButtonID == 0) { m_Mobile.CloseGump(typeof(ConfirmHouseResize)); m_Mobile.SendGump(new HouseGump(HouseGumpPage.Customize, m_Mobile, m_House)); } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 1 && !m_House.Deleted) { if (m_House.IsOwner(m_Mobile)) { if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0) { return; } if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062679); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house. return; } if (m_House.HasRentedVendors) { m_Mobile.SendLocalizedMessage(1062680); // You cannot do that that while you still have contract vendors in your house. return; } if (m_House.VendorInventories.Count > 0) { m_Mobile.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house. return; } if (m_House.HasActiveAuction) { m_Mobile.SendLocalizedMessage(1156453); // You cannot currently take this action because you have auction safes locked down in your home. You must remove them first. return; } if (m_Mobile.AccessLevel >= AccessLevel.GameMaster) { m_Mobile.SendMessage("You do not get a refund for your house as you are not a player"); m_House.Delete(); } else { Banker.Deposit(m_Mobile, m_House.Price, true); var region = new TempNoHousingRegion(m_House, m_Mobile); Timer.DelayCall(m_House.RestrictedPlacingTime, region.Unregister); m_House.Delete(); return; } } else { m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this. } } }
public static void FillBank(Mobile m) { BankBox bank = m.BankBox; for (int i = 0; i < PowerScroll.Skills.Count; ++i) { m.Skills[PowerScroll.Skills[i]].Cap = 120.0; } m.StatCap = 250; var book = new Runebook(9999); book.CurCharges = book.MaxCharges; book.Entries.Add(new RunebookEntry(new Point3D(1438, 1695, 0), Map.Trammel, "Britain Bank", null)); book.Entries.Add(new RunebookEntry(new Point3D(1821, 2821, 0), Map.Trammel, "Trinsic Bank", null)); book.Entries.Add(new RunebookEntry(new Point3D(1492, 1628, 13), Map.Trammel, "Britain Sweet Dreams", null)); book.Entries.Add(new RunebookEntry(new Point3D(1388, 1507, 10), Map.Trammel, "Britain Graveyard", null)); book.Entries.Add(new RunebookEntry(new Point3D(1300, 1080, 0), Map.Trammel, "Dungeon Despise", null)); book.Entries.Add(new RunebookEntry(new Point3D(1171, 2639, 0), Map.Trammel, "Dungeon Destard", null)); book.Entries.Add(new RunebookEntry(new Point3D(1260, 2296, 0), Map.Trammel, "Hedge Maze", null)); m.AddToBackpack(book); #region Gold var account = m.Account as Account; if (account != null && account.GetTag("TCGold") == null) { account.AddTag("TCGold", "Gold Given"); Banker.Deposit(m, 30000000, false); } #endregion #region Bank Level Items bank.DropItem(new Robe(443)); bank.DropItem(new Dagger()); bank.DropItem(new Candle()); bank.DropItem(new FireworksWand() { Name = "Mininova Fireworks Wand" }); #endregion Container cont; #region TMaps cont = new Bag(); cont.Name = "Bag of Treasure Maps"; for (int i = 0; i < 10; i++) { PlaceItemIn(cont, 30 + (i * 6), 35, new TreasureMap(Utility.Random(3), Map.Trammel)); } for (int i = 0; i < 10; i++) { PlaceItemIn(cont, 30 + (i * 6), 51, new TreasureMap(Utility.Random(3), Map.Trammel)); } for (int i = 0; i < 20; i++) { PlaceItemIn(cont, 76, 91, new MessageInABottle()); } PlaceItemIn(cont, 22, 77, new Shovel(30000)); PlaceItemIn(cont, 57, 97, new Lockpick(3)); PlaceItemIn(bank, 98, 124, cont); #endregion #region Trans Powder cont = new Bag(); PlaceItemIn(cont, 117, 147, new PowderOfTranslocation(100)); PlaceItemIn(bank, 117, 147, cont); #endregion #region Magery Items cont = new WoodenBox(); cont.Hue = 1195; cont.Name = "Magery Items"; PlaceItemIn(cont, 78, 88, new CrimsonCincture() { Hue = 232 }); PlaceItemIn(cont, 102, 90, new CrystallineRing()); var brac = new GoldBracelet(); brac.Name = "Farmer's Bank of Mastery"; brac.Attributes.CastRecovery = 3; brac.Attributes.CastSpeed = 1; PlaceItemIn(cont, 139, 30, brac); Container bag = new Backpack(); bag.Hue = 1152; bag.Name = "Spell Casting Stuff"; PlaceItemIn(bag, 45, 107, new Spellbook(UInt64.MaxValue)); PlaceItemIn(bag, 65, 107, new NecromancerSpellbook((UInt64)0xFFFF)); PlaceItemIn(bag, 85, 107, new BookOfChivalry((UInt64)0x3FF)); PlaceItemIn(bag, 105, 107, new BookOfBushido()); //Default ctor = full PlaceItemIn(bag, 125, 107, new BookOfNinjitsu()); //Default ctor = full PlaceItemIn(bag, 102, 122, new SpellweavingBook((1ul << 16) - 1)); PlaceItemIn(bag, 122, 122, new MysticBook((1ul << 16) - 1)); Runebook runebook = new Runebook(20); runebook.CurCharges = runebook.MaxCharges; PlaceItemIn(bag, 145, 105, runebook); Item toHue = new BagOfReagents(5000); toHue.Hue = 0x2D; PlaceItemIn(bag, 45, 128, toHue); toHue = new BagOfNecroReagents(3000); toHue.Hue = 0x488; PlaceItemIn(bag, 64, 125, toHue); toHue = new BagOfMysticReagents(3000); toHue.Hue = 1167; PlaceItemIn(bag, 141, 128, toHue); for (int i = 0; i < 9; ++i) { PlaceItemIn(bag, 45 + (i * 10), 74, new RecallRune()); } PlaceItemIn(cont, 47, 91, bag); bag = new Backpack(); bag.Name = "Various Potion Kegs"; PlaceItemIn(bag, 45, 149, MakePotionKeg(PotionEffect.CureGreater, 0x2D)); PlaceItemIn(bag, 69, 149, MakePotionKeg(PotionEffect.HealGreater, 0x499)); PlaceItemIn(bag, 93, 149, MakePotionKeg(PotionEffect.PoisonDeadly, 0x46)); PlaceItemIn(bag, 117, 149, MakePotionKeg(PotionEffect.RefreshTotal, 0x21)); PlaceItemIn(bag, 141, 149, MakePotionKeg(PotionEffect.ExplosionGreater, 0x74)); PlaceItemIn(bag, 93, 82, new Bottle(1000)); PlaceItemIn(cont, 53, 169, bag); PlaceItemIn(bank, 63, 142, cont); #endregion #region Silver - No Mas Silver /*cont = new WoodenBox(); * cont.Hue = 1161; * * PlaceItemIn(cont, 47, 91, new Silver(9000)); * PlaceItemIn(bank, 38, 142, cont);*/ #endregion #region Ethys cont = new Backpack(); cont.Hue = 0x490; cont.Name = "Bag Of Ethy's!"; PlaceItemIn(cont, 45, 66, new EtherealHorse()); PlaceItemIn(cont, 93, 99, new EtherealLlama()); PlaceItemIn(cont, 45, 132, new EtherealUnicorn()); PlaceItemIn(cont, 117, 99, new EtherealBeetle()); PlaceItemIn(bank, 38, 124, cont); #endregion }
static void Main(string[] args) { var banker = new Banker(new ConsoleLogger()); banker.Deposit("12345", 500); }
/** * Way more complex code than it should actually be.. Removes a player, changes turn, updates bank balance */ public void RemovePlayer(Mobile m, bool exchangeBalance) { int exitMobileIdx = GetCurrentDicePlayerIdx(m); int prevExitPlayerIdx = GetPrevDicePlayerIdx(exitMobileIdx); //make the next updated mobile idx MobileDiceStstatus mds = dicePlayers[exitMobileIdx]; RemoveGumps(mds); //remove all gumps from user exiting int exitPlayerBal = mds.GetTableBalance(); int exitPrevPlayerBal = dicePlayers[prevExitPlayerIdx].GetTableBalance(); //only subtract balances, if exchangeBalance is true, and therefore player left the table, and not kicked out by //a too low of balance if (this.playerCnt > 1 && exchangeBalance == true) { if (exitMobileIdx == updatedMobileIdx) { //give previous player the balance //give next player a fresh roll mds.SetTableBalance(exitPlayerBal - this.goldPerGame); dicePlayers[prevExitPlayerIdx].SetTableBalance(exitPrevPlayerBal + this.goldPerGame); SendMessageAllPlayers("Player " + mds.getMobile().Name + " Left on his turn, so " + dicePlayers[prevPlayerIdx].getMobile().Name + " wins " + this.goldPerGame + " gp. from " + mds.getMobile().Name); } else if (exitMobileIdx == prevPlayerIdx) { //give next player the balance. //give current player a fresh roll mds.SetTableBalance(exitPlayerBal - this.goldPerGame); dicePlayers[updatedMobileIdx].SetTableBalance(exitPrevPlayerBal + this.goldPerGame); SendMessageAllPlayers("Player " + mds.getMobile().Name + " Left the game before " + dicePlayers[updatedMobileIdx].getMobile().Name + " could make his decision, and so " + dicePlayers[updatedMobileIdx].getMobile().Name + " wins " + this.goldPerGame + " gp. from " + mds.getMobile().Name); } } //deposite old money Banker.Deposit(mds.getMobile(), mds.GetTableBalance()); //update indexes of game if (updatedMobileIdx >= exitMobileIdx && this.playerCnt > 1) { updatedMobileIdx -= 1; if (dicePlayers.Contains(mds)) { dicePlayers.Remove(mds); } this.playerCnt -= 1; //unfreeze character, used so they can't enter more than 1 game at time mds.getMobile().Frozen = false; prevPlayerIdx = GetPrevDicePlayerIdx(updatedMobileIdx); nextPlayerIdx = GetNextDicePlayerIdx(updatedMobileIdx); if (this.playerCnt < 2) { return; } PlayerTurn(dicePlayers[updatedMobileIdx], DICE_RESET); AddPlayerWaiting(updatedMobileIdx); SetTimerAction(dicePlayers[prevPlayerIdx], dicePlayers[updatedMobileIdx]); } else if (this.playerCnt > 1) { if (dicePlayers.Contains(mds)) { dicePlayers.Remove(mds); } this.playerCnt -= 1; //unfreeze character, used so they can't enter more than 1 game at time mds.getMobile().Frozen = false; prevPlayerIdx = GetPrevDicePlayerIdx(updatedMobileIdx); nextPlayerIdx = GetNextDicePlayerIdx(updatedMobileIdx); if (this.playerCnt < 2) { AddPlayerWaiting(0); return; } PlayerTurn(dicePlayers[updatedMobileIdx], DICE_RESET); AddPlayerWaiting(updatedMobileIdx); SetTimerAction(dicePlayers[prevPlayerIdx], dicePlayers[updatedMobileIdx]); } else if (this.playerCnt == 1) { if (dicePlayers.Contains(mds)) { dicePlayers.Remove(mds); } this.playerCnt = 0; //unfreeze character, used so they can't enter more than 1 game at time mds.getMobile().Frozen = false; } }
public override void OnTalk(PlayerMobile player, bool contextMenu) { QuestSystem qs = player.Quest; if (qs is DarkTidesQuest) { if (DarkTidesQuest.HasLostCallingScroll(player)) { qs.AddConversation(new LostCallingScrollConversation(true)); } else { QuestObjective obj = qs.FindObjective(typeof(FindMardothAboutVaultObjective)); if (obj != null && !obj.Completed) { obj.Complete(); } else { obj = qs.FindObjective(typeof(FindMardothAboutKronusObjective)); if (obj != null && !obj.Completed) { obj.Complete(); } else { obj = qs.FindObjective(typeof(FindMardothEndObjective)); if (obj != null && !obj.Completed) { Container cont = GetNewContainer(); cont.DropItem(new PigIron(20)); cont.DropItem(new NoxCrystal(20)); cont.DropItem(new BatWing(25)); cont.DropItem(new DaemonBlood(20)); cont.DropItem(new GraveDust(20)); BaseWeapon weapon = new BoneHarvester(); weapon.Slayer = SlayerName.OrcSlaying; if (Core.AOS) { BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40); } else { weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4); weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4); weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4); } cont.DropItem(weapon); if (!Core.TOL) { cont.DropItem(new BankCheck(2000)); } else { Banker.Deposit(player, 2000, true); } cont.DropItem(new EnchantedSextant()); if (!player.PlaceInBackpack(cont)) { cont.Delete(); player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory. } else { obj.Complete(); } } else if (contextMenu) { FocusTo(player); player.SendLocalizedMessage(1061821); // Mardoth has nothing more for you at this time. } } } } } else if (qs == null && QuestSystem.CanOfferQuest(player, typeof(DarkTidesQuest))) { new DarkTidesQuest(player).SendOffer(); } }
/// <summary> /// Verse un salaire pour tous les mobiles qui sont dans une institution. Dans le cas /// où un joueur est dans deux institutions, il touche le salaire le plus élevé. /// </summary> public static void Pay() { if (m_InstancesList != null) { if (m_InstancesList.Count > 0) { Dictionary <Mobile, int> Paie = new Dictionary <Mobile, int>(); Dictionary <Mobile, int> BonusRepublique = new Dictionary <Mobile, int>(); // Construit une liste key-val pour chaque Mobile institutionnalisé. // Lui set un salaire qui correspond au salaire le plus élevé de toutes les institutions dans lesquelles il a un rang. foreach (InstitutionHandler i in m_InstancesList) { if (i != null) { if (i is RepubliqueInstitutionHandler) { foreach (KeyValuePair <Mobile, int> pair in i.m_Mobiles) { BonusRepublique.Add(pair.Key, i.GetSalaire(pair.Value)); } } else { foreach (KeyValuePair <Mobile, int> pair in i.m_Mobiles) { if (!Paie.ContainsKey(pair.Key)) { Paie.Add(pair.Key, i.GetSalaire(pair.Value)); } else { Paie[pair.Key] = Math.Max(Paie[pair.Key], i.GetSalaire(pair.Value)); } } } } } int amount = 0; foreach (KeyValuePair <Mobile, int> pair in Paie) { amount = 0; if (BonusRepublique.ContainsKey(pair.Key)) { amount += BonusRepublique[pair.Key]; pair.Key.SendMessage("Votre fonction au sein de la république ajoute " + amount + " pièces d'or à votre salaire."); } amount += pair.Value; if (Banker.Deposit(pair.Key, amount)) { pair.Key.SendMessage("Un dépot de " + amount + " pièces d'or a été fait par vos institutions."); } else { pair.Key.SendMessage("Il y a eu une erreur lors du dépot de " + amount + " pièces d'or dans votre coffre de banque. Le salaire a donc été versé directement dans votre sac pour éviter la perte."); pair.Key.AddToBackpack(new Gold(amount)); } PayLogging(pair.Key, amount); } } } }
public void RemovePlayer(PokerPlayer player) { Mobile from = player.Mobile; if (from is PlayerMobile) { var playermob = from as PlayerMobile; playermob.PokerJoinTimer = DateTime.UtcNow + TimeSpan.FromMinutes(1); playermob.Blessed = false; } if (from == null || !Players.Contains(player)) { return; } Players.Players.Remove(player); if (Players.Peek() == player) //It is currently their turn, fold them. { player.CloseGump(typeof(PokerBetGump)); Timer.m_LastPlayer = null; player.Action = PlayerAction.Fold; } if (Players.Round.Contains(player)) { Players.Round.Remove(player); } if (Players.Turn.Contains(player)) { Players.Turn.Remove(player); } if (Players.Round.Count == 0) { if (PokerPlayers != null && PokerPlayers.Exists(x => x.Serial == player.Mobile.Serial)) { PokerPlayers.Find(x => x.Serial == player.Mobile.Serial).Credit += CommunityCurrency; } player.Currency += CommunityCurrency; CommunityCurrency = 0; if (GameBackup.PokerGames.Contains(this)) { GameBackup.PokerGames.Remove(this); } } if (player.Currency > 0) { if (from.BankBox == null) //Should NEVER happen, but JUST IN CASE! { Utility.PushColor(ConsoleColor.Red); Console.WriteLine( "WARNING: Player \"{0}\" with account \"{1}\" had null bank box while trying to deposit {2:#,0} {3}. Player will NOT recieve their gold.", from.Name, from.Account == null ? "(-null-)" : from.Account.Username, player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); Utility.PopColor(); try { using (var op = new StreamWriter("poker_error.log", true)) { op.WriteLine( "WARNING: Player \"{0}\" with account \"{1}\" had null bankbox while poker script was trying to deposit {2:#,0} {3}. Player will NOT recieve their gold.", from.Name, from.Account == null ? "(-null-)" : from.Account.Username, player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } } catch {} from.SendMessage( 0x22, "WARNING: Could not find your bank box. All of your poker money has been lost in this error. Please contact a Game Master to resolve this issue."); } else { if (Banker.Deposit(from, TypeOfCurrency, player.Currency)) { from.SendMessage(0x22, "{0:#,0} {1} has been deposited into your bank box.", player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } else { BankCheck check; if (Dealer.IsDonation) { check = new BankCheck(player.Currency, true); } else { check = new BankCheck(player.Currency); } from.Backpack.DropItem(check); from.SendMessage(0x22, "{0:#,0} {1} has been placed in your bag.", player.Currency, (Dealer.IsDonation ? "donation coins" : "gold")); } } } player.CloseAllGumps(); ((PlayerMobile)from).PokerGame = null; from.Location = Dealer.ExitLocation; from.Map = Dealer.ExitMap; from.SendMessage(0x22, "You have left the table"); NeedsGumpUpdate = true; }