mirror of
https://github.com/islehorse/HISP.git
synced 2025-06-03 20:37:07 +12:00
patially implement autosell
This commit is contained in:
parent
614bfa1d42
commit
55527e4e10
6 changed files with 102 additions and 12 deletions
|
@ -178,6 +178,11 @@ namespace HISP.Game.Horse
|
|||
private int autosell;
|
||||
private string category;
|
||||
|
||||
public void ChangeNameWithoutUpdatingDatabase(string newName)
|
||||
{
|
||||
name = newName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,8 +194,8 @@ namespace HISP.Game
|
|||
public static string HorseProfileButtonFormat;
|
||||
|
||||
public static string HorseNoAutoSell;
|
||||
public static string HorseAutoSellPriceFormat;
|
||||
public static string HorseAutoSellFormat;
|
||||
public static string HorseAutoSellPriceFormat;
|
||||
public static string HorseCantAutoSellTacked;
|
||||
public static string HorseCurrentlyCategoryFormat;
|
||||
public static string HorseStats;
|
||||
|
@ -222,6 +222,10 @@ namespace HISP.Game
|
|||
public static string HorsePetTooHappyFormat;
|
||||
public static string HorseSetNewCategoryMessageFormat;
|
||||
|
||||
public static string HorseAutoSellMenuFormat;
|
||||
public static string HorseIsAutoSell;
|
||||
public static string HorseAutoSellConfirmedFormat;
|
||||
public static string HorseAutoSellRemoved;
|
||||
|
||||
// Horse Feed Menu
|
||||
public static string HorseCurrentStatusFormat;
|
||||
|
@ -431,6 +435,14 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
public static string FormatAutoSellConfirmedMessage(int money)
|
||||
{
|
||||
return HorseAutoSellConfirmedFormat.Replace("%MONEY%", money.ToString("N0"));
|
||||
}
|
||||
public static string FormatAutoSellMenu(int currentAutoSellPrice)
|
||||
{
|
||||
return HorseAutoSellMenuFormat.Replace("%AUTOSELL%", currentAutoSellPrice.ToString());
|
||||
}
|
||||
public static string FormatHorseSetToNewCategory(string category)
|
||||
{
|
||||
return HorseSetNewCategoryMessageFormat.Replace("%CATEGORY%", category);
|
||||
|
@ -587,9 +599,9 @@ namespace HISP.Game
|
|||
{
|
||||
return UpdateHorseCategory.Replace("%CATEGORY%", newCategory);
|
||||
}
|
||||
public static string FormatHorseEntry(int numb, string horseName, string breedName, int randomId)
|
||||
public static string FormatHorseEntry(int numb, string horseName, string breedName, int randomId, bool hasAutoSell)
|
||||
{
|
||||
return HorseEntryFormat.Replace("%NUMB%", numb.ToString()).Replace("%NAME%", horseName).Replace("%BREED%", breedName).Replace("%ID%", randomId.ToString());
|
||||
return HorseEntryFormat.Replace("%NUMB%", numb.ToString()).Replace("%NAME%", horseName).Replace("%BREED%", breedName).Replace("%ID%", randomId.ToString()).Replace("%ISAUTOSELL%", hasAutoSell ? HorseIsAutoSell : "");
|
||||
}
|
||||
public static string FormatHorseHeader(int maxHorses, int numHorses)
|
||||
{
|
||||
|
|
|
@ -890,7 +890,7 @@ namespace HISP.Game
|
|||
message += category.Meta;
|
||||
foreach (HorseInstance instance in horsesInCategory)
|
||||
{
|
||||
message += Messages.FormatHorseEntry(i, instance.Name, instance.Breed.Name, instance.RandomId);
|
||||
message += Messages.FormatHorseEntry(i, instance.Name, instance.Breed.Name, instance.RandomId, instance.AutoSell > 0);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -989,6 +989,15 @@ namespace HISP.Game
|
|||
message += Messages.BackToHorse;
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string BuildAutoSellMenu(HorseInstance horse)
|
||||
{
|
||||
string message = "";
|
||||
message += Messages.FormatAutoSellMenu(horse.AutoSell);
|
||||
message += Messages.ExitThisPlace;
|
||||
message += Messages.MetaTerminator;
|
||||
return message;
|
||||
}
|
||||
public static string BuildHorseDescriptionEditMeta(HorseInstance horse)
|
||||
{
|
||||
string message = Messages.FormatDescriptionEditMeta(horse.Name, horse.Description);
|
||||
|
@ -1018,10 +1027,17 @@ namespace HISP.Game
|
|||
message += Messages.FormatPetButton(horse.RandomId);
|
||||
message += Messages.FormatProfileButton(horse.RandomId);
|
||||
|
||||
string autoSellMessage = Messages.HorseNoAutoSell;
|
||||
if (horse.AutoSell > 0)
|
||||
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
||||
message += Messages.FormatAutoSell(autoSellMessage);
|
||||
if (horse.Equipment.Saddle == null && horse.Equipment.SaddlePad == null && horse.Equipment.Bridle == null)
|
||||
{
|
||||
string autoSellMessage = Messages.HorseNoAutoSell;
|
||||
if (horse.AutoSell > 0)
|
||||
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
||||
message += Messages.FormatAutoSell(autoSellMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
message += Messages.HorseCantAutoSellTacked;
|
||||
}
|
||||
|
||||
message += Messages.FormatHorseCategory(horse.Category);
|
||||
message += Messages.HorseStats;
|
||||
|
|
|
@ -631,8 +631,8 @@ namespace HISP.Server
|
|||
Messages.HorseSavedProfileMessageFormat = gameData.messages.meta.horse.saved_profile;
|
||||
|
||||
Messages.HorseNoAutoSell = gameData.messages.meta.horse.horse_inventory.no_auto_sell;
|
||||
Messages.HorseAutoSellFormat = gameData.messages.meta.horse.horse_inventory.auto_sell_format;
|
||||
Messages.HorseAutoSellPriceFormat = gameData.messages.meta.horse.horse_inventory.auto_sell;
|
||||
Messages.HorseAutoSellPriceFormat = gameData.messages.meta.horse.horse_inventory.auto_sell_format;
|
||||
Messages.HorseAutoSellFormat = gameData.messages.meta.horse.horse_inventory.auto_sell;
|
||||
Messages.HorseCantAutoSellTacked = gameData.messages.meta.horse.horse_inventory.cannot_auto_sell_tacked;
|
||||
|
||||
Messages.HorseCurrentlyCategoryFormat = gameData.messages.meta.horse.horse_inventory.marked_as;
|
||||
|
@ -660,6 +660,12 @@ namespace HISP.Server
|
|||
Messages.HorsePetTooHappyFormat = gameData.messages.meta.horse.pet_horse_too_happy;
|
||||
Messages.HorseSetNewCategoryMessageFormat = gameData.messages.meta.horse.horse_set_new_category;
|
||||
|
||||
Messages.HorseAutoSellMenuFormat = gameData.messages.meta.horse.auto_sell.auto_sell_meta;
|
||||
Messages.HorseIsAutoSell = gameData.messages.meta.auto_sell.horse.is_auto_sell;
|
||||
Messages.HorseAutoSellConfirmedFormat = gameData.messages.meta.auto_sell.horse.auto_sell_confirmed;
|
||||
Messages.HorseAutoSellRemoved = gameData.messages.meta.auto_sell.horse.auto_sell_remove;
|
||||
|
||||
|
||||
// Horse Feed Menu
|
||||
Messages.HorseCurrentStatusFormat = gameData.messages.meta.horse.feed_horse.current_status;
|
||||
Messages.HorseHoldingHorseFeed = gameData.messages.meta.horse.feed_horse.holding_horse_feed;
|
||||
|
|
|
@ -809,6 +809,42 @@ namespace HISP.Server
|
|||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (private notes, wrong size)");
|
||||
break;
|
||||
}
|
||||
case 10: // Change auto sell price
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
if (sender.LoggedinUser.LastViewedHorse != null)
|
||||
{
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
|
||||
int newSellPrice = 0;
|
||||
try
|
||||
{
|
||||
newSellPrice = int.Parse(dynamicInput[1]);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to set sell price to non int value.");
|
||||
break;
|
||||
}
|
||||
|
||||
byte[] sellPricePacket;
|
||||
if (newSellPrice > 0)
|
||||
sellPricePacket = PacketBuilder.CreateChat(Messages.FormatAutoSellConfirmedMessage(newSellPrice), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
else
|
||||
sellPricePacket = PacketBuilder.CreateChat(Messages.HorseAutoSellRemoved, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
sender.SendPacket(sellPricePacket);
|
||||
horseInstance.AutoSell = newSellPrice;
|
||||
|
||||
UpdateHorseMenu(sender, sender.LoggedinUser.LastViewedHorse);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (autosell, wrong size)");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 12: // Abuse Report
|
||||
if (dynamicInput.Length >= 2)
|
||||
{
|
||||
|
@ -961,7 +997,7 @@ namespace HISP.Server
|
|||
{
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
|
||||
horseInstance.Name = HorseInfo.GenerateHorseName();
|
||||
horseInstance.ChangeNameWithoutUpdatingDatabase(HorseInfo.GenerateHorseName());
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseDescriptionEditMeta(horseInstance));
|
||||
sender.SendPacket(metaPacket);
|
||||
}
|
||||
|
@ -1006,6 +1042,15 @@ namespace HISP.Server
|
|||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildFindNpcMenu());
|
||||
sender.SendPacket(metaPacket);
|
||||
break;
|
||||
case "25": // Set auto sell price
|
||||
if (sender.LoggedinUser.LastViewedHorse != null)
|
||||
{
|
||||
sender.LoggedinUser.MetaPriority = true;
|
||||
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
|
||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildAutoSellMenu(horseInstance));
|
||||
sender.SendPacket(metaPacket);
|
||||
}
|
||||
break;
|
||||
case "31": // Find Ranch
|
||||
break;
|
||||
case "9": // View Tack
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue