#W# Added House limit to Settings.cs. Statichouses can now be odd shapes the statichouse.cfg can take more that 1 set of xy coords.
This commit is contained in:
parent
dc5e0577fd
commit
eea0f9defb
8 changed files with 246 additions and 80 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
|
|
@ -38,37 +39,39 @@ namespace Server.Custom.StaticHousing
|
|||
|
||||
string[] split = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (split.Length >= 13)
|
||||
// We need at least 14 arguments now (10 base + 4 for the first area)
|
||||
if (split.Length >= 14)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map map = Map.Parse(split[0]);
|
||||
Point3D signLoc = new Point3D(int.Parse(split[1]), int.Parse(split[2]), int.Parse(split[3]));
|
||||
|
||||
Point2D start = new Point2D(int.Parse(split[4]), int.Parse(split[5]));
|
||||
Point2D end = new Point2D(start.X + int.Parse(split[6]), start.Y + int.Parse(split[7]));
|
||||
Rectangle2D area = new Rectangle2D(start, end);
|
||||
|
||||
int minZ = int.Parse(split[8]);
|
||||
int maxZ = int.Parse(split[9]);
|
||||
int price = int.Parse(split[10]);
|
||||
int locks = int.Parse(split[11]);
|
||||
int secures = int.Parse(split[12]);
|
||||
int minZ = int.Parse(split[4]);
|
||||
int maxZ = int.Parse(split[5]);
|
||||
int price = int.Parse(split[6]);
|
||||
int locks = int.Parse(split[7]);
|
||||
int secures = int.Parse(split[8]);
|
||||
|
||||
// --- NEW ITEM ID PARSING ---
|
||||
int itemID = 0xC0B; // Defaults to the East-facing sign
|
||||
if (split.Length >= 14)
|
||||
int itemID = split[9].StartsWith("0x", StringComparison.OrdinalIgnoreCase)
|
||||
? Convert.ToInt32(split[9], 16)
|
||||
: int.Parse(split[9]);
|
||||
|
||||
// Loop to capture ALL blocks appended to the end of the line!
|
||||
List<Rectangle2D> areas = new List<Rectangle2D>();
|
||||
for (int i = 10; i < split.Length; i += 4)
|
||||
{
|
||||
if (split[13].StartsWith("0x", StringComparison.OrdinalIgnoreCase))
|
||||
itemID = Convert.ToInt32(split[13], 16);
|
||||
else
|
||||
itemID = int.Parse(split[13]);
|
||||
if (i + 3 < split.Length)
|
||||
{
|
||||
Point2D start = new Point2D(int.Parse(split[i]), int.Parse(split[i + 1]));
|
||||
Point2D end = new Point2D(start.X + int.Parse(split[i + 2]), start.Y + int.Parse(split[i + 3]));
|
||||
areas.Add(new Rectangle2D(start, end));
|
||||
}
|
||||
}
|
||||
|
||||
if (map != null && !CheckForExistingHouse(map, signLoc))
|
||||
if (map != null && !CheckForExistingHouse(map, signLoc) && areas.Count > 0)
|
||||
{
|
||||
// Pass the parsed itemID into the new sign!
|
||||
StaticHouseSign sign = new StaticHouseSign(itemID, area, minZ, maxZ, price, locks, secures);
|
||||
StaticHouseSign sign = new StaticHouseSign(itemID, areas.ToArray(), minZ, maxZ, price, locks, secures);
|
||||
sign.MoveToWorld(signLoc, map);
|
||||
count++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue