mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 23:25:41 +12:00
Fix bug where building in your ranch builds in all ranches
This commit is contained in:
parent
8c43129303
commit
06b810cef3
6 changed files with 81 additions and 25 deletions
|
@ -902,6 +902,11 @@
|
|||
{"id":2,"max":1000,"cost":0.8},
|
||||
{"id":3,"max":750,"cost":0.4}
|
||||
],
|
||||
},
|
||||
"farrier":{
|
||||
"price_multipliers":[
|
||||
{"id":1,"steel":1000,"steelcost":500,"iron":750, "ironcost":100}
|
||||
]
|
||||
}
|
||||
},
|
||||
"horses":{
|
||||
|
|
|
@ -421,6 +421,15 @@ namespace HISP.Game
|
|||
public static string PirateTreasureFormat;
|
||||
public static string PotOfGoldFormat;
|
||||
|
||||
// Farrier
|
||||
public static string FarrierCurrentShoesFormat;
|
||||
public static string FarrierApplyIronShoesFormat;
|
||||
public static string FarrierApplySteelShoesFormat;
|
||||
|
||||
|
||||
public static string FarrierPutOnSteelShoesMessageFormat;
|
||||
public static string FarrierPutOnIronShoesMessageFormat;
|
||||
public static string FarrierPutOnSteelShoesAllMessageFormat;
|
||||
|
||||
// Groomer
|
||||
|
||||
|
|
|
@ -724,7 +724,7 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
public static string BuildHorseList(User user)
|
||||
public static string BuildWildHorseList(User user)
|
||||
{
|
||||
string message = "";
|
||||
WildHorse[] horses = WildHorse.GetHorsesAt(user.X, user.Y);
|
||||
|
@ -940,7 +940,7 @@ namespace HISP.Game
|
|||
return message;
|
||||
}
|
||||
|
||||
public static string BuildHorseList()
|
||||
public static string BuildHorseBreedListLibary()
|
||||
{
|
||||
string message = "";
|
||||
foreach (HorseInfo.Breed breed in HorseInfo.Breeds.OrderBy(o => o.Name).ToList())
|
||||
|
@ -1921,7 +1921,7 @@ namespace HISP.Game
|
|||
{
|
||||
string message = "";
|
||||
message += buildLocationString(x, y);
|
||||
message += BuildHorseList(user);
|
||||
message += BuildWildHorseList(user);
|
||||
message += buildNpc(user, x, y);
|
||||
|
||||
|
||||
|
|
42
Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs
Normal file
42
Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Game.Services
|
||||
{
|
||||
public class Farrier
|
||||
{
|
||||
private static List<Farrier> farriers = new List<Farrier>();
|
||||
public static Farrier[] Farriers
|
||||
{
|
||||
get
|
||||
{
|
||||
return farriers.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public int Id;
|
||||
public int SteelShoesAmount;
|
||||
public int SteelCost;
|
||||
public int IronShoesAmount;
|
||||
public int IronCost;
|
||||
|
||||
public Farrier(int id, int steelShoesInc, int steelCost, int ironShoesInc, int ironCost)
|
||||
{
|
||||
this.Id = id;
|
||||
this.SteelShoesAmount = steelShoesInc;
|
||||
this.SteelCost = steelCost;
|
||||
this.IronShoesAmount = ironShoesInc;
|
||||
this.IronCost = ironCost;
|
||||
farriers.Add(this);
|
||||
}
|
||||
|
||||
public static Farrier GetFarrierById(int id)
|
||||
{
|
||||
foreach (Farrier farrier in Farriers)
|
||||
if (farrier.Id == id)
|
||||
return farrier;
|
||||
throw new KeyNotFoundException("No farrier with id: " + id + " found.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -487,7 +487,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET upgradeLevel=@upgradeLevel";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET upgradeLevel=@upgradeLevel WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@upgradeLevel", upgradeLevel);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -501,7 +501,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET investedMoney=@investedMoney";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET investedMoney=@investedMoney WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@investedMoney", investedMoney);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -515,7 +515,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET playerId=@ownerId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET playerId=@ownerId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@ownerId", ownerId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -529,7 +529,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET description=@description";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET description=@description WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@description", description);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -543,7 +543,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET title=@title";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET title=@title WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@title", title);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -557,7 +557,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building16=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building16=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -571,7 +571,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building15=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building15=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -585,7 +585,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building14=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building14=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -599,7 +599,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building13=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building13=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -613,7 +613,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building12=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building12=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -627,7 +627,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building11=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building11=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -641,7 +641,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building10=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building10=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -655,7 +655,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building9=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building9=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -669,7 +669,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building8=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building8=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -683,7 +683,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building7=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building7=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -697,7 +697,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building6=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building6=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -711,7 +711,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building5=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building5=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -725,7 +725,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building4=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building4=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -739,7 +739,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building3=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building3=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -753,7 +753,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building2=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building2=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
@ -767,7 +767,7 @@ namespace HISP.Server
|
|||
{
|
||||
db.Open();
|
||||
MySqlCommand sqlCommand = db.CreateCommand();
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building1=@buildingId";
|
||||
sqlCommand.CommandText = "UPDATE Ranches SET building1=@buildingId WHERE ranchId=@ranchId";
|
||||
sqlCommand.Parameters.AddWithValue("@ranchId", ranchId);
|
||||
sqlCommand.Parameters.AddWithValue("@buildingId", buildingId);
|
||||
sqlCommand.Prepare();
|
||||
|
|
|
@ -1361,7 +1361,7 @@ namespace HISP.Server
|
|||
break;
|
||||
case "4": // View Horse Breeds
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseList());
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseBreedListLibary());
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
case "5": // Back to horse
|
||||
|
|
Loading…
Add table
Reference in a new issue