mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 12:19:15 +12:00
Change default intrest rate,
and start adding ranches
This commit is contained in:
parent
02876ec2b4
commit
81440b1814
7 changed files with 1208 additions and 18 deletions
|
@ -27,20 +27,26 @@ namespace HISP.Game
|
|||
public static int NewUserStartY;
|
||||
public static int GetTileId(int x, int y, bool overlay)
|
||||
{
|
||||
if ((x > Width || x < 0) || (y > Height || y < 0)) // Outside map?
|
||||
return 0x1;
|
||||
|
||||
int pos = ((x * Height) + y);
|
||||
|
||||
if (overlay && Treasure.IsTileBuiredTreasure(x, y))
|
||||
if (pos >= oMapData.Length && overlay)
|
||||
return 1;
|
||||
else if (pos >= MapData.Length && !overlay)
|
||||
return 1;
|
||||
else if (overlay && oMapData[pos] != 1)
|
||||
return oMapData[pos];
|
||||
else if (overlay && Treasure.IsTileBuiredTreasure(x, y))
|
||||
return 193; // Burried Treasure tile.
|
||||
else if (overlay && Treasure.IsTilePotOfGold(x, y))
|
||||
return 186; // Pot of Gold tile.
|
||||
|
||||
if (overlay)
|
||||
return oMapData[pos];
|
||||
else
|
||||
else if (overlay && Ranch.IsRanchHere(x, y))
|
||||
return 170 + Ranch.GetRanchAt(x, y).Upgraded; // Ranch Tile + Upgraded amount
|
||||
else if (overlay)
|
||||
return 1;
|
||||
else if (!overlay)
|
||||
return MapData[pos];
|
||||
else // Not sure how you could even get here.
|
||||
return 1;
|
||||
}
|
||||
public static bool CheckPassable(int x, int y)
|
||||
{
|
||||
|
|
59
Horse Isle Server/HorseIsleServer/Game/Ranch.cs
Normal file
59
Horse Isle Server/HorseIsleServer/Game/Ranch.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Game
|
||||
{
|
||||
public class Ranch
|
||||
{
|
||||
public class RanchBuilding
|
||||
{
|
||||
public static List<RanchBuilding> RanchBuildings = new List<RanchBuilding>();
|
||||
public int Id;
|
||||
public string Type;
|
||||
public int Cost;
|
||||
public string Title;
|
||||
public string Description;
|
||||
public int Limit;
|
||||
}
|
||||
public static List<Ranch> Ranches = new List<Ranch>();
|
||||
|
||||
public int X;
|
||||
public int Y;
|
||||
public int Id;
|
||||
public int Value;
|
||||
|
||||
public int OwnerId;
|
||||
public int Upgraded;
|
||||
public Ranch(int x, int y, int id, int value)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Id = id;
|
||||
Value = value;
|
||||
Upgraded = 0;
|
||||
OwnerId = -1;
|
||||
}
|
||||
|
||||
public static bool IsRanchHere(int x, int y)
|
||||
{
|
||||
foreach (Ranch ranch in Ranches)
|
||||
{
|
||||
if (ranch.X == x && ranch.Y == y)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static Ranch GetRanchAt(int x, int y)
|
||||
{
|
||||
foreach(Ranch ranch in Ranches)
|
||||
{
|
||||
if (ranch.X == x && ranch.Y == y)
|
||||
return ranch;
|
||||
}
|
||||
throw new KeyNotFoundException("No Ranch found at x" + x + " y" + y);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue