Merge branch 'develop' of github.com:kamronbatman/ModernUO into develop
This commit is contained in:
commit
0993c03b70
1140 changed files with 18133 additions and 26312 deletions
8
.editorconfig
Normal file
8
.editorconfig
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=crlf
|
||||
trim_trailing_whitespace=true
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
|
||||
2
GOALS.md
2
GOALS.md
|
|
@ -44,7 +44,7 @@
|
|||
- [ ] Naked corpses (container display issue)
|
||||
- [X] Rounding errors with new bank system
|
||||
- [ ] Replace `double` with `int` for skills to fix rounding errors and optimize code
|
||||
- [ ] Replace specific checks for `Item`/`Mobile` by extended `IEntity` and mainstreaming the `NEWPARENT` code
|
||||
- [X] Replace specific checks for `Item`/`Mobile` by extended `IEntity` and mainstreaming the `NEWPARENT` code
|
||||
- [ ] TryDropItem dropping items until it fails when it should be all-or-nothing
|
||||
- [ ] Consuming items are deleted directly in several places instead of using `Item.Consume()`
|
||||
- [ ] Content displaying for newer clients is not working properly in several situations
|
||||
|
|
|
|||
63
README.md
63
README.md
|
|
@ -1,30 +1,33 @@
|
|||
ModernUO
|
||||
=====
|
||||
|
||||
### Goals
|
||||
- See [Goals](./GOALS.md)
|
||||
|
||||
### Requirements
|
||||
- .NET Framework 4.7 or Mono 5.10+
|
||||
- zlib (Linux only)
|
||||
- [DotNetCompilerPlatform](https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform) v2.0+ (Windows Only)
|
||||
|
||||
### Building using Visual Studio (Recommended)
|
||||
- Build `Server` project
|
||||
- Building with Visual Studio for Windows will install `DotNetCompilerPlatform` automatically.
|
||||
|
||||
### Building for Windows (Without Visual Studio)
|
||||
`C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /optimize /unsafe /t:exe /out:RunUO.exe /win32icon:Server\runuo.ico /d:NEWTIMERS /d:NEWPARENT /recurse:Server\\*.cs`
|
||||
- DotNetCompilerPlatform must be installed with the `csc.exe` file in the `roslyn` folder at the root of the repository.
|
||||
|
||||
### Building for Mac/Linux (Without Visual Studio)
|
||||
`mcs -optimize+ -unsafe -t:exe -out:RunUO.exe -win32icon:Server/runuo.ico -nowarn:219,414 -d:NEWTIMERS -d:NEWPARENT -d:MONO -reference:System.Drawing -recurse:Server/*.cs`
|
||||
|
||||
### Running on Mac/Linux (MONO)
|
||||
`mono RunUO.exe`
|
||||
|
||||
### Troubleshooting / FAQ
|
||||
|
||||
#### Scripts fail to compile on Windows
|
||||
This is usually caused nuget packages not being installed. Install the required packages and rebuild the Server project.
|
||||
Note: The required nuget packages can be set to automatically restore on build with this [setting](https://docs.microsoft.com/en-us/nuget/consume-packages/media/restore-01-autorestoreoptions.png)
|
||||
ModernUO
|
||||
=====
|
||||
|
||||
### Contacts
|
||||
[Join Discord Channel](https://discord.gg/VdyCpjQ)
|
||||
|
||||
### Goals
|
||||
- See [Goals](./GOALS.md)
|
||||
|
||||
### Requirements
|
||||
- .NET Framework 4.7 or Mono 5.10+
|
||||
- zlib (Linux only)
|
||||
- [DotNetCompilerPlatform](https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform) v2.0+ (Windows Only)
|
||||
|
||||
### Building using Visual Studio (Recommended)
|
||||
- Build `Server` project
|
||||
- Building with Visual Studio for Windows will install `DotNetCompilerPlatform` automatically.
|
||||
|
||||
### Building for Windows (Without Visual Studio)
|
||||
`C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /optimize /unsafe /t:exe /out:RunUO.exe /win32icon:Server\runuo.ico /d:NEWTIMERS /recurse:Server\\*.cs`
|
||||
- DotNetCompilerPlatform must be installed with the `csc.exe` file in the `roslyn` folder at the root of the repository.
|
||||
|
||||
### Building for Mac/Linux (Without Visual Studio)
|
||||
`mcs -optimize+ -unsafe -t:exe -out:RunUO.exe -win32icon:Server/runuo.ico -nowarn:219,414 -d:NEWTIMERS -d:MONO -recurse:"Server/*".cs`
|
||||
|
||||
### Running on Mac/Linux (MONO)
|
||||
`mono RunUO.exe`
|
||||
|
||||
### Troubleshooting / FAQ
|
||||
|
||||
#### Scripts fail to compile on Windows
|
||||
This is usually caused nuget packages not being installed. Install the required packages and rebuild the Server project.
|
||||
Note: The required nuget packages can be set to automatically restore on build with this [setting](https://docs.microsoft.com/en-us/nuget/consume-packages/media/restore-01-autorestoreoptions.png)
|
||||
|
|
|
|||
71
RUNUO_MIGRATIONS.md
Normal file
71
RUNUO_MIGRATIONS.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
### Migrating from RunUO 2.0
|
||||
There are several considerations before migration from RunUO 2.0 to ModernUO.
|
||||
Many of these issues can be fixed by writing scripts that do world file fixes.
|
||||
Others will require careful code review to fix compile/runtime issues.
|
||||
|
||||
#### Deserialization Issues
|
||||
* All BODs will fail to deserialize due to the introduction of BaseBOD
|
||||
* Serial is now a `uint` which could break certain scripts expecting negative numbers or fixed encoding.
|
||||
|
||||
#### Constructor Inheritence Issues
|
||||
* Items that inherit `Food` will pass the wrong arguments to their parent constructor.
|
||||
* Items that inherit spells or scrolls will pass the wrong arguments to their parent constructors.
|
||||
|
||||
#### Code Changes (Possible Compile Errors)
|
||||
* The following functions no longer take a Type as their argument and now utilize generics:
|
||||
* CanBeginAction, BeginAction and EndAction
|
||||
* FindRegion and IsPartOf
|
||||
* FindGump, HasGump, and CloseGump
|
||||
* Timers use lambda functions instead of callback objects with generic `object state` argument.
|
||||
* Various functions such as `OnAdded` which previously took `object parent` now take `IEntity`
|
||||
* Functions that utilized non-generic structures (ArrayList, etc) have been changed to use generics.
|
||||
|
||||
|
||||
### Future Migration Concerns
|
||||
|
||||
#### Account System
|
||||
* Accounts from the XML format will need to be migrated to the new database.
|
||||
* IP Logs from the Accounts XML will need to be offloaded to a new database.
|
||||
|
||||
#### Deserialization
|
||||
* All layered/stackable items will need to be migrated/fixed since the new hierarchy will look like this:
|
||||
* Item -> LayeredItem -> Armor/Weapon/etc
|
||||
* Item -> StackableItem -> Food/etc
|
||||
* All resources including but not limited to the following will need to be migrated:
|
||||
* Gold, Silver, Platinum
|
||||
* Arrow, Bolt, Feature, Shaft
|
||||
* BaseOre, BaseIngot, BaseScale and all children
|
||||
* BigFish, Fish, MagicFish
|
||||
* Granite, Sand
|
||||
* BaseReagent and all children
|
||||
* BoltOfCloth, Bone, Cloth, Cotton, Flax, BaseHides, BaseLeather, UncutCloth, Wool, YarnAndThreads and all children
|
||||
* ML Resources (Check Scripts/Items/Resources/MiscMLResources.cs on RunUO 2.0)
|
||||
* Log and Board
|
||||
* Bottle
|
||||
* Solen Items (e.g. ZoogiFungus)
|
||||
* Other commodity types I can't remember
|
||||
* Spawners will need to be migrated since the old Spawner has been replaced and deserialization is not guaranteed.
|
||||
|
||||
#### Timers
|
||||
* Scripts that rely on Timers, TimerPriority, etc will need to be fixed to work with the format.
|
||||
|
||||
#### Skills
|
||||
* Scripts that use or do math against `double` type Skill values will need to be fixed.
|
||||
|
||||
#### Fastwalk
|
||||
* Other fastwalk/speedhack detection systems will need to be deleted or fixed.
|
||||
|
||||
#### Reports
|
||||
* These will be removed.
|
||||
|
||||
#### RemoteAdmin
|
||||
* This will also be removed. Discussion about a replacement as a plug-in is encouraged.
|
||||
|
||||
#### MyRunUO
|
||||
* This will be removed. Discussion about a replacement using an external database is encouraged.
|
||||
|
||||
#### EventLog
|
||||
* This will be changed to be cross platform compatible. What form it will take is still up for discussion.
|
||||
|
||||
#### Packets (Maybe)
|
||||
* Packets will be changed to be stateless functions that do not require instantiation.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<gcServer enabled="true" />
|
||||
</runtime>
|
||||
<!--
|
||||
MONO/Linux users will need to uncomment and modify the following line:
|
||||
-->
|
||||
<!--<dllmap dll="libz" target="/lib/x86_64-linux-gnu/libz.so.1" />-->
|
||||
</configuration>
|
||||
|
|
@ -11,7 +11,7 @@ using Server.Network;
|
|||
|
||||
namespace Server.Accounting
|
||||
{
|
||||
public class Account : IAccount, IComparable, IComparable<Account>
|
||||
public class Account : IAccount, IComparable<Account>
|
||||
{
|
||||
public static readonly TimeSpan YoungDuration = TimeSpan.FromHours( 40.0 );
|
||||
|
||||
|
|
@ -72,20 +72,14 @@ namespace Server.Accounting
|
|||
/// <summary>
|
||||
/// List of account comments. Type of contained objects is AccountComment.
|
||||
/// </summary>
|
||||
public List<AccountComment> Comments
|
||||
{
|
||||
get { if ( m_Comments == null ) m_Comments = new List<AccountComment>(); return m_Comments; }
|
||||
}
|
||||
public List<AccountComment> Comments => m_Comments ?? (m_Comments = new List<AccountComment>());
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// List of account tags. Type of contained objects is AccountTag.
|
||||
/// </summary>
|
||||
public List<AccountTag> Tags
|
||||
{
|
||||
get { if ( m_Tags == null ) m_Tags = new List<AccountTag>(); return m_Tags; }
|
||||
}
|
||||
public List<AccountTag> Tags => m_Tags ?? (m_Tags = new List<AccountTag>());
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Account username. Case insensitive validation.
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
|
@ -136,10 +130,7 @@ namespace Server.Accounting
|
|||
if ( !isBanned )
|
||||
return false;
|
||||
|
||||
DateTime banTime;
|
||||
TimeSpan banDuration;
|
||||
|
||||
if ( GetBanTags( out banTime, out banDuration ) )
|
||||
if ( GetBanTags( out DateTime banTime, out TimeSpan banDuration ) )
|
||||
{
|
||||
if ( banDuration != TimeSpan.MaxValue && DateTime.UtcNow >= ( banTime + banDuration ) )
|
||||
{
|
||||
|
|
@ -164,11 +155,8 @@ namespace Server.Accounting
|
|||
{
|
||||
SetFlag( 1, !value );
|
||||
|
||||
if ( m_YoungTimer != null )
|
||||
{
|
||||
m_YoungTimer.Stop();
|
||||
m_YoungTimer = null;
|
||||
}
|
||||
m_YoungTimer?.Stop();
|
||||
m_YoungTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -704,9 +692,7 @@ namespace Server.Accounting
|
|||
{
|
||||
if ( count < list.Length )
|
||||
{
|
||||
IPAddress address;
|
||||
|
||||
if ( IPAddress.TryParse( Utility.GetText( ip, null ), out address ) )
|
||||
if ( IPAddress.TryParse( Utility.GetText( ip, null ), out IPAddress address ) )
|
||||
{
|
||||
list[count] = Utility.Intern( address );
|
||||
count++;
|
||||
|
|
@ -848,7 +834,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = this[i];
|
||||
|
||||
if ( m != null && m.AccessLevel >= level )
|
||||
if ( m?.AccessLevel >= level )
|
||||
hasAccess = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -991,7 +977,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = m_Mobiles[i];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
xml.WriteStartElement( "char" );
|
||||
xml.WriteAttributeString( "index", i.ToString() );
|
||||
|
|
@ -1002,7 +988,7 @@ namespace Server.Accounting
|
|||
|
||||
xml.WriteEndElement();
|
||||
|
||||
if ( m_Comments != null && m_Comments.Count > 0 )
|
||||
if (m_Comments?.Count > 0)
|
||||
{
|
||||
xml.WriteStartElement( "comments" );
|
||||
|
||||
|
|
@ -1012,7 +998,7 @@ namespace Server.Accounting
|
|||
xml.WriteEndElement();
|
||||
}
|
||||
|
||||
if ( m_Tags != null && m_Tags.Count > 0 )
|
||||
if (m_Tags?.Count > 0)
|
||||
{
|
||||
xml.WriteStartElement( "tags" );
|
||||
|
||||
|
|
@ -1103,7 +1089,7 @@ namespace Server.Accounting
|
|||
{
|
||||
Mobile m = m_Mobiles[index];
|
||||
|
||||
if ( m != null && m.Deleted )
|
||||
if (m?.Deleted == true)
|
||||
{
|
||||
m.Account = null;
|
||||
m_Mobiles[index] = m = null;
|
||||
|
|
@ -1135,28 +1121,14 @@ namespace Server.Accounting
|
|||
}
|
||||
|
||||
public int CompareTo( Account other )
|
||||
{
|
||||
if ( other == null )
|
||||
return 1;
|
||||
|
||||
return Username.CompareTo( other.Username );
|
||||
}
|
||||
{
|
||||
return other == null ? 1 : Username.CompareTo( other.Username );
|
||||
}
|
||||
|
||||
public int CompareTo( IAccount other )
|
||||
{
|
||||
if ( other == null )
|
||||
return 1;
|
||||
|
||||
return Username.CompareTo( other.Username );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
if ( obj is Account account )
|
||||
return CompareTo( account );
|
||||
|
||||
throw new ArgumentException();
|
||||
}
|
||||
{
|
||||
return other == null ? 1 : Username.CompareTo( other.Username );
|
||||
}
|
||||
|
||||
#region Gold Account
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -303,4 +303,4 @@ namespace Server
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,19 +190,17 @@ namespace Server.Commands
|
|||
|
||||
if (!IsConstructible(ctor, from.AccessLevel))
|
||||
continue;
|
||||
|
||||
|
||||
int totalParams = 0;
|
||||
|
||||
// Handle optional constructors
|
||||
ParameterInfo[] paramList = ctor.GetParameters().Select(param =>
|
||||
{
|
||||
if (param.DefaultValue is DBNull)
|
||||
ParameterInfo[] paramList = ctor.GetParameters();
|
||||
for (int j = 0; j < paramList.Length; j++)
|
||||
if (!paramList[j].HasDefaultValue)
|
||||
totalParams += 1;
|
||||
|
||||
return param;
|
||||
}).ToArray();
|
||||
|
||||
if (args.Length == totalParams)
|
||||
if (args.Length >= totalParams && args.Length <= paramList.Length)
|
||||
{
|
||||
object[] paramValues = ParseValues(paramList, args);
|
||||
|
||||
|
|
@ -223,25 +221,23 @@ namespace Server.Commands
|
|||
{
|
||||
object[] values = new object[paramList.Length];
|
||||
|
||||
for (int i = 0, a = 0; i < paramList.Length; ++i)
|
||||
for (int i = 0, a = 0; i < paramList.Length; i++)
|
||||
{
|
||||
ParameterInfo param = paramList[i];
|
||||
if (param.DefaultValue is DBNull)
|
||||
{
|
||||
object value = ParseValue(param.ParameterType, args[a++], param.DefaultValue);
|
||||
if (value == null)
|
||||
return null;
|
||||
object value = ParseValue(param.ParameterType, a < args.Length ? args[a++] : null);
|
||||
|
||||
if (value != null)
|
||||
values[i] = value;
|
||||
}
|
||||
else
|
||||
else if (param.HasDefaultValue)
|
||||
values[i] = Type.Missing;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public static object ParseValue(Type type, string value, object defaultValue)
|
||||
public static object ParseValue(Type type, string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -250,7 +246,7 @@ namespace Server.Commands
|
|||
if (IsParsable(type)) return ParseParsable(type, value);
|
||||
object obj = value;
|
||||
|
||||
if (value != null && value.StartsWith("0x"))
|
||||
if (value?.StartsWith("0x") == true)
|
||||
{
|
||||
if (IsSignedNumeric(type))
|
||||
obj = Convert.ToInt64(value.Substring(2), 16);
|
||||
|
|
@ -262,7 +258,7 @@ namespace Server.Commands
|
|||
|
||||
if (obj == null && !type.IsValueType)
|
||||
return null;
|
||||
|
||||
|
||||
return Convert.ChangeType(obj, type);
|
||||
}
|
||||
catch
|
||||
|
|
@ -455,7 +451,7 @@ namespace Server.Commands
|
|||
private static void Internal_OnCommand(CommandEventArgs e, bool outline)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
|
||||
if (e.Length >= 1)
|
||||
BoundingBoxPicker.Begin(from, (map, start, end) =>
|
||||
TileBox_Callback(from, map, start, end, new TileState(TileZType.Start, 0, e.Arguments, outline)));
|
||||
|
|
@ -511,7 +507,7 @@ namespace Server.Commands
|
|||
private static void InternalZ_OnCommand(CommandEventArgs e, bool outline)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
|
||||
if (e.Length >= 2)
|
||||
{
|
||||
string[] subArgs = new string[e.Length - 1];
|
||||
|
|
@ -532,7 +528,7 @@ namespace Server.Commands
|
|||
private static void InternalAvg_OnCommand(CommandEventArgs e, bool outline)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
|
||||
if (e.Length >= 1)
|
||||
BoundingBoxPicker.Begin(from, (map, start, end) =>
|
||||
TileBox_Callback(from, map, start, end, new TileState(TileZType.MapAverage, 0, e.Arguments, outline)));
|
||||
|
|
@ -630,10 +626,7 @@ namespace Server.Commands
|
|||
{
|
||||
object[] attrs = ctor.GetCustomAttributes(m_ConstructibleType, false);
|
||||
|
||||
if (attrs.Length == 0)
|
||||
return false;
|
||||
|
||||
return accessLevel >= ((ConstructibleAttribute)attrs[0]).AccessLevel;
|
||||
return attrs.Length != 0 && accessLevel >= ((ConstructibleAttribute)attrs[0]).AccessLevel;
|
||||
}
|
||||
|
||||
public static bool IsEnum(Type type)
|
||||
|
|
@ -701,4 +694,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Server.Commands.Generic;
|
||||
|
|
@ -308,7 +307,7 @@ namespace Server.Commands
|
|||
|
||||
for (int i = m_Batch.BatchCommands.Count - 1; i >= 0; --i)
|
||||
{
|
||||
BatchCommand sc = (BatchCommand)m_Batch.BatchCommands[i];
|
||||
BatchCommand sc = m_Batch.BatchCommands[i];
|
||||
|
||||
entry = info.GetTextEntry(1 + i * 2);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
using Server.Items;
|
||||
|
|
@ -429,7 +430,7 @@ namespace Server.Commands
|
|||
int indexOf = m_Params[i].IndexOf('=');
|
||||
|
||||
if (indexOf >= 0)
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf), 100, 1);
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
}
|
||||
else if (m_Params[i].StartsWith("MinDelay"))
|
||||
{
|
||||
|
|
@ -901,12 +902,11 @@ namespace Server.Commands
|
|||
{
|
||||
eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z == z && item.ItemID == itemID)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
if (eable.Any(item => item.Z == z && item.ItemID == itemID))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
|
@ -989,7 +989,7 @@ namespace Server.Commands
|
|||
{
|
||||
List<DecorationList> list = new List<DecorationList>();
|
||||
DecorationList v;
|
||||
|
||||
|
||||
while ((v = Read(ip)) != null)
|
||||
list.Add(v);
|
||||
|
||||
|
|
@ -1066,11 +1066,9 @@ namespace Server.Commands
|
|||
{
|
||||
public DecorationEntry(string line)
|
||||
{
|
||||
string x, y, z;
|
||||
|
||||
Pop(out x, ref line);
|
||||
Pop(out y, ref line);
|
||||
Pop(out z, ref line);
|
||||
Pop(out string x, ref line);
|
||||
Pop(out string y, ref line);
|
||||
Pop(out string z, ref line);
|
||||
|
||||
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
|
||||
Extra = line;
|
||||
|
|
@ -1096,4 +1094,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
using Server.Items;
|
||||
|
|
@ -427,7 +428,7 @@ namespace Server.Commands
|
|||
int indexOf = m_Params[i].IndexOf('=');
|
||||
|
||||
if (indexOf >= 0)
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf), 100, 1);
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
}
|
||||
else if (m_Params[i].StartsWith("MinDelay"))
|
||||
{
|
||||
|
|
@ -899,12 +900,11 @@ namespace Server.Commands
|
|||
{
|
||||
eable = map.GetItemsInRange(new Point3D(x, y, z), 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z == z && item.ItemID == itemID)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
if (eable.Any(item => item.Z == z && item.ItemID == itemID))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
|
@ -1064,11 +1064,9 @@ namespace Server.Commands
|
|||
{
|
||||
public DecorationEntryMag(string line)
|
||||
{
|
||||
string x, y, z;
|
||||
|
||||
Pop(out x, ref line);
|
||||
Pop(out y, ref line);
|
||||
Pop(out z, ref line);
|
||||
Pop(out string x, ref line);
|
||||
Pop(out string y, ref line);
|
||||
Pop(out string z, ref line);
|
||||
|
||||
Location = new Point3D(Utility.ToInt32(x), Utility.ToInt32(y), Utility.ToInt32(z));
|
||||
Extra = line;
|
||||
|
|
@ -1094,4 +1092,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,11 +229,9 @@ namespace Server.Commands
|
|||
StringBuilder nameBuilder = new StringBuilder(rootType);
|
||||
StringBuilder fnamBuilder = new StringBuilder("docs/types/" + SanitizeType(rootType));
|
||||
StringBuilder linkBuilder;
|
||||
if (DontLink(type)) //if ( DontLink( rootType ) )
|
||||
linkBuilder = new StringBuilder("<font color=\"blue\">" + rootType + "</font>");
|
||||
else
|
||||
linkBuilder =
|
||||
new StringBuilder("<a href=\"" + "@directory@" + rootType + "-T-.html\">" + rootType + "</a>");
|
||||
linkBuilder = DontLink(type) ?
|
||||
new StringBuilder("<font color=\"blue\">" + rootType + "</font>") :
|
||||
new StringBuilder("<a href=\"" + "@directory@" + rootType + "-T-.html\">" + rootType + "</a>");
|
||||
|
||||
nameBuilder.Append("<");
|
||||
fnamBuilder.Append("-");
|
||||
|
|
@ -272,10 +270,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
if (name == null)
|
||||
typeName = type.Name;
|
||||
else
|
||||
typeName = name;
|
||||
typeName = name ?? type.Name;
|
||||
|
||||
if (fnam == null) fileName = "docs/types/" + SanitizeType(type.Name) + ".html";
|
||||
else fileName = fnam + ".html";
|
||||
|
|
@ -300,7 +295,8 @@ namespace Server.Commands
|
|||
{
|
||||
bool anonymousType = name.Contains("<");
|
||||
StringBuilder sb = new StringBuilder(name);
|
||||
for (int i = 0; i < ReplaceChars.Length; ++i) sb.Replace(ReplaceChars[i], '-');
|
||||
for (int i = 0; i < ReplaceChars.Length; ++i)
|
||||
sb.Replace(ReplaceChars[i], '-');
|
||||
|
||||
if (anonymousType) return "(Anonymous-Type)" + sb;
|
||||
return sb.ToString();
|
||||
|
|
@ -396,7 +392,8 @@ namespace Server.Commands
|
|||
v = 1;
|
||||
}
|
||||
|
||||
if (v == 0) v = GetNameFrom(aCtor, aProp, aMethod).CompareTo(GetNameFrom(bCtor, bProp, bMethod));
|
||||
if (v == 0)
|
||||
v = GetNameFrom(aCtor, aProp, aMethod).CompareTo(GetNameFrom(bCtor, bProp, bMethod));
|
||||
|
||||
if (v == 0 && aCtor != null && bCtor != null)
|
||||
v = aCtor.GetParameters().Length.CompareTo(bCtor.GetParameters().Length);
|
||||
|
|
@ -418,7 +415,7 @@ namespace Server.Commands
|
|||
MethodInfo getMethod = prop.GetGetMethod();
|
||||
MethodInfo setMethod = prop.GetGetMethod();
|
||||
|
||||
return getMethod != null && getMethod.IsStatic || setMethod != null && setMethod.IsStatic;
|
||||
return getMethod?.IsStatic == true || setMethod?.IsStatic == true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -426,13 +423,7 @@ namespace Server.Commands
|
|||
|
||||
private string GetNameFrom(ConstructorInfo ctor, PropertyInfo prop, MethodInfo method)
|
||||
{
|
||||
if (ctor != null)
|
||||
return ctor.DeclaringType?.Name ?? "";
|
||||
if (prop != null)
|
||||
return prop.Name;
|
||||
if (method != null)
|
||||
return method.Name;
|
||||
return "";
|
||||
return ctor?.DeclaringType?.Name ?? prop?.Name ?? method?.Name ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -440,14 +431,8 @@ namespace Server.Commands
|
|||
{
|
||||
public int Compare(TypeInfo x, TypeInfo y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return x.TypeName.CompareTo(y.TypeName);
|
||||
return x == null && y == null ? 0 : x == null ? -1 : y == null ? 1 :
|
||||
x.TypeName.CompareTo(y.TypeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1194,14 +1179,14 @@ namespace Server.Commands
|
|||
html.WriteLine(" </table></td></tr></table>");
|
||||
}
|
||||
|
||||
private static void DocumentTailorBOD(StreamWriter html, List<Item> items, string amt, BulkMaterialType material,
|
||||
private static void DocumentTailorBOD(StreamWriter html, List<RewardItem> items, string amt, BulkMaterialType material,
|
||||
Type type)
|
||||
{
|
||||
bool[] rewards = new bool[20];
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item item = items[i];
|
||||
Item item = items[i].Construct();
|
||||
|
||||
if (item is Sandals)
|
||||
{
|
||||
|
|
@ -1471,13 +1456,13 @@ namespace Server.Commands
|
|||
html.WriteLine(" </table></td></tr></table>");
|
||||
}
|
||||
|
||||
private static void DocumentSmithBOD(StreamWriter html, List<Item> items, string amt, BulkMaterialType material)
|
||||
private static void DocumentSmithBOD(StreamWriter html, List<RewardItem> items, string amt, BulkMaterialType material)
|
||||
{
|
||||
bool[] rewards = new bool[24];
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item item = items[i];
|
||||
Item item = items[i].Construct();
|
||||
|
||||
if (item is SturdyPickaxe || item is SturdyShovel)
|
||||
{
|
||||
|
|
@ -2463,7 +2448,7 @@ namespace Server.Commands
|
|||
|
||||
int extendCount = 0;
|
||||
|
||||
if (baseType != null && baseType != typeof(object) && baseType != typeof(ValueType) && !baseType.IsPrimitive)
|
||||
if (baseType != typeof(object) && baseType != typeof(ValueType) && baseType?.IsPrimitive == false)
|
||||
{
|
||||
typeHtml.Write(" : ");
|
||||
|
||||
|
|
@ -2575,7 +2560,7 @@ namespace Server.Commands
|
|||
MethodInfo getMethod = pi.GetGetMethod();
|
||||
MethodInfo setMethod = pi.GetSetMethod();
|
||||
|
||||
if (getMethod != null && getMethod.IsStatic || setMethod != null && setMethod.IsStatic)
|
||||
if (getMethod?.IsStatic == true || setMethod?.IsStatic == true)
|
||||
html.Write(StaticString);
|
||||
|
||||
html.Write(GetPair(pi.PropertyType, pi.Name, false));
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace Server.Commands
|
|||
|
||||
ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes);
|
||||
|
||||
return ctor != null && ctor.IsDefined(typeofConstructible, false);
|
||||
return ctor?.IsDefined(typeofConstructible, false) == true;
|
||||
}
|
||||
|
||||
private static void AddTypes(Assembly asm, List<Type> types)
|
||||
|
|
@ -399,4 +399,4 @@ namespace Server.Commands
|
|||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Server.Commands.Generic
|
|||
PropertyInfo[] chain = Properties.GetPropertyInfoChain(m_From, obj.GetType(), m_Columns[i],
|
||||
PropertyAccess.Read, ref failReason);
|
||||
|
||||
if (chain != null && chain.Length > 0)
|
||||
if (chain?.Length > 0)
|
||||
{
|
||||
m_Columns[i] = "";
|
||||
|
||||
|
|
@ -565,4 +565,4 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,93 +90,93 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void Acquire(TypeBuilder typeBuilder, ILGenerator il, string fieldName)
|
||||
{
|
||||
if (Value is string toParse)
|
||||
{
|
||||
if (!Type.IsValueType && toParse == "null")
|
||||
{
|
||||
Value = null;
|
||||
}
|
||||
else if (Type == typeof(string))
|
||||
{
|
||||
if (toParse == @"@""null""")
|
||||
toParse = "null";
|
||||
if (!(Value is string toParse))
|
||||
return;
|
||||
|
||||
Value = toParse;
|
||||
}
|
||||
else if (Type.IsEnum)
|
||||
if (!Type.IsValueType && toParse == "null")
|
||||
{
|
||||
Value = null;
|
||||
}
|
||||
else if (Type == typeof(string))
|
||||
{
|
||||
if (toParse == @"@""null""")
|
||||
toParse = "null";
|
||||
|
||||
Value = toParse;
|
||||
}
|
||||
else if (Type.IsEnum)
|
||||
{
|
||||
Value = Enum.Parse(Type, toParse, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseMethod;
|
||||
object[] parseArgs;
|
||||
|
||||
MethodInfo parseNumber = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string), typeof(NumberStyles) },
|
||||
null
|
||||
);
|
||||
|
||||
if (parseNumber != null)
|
||||
{
|
||||
Value = Enum.Parse(Type, toParse, true);
|
||||
NumberStyles style = NumberStyles.Integer;
|
||||
|
||||
if (Insensitive.StartsWith(toParse, "0x"))
|
||||
{
|
||||
style = NumberStyles.HexNumber;
|
||||
toParse = toParse.Substring(2);
|
||||
}
|
||||
|
||||
parseMethod = parseNumber;
|
||||
parseArgs = new object[] { toParse, style };
|
||||
}
|
||||
else
|
||||
{
|
||||
MethodInfo parseMethod;
|
||||
object[] parseArgs;
|
||||
|
||||
MethodInfo parseNumber = Type.GetMethod(
|
||||
MethodInfo parseGeneral = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string), typeof(NumberStyles) },
|
||||
new[] { typeof(string) },
|
||||
null
|
||||
);
|
||||
|
||||
if (parseNumber != null)
|
||||
{
|
||||
NumberStyles style = NumberStyles.Integer;
|
||||
parseMethod = parseGeneral;
|
||||
parseArgs = new object[] { toParse };
|
||||
}
|
||||
|
||||
if (Insensitive.StartsWith(toParse, "0x"))
|
||||
{
|
||||
style = NumberStyles.HexNumber;
|
||||
toParse = toParse.Substring(2);
|
||||
}
|
||||
if (parseMethod != null)
|
||||
{
|
||||
Value = parseMethod.Invoke(null, parseArgs);
|
||||
|
||||
parseMethod = parseNumber;
|
||||
parseArgs = new object[] { toParse, style };
|
||||
}
|
||||
else
|
||||
if (!Type.IsPrimitive)
|
||||
{
|
||||
MethodInfo parseGeneral = Type.GetMethod(
|
||||
"Parse",
|
||||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string) },
|
||||
null
|
||||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
parseMethod = parseGeneral;
|
||||
parseArgs = new object[] { toParse };
|
||||
}
|
||||
|
||||
if (parseMethod != null)
|
||||
{
|
||||
Value = parseMethod.Invoke(null, parseArgs);
|
||||
|
||||
if (!Type.IsPrimitive)
|
||||
{
|
||||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.Emit(OpCodes.Ldstr, toParse);
|
||||
|
||||
if (parseArgs.Length == 2) // dirty evil hack :-(
|
||||
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
||||
|
||||
il.Emit(OpCodes.Call, parseMethod);
|
||||
il.Emit(OpCodes.Stfld, Field);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.Emit(OpCodes.Ldstr, toParse);
|
||||
|
||||
if (parseArgs.Length == 2) // dirty evil hack :-(
|
||||
il.Emit(OpCodes.Ldc_I4, (int)parseArgs[1]);
|
||||
|
||||
il.Emit(OpCodes.Call, parseMethod);
|
||||
il.Emit(OpCodes.Stfld, Field);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -542,4 +542,4 @@ namespace Server.Commands.Generic
|
|||
return (IConditional)Activator.CreateInstance(conditionalType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -36,28 +37,15 @@ namespace Server.Commands.Generic
|
|||
if (!CheckObjectTypes(from, command, ext, out bool items, out bool mobiles))
|
||||
return;
|
||||
|
||||
IPooledEnumerable<IEntity> eable;
|
||||
|
||||
if (items || mobiles)
|
||||
eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
else
|
||||
if (!(items || mobiles))
|
||||
return;
|
||||
|
||||
eable.Free();
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInBounds(rect, items, mobiles);
|
||||
|
||||
List<object> objs = new List<object>();
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
{
|
||||
if (mobiles && obj is Mobile && !BaseCommand.IsAccessible(from, obj))
|
||||
continue;
|
||||
|
||||
if (ext.IsValid(obj))
|
||||
objs.Add(obj);
|
||||
}
|
||||
List<object> objs = eable.Where(obj => !mobiles || !(obj is Mobile) || BaseCommand.IsAccessible(from, obj))
|
||||
.Where(obj => ext.IsValid(obj)).Cast<object>().ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
ext.Filter(objs);
|
||||
|
||||
RunCommand(from, objs, command, args);
|
||||
|
|
@ -68,4 +56,4 @@ namespace Server.Commands.Generic
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server.Commands
|
|||
}
|
||||
|
||||
[Usage("SpeedBoost [true|false]")]
|
||||
[Description("Enables a speed boost for the invoker. Disable with paramaters.")]
|
||||
[Description("Enables a speed boost for the invoker. Disable with parameters.")]
|
||||
private static void SpeedBoost_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
|
@ -299,7 +299,7 @@ namespace Server.Commands
|
|||
|
||||
for (int i = 0; i < pets.Count; ++i)
|
||||
{
|
||||
Mobile pet = (Mobile)pets[i];
|
||||
Mobile pet = pets[i];
|
||||
|
||||
if (pet is IMount mount)
|
||||
mount.Rider = null; // make sure it's dismounted
|
||||
|
|
@ -410,18 +410,20 @@ namespace Server.Commands
|
|||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item)
|
||||
{
|
||||
return map == null || map == Map.Internal && item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
|
||||
return map != null && map != Map.Internal || item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
|
||||
}
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Mobile m)
|
||||
{
|
||||
if (map == null || map == Map.Internal)
|
||||
bool validMap = map != null && map != Map.Internal;
|
||||
|
||||
if (!validMap)
|
||||
{
|
||||
map = m.LogoutMap;
|
||||
loc = m.LogoutLocation;
|
||||
}
|
||||
|
||||
return map != null && map != Map.Internal;
|
||||
return validMap;
|
||||
}
|
||||
|
||||
[Usage("Go [name | serial | (x y [z]) | (deg min (N | S) deg min (E | W))]")]
|
||||
|
|
@ -676,7 +678,7 @@ namespace Server.Commands
|
|||
{
|
||||
Mobile m = state.Mobile;
|
||||
|
||||
if (m != null && m.AccessLevel >= ac)
|
||||
if (m?.AccessLevel >= ac)
|
||||
m.SendMessage(hue, message);
|
||||
}
|
||||
}
|
||||
|
|
@ -957,4 +959,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,12 +337,7 @@ namespace Server.Commands
|
|||
|
||||
public class CommandInfoGump : Gump
|
||||
{
|
||||
public CommandInfoGump(CommandInfo info)
|
||||
: this(info, 320, 200)
|
||||
{
|
||||
}
|
||||
|
||||
public CommandInfoGump(CommandInfo info, int width, int height)
|
||||
public CommandInfoGump(CommandInfo info, int width = 320, int height = 200)
|
||||
: base(300, 50)
|
||||
{
|
||||
AddPage(0);
|
||||
|
|
@ -352,7 +347,7 @@ namespace Server.Commands
|
|||
//AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
//AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
//AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false );
|
||||
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000), false, false);
|
||||
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000));
|
||||
|
||||
//AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
//AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
|
@ -365,7 +360,7 @@ namespace Server.Commands
|
|||
|
||||
string[] aliases = info.Aliases;
|
||||
|
||||
if (aliases != null && aliases.Length != 0)
|
||||
if (aliases?.Length > 0)
|
||||
{
|
||||
sb.Append($"Alias{(aliases.Length == 1 ? "" : "es")}: ");
|
||||
|
||||
|
|
@ -404,4 +399,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Commands
|
|||
ReadWrite = Read | Write
|
||||
}
|
||||
|
||||
public class Properties
|
||||
public static class Properties
|
||||
{
|
||||
private static Type typeofCPA = typeof(CPA);
|
||||
|
||||
|
|
@ -174,10 +174,7 @@ namespace Server.Commands
|
|||
{
|
||||
PropertyInfo[] chain = GetPropertyInfoChain(from, obj.GetType(), propertyName, access, ref failReason);
|
||||
|
||||
if (chain == null)
|
||||
return null;
|
||||
|
||||
return GetPropertyInfo(ref obj, chain, ref failReason);
|
||||
return chain == null ? null : GetPropertyInfo(ref obj, chain, ref failReason);
|
||||
}
|
||||
|
||||
public static PropertyInfo GetPropertyInfo(ref object obj, PropertyInfo[] chain, ref string failReason)
|
||||
|
|
@ -216,21 +213,19 @@ namespace Server.Commands
|
|||
|
||||
PropertyInfo p = GetPropertyInfo(ref o, chain, ref failReason);
|
||||
|
||||
if (p == null)
|
||||
return failReason;
|
||||
|
||||
return InternalGetValue(o, p, chain);
|
||||
return p == null ? failReason : InternalGetValue(o, p, chain);
|
||||
}
|
||||
|
||||
public static string IncreaseValue(Mobile from, object o, string[] args)
|
||||
{
|
||||
Type type = o.GetType();
|
||||
// Type type = o.GetType();
|
||||
|
||||
object[] realObjs = new object[args.Length / 2];
|
||||
PropertyInfo[] realProps = new PropertyInfo[args.Length / 2];
|
||||
int[] realValues = new int[args.Length / 2];
|
||||
|
||||
bool positive = false, negative = false;
|
||||
bool positive = false;
|
||||
bool negative = false;
|
||||
|
||||
for (int i = 0; i < realProps.Length; ++i)
|
||||
{
|
||||
|
|
@ -315,9 +310,9 @@ namespace Server.Commands
|
|||
if (value == null)
|
||||
toString = "null";
|
||||
else if (IsNumeric(type))
|
||||
toString = string.Format("{0} (0x{0:X})", value);
|
||||
toString = $"{value} (0x{value:X})";
|
||||
else if (IsChar(type))
|
||||
toString = string.Format("'{0}' ({1} [0x{1:X}])", value, (int)value);
|
||||
toString = $"'{value}' ({(int)value} [0x{(int)value:X}])";
|
||||
else if (IsString(type))
|
||||
toString = (string)value == "null" ? @"@""null""" : $"\"{value}\"";
|
||||
else if (IsText(type))
|
||||
|
|
@ -348,10 +343,7 @@ namespace Server.Commands
|
|||
string failReason = "";
|
||||
PropertyInfo p = GetPropertyInfo(from, ref o, name, PropertyAccess.Write, ref failReason);
|
||||
|
||||
if (p == null)
|
||||
return failReason;
|
||||
|
||||
return InternalSetValue(from, logObject, o, p, name, value, true);
|
||||
return p == null ? failReason : InternalSetValue(from, logObject, o, p, name, value, true);
|
||||
}
|
||||
|
||||
private static bool IsSerial(Type t)
|
||||
|
|
@ -524,10 +516,7 @@ namespace Server.Commands
|
|||
object toSet = null;
|
||||
string result = ConstructFromString(p.PropertyType, o, value, ref toSet);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
return SetDirect(from, logobj, o, p, pname, toSet, shouldLog);
|
||||
return result ?? SetDirect(from, logobj, o, p, pname, toSet, shouldLog);
|
||||
}
|
||||
|
||||
public static string InternalSetValue(object o, PropertyInfo p, string value)
|
||||
|
|
@ -535,10 +524,7 @@ namespace Server.Commands
|
|||
object toSet = null;
|
||||
string result = ConstructFromString(p.PropertyType, o, value, ref toSet);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
return SetDirect(o, p, toSet);
|
||||
return result ?? SetDirect(o, p, toSet);
|
||||
}
|
||||
|
||||
private class PropsTarget : Target
|
||||
|
|
@ -639,18 +625,14 @@ namespace Server
|
|||
|
||||
public abstract class ClearanceException : AccessException
|
||||
{
|
||||
protected AccessLevel m_NeededAccess;
|
||||
protected AccessLevel m_PlayerAccess;
|
||||
|
||||
public ClearanceException(Property property, AccessLevel playerAccess, AccessLevel neededAccess, string accessType)
|
||||
: base(property,
|
||||
$"You must be at least {Mobile.GetAccessLevelName(neededAccess)} to {accessType} this property.")
|
||||
{
|
||||
}
|
||||
|
||||
public AccessLevel PlayerAccess => m_PlayerAccess;
|
||||
|
||||
public AccessLevel NeededAccess => m_NeededAccess;
|
||||
public AccessLevel PlayerAccess{ get; set; }
|
||||
public AccessLevel NeededAccess{ get; set; }
|
||||
}
|
||||
|
||||
public sealed class ReadAccessException : ClearanceException
|
||||
|
|
@ -801,4 +783,4 @@ namespace Server
|
|||
return prop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Server.Commands
|
|||
break; // Tokuno Islands
|
||||
}
|
||||
|
||||
for (int j = 0; maps != null && j < maps.Length; ++j)
|
||||
for (int j = 0; maps?.Length >= j; ++j)
|
||||
Add_Static(e.m_ItemID, e.m_Location, maps[j], e.m_Text);
|
||||
}
|
||||
|
||||
|
|
@ -145,4 +145,4 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Commands;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ namespace Server.ContextMenus
|
|||
|
||||
public override void OnClick()
|
||||
{
|
||||
if (m_Food.Deleted || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
||||
if (m_Food?.Deleted != false || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse(m_From))
|
||||
return;
|
||||
|
||||
m_Food.Eat(m_From);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
Scripts/Engines/BulkOrders/BODTarget.cs
Normal file
28
Scripts/Engines/BulkOrders/BODTarget.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BODTarget : Target
|
||||
{
|
||||
private BaseBOD m_Deed;
|
||||
|
||||
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
if (!(targeted is Item item && item.IsChildOf(from.Backpack)))
|
||||
{
|
||||
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
|
||||
return;
|
||||
}
|
||||
|
||||
m_Deed.EndCombine(from, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
153
Scripts/Engines/BulkOrders/BaseBOD.cs
Normal file
153
Scripts/Engines/BulkOrders/BaseBOD.cs
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public abstract class BaseBOD : Item
|
||||
{
|
||||
private int m_AmountMax;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for ( int i = 0; i < chances.Length; ++i )
|
||||
{
|
||||
if ( random < chances[i] )
|
||||
return i == 0 ? BulkMaterialType.None : start + (i - 1);
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public BaseBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material) : this()
|
||||
{
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
RequireExceptional = requireExeptional;
|
||||
Material = material;
|
||||
}
|
||||
|
||||
public BaseBOD() : base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public BaseBOD(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool Complete{ get; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public sealed override int Hue{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get => m_AmountMax;
|
||||
set{ m_AmountMax = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get => m_RequireExceptional;
|
||||
set{ m_RequireExceptional = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get => m_Material;
|
||||
set{ m_Material = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public abstract RewardGroup GetRewardGroup();
|
||||
|
||||
public abstract int ComputeGold();
|
||||
public abstract int ComputeFame();
|
||||
public abstract void EndCombine(Mobile from, Item item);
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
List<RewardItem> rewards = ComputeRewards(false);
|
||||
|
||||
reward = rewards.Count <= 0 ? null : rewards[Utility.Random(rewards.Count)].Construct();
|
||||
}
|
||||
|
||||
public virtual List<RewardItem> ComputeRewards(bool full)
|
||||
{
|
||||
RewardGroup rewardGroup = GetRewardGroup();
|
||||
|
||||
List<RewardItem> list = new List<RewardItem>();
|
||||
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup?.Items.Length; ++i)
|
||||
{
|
||||
RewardItem reward = rewardGroup.Items[i];
|
||||
|
||||
if (reward != null)
|
||||
list.Add(reward);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem reward = rewardGroup.AcquireItem();
|
||||
|
||||
if (reward != null)
|
||||
list.Add(reward);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public virtual void BeginCombine(Mobile from)
|
||||
{
|
||||
if (Complete)
|
||||
from.SendLocalizedMessage(1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
else
|
||||
from.Target = new BODTarget(this);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,33 +94,31 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(5, 424, 10460);
|
||||
AddImage(585, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor, false, false); // Filter Preference
|
||||
AddHtmlLocalized(270, 32, 200, 32, 1062223, LabelColor); // Filter Preference
|
||||
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor, false, false); // Bulk Order Type
|
||||
AddHtmlLocalized(26, 64, 120, 32, 1062228, LabelColor); // Bulk Order Type
|
||||
AddFilterList(25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0);
|
||||
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(320, 64, 50, 32, 1062215, LabelColor); // Quality
|
||||
AddFilterList(320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1);
|
||||
|
||||
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor, false, false); // Material Type
|
||||
AddHtmlLocalized(26, 160, 120, 32, 1062232, LabelColor); // Material Type
|
||||
AddFilterList(25, 192, m_XOffsets_Material, 40, m_MaterialFilters, m_XWidths_Large, f.Material, 2);
|
||||
|
||||
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddHtmlLocalized(26, 320, 120, 32, 1062217, LabelColor); // Amount
|
||||
AddFilterList(25, 352, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3);
|
||||
|
||||
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927, false,
|
||||
false); // Set Book Filter
|
||||
AddButton(40, 416, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(75, 416, 120, 32, 1062477, from.UseOwnFilter ? LabelColor : 16927); // Set Book Filter
|
||||
AddButton(40, 416, 4005, 4007, 1);
|
||||
|
||||
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor, false,
|
||||
false); // Set Your Filter
|
||||
AddButton(200, 416, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(235, 416, 120, 32, 1062478, from.UseOwnFilter ? 16927 : LabelColor); // Set Your Filter
|
||||
AddButton(200, 416, 4005, 4007, 2);
|
||||
|
||||
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor, false, false); // Clear Filter
|
||||
AddButton(370, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(405, 416, 120, 32, 1062231, LabelColor); // Clear Filter
|
||||
AddButton(370, 416, 4005, 4007, 3);
|
||||
|
||||
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor, false, false); // APPLY
|
||||
AddButton(505, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(540, 416, 50, 32, 1011046, LabelColor); // APPLY
|
||||
AddButton(505, 416, 4017, 4018, 0);
|
||||
}
|
||||
|
||||
private void AddFilterList(int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue,
|
||||
|
|
@ -133,15 +131,13 @@ namespace Server.Engines.BulkOrders
|
|||
if (number == 0)
|
||||
continue;
|
||||
|
||||
bool isSelected = filters[i, 1] == filterValue;
|
||||
|
||||
if (!isSelected && i % xOffsets.Length == 0)
|
||||
isSelected = filterValue == 0;
|
||||
bool isSelected = filters[i, 1] == filterValue ||
|
||||
i % xOffsets.Length == 0 && filterValue == 0;
|
||||
|
||||
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset,
|
||||
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false);
|
||||
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor);
|
||||
AddButton(x + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset, 4005, 4007,
|
||||
4 + filterIndex + i * 4, GumpButtonType.Reply, 0);
|
||||
4 + filterIndex + i * 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,4 +217,4 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
VendorItem vi = pv.GetVendorItem(book);
|
||||
|
||||
canBuy = vi != null && !vi.IsForSale;
|
||||
canBuy = vi?.IsForSale == false;
|
||||
}
|
||||
|
||||
int width = 600;
|
||||
|
|
@ -103,45 +103,45 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(5, 424, 10460);
|
||||
AddImage(width - 15, 424, 10460);
|
||||
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor, false, false); // Type
|
||||
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor, false, false); // Item
|
||||
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor, false, false); // Quality
|
||||
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor, false, false); // Material
|
||||
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor, false, false); // Amount
|
||||
AddHtmlLocalized(canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor); // Bulk Order Book
|
||||
AddHtmlLocalized(63, 64, 200, 32, 1062213, LabelColor); // Type
|
||||
AddHtmlLocalized(147, 64, 200, 32, 1062214, LabelColor); // Item
|
||||
AddHtmlLocalized(246, 64, 200, 32, 1062215, LabelColor); // Quality
|
||||
AddHtmlLocalized(336, 64, 200, 32, 1062216, LabelColor); // Material
|
||||
AddHtmlLocalized(429, 64, 200, 32, 1062217, LabelColor); // Amount
|
||||
|
||||
AddButton(35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor, false, false); // Set Filter
|
||||
AddButton(35, 32, 4005, 4007, 1);
|
||||
AddHtmlLocalized(70, 32, 200, 32, 1062476, LabelColor); // Set Filter
|
||||
|
||||
BOBFilter f = from.UseOwnFilter ? from.BOBFilter : book.Filter;
|
||||
|
||||
if (f.IsDefault)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false); // Using No Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927); // Using No Filter
|
||||
else if (from.UseOwnFilter)
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false); // Using Your Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927); // Using Your Filter
|
||||
else
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false); // Using Book Filter
|
||||
AddHtmlLocalized(canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927); // Using Book Filter
|
||||
|
||||
AddButton(375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor, false, false); // EXIT
|
||||
AddButton(375, 416, 4017, 4018, 0);
|
||||
AddHtmlLocalized(410, 416, 120, 20, 1011441, LabelColor); // EXIT
|
||||
|
||||
if (canDrop)
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor, false, false); // Drop
|
||||
AddHtmlLocalized(26, 64, 50, 32, 1062212, LabelColor); // Drop
|
||||
|
||||
if (canPrice)
|
||||
{
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor, false, false); // Price
|
||||
AddHtmlLocalized(516, 64, 200, 32, 1062218, LabelColor); // Price
|
||||
|
||||
if (canBuy)
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor, false, false); // Buy
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062219, LabelColor); // Buy
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor, false, false); // Set
|
||||
AddHtmlLocalized(576, 64, 200, 32, 1062227, LabelColor); // Set
|
||||
|
||||
AddButton(450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false);
|
||||
AddButton(450, 416, 4005, 4007, 4);
|
||||
AddHtml(485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,14 +149,14 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (page > 0)
|
||||
{
|
||||
AddButton(75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor, false, false); // Previous page
|
||||
AddButton(75, 416, 4014, 4016, 2);
|
||||
AddHtmlLocalized(110, 416, 150, 20, 1011067, LabelColor); // Previous page
|
||||
}
|
||||
|
||||
if (GetIndexForPage(page + 1) < list.Count)
|
||||
{
|
||||
AddButton(225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor, false, false); // Next page
|
||||
AddButton(225, 416, 4005, 4007, 3);
|
||||
AddHtmlLocalized(260, 416, 150, 20, 1011066, LabelColor); // Next page
|
||||
}
|
||||
|
||||
for (int i = index; i < index + count && i >= 0 && i < list.Count; ++i)
|
||||
|
|
@ -171,31 +171,31 @@ namespace Server.Engines.BulkOrders
|
|||
int y = 96 + tableIndex * 32;
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && entry.Price > 0)
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, entry.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor, false, false); // Large
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062225, LabelColor); // Large
|
||||
|
||||
for (int j = 0; j < largeEntry.Entries.Length; ++j)
|
||||
{
|
||||
BOBLargeSubEntry sub = largeEntry.Entries[j];
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor, false, false);
|
||||
AddHtmlLocalized(103, y, 130, 32, sub.Number, LabelColor);
|
||||
|
||||
if (entry.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||
|
||||
object name = GetMaterialName(entry.Material, entry.DeedType, sub.ItemType);
|
||||
|
||||
if (name is int intName)
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
|
||||
else
|
||||
AddLabel(316, y, 1152, name.ToString());
|
||||
|
||||
|
|
@ -212,27 +212,27 @@ namespace Server.Engines.BulkOrders
|
|||
int y = 96 + tableIndex++ * 32;
|
||||
|
||||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && smallEntry.Price > 0)
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2, GumpButtonType.Reply, 0);
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, smallEntry.Price.ToString());
|
||||
}
|
||||
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor, false, false); // Small
|
||||
AddHtmlLocalized(61, y, 50, 32, 1062224, LabelColor); // Small
|
||||
|
||||
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor, false, false);
|
||||
AddHtmlLocalized(103, y, 130, 32, smallEntry.Number, LabelColor);
|
||||
|
||||
if (smallEntry.RequireExceptional)
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor, false, false); // exceptional
|
||||
AddHtmlLocalized(235, y, 80, 20, 1060636, LabelColor); // exceptional
|
||||
else
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor, false, false); // normal
|
||||
AddHtmlLocalized(235, y, 80, 20, 1011542, LabelColor); // normal
|
||||
|
||||
object name = GetMaterialName(smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType);
|
||||
|
||||
if (name is int intName)
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor, false, false);
|
||||
AddHtmlLocalized(316, y, 100, 20, intName, LabelColor);
|
||||
else
|
||||
AddLabel(316, y, 1152, name.ToString());
|
||||
|
||||
|
|
@ -242,11 +242,11 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
public bool CheckFilter(IBOBEntry entry)
|
||||
{
|
||||
{
|
||||
if (entry is BOBLargeEntry largeEntry)
|
||||
return CheckFilter(entry.Material, entry.AmountMax, true, entry.RequireExceptional, entry.DeedType,
|
||||
largeEntry.Entries.Length > 0 ? largeEntry.Entries[0].ItemType : null);
|
||||
|
||||
|
||||
if (entry is BOBSmallEntry smallEntry)
|
||||
return CheckFilter(entry.Material, entry.AmountMax, false, entry.RequireExceptional,
|
||||
entry.DeedType, smallEntry.ItemType);
|
||||
|
|
@ -355,7 +355,7 @@ namespace Server.Engines.BulkOrders
|
|||
int count = 0;
|
||||
int page = 0;
|
||||
int i;
|
||||
|
||||
|
||||
List<IBOBEntry> list = m_List;
|
||||
for (i = 0; i < index && i < list.Count; i++)
|
||||
{
|
||||
|
|
@ -510,8 +510,8 @@ namespace Server.Engines.BulkOrders
|
|||
Item item = bobEntry.Reconstruct();
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight))
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
|
|
@ -558,26 +558,26 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
{
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
if (vi?.IsForSale != false)
|
||||
return;
|
||||
|
||||
if (price == 0)
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
|
||||
if (price == 0)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -625,7 +625,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (!m_Book.Entries.Contains(entry))
|
||||
continue;
|
||||
|
||||
|
||||
entry.Price = price;
|
||||
}
|
||||
|
||||
|
|
@ -644,4 +644,4 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.BulkOrders
|
|||
else if (DeedType == BODType.Tailor)
|
||||
bod = new LargeTailorBOD(AmountMax, RequireExceptional, Material, ReconstructEntries());
|
||||
|
||||
for (int i = 0; bod != null && i < bod.Entries.Length; ++i)
|
||||
for (int i = 0; bod?.Entries.Length >= i; ++i)
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
||||
return bod;
|
||||
|
|
@ -103,4 +103,4 @@ namespace Server.Engines.BulkOrders
|
|||
Entries[i].Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
AddBackground(100, 10, 300, 150, 5054);
|
||||
|
||||
AddHtmlLocalized(125, 20, 250, 24, 1019070, false, false); // You have agreed to purchase:
|
||||
AddHtmlLocalized(125, 45, 250, 24, 1045151, false, false); // a bulk order deed
|
||||
AddHtmlLocalized(125, 20, 250, 24, 1019070); // You have agreed to purchase:
|
||||
AddHtmlLocalized(125, 45, 250, 24, 1045151); // a bulk order deed
|
||||
|
||||
AddHtmlLocalized(125, 70, 250, 24, 1019071, false, false); // for the amount of:
|
||||
AddHtmlLocalized(125, 70, 250, 24, 1019071); // for the amount of:
|
||||
AddLabel(125, 95, 0, price.ToString());
|
||||
|
||||
AddButton(250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(282, 130, 100, 24, 1011012, false, false); // CANCEL
|
||||
AddButton(250, 130, 4005, 4007, 1);
|
||||
AddHtmlLocalized(282, 130, 100, 24, 1011012); // CANCEL
|
||||
|
||||
AddButton(120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(152, 130, 100, 24, 1011036, false, false); // OKAY
|
||||
AddButton(120, 130, 4005, 4007, 2);
|
||||
AddHtmlLocalized(152, 130, 100, 24, 1011036); // OKAY
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -57,12 +57,10 @@ namespace Server.Engines.BulkOrders
|
|||
pv.SayTo(m_From, 1062382); // The deed selected is not available.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int price = 0;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi != null && !vi.IsForSale)
|
||||
if (pv.GetVendorItem(m_Book)?.IsForSale == false)
|
||||
price = m_Entry.Price;
|
||||
|
||||
if (price != m_Price)
|
||||
|
|
@ -79,16 +77,17 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
Item item = m_Entry.Reconstruct();
|
||||
|
||||
|
||||
pv.Say(m_From.Name);
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
|
||||
if (pack == null || !pack.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight))
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
item.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -120,4 +119,4 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,23 +64,18 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
|
||||
SecureTradeContainer cont = GetSecureTradeCont();
|
||||
SecureTrade trade = GetSecureTradeCont()?.Trade;
|
||||
|
||||
if ( cont != null )
|
||||
{
|
||||
SecureTrade trade = cont.Trade;
|
||||
|
||||
if ( trade != null && trade.From.Mobile == from )
|
||||
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
|
||||
else if ( trade != null && trade.To.Mobile == from )
|
||||
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
|
||||
}
|
||||
if (trade?.From.Mobile == from )
|
||||
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
|
||||
else if (trade?.To.Mobile == from )
|
||||
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is LargeBOD || dropped is SmallBOD )
|
||||
if ( dropped is BaseBOD )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
|
|
@ -142,7 +137,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers( object parent )
|
||||
public void InvalidateContainers(IEntity parent)
|
||||
{
|
||||
if ( parent is Container c )
|
||||
{
|
||||
|
|
@ -159,9 +154,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
writer.Write( 2 ); // version
|
||||
|
||||
writer.Write( (int) ItemCount );
|
||||
writer.Write( ItemCount );
|
||||
|
||||
writer.Write( (int) Level );
|
||||
|
||||
|
|
@ -169,7 +164,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
writer.WriteEncodedInt( Entries.Count );
|
||||
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,15 +30,11 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public static BulkGenericType Classify(BODType deedType, Type itemType)
|
||||
{
|
||||
if (deedType == BODType.Tailor)
|
||||
{
|
||||
if (itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return BulkGenericType.Leather;
|
||||
if (deedType != BODType.Tailor)
|
||||
return BulkGenericType.Iron;
|
||||
|
||||
return BulkGenericType.Cloth;
|
||||
}
|
||||
|
||||
return BulkGenericType.Iron;
|
||||
return itemType == null || itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes))
|
||||
? BulkGenericType.Leather : BulkGenericType.Cloth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,104 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias( "Scripts.Engines.BulkOrders.LargeBOD" )]
|
||||
public abstract class LargeBOD : Item
|
||||
public abstract class LargeBOD : BaseBOD
|
||||
{
|
||||
private int m_AmountMax;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
private LargeBulkEntry[] m_Entries;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int AmountMax{ get => m_AmountMax;
|
||||
set{ m_AmountMax = value; InvalidateProperties(); } }
|
||||
public LargeBulkEntry[] Entries
|
||||
{
|
||||
get => m_Entries;
|
||||
set{ m_Entries = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional{ get => m_RequireExceptional;
|
||||
set{ m_RequireExceptional = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BulkMaterialType Material{ get => m_Material;
|
||||
set{ m_Material = value; InvalidateProperties(); } }
|
||||
|
||||
public LargeBulkEntry[] Entries{ get => m_Entries;
|
||||
set{ m_Entries = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Complete
|
||||
public override bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
if ( m_Entries[i].Amount < m_AmountMax )
|
||||
if ( m_Entries[i].Amount < AmountMax )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards( bool full );
|
||||
public abstract int ComputeGold();
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards( out Item reward, out int gold, out int fame )
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
List<Item> rewards = ComputeRewards( false );
|
||||
|
||||
if ( rewards.Count > 0 )
|
||||
{
|
||||
reward = rewards[Utility.Random( rewards.Count )];
|
||||
|
||||
for ( int i = 0; i < rewards.Count; ++i )
|
||||
{
|
||||
if ( rewards[i] != reward )
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetRandomMaterial( BulkMaterialType start, double[] chances )
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for ( int i = 0; i < chances.Length; ++i )
|
||||
{
|
||||
if ( random < chances[i] )
|
||||
return ( i == 0 ? BulkMaterialType.None : start + (i - 1) );
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1045151; // a bulk order deed
|
||||
|
||||
public LargeBOD( int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries ) : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries) :
|
||||
base(hue, amountMax, requireExeptional, material)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
m_Entries = entries;
|
||||
}
|
||||
|
||||
public LargeBOD() : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
public LargeBOD()
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
|
|
@ -106,13 +43,13 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
list.Add( 1060655 ); // large bulk order
|
||||
|
||||
if ( m_RequireExceptional )
|
||||
if ( RequireExceptional )
|
||||
list.Add( 1045141 ); // All items must be exceptional.
|
||||
|
||||
if ( m_Material != BulkMaterialType.None )
|
||||
list.Add( LargeBODGump.GetMaterialNumberFor( m_Material ) ); // All items must be made with x material.
|
||||
if ( Material != BulkMaterialType.None )
|
||||
list.Add( LargeBODGump.GetMaterialNumberFor( Material ) ); // All items must be made with x material.
|
||||
|
||||
list.Add( 1060656, m_AmountMax.ToString() ); // amount to make: ~1_val~
|
||||
list.Add( 1060656, AmountMax.ToString() ); // amount to make: ~1_val~
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
list.Add( 1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount ); // ~1_val~: ~2_val~
|
||||
|
|
@ -136,81 +73,70 @@ namespace Server.Engines.BulkOrders
|
|||
from.SendLocalizedMessage( 1045156 ); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
|
||||
public void BeginCombine( Mobile from )
|
||||
{
|
||||
if ( !Complete )
|
||||
from.Target = new LargeBODTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
public override void EndCombine(Mobile from, Item item)
|
||||
{
|
||||
if (!(item is SmallBOD small))
|
||||
{
|
||||
from.SendLocalizedMessage(1045159); // That is not a bulk order.
|
||||
return;
|
||||
}
|
||||
|
||||
public void EndCombine( Mobile from, object o )
|
||||
{
|
||||
if ( o is Item item && item.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( item is SmallBOD small )
|
||||
{
|
||||
LargeBulkEntry entry = null;
|
||||
LargeBulkEntry entry = null;
|
||||
|
||||
for ( int i = 0; entry == null && i < m_Entries.Length; ++i )
|
||||
{
|
||||
if ( m_Entries[i].Details.Type == small.Type )
|
||||
entry = m_Entries[i];
|
||||
}
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
{
|
||||
if (m_Entries[i].Details.Type == small.Type)
|
||||
{
|
||||
entry = m_Entries[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( entry == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045160 ); // That is not a bulk order for this large request.
|
||||
}
|
||||
else if ( m_RequireExceptional && !small.RequireExceptional )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045161 ); // Both orders must be of exceptional quality.
|
||||
}
|
||||
else if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && small.Material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045162 ); // Both orders must use the same ore type.
|
||||
}
|
||||
else if ( m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Barbed && small.Material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049351 ); // Both orders must use the same leather type.
|
||||
}
|
||||
else if ( m_AmountMax != small.AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045163 ); // The two orders have different requested amounts and cannot be combined.
|
||||
}
|
||||
else if ( small.AmountCur < small.AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045164 ); // The order to combine with is not completed.
|
||||
}
|
||||
else if ( entry.Amount >= m_AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Amount += small.AmountCur;
|
||||
small.Delete();
|
||||
if (entry == null)
|
||||
{
|
||||
from.SendLocalizedMessage(1045160); // That is not a bulk order for this large request.
|
||||
}
|
||||
else if (RequireExceptional && !small.RequireExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045161); // Both orders must be of exceptional quality.
|
||||
}
|
||||
else if (Material >= BulkMaterialType.DullCopper && Material <= BulkMaterialType.Valorite &&
|
||||
small.Material != Material)
|
||||
{
|
||||
from.SendLocalizedMessage(1045162); // Both orders must use the same ore type.
|
||||
}
|
||||
else if (Material >= BulkMaterialType.Spined && Material <= BulkMaterialType.Barbed &&
|
||||
small.Material != Material)
|
||||
{
|
||||
from.SendLocalizedMessage(1049351); // Both orders must use the same leather type.
|
||||
}
|
||||
else if (AmountMax != small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045163); // The two orders have different requested amounts and cannot be combined.
|
||||
}
|
||||
else if (small.AmountCur < small.AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(1045164); // The order to combine with is not completed.
|
||||
}
|
||||
else if (entry.Amount >= AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Amount += small.AmountCur;
|
||||
small.Delete();
|
||||
|
||||
from.SendLocalizedMessage( 1045165 ); // The orders have been combined.
|
||||
from.SendLocalizedMessage(1045165); // The orders have been combined.
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
|
||||
from.SendGump( new LargeBODGump( from, this ) );
|
||||
if (!Complete)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Complete )
|
||||
BeginCombine( from );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1045159 ); // That is not a bulk order.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public LargeBOD( Serial serial ) : base( serial )
|
||||
public LargeBOD(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -218,13 +144,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
|
||||
writer.Write( (int) m_Entries.Length );
|
||||
writer.Write( m_Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
|
|
@ -234,16 +156,12 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
|
|
@ -252,15 +170,6 @@ namespace Server.Engines.BulkOrders
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
|
||||
if ( Core.AOS && ItemID == 0x14EF )
|
||||
ItemID = 0x2258;
|
||||
|
||||
if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,48 +30,45 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(20, 225 + entries.Length * 24, 10460);
|
||||
AddImage(430, 225 + entries.Length * 24, 10460);
|
||||
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
|
||||
false); // Ah! Thanks for the goods! Would you help me out?
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF); // Items requested:
|
||||
|
||||
int y = 120;
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i, y += 24)
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
y += 24;
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
|
||||
false); // All items must be made with x material.
|
||||
AddHtmlLocalized(40, y, 350, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF, false,
|
||||
false); // Do you want to accept this order?
|
||||
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1);
|
||||
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF); // Ok
|
||||
|
||||
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0);
|
||||
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -94,6 +91,12 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
if (m_Deed?.Deleted == false)
|
||||
m_Deed.Delete();
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||
{
|
||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||
|
|
@ -104,4 +107,4 @@ namespace Server.Engines.BulkOrders
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(45, 221 + entries.Length * 24, 10460);
|
||||
AddImage(480, 221 + entries.Length * 24, 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF, false, false); // A large bulk order
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF, false, false); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF); // Items requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
|
||||
|
||||
int y = 96;
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server.Engines.BulkOrders
|
|||
LargeBulkEntry entry = entries[i];
|
||||
SmallBulkEntry details = entry.Details;
|
||||
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF);
|
||||
AddLabel(275, y, 0x480, entry.Amount.ToString());
|
||||
|
||||
y += 24;
|
||||
|
|
@ -53,26 +53,24 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
{
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF, false,
|
||||
false); // All items must be made with x material.
|
||||
AddHtmlLocalized(75, y, 300, 20, GetMaterialNumberFor(deed.Material), 0x7FFF); // All items must be made with x material.
|
||||
|
||||
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF, false,
|
||||
false); // Combine this deed with another deed.
|
||||
AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
|
||||
AddHtmlLocalized(160, 168 + entries.Length * 24, 300, 20, 1045155, 0x7FFF); // Combine this deed with another deed.
|
||||
|
||||
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1);
|
||||
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -97,4 +95,4 @@ namespace Server.Engines.BulkOrders
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODTarget : Target
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
|
||||
public LargeBODTarget(LargeBOD deed) : base(18, false, TargetFlags.None)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,11 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public LargeBOD Owner { get; set; }
|
||||
|
||||
public int Amount{ get => m_Amount;
|
||||
set{ m_Amount = value;
|
||||
Owner?.InvalidateProperties();
|
||||
} }
|
||||
public int Amount
|
||||
{
|
||||
get => m_Amount;
|
||||
set{ m_Amount = value; Owner?.InvalidateProperties(); }
|
||||
}
|
||||
public SmallBulkEntry Details { get; }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.LargeSmithBOD")]
|
||||
public class LargeSmithBOD : LargeBOD
|
||||
{
|
||||
public static double[] m_BlacksmithMaterialChances =
|
||||
|
|
@ -63,12 +61,8 @@ namespace Server.Engines.BulkOrders
|
|||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = 0.825 > Utility.RandomDouble();
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
|
|
@ -78,60 +72,20 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
public LargeSmithBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
: base(0x44E, amountMax, reqExceptional, mat, entries)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
}
|
||||
|
||||
public LargeSmithBOD(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
public override int ComputeFame() => SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
public override int ComputeGold() => SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup =
|
||||
SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
Item item = rewardItem?.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public override RewardGroup GetRewardGroup() =>
|
||||
SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
|
|
@ -147,4 +101,4 @@ namespace Server.Engines.BulkOrders
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections.Generic;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
|
|
@ -75,12 +74,8 @@ namespace Server.Engines.BulkOrders
|
|||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = 0.825 > Utility.RandomDouble();
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
|
|
@ -90,12 +85,8 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
public LargeTailorBOD(int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries)
|
||||
: base(0x483, amountMax, reqExceptional, mat, entries)
|
||||
{
|
||||
Hue = 0x483;
|
||||
AmountMax = amountMax;
|
||||
Entries = entries;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
}
|
||||
|
||||
public LargeTailorBOD(Serial serial) : base(serial)
|
||||
|
|
@ -112,38 +103,8 @@ namespace Server.Engines.BulkOrders
|
|||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup =
|
||||
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
Item item = rewardItem?.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public override RewardGroup GetRewardGroup() =>
|
||||
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
|
|
@ -159,4 +120,4 @@ namespace Server.Engines.BulkOrders
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardItem
|
||||
{
|
||||
public RewardItem(int weight, ConstructCallback constructor) : this(weight, constructor, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public RewardItem(int weight, ConstructCallback constructor, int type)
|
||||
public RewardItem(int weight, ConstructCallback constructor, int type = 0)
|
||||
{
|
||||
Weight = weight;
|
||||
Constructor = constructor;
|
||||
|
|
@ -111,14 +107,12 @@ namespace Server.Engines.BulkOrders
|
|||
public virtual int ComputeFame(SmallBOD bod)
|
||||
{
|
||||
int points = ComputePoints(bod) / 50;
|
||||
|
||||
return points * points;
|
||||
}
|
||||
|
||||
public virtual int ComputeFame(LargeBOD bod)
|
||||
{
|
||||
int points = ComputePoints(bod) / 50;
|
||||
|
||||
return points * points;
|
||||
}
|
||||
|
||||
|
|
@ -354,10 +348,10 @@ namespace Server.Engines.BulkOrders
|
|||
if (itemCount == 1)
|
||||
return 0;
|
||||
|
||||
int typeIdx;
|
||||
int typeIdx = 0;
|
||||
|
||||
// Loop through the RewardTypes defined earlier and find the correct one.
|
||||
for (typeIdx = 0; typeIdx < 7; ++typeIdx)
|
||||
for (; typeIdx < 7; ++typeIdx)
|
||||
if (m_Types[typeIdx].Contains(type))
|
||||
break;
|
||||
|
||||
|
|
@ -403,14 +397,17 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
private static Item CreateMiningGloves(int type)
|
||||
{
|
||||
if (type == 1)
|
||||
return new LeatherGlovesOfMining(1);
|
||||
if (type == 3)
|
||||
return new StuddedGlovesOfMining(3);
|
||||
if (type == 5)
|
||||
return new RingmailGlovesOfMining(5);
|
||||
|
||||
throw new InvalidOperationException();
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
return new LeatherGlovesOfMining(1);
|
||||
case 3:
|
||||
return new StuddedGlovesOfMining(3);
|
||||
case 5:
|
||||
return new RingmailGlovesOfMining(5);
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
private static Item CreateGargoylesPickaxe(int type)
|
||||
|
|
@ -583,7 +580,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
Groups = new[]
|
||||
{
|
||||
new RewardGroup(0, new RewardItem(1, Cloth, 0)),
|
||||
new RewardGroup(0, new RewardItem(1, Cloth)),
|
||||
new RewardGroup(50, new RewardItem(1, Cloth, 1)),
|
||||
new RewardGroup(100, new RewardItem(1, Cloth, 2)),
|
||||
new RewardGroup(150, new RewardItem(9, Cloth, 3), new RewardItem(1, Sandals)),
|
||||
|
|
@ -745,4 +742,4 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallBOD")]
|
||||
public abstract class SmallBOD : Item
|
||||
public abstract class SmallBOD : BaseBOD
|
||||
{
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountCur;
|
||||
private int m_Number;
|
||||
private bool m_RequireExceptional;
|
||||
|
||||
[Constructible]
|
||||
public SmallBOD(int hue, int amountMax, Type type, int number, int graphic, bool requireExeptional,
|
||||
BulkMaterialType material) : base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
public SmallBOD(int hue, int amountCur, int amountMax, Type type, int number, int graphic, bool requireExeptional,
|
||||
BulkMaterialType material) : base(hue, amountMax, requireExeptional, material)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
Type = type;
|
||||
m_Number = number;
|
||||
Graphic = graphic;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
m_AmountCur = amountCur;
|
||||
m_Number = number;
|
||||
}
|
||||
|
||||
public SmallBOD() : base(Core.AOS ? 0x2258 : 0x14EF)
|
||||
public SmallBOD()
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public SmallBOD(Serial serial) : base(serial)
|
||||
|
|
@ -50,17 +37,6 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get => m_AmountMax;
|
||||
set
|
||||
{
|
||||
m_AmountMax = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Type Type{ get; set; }
|
||||
|
||||
|
|
@ -79,60 +55,23 @@ namespace Server.Engines.BulkOrders
|
|||
public int Graphic{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get => m_RequireExceptional;
|
||||
set
|
||||
{
|
||||
m_RequireExceptional = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get => m_Material;
|
||||
set
|
||||
{
|
||||
m_Material = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complete => m_AmountCur == m_AmountMax;
|
||||
public override bool Complete => m_AmountCur == AmountMax;
|
||||
|
||||
public override int LabelNumber => 1045151; // a bulk order deed
|
||||
|
||||
public static BulkMaterialType GetRandomMaterial(BulkMaterialType start, double[] chances)
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if (random < chances[i])
|
||||
return i == 0 ? BulkMaterialType.None : start + (i - 1);
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1060654); // small bulk order
|
||||
|
||||
if (m_RequireExceptional)
|
||||
if (RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if (m_Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(m_Material)); // All items must be made with x material.
|
||||
if (Material != BulkMaterialType.None)
|
||||
list.Add(SmallBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
||||
|
||||
list.Add(1060656, m_AmountMax.ToString()); // amount to make: ~1_val~
|
||||
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
||||
list.Add(1060658, "#{0}\t{1}", m_Number, m_AmountCur); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
|
|
@ -154,37 +93,6 @@ namespace Server.Engines.BulkOrders
|
|||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public void BeginCombine(Mobile from)
|
||||
{
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
from.Target = new SmallBODTarget(this);
|
||||
else
|
||||
from.SendLocalizedMessage(
|
||||
1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public abstract List<Item> ComputeRewards(bool full);
|
||||
public abstract int ComputeGold();
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards(out Item reward, out int gold, out int fame)
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
List<Item> rewards = ComputeRewards(false);
|
||||
|
||||
if (rewards.Count > 0)
|
||||
{
|
||||
reward = rewards[Utility.Random(rewards.Count)];
|
||||
|
||||
for (int i = 0; i < rewards.Count; ++i)
|
||||
if (rewards[i] != reward)
|
||||
rewards[i].Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetMaterial(CraftResource resource)
|
||||
{
|
||||
switch (resource)
|
||||
|
|
@ -205,13 +113,11 @@ namespace Server.Engines.BulkOrders
|
|||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public void EndCombine(Mobile from, object o)
|
||||
public override void EndCombine(Mobile from, Item item)
|
||||
{
|
||||
if (o is Item item && item.IsChildOf(from.Backpack))
|
||||
{
|
||||
Type objectType = item.GetType();
|
||||
Type objectType = item.GetType();
|
||||
|
||||
if (m_AmountCur >= m_AmountMax)
|
||||
if (m_AmountCur >= AmountMax)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
|
|
@ -228,13 +134,13 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
BulkMaterialType material = GetMaterial(armor?.Resource ?? clothing?.Resource ?? CraftResource.None);
|
||||
|
||||
if (m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite &&
|
||||
material != m_Material)
|
||||
if (Material >= BulkMaterialType.DullCopper && Material <= BulkMaterialType.Valorite &&
|
||||
material != Material)
|
||||
{
|
||||
from.SendLocalizedMessage(1045168); // The item is not made from the requested ore.
|
||||
}
|
||||
else if (m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Barbed &&
|
||||
material != m_Material)
|
||||
else if (Material >= BulkMaterialType.Spined && Material <= BulkMaterialType.Barbed &&
|
||||
material != Material)
|
||||
{
|
||||
from.SendLocalizedMessage(1049352); // The item is not made from the requested leather type.
|
||||
}
|
||||
|
|
@ -249,7 +155,7 @@ namespace Server.Engines.BulkOrders
|
|||
else
|
||||
isExceptional = clothing.Quality == ClothingQuality.Exceptional;
|
||||
|
||||
if (m_RequireExceptional && !isExceptional)
|
||||
if (RequireExceptional && !isExceptional)
|
||||
{
|
||||
from.SendLocalizedMessage(1045167); // The item must be exceptional.
|
||||
}
|
||||
|
|
@ -259,19 +165,13 @@ namespace Server.Engines.BulkOrders
|
|||
++AmountCur;
|
||||
|
||||
from.SendLocalizedMessage(1045170); // The item has been combined with the deed.
|
||||
|
||||
from.SendGump(new SmallBODGump(from, this));
|
||||
|
||||
if (m_AmountCur < m_AmountMax)
|
||||
if (m_AmountCur < AmountMax)
|
||||
BeginCombine(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -281,12 +181,9 @@ namespace Server.Engines.BulkOrders
|
|||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(Type == null ? null : Type.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(Graphic);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -300,7 +197,6 @@ namespace Server.Engines.BulkOrders
|
|||
case 0:
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
m_AmountMax = reader.ReadInt();
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
|
|
@ -309,21 +205,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
m_Number = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Weight == 0.0)
|
||||
Weight = 1.0;
|
||||
|
||||
if (Core.AOS && ItemID == 0x14EF)
|
||||
ItemID = 0x2258;
|
||||
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,36 +28,35 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(20, 249, 10460);
|
||||
AddImage(430, 249, 10460);
|
||||
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF, false,
|
||||
false); // Ah! Thanks for the goods! Would you help me out?
|
||||
AddHtmlLocalized(190, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
|
||||
AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddHtmlLocalized(40, 96, 120, 20, 1045136, 0x7FFF); // Item requested:
|
||||
AddItem(385, 96, deed.Graphic);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false);
|
||||
AddHtmlLocalized(40, 120, 210, 20, deed.Number, 0xFFFFFF);
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
{
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(40, 144, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(40, 168, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(40, deed.RequireExceptional ? 192 : 168, 350, 20, GetMaterialNumberFor(deed.Material),
|
||||
0x7FFF, false, false); // All items must be made with x material.
|
||||
0x7FFF); // All items must be made with x material.
|
||||
}
|
||||
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF, false, false); // Do you want to accept this order?
|
||||
AddHtmlLocalized(40, 216, 350, 20, 1045139, 0x7FFF); // Do you want to accept this order?
|
||||
|
||||
AddButton(100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF, false, false); // Ok
|
||||
AddButton(100, 240, 4005, 4007, 1);
|
||||
AddHtmlLocalized(135, 240, 120, 20, 1006044, 0x7FFF); // Ok
|
||||
|
||||
AddButton(275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF, false, false); // CANCEL
|
||||
AddButton(275, 240, 4005, 4007, 0);
|
||||
AddHtmlLocalized(310, 240, 120, 20, 1011012, 0x7FFF); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -80,6 +79,12 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
}
|
||||
|
||||
public override void OnServerClose(NetState owner)
|
||||
{
|
||||
if (m_Deed?.Deleted == false)
|
||||
m_Deed.Delete();
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor(BulkMaterialType material)
|
||||
{
|
||||
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
|
||||
|
|
@ -90,4 +95,4 @@ namespace Server.Engines.BulkOrders
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,34 +27,34 @@ namespace Server.Engines.BulkOrders
|
|||
AddImage(45, 245, 10460);
|
||||
AddImage(480, 245, 10460);
|
||||
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF, false, false); // A bulk order
|
||||
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
|
||||
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF, false, false); // Amount to make:
|
||||
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
|
||||
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
|
||||
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF, false, false); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF, false, false); // Item requested:
|
||||
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
|
||||
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF); // Item requested:
|
||||
|
||||
AddItem(410, 72, deed.Graphic);
|
||||
|
||||
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF);
|
||||
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
|
||||
|
||||
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF, false, false); // Special requirements to meet:
|
||||
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
|
||||
|
||||
if (deed.RequireExceptional)
|
||||
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF, false, false); // All items must be exceptional.
|
||||
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
|
||||
|
||||
if (deed.Material != BulkMaterialType.None)
|
||||
AddHtmlLocalized(75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor(deed.Material),
|
||||
0x7FFF, false, false); // All items must be made with x material.
|
||||
0x7FFF); // All items must be made with x material.
|
||||
|
||||
AddButton(125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF, false, false); // Combine this deed with the item requested.
|
||||
AddButton(125, 192, 4005, 4007, 2);
|
||||
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
|
||||
|
||||
AddButton(125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF, false, false); // EXIT
|
||||
AddButton(125, 216, 4005, 4007, 1);
|
||||
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -79,4 +79,4 @@ namespace Server.Engines.BulkOrders
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODTarget : Target
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
|
||||
public SmallBODTarget(SmallBOD deed) : base(18, false, TargetFlags.None)
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
|
||||
return;
|
||||
|
||||
m_Deed.EndCombine(from, targeted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,10 +78,11 @@ namespace Server.Engines.BulkOrders
|
|||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
|||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias("Scripts.Engines.BulkOrders.SmallSmithBOD")]
|
||||
public class SmallSmithBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_BlacksmithMaterialChances =
|
||||
|
|
@ -21,9 +20,33 @@ namespace Server.Engines.BulkOrders
|
|||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
private SmallSmithBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
private SmallSmithBOD(SmallBulkEntry entry, BulkMaterialType mat, int amountMax, bool reqExceptional)
|
||||
: base(0x44E, 0, amountMax, entry.Type, entry.Number, entry.Graphic, reqExceptional, mat)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallSmithBOD()
|
||||
{
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
SmallBulkEntry[] entries = useMaterials ? SmallBulkEntry.BlacksmithArmor :
|
||||
SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length <= 0)
|
||||
return;
|
||||
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
|
|
@ -32,216 +55,128 @@ namespace Server.Engines.BulkOrders
|
|||
Material = material;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallSmithBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallSmithBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional,
|
||||
BulkMaterialType mat)
|
||||
BulkMaterialType mat) : base(0x44E, amountCur, amountMax, type, number, graphic, reqExceptional, mat)
|
||||
{
|
||||
Hue = 0x44E;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
}
|
||||
|
||||
public SmallSmithBOD(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
public override int ComputeFame() => SmithRewardCalculator.Instance.ComputeFame(this);
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
public override int ComputeGold() => SmithRewardCalculator.Instance.ComputeGold(this);
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup =
|
||||
SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
Item item = rewardItem?.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public override RewardGroup GetRewardGroup() =>
|
||||
SmithRewardCalculator.Instance.LookupRewards(SmithRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
public static SmallSmithBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
SmallBulkEntry[] entries = useMaterials ? SmallBulkEntry.BlacksmithArmor :
|
||||
SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if (entries.Length <= 0)
|
||||
return null;
|
||||
|
||||
double theirSkill = m.Skills.Blacksmith.Base;
|
||||
int amountMax;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
double theirSkill = m.Skills.Blacksmith.Base;
|
||||
int amountMax;
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
else if (theirSkill >= 50.1)
|
||||
amountMax = Utility.RandomList(10, 15, 15, 20);
|
||||
else
|
||||
amountMax = Utility.RandomList(10, 10, 15, 20);
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
double skillReq = 0.0;
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if (useMaterials && theirSkill >= 70.1)
|
||||
for (int i = 0; i < 20; ++i)
|
||||
switch (check)
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances);
|
||||
double skillReq = 0.0;
|
||||
|
||||
switch (check)
|
||||
{
|
||||
case BulkMaterialType.DullCopper:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
skillReq = 70.0;
|
||||
break;
|
||||
case BulkMaterialType.Copper:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.Bronze:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Gold:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Agapite:
|
||||
skillReq = 90.0;
|
||||
break;
|
||||
case BulkMaterialType.Verite:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
case BulkMaterialType.Valorite:
|
||||
skillReq = 100.0;
|
||||
break;
|
||||
case BulkMaterialType.Spined:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.Horned:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Barbed:
|
||||
skillReq = 99.0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
material = check;
|
||||
case BulkMaterialType.DullCopper:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.ShadowIron:
|
||||
skillReq = 70.0;
|
||||
break;
|
||||
case BulkMaterialType.Copper:
|
||||
skillReq = 75.0;
|
||||
break;
|
||||
case BulkMaterialType.Bronze:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Gold:
|
||||
skillReq = 85.0;
|
||||
break;
|
||||
case BulkMaterialType.Agapite:
|
||||
skillReq = 90.0;
|
||||
break;
|
||||
case BulkMaterialType.Verite:
|
||||
skillReq = 95.0;
|
||||
break;
|
||||
case BulkMaterialType.Valorite:
|
||||
skillReq = 100.0;
|
||||
break;
|
||||
case BulkMaterialType.Spined:
|
||||
skillReq = 65.0;
|
||||
break;
|
||||
case BulkMaterialType.Horned:
|
||||
skillReq = 80.0;
|
||||
break;
|
||||
case BulkMaterialType.Barbed:
|
||||
skillReq = 99.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if (theirSkill >= 70.1)
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
if (theirSkill >= skillReq)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (validEntries.Count > 0)
|
||||
double excChance = theirSkill >= 70.1 ? (theirSkill + 80.0) / 200.0 : 0.0;
|
||||
|
||||
bool reqExceptional = excChance > Utility.RandomDouble();
|
||||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
||||
for (int i = 0; i < entries.Length; ++i)
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor(entries[i].Type);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
if (reqExceptional)
|
||||
chance = item.GetExceptionalChance(system, chance, m);
|
||||
|
||||
if (chance > 0.0)
|
||||
validEntries.Add(entries[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
if (validEntries.Count <= 0)
|
||||
return null;
|
||||
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -258,4 +193,4 @@ namespace Server.Engines.BulkOrders
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,30 @@ namespace Server.Engines.BulkOrders
|
|||
0.001953125 // Barbed
|
||||
};
|
||||
|
||||
private SmallTailorBOD(SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional)
|
||||
private SmallTailorBOD(SmallBulkEntry entry, BulkMaterialType mat, int amountMax, bool reqExceptional)
|
||||
: base(0x483, 0, amountMax, entry.Type, entry.Number, entry.Graphic, reqExceptional, mat)
|
||||
{
|
||||
Hue = 0x483;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallTailorBOD()
|
||||
{
|
||||
bool useMaterials = Utility.RandomBool();
|
||||
SmallBulkEntry[] entries = useMaterials ? SmallBulkEntry.TailorLeather : SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length <= 0)
|
||||
return;
|
||||
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
|
|
@ -25,102 +46,21 @@ namespace Server.Engines.BulkOrders
|
|||
Material = material;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SmallTailorBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if (useMaterials = Utility.RandomBool())
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if (entries.Length > 0)
|
||||
{
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20);
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if (useMaterials)
|
||||
material = GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances);
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || material == BulkMaterialType.None;
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random(entries.Length)];
|
||||
|
||||
Hue = hue;
|
||||
AmountMax = amountMax;
|
||||
Type = entry.Type;
|
||||
Number = entry.Number;
|
||||
Graphic = entry.Graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = material;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallTailorBOD(int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional,
|
||||
BulkMaterialType mat)
|
||||
BulkMaterialType mat) : base(0x483, amountCur, amountMax, type, number, graphic, reqExceptional, mat)
|
||||
{
|
||||
Hue = 0x483;
|
||||
AmountMax = amountMax;
|
||||
AmountCur = amountCur;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
RequireExceptional = reqExceptional;
|
||||
Material = mat;
|
||||
}
|
||||
|
||||
public SmallTailorBOD(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
}
|
||||
public override int ComputeFame() => TailorRewardCalculator.Instance.ComputeFame(this);
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
}
|
||||
public override int ComputeGold() => TailorRewardCalculator.Instance.ComputeGold(this);
|
||||
|
||||
public override List<Item> ComputeRewards(bool full)
|
||||
{
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
RewardGroup rewardGroup =
|
||||
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
if (rewardGroup != null)
|
||||
{
|
||||
if (full)
|
||||
{
|
||||
for (int i = 0; i < rewardGroup.Items.Length; ++i)
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
Item item = rewardItem?.Construct();
|
||||
|
||||
if (item != null)
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public override RewardGroup GetRewardGroup() =>
|
||||
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));
|
||||
|
||||
public static SmallTailorBOD CreateRandomFor(Mobile m)
|
||||
{
|
||||
|
|
@ -128,8 +68,9 @@ namespace Server.Engines.BulkOrders
|
|||
bool useMaterials = Utility.RandomBool();
|
||||
|
||||
double theirSkill = m.Skills.Tailoring.Base;
|
||||
if (useMaterials && theirSkill >= 6.2
|
||||
) // Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||
|
||||
// Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||
if (useMaterials && theirSkill >= 6.2)
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
|
@ -247,4 +188,4 @@ namespace Server.Engines.BulkOrders
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
@ -88,7 +88,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
@ -181,4 +181,4 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool Validate(ChampionSkullBrazier brazier)
|
||||
{
|
||||
return brazier?.Skull != null && !brazier.Skull.Deleted;
|
||||
return brazier?.Skull?.Deleted == false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -125,4 +125,4 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
else
|
||||
{
|
||||
if (killer.Corpse != null && !killer.Corpse.Deleted)
|
||||
if (killer?.Corpse.Deleted == false)
|
||||
killer.Corpse.DropItem(scroll);
|
||||
else
|
||||
killer.AddToBackpack(scroll);
|
||||
|
|
@ -421,7 +421,8 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
m_Altar.Hue = 0;
|
||||
|
||||
if (!Core.ML || Map == Map.Felucca) new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
|
||||
if (!Core.ML || Map == Map.Felucca)
|
||||
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
|
||||
}
|
||||
|
||||
Champion = null;
|
||||
|
|
@ -440,7 +441,9 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
if (m.Deleted)
|
||||
{
|
||||
if (m.Corpse != null && !m.Corpse.Deleted) ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
if (m.Corpse?.Deleted == false)
|
||||
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
|
||||
m_Creatures.RemoveAt(i);
|
||||
--i;
|
||||
++m_Kills;
|
||||
|
|
@ -574,6 +577,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
Champion?.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
|
||||
|
|
@ -919,7 +923,7 @@ namespace Server.Engines.CannedEvil
|
|||
m_Creatures.Clear();
|
||||
}
|
||||
|
||||
if (Champion != null && !Champion.Player)
|
||||
if (Champion?.Player == false)
|
||||
Champion.Delete();
|
||||
|
||||
Stop();
|
||||
|
|
@ -950,7 +954,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public void RegisterDamage(Mobile from, int amount)
|
||||
{
|
||||
if (from == null || !from.Player)
|
||||
if (from?.Player != true)
|
||||
return;
|
||||
|
||||
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out int value) ? value : 0);
|
||||
|
|
@ -997,7 +1001,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
Container pack = to.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(to, artifact, false))
|
||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||
artifact.Delete();
|
||||
else
|
||||
to.SendLocalizedMessage(
|
||||
|
|
@ -1006,8 +1010,8 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool IsEligible(Mobile m, Item Artifact)
|
||||
{
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null &&
|
||||
m.Backpack.CheckHold(m, Artifact, false);
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
|
||||
m.Backpack?.CheckHold(m, Artifact, false) == true;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -9,19 +9,14 @@ namespace Server.Items
|
|||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate() : this(false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays, Point3D loc, Map map) : this(decays)
|
||||
public StarRoomGate(Point3D loc, Map map, bool decays) : this(decays)
|
||||
{
|
||||
MoveToWorld(loc, map);
|
||||
Effects.PlaySound(loc, map, 0x20E);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
public StarRoomGate(bool decays = false) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
{
|
||||
Dispellable = false;
|
||||
ItemID = 0x1FD4;
|
||||
|
|
@ -101,4 +96,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,21 +116,15 @@ namespace Server.Engines.Chat
|
|||
|
||||
public bool ValidateAccess(ChatUser from, ChatUser target)
|
||||
{
|
||||
if (from != null && target != null && from.Mobile.AccessLevel < target.Mobile.AccessLevel)
|
||||
{
|
||||
from.Mobile.SendMessage("Your access level is too low to do this.");
|
||||
return false;
|
||||
}
|
||||
if (from == null || target == null || from.Mobile.AccessLevel >= target.Mobile.AccessLevel)
|
||||
return true;
|
||||
|
||||
from.Mobile.SendMessage("Your access level is too low to do this.");
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddUser(ChatUser user)
|
||||
{
|
||||
return AddUser(user, null);
|
||||
}
|
||||
|
||||
public bool AddUser(ChatUser user, string password)
|
||||
public bool AddUser(ChatUser user, string password = null)
|
||||
{
|
||||
if (Contains(user))
|
||||
{
|
||||
|
|
@ -188,12 +182,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void AdBan(ChatUser user)
|
||||
{
|
||||
AddBan(user, null);
|
||||
}
|
||||
|
||||
public void AddBan(ChatUser user, ChatUser moderator)
|
||||
public void AddBan(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
|
||||
return;
|
||||
|
|
@ -210,12 +199,7 @@ namespace Server.Engines.Chat
|
|||
m_Banned.Remove(user);
|
||||
}
|
||||
|
||||
public void Kick(ChatUser user)
|
||||
{
|
||||
Kick(user, null);
|
||||
}
|
||||
|
||||
public void Kick(ChatUser user, ChatUser moderator)
|
||||
public void Kick(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
Kick(user, moderator, false);
|
||||
}
|
||||
|
|
@ -248,12 +232,7 @@ namespace Server.Engines.Chat
|
|||
moderator?.SendMessage(62, user.Username); // You are banning %1 from this conference.
|
||||
}
|
||||
|
||||
public void AddVoiced(ChatUser user)
|
||||
{
|
||||
AddVoiced(user, null);
|
||||
}
|
||||
|
||||
public void AddVoiced(ChatUser user, ChatUser moderator)
|
||||
public void AddVoiced(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator))
|
||||
return;
|
||||
|
|
@ -291,12 +270,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void AddModerator(ChatUser user)
|
||||
{
|
||||
AddModerator(user, null);
|
||||
}
|
||||
|
||||
public void AddModerator(ChatUser user, ChatUser moderator)
|
||||
public void AddModerator(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator))
|
||||
return;
|
||||
|
|
@ -316,12 +290,7 @@ namespace Server.Engines.Chat
|
|||
SendCommand(ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username);
|
||||
}
|
||||
|
||||
public void RemoveModerator(ChatUser user)
|
||||
{
|
||||
RemoveModerator(user, null);
|
||||
}
|
||||
|
||||
public void RemoveModerator(ChatUser user, ChatUser moderator)
|
||||
public void RemoveModerator(ChatUser user, ChatUser moderator = null)
|
||||
{
|
||||
if (!ValidateModerator(moderator) || !ValidateAccess(moderator, user))
|
||||
return;
|
||||
|
|
@ -338,32 +307,12 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void SendMessage(int number)
|
||||
public void SendMessage(int number, string param1 = null)
|
||||
{
|
||||
SendMessage(number, null, null, null);
|
||||
SendMessage(number, null, param1);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1)
|
||||
{
|
||||
SendMessage(number, null, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1, string param2)
|
||||
{
|
||||
SendMessage(number, null, param1, param2);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator)
|
||||
{
|
||||
SendMessage(number, initiator, null, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator, string param1)
|
||||
{
|
||||
SendMessage(number, initiator, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, ChatUser initiator, string param1, string param2)
|
||||
public void SendMessage(int number, ChatUser initiator, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
@ -395,32 +344,12 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command)
|
||||
{
|
||||
SendCommand(command, null, null, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, string param1)
|
||||
{
|
||||
SendCommand(command, null, param1, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, string param1, string param2)
|
||||
public void SendCommand(ChatCommand command, string param1 = null, string param2 = null)
|
||||
{
|
||||
SendCommand(command, null, param1, param2);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator)
|
||||
{
|
||||
SendCommand(command, initiator, null, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1)
|
||||
{
|
||||
SendCommand(command, initiator, param1, null);
|
||||
}
|
||||
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
|
||||
public void SendCommand(ChatCommand command, ChatUser initiator, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
@ -457,12 +386,7 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
|
||||
public static Channel AddChannel(string name)
|
||||
{
|
||||
return AddChannel(name, null);
|
||||
}
|
||||
|
||||
public static Channel AddChannel(string name, string password)
|
||||
public static Channel AddChannel(string name, string password = null)
|
||||
{
|
||||
Channel channel = FindChannelByName(name);
|
||||
|
||||
|
|
@ -521,4 +445,4 @@ namespace Server.Engines.Chat
|
|||
AddChannel(name).AlwaysAvailable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,17 +16,7 @@ namespace Server.Engines.Chat
|
|||
PacketHandlers.Register(0xB3, 0, true, ChatAction);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type)
|
||||
{
|
||||
SendCommandTo(to, type, null, null);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1)
|
||||
{
|
||||
SendCommandTo(to, type, param1, null);
|
||||
}
|
||||
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1, string param2)
|
||||
public static void SendCommandTo(Mobile to, ChatCommand type, string param1 = null, string param2 = null)
|
||||
{
|
||||
to?.Send(new ChatMessagePacket(null, (int)type + 20, param1, param2));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
password = password?.Trim();
|
||||
|
||||
if (password != null && password.Length == 0)
|
||||
if (password?.Length == 0)
|
||||
password = null;
|
||||
|
||||
Channel joined = Channel.FindChannelByName(name);
|
||||
|
|
@ -217,7 +217,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
password = password?.Trim();
|
||||
|
||||
if (password != null && password.Length == 0)
|
||||
if (password?.Length == 0)
|
||||
password = null;
|
||||
|
||||
Channel.AddChannel(name, password).AddUser(from, password);
|
||||
|
|
@ -355,4 +355,4 @@ namespace Server.Engines.Chat
|
|||
channel.VoiceRestricted = !channel.VoiceRestricted;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,17 +49,12 @@ namespace Server.Engines.Chat
|
|||
|
||||
public bool IgnorePrivateMessage{ get; set; }
|
||||
|
||||
public bool IsModerator => CurrentChannel != null && CurrentChannel.IsModerator(this);
|
||||
public bool IsModerator => CurrentChannel?.IsModerator(this) == true;
|
||||
|
||||
public char GetColorCharacter()
|
||||
{
|
||||
if (CurrentChannel != null && CurrentChannel.IsModerator(this))
|
||||
return ModeratorColorCharacter;
|
||||
|
||||
if (CurrentChannel != null && CurrentChannel.IsVoiced(this))
|
||||
return VoicedColorCharacter;
|
||||
|
||||
return NormalColorCharacter;
|
||||
return IsModerator ? ModeratorColorCharacter :
|
||||
CurrentChannel?.IsVoiced(this) == true ? VoicedColorCharacter : NormalColorCharacter;
|
||||
}
|
||||
|
||||
public bool CheckOnline()
|
||||
|
|
@ -71,17 +66,7 @@ namespace Server.Engines.Chat
|
|||
return false;
|
||||
}
|
||||
|
||||
public void SendMessage(int number)
|
||||
{
|
||||
SendMessage(number, null, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1)
|
||||
{
|
||||
SendMessage(number, param1, null);
|
||||
}
|
||||
|
||||
public void SendMessage(int number, string param1, string param2)
|
||||
public void SendMessage(int number, string param1 = null, string param2 = null)
|
||||
{
|
||||
if (Mobile.NetState != null)
|
||||
Mobile.Send(new ChatMessagePacket(Mobile, number, param1, param2));
|
||||
|
|
@ -135,28 +120,28 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
ChatUser user = GetChatUser(from);
|
||||
|
||||
if (user == null)
|
||||
if (user != null)
|
||||
return user;
|
||||
|
||||
user = new ChatUser(from);
|
||||
|
||||
m_Users.Add(user);
|
||||
m_Table[from] = user;
|
||||
|
||||
Channel.SendChannelsTo(user);
|
||||
|
||||
List<Channel> list = Channel.Channels;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
user = new ChatUser(from);
|
||||
Channel c = list[i];
|
||||
|
||||
m_Users.Add(user);
|
||||
m_Table[from] = user;
|
||||
|
||||
Channel.SendChannelsTo(user);
|
||||
|
||||
List<Channel> list = Channel.Channels;
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Channel c = list[i];
|
||||
|
||||
if (c.AddUser(user))
|
||||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
if (c.AddUser(user))
|
||||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
|
|
@ -205,32 +190,12 @@ namespace Server.Engines.Chat
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command)
|
||||
{
|
||||
GlobalSendCommand(command, null, null, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1)
|
||||
{
|
||||
GlobalSendCommand(command, null, param1, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1, string param2)
|
||||
public static void GlobalSendCommand(ChatCommand command, string param1, string param2 = null)
|
||||
{
|
||||
GlobalSendCommand(command, null, param1, param2);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator)
|
||||
{
|
||||
GlobalSendCommand(command, initiator, null, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1)
|
||||
{
|
||||
GlobalSendCommand(command, initiator, param1, null);
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1, string param2)
|
||||
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator = null, string param1 = null, string param2 = null)
|
||||
{
|
||||
for (int i = 0; i < m_Users.Count; ++i)
|
||||
{
|
||||
|
|
@ -244,4 +209,4 @@ namespace Server.Engines.Chat
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ namespace Server.Engines.ConPVP
|
|||
AddImage(215, -43, 0xEE40);
|
||||
//AddImage( 330, 141, 0x8BA );
|
||||
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32), false, false);
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32));
|
||||
|
||||
string fmt;
|
||||
|
||||
|
|
@ -57,37 +57,37 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
fmt = "You have been challenged to a duel from {0}. Do you accept?";
|
||||
|
||||
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
|
||||
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868), false, false);
|
||||
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
|
||||
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868));
|
||||
|
||||
AddImageTiled(32, 88, 264, 1, 9107);
|
||||
AddImageTiled(42, 90, 264, 1, 9157);
|
||||
|
||||
AddRadio(24, 100, 9727, 9730, true, 1);
|
||||
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
|
||||
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
|
||||
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32));
|
||||
|
||||
AddRadio(24, 135, 9727, 9730, false, 2);
|
||||
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
|
||||
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
|
||||
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32));
|
||||
|
||||
AddRadio(24, 170, 9727, 9730, false, 3);
|
||||
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
|
||||
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32), false, false);
|
||||
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
|
||||
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32));
|
||||
|
||||
AddButton(314, 173, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, 173, 247, 248, 1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,13 +86,9 @@ namespace Server.Engines.ConPVP
|
|||
[PropertyObject]
|
||||
public class ArenaStartPoints
|
||||
{
|
||||
public ArenaStartPoints() : this(new Point3D[8])
|
||||
public ArenaStartPoints(Point3D[] points = null)
|
||||
{
|
||||
}
|
||||
|
||||
public ArenaStartPoints(Point3D[] points)
|
||||
{
|
||||
Points = points;
|
||||
Points = points ?? new Point3D[8];
|
||||
}
|
||||
|
||||
public ArenaStartPoints(GenericReader reader)
|
||||
|
|
@ -176,7 +172,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class Arena : IComparable
|
||||
public class Arena : IComparable<Arena>
|
||||
{
|
||||
private bool m_Active;
|
||||
private Rectangle2D m_Bounds;
|
||||
|
|
@ -407,7 +403,8 @@ namespace Server.Engines.ConPVP
|
|||
set
|
||||
{
|
||||
m_GateOut = value;
|
||||
if (Teleporter != null) Teleporter.Location = m_GateOut;
|
||||
if (Teleporter != null)
|
||||
Teleporter.Location = m_GateOut;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -459,10 +456,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static List<Arena> Arenas{ get; } = new List<Arena>();
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(Arena c)
|
||||
{
|
||||
Arena c = (Arena)obj;
|
||||
|
||||
string a = m_Name;
|
||||
string b = c.m_Name;
|
||||
|
||||
|
|
@ -478,18 +473,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Ladder AcquireLadder()
|
||||
{
|
||||
if (Ladder != null)
|
||||
return Ladder.Ladder;
|
||||
|
||||
return ConPVP.Ladder.Instance;
|
||||
return Ladder?.Ladder ?? ConPVP.Ladder.Instance;
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
Active = false;
|
||||
|
||||
m_Region?.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +654,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
ArenaController controller = allControllers[i];
|
||||
|
||||
if (controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate &&
|
||||
if (controller?.Deleted == false && controller.Arena != null && controller.IsPrivate &&
|
||||
controller.Map == first.Map && first.InRange(controller, 24))
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(controller);
|
||||
|
|
@ -832,4 +822,4 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private bool m_Yielding;
|
||||
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout) : this(initiator, layout, true)
|
||||
{
|
||||
}
|
||||
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew)
|
||||
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew = true)
|
||||
{
|
||||
Initiator = initiator;
|
||||
Participants = new List<Participant>();
|
||||
|
|
@ -123,13 +119,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move)
|
||||
{
|
||||
if (!(from is PlayerMobile pm))
|
||||
return true;
|
||||
|
||||
DuelContext dc = pm.DuelContext;
|
||||
|
||||
// No DuelContext, or InstaAllowSpecialMove
|
||||
return dc?.InstAllowSpecialMove(from, name, move) != false;
|
||||
return (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
|
||||
}
|
||||
|
||||
public bool InstAllowSpecialMove(Mobile from, string name, SpecialMove move)
|
||||
|
|
@ -139,7 +130,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -165,9 +156,7 @@ namespace Server.Engines.ConPVP
|
|||
if (!StartedBeginCountdown)
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl?.Eliminated != false)
|
||||
if (Find(from)?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -256,7 +245,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (item is Dagger || CheckItemEquip(from, item))
|
||||
|
|
@ -350,7 +339,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (CantDoAnything(from))
|
||||
|
|
@ -373,7 +362,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(from);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return true;
|
||||
|
||||
if (!(item is BaseRefreshPotion))
|
||||
|
|
@ -507,7 +496,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(mob);
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
return;
|
||||
|
||||
if (mob.Map == Map.Internal)
|
||||
|
|
@ -533,30 +522,27 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
DuelPlayer pl = Find(mob);
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == true || m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
|
||||
return;
|
||||
|
||||
pl.Eliminated = true;
|
||||
|
||||
if (mob.Poison != null)
|
||||
mob.Poison = null;
|
||||
|
||||
Requip(mob, corpse);
|
||||
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
|
||||
|
||||
Participant winner = CheckCompletion();
|
||||
|
||||
if (winner != null)
|
||||
{
|
||||
if (m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
|
||||
return;
|
||||
|
||||
pl.Eliminated = true;
|
||||
|
||||
if (mob.Poison != null)
|
||||
mob.Poison = null;
|
||||
|
||||
Requip(mob, corpse);
|
||||
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
|
||||
|
||||
Participant winner = CheckCompletion();
|
||||
|
||||
if (winner != null)
|
||||
{
|
||||
Finish(winner);
|
||||
}
|
||||
else if (!m_Yielding)
|
||||
{
|
||||
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
|
||||
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
|
||||
}
|
||||
Finish(winner);
|
||||
}
|
||||
else if (!m_Yielding)
|
||||
{
|
||||
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
|
||||
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +550,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
if (p.HasOpenSlot)
|
||||
return false;
|
||||
|
|
@ -609,7 +595,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Mobile killer = from.FindMostRecentDamager(false);
|
||||
|
||||
if (killer != null && killer.Player)
|
||||
if (killer?.Player == true)
|
||||
killer.AddToBackpack(new Head(m_Tournament == null ? HeadType.Duel : HeadType.Tournament, from.Name));
|
||||
}
|
||||
|
||||
|
|
@ -671,7 +657,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = winner.Players[i];
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == false)
|
||||
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
|
||||
}
|
||||
|
||||
|
|
@ -688,7 +674,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant loser = (Participant)Participants[i];
|
||||
Participant loser = Participants[i];
|
||||
|
||||
if (loser != winner)
|
||||
{
|
||||
|
|
@ -714,8 +700,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (IsOneVsOne)
|
||||
{
|
||||
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
|
||||
DuelPlayer dp1 = Participants[0].Players[0];
|
||||
DuelPlayer dp2 = Participants[1].Players[0];
|
||||
|
||||
if (dp1 != null && dp2 != null)
|
||||
{
|
||||
|
|
@ -797,7 +783,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -828,7 +814,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant oldPart = (Participant)Participants[i];
|
||||
Participant oldPart = Participants[i];
|
||||
Participant newPart = new Participant(dc, oldPart.Players.Length);
|
||||
|
||||
for (int j = 0; j < oldPart.Players.Length; ++j)
|
||||
|
|
@ -858,7 +844,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
DuelPlayer pl = p.Find(mob);
|
||||
|
||||
if (pl != null)
|
||||
|
|
@ -873,7 +859,7 @@ namespace Server.Engines.ConPVP
|
|||
DuelPlayer pl1 = Find(m1);
|
||||
DuelPlayer pl2 = Find(m2);
|
||||
|
||||
return pl1 != null && pl2 != null && pl1.Participant == pl2.Participant;
|
||||
return pl1 != null && pl1.Participant == pl2?.Participant;
|
||||
}
|
||||
|
||||
public Participant CheckCompletion()
|
||||
|
|
@ -885,7 +871,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
if (p.Eliminated)
|
||||
{
|
||||
|
|
@ -900,10 +886,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (hasWinner)
|
||||
return winner ?? (Participant)Participants[0];
|
||||
|
||||
return null;
|
||||
return hasWinner ? winner ?? Participants[0] : null;
|
||||
}
|
||||
|
||||
public void StartCountdown(int count, CountdownCallback cb)
|
||||
|
|
@ -953,13 +936,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
continue;
|
||||
|
||||
pl.Mobile.SendSound(0x1E1);
|
||||
|
|
@ -984,13 +967,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl == null || pl.Eliminated)
|
||||
if (pl?.Eliminated != false)
|
||||
continue;
|
||||
|
||||
pl.Mobile.SendSound(0x1E1);
|
||||
|
|
@ -1065,7 +1048,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl != null && !pl.Eliminated)
|
||||
if (pl?.Eliminated == false)
|
||||
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
|
||||
}
|
||||
|
||||
|
|
@ -1511,7 +1494,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void CloseAllGumps(DuelPlayer pl)
|
||||
{
|
||||
pl.Mobile.CloseGump<BeginGump>();
|
||||
|
|
@ -1527,7 +1510,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -1546,7 +1529,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)Participants[i];
|
||||
Participant p = Participants[i];
|
||||
|
||||
for (int j = 0; j < p.Players.Length; ++j)
|
||||
{
|
||||
|
|
@ -1571,7 +1554,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
mob.SendMessage(0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page);
|
||||
}
|
||||
|
||||
|
||||
// Close all of them?
|
||||
mob.CloseGump<DuelContextGump>();
|
||||
mob.CloseGump<ReadyUpGump>();
|
||||
|
|
@ -1851,9 +1834,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
{
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
mob.SendMessage(" + {0}", ((Ruleset)ruleset.Flavors[i]).Title);
|
||||
mob.SendMessage(" + {0}", ruleset.Flavors[i].Title);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2084,10 +2067,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
Arena arena = m_OverrideArena;
|
||||
|
||||
if (arena == null)
|
||||
arena = Arena.FindArena(players);
|
||||
Arena arena = m_OverrideArena ?? Arena.FindArena(players);
|
||||
|
||||
if (arena == null)
|
||||
{
|
||||
|
|
@ -2482,7 +2462,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_Teleporter != null && !m_Teleporter.Deleted)
|
||||
if (m_Teleporter?.Deleted == false)
|
||||
m_Teleporter.Register(m);
|
||||
|
||||
base.UseGate(m);
|
||||
|
|
@ -2512,4 +2492,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@ namespace Server.Engines.ConPVP
|
|||
public class DuelTeleporterAddon : BaseAddon
|
||||
{
|
||||
[Constructible]
|
||||
public DuelTeleporterAddon() : this(DuelTeleporterType.Squares)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DuelTeleporterAddon(DuelTeleporterType type)
|
||||
public DuelTeleporterAddon(DuelTeleporterType type = DuelTeleporterType.Squares)
|
||||
{
|
||||
int itemID = (int)type;
|
||||
|
||||
|
|
@ -91,4 +86,4 @@ namespace Server.Engines.ConPVP
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -49,7 +49,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContext Context{ get; set; }
|
||||
|
||||
public bool InProgress => Context != null && Context.Registered;
|
||||
public bool InProgress => Context?.Registered == true;
|
||||
|
||||
public void Start(Arena arena, Tournament tourney)
|
||||
{
|
||||
|
|
@ -120,4 +120,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32);
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
|
||||
}
|
||||
|
|
@ -270,9 +270,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AutoReject()
|
||||
|
|
@ -379,4 +379,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,18 +105,13 @@ namespace Server.Engines.ConPVP
|
|||
AddColumnHeader(325, "Participants");
|
||||
AddColumnHeader(40, "Obs");
|
||||
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Arena ar = list[i];
|
||||
|
||||
string name = ar.Name;
|
||||
|
||||
if (name == null)
|
||||
name = "(no name)";
|
||||
|
||||
int x = 12;
|
||||
int y = 32 + i * 31;
|
||||
|
||||
|
|
@ -125,7 +120,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRadio(x + 3, y + 1, 9727, 9730, false, i);
|
||||
x += 35;
|
||||
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, name, color, 0);
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, ar.Name ?? "(no name)", color, 0);
|
||||
x += 115;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -271,9 +266,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
@ -287,4 +282,4 @@ namespace Server.Engines.ConPVP
|
|||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,32 +20,32 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32), false, false);
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32));
|
||||
|
||||
AddHtml(22 - 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22 + 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 - 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 + 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
0xFFCC66), false, false);
|
||||
0xFFCC66));
|
||||
|
||||
/*AddImageTiled( 32, 128, 264, 1, 9107 );
|
||||
AddImageTiled( 42, 130, 264, 1, 9157 );
|
||||
|
|
@ -56,7 +56,7 @@ namespace Server.Engines.ConPVP
|
|||
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
|
||||
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -69,4 +69,4 @@ namespace Server.Engines.ConPVP
|
|||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -38,12 +38,12 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x, y, 3, "Add Participant");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Participants"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < context.Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)context.Participants[i];
|
||||
Participant p = context.Participants[i];
|
||||
|
||||
AddGoldenButtonLabeled(x, y, 4 + i,
|
||||
string.Format(p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count,
|
||||
|
|
@ -63,14 +63,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -129,11 +129,11 @@ namespace Server.Engines.ConPVP
|
|||
index -= 4;
|
||||
|
||||
if (index >= 0 && index < Context.Participants.Count)
|
||||
From.SendGump(new ParticipantGump(From, Context, (Participant)Context.Participants[index]));
|
||||
From.SendGump(new ParticipantGump(From, Context, Context.Participants[index]));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,18 +103,18 @@ namespace Server.Engines.ConPVP
|
|||
AddAlphaRegion(10, 10, 479, height - 20);
|
||||
|
||||
if (page > 0)
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1);
|
||||
else
|
||||
AddImage(446, height - 12 - 2 - 16, 0x2626);
|
||||
|
||||
if ((page + 1) * 15 < lc)
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2);
|
||||
else
|
||||
AddImage(466, height - 12 - 2 - 16, 0x2622);
|
||||
|
||||
AddHtml(16, height - 12 - 2 - 18, 400, 20,
|
||||
Color(string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc),
|
||||
0xFFC000), false, false);
|
||||
0xFFC000));
|
||||
|
||||
AddColumnHeader(75, "Rank");
|
||||
AddColumnHeader(115, "Level");
|
||||
|
|
@ -231,9 +231,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
@ -245,4 +245,4 @@ namespace Server.Engines.ConPVP
|
|||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3);
|
||||
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 );
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, );
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}", false, false);
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}");
|
||||
y += 22;
|
||||
|
||||
AddGoldenButtonLabeled(x + 20, y, 1, "Increase");
|
||||
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x + 20, y, 2, "Decrease");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Players"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Players"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < p.Players.Length; ++i)
|
||||
|
|
@ -71,14 +71,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -250,4 +250,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
|
|
@ -34,37 +34,37 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Ruleset cur = m_Defaults[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Base == cur && !ruleset.Changed)
|
||||
AddImage(35, y + 4, 0x939);
|
||||
else if (ruleset.Base == cur)
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom", false, false);
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0);
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom");
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1);
|
||||
|
||||
y += 22;
|
||||
y += 6;
|
||||
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"), false, false);
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"));
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < m_Flavors.Length; ++i)
|
||||
{
|
||||
Ruleset cur = m_Flavors[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Flavors.Contains(cur))
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Context != null && !m_Context.Registered)
|
||||
if (m_Context?.Registered == false)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
|
|
@ -123,4 +123,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
height += 4;
|
||||
|
||||
|
|
@ -44,19 +44,19 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (count == -1)
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"), false, false);
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count, false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"));
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count);
|
||||
}
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}", false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl != null && pl.Ready)
|
||||
if (pl?.Ready == true)
|
||||
{
|
||||
AddImage(35 + offset, y + 4, 0x939);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -106,4 +106,4 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 210, height, 9250);
|
||||
AddBackground(10, 10, 190, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"), false, false);
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"));
|
||||
|
||||
AddButton(35, 55, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(115, 55, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, 55, 247, 248, 1);
|
||||
AddButton(115, 55, 242, 241, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"));
|
||||
|
||||
int y = 20 + 25;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}", false, false);
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -91,12 +91,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 0, GumpButtonType.Page, 2);
|
||||
AddButton(169, y, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 2);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -140,20 +140,20 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}", false, false);
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}");
|
||||
|
||||
y = 70;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -164,7 +164,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -172,18 +172,18 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
y += 20;
|
||||
}
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(102, y, 247, 248, 1);
|
||||
AddButton(169, y, 242, 241, 3);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -196,8 +196,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -230,4 +230,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -53,7 +53,7 @@ namespace Server.Engines.ConPVP
|
|||
for (int i = 0; i < page.Children.Length; ++i)
|
||||
{
|
||||
AddGoldenButton(x, y, 1 + i);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
AddCheck(x, y, 0xD2, 0xD3, enabled, i);
|
||||
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i]);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -80,13 +80,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_DuelContext != null && !m_DuelContext.Registered)
|
||||
if (m_DuelContext?.Registered == false)
|
||||
return;
|
||||
|
||||
if (!m_ReadOnly)
|
||||
|
|
@ -127,4 +127,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Engines.ConPVP
|
|||
Match_Info,
|
||||
Player_Info
|
||||
}
|
||||
|
||||
|
||||
public class TournamentBracketGump : Gump
|
||||
{
|
||||
private const int BlackColor32 = 0x000008;
|
||||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
sb.Append(" Tournament Bracket");
|
||||
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()));
|
||||
|
||||
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
|
||||
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP
|
|||
text = "The tournament will begin shortly.";
|
||||
}
|
||||
|
||||
AddHtml(25, 92, 250, 40, text, false, false);
|
||||
AddHtml(25, 92, 250, 40, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ namespace Server.Engines.ConPVP
|
|||
60 + 18 + 20 + 20 + 20 + 8 + 20 + ruleset.Flavors.Count * 18 + 4 + 20 + changes * 22 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}");
|
||||
y += 20;
|
||||
|
||||
string tieText = null;
|
||||
|
|
@ -201,7 +201,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}");
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
|
@ -216,22 +216,22 @@ namespace Server.Engines.ConPVP
|
|||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}", false, false);
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}");
|
||||
y += 20;
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -242,7 +242,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -250,7 +250,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -265,8 +265,7 @@ namespace Server.Engines.ConPVP
|
|||
: new List<TourneyParticipant>(tourney.Participants);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"), false,
|
||||
false);
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
|
||||
|
||||
StartPage(out int index, out int count, out int y, 12);
|
||||
|
||||
|
|
@ -293,11 +292,11 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 1));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team", false, false);
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < part.Players.Count; ++i)
|
||||
|
|
@ -314,10 +313,10 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
AddHtml(25, y, 200, 20,
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}", false, false);
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}");
|
||||
y += 20;
|
||||
|
||||
AddHtml(25, y, 200, 20, "Log:", false, false);
|
||||
AddHtml(25, y, 200, 20, "Log:");
|
||||
y += 20;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -343,7 +342,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 3));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
if (!(obj is Mobile mob))
|
||||
break;
|
||||
|
|
@ -351,16 +350,13 @@ namespace Server.Engines.ConPVP
|
|||
Ladder ladder = Ladder.Instance;
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}", false, false);
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false,
|
||||
false);
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false,
|
||||
false);
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false);
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false);
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}");
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}");
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}");
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}");
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -370,7 +366,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
|
|
@ -389,11 +385,11 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 2));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
if (!(m_Object is PyramidLevel level))
|
||||
break;
|
||||
|
||||
|
||||
List<TourneyMatch> matchesList = m_List != null
|
||||
? Utility.CastListCovariant<object, TourneyMatch>(m_List)
|
||||
: new List<TourneyMatch>(level.Matches);
|
||||
|
|
@ -401,7 +397,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRightArrow(25, 53, ToButtonID(5, 0),
|
||||
$"Free Advance: {(level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList)}");
|
||||
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}", false, false);
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}");
|
||||
|
||||
StartPage(out int index, out int count, out int y, 10);
|
||||
|
||||
|
|
@ -529,14 +525,12 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 5));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}", false,
|
||||
false);
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, "Participants:", false, false);
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}");
|
||||
AddHtml(25, 93, 250, 20, "Participants:");
|
||||
|
||||
if (m_Tournament.TourneyType == TourneyType.Standard)
|
||||
for (int i = 0; i < match.Participants.Count; ++i)
|
||||
|
|
@ -613,7 +607,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
else if (m_Tournament.TourneyType == TourneyType.FreeForAll)
|
||||
AddHtml(25, 113, 250, 20, "Free For All", false, false);
|
||||
AddHtml(25, 113, 250, 20, "Free For All");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -642,17 +636,17 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid)
|
||||
|
|
@ -662,10 +656,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddLeftArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddLeftArrow(int x, int y, int bid)
|
||||
|
|
@ -859,4 +853,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
public class LadderEntry : IComparable
|
||||
public class LadderEntry : IComparable<LadderEntry>
|
||||
{
|
||||
private int m_Experience;
|
||||
private Ladder m_Ladder;
|
||||
|
|
@ -350,9 +350,9 @@ namespace Server.Engines.ConPVP
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Rank => Index;
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(LadderEntry l)
|
||||
{
|
||||
return ((LadderEntry)obj).m_Experience - m_Experience;
|
||||
return (l?.m_Experience ?? 0) - m_Experience;
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
get
|
||||
{
|
||||
for (int i = 0; i < Players.Length; ++i)
|
||||
if (Players[i] != null && !Players[i].Eliminated)
|
||||
if (Players[i]?.Eliminated == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -96,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
for (int i = 0; i < Players.Length; ++i)
|
||||
if (Players[i] != null && Players[i].Mobile == mob)
|
||||
if (Players[i]?.Mobile == mob)
|
||||
return Players[i];
|
||||
|
||||
return null;
|
||||
|
|
@ -228,4 +228,4 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Participant Participant{ get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ namespace Server.Engines.ConPVP
|
|||
AddColumnHeader(35, null);
|
||||
AddColumnHeader(115, "Arena");
|
||||
|
||||
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
|
||||
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2);
|
||||
|
||||
for (int i = 0; i < arenas.Count; ++i)
|
||||
{
|
||||
|
|
@ -258,9 +258,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (m_Root != null)
|
||||
return m_Root;
|
||||
|
||||
|
||||
List<RulesetLayout> entries = new List<RulesetLayout>
|
||||
{
|
||||
new RulesetLayout("Spells",
|
||||
|
|
@ -761,4 +761,4 @@ namespace Server.Engines.ConPVP
|
|||
return TotalLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override bool AllowHousing(Mobile from, Point3D p)
|
||||
{
|
||||
if (from.AccessLevel < AccessLevel.GameMaster)
|
||||
return false;
|
||||
|
||||
return base.AllowHousing(from, p);
|
||||
return from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
|
||||
}
|
||||
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
|
|
@ -35,12 +32,11 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
}
|
||||
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
PlayerMobile pm = m as PlayerMobile ??
|
||||
(m is BaseCreature bc && bc.Summoned ?
|
||||
bc.SummonMaster as PlayerMobile : null);
|
||||
|
||||
if (pm == null && m is BaseCreature bc && bc.Summoned)
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
|
||||
if (pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown)
|
||||
if (pm?.DuelContext?.StartedBeginCountdown == true)
|
||||
return true;
|
||||
|
||||
if (DuelContext.CheckCombat(m))
|
||||
|
|
@ -67,4 +63,4 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ namespace Server.Engines.ConPVP
|
|||
sb.Append(remaining.Count == 2 ? "between " : "among ");
|
||||
|
||||
sb.Append(remaining.Count);
|
||||
|
||||
|
||||
sb.Append(remaining[0].Players.Count == 1 ? " players: " : " teams: ");
|
||||
|
||||
bool hasAppended = false;
|
||||
|
|
@ -370,9 +370,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < part.Context.Participants.Count; ++i)
|
||||
{
|
||||
Participant check = part.Context.Participants[i];
|
||||
|
||||
if (check != null && !check.Eliminated)
|
||||
if (part.Context.Participants[i]?.Eliminated == false)
|
||||
++rem;
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +557,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile mob = players[i];
|
||||
|
||||
if (mob == null || mob.Deleted)
|
||||
if (mob?.Deleted != false)
|
||||
continue;
|
||||
|
||||
Item item = new Trophy(title, rank);
|
||||
|
|
@ -762,7 +760,7 @@ namespace Server.Engines.ConPVP
|
|||
if (!match.InProgress)
|
||||
for (int j = 0; j < Arenas.Count; ++j)
|
||||
{
|
||||
Arena arena = (Arena)Arenas[j];
|
||||
Arena arena = Arenas[j];
|
||||
|
||||
if (!arena.IsOccupied)
|
||||
{
|
||||
|
|
@ -794,7 +792,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (!bad)
|
||||
continue;
|
||||
|
||||
|
||||
for (int j = 0; j < part.Players.Count; ++j)
|
||||
part.Players[j].SendMessage("You have been disqualified from the tournament.");
|
||||
|
||||
|
|
@ -882,7 +880,7 @@ namespace Server.Engines.ConPVP
|
|||
Undefeated.Clear();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Undefeated.Count > 1)
|
||||
|
|
@ -895,7 +893,7 @@ namespace Server.Engines.ConPVP
|
|||
public void Alert(params string[] alerts)
|
||||
{
|
||||
for (int i = 0; i < Arenas.Count; ++i)
|
||||
Alert((Arena)Arenas[i], alerts);
|
||||
Alert(Arenas[i], alerts);
|
||||
}
|
||||
|
||||
public void Alert(Arena arena, params string[] alerts)
|
||||
|
|
@ -909,4 +907,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
TournamentController controller = m_Instances[i];
|
||||
|
||||
if (controller != null && !controller.Deleted && controller.Tournament != null &&
|
||||
if (controller?.Deleted == false && controller.Tournament != null &&
|
||||
controller.Tournament.Stage != TournamentStage.Inactive)
|
||||
return true;
|
||||
}
|
||||
|
|
@ -140,4 +140,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Faction fac = Faction.Find(mob);
|
||||
|
||||
if (fac != null) index = fac.Definition.Sort;
|
||||
if (fac != null)
|
||||
index = fac.Definition.Sort;
|
||||
}
|
||||
else if (partsPerMatch == 2)
|
||||
{
|
||||
|
|
@ -186,4 +187,4 @@ namespace Server.Engines.ConPVP
|
|||
public List<TourneyMatch> Matches{ get; set; } = new List<TourneyMatch>();
|
||||
public TourneyParticipant FreeAdvance{ get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
private CraftPage m_Page;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
/*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
|
||||
{
|
||||
}*/
|
||||
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool,
|
||||
notice, CraftPage.None)
|
||||
{
|
||||
}
|
||||
|
||||
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40)
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40)
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftSystem = craftSystem;
|
||||
|
|
@ -50,57 +41,56 @@ namespace Server.Engines.Craft
|
|||
AddAlphaRegion(10, 10, 510, 417);
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER>
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor); // <CENTER>NOTICES</CENTER>
|
||||
|
||||
AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT
|
||||
AddButton(15, 402, 4017, 4019, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor); // EXIT
|
||||
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2));
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor); // MAKE LAST
|
||||
|
||||
// Mark option
|
||||
if (craftSystem.MarkOption)
|
||||
{
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor,
|
||||
false, false); // MARK ITEM
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6));
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor); // MARK ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Resmelt option
|
||||
if (craftSystem.Resmelt)
|
||||
{
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1));
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor); // SMELT ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Repair option
|
||||
if (craftSystem.Repair)
|
||||
{
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5));
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor); // REPAIR ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Enhance option
|
||||
if (craftSystem.CanEnhance)
|
||||
{
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8));
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor); // ENHANCE ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
if (notice is int noticeInt && noticeInt > 0)
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor);
|
||||
else if (notice is string)
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>", false, false);
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>");
|
||||
|
||||
// If the system has more than one resource
|
||||
if (craftSystem.CraftSubRes.Init)
|
||||
|
|
@ -131,10 +121,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 362, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -169,10 +159,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 385, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -184,7 +174,7 @@ namespace Server.Engines.Craft
|
|||
CreateResList(false, from);
|
||||
else if (page == CraftPage.PickResource2)
|
||||
CreateResList(true, from);
|
||||
else if (context != null && context.LastGroupIndex > -1)
|
||||
else if (context?.LastGroupIndex > -1)
|
||||
CreateItemList(context.LastGroupIndex);
|
||||
}
|
||||
|
||||
|
|
@ -210,9 +200,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
CraftContext context = m_CraftSystem.GetContext(m_From);
|
||||
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4));
|
||||
AddHtmlLocalized(255, 263, 200, 18, context == null || !context.DoNotColor ? 1061591 : 1061590,
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
}
|
||||
|
||||
int resourceCount = 0;
|
||||
|
|
@ -225,11 +215,11 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[j].Amount;
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i));
|
||||
|
||||
if (subResource.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 250, 18, subResource.NameNumber, resourceCount.ToString(),
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, $"{subResource.NameString} ({resourceCount})");
|
||||
}
|
||||
|
|
@ -256,7 +246,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -264,21 +254,21 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i));
|
||||
}
|
||||
else
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor, false, false); // You haven't made anything yet.
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor); // You haven't made anything yet.
|
||||
}
|
||||
|
||||
public void CreateItemList(int selectedGroup)
|
||||
|
|
@ -304,7 +294,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -312,18 +302,18 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,17 +321,17 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor, false, false); // LAST TEN
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3));
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor); // LAST TEN
|
||||
|
||||
for (int i = 0; i < craftGroupCol.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt(i);
|
||||
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i));
|
||||
|
||||
if (craftGroup.NameNumber > 0)
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(50, 80 + i * 20, LabelHue, craftGroup.NameString);
|
||||
}
|
||||
|
|
@ -608,11 +598,11 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
|
||||
private enum CraftPage
|
||||
public enum CraftPage
|
||||
{
|
||||
None,
|
||||
PickResource,
|
||||
PickResource2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,41 +53,40 @@ namespace Server.Engines.Craft
|
|||
AddImageTiled(10, 387, 510, 22, 2624);
|
||||
AddAlphaRegion(10, 10, 510, 399);
|
||||
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor, false, false); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER>
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER>
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK
|
||||
AddButton(15, 387, 4014, 4016, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
|
||||
|
||||
bool needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile &&
|
||||
!mobile.HasRecipe(craftItem.Recipe);
|
||||
|
||||
if (needsRecipe)
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 1);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW
|
||||
}
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(330, 40, LabelHue, craftItem.NameString);
|
||||
|
||||
if (craftItem.UseAllRes)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor, false,
|
||||
false); // Makes as many as possible at once
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor); // Makes as many as possible at once
|
||||
|
||||
DrawItem();
|
||||
DrawSkill();
|
||||
|
|
@ -100,15 +99,14 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (craftItem.RequiredExpansion != Expansion.None)
|
||||
{
|
||||
bool supportsEx = from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion);
|
||||
bool supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true;
|
||||
TextDefinition.AddHtmlText(this, 170, 302 + m_OtherCount++ * 20, 310, 18,
|
||||
RequiredExpansionMessage(craftItem.RequiredExpansion), false, false,
|
||||
supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue);
|
||||
}
|
||||
|
||||
if (needsRecipe)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor, false,
|
||||
false); // You have not learned this recipe.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor); // You have not learned this recipe.
|
||||
}
|
||||
|
||||
private TextDefinition RequiredExpansionMessage(Expansion expansion)
|
||||
|
|
@ -132,8 +130,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.IsMarkable(type))
|
||||
{
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor, false,
|
||||
false); // This item may hold its maker's mark
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor); // This item may hold its maker's mark
|
||||
m_ShowExceptionalChance = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,8 +145,7 @@ namespace Server.Engines.Craft
|
|||
if (minSkill < 0)
|
||||
minSkill = 0;
|
||||
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false,
|
||||
false);
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
|
||||
AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +167,7 @@ namespace Server.Engines.Craft
|
|||
else if (chance > 1.0)
|
||||
chance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false); // Success Chance:
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
|
||||
AddLabel(430, 80, LabelHue, $"{chance * 100:F1}%");
|
||||
|
||||
if (m_ShowExceptionalChance)
|
||||
|
|
@ -181,7 +177,7 @@ namespace Server.Engines.Craft
|
|||
else if (excepChance > 1.0)
|
||||
excepChance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
|
||||
AddLabel(430, 100, LabelHue, $"{excepChance * 100:F1}%");
|
||||
}
|
||||
}
|
||||
|
|
@ -232,13 +228,12 @@ namespace Server.Engines.Craft
|
|||
if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, type))
|
||||
{
|
||||
retainedColor = true;
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor, false,
|
||||
false); // * The item retains the color of this material
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor); // * The item retains the color of this material
|
||||
AddLabel(500, 219 + i * 20, LabelHue, "*");
|
||||
}
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(170, 219 + i * 20, LabelHue, nameString);
|
||||
|
||||
|
|
@ -247,13 +242,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.NameNumber == 1041267) // runebook
|
||||
{
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor);
|
||||
AddLabel(430, 219 + m_CraftItem.Resources.Count * 20, LabelHue, "1");
|
||||
}
|
||||
|
||||
if (cropScroll)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor, false,
|
||||
false); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -292,4 +286,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
|
|
@ -273,16 +274,12 @@ namespace Server.Engines.Craft
|
|||
return false;
|
||||
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange(from.Location, 2);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z + 16 > from.Z && from.Z + 16 > item.Z && Find(item.ItemID, itemIDs))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool found = eable.Any(item => item.Z + 16 > item.Z && item.Z + 16 > item.Z && Find(item.ItemID, itemIDs));
|
||||
eable.Free();
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
for (int x = -2; x <= 2; ++x)
|
||||
for (int y = -2; y <= 2; ++y)
|
||||
{
|
||||
|
|
@ -758,7 +755,7 @@ namespace Server.Engines.Craft
|
|||
if (from.BeginAction<CraftSystem>())
|
||||
{
|
||||
if (RequiredExpansion == Expansion.None ||
|
||||
from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion))
|
||||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
|
||||
|
|
@ -860,7 +857,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
|
||||
else
|
||||
from.SendLocalizedMessage(badCraft);
|
||||
|
|
@ -876,7 +873,7 @@ namespace Server.Engines.Craft
|
|||
ref checkMessage)
|
||||
&& ConsumeAttributes(from, ref checkMessage, false)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
|
||||
else if (checkMessage is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -905,7 +902,7 @@ namespace Server.Engines.Craft
|
|||
if (!(ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)
|
||||
&& ConsumeAttributes(from, ref message, true)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageIn && messageIn > 0)
|
||||
from.SendLocalizedMessage(messageIn);
|
||||
|
|
@ -992,7 +989,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town != null && town.Owner == faction)
|
||||
if (town?.Owner == faction)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
|
|
@ -1013,14 +1010,14 @@ namespace Server.Engines.Craft
|
|||
if (queryFactionImbue)
|
||||
from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction,
|
||||
def));
|
||||
else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
else if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, num));
|
||||
else if (num > 0)
|
||||
from.SendLocalizedMessage(num);
|
||||
}
|
||||
else if (!allRequiredSkills)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
|
||||
else
|
||||
from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
|
||||
|
|
@ -1036,7 +1033,7 @@ namespace Server.Engines.Craft
|
|||
// Not enough resource to craft it
|
||||
if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -1104,7 +1101,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
|
||||
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
|
||||
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
|
||||
else
|
||||
m_From.SendLocalizedMessage(badCraft);
|
||||
|
|
|
|||
|
|
@ -4,14 +4,11 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftRes
|
||||
{
|
||||
public CraftRes(Type type, int amount)
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message = null)
|
||||
{
|
||||
ItemType = type;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message) : this(type, amount)
|
||||
{
|
||||
NameNumber = name;
|
||||
MessageNumber = message;
|
||||
|
||||
|
|
@ -41,4 +38,4 @@ namespace Server.Engines.Craft
|
|||
from.SendLocalizedMessage(502925); // You don't have the resources required to make that item.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ namespace Server.Engines.Craft
|
|||
|
||||
public double RequiredSkill{ get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ namespace Server.Engines.Craft
|
|||
AddBackground(0, 0, 220, 170, 5054);
|
||||
AddBackground(10, 10, 200, 150, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item?
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
|
||||
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -52,4 +52,4 @@ namespace Server.Engines.Craft
|
|||
m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,16 +34,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int ID{ get; }
|
||||
|
||||
public TextDefinition TextDefinition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_TD == null)
|
||||
m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString);
|
||||
|
||||
return m_TD;
|
||||
}
|
||||
}
|
||||
public TextDefinition TextDefinition => m_TD ?? (m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString));
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return SmeltResult.Invalid;
|
||||
|
|
|
|||
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044001;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefAlchemy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -35,8 +26,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
|
|
@ -180,4 +172,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,16 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044002;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBlacksmithy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBlacksmithy());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -111,7 +102,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -801,4 +792,4 @@ namespace Server.Engines.Craft
|
|||
public class AnvilAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044006;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBowFletching();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBowFletching());
|
||||
|
||||
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -212,4 +203,4 @@ namespace Server.Engines.Craft
|
|||
Repair = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044004;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCarpentry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -545,4 +536,4 @@ namespace Server.Engines.Craft
|
|||
AddSubRes(typeof(FrostwoodLog), 1072649, 100.0, 1044041, 1072652);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044008;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCartography();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -76,4 +67,4 @@ namespace Server.Engines.Craft
|
|||
AddCraft(typeof(WorldMap), 1044448, 1015233, 39.5, 99.5, typeof(BlankMap), 1044449, 1, 1044450);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044003;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCooking();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCooking());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -292,4 +283,4 @@ namespace Server.Engines.Craft
|
|||
/* End Chocolatiering */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,28 +16,16 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044622;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefGlassblowing();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
if (item.ItemType == typeof(HollowPrism))
|
||||
return 0.5; // 50%
|
||||
|
||||
return 0.0; // 0%
|
||||
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
|
||||
}
|
||||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -48,10 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
DefBlacksmithy.CheckAnvilAndForge(from, 2, out _, out bool forge);
|
||||
|
||||
if (forge)
|
||||
return 0;
|
||||
|
||||
return 1044628; // You must be near a forge to blow glass.
|
||||
return forge ? 0 : 1044628; // You must be near a forge to blow glass.
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect(Mobile from)
|
||||
|
|
@ -128,4 +113,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,16 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044009;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefInscription();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -54,7 +45,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -65,9 +56,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (o is SpellScroll scroll)
|
||||
{
|
||||
Spellbook book = Spellbook.Find(from, scroll.SpellID);
|
||||
|
||||
bool hasSpell = book != null && book.HasSpell(scroll.SpellID);
|
||||
bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;
|
||||
|
||||
scroll.Delete();
|
||||
|
||||
|
|
@ -121,7 +110,6 @@ namespace Server.Engines.Craft
|
|||
switch (m_Circle)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
minSkill = -25.0;
|
||||
maxSkill = 25.0;
|
||||
break;
|
||||
|
|
@ -409,4 +397,4 @@ namespace Server.Engines.Craft
|
|||
SpidersSilk
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044500;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefMasonry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -39,7 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -139,4 +130,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue