Modernization Fixes & Updates to Default Values (#3)
This commit is contained in:
parent
445eddff68
commit
dcf64091b1
768 changed files with 10507 additions and 14196 deletions
|
|
@ -247,7 +247,6 @@ namespace Server.PathAlgorithms.FastAStar
|
|||
int px = p % AreaSize;
|
||||
int py = p / AreaSize % AreaSize;
|
||||
int pz = m_Nodes[p].z;
|
||||
int x, y, z;
|
||||
|
||||
Point3D p3D = new Point3D(px + m_xOffset, py + m_yOffset, pz);
|
||||
|
||||
|
|
@ -256,6 +255,8 @@ namespace Server.PathAlgorithms.FastAStar
|
|||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
switch (i)
|
||||
{
|
||||
default:
|
||||
|
|
@ -299,7 +300,7 @@ namespace Server.PathAlgorithms.FastAStar
|
|||
if (x < 0 || x >= AreaSize || y < 0 || y >= AreaSize)
|
||||
continue;
|
||||
|
||||
if (CalcMoves.CheckMovement(m, map, p3D, (Direction)i, out z))
|
||||
if (CalcMoves.CheckMovement(m, map, p3D, (Direction)i, out int z))
|
||||
{
|
||||
int idx = GetIndex(x + m_xOffset, y + m_yOffset, z);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ namespace Server.Movement
|
|||
return false;
|
||||
}
|
||||
|
||||
int startZ, startTop;
|
||||
|
||||
IEnumerable<Item> itemsStart, itemsForward, itemsLeft, itemsRight;
|
||||
|
||||
bool ignoreMovableImpassables = MovementImpl.IgnoreMovableImpassables;
|
||||
|
|
@ -85,7 +83,7 @@ namespace Server.Movement
|
|||
itemsRight = Enumerable.Empty<Item>();
|
||||
}
|
||||
|
||||
GetStartZ(m, map, loc, itemsStart, out startZ, out startTop);
|
||||
GetStartZ(m, map, loc, itemsStart, out int startZ, out int startTop);
|
||||
|
||||
List<Item> list = null;
|
||||
|
||||
|
|
@ -95,13 +93,11 @@ namespace Server.Movement
|
|||
|
||||
if (moveIsOk && checkDiagonals)
|
||||
{
|
||||
int hold;
|
||||
|
||||
if (m.Player && m.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
MovementPool.AcquireMoveCache(ref list, itemsLeft);
|
||||
|
||||
if (!Check(map, m, list, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
|
||||
if (!Check(map, m, list, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk, out _))
|
||||
{
|
||||
moveIsOk = false;
|
||||
}
|
||||
|
|
@ -109,7 +105,7 @@ namespace Server.Movement
|
|||
{
|
||||
MovementPool.AcquireMoveCache(ref list, itemsRight);
|
||||
|
||||
if (!Check(map, m, list, xRight, yRight, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
|
||||
if (!Check(map, m, list, xRight, yRight, startTop, startZ, m.CanSwim, m.CantWalk, out _))
|
||||
moveIsOk = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -117,11 +113,11 @@ namespace Server.Movement
|
|||
{
|
||||
MovementPool.AcquireMoveCache(ref list, itemsLeft);
|
||||
|
||||
if (!Check(map, m, list, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
|
||||
if (!Check(map, m, list, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk, out _))
|
||||
{
|
||||
MovementPool.AcquireMoveCache(ref list, itemsRight);
|
||||
|
||||
if (!Check(map, m, list, xRight, yRight, startTop, startZ, m.CanSwim, m.CantWalk, out hold))
|
||||
if (!Check(map, m, list, xRight, yRight, startTop, startZ, m.CanSwim, m.CantWalk, out _))
|
||||
moveIsOk = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +132,8 @@ namespace Server.Movement
|
|||
|
||||
public bool CheckMovement(Mobile m, Direction d, out int newZ)
|
||||
{
|
||||
if (!Enabled && _Successor != null) return _Successor.CheckMovement(m, d, out newZ);
|
||||
if (!Enabled && _Successor != null)
|
||||
return _Successor.CheckMovement(m, d, out newZ);
|
||||
|
||||
return CheckMovement(m, m.Map, m.Location, d, out newZ);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ namespace Server.Movement
|
|||
|
||||
private const TileFlag ImpassableSurface = TileFlag.Impassable | TileFlag.Surface;
|
||||
|
||||
private List<Mobile>[] m_MobPools = new List<Mobile>[3]
|
||||
{
|
||||
private List<Mobile>[] m_MobPools = {
|
||||
new List<Mobile>(), new List<Mobile>(),
|
||||
new List<Mobile>()
|
||||
};
|
||||
|
||||
private List<Item>[] m_Pools = new List<Item>[4]
|
||||
{
|
||||
private List<Item>[] m_Pools = {
|
||||
new List<Item>(), new List<Item>(),
|
||||
new List<Item>(), new List<Item>()
|
||||
};
|
||||
|
|
@ -64,8 +62,6 @@ namespace Server.Movement
|
|||
return false;
|
||||
}
|
||||
|
||||
int startZ, startTop;
|
||||
|
||||
List<Item> itemsStart = m_Pools[0];
|
||||
List<Item> itemsForward = m_Pools[1];
|
||||
List<Item> itemsLeft = m_Pools[2];
|
||||
|
|
@ -217,27 +213,25 @@ namespace Server.Movement
|
|||
}
|
||||
}
|
||||
|
||||
GetStartZ(m, map, loc, itemsStart, out startZ, out startTop);
|
||||
GetStartZ(m, map, loc, itemsStart, out int startZ, out int startTop);
|
||||
|
||||
bool moveIsOk = Check(map, m, itemsForward, mobsForward, xForward, yForward, startTop, startZ, m.CanSwim,
|
||||
m.CantWalk, out newZ);
|
||||
|
||||
if (moveIsOk && checkDiagonals)
|
||||
{
|
||||
int hold;
|
||||
|
||||
if (m.Player && m.AccessLevel < AccessLevel.GameMaster)
|
||||
{
|
||||
if (!Check(map, m, itemsLeft, mobsLeft, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk,
|
||||
out hold) || !Check(map, m, itemsRight, mobsRight, xRight, yRight, startTop, startZ, m.CanSwim,
|
||||
m.CantWalk, out hold))
|
||||
out _) || !Check(map, m, itemsRight, mobsRight, xRight, yRight, startTop, startZ, m.CanSwim,
|
||||
m.CantWalk, out _))
|
||||
moveIsOk = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Check(map, m, itemsLeft, mobsLeft, xLeft, yLeft, startTop, startZ, m.CanSwim, m.CantWalk,
|
||||
out hold) && !Check(map, m, itemsRight, mobsRight, xRight, yRight, startTop, startZ, m.CanSwim,
|
||||
m.CantWalk, out hold))
|
||||
out _) && !Check(map, m, itemsRight, mobsRight, xRight, yRight, startTop, startZ, m.CanSwim,
|
||||
m.CantWalk, out _))
|
||||
moveIsOk = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,7 +352,6 @@ namespace Server.Movement
|
|||
int itemZ = tile.Z;
|
||||
int itemTop = itemZ;
|
||||
int ourZ = itemZ + itemData.CalcHeight;
|
||||
int ourTop = ourZ + PersonHeight;
|
||||
int testTop = checkTop;
|
||||
|
||||
if (moveIsOk)
|
||||
|
|
@ -415,7 +408,6 @@ namespace Server.Movement
|
|||
int itemZ = item.Z;
|
||||
int itemTop = itemZ;
|
||||
int ourZ = itemZ + itemData.CalcHeight;
|
||||
int ourTop = ourZ + PersonHeight;
|
||||
int testTop = checkTop;
|
||||
|
||||
if (moveIsOk)
|
||||
|
|
@ -458,7 +450,6 @@ namespace Server.Movement
|
|||
if (considerLand && !landBlocks && stepTop >= landZ)
|
||||
{
|
||||
int ourZ = landCenter;
|
||||
int ourTop = ourZ + PersonHeight;
|
||||
int testTop = checkTop;
|
||||
|
||||
if (ourZ + PersonHeight > testTop)
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public static void Path_OnTarget(Mobile from, object obj)
|
||||
public static void Path_OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (!(obj is IPoint3D p))
|
||||
if (!(targeted is IPoint3D p))
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
|
@ -104,47 +104,6 @@ namespace Server
|
|||
Path(from, p, FastAStarAlgorithm.Instance, "Fast", 0);
|
||||
Path(from, p, SlowAStarAlgorithm.Instance, "Slow", 2);
|
||||
OverrideAlgorithm = null;
|
||||
|
||||
/*MovementPath path = new MovementPath( from, new Point3D( p ) );
|
||||
|
||||
if ( !path.Success )
|
||||
{
|
||||
from.SendMessage( "No path to there could be found." );
|
||||
}
|
||||
else
|
||||
{
|
||||
//for ( int i = 0; i < path.Directions.Length; ++i )
|
||||
// Timer.DelayCall( TimeSpan.FromSeconds( 0.1 + (i * 0.3) ), new TimerStateCallback( Pathfind ), new object[]{ from, path.Directions[i] } );
|
||||
int x = from.X;
|
||||
int y = from.Y;
|
||||
int z = from.Z;
|
||||
|
||||
for ( int i = 0; i < path.Directions.Length; ++i )
|
||||
{
|
||||
Movement.Movement.Offset( path.Directions[i], ref x, ref y );
|
||||
|
||||
new Items.RecallRune().MoveToWorld( new Point3D( x, y, z ), from.Map );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void Pathfind(object state)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
Direction d = (Direction)states[1];
|
||||
|
||||
try
|
||||
{
|
||||
from.Direction = d;
|
||||
from.NetState.BlockAllPackets = true;
|
||||
from.Move(d);
|
||||
from.NetState.BlockAllPackets = false;
|
||||
from.ProcessDelta();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,7 @@ namespace Server.PathAlgorithms
|
|||
{
|
||||
public abstract class PathAlgorithm
|
||||
{
|
||||
private static Direction[] m_CalcDirections = new Direction[9]
|
||||
{
|
||||
private static Direction[] m_CalcDirections = {
|
||||
Direction.Up,
|
||||
Direction.North,
|
||||
Direction.Right,
|
||||
|
|
|
|||
|
|
@ -65,20 +65,19 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
PathNode[] closed = m_Closed, open = m_Open, successors = m_Successors;
|
||||
Direction[] path = m_Path;
|
||||
|
||||
int closedCount = 0, openCount = 0, sucCount = 0, pathCount = 0;
|
||||
int popIndex, curF;
|
||||
int x, y, z;
|
||||
int closedCount = 0, openCount = 0;
|
||||
int pathCount = 0;
|
||||
int depth = 0;
|
||||
|
||||
int xBacktrack, yBacktrack, zBacktrack, iBacktrack = 0;
|
||||
int iBacktrack = 0;
|
||||
|
||||
open[openCount++] = startNode;
|
||||
|
||||
while (openCount > 0)
|
||||
{
|
||||
curNode = open[0];
|
||||
curF = curNode.g + curNode.h;
|
||||
popIndex = 0;
|
||||
int curF = curNode.g + curNode.h;
|
||||
int popIndex = 0;
|
||||
|
||||
for (int i = 1; i < openCount; ++i)
|
||||
if (open[i].g + open[i].h < curF)
|
||||
|
|
@ -95,9 +94,9 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
|
||||
closed[closedCount++] = curNode;
|
||||
|
||||
xBacktrack = curNode.px;
|
||||
yBacktrack = curNode.py;
|
||||
zBacktrack = curNode.pz;
|
||||
int xBacktrack = curNode.px;
|
||||
int yBacktrack = curNode.py;
|
||||
int zBacktrack = curNode.pz;
|
||||
|
||||
if (pathCount == MaxNodes)
|
||||
break;
|
||||
|
|
@ -148,7 +147,7 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
for (int i = popIndex; i < openCount; ++i)
|
||||
open[i] = open[i + 1];
|
||||
|
||||
sucCount = 0;
|
||||
int sucCount = 0;
|
||||
|
||||
if (bc != null)
|
||||
{
|
||||
|
|
@ -158,6 +157,9 @@ namespace Server.PathAlgorithms.SlowAStar
|
|||
|
||||
MoveImpl.Goal = goal;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
switch (i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue