Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,92 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Engines.InstancedPeerless;
namespace Server.Gumps
{
public class ConfirmExitInstanceGump : Gump
{
private InstanceExitGate m_Gate;
public ConfirmExitInstanceGump( InstanceExitGate gate )
: base( 150, 50 )
{
m_Gate = gate;
AddPage( 0 );
Closable = false;
AddImage( 0, 0, 0xE10 );
AddImageTiled( 0, 14, 15, 200, 0xE13 );
AddImageTiled( 380, 14, 14, 200, 0xE15 );
AddImage( 0, 201, 0xE16 );
AddImageTiled( 15, 201, 370, 16, 0xE17 );
AddImageTiled( 15, 0, 370, 16, 0xE11 );
AddImage( 380, 0, 0xE12 );
AddImage( 380, 201, 0xE18 );
AddImageTiled( 15, 15, 365, 190, 0xA40 );
AddRadio( 30, 140, 0x25FF, 0x2602, true, 1 );
AddHtmlLocalized( 65, 145, 300, 25, 1113745, 0xFFFFFF, false, false ); // Yes! I must go!
AddRadio( 30, 175, 0x25FF, 0x2602, false, 0 );
AddHtmlLocalized( 65, 178, 300, 25, 1113746, 0xFFFFFF, false, false ); // No, I am not done yet...
AddHtmlLocalized( 30, 20, 360, 20, 1113742, 0xFEFE40, false, false ); // Instance Exit
AddHtmlLocalized( 30, 50, 360, 60, 1113743, 0xFFFFFF, false, false ); // You may not return to this instance while it is still in progress. If you leave, you will not be able to return to claim your corpse. Resurrect first if you wish to take your belongings.
AddHtmlLocalized( 30, 115, 345, 40, 1113747, 0x1DB2D, false, false ); // Do you really wish to leave the instance?
AddButton( 290, 175, 0xF7, 0xF8, 2, GumpButtonType.Reply, 0 );
AddImageTiled( 15, 14, 365, 1, 0x2393 );
AddImageTiled( 380, 14, 1, 190, 0x2391 );
AddImageTiled( 15, 205, 365, 1, 0x2393 );
AddImageTiled( 15, 14, 1, 190, 0x2391 );
AddImageTiled( 0, 0, 395, 1, 0x23C5 );
AddImageTiled( 394, 0, 1, 217, 0x23C3 );
AddImageTiled( 0, 216, 395, 1, 0x23C5 );
AddImageTiled( 0, 0, 1, 217, 0x23C3 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile m = sender.Mobile;
if ( info.IsSwitched( 1 ) )
{
if ( m.InRange( m_Gate, 2 ) )
{
BaseCreature.TeleportPets( m, m_Gate.LocDest, m_Gate.MapDest );
m.MoveToWorld( m_Gate.LocDest, m_Gate.MapDest );
}
else
{
m.SendLocalizedMessage( 500446 ); // That is too far away.
}
}
}
}
}

View File

@@ -0,0 +1,67 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;
using Server.Engines.InstancedPeerless;
namespace Server.Gumps
{
public class ConfirmJoinInstanceGump : Gump
{
private PeerlessInstance m_Instance;
public ConfirmJoinInstanceGump( PeerlessInstance instance )
: base( 50, 50 )
{
m_Instance = instance;
AddPage( 0 );
AddBackground( 0, 0, 240, 135, 0x2422 );
AddHtmlLocalized( 15, 15, 210, 75, 1072525, 0x0, false, false ); // <CENTER>Are you sure you want to teleport <BR>your party to an unknown area?</CENTER>
AddButton( 160, 95, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
AddButton( 90, 95, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if ( info.ButtonID == 1 && m_Instance.State == InstanceState.Reserved )
{
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
Effects.PlaySound( from.Location, from.Map, 0x1FE );
BaseCreature.TeleportPets( from, m_Instance.EntranceLocation, m_Instance.Map );
from.MoveToWorld( m_Instance.EntranceLocation, m_Instance.Map );
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
Effects.PlaySound( from.Location, from.Map, 0x1FE );
m_Instance.AddFighter( from );
}
}
}
}

View File

@@ -0,0 +1,86 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Gumps;
namespace Server.Engines.InstancedPeerless
{
public class InstanceEnterGate : Item
{
private PeerlessInstance m_Instance;
private List<Mobile> m_AllowedPlayers;
public override int LabelNumber { get { return 1113494; } } // (Entrance)
public override bool ForceShowProperties { get { return true; } }
public InstanceEnterGate( PeerlessInstance instance, List<Mobile> allowedPlayers )
: base( 0xF6C )
{
m_Instance = instance;
m_AllowedPlayers = allowedPlayers;
Movable = false;
Hue = 0x484;
Light = LightType.Circle300;
Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), new TimerCallback( Delete ) );
}
public override bool OnMoveOver( Mobile m )
{
if ( !m_AllowedPlayers.Contains( m ) )
{
m.SendLocalizedMessage( 1113573 ); // This instance has been reserved for another party.
}
else
{
if ( !m.HasGump( typeof( ConfirmJoinInstanceGump ) ) )
m.SendGump( new ConfirmJoinInstanceGump( m_Instance ) );
}
return base.OnMoveOver( m );
}
public InstanceEnterGate( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */
reader.ReadInt();
Delete();
}
}
}

View File

@@ -0,0 +1,94 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Engines.InstancedPeerless;
namespace Server.Items
{
public class InstanceExitGate : Item
{
private Map m_MapDest;
private Point3D m_LocDest;
public override int LabelNumber { get { return 1113495; } } // (Exit)
public override bool ForceShowProperties { get { return true; } }
[CommandProperty( AccessLevel.GameMaster )]
public Map MapDest { get { return m_MapDest; } set { m_MapDest = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D LocDest { get { return m_LocDest; } set { m_LocDest = value; } }
[Constructable]
public InstanceExitGate()
: this( Map.Internal, Point3D.Zero )
{
}
[Constructable]
public InstanceExitGate( Map mapDest, Point3D locDest )
: base( 0xF6C )
{
m_MapDest = mapDest;
m_LocDest = locDest;
Movable = false;
Hue = 0x488;
Light = LightType.Circle300;
}
public override bool OnMoveOver( Mobile m )
{
if ( !m.HasGump( typeof( ConfirmExitInstanceGump ) ) )
m.SendGump( new ConfirmExitInstanceGump( this ) );
return base.OnMoveOver( m );
}
public InstanceExitGate( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_MapDest );
writer.Write( m_LocDest );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */
reader.ReadInt();
m_MapDest = reader.ReadMap();
m_LocDest = reader.ReadPoint3D();
}
}
}

View File

@@ -0,0 +1,80 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections;
using Server.Regions;
using Server.Spells.Fourth;
using Server.Spells.Chivalry;
namespace Server.Engines.InstancedPeerless
{
public class InstanceRegion : Region
{
private PeerlessInstance m_Owner;
public PeerlessInstance Owner { get { return m_Owner; } }
public static void Initialize()
{
EventSink.Logout += new LogoutEventHandler( EventSink_Logout );
}
public override bool OnBeginSpellCast( Mobile m, ISpell s )
{
if ( s is RecallSpell || s is SacredJourneySpell )
{
m.SendLocalizedMessage( 501802 ); // Thy spell doth not appear to work...
return false;
}
return base.OnBeginSpellCast( m, s );
}
public InstanceRegion( PeerlessInstance instance )
: base( null, instance.Map, Region.Find( instance.EntranceLocation, instance.Map ), instance.RegionBounds )
{
m_Owner = instance;
Register();
}
public override TimeSpan GetLogoutDelay( Mobile m )
{
return TimeSpan.FromMinutes( 10.0 );
}
private static void EventSink_Logout( LogoutEventArgs e )
{
Mobile from = e.Mobile;
InstanceRegion region = from.Region as InstanceRegion;
if ( region != null )
region.Owner.Kick( from );
}
public override void OnExit( Mobile m )
{
m_Owner.RemoveFighter( m );
}
}
}

View File

@@ -0,0 +1,103 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.InstancedPeerless
{
public class MedusaPlatform : PeerlessPlatform
{
public override Type KeyType { get { return typeof( RareSerpentEgg ); } }
public override Type BossType { get { return typeof( Medusa ); } }
[Constructable]
public MedusaPlatform()
{
ExitLocation = new Point3D( 817, 756, 50 );
// base
AddComponent( new AddonComponent( 0x0709 ), -1, -1, 0 );
AddComponent( new AddonComponent( 0x0709 ), 0, -1, 0 );
AddComponent( new AddonComponent( 0x0709 ), 1, -1, 0 );
AddComponent( new AddonComponent( 0x0709 ), 0, 0, 0 );
AddComponent( new AddonComponent( 0x0709 ), 1, 0, 0 );
AddComponent( new AddonComponent( 0x0709 ), -1, 1, 0 );
AddComponent( new AddonComponent( 0x0709 ), 0, 1, 0 );
AddComponent( new AddonComponent( 0x0709 ), 1, 1, 0 );
// stairs
AddComponent( new AddonComponent( 0x070D ), -1, 0, 0 );
// blockers
AddComponent( new AddonComponent( 0x21A4 ), 0, -1, 5 );
AddComponent( new AddonComponent( 0x21A4 ), 1, 0, 5 );
AddComponent( new AddonComponent( 0x21A4 ), 0, 1, 5 );
// floor cracks
AddComponent( new AddonComponent( 0x1B07 ), 0, 0, 5 );
AddComponent( new AddonComponent( 0x1B05 ), 0, 0, 5 );
// floor
AddComponent( new AddonComponent( 0x4332 ), 1, 1, 5 );
AddComponent( new AddonComponent( 0x4333 ), -1, -1, 5 );
AddComponent( new AddonComponent( 0x4334 ), -1, 1, 5 );
AddComponent( new AddonComponent( 0x4335 ), 1, -1, 5 );
AddComponent( new AddonComponent( 0x433A ), 0, -1, 5 );
AddComponent( new AddonComponent( 0x433A ), 1, 0, 5 );
AddComponent( new AddonComponent( 0x433A ), 0, 1, 5 );
}
public override void AddInstances()
{
AddInstance( 0, -1, 7, Map.TerMur, new Point3D( 776, 928, -5 ), new Point3D( 818, 927, -15 ), new Rectangle2D( 760, 887, 95, 81 ) );
AddInstance( 1, 0, 7, Map.TerMur, new Point3D( 776, 1094, -5 ), new Point3D( 818, 1093, -15 ), new Rectangle2D( 760, 1057, 95, 81 ) );
AddInstance( 0, 1, 7, Map.TerMur, new Point3D( 776, 1264, -5 ), new Point3D( 818, 1263, -15 ), new Rectangle2D( 760, 1230, 95, 81 ) );
}
public override void AddBraziers()
{
AddBrazier( -1, -1, 7 );
AddBrazier( 1, -1, 8 );
AddBrazier( -1, 1, 8 );
AddBrazier( 1, 1, 9 );
}
public MedusaPlatform( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,59 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
namespace Server.Items
{
public class RareSerpentEgg : PeerlessKey
{
public override int LabelNumber { get { return 1112575; } } // a rare serpent egg
[Constructable]
public RareSerpentEgg()
: base(0x41BF)
{
Weight = 1.0;
LootType = LootType.Blessed;
Hue = Utility.RandomList(0x21, 0x4AC, 0x41C);
}
public override int Lifespan { get { return 43200; } }
public RareSerpentEgg(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
/*int version = */
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,267 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Engines.InstancedPeerless
{
public enum InstanceState
{
Available,
Reserved,
Fighting,
Looting
}
public class PeerlessInstance
{
private const int BusyHue = 1;
private const int EmptyHue = 60;
private PeerlessPlatform m_Owner;
private InstanceRegion m_Region;
private List<Mobile> m_Fighters;
private Mobile m_Boss;
private Item m_Light;
private InstanceState m_State;
private Map m_Map;
private Point3D m_EntranceLocation;
private Point3D m_BossSpawnLocation;
private Rectangle2D m_RegionBounds;
private Timer m_SliceTimer;
private Timer m_KickTimer;
public Mobile Boss { get { return m_Boss; } }
public InstanceState State
{
get { return m_State; }
set
{
m_State = value;
if ( m_State == InstanceState.Available )
m_Light.Hue = 0;
else
m_Light.Hue = 0x21;
}
}
public Map Map { get { return m_Map; } }
public Point3D EntranceLocation { get { return m_EntranceLocation; } }
public Rectangle2D RegionBounds { get { return m_RegionBounds; } }
public PeerlessInstance( PeerlessPlatform platform, Map map, Item light, Point3D entranceLoc, Point3D bossSpawnLoc, Rectangle2D regionBounds )
{
m_Owner = platform;
m_Map = map;
m_Light = light;
m_EntranceLocation = entranceLoc;
m_BossSpawnLocation = bossSpawnLoc;
m_RegionBounds = regionBounds;
Initialize();
}
protected virtual void Initialize()
{
State = InstanceState.Available;
m_Fighters = new List<Mobile>();
m_Region = new InstanceRegion( this );
}
public void AddFighter( Mobile m )
{
m_Fighters.Add( m );
}
public void RemoveFighter( Mobile m )
{
m_Fighters.Remove( m );
}
public void Activate()
{
State = InstanceState.Reserved;
Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), new TimerCallback( StartFight ) );
}
private void StartFight()
{
State = InstanceState.Fighting;
m_Boss = Activator.CreateInstance( m_Owner.BossType ) as Mobile;
m_Boss.OnBeforeSpawn( m_BossSpawnLocation, m_Owner.Map );
m_Boss.MoveToWorld( m_BossSpawnLocation, m_Owner.Map );
m_SliceTimer = new SliceTimer( this );
m_SliceTimer.Start();
m_KickTimer = Timer.DelayCall( TimeSpan.FromHours( 2.0 ), new TimerCallback( Kick ) );
}
public void OnSlice()
{
if ( m_Fighters.Count == 0 )
{
FreeInstance();
return;
}
if ( m_State == InstanceState.Fighting && m_Boss.Deleted )
{
if ( m_KickTimer != null )
m_KickTimer.Stop();
m_KickTimer = Timer.DelayCall( TimeSpan.FromMinutes( 15.0 ), new TimerCallback( Kick ) );
State = InstanceState.Looting;
}
}
private void Kick()
{
List<Mobile> fighters = new List<Mobile>( m_Fighters );
foreach ( Mobile m in fighters )
Kick( m );
FreeInstance();
}
public void Kick( Mobile m )
{
Map map = m_Owner.Map;
if (map == null || map == Map.Internal)
{
// Error, lets move to luna bank just incase
if (m.Murderer)
{
BaseCreature.TeleportPets(m, new Point3D(1459, 1629, 0), Map.Felucca);
m.MoveToWorld(new Point3D(1459, 1629, 0), Map.Felucca);
}
else
{
BaseCreature.TeleportPets(m, new Point3D(989, 520, -50), Map.Malas);
m.MoveToWorld(new Point3D(989, 520, -50), Map.Malas);
}
}
else
{
BaseCreature.TeleportPets(m, m_Owner.ExitLocation, map);
m.MoveToWorld(m_Owner.ExitLocation, map);
}
RemoveFighter( m );
}
private void FreeInstance()
{
if ( m_Boss != null )
{
m_Boss.Delete();
m_Boss = null;
}
if ( m_SliceTimer != null )
m_SliceTimer.Stop();
if ( m_KickTimer != null )
m_KickTimer.Stop();
State = InstanceState.Available;
m_Owner.OnFreeInstance( this );
}
public void OnDelete()
{
if ( m_SliceTimer != null )
m_SliceTimer.Stop();
if ( m_KickTimer != null )
m_KickTimer.Stop();
if ( m_Boss != null )
m_Boss.Delete();
foreach ( Mobile m in m_Fighters )
Kick( m );
m_Region.Unregister();
}
#region Serialization
public PeerlessInstance( GenericReader reader )
{
m_Owner = reader.ReadItem<PeerlessPlatform>();
m_Light = reader.ReadItem();
m_Map = reader.ReadMap();
m_EntranceLocation = reader.ReadPoint3D();
m_BossSpawnLocation = reader.ReadPoint3D();
m_RegionBounds = reader.ReadRect2D();
Mobile boss = reader.ReadMobile();
if ( boss != null )
boss.Delete();
Initialize();
}
public void Serialize( GenericWriter writer )
{
writer.Write( m_Owner );
writer.Write( m_Light );
writer.Write( m_Map );
writer.Write( m_EntranceLocation );
writer.Write( m_BossSpawnLocation );
writer.Write( m_RegionBounds );
writer.Write( m_Boss );
}
#endregion
}
public class SliceTimer : Timer
{
private PeerlessInstance m_Instance;
public SliceTimer( PeerlessInstance instance )
: base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
{
m_Instance = instance;
}
protected override void OnTick()
{
m_Instance.OnSlice();
}
}
}

View File

@@ -0,0 +1,161 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using System.Collections.Generic;
using Server;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Engines.InstancedPeerless
{
public class PeerlessKeyBrazier : AddonComponent
{
public override int LabelNumber { get { return 1024622; } } // altar
private PeerlessPlatform m_Platform;
private Item m_Key;
[CommandProperty( AccessLevel.GameMaster )]
public PeerlessPlatform Platform { get { return m_Platform; } }
[CommandProperty( AccessLevel.GameMaster )]
public Item Key { get { return m_Key; } set { m_Key = value; } }
public PeerlessKeyBrazier( PeerlessPlatform platform )
: base( 0x19BB )
{
Hue = 0x15F;
Light = LightType.Circle300;
m_Platform = platform;
}
public PeerlessKeyBrazier( Serial serial )
: base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( from.Map != Map || !from.InRange( Location, 2 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m_Platform.Summoner != null && m_Platform.Summoner != from )
{
SendLocalizedMessageTo( from, 502221 ); // Someone else is already using this item.
}
else if ( m_Key != null && !m_Key.Deleted )
{
SendLocalizedMessageTo( from, 1112701 ); // I've already accepted your offering.
}
else
{
from.SendAsciiMessage( "What would you like to sacrifice?" );
from.BeginTarget( 10, false, TargetFlags.None, new TargetCallback( Sacrifice_Callback ) );
}
}
public void Sacrifice_Callback( Mobile from, object state )
{
Item targeted = state as Item;
if ( targeted == null || targeted.Deleted )
return;
if ( from.Map != Map || !from.InRange( Location, 2 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m_Key != null && !m_Key.Deleted )
{
SendLocalizedMessageTo( from, 502221 ); // Someone else is already using this item.
}
else if ( !targeted.IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1049486 ); // You can only sacrifice items that are in your backpack!
}
else if ( targeted.GetType() != m_Platform.KeyType )
{
from.SendAsciiMessage( "I do not want that!" );
Effects.SendBoltEffect( from );
}
else
{
targeted.Movable = false;
targeted.MoveToWorld( new Point3D( X, Y, Z + 1 ), Map );
Effects.SendLocationEffect( targeted.Location, targeted.Map, 0x3728, 10 );
Effects.PlaySound( targeted.Location, targeted.Map, 0x29 );
m_Key = targeted;
m_Platform.Summoner = from;
m_Platform.Validate();
}
}
public override void OnAfterDelete()
{
if ( m_Key != null )
m_Key.Delete();
base.OnAfterDelete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_Platform );
writer.Write( m_Key );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Platform = reader.ReadItem() as PeerlessPlatform;
m_Key = reader.ReadItem();
if ( m_Platform == null )
Delete();
if ( m_Key != null )
{
m_Key.Delete();
m_Key = null;
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,288 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Engines.PartySystem;
namespace Server.Engines.InstancedPeerless
{
public abstract class PeerlessPlatform : BaseAddon
{
public abstract Type KeyType { get; }
public abstract Type BossType { get; }
public virtual int OfferGumpTitle { get { return 1113737; } } // Monster's Lair
public virtual int OfferGumpDesc { get { return 1113738; } } // Your party has gained entrance to a monster's lair. You may choose to join the fight or stay away.
private List<PeerlessKeyBrazier> m_Braziers = new List<PeerlessKeyBrazier>();
private List<PeerlessInstance> m_Instances = new List<PeerlessInstance>();
private Queue<List<Mobile>> m_PartyQueue = new Queue<List<Mobile>>();
private Point3D m_ExitLocation;
private Mobile m_Summoner;
private Timer m_KeyExpireTimer;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Summoner { get { return m_Summoner; } set { m_Summoner = value; } }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D ExitLocation { get { return m_ExitLocation; } set { m_ExitLocation = value; } }
public PeerlessPlatform()
{
AddInstances();
AddBraziers();
}
public abstract void AddInstances();
public abstract void AddBraziers();
public override bool ShareHue { get { return false; } }
public void Validate()
{
if ( m_KeyExpireTimer != null )
m_KeyExpireTimer.Stop();
foreach ( PeerlessKeyBrazier brazier in m_Braziers )
{
if ( !Validate( brazier ) )
{
m_KeyExpireTimer = Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), new TimerCallback( delegate { Clear( false ); } ) );
return;
}
}
List<Mobile> party = GetParty( m_Summoner );
List<Mobile> invalid;
if ( !ValidateMembers( party, out invalid ) )
{
m_Summoner.SendLocalizedMessage( 1113574 ); // Your party cannot join the queue because the following members have already registered with another group:
foreach ( Mobile m in invalid )
m_Summoner.SendMessage( m.Name );
Clear( true );
}
else
{
PeerlessInstance instance = AcquireEmptyInstance();
if ( instance == null )
{
m_PartyQueue.Enqueue( party );
m_Summoner.SendLocalizedMessage( 1113575 ); // Your party has been successfully added to the queue for this instance.
}
else
{
instance.Activate();
new InstanceEnterGate( instance, party ).MoveToWorld( new Point3D( X, Y, Z + 5 ), Map );
}
Clear( false );
}
}
private void Clear( bool returnKeys )
{
foreach ( PeerlessKeyBrazier brazier in m_Braziers )
{
Item key = brazier.Key;
if ( key == null )
continue;
if ( returnKeys )
{
key.Movable = true;
m_Summoner.PlaceInBackpack( key );
}
else
key.Delete();
brazier.Key = null;
}
if ( returnKeys )
m_Summoner.SendLocalizedMessage( 1113576 ); // Your sacrificial keys have been returned to you.
m_Summoner = null;
}
private bool Validate( PeerlessKeyBrazier brazier )
{
return brazier.Key != null && !brazier.Key.Deleted;
}
private bool ValidateMembers( List<Mobile> party, out List<Mobile> invalid )
{
invalid = new List<Mobile>();
foreach ( List<Mobile> otherParty in m_PartyQueue )
{
foreach ( Mobile m in otherParty )
{
if ( party.Contains( m ) )
invalid.Add( m );
}
}
return ( invalid.Count == 0 );
}
private List<Mobile> GetParty( Mobile from )
{
List<Mobile> list = new List<Mobile>();
Party p = from.Party as Party;
if ( p != null )
{
foreach ( PartyMemberInfo pmInfo in p.Members )
list.Add( pmInfo.Mobile );
}
else
{
list.Add( from );
}
return list;
}
private PeerlessInstance AcquireEmptyInstance()
{
foreach ( PeerlessInstance instance in m_Instances )
{
if ( instance.State == InstanceState.Available )
return instance;
}
return null;
}
protected void AddInstance( int x, int y, int z, Map map, Point3D entranceLoc, Point3D bossSpawnLoc, Rectangle2D regionBounds )
{
AddonComponent light = new AddonComponent( 0x1ECF );
m_Instances.Add( new PeerlessInstance( this, map, light, entranceLoc, bossSpawnLoc, regionBounds ) );
AddComponent( light, x, y, z );
}
protected void AddBrazier( int x, int y, int z )
{
PeerlessKeyBrazier brazier = new PeerlessKeyBrazier( this );
m_Braziers.Add( brazier );
AddComponent( brazier, x, y, z );
}
public void OnFreeInstance( PeerlessInstance instance )
{
if ( m_PartyQueue.Count > 0 )
{
List<Mobile> party = m_PartyQueue.Dequeue();
instance.Activate();
foreach ( Mobile member in party )
{
if ( member.Region.IsPartOf( "Stygian Abyss" ) )
{
member.SendGump( new RejoinInstanceGump( instance, OfferGumpTitle, OfferGumpDesc ) );
Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), new TimerCallback(
delegate { member.CloseGump( typeof( RejoinInstanceGump ) ); } ) );
}
}
}
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
Clear( false );
if ( m_KeyExpireTimer != null )
m_KeyExpireTimer.Stop();
foreach ( PeerlessInstance instance in m_Instances )
instance.OnDelete();
}
public PeerlessPlatform( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( m_ExitLocation );
writer.Write( m_Braziers.Count );
for ( int i = 0; i < m_Braziers.Count; i++ )
writer.WriteItem<PeerlessKeyBrazier>( m_Braziers[i] );
writer.Write( m_Instances.Count );
for ( int i = 0; i < m_Instances.Count; i++ )
m_Instances[i].Serialize( writer );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_ExitLocation = reader.ReadPoint3D();
int braziers = reader.ReadInt();
for ( int i = 0; i < braziers; i++ )
m_Braziers.Add( reader.ReadItem<PeerlessKeyBrazier>() );
int instances = reader.ReadInt();
for ( int i = 0; i < instances; i++ )
m_Instances.Add( new PeerlessInstance( reader ) );
break;
}
}
}
}
}

View File

@@ -0,0 +1,77 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;
using Server.Items;
using Server.Engines.InstancedPeerless;
namespace Server.Gumps
{
public class RejoinInstanceGump : Gump
{
private PeerlessInstance m_Instance;
public RejoinInstanceGump( PeerlessInstance instance, int titleCliloc, int msgCliloc )
: base( 340, 340 )
{
/* Not sure if the gump structure is the same as OSI, but this is better than nothing */
m_Instance = instance;
AddPage( 0 );
AddBackground( 0, 0, 291, 99, 0x13BE );
AddImageTiled( 5, 6, 280, 20, 0xA40 );
AddHtmlLocalized( 9, 8, 280, 20, titleCliloc, 0x7FFF, false, false );
AddImageTiled( 5, 31, 280, 40, 0xA40 );
AddHtmlLocalized( 9, 35, 272, 40, msgCliloc, 0x7FFF, false, false );
AddButton( 215, 73, 0xFB7, 0xFB8, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 250, 75, 65, 20, 1006044, 0x7FFF, false, false ); // OK
AddButton( 5, 73, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 40, 75, 100, 20, 1060051, 0x7FFF, false, false ); // CANCEL
}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
if ( info.ButtonID == 1 )
{
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
Effects.PlaySound( from.Location, from.Map, 0x1FE );
BaseCreature.TeleportPets( from, m_Instance.EntranceLocation, m_Instance.Map );
from.MoveToWorld( m_Instance.EntranceLocation, m_Instance.Map );
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );
Effects.PlaySound( from.Location, from.Map, 0x1FE );
m_Instance.AddFighter( from );
}
}
}
}

View File

@@ -0,0 +1,59 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
namespace Server.Items
{
public class DraconicOrb : PeerlessKey
{
public override int LabelNumber { get { return 1113515; } } // Draconic Orb (Lesser)
[Constructable]
public DraconicOrb()
: base(0x573E)
{
Weight = 1.0;
LootType = LootType.Blessed;
Hue = 0x80F;
}
public override int Lifespan { get { return 43200; } }
public DraconicOrb(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
/*int version = */
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,110 @@
//
// X-RunUO - Ultima Online Server Emulator
// Copyright (C) 2015 Pedro Pardal
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.
//
using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.InstancedPeerless
{
public class StygianDragonPlatform : PeerlessPlatform
{
public override Type KeyType { get { return typeof( DraconicOrb ); } }
public override Type BossType { get { return typeof( StygianDragon ); } }
[Constructable]
public StygianDragonPlatform()
{
ExitLocation = new Point3D( 367, 158, 0 );
// base
AddHuedComponent( 0x0709, 1, 1, 0 );
AddHuedComponent( 0x0709, -1, -1, 0 );
AddHuedComponent( 0x0709, 0, -1, 0 );
AddHuedComponent( 0x0709, 1, -1, 0 );
AddHuedComponent( 0x0709, 0, 0, 0 );
AddHuedComponent( 0x0709, -1, 0, 0 );
AddHuedComponent( 0x0709, -1, 1, 0 );
AddHuedComponent( 0x0709, 0, 1, 0 );
// stairs
AddHuedComponent( 0x070B, 1, 0, 0 );
// blockers
AddHuedComponent( 0x21A4, 0, -1, 5 );
AddHuedComponent( 0x21A4, -1, 0, 5 );
AddHuedComponent( 0x21A4, 0, 1, 5 );
// floor cracks
AddHuedComponent( 0x1B07, 0, 0, 5 );
AddHuedComponent( 0x1B05, 0, 0, 5 );
// floor
AddHuedComponent( 0x4338, -1, -1, 5 );
AddHuedComponent( 0x4338, 1, -1, 5 );
AddHuedComponent( 0x4338, 1, 1, 5 );
AddHuedComponent( 0x4338, -1, 1, 5 );
AddHuedComponent( 0x4339, 0, -1, 5 );
AddHuedComponent( 0x4339, -1, 0, 5 );
AddHuedComponent( 0x4339, 0, 1, 5 );
}
public override void AddInstances()
{
AddInstance( 0, -1, 7, Map.TerMur, new Point3D( 80, 366, 0 ), new Point3D( 61, 366, 20 ), new Rectangle2D( 0, 286, 136, 176 ) );
AddInstance( -1, 0, 8, Map.TerMur, new Point3D( 80, 564, 0 ), new Point3D( 61, 564, 20 ), new Rectangle2D( 0, 485, 136, 176 ) );
AddInstance( 0, 1, 7, Map.TerMur, new Point3D( 80, 772, 0 ), new Point3D( 61, 772, 20 ), new Rectangle2D( 0, 684, 136, 176 ) );
}
public override void AddBraziers()
{
AddBrazier( -1, -1, 7 );
AddBrazier( 1, -1, 8 );
AddBrazier( -1, 1, 8 );
AddBrazier( 1, 1, 9 );
}
private void AddHuedComponent( int itemId, int x, int y, int z )
{
AddonComponent component = new AddonComponent( itemId );
component.Hue = 0x2EF;
AddComponent( component, x, y, z );
}
public StygianDragonPlatform( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */
reader.ReadInt();
}
}
}