From 0988eec59772e173e9b3692b9382ee7145051687 Mon Sep 17 00:00:00 2001 From: xavier Date: Sat, 9 Oct 2010 17:45:14 +0000 Subject: [PATCH] Cannot recall from any champ spawns, not just felucca. http://www.uodemise.com/forum/showthread.php?t=155452 Party functions context menu bypasses various checks. http://www.uodemise.com/forum/showthread.php?t=150643 Insurance consumption notifications. http://www.uodemise.com/forum/showthread.php?t=152421 --- Scripts/Context Menus/AddToParty.cs | 18 ++++++++++++- Scripts/Engines/Party/RemoveFromParty.cs | 31 +++++++++++++++++++++++ Scripts/Mobiles/PlayerMobile.cs | 32 +++++++++++++++++++----- Scripts/Spells/Base/SpellHelper.cs | 2 +- 4 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 Scripts/Engines/Party/RemoveFromParty.cs diff --git a/Scripts/Context Menus/AddToParty.cs b/Scripts/Context Menus/AddToParty.cs index 89735d351..a666231ac 100644 --- a/Scripts/Context Menus/AddToParty.cs +++ b/Scripts/Context Menus/AddToParty.cs @@ -17,7 +17,23 @@ namespace Server.ContextMenus public override void OnClick() { - Party.Invite( m_From, m_Target ); + Party p = Party.Get( m_From ); + Party mp = Party.Get( m_Target ); + + if ( m_From == m_Target ) + m_From.SendLocalizedMessage( 1005439 ); // You cannot add yourself to a party. + else if ( p != null && p.Leader != m_From ) + m_From.SendLocalizedMessage( 1005453 ); // You may only add members to the party if you are the leader. + else if ( p != null && (p.Members.Count + p.Candidates.Count) >= Party.Capacity ) + m_From.SendLocalizedMessage( 1008095 ); // You may only have 10 in your party (this includes candidates). + else if ( !m_Target.Player ) + m_From.SendLocalizedMessage( 1005444 ); // The creature ignores your offer. + else if ( mp != null && mp == p ) + m_From.SendLocalizedMessage( 1005440 ); // This person is already in your party! + else if ( mp != null ) + m_From.SendLocalizedMessage( 1005441 ); // This person is already in a party! + else + Party.Invite( m_From, m_Target ); } } } diff --git a/Scripts/Engines/Party/RemoveFromParty.cs b/Scripts/Engines/Party/RemoveFromParty.cs new file mode 100644 index 000000000..f07242ab9 --- /dev/null +++ b/Scripts/Engines/Party/RemoveFromParty.cs @@ -0,0 +1,31 @@ +using System; +using Server.Mobiles; +using Server.Engines.PartySystem; + +namespace Server.ContextMenus +{ + public class RemoveFromPartyEntry : ContextMenuEntry + { + private Mobile m_From; + private Mobile m_Target; + + public RemoveFromPartyEntry( Mobile from, Mobile target ) : base( 0198, 12 ) + { + m_From = from; + m_Target = target; + } + + public override void OnClick() + { + Party p = Party.Get( m_From ); + + if ( p == null || p.Leader != m_From || !p.Contains( m_Target ) ) + return; + + if ( m_From == m_Target ) + m_From.SendLocalizedMessage( 1005446 ); // You may only remove yourself from a party if you are not the leader. + else + p.Remove( m_Target ); + } + } +} diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 329a30044..61ef91be8 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -24,6 +24,7 @@ using Server.Accounting; using Server.Engines.CannedEvil; using Server.Engines.Craft; using Server.Spells.Spellweaving; +using Server.Engines.PartySystem; namespace Server.Mobiles { @@ -103,6 +104,7 @@ namespace Server.Mobiles private int m_Profession; private bool m_IsStealthing; // IsStealthing should be moved to Server.Mobiles private bool m_IgnoreMobiles; // IgnoreMobiles should be moved to Server.Mobiles + private int m_NonAutoreinsuredItems; // number of items that could not be automaitically reinsured because gold in bank was not enough /* * a value of zero means, that the mobile is not executing the spell. Otherwise, @@ -1491,9 +1493,19 @@ namespace Server.Mobiles } if ( from != this ) { - if ( Alive && Core.Expansion >= Expansion.AOS ) - list.Add( new AddToPartyEntry( from, this ) ); + { + if ( from.Party == null && this.Party == null ) + list.Add( new AddToPartyEntry( from, this ) ); + + else if ( from.Party != null && ((Party)from.Party).Leader == from ) + { + if ( this.Party == null ) + list.Add( new AddToPartyEntry( from, this ) ); + else if ( this.Party == from.Party ) + list.Add( new RemoveFromPartyEntry( from, this ) ); + } + } BaseHouse curhouse = BaseHouse.FindHouseAt( this ); @@ -2059,6 +2071,7 @@ namespace Server.Mobiles public override bool OnBeforeDeath() { + m_NonAutoreinsuredItems = 0; m_InsuranceCost = 0; m_InsuranceAward = base.FindMostRecentDamager( false ); @@ -2098,12 +2111,14 @@ namespace Server.Mobiles { m_InsuranceCost += cost; item.PayedInsurance = true; - } + SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. + } else { SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance item.PayedInsurance = false; item.Insured = false; + m_NonAutoreinsuredItems++; } } else @@ -2155,7 +2170,12 @@ namespace Server.Mobiles public override void OnDeath( Container c ) { - base.OnDeath( c ); + if (m_NonAutoreinsuredItems > 0) + { + SendMessage("You do not have the gold to automatically reinsure all your items."); + } + + base.OnDeath(c); HueMod = -1; NameMod = null; @@ -2474,7 +2494,7 @@ namespace Server.Mobiles /* Per EA's UO Herald Pub48 (ML): * ((resist spellsx10)/20 + 10=percentage of damage resisted) */ - + if ( oath == this ) { amount = (int)(amount * 1.1); @@ -3399,7 +3419,7 @@ namespace Server.Mobiles if ( context != null && context.Type == typeof( ReaperFormSpell ) ) return Mobile.WalkFoot; - bool running = ( (dir & Direction.Running) != 0 ); + bool running = ( (dir & Direction.Running) != 0 ); bool onHorse = ( this.Mount != null ); diff --git a/Scripts/Spells/Base/SpellHelper.cs b/Scripts/Spells/Base/SpellHelper.cs index 4fd7e02a3..200cf97be 100644 --- a/Scripts/Spells/Base/SpellHelper.cs +++ b/Scripts/Spells/Base/SpellHelper.cs @@ -553,7 +553,7 @@ namespace Server.Spells private static bool[,] m_Rules = new bool[,] { /*T2A(Fel) Ilshenar Wind(Tram), Wind(Fel), Dungeons(Fel), Solen(Tram), Solen(Fel), CrystalCave(Malas), Gauntlet(Malas), Gauntlet(Ferry), Stronghold, ChampionSpawn, Dungeons(Tokuno[Malas]), LampRoom(Doom), GuardianRoom(Doom) */ -/* Recall From */ { false, true, true, false, false, true, false, false, false, false, true, true, true, false, false }, +/* Recall From */ { false, true, true, false, false, true, false, false, false, false, true, false, true, false, false }, /* Recall To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }, /* Gate From */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false }, /* Gate To */ { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false },