bleedingspiderlegs
Wanderer
i was wondering that myself..to the point where i got a headache and gave up..
owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
owner.Resurrect();
Delete();
CB0T;778754 said:How i put charges on it?
I need 1 charge.
Thanks!
using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Items
{
public class AutoResStone : Item
{
public static void Initialize()
{
EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
}
private static void EventSink_Death(PlayerDeathEventArgs e)
{
CheckResurrect(e.Mobile);
}
public static void CheckResurrect( Mobile owner )
{
if (owner != null && !owner.Deleted)
{
if (owner.Alive)
return;
if (owner.Backpack == null || owner.Backpack.Deleted)
return;
AutoResStone stone = owner.Backpack.FindItemByType(typeof(AutoResStone)) as AutoResStone;
if (stone != null && !stone.Deleted)
{
owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
owner.Resurrect();
}
}
}
[Constructable]
public AutoResStone()
: base(0x1870)
{
Name = "Stone Of Rebirth";
LootType = LootType.Blessed;
}
public AutoResStone(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();
switch (version)
{
//case 1: { } goto case 0;
case 0: { } break;
}
}
}
}
public override void OnDeath( Container c )
{
//Standard OnDeath code, blah blah...
[B][COLOR="Red"]AutoResStone.CheckResurrect( this );[/COLOR][/B]
//More Standard OnDeath code, blah blah blah blah...
}
m.CloseGump( typeof( ResurrectGump ) );
m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
owner.CloseGump(typeof(ResurrectGump));
owner.SendGump(new ResurrectGump(owner, ResurrectMessage.Healer));
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Prompts;
using Server.Network;
using System.Collections;
namespace Server.Items
{
public class AutoResStone : Item
{
private int m_Charges = 10;
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
{
get { return m_Charges; }
set { m_Charges = value; InvalidateProperties(); }
}
private Timer m_Timer;
private TimeSpan m_Delay = TimeSpan.FromSeconds( 5.0 ); /*TimeSpan.Zero*/
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Delay { get { return m_Delay; } set { m_Delay = value; } }
public static void Initialize()
{
EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
}
private static void EventSink_Death(PlayerDeathEventArgs e)
{
PlayerMobile owner = e.Mobile as PlayerMobile;
if (owner != null && !owner.Deleted)
{
if (owner.Alive)
return;
if (owner.Backpack == null || owner.Backpack.Deleted)
return;
AutoResStone stone = owner.Backpack.FindItemByType(typeof(AutoResStone)) as AutoResStone;
if (stone != null && !stone.Deleted)
{
stone.CountDown(owner);
}
}
}
[Constructable]
public AutoResStone() : this( 1 )
{ }
[Constructable]
public AutoResStone(int charges)
: base(0x1870)
{
m_Charges = charges;
Name = "Stone Of Rebirth";
LootType = LootType.Blessed;
Weight = 1.0;
}
public AutoResStone(Serial serial)
: base(serial)
{ }
private void CountDown(PlayerMobile owner)
{
m_Timer = Timer.DelayCall(m_Delay, new TimerStateCallback(Resurrect_OnTick), new object[] { owner });
}
private void Resurrect_OnTick(object state)
{
object[] states = (object[])state;
PlayerMobile owner = (PlayerMobile)states[0];
if (owner != null && !owner.Deleted)
{
if (owner.Alive || m_Charges < 1)
return;
owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
owner.Resurrect();
owner.Hits = owner.HitsMax;
owner.Stam = owner.StamMax;
owner.Mana = owner.ManaMax;
m_Charges--;
InvalidateProperties();
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add(String.Format("{0} Charges", m_Charges));
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
writer.Write( (TimeSpan) m_Delay );
writer.Write( (int) m_Charges );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Delay = reader.ReadTimeSpan();
m_Charges = reader.ReadInt();
} break;
}
}
}
}
Nockar;810716 said:With Much help here from others here is a working version that has charges, res's with 100% str, int, dex, and has a timer of 5 seconds.
- charges (-1 charge each rez)
- res 100% str, int, dex
- 5 second timer
Peoples who helped make this
Vorspire (Most of the final code was made by Vorspire)
M_0_h
Lord_Greywolf
Vorspire;810745 said:That's pretty sweet too, I just finished a nice little system for building Item Sets
It works exactly the same as in World of Warcraft
More Info: RunUO - Ultima Online Emulation - Vorspire's Album: Developments - Picture
Vorspire;810745 said:That's pretty sweet too, I just finished a nice little system for building Item Sets
It works exactly the same as in World of Warcraft
More Info: RunUO - Ultima Online Emulation - Vorspire's Album: Developments - Picture
Vorspire;810766 said:When I'm totally confident that the ItemSet class I use is perfect and bug-free, I will possibly release it
using System;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server.Items
{
public class AutoResStoneCharged : Item
{
private int m_Charges;
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
{
get { return m_Charges; }
set { m_Charges = value; }
}
private Timer m_Timer;
private TimeSpan m_Delay = TimeSpan.FromSeconds ( 5.0 );
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Delay { get { return m_Delay; } set { m_Delay = value; } }
public static void Initialize()
{
EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
}
private static void EventSink_Death(PlayerDeathEventArgs e)
{
PlayerMobile owner = e.Mobile as PlayerMobile;
if (owner != null && !owner.Deleted)
{
if (owner.Alive)
return;
if (owner.Backpack == null || owner.Backpack.Deleted)
return;
AutoResStoneCharged stone = owner.Backpack.FindItemByType(typeof(AutoResStoneCharged)) as AutoResStoneCharged;
if (stone != null && !stone.Deleted)
{
stone.CountDown(owner);
}
}
}
[Constructable]
public AutoResStoneCharged() : this( 1 )
{ }
[Constructable]
public AutoResStoneCharged(int charges)
: base(0x1F1C)
{
Name = "Stone Of Rebirth";
LootType = LootType.Blessed;
Charges = 15;
Weight = 1.0;
}
public AutoResStoneCharged(Serial serial)
: base(serial)
{ }
private void CountDown(PlayerMobile owner)
{
m_Timer = Timer.DelayCall(m_Delay, new TimerStateCallback(Resurrect_OnTick), new object[] { owner });
}
private void Resurrect_OnTick(object state)
{
object[] states = (object[])state;
PlayerMobile owner = (PlayerMobile)states[0];
AutoResStoneCharged stone = owner.Backpack.FindItemByType(typeof(AutoResStoneCharged)) as AutoResStoneCharged;
if (owner != null && !owner.Deleted)
{
if (owner.Alive || m_Charges < 1)
return;
owner.SendMessage("Your stone of rebirth has saved you from the farplane.");
owner.Resurrect();
owner.Hits = owner.HitsMax;
owner.Stam = owner.StamMax;
owner.Mana = owner.ManaMax;
m_Charges--;
if( m_Charges == 0 )
stone.Delete();
InvalidateProperties();
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( 1060741, "{0}", Charges.ToString() );
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
writer.Write( (TimeSpan) m_Delay );
writer.Write( (int) m_Charges );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Delay = reader.ReadTimeSpan();
m_Charges = reader.ReadInt();
} break;
}
}
}
}