Hello all i need help on playermobile these are the error i gt when i try to run it
CODE
- Error: Scripts\Mobiles\PlayerMobile.cs: CS1519: (line 2505, column 4) Invalid token 'if' in class, struct, or interface member declaration - Error: Scripts\Mobiles\PlayerMobile.cs: CS1519: (line 2505, column 18) Invali d token '>' in class, struct, or interface member declaration - Error: Scripts\Mobiles\PlayerMobile.cs: CS1519: (line 2507, column 22) Invali d token '==' in class, struct, or interface member declaration - Error: Scripts\Mobiles\PlayerMobile.cs: CS1519: (line 2507, column 44) Invali d token ')' in class, struct, or interface member declaration - Error: Scripts\Mobiles\PlayerMobile.cs: CS1519: (line 2508, column 13) Invali d token '(' in class, struct, or interface member declaration - Error: Scripts\Mobiles\PlayerMobile.cs: CS0116: (line 2512, column 4) A names pace does not directly contain members such as fields or methods
here is part i added
CODE
if ( m_Kills > 0 ) { if ( AccessLevel == AccessLevel.Player ) list.Add( 1060809, "Kills/t0" ); } }
if ( m_Deaths > 0 ) { if ( AccessLevel == AccessLevel.Player ) list.Add( 1060811, "Deaths\t0", ); } }
here is the full script
CODE
using System; using System.Collections; using Server; using Server.Misc; using Server.Items; using Server.Gumps; using Server.Multis; using Server.Engines.Help; using Server.ContextMenus; using Server.Network; using Server.Spells; using Server.Spells.Fifth; using Server.Spells.Seventh; using Server.Targeting; using Server.Engines.Quests; using Server.Factions; using Server.Regions; using Server.Accounting;
using Scripts.ToolBarGump;
namespace Server.Mobiles { [Flags] public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000 { None = 0x00000000, Glassblowing = 0x00000001, Masonry = 0x00000002, SandMining = 0x00000004, StoneMining = 0x00000008, ToggleMiningStone = 0x00000010, KarmaLocked = 0x00000020, AutoRenewInsurance = 0x00000040, UseOwnFilter = 0x00000080, PublicMyRunUO = 0x00000100, PagingSquelched = 0x00000200, Young = 0x00000400 }
public override bool KeepsItemsOnDeath { get { if(isinchal) return true; return base.KeepsItemsOnDeath; } }
//End Challenge System
//Start Pvp Point System
private int m_TotalPoints; private int m_TotalWins; private int m_TotalLoses; private int m_TotalResKills; private int m_TotalResKilled; private Mobile m_LastPwner; private Mobile m_LastPwned; private DateTime m_ResKillTime; private int m_TotalPointsLost; private int m_TotalPointsSpent; private string m_PvpRank = "Newbie";
public static Direction GetDirection4( Point3D from, Point3D to ) { int dx = from.X - to.X; int dy = from.Y - to.Y;
int rx = dx - dy; int ry = dx + dy;
Direction ret;
if ( rx >= 0 && ry >= 0 ) ret = Direction.West; else if ( rx >= 0 && ry < 0 ) ret = Direction.South; else if ( rx < 0 && ry < 0 ) ret = Direction.East; else ret = Direction.North;
return ret; }
public override bool OnDroppedItemToWorld( Item item, Point3D location ) { if ( !base.OnDroppedItemToWorld( item, location ) ) return false;
public override void ComputeBaseLightLevels( out int global, out int personal ) { if ( null != m_SafeResContext ) m_SafeResContext.Check(); // <- Xanthos Safe Res change this line only global = LightCycle.ComputeLevelFor( this );
if ( this.LightLevel < 21 && AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 ) personal = 21; else personal = this.LightLevel; } public override void CheckLightLevels( bool forceResend ) { NetState ns = this.NetState;
if ( ns == null ) return;
int global, personal;
ComputeLightLevels( out global, out personal );
if ( !forceResend ) forceResend = ( global != m_LastGlobalLight || personal != m_LastPersonalLight );
ns.Send( GlobalLightLevel.Instantiate( global ) ); ns.Send( new PersonalLightLevel( this, personal ) ); }
public override int GetMinResistance( ResistanceType type ) { int magicResist = (int)(Skills[SkillName.MagicResist].Value * 10); int min = int.MinValue;
if ( magicResist >= 1000 ) min = 40 + ((magicResist - 1000) / 50); else if ( magicResist >= 400 ) min = (magicResist - 400) / 15;
if ( min > MaxPlayerResistance ) min = MaxPlayerResistance;
int baseMin = base.GetMinResistance( type );
if ( min < baseMin ) min = baseMin;
return min; }
private static void OnLogin( LoginEventArgs e ) { Mobile from = e.Mobile;
SacrificeVirtue.CheckAtrophy( from ); JusticeVirtue.CheckAtrophy( from ); CompassionVirtue.CheckAtrophy( from );
if ( from.AccessLevel == AccessLevel.GameMaster ) { from.SendGump( new ToolBarGump() ); } if ( from.AccessLevel == AccessLevel.Administrator ) { from.SendGump( new ToolBarGump() ); }
if ( AccountHandler.LockdownLevel > AccessLevel.Player ) { string notice;
Accounting.Account acct = from.Account as Accounting.Account;
if ( acct == null || !acct.HasAccess( from.NetState ) ) { if ( from.AccessLevel == AccessLevel.Player ) notice = "The server is currently under lockdown. No players are allowed to log in at this time."; else notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from ); } else if ( from.AccessLevel == AccessLevel.Administrator ) { notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump."; } else { notice = "The server is currently under lockdown. You have sufficient access level to connect."; }
int str = this.Str; int dex = this.Dex; int intel = this.Int;
#region Factions int factionItemCount = 0; #endregion
Mobile from = this;
for ( int i = items.Count - 1; i >= 0; --i ) { if ( i >= items.Count ) continue;
Item item = (Item)items[i];
if ( item is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)item;
bool drop = false;
if ( dex < weapon.DexRequirement ) drop = true; else if ( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) ) drop = true; else if ( intel < weapon.IntRequirement ) drop = true;
if ( drop ) { string name = weapon.Name;
if ( name == null ) name = String.Format( "#{0}", weapon.LabelNumber );
from.SendLocalizedMessage( 1062001, name ); // You can no longer wield your ~1_WEAPON~ from.AddToBackpack( weapon ); moved = true; } } else if ( item is BaseArmor ) { BaseArmor armor = (BaseArmor)item;
bool drop = false;
if ( !armor.AllowMaleWearer && from.Body.IsMale && from.AccessLevel < AccessLevel.GameMaster ) { drop = true; } else if ( !armor.AllowFemaleWearer && from.Body.IsFemale && from.AccessLevel < AccessLevel.GameMaster ) { drop = true; } else { int strBonus = armor.ComputeStatBonus( StatType.Str ), strReq = armor.ComputeStatReq( StatType.Str ); int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex ); int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int );
if ( dex < dexReq || (dex + dexBonus) < 1 ) drop = true; else if ( str < strReq || (str + strBonus) < 1 ) drop = true; else if ( intel < intReq || (intel + intBonus) < 1 ) drop = true; }
if ( drop ) { string name = armor.Name;
if ( name == null ) name = String.Format( "#{0}", armor.LabelNumber );
if ( armor is BaseShield ) from.SendLocalizedMessage( 1062003, name ); // You can no longer equip your ~1_SHIELD~ else from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~
if ( ourFaction == null || ourFaction != factionItem.Faction ) drop = true; else if ( ++factionItemCount > FactionItem.GetMaxWearables( this ) ) drop = true;
if ( drop ) { from.AddToBackpack( item ); moved = true; } } }
if ( moved ) from.SendLocalizedMessage( 500647 ); // Some equipment has been moved to your backpack. } catch ( Exception e ) { Console.WriteLine( e ); } finally { m_NoDeltaRecursion = false; } }
public override void Delta( MobileDelta flag ) { base.Delta( flag );
if ( (flag & MobileDelta.Stat) != 0 ) ValidateEquipment();
for ( int i = 0; i < gumps.Count; ++i ) { if ( gumps[i] is ResurrectGump ) { if ( Alive ) { CloseGump( typeof( ResurrectGump ) ); } else { SendLocalizedMessage( 500111 ); // You are frozen and cannot move. return false; } } } }
TimeSpan speed = ComputeMovementSpeed( d );
if ( !base.Move( d ) ) return false;
m_NextMovementTime += speed;
return true; }
public override bool CheckMovement( Direction d, out int newZ ) { DesignContext context = m_DesignContext;
if ( context == null ) return base.CheckMovement( d, out newZ );
public override bool AllowItemUse( Item item ) { return DesignContext.Check( this ); }
public override bool AllowSkillUse( SkillName skill ) { if ( null != m_SafeResContext ) // <- Xanthos Safe Res change this line only return ( DesignContext.Check( this ) && m_SafeResContext.AllowSkillUse( skill )); // <- Xanthos Safe Res change this line only return DesignContext.Check( this ); }
private bool m_LastProtectedMessage; private int m_NextProtectionCheck = 10;
public virtual void RecheckTownProtection() { m_NextProtectionCheck = 10;
if ( isProtected != m_LastProtectedMessage ) { if ( isProtected ) SendLocalizedMessage( 500112 ); // You are now under the protection of the town guards. else SendLocalizedMessage( 500113 ); // You have left the protection of the town guards.
public override void SetLocation( Point3D loc, bool isTeleport ) { if ( !isTeleport && AccessLevel == AccessLevel.Player ) { // moving, not teleporting int zDrop = ( this.Location.Z - loc.Z );
if ( zDrop > 20 ) // we fell more than one story Hits -= ((zDrop / 20) * 10) - 5; // deal some damage; does not kill, disrupt, etc }
base.SetLocation( loc, isTeleport );
if ( isTeleport || --m_NextProtectionCheck == 0 ) RecheckTownProtection(); }
public override void GetContextMenuEntries( Mobile from, ArrayList list ) { base.GetContextMenuEntries( from, list );
if ( from == this ) { if ( m_Quest != null ) m_Quest.GetContextMenuEntries( list );
if ( Alive && InsuranceEnabled ) { list.Add( new CallbackEntry( 6201, new ContextCallback( ToggleItemInsurance ) ) );
if ( AutoRenewInsurance ) list.Add( new CallbackEntry( 6202, new ContextCallback( CancelRenewInventoryInsurance ) ) ); else list.Add( new CallbackEntry( 6200, new ContextCallback( AutoRenewInventoryInsurance ) ) ); }
// TODO: Toggle champ titles
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null ) { if ( Alive && house.InternalizedVendors.Count > 0 && house.IsOwner( this ) ) list.Add( new CallbackEntry( 6204, new ContextCallback( GetVendor ) ) );
if ( house.IsAosRules ) list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) ); }
if ( m_JusticeProtectors.Count > 0 ) list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) ); } }
private void CancelProtection() { for ( int i = 0; i < m_JusticeProtectors.Count; ++i ) { Mobile prot = (Mobile)m_JusticeProtectors[i];
prot.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended. this.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended. }
m_JusticeProtectors.Clear(); }
private void ToggleItemInsurance() { if ( !CheckAlive() ) return;
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868 ); // Target the item you wish to toggle insurance status on <ESC> to cancel }
private bool CanInsure( Item item ) { if ( item is Container || item is BagOfSending ) return false;
if ( item is Spellbook || item is Runebook || item is PotionKeg || item is Sigil ) return false;
if ( item.Stackable ) return false;
if ( item.LootType == LootType.Cursed ) return false;
if ( item.ItemID == 0x204E ) // death shroud return false;
return true; }
private void ToggleItemInsurance_Callback( Mobile from, object obj ) { if ( !CheckAlive() ) return;
Item item = obj as Item;
if ( item == null || !item.IsChildOf( this ) ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060871, "", 0x23 ); // You can only insure items that you have equipped or that are in your backpack } else if ( item.Insured ) { item.Insured = false;
SendLocalizedMessage( 1060874, "", 0x35 ); // You cancel the insurance on the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel } else if ( !CanInsure( item ) ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that } else if ( item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == from ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060870, "", 0x23 ); // That item is blessed and does not need to be insured SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that } else { if ( !item.PayedInsurance ) { if ( Banker.Withdraw( from, 600 ) ) { SendLocalizedMessage( 1060398, "600" ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. item.PayedInsurance = true; } else { SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance return; } }
item.Insured = true;
SendLocalizedMessage( 1060873, "", 0x23 ); // You have insured the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel } }
private void AutoRenewInventoryInsurance() { if ( !CheckAlive() ) return;
SendLocalizedMessage( 1060881, "", 0x23 ); // You have selected to automatically reinsure all insured items upon death AutoRenewInsurance = true; }
private void CancelRenewInventoryInsurance() { if ( !CheckAlive() ) return;
SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death AutoRenewInsurance = false; }
// TODO: Champ titles, toggle
private void GetVendor() { BaseHouse house = BaseHouse.FindHouseAt( this );
if ( CheckAlive() && house != null && house.IsOwner( this ) && house.InternalizedVendors.Count > 0 ) { CloseGump( typeof( ReclaimVendorGump ) ); SendGump( new ReclaimVendorGump( house ) ); } }
private void LeaveHouse() { BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null ) this.Location = house.BanLocation; }
private delegate void ContextCallback();
private class CallbackEntry : ContextMenuEntry { private ContextCallback m_Callback;
public CallbackEntry( int number, ContextCallback callback ) : this( number, -1, callback ) { }
public CallbackEntry( int number, int range, ContextCallback callback ) : base( number, range ) { m_Callback = callback; }
public override void OnClick() { if ( m_Callback != null ) m_Callback(); } }
public override void OnDoubleClick( Mobile from ) { if ( this == from && !Warmode ) { IMount mount = Mount;
if ( mount != null && !DesignContext.Check( this ) ) return; }
base.OnDoubleClick( from ); }
public override void DisplayPaperdollTo( Mobile to ) { if ( DesignContext.Check( this ) ) base.DisplayPaperdollTo( to ); }
private static bool m_NoRecursion;
public override bool CheckEquip( Item item ) { if ( !base.CheckEquip( item ) ) return false;
if ( bounce != null ) { if ( bounce.m_Parent is Item ) { Item parent = (Item) bounce.m_Parent;
if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) ) return true; } else if ( bounce.m_Parent == this ) { return true; } }
SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending. return false; }
return true; }
public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight ) { int msgNum = 0;
if ( cont == null ) { if ( to.Holding != null ) msgNum = 1062727; // You cannot trade with someone who is dragging something. else if ( this.HasTrade ) msgNum = 1062781; // You are already trading with someone else! else if ( to.HasTrade ) msgNum = 1062779; // That person is already involved in a trade }
if ( this.Backpack == null || !this.Backpack.CheckHold( this, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004040; // You would not be able to hold this if the trade failed. else if ( to.Backpack == null || !to.Backpack.CheckHold( to, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004039; // The recipient of this trade would not be able to carry this. else msgNum = CheckContentForTrade( item ); }
if ( msgNum != 0 ) { if ( message ) this.SendLocalizedMessage( msgNum );
return false; }
return true; }
private static int CheckContentForTrade( Item item ) { if ( item is TrapableContainer && ((TrapableContainer)item).TrapType != TrapType.None ) return 1004044; // You may not trade trapped items.
if ( SkillHandlers.StolenItem.IsStolen( item ) ) return 1004043; // You may not trade recently stolen items.
if ( item is Container ) { foreach ( Item subItem in item.Items ) { int msg = CheckContentForTrade( subItem );
if ( msg != 0 ) return msg; } }
return 0; }
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target ) { if ( !base.CheckNonlocalDrop( from, item, target ) ) return false;
if ( from.AccessLevel >= AccessLevel.GameMaster ) return true;
Container pack = this.Backpack; if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) ) { BounceInfo bounce = item.GetBounce();
if ( bounce != null && bounce.m_Parent is Item ) { Item parent = (Item) bounce.m_Parent;
if ( Banker.Withdraw( this, cost ) ) { m_InsuranceCost += cost; item.PayedInsurance = true; } else { SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance item.PayedInsurance = false; item.Insured = false; } } else { item.PayedInsurance = false; item.Insured = false; }
if ( m_Insuranc
ArteGordon- 02-07-2006
Im not sure where you put this code
CODE
if ( m_Kills > 0 ) { if ( AccessLevel == AccessLevel.Player ) list.Add( 1060809, "Kills/t0" ); } }
if ( m_Deaths > 0 ) { if ( AccessLevel == AccessLevel.Player ) list.Add( 1060811, "Deaths\t0", ); } }
but it is not in the correct place. You want to add this to a method like
QUOTE
public override void GetProperties( ObjectPropertyList list ) {
base.GetProperties( list );
// add the code somewhere in this method
if ( Map == Faction.Facet ) { PlayerState pl = PlayerState.Find( this );
if ( pl != null ) { Faction faction = pl.Faction;
if ( faction.Commander == this ) list.Add( 1042733, faction.Definition.PropName ); // Commanding Lord of the ~1_FACTION_NAME~ else if ( pl.Sheriff != null ) list.Add( 1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName ); // The Sheriff of ~1_CITY~, ~2_FACTION_NAME~ else if ( pl.Finance != null ) list.Add( 1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName ); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~ else if ( pl.MerchantTitle != MerchantTitle.None ) list.Add( 1060776, "{0}\t{1}", MerchantTitles.GetInfo( pl.MerchantTitle ).Title, faction.Definition.PropName ); // ~1_val~, ~2_val~ else list.Add( 1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName ); // ~1_val~, ~2_val~ } } }
Asmir02- 02-07-2006
ok i did what you told me but i figured out that i coded it wrong but i still get some errors the errors
CODE
- Error: Scripts\Mobiles\PlayerMobile.cs: CS0116: (line 2538, column 4) A name pace does not directly contain members such as fields or methods - Error: Scripts\Mobiles\PlayerMobile.cs: CS1022: (line 2549, column 4) Type o namespace definition, or end-of-file expected Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again.
here is the part of the script that im working on
CODE
public override void GetProperties( ObjectPropertyList list ) { base.GetProperties( list );
if (AccessLevel > AccessLevel.Player) { string color = ""; switch ( AccessLevel ) { case AccessLevel.Counselor: color = "#00BFFF"; break; //Deep Sky Blue case AccessLevel.GameMaster: color = "#FF0000"; break; //Red case AccessLevel.Seer: color = "#00FF00"; break; //Green case AccessLevel.Administrator: color = "#FFD700"; break; //Gold } list.Add( 1060658, "{0}\t{1}", "Staff", String.Format("<BASEFONT COLOR={0}>{1}", color, AccessLevel) ); }
if ( Map == Faction.Facet ) { PlayerState pl = PlayerState.Find( this );
if ( pl != null ) { Faction faction = pl.Faction;
if ( faction.Commander == this ) list.Add( 1042733, faction.Definition.PropName ); // Commanding Lord of the ~1_FACTION_NAME~ else if ( pl.Sheriff != null ) list.Add( 1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName ); // The Sheriff of ~1_CITY~, ~2_FACTION_NAME~ else if ( pl.Finance != null ) list.Add( 1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName ); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~ else if ( pl.MerchantTitle != MerchantTitle.None ) list.Add( 1060776, "{0}\t{1}", MerchantTitles.GetInfo( pl.MerchantTitle ).Title, faction.Definition.PropName ); // ~1_val~, ~2_val~ else list.Add( 1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName ); // ~1_val~, ~2_val~ } } }
ok now there is no errors i did what you said and still dont work i trying changing number it still dont show kill/death under players name here is the part that i fixxed
using System; using System.Collections; using Server; using Server.Misc; using Server.Items; using Server.Gumps; using Server.Multis; using Server.Engines.Help; using Server.ContextMenus; using Server.Network; using Server.Spells; using Server.Spells.Fifth; using Server.Spells.Seventh; using Server.Targeting; using Server.Engines.Quests; using Server.Factions; using Server.Regions; using Server.Accounting;
using Scripts.ToolBarGump;
namespace Server.Mobiles { [Flags] public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000 { None = 0x00000000, Glassblowing = 0x00000001, Masonry = 0x00000002, SandMining = 0x00000004, StoneMining = 0x00000008, ToggleMiningStone = 0x00000010, KarmaLocked = 0x00000020, AutoRenewInsurance = 0x00000040, UseOwnFilter = 0x00000080, PublicMyRunUO = 0x00000100, PagingSquelched = 0x00000200, Young = 0x00000400 }
public override bool KeepsItemsOnDeath { get { if(isinchal) return true; return base.KeepsItemsOnDeath; } }
//End Challenge System
//Start Pvp Point System
private int m_TotalPoints; private int m_TotalWins; private int m_TotalLoses; private int m_TotalResKills; private int m_TotalResKilled; private Mobile m_LastPwner; private Mobile m_LastPwned; private DateTime m_ResKillTime; private int m_TotalPointsLost; private int m_TotalPointsSpent; private string m_PvpRank = "Newbie";
public static Direction GetDirection4( Point3D from, Point3D to ) { int dx = from.X - to.X; int dy = from.Y - to.Y;
int rx = dx - dy; int ry = dx + dy;
Direction ret;
if ( rx >= 0 && ry >= 0 ) ret = Direction.West; else if ( rx >= 0 && ry < 0 ) ret = Direction.South; else if ( rx < 0 && ry < 0 ) ret = Direction.East; else ret = Direction.North;
return ret; }
public override bool OnDroppedItemToWorld( Item item, Point3D location ) { if ( !base.OnDroppedItemToWorld( item, location ) ) return false;
public override void ComputeBaseLightLevels( out int global, out int personal ) { if ( null != m_SafeResContext ) m_SafeResContext.Check(); // <- Xanthos Safe Res change this line only global = LightCycle.ComputeLevelFor( this );
if ( this.LightLevel < 21 && AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 ) personal = 21; else personal = this.LightLevel; } public override void CheckLightLevels( bool forceResend ) { NetState ns = this.NetState;
if ( ns == null ) return;
int global, personal;
ComputeLightLevels( out global, out personal );
if ( !forceResend ) forceResend = ( global != m_LastGlobalLight || personal != m_LastPersonalLight );
ns.Send( GlobalLightLevel.Instantiate( global ) ); ns.Send( new PersonalLightLevel( this, personal ) ); }
public override int GetMinResistance( ResistanceType type ) { int magicResist = (int)(Skills[SkillName.MagicResist].Value * 10); int min = int.MinValue;
if ( magicResist >= 1000 ) min = 40 + ((magicResist - 1000) / 50); else if ( magicResist >= 400 ) min = (magicResist - 400) / 15;
if ( min > MaxPlayerResistance ) min = MaxPlayerResistance;
int baseMin = base.GetMinResistance( type );
if ( min < baseMin ) min = baseMin;
return min; }
private static void OnLogin( LoginEventArgs e ) { Mobile from = e.Mobile;
SacrificeVirtue.CheckAtrophy( from ); JusticeVirtue.CheckAtrophy( from ); CompassionVirtue.CheckAtrophy( from );
if ( from.AccessLevel == AccessLevel.GameMaster ) { from.SendGump( new ToolBarGump() ); } if ( from.AccessLevel == AccessLevel.Administrator ) { from.SendGump( new ToolBarGump() ); }
if ( AccountHandler.LockdownLevel > AccessLevel.Player ) { string notice;
Accounting.Account acct = from.Account as Accounting.Account;
if ( acct == null || !acct.HasAccess( from.NetState ) ) { if ( from.AccessLevel == AccessLevel.Player ) notice = "The server is currently under lockdown. No players are allowed to log in at this time."; else notice = "The server is currently under lockdown. You do not have sufficient access level to connect.";
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Disconnect ), from ); } else if ( from.AccessLevel == AccessLevel.Administrator ) { notice = "The server is currently under lockdown. As you are an administrator, you may change this from the [Admin gump."; } else { notice = "The server is currently under lockdown. You have sufficient access level to connect."; }
int str = this.Str; int dex = this.Dex; int intel = this.Int;
#region Factions int factionItemCount = 0; #endregion
Mobile from = this;
for ( int i = items.Count - 1; i >= 0; --i ) { if ( i >= items.Count ) continue;
Item item = (Item)items[i];
if ( item is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)item;
bool drop = false;
if ( dex < weapon.DexRequirement ) drop = true; else if ( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) ) drop = true; else if ( intel < weapon.IntRequirement ) drop = true;
if ( drop ) { string name = weapon.Name;
if ( name == null ) name = String.Format( "#{0}", weapon.LabelNumber );
from.SendLocalizedMessage( 1062001, name ); // You can no longer wield your ~1_WEAPON~ from.AddToBackpack( weapon ); moved = true; } } else if ( item is BaseArmor ) { BaseArmor armor = (BaseArmor)item;
bool drop = false;
if ( !armor.AllowMaleWearer && from.Body.IsMale && from.AccessLevel < AccessLevel.GameMaster ) { drop = true; } else if ( !armor.AllowFemaleWearer && from.Body.IsFemale && from.AccessLevel < AccessLevel.GameMaster ) { drop = true; } else { int strBonus = armor.ComputeStatBonus( StatType.Str ), strReq = armor.ComputeStatReq( StatType.Str ); int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex ); int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int );
if ( dex < dexReq || (dex + dexBonus) < 1 ) drop = true; else if ( str < strReq || (str + strBonus) < 1 ) drop = true; else if ( intel < intReq || (intel + intBonus) < 1 ) drop = true; }
if ( drop ) { string name = armor.Name;
if ( name == null ) name = String.Format( "#{0}", armor.LabelNumber );
if ( armor is BaseShield ) from.SendLocalizedMessage( 1062003, name ); // You can no longer equip your ~1_SHIELD~ else from.SendLocalizedMessage( 1062002, name ); // You can no longer wear your ~1_ARMOR~
if ( ourFaction == null || ourFaction != factionItem.Faction ) drop = true; else if ( ++factionItemCount > FactionItem.GetMaxWearables( this ) ) drop = true;
if ( drop ) { from.AddToBackpack( item ); moved = true; } } }
if ( moved ) from.SendLocalizedMessage( 500647 ); // Some equipment has been moved to your backpack. } catch ( Exception e ) { Console.WriteLine( e ); } finally { m_NoDeltaRecursion = false; } }
public override void Delta( MobileDelta flag ) { base.Delta( flag );
if ( (flag & MobileDelta.Stat) != 0 ) ValidateEquipment();
for ( int i = 0; i < gumps.Count; ++i ) { if ( gumps[i] is ResurrectGump ) { if ( Alive ) { CloseGump( typeof( ResurrectGump ) ); } else { SendLocalizedMessage( 500111 ); // You are frozen and cannot move. return false; } } } }
TimeSpan speed = ComputeMovementSpeed( d );
if ( !base.Move( d ) ) return false;
m_NextMovementTime += speed;
return true; }
public override bool CheckMovement( Direction d, out int newZ ) { DesignContext context = m_DesignContext;
if ( context == null ) return base.CheckMovement( d, out newZ );
public override bool AllowItemUse( Item item ) { return DesignContext.Check( this ); }
public override bool AllowSkillUse( SkillName skill ) { if ( null != m_SafeResContext ) // <- Xanthos Safe Res change this line only return ( DesignContext.Check( this ) && m_SafeResContext.AllowSkillUse( skill )); // <- Xanthos Safe Res change this line only return DesignContext.Check( this ); }
private bool m_LastProtectedMessage; private int m_NextProtectionCheck = 10;
public virtual void RecheckTownProtection() { m_NextProtectionCheck = 10;
if ( isProtected != m_LastProtectedMessage ) { if ( isProtected ) SendLocalizedMessage( 500112 ); // You are now under the protection of the town guards. else SendLocalizedMessage( 500113 ); // You have left the protection of the town guards.
public override void SetLocation( Point3D loc, bool isTeleport ) { if ( !isTeleport && AccessLevel == AccessLevel.Player ) { // moving, not teleporting int zDrop = ( this.Location.Z - loc.Z );
if ( zDrop > 20 ) // we fell more than one story Hits -= ((zDrop / 20) * 10) - 5; // deal some damage; does not kill, disrupt, etc }
base.SetLocation( loc, isTeleport );
if ( isTeleport || --m_NextProtectionCheck == 0 ) RecheckTownProtection(); }
public override void GetContextMenuEntries( Mobile from, ArrayList list ) { base.GetContextMenuEntries( from, list );
if ( from == this ) { if ( m_Quest != null ) m_Quest.GetContextMenuEntries( list );
if ( Alive && InsuranceEnabled ) { list.Add( new CallbackEntry( 6201, new ContextCallback( ToggleItemInsurance ) ) );
if ( AutoRenewInsurance ) list.Add( new CallbackEntry( 6202, new ContextCallback( CancelRenewInventoryInsurance ) ) ); else list.Add( new CallbackEntry( 6200, new ContextCallback( AutoRenewInventoryInsurance ) ) ); }
// TODO: Toggle champ titles
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null ) { if ( Alive && house.InternalizedVendors.Count > 0 && house.IsOwner( this ) ) list.Add( new CallbackEntry( 6204, new ContextCallback( GetVendor ) ) );
if ( house.IsAosRules ) list.Add( new CallbackEntry( 6207, new ContextCallback( LeaveHouse ) ) ); }
if ( m_JusticeProtectors.Count > 0 ) list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) ); } }
private void CancelProtection() { for ( int i = 0; i < m_JusticeProtectors.Count; ++i ) { Mobile prot = (Mobile)m_JusticeProtectors[i];
prot.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended. this.SendLocalizedMessage( 1049371, args ); // The protective relationship between ~1_PLAYER1~ and ~2_PLAYER2~ has been ended. }
m_JusticeProtectors.Clear(); }
private void ToggleItemInsurance() { if ( !CheckAlive() ) return;
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868 ); // Target the item you wish to toggle insurance status on <ESC> to cancel }
private bool CanInsure( Item item ) { if ( item is Container || item is BagOfSending ) return false;
if ( item is Spellbook || item is Runebook || item is PotionKeg || item is Sigil ) return false;
if ( item.Stackable ) return false;
if ( item.LootType == LootType.Cursed ) return false;
if ( item.ItemID == 0x204E ) // death shroud return false;
return true; }
private void ToggleItemInsurance_Callback( Mobile from, object obj ) { if ( !CheckAlive() ) return;
Item item = obj as Item;
if ( item == null || !item.IsChildOf( this ) ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060871, "", 0x23 ); // You can only insure items that you have equipped or that are in your backpack } else if ( item.Insured ) { item.Insured = false;
SendLocalizedMessage( 1060874, "", 0x35 ); // You cancel the insurance on the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel } else if ( !CanInsure( item ) ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that } else if ( item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == from ) { BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060870, "", 0x23 ); // That item is blessed and does not need to be insured SendLocalizedMessage( 1060869, "", 0x23 ); // You cannot insure that } else { if ( !item.PayedInsurance ) { if ( Banker.Withdraw( from, 600 ) ) { SendLocalizedMessage( 1060398, "600" ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. item.PayedInsurance = true; } else { SendLocalizedMessage( 1061079, "", 0x23 ); // You lack the funds to purchase the insurance return; } }
item.Insured = true;
SendLocalizedMessage( 1060873, "", 0x23 ); // You have insured the item
BeginTarget( -1, false, TargetFlags.None, new TargetCallback( ToggleItemInsurance_Callback ) ); SendLocalizedMessage( 1060868, "", 0x23 ); // Target the item you wish to toggle insurance status on <ESC> to cancel } }
private void AutoRenewInventoryInsurance() { if ( !CheckAlive() ) return;
SendLocalizedMessage( 1060881, "", 0x23 ); // You have selected to automatically reinsure all insured items upon death AutoRenewInsurance = true; }
private void CancelRenewInventoryInsurance() { if ( !CheckAlive() ) return;
SendLocalizedMessage( 1061075, "", 0x23 ); // You have cancelled automatically reinsuring all insured items upon death AutoRenewInsurance = false; }
// TODO: Champ titles, toggle
private void GetVendor() { BaseHouse house = BaseHouse.FindHouseAt( this );
if ( CheckAlive() && house != null && house.IsOwner( this ) && house.InternalizedVendors.Count > 0 ) { CloseGump( typeof( ReclaimVendorGump ) ); SendGump( new ReclaimVendorGump( house ) ); } }
private void LeaveHouse() { BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house != null ) this.Location = house.BanLocation; }
private delegate void ContextCallback();
private class CallbackEntry : ContextMenuEntry { private ContextCallback m_Callback;
public CallbackEntry( int number, ContextCallback callback ) : this( number, -1, callback ) { }
public CallbackEntry( int number, int range, ContextCallback callback ) : base( number, range ) { m_Callback = callback; }
public override void OnClick() { if ( m_Callback != null ) m_Callback(); } }
public override void OnDoubleClick( Mobile from ) { if ( this == from && !Warmode ) { IMount mount = Mount;
if ( mount != null && !DesignContext.Check( this ) ) return; }
base.OnDoubleClick( from ); }
public override void DisplayPaperdollTo( Mobile to ) { if ( DesignContext.Check( this ) ) base.DisplayPaperdollTo( to ); }
private static bool m_NoRecursion;
public override bool CheckEquip( Item item ) { if ( !base.CheckEquip( item ) ) return false;
if ( bounce != null ) { if ( bounce.m_Parent is Item ) { Item parent = (Item) bounce.m_Parent;
if ( parent == this.Backpack || parent.IsChildOf( this.Backpack ) ) return true; } else if ( bounce.m_Parent == this ) { return true; } }
SendLocalizedMessage( 1004042 ); // You can only equip what you are already carrying while you have a trade pending. return false; }
return true; }
public override bool CheckTrade( Mobile to, Item item, SecureTradeContainer cont, bool message, bool checkItems, int plusItems, int plusWeight ) { int msgNum = 0;
if ( cont == null ) { if ( to.Holding != null ) msgNum = 1062727; // You cannot trade with someone who is dragging something. else if ( this.HasTrade ) msgNum = 1062781; // You are already trading with someone else! else if ( to.HasTrade ) msgNum = 1062779; // That person is already involved in a trade }
if ( this.Backpack == null || !this.Backpack.CheckHold( this, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004040; // You would not be able to hold this if the trade failed. else if ( to.Backpack == null || !to.Backpack.CheckHold( to, item, false, checkItems, plusItems, plusWeight ) ) msgNum = 1004039; // The recipient of this trade would not be able to carry this. else msgNum = CheckContentForTrade( item ); }
if ( msgNum != 0 ) { if ( message ) this.SendLocalizedMessage( msgNum );
return false; }
return true; }
private static int CheckContentForTrade( Item item ) { if ( item is TrapableContainer && ((TrapableContainer)item).TrapType != TrapType.None ) return 1004044; // You may not trade trapped items.
if ( SkillHandlers.StolenItem.IsStolen( item ) ) return 1004043; // You may not trade recently stolen items.
if ( item is Container ) { foreach ( Item subItem in item.Items ) { int msg = CheckContentForTrade( subItem );
if ( msg != 0 ) return msg; } }
return 0; }
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target ) { if ( !base.CheckNonlocalDrop( from, item, target ) ) return false;
if ( from.AccessLevel >= AccessLevel.GameMaster ) return true;
Container pack = this.Backpack; if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) ) { BounceInfo bounce = item.GetBounce();
if ( bounce != null && bounce.m_Parent is Item ) { Item parent = (Item) bounce.m_Parent;