#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
102
Scripts/Items/Misc/AcidSlime.cs
Normal file
102
Scripts/Items/Misc/AcidSlime.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AcidSlime : Item
|
||||
{
|
||||
private TimeSpan m_Duration;
|
||||
private int m_MinDamage;
|
||||
private int m_MaxDamage;
|
||||
private DateTime m_Created;
|
||||
private bool m_Drying;
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructable]
|
||||
public AcidSlime() : this( TimeSpan.FromSeconds( 10.0 ), 5, 10 )
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName { get { return "slime"; } }
|
||||
|
||||
[Constructable]
|
||||
public AcidSlime( TimeSpan duration, int minDamage, int maxDamage )
|
||||
: base( 0x122A )
|
||||
{
|
||||
Hue = 0x3F;
|
||||
Movable = false;
|
||||
m_MinDamage = minDamage;
|
||||
m_MaxDamage = maxDamage;
|
||||
m_Created = DateTime.UtcNow;
|
||||
m_Duration = duration;
|
||||
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) );
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
private void OnTick()
|
||||
{
|
||||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan age = now - m_Created;
|
||||
|
||||
if( age > m_Duration ) {
|
||||
Delete();
|
||||
} else {
|
||||
if( !m_Drying && age > (m_Duration - age) )
|
||||
{
|
||||
m_Drying = true;
|
||||
ItemID = 0x122B;
|
||||
}
|
||||
|
||||
List<Mobile> toDamage = new List<Mobile>();
|
||||
|
||||
foreach( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < toDamage.Count; i++ )
|
||||
Damage( toDamage[i] );
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
Damage( m );
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Damage ( Mobile m )
|
||||
{
|
||||
int damage = Utility.RandomMinMax( m_MinDamage, m_MaxDamage );
|
||||
if ( Core.AOS )
|
||||
AOS.Damage( m, damage, 0, 0, 0, 100, 0 );
|
||||
else
|
||||
m.Damage( damage );
|
||||
}
|
||||
|
||||
public AcidSlime( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
233
Scripts/Items/Misc/ArcaneGem.cs
Normal file
233
Scripts/Items/Misc/ArcaneGem.cs
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ArcaneGem : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "arcane gem"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ArcaneGem() : base( 0x1EA7 )
|
||||
{
|
||||
Stackable = Core.ML;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ArcaneGem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.BeginTarget( 2, false, TargetFlags.None, new TargetCallback( OnTarget ) );
|
||||
from.SendMessage( "What do you wish to use the gem on?" );
|
||||
}
|
||||
}
|
||||
|
||||
public int GetChargesFor( Mobile m )
|
||||
{
|
||||
int v = (int)(m.Skills[SkillName.Tailoring].Value / 5);
|
||||
|
||||
if ( v < 16 )
|
||||
return 16;
|
||||
else if ( v > 24 )
|
||||
return 24;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
public const int DefaultArcaneHue = 2117;
|
||||
|
||||
public void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( obj is IArcaneEquip && obj is Item )
|
||||
{
|
||||
Item item = (Item)obj;
|
||||
CraftResource resource = CraftResource.None;
|
||||
|
||||
if( item is BaseClothing )
|
||||
resource = ((BaseClothing)item).Resource;
|
||||
else if( item is BaseArmor )
|
||||
resource = ((BaseArmor)item).Resource;
|
||||
else if( item is BaseWeapon ) // Sanity, weapons cannot recieve gems...
|
||||
resource = ((BaseWeapon)item).Resource;
|
||||
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
else if ( item.LootType == LootType.Blessed )
|
||||
{
|
||||
from.SendMessage( "You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves." );
|
||||
return;
|
||||
}
|
||||
else if ( resource != CraftResource.None && resource != CraftResource.RegularLeather )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049690 ); // Arcane gems can not be used on that type of leather.
|
||||
return;
|
||||
}
|
||||
|
||||
int charges = GetChargesFor( from );
|
||||
|
||||
if ( eq.IsArcane )
|
||||
{
|
||||
if ( eq.CurArcaneCharges >= eq.MaxArcaneCharges )
|
||||
{
|
||||
from.SendMessage( "That item is already fully charged." );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( eq.CurArcaneCharges <= 0 )
|
||||
item.Hue = DefaultArcaneHue;
|
||||
|
||||
if ( (eq.CurArcaneCharges + charges) > eq.MaxArcaneCharges )
|
||||
eq.CurArcaneCharges = eq.MaxArcaneCharges;
|
||||
else
|
||||
eq.CurArcaneCharges += charges;
|
||||
|
||||
from.SendMessage( "You recharge the item." );
|
||||
if ( Amount <= 1 )
|
||||
Delete();
|
||||
else Amount--;
|
||||
}
|
||||
}
|
||||
else if ( from.Skills[SkillName.Tailoring].Value >= 80.0 )
|
||||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
if ( item is BaseClothing )
|
||||
isExceptional = ( ((BaseClothing)item).Quality == ClothingQuality.Exceptional );
|
||||
else if ( item is BaseArmor )
|
||||
isExceptional = ( ((BaseArmor)item).Quality == ArmorQuality.Exceptional );
|
||||
else if ( item is BaseWeapon )
|
||||
isExceptional = ( ((BaseWeapon)item).Quality == WeaponQuality.Exceptional );
|
||||
|
||||
if ( isExceptional )
|
||||
{
|
||||
if ( item is BaseClothing )
|
||||
{
|
||||
((BaseClothing)item).Quality = ClothingQuality.Regular;
|
||||
((BaseClothing)item).Crafter = from;
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
{
|
||||
((BaseArmor)item).Quality = ArmorQuality.Regular;
|
||||
((BaseArmor)item).Crafter = from;
|
||||
((BaseArmor)item).PhysicalBonus = ((BaseArmor)item).FireBonus = ((BaseArmor)item).ColdBonus = ((BaseArmor)item).PoisonBonus = ((BaseArmor)item).EnergyBonus = 0; // Is there a method to remove bonuses?
|
||||
}
|
||||
else if ( item is BaseWeapon ) // Sanity, weapons cannot recieve gems...
|
||||
{
|
||||
((BaseWeapon)item).Quality = WeaponQuality.Regular;
|
||||
((BaseWeapon)item).Crafter = from;
|
||||
}
|
||||
|
||||
eq.CurArcaneCharges = eq.MaxArcaneCharges = charges;
|
||||
|
||||
item.Hue = DefaultArcaneHue;
|
||||
|
||||
from.SendMessage( "You enhance the item with your gem." );
|
||||
if ( Amount <= 1 )
|
||||
Delete();
|
||||
else Amount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "Only exceptional items can be enhanced with the gem." );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You do not have enough skill in tailoring to enhance the item." );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You can only use this on exceptionally crafted robes, thigh boots, cloaks, or leather gloves." );
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ConsumeCharges( Mobile from, int amount )
|
||||
{
|
||||
List<Item> items = from.Items;
|
||||
int avail = 0;
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item obj = items[i];
|
||||
|
||||
if ( obj is IArcaneEquip )
|
||||
{
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
||||
if ( eq.IsArcane )
|
||||
avail += eq.CurArcaneCharges;
|
||||
}
|
||||
}
|
||||
|
||||
if ( avail < amount )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item obj = items[i];
|
||||
|
||||
if ( obj is IArcaneEquip )
|
||||
{
|
||||
IArcaneEquip eq = (IArcaneEquip)obj;
|
||||
|
||||
if ( eq.IsArcane )
|
||||
{
|
||||
if ( eq.CurArcaneCharges > amount )
|
||||
{
|
||||
eq.CurArcaneCharges -= amount;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
amount -= eq.CurArcaneCharges;
|
||||
eq.CurArcaneCharges = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
271
Scripts/Items/Misc/BankCheck.cs
Normal file
271
Scripts/Items/Misc/BankCheck.cs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Server;
|
||||
using Server.Accounting;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Engines.Quests;
|
||||
using Necro = Server.Engines.Quests.Necro;
|
||||
using Haven = Server.Engines.Quests.Haven;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BankCheck : Item
|
||||
{
|
||||
private int m_Worth;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Worth
|
||||
{
|
||||
get{ return m_Worth; }
|
||||
set{ m_Worth = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public BankCheck( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (int) m_Worth );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Worth = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BankCheck( int worth ) : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 0x34;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_Worth = worth;
|
||||
}
|
||||
|
||||
public override bool DisplayLootType{ get{ return Core.AOS; } }
|
||||
|
||||
public override int LabelNumber{ get{ return 1041361; } } // A bank check
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
string worth;
|
||||
|
||||
if ( Core.ML )
|
||||
worth = m_Worth.ToString( "N0", CultureInfo.GetCultureInfo( "en-US" ) );
|
||||
else
|
||||
worth = m_Worth.ToString();
|
||||
|
||||
list.Add( 1060738, worth ); // value: ~1_val~
|
||||
}
|
||||
|
||||
#if NEWPARENT
|
||||
public override void OnAdded(IEntity parent)
|
||||
#else
|
||||
public override void OnAdded(object parent)
|
||||
#endif
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
if (!AccountGold.Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile owner = null;
|
||||
SecureTradeInfo tradeInfo = null;
|
||||
|
||||
Container root = parent as Container;
|
||||
|
||||
while (root != null && root.Parent is Container)
|
||||
{
|
||||
root = (Container)root.Parent;
|
||||
}
|
||||
|
||||
parent = root ?? parent;
|
||||
|
||||
if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade)
|
||||
{
|
||||
var trade = (SecureTradeContainer)parent;
|
||||
|
||||
if (trade.Trade.From.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.From;
|
||||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
else if (trade.Trade.To.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.To;
|
||||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
}
|
||||
else if (parent is BankBox && AccountGold.ConvertOnBank)
|
||||
{
|
||||
owner = ((BankBox)parent).Owner;
|
||||
}
|
||||
|
||||
if (owner == null || owner.Account == null || !owner.Account.DepositGold(Worth))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tradeInfo != null)
|
||||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
var total = Worth / Math.Max(1.0, Account.CurrencyThreshold);
|
||||
var plat = (int)Math.Truncate(total);
|
||||
var gold = (int)((total - plat) * Account.CurrencyThreshold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
}
|
||||
|
||||
if (tradeInfo.VirtualCheck != null)
|
||||
{
|
||||
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
owner.SendLocalizedMessage(1042763, Worth.ToString("#,0"));
|
||||
|
||||
Delete();
|
||||
|
||||
((Container)parent).UpdateTotals();
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
from.Send(
|
||||
new MessageLocalizedAffix(
|
||||
Serial,
|
||||
ItemID,
|
||||
MessageType.Label,
|
||||
0x3B2,
|
||||
3,
|
||||
1041361,
|
||||
"",
|
||||
AffixType.Append,
|
||||
String.Concat(" ", m_Worth.ToString()),
|
||||
"")); // A bank check:
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
// This probably isn't OSI accurate, but we can't just make the quests redundant.
|
||||
// Double-clicking the BankCheck in your pack will now credit your account.
|
||||
|
||||
var box = AccountGold.Enabled ? from.Backpack : from.FindBankNoCreate();
|
||||
|
||||
if (box == null || !IsChildOf(box))
|
||||
{
|
||||
from.SendLocalizedMessage(AccountGold.Enabled ? 1080058 : 1047026);
|
||||
// This must be in your backpack to use it. : That must be in your bank box to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
Delete();
|
||||
|
||||
var deposited = 0;
|
||||
var toAdd = m_Worth;
|
||||
|
||||
if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
|
||||
{
|
||||
deposited = toAdd;
|
||||
toAdd = 0;
|
||||
}
|
||||
|
||||
if (toAdd > 0)
|
||||
{
|
||||
Gold gold;
|
||||
|
||||
while (toAdd > 60000)
|
||||
{
|
||||
gold = new Gold(60000);
|
||||
|
||||
if (box.TryDropItem(from, gold, false))
|
||||
{
|
||||
toAdd -= 60000;
|
||||
deposited += 60000;
|
||||
}
|
||||
else
|
||||
{
|
||||
gold.Delete();
|
||||
|
||||
from.AddToBackpack(new BankCheck(toAdd));
|
||||
toAdd = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toAdd > 0)
|
||||
{
|
||||
gold = new Gold(toAdd);
|
||||
|
||||
if (box.TryDropItem(from, gold, false))
|
||||
{
|
||||
deposited += toAdd;
|
||||
}
|
||||
else
|
||||
{
|
||||
gold.Delete();
|
||||
|
||||
from.AddToBackpack(new BankCheck(toAdd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gold was deposited in your account:
|
||||
from.SendLocalizedMessage(1042672, true, deposited.ToString("#,0"));
|
||||
|
||||
var pm = from as PlayerMobile;
|
||||
|
||||
if (pm != null)
|
||||
{
|
||||
var qs = pm.Quest;
|
||||
|
||||
if (qs is Necro.DarkTidesQuest)
|
||||
{
|
||||
var obj = qs.FindObjective(typeof(Necro.CashBankCheckObjective));
|
||||
|
||||
if (obj != null && !obj.Completed)
|
||||
{
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
if (qs is Haven.UzeraanTurmoilQuest)
|
||||
{
|
||||
var obj = qs.FindObjective(typeof(Engines.Quests.Haven.CashBankCheckObjective));
|
||||
|
||||
if (obj != null && !obj.Completed)
|
||||
{
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Scripts/Items/Misc/Bedlam/GlobOfMonstreousInterredGrizzle.cs
Normal file
34
Scripts/Items/Misc/Bedlam/GlobOfMonstreousInterredGrizzle.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GlobOfMonstreousInterredGrizzle : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072117; } } // Glob of Monsterous Interred Grizzle
|
||||
|
||||
[Constructable]
|
||||
public GlobOfMonstreousInterredGrizzle() : base( 0x2F3 )
|
||||
{
|
||||
}
|
||||
|
||||
public GlobOfMonstreousInterredGrizzle( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Bedlam/GrizzledSkullCollection.cs
Normal file
34
Scripts/Items/Misc/Bedlam/GrizzledSkullCollection.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GrizzledSkullCollection : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072116; } } // Grizzled Skull collection
|
||||
|
||||
[Constructable]
|
||||
public GrizzledSkullCollection() : base( 0x21FC )
|
||||
{
|
||||
}
|
||||
|
||||
public GrizzledSkullCollection( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MonsterousInterredGrizzleMaggots : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1075090; } } // Monsterous Interred Grizzle Maggots
|
||||
|
||||
[Constructable]
|
||||
public MonsterousInterredGrizzleMaggots() : base( 0x2633 )
|
||||
{
|
||||
}
|
||||
|
||||
public MonsterousInterredGrizzleMaggots( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Bedlam/ResolvesBridle.cs
Normal file
34
Scripts/Items/Misc/Bedlam/ResolvesBridle.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ResolvesBridle : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074761; } } // Resolve's Bridle
|
||||
|
||||
[Constructable]
|
||||
public ResolvesBridle() : base( 0x1374 )
|
||||
{
|
||||
}
|
||||
|
||||
public ResolvesBridle( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Bedlam/TombstoneOfTheDamned.cs
Normal file
34
Scripts/Items/Misc/Bedlam/TombstoneOfTheDamned.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TombstoneOfTheDamned : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072123; } } // Tombstone of the Damned
|
||||
|
||||
[Constructable]
|
||||
public TombstoneOfTheDamned() : base( Utility.RandomMinMax( 0xED7, 0xEDE ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TombstoneOfTheDamned( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
Scripts/Items/Misc/Beeswax.cs
Normal file
40
Scripts/Items/Misc/Beeswax.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Beeswax : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Beeswax() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Beeswax( int amount ) : base( 0x1422 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public Beeswax( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Misc/Blighted Grove/AbscessTail.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/AbscessTail.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AbscessTail : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074231; } } // Abscess' Tail
|
||||
|
||||
[Constructable]
|
||||
public AbscessTail() : base( 0x1A9D )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x51D; // TODO check
|
||||
}
|
||||
|
||||
public AbscessTail( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/CoilsFang.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/CoilsFang.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CoilsFang : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074229; } } // Coil's Fang
|
||||
|
||||
[Constructable]
|
||||
public CoilsFang() : base( 0x10E8 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x487;
|
||||
}
|
||||
|
||||
public CoilsFang( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/Blighted Grove/EternallyCorruptTree.cs
Normal file
35
Scripts/Items/Misc/Blighted Grove/EternallyCorruptTree.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EternallyCorruptTree : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072093; } } // Eternally Corrupt Tree
|
||||
|
||||
[Constructable]
|
||||
public EternallyCorruptTree() : base( 0x20FA )
|
||||
{
|
||||
Hue = Utility.RandomMinMax( 0x899, 0x8B0 );
|
||||
}
|
||||
|
||||
public EternallyCorruptTree( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/HydraScale.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/HydraScale.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HydraScale : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074760; } } // A hydra scale.
|
||||
|
||||
[Constructable]
|
||||
public HydraScale() : base( 0x26B4 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0xC2; // TODO check
|
||||
}
|
||||
|
||||
public HydraScale( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
52
Scripts/Items/Misc/Blighted Grove/MelisandesFermentedWine.cs
Normal file
52
Scripts/Items/Misc/Blighted Grove/MelisandesFermentedWine.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MelisandesFermentedWine : GreaterExplosionPotion
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072114; } } // Melisande's Fermented Wine
|
||||
|
||||
[Constructable]
|
||||
public MelisandesFermentedWine()
|
||||
{
|
||||
Stackable = false;
|
||||
ItemID = 0x99B;
|
||||
Hue = Utility.RandomList( 0xB, 0xF, 0x48D ); // TODO update
|
||||
}
|
||||
|
||||
public MelisandesFermentedWine( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Drink( Mobile from )
|
||||
{
|
||||
if ( MondainsLegacy.CheckML( from ) )
|
||||
base.Drink( from );
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1074502 ); // It looks explosive.
|
||||
list.Add( 1075085 ); // Requirement: Mondain's Legacy
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
90
Scripts/Items/Misc/Blighted Grove/MelisandesHairDye.cs
Normal file
90
Scripts/Items/Misc/Blighted Grove/MelisandesHairDye.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MelisandesHairDye : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041088; } } // Hair Dye
|
||||
|
||||
[Constructable]
|
||||
public MelisandesHairDye() : base( 0xEFF )
|
||||
{
|
||||
Hue = Utility.RandomMinMax( 0x47E, 0x499 );
|
||||
}
|
||||
|
||||
public MelisandesHairDye( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( MondainsLegacy.CheckML( from ) )
|
||||
from.SendGump( new ConfirmGump( this ) );
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1075085 ); // Requirement: Mondain's Legacy
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private class ConfirmGump : BaseConfirmGump
|
||||
{
|
||||
public override int TitleNumber{ get{ return 1074395; } } // <div align=right>Use Permanent Hair Dye</div>
|
||||
public override int LabelNumber{ get{ return 1074396; } } // This special hair dye is made of a unique mixture of leaves, permanently changing one's hair color until another dye is used.
|
||||
|
||||
private Item m_Item;
|
||||
|
||||
public ConfirmGump( Item item ) : base()
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
public override void Confirm( Mobile from )
|
||||
{
|
||||
if ( m_Item != null && !m_Item.Deleted && m_Item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( from.HairItemID != 0 )
|
||||
{
|
||||
from.HairHue = m_Item.Hue;
|
||||
from.PlaySound( 0x240 );
|
||||
from.SendLocalizedMessage( 502622 ); // You dye your hair.
|
||||
m_Item.Delete();
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 502623 ); // You have no hair to dye and you cannot use this.
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1073461 ); // You don't have enough dye.
|
||||
}
|
||||
|
||||
public override void Refuse( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 502620 ); // You decide not to dye your hair.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/SalivasFeather.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/SalivasFeather.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SalivasFeather : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074234; } } // Saliva's Feather
|
||||
|
||||
[Constructable]
|
||||
public SalivasFeather() : base( 0x1020 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x5C;
|
||||
}
|
||||
|
||||
public SalivasFeather( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/Blighted Grove/SamplesOfCorruptedWater.cs
Normal file
35
Scripts/Items/Misc/Blighted Grove/SamplesOfCorruptedWater.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SamplesOfCorruptedWater : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074999; } } // samples of corrupted water
|
||||
|
||||
[Constructable]
|
||||
public SamplesOfCorruptedWater() : base( 0xEFE )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public SamplesOfCorruptedWater( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/TaintedSeeds.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/TaintedSeeds.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TaintedSeeds : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074233; } } // Tainted Seeds
|
||||
|
||||
[Constructable]
|
||||
public TaintedSeeds() : base( 0xDFA )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x48; // TODO check
|
||||
}
|
||||
|
||||
public TaintedSeeds( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/ThorvaldsMedallion.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/ThorvaldsMedallion.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ThorvaldsMedallion : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074232; } } // Thorvald's Medallion
|
||||
|
||||
[Constructable]
|
||||
public ThorvaldsMedallion() : base( 0x2AAA )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x47F; // TODO check
|
||||
}
|
||||
|
||||
public ThorvaldsMedallion( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Items/Misc/Blighted Grove/ThrashersTail.cs
Normal file
36
Scripts/Items/Misc/Blighted Grove/ThrashersTail.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ThrashersTail : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074230; } } // Thrasher's Tail
|
||||
|
||||
[Constructable]
|
||||
public ThrashersTail() : base( 0x1A9D )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x455;
|
||||
}
|
||||
|
||||
public ThrashersTail( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
106
Scripts/Items/Misc/Blocker.cs
Normal file
106
Scripts/Items/Misc/Blocker.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Blocker : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 503057; } } // Impassable!
|
||||
|
||||
[Constructable]
|
||||
public Blocker() : base( 0x21A4 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Blocker( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
protected override Packet GetWorldPacketFor( NetState state ) {
|
||||
Mobile mob = state.Mobile;
|
||||
|
||||
if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster )
|
||||
return new GMItemPacket( this );
|
||||
|
||||
return base.GetWorldPacketFor( state );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public sealed class GMItemPacket : Packet
|
||||
{
|
||||
public GMItemPacket( Item item ) : base( 0x1A )
|
||||
{
|
||||
this.EnsureCapacity( 20 );
|
||||
|
||||
// 14 base length
|
||||
// +2 - Amount
|
||||
// +2 - Hue
|
||||
// +1 - Flags
|
||||
|
||||
uint serial = (uint)item.Serial.Value;
|
||||
int itemID = 0x1183;
|
||||
int amount = item.Amount;
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = item.Hue;
|
||||
int flags = item.GetPacketFlags();
|
||||
int direction = (int)item.Direction;
|
||||
|
||||
if ( amount != 0 )
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
|
||||
m_Stream.Write( (uint) serial );
|
||||
m_Stream.Write( (short) (itemID & 0x7FFF) );
|
||||
|
||||
if ( amount != 0 )
|
||||
m_Stream.Write( (short) amount );
|
||||
|
||||
x &= 0x7FFF;
|
||||
|
||||
if ( direction != 0 )
|
||||
x |= 0x8000;
|
||||
|
||||
m_Stream.Write( (short) x );
|
||||
|
||||
y &= 0x3FFF;
|
||||
|
||||
if ( hue != 0 )
|
||||
y |= 0x8000;
|
||||
|
||||
if ( flags != 0 )
|
||||
y |= 0x4000;
|
||||
|
||||
m_Stream.Write( (short) y );
|
||||
|
||||
if ( direction != 0 )
|
||||
m_Stream.Write( (byte) direction );
|
||||
|
||||
m_Stream.Write( (sbyte) loc.Z );
|
||||
|
||||
if ( hue != 0 )
|
||||
m_Stream.Write( (ushort) hue );
|
||||
|
||||
if ( flags != 0 )
|
||||
m_Stream.Write( (byte) flags );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Scripts/Items/Misc/Blood.cs
Normal file
57
Scripts/Items/Misc/Blood.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Blood : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Blood() : this( Utility.RandomList( 0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F ))
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Blood( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
new InternalTimer( this ).Start();
|
||||
}
|
||||
|
||||
public Blood( Serial serial ) : base( serial )
|
||||
{
|
||||
new InternalTimer( this ).Start();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Item m_Blood;
|
||||
|
||||
public InternalTimer( Item blood ) : base( TimeSpan.FromSeconds( 5.0 ) )
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
|
||||
m_Blood = blood;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Blood.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
234
Scripts/Items/Misc/Bola.cs
Normal file
234
Scripts/Items/Misc/Bola.cs
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Bola : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Bola() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Bola( int amount ) : base( 0x26AC )
|
||||
{
|
||||
Weight = 4.0;
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
|
||||
}
|
||||
else if ( !from.CanBeginAction( typeof( Bola ) ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
|
||||
}
|
||||
else if ( from.Target is BolaTarget )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049631 ); // This bola is already being used.
|
||||
}
|
||||
else if ( !HasFreeHands( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
|
||||
}
|
||||
else if ( from.Mounted )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
|
||||
}
|
||||
else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
|
||||
}
|
||||
else
|
||||
{
|
||||
EtherealMount.StopMounting( from );
|
||||
|
||||
from.Target = new BolaTarget( this );
|
||||
from.LocalOverheadMessage( MessageType.Emote, 0x3B2, 1049632 ); // * You begin to swing the bola...*
|
||||
from.NonlocalOverheadMessage( MessageType.Emote, 0x3B2, 1049633, from.Name ); // ~1_NAME~ begins to menacingly swing a bola...
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseBolaLock( object state )
|
||||
{
|
||||
((Mobile)state).EndAction( typeof( Bola ) );
|
||||
}
|
||||
|
||||
private static void FinishThrow( object state )
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
Mobile from = (Mobile)states[0];
|
||||
Mobile to = (Mobile)states[1];
|
||||
|
||||
if ( Core.AOS )
|
||||
new Bola().MoveToWorld( to.Location, to.Map );
|
||||
|
||||
if ( to is ChaosDragoon || to is ChaosDragoonElite )
|
||||
from.SendLocalizedMessage( 1042047 ); // You fail to knock the rider from its mount.
|
||||
|
||||
IMount mt = to.Mount;
|
||||
if ( mt != null && !( to is ChaosDragoon || to is ChaosDragoonElite ) )
|
||||
mt.Rider = null;
|
||||
|
||||
if (to is PlayerMobile)
|
||||
{
|
||||
if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
|
||||
{
|
||||
to.SendLocalizedMessage(1114066, from.Name); // ~1_NAME~ knocked you out of animal form!
|
||||
}
|
||||
else if (to.Mounted)
|
||||
{
|
||||
to.SendLocalizedMessage(1040023); // You have been knocked off of your mount!
|
||||
}
|
||||
|
||||
(to as PlayerMobile).SetMountBlock(BlockMountType.Dazed, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true);
|
||||
}
|
||||
|
||||
if (Core.AOS && from is PlayerMobile) /* only failsafe, attacker should already be dismounted */
|
||||
{
|
||||
(from as PlayerMobile).SetMountBlock( BlockMountType.BolaRecovery, TimeSpan.FromSeconds( Core.ML ? 10 : 3 ), true );
|
||||
}
|
||||
|
||||
to.Damage(1);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( ReleaseBolaLock ), from );
|
||||
}
|
||||
|
||||
private static bool HasFreeHands( Mobile from )
|
||||
{
|
||||
Item one = from.FindItemOnLayer( Layer.OneHanded );
|
||||
Item two = from.FindItemOnLayer( Layer.TwoHanded );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( pack != null )
|
||||
{
|
||||
if ( one != null && one.Movable )
|
||||
{
|
||||
pack.DropItem( one );
|
||||
one = null;
|
||||
}
|
||||
|
||||
if ( two != null && two.Movable )
|
||||
{
|
||||
pack.DropItem( two );
|
||||
two = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( Core.AOS )
|
||||
{
|
||||
if ( one != null && one.Movable )
|
||||
{
|
||||
from.AddToBackpack( one );
|
||||
one = null;
|
||||
}
|
||||
|
||||
if ( two != null && two.Movable )
|
||||
{
|
||||
from.AddToBackpack( two );
|
||||
two = null;
|
||||
}
|
||||
}
|
||||
|
||||
return ( one == null && two == null );
|
||||
}
|
||||
|
||||
public class BolaTarget : Target
|
||||
{
|
||||
private Bola m_Bola;
|
||||
|
||||
public BolaTarget( Bola bola ) : base( 8, false, TargetFlags.Harmful )
|
||||
{
|
||||
m_Bola = bola;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( m_Bola.Deleted )
|
||||
return;
|
||||
|
||||
if ( obj is Mobile )
|
||||
{
|
||||
Mobile to = (Mobile)obj;
|
||||
|
||||
if ( !m_Bola.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
|
||||
}
|
||||
else if ( !HasFreeHands( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
|
||||
}
|
||||
else if ( from.Mounted )
|
||||
{
|
||||
from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
|
||||
}
|
||||
else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
|
||||
}
|
||||
else if (!to.Mounted && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to))
|
||||
{
|
||||
from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that.
|
||||
}
|
||||
else if ( !from.CanBeHarmful( to ) )
|
||||
{
|
||||
}
|
||||
else if ( from.BeginAction( typeof( Bola ) ) )
|
||||
{
|
||||
EtherealMount.StopMounting( from );
|
||||
|
||||
from.DoHarmful( to );
|
||||
|
||||
m_Bola.Consume();
|
||||
|
||||
from.Direction = from.GetDirectionTo( to );
|
||||
from.Animate( 11, 5, 1, true, false, 0 );
|
||||
from.MovingEffect( to, 0x26AC, 10, 0, false, false );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Bola( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Scripts/Items/Misc/BolaBall.cs
Normal file
39
Scripts/Items/Misc/BolaBall.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BolaBall : Item
|
||||
{
|
||||
[Constructable]
|
||||
public BolaBall() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BolaBall( int amount ) : base( 0xE73 )
|
||||
{
|
||||
Weight = 4.0;
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
Hue = 0x8AC;
|
||||
}
|
||||
|
||||
public BolaBall( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
640
Scripts/Items/Misc/BulletinBoards.cs
Normal file
640
Scripts/Items/Misc/BulletinBoards.cs
Normal file
|
|
@ -0,0 +1,640 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable( 0x1E5E, 0x1E5F )]
|
||||
public class BulletinBoard : BaseBulletinBoard
|
||||
{
|
||||
[Constructable]
|
||||
public BulletinBoard() : base( 0x1E5E )
|
||||
{
|
||||
}
|
||||
|
||||
public BulletinBoard( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseBulletinBoard : Item
|
||||
{
|
||||
private string m_BoardName;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BoardName
|
||||
{
|
||||
get{ return m_BoardName; }
|
||||
set{ m_BoardName = value; }
|
||||
}
|
||||
|
||||
public BaseBulletinBoard( int itemID ) : base( itemID )
|
||||
{
|
||||
m_BoardName = "bulletin board";
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
// Threads will be removed six hours after the last post was made
|
||||
private static TimeSpan ThreadDeletionTime = TimeSpan.FromHours( 6.0 );
|
||||
|
||||
// A player may only create a thread once every two minutes
|
||||
private static TimeSpan ThreadCreateTime = TimeSpan.FromMinutes( 2.0 );
|
||||
|
||||
// A player may only reply once every thirty seconds
|
||||
private static TimeSpan ThreadReplyTime = TimeSpan.FromSeconds( 30.0 );
|
||||
|
||||
public static bool CheckTime( DateTime time, TimeSpan range )
|
||||
{
|
||||
return (time + range) < DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public static string FormatTS( TimeSpan ts )
|
||||
{
|
||||
int totalSeconds = (int)ts.TotalSeconds;
|
||||
int seconds = totalSeconds % 60;
|
||||
int minutes = totalSeconds / 60;
|
||||
|
||||
if ( minutes != 0 && seconds != 0 )
|
||||
return String.Format( "{0} minute{1} and {2} second{3}", minutes, minutes==1?"":"s", seconds, seconds==1?"":"s" );
|
||||
else if ( minutes != 0 )
|
||||
return String.Format( "{0} minute{1}", minutes, minutes==1?"":"s" );
|
||||
else
|
||||
return String.Format( "{0} second{1}", seconds, seconds==1?"":"s" );
|
||||
}
|
||||
|
||||
public virtual void Cleanup()
|
||||
{
|
||||
List<Item> items = this.Items;
|
||||
|
||||
for ( int i = items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( i >= items.Count )
|
||||
continue;
|
||||
|
||||
BulletinMessage msg = items[i] as BulletinMessage;
|
||||
|
||||
if ( msg == null )
|
||||
continue;
|
||||
|
||||
if ( msg.Thread == null && CheckTime( msg.LastPostTime, ThreadDeletionTime ) )
|
||||
{
|
||||
msg.Delete();
|
||||
RecurseDelete( msg ); // A root-level thread has expired
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RecurseDelete( BulletinMessage msg )
|
||||
{
|
||||
List<Item> found = new List<Item>();
|
||||
List<Item> items = this.Items;
|
||||
|
||||
for ( int i = items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( i >= items.Count )
|
||||
continue;
|
||||
|
||||
BulletinMessage check = items[i] as BulletinMessage;
|
||||
|
||||
if ( check == null )
|
||||
continue;
|
||||
|
||||
if ( check.Thread == msg )
|
||||
{
|
||||
check.Delete();
|
||||
found.Add( check );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < found.Count; ++i )
|
||||
RecurseDelete( (BulletinMessage)found[i] );
|
||||
}
|
||||
|
||||
public virtual bool GetLastPostTime( Mobile poster, bool onlyCheckRoot, ref DateTime lastPostTime )
|
||||
{
|
||||
List<Item> items = this.Items;
|
||||
bool wasSet = false;
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
BulletinMessage msg = items[i] as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Poster != poster )
|
||||
continue;
|
||||
|
||||
if ( onlyCheckRoot && msg.Thread != null )
|
||||
continue;
|
||||
|
||||
if ( msg.Time > lastPostTime )
|
||||
{
|
||||
wasSet = true;
|
||||
lastPostTime = msg.Time;
|
||||
}
|
||||
}
|
||||
|
||||
return wasSet;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( CheckRange( from ) )
|
||||
{
|
||||
Cleanup();
|
||||
|
||||
NetState state = from.NetState;
|
||||
|
||||
state.Send( new BBDisplayBoard( this ) );
|
||||
if ( state.ContainerGridLines )
|
||||
state.Send( new ContainerContent6017( from, this ) );
|
||||
else
|
||||
state.Send( new ContainerContent( from, this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CheckRange( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
return ( from.Map == this.Map && from.InRange( GetWorldLocation(), 2 ) );
|
||||
}
|
||||
|
||||
public void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines )
|
||||
{
|
||||
if ( thread != null )
|
||||
thread.LastPostTime = DateTime.UtcNow;
|
||||
|
||||
AddItem( new BulletinMessage( from, thread, subject, lines ) );
|
||||
}
|
||||
|
||||
public BaseBulletinBoard( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (string) m_BoardName );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_BoardName = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
PacketHandlers.Register( 0x71, 0, true, new OnPacketReceive( BBClientRequest ) );
|
||||
}
|
||||
|
||||
public static void BBClientRequest( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
int packetID = pvSrc.ReadByte();
|
||||
BaseBulletinBoard board = World.FindItem( pvSrc.ReadInt32() ) as BaseBulletinBoard;
|
||||
|
||||
if ( board == null || !board.CheckRange( from ) )
|
||||
return;
|
||||
|
||||
switch ( packetID )
|
||||
{
|
||||
case 3: BBRequestContent( from, board, pvSrc ); break;
|
||||
case 4: BBRequestHeader( from, board, pvSrc ); break;
|
||||
case 5: BBPostMessage( from, board, pvSrc ); break;
|
||||
case 6: BBRemoveMessage( from, board, pvSrc ); break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void BBRequestContent( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
return;
|
||||
|
||||
from.Send( new BBMessageContent( board, msg ) );
|
||||
}
|
||||
|
||||
public static void BBRequestHeader( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
return;
|
||||
|
||||
from.Send( new BBMessageHeader( board, msg ) );
|
||||
}
|
||||
|
||||
public static void BBPostMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage thread = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( thread != null && thread.Parent != board )
|
||||
thread = null;
|
||||
|
||||
int breakout = 0;
|
||||
|
||||
while ( thread != null && thread.Thread != null && breakout++ < 10 )
|
||||
thread = thread.Thread;
|
||||
|
||||
DateTime lastPostTime = DateTime.MinValue;
|
||||
|
||||
if ( board.GetLastPostTime( from, ( thread == null ), ref lastPostTime ) )
|
||||
{
|
||||
if ( !CheckTime( lastPostTime, (thread == null ? ThreadCreateTime : ThreadReplyTime) ) )
|
||||
{
|
||||
if ( thread == null )
|
||||
from.SendMessage( "You must wait {0} before creating a new thread.", FormatTS( ThreadCreateTime ) );
|
||||
else
|
||||
from.SendMessage( "You must wait {0} before replying to another thread.", FormatTS( ThreadReplyTime ) );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string subject = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );
|
||||
|
||||
if ( subject.Length == 0 )
|
||||
return;
|
||||
|
||||
string[] lines = new string[pvSrc.ReadByte()];
|
||||
|
||||
if ( lines.Length == 0 )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < lines.Length; ++i )
|
||||
lines[i] = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() );
|
||||
|
||||
board.PostMessage( from, thread, subject, lines );
|
||||
}
|
||||
|
||||
public static void BBRemoveMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc )
|
||||
{
|
||||
BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage;
|
||||
|
||||
if ( msg == null || msg.Parent != board )
|
||||
return;
|
||||
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from )
|
||||
return;
|
||||
|
||||
msg.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public struct BulletinEquip
|
||||
{
|
||||
public int itemID;
|
||||
public int hue;
|
||||
|
||||
public BulletinEquip( int itemID, int hue )
|
||||
{
|
||||
this.itemID = itemID;
|
||||
this.hue = hue;
|
||||
}
|
||||
}
|
||||
|
||||
public class BulletinMessage : Item
|
||||
{
|
||||
private Mobile m_Poster;
|
||||
private string m_Subject;
|
||||
private DateTime m_Time, m_LastPostTime;
|
||||
private BulletinMessage m_Thread;
|
||||
private string m_PostedName;
|
||||
private int m_PostedBody;
|
||||
private int m_PostedHue;
|
||||
private BulletinEquip[] m_PostedEquip;
|
||||
private string[] m_Lines;
|
||||
|
||||
public string GetTimeAsString()
|
||||
{
|
||||
return m_Time.ToString( "MMM dd, yyyy" );
|
||||
}
|
||||
|
||||
public override bool CheckTarget( Mobile from, Server.Targeting.Target targ, object targeted )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsAccessibleTo( Mobile check )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public BulletinMessage( Mobile poster, BulletinMessage thread, string subject, string[] lines ) : base( 0xEB0 )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
m_Poster = poster;
|
||||
m_Subject = subject;
|
||||
m_Time = DateTime.UtcNow;
|
||||
m_LastPostTime = m_Time;
|
||||
m_Thread = thread;
|
||||
m_PostedName = m_Poster.Name;
|
||||
m_PostedBody = m_Poster.Body;
|
||||
m_PostedHue = m_Poster.Hue;
|
||||
m_Lines = lines;
|
||||
|
||||
List<BulletinEquip> list = new List<BulletinEquip>();
|
||||
|
||||
for ( int i = 0; i < poster.Items.Count; ++i )
|
||||
{
|
||||
Item item = poster.Items[i];
|
||||
|
||||
if ( item.Layer >= Layer.OneHanded && item.Layer <= Layer.Mount )
|
||||
list.Add( new BulletinEquip( item.ItemID, item.Hue ) );
|
||||
}
|
||||
|
||||
m_PostedEquip = list.ToArray();
|
||||
}
|
||||
|
||||
public Mobile Poster{ get{ return m_Poster; } }
|
||||
public BulletinMessage Thread{ get{ return m_Thread; } }
|
||||
public string Subject{ get{ return m_Subject; } }
|
||||
public DateTime Time{ get{ return m_Time; } }
|
||||
public DateTime LastPostTime{ get{ return m_LastPostTime; } set{ m_LastPostTime = value; } }
|
||||
public string PostedName{ get{ return m_PostedName; } }
|
||||
public int PostedBody{ get{ return m_PostedBody; } }
|
||||
public int PostedHue{ get{ return m_PostedHue; } }
|
||||
public BulletinEquip[] PostedEquip{ get{ return m_PostedEquip; } }
|
||||
public string[] Lines{ get{ return m_Lines; } }
|
||||
|
||||
public BulletinMessage( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Poster );
|
||||
writer.Write( (string) m_Subject );
|
||||
writer.Write( (DateTime) m_Time );
|
||||
writer.Write( (DateTime) m_LastPostTime );
|
||||
writer.Write( (bool) (m_Thread != null) );
|
||||
writer.Write( (Item) m_Thread );
|
||||
writer.Write( (string) m_PostedName );
|
||||
writer.Write( (int) m_PostedBody );
|
||||
writer.Write( (int) m_PostedHue );
|
||||
|
||||
writer.Write( (int) m_PostedEquip.Length );
|
||||
|
||||
for ( int i = 0; i < m_PostedEquip.Length; ++i )
|
||||
{
|
||||
writer.Write( (int) m_PostedEquip[i].itemID );
|
||||
writer.Write( (int) m_PostedEquip[i].hue );
|
||||
}
|
||||
|
||||
writer.Write( (int) m_Lines.Length );
|
||||
|
||||
for ( int i = 0; i < m_Lines.Length; ++i )
|
||||
writer.Write( (string) m_Lines[i] );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Poster = reader.ReadMobile();
|
||||
m_Subject = reader.ReadString();
|
||||
m_Time = reader.ReadDateTime();
|
||||
m_LastPostTime = reader.ReadDateTime();
|
||||
bool hasThread = reader.ReadBool();
|
||||
m_Thread = reader.ReadItem() as BulletinMessage;
|
||||
m_PostedName = reader.ReadString();
|
||||
m_PostedBody = reader.ReadInt();
|
||||
m_PostedHue = reader.ReadInt();
|
||||
|
||||
m_PostedEquip = new BulletinEquip[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_PostedEquip.Length; ++i )
|
||||
{
|
||||
m_PostedEquip[i].itemID = reader.ReadInt();
|
||||
m_PostedEquip[i].hue = reader.ReadInt();
|
||||
}
|
||||
|
||||
m_Lines = new string[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Lines.Length; ++i )
|
||||
m_Lines[i] = reader.ReadString();
|
||||
|
||||
if ( hasThread && m_Thread == null )
|
||||
Delete();
|
||||
|
||||
if ( version == 0 )
|
||||
ValidationQueue<BulletinMessage>.Add( this );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if ( !( Parent is BulletinBoard && ((BulletinBoard)Parent).Items.Contains( this ) ) )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public class BBDisplayBoard : Packet
|
||||
{
|
||||
public BBDisplayBoard( BaseBulletinBoard board ) : base( 0x71 )
|
||||
{
|
||||
string name = board.BoardName;
|
||||
|
||||
if ( name == null )
|
||||
name = "";
|
||||
|
||||
EnsureCapacity( 38 );
|
||||
|
||||
byte[] buffer = Utility.UTF8.GetBytes( name );
|
||||
|
||||
m_Stream.Write( (byte) 0x00 ); // PacketID
|
||||
m_Stream.Write( (int) board.Serial ); // Bulletin board serial
|
||||
|
||||
// Bulletin board name
|
||||
if ( buffer.Length >= 29 )
|
||||
{
|
||||
m_Stream.Write( buffer, 0, 29 );
|
||||
m_Stream.Write( (byte) 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Stream.Write( buffer, 0, buffer.Length );
|
||||
m_Stream.Fill( 30 - buffer.Length );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BBMessageHeader : Packet
|
||||
{
|
||||
public BBMessageHeader( BaseBulletinBoard board, BulletinMessage msg ) : base( 0x71 )
|
||||
{
|
||||
string poster = SafeString( msg.PostedName );
|
||||
string subject = SafeString( msg.Subject );
|
||||
string time = SafeString( msg.GetTimeAsString() );
|
||||
|
||||
EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );
|
||||
|
||||
m_Stream.Write( (byte) 0x01 ); // PacketID
|
||||
m_Stream.Write( (int) board.Serial ); // Bulletin board serial
|
||||
m_Stream.Write( (int) msg.Serial ); // Message serial
|
||||
|
||||
BulletinMessage thread = msg.Thread;
|
||||
|
||||
if ( thread == null )
|
||||
m_Stream.Write( (int) 0 ); // Thread serial--root
|
||||
else
|
||||
m_Stream.Write( (int) thread.Serial ); // Thread serial--parent
|
||||
|
||||
WriteString( poster );
|
||||
WriteString( subject );
|
||||
WriteString( time );
|
||||
}
|
||||
|
||||
public void WriteString( string v )
|
||||
{
|
||||
byte[] buffer = Utility.UTF8.GetBytes( v );
|
||||
int len = buffer.Length + 1;
|
||||
|
||||
if ( len > 255 )
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write( (byte) len );
|
||||
m_Stream.Write( buffer, 0, len-1 );
|
||||
m_Stream.Write( (byte) 0 );
|
||||
}
|
||||
|
||||
public string SafeString( string v )
|
||||
{
|
||||
if ( v == null )
|
||||
return String.Empty;
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
public class BBMessageContent : Packet
|
||||
{
|
||||
public BBMessageContent( BaseBulletinBoard board, BulletinMessage msg ) : base( 0x71 )
|
||||
{
|
||||
string poster = SafeString( msg.PostedName );
|
||||
string subject = SafeString( msg.Subject );
|
||||
string time = SafeString( msg.GetTimeAsString() );
|
||||
|
||||
EnsureCapacity( 22 + poster.Length + subject.Length + time.Length );
|
||||
|
||||
m_Stream.Write( (byte) 0x02 ); // PacketID
|
||||
m_Stream.Write( (int) board.Serial ); // Bulletin board serial
|
||||
m_Stream.Write( (int) msg.Serial ); // Message serial
|
||||
|
||||
WriteString( poster );
|
||||
WriteString( subject );
|
||||
WriteString( time );
|
||||
|
||||
m_Stream.Write( (short) msg.PostedBody );
|
||||
m_Stream.Write( (short) msg.PostedHue );
|
||||
|
||||
int len = msg.PostedEquip.Length;
|
||||
|
||||
if ( len > 255 )
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write( (byte) len );
|
||||
|
||||
for ( int i = 0; i < len; ++i )
|
||||
{
|
||||
BulletinEquip eq = msg.PostedEquip[i];
|
||||
|
||||
m_Stream.Write( (short) eq.itemID );
|
||||
m_Stream.Write( (short) eq.hue );
|
||||
}
|
||||
|
||||
len = msg.Lines.Length;
|
||||
|
||||
if ( len > 255 )
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write( (byte) len );
|
||||
|
||||
for ( int i = 0; i < len; ++i )
|
||||
WriteString( msg.Lines[i], true );
|
||||
}
|
||||
|
||||
public void WriteString( string v )
|
||||
{
|
||||
WriteString( v, false );
|
||||
}
|
||||
|
||||
public void WriteString( string v, bool padding )
|
||||
{
|
||||
byte[] buffer = Utility.UTF8.GetBytes( v );
|
||||
int tail = padding ? 2 : 1;
|
||||
int len = buffer.Length + tail;
|
||||
|
||||
if ( len > 255 )
|
||||
len = 255;
|
||||
|
||||
m_Stream.Write( (byte) len );
|
||||
m_Stream.Write( buffer, 0, len - tail );
|
||||
|
||||
if ( padding )
|
||||
m_Stream.Write( (short) 0 ); // padding compensates for a client bug
|
||||
else
|
||||
m_Stream.Write( (byte) 0 );
|
||||
}
|
||||
|
||||
public string SafeString( string v )
|
||||
{
|
||||
if ( v == null )
|
||||
return String.Empty;
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
134
Scripts/Items/Misc/ClockworkAssembly.cs
Normal file
134
Scripts/Items/Misc/ClockworkAssembly.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ClockworkAssembly : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "clockwork assembly"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ClockworkAssembly() : base( 0x1EA8 )
|
||||
{
|
||||
Weight = 5.0;
|
||||
Hue = 1102;
|
||||
}
|
||||
|
||||
public ClockworkAssembly( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
double tinkerSkill = from.Skills[SkillName.Tinkering].Value;
|
||||
|
||||
if ( tinkerSkill < 60.0 )
|
||||
{
|
||||
from.SendMessage( "You must have at least 60.0 skill in tinkering to construct a golem." );
|
||||
return;
|
||||
}
|
||||
else if ( (from.Followers + 4) > from.FollowersMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049607 ); // You have too many followers to control that creature.
|
||||
return;
|
||||
}
|
||||
|
||||
double scalar;
|
||||
|
||||
if ( tinkerSkill >= 100.0 )
|
||||
scalar = 1.0;
|
||||
else if ( tinkerSkill >= 90.0 )
|
||||
scalar = 0.9;
|
||||
else if ( tinkerSkill >= 80.0 )
|
||||
scalar = 0.8;
|
||||
else if ( tinkerSkill >= 70.0 )
|
||||
scalar = 0.7;
|
||||
else
|
||||
scalar = 0.6;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( pack == null )
|
||||
return;
|
||||
|
||||
int res = pack.ConsumeTotal(
|
||||
new Type[]
|
||||
{
|
||||
typeof( PowerCrystal ),
|
||||
typeof( IronIngot ),
|
||||
typeof( BronzeIngot ),
|
||||
typeof( Gears )
|
||||
},
|
||||
new int[]
|
||||
{
|
||||
1,
|
||||
50,
|
||||
50,
|
||||
5
|
||||
} );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
from.SendMessage( "You must have a power crystal to construct the golem." );
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
from.SendMessage( "You must have 50 iron ingots to construct the golem." );
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
from.SendMessage( "You must have 50 bronze ingots to construct the golem." );
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
from.SendMessage( "You must have 5 gears to construct the golem." );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Golem g = new Golem( true, scalar );
|
||||
|
||||
if ( g.SetControlMaster( from ) )
|
||||
{
|
||||
Delete();
|
||||
|
||||
g.MoveToWorld( from.Location, from.Map );
|
||||
from.PlaySound( 0x241 );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
484
Scripts/Items/Misc/CommunicationCrystals.cs
Normal file
484
Scripts/Items/Misc/CommunicationCrystals.cs
Normal file
|
|
@ -0,0 +1,484 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CrystalRechargeInfo
|
||||
{
|
||||
public static readonly CrystalRechargeInfo[] Table = new CrystalRechargeInfo[]
|
||||
{
|
||||
new CrystalRechargeInfo( typeof( Citrine ), 500 ),
|
||||
new CrystalRechargeInfo( typeof( Amber ), 500 ),
|
||||
new CrystalRechargeInfo( typeof( Tourmaline ), 750 ),
|
||||
new CrystalRechargeInfo( typeof( Emerald ), 1000 ),
|
||||
new CrystalRechargeInfo( typeof( Sapphire ), 1000 ),
|
||||
new CrystalRechargeInfo( typeof( Amethyst ), 1000 ),
|
||||
new CrystalRechargeInfo( typeof( StarSapphire ), 1250 ),
|
||||
new CrystalRechargeInfo( typeof( Diamond ), 2000 )
|
||||
};
|
||||
|
||||
public static CrystalRechargeInfo Get( Type type )
|
||||
{
|
||||
foreach ( CrystalRechargeInfo info in Table )
|
||||
{
|
||||
if ( info.Type == type )
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Type m_Type;
|
||||
private int m_Amount;
|
||||
|
||||
public Type Type{ get{ return m_Type; } }
|
||||
public int Amount{ get{ return m_Amount; } }
|
||||
|
||||
private CrystalRechargeInfo( Type type, int amount )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public class BroadcastCrystal : Item
|
||||
{
|
||||
public static readonly int MaxCharges = 2000;
|
||||
|
||||
public override int LabelNumber{ get{ return 1060740; } } // communication crystal
|
||||
|
||||
private int m_Charges;
|
||||
private List<ReceiverCrystal> m_Receivers;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
{
|
||||
get{ return this.ItemID == 0x1ECD; }
|
||||
set
|
||||
{
|
||||
this.ItemID = value ? 0x1ECD : 0x1ED0;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges
|
||||
{
|
||||
get{ return m_Charges; }
|
||||
set
|
||||
{
|
||||
m_Charges = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public List<ReceiverCrystal> Receivers
|
||||
{
|
||||
get{ return m_Receivers; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BroadcastCrystal() : this( 2000 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BroadcastCrystal( int charges ) : base( 0x1ED0 )
|
||||
{
|
||||
Light = LightType.Circle150;
|
||||
|
||||
m_Charges = charges;
|
||||
|
||||
m_Receivers = new List<ReceiverCrystal>();
|
||||
}
|
||||
|
||||
public BroadcastCrystal( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( this.Active ? 1060742 : 1060743 ); // active / inactive
|
||||
list.Add( 1060745 ); // broadcast
|
||||
list.Add( 1060741, this.Charges.ToString() ); // charges: ~1_val~
|
||||
|
||||
if ( Receivers.Count > 0 )
|
||||
list.Add( 1060746, Receivers.Count.ToString() ); // links: ~1_val~
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
LabelTo( from, this.Active ? 1060742 : 1060743 ); // active / inactive
|
||||
LabelTo( from, 1060745 ); // broadcast
|
||||
LabelTo( from, 1060741, this.Charges.ToString() ); // charges: ~1_val~
|
||||
|
||||
if ( Receivers.Count > 0 )
|
||||
LabelTo( from, 1060746, Receivers.Count.ToString() ); // links: ~1_val~
|
||||
}
|
||||
|
||||
public override bool HandlesOnSpeech
|
||||
{
|
||||
get{ return true; }
|
||||
}
|
||||
|
||||
public override void OnSpeech( SpeechEventArgs e )
|
||||
{
|
||||
if ( !Active || Receivers.Count == 0 || ( RootParent != null && !(RootParent is Mobile) ) )
|
||||
return;
|
||||
|
||||
if ( e.Type == MessageType.Emote )
|
||||
return;
|
||||
|
||||
Mobile from = e.Mobile;
|
||||
string speech = e.Speech;
|
||||
|
||||
foreach ( ReceiverCrystal receiver in new List<ReceiverCrystal>( Receivers ) )
|
||||
{
|
||||
if ( receiver.Deleted )
|
||||
{
|
||||
Receivers.Remove( receiver );
|
||||
}
|
||||
else if ( Charges > 0 )
|
||||
{
|
||||
receiver.TransmitMessage( from, speech );
|
||||
Charges--;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Active = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private BroadcastCrystal m_Crystal;
|
||||
|
||||
public InternalTarget( BroadcastCrystal crystal ) : base( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_Crystal = crystal;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( !m_Crystal.IsAccessibleTo( from ) )
|
||||
return;
|
||||
|
||||
if ( from.Map != m_Crystal.Map || !from.InRange( m_Crystal.GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( targeted == m_Crystal )
|
||||
{
|
||||
if ( m_Crystal.Active )
|
||||
{
|
||||
m_Crystal.Active = false;
|
||||
from.SendLocalizedMessage( 500672 ); // You turn the crystal off.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Crystal.Charges > 0 )
|
||||
{
|
||||
m_Crystal.Active = true;
|
||||
from.SendLocalizedMessage( 500673 ); // You turn the crystal on.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500676 ); // This crystal is out of charges.
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( targeted is ReceiverCrystal )
|
||||
{
|
||||
ReceiverCrystal receiver = (ReceiverCrystal) targeted;
|
||||
|
||||
if ( m_Crystal.Receivers.Count >= 10 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010042 ); // This broadcast crystal is already linked to 10 receivers.
|
||||
}
|
||||
else if ( receiver.Sender == m_Crystal )
|
||||
{
|
||||
from.SendLocalizedMessage( 500674 ); // This crystal is already linked with that crystal.
|
||||
}
|
||||
else if ( receiver.Sender != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010043 ); // That receiver crystal is already linked to another broadcast crystal.
|
||||
}
|
||||
else
|
||||
{
|
||||
receiver.Sender = m_Crystal;
|
||||
from.SendLocalizedMessage( 500675 ); // That crystal has been linked to this crystal.
|
||||
}
|
||||
}
|
||||
else if ( targeted == from )
|
||||
{
|
||||
foreach( ReceiverCrystal receiver in new List<ReceiverCrystal>( m_Crystal.Receivers ) )
|
||||
{
|
||||
receiver.Sender = null;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1010046 ); // You unlink the broadcast crystal from all of its receivers.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item targItem = targeted as Item;
|
||||
|
||||
if ( targItem != null && targItem.VerifyMove( from ) )
|
||||
{
|
||||
CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() );
|
||||
|
||||
if ( info != null )
|
||||
{
|
||||
if ( m_Crystal.Charges >= MaxCharges )
|
||||
{
|
||||
from.SendLocalizedMessage( 500678 ); // This crystal is already fully charged.
|
||||
}
|
||||
else
|
||||
{
|
||||
targItem.Consume();
|
||||
|
||||
if ( m_Crystal.Charges + info.Amount >= MaxCharges )
|
||||
{
|
||||
m_Crystal.Charges = MaxCharges;
|
||||
from.SendLocalizedMessage( 500679 ); // You completely recharge the crystal.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Crystal.Charges += info.Amount;
|
||||
from.SendLocalizedMessage( 500680 ); // You recharge the crystal.
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 500681 ); // You cannot use this crystal on that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Charges );
|
||||
writer.WriteItemList<ReceiverCrystal>( m_Receivers );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Charges = reader.ReadEncodedInt();
|
||||
m_Receivers = reader.ReadStrongItemList<ReceiverCrystal>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ReceiverCrystal : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1060740; } } // communication crystal
|
||||
|
||||
private BroadcastCrystal m_Sender;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
{
|
||||
get{ return this.ItemID == 0x1ED1; }
|
||||
set
|
||||
{
|
||||
this.ItemID = value ? 0x1ED1 : 0x1ED0;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BroadcastCrystal Sender
|
||||
{
|
||||
get{ return m_Sender; }
|
||||
set
|
||||
{
|
||||
if ( m_Sender != null )
|
||||
{
|
||||
m_Sender.Receivers.Remove( this );
|
||||
m_Sender.InvalidateProperties();
|
||||
}
|
||||
|
||||
m_Sender = value;
|
||||
|
||||
if ( value != null )
|
||||
{
|
||||
value.Receivers.Add( this );
|
||||
value.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public ReceiverCrystal() : base( 0x1ED0 )
|
||||
{
|
||||
Light = LightType.Circle150;
|
||||
}
|
||||
|
||||
public ReceiverCrystal( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( this.Active ? 1060742 : 1060743 ); // active / inactive
|
||||
list.Add( 1060744 ); // receiver
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
LabelTo( from, this.Active ? 1060742 : 1060743 ); // active / inactive
|
||||
LabelTo( from, 1060744 ); // receiver
|
||||
}
|
||||
|
||||
public void TransmitMessage( Mobile from, string message )
|
||||
{
|
||||
if ( !this.Active )
|
||||
return;
|
||||
|
||||
string text = String.Format( "{0} says {1}", from.Name, message );
|
||||
|
||||
if ( this.RootParent is Mobile )
|
||||
{
|
||||
((Mobile)this.RootParent).SendMessage( 0x2B2, "Crystal: " + text );
|
||||
}
|
||||
else if ( this.RootParent is Item )
|
||||
{
|
||||
((Item)this.RootParent).PublicOverheadMessage( MessageType.Regular, 0x2B2, false, "Crystal: " + text );
|
||||
}
|
||||
else
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x2B2, false, text );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ReceiverCrystal m_Crystal;
|
||||
|
||||
public InternalTarget( ReceiverCrystal crystal ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_Crystal = crystal;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( !m_Crystal.IsAccessibleTo( from ) )
|
||||
return;
|
||||
|
||||
if ( from.Map != m_Crystal.Map || !from.InRange( m_Crystal.GetWorldLocation(), 2 ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( targeted == m_Crystal )
|
||||
{
|
||||
if ( m_Crystal.Active )
|
||||
{
|
||||
m_Crystal.Active = false;
|
||||
from.SendLocalizedMessage( 500672 ); // You turn the crystal off.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Crystal.Active = true;
|
||||
from.SendLocalizedMessage( 500673 ); // You turn the crystal on.
|
||||
}
|
||||
}
|
||||
else if ( targeted == from )
|
||||
{
|
||||
if ( m_Crystal.Sender != null )
|
||||
{
|
||||
m_Crystal.Sender = null;
|
||||
from.SendLocalizedMessage( 1010044 ); // You unlink the receiver crystal.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Item targItem = targeted as Item;
|
||||
|
||||
if ( targItem != null && targItem.VerifyMove( from ) )
|
||||
{
|
||||
CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() );
|
||||
|
||||
if ( info != null )
|
||||
{
|
||||
from.SendLocalizedMessage( 500677 ); // This crystal cannot be recharged.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteItem<BroadcastCrystal>( m_Sender );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Sender = reader.ReadItem<BroadcastCrystal>();
|
||||
}
|
||||
}
|
||||
}
|
||||
1305
Scripts/Items/Misc/Corpses/Corpse.cs
Normal file
1305
Scripts/Items/Misc/Corpses/Corpse.cs
Normal file
File diff suppressed because it is too large
Load diff
20
Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs
Normal file
20
Scripts/Items/Misc/Corpses/CorpseNameAttribute.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class CorpseNameAttribute : Attribute
|
||||
{
|
||||
private string m_Name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get{ return m_Name; }
|
||||
}
|
||||
|
||||
public CorpseNameAttribute( string name )
|
||||
{
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Items/Misc/Corpses/DecayedCorpse.cs
Normal file
115
Scripts/Items/Misc/Corpses/DecayedCorpse.cs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DecayedCorpse : Container
|
||||
{
|
||||
private Timer m_DecayTimer;
|
||||
private DateTime m_DecayTime;
|
||||
|
||||
private static TimeSpan m_DefaultDecayTime = TimeSpan.FromMinutes( 7.0 );
|
||||
|
||||
public DecayedCorpse( string name ) : base( Utility.Random( 0xECA, 9 ) )
|
||||
{
|
||||
Movable = false;
|
||||
Name = name;
|
||||
|
||||
BeginDecay( m_DefaultDecayTime );
|
||||
}
|
||||
|
||||
public void BeginDecay( TimeSpan delay )
|
||||
{
|
||||
if ( m_DecayTimer != null )
|
||||
m_DecayTimer.Stop();
|
||||
|
||||
m_DecayTime = DateTime.UtcNow + delay;
|
||||
|
||||
m_DecayTimer = new InternalTimer( this, delay );
|
||||
m_DecayTimer.Start();
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_DecayTimer != null )
|
||||
m_DecayTimer.Stop();
|
||||
|
||||
m_DecayTimer = null;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private DecayedCorpse m_Corpse;
|
||||
|
||||
public InternalTimer( DecayedCorpse c, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Corpse = c;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Corpse.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Do not display (x items, y stones)
|
||||
public override bool CheckContentDisplay( Mobile from )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not display (x items, y stones)
|
||||
public override bool DisplaysContent{ get{ return false; } }
|
||||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
list.Add( 1046414, Name ); // the remains of ~1_NAME~
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
this.LabelTo( from, 1046414, Name ); // the remains of ~1_NAME~
|
||||
}
|
||||
|
||||
public DecayedCorpse( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_DecayTimer != null );
|
||||
|
||||
if ( m_DecayTimer != null )
|
||||
writer.WriteDeltaTime( m_DecayTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
BeginDecay( m_DefaultDecayTime );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if ( reader.ReadBool() )
|
||||
BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
201
Scripts/Items/Misc/Corpses/Packets.cs
Normal file
201
Scripts/Items/Misc/Corpses/Packets.cs
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public sealed class CorpseEquip : Packet
|
||||
{
|
||||
public CorpseEquip( Mobile beholder, Corpse beheld ) : base( 0x89 )
|
||||
{
|
||||
List<Item> list = beheld.EquipItems;
|
||||
|
||||
int count = list.Count;
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 8 + (count * 5) );
|
||||
|
||||
m_Stream.Write( (int) beheld.Serial );
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if ( !item.Deleted && beholder.CanSee( item ) && item.Parent == beheld )
|
||||
{
|
||||
m_Stream.Write( (byte) (item.Layer + 1) );
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.Hair + 1) );
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (byte)(Layer.FacialHair + 1) );
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
}
|
||||
|
||||
m_Stream.Write( (byte) Layer.Invalid );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent : Packet
|
||||
{
|
||||
public CorpseContent( Mobile beholder, Corpse beheld )
|
||||
: base( 0x3C )
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
count++;
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
count++;
|
||||
|
||||
EnsureCapacity( 5 + (count * 19) );
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write( (ushort)0 );
|
||||
|
||||
for( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
|
||||
{
|
||||
m_Stream.Write( (int)child.Serial );
|
||||
m_Stream.Write( (ushort)child.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)child.Amount );
|
||||
m_Stream.Write( (short)child.X );
|
||||
m_Stream.Write( (short)child.Y );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)child.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.Hair.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)1 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)beheld.Hair.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
|
||||
{
|
||||
m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
|
||||
m_Stream.Write( (ushort)beheld.FacialHair.ItemID );
|
||||
m_Stream.Write( (byte)0 ); // signed, itemID offset
|
||||
m_Stream.Write( (ushort)1 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (short)0 );
|
||||
m_Stream.Write( (int)beheld.Serial );
|
||||
m_Stream.Write( (ushort)beheld.FacialHair.Hue );
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek( pos, SeekOrigin.Begin );
|
||||
m_Stream.Write( (ushort)written );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent6017 : Packet
|
||||
{
|
||||
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
|
||||
EnsureCapacity(5 + (count * 20));
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write((int)child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((int)HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((int)FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
}
|
||||
}
|
||||
}
|
||||
226
Scripts/Items/Misc/DeceitBrazier.cs
Normal file
226
Scripts/Items/Misc/DeceitBrazier.cs
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
using System;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DeceitBrazier : Item
|
||||
{
|
||||
private static Type[] m_Creatures = new Type[]
|
||||
{
|
||||
#region Animals
|
||||
typeof( FireSteed ), //Set the tents up people!
|
||||
#endregion
|
||||
|
||||
#region Undead
|
||||
typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ),
|
||||
typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ),
|
||||
typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ),
|
||||
typeof( RottingCorpse ), typeof( Ghoul ),
|
||||
#endregion
|
||||
|
||||
#region Demons
|
||||
typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ),
|
||||
typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ),
|
||||
typeof( FireGargoyle ), typeof( HordeMinion ),
|
||||
#endregion
|
||||
|
||||
#region Gazers
|
||||
typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ),
|
||||
#endregion
|
||||
|
||||
#region Uncategorized
|
||||
typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ),
|
||||
typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ),
|
||||
typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ),
|
||||
#endregion
|
||||
|
||||
#region Arachnid
|
||||
typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ),
|
||||
#endregion
|
||||
|
||||
#region Repond
|
||||
typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ),
|
||||
typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ),
|
||||
typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ),
|
||||
typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ),
|
||||
typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ),
|
||||
#endregion
|
||||
|
||||
#region Reptilian
|
||||
typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ),
|
||||
typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ),
|
||||
typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ),
|
||||
typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ),
|
||||
#endregion
|
||||
|
||||
#region Elementals
|
||||
typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ),
|
||||
typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ),
|
||||
typeof( AirElemental ), typeof( Golem ),
|
||||
#endregion
|
||||
|
||||
#region Random Critters
|
||||
typeof( Sewerrat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ),
|
||||
typeof( Cougar ), typeof( Alligator )
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static Type[] Creatures { get { return m_Creatures; } }
|
||||
|
||||
private Timer m_Timer;
|
||||
private DateTime m_NextSpawn;
|
||||
private int m_SpawnRange;
|
||||
private TimeSpan m_NextSpawnDelay;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime NextSpawn { get { return m_NextSpawn; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SpawnRange { get { return m_SpawnRange; } set { m_SpawnRange = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan NextSpawnDelay { get { return m_NextSpawnDelay; } set { m_NextSpawnDelay = value; } }
|
||||
|
||||
public override int LabelNumber { get { return 1023633; } } // Brazier
|
||||
|
||||
[Constructable]
|
||||
public DeceitBrazier() : base( 0xE31 )
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle225;
|
||||
m_NextSpawn = DateTime.UtcNow;
|
||||
m_NextSpawnDelay = TimeSpan.FromMinutes( 15.0 );
|
||||
m_SpawnRange = 5;
|
||||
}
|
||||
|
||||
public DeceitBrazier( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 ); // version
|
||||
|
||||
writer.Write( (int)m_SpawnRange );
|
||||
writer.Write( m_NextSpawnDelay );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if( version >= 0 )
|
||||
{
|
||||
m_SpawnRange = reader.ReadInt();
|
||||
m_NextSpawnDelay = reader.ReadTimeSpan();
|
||||
}
|
||||
|
||||
m_NextSpawn = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public virtual void HeedWarning()
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500761 );// Heed this warning well, and use this brazier at your own peril.
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement { get { return true; } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
|
||||
{
|
||||
if( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
|
||||
{
|
||||
if( m_Timer == null || !m_Timer.Running )
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerCallback( HeedWarning ) );
|
||||
}
|
||||
}
|
||||
|
||||
base.OnMovement( m, oldLocation );
|
||||
}
|
||||
|
||||
public Point3D GetSpawnPosition()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if( map == null )
|
||||
return Location;
|
||||
|
||||
// Try 10 times to find a Spawnable location.
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
int x = Location.X + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
|
||||
int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
|
||||
int z = Map.GetAverageZ( x, y );
|
||||
|
||||
if( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
|
||||
return new Point3D( x, y, this.Z );
|
||||
else if( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
|
||||
return new Point3D( x, y, z );
|
||||
}
|
||||
|
||||
return this.Location;
|
||||
}
|
||||
|
||||
public virtual void DoEffect( Point3D loc, Map map )
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( loc, map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 5052 );
|
||||
Effects.PlaySound( loc, map, 0x225 );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if( Utility.InRange( from.Location, Location, 2 ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( m_NextSpawn < DateTime.UtcNow )
|
||||
{
|
||||
Map map = this.Map;
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] );
|
||||
|
||||
if( bc != null )
|
||||
{
|
||||
Point3D spawnLoc = GetSpawnPosition();
|
||||
|
||||
DoEffect( spawnLoc, map );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate()
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = m_SpawnRange;
|
||||
bc.FightMode = FightMode.Closest;
|
||||
|
||||
bc.MoveToWorld( spawnLoc, map );
|
||||
|
||||
DoEffect( spawnLoc, map );
|
||||
|
||||
bc.ForceReacquire();
|
||||
} );
|
||||
|
||||
m_NextSpawn = DateTime.UtcNow + m_NextSpawnDelay;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500760 ); // The brazier fizzes and pops, but nothing seems to happen.
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
339
Scripts/Items/Misc/EffectController.cs
Normal file
339
Scripts/Items/Misc/EffectController.cs
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum ECEffectType
|
||||
{
|
||||
None,
|
||||
Moving,
|
||||
Location,
|
||||
Target,
|
||||
Lightning
|
||||
}
|
||||
|
||||
public enum EffectTriggerType
|
||||
{
|
||||
None,
|
||||
Sequenced,
|
||||
DoubleClick,
|
||||
InRange
|
||||
}
|
||||
|
||||
public class EffectController : Item
|
||||
{
|
||||
private TimeSpan m_EffectDelay;
|
||||
|
||||
private ECEffectType m_EffectType;
|
||||
private EffectTriggerType m_TriggerType;
|
||||
|
||||
private IEntity m_Source;
|
||||
private IEntity m_Target;
|
||||
|
||||
private TimeSpan m_TriggerDelay;
|
||||
private EffectController m_Trigger;
|
||||
|
||||
private int m_ItemID;
|
||||
private int m_Hue;
|
||||
private int m_RenderMode;
|
||||
|
||||
private int m_Speed;
|
||||
private int m_Duration;
|
||||
|
||||
private bool m_FixedDirection;
|
||||
private bool m_Explodes;
|
||||
|
||||
private int m_ParticleEffect;
|
||||
private int m_ExplodeParticleEffect;
|
||||
private int m_ExplodeSound;
|
||||
|
||||
private EffectLayer m_EffectLayer;
|
||||
private int m_Unknown;
|
||||
|
||||
private TimeSpan m_SoundDelay;
|
||||
private int m_SoundID;
|
||||
private bool m_PlaySoundAtTrigger;
|
||||
|
||||
private int m_TriggerRange;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ECEffectType EffectType{ get{ return m_EffectType; } set{ m_EffectType = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectTriggerType TriggerType{ get{ return m_TriggerType; } set{ m_TriggerType = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectLayer EffectLayer{ get{ return m_EffectLayer; } set{ m_EffectLayer = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan EffectDelay{ get{ return m_EffectDelay; } set{ m_EffectDelay = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan TriggerDelay{ get{ return m_TriggerDelay; } set{ m_TriggerDelay = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan SoundDelay{ get{ return m_SoundDelay; } set{ m_SoundDelay = value; } }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item SourceItem{ get{ return m_Source as Item; } set{ m_Source = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile SourceMobile{ get{ return m_Source as Mobile; } set{ m_Source = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool SourceNull{ get{ return ( m_Source == null ); } set{ if ( value ) m_Source = null; } }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item TargetItem{ get{ return m_Target as Item; } set{ m_Target = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile TargetMobile{ get{ return m_Target as Mobile; } set{ m_Target = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool TargetNull{ get{ return ( m_Target == null ); } set{ if ( value ) m_Target = null; } }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectController Sequence{ get{ return m_Trigger; } set{ m_Trigger = value; } }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool FixedDirection{ get{ return m_FixedDirection; } set{ m_FixedDirection = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool Explodes{ get{ return m_Explodes; } set{ m_Explodes = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool PlaySoundAtTrigger{ get{ return m_PlaySoundAtTrigger; } set{ m_PlaySoundAtTrigger = value; } }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int EffectItemID{ get{ return m_ItemID; } set{ m_ItemID = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int EffectHue{ get{ return m_Hue; } set{ m_Hue = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int RenderMode{ get{ return m_RenderMode; } set{ m_RenderMode = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Speed{ get{ return m_Speed; } set{ m_Speed = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Duration{ get{ return m_Duration; } set{ m_Duration = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ParticleEffect{ get{ return m_ParticleEffect; } set{ m_ParticleEffect = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ExplodeParticleEffect{ get{ return m_ExplodeParticleEffect; } set{ m_ExplodeParticleEffect = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ExplodeSound{ get{ return m_ExplodeSound; } set{ m_ExplodeSound = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Unknown{ get{ return m_Unknown; } set{ m_Unknown = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SoundID{ get{ return m_SoundID; } set{ m_SoundID = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TriggerRange{ get{ return m_TriggerRange; } set{ m_TriggerRange = value; } }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "Effect Controller"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public EffectController() : base( 0x1B72 )
|
||||
{
|
||||
Movable = false;
|
||||
Visible = false;
|
||||
m_TriggerType = EffectTriggerType.Sequenced;
|
||||
m_EffectLayer = (EffectLayer)255;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_TriggerType == EffectTriggerType.DoubleClick )
|
||||
DoEffect( from );
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return ( m_TriggerType == EffectTriggerType.InRange ); } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Location != oldLocation && m_TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, m_TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, m_TriggerRange ) )
|
||||
DoEffect( m );
|
||||
}
|
||||
|
||||
public EffectController( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_EffectDelay );
|
||||
writer.Write( m_TriggerDelay );
|
||||
writer.Write( m_SoundDelay );
|
||||
|
||||
if ( m_Source is Item )
|
||||
writer.Write( m_Source as Item );
|
||||
else
|
||||
writer.Write( m_Source as Mobile );
|
||||
|
||||
if ( m_Target is Item )
|
||||
writer.Write( m_Target as Item );
|
||||
else
|
||||
writer.Write( m_Target as Mobile );
|
||||
|
||||
writer.Write( m_Trigger as Item );
|
||||
|
||||
writer.Write( m_FixedDirection );
|
||||
writer.Write( m_Explodes );
|
||||
writer.Write( m_PlaySoundAtTrigger );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_EffectType );
|
||||
writer.WriteEncodedInt( (int) m_EffectLayer );
|
||||
writer.WriteEncodedInt( (int) m_TriggerType );
|
||||
|
||||
writer.WriteEncodedInt( m_ItemID );
|
||||
writer.WriteEncodedInt( m_Hue );
|
||||
writer.WriteEncodedInt( m_RenderMode );
|
||||
writer.WriteEncodedInt( m_Speed );
|
||||
writer.WriteEncodedInt( m_Duration );
|
||||
writer.WriteEncodedInt( m_ParticleEffect );
|
||||
writer.WriteEncodedInt( m_ExplodeParticleEffect );
|
||||
writer.WriteEncodedInt( m_ExplodeSound );
|
||||
writer.WriteEncodedInt( m_Unknown );
|
||||
writer.WriteEncodedInt( m_SoundID );
|
||||
writer.WriteEncodedInt( m_TriggerRange );
|
||||
}
|
||||
|
||||
private IEntity ReadEntity( GenericReader reader )
|
||||
{
|
||||
return World.FindEntity( reader.ReadInt() );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_EffectDelay = reader.ReadTimeSpan();
|
||||
m_TriggerDelay = reader.ReadTimeSpan();
|
||||
m_SoundDelay = reader.ReadTimeSpan();
|
||||
|
||||
m_Source = ReadEntity( reader );
|
||||
m_Target = ReadEntity( reader );
|
||||
m_Trigger = reader.ReadItem() as EffectController;
|
||||
|
||||
m_FixedDirection = reader.ReadBool();
|
||||
m_Explodes = reader.ReadBool();
|
||||
m_PlaySoundAtTrigger = reader.ReadBool();
|
||||
|
||||
m_EffectType = (ECEffectType)reader.ReadEncodedInt();
|
||||
m_EffectLayer = (EffectLayer)reader.ReadEncodedInt();
|
||||
m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt();
|
||||
|
||||
m_ItemID = reader.ReadEncodedInt();
|
||||
m_Hue = reader.ReadEncodedInt();
|
||||
m_RenderMode = reader.ReadEncodedInt();
|
||||
m_Speed = reader.ReadEncodedInt();
|
||||
m_Duration = reader.ReadEncodedInt();
|
||||
m_ParticleEffect = reader.ReadEncodedInt();
|
||||
m_ExplodeParticleEffect = reader.ReadEncodedInt();
|
||||
m_ExplodeSound = reader.ReadEncodedInt();
|
||||
m_Unknown = reader.ReadEncodedInt();
|
||||
m_SoundID = reader.ReadEncodedInt();
|
||||
m_TriggerRange = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(IEntity trigger)
|
||||
{
|
||||
IEntity ent = null;
|
||||
|
||||
if (m_PlaySoundAtTrigger)
|
||||
ent = trigger as IEntity;
|
||||
|
||||
if (ent == null)
|
||||
ent = this;
|
||||
|
||||
Effects.PlaySound((ent is Item) ? ((Item)ent).GetWorldLocation() : ent.Location, ent.Map, m_SoundID);
|
||||
}
|
||||
|
||||
public void DoEffect(IEntity trigger)
|
||||
{
|
||||
if (Deleted || m_TriggerType == EffectTriggerType.None)
|
||||
return;
|
||||
|
||||
if (trigger is Mobile && ((Mobile)trigger).Hidden && ((Mobile)trigger).AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if (m_SoundID > 0)
|
||||
Timer.DelayCall<IEntity>(m_SoundDelay, new TimerStateCallback<IEntity>(PlaySound), trigger);
|
||||
|
||||
if (m_Trigger != null)
|
||||
Timer.DelayCall<IEntity>(m_TriggerDelay, new TimerStateCallback<IEntity>(m_Trigger.DoEffect), trigger);
|
||||
|
||||
if (m_EffectType != ECEffectType.None)
|
||||
Timer.DelayCall<IEntity>(m_EffectDelay, new TimerStateCallback<IEntity>(InternalDoEffect), trigger);
|
||||
}
|
||||
|
||||
public void InternalDoEffect(IEntity trigger)
|
||||
{
|
||||
IEntity from = m_Source, to = m_Target;
|
||||
|
||||
if (from == null)
|
||||
from = trigger;
|
||||
|
||||
if (to == null)
|
||||
to = trigger;
|
||||
|
||||
switch (m_EffectType)
|
||||
{
|
||||
case ECEffectType.Lightning:
|
||||
{
|
||||
Effects.SendBoltEffect(from, false, m_Hue);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Location:
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_Unknown);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Moving:
|
||||
{
|
||||
if (from == this)
|
||||
from = EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration);
|
||||
|
||||
if (to == this)
|
||||
to = EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration);
|
||||
|
||||
Effects.SendMovingParticles(from, to, m_ItemID, m_Speed, m_Duration, m_FixedDirection, m_Explodes, m_Hue, m_RenderMode, m_ParticleEffect, m_ExplodeParticleEffect, m_ExplodeSound, m_EffectLayer, m_Unknown);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Target:
|
||||
{
|
||||
Effects.SendTargetParticles(from, m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_EffectLayer, m_Unknown);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Scripts/Items/Misc/EffectItem.cs
Normal file
95
Scripts/Items/Misc/EffectItem.cs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class EffectItem : Item
|
||||
{
|
||||
private static List<EffectItem> m_Free = new List<EffectItem>(); // List of available EffectItems
|
||||
|
||||
public static readonly TimeSpan DefaultDuration = TimeSpan.FromSeconds( 5.0 );
|
||||
|
||||
public static EffectItem Create( Point3D p, Map map, TimeSpan duration )
|
||||
{
|
||||
EffectItem item = null;
|
||||
|
||||
for ( int i = m_Free.Count - 1; item == null && i >= 0; --i ) // We reuse new entries first so decay works better
|
||||
{
|
||||
EffectItem free = m_Free[i];
|
||||
|
||||
m_Free.RemoveAt( i );
|
||||
|
||||
if ( !free.Deleted && free.Map == Map.Internal )
|
||||
item = free;
|
||||
}
|
||||
|
||||
if ( item == null )
|
||||
item = new EffectItem();
|
||||
else
|
||||
item.ItemID = 1;
|
||||
|
||||
item.MoveToWorld( p, map );
|
||||
item.BeginFree( duration );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private EffectItem() : base( 1 ) // nodraw
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public void BeginFree( TimeSpan duration )
|
||||
{
|
||||
new FreeTimer( this, duration ).Start();
|
||||
}
|
||||
|
||||
public override bool Decays
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public EffectItem( 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();
|
||||
}
|
||||
|
||||
private class FreeTimer : Timer
|
||||
{
|
||||
private EffectItem m_Item;
|
||||
|
||||
public FreeTimer( EffectItem item, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Internalize();
|
||||
|
||||
m_Free.Add( m_Item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Scripts/Items/Misc/ExecutionersCap.cs
Normal file
31
Scripts/Items/Misc/ExecutionersCap.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ExecutionersCap : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ExecutionersCap() : base(0xF83)
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ExecutionersCap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int) 0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
312
Scripts/Items/Misc/Firebomb.cs
Normal file
312
Scripts/Items/Misc/Firebomb.cs
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Firebomb : Item
|
||||
{
|
||||
private Timer m_Timer;
|
||||
private int m_Ticks = 0;
|
||||
private Mobile m_LitBy;
|
||||
private List<Mobile> m_Users;
|
||||
|
||||
[Constructable]
|
||||
public Firebomb() : this( 0x99B )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Firebomb( int itemID ) : base( itemID )
|
||||
{
|
||||
//Name = "a firebomb";
|
||||
Weight = 2.0;
|
||||
Hue = 1260;
|
||||
}
|
||||
|
||||
public Firebomb( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
|
||||
{
|
||||
// to prevent exploiting for pvp
|
||||
from.SendLocalizedMessage( 1075857 ); // You cannot use that while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_Timer == null )
|
||||
{
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ), new TimerCallback( OnFirebombTimerTick ) );
|
||||
m_LitBy = from;
|
||||
from.SendLocalizedMessage( 1060582 ); // You light the firebomb. Throw it now!
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage( 1060581 ); // You've already lit it! Better throw it now!
|
||||
|
||||
if ( m_Users == null )
|
||||
m_Users = new List<Mobile>();
|
||||
|
||||
if ( !m_Users.Contains( from ) )
|
||||
m_Users.Add( from );
|
||||
|
||||
from.Target = new ThrowTarget( this );
|
||||
}
|
||||
|
||||
private void OnFirebombTimerTick()
|
||||
{
|
||||
if ( Deleted )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Map == Map.Internal && HeldBy == null )
|
||||
return;
|
||||
|
||||
switch ( m_Ticks )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
++m_Ticks;
|
||||
|
||||
if ( HeldBy != null )
|
||||
HeldBy.PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
else if ( RootParent == null )
|
||||
PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
else if ( RootParent is Mobile )
|
||||
((Mobile)RootParent).PublicOverheadMessage( MessageType.Regular, 957, false, m_Ticks.ToString() );
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if ( HeldBy != null )
|
||||
HeldBy.DropHolding();
|
||||
|
||||
if ( m_Users != null )
|
||||
{
|
||||
foreach ( Mobile m in m_Users )
|
||||
{
|
||||
ThrowTarget targ = m.Target as ThrowTarget;
|
||||
|
||||
if ( targ != null && targ.Bomb == this )
|
||||
Target.Cancel( m );
|
||||
}
|
||||
|
||||
m_Users.Clear();
|
||||
m_Users = null;
|
||||
}
|
||||
|
||||
if ( RootParent is Mobile )
|
||||
{
|
||||
Mobile parent = (Mobile)RootParent;
|
||||
parent.SendLocalizedMessage( 1060583 ); // The firebomb explodes in your hand!
|
||||
AOS.Damage( parent, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
else if ( RootParent == null )
|
||||
{
|
||||
List<Mobile> toDamage = new List<Mobile>();
|
||||
IPooledEnumerable eable = Map.GetMobilesInRange( Location, 1 );
|
||||
|
||||
foreach ( Mobile m in eable )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
eable.Free();
|
||||
|
||||
Mobile victim;
|
||||
for ( int i = 0; i < toDamage.Count; ++i )
|
||||
{
|
||||
victim = toDamage[i];
|
||||
|
||||
if ( m_LitBy == null || (SpellHelper.ValidIndirectTarget( m_LitBy, victim ) && m_LitBy.CanBeHarmful( victim, false )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( victim );
|
||||
|
||||
AOS.Damage( victim, m_LitBy, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
(new FirebombField( m_LitBy, toDamage )).MoveToWorld( Location, Map );
|
||||
}
|
||||
|
||||
m_Timer.Stop();
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFirebombTarget( Mobile from, object obj )
|
||||
{
|
||||
if ( Deleted || Map == Map.Internal || !IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
IPoint3D p = obj as IPoint3D;
|
||||
|
||||
if ( p == null )
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop( ref p );
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
|
||||
if ( p is Mobile )
|
||||
to = (Mobile)p;
|
||||
else
|
||||
to = new Entity( Serial.Zero, new Point3D( p ), Map );
|
||||
|
||||
Effects.SendMovingEffect( from, to, ItemID, 7, 0, false, false, Hue, 0 );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FirebombReposition_OnTick ), new object[]{ p, Map } );
|
||||
Internalize();
|
||||
}
|
||||
|
||||
private void FirebombReposition_OnTick( object state )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
IPoint3D p = (IPoint3D)states[0];
|
||||
Map map = (Map)states[1];
|
||||
|
||||
MoveToWorld( new Point3D( p ), map );
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
private Firebomb m_Bomb;
|
||||
|
||||
public Firebomb Bomb
|
||||
{
|
||||
get { return m_Bomb; }
|
||||
}
|
||||
|
||||
public ThrowTarget( Firebomb bomb )
|
||||
: base( 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Bomb = bomb;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
m_Bomb.OnFirebombTarget( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FirebombField : Item
|
||||
{
|
||||
private List<Mobile> m_Burning;
|
||||
private Timer m_Timer;
|
||||
private Mobile m_LitBy;
|
||||
private DateTime m_Expire;
|
||||
|
||||
public FirebombField( Mobile litBy, List<Mobile> toDamage ) : base( 0x376A )
|
||||
{
|
||||
Movable = false;
|
||||
m_LitBy = litBy;
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromSeconds( 10 );
|
||||
m_Burning = toDamage;
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), new TimerCallback( OnFirebombFieldTimerTick ) );
|
||||
}
|
||||
|
||||
public FirebombField( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
// Don't serialize these...
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( ItemID == 0x398C && m_LitBy == null || (SpellHelper.ValidIndirectTarget( m_LitBy, m ) && m_LitBy.CanBeHarmful( m, false )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( m );
|
||||
|
||||
AOS.Damage( m, m_LitBy, 2, 0, 100, 0, 0, 0 );
|
||||
m.PlaySound( 0x208 );
|
||||
|
||||
if ( !m_Burning.Contains( m ) )
|
||||
m_Burning.Add( m );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnFirebombFieldTimerTick()
|
||||
{
|
||||
if ( Deleted )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ItemID == 0x376A )
|
||||
{
|
||||
ItemID = 0x398C;
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile victim;
|
||||
for ( int i = 0; i < m_Burning.Count; )
|
||||
{
|
||||
victim = m_Burning[i];
|
||||
|
||||
if ( victim.Location == Location && victim.Map == Map && (m_LitBy == null || ( SpellHelper.ValidIndirectTarget( m_LitBy, victim ) && m_LitBy.CanBeHarmful( victim, false ) )) )
|
||||
{
|
||||
if ( m_LitBy != null )
|
||||
m_LitBy.DoHarmful( victim );
|
||||
|
||||
AOS.Damage( victim, m_LitBy, Utility.Random( 3 ) + 4, 0, 100, 0, 0, 0 );
|
||||
++i;
|
||||
}
|
||||
else
|
||||
m_Burning.RemoveAt( i );
|
||||
}
|
||||
|
||||
if ( DateTime.UtcNow >= m_Expire )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
130
Scripts/Items/Misc/FlipableAddonAttribute.cs
Normal file
130
Scripts/Items/Misc/FlipableAddonAttribute.cs
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class FlipableAddonAttribute : Attribute
|
||||
{
|
||||
private static string m_MethodName = "Flip";
|
||||
|
||||
private static Type[] m_Params = new Type[]
|
||||
{
|
||||
typeof( Mobile ), typeof( Direction )
|
||||
};
|
||||
|
||||
private Direction[] m_Directions;
|
||||
|
||||
public Direction[] Directions
|
||||
{
|
||||
get { return m_Directions; }
|
||||
}
|
||||
|
||||
public FlipableAddonAttribute( params Direction[] directions )
|
||||
{
|
||||
m_Directions = directions;
|
||||
}
|
||||
|
||||
public virtual void Flip( Mobile from, Item addon )
|
||||
{
|
||||
if ( m_Directions != null && m_Directions.Length > 1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
MethodInfo flipMethod = addon.GetType().GetMethod( m_MethodName, m_Params );
|
||||
|
||||
if ( flipMethod != null )
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for ( int i = 0; i < m_Directions.Length; i++ )
|
||||
{
|
||||
if ( addon.Direction == m_Directions[ i ] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( index >= m_Directions.Length )
|
||||
index = 0;
|
||||
|
||||
ClearComponents( addon );
|
||||
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
|
||||
|
||||
BaseHouse house = null;
|
||||
AddonFitResult result = AddonFitResult.Valid;
|
||||
|
||||
addon.Map = Map.Internal;
|
||||
|
||||
if ( addon is BaseAddon )
|
||||
result = ( (BaseAddon) addon ).CouldFit( addon.Location, from.Map, from, ref house );
|
||||
else if ( addon is BaseAddonContainer )
|
||||
result = ( (BaseAddonContainer) addon ).CouldFit( addon.Location, from.Map, from, ref house );
|
||||
|
||||
addon.Map = from.Map;
|
||||
|
||||
if ( result != AddonFitResult.Valid )
|
||||
{
|
||||
if ( index == 0 )
|
||||
index = m_Directions.Length - 1;
|
||||
else
|
||||
index -= 1;
|
||||
|
||||
ClearComponents( addon );
|
||||
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
|
||||
|
||||
if ( result == AddonFitResult.Blocked )
|
||||
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
|
||||
else if ( result == AddonFitResult.NotInHouse )
|
||||
from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
|
||||
else if ( result == AddonFitResult.DoorsNotClosed )
|
||||
from.SendMessage( "You must close all house doors before placing this." );
|
||||
else if ( result == AddonFitResult.DoorTooClose )
|
||||
from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
|
||||
else if ( result == AddonFitResult.NoWall )
|
||||
from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.
|
||||
}
|
||||
|
||||
addon.Direction = m_Directions[ index ];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearComponents( Item item )
|
||||
{
|
||||
if ( item is BaseAddon )
|
||||
{
|
||||
BaseAddon addon = (BaseAddon) item;
|
||||
|
||||
foreach ( AddonComponent c in addon.Components )
|
||||
{
|
||||
c.Addon = null;
|
||||
c.Delete();
|
||||
}
|
||||
|
||||
addon.Components.Clear();
|
||||
}
|
||||
else if ( item is BaseAddonContainer )
|
||||
{
|
||||
BaseAddonContainer addon = (BaseAddonContainer) item;
|
||||
|
||||
foreach ( AddonContainerComponent c in addon.Components )
|
||||
{
|
||||
c.Addon = null;
|
||||
c.Delete();
|
||||
}
|
||||
|
||||
addon.Components.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
118
Scripts/Items/Misc/FlipableAttribute.cs
Normal file
118
Scripts/Items/Misc/FlipableAttribute.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
using System;
|
||||
using Server;
|
||||
using System.Reflection;
|
||||
using Server.Targeting;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FlipCommandHandlers
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "Flip", AccessLevel.GameMaster, new CommandEventHandler( Flip_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "Flip" )]
|
||||
[Description( "Turns an item." )]
|
||||
public static void Flip_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.Target = new FlipTarget();
|
||||
}
|
||||
|
||||
private class FlipTarget : Target
|
||||
{
|
||||
public FlipTarget()
|
||||
: base( -1, false, TargetFlags.None )
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if( targeted is Item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
|
||||
if( item.Movable == false && from.AccessLevel == AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Type type = targeted.GetType();
|
||||
|
||||
FlipableAttribute[] AttributeArray = (FlipableAttribute[])type.GetCustomAttributes( typeof( FlipableAttribute ), false );
|
||||
|
||||
if( AttributeArray.Length == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FlipableAttribute fa = AttributeArray[0];
|
||||
|
||||
fa.Flip( (Item)targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class DynamicFlipingAttribute : Attribute
|
||||
{
|
||||
public DynamicFlipingAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class FlipableAttribute : Attribute
|
||||
{
|
||||
private int[] m_ItemIDs;
|
||||
|
||||
public int[] ItemIDs
|
||||
{
|
||||
get { return m_ItemIDs; }
|
||||
}
|
||||
|
||||
public FlipableAttribute()
|
||||
: this( null )
|
||||
{
|
||||
}
|
||||
|
||||
public FlipableAttribute( params int[] itemIDs )
|
||||
{
|
||||
m_ItemIDs = itemIDs;
|
||||
}
|
||||
|
||||
public virtual void Flip( Item item )
|
||||
{
|
||||
if( m_ItemIDs == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
MethodInfo flipMethod = item.GetType().GetMethod( "Flip", Type.EmptyTypes );
|
||||
if( flipMethod != null )
|
||||
flipMethod.Invoke( item, new object[0] );
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = 0;
|
||||
for( int i = 0; i < m_ItemIDs.Length; i++ )
|
||||
{
|
||||
if( item.ItemID == m_ItemIDs[i] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( index > m_ItemIDs.Length - 1 )
|
||||
index = 0;
|
||||
|
||||
item.ItemID = m_ItemIDs[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1218
Scripts/Items/Misc/GlassItems.cs
Normal file
1218
Scripts/Items/Misc/GlassItems.cs
Normal file
File diff suppressed because it is too large
Load diff
151
Scripts/Items/Misc/Gold.cs
Normal file
151
Scripts/Items/Misc/Gold.cs
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Gold : Item
|
||||
{
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get { return ( Core.ML ? ( 0.02 / 3 ) : 0.02 ); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Gold() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Gold( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Gold( int amount ) : base( 0xEED )
|
||||
{
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public Gold( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override int GetDropSound()
|
||||
{
|
||||
if ( Amount <= 1 )
|
||||
return 0x2E4;
|
||||
else if ( Amount <= 5 )
|
||||
return 0x2E5;
|
||||
else
|
||||
return 0x2E6;
|
||||
}
|
||||
|
||||
protected override void OnAmountChange( int oldValue )
|
||||
{
|
||||
int newValue = this.Amount;
|
||||
|
||||
UpdateTotal( this, TotalType.Gold, newValue - oldValue );
|
||||
}
|
||||
|
||||
#if NEWPARENT
|
||||
public override void OnAdded(IEntity parent)
|
||||
#else
|
||||
public override void OnAdded(object parent)
|
||||
#endif
|
||||
{
|
||||
base.OnAdded(parent);
|
||||
|
||||
if (!AccountGold.Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile owner = null;
|
||||
SecureTradeInfo tradeInfo = null;
|
||||
|
||||
Container root = parent as Container;
|
||||
|
||||
while (root != null && root.Parent is Container)
|
||||
{
|
||||
root = (Container)root.Parent;
|
||||
}
|
||||
|
||||
parent = root ?? parent;
|
||||
|
||||
if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade)
|
||||
{
|
||||
var trade = (SecureTradeContainer)parent;
|
||||
|
||||
if (trade.Trade.From.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.From;
|
||||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
else if (trade.Trade.To.Container == trade)
|
||||
{
|
||||
tradeInfo = trade.Trade.To;
|
||||
owner = tradeInfo.Mobile;
|
||||
}
|
||||
}
|
||||
else if (parent is BankBox && AccountGold.ConvertOnBank)
|
||||
{
|
||||
owner = ((BankBox)parent).Owner;
|
||||
}
|
||||
|
||||
if (owner == null || owner.Account == null || !owner.Account.DepositGold(Amount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tradeInfo != null)
|
||||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
var total = Amount / Math.Max(1.0, Account.CurrencyThreshold);
|
||||
var plat = (int)Math.Truncate(total);
|
||||
var gold = (int)((total - plat) * Account.CurrencyThreshold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
}
|
||||
|
||||
if (tradeInfo.VirtualCheck != null)
|
||||
{
|
||||
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
|
||||
}
|
||||
}
|
||||
|
||||
owner.SendLocalizedMessage(1042763, Amount.ToString("#,0"));
|
||||
|
||||
Delete();
|
||||
|
||||
((Container)parent).UpdateTotals();
|
||||
}
|
||||
|
||||
public override int GetTotal( TotalType type )
|
||||
{
|
||||
int baseTotal = base.GetTotal( type );
|
||||
|
||||
if ( type == TotalType.Gold )
|
||||
baseTotal += this.Amount;
|
||||
|
||||
return baseTotal;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Scripts/Items/Misc/Guillotine.cs
Normal file
115
Scripts/Items/Misc/Guillotine.cs
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Guillotine : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Guillotine()
|
||||
: base( 4656 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
private DateTime m_NextUse;
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that
|
||||
}
|
||||
else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.UtcNow >= m_NextUse )
|
||||
{
|
||||
Point3D p = this.GetWorldLocation();
|
||||
|
||||
if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) )
|
||||
{
|
||||
Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() );
|
||||
from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" );
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) );
|
||||
}
|
||||
|
||||
Effects.PlaySound( this.GetWorldLocation(), this.Map, 0x387 );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) );
|
||||
|
||||
m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
|
||||
}
|
||||
}
|
||||
|
||||
private void Down1()
|
||||
{
|
||||
ItemID = ( ItemID == 4656 ? 4678 : 4712 );
|
||||
}
|
||||
|
||||
private void Down2()
|
||||
{
|
||||
ItemID = ( ItemID == 4678 ? 4679 : 4713 );
|
||||
|
||||
Point3D p = this.GetWorldLocation();
|
||||
Map f = this.Map;
|
||||
|
||||
if ( f == null )
|
||||
return;
|
||||
|
||||
new Blood( 4650 ).MoveToWorld( p, f );
|
||||
|
||||
for ( int i = 0; i < 4; ++i )
|
||||
{
|
||||
int x = p.X - 2 + Utility.Random( 5 );
|
||||
int y = p.Y - 2 + Utility.Random( 5 );
|
||||
int z = p.Z;
|
||||
|
||||
if ( !f.CanFit( x, y, z, 1, false, false, true ) )
|
||||
{
|
||||
z = f.GetAverageZ( x, y );
|
||||
|
||||
if ( !f.CanFit( x, y, z, 1, false, false, true ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
new Blood().MoveToWorld( new Point3D( x, y, z ), f );
|
||||
}
|
||||
}
|
||||
|
||||
private void BackUp()
|
||||
{
|
||||
if ( ItemID == 4678 || ItemID == 4679 )
|
||||
ItemID = 4656;
|
||||
else if ( ItemID == 4712 || ItemID == 4713 )
|
||||
ItemID = 4702;
|
||||
}
|
||||
|
||||
public Guillotine( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (byte) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadByte();
|
||||
|
||||
if ( ItemID == 4678 || ItemID == 4679 )
|
||||
ItemID = 4656;
|
||||
else if ( ItemID == 4712 || ItemID == 4713 )
|
||||
ItemID = 4702;
|
||||
}
|
||||
}
|
||||
}
|
||||
193
Scripts/Items/Misc/HairDye.cs
Normal file
193
Scripts/Items/Misc/HairDye.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HairDye : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041060; } } // Hair Dye
|
||||
|
||||
[Constructable]
|
||||
public HairDye() : base( 0xEFF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public HairDye( 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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
from.CloseGump( typeof( HairDyeGump ) );
|
||||
from.SendGump( new HairDyeGump( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HairDyeGump : Gump
|
||||
{
|
||||
private HairDye m_HairDye;
|
||||
|
||||
private class HairDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueStart;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueCount;
|
||||
}
|
||||
}
|
||||
|
||||
public HairDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
private static HairDyeEntry[] m_Entries = new HairDyeEntry[]
|
||||
{
|
||||
new HairDyeEntry( "*****", 1602, 26 ),
|
||||
new HairDyeEntry( "*****", 1628, 27 ),
|
||||
new HairDyeEntry( "*****", 1502, 32 ),
|
||||
new HairDyeEntry( "*****", 1302, 32 ),
|
||||
new HairDyeEntry( "*****", 1402, 32 ),
|
||||
new HairDyeEntry( "*****", 1202, 24 ),
|
||||
new HairDyeEntry( "*****", 2402, 29 ),
|
||||
new HairDyeEntry( "*****", 2213, 6 ),
|
||||
new HairDyeEntry( "*****", 1102, 8 ),
|
||||
new HairDyeEntry( "*****", 1110, 8 ),
|
||||
new HairDyeEntry( "*****", 1118, 16 ),
|
||||
new HairDyeEntry( "*****", 1134, 16 )
|
||||
};
|
||||
|
||||
public HairDyeGump( HairDye dye ) : base( 50, 50 )
|
||||
{
|
||||
m_HairDye = dye;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 100, 10, 350, 355, 2600 );
|
||||
AddBackground( 120, 54, 110, 270, 5100 );
|
||||
|
||||
AddHtmlLocalized( 70, 25, 400, 35, 1011013, false, false ); // <center>Hair Color Selection Menu</center>
|
||||
|
||||
AddButton( 149, 328, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 185, 329, 250, 35, 1011014, false, false ); // Dye my hair this color!
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
AddLabel( 130, 59 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name );
|
||||
AddButton( 207, 60 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1 );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
HairDyeEntry e = m_Entries[i];
|
||||
|
||||
AddPage( i + 1 );
|
||||
|
||||
for ( int j = 0; j < e.HueCount; ++j )
|
||||
{
|
||||
AddLabel( 278 + ((j / 16) * 80), 52 + ((j % 16) * 17), e.HueStart + j - 1, "*****" );
|
||||
AddRadio( 260 + ((j / 16) * 80), 52 + ((j % 16) * 17), 210, 211, false, (i * 100) + j );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState from, RelayInfo info )
|
||||
{
|
||||
if ( m_HairDye.Deleted )
|
||||
return;
|
||||
|
||||
Mobile m = from.Mobile;
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( !m_HairDye.IsChildOf( m.Backpack ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1042010 ); //You must have the objectin your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.HairItemID == 0 && m.FacialHairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
else
|
||||
{
|
||||
// To prevent this from being exploited, the hue is abstracted into an internal list
|
||||
|
||||
int entryIndex = switches[0] / 100;
|
||||
int hueOffset = switches[0] % 100;
|
||||
|
||||
if ( entryIndex >= 0 && entryIndex < m_Entries.Length )
|
||||
{
|
||||
HairDyeEntry e = m_Entries[entryIndex];
|
||||
|
||||
if ( hueOffset >= 0 && hueOffset < e.HueCount )
|
||||
{
|
||||
int hue = e.HueStart + hueOffset;
|
||||
|
||||
m.HairHue = hue;
|
||||
m.FacialHairHue = hue;
|
||||
|
||||
m.SendLocalizedMessage( 501199 ); // You dye your hair
|
||||
m_HairDye.Delete();
|
||||
m.PlaySound( 0x4E );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 501200 ); // You decide not to dye your hair
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Scripts/Items/Misc/HoveringWisp.cs
Normal file
34
Scripts/Items/Misc/HoveringWisp.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HoveringWisp : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072881; } } // hovering wisp
|
||||
|
||||
[Constructable]
|
||||
public HoveringWisp() : base( 0x2100 )
|
||||
{
|
||||
}
|
||||
|
||||
public HoveringWisp( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
Scripts/Items/Misc/IDurability.cs
Normal file
24
Scripts/Items/Misc/IDurability.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
interface IDurability
|
||||
{
|
||||
bool CanFortify { get; }
|
||||
|
||||
int InitMinHits { get; }
|
||||
int InitMaxHits { get; }
|
||||
|
||||
int HitPoints { get; set; }
|
||||
int MaxHitPoints { get; set; }
|
||||
|
||||
void ScaleDurability();
|
||||
void UnscaleDurability();
|
||||
}
|
||||
|
||||
interface IWearableDurability : IDurability
|
||||
{
|
||||
int OnHit( BaseWeapon weapon, int damageTaken );
|
||||
}
|
||||
}
|
||||
317
Scripts/Items/Misc/InteriorDecorator.cs
Normal file
317
Scripts/Items/Misc/InteriorDecorator.cs
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum DecorateCommand
|
||||
{
|
||||
None,
|
||||
Turn,
|
||||
Up,
|
||||
Down
|
||||
}
|
||||
|
||||
public class InteriorDecorator : Item
|
||||
{
|
||||
private DecorateCommand m_Command;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DecorateCommand Command{ get{ return m_Command; } set{ m_Command = value; InvalidateProperties(); } }
|
||||
|
||||
[Constructable]
|
||||
public InteriorDecorator() : base( 0xFC1 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041280; } } // an interior decorator
|
||||
|
||||
public InteriorDecorator( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_Command != DecorateCommand.None )
|
||||
list.Add( 1018322 + (int)m_Command ); // Turn/Up/Down
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !CheckUse( this, from ) )
|
||||
return;
|
||||
|
||||
if ( from.FindGump( typeof( InteriorDecorator.InternalGump ) ) == null )
|
||||
from.SendGump( new InternalGump( this ) );
|
||||
|
||||
if ( m_Command != DecorateCommand.None )
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
public static bool InHouse( Mobile from )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
||||
return ( house != null && house.IsCoOwner( from ) );
|
||||
}
|
||||
|
||||
public static bool CheckUse( InteriorDecorator tool, Mobile from )
|
||||
{
|
||||
/*if ( tool.Deleted || !tool.IsChildOf( from.Backpack ) )
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
else*/
|
||||
if ( !InHouse( from ) )
|
||||
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
|
||||
else
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class InternalGump : Gump
|
||||
{
|
||||
private InteriorDecorator m_Decorator;
|
||||
|
||||
public InternalGump( InteriorDecorator decorator ) : base( 150, 50 )
|
||||
{
|
||||
m_Decorator = decorator;
|
||||
|
||||
AddBackground( 0, 0, 200, 200, 2600 );
|
||||
|
||||
AddButton( 50, 45, ( decorator.Command == DecorateCommand.Turn ? 2154 : 2152 ), 2154, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 90, 50, 70, 40, 1018323, false, false ); // Turn
|
||||
|
||||
AddButton( 50, 95, ( decorator.Command == DecorateCommand.Up ? 2154 : 2152 ), 2154, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 90, 100, 70, 40, 1018324, false, false ); // Up
|
||||
|
||||
AddButton( 50, 145, ( decorator.Command == DecorateCommand.Down ? 2154 : 2152 ), 2154, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 90, 150, 70, 40, 1018325, false, false ); // Down
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
DecorateCommand command = DecorateCommand.None;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1: command = DecorateCommand.Turn; break;
|
||||
case 2: command = DecorateCommand.Up; break;
|
||||
case 3: command = DecorateCommand.Down; break;
|
||||
}
|
||||
|
||||
if ( command != DecorateCommand.None )
|
||||
{
|
||||
m_Decorator.Command = command;
|
||||
sender.Mobile.SendGump( new InternalGump( m_Decorator ) );
|
||||
sender.Mobile.Target = new InternalTarget( m_Decorator );
|
||||
}
|
||||
else
|
||||
Target.Cancel( sender.Mobile );
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private InteriorDecorator m_Decorator;
|
||||
|
||||
public InternalTarget( InteriorDecorator decorator ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
CheckLOS = false;
|
||||
|
||||
m_Decorator = decorator;
|
||||
}
|
||||
|
||||
protected override void OnTargetNotAccessible( Mobile from, object targeted )
|
||||
{
|
||||
OnTarget( from, targeted );
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Item && InteriorDecorator.CheckUse( m_Decorator, from ) )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
Item item = (Item)targeted;
|
||||
|
||||
bool isDecorableComponent = false;
|
||||
|
||||
if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
|
||||
{
|
||||
object addon = null;
|
||||
int count = 0;
|
||||
|
||||
if ( item is AddonComponent )
|
||||
{
|
||||
AddonComponent component = (AddonComponent) item;
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
}
|
||||
else if ( item is AddonContainerComponent )
|
||||
{
|
||||
AddonContainerComponent component = (AddonContainerComponent) item;
|
||||
count = component.Addon.Components.Count;
|
||||
addon = component.Addon;
|
||||
}
|
||||
else if ( item is BaseAddonContainer )
|
||||
{
|
||||
BaseAddonContainer container = (BaseAddonContainer) item;
|
||||
count = container.Components.Count;
|
||||
addon = container;
|
||||
}
|
||||
|
||||
if ( count == 1 && Core.SE )
|
||||
isDecorableComponent = true;
|
||||
|
||||
if ( m_Decorator.Command == DecorateCommand.Turn )
|
||||
{
|
||||
FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlipableAddonAttribute ), false );
|
||||
|
||||
if ( attributes.Length > 0 )
|
||||
isDecorableComponent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( house == null || !house.IsCoOwner( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
|
||||
}
|
||||
else if ( item.Parent != null || !house.IsInside( item ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042270 ); // That is not in your house.
|
||||
}
|
||||
else if ( !house.IsLockedDown( item ) && !house.IsSecure( item ) && !isDecorableComponent )
|
||||
{
|
||||
if ( item is AddonComponent && m_Decorator.Command == DecorateCommand.Up )
|
||||
from.SendLocalizedMessage( 1042274 ); // You cannot raise it up any higher.
|
||||
else if ( item is AddonComponent && m_Decorator.Command == DecorateCommand.Down )
|
||||
from.SendLocalizedMessage( 1042275 ); // You cannot lower it down any further.
|
||||
else
|
||||
from.SendLocalizedMessage( 1042271 ); // That is not locked down.
|
||||
}
|
||||
else if ( item is VendorRentalContract )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062491 ); // You cannot use the house decorator on that object.
|
||||
}
|
||||
else if ( item.TotalWeight + item.PileWeight > 100 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042272 ); // That is too heavy.
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( m_Decorator.Command )
|
||||
{
|
||||
case DecorateCommand.Up: Up( item, from ); break;
|
||||
case DecorateCommand.Down: Down( item, from ); break;
|
||||
case DecorateCommand.Turn: Turn( item, from ); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from.Target = new InternalTarget( m_Decorator );
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType )
|
||||
{
|
||||
if ( cancelType == TargetCancelType.Canceled )
|
||||
from.CloseGump( typeof( InteriorDecorator.InternalGump ) );
|
||||
}
|
||||
|
||||
private static void Turn( Item item, Mobile from )
|
||||
{
|
||||
if ( item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer )
|
||||
{
|
||||
object addon = null;
|
||||
|
||||
if ( item is AddonComponent )
|
||||
addon = ((AddonComponent) item).Addon;
|
||||
else if ( item is AddonContainerComponent )
|
||||
addon = ((AddonContainerComponent) item).Addon;
|
||||
else if ( item is BaseAddonContainer )
|
||||
addon = (BaseAddonContainer) item;
|
||||
|
||||
FlipableAddonAttribute[] aAttributes = (FlipableAddonAttribute[]) addon.GetType().GetCustomAttributes( typeof( FlipableAddonAttribute ), false );
|
||||
|
||||
if ( aAttributes.Length > 0 )
|
||||
{
|
||||
aAttributes[ 0 ].Flip( from, (Item) addon );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FlipableAttribute[] attributes = (FlipableAttribute[]) item.GetType().GetCustomAttributes( typeof( FlipableAttribute ), false );
|
||||
|
||||
if ( attributes.Length > 0 )
|
||||
attributes[ 0 ].Flip( item );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042273 ); // You cannot turn that.
|
||||
}
|
||||
|
||||
private static void Up( Item item, Mobile from )
|
||||
{
|
||||
int floorZ = GetFloorZ( item );
|
||||
|
||||
if ( floorZ > int.MinValue && item.Z < (floorZ + 15) ) // Confirmed : no height checks here
|
||||
item.Location = new Point3D( item.Location, item.Z + 1 );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042274 ); // You cannot raise it up any higher.
|
||||
}
|
||||
|
||||
private static void Down( Item item, Mobile from )
|
||||
{
|
||||
int floorZ = GetFloorZ( item );
|
||||
|
||||
if ( floorZ > int.MinValue && item.Z > GetFloorZ( item ) )
|
||||
item.Location = new Point3D( item.Location, item.Z - 1 );
|
||||
else
|
||||
from.SendLocalizedMessage( 1042275 ); // You cannot lower it down any further.
|
||||
}
|
||||
|
||||
private static int GetFloorZ( Item item )
|
||||
{
|
||||
Map map = item.Map;
|
||||
|
||||
if ( map == null )
|
||||
return int.MinValue;
|
||||
|
||||
StaticTile[] tiles = map.Tiles.GetStaticTiles( item.X, item.Y, true );
|
||||
|
||||
int z = int.MinValue;
|
||||
|
||||
for ( int i = 0; i < tiles.Length; ++i )
|
||||
{
|
||||
StaticTile tile = tiles[i];
|
||||
ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
|
||||
|
||||
int top = tile.Z; // Confirmed : no height checks here
|
||||
|
||||
if ( id.Surface && !id.Impassable && top > z && top <= item.Z )
|
||||
z = top;
|
||||
}
|
||||
|
||||
return z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
468
Scripts/Items/Misc/Key.cs
Normal file
468
Scripts/Items/Misc/Key.cs
Normal file
|
|
@ -0,0 +1,468 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum KeyType
|
||||
{
|
||||
Copper = 0x100E,
|
||||
Gold = 0x100F,
|
||||
Iron = 0x1010,
|
||||
Rusty = 0x1013
|
||||
}
|
||||
|
||||
public interface ILockable
|
||||
{
|
||||
bool Locked{ get; set; }
|
||||
uint KeyValue{ get; set; }
|
||||
}
|
||||
|
||||
public class Key : Item
|
||||
{
|
||||
private string m_Description;
|
||||
private uint m_KeyVal;
|
||||
private Item m_Link;
|
||||
private int m_MaxRange;
|
||||
|
||||
public static uint RandomValue()
|
||||
{
|
||||
return (uint)(0xFFFFFFFE * Utility.RandomDouble()) + 1;
|
||||
}
|
||||
|
||||
public static void RemoveKeys( Mobile m, uint keyValue )
|
||||
{
|
||||
if ( keyValue == 0 )
|
||||
return;
|
||||
|
||||
RemoveKeys( m.Backpack, keyValue );
|
||||
RemoveKeys( m.BankBox, keyValue );
|
||||
}
|
||||
|
||||
public static void RemoveKeys( Container cont, uint keyValue )
|
||||
{
|
||||
if ( cont == null || keyValue == 0 )
|
||||
return;
|
||||
|
||||
Item[] items = cont.FindItemsByType( new Type[] { typeof( Key ), typeof( KeyRing ) } );
|
||||
|
||||
foreach ( Item item in items )
|
||||
{
|
||||
if ( item is Key )
|
||||
{
|
||||
Key key = (Key) item;
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
key.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyRing keyRing = (KeyRing) item;
|
||||
|
||||
keyRing.RemoveKeys( keyValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ContainsKey( Container cont, uint keyValue )
|
||||
{
|
||||
if ( cont == null )
|
||||
return false;
|
||||
|
||||
Item[] items = cont.FindItemsByType( new Type[] { typeof( Key ), typeof( KeyRing ) } );
|
||||
|
||||
foreach ( Item item in items )
|
||||
{
|
||||
if ( item is Key )
|
||||
{
|
||||
Key key = (Key) item;
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyRing keyRing = (KeyRing) item;
|
||||
|
||||
if ( keyRing.ContainsKey( keyValue ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Description;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Description = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MaxRange
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MaxRange;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_MaxRange = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public uint KeyValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_KeyVal;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_KeyVal = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Link
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Link;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_Link = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_MaxRange );
|
||||
|
||||
writer.Write( (Item) m_Link );
|
||||
|
||||
writer.Write( (string) m_Description );
|
||||
writer.Write( (uint) m_KeyVal );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_MaxRange = reader.ReadInt();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Link = reader.ReadItem();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 2 || m_MaxRange == 0 )
|
||||
m_MaxRange = 3;
|
||||
|
||||
m_Description = reader.ReadString();
|
||||
|
||||
m_KeyVal = reader.ReadUInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Key() : this( KeyType.Iron, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Key( KeyType type ) : this( type, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Key( uint val ) : this ( KeyType.Iron, val )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Key( KeyType type, uint LockVal ) : this( type, LockVal, null )
|
||||
{
|
||||
m_KeyVal = LockVal;
|
||||
}
|
||||
|
||||
public Key( KeyType type, uint LockVal, Item link ) : base( (int)type )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_MaxRange = 3;
|
||||
m_KeyVal = LockVal;
|
||||
m_Link = link;
|
||||
}
|
||||
|
||||
public Key( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !this.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501661 ); // That key is unreachable.
|
||||
return;
|
||||
}
|
||||
|
||||
Target t;
|
||||
int number;
|
||||
|
||||
if ( m_KeyVal != 0 )
|
||||
{
|
||||
number = 501662; // What shall I use this key on?
|
||||
t = new UnlockTarget( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501663; // This key is a key blank. Which key would you like to make a copy of?
|
||||
t = new CopyTarget( this );
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( number );
|
||||
from.Target = t;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
string desc;
|
||||
|
||||
if ( m_KeyVal == 0 )
|
||||
desc = "(blank)";
|
||||
else if ( (desc = m_Description) == null || (desc = desc.Trim()).Length <= 0 )
|
||||
desc = null;
|
||||
|
||||
if ( desc != null )
|
||||
list.Add( desc );
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
string desc;
|
||||
|
||||
if ( m_KeyVal == 0 )
|
||||
desc = "(blank)";
|
||||
else if ( (desc = m_Description) == null || (desc = desc.Trim()).Length <= 0 )
|
||||
desc = "";
|
||||
|
||||
if ( desc.Length > 0 )
|
||||
from.Send( new UnicodeMessage( Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", "", desc ) );
|
||||
}
|
||||
|
||||
public bool UseOn( Mobile from, ILockable o )
|
||||
{
|
||||
if ( o.KeyValue == this.KeyValue )
|
||||
{
|
||||
if ( o is BaseDoor && !((BaseDoor)o).UseLocks() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.Locked = !o.Locked;
|
||||
|
||||
if ( o is LockableContainer )
|
||||
{
|
||||
LockableContainer cont = (LockableContainer)o;
|
||||
|
||||
if ( cont.LockLevel == -255 )
|
||||
cont.LockLevel = cont.RequiredSkill - 10;
|
||||
}
|
||||
|
||||
if ( o is Item )
|
||||
{
|
||||
Item item = (Item) o;
|
||||
|
||||
if ( o.Locked )
|
||||
item.SendLocalizedMessageTo( from, 1048000 ); // You lock it.
|
||||
else
|
||||
item.SendLocalizedMessageTo( from, 1048001 ); // You unlock it.
|
||||
|
||||
if ( item is LockableContainer )
|
||||
{
|
||||
LockableContainer cont = (LockableContainer) item;
|
||||
|
||||
if ( cont.TrapType != TrapType.None && cont.TrapOnLockpick )
|
||||
{
|
||||
if ( o.Locked )
|
||||
item.SendLocalizedMessageTo( from, 501673 ); // You re-enable the trap.
|
||||
else
|
||||
item.SendLocalizedMessageTo( from, 501672 ); // You disable the trap temporarily. Lock it again to re-enable it.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class RenamePrompt : Prompt
|
||||
{
|
||||
private Key m_Key;
|
||||
|
||||
public RenamePrompt( Key key )
|
||||
{
|
||||
m_Key = key;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( m_Key.Deleted || !m_Key.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501661 ); // That key is unreachable.
|
||||
return;
|
||||
}
|
||||
|
||||
m_Key.Description = Utility.FixHtml( text );
|
||||
}
|
||||
}
|
||||
|
||||
private class UnlockTarget : Target
|
||||
{
|
||||
private Key m_Key;
|
||||
|
||||
public UnlockTarget( Key key ) : base( key.MaxRange, false, TargetFlags.None )
|
||||
{
|
||||
m_Key = key;
|
||||
CheckLOS = false;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Key.Deleted || !m_Key.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501661 ); // That key is unreachable.
|
||||
return;
|
||||
}
|
||||
|
||||
int number;
|
||||
|
||||
if ( targeted == m_Key )
|
||||
{
|
||||
number = 501665; // Enter a description for this key.
|
||||
|
||||
from.Prompt = new RenamePrompt( m_Key );
|
||||
}
|
||||
else if ( targeted is ILockable )
|
||||
{
|
||||
if ( m_Key.UseOn( from, (ILockable) targeted ) )
|
||||
number = -1;
|
||||
else
|
||||
number = 501668; // This key doesn't seem to unlock that.
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501666; // You can't unlock that!
|
||||
}
|
||||
|
||||
if ( number != -1 )
|
||||
{
|
||||
from.SendLocalizedMessage( number );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CopyTarget : Target
|
||||
{
|
||||
private Key m_Key;
|
||||
|
||||
public CopyTarget( Key key ) : base( 3, false, TargetFlags.None )
|
||||
{
|
||||
m_Key = key;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Key.Deleted || !m_Key.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501661 ); // That key is unreachable.
|
||||
return;
|
||||
}
|
||||
|
||||
int number;
|
||||
|
||||
if ( targeted is Key )
|
||||
{
|
||||
Key k = (Key)targeted;
|
||||
|
||||
if ( k.m_KeyVal == 0 )
|
||||
{
|
||||
number = 501675; // This key is also blank.
|
||||
}
|
||||
else if ( from.CheckTargetSkill( SkillName.Tinkering, k, 0, 75.0 ) )
|
||||
{
|
||||
number = 501676; // You make a copy of the key.
|
||||
|
||||
m_Key.Description = k.Description;
|
||||
m_Key.KeyValue = k.KeyValue;
|
||||
m_Key.Link = k.Link;
|
||||
m_Key.MaxRange = k.MaxRange;
|
||||
}
|
||||
else if ( Utility.RandomDouble() <= 0.1 ) // 10% chance to destroy the key
|
||||
{
|
||||
from.SendLocalizedMessage( 501677 ); // You fail to make a copy of the key.
|
||||
|
||||
number = 501678; // The key was destroyed in the attempt.
|
||||
|
||||
m_Key.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501677; // You fail to make a copy of the key.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 501688; // Not a key.
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( number );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
207
Scripts/Items/Misc/KeyRing.cs
Normal file
207
Scripts/Items/Misc/KeyRing.cs
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class KeyRing : Item
|
||||
{
|
||||
public static readonly int MaxKeys = 20;
|
||||
|
||||
private List<Key> m_Keys;
|
||||
|
||||
public List<Key> Keys { get { return m_Keys; } }
|
||||
|
||||
[Constructable]
|
||||
public KeyRing() : base( 0x1011 )
|
||||
{
|
||||
Weight = 1.0; // They seem to have no weight on OSI ?!
|
||||
|
||||
m_Keys = new List<Key>();
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( !this.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060640 ); // The item must be in your backpack to use it.
|
||||
return false;
|
||||
}
|
||||
|
||||
Key key = dropped as Key;
|
||||
|
||||
if ( key == null || key.KeyValue == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 501689 ); // Only non-blank keys can be put on a keyring.
|
||||
return false;
|
||||
}
|
||||
else if ( this.Keys.Count >= MaxKeys )
|
||||
{
|
||||
from.SendLocalizedMessage( 1008138 ); // This keyring is full.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Add( key );
|
||||
from.SendLocalizedMessage( 501691 ); // You put the key on the keyring.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !this.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060640 ); // The item must be in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 501680 ); // What do you want to unlock?
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private KeyRing m_KeyRing;
|
||||
|
||||
public InternalTarget( KeyRing keyRing ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_KeyRing = keyRing;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_KeyRing.Deleted || !m_KeyRing.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060640 ); // The item must be in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_KeyRing == targeted )
|
||||
{
|
||||
m_KeyRing.Open( from );
|
||||
from.SendLocalizedMessage( 501685 ); // You open the keyring.
|
||||
}
|
||||
else if ( targeted is ILockable )
|
||||
{
|
||||
ILockable o = (ILockable) targeted;
|
||||
|
||||
foreach ( Key key in m_KeyRing.Keys )
|
||||
{
|
||||
if ( key.UseOn( from, o ) )
|
||||
return;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1008140 ); // You do not have a key for that.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 501666 ); // You can't unlock that!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
foreach ( Key key in m_Keys )
|
||||
{
|
||||
key.Delete();
|
||||
}
|
||||
|
||||
m_Keys.Clear();
|
||||
}
|
||||
|
||||
public void Add( Key key )
|
||||
{
|
||||
key.Internalize();
|
||||
m_Keys.Add( key );
|
||||
|
||||
UpdateItemID();
|
||||
}
|
||||
|
||||
public void Open( Mobile from )
|
||||
{
|
||||
Container cont = this.Parent as Container;
|
||||
|
||||
if ( cont == null )
|
||||
return;
|
||||
|
||||
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
Key key = m_Keys[i];
|
||||
|
||||
if ( !key.Deleted && !cont.TryDropItem( from, key, true ) )
|
||||
break;
|
||||
|
||||
m_Keys.RemoveAt( i );
|
||||
}
|
||||
|
||||
UpdateItemID();
|
||||
}
|
||||
|
||||
public void RemoveKeys( uint keyValue )
|
||||
{
|
||||
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
Key key = m_Keys[i];
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
{
|
||||
key.Delete();
|
||||
m_Keys.RemoveAt( i );
|
||||
}
|
||||
}
|
||||
|
||||
UpdateItemID();
|
||||
}
|
||||
|
||||
public bool ContainsKey( uint keyValue )
|
||||
{
|
||||
foreach ( Key key in m_Keys )
|
||||
{
|
||||
if ( key.KeyValue == keyValue )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateItemID()
|
||||
{
|
||||
if ( this.Keys.Count < 1 )
|
||||
this.ItemID = 0x1011;
|
||||
else if ( this.Keys.Count < 3 )
|
||||
this.ItemID = 0x1769;
|
||||
else if ( this.Keys.Count < 5 )
|
||||
this.ItemID = 0x176A;
|
||||
else
|
||||
this.ItemID = 0x176B;
|
||||
}
|
||||
|
||||
public KeyRing( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteItemList<Key>( m_Keys );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Keys = reader.ReadStrongItemList<Key>();
|
||||
}
|
||||
}
|
||||
}
|
||||
119
Scripts/Items/Misc/LOSBlocker.cs
Normal file
119
Scripts/Items/Misc/LOSBlocker.cs
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LOSBlocker : Item
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
TileData.ItemTable[0x21A2].Flags = TileFlag.Wall | TileFlag.NoShoot;
|
||||
TileData.ItemTable[0x21A2].Height = 20;
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "no line of sight"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LOSBlocker() : base( 0x21A2 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public LOSBlocker( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
protected override Packet GetWorldPacketFor( NetState state ) {
|
||||
Mobile mob = state.Mobile;
|
||||
|
||||
if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster ) {
|
||||
return new GMItemPacket( this );
|
||||
}
|
||||
|
||||
return base.GetWorldPacketFor( state );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && ItemID == 0x2199 )
|
||||
this.ItemID = 0x21A2;
|
||||
}
|
||||
|
||||
public sealed class GMItemPacket : Packet
|
||||
{
|
||||
public GMItemPacket( Item item ) : base( 0x1A )
|
||||
{
|
||||
this.EnsureCapacity( 20 );
|
||||
|
||||
// 14 base length
|
||||
// +2 - Amount
|
||||
// +2 - Hue
|
||||
// +1 - Flags
|
||||
|
||||
uint serial = (uint)item.Serial.Value;
|
||||
int itemID = 0x36FF;
|
||||
int amount = item.Amount;
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.X;
|
||||
int y = loc.Y;
|
||||
int hue = item.Hue;
|
||||
int flags = item.GetPacketFlags();
|
||||
int direction = (int)item.Direction;
|
||||
|
||||
if ( amount != 0 )
|
||||
serial |= 0x80000000;
|
||||
else
|
||||
serial &= 0x7FFFFFFF;
|
||||
|
||||
m_Stream.Write( (uint) serial );
|
||||
m_Stream.Write( (short) (itemID & 0x7FFF) );
|
||||
|
||||
if ( amount != 0 )
|
||||
m_Stream.Write( (short) amount );
|
||||
|
||||
x &= 0x7FFF;
|
||||
|
||||
if ( direction != 0 )
|
||||
x |= 0x8000;
|
||||
|
||||
m_Stream.Write( (short) x );
|
||||
|
||||
y &= 0x3FFF;
|
||||
|
||||
if ( hue != 0 )
|
||||
y |= 0x8000;
|
||||
|
||||
if ( flags != 0 )
|
||||
y |= 0x4000;
|
||||
|
||||
m_Stream.Write( (short) y );
|
||||
|
||||
if ( direction != 0 )
|
||||
m_Stream.Write( (byte) direction );
|
||||
|
||||
m_Stream.Write( (sbyte) loc.Z );
|
||||
|
||||
if ( hue != 0 )
|
||||
m_Stream.Write( (ushort) hue );
|
||||
|
||||
if ( flags != 0 )
|
||||
m_Stream.Write( (byte) flags );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Scripts/Items/Misc/Labyrinth/MinotaurArtifact.cs
Normal file
39
Scripts/Items/Misc/Labyrinth/MinotaurArtifact.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MinotaurArtifact : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074826; } } // Minotaur Artifact
|
||||
public override double DefaultWeight{ get{ return 5.0; } }
|
||||
|
||||
[Constructable]
|
||||
public MinotaurArtifact() : base( Utility.RandomList( 0xB46, 0xB48, 0x9ED ) )
|
||||
{
|
||||
if ( ItemID == 0x9ED )
|
||||
Weight = 30;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x100;
|
||||
}
|
||||
|
||||
public MinotaurArtifact( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
203
Scripts/Items/Misc/Moonstone.cs
Normal file
203
Scripts/Items/Misc/Moonstone.cs
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum MoonstoneType
|
||||
{
|
||||
Felucca, Trammel
|
||||
}
|
||||
|
||||
public class Moonstone : Item
|
||||
{
|
||||
private MoonstoneType m_Type;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public MoonstoneType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1041490 + (int)m_Type; } }
|
||||
|
||||
[Constructable]
|
||||
public Moonstone( MoonstoneType type ) : base( 0xF8B )
|
||||
{
|
||||
Weight = 1.0;
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
public Moonstone( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
Hue = Utility.RandomBirdHue();
|
||||
ProcessDelta();
|
||||
from.SendLocalizedMessage( 1005398 ); // The stone's substance shifts as you examine it.
|
||||
}
|
||||
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( from.Mounted )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005399 ); // You can not bury a stone while you sit on a mount.
|
||||
}
|
||||
else if ( !from.Body.IsHuman )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005400 ); // You can not bury a stone in this form.
|
||||
}
|
||||
else if ( Factions.Sigil.ExistsOn( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
|
||||
}
|
||||
else if ( from.Map == GetTargetMap() || ( from.Map != Map.Trammel && from.Map != Map.Felucca ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005401 ); // You cannot bury the stone here.
|
||||
}
|
||||
else if ( from is PlayerMobile && ((PlayerMobile)from).Young )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
|
||||
}
|
||||
else if ( from.Kills >= 5 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005402 ); // The magic of the stone cannot be evoked by someone with blood on their hands.
|
||||
}
|
||||
else if ( from.Criminal )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005403 ); // The magic of the stone cannot be evoked by the lawless.
|
||||
}
|
||||
else if ( !Region.Find( from.Location, from.Map ).IsDefault || !Region.Find( from.Location, GetTargetMap() ).IsDefault )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005401 ); // You cannot bury the stone here.
|
||||
}
|
||||
else if ( !GetTargetMap().CanFit( from.Location, 16 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005408 ); // Something is blocking the facet gate exit.
|
||||
}
|
||||
else
|
||||
{
|
||||
Movable = false;
|
||||
MoveToWorld( from.Location, from.Map );
|
||||
|
||||
from.Animate( 32, 5, 1, true, false, 0 );
|
||||
|
||||
new SettleTimer( this, from.Location, from.Map, GetTargetMap(), from ).Start();
|
||||
}
|
||||
}
|
||||
|
||||
public Map GetTargetMap()
|
||||
{
|
||||
return ( m_Type == MoonstoneType.Felucca ) ? Map.Felucca : Map.Trammel;
|
||||
}
|
||||
|
||||
private class SettleTimer : Timer
|
||||
{
|
||||
private Item m_Stone;
|
||||
private Point3D m_Location;
|
||||
private Map m_Map, m_TargetMap;
|
||||
private Mobile m_Caster;
|
||||
private int m_Count;
|
||||
|
||||
public SettleTimer( Item stone, Point3D loc, Map map, Map targetMap, Mobile caster ) : base( TimeSpan.FromSeconds( 2.5 ), TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Stone = stone;
|
||||
|
||||
m_Location = loc;
|
||||
m_Map = map;
|
||||
m_TargetMap = targetMap;
|
||||
|
||||
m_Caster = caster;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
++m_Count;
|
||||
|
||||
if ( m_Count == 1 )
|
||||
{
|
||||
m_Stone.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1005414 ); // The stone settles into the ground.
|
||||
}
|
||||
else if ( m_Count >= 10 )
|
||||
{
|
||||
m_Stone.Location = new Point3D( m_Stone.X, m_Stone.Y, m_Stone.Z - 1 );
|
||||
|
||||
if ( m_Count == 16 )
|
||||
{
|
||||
if ( !Region.Find( m_Location, m_Map ).IsDefault || !Region.Find( m_Location, m_TargetMap ).IsDefault )
|
||||
{
|
||||
m_Stone.Movable = true;
|
||||
m_Caster.AddToBackpack( m_Stone );
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
else if ( !m_TargetMap.CanFit( m_Location, 16 ) )
|
||||
{
|
||||
m_Stone.Movable = true;
|
||||
m_Caster.AddToBackpack( m_Stone );
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
int hue = m_Stone.Hue;
|
||||
|
||||
if ( hue == 0 )
|
||||
hue = Utility.RandomBirdHue();
|
||||
|
||||
new MoonstoneGate( m_Location, m_TargetMap, m_Map, m_Caster, hue );
|
||||
new MoonstoneGate( m_Location, m_Map, m_TargetMap, m_Caster, hue );
|
||||
|
||||
m_Stone.Delete();
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (int) m_Type );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Type = (MoonstoneType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
Scripts/Items/Misc/MoonstoneGate.cs
Normal file
85
Scripts/Items/Misc/MoonstoneGate.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Engines.PartySystem;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MoonstoneGate : Moongate
|
||||
{
|
||||
private Mobile m_Caster;
|
||||
|
||||
public MoonstoneGate( Point3D loc, Map map, Map targetMap, Mobile caster, int hue ) : base( loc, targetMap )
|
||||
{
|
||||
MoveToWorld( loc, map );
|
||||
Dispellable = false;
|
||||
Hue = hue;
|
||||
|
||||
m_Caster = caster;
|
||||
|
||||
new InternalTimer( this ).Start();
|
||||
|
||||
Effects.PlaySound( loc, map, 0x20E );
|
||||
}
|
||||
|
||||
public MoonstoneGate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void CheckGate( Mobile m, int range )
|
||||
{
|
||||
if ( m.Kills >= 5 )
|
||||
return;
|
||||
|
||||
Party casterParty = Party.Get( m_Caster );
|
||||
Party userParty = Party.Get( m );
|
||||
|
||||
if ( m == m_Caster || (casterParty != null && userParty == casterParty) )
|
||||
base.CheckGate( m, range );
|
||||
}
|
||||
|
||||
public override void UseGate( Mobile m )
|
||||
{
|
||||
if ( m.Kills >= 5 )
|
||||
return;
|
||||
|
||||
Party casterParty = Party.Get( m_Caster );
|
||||
Party userParty = Party.Get( m );
|
||||
|
||||
if ( m == m_Caster || (casterParty != null && userParty == casterParty) )
|
||||
base.UseGate( m );
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public InternalTimer( Item item ) : base( TimeSpan.FromSeconds( 30.0 ) )
|
||||
{
|
||||
m_Item = item;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
146
Scripts/Items/Misc/MorphItem.cs
Normal file
146
Scripts/Items/Misc/MorphItem.cs
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MorphItem : Item
|
||||
{
|
||||
private int m_InactiveItemID;
|
||||
private int m_ActiveItemID;
|
||||
private int m_InRange;
|
||||
private int m_OutRange;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int InactiveItemID
|
||||
{
|
||||
get{ return m_InactiveItemID; }
|
||||
set{ m_InactiveItemID = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ActiveItemID
|
||||
{
|
||||
get{ return m_ActiveItemID; }
|
||||
set{ m_ActiveItemID = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int InRange
|
||||
{
|
||||
get{ return m_InRange; }
|
||||
set{ if ( value > 18 ) value = 18; m_InRange = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int OutRange
|
||||
{
|
||||
get{ return m_OutRange; }
|
||||
set{ if ( value > 18 ) value = 18; m_OutRange = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int CurrentRange{ get{ return ItemID == InactiveItemID ? InRange : OutRange; } }
|
||||
|
||||
[Constructable]
|
||||
public MorphItem( int inactiveItemID, int activeItemID, int range ) : this( inactiveItemID, activeItemID, range, range )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public MorphItem( int inactiveItemID, int activeItemID, int inRange, int outRange ) : base( inactiveItemID )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
InactiveItemID = inactiveItemID;
|
||||
ActiveItemID = activeItemID;
|
||||
InRange = inRange;
|
||||
OutRange = outRange;
|
||||
}
|
||||
|
||||
public MorphItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return true; } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( Utility.InRange( m.Location, Location, CurrentRange ) || Utility.InRange( oldLocation, Location, CurrentRange ) )
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
if ( !Deleted )
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public override void OnLocationChange( Point3D oldLoc )
|
||||
{
|
||||
if ( !Deleted )
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
foreach ( Mobile mob in GetMobilesInRange( CurrentRange ) )
|
||||
{
|
||||
if ( mob.Hidden && mob.AccessLevel > AccessLevel.Player )
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( found )
|
||||
ItemID = ActiveItemID;
|
||||
else
|
||||
ItemID = InactiveItemID;
|
||||
|
||||
Visible = ( ItemID != 0x1 );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_OutRange );
|
||||
|
||||
writer.Write( (int) m_InactiveItemID );
|
||||
writer.Write( (int) m_ActiveItemID );
|
||||
writer.Write( (int) m_InRange );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_OutRange = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_InactiveItemID = reader.ReadInt();
|
||||
m_ActiveItemID = reader.ReadInt();
|
||||
m_InRange = reader.ReadInt();
|
||||
|
||||
if ( version < 1 )
|
||||
m_OutRange = m_InRange;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Refresh ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
154
Scripts/Items/Misc/OilCloth.cs
Normal file
154
Scripts/Items/Misc/OilCloth.cs
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class OilCloth : Item, IScissorable, IDyable
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041498; } } // oil cloth
|
||||
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get { return 1.0; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public OilCloth() : base( 0x175D )
|
||||
{
|
||||
Hue = 2001;
|
||||
}
|
||||
|
||||
public bool Dye( Mobile from, DyeTub sender )
|
||||
{
|
||||
if ( Deleted )
|
||||
return false;
|
||||
|
||||
Hue = sender.DyedHue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Scissor( Mobile from, Scissors scissors )
|
||||
{
|
||||
if ( Deleted || !from.CanSee( this ) )
|
||||
return false;
|
||||
|
||||
base.ScissorHelper( from, new Bandage(), 1 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
|
||||
from.SendLocalizedMessage( 1005424 ); // Select the weapon or armor you wish to use the cloth on.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTarget( Mobile from, object obj )
|
||||
{
|
||||
// TODO: Need details on how oil cloths should get consumed here
|
||||
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( obj is Item && ((Item)obj).RootParent != from )
|
||||
{
|
||||
from.SendLocalizedMessage( 1005425 ); // You may only wipe down items you are holding or carrying.
|
||||
}
|
||||
else if ( obj is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)obj;
|
||||
|
||||
if ( weapon.Poison == null || weapon.PoisonCharges <= 0 )
|
||||
{
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1005422 ); // Hmmmm... this does not need to be cleaned.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( weapon.PoisonCharges < 2 )
|
||||
weapon.PoisonCharges = 0;
|
||||
else
|
||||
weapon.PoisonCharges -= 2;
|
||||
|
||||
if ( weapon.PoisonCharges > 0 )
|
||||
from.SendLocalizedMessage( 1005423 ); // You have removed some of the caustic substance, but not all.
|
||||
else
|
||||
from.SendLocalizedMessage( 1010497 ); // You have cleaned the item.
|
||||
}
|
||||
}
|
||||
else if ( obj == from && obj is PlayerMobile )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)obj;
|
||||
|
||||
if ( pm.BodyMod == 183 || pm.BodyMod == 184 )
|
||||
{
|
||||
pm.SavagePaintExpiration = TimeSpan.Zero;
|
||||
|
||||
pm.BodyMod = 0;
|
||||
pm.HueMod = -1;
|
||||
|
||||
from.SendLocalizedMessage( 1040006 ); // You wipe away all of your body paint.
|
||||
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1005422 ); // Hmmmm... this does not need to be cleaned.
|
||||
}
|
||||
}
|
||||
#region Firebomb
|
||||
else if ( obj is BaseBeverage )
|
||||
{
|
||||
BaseBeverage beverage = (BaseBeverage) obj;
|
||||
|
||||
if ( beverage.Content == BeverageType.Liquor )
|
||||
{
|
||||
Firebomb bomb = new Firebomb( beverage.ItemID );
|
||||
bomb.Name = beverage.Name;
|
||||
|
||||
beverage.ReplaceWith( bomb );
|
||||
|
||||
from.SendLocalizedMessage( 1060580 ); // You prepare a firebomb.
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
else if ( obj is Firebomb )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060579 ); // That is already a firebomb!
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1005426 ); // The cloth will not work on that.
|
||||
}
|
||||
}
|
||||
|
||||
public OilCloth( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
247
Scripts/Items/Misc/Origami.cs
Normal file
247
Scripts/Items/Misc/Origami.cs
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class OrigamiPaper : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030288; } } // origami paper
|
||||
|
||||
[Constructable]
|
||||
public OrigamiPaper() : base( 0x2830 )
|
||||
{
|
||||
}
|
||||
|
||||
public OrigamiPaper( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Delete();
|
||||
|
||||
Item i = null;
|
||||
|
||||
switch ( Utility.Random( (from.BAC >= 5) ? 6 : 5) )
|
||||
{
|
||||
case 0: i = new OrigamiButterfly(); break;
|
||||
case 1: i = new OrigamiSwan(); break;
|
||||
case 2: i = new OrigamiFrog(); break;
|
||||
case 3: i = new OrigamiShape(); break;
|
||||
case 4: i = new OrigamiSongbird(); break;
|
||||
case 5: i = new OrigamiFish(); break;
|
||||
}
|
||||
|
||||
if( i != null )
|
||||
from.AddToBackpack( i );
|
||||
|
||||
from.SendLocalizedMessage( 1070822 ); // You fold the paper into an interesting shape.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiButterfly : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030296; } } // a delicate origami butterfly
|
||||
|
||||
[Constructable]
|
||||
public OrigamiButterfly() : base( 0x2838 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public OrigamiButterfly( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiSwan : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030297; } } // a delicate origami swan
|
||||
|
||||
[Constructable]
|
||||
public OrigamiSwan() : base( 0x2839 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OrigamiSwan( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiFrog : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030298; } } // a delicate origami frog
|
||||
|
||||
[Constructable]
|
||||
public OrigamiFrog() : base( 0x283A )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OrigamiFrog( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiShape : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030299; } } // an intricate geometric origami shape
|
||||
|
||||
[Constructable]
|
||||
public OrigamiShape() : base( 0x283B )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OrigamiShape( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiSongbird : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030300; } } // a delicate origami songbird
|
||||
|
||||
[Constructable]
|
||||
public OrigamiSongbird() : base( 0x283C )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OrigamiSongbird( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class OrigamiFish : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030301; } } // a delicate origami fish
|
||||
|
||||
[Constructable]
|
||||
public OrigamiFish() : base( 0x283D )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OrigamiFish( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Scripts/Items/Misc/Painted Caves/GrobusFur.cs
Normal file
35
Scripts/Items/Misc/Painted Caves/GrobusFur.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GrobusFur : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074676; } } // Grobu's Fur
|
||||
|
||||
[Constructable]
|
||||
public GrobusFur() : base( 0x11F4 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x455;
|
||||
}
|
||||
|
||||
public GrobusFur( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/Painted Caves/PrimitiveFetish.cs
Normal file
35
Scripts/Items/Misc/Painted Caves/PrimitiveFetish.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PrimitiveFetish : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074675; } } // Primitive Fetish
|
||||
|
||||
[Constructable]
|
||||
public PrimitiveFetish() : base( 0x23F )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x244;
|
||||
}
|
||||
|
||||
public PrimitiveFetish( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/Palace of Paroxysmus/AcidProofRope.cs
Normal file
35
Scripts/Items/Misc/Palace of Paroxysmus/AcidProofRope.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AcidProofRope : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074886; } } // Acid Proof Rope
|
||||
|
||||
[Constructable]
|
||||
public AcidProofRope() : base( 0x20D )
|
||||
{
|
||||
Hue = 0x3D1; // TODO check
|
||||
}
|
||||
|
||||
public AcidProofRope( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ParoxysmusCorrodedStein : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072083; } } // Paroxysmus' Corroded Stein
|
||||
|
||||
[Constructable]
|
||||
public ParoxysmusCorrodedStein() : base( 0x9D6 )
|
||||
{
|
||||
}
|
||||
|
||||
public ParoxysmusCorrodedStein( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Palace of Paroxysmus/ParoxysmusDinner.cs
Normal file
34
Scripts/Items/Misc/Palace of Paroxysmus/ParoxysmusDinner.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ParoxysmusDinner : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072086; } } // Paroxysmus' Dinner
|
||||
|
||||
[Constructable]
|
||||
public ParoxysmusDinner() : base( 0x1E95 )
|
||||
{
|
||||
}
|
||||
|
||||
public ParoxysmusDinner( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StringOfPartsOfParoxysmusVictims : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072082; } } // String of Parts of Paroxysmus' Victims
|
||||
|
||||
[Constructable]
|
||||
public StringOfPartsOfParoxysmusVictims() : base( 0xFD2 )
|
||||
{
|
||||
}
|
||||
|
||||
public StringOfPartsOfParoxysmusVictims( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Palace of Paroxysmus/SweatOfParoxysmus.cs
Normal file
34
Scripts/Items/Misc/Palace of Paroxysmus/SweatOfParoxysmus.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SweatOfParoxysmus : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072081; } } // Sweat of Paroxysmus
|
||||
|
||||
[Constructable]
|
||||
public SweatOfParoxysmus() : base( 0xF01 )
|
||||
{
|
||||
}
|
||||
|
||||
public SweatOfParoxysmus( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
640
Scripts/Items/Misc/PlayerBulletinBoards.cs
Normal file
640
Scripts/Items/Misc/PlayerBulletinBoards.cs
Normal file
|
|
@ -0,0 +1,640 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PlayerBBSouth : BasePlayerBB
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1062421; } } // bulletin board (south)
|
||||
|
||||
[Constructable]
|
||||
public PlayerBBSouth() : base( 0x2311 )
|
||||
{
|
||||
Weight = 15.0;
|
||||
}
|
||||
|
||||
public PlayerBBSouth( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerBBEast : BasePlayerBB
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1062420; } } // bulletin board (east)
|
||||
|
||||
[Constructable]
|
||||
public PlayerBBEast() : base( 0x2312 )
|
||||
{
|
||||
Weight = 15.0;
|
||||
}
|
||||
|
||||
public PlayerBBEast( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BasePlayerBB : Item, ISecurable
|
||||
{
|
||||
private PlayerBBMessage m_Greeting;
|
||||
private List<PlayerBBMessage> m_Messages;
|
||||
private string m_Title;
|
||||
private SecureLevel m_Level;
|
||||
|
||||
public List<PlayerBBMessage> Messages
|
||||
{
|
||||
get{ return m_Messages; }
|
||||
}
|
||||
|
||||
public PlayerBBMessage Greeting
|
||||
{
|
||||
get{ return m_Greeting; }
|
||||
set{ m_Greeting = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title
|
||||
{
|
||||
get{ return m_Title; }
|
||||
set{ m_Title = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get{ return m_Level; }
|
||||
set{ m_Level = value; }
|
||||
}
|
||||
|
||||
public BasePlayerBB( int itemID ) : base( itemID )
|
||||
{
|
||||
m_Messages = new List<PlayerBBMessage>();
|
||||
m_Level = SecureLevel.Anyone;
|
||||
}
|
||||
|
||||
public BasePlayerBB( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
|
||||
writer.Write( m_Title );
|
||||
|
||||
if ( m_Greeting != null )
|
||||
{
|
||||
writer.Write( true );
|
||||
m_Greeting.Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write( false );
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( m_Messages.Count );
|
||||
|
||||
for ( int i = 0; i < m_Messages.Count; ++i )
|
||||
m_Messages[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 1 )
|
||||
m_Level = SecureLevel.Anyone;
|
||||
|
||||
m_Title = reader.ReadString();
|
||||
|
||||
if ( reader.ReadBool() )
|
||||
m_Greeting = new PlayerBBMessage( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Messages = new List<PlayerBBMessage>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
m_Messages.Add( new PlayerBBMessage( reader ) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckAccess( BaseHouse house, Mobile from )
|
||||
{
|
||||
if ( house.Public || !house.IsAosRules )
|
||||
return !house.IsBanned( from );
|
||||
|
||||
return house.HasAccess( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
if ( house == null || !house.IsLockedDown( this ) )
|
||||
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
|
||||
else if ( !from.InRange( this.GetWorldLocation(), 2 ) || !from.InLOS( this ) )
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( CheckAccess( house, from ) )
|
||||
from.SendGump( new PlayerBBGump( from, house, this, 0 ) );
|
||||
}
|
||||
|
||||
public class PostPrompt : Prompt
|
||||
{
|
||||
private int m_Page;
|
||||
private BaseHouse m_House;
|
||||
private BasePlayerBB m_Board;
|
||||
private bool m_Greeting;
|
||||
|
||||
public PostPrompt( int page, BaseHouse house, BasePlayerBB board, bool greeting )
|
||||
{
|
||||
m_Page = page;
|
||||
m_House = house;
|
||||
m_Board = board;
|
||||
m_Greeting = greeting;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
OnResponse( from, "" );
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
int page = m_Page;
|
||||
BaseHouse house = m_House;
|
||||
BasePlayerBB board = m_Board;
|
||||
|
||||
if ( house == null || !house.IsLockedDown( board ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
|
||||
return;
|
||||
}
|
||||
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
else if ( !CheckAccess( house, from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
|
||||
return;
|
||||
}
|
||||
else if ( m_Greeting && !house.IsOwner( from ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 255 )
|
||||
text = text.Substring( 0, 255 );
|
||||
|
||||
if ( text.Length > 0 )
|
||||
{
|
||||
PlayerBBMessage message = new PlayerBBMessage( DateTime.UtcNow, from, text );
|
||||
|
||||
if ( m_Greeting )
|
||||
{
|
||||
board.Greeting = message;
|
||||
}
|
||||
else
|
||||
{
|
||||
board.Messages.Add( message );
|
||||
|
||||
if ( board.Messages.Count > 50 )
|
||||
{
|
||||
board.Messages.RemoveAt( 0 );
|
||||
|
||||
if ( page > 0 )
|
||||
--page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
}
|
||||
}
|
||||
|
||||
public class SetTitlePrompt : Prompt
|
||||
{
|
||||
private int m_Page;
|
||||
private BaseHouse m_House;
|
||||
private BasePlayerBB m_Board;
|
||||
|
||||
public SetTitlePrompt( int page, BaseHouse house, BasePlayerBB board )
|
||||
{
|
||||
m_Page = page;
|
||||
m_House = house;
|
||||
m_Board = board;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
OnResponse( from, "" );
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
int page = m_Page;
|
||||
BaseHouse house = m_House;
|
||||
BasePlayerBB board = m_Board;
|
||||
|
||||
if ( house == null || !house.IsLockedDown( board ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
|
||||
return;
|
||||
}
|
||||
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
else if ( !CheckAccess( house, from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
|
||||
return;
|
||||
}
|
||||
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 255 )
|
||||
text = text.Substring( 0, 255 );
|
||||
|
||||
if ( text.Length > 0 )
|
||||
board.Title = text;
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerBBMessage
|
||||
{
|
||||
private DateTime m_Time;
|
||||
private Mobile m_Poster;
|
||||
private string m_Message;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Time
|
||||
{
|
||||
get{ return m_Time; }
|
||||
set{ m_Time = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Poster
|
||||
{
|
||||
get{ return m_Poster; }
|
||||
set{ m_Poster = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Message
|
||||
{
|
||||
get{ return m_Message; }
|
||||
set{ m_Message = value; }
|
||||
}
|
||||
|
||||
public PlayerBBMessage( DateTime time, Mobile poster, string message )
|
||||
{
|
||||
m_Time = time;
|
||||
m_Poster = poster;
|
||||
m_Message = message;
|
||||
}
|
||||
|
||||
public PlayerBBMessage( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Time = reader.ReadDateTime();
|
||||
m_Poster = reader.ReadMobile();
|
||||
m_Message = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_Time );
|
||||
writer.Write( m_Poster );
|
||||
writer.Write( m_Message );
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerBBGump : Gump
|
||||
{
|
||||
private int m_Page;
|
||||
private Mobile m_From;
|
||||
private BaseHouse m_House;
|
||||
private BasePlayerBB m_Board;
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private const int LabelHue = 1153;
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
int page = m_Page;
|
||||
Mobile from = m_From;
|
||||
BaseHouse house = m_House;
|
||||
BasePlayerBB board = m_Board;
|
||||
|
||||
if ( house == null || !house.IsLockedDown( board ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
|
||||
return;
|
||||
}
|
||||
else if ( !from.InRange( board.GetWorldLocation(), 2 ) || !from.InLOS( board ) )
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
return;
|
||||
}
|
||||
else if ( !BasePlayerBB.CheckAccess( house, from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1: // Post message
|
||||
{
|
||||
from.Prompt = new BasePlayerBB.PostPrompt( page, house, board, false );
|
||||
from.SendLocalizedMessage( 1062397 ); // Please enter your message:
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set title
|
||||
{
|
||||
if ( house.IsOwner( from ) )
|
||||
{
|
||||
from.Prompt = new BasePlayerBB.SetTitlePrompt( page, house, board );
|
||||
from.SendLocalizedMessage( 1062402 ); // Enter new title:
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Post greeting
|
||||
{
|
||||
if ( house.IsOwner( from ) )
|
||||
{
|
||||
from.Prompt = new BasePlayerBB.PostPrompt( page, house, board, true );
|
||||
from.SendLocalizedMessage( 1062404 ); // Enter new greeting (this will always be the first post):
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Scroll up
|
||||
{
|
||||
if ( page == 0 )
|
||||
page = board.Messages.Count;
|
||||
else
|
||||
page -= 1;
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Scroll down
|
||||
{
|
||||
page += 1;
|
||||
page %= board.Messages.Count + 1;
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Banish poster
|
||||
{
|
||||
if ( house.IsOwner( from ) )
|
||||
{
|
||||
if ( page >= 1 && page <= board.Messages.Count )
|
||||
{
|
||||
PlayerBBMessage message = (PlayerBBMessage)board.Messages[page - 1];
|
||||
Mobile poster = message.Poster;
|
||||
|
||||
if ( poster == null )
|
||||
{
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( poster.AccessLevel > AccessLevel.Player && from.AccessLevel <= poster.AccessLevel )
|
||||
{
|
||||
from.SendLocalizedMessage( 501354 ); // Uh oh...a bigger boot may be required.
|
||||
}
|
||||
else if ( house.IsFriend( poster ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1060750 ); // That person is a friend, co-owner, or owner of this house, and therefore cannot be banished!
|
||||
}
|
||||
else if ( poster is PlayerVendor )
|
||||
{
|
||||
from.SendLocalizedMessage( 501351 ); // You cannot eject a vendor.
|
||||
}
|
||||
else if ( house.Bans.Count >= BaseHouse.MaxBans )
|
||||
{
|
||||
from.SendLocalizedMessage( 501355 ); // The ban limit for this house has been reached!
|
||||
}
|
||||
else if ( house.IsBanned( poster ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501356 ); // This person is already banned!
|
||||
}
|
||||
else if ( poster is BaseCreature && ((BaseCreature)poster).NoHouseRestrictions )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062040 ); // You cannot ban that.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !house.Bans.Contains( poster ) )
|
||||
house.Bans.Add( poster );
|
||||
|
||||
from.SendLocalizedMessage( 1062417 ); // That person has been banned from this house.
|
||||
|
||||
if ( house.IsInside( poster ) && !BasePlayerBB.CheckAccess( house, poster ) )
|
||||
poster.MoveToWorld( house.BanLocation, house.Map );
|
||||
}
|
||||
}
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: // Delete message
|
||||
{
|
||||
if ( house.IsOwner( from ) )
|
||||
{
|
||||
if ( page >= 1 && page <= board.Messages.Count )
|
||||
board.Messages.RemoveAt( page - 1 );
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, 0 ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Post props
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
PlayerBBMessage message = board.Greeting;
|
||||
|
||||
if ( page >= 1 && page <= board.Messages.Count )
|
||||
message = (PlayerBBMessage)board.Messages[page - 1];
|
||||
|
||||
from.SendGump( new PlayerBBGump( from, house, board, page ) );
|
||||
from.SendGump( new PropertiesGump( from, message ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerBBGump( Mobile from, BaseHouse house, BasePlayerBB board, int page ) : base( 50, 10 )
|
||||
{
|
||||
from.CloseGump( typeof( PlayerBBGump ) );
|
||||
|
||||
m_Page = page;
|
||||
m_From = from;
|
||||
m_House = house;
|
||||
m_Board = board;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddImage( 30, 30, 5400 );
|
||||
|
||||
AddButton( 393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0 ); // Scroll up
|
||||
AddButton( 390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0 ); // Scroll down
|
||||
|
||||
AddButton( 32, 183, 5412, 5413, 1, GumpButtonType.Reply, 0 ); // Post message
|
||||
|
||||
if ( house.IsOwner( from ) )
|
||||
{
|
||||
AddButton( 63, 90, 5601, 5605, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 81, 89, 230, 20, 1062400, LabelColor, false, false ); // Set title
|
||||
|
||||
AddButton( 63, 109, 5601, 5605, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 81, 108, 230, 20, 1062401, LabelColor, false, false ); // Post greeting
|
||||
}
|
||||
|
||||
string title = board.Title;
|
||||
|
||||
if ( title != null )
|
||||
AddHtml( 183, 68, 180, 23, title, false, false );
|
||||
|
||||
AddHtmlLocalized( 385, 89, 60, 20, 1062409, LabelColor, false, false ); // Post
|
||||
|
||||
AddLabel( 440, 89, LabelHue, page.ToString() );
|
||||
AddLabel( 455, 89, LabelHue, "/" );
|
||||
AddLabel( 470, 89, LabelHue, board.Messages.Count.ToString() );
|
||||
|
||||
PlayerBBMessage message = board.Greeting;
|
||||
|
||||
if ( page >= 1 && page <= board.Messages.Count )
|
||||
message = (PlayerBBMessage)board.Messages[page - 1];
|
||||
|
||||
AddImageTiled( 150, 220, 240, 1, 2700 ); // Separator
|
||||
|
||||
AddHtmlLocalized( 150, 180, 100, 20, 1062405, 16715, false, false ); // Posted On:
|
||||
AddHtmlLocalized( 150, 200, 100, 20, 1062406, 16715, false, false ); // Posted By:
|
||||
|
||||
if ( message != null )
|
||||
{
|
||||
AddHtml( 255, 180, 150, 20, message.Time.ToString( "yyyy-MM-dd HH:mm:ss" ), false, false );
|
||||
|
||||
Mobile poster = message.Poster;
|
||||
string name = ( poster == null ? null : poster.Name );
|
||||
|
||||
if ( name == null || (name = name.Trim()).Length == 0 )
|
||||
name = "Someone";
|
||||
|
||||
AddHtml( 255, 200, 150, 20, name, false, false );
|
||||
|
||||
string body = message.Message;
|
||||
|
||||
if ( body == null )
|
||||
body = "";
|
||||
|
||||
AddHtml( 150, 240, 250, 100, body, false, false );
|
||||
|
||||
if ( message != board.Greeting && house.IsOwner( from ) )
|
||||
{
|
||||
AddButton( 130, 395, 1209, 1210, 6, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 150, 393, 150, 20, 1062410, LabelColor, false, false ); // Banish Poster
|
||||
|
||||
AddButton( 310, 395, 1209, 1210, 7, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 330, 393, 150, 20, 1062411, LabelColor, false, false ); // Delete Message
|
||||
}
|
||||
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
AddButton( 135, 242, 1209, 1210, 8, GumpButtonType.Reply, 0 ); // Post props
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
Scripts/Items/Misc/PlayerVendorDeed.cs
Normal file
104
Scripts/Items/Misc/PlayerVendorDeed.cs
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ContractOfEmployment : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041243; } } // a contract of employment
|
||||
|
||||
[Constructable]
|
||||
public ContractOfEmployment() : base( 0x14F0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
//LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public ContractOfEmployment( 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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
else if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
from.SendLocalizedMessage( 503248 ); // Your godly powers allow you to place this vendor whereever you wish.
|
||||
|
||||
Mobile v = new PlayerVendor( from, BaseHouse.FindHouseAt( from ) );
|
||||
|
||||
v.Direction = from.Direction & Direction.Mask;
|
||||
v.MoveToWorld( from.Location, from.Map );
|
||||
|
||||
v.SayTo( from, 503246 ); // Ah! it feels good to be working again.
|
||||
|
||||
this.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
||||
if ( house == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 503240 ); // Vendors can only be placed in houses.
|
||||
}
|
||||
else if ( !BaseHouse.NewVendorSystem && !house.IsFriend( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 503242 ); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here.
|
||||
}
|
||||
else if ( BaseHouse.NewVendorSystem && !house.IsOwner( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062423 ); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house.
|
||||
}
|
||||
else if ( !house.Public || !house.CanPlaceNewVendor() )
|
||||
{
|
||||
from.SendLocalizedMessage( 503241 ); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available.
|
||||
}
|
||||
else
|
||||
{
|
||||
bool vendor, contract;
|
||||
BaseHouse.IsThereVendor( from.Location, from.Map, out vendor, out contract );
|
||||
|
||||
if ( vendor )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062677 ); // You cannot place a vendor or barkeep at this location.
|
||||
}
|
||||
else if ( contract )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062678 ); // You cannot place a vendor or barkeep on top of a rental contract!
|
||||
}
|
||||
else
|
||||
{
|
||||
Mobile v = new PlayerVendor( from, house );
|
||||
|
||||
v.Direction = from.Direction & Direction.Mask;
|
||||
v.MoveToWorld( from.Location, from.Map );
|
||||
|
||||
v.SayTo( from, 503246 ); // Ah! it feels good to be working again.
|
||||
|
||||
this.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Scripts/Items/Misc/PoolOfAcid.cs
Normal file
101
Scripts/Items/Misc/PoolOfAcid.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PoolOfAcid : Item
|
||||
{
|
||||
private TimeSpan m_Duration;
|
||||
private int m_MinDamage;
|
||||
private int m_MaxDamage;
|
||||
private DateTime m_Created;
|
||||
private bool m_Drying;
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructable]
|
||||
public PoolOfAcid() : this( TimeSpan.FromSeconds( 10.0 ), 2, 5 )
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName { get { return "a pool of acid"; } }
|
||||
|
||||
[Constructable]
|
||||
public PoolOfAcid( TimeSpan duration, int minDamage, int maxDamage )
|
||||
: base( 0x122A )
|
||||
{
|
||||
Hue = 0x3F;
|
||||
Movable = false;
|
||||
|
||||
m_MinDamage = minDamage;
|
||||
m_MaxDamage = maxDamage;
|
||||
m_Created = DateTime.UtcNow;
|
||||
m_Duration = duration;
|
||||
|
||||
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) );
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
private void OnTick()
|
||||
{
|
||||
DateTime now = DateTime.UtcNow;
|
||||
TimeSpan age = now - m_Created;
|
||||
|
||||
if( age > m_Duration ) {
|
||||
Delete();
|
||||
} else {
|
||||
if( !m_Drying && age > (m_Duration - age) )
|
||||
{
|
||||
m_Drying = true;
|
||||
ItemID = 0x122B;
|
||||
}
|
||||
|
||||
List<Mobile> toDamage = new List<Mobile>();
|
||||
|
||||
foreach( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
BaseCreature bc = m as BaseCreature;
|
||||
|
||||
if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) )
|
||||
{
|
||||
toDamage.Add( m );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < toDamage.Count; i++ )
|
||||
Damage( toDamage[i] );
|
||||
}
|
||||
}
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
Damage( m );
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Damage ( Mobile m )
|
||||
{
|
||||
m.Damage( Utility.RandomMinMax( m_MinDamage, m_MaxDamage ) );
|
||||
}
|
||||
|
||||
public PoolOfAcid( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
//Don't serialize these
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Scripts/Items/Misc/PowerCrystal.cs
Normal file
45
Scripts/Items/Misc/PowerCrystal.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowerCrystal : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "power crystal"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowerCrystal() : base( 0x1F1C )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public PowerCrystal( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( this.GetWorldLocation(), 3 ))
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else
|
||||
from.SendAsciiMessage( "This looks like part of a larger contraption." );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
571
Scripts/Items/Misc/PowerGenerator.cs
Normal file
571
Scripts/Items/Misc/PowerGenerator.cs
Normal file
|
|
@ -0,0 +1,571 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PowerGenerator : BaseAddon
|
||||
{
|
||||
[Constructable]
|
||||
public PowerGenerator() : this( Utility.RandomMinMax( 3, 6 ) )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public PowerGenerator( int sideLength )
|
||||
{
|
||||
AddGeneratorComponent( 0x4FA1, 0, 0, 0 );
|
||||
AddGeneratorComponent( 0x76, -1, 0, 0 );
|
||||
AddGeneratorComponent( 0x75, 0, -1, 0 );
|
||||
AddGeneratorComponent( 0x37F4, 0, 0, 13 );
|
||||
|
||||
AddComponent( new ControlPanel( sideLength ), 1, 0, -2 );
|
||||
}
|
||||
|
||||
public override bool ShareHue{ get{ return false; } }
|
||||
|
||||
private void AddGeneratorComponent( int itemID, int x, int y, int z )
|
||||
{
|
||||
AddonComponent component = new AddonComponent( itemID );
|
||||
component.Name = "a power generator";
|
||||
component.Hue = 0x451;
|
||||
|
||||
AddComponent( component, x, y, z );
|
||||
}
|
||||
|
||||
public PowerGenerator( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class ControlPanel : AddonComponent
|
||||
{
|
||||
private static readonly TimeSpan m_UseTimeout = TimeSpan.FromMinutes( 2.0 );
|
||||
|
||||
public struct Node
|
||||
{
|
||||
private int m_X;
|
||||
private int m_Y;
|
||||
|
||||
public int X{ get{ return m_X; } set{ m_X = value; } }
|
||||
public int Y{ get{ return m_Y; } set{ m_Y = value; } }
|
||||
|
||||
public Node( int x, int y )
|
||||
{
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
}
|
||||
}
|
||||
|
||||
private int m_SideLength;
|
||||
private Node[] m_Path;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SideLength
|
||||
{
|
||||
get{ return m_SideLength; }
|
||||
set
|
||||
{
|
||||
if ( value < 3 )
|
||||
value = 3;
|
||||
else if ( value > 6 )
|
||||
value = 6;
|
||||
|
||||
if ( m_SideLength != value )
|
||||
{
|
||||
m_SideLength = value;
|
||||
InitPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Node[] Path{ get{ return m_Path; } }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "a control panel"; }
|
||||
}
|
||||
|
||||
public ControlPanel( int sideLength ) : base( 0xBDC )
|
||||
{
|
||||
Hue = 0x835;
|
||||
|
||||
SideLength = sideLength;
|
||||
}
|
||||
|
||||
private enum PathDirection
|
||||
{
|
||||
Left,
|
||||
Up,
|
||||
Right,
|
||||
Down
|
||||
}
|
||||
|
||||
public void InitPath()
|
||||
{
|
||||
// Depth-First Search algorithm
|
||||
|
||||
int totalNodes = SideLength * SideLength;
|
||||
|
||||
Node[] stack = new Node[totalNodes];
|
||||
Node current = stack[0] = new Node( 0, 0 );
|
||||
int stackSize = 1;
|
||||
|
||||
bool[,] visited = new bool[SideLength, SideLength];
|
||||
visited[0, 0] = true;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
PathDirection[] choices = new PathDirection[4];
|
||||
int count = 0;
|
||||
|
||||
if ( current.X > 0 && !visited[current.X - 1, current.Y] )
|
||||
choices[count++] = PathDirection.Left;
|
||||
|
||||
if ( current.Y > 0 && !visited[current.X, current.Y - 1] )
|
||||
choices[count++] = PathDirection.Up;
|
||||
|
||||
if ( current.X < SideLength - 1 && !visited[current.X + 1, current.Y] )
|
||||
choices[count++] = PathDirection.Right;
|
||||
|
||||
if ( current.Y < SideLength - 1 && !visited[current.X, current.Y + 1] )
|
||||
choices[count++] = PathDirection.Down;
|
||||
|
||||
if ( count > 0 )
|
||||
{
|
||||
PathDirection dir = choices[Utility.Random( count )];
|
||||
|
||||
switch ( dir )
|
||||
{
|
||||
case PathDirection.Left:
|
||||
current = new Node( current.X - 1, current.Y );
|
||||
break;
|
||||
case PathDirection.Up:
|
||||
current = new Node( current.X, current.Y - 1 );
|
||||
break;
|
||||
case PathDirection.Right:
|
||||
current = new Node( current.X + 1, current.Y );
|
||||
break;
|
||||
default:
|
||||
current = new Node( current.X, current.Y + 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
stack[stackSize++] = current;
|
||||
|
||||
if ( current.X == SideLength - 1 && current.Y == SideLength - 1 )
|
||||
break;
|
||||
|
||||
visited[current.X, current.Y] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
current = stack[--stackSize - 1];
|
||||
}
|
||||
}
|
||||
|
||||
m_Path = new Node[stackSize];
|
||||
|
||||
for ( int i = 0; i < stackSize; i++ )
|
||||
{
|
||||
m_Path[i] = stack[i];
|
||||
}
|
||||
|
||||
if ( m_User != null )
|
||||
{
|
||||
m_User.CloseGump( typeof( GameGump ) );
|
||||
m_User = null;
|
||||
}
|
||||
}
|
||||
|
||||
private Mobile m_User;
|
||||
private DateTime m_LastUse;
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( this, 3 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_User != null )
|
||||
{
|
||||
if ( m_User == from )
|
||||
return;
|
||||
|
||||
if ( m_User.Deleted || m_User.Map != Map || !m_User.InRange( this, 3 )
|
||||
|| m_User.NetState == null || DateTime.UtcNow - m_LastUse >= m_UseTimeout )
|
||||
{
|
||||
m_User.CloseGump( typeof( GameGump ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "Someone is currently using the control panel." );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_User = from;
|
||||
m_LastUse = DateTime.UtcNow;
|
||||
|
||||
from.SendGump( new GameGump( this, from, 0, false ) );
|
||||
}
|
||||
|
||||
private class GameGump : Gump
|
||||
{
|
||||
private enum NodeHue
|
||||
{
|
||||
Gray,
|
||||
Blue,
|
||||
Red
|
||||
}
|
||||
|
||||
private ControlPanel m_Panel;
|
||||
private Mobile m_From;
|
||||
private int m_Step;
|
||||
|
||||
public GameGump( ControlPanel panel, Mobile from, int step, bool hint ) : base( 5, 30 )
|
||||
{
|
||||
m_Panel = panel;
|
||||
m_From = from;
|
||||
m_Step = step;
|
||||
|
||||
int sideLength = panel.SideLength;
|
||||
|
||||
AddBackground( 50, 0, 530, 410, 0xA28 );
|
||||
|
||||
AddImage( 0, 0, 0x28C8 );
|
||||
AddImage( 547, 0, 0x28C9 );
|
||||
|
||||
AddBackground( 95, 20, 442, 90, 0xA28 );
|
||||
|
||||
AddHtml( 229, 35, 300, 45, "GENERATOR CONTROL PANEL", false, false );
|
||||
|
||||
AddHtml( 223, 60, 300, 70, "Use the Directional Controls to", false, false );
|
||||
AddHtml( 253, 75, 300, 85, "Close the Grid Circuit", false, false );
|
||||
|
||||
AddImage( 140, 40, 0x28D3 );
|
||||
AddImage( 420, 40, 0x28D3 );
|
||||
|
||||
AddBackground( 365, 120, 178, 210, 0x1400 );
|
||||
|
||||
AddImage( 365, 115, 0x28D4 );
|
||||
AddImage( 365, 288, 0x28D4 );
|
||||
|
||||
AddImage( 414, 189, 0x589 );
|
||||
AddImage( 435, 210, 0xA52 );
|
||||
|
||||
AddButton( 408, 222, 0x29EA, 0x29EC, 1, GumpButtonType.Reply, 0 ); // Left
|
||||
AddButton( 448, 185, 0x29CC, 0x29CE, 2, GumpButtonType.Reply, 0 ); // Up
|
||||
AddButton( 473, 222, 0x29D6, 0x29D8, 3, GumpButtonType.Reply, 0 ); // Right
|
||||
AddButton( 448, 243, 0x29E0, 0x29E2, 4, GumpButtonType.Reply, 0 ); // Down
|
||||
|
||||
AddBackground( 90, 115, 30 + 40 * sideLength, 30 + 40 * sideLength, 0xA28 );
|
||||
AddBackground( 100, 125, 10 + 40 * sideLength, 10 + 40 * sideLength, 0x1400 );
|
||||
|
||||
for ( int i = 0; i < sideLength; i++ )
|
||||
{
|
||||
for ( int j = 0; j < sideLength - 1; j++ )
|
||||
{
|
||||
AddImage( 120 + 40 * i, 162 + 40 * j, 0x13F9 );
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < sideLength - 1; i++ )
|
||||
{
|
||||
for ( int j = 0; j < sideLength; j++ )
|
||||
{
|
||||
AddImage( 138 + 40 * i, 147 + 40 * j, 0x13FD );
|
||||
}
|
||||
}
|
||||
|
||||
Node[] path = panel.Path;
|
||||
|
||||
NodeHue[,] hues = new NodeHue[sideLength, sideLength];
|
||||
|
||||
for ( int i = 0; i <= step; i++ )
|
||||
{
|
||||
Node n = path[i];
|
||||
hues[n.X, n.Y] = NodeHue.Blue;
|
||||
}
|
||||
|
||||
Node lastNode = path[path.Length - 1];
|
||||
hues[lastNode.X, lastNode.Y] = NodeHue.Red;
|
||||
|
||||
for ( int i = 0; i < sideLength; i++ )
|
||||
{
|
||||
for ( int j = 0; j < sideLength; j++ )
|
||||
{
|
||||
AddNode( 110 + 40 * i, 135 + 40 * j, hues[i, j] );
|
||||
}
|
||||
}
|
||||
|
||||
Node curNode = path[step];
|
||||
AddImage( 118 + 40 * curNode.X, 143 + 40 * curNode.Y, 0x13A8 );
|
||||
|
||||
if ( hint )
|
||||
{
|
||||
Node nextNode = path[step + 1];
|
||||
AddImage( 119 + 40 * nextNode.X, 143 + 40 * nextNode.Y, 0x939 );
|
||||
}
|
||||
|
||||
if ( from.Skills.Lockpicking.Value >= 65.0 )
|
||||
{
|
||||
AddButton( 365, 350, 0xFA6, 0xFA7, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 405, 345, 140, 40, "Attempt to Decipher the Circuit Path", false, false );
|
||||
}
|
||||
}
|
||||
|
||||
private void AddNode( int x, int y, NodeHue hue )
|
||||
{
|
||||
int id;
|
||||
switch ( hue )
|
||||
{
|
||||
case NodeHue.Gray: id = 0x25F8; break;
|
||||
case NodeHue.Blue: id = 0x868; break;
|
||||
default: id = 0x9A8; break;
|
||||
}
|
||||
|
||||
AddImage( x, y, id );
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Panel.Deleted || info.ButtonID == 0 || !m_From.CheckAlive() )
|
||||
{
|
||||
m_Panel.m_User = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_From.Map != m_Panel.Map || !m_From.InRange( m_Panel, 3 ) )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
m_Panel.m_User = null;
|
||||
return;
|
||||
}
|
||||
|
||||
Node nextNode = m_Panel.Path[m_Step + 1];
|
||||
|
||||
if ( info.ButtonID == 5 ) // Attempt to Decipher
|
||||
{
|
||||
double lockpicking = m_From.Skills.Lockpicking.Value;
|
||||
|
||||
if ( lockpicking < 65.0 )
|
||||
return;
|
||||
|
||||
m_From.PlaySound( 0x241 );
|
||||
|
||||
if ( 40.0 + Utility.RandomDouble() * 80.0 < lockpicking )
|
||||
{
|
||||
m_From.SendGump( new GameGump( m_Panel, m_From, m_Step, true ) );
|
||||
m_Panel.m_LastUse = DateTime.UtcNow;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Panel.DoDamage( m_From );
|
||||
m_Panel.m_User = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Node curNode = m_Panel.Path[m_Step];
|
||||
|
||||
int newX, newY;
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 1: // Left
|
||||
newX = curNode.X - 1;
|
||||
newY = curNode.Y;
|
||||
break;
|
||||
case 2: // Up
|
||||
newX = curNode.X;
|
||||
newY = curNode.Y - 1;
|
||||
break;
|
||||
case 3: // Right
|
||||
newX = curNode.X + 1;
|
||||
newY = curNode.Y;
|
||||
break;
|
||||
case 4: // Down
|
||||
newX = curNode.X;
|
||||
newY = curNode.Y + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if ( nextNode.X == newX && nextNode.Y == newY )
|
||||
{
|
||||
if ( m_Step + 1 == m_Panel.Path.Length - 1 )
|
||||
{
|
||||
m_Panel.Solve( m_From );
|
||||
m_Panel.m_User = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.PlaySound( 0x1F4 );
|
||||
m_From.SendGump( new GameGump( m_Panel, m_From, m_Step + 1, false ) );
|
||||
m_Panel.m_LastUse = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Panel.DoDamage( m_From );
|
||||
m_Panel.m_User = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Hashtable m_DamageTable = new Hashtable();
|
||||
|
||||
public void DoDamage( Mobile to )
|
||||
{
|
||||
to.Send( new UnicodeMessage( Serial, ItemID, MessageType.Regular, 0x3B2, 3, "", "", "The generator shoots an arc of electricity at you!" ) );
|
||||
to.BoltEffect( 0 );
|
||||
to.LocalOverheadMessage( MessageType.Regular, 0xC9, true, "* Your body convulses from electric shock *" );
|
||||
to.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true, string.Format( "* {0} spasms from electric shock *", to.Name ) );
|
||||
|
||||
AOS.Damage( to, to, 60, 0, 0, 0, 0, 100 );
|
||||
|
||||
if ( !to.Alive )
|
||||
return;
|
||||
|
||||
if ( m_DamageTable[to] == null )
|
||||
{
|
||||
to.Frozen = true;
|
||||
|
||||
DamageTimer timer = new DamageTimer( this, to );
|
||||
m_DamageTable[to] = timer;
|
||||
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private class DamageTimer : Timer
|
||||
{
|
||||
private ControlPanel m_Panel;
|
||||
private Mobile m_To;
|
||||
private int m_Step;
|
||||
|
||||
public DamageTimer( ControlPanel panel, Mobile to ) : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 5.0 ) )
|
||||
{
|
||||
m_Panel = panel;
|
||||
m_To = to;
|
||||
m_Step = 0;
|
||||
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Panel.Deleted || m_To.Deleted || !m_To.Alive )
|
||||
{
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
m_To.PlaySound( 0x28 );
|
||||
|
||||
m_To.LocalOverheadMessage( MessageType.Regular, 0xC9, true, "* Your body convulses from electric shock *" );
|
||||
m_To.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true, string.Format( "* {0} spasms from electric shock *", m_To.Name ) );
|
||||
|
||||
AOS.Damage( m_To, m_To, 20, 0, 0, 0, 0, 100 );
|
||||
|
||||
if ( ++m_Step >= 3 || !m_To.Alive )
|
||||
{
|
||||
End();
|
||||
}
|
||||
}
|
||||
|
||||
private void End()
|
||||
{
|
||||
m_Panel.m_DamageTable.Remove( m_To );
|
||||
m_To.Frozen = false;
|
||||
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Solve( Mobile from )
|
||||
{
|
||||
Effects.PlaySound( Location, Map, 0x211 );
|
||||
Effects.PlaySound( Location, Map, 0x1F3 );
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, 0x36B0, 4, 4 );
|
||||
Effects.SendLocationEffect( new Point3D( X - 1, Y - 1, Z + 2 ), Map, 0x36B0, 4, 4 );
|
||||
Effects.SendLocationEffect( new Point3D( X - 2, Y - 1, Z + 2 ), Map, 0x36B0, 4, 4 );
|
||||
|
||||
from.SendMessage( "You scrounge some gems from the wreckage." );
|
||||
|
||||
for ( int i = 0; i < SideLength; i++ )
|
||||
{
|
||||
from.AddToBackpack( new ArcaneGem() );
|
||||
}
|
||||
|
||||
from.AddToBackpack( new Diamond( SideLength ) );
|
||||
|
||||
Item ore = new ShadowIronOre( 9 );
|
||||
ore.MoveToWorld( new Point3D( X - 1, Y, Z + 2 ), Map );
|
||||
|
||||
ore = new ShadowIronOre( 14 );
|
||||
ore.MoveToWorld( new Point3D( X - 2, Y - 1, Z + 2 ), Map );
|
||||
|
||||
Delete();
|
||||
}
|
||||
|
||||
public ControlPanel( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( (int) m_SideLength );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Path.Length );
|
||||
for ( int i = 0; i < m_Path.Length; i++ )
|
||||
{
|
||||
Node cur = m_Path[i];
|
||||
|
||||
writer.WriteEncodedInt( cur.X );
|
||||
writer.WriteEncodedInt( cur.Y );
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_SideLength = reader.ReadEncodedInt();
|
||||
|
||||
m_Path = new Node[reader.ReadEncodedInt()];
|
||||
for ( int i = 0; i < m_Path.Length; i++ )
|
||||
{
|
||||
m_Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Scripts/Items/Misc/Prism of Light/CrystallineFragments.cs
Normal file
36
Scripts/Items/Misc/Prism of Light/CrystallineFragments.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CrystallineFragments : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073160; } } // Crystalline Fragments
|
||||
|
||||
[Constructable]
|
||||
public CrystallineFragments() : base( 0x223B )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Hue = 0x47E;
|
||||
}
|
||||
|
||||
public CrystallineFragments( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Prism of Light/IcyHeart.cs
Normal file
34
Scripts/Items/Misc/Prism of Light/IcyHeart.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class IcyHeart : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073162; } } // Icy Heart
|
||||
|
||||
[Constructable]
|
||||
public IcyHeart() : base( 0x24B )
|
||||
{
|
||||
}
|
||||
|
||||
public IcyHeart( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
33
Scripts/Items/Misc/Prism of Light/LuckyDagger.cs
Normal file
33
Scripts/Items/Misc/Prism of Light/LuckyDagger.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class LuckyDagger : Item
|
||||
{
|
||||
[Constructable]
|
||||
public LuckyDagger() : base( 0xF52 )
|
||||
{
|
||||
Hue = 0x8A5;
|
||||
}
|
||||
|
||||
public LuckyDagger( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Prism of Light/ProtectorsEssence.cs
Normal file
34
Scripts/Items/Misc/Prism of Light/ProtectorsEssence.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ProtectorsEssence : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073159; } } // Protector's Essence
|
||||
|
||||
[Constructable]
|
||||
public ProtectorsEssence() : base( 0x23F )
|
||||
{
|
||||
}
|
||||
|
||||
public ProtectorsEssence( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
Scripts/Items/Misc/Prism of Light/ShimmeringCrystal.cs
Normal file
43
Scripts/Items/Misc/Prism of Light/ShimmeringCrystal.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ShimmeringCrystals : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1075095; } } // Shimmering Crystals
|
||||
public override bool ForceShowProperties{ get{ return true; } }
|
||||
|
||||
private static readonly int[] m_ItemIDs = new int[]
|
||||
{
|
||||
0x2206, 0x2207, 0x2208, 0x2209, 0x220A, 0x220B, 0x220C, 0x220D, 0x220E,
|
||||
0x2210, 0x2211, 0x2212, 0x2213, 0x2214, 0x2215, 0x2216, 0x2217, 0x2218,
|
||||
0x221A, 0x221B, 0x221C, 0x221D, 0x221E, 0x221F, 0x2220, 0x2221, 0x2222,
|
||||
0x2224, 0x2225, 0x2226, 0x2227, 0x2228, 0x2229, 0x222A, 0x222B, 0x222C
|
||||
};
|
||||
|
||||
[Constructable]
|
||||
public ShimmeringCrystals() : base( Utility.RandomList( m_ItemIDs ) )
|
||||
{
|
||||
}
|
||||
|
||||
public ShimmeringCrystals( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
159
Scripts/Items/Misc/PromotionalToken.cs
Normal file
159
Scripts/Items/Misc/PromotionalToken.cs
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class PromotionalToken : Item
|
||||
{
|
||||
public abstract Item CreateItemFor( Mobile from );
|
||||
|
||||
public abstract TextDefinition ItemName{ get; }
|
||||
public abstract TextDefinition ItemReceiveMessage { get; }
|
||||
public abstract TextDefinition ItemGumpName { get; }
|
||||
|
||||
public PromotionalToken() : base( 0x2AAA )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
Light = LightType.Circle300;
|
||||
Weight = 5.0;
|
||||
}
|
||||
|
||||
public PromotionalToken( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1070998, ItemName.ToString() ); // Use this to redeem<br>your ~1_PROMO~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump( typeof( PromotionalTokenGump ) );
|
||||
from.SendGump( new PromotionalTokenGump( this ) );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoved(IEntity parent)
|
||||
{
|
||||
Mobile m = null;
|
||||
|
||||
if( parent is Item )
|
||||
m = ((Item)parent).RootParent as Mobile;
|
||||
else if( parent is Mobile )
|
||||
m = (Mobile)parent;
|
||||
|
||||
if( m != null )
|
||||
m.CloseGump( typeof( PromotionalTokenGump ) );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override int LabelNumber { get { return 1070997; } } // A promotional token
|
||||
|
||||
|
||||
private class PromotionalTokenGump : Gump
|
||||
{
|
||||
private PromotionalToken m_Token;
|
||||
|
||||
public PromotionalTokenGump( PromotionalToken token ) : base( 10, 10 )
|
||||
{
|
||||
m_Token = token;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 240, 135, 0x2422 );
|
||||
AddHtmlLocalized( 15, 15, 210, 75, 1070972, 0x0, true, false ); // Click "OKAY" to redeem the following promotional item:
|
||||
TextDefinition.AddHtmlText( this, 15, 60, 210, 75, m_Token.ItemGumpName, false, false );
|
||||
|
||||
AddButton( 160, 95, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 ); //Okay
|
||||
AddButton( 90, 95, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 ); //Cancel
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if( info.ButtonID != 1 )
|
||||
return;
|
||||
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if( !m_Token.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item i = m_Token.CreateItemFor( from );
|
||||
|
||||
if( i != null )
|
||||
{
|
||||
from.BankBox.AddItem( i );
|
||||
TextDefinition.SendMessageTo( from, m_Token.ItemReceiveMessage );
|
||||
m_Token.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SoulstoneFragmentToken : PromotionalToken
|
||||
{
|
||||
|
||||
public override Item CreateItemFor( Mobile from )
|
||||
{
|
||||
if( from != null && from.Account != null )
|
||||
return new SoulstoneFragment( from.Account.ToString() );
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public override TextDefinition ItemGumpName{ get{ return 1070999; } }// <center>Soulstone Fragment</center>
|
||||
public override TextDefinition ItemName { get { return 1071000; } }//soulstone fragment
|
||||
public override TextDefinition ItemReceiveMessage{ get{ return 1070976; } } // A soulstone fragment has been created in your bank box.
|
||||
|
||||
[Constructable]
|
||||
public SoulstoneFragmentToken() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public SoulstoneFragmentToken( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int)0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
470
Scripts/Items/Misc/PublicMoongate.cs
Normal file
470
Scripts/Items/Misc/PublicMoongate.cs
Normal file
|
|
@ -0,0 +1,470 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class PublicMoongate : Item
|
||||
{
|
||||
public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
|
||||
|
||||
[Constructable]
|
||||
public PublicMoongate() : base( 0xF6C )
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
}
|
||||
|
||||
public PublicMoongate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.Player )
|
||||
return;
|
||||
|
||||
if ( from.InRange( GetWorldLocation(), 1 ) )
|
||||
UseGate( from );
|
||||
else
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
// Changed so criminals are not blocked by it.
|
||||
if ( m.Player )
|
||||
UseGate( m );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return true; } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m is PlayerMobile )
|
||||
{
|
||||
if ( !Utility.InRange( m.Location, this.Location, 1 ) && Utility.InRange( oldLocation, this.Location, 1 ) )
|
||||
m.CloseGump( typeof( MoongateGump ) );
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseGate( Mobile m )
|
||||
{
|
||||
if ( m.Criminal )
|
||||
{
|
||||
m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
|
||||
return false;
|
||||
}
|
||||
else if ( SpellHelper.CheckCombat( m ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
|
||||
return false;
|
||||
}
|
||||
else if ( m.Spell != null )
|
||||
{
|
||||
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m.CloseGump( typeof( MoongateGump ) );
|
||||
m.SendGump( new MoongateGump( m, this ) );
|
||||
|
||||
if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
|
||||
Effects.PlaySound( m.Location, m.Map, 0x20E );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "MoonGen", AccessLevel.Administrator, new CommandEventHandler( MoonGen_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "MoonGen" )]
|
||||
[Description( "Generates public moongates. Removes all old moongates." )]
|
||||
public static void MoonGen_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
DeleteAll();
|
||||
|
||||
int count = 0;
|
||||
|
||||
count += MoonGen( PMList.Trammel );
|
||||
count += MoonGen( PMList.Felucca );
|
||||
count += MoonGen( PMList.Ilshenar );
|
||||
count += MoonGen( PMList.Malas );
|
||||
count += MoonGen( PMList.Tokuno );
|
||||
|
||||
World.Broadcast( 0x35, true, "{0} moongates generated.", count );
|
||||
}
|
||||
|
||||
private static void DeleteAll()
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
foreach ( Item item in World.Items.Values )
|
||||
{
|
||||
if ( item is PublicMoongate )
|
||||
list.Add( item );
|
||||
}
|
||||
|
||||
foreach ( Item item in list )
|
||||
item.Delete();
|
||||
|
||||
if ( list.Count > 0 )
|
||||
World.Broadcast( 0x35, true, "{0} moongates removed.", list.Count );
|
||||
}
|
||||
|
||||
private static int MoonGen( PMList list )
|
||||
{
|
||||
foreach ( PMEntry entry in list.Entries )
|
||||
{
|
||||
Item item = new PublicMoongate();
|
||||
|
||||
item.MoveToWorld( entry.Location, list.Map );
|
||||
|
||||
if ( entry.Number == 1060642 ) // Umbra
|
||||
item.Hue = 0x497;
|
||||
}
|
||||
|
||||
return list.Entries.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public class PMEntry
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private int m_Number;
|
||||
|
||||
public Point3D Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Location;
|
||||
}
|
||||
}
|
||||
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
|
||||
public PMEntry( Point3D loc, int number )
|
||||
{
|
||||
m_Location = loc;
|
||||
m_Number = number;
|
||||
}
|
||||
}
|
||||
|
||||
public class PMList
|
||||
{
|
||||
private int m_Number, m_SelNumber;
|
||||
private Map m_Map;
|
||||
private PMEntry[] m_Entries;
|
||||
|
||||
public int Number
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Number;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelNumber;
|
||||
}
|
||||
}
|
||||
|
||||
public Map Map
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Map;
|
||||
}
|
||||
}
|
||||
|
||||
public PMEntry[] Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Entries;
|
||||
}
|
||||
}
|
||||
|
||||
public PMList( int number, int selNumber, Map map, PMEntry[] entries )
|
||||
{
|
||||
m_Number = number;
|
||||
m_SelNumber = selNumber;
|
||||
m_Map = map;
|
||||
m_Entries = entries;
|
||||
}
|
||||
|
||||
public static readonly PMList Trammel =
|
||||
new PMList( 1012000, 1012012, Map.Trammel, new PMEntry[]
|
||||
{
|
||||
new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
|
||||
new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
|
||||
new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
|
||||
new PMEntry( new Point3D( 771, 752, 5 ), 1012006 ), // Yew
|
||||
new PMEntry( new Point3D( 2701, 692, 5 ), 1012007 ), // Minoc
|
||||
new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
|
||||
new PMEntry( new Point3D( 643, 2067, 5 ), 1012009 ), // Skara Brae
|
||||
/* Dynamic Z for Magincia to support both old and new maps. */
|
||||
new PMEntry( new Point3D( 3563, 2139, Map.Trammel.GetAverageZ( 3563, 2139 ) ), 1012010 ), // (New) Magincia
|
||||
new PMEntry( new Point3D( 3450, 2677, 25), 1078098 ) // New Haven
|
||||
} );
|
||||
|
||||
public static readonly PMList Felucca =
|
||||
new PMList( 1012001, 1012013, Map.Felucca, new PMEntry[]
|
||||
{
|
||||
new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
|
||||
new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
|
||||
new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
|
||||
new PMEntry( new Point3D( 771, 752, 5 ), 1012006 ), // Yew
|
||||
new PMEntry( new Point3D( 2701, 692, 5 ), 1012007 ), // Minoc
|
||||
new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
|
||||
new PMEntry( new Point3D( 643, 2067, 5 ), 1012009 ), // Skara Brae
|
||||
/* Dynamic Z for Magincia to support both old and new maps. */
|
||||
new PMEntry( new Point3D( 3563, 2139, Map.Felucca.GetAverageZ( 3563, 2139 ) ), 1012010 ), // (New) Magincia
|
||||
new PMEntry( new Point3D( 2711, 2234, 0 ), 1019001 ) // Buccaneer's Den
|
||||
} );
|
||||
|
||||
public static readonly PMList Ilshenar =
|
||||
new PMList( 1012002, 1012014, Map.Ilshenar, new PMEntry[]
|
||||
{
|
||||
new PMEntry( new Point3D( 1215, 467, -13 ), 1012015 ), // Compassion
|
||||
new PMEntry( new Point3D( 722, 1366, -60 ), 1012016 ), // Honesty
|
||||
new PMEntry( new Point3D( 744, 724, -28 ), 1012017 ), // Honor
|
||||
new PMEntry( new Point3D( 281, 1016, 0 ), 1012018 ), // Humility
|
||||
new PMEntry( new Point3D( 987, 1011, -32 ), 1012019 ), // Justice
|
||||
new PMEntry( new Point3D( 1174, 1286, -30 ), 1012020 ), // Sacrifice
|
||||
new PMEntry( new Point3D( 1532, 1340, - 3 ), 1012021 ), // Spirituality
|
||||
new PMEntry( new Point3D( 528, 216, -45 ), 1012022 ), // Valor
|
||||
new PMEntry( new Point3D( 1721, 218, 96 ), 1019000 ) // Chaos
|
||||
} );
|
||||
|
||||
public static readonly PMList Malas =
|
||||
new PMList( 1060643, 1062039, Map.Malas, new PMEntry[]
|
||||
{
|
||||
new PMEntry( new Point3D( 1015, 527, -65 ), 1060641 ), // Luna
|
||||
new PMEntry( new Point3D( 1997, 1386, -85 ), 1060642 ) // Umbra
|
||||
} );
|
||||
|
||||
public static readonly PMList Tokuno =
|
||||
new PMList( 1063258, 1063415, Map.Tokuno, new PMEntry[]
|
||||
{
|
||||
new PMEntry( new Point3D( 1169, 998, 41 ), 1063412 ), // Isamu-Jima
|
||||
new PMEntry( new Point3D( 802, 1204, 25 ), 1063413 ), // Makoto-Jima
|
||||
new PMEntry( new Point3D( 270, 628, 15 ), 1063414 ) // Homare-Jima
|
||||
} );
|
||||
|
||||
public static readonly PMList[] UORLists = new PMList[] { Trammel, Felucca };
|
||||
public static readonly PMList[] UORListsYoung = new PMList[] { Trammel };
|
||||
public static readonly PMList[] LBRLists = new PMList[] { Trammel, Felucca, Ilshenar };
|
||||
public static readonly PMList[] LBRListsYoung = new PMList[] { Trammel, Ilshenar };
|
||||
public static readonly PMList[] AOSLists = new PMList[] { Trammel, Felucca, Ilshenar, Malas };
|
||||
public static readonly PMList[] AOSListsYoung = new PMList[] { Trammel, Ilshenar, Malas };
|
||||
public static readonly PMList[] SELists = new PMList[] { Trammel, Felucca, Ilshenar, Malas, Tokuno };
|
||||
public static readonly PMList[] SEListsYoung = new PMList[] { Trammel, Ilshenar, Malas, Tokuno };
|
||||
public static readonly PMList[] RedLists = new PMList[] { Felucca };
|
||||
public static readonly PMList[] SigilLists = new PMList[] { Felucca };
|
||||
}
|
||||
|
||||
public class MoongateGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Item m_Moongate;
|
||||
private PMList[] m_Lists;
|
||||
|
||||
public MoongateGump( Mobile mobile, Item moongate ) : base( 100, 100 )
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Moongate = moongate;
|
||||
|
||||
PMList[] checkLists;
|
||||
|
||||
if ( mobile.Player )
|
||||
{
|
||||
if ( Factions.Sigil.ExistsOn( mobile ) )
|
||||
{
|
||||
checkLists = PMList.SigilLists;
|
||||
}
|
||||
else if ( mobile.Kills >= 5 )
|
||||
{
|
||||
checkLists = PMList.RedLists;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientFlags flags = mobile.NetState == null ? ClientFlags.None : mobile.NetState.Flags;
|
||||
bool young = mobile is PlayerMobile ? ((PlayerMobile)mobile).Young : false;
|
||||
|
||||
if ( Core.SE && (flags & ClientFlags.Tokuno) != 0 )
|
||||
checkLists = young ? PMList.SEListsYoung : PMList.SELists;
|
||||
else if ( Core.AOS && (flags & ClientFlags.Malas) != 0 )
|
||||
checkLists = young ? PMList.AOSListsYoung : PMList.AOSLists;
|
||||
else if ( (flags & ClientFlags.Ilshenar) != 0 )
|
||||
checkLists = young ? PMList.LBRListsYoung : PMList.LBRLists;
|
||||
else
|
||||
checkLists = young ? PMList.UORListsYoung : PMList.UORLists;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checkLists = PMList.SELists;
|
||||
}
|
||||
|
||||
m_Lists = new PMList[checkLists.Length];
|
||||
|
||||
for ( int i = 0; i < m_Lists.Length; ++i )
|
||||
m_Lists[i] = checkLists[i];
|
||||
|
||||
for ( int i = 0; i < m_Lists.Length; ++i )
|
||||
{
|
||||
if ( m_Lists[i].Map == mobile.Map )
|
||||
{
|
||||
PMList temp = m_Lists[i];
|
||||
|
||||
m_Lists[i] = m_Lists[0];
|
||||
m_Lists[0] = temp;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 380, 280, 5054 );
|
||||
|
||||
AddButton( 10, 210, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 45, 210, 140, 25, 1011036, false, false ); // OKAY
|
||||
|
||||
AddButton( 10, 235, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 45, 235, 140, 25, 1011012, false, false ); // CANCEL
|
||||
|
||||
AddHtmlLocalized( 5, 5, 200, 20, 1012011, false, false ); // Pick your destination:
|
||||
|
||||
for ( int i = 0; i < checkLists.Length; ++i )
|
||||
{
|
||||
AddButton( 10, 35 + (i * 25), 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf( m_Lists, checkLists[i] ) + 1 );
|
||||
AddHtmlLocalized( 30, 35 + (i * 25), 150, 20, checkLists[i].Number, false, false );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Lists.Length; ++i )
|
||||
RenderPage( i, Array.IndexOf( checkLists, m_Lists[i] ) );
|
||||
}
|
||||
|
||||
private void RenderPage( int index, int offset )
|
||||
{
|
||||
PMList list = m_Lists[index];
|
||||
|
||||
AddPage( index + 1 );
|
||||
|
||||
AddButton( 10, 35 + (offset * 25), 2117, 2118, 0, GumpButtonType.Page, index + 1 );
|
||||
AddHtmlLocalized( 30, 35 + (offset * 25), 150, 20, list.SelNumber, false, false );
|
||||
|
||||
PMEntry[] entries = list.Entries;
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
AddRadio( 200, 35 + (i * 25), 210, 211, false, (index * 100) + i );
|
||||
AddHtmlLocalized( 225, 35 + (i * 25), 150, 20, entries[i].Number, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 0 ) // Cancel
|
||||
return;
|
||||
else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
|
||||
return;
|
||||
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length == 0 )
|
||||
return;
|
||||
|
||||
int switchID = switches[0];
|
||||
int listIndex = switchID / 100;
|
||||
int listEntry = switchID % 100;
|
||||
|
||||
if ( listIndex < 0 || listIndex >= m_Lists.Length )
|
||||
return;
|
||||
|
||||
PMList list = m_Lists[listIndex];
|
||||
|
||||
if ( listEntry < 0 || listEntry >= list.Entries.Length )
|
||||
return;
|
||||
|
||||
PMEntry entry = list.Entries[listEntry];
|
||||
|
||||
if ( !m_Mobile.InRange( m_Moongate.GetWorldLocation(), 1 ) || m_Mobile.Map != m_Moongate.Map )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
|
||||
}
|
||||
else if ( m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
|
||||
}
|
||||
else if ( Factions.Sigil.ExistsOn( m_Mobile ) && list.Map != Factions.Faction.Facet )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
|
||||
}
|
||||
else if ( m_Mobile.Criminal )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
|
||||
}
|
||||
else if ( SpellHelper.CheckCombat( m_Mobile ) )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
|
||||
}
|
||||
else if ( m_Mobile.Spell != null )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
|
||||
}
|
||||
else if ( m_Mobile.Map == list.Map && m_Mobile.InRange( entry.Location, 1 ) )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1019003 ); // You are already there.
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseCreature.TeleportPets( m_Mobile, entry.Location, list.Map );
|
||||
|
||||
m_Mobile.Combatant = null;
|
||||
m_Mobile.Warmode = false;
|
||||
m_Mobile.Hidden = true;
|
||||
|
||||
m_Mobile.MoveToWorld( entry.Location, list.Map );
|
||||
|
||||
Effects.PlaySound( entry.Location, list.Map, 0x1FE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
718
Scripts/Items/Misc/Rares.cs
Normal file
718
Scripts/Items/Misc/Rares.cs
Normal file
|
|
@ -0,0 +1,718 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Rope : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Rope() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Rope( int amount ) : base( 0x14F8 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Rope( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class IronWire : Item
|
||||
{
|
||||
[Constructable]
|
||||
public IronWire() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public IronWire( int amount ) : base( 0x1876 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 5.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IronWire( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && Weight == 2.0 )
|
||||
Weight = 5.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class SilverWire : Item
|
||||
{
|
||||
[Constructable]
|
||||
public SilverWire() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SilverWire( int amount ) : base( 0x1877 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 5.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public SilverWire( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && Weight == 2.0 )
|
||||
Weight = 5.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class GoldWire : Item
|
||||
{
|
||||
[Constructable]
|
||||
public GoldWire() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GoldWire( int amount ) : base( 0x1878 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 5.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GoldWire( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && Weight == 2.0 )
|
||||
Weight = 5.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class CopperWire : Item
|
||||
{
|
||||
[Constructable]
|
||||
public CopperWire() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public CopperWire( int amount ) : base( 0x1879 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 5.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CopperWire( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version < 1 && Weight == 2.0 )
|
||||
Weight = 5.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class WhiteDriedFlowers : Item
|
||||
{
|
||||
[Constructable]
|
||||
public WhiteDriedFlowers() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WhiteDriedFlowers( int amount ) : base( 0xC3C )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public WhiteDriedFlowers( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreenDriedFlowers : Item
|
||||
{
|
||||
[Constructable]
|
||||
public GreenDriedFlowers() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GreenDriedFlowers( int amount ) : base( 0xC3E )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GreenDriedFlowers( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DriedOnions : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DriedOnions() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DriedOnions( int amount ) : base( 0xC40 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DriedOnions( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DriedHerbs : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DriedHerbs() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DriedHerbs( int amount ) : base( 0xC42 )
|
||||
{
|
||||
Stackable = true;
|
||||
Weight = 1.0;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DriedHerbs( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class HorseShoes : Item
|
||||
{
|
||||
[Constructable]
|
||||
public HorseShoes() : base( 0xFB6 )
|
||||
{
|
||||
Weight = 3.0;
|
||||
}
|
||||
|
||||
public HorseShoes( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class ForgedMetal : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ForgedMetal() : base( 0xFB8 )
|
||||
{
|
||||
Weight = 5.0;
|
||||
}
|
||||
|
||||
public ForgedMetal( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class Whip : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Whip() : base( 0x166E )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public Whip( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class PaintsAndBrush : Item
|
||||
{
|
||||
[Constructable]
|
||||
public PaintsAndBrush() : base( 0xFC1 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public PaintsAndBrush( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class PenAndInk : Item
|
||||
{
|
||||
[Constructable]
|
||||
public PenAndInk() : base( 0xFBF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public PenAndInk( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class ChiselsNorth : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ChiselsNorth() : base( 0x1026 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ChiselsNorth( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class ChiselsWest : Item
|
||||
{
|
||||
[Constructable]
|
||||
public ChiselsWest() : base( 0x1027 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public ChiselsWest( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtyPan : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtyPan() : base( 0x9E8 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtyPan( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtySmallRoundPot : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtySmallRoundPot() : base( 0x9E7 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtySmallRoundPot( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtyPot : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtyPot() : base( 0x9E6 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtyPot( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtyRoundPot : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtyRoundPot() : base( 0x9DF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtyRoundPot( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtyFrypan : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtyFrypan() : base( 0x9DE )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtyFrypan( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtySmallPot : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtySmallPot() : base( 0x9DD )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtySmallPot( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class DirtyKettle : Item
|
||||
{
|
||||
[Constructable]
|
||||
public DirtyKettle() : base( 0x9DC )
|
||||
{
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public DirtyKettle( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Scripts/Items/Misc/Scales.cs
Normal file
93
Scripts/Items/Misc/Scales.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Scales : Item
|
||||
{
|
||||
[Constructable]
|
||||
public Scales() : base( 0x1852 )
|
||||
{
|
||||
Weight = 4.0;
|
||||
}
|
||||
|
||||
public Scales( 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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
from.SendLocalizedMessage( 502431 ); // What would you like to weigh?
|
||||
from.Target = new InternalTarget( this );
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private Scales m_Item;
|
||||
|
||||
public InternalTarget( Scales item ) : base( 1, false, TargetFlags.None )
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
string message;
|
||||
|
||||
if ( targeted == m_Item )
|
||||
{
|
||||
message = "It cannot weight itself.";
|
||||
}
|
||||
else if ( targeted is Item )
|
||||
{
|
||||
Item item = (Item)targeted;
|
||||
object root = item.RootParent;
|
||||
|
||||
if ( (root != null && root != from) || item.Parent == from )
|
||||
{
|
||||
message = "You decide that item's current location is too awkward to get an accurate result.";
|
||||
}
|
||||
else if ( item.Movable )
|
||||
{
|
||||
if ( item.Amount > 1 )
|
||||
message = "You place one item on the scale. ";
|
||||
else
|
||||
message = "You place that item on the scale. ";
|
||||
|
||||
double weight = item.Weight;
|
||||
|
||||
if ( weight <= 0.0 )
|
||||
message += "It is lighter than a feather.";
|
||||
else
|
||||
message += String.Format( "It weighs {0} stones.", weight );
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "You cannot weigh that object.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "You cannot weigh that object.";
|
||||
}
|
||||
|
||||
from.SendMessage( message );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Scripts/Items/Misc/SerpentPillar.cs
Normal file
126
Scripts/Items/Misc/SerpentPillar.cs
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SerpentPillar : Item
|
||||
{
|
||||
private bool m_Active;
|
||||
private string m_Word;
|
||||
private Rectangle2D m_Destination;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
{
|
||||
get{ return m_Active; }
|
||||
set{ m_Active = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Word
|
||||
{
|
||||
get{ return m_Word; }
|
||||
set{ m_Word = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D Destination
|
||||
{
|
||||
get{ return m_Destination; }
|
||||
set{ m_Destination = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SerpentPillar() : this( null, new Rectangle2D(), false )
|
||||
{
|
||||
}
|
||||
|
||||
public SerpentPillar( string word, Rectangle2D destination ) : this( word, destination, true )
|
||||
{
|
||||
}
|
||||
|
||||
public SerpentPillar( string word, Rectangle2D destination, bool active ) : base( 0x233F )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
m_Active = active;
|
||||
m_Word = word;
|
||||
m_Destination = destination;
|
||||
}
|
||||
|
||||
public override bool HandlesOnSpeech{ get{ return true; } }
|
||||
|
||||
public override void OnSpeech( SpeechEventArgs e )
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if ( !e.Handled && from.InRange( this, 10 ) && e.Speech.ToLower() == this.Word )
|
||||
{
|
||||
BaseBoat boat = BaseBoat.FindBoatAt( from, from.Map );
|
||||
|
||||
if ( boat == null )
|
||||
return;
|
||||
|
||||
if ( !this.Active )
|
||||
{
|
||||
if ( boat.TillerMan != null )
|
||||
boat.TillerMan.Say( 502507 ); // Ar, Legend has it that these pillars are inactive! No man knows how it might be undone!
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
for ( int i = 0; i < 5; i++ ) // Try 5 times
|
||||
{
|
||||
int x = Utility.Random( Destination.X, Destination.Width );
|
||||
int y = Utility.Random( Destination.Y, Destination.Height );
|
||||
int z = map.GetAverageZ( x, y );
|
||||
|
||||
Point3D dest = new Point3D( x, y, z );
|
||||
|
||||
if ( boat.CanFit( dest, map, boat.ItemID ) )
|
||||
{
|
||||
int xOffset = x - boat.X;
|
||||
int yOffset = y - boat.Y;
|
||||
int zOffset = z - boat.Z;
|
||||
|
||||
boat.Teleport( xOffset, yOffset, zOffset );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( boat.TillerMan != null )
|
||||
boat.TillerMan.Say( 502508 ); // Ar, I refuse to take that matey through here!
|
||||
}
|
||||
}
|
||||
|
||||
public SerpentPillar( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_Active );
|
||||
writer.Write( (string) m_Word );
|
||||
writer.Write( (Rectangle2D) m_Destination );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
m_Word = reader.ReadString();
|
||||
m_Destination = reader.ReadRect2D();
|
||||
}
|
||||
}
|
||||
}
|
||||
186
Scripts/Items/Misc/SpecialBeardDye.cs
Normal file
186
Scripts/Items/Misc/SpecialBeardDye.cs
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SpecialBeardDye : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041087; } } // Special Beard Dye
|
||||
|
||||
[Constructable]
|
||||
public SpecialBeardDye() : base( 0xE26 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
public SpecialBeardDye( 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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
from.CloseGump( typeof( SpecialBeardDyeGump ) );
|
||||
from.SendGump( new SpecialBeardDyeGump( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpecialBeardDyeGump : Gump
|
||||
{
|
||||
private SpecialBeardDye m_SpecialBeardDye;
|
||||
|
||||
private class SpecialBeardDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueStart;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueCount;
|
||||
}
|
||||
}
|
||||
|
||||
public SpecialBeardDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
private static SpecialBeardDyeEntry[] m_Entries = new SpecialBeardDyeEntry[]
|
||||
{
|
||||
new SpecialBeardDyeEntry( "*****", 12, 10 ),
|
||||
new SpecialBeardDyeEntry( "*****", 32, 5 ),
|
||||
new SpecialBeardDyeEntry( "*****", 38, 8 ),
|
||||
new SpecialBeardDyeEntry( "*****", 54, 3 ),
|
||||
new SpecialBeardDyeEntry( "*****", 62, 10 ),
|
||||
new SpecialBeardDyeEntry( "*****", 81, 2 ),
|
||||
new SpecialBeardDyeEntry( "*****", 89, 2 ),
|
||||
new SpecialBeardDyeEntry( "*****", 1153, 2 )
|
||||
};
|
||||
|
||||
public SpecialBeardDyeGump( SpecialBeardDye dye ) : base( 0, 0 )
|
||||
{
|
||||
m_SpecialBeardDye = dye;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 150, 60, 350, 358, 2600 );
|
||||
AddBackground( 170, 104, 110, 270, 5100 );
|
||||
AddHtmlLocalized( 230, 75, 200, 20, 1011013, false, false ); // Hair Color Selection Menu
|
||||
AddHtmlLocalized( 235, 380, 300, 20, 1013007, false, false ); // Dye my beard this color!
|
||||
AddButton( 200, 380, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 ); // DYE HAIR
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
AddLabel( 180, 109 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name );
|
||||
AddButton( 257, 110 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1 );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
SpecialBeardDyeEntry e = m_Entries[i];
|
||||
|
||||
AddPage( i + 1 );
|
||||
|
||||
for ( int j = 0; j < e.HueCount; ++j )
|
||||
{
|
||||
AddLabel( 328 + ((j / 16) * 80), 102 + ((j % 16) * 17), e.HueStart + j - 1, "*****" );
|
||||
AddRadio( 310 + ((j / 16) * 80), 102 + ((j % 16) * 17), 210, 211, false, (i * 100) + j );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState from, RelayInfo info )
|
||||
{
|
||||
if ( m_SpecialBeardDye.Deleted )
|
||||
return;
|
||||
|
||||
Mobile m = from.Mobile;
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( !m_SpecialBeardDye.IsChildOf( m.Backpack ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1042010 ); //You must have the objectin your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.FacialHairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
else
|
||||
{
|
||||
// To prevent this from being exploited, the hue is abstracted into an internal list
|
||||
|
||||
int entryIndex = switches[0] / 100;
|
||||
int hueOffset = switches[0] % 100;
|
||||
|
||||
if ( entryIndex >= 0 && entryIndex < m_Entries.Length )
|
||||
{
|
||||
SpecialBeardDyeEntry e = m_Entries[entryIndex];
|
||||
|
||||
if ( hueOffset >= 0 && hueOffset < e.HueCount )
|
||||
{
|
||||
int hue = e.HueStart + hueOffset;
|
||||
|
||||
m.FacialHairHue = hue;
|
||||
|
||||
m.SendLocalizedMessage( 501199 ); // You dye your hair
|
||||
m_SpecialBeardDye.Delete();
|
||||
m.PlaySound( 0x4E );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 501200 ); // You decide not to dye your hair
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
191
Scripts/Items/Misc/SpecialHairDye.cs
Normal file
191
Scripts/Items/Misc/SpecialHairDye.cs
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SpecialHairDye : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "Special Hair Dye"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpecialHairDye() : base( 0xE26 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Newbied;
|
||||
}
|
||||
|
||||
public SpecialHairDye( 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();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( this.GetWorldLocation(), 1 ) )
|
||||
{
|
||||
from.CloseGump( typeof( SpecialHairDyeGump ) );
|
||||
from.SendGump( new SpecialHairDyeGump( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SpecialHairDyeGump : Gump
|
||||
{
|
||||
private SpecialHairDye m_SpecialHairDye;
|
||||
|
||||
private class SpecialHairDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueStart
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueStart;
|
||||
}
|
||||
}
|
||||
|
||||
public int HueCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_HueCount;
|
||||
}
|
||||
}
|
||||
|
||||
public SpecialHairDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
private static SpecialHairDyeEntry[] m_Entries = new SpecialHairDyeEntry[]
|
||||
{
|
||||
new SpecialHairDyeEntry( "*****", 12, 10 ),
|
||||
new SpecialHairDyeEntry( "*****", 32, 5 ),
|
||||
new SpecialHairDyeEntry( "*****", 38, 8 ),
|
||||
new SpecialHairDyeEntry( "*****", 54, 3 ),
|
||||
new SpecialHairDyeEntry( "*****", 62, 10 ),
|
||||
new SpecialHairDyeEntry( "*****", 81, 2 ),
|
||||
new SpecialHairDyeEntry( "*****", 89, 2 ),
|
||||
new SpecialHairDyeEntry( "*****", 1153, 2 )
|
||||
};
|
||||
|
||||
public SpecialHairDyeGump( SpecialHairDye dye ) : base( 0, 0 )
|
||||
{
|
||||
m_SpecialHairDye = dye;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 150, 60, 350, 358, 2600 );
|
||||
AddBackground( 170, 104, 110, 270, 5100 );
|
||||
AddHtmlLocalized( 230, 75, 200, 20, 1011013, false, false ); // Hair Color Selection Menu
|
||||
AddHtmlLocalized( 235, 380, 300, 20, 1011014, false, false ); // Dye my hair this color!
|
||||
AddButton( 200, 380, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 ); // DYE HAIR
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
AddLabel( 180, 109 + (i * 22), m_Entries[i].HueStart - 1, m_Entries[i].Name );
|
||||
AddButton( 257, 110 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, i + 1 );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
SpecialHairDyeEntry e = m_Entries[i];
|
||||
|
||||
AddPage( i + 1 );
|
||||
|
||||
for ( int j = 0; j < e.HueCount; ++j )
|
||||
{
|
||||
AddLabel( 328 + ((j / 16) * 80), 102 + ((j % 16) * 17), e.HueStart + j - 1, "*****" );
|
||||
AddRadio( 310 + ((j / 16) * 80), 102 + ((j % 16) * 17), 210, 211, false, (i * 100) + j );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState from, RelayInfo info )
|
||||
{
|
||||
if ( m_SpecialHairDye.Deleted )
|
||||
return;
|
||||
|
||||
Mobile m = from.Mobile;
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( !m_SpecialHairDye.IsChildOf( m.Backpack ) )
|
||||
{
|
||||
m.SendLocalizedMessage( 1042010 ); //You must have the objectin your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( info.ButtonID != 0 && switches.Length > 0 )
|
||||
{
|
||||
if( m.HairItemID == 0 )
|
||||
{
|
||||
m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this
|
||||
}
|
||||
else
|
||||
{
|
||||
// To prevent this from being exploited, the hue is abstracted into an internal list
|
||||
|
||||
int entryIndex = switches[0] / 100;
|
||||
int hueOffset = switches[0] % 100;
|
||||
|
||||
if ( entryIndex >= 0 && entryIndex < m_Entries.Length )
|
||||
{
|
||||
SpecialHairDyeEntry e = m_Entries[entryIndex];
|
||||
|
||||
if ( hueOffset >= 0 && hueOffset < e.HueCount )
|
||||
{
|
||||
m_SpecialHairDye.Delete();
|
||||
|
||||
int hue = e.HueStart + hueOffset;
|
||||
|
||||
m.HairHue = hue;
|
||||
|
||||
m.SendLocalizedMessage( 501199 ); // You dye your hair
|
||||
m.PlaySound( 0x4E );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendLocalizedMessage( 501200 ); // You decide not to dye your hair
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
98
Scripts/Items/Misc/Static.cs
Normal file
98
Scripts/Items/Misc/Static.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Static : Item
|
||||
{
|
||||
public Static() : base( 0x80 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Static( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Static( int itemID, int count ) : this( Utility.Random( itemID, count ) )
|
||||
{
|
||||
}
|
||||
|
||||
public Static( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( version == 0 && Weight == 0 )
|
||||
Weight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public class LocalizedStatic : Static
|
||||
{
|
||||
private int m_LabelNumber;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Number
|
||||
{
|
||||
get{ return m_LabelNumber; }
|
||||
set{ m_LabelNumber = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return m_LabelNumber; } }
|
||||
|
||||
[Constructable]
|
||||
public LocalizedStatic( int itemID ) : this( itemID, itemID < 0x4000 ? 1020000 + itemID : 1078872 + itemID )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LocalizedStatic( int itemID, int labelNumber ) : base( itemID )
|
||||
{
|
||||
m_LabelNumber = labelNumber;
|
||||
}
|
||||
|
||||
public LocalizedStatic( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (byte) 0 ); // version
|
||||
writer.WriteEncodedInt( (int) m_LabelNumber );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadByte();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_LabelNumber = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Scripts/Items/Misc/SwarmOfFlies.cs
Normal file
37
Scripts/Items/Misc/SwarmOfFlies.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SwarmOfFlies : Item
|
||||
{
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "a swarm of flies"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SwarmOfFlies() : base( 0x91B )
|
||||
{
|
||||
Hue = 1;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public SwarmOfFlies( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
1152
Scripts/Items/Misc/Teleporter.cs
Normal file
1152
Scripts/Items/Misc/Teleporter.cs
Normal file
File diff suppressed because it is too large
Load diff
35
Scripts/Items/Misc/The Citadel/DragonFlameSectBadge.cs
Normal file
35
Scripts/Items/Misc/The Citadel/DragonFlameSectBadge.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class DragonFlameSectBadge : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073141; } } // A Dragon Flame Sect Badge
|
||||
|
||||
[Constructable]
|
||||
public DragonFlameSectBadge() : base( 0x23E )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public DragonFlameSectBadge( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/The Citadel/OrdersFromMinax.cs
Normal file
35
Scripts/Items/Misc/The Citadel/OrdersFromMinax.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class OrdersFromMinax : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1074639; } } // Orders from Minax
|
||||
|
||||
[Constructable]
|
||||
public OrdersFromMinax() : base( 0x2279 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public OrdersFromMinax( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/The Citadel/SerpentFangSectBadge.cs
Normal file
35
Scripts/Items/Misc/The Citadel/SerpentFangSectBadge.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SerpentFangSectBadge : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073139; } } // A Serpent Fang Sect Badge
|
||||
|
||||
[Constructable]
|
||||
public SerpentFangSectBadge() : base( 0x23C )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public SerpentFangSectBadge( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
Scripts/Items/Misc/The Citadel/TigerClawSectBadge.cs
Normal file
35
Scripts/Items/Misc/The Citadel/TigerClawSectBadge.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TigerClawSectBadge : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1073140; } } // A Tiger Claw Sect Badge
|
||||
|
||||
[Constructable]
|
||||
public TigerClawSectBadge() : base( 0x23D )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public TigerClawSectBadge( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TravestysCollectionOfShells : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072090; } } // Travesty's Collection of Shells
|
||||
|
||||
[Constructable]
|
||||
public TravestysCollectionOfShells() : base( 0xFD3 )
|
||||
{
|
||||
}
|
||||
|
||||
public TravestysCollectionOfShells( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/The Citadel/TravestysFineTeakwoodTray.cs
Normal file
34
Scripts/Items/Misc/The Citadel/TravestysFineTeakwoodTray.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TravestysFineTeakwoodTray : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1075094; } } // Travesty's Fine Teakwood Tray
|
||||
|
||||
[Constructable]
|
||||
public TravestysFineTeakwoodTray() : base( Utility.Random( 0x991, 2 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TravestysFineTeakwoodTray( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/The Citadel/TravestysSushiPreparations.cs
Normal file
34
Scripts/Items/Misc/The Citadel/TravestysSushiPreparations.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TravestysSushiPreparations : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1075093; } } // Travesty's Sushi Preparations
|
||||
|
||||
[Constructable]
|
||||
public TravestysSushiPreparations() : base( Utility.Random( 0x1E15, 2 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TravestysSushiPreparations( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
151
Scripts/Items/Misc/TrashBarrel.cs
Normal file
151
Scripts/Items/Misc/TrashBarrel.cs
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Multis;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TrashBarrel : Container, IChopable
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1041064; } } // a trash barrel
|
||||
|
||||
public override int DefaultMaxWeight{ get{ return 0; } } // A value of 0 signals unlimited weight
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public TrashBarrel() : base( 0xE77 )
|
||||
{
|
||||
Hue = 0x3B2;
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public TrashBarrel( 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();
|
||||
|
||||
if ( Items.Count > 0 )
|
||||
{
|
||||
m_Timer = new EmptyTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( !base.OnDragDrop( from, dropped ) )
|
||||
return false;
|
||||
|
||||
if ( TotalItems >= 50 )
|
||||
{
|
||||
Empty( 501478 ); // The trash is full! Emptying!
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1010442 ); // The item will be deleted in three minutes
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
else
|
||||
m_Timer = new EmptyTimer( this );
|
||||
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
|
||||
{
|
||||
if ( !base.OnDragDropInto( from, item, p ) )
|
||||
return false;
|
||||
|
||||
if ( TotalItems >= 50 )
|
||||
{
|
||||
Empty( 501478 ); // The trash is full! Emptying!
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1010442 ); // The item will be deleted in three minutes
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
else
|
||||
m_Timer = new EmptyTimer( this );
|
||||
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnChop( Mobile from )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( from );
|
||||
|
||||
if ( house != null && house.IsCoOwner( from ) )
|
||||
{
|
||||
Effects.PlaySound( Location, Map, 0x3B3 );
|
||||
from.SendLocalizedMessage( 500461 ); // You destroy the item.
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void Empty( int message )
|
||||
{
|
||||
List<Item> items = this.Items;
|
||||
|
||||
if ( items.Count > 0 )
|
||||
{
|
||||
PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, message, "" );
|
||||
|
||||
for ( int i = items.Count - 1; i >= 0; --i )
|
||||
{
|
||||
if ( i >= items.Count )
|
||||
continue;
|
||||
|
||||
items[i].Delete();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
private class EmptyTimer : Timer
|
||||
{
|
||||
private TrashBarrel m_Barrel;
|
||||
|
||||
public EmptyTimer( TrashBarrel barrel ) : base( TimeSpan.FromMinutes( 3.0 ) )
|
||||
{
|
||||
m_Barrel = barrel;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Barrel.Empty( 501479 ); // Emptying the trashcan!
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Scripts/Items/Misc/TrashChest.cs
Normal file
61
Scripts/Items/Misc/TrashChest.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute( 0xE41, 0xE40 )]
|
||||
public class TrashChest : Container
|
||||
{
|
||||
public override int DefaultMaxWeight{ get{ return 0; } } // A value of 0 signals unlimited weight
|
||||
|
||||
public override bool IsDecoContainer
|
||||
{
|
||||
get{ return false; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public TrashChest() : base( 0xE41 )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public TrashChest( 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();
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( !base.OnDragDrop( from, dropped ) )
|
||||
return false;
|
||||
|
||||
PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, Utility.Random( 1042891, 8 ) );
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
|
||||
{
|
||||
if ( !base.OnDragDropInto( from, item, p ) )
|
||||
return false;
|
||||
|
||||
PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, Utility.Random( 1042891, 8 ) );
|
||||
item.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Scripts/Items/Misc/TribalBerry.cs
Normal file
46
Scripts/Items/Misc/TribalBerry.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TribalBerry : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1040001; } } // tribal berry
|
||||
|
||||
[Constructable]
|
||||
public TribalBerry() : this( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public TribalBerry( int amount ) : base( 0x9D0 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Stackable = true;
|
||||
Amount = amount;
|
||||
Hue = 6;
|
||||
}
|
||||
|
||||
public TribalBerry( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( Hue == 4 )
|
||||
Hue = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
85
Scripts/Items/Misc/TribalPaint.cs
Normal file
85
Scripts/Items/Misc/TribalPaint.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TribalPaint : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1040000; } } // savage kin paint
|
||||
|
||||
[Constructable]
|
||||
public TribalPaint() : base( 0x9EC )
|
||||
{
|
||||
Hue = 2101;
|
||||
Weight = 2.0;
|
||||
Stackable = Core.ML;
|
||||
}
|
||||
|
||||
public TribalPaint( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( Factions.Sigil.ExistsOn( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1010465 ); // You cannot disguise yourself while holding a sigil.
|
||||
}
|
||||
else if ( !from.CanBeginAction( typeof( Spells.Fifth.IncognitoSpell ) ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501698 ); // You cannot disguise yourself while incognitoed.
|
||||
}
|
||||
else if ( !from.CanBeginAction( typeof( Spells.Seventh.PolymorphSpell ) ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
|
||||
}
|
||||
else if( TransformationSpellHelper.UnderTransformation( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed.
|
||||
}
|
||||
else if ( Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1061634 ); // You cannot disguise yourself while in that form.
|
||||
}
|
||||
else if ( from.IsBodyMod || from.FindItemOnLayer( Layer.Helm ) is OrcishKinMask )
|
||||
{
|
||||
from.SendLocalizedMessage( 501605 ); // You are already disguised.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.BodyMod = ( from.Female ? 184 : 183 );
|
||||
from.HueMod = 0;
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
((PlayerMobile)from).SavagePaintExpiration = TimeSpan.FromDays( 7.0 );
|
||||
|
||||
from.SendLocalizedMessage( 1042537 ); // You now bear the markings of the savage tribe. Your body paint will last about a week or you can remove it with an oil cloth.
|
||||
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Scripts/Items/Misc/Twisted Weald/HornOfTheDreadhorn.cs
Normal file
34
Scripts/Items/Misc/Twisted Weald/HornOfTheDreadhorn.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x315C, 0x315D)]
|
||||
public class HornOfTheDreadhorn : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072089; } } // Horn of the Dread
|
||||
|
||||
[Constructable]
|
||||
public HornOfTheDreadhorn() : base( 0x315C )
|
||||
{
|
||||
}
|
||||
|
||||
public HornOfTheDreadhorn( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Twisted Weald/MangledHeadOfDreadhorn.cs
Normal file
34
Scripts/Items/Misc/Twisted Weald/MangledHeadOfDreadhorn.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable(0x3156, 0x3157)]
|
||||
public class MangledHeadOfDreadhorn : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1072088; } } // The Mangled Head of Dread Horn
|
||||
|
||||
[Constructable]
|
||||
public MangledHeadOfDreadhorn() : base( 0x3156 )
|
||||
{
|
||||
}
|
||||
|
||||
public MangledHeadOfDreadhorn( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
Scripts/Items/Misc/Twisted Weald/TaintedMushroom.cs
Normal file
34
Scripts/Items/Misc/Twisted Weald/TaintedMushroom.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class TaintedMushroom : Item
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1075088; } } // Dread Horn Tainted Mushroom
|
||||
public override bool ForceShowProperties{ get{ return true; } }
|
||||
|
||||
[Constructable]
|
||||
public TaintedMushroom() : base( Utility.RandomMinMax( 0x222E, 0x2231 ) )
|
||||
{
|
||||
}
|
||||
|
||||
public TaintedMushroom( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
117
Scripts/Items/Misc/UnholyBone.cs
Normal file
117
Scripts/Items/Misc/UnholyBone.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class UnholyBone : Item, ICarvable
|
||||
{
|
||||
private SpawnTimer m_Timer;
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "unholy bone"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public UnholyBone() : base( 0xF7E )
|
||||
{
|
||||
Movable = false;
|
||||
Hue = 0x497;
|
||||
|
||||
m_Timer = new SpawnTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public void Carve( Mobile from, Item item )
|
||||
{
|
||||
Effects.PlaySound( GetWorldLocation(), Map, 0x48F );
|
||||
Effects.SendLocationEffect( GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0 );
|
||||
|
||||
if ( 0.3 > Utility.RandomDouble() )
|
||||
{
|
||||
if ( ItemID == 0xF7E )
|
||||
from.SendMessage( "You destroy the bone." );
|
||||
else
|
||||
from.SendMessage( "You destroy the bone pile." );
|
||||
|
||||
Gold gold = new Gold( 25, 100 );
|
||||
|
||||
gold.MoveToWorld( GetWorldLocation(), Map );
|
||||
|
||||
Delete();
|
||||
|
||||
m_Timer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ItemID == 0xF7E )
|
||||
from.SendMessage( "You damage the bone." );
|
||||
else
|
||||
from.SendMessage( "You damage the bone pile." );
|
||||
}
|
||||
}
|
||||
|
||||
public UnholyBone( 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();
|
||||
|
||||
m_Timer = new SpawnTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
private class SpawnTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public SpawnTimer( Item item ) : base( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 10 ) ) )
|
||||
{
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Item.Deleted )
|
||||
return;
|
||||
|
||||
Mobile spawn;
|
||||
|
||||
switch ( Utility.Random( 12 ) )
|
||||
{
|
||||
default:
|
||||
case 0: spawn = new Skeleton(); break;
|
||||
case 1: spawn = new Zombie(); break;
|
||||
case 2: spawn = new Wraith(); break;
|
||||
case 3: spawn = new Spectre(); break;
|
||||
case 4: spawn = new Ghoul(); break;
|
||||
case 5: spawn = new Mummy(); break;
|
||||
case 6: spawn = new Bogle(); break;
|
||||
case 7: spawn = new RottingCorpse(); break;
|
||||
case 8: spawn = new BoneKnight(); break;
|
||||
case 9: spawn = new SkeletalKnight(); break;
|
||||
case 10: spawn = new Lich(); break;
|
||||
case 11: spawn = new LichLord(); break;
|
||||
}
|
||||
|
||||
spawn.MoveToWorld( m_Item.Location, m_Item.Map );
|
||||
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
242
Scripts/Items/Misc/WarningItem.cs
Normal file
242
Scripts/Items/Misc/WarningItem.cs
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class WarningItem : Item
|
||||
{
|
||||
private string m_WarningString;
|
||||
private int m_WarningNumber;
|
||||
private int m_Range;
|
||||
private TimeSpan m_ResetDelay;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string WarningString
|
||||
{
|
||||
get{ return m_WarningString; }
|
||||
set{ m_WarningString = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int WarningNumber
|
||||
{
|
||||
get{ return m_WarningNumber; }
|
||||
set{ m_WarningNumber = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Range
|
||||
{
|
||||
get{ return m_Range; }
|
||||
set{ if ( value > 18 ) value = 18; m_Range = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan ResetDelay
|
||||
{
|
||||
get{ return m_ResetDelay; }
|
||||
set{ m_ResetDelay = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WarningItem( int itemID, int range, int warning ) : base( itemID )
|
||||
{
|
||||
if ( range > 18 )
|
||||
range = 18;
|
||||
|
||||
Movable = false;
|
||||
|
||||
m_WarningNumber = warning;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WarningItem( int itemID, int range, string warning ) : base( itemID )
|
||||
{
|
||||
if ( range > 18 )
|
||||
range = 18;
|
||||
|
||||
Movable = false;
|
||||
|
||||
m_WarningString = warning;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
public WarningItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
private bool m_Broadcasting;
|
||||
|
||||
private DateTime m_LastBroadcast;
|
||||
|
||||
public virtual void SendMessage( Mobile triggerer, bool onlyToTriggerer, string messageString, int messageNumber )
|
||||
{
|
||||
if ( onlyToTriggerer )
|
||||
{
|
||||
if ( messageString != null )
|
||||
triggerer.SendMessage( messageString );
|
||||
else
|
||||
triggerer.SendLocalizedMessage( messageNumber );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( messageString != null )
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, false, messageString );
|
||||
else
|
||||
PublicOverheadMessage( MessageType.Regular, 0x3B2, messageNumber );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool OnlyToTriggerer{ get{ return false; } }
|
||||
public virtual int NeighborRange { get { return 5; } }
|
||||
|
||||
public virtual void Broadcast( Mobile triggerer )
|
||||
{
|
||||
if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + m_ResetDelay)) )
|
||||
return;
|
||||
|
||||
m_LastBroadcast = DateTime.UtcNow;
|
||||
|
||||
m_Broadcasting = true;
|
||||
|
||||
SendMessage( triggerer, this.OnlyToTriggerer, m_WarningString, m_WarningNumber );
|
||||
|
||||
if ( NeighborRange >= 0 )
|
||||
{
|
||||
List<WarningItem> list = new List<WarningItem>();
|
||||
|
||||
foreach ( Item item in GetItemsInRange( NeighborRange ) )
|
||||
{
|
||||
if ( item != this && item is WarningItem )
|
||||
list.Add( (WarningItem)item );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < list.Count; i++ )
|
||||
list[i].Broadcast( triggerer );
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( InternalCallback ) );
|
||||
}
|
||||
|
||||
private void InternalCallback()
|
||||
{
|
||||
m_Broadcasting = false;
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return true; } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Player && Utility.InRange( m.Location, Location, m_Range ) && !Utility.InRange( oldLocation, Location, m_Range ) )
|
||||
Broadcast( m );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( (string) m_WarningString );
|
||||
writer.Write( (int) m_WarningNumber );
|
||||
writer.Write( (int) m_Range );
|
||||
|
||||
writer.Write( (TimeSpan) m_ResetDelay );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_WarningString = reader.ReadString();
|
||||
m_WarningNumber = reader.ReadInt();
|
||||
m_Range = reader.ReadInt();
|
||||
m_ResetDelay = reader.ReadTimeSpan();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HintItem : WarningItem
|
||||
{
|
||||
private string m_HintString;
|
||||
private int m_HintNumber;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string HintString
|
||||
{
|
||||
get{ return m_HintString; }
|
||||
set{ m_HintString = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int HintNumber
|
||||
{
|
||||
get{ return m_HintNumber; }
|
||||
set{ m_HintNumber = value; }
|
||||
}
|
||||
|
||||
public override bool OnlyToTriggerer{ get{ return true; } }
|
||||
|
||||
[Constructable]
|
||||
public HintItem( int itemID, int range, int warning, int hint ) : base( itemID, range, warning )
|
||||
{
|
||||
m_HintNumber = hint;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HintItem( int itemID, int range, string warning, string hint ) : base( itemID, range, warning )
|
||||
{
|
||||
m_HintString = hint;
|
||||
}
|
||||
|
||||
public HintItem( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
SendMessage( from, true, m_HintString, m_HintNumber );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( (string) m_HintString );
|
||||
writer.Write( (int) m_HintNumber );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_HintString = reader.ReadString();
|
||||
m_HintNumber = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
161
Scripts/Items/Misc/Waypoint.cs
Normal file
161
Scripts/Items/Misc/Waypoint.cs
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAttribute( 0x1f14, 0x1f15, 0x1f16, 0x1f17 )]
|
||||
public class WayPoint : Item
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "WayPointSeq", AccessLevel.GameMaster, new CommandEventHandler( WayPointSeq_OnCommand ) );
|
||||
}
|
||||
|
||||
public static void WayPointSeq_OnCommand( CommandEventArgs arg )
|
||||
{
|
||||
arg.Mobile.SendMessage( "Target the position of the first way point." );
|
||||
arg.Mobile.Target = new WayPointSeqTarget( null );
|
||||
}
|
||||
|
||||
private WayPoint m_Next;
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "AI Way Point"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public WayPoint() : base( 0x1f14 )
|
||||
{
|
||||
this.Hue = 0x498;
|
||||
this.Visible = false;
|
||||
//this.Movable = false;
|
||||
}
|
||||
|
||||
public WayPoint( WayPoint prev ) : this()
|
||||
{
|
||||
if ( prev != null )
|
||||
prev.NextPoint = this;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public WayPoint NextPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Next;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ( m_Next != this )
|
||||
m_Next = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
{
|
||||
from.SendMessage( "Target the next way point in the sequence." );
|
||||
|
||||
from.Target = new NextPointTarget( this );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Next == null )
|
||||
LabelTo( from, "(Unlinked)" );
|
||||
else
|
||||
LabelTo( from, "(Linked: {0})", m_Next.Location );
|
||||
}
|
||||
|
||||
public WayPoint( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Next = reader.ReadItem() as WayPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( m_Next );
|
||||
}
|
||||
}
|
||||
|
||||
public class NextPointTarget : Target
|
||||
{
|
||||
private WayPoint m_Point;
|
||||
|
||||
public NextPointTarget( WayPoint pt ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_Point = pt;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object target )
|
||||
{
|
||||
if ( target is WayPoint && m_Point != null )
|
||||
{
|
||||
m_Point.NextPoint = (WayPoint)target;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "Target a way point." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WayPointSeqTarget : Target
|
||||
{
|
||||
private WayPoint m_Last;
|
||||
|
||||
public WayPointSeqTarget( WayPoint last ) : base( -1, true, TargetFlags.None )
|
||||
{
|
||||
m_Last = last;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is WayPoint )
|
||||
{
|
||||
if ( m_Last != null )
|
||||
m_Last.NextPoint = (WayPoint)targeted;
|
||||
}
|
||||
else if ( targeted is IPoint3D )
|
||||
{
|
||||
Point3D p = new Point3D( (IPoint3D)targeted );
|
||||
|
||||
WayPoint point = new WayPoint( m_Last );
|
||||
point.MoveToWorld( p, from.Map );
|
||||
|
||||
from.Target = new WayPointSeqTarget( point );
|
||||
from.SendMessage( "Target the position of the next way point in the sequence, or target a way point link the newest way point to." );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "Target a position, or another way point." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
189
Scripts/Items/Misc/WindChimes.cs
Normal file
189
Scripts/Items/Misc/WindChimes.cs
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseWindChimes : Item
|
||||
{
|
||||
private bool m_TurnedOn;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool TurnedOn
|
||||
{
|
||||
get{ return m_TurnedOn; }
|
||||
set{ m_TurnedOn = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public BaseWindChimes( int itemID ) : base( itemID )
|
||||
{
|
||||
}
|
||||
|
||||
private static int[] m_Sounds = new int[] { 0x505, 0x506, 0x507 };
|
||||
|
||||
public static int[] Sounds
|
||||
{
|
||||
get{ return m_Sounds; }
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return m_TurnedOn && IsLockedDown; } }
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, this.Location, 2 ) && !Utility.InRange( oldLocation, this.Location, 2 ) )
|
||||
Effects.PlaySound( this.Location, this.Map, m_Sounds[Utility.Random( m_Sounds.Length )] );
|
||||
|
||||
base.OnMovement( m, oldLocation );
|
||||
}
|
||||
|
||||
public BaseWindChimes( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_TurnedOn )
|
||||
list.Add( 502695 ); // turned on
|
||||
else
|
||||
list.Add( 502696 ); // turned off
|
||||
}
|
||||
|
||||
public bool IsOwner( Mobile mob )
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt( this );
|
||||
|
||||
return ( house != null && house.IsOwner( mob ) );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsOwner( from ) )
|
||||
{
|
||||
OnOffGump onOffGump = new OnOffGump( this );
|
||||
from.SendGump( onOffGump );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502691 ); // You must be the owner to use this.
|
||||
}
|
||||
}
|
||||
|
||||
private class OnOffGump : Gump
|
||||
{
|
||||
private BaseWindChimes m_Chimes;
|
||||
|
||||
public OnOffGump( BaseWindChimes chimes ) : base( 150, 200 )
|
||||
{
|
||||
m_Chimes = chimes;
|
||||
|
||||
AddBackground( 0, 0, 300, 150, 0xA28 );
|
||||
AddHtmlLocalized( 45, 20, 300, 35, chimes.TurnedOn ? 1011035 : 1011034, false, false ); // [De]Activate this item
|
||||
AddButton( 40, 53, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 80, 55, 65, 35, 1011036, false, false ); // OKAY
|
||||
AddButton( 150, 53, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 190, 55, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
bool newValue = !m_Chimes.TurnedOn;
|
||||
|
||||
m_Chimes.TurnedOn = newValue;
|
||||
|
||||
if ( newValue && !m_Chimes.IsLockedDown )
|
||||
from.SendLocalizedMessage( 502693 ); // Remember, this only works when locked down.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 502694 ); // Cancelled action.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_TurnedOn );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_TurnedOn = reader.ReadBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WindChimes : BaseWindChimes
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030290; } }
|
||||
|
||||
[Constructable]
|
||||
public WindChimes() : base( 0x2832 )
|
||||
{
|
||||
}
|
||||
|
||||
public WindChimes( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class FancyWindChimes : BaseWindChimes
|
||||
{
|
||||
public override int LabelNumber{ get{ return 1030291; } }
|
||||
|
||||
[Constructable]
|
||||
public FancyWindChimes() : base( 0x2833 )
|
||||
{
|
||||
}
|
||||
|
||||
public FancyWindChimes( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue