#W# Inn room size and price now set in inndoors.cfg.
This commit is contained in:
parent
9415670556
commit
8f44a3fe50
8 changed files with 114 additions and 84 deletions
|
|
@ -3,7 +3,7 @@ using System.IO;
|
|||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Custom.InnRooms; // Ensure it can find our InnDoor!
|
||||
using Server.Custom.InnRooms;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
|
|
@ -30,7 +30,6 @@ namespace Server.Commands
|
|||
private int m_Count;
|
||||
private static Queue m_Queue = new Queue();
|
||||
|
||||
// Finds and deletes existing InnDoors at the target location to prevent stacking
|
||||
public static bool FindExistingDoor(Map map, Point3D p)
|
||||
{
|
||||
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
|
||||
|
|
@ -41,7 +40,7 @@ namespace Server.Commands
|
|||
{
|
||||
int delta = item.Z - p.Z;
|
||||
|
||||
if (delta >= -12 && delta <= 12) // Uses your existing Z-delta logic
|
||||
if (delta >= -12 && delta <= 12)
|
||||
m_Queue.Enqueue(item);
|
||||
}
|
||||
}
|
||||
|
|
@ -54,16 +53,16 @@ namespace Server.Commands
|
|||
return false;
|
||||
}
|
||||
|
||||
public void CreateDoor(Point3D loc, Map mapLoc, Point3D roomLoc, Map roomMap, int itemID)
|
||||
// --- ADDED RECTANGLE2D PARAMETER ---
|
||||
public void CreateDoor(Point3D loc, Map mapLoc, Point3D roomLoc, Map roomMap, int rentCost, int itemID, Rectangle2D roomArea)
|
||||
{
|
||||
if (!FindExistingDoor(mapLoc, loc))
|
||||
{
|
||||
m_Count++;
|
||||
|
||||
// Uses our new parameterized constructor for custom facings!
|
||||
InnDoor door = new InnDoor(itemID);
|
||||
// Passing the custom boundary into the door!
|
||||
InnDoor door = new InnDoor(itemID, roomArea, rentCost);
|
||||
|
||||
// Wire up the void room coordinates automatically
|
||||
door.RoomLocation = roomLoc;
|
||||
door.RoomMap = roomMap;
|
||||
|
||||
|
|
@ -73,8 +72,7 @@ namespace Server.Commands
|
|||
|
||||
public int CreateDoors()
|
||||
{
|
||||
// Reads from the same Decoration directory[cite: 3]
|
||||
string filePath = Path.Combine(Core.BaseDirectory, "Data", "Decoration", "inndoors.cfg");
|
||||
string filePath = Path.Combine(Core.BaseDirectory, "Data", "Config", "inndoors.cfg");
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
|
|
@ -94,8 +92,8 @@ namespace Server.Commands
|
|||
|
||||
string[] split = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// We need at least 8 arguments (Door Map/X/Y/Z and Room Map/X/Y/Z)
|
||||
if (split.Length >= 8)
|
||||
// --- EXPANDED TO 13 ARGUMENTS ---
|
||||
if (split.Length >= 14)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -108,21 +106,23 @@ namespace Server.Commands
|
|||
int xRoom = int.Parse(split[5]);
|
||||
int yRoom = int.Parse(split[6]);
|
||||
int zRoom = int.Parse(split[7]);
|
||||
|
||||
// Optional 9th argument: ItemID for custom facings! Defaults to 0x6E5 (1765) if missing.
|
||||
int rentCost = int.Parse(split[8]);
|
||||
int itemID = 1765;
|
||||
if (split.Length >= 9)
|
||||
{
|
||||
// Handles both hex (0x6F3) and integer (1779) formats
|
||||
if (split[8].StartsWith("0x", StringComparison.OrdinalIgnoreCase))
|
||||
itemID = Convert.ToInt32(split[8], 16);
|
||||
else
|
||||
itemID = int.Parse(split[8]);
|
||||
}
|
||||
if (split[8].StartsWith("0x", StringComparison.OrdinalIgnoreCase))
|
||||
itemID = Convert.ToInt32(split[9], 16);
|
||||
else
|
||||
itemID = int.Parse(split[9]);
|
||||
|
||||
// Parsing the new custom boundaries
|
||||
int startX = int.Parse(split[10]);
|
||||
int startY = int.Parse(split[11]);
|
||||
int width = int.Parse(split[12]);
|
||||
int height = int.Parse(split[13]);
|
||||
Rectangle2D roomArea = new Rectangle2D(startX, startY, width, height);
|
||||
|
||||
if (mapLoc != null && mapRoom != null)
|
||||
{
|
||||
CreateDoor(new Point3D(xLoc, yLoc, zLoc), mapLoc, new Point3D(xRoom, yRoom, zRoom), mapRoom, itemID);
|
||||
CreateDoor(new Point3D(xLoc, yLoc, zLoc), mapLoc, new Point3D(xRoom, yRoom, zRoom), mapRoom, rentCost, itemID, roomArea);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue