diff --git a/DataCollection/gamedata.json b/DataCollection/gamedata.json index 4d98784..4332ece 100755 --- a/DataCollection/gamedata.json +++ b/DataCollection/gamedata.json @@ -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":{ diff --git a/Horse Isle Server/HorseIsleServer/Game/Messages.cs b/Horse Isle Server/HorseIsleServer/Game/Messages.cs index b66b149..2663333 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Messages.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Messages.cs @@ -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 diff --git a/Horse Isle Server/HorseIsleServer/Game/Meta.cs b/Horse Isle Server/HorseIsleServer/Game/Meta.cs index 5d7c190..eaac887 100755 --- a/Horse Isle Server/HorseIsleServer/Game/Meta.cs +++ b/Horse Isle Server/HorseIsleServer/Game/Meta.cs @@ -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); diff --git a/Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs b/Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs new file mode 100644 index 0000000..438d313 --- /dev/null +++ b/Horse Isle Server/HorseIsleServer/Game/Services/Farrier.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace HISP.Game.Services +{ + public class Farrier + { + private static List farriers = new List(); + 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."); + } + + + } +} diff --git a/Horse Isle Server/HorseIsleServer/Server/Database.cs b/Horse Isle Server/HorseIsleServer/Server/Database.cs index df54242..e9867f2 100755 --- a/Horse Isle Server/HorseIsleServer/Server/Database.cs +++ b/Horse Isle Server/HorseIsleServer/Server/Database.cs @@ -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(); diff --git a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs index a10753b..281078f 100755 --- a/Horse Isle Server/HorseIsleServer/Server/GameServer.cs +++ b/Horse Isle Server/HorseIsleServer/Server/GameServer.cs @@ -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