Overwrite

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

View File

@@ -0,0 +1,652 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Server;
using Server.Accounting;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;
using Server.Commands;
namespace Server.Commands
{
/// <summary>
/// David M. O'Hara
/// 08-11-04
/// Version 2.1
/// Gives item (targeted or given type) into bank box. Distribution can be 1 per account, 1 per character, or
/// based on AccessLevel (good for staff items).
/// </summary>
// Update by X-SirSly-X
// 12/15/2005
// www.LandofObsidian.com
// The update fixes a issue when a item is given only once per account. The problem happens when a player deletes their first char which is char slot 0. So if char slot 0 is empty it just skips over that player, and they end up not getting a item in their bank.
public class AddToBank
{
public static void Initialize()
{
// alter AccessLevel to be AccessLevel.Admin if you only want admins to use.
CommandSystem.Register( "AddToBank", AccessLevel.Administrator, new CommandEventHandler( AddToBank_OnCommand ) );
}
private static void AddToBank_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new AddToBankGump() );
}
private static void PlaceItemIn( Container parent, int x, int y, Item item )
{
parent.AddItem( item );
item.Location = new Point3D( x, y, 0 );
}
#region " Targeting/Dupe System "
public class DupeTarget : Target
{
private bool m_InBag;
private int m_Amount;
private int m_GiveRule;
private int m_Access;
public DupeTarget( bool inbag, int amount, int give, int access ) : base( 15, false, TargetFlags.None )
{
m_InBag = inbag;
m_Amount = amount;
m_GiveRule = give;
m_Access = access;
}
protected override void OnTarget( Mobile from, object targ )
{
if ( !(targ is Item) )
{
from.SendMessage( "You can only dupe items." );
return;
}
from.SendMessage( "Placing {0} into bank boxes...", ((Item)targ).Name == null ? "an item" : ((Item)targ).Name.ToString() );
CommandLogging.WriteLine( from, "{0} {1} adding {2} to bank boxes )", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targ ) );
GiveItem( from, (Item)targ, m_Amount, m_GiveRule, m_Access );
}
}
public static void GiveItem( Mobile from, Item item, int amount, int give, int access )
{
bool done = true;
if ( give == (int)AddToBankGump.Switches.GiveToAccount )
{
done = AddToBank.GiveItemToAccounts( item, amount );
}
else if ( give == (int)AddToBankGump.Switches.GiveToCharacter )
{
done = AddToBank.GiveItemToCharacters( item, amount );
}
else if ( give == (int)AddToBankGump.Switches.GiveToAccessLevel )
{
done = AddToBank.GiveItemToAccessLevel( item, amount, access );
}
if ( !done )
{
from.SendMessage( "Unable to give out to 1 or more players." );
}
else
{
from.SendMessage( "Completed." );
}
}
private static bool GiveItemToAccounts( Item item, int amount )
{
bool success = true;
foreach ( Account acct in Accounts.GetAccounts() )
{
if ( acct[0] != null )
{
if ( !CopyItem( item, amount, acct[0].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[0].Name );
success = false;
}
}
else if ( acct[0] == null )
{
if ( acct[1] != null )
{
if ( !CopyItem( item, amount, acct[1].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[1].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[2] != null )
{
if ( !CopyItem( item, amount, acct[2].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[2].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[3] != null )
{
if ( !CopyItem( item, amount, acct[3].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[3].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[4] != null )
{
if ( !CopyItem( item, amount, acct[4].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[4].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[5] != null )
{
if ( !CopyItem( item, amount, acct[5].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[5].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[6] != null )
{
if ( !CopyItem( item, amount, acct[6].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[6].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[7] != null )
{
if ( !CopyItem( item, amount, acct[7].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[7].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[8] != null )
{
if ( !CopyItem( item, amount, acct[8].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[8].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[9] != null )
{
if ( !CopyItem( item, amount, acct[9].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[9].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[10] != null )
{
if ( !CopyItem( item, amount, acct[10].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[10].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[11] != null )
{
if ( !CopyItem( item, amount, acct[11].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[11].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[12] != null )
{
if ( !CopyItem( item, amount, acct[12].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[12].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[13] != null )
{
if ( !CopyItem( item, amount, acct[13].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[13].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[14] != null )
{
if ( !CopyItem( item, amount, acct[14].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[14].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[15] != null )
{
if ( !CopyItem( item, amount, acct[15].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[15].Name );
success = false;
}
}
}
else if ( acct[0] == null )
{
if ( acct[16] != null )
{
if ( !CopyItem( item, amount, acct[16].BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", acct[16].Name );
success = false;
}
}
}
}
return success;
}
private static bool GiveItemToCharacters( Item item, int amount )
{
bool success = true;
List<Mobile> mobs = new List<Mobile>( World.Mobiles.Values );
foreach ( Mobile m in mobs )
{
if ( m is PlayerMobile )
{
if ( !CopyItem( item, amount, m.BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", m.Name );
success = false;
}
}
}
return success;
}
private static bool GiveItemToAccessLevel( Item item, int amount, int access )
{
bool success = true;
List<Mobile> mobs = new List<Mobile>( World.Mobiles.Values );
foreach ( Mobile m in mobs )
{
if ( m is PlayerMobile )
{
bool give = false;
if ( ( access & (int)AddToBankGump.Switches.Administrator ) != 0 && m.AccessLevel == AccessLevel.Administrator )
{
give = true;
}
else if ( ( access & (int)AddToBankGump.Switches.GameMaster ) != 0 && m.AccessLevel == AccessLevel.GameMaster )
{
give = true;
}
else if ( ( access & (int)AddToBankGump.Switches.Seer ) != 0 && m.AccessLevel == AccessLevel.Seer )
{
give = true;
}
else if ( ( access & (int)AddToBankGump.Switches.Counselor ) != 0 && m.AccessLevel == AccessLevel.Counselor )
{
give = true;
}
if ( give )
{
if ( !CopyItem( item, amount, m.BankBox ) )
{
Console.WriteLine( "Could not give item to {0}", m.Name );
success = false;
}
}
}
}
return success;
}
private static bool CopyItem( Item item, int count, Container container)
{
bool m_Success = false;
Type t = item.GetType();
ConstructorInfo[] info = t.GetConstructors();
foreach ( ConstructorInfo c in info )
{
ParameterInfo[] paramInfo = c.GetParameters();
if ( paramInfo.Length == 0 )
{
object[] objParams = new object[0];
try
{
for (int i=0;i<count;i++)
{
object o = c.Invoke( objParams );
if ( o != null && o is Item )
{
Item newItem = (Item)o;
CopyProperties( newItem, item );
newItem.Parent = null;
// recurse if container
if ( item is Container && newItem.Items.Count == 0 )
{
for ( int x=0;x<item.Items.Count;x++ )
{
m_Success = CopyItem( (Item)item.Items[x], 1, (Container)newItem );
}
}
if ( container != null )
PlaceItemIn( container, 20 + (i*10),10, newItem );
}
}
m_Success = true;
}
catch
{
m_Success = false;
}
}
} // end foreach
return m_Success;
} // end function
private static void CopyProperties ( Item dest, Item src )
{
PropertyInfo[] props = src.GetType().GetProperties();
for ( int i = 0; i < props.Length; i++ )
{
try
{
if ( props[i].CanRead && props[i].CanWrite )
{
//Console.WriteLine( "Setting {0} = {1}", props[i].Name, props[i].GetValue( src, null ) );
if ( src is Container && ( props[i].Name == "TotalWeight" || props[i].Name == "TotalItems" ) )
{
// don't set these props
}
else
{
props[i].SetValue( dest, props[i].GetValue( src, null ), null );
}
}
}
catch
{
//Console.WriteLine( "Denied" );
}
}
}
#endregion
} // end class
#region " Gump "
public class AddToBankGump : Gump
{
private int m_Amount;
public void RenderGump()
{
m_Amount = 1;
RenderGump( 100, 0, string.Empty );
}
public void RenderGump( int rule, int access, string type)
{
AddPage( 0 );
AddBackground( 0, 0, 400, 270, 9260 );
AddLabel( 125, 20, 52, @"Distribute Items to Shard" );
AddLabel( 25, 40, 52, @"Rules:" );
AddLabel( 260, 60, 2100, @"Amount:" );
AddLabel( 315, 60, 2100, m_Amount.ToString() );
AddButton( 330, 62, 9700, 9701, (int)Buttons.IncAmount, GumpButtonType.Reply, 1 );
AddButton( 345, 62, 9704, 9705, (int)Buttons.DecAmount, GumpButtonType.Reply, -1 );
AddRadio( 35, 60, 209, 208, rule == (int)Switches.GiveToAccount, (int)Switches.GiveToAccount );
AddLabel( 65, 60, 2100, @"Per Account" );
AddRadio( 35, 80, 209, 208, rule == (int)Switches.GiveToCharacter, (int)Switches.GiveToCharacter );
AddLabel( 65, 80, 2100, @"Per Character (Mobile)" );
AddRadio( 35, 100, 209, 208, rule == (int)Switches.GiveToAccessLevel, (int)Switches.GiveToAccessLevel );
AddLabel( 65, 100, 2100, @"Per AccessLevel" );
AddCheck( 80, 125, 210, 211, ( access & (int)Switches.Administrator ) != 0, (int)Switches.Administrator );
AddLabel( 105, 125, 2100, @"Administrator" );
AddCheck( 215, 125, 210, 211, ( access & (int)Switches.GameMaster ) != 0, (int)Switches.GameMaster );
AddLabel( 240, 125, 2100, @"GameMaster" );
AddCheck( 80, 150, 210, 211, ( access & (int)Switches.Seer ) != 0, (int)Switches.Seer );
AddLabel( 105, 150, 2100, @"Seer" );
AddCheck( 215, 150, 210, 211, ( access & (int)Switches.Counselor ) != 0, (int)Switches.Counselor );
AddLabel( 240, 150, 2100, @"Counselor" );
AddLabel( 80, 185, 52, @"Give By Type" );
AddLabel( 280, 185, 52, @"Give By Target" );
AddImageTiled( 40, 210, 160, 20, 9274 );
AddTextEntry( 45, 210, 150, 20, 2100, 100, type );
AddButton( 200, 210, 4014, 4016, (int)Buttons.GiveByType, GumpButtonType.Reply, 0 );
AddButton( 310, 210, 4005, 4007, (int)Buttons.GiveByTarget, GumpButtonType.Reply, 1 );
}
public AddToBankGump() : base( 50, 50 )
{
RenderGump();
}
public AddToBankGump( int GiveRule, int Access, string TypeName, int Amount ) : base( 50, 50 )
{
m_Amount = Amount;
RenderGump( GiveRule, Access, TypeName );
}
public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
string TypeName = string.Empty;
int GiveRule = 0;
int Access = 0;
foreach( int sw in info.Switches )
{
switch ( sw )
{
case (int)Switches.GiveToCharacter:
{
GiveRule = (int)Switches.GiveToCharacter;
break;
}
case (int)Switches.GiveToAccount:
{
GiveRule = (int)Switches.GiveToAccount;
break;
}
case (int)Switches.GiveToAccessLevel:
{
GiveRule = (int)Switches.GiveToAccessLevel;
break;
}
case (int)Switches.Administrator:
case (int)Switches.GameMaster:
case (int)Switches.Seer:
case (int)Switches.Counselor:
{
Access += sw;
break;
}
}
}
if ( GiveRule == 0 )
{
from.SendMessage( "You must select the audience rule to receive the item." );
from.SendGump( new AddToBankGump( GiveRule, Access, TypeName, m_Amount ) );
return;
}
else if ( GiveRule == (int)Switches.GiveToAccessLevel && Access == 0 )
{
from.SendMessage( "You must select the AccessLevel to receive the item." );
from.SendGump( new AddToBankGump( GiveRule, Access, TypeName, m_Amount ) );
return;
}
switch( info.ButtonID )
{
case (int)Buttons.GiveByTarget:
{
from.Target = new AddToBank.DupeTarget( false, m_Amount, GiveRule, Access );
from.SendMessage( "What do you wish to give out?" );
break;
}
case (int)Buttons.GiveByType:
{
if ( info.TextEntries.Length > 0 )
{
TypeName = info.TextEntries[0].Text;
}
if ( TypeName == string.Empty )
{
from.SendMessage( "You must specify a type" );
from.SendGump( new AddToBankGump( GiveRule, Access, TypeName, m_Amount ) );
}
else
{
Type type = ScriptCompiler.FindTypeByName( TypeName, true );
if ( type == null )
{
from.SendMessage( "{0} is not a valid type", type );
from.SendGump( new AddToBankGump( GiveRule, Access, string.Empty, m_Amount ) );
return;
}
else
{
object obj = Activator.CreateInstance( type );
if ( obj is Item )
AddToBank.GiveItem( from, (Item)obj, m_Amount, GiveRule, Access );
else
{
from.SendMessage( "You may only duplicate items." );
}
}
}
break;
}
case (int)Buttons.IncAmount:
{
from.SendGump( new AddToBankGump( GiveRule, Access, TypeName, ++m_Amount ) );
break;
}
case (int)Buttons.DecAmount:
{
if ( m_Amount > 1 )
m_Amount -= 1;
else
from.SendMessage( "You cannot give less than 1 item." );
from.SendGump( new AddToBankGump( GiveRule, Access, TypeName, m_Amount ) );
break;
}
}
}
public enum Buttons
{
Cancel,
GiveByTarget,
GiveByType,
IncAmount,
DecAmount
}
public enum Switches
{
Administrator = 1,
GameMaster = 2,
Seer = 4,
Counselor = 8,
GiveToAccount = 100,
GiveToCharacter = 200,
GiveToAccessLevel = 300
}
} // end class AddToBankGump
#endregion
} // end namespace

View File

@@ -0,0 +1,452 @@
// AddToParty Command v1.1.0
// Author: Felladrin
// Created at 2013-11-21
// Updated at 2016-01-01
using System;
using System.Collections.Generic;
using Server;
using Server.Commands;
using Server.Engines.PartySystem;
using Server.Factions;
using Server.Gumps;
using Server.Network;
namespace Felladrin.Commands
{
public static class AddToParty
{
public static class Config
{
public static bool Enabled = true; // Is this command enabled?
public static bool OnlyLeadersCanAdd = true; // New party members can only be added by the party leader?
}
public static void Initialize()
{
if (Config.Enabled)
CommandSystem.Register("AddToParty", AccessLevel.Player, new CommandEventHandler(OnCommand));
}
[Usage("AddToParty <Name>")]
[Description("Used to add a player to your party. Optionally you can provide a name to filter.")]
public static void OnCommand(CommandEventArgs e)
{
e.Mobile.CloseGump(typeof(AddToPartyGump));
e.Mobile.SendGump(new AddToPartyGump(e.Mobile, e.ArgString));
}
public class PartyInvitationGump : Gump
{
Mobile m_Target, m_From;
public PartyInvitationGump(Mobile from, Mobile target)
: base(0, 0)
{
m_From = from;
m_Target = target;
DeclineTimer.Start(target, from);
Timer.DelayCall(TimeSpan.FromSeconds(30), delegate { target.CloseGump(typeof(PartyInvitationGump)); });
Closable = false;
Disposable = false;
Dragable = true;
Resizable = false;
AddPage(0);
AddBackground(11, 318, 225, 239, 9270);
AddButton(136, 520, 12018, 12020, (int)Buttons.GumpRefuse, GumpButtonType.Reply, 0);
AddButton(35, 520, 12000, 12002, (int)Buttons.GumpAccept, GumpButtonType.Reply, 0);
AddLabel(30, 335, 95, string.Format("Invitation from {0}", m_From.Name));
AddLabel(30, 360, 68, string.Format("Do you want to join {0} party?", ((m_From.Female) ? "her" : "his")));
AddImage(33, 386, 11413);
}
public enum Buttons
{
GumpRefuse,
GumpAccept,
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_From == null || m_Target == null)
return;
switch (info.ButtonID)
{
case (int)Buttons.GumpRefuse:
PartyCommands.Handler.OnDecline(m_Target, m_From);
break;
case (int)Buttons.GumpAccept:
PartyCommands.Handler.OnAccept(m_Target, m_From);
break;
}
}
}
public class AddToPartyGump : Gump
{
public static bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
static readonly int EntryWidth = 180;
static readonly int EntryCount = 15;
static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
static readonly int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 1));
static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
Mobile m_Owner;
readonly List<Mobile> m_Mobiles;
int m_Page;
class InternalComparer : IComparer<Mobile>
{
public static readonly IComparer<Mobile> Instance = new InternalComparer();
public InternalComparer() { }
public int Compare(Mobile x, Mobile y)
{
if (x == null || y == null)
throw new ArgumentException();
if (x.AccessLevel > y.AccessLevel)
return -1;
else if (x.AccessLevel < y.AccessLevel)
return 1;
else
return Insensitive.Compare(x.Name, y.Name);
}
}
public AddToPartyGump(Mobile owner, string filter)
: this(owner, BuildList(owner, filter), 0)
{
}
public AddToPartyGump(Mobile owner, List<Mobile> list, int page)
: base(GumpOffsetX, GumpOffsetY)
{
owner.CloseGump(typeof(AddToPartyGump));
m_Owner = owner;
m_Mobiles = list;
if (m_Mobiles.Count == 0)
{
owner.SendMessage(38, "There are no players available to invite.");
}
else if (m_Mobiles.Count == 1)
{
Mobile m = m_Mobiles[0];
Party p = Party.Get(owner);
Party mp = Party.Get(m);
if (owner == m)
owner.SendLocalizedMessage(1005439); // You cannot add yourself to a party.
else if (Config.OnlyLeadersCanAdd && p != null && p.Leader != owner)
owner.SendLocalizedMessage(1005453); // You may only add members to the party if you are the leader.
else if (p != null && (p.Members.Count + p.Candidates.Count) >= Party.Capacity)
owner.SendLocalizedMessage(1008095); // You may only have 10 in your party (this includes candidates).
else if (!m.Player)
owner.SendLocalizedMessage(1005444); // The creature ignores your offer.
else if (mp != null && mp == p)
owner.SendLocalizedMessage(1005440); // This person is already in your party!
else if (mp != null)
owner.SendLocalizedMessage(1005441); // This person is already in a party!
else
{
Faction ourFaction = Faction.Find(owner);
Faction theirFaction = Faction.Find(m);
if (ourFaction != null && theirFaction != null && ourFaction != theirFaction)
{
owner.SendLocalizedMessage(1008088); // You cannot have players from opposing factions in the same party!
m.SendLocalizedMessage(1008093); // The party cannot have members from opposing factions.
return;
}
if (p == null)
owner.Party = p = new Party(owner);
if (!p.Candidates.Contains(m))
p.Candidates.Add(m);
m.SendGump(new PartyInvitationGump(owner, m));
m.Send(new PartyInvitation(owner));
m.Party = owner;
owner.SendMessage(68, "Invitation sent to {0}.", m.Name);
}
}
else
{
InitializeGump(page);
owner.SendMessage("Who would you like to add to your party?");
}
}
public static List<Mobile> BuildList(Mobile owner, string filter)
{
if (filter != null && (filter = filter.Trim()).Length == 0)
filter = null;
else
filter = filter.ToLower();
List<Mobile> list = new List<Mobile>();
List<NetState> states = NetState.Instances;
for (int i = 0; i < states.Count; ++i)
{
Mobile m = states[i].Mobile;
if (m != null)
{
if (filter != null && (m.Name == null || m.Name.ToLower().IndexOf(filter) < 0))
continue;
if (m == owner || m.AccessLevel > AccessLevel.Player)
continue;
if (owner.Party != null && owner.Party == m.Party)
continue;
list.Add(m);
}
}
list.Sort(InternalComparer.Instance);
return list;
}
public void InitializeGump(int page)
{
m_Page = page;
int count = m_Mobiles.Count - (page * EntryCount);
if (count < 0)
count = 0;
else if (count > EntryCount)
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1));
AddPage(0);
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID);
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4) - (OldStyle ? SetWidth + OffsetSize : 0);
if (!OldStyle)
AddImageTiled(x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID);
AddLabel(x + TextOffsetX, y, TextHue, String.Format("Add who? (Page {0}/{1})", page + 1, (m_Mobiles.Count + EntryCount - 1) / EntryCount));
x += emptyWidth + OffsetSize;
if (OldStyle)
AddImageTiled(x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID);
else
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (page > 0)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0);
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if ((page + 1) * EntryCount < m_Mobiles.Count)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
}
for (int i = 0, index = page * EntryCount; i < EntryCount && index < m_Mobiles.Count; ++i, ++index)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
Mobile m = m_Mobiles[index];
AddImageTiled(x, y, EntryWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, GetHueFor(m), m.Deleted ? "(deleted)" : m.Name);
x += EntryWidth + OffsetSize;
if (SetGumpID != 0)
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
if (m.NetState != null && !m.Deleted)
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3, GumpButtonType.Reply, 0);
}
}
static int GetHueFor(Mobile m)
{
switch (m.AccessLevel)
{
case AccessLevel.Owner:
case AccessLevel.Developer:
case AccessLevel.Administrator:
return 0x516;
case AccessLevel.Seer:
return 0x144;
case AccessLevel.GameMaster:
return 0x21;
case AccessLevel.Counselor:
return 0x2;
default:
{
if (m.Kills >= 5)
return 0x21;
else if (m.Criminal)
return 0x3B1;
return 0x58;
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
switch (info.ButtonID)
{
case 0: // Closed
{
return;
}
case 1: // Previous
{
if (m_Page > 0)
from.SendGump(new AddToPartyGump(from, m_Mobiles, m_Page - 1));
break;
}
case 2: // Next
{
if ((m_Page + 1) * EntryCount < m_Mobiles.Count)
from.SendGump(new AddToPartyGump(from, m_Mobiles, m_Page + 1));
break;
}
default:
{
int index = (m_Page * EntryCount) + (info.ButtonID - 3);
if (index >= 0 && index < m_Mobiles.Count)
{
Mobile m = m_Mobiles[index];
if (m.Deleted)
{
from.SendMessage("That player has deleted their character.");
from.SendGump(new AddToPartyGump(from, m_Mobiles, m_Page));
}
else if (m.NetState == null)
{
from.SendMessage("That player is no longer online.");
from.SendGump(new AddToPartyGump(from, m_Mobiles, m_Page));
}
else
{
Party p = Party.Get(from);
Party mp = Party.Get(m);
if (from == m)
from.SendLocalizedMessage(1005439); // You cannot add yourself to a party.
else if (Config.OnlyLeadersCanAdd && p != null && p.Leader != from)
from.SendLocalizedMessage(1005453); // You may only add members to the party if you are the leader.
else if (p != null && (p.Members.Count + p.Candidates.Count) >= Party.Capacity)
from.SendLocalizedMessage(1008095); // You may only have 10 in your party (this includes candidates).
else if (!m.Player)
from.SendLocalizedMessage(1005444); // The creature ignores your offer.
else if (mp != null && mp == p)
from.SendLocalizedMessage(1005440); // This person is already in your party!
else if (mp != null)
from.SendLocalizedMessage(1005441); // This person is already in a party!
else
{
Faction ourFaction = Faction.Find(from);
Faction theirFaction = Faction.Find(m);
if (ourFaction != null && theirFaction != null && ourFaction != theirFaction)
{
from.SendLocalizedMessage(1008088); // You cannot have players from opposing factions in the same party!
m.SendLocalizedMessage(1008093); // The party cannot have members from opposing factions.
break;
}
if (p == null)
from.Party = p = new Party(from);
if (!p.Candidates.Contains(m))
p.Candidates.Add(m);
m.SendGump(new PartyInvitationGump(from, m));
m.Send(new PartyInvitation(from));
m.Party = from;
from.SendMessage(68, "Invitation sent to {0}.", m.Name);
}
}
}
break;
}
}
}
}
}
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections;
using Server;
using Server.Targeting;
using Server.Items;
using Server.Multis;
using Server.Network;
namespace Server.Commands
{
public class Addon2Static
{
public static void Initialize()
{
CommandSystem.Register( "Addon2Static", AccessLevel.Administrator, new CommandEventHandler( Addon2Static_OnCommand ) );
}
[Usage( "Addon2Static" )]
[Description( "Statify an Addon structure" )]
private static void Addon2Static_OnCommand( CommandEventArgs e )
{
e.Mobile.SendMessage("Please select the Addon structure you want to statify");
e.Mobile.Target = new AddonSelector();
}
///// //// /// // / BEGIN TARGET / // /// //// /////
private class AddonSelector : Target
{
public AddonSelector () : base( -1, false, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is AddonComponent )
{
BaseAddon design = ((AddonComponent)targeted).Addon;
if ( design.Components.Count > 0 )
{
for ( int i = 0; i < design.Components.Count; ++i )
{
AddonComponent component = (AddonComponent)((design.Components)[i]);
Static equivalent = new Static( component.HuedItemID ); //( component.ItemID );
equivalent.Location = component.Location; //component.Location;
equivalent.Map = component.Map; //component.Map;
equivalent.Hue = component.Hue; //component.Map;
}
}
design.Delete();
from.SendMessage("Addon structure statified. You can now freeze it.");
}
}
}
///// //// /// // / END TARGET / // /// //// /////
}
}

View File

@@ -0,0 +1,264 @@
using System;
using Server;
using Server.Network;
using Server.Gumps;
using Server.Items;
using Server.Targeting;
using Server.Engines.XmlSpawner2;
using Server.Commands;
namespace Server.Gumps
{
public class AddOnEditor : Gump
{
private AddOnEditor_Att _AddOnAtt;
public AddOnEditor( Mobile from, AddOnEditor_Att att ) : base( 100, 100 )
{
_AddOnAtt = att;
Closable=true; Disposable=true; Dragable=true; Resizable=false;
AddPage(0);
// Buttons hidden behind the background, but are still functional
AddButton(27, 80, 1042, 248, (int)Buttons.Select, GumpButtonType.Reply, 0);
AddButton(27, 117, 1042, 248, (int)Buttons.AddItem, GumpButtonType.Reply, 0);
AddButton(27, 154, 1042, 248, (int)Buttons.RemoveItem, GumpButtonType.Reply, 0);
AddButton(27, 191, 1042, 248, (int)Buttons.DeleteItem, GumpButtonType.Reply, 0);
AddButton(27, 228, 1042, 248, (int)Buttons.CreateAddon, GumpButtonType.Reply, 0);
AddBackground(0, 0, 241, 287, 9270);
AddBackground(15, 15, 211, 257, 9200);
AddHtml( 21, 18, 196, 18, @"<BASEFONT COLOR=#FFFFFF><center><big>Addon Editor", (bool)false, (bool)false);
//Close Button
AddButton(211, 5, 25, 26, (int)Buttons.Close, GumpButtonType.Reply, 0);
string TypeName;
if( att.SelectedAddon != null )
TypeName = att.SelectedAddon.GetType().ToString();
else { TypeName = "An Addon has not been selected"; }
AddHtml( 17, 32, 207, 41, String.Format( @"Link: {0}", TypeName ), (bool)false, (bool)false);
// Backgrounds used to represent the buttons
AddBackground(30, 80, 175, 27, 9500);
AddHtml( 34, 86, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Select AddOn", (bool)false, (bool)false);
AddBackground(30, 117, 175, 27, 9500);
AddHtml( 34, 123, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Add Item", (bool)false, (bool)false);
AddBackground(30, 154, 175, 27, 9500);
AddHtml( 34, 160, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Remove Item", (bool)false, (bool)false);
AddBackground(30, 191, 175, 27, 9500);
AddHtml( 34, 197, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Delete Item", (bool)false, (bool)false);
AddBackground(30, 228, 175, 27, 9500);
AddHtml( 34, 234, 165, 17, @"<BASEFONT COLOR=#FFFFFF><center>Create Addon", (bool)false, (bool)false);
}
public enum Buttons
{
Close, Select, AddItem, RemoveItem, DeleteItem, CreateAddon
}
public void Resend( Mobile from )
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
if( from.HasGump(typeof(AddOnEditor)) )
{
from.CloseGump(typeof(AddOnEditor));
}
from.SendGump( new AddOnEditor( from, addoneditor) );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
Mobile from = sender.Mobile;
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
switch( info.ButtonID )
{
default:
case (int)Buttons.Close:
from.CloseGump(typeof(AddOnEditor));
break;
case (int)Buttons.Select:
from.Target = new Select_Target(from);
Resend(from);
break;
case (int)Buttons.AddItem:
CheckDeleted( from, addoneditor );
from.Target = new Add_Target(from);
Resend( from );
break;
case (int)Buttons.RemoveItem:
CheckDeleted( from, addoneditor );
from.Target = new Remove_Target(from, false);
Resend( from );
break;
case (int)Buttons.DeleteItem:
CheckDeleted( from, addoneditor );
from.Target = new Remove_Target(from, true);
Resend( from );
break;
case (int)Buttons.CreateAddon:
CheckDeleted( from, addoneditor );
from.Target = new Create_Target(from);
Resend( from );
break;
}
}
private void CheckDeleted( Mobile from, AddOnEditor_Att addoneditor )
{
if( addoneditor.SelectedAddon == null || addoneditor.SelectedAddon.Deleted )
{
from.SendMessage("You must select a new Addon first");
Target.Cancel(from);
return;
}
}
private class Select_Target : Target
{
private Mobile _From;
public Select_Target(Mobile from) : base(10, false, TargetFlags.None)
{
_From = from;
}
protected override void OnTarget(Mobile from, object targ)
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
if( targ is AddonComponent ) {
AddonComponent component = (AddonComponent)targ;
addoneditor.SelectedAddon = component.Addon;
}
else
{
from.SendMessage("That is not an Addon.");
from.Target = new Select_Target(from);
}
if( from.HasGump(typeof(AddOnEditor)) )
{
from.CloseGump(typeof(AddOnEditor));
}
from.SendGump( new AddOnEditor( from, addoneditor) );
}
}
private class Add_Target : Target
{
private Mobile _From;
public Add_Target(Mobile from) : base(10, false, TargetFlags.None)
{
_From = from;
}
protected override void OnTarget(Mobile from, object targ)
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
BaseAddon addon = addoneditor.SelectedAddon;
if( targ is AddonComponent )
{
AddonComponent component = (AddonComponent)targ;
if( component.Addon == addon )
{
from.SendMessage("You cannot add an Addon to itself");
from.Target = new Add_Target(from);
}
else
{
addon.AddComponent(new AddonComponent(component.ItemID), component.X - addon.X , component.Y - addon.Y, addon.Z);
addon.Delete();
}
}
else if( targ is Item )
{
Item item = (Item)targ;
addon.AddComponent(new AddonComponent(item.ItemID), item.X - addon.X , item.Y - addon.Y, addon.Z);
item.Delete();
}
else
{
from.SendMessage("That is not an Item.");
from.Target = new Add_Target(from);
}
}
}
private class Remove_Target : Target
{
private Mobile _From;
private bool _delete;
public Remove_Target(Mobile from, bool delete) : base(10, false, TargetFlags.None)
{
_From = from;
_delete = delete;
}
protected override void OnTarget(Mobile from, object targ)
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
BaseAddon addon = addoneditor.SelectedAddon;
AddonComponent component = (AddonComponent)targ;
if( targ is AddonComponent )
{
addon.Components.Remove(component);
component.Addon = null;
if( _delete == true )
{
component.Delete();
}
}
else
{
from.SendMessage("That is not an Addon.");
from.Target = new Remove_Target(from, _delete);
}
}
}
private class Create_Target : Target
{
private Mobile _from;
public Create_Target(Mobile from)
: base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
this._from = from;
}
protected override void OnTarget(Mobile from, object targeted)
{
if (targeted is IPoint3D)
{
Point3D p = new Point3D((IPoint3D)targeted);
BasicAddon newAddon = new BasicAddon();
newAddon.MoveToWorld(p, from.Map);
}
}
}
}
}

View File

@@ -0,0 +1,85 @@
using System;
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Engines.XmlSpawner2;
using Server.Items;
namespace Server.Engines.XmlSpawner2
{
public class AddOnEditor_Att : XmlAttachment
{
[CommandProperty(AccessLevel.GameMaster)]
public BaseAddon SelectedAddon
{ get; set; }
public static void Initialize() {
CommandSystem.Register( "AddonEdit", AccessLevel.Seer, new CommandEventHandler( AddonEdit_OnCommand ) );
}
[Usage("AddonEdit")]
[Description("Allows you to edit AddOns")]
public static void AddonEdit_OnCommand( CommandEventArgs e )
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(e.Mobile, typeof(AddOnEditor_Att));
if( addoneditor == null ) {
XmlAttach.AttachTo(e.Mobile, new AddOnEditor_Att());
AddonEdit_OnCommand(e);
}
else
{
if( e.Mobile.HasGump(typeof(AddOnEditor)) ) {
e.Mobile.CloseGump(typeof(AddOnEditor));
}
e.Mobile.SendGump( new AddOnEditor( e.Mobile, addoneditor) );
}
}
public void CallCommand( Mobile from )
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
CommandEventArgs e = new CommandEventArgs(from, "", "", new string[0]);
AddonEdit_OnCommand(e);
}
public void Resend( Mobile from )
{
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
if( from.HasGump(typeof(AddOnEditor)) ) {
from.CloseGump(typeof(AddOnEditor));
}
from.SendGump( new AddOnEditor( from, addoneditor) );
}
public AddOnEditor_Att( ASerial serial ) : base( serial )
{}
[Attachable]
public AddOnEditor_Att()
{}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (BaseAddon) SelectedAddon);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
SelectedAddon = ( BaseAddon )reader.ReadItem();
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using Server.Mobiles;
using Server.Engines.XmlSpawner2;
using Server.Commands;
namespace Server.Items
{
public class AddonEditorTool : Item
{
[Constructable]
public AddonEditorTool() : base( 4033 )
{
Name = "Addon Editor Tool";
Hue = 1287;
}
public AddonEditorTool(Serial serial) : base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
if (from.AccessLevel == AccessLevel.Player)
{
from.SendMessage("That is for Staff use only!");
return;
}
AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att));
if( addoneditor == null ) {
XmlAttach.AttachTo(from, new AddOnEditor_Att());
}
addoneditor.CallCommand(from);
base.OnDoubleClick(from);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using Server.Network;
using Server.Mobiles;
using Server.Multis;
namespace Server.Items
{
public class BasicAddon : BaseAddon
{
[Constructable]
public BasicAddon()
{
this.AddComponent(new AddonComponent(2810), 0, 0, 0);
}
public BasicAddon(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();
}
}
}

View File

@@ -0,0 +1,113 @@
using Server.Commands;
using System;
using System.Collections;
using Server;
namespace Server.Commands
{
/// <summary>
/// Summary description for AFK.
/// </summary>
public class AFK : Timer
{
private static Hashtable m_AFK = new Hashtable();
private Mobile who;
private Point3D where;
private DateTime when;
public string what="";
public static void Initialize()
{
CommandSystem.Register( "afk", AccessLevel.Player, new CommandEventHandler( AFK_OnCommand ) );
EventSink.Logout += new LogoutEventHandler( OnLogout );
EventSink.Speech += new SpeechEventHandler( OnSpeech );
EventSink.PlayerDeath += new PlayerDeathEventHandler( OnDeath);
}
public static void OnDeath( PlayerDeathEventArgs e )
{
if ( m_AFK.Contains( e.Mobile.Serial.Value ) )
{
AFK afk=(AFK)m_AFK[e.Mobile.Serial.Value];
if (afk==null)
{
e.Mobile.SendMessage("Afk object missing!");
return;
}
e.Mobile.PlaySound( e.Mobile.Female ? 814 : 1088 );
afk.wakeUp();
}
}
public static void OnLogout( LogoutEventArgs e )
{
if ( m_AFK.Contains( e.Mobile.Serial.Value ) )
{
AFK afk=(AFK)m_AFK[e.Mobile.Serial.Value];
if (afk==null)
{
e.Mobile.SendMessage("Afk object missing!");
return;
}
afk.wakeUp();
}
}
public static void OnSpeech( SpeechEventArgs e )
{
if ( m_AFK.Contains( e.Mobile.Serial.Value ) )
{
AFK afk=(AFK)m_AFK[e.Mobile.Serial.Value];
if (afk==null)
{
e.Mobile.SendMessage("Afk object missing!");
return;
}
afk.wakeUp();
}
}
public static void AFK_OnCommand( CommandEventArgs e )
{
if ( m_AFK.Contains( e.Mobile.Serial.Value ) )
{
AFK afk=(AFK)m_AFK[e.Mobile.Serial.Value];
if (afk==null)
{
e.Mobile.SendMessage("Afk object missing!");
return;
}
afk.wakeUp();
}
else
{
m_AFK.Add( e.Mobile.Serial.Value,new AFK(e.Mobile,e.ArgString.Trim()) );
e.Mobile.SendMessage( "AFK enabled." );
}
}
public void wakeUp()
{
m_AFK.Remove( who.Serial.Value );
who.Emote("*is no longer AFK*");
who.SendMessage( "AFK deactivated." );
this.Stop();
}
public AFK(Mobile afker, string message) : base(TimeSpan.FromSeconds(60),TimeSpan.FromSeconds (60))
{
if ((message==null)||(message=="")) message="is AFK";
what=message;
who=afker;
when=DateTime.UtcNow;
where=who.Location;
this.Start();
}
protected override void OnTick()
{
if (!(who.Location==where) )
{
this.wakeUp();
return;
}
who.Say("zZz");
TimeSpan ts=DateTime.UtcNow.Subtract(when);
who.Emote("*{0} ({1}:{2}:{3})*",what,ts.Hours,ts.Minutes,ts.Seconds);
who.PlaySound( who.Female ? 819 : 1093);
}
}
}

View File

@@ -0,0 +1,393 @@
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Commands;
using System.Collections;
using System.Collections.Generic;
namespace Server
{
public class AnimalSpawnGenerator
{
public static Mobile player;
private static Rectangle2D[] m_BritRegions = new Rectangle2D[]
{
//new Rectangle2D( new Point2D( 0, 0 ), new Point2D( 5119, 4094 ) ),
new Rectangle2D( new Point2D( 0, 0 ), new Point2D( 6142, 4094 ) ),
};
/*
private static XmlSpawner.SpawnObject spawnAnimal01;
private static XmlSpawner.SpawnObject spawnAnimal02;
private static XmlSpawner.SpawnObject spawnAnimal03;
private static XmlSpawner.SpawnObject spawnAnimal04;
private static XmlSpawner.SpawnObject spawnAnimal05;
private static XmlSpawner.SpawnObject spawnAnimal06;
private static XmlSpawner.SpawnObject spawnAnimal07;
private static XmlSpawner.SpawnObject spawnAnimal08;
private static XmlSpawner.SpawnObject spawnAnimal09;
private static XmlSpawner.SpawnObject spawnAnimal10;
private static XmlSpawner.SpawnObject spawnAnimal11;
private static XmlSpawner.SpawnObject spawnAnimal12;
*/
private static XmlSpawner.SpawnObject[] spawnOres = new XmlSpawner.SpawnObject[12];
private static int[] m_Criterion = new int[]
{
//Trees
0xC9E, 0xCA8, 0xCAA, 0xCCA, 0xCCB, 0xCCC, 0xCCD, 0xCD0, 0xCD3, 0xCD6, 0xCD8, 0xCDA, 0xCDD, 0xCE0, 0xCE3,
0xCE6, 0xCF8, 0xCFB, 0xCFE, 0xD01, 0xD43, 0xD59, 0xD70, 0xD85, 0xD94, 0xD98, 0xD9C, 0xDA0, 0xDA4, 0xDA8,
//Rocks
4943, 4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951, 4951, 4953, 4954, 4955, 4956, 4957, 4958, 4959,
4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, 4968, 4969, 4970, 4971, 4972, 4973, 6001, 6002, 6003,
6004, 6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 13121, 13122, 13123, 13124, 13125, 13126, 13127,
13128, 13129, 13130, 13131, 13132, 13133, 13134, 13135, 13136, 13137, 13354, 13355, 13361, 13362, 13363,
13364, 13365, 13366, 13367, 13368, 13369, 13625, 13626, 13627, 13628,
//0x12B9,
};
public static void Initialize()
{
CommandSystem.Register("AnimalSpawnGen", AccessLevel.Administrator, new CommandEventHandler(AnimalSpawnGen_OnCommand));
CommandSystem.Register("AnimalSpawnRem", AccessLevel.Administrator, new CommandEventHandler(AnimalSpawnRem_OnCommand));
//spawnOreVain = new XmlSpawner.SpawnObject("RandomOreVain", 4);
//spawnOreVain.SpawnsPerTick = 1;
//spawnOres[0] = spawnOreVain;
}
[Usage("AnimalSpawnGen")]
[Description("Generates Animal spawners by analyzing the map. Slow.")]
public static void AnimalSpawnGen_OnCommand( CommandEventArgs e )
{
player = e.Mobile;
Generate();
}
[Usage("AnimalSpawnRem")]
[Description("Removes Animal spawners by analyzing the map. Slow.")]
public static void AnimalSpawnRem_OnCommand( CommandEventArgs e )
{
player = e.Mobile;
Remove();
}
private static Map m_Map;
private static int m_Count;
public static void Generate()
{
//World.Broadcast(252, true, "Generating Animal spawners, please wait.");
player.SendMessage(252, "Generating Animal spawners...");
Network.NetState.FlushAll();
Network.NetState.Pause();
m_Map = player.Map;
m_Count = 0;
for ( int i = 0; i < m_BritRegions.Length; ++i )
Generate(m_BritRegions[i]);
int ArseneCount = m_Count;
Network.NetState.Resume();
//World.Broadcast(252, true, "Animal spawner generation complete. {0}", ArseneCount);
player.SendMessage(252, String.Format("{0} Animals Spawners have been Generated", ArseneCount));
}
public static bool IsRock( int id )
{
if ( id > m_Criterion[m_Criterion.Length - 1] )
return false;
for ( int i = 0; i < m_Criterion.Length; ++i )
{
int delta = id - m_Criterion[i];
if ( delta < 0 )
return false;
else if ( delta == 0 )
return true;
}
return false;
}
private static void AddAnimalSpawner( int x, int y, int z )
{
if ( Utility.RandomDouble() < 0.9750 )
return;
Map map = player.Map;
IPooledEnumerable eable = map.GetItemsInRange(new Point3D(x, y, z), 20);
foreach ( Item item in eable )
{
if ( item is XmlSpawner )
{
if ( item.Hue == 346 )
{
return;
}
}
}
if ( !m_Map.CanFit(x, y, z, 1, false, false) )
return;
//XmlSpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, int spawnrange, string creatureName)
XmlSpawner spawner = null;
int MaxSpawn = 0;
int Counter = 0;
switch ( Utility.Random(6) )
{
case 0:
spawner = new XmlSpawner(10, 1, 3, 0, 0, Utility.RandomMinMax(22, 30), "Bird");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Chicken", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Eagle", 2));
MaxSpawn = 12;
Counter = 3;
break;
case 1:
spawner = new XmlSpawner(4, 2, 5, 0, 0, Utility.RandomMinMax(8, 10), "BrownBear");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("BlackBear", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GrizzlyBear", 2));
MaxSpawn = 6;
Counter = 3;
break;
case 2:
spawner = new XmlSpawner(4, 1, 3, 0, 0, Utility.RandomMinMax(18, 24), "Dog");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Cat", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GiantRat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("SewerRat", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("JackRabbit", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Rabbit", 4));
MaxSpawn = 10;
Counter = 6;
break;
case 3:
spawner = new XmlSpawner(2, 1, 3, 0, 0, Utility.RandomMinMax(26, 30), "Bull");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Cow", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Goat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("MountainGoat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Boar", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Pig", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GreatHart", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Hind", 6));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Sheep", 6));
MaxSpawn = 14;
Counter = 8;
break;
case 4:
spawner = new XmlSpawner(2, 2, 5, 0, 0, Utility.RandomMinMax(8, 10), "DireWolf");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GreyWolf", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("TimberWolf", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Panther", 2));
MaxSpawn = 6;
Counter = 4;
break;
case 5:
spawner = new XmlSpawner(6, 3, 7, 0, 0, Utility.RandomMinMax(8, 10), "Gorilla");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Alligator", 3));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GiantSerpent", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Raptor", 1));
MaxSpawn = 6;
Counter = 4;
break;
/*
case 0:
spawner = new XmlSpawner(10, 1, 3, 0, 0, Utility.RandomMinMax(22, 30), "Bird");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Chicken", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Eagle", 2));
MaxSpawn = 12;
Counter = 3;
break;
case 1:
spawner = new XmlSpawner(4, 2, 5, 0, 0, Utility.RandomMinMax(8, 10), "BrownBear");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("BlackBear", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GrizzlyBear", 2));
MaxSpawn = 6;
Counter = 3;
break;
case 2:
spawner = new XmlSpawner(4, 1, 3, 0, 0, Utility.RandomMinMax(18, 24), "Dog");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Cat", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GiantRat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("SewerRat", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("JackRabbit", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Rabbit", 4));
MaxSpawn = 10;
Counter = 6;
break;
case 3:
spawner = new XmlSpawner(2, 1, 3, 0, 0, Utility.RandomMinMax(26, 30), "Bull");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Cow", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Goat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("MountainGoat", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Boar", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Pig", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GreatHart", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Hind", 6));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Sheep", 6));
MaxSpawn = 14;
Counter = 8;
break;
case 4:
spawner = new XmlSpawner(2, 2, 5, 0, 0, Utility.RandomMinMax(8, 10), "DireWolf");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GreyWolf", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("TimberWolf", 4));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Panther", 2));
MaxSpawn = 6;
Counter = 4;
break;
case 5:
spawner = new XmlSpawner(6, 3, 7, 0, 0, Utility.RandomMinMax(8, 10), "Gorilla");
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Alligator", 3));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("GiantSerpent", 2));
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Raptor", 1));
MaxSpawn = 6;
Counter = 4;
break;
*/
}
//Spawn Orcs ( 30% )
if ( spawner != null )
{
switch ( Utility.Random(10) )
{
case 0:
case 1: // 20%
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("Orc", 2));
break;
case 2: // 10%
spawner.m_SpawnObjects.Add(new XmlSpawner.SpawnObject("OrcChopper", 2));
break;
default:
break;
}
}
if ( spawner != null )
{
for ( int i = 0; i < Counter; i++ )
{
spawner.SpawnObjects[i].SpawnsPerTick = 1;
}
spawner.Name = "Animal Spawner #" + m_Count;
spawner.MoveToWorld(new Point3D(x, y, z), player.Map);
spawner.MaxCount = MaxSpawn;
spawner.Hue = 346;
}
++m_Count;
}
public static void Generate( Rectangle2D region )
{
int OakTree = 0x12B9;
for ( int rx = 0; rx < region.Width; ++rx )
{
for ( int ry = 0; ry < region.Height; ++ry )
{
int vx = rx + region.X;
int vy = ry + region.Y;
StaticTile[] tiles = m_Map.Tiles.GetStaticTiles( vx, vy );
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile tile = tiles[i];
int id = tile.ID;
id &= 0x3FFF;
int z = tile.Z;
if ( IsRock(id) )
{
AddAnimalSpawner(vx + 1, vy, z);
}
}
}
}
}
public static void Remove()
{
player.SendMessage(252, "Removing Animal Spawners...");
List<Item> itemList = new List<Item>( World.Items.Values );
List<Item> AnimalSpawner = new List<Item>();
foreach ( Item item in itemList )
{
if ( item is XmlSpawner )
{
XmlSpawner spawner = item as XmlSpawner;
if ( spawner.SpawnObjects.Length > 0 )
{
if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "BROWNBEAR" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "BLACKBEAR" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "GRIZZLYBEAR" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "POLARBEAR" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "BIRD" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "CHICKEN" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "EAGLE" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "DOG" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "BULL" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "DIREWOLF" )
{
AnimalSpawner.Add(item);
}
else if ( spawner.SpawnObjects[0].TypeName.ToUpper() == "GORILLA" )
{
AnimalSpawner.Add(item);
}
}
}
}
player.SendMessage(252, String.Format("{0} Animals Spawners have been Removed", AnimalSpawner.Count));
Console.WriteLine("{0} Animals Spawners have been Removed", AnimalSpawner.Count);
foreach ( Item item in AnimalSpawner )
item.Delete();
}
}
}

View File

@@ -0,0 +1,44 @@
using System;
using Server;
using Server.Items;
using Server.Commands;
namespace Server.Commands
{
public class Bandself
{
public static void Initialize()
{
CommandSystem.Register( "BandSelf", AccessLevel.Player, new CommandEventHandler( BandSelf_OnCommand ) );
}
[Usage( "BandSelf" )]
public static void BandSelf_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
if( from != null)
{
Container backpack = from.Backpack;
if( backpack != null )
{
Bandage bandage = (Bandage) backpack.FindItemByType( typeof( Bandage ) );
if ( bandage != null )
{
Targeting.Target.Cancel( from );
from.RevealingAction();
if ( BandageContext.BeginHeal( from, from ) != null )
bandage.Consume();
}
else
e.Mobile.SendMessage( "Cannot find bandage." );
}
else
from.SendMessage( "You don't have a Backpack." );
}
}
}
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Network;
namespace Server.Commands
{
public class BondInfoCommand
{
public static void Initialize()
{
CommandSystem.Register( "BondInfo", AccessLevel.Player, new CommandEventHandler( BondInfo_OnCommand ) );
}
[Usage( "BondInfo" )]
[Description( "Tells you how much time remaining until your next BOD is available." )]
public static void BondInfo_OnCommand( CommandEventArgs e )
{
Mobile from = e.Mobile;
e.Mobile.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( BondInfo_OnTarget ) );
e.Mobile.SendMessage("Target the pet you wish to know the bonding timer of");
}
public static void BondInfo_OnTarget( Mobile from, object targeted )
{
if ( targeted is BaseCreature )
{
BaseCreature targ = (BaseCreature)targeted;
if ( targ.ControlMaster == from )
{
if( targ.BondingBegin == DateTime.MinValue )
{
from.SendMessage("Your pet hasn't started to bond yet, please feed it and try again." );
}
else
{
DateTime today = DateTime.UtcNow;
DateTime willbebonded = targ.BondingBegin.AddDays(7);
TimeSpan bondedfor = targ.BondingBegin - today;
TimeSpan daystobond = willbebonded - today;
string BondInfo = string.Format("The pet started bonding with you at {0}. Its {1} days, {2} hours and {3} minutes until it bonds", targ.BondingBegin, daystobond.Days,
daystobond.Hours, daystobond.Minutes );
from.SendMessage ( BondInfo );
}
}
else
{
from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( BondInfo_OnTarget ) );
from.SendMessage( "That is not your pet!" );
}
}
else
{
from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( BondInfo_OnTarget ) );
from.SendMessage("That is not a pet!" );
}
}
}
}

View File

@@ -0,0 +1,432 @@
// ChangeHairStyle Command v1.0.0
// Author: Felladrin
// Started: 2016-01-31
// Updated: 2016-01-31
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Felladrin.Commands
{
public static class ChangeHairStyle
{
public static class Config
{
public static bool Enabled = true; // Is this command enabled?
public static int PriceForHairHue = 5000; // What's the price for changing hair hue?
public static int PriceForHairStyle = 50000; // What's the price for changing hair style?
public static int PriceForFacialHairStyle = 30000; // What's the price for changing facial hair style?
public static bool DisplayRegularHues = true; // Should we display regular hues (true) or bright hues (folse) on the hair hue gump?
}
public static void Initialize()
{
if (Config.Enabled)
CommandSystem.Register("ChangeHairStyle", AccessLevel.Player, new CommandEventHandler(OnCommand));
else if (!Config.Enabled)
CommandSystem.Register("ChangeHairStyle", AccessLevel.Seer, new CommandEventHandler(OnCommand));
}
[Usage("ChangeHairStyle")]
[Description("Used to change your hair style.")]
static void OnCommand(CommandEventArgs e)
{
var from = e.Mobile;
from.CloseGump(typeof(ChangeHairHueGump));
from.CloseGump(typeof(ChangeHairstyleGump));
from.SendGump(new ChangeHairHueGump(from, Config.PriceForHairHue, true, true, (Config.DisplayRegularHues ? ChangeHairHueEntry.RegularEntries : ChangeHairHueEntry.BrightEntries)));
if (Config.PriceForHairHue > 0)
from.SendMessage(65, "You'll be charged {0} gold, directly from your bank, if you choose to change your hair hue.", Config.PriceForHairHue);
if (from.Race == Race.Human)
{
from.SendGump(new ChangeHairstyleGump(from, Config.PriceForHairStyle, false, ChangeHairstyleEntry.HairEntries));
if (Config.PriceForHairStyle > 0)
from.SendMessage(67, "You'll be charged {0} gold, directly from your bank, if you choose to change your hair style.", Config.PriceForHairStyle);
if (!from.Female)
{
from.SendGump(new ChangeHairstyleGump(from, Config.PriceForFacialHairStyle, true, ChangeHairstyleEntry.BeardEntries));
if (Config.PriceForFacialHairStyle > 0)
from.SendMessage(66, "You'll be charged {0} gold, directly from your bank, if you choose to change your facial hair style.", Config.PriceForFacialHairStyle);
}
}
}
public class ChangeHairstyleGump : Gump
{
readonly Mobile m_From;
readonly int m_Price;
readonly bool m_FacialHair;
readonly ChangeHairstyleEntry[] m_Entries;
public ChangeHairstyleGump(Mobile from, int price, bool facialHair, ChangeHairstyleEntry[] entries) : base(50, 50)
{
m_From = from;
m_Price = price;
m_FacialHair = facialHair;
m_Entries = entries;
int tableWidth = (m_FacialHair ? 2 : 3);
int tableHeight = ((entries.Length + tableWidth - (m_FacialHair ? 1 : 2)) / tableWidth);
const int offsetWidth = 123;
int offsetHeight = (m_FacialHair ? 70 : 65);
AddPage(0);
AddBackground(0, 0, 81 + (tableWidth * offsetWidth), 105 + (tableHeight * offsetHeight), 2600);
AddButton(45, 45 + (tableHeight * offsetHeight), 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(77, 45 + (tableHeight * offsetHeight), 90, 35, 1006044, false, false); // Ok
AddButton(81 + (tableWidth * offsetWidth) - 180, 45 + (tableHeight * offsetHeight), 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(81 + (tableWidth * offsetWidth) - 148, 45 + (tableHeight * offsetHeight), 90, 35, 1006045, false, false); // Cancel
if (!facialHair)
AddHtmlLocalized(50, 15, 350, 20, 1018353, false, false); // <center>New Hairstyle</center>
else
AddHtmlLocalized(55, 15, 200, 20, 1018354, false, false); // <center>New Beard</center>
for (int i = 0; i < entries.Length; ++i)
{
int xTable = i % tableWidth;
int yTable = i / tableWidth;
if (entries[i].GumpID != 0)
{
AddRadio(40 + (xTable * offsetWidth), 70 + (yTable * offsetHeight), 208, 209, false, i);
AddBackground(87 + (xTable * offsetWidth), 50 + (yTable * offsetHeight), 50, 50, 2620);
AddImage(87 + (xTable * offsetWidth) + entries[i].X, 50 + (yTable * offsetHeight) + entries[i].Y, entries[i].GumpID);
}
else if (!facialHair)
{
AddRadio(40 + ((xTable + 1) * offsetWidth), 240, 208, 209, false, i);
AddHtmlLocalized(60 + ((xTable + 1) * offsetWidth), 240, 85, 35, 1011064, false, false); // Bald
}
else
{
AddRadio(40 + (xTable * offsetWidth), 70 + (yTable * offsetHeight), 208, 209, false, i);
AddHtmlLocalized(60 + (xTable * offsetWidth), 70 + (yTable * offsetHeight), 85, 35, 1011064, false, false); // Bald
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_FacialHair && (m_From.Female || m_From.Body.IsFemale))
return;
if (m_From.Race == Race.Elf)
{
m_From.SendMessage("This isn't implemented for elves yet. Sorry!");
return;
}
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
if (index >= 0 && index < m_Entries.Length)
{
ChangeHairstyleEntry entry = m_Entries[index];
var playerMobile = m_From as PlayerMobile;
if (playerMobile != null)
playerMobile.SetHairMods(-1, -1);
int hairID = m_From.HairItemID;
int facialHairID = m_From.FacialHairItemID;
if (entry.ItemID == 0)
{
if (m_FacialHair ? (facialHairID == 0) : (hairID == 0))
return;
if (Banker.Withdraw(m_From, m_Price))
{
if (m_FacialHair)
{
m_From.FacialHairItemID = 0;
if (Config.PriceForFacialHairStyle > 0)
m_From.SendLocalizedMessage(1060398, Config.PriceForFacialHairStyle.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
{
m_From.HairItemID = 0;
if (Config.PriceForHairStyle > 0)
m_From.SendLocalizedMessage(1060398, Config.PriceForHairStyle.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
}
else
m_From.SendLocalizedMessage(1042293); // You cannot afford my services for that style.
}
else
{
if (m_FacialHair)
{
if (facialHairID > 0 && facialHairID == entry.ItemID)
return;
}
else
{
if (hairID > 0 && hairID == entry.ItemID)
return;
}
if (Banker.Withdraw(m_From, m_Price))
{
if (m_FacialHair)
{
m_From.FacialHairItemID = entry.ItemID;
if (Config.PriceForFacialHairStyle > 0)
m_From.SendLocalizedMessage(1060398, Config.PriceForFacialHairStyle.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
{
m_From.HairItemID = entry.ItemID;
if (Config.PriceForHairStyle > 0)
m_From.SendLocalizedMessage(1060398, Config.PriceForHairStyle.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
}
else
m_From.SendLocalizedMessage(1042293); // You cannot afford my services for that style.
}
}
}
else
{
m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
}
}
else
{
m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
}
}
}
public class ChangeHairstyleEntry
{
readonly int m_ItemID;
readonly int m_GumpID;
int m_X, m_Y;
public int ItemID{ get { return m_ItemID; } }
public int GumpID{ get { return m_GumpID; } }
public int X{ get { return m_X; } }
public int Y{ get { return m_Y; } }
public ChangeHairstyleEntry(int gumpID, int x, int y, int itemID)
{
m_GumpID = gumpID;
m_X = x;
m_Y = y;
m_ItemID = itemID;
}
public static readonly ChangeHairstyleEntry[] HairEntries =
{
new ChangeHairstyleEntry(50700, 70 - 137, 20 - 60, 0x203B),//ShortHair
new ChangeHairstyleEntry(60710, 193 - 260, 18 - 60, 0x2045),//Pageboy
new ChangeHairstyleEntry(50703, 316 - 383, 25 - 60, 0x2044),//Mohawk
new ChangeHairstyleEntry(60708, 70 - 137, 75 - 125, 0x203C),//Horns1
new ChangeHairstyleEntry(60900, 193 - 260, 85 - 125, 0x2047),//Curly
new ChangeHairstyleEntry(60713, 320 - 383, 85 - 125, 0x204A),//Topknot
new ChangeHairstyleEntry(60702, 70 - 137, 140 - 190, 0x203D),//LongHair
new ChangeHairstyleEntry(60707, 193 - 260, 140 - 190, 0x2049),//Horns2
new ChangeHairstyleEntry(60901, 315 - 383, 150 - 190, 0x2048),//Receding
new ChangeHairstyleEntry(0, 0, 0, 0) //Bald
};
public static readonly ChangeHairstyleEntry[] BeardEntries =
{
new ChangeHairstyleEntry(50800, 120 - 187, 30 - 80, 0x2040),//goatee 0x2052
new ChangeHairstyleEntry(50904, 243 - 310, 33 - 80, 0x204B),//Shortbeard Moustache
new ChangeHairstyleEntry(50906, 120 - 187, 100 - 150, 0x204D),//vandyke
new ChangeHairstyleEntry(50801, 243 - 310, 95 - 150, 0x203E),//long beard
new ChangeHairstyleEntry(50802, 120 - 187, 173 - 220, 0x203F),//short beard
new ChangeHairstyleEntry(50905, 243 - 310, 165 - 220, 0x204C),//Longbeard Moustache
//new ChangeHairstyleEntry(50808, 120 - 187, 242 - 290, 0x2041),//Moustache
new ChangeHairstyleEntry(51451, 120 - 187, 242 - 290, 0xA1A8),
new ChangeHairstyleEntry(0, 0, 0, 0)
};
}
public class ChangeHairHueEntry
{
readonly string m_Name;
readonly int[] m_Hues;
public string Name{ get { return m_Name; } }
public int[] Hues{ get { return m_Hues; } }
public ChangeHairHueEntry(string name, int[] hues)
{
m_Name = name;
m_Hues = hues;
}
public ChangeHairHueEntry(string name, int start, int count)
{
m_Name = name;
m_Hues = new int[count];
for (int i = 0; i < count; ++i)
m_Hues[i] = start + i;
}
public static readonly ChangeHairHueEntry[] BrightEntries =
{
new ChangeHairHueEntry("*****", 12, 10),
new ChangeHairHueEntry("*****", 32, 5),
new ChangeHairHueEntry("*****", 38, 8),
new ChangeHairHueEntry("*****", 54, 3),
new ChangeHairHueEntry("*****", 62, 10),
new ChangeHairHueEntry("*****", 81, 2),
new ChangeHairHueEntry("*****", 89, 2),
new ChangeHairHueEntry("*****", 1153, 2)
};
public static readonly ChangeHairHueEntry[] RegularEntries =
{
new ChangeHairHueEntry("*****", 1602, 26),
new ChangeHairHueEntry("*****", 1628, 27),
new ChangeHairHueEntry("*****", 1502, 32),
new ChangeHairHueEntry("*****", 1302, 32),
new ChangeHairHueEntry("*****", 1402, 32),
new ChangeHairHueEntry("*****", 1202, 24),
new ChangeHairHueEntry("*****", 2402, 29),
new ChangeHairHueEntry("*****", 2213, 6),
new ChangeHairHueEntry("*****", 1102, 8),
new ChangeHairHueEntry("*****", 1110, 8),
new ChangeHairHueEntry("*****", 1118, 16),
new ChangeHairHueEntry("*****", 1134, 16)
};
}
public class ChangeHairHueGump : Gump
{
readonly Mobile m_From;
readonly int m_Price;
readonly bool m_Hair;
readonly bool m_FacialHair;
readonly ChangeHairHueEntry[] m_Entries;
public ChangeHairHueGump(Mobile from, int price, bool hair, bool facialHair, ChangeHairHueEntry[] entries) : base(300, 50)
{
m_From = from;
m_Price = price;
m_Hair = hair;
m_FacialHair = facialHair;
m_Entries = entries;
AddPage(0);
AddBackground(100, 10, 350, 370, 2600);
AddBackground(120, 54, 110, 270, 5100);
AddHtmlLocalized(155, 25, 240, 30, 1011013, false, false); // <center>Hair Color Selection Menu</center>
AddHtmlLocalized(150, 330, 220, 35, 1011014, false, false); // Dye my hair this color!
AddButton(380, 330, 4005, 4007, 1, GumpButtonType.Reply, 0);
for (int i = 0; i < entries.Length; ++i)
{
ChangeHairHueEntry entry = entries[i];
AddLabel(130, 59 + (i * 22), entry.Hues[0] - 1, entry.Name);
AddButton(207, 60 + (i * 22), 5224, 5224, 0, GumpButtonType.Page, 1 + i);
}
for (int i = 0; i < entries.Length; ++i)
{
ChangeHairHueEntry entry = entries[i];
int[] hues = entry.Hues;
string name = entry.Name;
AddPage(1 + i);
for (int j = 0; j < hues.Length; ++j)
{
AddLabel(278 + ((j / 16) * 80), 52 + ((j % 16) * 17), hues[j] - 1, name);
AddRadio(260 + ((j / 16) * 80), 52 + ((j % 16) * 17), 210, 211, false, (j * entries.Length) + i);
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (info.ButtonID == 1)
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0] % m_Entries.Length;
int offset = switches[0] / m_Entries.Length;
if (index >= 0 && index < m_Entries.Length)
{
if (offset >= 0 && offset < m_Entries[index].Hues.Length)
{
if (m_Hair && m_From.HairItemID > 0 || m_FacialHair && m_From.FacialHairItemID > 0)
{
if (!Banker.Withdraw(m_From, m_Price))
{
m_From.SendLocalizedMessage(1042293); // You cannot afford my services for that style.
return;
}
int hue = m_Entries[index].Hues[offset];
if (m_Hair)
m_From.HairHue = hue;
if (m_FacialHair)
m_From.FacialHairHue = hue;
if (Config.PriceForHairHue > 0)
m_From.SendLocalizedMessage(1060398, Config.PriceForHairHue.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
}
else
m_From.SendLocalizedMessage(502623); // You have no hair to dye and you cannot use this.
}
}
}
else
{
m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
}
}
else
{
m_From.SendLocalizedMessage(1013009); // You decide not to change your hairstyle.
}
}
}
}
}

View File

@@ -0,0 +1,72 @@
// ___|========================|___
// \ | Written by Felladrin | / This script was released on RunUO Community under the GPL licensing terms.
// > | August 2013 | <
// /__|========================|__\ [Change Season] - Current version: 1.0 (August 17, 2013)
using System;
using VitaNex.Network;
namespace Server.Commands
{
public class ChangeSeason
{
public static void Initialize()
{
CommandSystem.Register("ChangeSeason", AccessLevel.Administrator, new CommandEventHandler(ChangeSeason_OnCommand));
//Console.WriteLine("The Season for Felucca has been set to Summer.");
//Map.Felucca.Season = 1;
}
[Usage("ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]")]
[Description("Changes the current season of all facets to the specified one.")]
public static void ChangeSeason_OnCommand(CommandEventArgs e)
{
if (e.Length != 1)
{
e.Mobile.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
return;
}
int season;
switch (e.GetString(0).ToLower())
{
case "spring":
season = 0;
break;
case "summer":
season = 1;
break;
case "autumn":
case "fall":
season = 2;
break;
case "winter":
season = 3;
break;
case "desolation":
season = 4;
break;
default:
e.Mobile.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
return;
}
foreach (Map map in Map.AllMaps)
{
map.Season = season;
foreach (Network.NetState ns in Network.NetState.Instances)
{
if (ns.Mobile == null)
continue;
ns.Send(Network.SeasonChange.Instantiate(ns.Mobile.GetSeason(), true));
ns.Mobile.SendEverything();
}
}
}
}
}

View File

@@ -0,0 +1,180 @@
using System;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Network;
using Server.Commands;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Gumps
{
public class CharacterSheetDragon : Gump
{
public static void Initialize()
{
CommandSystem.Register("mystats", AccessLevel.Player, new CommandEventHandler(StatsDragon_OnCommand));
}
private static void StatsDragon_OnCommand(CommandEventArgs e)
{
e.Mobile.CloseGump(typeof(CharacterSheetDragon));
e.Mobile.SendGump(new CharacterSheetDragon(e.Mobile));
}
public CharacterSheetDragon(Mobile m)
: base( 208, 166 )
{
PlayerMobile pm = m as PlayerMobile;
// configuration
int LRCCap = 100;
int LMCCap = 40;
double BandageSpeedCap = 0.0;
int SwingSpeedCap = 125;
int HCICap = 45;
int DCICap = 45;
int FCCap = 4;
int FCRCap = 6;
int DamageIncreaseCap = 100;
int SDICap = 100;
int ReflectDamageCap = 50;
int SSICap = 100;
int LRC = AosAttributes.GetValue(pm, AosAttribute.LowerRegCost) > LRCCap ? LRCCap : AosAttributes.GetValue(pm, AosAttribute.LowerRegCost);
int LMC = AosAttributes.GetValue(pm, AosAttribute.LowerManaCost) > LMCCap ? LMCCap : AosAttributes.GetValue(pm, AosAttribute.LowerManaCost);
double BandageSpeed = (2.0 + (0.5 * ((double)(205 - pm.Dex) / 10))) < BandageSpeedCap ? BandageSpeedCap : (2.0 + (0.5 * ((double)(205 - pm.Dex) / 10)));
TimeSpan SwingSpeed = (pm.Weapon as BaseWeapon).GetDelay(pm) > TimeSpan.FromSeconds(SwingSpeedCap) ? TimeSpan.FromSeconds(SwingSpeedCap) : (pm.Weapon as BaseWeapon).GetDelay(pm);
int HCI = AosAttributes.GetValue(pm, AosAttribute.AttackChance) > HCICap ? HCICap : AosAttributes.GetValue(pm, AosAttribute.AttackChance);
int DCI = AosAttributes.GetValue(pm, AosAttribute.DefendChance) > DCICap ? DCICap : AosAttributes.GetValue(pm, AosAttribute.DefendChance);
int FC = AosAttributes.GetValue(pm, AosAttribute.CastSpeed) > FCCap ? FCCap : AosAttributes.GetValue(pm, AosAttribute.CastSpeed);
int FCR = AosAttributes.GetValue(pm, AosAttribute.CastRecovery) > FCRCap ? FCRCap : AosAttributes.GetValue(pm, AosAttribute.CastRecovery);
int DamageIncrease = AosAttributes.GetValue(pm, AosAttribute.WeaponDamage) > DamageIncreaseCap ? DamageIncreaseCap : AosAttributes.GetValue(pm, AosAttribute.WeaponDamage);
int SDI = AosAttributes.GetValue(pm, AosAttribute.SpellDamage) > SDICap ? SDICap : AosAttributes.GetValue(pm, AosAttribute.SpellDamage);
int ReflectDamage = AosAttributes.GetValue(pm, AosAttribute.ReflectPhysical) > ReflectDamageCap ? ReflectDamageCap : AosAttributes.GetValue(pm, AosAttribute.ReflectPhysical);
int SSI = AosAttributes.GetValue(pm, AosAttribute.WeaponSpeed) > SSICap ? SSICap : AosAttributes.GetValue(pm, AosAttribute.WeaponSpeed);
int hue = 1149;
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
this.AddPage(0);
this.AddBackground(56, 56, 423, 340, 9270);
this.AddImage(443, 20, 10441);
this.AddImage(10, 20, 10440);
this.AddBackground(144, 20, 249, 42, 9270);
this.AddLabel(173, 31, 394, @"Lumyr Character Information");
/*********** STATS *****************/
this.AddLabel(75, 74, 394, @"Stats");
this.AddImage(75, 94, 9277);
this.AddImage(133, 94, 9277);
this.AddLabel(75, 106, 155, @"Strength:");
this.AddLabel(200, 106, hue, @"" + pm.RawStr + " + " + (pm.Str - pm.RawStr) + "");
this.AddLabel(76, 136, 155, @"Intelligence:");
this.AddLabel(200, 136, hue, @"" + pm.RawInt + " + " + (pm.Int - pm.RawInt) + "");
this.AddLabel(75, 121, 155, @"Dexterity:");
this.AddLabel(200, 121, hue, @"" + pm.RawDex + " + " + (pm.Dex - pm.RawDex) + "");
/*********** VITALS ****************/
this.AddLabel(75, 157, 394, @"Vitals");
this.AddLabel(217, 157, 394, @"Regen");
this.AddLabel(169, 157, 394, @"Bonus");
this.AddImage(75, 178, 9277);
this.AddImage(133, 178, 9277);
this.AddLabel(75, 190, 155, @"HP:");
this.AddLabel(105, 190, hue, @"" + pm.Hits + "/" + pm.HitsMax + "");
this.AddLabel(174, 190, hue, @"(+ " + AosAttributes.GetValue(pm, AosAttribute.BonusHits) + ")");
this.AddLabel(232, 190, hue, @"" + AosAttributes.GetValue(pm, AosAttribute.RegenHits) + "");
this.AddLabel(75, 205, 155, @"MP:");
this.AddLabel(105, 205, hue, @"" + pm.Mana + "/" + pm.ManaMax + "");
this.AddLabel(174, 205, hue, @"(+ " + AosAttributes.GetValue(pm, AosAttribute.BonusMana) + ")");
this.AddLabel(232, 205, hue, @"" + AosAttributes.GetValue(pm, AosAttribute.RegenMana) + "");
this.AddLabel(75, 220, 155, @"SP:");
this.AddLabel(105, 220, hue, @"" + pm.Stam + "/" + pm.StamMax + "");
this.AddLabel(174, 220, hue, @"(+ " + AosAttributes.GetValue(pm, AosAttribute.BonusStam) + ")");
this.AddLabel(232, 220, hue, @"" + AosAttributes.GetValue(pm, AosAttribute.RegenStam) + "");
/************ POINTS ************/
this.AddLabel(75, 240, 394, @"Points");
this.AddImage(75, 260, 9277);
this.AddImage(133, 260, 9277);
this.AddLabel(75, 270, 155, @"Tithing Points:");
this.AddLabel(182, 270, hue, @"" + pm.TithingPoints + "");
this.AddLabel(75, 285, 155, @"Karma:");
this.AddLabel(182, 285, hue, @"" + pm.Karma + "");
this.AddLabel(75, 300, 155, @"Fame:");
this.AddLabel(182, 300, hue, @"" + pm.Fame + "");
this.AddLabel(75, 315, 155, @"Player Kills:");
this.AddLabel(182, 315, hue, @"" + pm.Kills + "");
this.AddLabel(75, 330, 155, @"Followers:");
this.AddLabel(182, 330, hue, @"" + pm.Followers + "/" + pm.FollowersMax + "");
// Setup Damage
IWeapon weapon = m.Weapon;
int min = 0, max = 0;
if (weapon != null)
weapon.GetStatusDamage(m, out min, out max);
this.AddLabel(75, 345, 155, @"Damage:");
this.AddLabel(182, 345, hue, @"" + min + " - " + max + "");
this.AddLabel(75, 360, 155, @"Luck:");
this.AddLabel(182, 360, hue, @"" + pm.Luck + "");
/************* CHAR INFO *********************/
this.AddLabel(272, 74, 394, @"Character Information");
this.AddImage(272, 94, 9277);
this.AddImage(330, 94, 9277);
this.AddLabel(272, 106, 93, @"" + pm.Name + "");
this.AddLabel(272, 126, 155, @"LRC:");
this.AddLabel(304, 126, hue, @"" + LRC + " %");
this.AddLabel(350, 126, 155, @"LMC:");
this.AddLabel(385, 126, hue, @"" + LMC + " %");
this.AddLabel(272, 146, 155, @"FC:");
this.AddLabel(305, 146, hue, @"" + FC + "");
this.AddLabel(350, 146, 155, @"FCR:");
this.AddLabel(385, 146, hue, @"" + FCR + "");
this.AddLabel(273, 166, 155, @"SDI:");
this.AddLabel(305, 166, hue, @"" + SDI + " %");
this.AddLabel(350, 166, 155, @"SSI:");
this.AddLabel(385, 166, hue, @"" + SSI + " %");
this.AddLabel(273, 186, 155, @"HCI:");
this.AddLabel(305, 186, hue, @"" + HCI + " %");
this.AddLabel(350, 186, 155, @"DCI:");
this.AddLabel(385, 186, hue, @"" + DCI + " %");
this.AddLabel(273, 206, 155, @"Damage Increase:");
this.AddLabel(385, 206, hue, @"" + DamageIncrease + " %");
this.AddLabel(273, 226, 155, @"Bandage Speed:");
this.AddLabel(385, 226, hue, String.Format("{0:0.0}s", new DateTime(TimeSpan.FromSeconds(BandageSpeed).Ticks).ToString("s.ff")));
this.AddLabel(273, 246, 155, @"Swing Speed:");
this.AddLabel(385, 246, hue, String.Format("{0}s", new DateTime(SwingSpeed.Ticks).ToString("s.ff")));
this.AddLabel(273, 266, 155, @"Reflect Damage:");
this.AddLabel(385, 266, hue, @"" + ReflectDamage + " %");
// Setup Weight
int weight = Mobile.BodyWeight + m.TotalWeight;
this.AddLabel(273, 286, 155, @"Weight:");
this.AddLabel(385, 286, hue, @"" + weight + "/" + pm.MaxWeight + "");
this.AddLabel(273, 306, 155, @"Skill Total:");
this.AddLabel(385, 306, hue, @"" + pm.SkillsTotal + "");
/************* MONEY ***************/
//Lets Setup the Box as the Characters BankBox
BankBox box = pm.BankBox;
this.AddLabel(272, 331, 394, @"Loose Coins");
this.AddLabel(362, 331, 394, @"Carried/Bank");
this.AddImage(272, 351, 9277);
this.AddImage(330, 351, 9277);
this.AddLabel(276, 360, 144, @"Gold");
this.AddLabel(330, 360, hue, @"" + pm.TotalGold + "/" + Banker.GetBalance( pm ).ToString());
}
}
}

View File

@@ -0,0 +1,313 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
using Server.Commands;
using System.IO;
using System.Linq;
namespace Server.Gumps
{
//this is an entry which holds the loaded cliloc index/text pair
public class CliLocEntry
{
protected int _Index;
protected string _Text;
public int Index
{
get { return _Index; }
}
public string Text
{
get { return _Text; }
}
public override string ToString()
{
return _Text;
}
public CliLocEntry(int index,string text)
{
_Index = index;
_Text = text;
}
}
public class ClilocGump : Gump
{
public static List<int> ClilocList;
public static Hashtable ClilocHash;
private static int MaxEntry { get { return 3011032; } }
public static void Initialize()
{
CommandSystem.Register("ClilocGump", AccessLevel.Administrator, new CommandEventHandler(ClilocGump_OnCommand));
CommandSystem.Register("Cliloc", AccessLevel.Administrator, new CommandEventHandler(ClilocGump_OnCommand));
if (LoadClilocs()) Console.WriteLine("ClilocGump successfully loaded Cliloc list.");
else Console.WriteLine("ClilocGump failed to load Cliloc list.");
}
[Usage("ClilocGump")]
[Description("Begins the Cliloc Gump.")]
private static void ClilocGump_OnCommand(CommandEventArgs e)
{
Mobile m = e.Mobile;
try
{
int arg = Int32.Parse(e.Arguments[0]);
if (arg >= 500000 && arg <= 3011032) {
m.SendGump(new ClilocGump(m, arg));
}
else {
m.SendGump(new ClilocGump(m));
}
}
catch {
m.SendGump(new ClilocGump(m));
}
}
private static bool LoadClilocs()
{
bool success = true;
ClilocHash = Read("cliloc.enu", Core.FindDataFile("cliloc.enu"));
ClilocList = new List<int>();
try
{
for (int x = 500000; x < 3011032; x++)
{
if (ClilocHash.ContainsKey(x) && ClilocHash[x] is CliLocEntry && ((CliLocEntry)ClilocHash[x]).Text.Length > 0)
{
ClilocList.Add(x);
}
}
}
catch { success = false; }
return success;
}
//read operation, which loads all the data into the specified cliloc entry hashtable
public static Hashtable Read(string _Filename, string _FilePath)
{
Hashtable clilocs = new Hashtable();
if (File.Exists(_FilePath))
{
using (FileStream stream = new FileStream(_FilePath,FileMode.Open,FileAccess.Read,FileShare.Read))
{
BinaryReader reader = new BinaryReader(stream);
for (int i = 0; i < 6; i++){reader.ReadByte();}
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
int index = 0;
while (index != MaxEntry)
{
try {
index = reader.ReadInt32();
reader.ReadByte();
short strlen = reader.ReadInt16();
byte[] buffer = new byte[strlen];
reader.Read(buffer,0,strlen);
string text = encoding.GetString(buffer);
clilocs.Add(index,new CliLocEntry(index,text));
}
catch{}
}
}
}
else
{
Console.WriteLine("CliLoc load error: file doesn't exist");
return null;
}
return clilocs;
}
private Mobile m_From;
private int m_OldIndex;
private int m_LastIndex;
private const int NUM_PER_PAGE = 8;
private int m_Theme = 7;
private string m_Filter = "";
private List<int> m_List;
public ClilocGump(Mobile from)
: this(from, 0, 7, "")
{
}
public ClilocGump(Mobile from, int temp)
: this(from, ClilocList.LastIndexOf(temp), 7, "")
{
}
public ClilocGump(Mobile from, int index, int theme, string filter)
: base(20, 40)
{
m_From = from;
m_OldIndex = index;
m_LastIndex = index;
m_Theme = theme;
m_Filter = filter;
m_List = ClilocList;
int precount = m_List.Count;
if (m_Filter.Length > 0)
m_List = FilteredCliLocs(m_Filter);
bool t7 = theme == 7;
bool t8 = theme == 8;
bool t9 = theme == 9;
bool t10 = theme == 10;
bool t11 = theme == 11;
int bground = t7 ? 9200 : t8 ? 3500 : t9 ? 3600 : t10 ? 9400 : 9300;
Closable = true;
Disposable = true;
Dragable = true;
Resizable = true;
AddPage(0);
AddBackground(20, 40, 740, 505, bground);
AddBackground(20, 551, 618, 39, bground);
AddBackground(621, 551, 139, 39, bground);
AddBackground(600, 90, 130, 60, 9200);
AddHtml(615, 105, 80, 30, t7 ? "*Current*" : "Select This One", true, false);
if (!t7) AddButton(700, 108, 1210, 1210, 7, GumpButtonType.Reply, 0);
AddBackground(600, 165, 130, 60, 3500);
AddHtml(615, 180, 80, 30, t8 ? "*Current*" : "Select This One", true, false);
if (!t8) AddButton(700, 183, 1210, 1210, 8, GumpButtonType.Reply, 0);
AddBackground(600, 240, 130, 60, 3600);
AddHtml(615, 255, 80, 30, t9 ? "*Current*" : "Select This One", true, false);
if (!t9) AddButton(700, 258, 1210, 1210, 9, GumpButtonType.Reply, 0);
AddBackground(600, 315, 130, 60, 9400);
AddHtml(615, 330, 80, 30, t10 ? "*Current*" : "Select This One", true, false);
if (!t10) AddButton(700, 333, 1210, 1210, 10, GumpButtonType.Reply, 0);
AddBackground(600, 390, 130, 60, 9300);
AddHtml(615, 405, 80, 30, t11 ? "*Current*" : "Select This One", true, false);
if (!t11) AddButton(700, 408, 1210, 1210, 11, GumpButtonType.Reply, 0);
int y = 45;
int found = 0;
int error = 0;
for (int z = index; found < NUM_PER_PAGE && z < m_List.Count; z++)
{
try
{
AddHtml(33, y + 3, 80, 22, m_List[z].ToString(), false, false);
AddHtmlLocalized(110, y, 480, (int)(500 / NUM_PER_PAGE) - 5, m_List[z], true, true);
y += (int)(500/NUM_PER_PAGE);
found += 1;
}
catch {
error++;
}
m_LastIndex = z;
}
try {
AddLabel(490, 560, 380, "Search by number:");
AddTextField(630, 560, 90, 20, 2, m_List[index].ToString());
AddButton(715, 560, 4015, 4016, 5, GumpButtonType.Reply, 0);
AddLabel(20, 560, 380, "Search by name:");
AddTextField(130, 560, 290, 20, 3, m_Filter);
AddButton(420, 560, 4015, 4016, 6, GumpButtonType.Reply, 0);
if (index - NUM_PER_PAGE >= 0)
AddButton(601, 45, 0x1519, 0x1519, 3, GumpButtonType.Reply, 0); // Previous Page
if (index + NUM_PER_PAGE < m_List.Count)
AddButton(601, 522, 0x151A, 0x151A, 4, GumpButtonType.Reply, 0); // Next Page
}
catch (Exception e) {
Console.WriteLine(e.Message);
}
}
public void AddTextField(int x,int y,int width,int height,int index,string text)
{
AddImageTiled(x - 2,y - 2,width + 4,height + 4,0xA2C);
AddAlphaRegion(x - 2,y - 2,width + 4,height + 4);
AddTextEntry(x + 2,y + 2,width - 4,height - 4,1153,index,text);
}
public override void OnResponse(NetState state, RelayInfo info)
{
int x = info.ButtonID;
TextRelay tr2 = info.GetTextEntry(2);
TextRelay tr3 = info.GetTextEntry(3);
m_From.CloseGump(typeof(ClilocGump));
if (x == 3) m_From.SendGump(new ClilocGump(m_From, m_OldIndex - NUM_PER_PAGE, m_Theme, m_Filter)); //Previous Page
else if (x == 4) m_From.SendGump(new ClilocGump(m_From, m_LastIndex + 1, m_Theme, m_Filter)); //Next Page
else if (x == 5 && tr2 != null)
{
//Try to interpret the number typed in the browse box.
int temp = 0;
try { temp = Convert.ToInt32(tr2.Text, 10); }
catch { }
if (ClilocList.Contains(temp))
{
m_From.SendGump(new ClilocGump(m_From, ClilocList.LastIndexOf(temp), m_Theme, ""));
}
else
//If out of range, send an error, and re-display the gump.
{
m_From.SendMessage("That number is out of range.");
m_From.SendGump(new ClilocGump(m_From, m_OldIndex, m_Theme, m_Filter));
}
}
else if (x == 6 && tr3 != null)
{
//Try to interpret the number typed in the browse box.
string filter = "";
try { filter = tr3.Text; }
catch {
m_From.SendMessage("That search text was not recognized.");
m_From.SendGump(new ClilocGump(m_From, 0, m_Theme, ""));
}
m_From.SendGump(new ClilocGump(m_From, 0, m_Theme, filter));
}
else if (x == 7) m_From.SendGump(new ClilocGump(m_From, m_OldIndex, x, m_Filter)); //Grey Stone Theme
else if (x == 8) m_From.SendGump(new ClilocGump(m_From, m_OldIndex, x, m_Filter)); //Paper Theme
else if (x == 9) m_From.SendGump(new ClilocGump(m_From, m_OldIndex, x, m_Filter)); //Dark Box Theme
else if (x == 10) m_From.SendGump(new ClilocGump(m_From, m_OldIndex, x, m_Filter)); //Shiny Grey Theme
else if (x == 11) m_From.SendGump(new ClilocGump(m_From, m_OldIndex, x, m_Filter)); //Tan Parchment Theme
}
protected static List<int> FilteredCliLocs(string filterstring)
{
if (filterstring == null || filterstring == "")
{
return ClilocGump.ClilocHash.Keys.Cast<int>().ToList();
}
List<int> filtered = new List<int>();
IDictionaryEnumerator enumerator = ClilocGump.ClilocHash.GetEnumerator();
//seek ahead until you reach the entry
while (enumerator.MoveNext())
{
if (enumerator.Value.ToString().ToLower().IndexOf(filterstring.ToLower()) > -1)
{
filtered.Add((int)enumerator.Key);
}
}
filtered.Sort();
if (filtered.Count == 0) return ClilocGump.ClilocHash.Keys.Cast<int>().ToList();
return filtered;
}
}
}

View File

@@ -0,0 +1,662 @@
//Emote v2 by CMonkey123
/*
v2 changes:
-Shortened script
-Added emotes (thanks to zire):
bow, faint, punch, slap, stickouttongue, tapfoot
-Added emote gump (thanks to zire)
*/
/* Emote v3 by GM Jubal from Ebonspire http://www.ebonspire.com
* I Left the above comments in here for credit to properly go back to those whom originally wrote this
* I simply made it so that the [e command would call the gump if used by itself or if the <sound> was
* misspelled, shortened the code down from 1300+ lines down to only 635 lines including these comments.
* Also fixed a couple of typos in the script.
* This has been tested on both RunUO beta .36 and RunUO RC0 1.0
*/
/* Emote v4 by Lysdexic
* Updated for RunUO 2.0 RC2
* Puke command could be used for teleport bug... removed that ability.
* Typos again...
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Gumps;
using Server.Commands.Generic;
namespace Server.Commands
{
public enum EmotePage
{
P1,
P2,
P3,
P4,
}
public class Emote
{
public static void Initialize()
{
CommandSystem.Register( "emote", AccessLevel.Player, new CommandEventHandler( Emote_OnCommand ) );
CommandSystem.Register( "e", AccessLevel.Player, new CommandEventHandler( Emote_OnCommand ) );
}
[Usage( "<sound>" )]
[Description( "Emote with sounds, words, and possibly an animation with one command!")]
private static void Emote_OnCommand( CommandEventArgs e )
{
Mobile pm = e.Mobile;
string em = e.ArgString.Trim();
int SoundInt;
switch( em )
{
case "ah":
SoundInt = 1;
break;
case "ahha":
SoundInt = 2;
break;
case "applaud":
SoundInt = 3;
break;
case "blownose":
SoundInt = 4;
break;
case "bow":
SoundInt = 5;
break;
case "bscough":
SoundInt = 6;
break;
case "burp":
SoundInt = 7;
break;
case "clearthroat":
SoundInt = 8;
break;
case "cough":
SoundInt = 9;
break;
case "cry":
SoundInt = 10;
break;
case "faint":
SoundInt = 11;
break;
case "fart":
SoundInt = 12;
break;
case "gasp":
SoundInt = 13;
break;
case "giggle":
SoundInt = 14;
break;
case "groan":
SoundInt = 15;
break;
case "growl":
SoundInt = 16;
break;
case "hey":
SoundInt = 17;
break;
case "hiccup":
SoundInt = 18;
break;
case "huh":
SoundInt = 19;
break;
case "kiss":
SoundInt = 20;
break;
case "laugh":
SoundInt = 21;
break;
case "no":
SoundInt = 22;
break;
case "oh":
SoundInt = 23;
break;
case "oooh":
SoundInt = 24;
break;
case "oops":
SoundInt = 25;
break;
case "puke":
SoundInt = 26;
break;
case "punch":
SoundInt = 27;
break;
case "scream":
SoundInt = 28;
break;
case "shush":
SoundInt = 29;
break;
case "sigh":
SoundInt = 30;
break;
case "slap":
SoundInt = 31;
break;
case "sneeze":
SoundInt = 32;
break;
case "sniff":
SoundInt = 33;
break;
case "snore":
SoundInt = 34;
break;
case "spit":
SoundInt = 35;
break;
case "stickouttongue":
SoundInt = 36;
break;
case "tapfoot":
SoundInt = 37;
break;
case "whistle":
SoundInt = 38;
break;
case "woohoo":
SoundInt = 39;
break;
case "yawn":
SoundInt = 40;
break;
case "yea":
SoundInt = 41;
break;
case "yell":
SoundInt = 42;
break;
default:
SoundInt = 0;
e.Mobile.SendGump( new EmoteGump( e.Mobile, EmotePage.P1) );
break;
}
if ( SoundInt > 0 )
new ESound( pm, SoundInt );
}
}
public class EmoteGump : Gump
{
private Mobile m_From;
private EmotePage m_Page;
private const int Blanco = 0xFFFFFF;
private const int Azul = 0x8080FF;
public void AddPageButton( int x, int y, int buttonID, string text, EmotePage page, params EmotePage[] subpage )
{
bool seleccionado = ( m_Page == page );
for ( int i = 0; !seleccionado && i < subpage.Length; ++i )
seleccionado = ( m_Page == subpage[i] );
AddButton( x, y - 1, seleccionado ? 4006 : 4005, 4007, buttonID, GumpButtonType.Reply, 0 );
AddHtml( x + 35, y, 200, 20, Color( text, seleccionado ? Azul : Blanco ), false, false );
}
public void AddButtonLabeled( int x, int y, int buttonID, string text )
{
AddButton( x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0 );
AddHtml( x + 35, y, 240, 20, Color( text, Blanco ), false, false );
}
public int GetButtonID( int type, int index )
{
return 1 + (index * 15) + type;
}
public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
public EmoteGump ( Mobile from, EmotePage page) : base ( 600, 50 )
{
from.CloseGump( typeof( EmoteGump ) );
m_From = from;
m_Page = page;
Closable = true;
Dragable = true;
AddPage( 0 );
AddBackground( 0, 65, 130, 360, 5054);
AddAlphaRegion( 10, 70, 110, 350 );
AddImageTiled( 10, 70, 110, 20, 9354);
AddLabel( 13, 70, 200, "Emote List");
AddImage( 100, 0, 10410);
AddImage( 100, 305, 10412);
AddImage( 100, 150, 10411);
switch ( page )
{
case EmotePage.P1:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 1 ), "Ah");
AddButtonLabeled( 10, 115, GetButtonID( 1, 2 ), "Ah-ha");
AddButtonLabeled( 10, 140, GetButtonID( 1, 3 ), "Applaud");
AddButtonLabeled( 10, 165, GetButtonID( 1, 4 ), "Blows Nose");
AddButtonLabeled( 10, 190, GetButtonID( 1, 5 ), "Bows");
AddButtonLabeled( 10, 215, GetButtonID( 1, 6 ), "BS Cough");
AddButtonLabeled( 10, 240, GetButtonID( 1, 7 ), "Burp");
AddButtonLabeled( 10, 265, GetButtonID( 1, 8 ), "Clear Throat");
AddButtonLabeled( 10, 290, GetButtonID( 1, 9 ), "Cough");
AddButtonLabeled( 10, 315, GetButtonID( 1, 10 ), "Cry");
AddButtonLabeled( 10, 340, GetButtonID( 1, 11 ), "Faints");
AddButtonLabeled( 10, 365, GetButtonID( 1, 12 ), "Fart");
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
break;
}
case EmotePage.P2:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 13 ), "Gasp");
AddButtonLabeled( 10, 115, GetButtonID( 1, 14 ), "Giggle");
AddButtonLabeled( 10, 140, GetButtonID( 1, 15 ), "Groan");
AddButtonLabeled( 10, 165, GetButtonID( 1, 16 ), "Growl");
AddButtonLabeled( 10, 190, GetButtonID( 1, 17 ), "Hey");
AddButtonLabeled( 10, 215, GetButtonID( 1, 18 ), "Hiccup");
AddButtonLabeled( 10, 240, GetButtonID( 1, 19 ), "Huh");
AddButtonLabeled( 10, 265, GetButtonID( 1, 20 ), "Kiss");
AddButtonLabeled( 10, 290, GetButtonID( 1, 21 ), "Laughs");
AddButtonLabeled( 10, 315, GetButtonID( 1, 22 ), "No");
AddButtonLabeled( 10, 340, GetButtonID( 1, 23 ), "Oh");
AddButtonLabeled( 10, 365, GetButtonID( 1, 24 ), "Oooh");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,1 ), GumpButtonType.Reply, 0 );
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,3 ), GumpButtonType.Reply, 0 );
break;
}
case EmotePage.P3:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 25 ), "Oops");
AddButtonLabeled( 10, 115, GetButtonID( 1, 26 ), "Puke");
AddButtonLabeled( 10, 140, GetButtonID( 1, 27 ), "Punch");
AddButtonLabeled( 10, 165, GetButtonID( 1, 28 ), "Scream");
AddButtonLabeled( 10, 190, GetButtonID( 1, 29 ), "Shush");
AddButtonLabeled( 10, 215, GetButtonID( 1, 30 ), "Sigh");
AddButtonLabeled( 10, 240, GetButtonID( 1, 31 ), "Slap");
AddButtonLabeled( 10, 265, GetButtonID( 1, 32 ), "Sneeze");
AddButtonLabeled( 10, 290, GetButtonID( 1, 33 ), "Sniff");
AddButtonLabeled( 10, 315, GetButtonID( 1, 34 ), "Snore");
AddButtonLabeled( 10, 340, GetButtonID( 1, 35 ), "Spit");
AddButtonLabeled( 10, 365, GetButtonID( 1, 36 ), "Sticks Tongue");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,2 ), GumpButtonType.Reply, 0 );
AddButton( 70, 380, 4502, 0504, GetButtonID( 0,4 ), GumpButtonType.Reply, 0 );
break;
}
case EmotePage.P4:
{
AddButtonLabeled( 10, 90, GetButtonID( 1, 37 ), "Taps Foot");
AddButtonLabeled( 10, 115, GetButtonID( 1, 38 ), "Whistle");
AddButtonLabeled( 10, 140, GetButtonID( 1, 39 ), "Woohoo");
AddButtonLabeled( 10, 165, GetButtonID( 1, 40 ), "Yawn");
AddButtonLabeled( 10, 190, GetButtonID( 1, 41 ), "Yea");
AddButtonLabeled( 10, 215, GetButtonID( 1, 42 ), "Yell");
AddButton( 10, 380, 4506, 4508, GetButtonID( 0,3 ), GumpButtonType.Reply, 0 );
break;
}
}
}
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
{
int val = info.ButtonID - 1;
if ( val < 0 )
return;
Mobile from = m_From;
int type = val % 15;
int index = val / 15;
switch ( type )
{
case 0:
{
EmotePage page;
switch ( index )
{
case 1: page = EmotePage.P1; break;
case 2: page = EmotePage.P2; break;
case 3: page = EmotePage.P3; break;
case 4: page = EmotePage.P4; break;
default: return;
}
from.SendGump( new EmoteGump( from, page) );
break;
}
case 1:
{
if ( index > 0 && index < 13 )
{
from.SendGump( new EmoteGump( from, EmotePage.P1) );
}
else if ( index > 12 && index < 25 )
{
from.SendGump( new EmoteGump( from, EmotePage.P2) );
}
else if ( index > 24 && index < 37 )
{
from.SendGump( new EmoteGump( from, EmotePage.P3) );
}
else if ( index > 36 && index < 43 )
{
from.SendGump( new EmoteGump( from, EmotePage.P4) );
}
new ESound( from, index );
break;
}
}
}
}
public class ItemRemovalTimer : Timer
{
private Item i_item;
public ItemRemovalTimer( Item item ) : base( TimeSpan.FromSeconds( 1.0 ) )
{
Priority = TimerPriority.OneSecond;
i_item = item;
}
protected override void OnTick()
{
if (( i_item != null ) && ( !i_item.Deleted ))
{
i_item.Delete();
Stop();
}
}
}
public class Puke : Item
{
private Timer m_Timer;
[Constructable]
public Puke() : base( Utility.RandomList( 0xf3b, 0xf3c ) )
{
Name = "A Pile of Puke";
Hue = 0x557;
Movable = false;
m_Timer = new ItemRemovalTimer( this );
m_Timer.Start();
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
if ( m_Timer != null )
m_Timer.Stop();
}
public override void OnSingleClick( Mobile from )
{
this.LabelTo( from, this.Name );
}
public Puke( 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();
this.Delete(); // none when the world starts
}
}
public class ESound
{
public ESound( Mobile pm, int SoundMade )
{
switch( SoundMade )
{
case 1:
pm.PlaySound( pm.Female ? 778 : 1049 );
pm.Say( "*ah!*" );
break;
case 2:
pm.PlaySound( pm.Female ? 779 : 1050 );
pm.Say( "*ah ha!*" );
break;
case 3:
pm.PlaySound( pm.Female ? 780 : 1051 );
pm.Say( "*applauds*" );
break;
case 4:
pm.PlaySound( pm.Female ? 781 : 1052 );
pm.Say( "*blows nose*" );
if ( !pm.Mounted )
pm.Animate( 34, 5, 1, true, false, 0 );
break;
case 5:
pm.Say( "*bows*" );
if ( !pm.Mounted )
pm.Animate( 32, 5, 1, true, false, 0 );
break;
case 6:
pm.PlaySound( pm.Female ? 786 : 1057 );
pm.Say( "*bs cough*" );
break;
case 7:
pm.PlaySound( pm.Female ? 782 : 1053 );
pm.Say( "*burp!*" );
if ( !pm.Mounted )
pm.Animate( 33, 5, 1, true, false, 0 );
break;
case 8:
pm.PlaySound( pm.Female ? 748 : 1055 );
pm.Say( "*clears throat*" );
if ( !pm.Mounted )
pm.Animate( 33, 5, 1, true, false, 0 );
break;
case 9:
pm.PlaySound( pm.Female ? 785 : 1056 );
pm.Say( "*cough!*" );
if ( !pm.Mounted )
pm.Animate( 33, 5, 1, true, false, 0 );
break;
case 10:
pm.PlaySound( pm.Female ? 787 : 1058 );
pm.Say( "*cries*" );
break;
case 11:
pm.PlaySound( pm.Female ? 791 : 1063 );
pm.Say( "*faints*" );
if ( !pm.Mounted )
pm.Animate( 22, 5, 1, true, false, 0 );
break;
case 12:
pm.PlaySound( pm.Female ? 792 : 1064 );
pm.Say( "*farts*" );
break;
case 13:
pm.PlaySound( pm.Female ? 793 : 1065 );
pm.Say( "*gasp!*" );
break;
case 14:
pm.PlaySound( pm.Female ? 794 : 1066 );
pm.Say( "*giggles*" );
break;
case 15:
pm.PlaySound( pm.Female ? 795 : 1067 );
pm.Say( "*groans*" );
break;
case 16:
pm.PlaySound( pm.Female ? 796 : 1068 );
pm.Say( "*growls*" );
break;
case 17:
pm.PlaySound( pm.Female ? 797 : 1069 );
pm.Say( "*hey!*" );
break;
case 18:
pm.PlaySound( pm.Female ? 798 : 1070 );
pm.Say( "*hiccup!*" );
break;
case 19:
pm.PlaySound( pm.Female ? 799 : 1071 );
pm.Say( "*huh?*" );
break;
case 20:
pm.PlaySound( pm.Female ? 800 : 1072 );
pm.Say( "*kisses*" );
break;
case 21:
pm.PlaySound( pm.Female ? 801 : 1073 );
pm.Say( "*laughs*" );
break;
case 22:
pm.PlaySound( pm.Female ? 802 : 1074 );
pm.Say( "*no!*" );
break;
case 23:
pm.PlaySound( pm.Female ? 803 : 1075 );
pm.Say( "*oh!*" );
break;
case 24:
pm.PlaySound( pm.Female ? 811 : 1085 );
pm.Say( "*oooh*" );
break;
case 25:
pm.PlaySound( pm.Female ? 812 : 1086 );
pm.Say( "*oops*" );
break;
case 26:
pm.PlaySound( pm.Female ? 813 : 1087 );
pm.Say( "*pukes*" );
if ( !pm.Mounted )
pm.Animate( 32, 5, 1, true, false, 0 );
Point3D p = new Point3D( pm.Location );
switch( pm.Direction )
{
case Direction.North:
p.Y--; break;
case Direction.South:
p.Y++; break;
case Direction.East:
p.X++; break;
case Direction.West:
p.X--; break;
case Direction.Right:
p.X++; p.Y--; break;
case Direction.Down:
p.X++; p.Y++; break;
case Direction.Left:
p.X--; p.Y++; break;
case Direction.Up:
p.X--; p.Y--; break;
default:
break;
}
p.Z = pm.Map.GetAverageZ( p.X, p.Y );
bool canFit = Server.Spells.SpellHelper.AdjustField( ref p, pm.Map, 12, false );
if ( canFit )
{
Puke puke = new Puke();
puke.Map = pm.Map;
puke.Location = p;
}
/*else
pm.SendMessage( "your puke won't fit!" ); /* Debug testing */
break;
case 27:
pm.PlaySound( 315 );
pm.Say( "*punches*" );
if ( !pm.Mounted )
pm.Animate( 31, 5, 1, true, false, 0 );
break;
case 28:
pm.PlaySound( pm.Female ? 814 : 1088 );
pm.Say( "*ahhhh!*" );
break;
case 29:
pm.PlaySound( pm.Female ? 815 : 1089 );
pm.Say( "*shhh!*" );
break;
case 30:
pm.PlaySound( pm.Female ? 816 : 1090 );
pm.Say( "*sigh*" );
break;
case 31:
pm.PlaySound( 948 );
pm.Say( "*slaps*" );
if ( !pm.Mounted )
pm.Animate( 11, 5, 1, true, false, 0 );
break;
case 32:
pm.PlaySound( pm.Female ? 817 : 1091 );
pm.Say( "*ahh-choo!*" );
if ( !pm.Mounted )
pm.Animate( 32, 5, 1, true, false, 0 );
break;
case 33:
pm.PlaySound( pm.Female ? 818 : 1092 );
pm.Say( "*sniff*" );
if( !pm.Mounted )
pm.Animate( 34, 5, 1, true, false, 0 );
break;
case 34:
pm.PlaySound( pm.Female ? 819 : 1093 );
pm.Say( "*snore*" );
break;
case 35:
pm.PlaySound( pm.Female ? 820 : 1094 );
pm.Say( "*spits*" );
if ( !pm.Mounted )
pm.Animate( 6, 5, 1, true, false, 0 );
break;
case 36:
pm.PlaySound( 792 );
pm.Say( "*sticks out tongue*" );
break;
case 37:
pm.PlaySound( 874 );
pm.Say( "*taps foot*" );
if ( !pm.Mounted )
pm.Animate( 38, 5, 1, true, false, 0 );
break;
case 38:
pm.PlaySound( pm.Female ? 821 : 1095 );
pm.Say( "*whistles*" );
if ( !pm.Mounted )
pm.Animate( 5, 5, 1, true, false, 0 );
break;
case 39:
pm.PlaySound( pm.Female ? 783 : 1054 );
pm.Say( "*woohoo!*" );
break;
case 40:
pm.PlaySound( pm.Female ? 822 : 1096 );
pm.Say( "*yawns*" );
if ( !pm.Mounted )
pm.Animate( 17, 5, 1, true, false, 0 );
break;
case 41:
pm.PlaySound( pm.Female ? 823 : 1097 );
pm.Say( "*yea!*" );
break;
case 42:
pm.PlaySound( pm.Female ? 823 : 1098 );
pm.Say( "*yells*" );
break;
}
}
}
}

View File

@@ -0,0 +1,57 @@
/*
*made by Ttxman
*
*/
using System;
using System.Reflection;
using Server.Items;
using Server.Targeting;
using System.Collections;
using Server.Engines.BulkOrders;
namespace Server.Commands
{
public class FillBulk
{
public static void Initialize()
{
CommandSystem.Register( "FillBOD", AccessLevel.GameMaster, new CommandEventHandler( FillBulk_OnCommand ) );
}
[Usage( "FillBOD" )]
[Description( "Fills BOD" )]
private static void FillBulk_OnCommand( CommandEventArgs e )
{
e.Mobile.Target = new FillBulkTarget();
e.Mobile.SendMessage("Target a BOD to fill it");
}
private class FillBulkTarget : Target
{
public FillBulkTarget() : base( 20, false, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object targ )
{
if (!((targ is SmallBOD) || (targ is LargeBOD)))
return;
if (targ is SmallBOD)
{
SmallBOD x = targ as SmallBOD;
x.AmountCur =x.AmountMax;
x.InvalidateProperties();
}else if (targ is LargeBOD)
{
LargeBOD y = targ as LargeBOD;
foreach (LargeBulkEntry e in y.Entries)
{
e.Amount = y.AmountMax;
}
y.InvalidateProperties();
}
}
}
}
}

View File

@@ -0,0 +1,213 @@
// Script: GetPet
// Version: 1.0
// Author: Datguy (Morpheus)
// Servers: RunUO 2.0
// Date: 9/20/2007
// Purpose:
// Player Command. Allows players Allows players to retrieve their pets they may have lost for a fee
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
namespace Server.Commands
{
public class GetPet
{
private int m_Pets;
public static void Initialize()
{
CommandSystem.Register("GetPet", AccessLevel.Player, new CommandEventHandler(GetPet_OnCommand));
}
[Usage("GetPet")]
[Description("Teleports all your pets to your location.")]
public static void GetPet_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
ArrayList pet = new ArrayList();
foreach (Mobile m in World.Mobiles.Values)
{
if (m is BaseCreature)
{
BaseCreature bc = (BaseCreature)m;
if ((bc.Controlled && bc.ControlMaster == from) || (bc.Summoned && bc.SummonMaster == from))
pet.Add(bc);
}
}
from.SendGump(new GetPetGump(pet.Count));
}
}
}
namespace Server.Gumps
{
public class GetPetGump : Gump
{
//public GetPetGump(Mobile m) : base(150, 50)
private int m_Price;
private int m_Pet;
private int m_cycle;
public GetPetGump( int pet ) : base( 150, 50 )
{
m_Pet = pet;
m_Price = 100 * m_Pet;////Price per Pet 3500
Closable = false;
AddPage(0);
AddImage(0, 0, 3600);
AddImageTiled(0, 14, 15, 200, 3603);
AddImageTiled(380, 14, 14, 200, 3605);
AddImage(0, 201, 3606);
AddImageTiled(15, 201, 370, 16, 3607);
AddImageTiled(15, 0, 370, 16, 3601);
AddImage(380, 0, 3602);
AddImage(380, 201, 3608);
AddImageTiled(15, 15, 365, 190, 2624);
AddRadio(30, 140, 9727, 9730, true, 1);
AddHtmlLocalized(65, 145, 300, 25, 1060015, 0x7FFF, false, false); // Grudgingly pay the money
AddRadio(30, 175, 9727, 9730, false, 0);
AddHtml(65, 178, 300, 25, "<BASEFONT COLOR=White>I'll find my pets myself.</BASEFONT>", false, false);
AddHtml(30, 20, 360, 35, "<BASEFONT COLOR=Red>Pay the price per pet, and your pets will be brought to you, even if your sitting on it!, so shrink it.</BASEFONT>", false, false);
AddHtmlLocalized(30, 105, 345, 40, 1060018, 0x5B2D, false, false); // Do you accept the fee, which will be withdrawn from your Ledger or Bank?
AddImage(65, 72, 5605);
AddImageTiled(80, 90, 200, 1, 9107);
AddImageTiled(95, 92, 200, 1, 9157);
AddLabel(90, 70, 1645, m_Price.ToString());
AddLabel(130, 70, 1645, " gold coins for " + m_Pet + " pets found in world");
AddButton(290, 175, 247, 248, 2, GumpButtonType.Reply, 0);
AddImageTiled(15, 14, 365, 1, 9107);
AddImageTiled(380, 14, 1, 190, 9105);
AddImageTiled(15, 205, 365, 1, 9107);
AddImageTiled(15, 14, 1, 190, 9105);
AddImageTiled(0, 0, 395, 1, 9157);
AddImageTiled(394, 0, 1, 217, 9155);
AddImageTiled(0, 216, 395, 1, 9157);
AddImageTiled(0, 0, 1, 217, 9155);
}
public override void OnResponse(NetState state, RelayInfo info)
{
Mobile from = state.Mobile;
m_cycle = 0;
from.CloseGump(typeof(GetPetGump));
if (info.ButtonID == 1 || info.ButtonID == 2)
{
if (m_Price > 0)
{
if (info.IsSwitched(1))
{
ArrayList pets = new ArrayList();
foreach (Mobile m in World.Mobiles.Values)
{
if (m is BaseCreature)
{
BaseCreature bc = (BaseCreature)m;
if ((bc.Controlled && bc.ControlMaster == from) || (bc.Summoned && bc.SummonMaster == from))
pets.Add(bc);
}
}
if (pets.Count > 0)
{
m_Price = 100 * pets.Count;////Price per Pet 3500
/* To use Gold Ledger remove this line
Item[] items = from.Backpack.FindItemsByType(typeof(GoldLedger));
foreach (GoldLedger tl in items)
{
if (tl.Owner == from.Serial && tl.Gold - m_Price >= 0)
{
tl.Gold = (tl.Gold - m_Price); //withdraw gold
//Delete();
from.SendMessage(1174, "{0} Gold to your Gold had been withdrawn from ledger.", m_Price); //send a message to the player gold was taken from ledger
m_cycle = 1;
for (int i = 0; i < pets.Count; ++i)
{
Mobile pet = (Mobile)pets[i];
if (pet is IMount)
((IMount)pet).Rider = null; // make sure it's dismounted
pet.MoveToWorld(from.Location, from.Map);
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052);
Effects.PlaySound(from.Location, from.Map, 0x201);
//return;
}
}
}
To use Gold Ledger remove this line */
if (m_cycle == 0)
{
if (Banker.Withdraw(from, m_Price))
{
from.SendLocalizedMessage(1060398, m_Price.ToString()); // Amount charged
from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // Amount left, from bank
for (int i = 0; i < pets.Count; ++i)
{
Mobile pet = (Mobile)pets[i];
if (pet is IMount)
((IMount)pet).Rider = null; // make sure it's dismounted
pet.MoveToWorld(from.Location, from.Map);
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 30, 5052);
Effects.PlaySound(from.Location, from.Map, 0x201);
}
}
else
from.SendMessage("Unfortunately, you do not have enough cash in the bank to get your pets... ya mad bro");
return;
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,159 @@
/* Scripted By
█▀▀▀ █▀▀ █▀▀█ █▀▀ █▀▀ ▀█ █▀ █▀▀█ █▀▀█
█▀▀▀ ▀▀█ █ █ █ █▀▀ █▄█ █▄▄█ █ █
█▄▄▄ ▀▀▀ █▀▀▀ ▀▀▀ ▀▀▀ ▀ ▀ ▀ ▀ ▀
*/
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Commands
{
public class LinkIt
{
public static int X1;
public static int Y1;
public static int Z1;
public static int X2;
public static int Y2;
public static int Z2;
public static Moongate moonGate1;
public static Moongate moonGate2;
public static Teleporter telePorter1;
public static Teleporter telePorter2;
public static void Initialize()
{
moonGate1 = null;
moonGate2 = null;
telePorter1 = null;
telePorter2 = null;
CommandSystem.Register("LinkIt", AccessLevel.Counselor, new CommandEventHandler(LinkIt_OnCommand));
}
[Usage("LinkIt")]
[Description("Links Gates and Teleporters.")]
public static void LinkIt_OnCommand( CommandEventArgs e )
{
e.Mobile.Target = new LinkItTarget1( e.Mobile );
}
private class LinkItTarget1 : Target
{
public LinkItTarget1( Mobile m)
: base( -1, true, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object o )
{
PlayerMobile player = (PlayerMobile)from;
if (o == null)
{
return;
}
else if ( !Generic.BaseCommand.IsAccessible( from, o ))
{
from.SendMessage(37, "That is not accessible." );
}
else if(o is Teleporter)
{
Teleporter tele1 = (Teleporter)o;
telePorter1 = tele1;
X1 = tele1.X;
Y1 = tele1.Y;
Z1 = tele1.Z;
player.SendMessage(1150, String.Format("Teleporter1 X:{0} Y:{1} Z:{2}", X1.ToString() ,Y1.ToString(), Z1.ToString() ) );
player.Target = new LinkItTarget2(player);
}
else if ( o is Moongate)
{
Moongate gate1 = (Moongate)o;
moonGate1 = gate1;
X1 = gate1.X;
Y1 = gate1.Y;
Z1 = gate1.Z;
player.SendMessage(1150, String.Format("Gate1 X:{0} Y:{1} Z:{2}", X1.ToString(), Y1.ToString(), Z1.ToString()));
player.Target = new LinkItTarget2(player);
}
else
from.SendMessage(37, "That is neither a Moongate or a Teleporter.");
}
}
private class LinkItTarget2 : Target
{
public LinkItTarget2( Mobile m)
: base(-1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object p)
{
PlayerMobile player = (PlayerMobile)from;
if ( p == null )
{
return;
}
else if (!Generic.BaseCommand.IsAccessible(from, p))
{
from.SendMessage(37, "That is not accessible.");
}
else if ( p is Teleporter && telePorter1 != null)
{
Teleporter tele2 = (Teleporter)p;
telePorter2 = tele2;
Z2 = tele2.Z;
X2 = tele2.X;
Y2 = tele2.Y;
player.SendMessage(1150, String.Format("Teleporter2 X:{0} Y:{1} Z:{2}", X2.ToString(), Y2.ToString(), Z2.ToString()));
ApplyLink(player, telePorter1, telePorter2);
}
else if ( p is Moongate && moonGate1 != null )
{
Moongate gate2 = (Moongate)p;
moonGate2 = gate2;
Z2 = gate2.Z;
X2 = gate2.X;
Y2 = gate2.Y;
player.SendMessage(1150, String.Format("Gate2 X:{0} Y:{1} Z:{2}", X2.ToString(), Y2.ToString(), Z2.ToString()));
ApplyLink(player, moonGate1, moonGate2);
}
else
player.SendMessage(37,"Something went wrong!");
}
}
public static void ApplyLink( Mobile from, Item a, Item b )
{
PlayerMobile player = (PlayerMobile)from;
if ( moonGate1 != null && moonGate2 != null )
{
moonGate1.Target = moonGate2.Location;
moonGate1.TargetMap = moonGate2.Map;
moonGate1.Dispellable = false;
moonGate2.Target = moonGate1.Location;
moonGate2.TargetMap = moonGate1.Map;
moonGate2.Dispellable = false;
player.SendMessage(72,"The Moongate Link was Successful");
moonGate1 = null;
moonGate2 = null;
telePorter1 = null;
telePorter2 = null;
}
else if ( telePorter1 != null && telePorter2 != null )
{
telePorter1.PointDest = telePorter2.Location;
telePorter1.MapDest = telePorter2.Map;
telePorter2.PointDest = telePorter1.Location;
telePorter2.MapDest = telePorter1.Map;
player.SendMessage(72,"The Teleporter Link was Successful");
telePorter1 = null;
telePorter2 = null;
moonGate1 = null;
moonGate2 = null;
}
else
player.SendMessage(37, "Something went wrong!");
}
}
}

View File

@@ -0,0 +1,82 @@
/*
# Login/Logout/New Player Broadcast
# * Author: mordero
# * Email: mordero@gmail.com
# * Description: Will broadcast to current online players when someone has logged in/out. If the person who has logged in/out is above the player access level, it only broadcasts to the staff.
# * Description of Edit: When a new character is created, a message with their name, will be broadcasted to current online players.
# * Additional Info: You may edit the New Player Message to your liking. Remember that the {0} denotes the player's name.
# * Installation: Just drag into your custom scripts folder.
# * Additional edits made by Orbit Storm to include a New Player Login Broadcast (and cleanup of wording for easier understanding).
# * All credit goes to mordero for developing this script and releasing it on RunUO. Please leave this header intact if you redistribute!
*/
using System;
using System.Text;
using Server;
using Server.Commands;
namespace mordero.Custom
{
class Broadcast
{
//{0} is the name of the player
private readonly static string m_staffLoginMessage = "Staff Member {0} has Logged In.";
private readonly static string m_staffLogoutMessage = "Staff Member {0} has Logged Out.";
private readonly static int m_staffLoginHue = 0x482;//Login Message Hue
private readonly static int m_staffLogoutHue = 0x482;//Logout Message Hue
private readonly static string m_LoginMessage = "{0} has Logged In.";//Login Message
private readonly static string m_LogoutMessage = "{0} has Logged Out.";//Logout Message
private readonly static int m_LoginHue = 0x482;//Login Message Hue
private readonly static int m_LogoutHue = 0x482;//Logout Message Hue
private readonly static string m_NewPlayerMessage = "{0}, Welcome to LumyrUO!"; //New Player Message
private readonly static int m_NewPlayerHue = 33; //New Player Message Hue
//maximum access level to announce
private static AccessLevel m_AnnounceLevel = AccessLevel.Player;
private static AccessLevel m_AnnounceStaffLevel = AccessLevel.GameMaster;
public static void Initialize()
{
EventSink.Login += new LoginEventHandler(EventSink_Login);
EventSink.Logout += new LogoutEventHandler(EventSink_Logout);
EventSink.CharacterCreated += new CharacterCreatedEventHandler(EventSink_CharacterCreated);
}
public static void EventSink_Logout( LogoutEventArgs e )
{
if ( e.Mobile.Player )
{
if ( e.Mobile.AccessLevel == m_AnnounceLevel )
CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LogoutHue, String.Format(m_LogoutMessage, e.Mobile.Name));
else// if( e.Mobile.AccessLevel <= m_AnnounceLevel )
{
CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LogoutHue, String.Format(m_staffLogoutMessage, e.Mobile.Name));
}
//else
//broadcast any other level to the staff
//CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LogoutHue, String.Format(m_staffLoginMessage, e.Mobile.Name));
}
}
public static void EventSink_Login( LoginEventArgs e )
{
if ( e.Mobile.Player )
{
if ( e.Mobile.AccessLevel <= m_AnnounceLevel )
CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LoginHue, String.Format(m_LoginMessage, e.Mobile.Name));
else //broadcast any other level to the staff
CommandHandlers.BroadcastMessage(AccessLevel.Player, m_LoginHue, String.Format(m_staffLoginMessage, e.Mobile.Name));
}
}
public static void EventSink_CharacterCreated( CharacterCreatedEventArgs e )
{
if ( e.Mobile != null )
{
if ( e.Mobile.AccessLevel == AccessLevel.Player )
{
CommandHandlers.BroadcastMessage(AccessLevel.Player, m_NewPlayerHue, String.Format(m_NewPlayerMessage, e.Mobile.Name));
}
}
}
}
}

View File

@@ -0,0 +1,92 @@
using Server.Commands;
using System;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using Server.Items;
namespace Server.Commands
{
public class LinkMoongateCommand
{
public static int hue;
public static void Initialize()
{
CommandSystem.Register("moongatelink", AccessLevel.GameMaster, new CommandEventHandler(LinkMoongate_OnCommand));
}
[Usage("moongatelink <hue>")]
[Description("Creates 2 moongates simultaneously and links them.")]
private static void LinkMoongate_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
hue = e.GetInt32(0);
from.SendMessage("Target a location for 1st Moongate:");
from.Target = new FirstTarget();
}
private class FirstTarget : Target
{
public FirstTarget() : base(-1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object target)
{
IPoint3D p = target as IPoint3D;
if (p == null)
return;
Point3D mg_Loc1 = new Point3D(p);
Map mg_Map1 = from.Map;
from.SendMessage("Target a location for 2nd Moongate:");
from.Target = new SecondTarget(mg_Loc1, mg_Map1);
}
}
private class SecondTarget : Target
{
private Point3D mg_Loc1;
private Map mg_Map1;
public SecondTarget(Point3D loc, Map map) : base(-1, true, TargetFlags.None)
{
mg_Loc1 = loc;
mg_Map1 = map;
}
protected override void OnTarget(Mobile from, object target)
{
IPoint3D p = target as IPoint3D;
if (p == null)
return;
Point3D mg_Loc2 = new Point3D(p);
Map mg_Map2 = from.Map;
Item mg1 = new Moongate(mg_Loc2, mg_Map2);
Item mg2 = new Moongate(mg_Loc1, mg_Map1);
if (hue == null){
mg1.Hue = 0;
mg2.Hue = 0;
}
else{
mg1.Hue = hue;
mg2.Hue = hue;
}
mg1.MoveToWorld(mg_Loc1, mg_Map1);
mg2.MoveToWorld(mg_Loc2, mg_Map2);
}
}
}
}

View File

@@ -0,0 +1,332 @@
//MyHouses System
//A re-write of the "viewhouses" command, but for players.
//Re-write by DxMonkey - AKA - Tresdni
//www.ultimaeclipse.com
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Multis;
using Server.Targeting;
using Server.Accounting;
using Server.Commands;
using Server.Spells;
namespace Server.Gumps
{
public class MyHousesGump : Gump
{
public static void Initialize()
{
CommandSystem.Register( "MyHouses", AccessLevel.Player, new CommandEventHandler( ViewHouses_OnCommand ) );
}
[Usage( "MyHouses" )]
[Description( "Displays a menu listing all houses of the. The menu also contains specific house details, and options to: go to house, and demolish house." )]
public static void ViewHouses_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new MyHousesGump( e.Mobile, GetMyHouses( e.Mobile ), null ) );
}
private class MyHouseComparer : IComparer<BaseHouse>
{
public static readonly IComparer<BaseHouse> Instance = new MyHouseComparer();
public int Compare( BaseHouse x, BaseHouse y )
{
return x.BuiltOn.CompareTo( y.BuiltOn );
}
}
public static List<BaseHouse> GetMyHouses( Mobile owner )
{
List<BaseHouse> list = new List<BaseHouse>();
Account acct = owner.Account as Account;
if ( acct == null )
{
list.AddRange( BaseHouse.GetHouses( owner ) );
}
else
{
for ( int i = 0; i < acct.Length; ++i )
{
Mobile mob = acct[i];
if ( mob != null )
list.AddRange( BaseHouse.GetHouses( mob ) );
}
}
list.Sort( MyHouseComparer.Instance );
return list;
}
private Mobile m_From;
private List<BaseHouse> m_List;
private BaseHouse m_Selection;
public MyHousesGump( Mobile from, List<BaseHouse> list, BaseHouse sel ) : base( 50, 40 )
{
m_From = from;
m_List = list;
m_Selection = sel;
from.CloseGump( typeof( MyHousesGump ) );
AddPage( 0 );
AddBackground( 0, 0, 240, 360, 5054 );
AddBlackAlpha( 10, 10, 220, 340 );
if ( sel == null || sel.Deleted )
{
m_Selection = null;
AddHtml( 35, 15, 120, 20, Color( "My House Types", White ), false, false );
if ( list.Count == 0 )
AddHtml( 35, 40, 160, 40, Color( "You have no houses in the world.", White ), false, false );
AddImage( 190, 17, 0x25EA );
AddImage( 207, 17, 0x25E6 );
int page = 0;
for ( int i = 0; i < list.Count; ++i )
{
if ( (i % 15) == 0 )
{
if ( page > 0 )
AddButton( 207, 17, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page+1 );
AddPage( ++page );
if ( page > 1 )
AddButton( 190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page-1 );
}
object name = FindMyHouseName( list[i] );
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false );
if ( name is int )
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, (int)name, White16, false, false );
else if ( name is string )
AddHtml( 35, 40 + ((i % 15) * 20), 160, 20, Color( (string)name, White ), false, false );
AddButton( 198, 39 + ((i % 15) * 20), 4005, 4007, i+1, GumpButtonType.Reply, 0 );
}
}
else
{
string houseName, owner, location;
Map map = sel.Map;
houseName = (sel.Sign == null) ? "An Unnamed House" : sel.Sign.GetName();
owner = (sel.Owner == null) ? "nobody" : sel.Owner.Name;
int xLong = 0, yLat = 0, xMins = 0, yMins = 0;
bool xEast = false, ySouth = false;
bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );
if ( valid )
location = String.Format( "{0}<7D> {1}'{2}, {3}<7D> {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
else
location = "unknown";
AddHtml( 10, 15, 220, 20, Color( Center( "My House Properties" ), White ), false, false );
AddHtml( 15, 40, 210, 20, Color( "Facet:", White ), false, false );
AddHtml( 15, 40, 210, 20, Color( Right( map == null ? "(null)" : map.Name ), White ), false, false );
AddHtml( 15, 60, 210, 20, Color( "Location:", White ), false, false );
AddHtml( 15, 60, 210, 20, Color( Right( sel.Location.ToString() ), White ), false, false );
AddHtml( 15, 80, 210, 20, Color( "Sextant:", White ), false, false );
AddHtml( 15, 80, 210, 20, Color( Right( location ), White ), false, false );
AddHtml( 15, 100, 210, 20, Color( "Owner:", White ), false, false );
AddHtml( 15, 100, 210, 20, Color( Right( owner ), White ), false, false );
AddHtml( 15, 120, 210, 20, Color( "Name:", White ), false, false );
AddHtml( 15, 120, 210, 20, Color( Right( houseName ), White ), false, false );
AddHtml( 15, 140, 210, 20, Color( "Friends:", White ), false, false );
AddHtml( 15, 140, 210, 20, Color( Right( sel.Friends.Count.ToString() ), White ), false, false );
AddHtml( 15, 160, 210, 20, Color( "Co-Owners:", White ), false, false );
AddHtml( 15, 160, 210, 20, Color( Right( sel.CoOwners.Count.ToString() ), White ), false, false );
AddHtml( 15, 180, 210, 20, Color( "Bans:", White ), false, false );
AddHtml( 15, 180, 210, 20, Color( Right( sel.Bans.Count.ToString() ), White ), false, false );
AddHtml( 15, 200, 210, 20, Color( "Decays:", White ), false, false );
AddHtml( 15, 200, 210, 20, Color( Right( sel.CanDecay ? "Yes" : "No" ), White ), false, false );
AddHtml( 15, 220, 210, 20, Color( "Decay Level:", White ), false, false );
AddHtml( 15, 220, 210, 20, Color( Right( sel.DecayLevel.ToString() ), White ), false, false );
AddButton( 15, 245, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtml( 50, 245, 120, 20, Color( "Go to this house", White ), false, false );
//AddButton( 15, 265, 4005, 4007, 2, GumpButtonType.Reply, 0 );
//AddHtml( 50, 265, 120, 20, Color( "Open house menu", White ), false, false );
AddButton( 15, 285, 4005, 4007, 3, GumpButtonType.Reply, 0 );
AddHtml( 50, 285, 120, 20, Color( "Demolish house", White ), false, false );
AddButton( 15, 305, 4005, 4007, 4, GumpButtonType.Reply, 0 );
AddHtml( 50, 305, 120, 20, Color( "Refresh house", White ), false, false );
}
}
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
{
if ( m_Selection == null )
{
int v = info.ButtonID - 1;
if ( v >= 0 && v < m_List.Count )
m_From.SendGump( new MyHousesGump( m_From, m_List, m_List[v] ) );
}
else if ( !m_Selection.Deleted )
{
switch ( info.ButtonID )
{
case 0:
{
m_From.SendGump( new MyHousesGump( m_From, m_List, null ) );
break;
}
case 1:
{
Map map = m_Selection.Map;
if ( m_From.Region is Regions.Jail )
{
m_From.SendMessage ("You cannot escape jail so easily foolish one.");
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
return;
}
if ( Server.Spells.SpellHelper.CheckCombat( m_From ) || m_From.Combatant != null )
{
m_From.SendMessage ("Wouldst thou flee during the heat of battle?");
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
return;
}
if ( Server.Factions.Sigil.ExistsOn( m_From ) )
{
m_From.SendMessage ("You cannot use this function while carrying a sigil.");
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
return;
}
if ( m_From.Criminal )
{
m_From.SendMessage ("A criminal may not escape so easily.");
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
return;
}
m_From.MoveToWorld( m_Selection.BanLocation, map );
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
break;
}
case 2:
{
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
HouseSign sign = m_Selection.Sign;
if ( sign != null && !sign.Deleted )
sign.OnDoubleClick( m_From );
break;
}
case 3:
{
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
m_From.SendGump( new HouseDemolishGump( m_From, m_Selection ) );
break;
}
case 4:
{
m_Selection.RefreshDecay();
m_From.SendGump( new MyHousesGump( m_From, m_List, m_Selection ) );
break;
}
}
}
}
public object FindMyHouseName( BaseHouse house )
{
int multiID = house.ItemID & 0x3FFF;
HousePlacementEntry[] entries;
entries = HousePlacementEntry.ClassicHouses;
for ( int i = 0; i < entries.Length; ++i )
{
if ( entries[i].MultiID == multiID )
return entries[i].Description;
}
entries = HousePlacementEntry.TwoStoryFoundations;
for ( int i = 0; i < entries.Length; ++i )
{
if ( entries[i].MultiID == multiID )
return entries[i].Description;
}
entries = HousePlacementEntry.ThreeStoryFoundations;
for ( int i = 0; i < entries.Length; ++i )
{
if ( entries[i].MultiID == multiID )
return entries[i].Description;
}
return house.GetType().Name;
}
private const int White16 = 0x7FFF;
private const int White = 0xFFFFFF;
public string Right( string text )
{
return String.Format( "<div align=right>{0}</div>", text );
}
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
}
public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
public void AddBlackAlpha( int x, int y, int width, int height )
{
AddImageTiled( x, y, width, height, 2624 );
AddAlphaRegion( x, y, width, height );
}
}
}

View File

@@ -0,0 +1,51 @@
// Party Message Command v1.1.0
// Author: Felladrin
// Started: 2015-12-19
// Updated: 2016-01-22
using System.Collections.Generic;
using Server;
using Server.Commands;
using Server.Engines.PartySystem;
namespace Felladrin.Commands
{
public static class PartyMessage
{
public static void Initialize()
{
CommandSystem.Register("P", AccessLevel.Player, new CommandEventHandler(OnCommand));
}
[Usage("P <message>")]
[Description("Sends a message to your party. If no message is set, lists the party members names.")]
static void OnCommand(CommandEventArgs e)
{
var from = e.Mobile;
var message = e.ArgString;
var party = Party.Get(from);
if (from.Party == null)
{
from.SendLocalizedMessage(3000211); // You are not in a party.
return;
}
if (message.Length > 0)
{
party.SendPublicMessage(from, message);
return;
}
var leader = (from == party.Leader) ? "You are" : party.Leader.Name + " is";
var fellows = new List<string>();
foreach (PartyMemberInfo pmi in party.Members)
if (from != pmi.Mobile)
fellows.Add(pmi.Mobile.Name);
from.SendMessage("Your have {0} fellow{1} in your party: {2}. {3} the leader.", fellows.Count, (fellows.Count > 1 ? "s" : ""), string.Join(", ", fellows), leader);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
#region Fraz
/*
made by Fraz 3.29.2016
*/
#endregion
using System;
using Server.Commands;
using Server.Network;
namespace Server.Gumps
{
public class SeasonChange : Gump
{
private Map _map;
public static void Initialize()
{
CommandSystem.Register("SeasonChange", AccessLevel.Decorator, new CommandEventHandler(SeasonChange_OnCommand));
CommandSystem.Register("SC", AccessLevel.Decorator, new CommandEventHandler(SeasonChange_OnCommand));
}
[Usage("SeasonChange")]
[Aliases("SC")]
[Description("Brings up the Season Change Menu")]
private static void SeasonChange_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
from.CloseGump(typeof(SeasonChange));
from.SendGump(new SeasonChange(from, from.Map));
}
static string Center(string text)
{
return String.Format("<CENTER>{0}</CENTER>", text);
}
static string Color(string text, int color)
{
return String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text);
}
static string Label(string text, string value)
{
return String.Format("{0}: {1}", text, value);
}
void AddButtonLabeled(int x, int y, int buttonID, string text)
{
AddButton(x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0);
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF), false, false);
}
void AddTextField(int x, int y, int width, int height, int index)
{
AddBackground(x - 2, y - 2, width + 4, height + 4, 0x2486);
AddTextEntry(x + 2, y + 2, width - 4, height - 4, 0, index, "");
}
public SeasonChange(Mobile from, Map map) : base(0, 0)
{
NetState ns = from.NetState;
if (ns == null) return;
_map = map;
this.Closable = true;
this.Disposable = true;
this.Dragable = true;
this.Resizable = false;
AddPage(0);
AddBackground(5, 115, 230, 200, 9270);
AddAlphaRegion(15, 125, 210, 180);
AddHtml(7, 128, 230, 375, Color(Center("SEASON CHANGE ASSISTANT"), 0x00FF00), false, false);
AddLabel(85, 147, 2727, Label("Map", _map.Name));
AddLabel(25, 172, 2727, @"Select Map");
AddTextField(105, 173, 110, 20, 0);
AddButton(185, 197, 4005, 4007, 0xFF, GumpButtonType.Reply, 0);
AddButtonLabeled(25, 200, 1, "Spring");
AddButtonLabeled(25, 220, 2, "Summer");
AddButtonLabeled(25, 240, 3, "Fall");
AddButtonLabeled(25, 260, 4, "Winter");
AddButtonLabeled(25, 280, 5, "Desolation");
AddImage(192, 271, 0x71, 2424);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
if (from == null) return;
if (info.ButtonID < 1) return;
var mapNameEntry = info.GetTextEntry(0);
string MapNameEntry = null;
if (mapNameEntry != null)
MapNameEntry = mapNameEntry.Text.Trim();
if (info.ButtonID == 0xFF)
{
for (int j = 0; j < Map.AllMaps.Count; ++j)
{
if (MapNameEntry != null && Map.AllMaps[j].Name == MapNameEntry)
{
if (Map.AllMaps[j] != null && Map.AllMaps[j] != Map.Internal)
{
from.CloseGump(typeof(SeasonChange));
from.SendGump(new SeasonChange(from, Map.AllMaps[j]));
return;
}
}
}
from.SendMessage("No map was found with the name you selected.");
from.CloseGump(typeof(SeasonChange));
from.SendGump(new SeasonChange(from, _map));
return;
}
_map.Season = info.ButtonID - 1;
for (int i = 0; i < NetState.Instances.Count; ++i)
{
NetState ns = NetState.Instances[i];
if (ns == null) continue;
Mobile m = ns.Mobile;
if (m != null && m.Map == _map)
{
ns.Sequence = 0;
ns.Send(Network.SeasonChange.Instantiate(m.GetSeason(), true));
if (ns.StygianAbyss)
{
ns.Send(new MobileUpdate(m));
}
else
{
ns.Send(new MobileUpdateOld(m));
}
}
}
from.CloseGump(typeof(SeasonChange));
from.SendGump(new SeasonChange(from, _map));
}
}
}

View File

@@ -0,0 +1,312 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Network;
namespace Joeku.SR
{
public class SR_Gump : Gump
{
public SR_RuneAccount RuneAcc { get; set; }
public SR_Gump(Mobile m, SR_RuneAccount runeAcc)
: base(0, 27)
{
RuneAcc = runeAcc;
int count = 0;
if (RuneAcc.ChildRune == null)
count = RuneAcc.Count;
else
count = RuneAcc.ChildRune.Count;
int RunebooksH = 0,
RunebooksW = 0;
int tier = -1;
if (RuneAcc.ChildRune != null)
tier = RuneAcc.ChildRune.Tier;
if (tier > -1)
{
if (tier == 0)
{
RunebooksH = 42;
RunebooksW = 278;
}
else
{
RunebooksH = 37 + 42;
RunebooksW = 278 + (tier * 5);
}
}
int RunesH = 10 * 2;
if (count > 10)
count = 10;
if (count > 0)
RunesH += (count * 22);
if (count > 1)
RunesH += ((count - 1) * 5);
DisplayHeader();
int labelHue = m != null && m.NetState != null && m.NetState.IsEnhancedClient ? 2101 : 2100;
if (tier > -1)
DisplayRunebooks(42, RunebooksH, RunebooksW, tier, labelHue);
DisplayAddNew(42 + RunebooksH + RunesH, labelHue);
DisplayRunes(42 + RunebooksH, RunesH, labelHue);
}
public static void Send(Mobile mob, SR_RuneAccount runeAcc)
{
mob.CloseGump(typeof(SR_Gump));
mob.SendGump(new SR_Gump(mob, runeAcc));
}
public void DisplayHeader()
{
AddPage(0);
AddBackground(0, 0, 210, 42, 9270);
AddImageTiled(10, 10, 190, 22, 2624);
AddAlphaRegion(10, 10, 190, 22);
AddHtml(0, 11, 210, 20, "<CENTER><BASEFONT COLOR=#FFFFFF><BIG>Joeku's Staff Runebook</CENTER>", false, false);
}
public void DisplayRunebooks(int y, int h, int w, int tiers, int labelHue)
{
AddBackground(0, y, w, h, 9270);
AddImageTiled(10, y + 10, w - 20, h - 20, 2624);
AddAlphaRegion(10, y + 10, w - 20, h - 20);
for (int i = tiers, j = 1; i > 0; i--, j++)
{
AddBackground(j * 5, y + 37, ((i - 1) * 5) + 278, 42, 9270);
if (i == 1)
{
AddImageTiled((j * 5) + 10, y + 47, ((i - 1) * 5) + 258, 22, 2624);
AddAlphaRegion((j * 5) + 10, y + 47, ((i - 1) * 5) + 258, 22);
}
}
SR_Rune rune = RuneAcc.Runes[RuneAcc.PageIndex];
AddItem(SR_Utilities.ItemOffsetX(rune), y + SR_Utilities.ItemOffsetY(rune) + 12, SR_Utilities.RunebookID, SR_Utilities.ItemHue(rune));
AddLabelCropped(35, y + 12, w - 108, 20, labelHue, rune.Name);
AddButton(w - 70, y + 10, 4014, 4016, 5, GumpButtonType.Reply, 0);
AddButton(w - 40, y + 10, 4017, 4019, 4, GumpButtonType.Reply, 0);
if (tiers > 0)
{
rune = RuneAcc.ChildRune;
AddItem(SR_Utilities.ItemOffsetX(rune) + tiers * 5, y + SR_Utilities.ItemOffsetY(rune) + 12 + 37, SR_Utilities.RunebookID, SR_Utilities.ItemHue(rune));
AddLabelCropped(35 + tiers * 5, y + 12 + 37, 170, 20, labelHue, rune.Name);
AddButton(w - 70, y + 10 + 37, 4014, 4016, 7, GumpButtonType.Reply, 0);
AddButton(w - 40, y + 10 + 37, 4017, 4019, 6, GumpButtonType.Reply, 0);
}
// AddButton(238, 30 + bgY + 10, 4011, 4013, 0, GumpButtonType.Reply, 0);
}
public void DisplayAddNew(int y, int labelHue)
{
AddBackground(0, y, 278, 42, 9270);
AddImageTiled(10, y + 10, 258, 22, 2624);
AddAlphaRegion(10, y + 10, 258, 22);
AddLabel(15, y + 10, labelHue, @"New Rune");
AddButton(80, y + 10, 4011, 4013, 1, GumpButtonType.Reply, 0);
AddButton(110, y + 10, 4029, 4031, 2, GumpButtonType.Reply, 0);
AddLabel(150, y + 10, labelHue, @"New Runebook");
AddButton(238, y + 10, 4011, 4013, 3, GumpButtonType.Reply, 0);
}
public void DisplayRunes(int y, int h, int labelHue)
{
AddBackground(0, y, 430/*400*/, h, 9270);
AddImageTiled(10, y + 10, 410, h - 20, 2624);
AddAlphaRegion(10, y + 10, 410, h - 20);
List<SR_Rune> runes = null;
int count, runebooks;
if (RuneAcc.ChildRune == null)
{
runes = RuneAcc.Runes;
count = RuneAcc.Count;
runebooks = RuneAcc.RunebookCount;
}
else
{
runes = RuneAcc.ChildRune.Runes;
count = RuneAcc.ChildRune.Count;
runebooks = RuneAcc.ChildRune.RunebookCount;
}
AddPage(1);
int pages = (int)Math.Ceiling((double)count / 9.0), temp = 0;
for (int i = 0, loc = 0, page = 1; i < count; i++, loc++)
{
temp = 10 + y + (22 + 5) * loc;
AddItem(SR_Utilities.ItemOffsetX(runes[i]), 2 + SR_Utilities.ItemOffsetY(runes[i]) + temp, runes[i].IsRunebook ? SR_Utilities.RunebookID : SR_Utilities.RuneID, SR_Utilities.ItemHue(runes[i]));
if (runes[i].IsRunebook)
AddLabelCropped(35, 2 + temp, 175, 20, labelHue, String.Format("{0}. {1}", i + 1, runes[i].Name));
else
{
AddLabelCropped(35, 2 + temp, 175, 20, labelHue, String.Format("{0}. {1} ({2})", i + 1 - runebooks, runes[i].Name, runes[i].TargetMap.ToString()));
AddLabelCropped(215, 2 + temp, 110, 20, labelHue, runes[i].TargetLoc.ToString());
AddButton(360, temp, 4008, 4010, i + 30010, GumpButtonType.Reply, 0);
}
AddButton(330 + (runes[i].IsRunebook ? 30 : 0), temp, 4005, 4007, i + 10, GumpButtonType.Reply, 0);
//AddButton(340, 40 + ((22+5)*i), 4026, 4028, 0, GumpButtonType.Reply, 0);
//AddImage(340, 40 + ((22+5)*i), 4026, 1000);
AddButton(390, temp, 4017, 4019, i + 60010, GumpButtonType.Reply, 0); // delete
if (pages > 1 && ((loc == 8 && i < count - 1) || i == count - 1))
{
temp = 10 + y + (22 + 5) * 9;
// (430(bg) - 20 (buffer) - 70 (txt/buffer) - 60(buttons)) / 2 = 140
if (page > 1)
AddButton(140, temp, 4014, 4016, 0, GumpButtonType.Page, page - 1);
else
AddImage(140, temp, 4014, 1000);
AddHtml(170, 2 + temp, 90, 20, String.Format("<BASEFONT COLOR=#FFFFFF><CENTER>Page {0}/{1}", page, pages), false, false);
if (page < pages)
AddButton(260, temp, 4005, 4007, 0, GumpButtonType.Page, page + 1);
else
AddImage(260, temp, 4005, 1000);
page++;
AddPage(page);
loc = -1;
}
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
int button = info.ButtonID;
Mobile mob = sender.Mobile;
switch( button )
{
case 0:
break;
case 1:
mob.SendMessage("Enter a description:");
mob.Prompt = new SR_NewRunePrompt(RuneAcc, mob.Location, mob.Map);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 2:
mob.SendMessage("Target a location to mark:");
mob.Target = new SR_NewRuneTarget(RuneAcc);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 3:
mob.SendMessage("Enter a description:");
mob.Prompt = new SR_NewRunePrompt(RuneAcc);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 4:
RuneAcc.RemoveRune(RuneAcc.PageIndex, true);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 5:
RuneAcc.ResetPageIndex();
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 6:
RuneAcc.ChildRune.ParentRune.RemoveRune(RuneAcc.ChildRune.ParentRune.PageIndex, true);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
case 7:
RuneAcc.ChildRune.ParentRune.ResetPageIndex();
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
default:
bool moongate = false;
button -= 10;
if (button >= 60000)
{
if (RuneAcc.ChildRune == null)
RuneAcc.RemoveRune(button - 60000);
else
RuneAcc.ChildRune.RemoveRune(button - 60000);
Send(mob, SR_Utilities.FetchInfo(mob.Account));
break;
}
if (button >= 30000)
{
button -= 30000;
moongate = true;
}
SR_Rune rune = null;
if (RuneAcc.ChildRune == null && button >= 0 && button < RuneAcc.Runes.Count)
rune = RuneAcc.Runes[button];
else if (button >= 0 && button < RuneAcc.ChildRune.Runes.Count)
rune = RuneAcc.ChildRune.Runes[button];
if (rune.IsRunebook)
{
if (RuneAcc.ChildRune == null)
RuneAcc.PageIndex = button;
else
RuneAcc.ChildRune.PageIndex = button;
Send(mob, SR_Utilities.FetchInfo(mob.Account));
}
else
{
if (mob.Location == rune.TargetLoc && mob.Map == rune.TargetMap)
mob.SendMessage("You are already there.");
else if (!moongate)
{
mob.PlaySound(0x1FC);
mob.MoveToWorld(rune.TargetLoc, rune.TargetMap);
mob.PlaySound(0x1FC);
}
else
{
if (SR_Utilities.FindItem(typeof(Moongate), mob.Location, mob.Map))
mob.SendMessage("You are standing on top of a moongate, please move.");
else if (SR_Utilities.FindItem(typeof(Moongate), rune.TargetLoc, rune.TargetMap))
mob.SendMessage("There is already a moongate there, sorry.");
else
{
mob.SendLocalizedMessage(501024); // You open a magical gate to another location
Effects.PlaySound(mob.Location, mob.Map, 0x20E);
SR_RuneGate firstGate = new SR_RuneGate(rune.TargetLoc, rune.TargetMap);
firstGate.MoveToWorld(mob.Location, mob.Map);
Effects.PlaySound(rune.TargetLoc, rune.TargetMap, 0x20E);
SR_RuneGate secondGate = new SR_RuneGate(mob.Location, mob.Map);
secondGate.MoveToWorld(rune.TargetLoc, rune.TargetMap);
}
}
}
break;
}
}
}
}

View File

@@ -0,0 +1,121 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.IO;
using System.Xml;
using Server;
namespace Joeku.SR
{
public class SR_Load
{
public static void ReadData(string filePath)
{
if (!File.Exists(filePath))
return;
Console.WriteLine();
Console.WriteLine("Joeku's Staff Runebook: Loading...");
XmlDocument doc = new XmlDocument();
doc.Load(filePath);
XmlElement root = doc["StaffRunebook"];
int version = Utility.ToInt32(root.GetAttribute("Version"));
if (root.HasChildNodes)
{
foreach (XmlElement a in root.GetElementsByTagName("RuneAccount"))
{
try
{
ReadAccountNode(a);
}
catch
{
Console.WriteLine(" Warning: Staff Runebook load failed.");
}
}
}
Console.WriteLine();
}
public static void ReadAccountNode(XmlElement parent)
{
Console.Write(" Account: {0}... ", parent.GetAttribute("Username"));
try
{
SR_RuneAccount acc = new SR_RuneAccount(parent.GetAttribute("Username"));
if (parent.HasChildNodes)
{
XmlElement child = parent.FirstChild as XmlElement;
acc.AddRune(ReadRuneNode(child));
while (child.NextSibling != null)
{
child = child.NextSibling as XmlElement;
acc.AddRune(ReadRuneNode(child));
}
/*foreach( XmlElement child in parent.GetElementsByTagName("Runebook") )
if( child != null )
acc.AddRune(ReadRunebookNode(child));
foreach( XmlElement child in parent.GetElementsByTagName("Rune") )
if( child != null )
acc.AddRune(ReadRuneNode(child));*/
}
}
catch
{
Console.WriteLine("failed.");
}
Console.WriteLine("done.");
}
public static SR_Rune ReadRuneNode(XmlElement parent)
{
if (parent.LocalName == "Runebook")
{
SR_Rune runebook = new SR_Rune(parent.GetAttribute("Name"), true);
if (parent.HasChildNodes)
{
XmlElement child = parent.FirstChild as XmlElement;
runebook.AddRune(ReadRuneNode(child));
while (child.NextSibling != null)
{
child = child.NextSibling as XmlElement;
runebook.AddRune(ReadRuneNode(child));
}
}
return runebook;
}
//else if( parent.LocalName == "Rune" )
return new SR_Rune(parent.GetAttribute("Name"), Map.Parse(parent.GetAttribute("TargetMap")), new Point3D(Utility.ToInt32(parent.GetAttribute("X")),Utility.ToInt32(parent.GetAttribute("Y")),Utility.ToInt32(parent.GetAttribute("Z"))));
}
/*public static SR_Rune ReadRunebookNode( XmlElement parent )
{
SR_Rune rune = new SR_Rune(parent.GetAttribute("Name"), true);
if( parent.HasChildNodes )
{
foreach( XmlElement child in parent.GetElementsByTagName("Runebook") )
if( child != null )
rune.AddRune(ReadRunebookNode(child));
foreach( XmlElement child in parent.GetElementsByTagName("Rune") )
if( child != null )
rune.AddRune(ReadRuneNode(child));
}
return rune;
}
public static SR_Rune ReadRuneNode( XmlElement rune )
{
return new SR_Rune(rune.GetAttribute("Name"), Map.Parse(rune.GetAttribute("TargetMap")), new Point3D(Utility.ToInt32(rune.GetAttribute("X")),Utility.ToInt32(rune.GetAttribute("Y")),Utility.ToInt32(rune.GetAttribute("Z"))) );
}*/
}
}

View File

@@ -0,0 +1,80 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.Collections.Generic;
using System.IO;
using Server;
using Server.Commands;
namespace Joeku.SR
{
public class SR_Main
{
public static int Version = 110;
public static string ReleaseDate = "February 4, 2009";
public static string SavePath = "Saves/Staff Runebook";// "ROOT\..."
public static string FileName = "Rune Accounts.xml";
public static List<SR_RuneAccount> Info = new List<SR_RuneAccount>();
public static int Count
{
get
{
return Info.Count;
}
}
// public SR_Main(){}
[CallPriority(100)]
public static void Initialize()
{
if (Info.Count == 0)
SR_Load.ReadData(Path.Combine(SavePath, FileName));
CommandHandlers.Register("StaffRunebook", AccessLevel.Counselor, new CommandEventHandler(SR_OnCommand));
CommandHandlers.Register("SR", AccessLevel.Counselor, new CommandEventHandler(SR_OnCommand));
CommandHandlers.Register("StaffRunebookReset", AccessLevel.Counselor, new CommandEventHandler(SR_Reset_OnCommand));
EventSink.WorldSave += new WorldSaveEventHandler(EventSink_WorldSave);
}
[Usage("StaffRunebook")]
[Aliases("SR")]
public static void SR_OnCommand(CommandEventArgs e)
{
Mobile mob = e.Mobile;
SR_Gump.Send(mob, SR_Utilities.FetchInfo(mob.Account));
}
[Usage("StaffRunebookReset")]
public static void SR_Reset_OnCommand(CommandEventArgs e)
{
Mobile mob = e.Mobile;
SR_Utilities.NewRuneAcc(SR_Utilities.FetchInfo(mob.Account));
mob.SendMessage("Your staff runebook has been reset to default.");
}
public static void AddInfo(SR_RuneAccount runeAccount)
{
for (int i = 0; i < Info.Count; i++)
if (Info[i].Username == runeAccount.Username)
Info.RemoveAt(i);
Info.Add(runeAccount);
}
private static void EventSink_WorldSave(WorldSaveEventArgs e)
{
// Args: bool e.Message
SR_Save.WriteData();
}
}
}

View File

@@ -0,0 +1,60 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using Server;
using Server.Prompts;
namespace Joeku.SR
{
public class SR_NewRunePrompt : Prompt
{
public SR_RuneAccount RuneAcc;
public bool IsRunebook;
public Point3D TargetLoc;
public Map TargetMap;
public SR_NewRunePrompt(SR_RuneAccount runeAcc)
{
this.RuneAcc = runeAcc;
this.IsRunebook = true;
}
public SR_NewRunePrompt(SR_RuneAccount runeAcc, Point3D targetLoc, Map targetMap)
{
this.RuneAcc = runeAcc;
this.TargetLoc = targetLoc;
this.TargetMap = targetMap;
}
public override void OnResponse(Mobile mob, string text)
{
text = text.Trim();
if (text.Length > 40)
text = text.Substring(0, 40);
if (text.Length > 0)
{
SR_Rune rune = null;
if (this.IsRunebook)
rune = new SR_Rune(text, true);
else
rune = new SR_Rune(text, this.TargetMap, this.TargetLoc);
if (this.RuneAcc.ChildRune == null)
this.RuneAcc.AddRune(rune);
else
this.RuneAcc.ChildRune.AddRune(rune);
}
SR_Gump.Send(mob, this.RuneAcc);
}
}
}

View File

@@ -0,0 +1,42 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using Server;
using Server.Targeting;
namespace Joeku.SR
{
public class SR_NewRuneTarget : Target
{
public SR_RuneAccount RuneAcc;
public SR_NewRuneTarget(SR_RuneAccount runeAcc)
: base(12, true, TargetFlags.None)
{
this.RuneAcc = runeAcc;
}
protected override void OnTarget(Mobile mob, object targ)
{
Point3D loc = new Point3D(0, 0, 0);
if (targ is LandTarget)
loc = (targ as LandTarget).Location;
else if (targ is StaticTarget)
loc = (targ as StaticTarget).Location;
else if (targ is Mobile)
loc = (targ as Mobile).Location;
else if (targ is Item)
loc = (targ as Item).Location;
mob.SendMessage("Enter a description:");
mob.Prompt = new SR_NewRunePrompt(this.RuneAcc, loc, mob.Map);
}
}
}

View File

@@ -0,0 +1,50 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using Server;
namespace Joeku.SR
{
// Legacy... binary serialization only used in v1.00, deserialization preserved to migrate data.
public class SR_Persistence : Item
{
public SR_Persistence()
{
}
public SR_Persistence(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Joeku's Staff Runebook: Loading...");
Console.WriteLine(" Migrating data from version 1.00... ");
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
SR_RuneAccount.Deserialize(reader, version);
Console.WriteLine();
this.Delete();
}
}
}

View File

@@ -0,0 +1,157 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.Collections.Generic;
using Server;
namespace Joeku.SR
{
public class SR_Rune
{
public string Name;
public bool IsRunebook = false;
public List<SR_Rune> Runes;
public int RunebookCount, RuneCount;
public int PageIndex = -1;
public SR_Rune ParentRune;
public Map TargetMap = Map.Felucca;
public Point3D TargetLoc = new Point3D(0, 0, 0);
public SR_Rune(string name, Map map, Point3D loc)
: this(name, false)
{
this.TargetMap = map;
this.TargetLoc = loc;
}
public SR_Rune(string name, bool isRunebook)
: this(name, isRunebook, new List<SR_Rune>())
{
}
public SR_Rune(string name, bool isRunebook, List<SR_Rune> runes)
{
this.Name = name;
this.IsRunebook = isRunebook;
this.Runes = runes;
this.FindCounts();
}
public int Count
{
get
{
return this.Runes.Count;
}
}
public int Tier
{
get
{
if (this.ParentRune != null)
return this.ParentRune.Tier + 1;
return 0;
}
}
// Legacy... binary serialization only used in v1.00, deserialization preserved to migrate data.
public static SR_Rune Deserialize(GenericReader reader, int version)
{
SR_Rune rune = null;
string name = reader.ReadString();
bool isRunebook = reader.ReadBool();
Map targetMap = reader.ReadMap();
Point3D targetLoc = reader.ReadPoint3D();
if (isRunebook)
rune = new SR_Rune(name, isRunebook);
else
rune = new SR_Rune(name, targetMap, targetLoc);
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
rune.AddRune(SR_Rune.Deserialize(reader, version));
return rune;
}
public void ResetPageIndex()
{
if (!this.IsRunebook || this.PageIndex == -1)
return;
if (this.Runes[this.PageIndex] != null)
this.Runes[this.PageIndex].ResetPageIndex();
this.PageIndex = -1;
}
public void Clear()
{
this.Runes.Clear();
this.RunebookCount = 0;
this.RuneCount = 0;
this.PageIndex = -1;
}
public void AddRune(SR_Rune rune)
{
for (int i = 0; i < this.Count; i++)
if (this.Runes[i] == rune)
this.Runes.RemoveAt(i);
if (rune.IsRunebook)
{
this.Runes.Insert(this.RunebookCount, rune);
this.RunebookCount++;
}
else
{
this.Runes.Add(rune);
this.RuneCount++;
}
rune.ParentRune = this;
}
public void RemoveRune(int index)
{
this.RemoveRune(index, false);
}
public void RemoveRune(int index, bool pageIndex)
{
if (this.Runes[index].IsRunebook)
this.RunebookCount--;
else
this.RuneCount--;
if (pageIndex && this.PageIndex == index)
this.PageIndex = -1;
this.Runes.RemoveAt(index);
}
public void FindCounts()
{
int runebookCount = 0, runeCount = 0;
for (int i = 0; i < this.Runes.Count; i++)
if (this.Runes[i].IsRunebook)
runebookCount++;
else
runeCount++;
this.RunebookCount = runebookCount;
this.RuneCount = runeCount;
}
}
}

View File

@@ -0,0 +1,139 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.Collections.Generic;
using Server;
namespace Joeku.SR
{
public class SR_RuneAccount
{
public string Username;
public List<SR_Rune> Runes;
public int RunebookCount, RuneCount;
public int PageIndex = -1;
public SR_RuneAccount(string username)
: this(username, new List<SR_Rune>())
{
}
public SR_RuneAccount(string username, List<SR_Rune> runes)
{
this.Username = username;
this.Runes = runes;
this.FindCounts();
SR_Main.AddInfo(this);
}
public int Count
{
get
{
return this.Runes.Count;
}
}
public SR_Rune ChildRune
{
get
{
SR_Rune rune = null;
if (this.PageIndex > -1)
rune = this.Runes[this.PageIndex];
if (rune != null)
{
while (rune.PageIndex > -1)
rune = rune.Runes[rune.PageIndex];
}
return rune;
}
}
// Legacy... binary serialization only used in v1.00, deserialization preserved to migrate data.
public static void Deserialize(GenericReader reader, int version)
{
List<SR_Rune> runes = new List<SR_Rune>();
string username = reader.ReadString();
Console.Write(" Account: {0}... ", username);
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
runes.Add(SR_Rune.Deserialize(reader, version));
new SR_RuneAccount(username, runes);
Console.WriteLine("done.");
}
public void ResetPageIndex()
{
this.Runes[this.PageIndex].ResetPageIndex();
this.PageIndex = -1;
}
public void Clear()
{
this.Runes.Clear();
this.RunebookCount = 0;
this.RuneCount = 0;
this.PageIndex = -1;
}
public void AddRune(SR_Rune rune)
{
for (int i = 0; i < this.Count; i++)
if (this.Runes[i] == rune)
this.Runes.RemoveAt(i);
if (rune.IsRunebook)
{
this.Runes.Insert(this.RunebookCount, rune);
this.RunebookCount++;
}
else
{
this.Runes.Add(rune);
this.RuneCount++;
}
}
public void RemoveRune(int index)
{
this.RemoveRune(index, false);
}
public void RemoveRune(int index, bool pageIndex)
{
if (this.Runes[index].IsRunebook)
this.RunebookCount--;
else
this.RuneCount--;
if (pageIndex && this.PageIndex == index)
this.PageIndex = -1;
this.Runes.RemoveAt(index);
}
public void FindCounts()
{
int runebookCount = 0, runeCount = 0;
for (int i = 0; i < this.Runes.Count; i++)
if (this.Runes[i].IsRunebook)
runebookCount++;
else
runeCount++;
this.RunebookCount = runebookCount;
this.RuneCount = runeCount;
}
}
}

View File

@@ -0,0 +1,73 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using Server;
using Server.Items;
namespace Joeku.SR
{
public class SR_RuneGate : Moongate
{
public SR_RuneGate(Point3D target, Map map)
: base(target, map)
{
this.Map = map;
if (this.ShowFeluccaWarning && map == Map.Felucca)
this.ItemID = 0xDDA;
this.Dispellable = false;
InternalTimer t = new InternalTimer(this);
t.Start();
}
public SR_RuneGate(Serial serial)
: base(serial)
{
}
public override bool ShowFeluccaWarning
{
get
{
return false/*Core.AOS*/;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
this.Delete();
}
private class InternalTimer : Timer
{
private readonly Item m_Item;
public InternalTimer(Item item)
: base(TimeSpan.FromSeconds(30.0))
{
this.Priority = TimerPriority.OneSecond;
this.m_Item = item;
}
protected override void OnTick()
{
this.m_Item.Delete();
}
}
}
}

View File

@@ -0,0 +1,79 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using System.IO;
using System.Xml;
namespace Joeku.SR
{
public class SR_Save
{
public static void WriteData()
{
if (!Directory.Exists(SR_Main.SavePath))
Directory.CreateDirectory(SR_Main.SavePath);
string filePath = Path.Combine(SR_Main.SavePath, SR_Main.FileName);
using (StreamWriter op = new StreamWriter(filePath))
{
XmlTextWriter xml = new XmlTextWriter(op);
xml.Formatting = Formatting.Indented;
xml.IndentChar = '\t';
xml.Indentation = 1;
xml.WriteStartDocument(true);
xml.WriteStartElement("StaffRunebook");
xml.WriteAttributeString("Version", SR_Main.Version.ToString());
for (int i = 0; i < SR_Main.Count; i++)
WriteAccountNode(SR_Main.Info[i], xml);
xml.WriteEndElement();
xml.Close();
}
}
public static void WriteAccountNode(SR_RuneAccount a, XmlTextWriter xml)
{
xml.WriteStartElement("RuneAccount");
xml.WriteAttributeString("Username", a.Username);
for (int i = 0; i < a.Count; i++)
WriteRuneNode(a.Runes[i], xml);
xml.WriteEndElement();
}
public static void WriteRuneNode(SR_Rune r, XmlTextWriter xml)
{
xml.WriteStartElement(r.IsRunebook ? "Runebook" : "Rune");
xml.WriteAttributeString("Name", r.Name);
if (!r.IsRunebook)
{
xml.WriteAttributeString("TargetMap", r.TargetMap.ToString());
xml.WriteAttributeString("X", r.TargetLoc.X.ToString());
xml.WriteAttributeString("Y", r.TargetLoc.Y.ToString());
xml.WriteAttributeString("Z", r.TargetLoc.Z.ToString());
}
else
for (int i = 0; i < r.Count; i++)
WriteRuneNode(r.Runes[i], xml);
xml.WriteEndElement();
}
}
}

View File

@@ -0,0 +1,207 @@
/**************************************
*Script Name: Staff Runebook *
*Author: Joeku *
*For use with RunUO 2.0 RC2 *
*Client Tested with: 6.0.9.2 *
*Version: 1.10 *
*Initial Release: 11/25/07 *
*Revision Date: 02/04/09 *
**************************************/
using System;
using Server;
using Server.Accounting;
using Server.Gumps;
namespace Joeku.SR
{
public class SR_Utilities
{
public static bool FindItem(Type type, Point3D p, Map map)
{
return FindEntity(type, p, map, false);
}
public static bool FindMobile(Type type, Point3D p, Map map)
{
return FindEntity(type, p, map, true);
}
public static bool FindEntity(Type type, Point3D p, Map map, bool mob)
{
IPooledEnumerable loc;
Rectangle2D rect = new Rectangle2D(p.X, p.Y, 1, 1);
if (mob)
loc = map.GetMobilesInBounds(rect);
else
loc = map.GetItemsInBounds(rect);
bool found = false;
try
{
foreach (object o in loc)
if (o != null && o.GetType() == type || o.GetType().IsSubclassOf(type))
{
found = true;
break;
}
}
catch
{
}
loc.Free();
return found;
}
public static SR_RuneAccount FetchInfo(IAccount acc)
{
return FetchInfo(acc as Account);
}
public static SR_RuneAccount FetchInfo(Account acc)
{
return FetchInfo(acc.Username);
}
public static SR_RuneAccount FetchInfo(string username)
{
SR_RuneAccount runeAcc = null;
for (int i = 0; i < SR_Main.Count; i++)
if (SR_Main.Info[i].Username == username)
{
runeAcc = SR_Main.Info[i];
break;
}
if (runeAcc == null)
{
runeAcc = new SR_RuneAccount(username);
NewRuneAcc(runeAcc);
}
return runeAcc;
}
public static int RunebookID = 8901;
public static int RuneID = 7956;
public static int ItemOffsetY(SR_Rune rune)
{
if (rune.IsRunebook)
return -1;
return 3;
}
public static int ItemOffsetX(SR_Rune rune)
{
if (rune.IsRunebook)
return -1;
return -2;
}
public static int ItemHue(SR_Rune rune)
{
int hue = 0;
if (rune.IsRunebook)
hue = 1121;
else
hue = RuneHues[MapInt(rune.TargetMap) /*+ (rune.House != null) ? 5 : 0*/];
return hue;
}
private static readonly int[] RuneHues = new int[] { 0, 50, 1102, 1102, 1154, 0x66D, 0x47F, 0x55F, 0x55F, 0x47F };
// To do: check for valid Z (?)
public static bool CheckValid(Point3D loc, Map map)
{
Point2D dim = MapDimensions[MapInt(map)];
if (loc.X < 0 || loc.Y < 0 || loc.X > dim.X || loc.Y > dim.Y)
return false;
return true;
}
private static readonly Point2D[] MapDimensions = new Point2D[]
{
new Point2D(7168, 4096), // Felucca
new Point2D(7168, 4096), // Trammel
new Point2D(2304, 1600), // Ilshenar
new Point2D(2560, 2048), // Malas
new Point2D(1448, 1448), // Tokuno
#region SA
new Point2D(1280, 4096)// TerMur
#endregion
};
public static int MapInt(Map map)
{
int i = 0;
if (map == Map.Felucca)
i = 0;
else if (map == Map.Trammel)
i = 1;
else if (map == Map.Ilshenar)
i = 2;
else if (map == Map.Malas)
i = 3;
else if (map == Map.Tokuno)
i = 4;
#region SA
else if (map == Map.TerMur)
i = 5;
#endregion
return i;
}
public static void NewRuneAcc(SR_RuneAccount acc)
{
acc.Clear();
acc.AddRune(AddTree(GoGump.Felucca, Map.Felucca));
acc.AddRune(AddTree(GoGump.Trammel, Map.Trammel));
acc.AddRune(AddTree(GoGump.Ilshenar, Map.Ilshenar));
acc.AddRune(AddTree(GoGump.Malas, Map.Malas));
acc.AddRune(AddTree(GoGump.Tokuno, Map.Tokuno));
#region SA
acc.AddRune(AddTree(GoGump.TerMur, Map.TerMur));
#endregion
}
private static SR_Rune AddTree(LocationTree tree, Map map)
{
SR_Rune runeBook = new SR_Rune(map.ToString(), true);
for (int i = 0; i < tree.Root.Children.Length; i++)
runeBook.AddRune(AddNode(tree.Root.Children[i], map));
return runeBook;
}
private static SR_Rune AddNode(object o, Map map)
{
if (o is ParentNode)
{
ParentNode parentNode = o as ParentNode;
SR_Rune runeBook = new SR_Rune(parentNode.Name, true);
for (int i = 0; i < parentNode.Children.Length; i++)
runeBook.AddRune(AddNode(parentNode.Children[i], map));
return runeBook;
}
ChildNode childNode = o as ChildNode;
return new SR_Rune(childNode.Name, map, childNode.Location);
}
}
}

View File

@@ -0,0 +1,79 @@
using Server.Commands;
using System;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Mobiles;
using Server.Items;
namespace Server.Commands
{
public class LinkTeleporterCommand
{
public static void Initialize()
{
CommandSystem.Register("telelink", AccessLevel.GameMaster, new CommandEventHandler(LinkTeleporter_OnCommand));
}
[Usage("telelink")]
[Description("Creates 2 teleporters simultaneously and links them.")]
private static void LinkTeleporter_OnCommand(CommandEventArgs e)
{
Mobile from = e.Mobile;
from.SendMessage("Target a location for 1st Teleporter:");
from.Target = new FirstTarget();
}
private class FirstTarget : Target
{
public FirstTarget() : base(-1, true, TargetFlags.None)
{
}
protected override void OnTarget(Mobile from, object target)
{
IPoint3D p = target as IPoint3D;
if (p == null)
return;
Point3D tele_Loc1 = new Point3D(p);
Map tele_Map1 = from.Map;
from.SendMessage("Target a location for 2nd Teleporter:");
from.Target = new SecondTarget(tele_Loc1, tele_Map1);
}
}
private class SecondTarget : Target
{
private Point3D tele_Loc1;
private Map tele_Map1;
public SecondTarget(Point3D loc, Map map) : base(-1, true, TargetFlags.None)
{
tele_Loc1 = loc;
tele_Map1 = map;
}
protected override void OnTarget(Mobile from, object target)
{
IPoint3D p = target as IPoint3D;
if (p == null)
return;
Point3D tele_Loc2 = new Point3D(p);
Map tele_Map2 = from.Map;
Item tele1 = new Teleporter(tele_Loc2, tele_Map2);
Item tele2 = new Teleporter(tele_Loc1, tele_Map1);
tele1.MoveToWorld(tele_Loc1, tele_Map1);
tele2.MoveToWorld(tele_Loc2, tele_Map2);
}
}
}
}

View File

@@ -0,0 +1,96 @@
#region References
using System;
using CustomsFramework;
using Server;
using Server.Commands;
using Server.Gumps;
using Services.Toolbar.Gumps;
#endregion
namespace Services.Toolbar.Core
{
public class ToolbarCore : BaseCore
{
public const string SystemVersion = "2.3";
public const string ReleaseDate = "October 28, 2013";
public static ToolbarCore Instance { get; private set; }
public static void Initialize()
{
Instance = World.GetCore(typeof(ToolbarCore)) as ToolbarCore ?? new ToolbarCore();
CommandHandlers.Register("Toolbar", AccessLevel.VIP, Toolbar_OnCommand);
EventSink.Login += OnLogin;
EventSink.PlayerDeath += OnPlayerDeath;
}
private static void OnLogin(LoginEventArgs e)
{
if (e.Mobile.AccessLevel >= AccessLevel.VIP)
{
SendToolbar(e.Mobile);
}
}
public static void OnPlayerDeath(PlayerDeathEventArgs e)
{
if (e.Mobile.AccessLevel < AccessLevel.VIP || e.Mobile.NetState == null)
{
return;
}
e.Mobile.CloseGump(typeof(ToolbarGump));
Timer.DelayCall(TimeSpan.FromSeconds(2.0), SendToolbar, e.Mobile);
}
[Usage("Toolbar")]
public static void Toolbar_OnCommand(CommandEventArgs e)
{
SendToolbar(e.Mobile);
}
public static void SendToolbar(Mobile m)
{
ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);
m.CloseGump(typeof(ToolbarGump));
m.SendGump(new ToolbarGump(module.ToolbarInfo, m));
}
public ToolbarCore()
{
Enabled = true;
}
public ToolbarCore(CustomSerial serial)
: base(serial)
{ }
public override string Name { get { return @"Toolbar Core"; } }
public override string Description { get { return @"Core that maintains the [Toolbar system."; } }
public override string Version { get { return SystemVersion; } }
public override AccessLevel EditLevel { get { return AccessLevel.Developer; } }
public override Gump SettingsGump { get { return null; } }
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteVersion(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,296 @@
#region References
using System.Collections.Generic;
using CustomsFramework;
using Server;
using Server.Commands;
#endregion
namespace Services.Toolbar.Core
{
public class ToolbarInfo
{
private int _Font, _Skin;
private bool _Phantom, _Stealth, _Reverse, _Lock;
private Point2D _Dimensions;
private List<string> _Entries = new List<string>();
private List<Point3D> _Points = new List<Point3D>();
public ToolbarInfo(
Point2D dimensions, List<string> entries, int skin, List<Point3D> points, int font, bool[] switches)
{
_Dimensions = dimensions;
_Entries = entries;
_Skin = skin;
_Points = points;
_Font = font;
_Phantom = switches[0];
_Stealth = switches[1];
_Reverse = switches[2];
_Lock = switches[3];
}
public int Font { get { return _Font; } set { _Font = value; } }
public int Skin { get { return _Skin; } set { _Skin = value; } }
public bool Phantom { get { return _Phantom; } set { _Phantom = value; } }
public bool Stealth { get { return _Stealth; } set { _Stealth = value; } }
public bool Reverse { get { return _Reverse; } set { _Reverse = value; } }
public bool Lock { get { return _Lock; } set { _Lock = value; } }
public int Rows { get { return _Dimensions.X; } set { _Dimensions.X = value; } }
public int Collumns { get { return _Dimensions.Y; } set { _Dimensions.Y = value; } }
public List<string> Entries { get { return _Entries; } set { _Entries = value; } }
public List<Point3D> Points { get { return _Points; } set { _Points = value; } }
public static ToolbarInfo CreateNew(Mobile from)
{
Point2D dimensions = DefaultDimensions(from.AccessLevel);
var entries = DefaultEntries(from.AccessLevel);
var points = new List<Point3D>();
for (int i = entries.Count; i <= 135; i++)
{
entries.Add("-*UNUSED*-");
}
return new ToolbarInfo(dimensions, entries, 0, points, 0, new[] {true, false, false, true});
}
public static List<string> DefaultEntries(AccessLevel level)
{
var entries = new List<string>();
switch (level)
{
case AccessLevel.Player:
{
break;
}
case AccessLevel.VIP:
{
break;
}
case AccessLevel.Counselor:
{
entries.Add(CommandSystem.Prefix + "GMBody");
entries.Add(CommandSystem.Prefix + "StaffRunebook");
entries.Add(CommandSystem.Prefix + "SpeedBoost");
entries.Add(CommandSystem.Prefix + "M Tele");
entries.Add(CommandSystem.Prefix + "Where");
entries.Add(CommandSystem.Prefix + "Who");
break;
}
case AccessLevel.Decorator:
{
entries.Add(CommandSystem.Prefix + "GMBody");
entries.Add(CommandSystem.Prefix + "StaffRunebook");
entries.Add(CommandSystem.Prefix + "SpeedBoost");
entries.Add(CommandSystem.Prefix + "M Tele");
entries.Add(CommandSystem.Prefix + "Where");
entries.Add(CommandSystem.Prefix + "Who");
for (int j = 0; j < 3; j++)
{
entries.Add("-*UNUSED*-");
}
entries.Add(CommandSystem.Prefix + "Add");
entries.Add(CommandSystem.Prefix + "Remove");
entries.Add(CommandSystem.Prefix + "Move");
entries.Add(CommandSystem.Prefix + "ShowArt");
entries.Add(CommandSystem.Prefix + "Get ItemID");
entries.Add(CommandSystem.Prefix + "Get Hue");
break;
}
case AccessLevel.Spawner:
{
entries.Add(CommandSystem.Prefix + "GMBody");
entries.Add(CommandSystem.Prefix + "StaffRunebook");
entries.Add(CommandSystem.Prefix + "SpeedBoost");
entries.Add(CommandSystem.Prefix + "M Tele");
entries.Add(CommandSystem.Prefix + "Where");
entries.Add(CommandSystem.Prefix + "Who");
for (int j = 0; j < 3; j++)
{
entries.Add("-*UNUSED*-");
}
entries.Add(CommandSystem.Prefix + "Add");
entries.Add(CommandSystem.Prefix + "Remove");
entries.Add(CommandSystem.Prefix + "XmlAdd");
entries.Add(CommandSystem.Prefix + "XmlFind");
entries.Add(CommandSystem.Prefix + "XmlShow");
entries.Add(CommandSystem.Prefix + "XmlHide");
break;
}
case AccessLevel.Seer:
case AccessLevel.GameMaster:
{
entries.Add(CommandSystem.Prefix + "GMBody");
entries.Add(CommandSystem.Prefix + "StaffRunebook");
entries.Add(CommandSystem.Prefix + "SpeedBoost");
entries.Add(CommandSystem.Prefix + "M Tele");
entries.Add(CommandSystem.Prefix + "Where");
entries.Add(CommandSystem.Prefix + "Who");
for (int j = 0; j < 3; j++)
{
entries.Add("-*UNUSED*-");
}
entries.Add(CommandSystem.Prefix + "Add");
entries.Add(CommandSystem.Prefix + "Remove");
entries.Add(CommandSystem.Prefix + "Props");
entries.Add(CommandSystem.Prefix + "Move");
entries.Add(CommandSystem.Prefix + "Kill");
entries.Add(CommandSystem.Prefix + "Follow");
break;
}
case AccessLevel.Administrator:
case AccessLevel.Developer:
case AccessLevel.CoOwner:
case AccessLevel.Owner:
{
entries.Add(CommandSystem.Prefix + "Admin");
entries.Add(CommandSystem.Prefix + "StaffRunebook");
entries.Add(CommandSystem.Prefix + "SpeedBoost");
entries.Add(CommandSystem.Prefix + "M Tele");
entries.Add(CommandSystem.Prefix + "Where");
entries.Add(CommandSystem.Prefix + "Who");
for (int j = 0; j < 3; j++)
{
entries.Add("-*UNUSED*-");
}
entries.Add(CommandSystem.Prefix + "Props");
entries.Add(CommandSystem.Prefix + "Move");
entries.Add(CommandSystem.Prefix + "Add");
entries.Add(CommandSystem.Prefix + "Remove");
entries.Add(CommandSystem.Prefix + "ViewEquip");
entries.Add(CommandSystem.Prefix + "Kill");
break;
}
}
return entries;
}
public static Point2D DefaultDimensions(AccessLevel level)
{
Point2D dimensions = new Point2D();
switch (level)
{
case AccessLevel.Player:
case AccessLevel.VIP:
{
dimensions.X = 0;
dimensions.Y = 0;
break;
}
case AccessLevel.Counselor:
{
dimensions.X = 6;
dimensions.Y = 1;
break;
}
case AccessLevel.Decorator:
case AccessLevel.Spawner:
case AccessLevel.GameMaster:
case AccessLevel.Seer:
case AccessLevel.Administrator:
case AccessLevel.Developer:
case AccessLevel.CoOwner:
case AccessLevel.Owner:
{
dimensions.X = 6;
dimensions.Y = 2;
break;
}
}
return dimensions;
}
public ToolbarInfo(GenericReader reader)
{
Deserialize(reader);
}
public void Serialize(GenericWriter writer)
{
writer.WriteVersion(0);
writer.Write(_Font);
writer.Write(_Phantom);
writer.Write(_Stealth);
writer.Write(_Reverse);
writer.Write(_Lock);
writer.Write(_Dimensions);
writer.Write(_Entries.Count);
foreach (string t in _Entries)
{
writer.Write(t);
}
writer.Write(_Skin);
writer.Write(_Points.Count);
foreach (Point3D t in _Points)
{
writer.Write(t);
}
}
private void Deserialize(GenericReader reader)
{
int version = reader.ReadInt();
_Dimensions = new Point2D();
_Entries = new List<string>();
_Points = new List<Point3D>();
switch (version)
{
case 0:
{
_Font = reader.ReadInt();
_Phantom = reader.ReadBool();
_Stealth = reader.ReadBool();
_Reverse = reader.ReadBool();
_Lock = reader.ReadBool();
_Dimensions = reader.ReadPoint2D();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
_Entries.Add(reader.ReadString());
}
_Skin = reader.ReadInt();
count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
_Points.Add(reader.ReadPoint3D());
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,65 @@
#region References
using System;
using CustomsFramework;
using Server;
using Services.Toolbar.Core;
#endregion
namespace Services.Toolbar
{
public class ToolbarModule : BaseModule
{
private ToolbarInfo _ToolbarInfo;
public ToolbarModule(Mobile from)
: base(from)
{
_ToolbarInfo = ToolbarInfo.CreateNew(from);
}
public ToolbarModule(CustomSerial serial)
: base(serial)
{ }
public override string Name
{
get { return LinkedMobile != null ? String.Format(@"Toolbar Module - {0}", LinkedMobile.Name) : @"Unlinked Toolbar Module"; }
}
public override string Version { get { return ToolbarCore.SystemVersion; } }
public override AccessLevel EditLevel { get { return AccessLevel.Developer; } }
[CommandProperty(AccessLevel.Developer)]
public ToolbarInfo ToolbarInfo { get { return _ToolbarInfo; } set { _ToolbarInfo = value; } }
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteVersion(0);
// Version 0
_ToolbarInfo.Serialize(writer);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
_ToolbarInfo = new ToolbarInfo(reader);
break;
}
}
}
}
}

View File

@@ -0,0 +1,61 @@
namespace Services.Toolbar.Gumps
{
public class GumpIDs
{
public enum MiscIDs
{
Background = 0,
Color = 1,
Buttonground = 2,
ButtonOffset = 3,
}
public enum ButtonIDs
{
Minimize = 0,
Maximize = 1,
Customize = 2,
SpecialCommand = 3,
Send = 4,
Teleport = 5,
Gate = 6,
}
public static int Skins = 2;
public static string[] Fonts = new[]
{
"", "<b>", "<i>", "<b><i>", "<small>", "<b><small>", "<i><small>", "<b><i><small>", "<big>", "<b><big>", "<i><big>",
"<b><i><big>"
};
public static GumpIDs[] Misc = new[]
{
new GumpIDs(0, "Background", new[,] {{9200}, {9270}}), new GumpIDs(1, "Color", new[,] {{0}, {0}}),
new GumpIDs(2, "Buttonground", new[,] {{9200}, {9350}}), new GumpIDs(3, "ButtonOffset", new[,] {{5}, {7}})
};
public static GumpIDs[] Buttons = new[]
{
new GumpIDs(0, "Minimize", new[,] {{5603, 5607, 16, 16}, {5537, 5539, 19, 21}}),
new GumpIDs(1, "Maximize", new[,] {{5601, 5605, 16, 16}, {5540, 5542, 19, 21}}),
new GumpIDs(2, "Customize", new[,] {{22153, 22155, 16, 16}, {5525, 5527, 62, 24}}),
new GumpIDs(3, "SpecialCommand", new[,] {{2117, 2118, 15, 15}, {9720, 9722, 29, 29}}),
new GumpIDs(4, "Send", new[,] {{2360, 2360, 11, 11}, {2360, 2360, 11, 11}}),
new GumpIDs(5, "Teleport", new[,] {{2361, 2361, 11, 11}, {2361, 2361, 11, 11}}),
new GumpIDs(6, "Gate", new[,] {{2362, 2362, 11, 11}, {2361, 2361, 11, 11}})
};
public int ID { get; set; }
public int[,] Content { get; set; }
public string Name { get; set; }
public GumpIDs(int iD, string name, int[,] content)
{
ID = iD;
Content = content;
Name = name;
}
}
}

View File

@@ -0,0 +1,223 @@
#region References
using System;
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Network;
using Services.Toolbar.Core;
#endregion
namespace Services.Toolbar.Gumps
{
public class ToolbarGump : Gump
{
/*******************
* BUTTON ID'S
* 0 - Close
* 1 - Edit
*******************/
private readonly ToolbarInfo _Info;
public int InitOptsW, InitOptsH;
public ToolbarGump(ToolbarInfo info, Mobile m)
: base(0, 28)
{
_Info = info;
if (_Info.Lock)
{
Closable = false;
Disposable = false;
}
int offset = GumpIDs.Misc[(int)GumpIDs.MiscIDs.ButtonOffset].Content[_Info.Skin, 0];
int bx = ((offset * 2) + (_Info.Rows * 110)), by = ((offset * 2) + (_Info.Collumns * 24)), byx = by, cy = 0;
SetCoords(offset);
if (_Info.Reverse)
{
cy = InitOptsH;
by = 0;
}
AddPage(0);
AddPage(1);
if (_Info.Stealth)
{
AddMinimized(by, offset);
AddPage(2);
}
AddInitOpts(by, offset);
AddBackground(0, cy, bx, byx, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
string font = GumpIDs.Fonts[_Info.Font];
if (_Info.Phantom)
{
font += "<BASEFONT COLOR=#FFFFFF>";
}
int temp = 0, x, y;
NetState ns = m.NetState;
for (int i = 0; i < _Info.Rows * _Info.Collumns; i++)
{
x = offset + ((i % _Info.Rows) * 110);
y = offset + (int)(Math.Floor((double)(i / _Info.Rows)) * 24) + cy;
if (ns.IsEnhancedClient)
{
AddButton(x + 4, y + 5, 2103, 2104, temp + 10, GumpButtonType.Reply, 0);//4005, 4007
}
else
{
AddButton(x + 1, y, 2445, 2445, temp + 10, GumpButtonType.Reply, 0);
}
AddBackground(x, y, 110, 24, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Buttonground].Content[_Info.Skin, 0]);
if (_Info.Phantom)
{
AddImageTiled(x + 2, y + 2, 106, 20, 2624); // Alpha Area 1_1
AddAlphaRegion(x + 2, y + 2, 106, 20); // Alpha Area 1_2
}
if (ns.IsEnhancedClient)
{
AddHtml(x + 30, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
}
else
{
AddHtml(x + 5, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
}
if (i % _Info.Rows == _Info.Rows - 1)
{
temp += 9 - _Info.Rows;
}
++temp;
}
if (_Info.Stealth)
{
return;
}
AddPage(2);
AddMinimized(by, offset);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile mob = sender.Mobile;
switch (info.ButtonID)
{
case 0: // Close
break;
case 1: // Edit
{
mob.SendGump(this);
mob.CloseGump(typeof(ToolbarEdit));
mob.SendGump(new ToolbarEdit(_Info));
}
break;
default: // Command
{
mob.SendGump(this);
int buttonPressedIndex = info.ButtonID - 10;
if (buttonPressedIndex >= _Info.Entries.Count)
return;
String buttonText = _Info.Entries[buttonPressedIndex];
if (buttonText.StartsWith(CommandSystem.Prefix))
{
mob.SendMessage(buttonText);
CommandSystem.Handle(mob, buttonText);
}
else
{
mob.DoSpeech(buttonText, new int[0], MessageType.Regular, mob.SpeechHue);
}
}
break;
}
}
/// <summary>
/// Sets coordinates and sizes.
/// </summary>
public void SetCoords(int offset)
{
InitOptsW = 50 + (offset * 2) + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5 +
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 2];
InitOptsH = (offset * 2) + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 3];
if (GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 3] + (offset * 2) > InitOptsH)
{
InitOptsH = GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 3] + (offset * 2);
}
}
/// <summary>
/// Adds initial options.
/// </summary>
public void AddInitOpts(int y, int offset)
{
AddBackground(0, y, InitOptsW, InitOptsH, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
AddButton(
offset,
y + offset,
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 0],
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 1],
0,
GumpButtonType.Page,
_Info.Stealth ? 1 : 2);
AddButton(
offset + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5,
y + offset,
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 0],
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 1],
1,
GumpButtonType.Reply,
0); // 1 Edit
}
/// <summary>
/// Adds minimized page.
/// </summary>
public void AddMinimized(int y, int offset)
{
AddBackground(0, y, InitOptsW, InitOptsH, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);
AddButton(
offset,
y + offset,
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Maximize].Content[_Info.Skin, 0],
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Maximize].Content[_Info.Skin, 1],
0,
GumpButtonType.Page,
_Info.Stealth ? 2 : 1);
AddButton(
offset + GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Minimize].Content[_Info.Skin, 2] + 5,
y + offset,
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 0],
GumpIDs.Buttons[(int)GumpIDs.ButtonIDs.Customize].Content[_Info.Skin, 1],
1,
GumpButtonType.Reply,
0); // 1 Edit
}
}
}

View File

@@ -0,0 +1,577 @@
#region References
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Gumps;
using Server.Network;
using Services.Toolbar.Core;
#endregion
namespace Services.Toolbar.Gumps
{
public class ToolbarEdit : Gump
{
public static string HTML =
String.Format(
"<center><u>Command Toolbar v{0}</u><br>Made by Joeku AKA Demortris<br>{1}<br>- Customized for ServUO -</center><br> This toolbar is extremely versatile. You can switch skins and increase or decrease columns or rows. The toolbar operates like a spreadsheet; you can use the navigation menu to scroll through different commands and bind them. Enjoy!<br><p>If you have questions, concerns, or bug reports, please <A HREF=\"mailto:demortris@adelphia.net\">e-mail me</A>.",
ToolbarCore.SystemVersion,
ToolbarCore.ReleaseDate);
private readonly bool _Expanded;
private readonly int _ExpandedInt;
private readonly ToolbarInfo _Info;
private List<TextRelay> _TextRelays;
public ToolbarEdit(ToolbarInfo info)
: this(info, false)
{ }
public ToolbarEdit(ToolbarInfo info, bool expanded)
: base(0, 28)
{
_Info = info;
_Expanded = expanded;
_ExpandedInt = expanded ? 2 : 1;
AddInit();
AddControls();
AddNavigation();
AddResponses();
AddEntries();
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile m = sender.Mobile;
_TextRelays = CreateList(info.TextEntries);
switch (info.ButtonID)
{
case 0:
break;
case 1:
{
_Info.Skin++;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 2:
{
_Info.Skin--;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 3:
{
_Info.Rows++;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 4:
{
_Info.Rows--;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 5:
{
_Info.Collumns++;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 6:
{
_Info.Collumns--;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 9: // Default
{
var toolbarinfo = ToolbarInfo.DefaultEntries(m.AccessLevel);
CombineEntries(toolbarinfo);
toolbarinfo.AddRange(AnalyzeEntries(toolbarinfo.Count));
_Info.Entries = toolbarinfo;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 10: // Okay
goto case 12;
case 11: // Cancel
goto case 0;
case 12: // Apply
{
ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);
module.ToolbarInfo.Entries = AnalyzeEntries();
module.ToolbarInfo.Phantom = info.IsSwitched(21);
module.ToolbarInfo.Stealth = info.IsSwitched(23);
module.ToolbarInfo.Reverse = info.IsSwitched(25);
module.ToolbarInfo.Lock = info.IsSwitched(27);
if (info.ButtonID == 12)
{
m.SendGump(new ToolbarEdit(_Info, _Expanded));
}
m.CloseGump(typeof(ToolbarGump));
m.SendGump(new ToolbarGump(module.ToolbarInfo, m));
break;
}
case 18:
{
_Info.Font++;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 19:
{
_Info.Font--;
m.SendGump(new ToolbarEdit(_Info, _Expanded));
break;
}
case 20:
{
m.SendGump(new ToolbarEdit(_Info, _Expanded));
m.SendMessage(2101, "Phantom mode turns the toolbar semi-transparent.");
break;
}
case 22:
{
m.SendGump(new ToolbarEdit(_Info, _Expanded));
m.SendMessage(2101, "Stealth mode makes the toolbar automatically minimize when you click a button.");
break;
}
case 24:
{
m.SendGump(new ToolbarEdit(_Info, _Expanded));
m.SendMessage(2101, "Reverse mode puts the minimize bar above the toolbar instead of below.");
break;
}
case 26:
{
m.SendGump(new ToolbarEdit(_Info, _Expanded));
m.SendMessage(2101, "Lock mode disables closing the toolbar with right-click.");
break;
}
case 28: // Expand
{
m.SendGump(new ToolbarEdit(_Info, !_Expanded));
m.SendMessage(2101, "Expanded view {0}activated.", _Expanded ? "de" : "");
break;
}
}
}
/// <summary>
/// Takes the gump relay entries and converts them from an Array into a List.
/// </summary>
public static List<TextRelay> CreateList(TextRelay[] entries)
{
return entries.ToList();
}
public void CombineEntries(List<string> list)
{
string temp;
for (int i = 0; i < list.Count; i++)
{
if (list[i] == "-*UNUSED*-" && (temp = GetEntry(i + 13, this).Text) != "")
{
list[i] = temp;
}
}
}
public List<string> AnalyzeEntries()
{
return AnalyzeEntries(0);
}
/// <summary>
/// Organizes the gump relay entries into a usable collection.
/// </summary>
public List<string> AnalyzeEntries(int i)
{
var list = new List<string>();
string temp;
for (int j = i; j < 135; j++)
{
list.Add((temp = GetEntry(j + 13, this).Text) == "" ? "-*UNUSED*-" : temp);
}
return list;
}
/// <summary>
/// Gets entry # in the gump relay.
/// </summary>
public static TextRelay GetEntry(int entryID, ToolbarEdit gump)
{
int temp = 0;
TextRelay relay = null;
for (int i = 0; i < gump._TextRelays.Count; i++)
{
if (gump._TextRelays[i].EntryID != entryID)
{
continue;
}
temp = i;
relay = gump._TextRelays[i];
}
gump._TextRelays.RemoveAt(temp);
return relay;
}
/// <summary>
/// Adds the skeleton gump.
/// </summary>
public void AddInit()
{
AddPage(0);
AddBackground(0, 0, 620, 120, 9200);
AddHtml(10, 10, 240, 100, HTML, true, true);
}
/// <summary>
/// Adds other dynamic options.
/// </summary>
public void AddControls()
{
AddBackground(260, 0, 240, 120, 9200);
AddLabel(274, 11, 0, String.Format("Skin - {0}", _Info.Skin + 1));
if (_Info.Skin < GumpIDs.Skins - 1)
{
AddButton(359, 10, 2435, 2436, 1, GumpButtonType.Reply, 0);
}
if (_Info.Skin > 0)
{
AddButton(359, 21, 2437, 2438, 2, GumpButtonType.Reply, 0);
}
AddLabel(274, 36, 0, String.Format("Rows - {0}", _Info.Rows));
if (_Info.Rows < 15)
{
AddButton(359, 35, 2435, 2436, 3, GumpButtonType.Reply, 0);
}
if (_Info.Rows > 1)
{
AddButton(359, 46, 2437, 2438, 4, GumpButtonType.Reply, 0);
}
AddLabel(274, 61, 0, String.Format("Columns - {0}", _Info.Collumns));
if (_Info.Collumns < 9)
{
AddButton(359, 60, 2435, 2436, 5, GumpButtonType.Reply, 0);
}
if (_Info.Collumns > 1)
{
AddButton(359, 71, 2437, 2438, 6, GumpButtonType.Reply, 0);
}
AddHtml(276, 87, 100, 20, String.Format("{0}Font - {1}", GumpIDs.Fonts[_Info.Font], _Info.Font + 1), false, false);
if (_Info.Font < GumpIDs.Fonts.Length - 1)
{
AddButton(359, 85, 2435, 2436, 18, GumpButtonType.Reply, 0);
}
if (_Info.Font > 0)
{
AddButton(359, 96, 2437, 2438, 19, GumpButtonType.Reply, 0);
}
AddLabel(389, 11, 0, "Phantom");
AddButton(446, 13, 22153, 22155, 20, GumpButtonType.Reply, 0);
AddCheck(469, 11, 210, 211, _Info.Phantom, 21);
AddLabel(389, 36, 0, "Stealth");
AddButton(446, 38, 22153, 22155, 22, GumpButtonType.Reply, 0);
AddCheck(469, 36, 210, 211, _Info.Stealth, 23);
AddLabel(389, 61, 0, "Reverse");
AddButton(446, 63, 22153, 22155, 24, GumpButtonType.Reply, 0);
AddCheck(469, 61, 210, 211, _Info.Reverse, 25);
AddLabel(389, 86, 0, "Lock");
AddButton(446, 88, 22153, 22155, 26, GumpButtonType.Reply, 0);
AddCheck(469, 86, 210, 211, _Info.Lock, 27);
}
/// <summary>
/// Adds the skeleton navigation section.
/// </summary>
public void AddNavigation()
{
AddBackground(500, 0, 120, 120, 9200);
AddHtml(500, 10, 120, 20, @"<center><u>Navigation</u></center>", false, false);
AddLabel(508, 92, 0, "Expanded View");
AddButton(595, 95, _Expanded ? 5603 : 5601, _Expanded ? 5607 : 5605, 28, GumpButtonType.Reply, 0);
}
/// <summary>
/// Adds response buttons.
/// </summary>
public void AddResponses()
{
int temp = 170 + (_ExpandedInt * 100);
AddBackground(0, temp, 500, 33, 9200);
AddButton(50, temp + 5, 246, 244, 9, GumpButtonType.Reply, 0); // Default
AddButton(162, temp + 5, 249, 248, 10, GumpButtonType.Reply, 0); // Okay
AddButton(275, temp + 5, 243, 241, 11, GumpButtonType.Reply, 0); // Cancel
AddButton(387, temp + 5, 239, 240, 12, GumpButtonType.Reply, 0); // Apply
}
/// <summary>
/// Adds the actual command/phrase entries.
/// </summary>
public void AddEntries()
{
const int buffer = 2;
// CALC
int entryX = _ExpandedInt * 149, entryY = _ExpandedInt * 20;
int bgX = 10 + 4 + (buffer * 3) + (entryX * 3), bgY = 10 + 8 + (entryY * 5);
int divX = bgX - 10, divY = bgY - 10;
// ENDCALC
AddBackground(0, 120, 33 + bgX, 32 + bgY, 9200);
AddBackground(33, 152, bgX, bgY, 9200);
// Add vertical dividers
for (int m = 1; m <= 2; m++)
{
AddImageTiled(38 + (m * entryX) + buffer + ((m - 1) * 4), 157, 2, divY, 10004);
}
// Add horizontal dividers
for (int n = 1; n <= 4; n++)
{
AddImageTiled(38, 155 + (n * (entryY + 2)), divX, 2, 10001);
}
int start = -3, temp;
for (int i = 1; i <= 9; i++)
{
start += 3;
switch (i)
{
case 4:
start = 45;
break;
case 7:
start = 90;
break;
}
temp = start;
/********
* PAGES *
*-------*
* 1 2 3 *
* 4 5 6 *
* 7 8 9 *
********/
AddPage(i);
CalculatePages(i);
// Add column identifiers
for (int j = 0; j < 3; j++)
{
AddHtml(
38 + buffer + ((j % 3) * (buffer + entryX + 2)),
128,
entryX,
20,
String.Format("<center>Column {0}</center>", (j + 1) + CalculateColumns(i)),
false,
false);
}
AddHtml(2, 128, 30, 20, "<center>Row</center>", false, false);
int tempInt = 0;
if (_Expanded)
{
tempInt = 11;
}
// Add row identifiers
for (int k = 0; k < 5; k++)
{
AddHtml(
0,
157 + (k * (entryY + 2)) + tempInt,
32,
20,
String.Format("<center>{0}</center>", (k + 1) + CalculateRows(i)),
false,
false);
}
// Add command entries
for (int l = 0; l < 15; l++)
{
AddTextEntry(
38 + buffer + ((l % 3) * ((buffer * 2) + entryX)),
157 + ((int)Math.Floor((double)l / 3) * (entryY + 2)),
entryX - 1,
entryY,
2101,
temp + 13,
_Info.Entries[temp] /*,int size*/);
if (l % 3 == 2)
{
temp += 6;
}
++temp;
}
}
}
/// <summary>
/// Calculates what navigation button takes you to what page.
/// </summary>
public void CalculatePages(int i)
{
int up = 0, down = 0, left = 0, right = 0;
switch (i)
{
case 1:
down = 4;
right = 2;
break;
case 2:
down = 5;
left = 1;
right = 3;
break;
case 3:
down = 6;
left = 2;
break;
case 4:
up = 1;
down = 7;
right = 5;
break;
case 5:
up = 2;
down = 8;
left = 4;
right = 6;
break;
case 6:
up = 3;
down = 9;
left = 5;
break;
case 7:
up = 4;
right = 8;
break;
case 8:
up = 5;
left = 7;
right = 9;
break;
case 9:
up = 6;
left = 8;
break;
}
AddNavigation(up, down, left, right);
}
/// <summary>
/// Adds navigation buttons for each page.
/// </summary>
public void AddNavigation(int up, int down, int left, int right)
{
if (up > 0)
{
AddButton(549, 34, 9900, 9902, 0, GumpButtonType.Page, up);
}
if (down > 0)
{
AddButton(549, 65, 9906, 9908, 0, GumpButtonType.Page, down);
}
if (left > 0)
{
AddButton(523, 50, 9909, 9911, 0, GumpButtonType.Page, left);
}
if (right > 0)
{
AddButton(575, 50, 9903, 9905, 0, GumpButtonType.Page, right);
}
}
/// <summary>
/// Damn I've forgotten...
/// </summary>
public static int CalculateColumns(int i)
{
switch (i)
{
case 7:
case 4:
case 1:
return 0;
case 8:
case 5:
case 2:
return 3;
default:
return 6;
}
}
/// <summary>
/// Same as above! =(
/// </summary>
public static int CalculateRows(int i)
{
if (i >= 1 && i <= 3)
{
return 0;
}
if (i >= 4 && i <= 6)
{
return 5;
}
return 10;
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using Server.Items;
using Server.Commands;
namespace Server.Commands
{
public class UOGatewayVote
{
string URL;
public static void Initialize()
{
CommandSystem.Register("Vote", AccessLevel.Player, new CommandEventHandler(UOGatewayVote_OnCommand));
}
[Usage("Vote")]
public static void UOGatewayVote_OnCommand(CommandEventArgs e)
{
string URL = "https://www.uogateway.com/shard.php?id=1246&act=vote";
Mobile from = e.Mobile;
from.SendMessage("Thank you for voteing");
from.LaunchBrowser(URL);
}
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace UOPingServer
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("#################################");
Console.WriteLine("### Ultima Online Ping Server ###");
Console.WriteLine("### Created by aj9251 ###");
Console.WriteLine("#################################");
UdpClient receivingUdpClient = new UdpClient(12000);
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
while (true)
{
try
{
// Blocks until a message returns on this socket from a remote host.
Byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIpEndPoint);
IPAddress IP = RemoteIpEndPoint.Address;
int Port = RemoteIpEndPoint.Port;
int bytes = receiveBytes.Length;
string data = Encoding.ASCII.GetString(receiveBytes);
Console.WriteLine("[" + System.DateTime.Now.Hour.ToString().PadLeft(2, '0') + ":" +
System.DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" +
System.DateTime.Now.Second.ToString().PadLeft(2, '0') + "] " + IP.ToString() +
":" + Port.ToString() + " - " +
bytes + " bytes - Data:" + data);
receivingUdpClient.Send(receiveBytes, receiveBytes.Length, RemoteIpEndPoint);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
}