mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +12:00
patially implement autosell
This commit is contained in:
parent
614bfa1d42
commit
55527e4e10
6 changed files with 102 additions and 12 deletions
|
@ -143,7 +143,7 @@
|
||||||
"too_many_horses":"You cannot manage any more horses.",
|
"too_many_horses":"You cannot manage any more horses.",
|
||||||
"horses_menu":"^ATYour Horses^H<B>You can have up to %MAXHORSE% horses. Here are your %TOTALHORSE%:</B><BR>",
|
"horses_menu":"^ATYour Horses^H<B>You can have up to %MAXHORSE% horses. Here are your %TOTALHORSE%:</B><BR>",
|
||||||
"update_category":"Horse set as %CATEGORY%",
|
"update_category":"Horse set as %CATEGORY%",
|
||||||
"horse_format":"^I252^T7#%NUMB%: %NAME% (%BREED%) ^B3L%ID%^R1",
|
"horse_format":"^I252^T7#%NUMB%: %NAME% (%BREED%) %ISAUTOSELL% ^B3L%ID%^R1",
|
||||||
"view_basic_stats":"^T6View all of basic stats together:^D33|BASIC STATS^R1",
|
"view_basic_stats":"^T6View all of basic stats together:^D33|BASIC STATS^R1",
|
||||||
"view_advanced_stats":"^T6View all advanced stats together:^D34|ALL STATS^R1",
|
"view_advanced_stats":"^T6View all advanced stats together:^D34|ALL STATS^R1",
|
||||||
"equip_tack_message":"You put the %NAME% on %HORSENAME%.",
|
"equip_tack_message":"You put the %NAME% on %HORSENAME%.",
|
||||||
|
@ -157,6 +157,12 @@
|
||||||
"pet_horse":"Your horse whinnies lightly. (+%MOOD% mood / -%TIREDNESS% tiredness)",
|
"pet_horse":"Your horse whinnies lightly. (+%MOOD% mood / -%TIREDNESS% tiredness)",
|
||||||
"pet_horse_too_happy":"Your horse is as happy as it can be now. Your horse whinnies lightly. (+%MOOD% mood / -%TIREDNESS% tiredness)",
|
"pet_horse_too_happy":"Your horse is as happy as it can be now. Your horse whinnies lightly. (+%MOOD% mood / -%TIREDNESS% tiredness)",
|
||||||
"description_edit":"^PLHorse's Name:|%HORSENAME%^D11|GENERATE RANDOM HORSE NAME^R1^LDescription: (reset if you generate name)^R1^PB120|%DESCRIPTION%^PS5|SAVE CHANGES",
|
"description_edit":"^PLHorse's Name:|%HORSENAME%^D11|GENERATE RANDOM HORSE NAME^R1^LDescription: (reset if you generate name)^R1^PB120|%DESCRIPTION%^PS5|SAVE CHANGES",
|
||||||
|
"auto_sell":{
|
||||||
|
"auto_sell_meta":"<B>Auto-Selling a horse:</B><BR>By setting this value, any other player can buy this horse from you at any time. If you have a Ranch, they can even buy the horse when you are offline! (Put the cost to 0 to stop it from being for auto-sale.)^PMAuto-Sell horse for:|%AUTOSELL%^PS10|SET COST",
|
||||||
|
"auto_sell_confirmed":"Setting up Auto-Sell for horse at $%MONEY%",
|
||||||
|
"auto_sell_remove":"Removing auto-sell off horse.",
|
||||||
|
"is_auto_sell":"[$] "
|
||||||
|
},
|
||||||
"feed_horse":{
|
"feed_horse":{
|
||||||
"horse_neigh":"Your horse neighs a thank you!",
|
"horse_neigh":"Your horse neighs a thank you!",
|
||||||
"horse_could_not_finish":"The horse could not finish it all. Some was wasted.",
|
"horse_could_not_finish":"The horse could not finish it all. Some was wasted.",
|
||||||
|
|
|
@ -178,6 +178,11 @@ namespace HISP.Game.Horse
|
||||||
private int autosell;
|
private int autosell;
|
||||||
private string category;
|
private string category;
|
||||||
|
|
||||||
|
public void ChangeNameWithoutUpdatingDatabase(string newName)
|
||||||
|
{
|
||||||
|
name = newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,8 +194,8 @@ namespace HISP.Game
|
||||||
public static string HorseProfileButtonFormat;
|
public static string HorseProfileButtonFormat;
|
||||||
|
|
||||||
public static string HorseNoAutoSell;
|
public static string HorseNoAutoSell;
|
||||||
public static string HorseAutoSellPriceFormat;
|
|
||||||
public static string HorseAutoSellFormat;
|
public static string HorseAutoSellFormat;
|
||||||
|
public static string HorseAutoSellPriceFormat;
|
||||||
public static string HorseCantAutoSellTacked;
|
public static string HorseCantAutoSellTacked;
|
||||||
public static string HorseCurrentlyCategoryFormat;
|
public static string HorseCurrentlyCategoryFormat;
|
||||||
public static string HorseStats;
|
public static string HorseStats;
|
||||||
|
@ -222,6 +222,10 @@ namespace HISP.Game
|
||||||
public static string HorsePetTooHappyFormat;
|
public static string HorsePetTooHappyFormat;
|
||||||
public static string HorseSetNewCategoryMessageFormat;
|
public static string HorseSetNewCategoryMessageFormat;
|
||||||
|
|
||||||
|
public static string HorseAutoSellMenuFormat;
|
||||||
|
public static string HorseIsAutoSell;
|
||||||
|
public static string HorseAutoSellConfirmedFormat;
|
||||||
|
public static string HorseAutoSellRemoved;
|
||||||
|
|
||||||
// Horse Feed Menu
|
// Horse Feed Menu
|
||||||
public static string HorseCurrentStatusFormat;
|
public static string HorseCurrentStatusFormat;
|
||||||
|
@ -431,6 +435,14 @@ namespace HISP.Game
|
||||||
// Click
|
// Click
|
||||||
public static string NothingInterestingHere;
|
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)
|
public static string FormatHorseSetToNewCategory(string category)
|
||||||
{
|
{
|
||||||
return HorseSetNewCategoryMessageFormat.Replace("%CATEGORY%", category);
|
return HorseSetNewCategoryMessageFormat.Replace("%CATEGORY%", category);
|
||||||
|
@ -587,9 +599,9 @@ namespace HISP.Game
|
||||||
{
|
{
|
||||||
return UpdateHorseCategory.Replace("%CATEGORY%", newCategory);
|
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)
|
public static string FormatHorseHeader(int maxHorses, int numHorses)
|
||||||
{
|
{
|
||||||
|
|
|
@ -890,7 +890,7 @@ namespace HISP.Game
|
||||||
message += category.Meta;
|
message += category.Meta;
|
||||||
foreach (HorseInstance instance in horsesInCategory)
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -989,6 +989,15 @@ namespace HISP.Game
|
||||||
message += Messages.BackToHorse;
|
message += Messages.BackToHorse;
|
||||||
return message;
|
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)
|
public static string BuildHorseDescriptionEditMeta(HorseInstance horse)
|
||||||
{
|
{
|
||||||
string message = Messages.FormatDescriptionEditMeta(horse.Name, horse.Description);
|
string message = Messages.FormatDescriptionEditMeta(horse.Name, horse.Description);
|
||||||
|
@ -1018,10 +1027,17 @@ namespace HISP.Game
|
||||||
message += Messages.FormatPetButton(horse.RandomId);
|
message += Messages.FormatPetButton(horse.RandomId);
|
||||||
message += Messages.FormatProfileButton(horse.RandomId);
|
message += Messages.FormatProfileButton(horse.RandomId);
|
||||||
|
|
||||||
string autoSellMessage = Messages.HorseNoAutoSell;
|
if (horse.Equipment.Saddle == null && horse.Equipment.SaddlePad == null && horse.Equipment.Bridle == null)
|
||||||
if (horse.AutoSell > 0)
|
{
|
||||||
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
string autoSellMessage = Messages.HorseNoAutoSell;
|
||||||
message += Messages.FormatAutoSell(autoSellMessage);
|
if (horse.AutoSell > 0)
|
||||||
|
autoSellMessage = Messages.FormatAutoSellPrice(horse.AutoSell);
|
||||||
|
message += Messages.FormatAutoSell(autoSellMessage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message += Messages.HorseCantAutoSellTacked;
|
||||||
|
}
|
||||||
|
|
||||||
message += Messages.FormatHorseCategory(horse.Category);
|
message += Messages.FormatHorseCategory(horse.Category);
|
||||||
message += Messages.HorseStats;
|
message += Messages.HorseStats;
|
||||||
|
|
|
@ -631,8 +631,8 @@ namespace HISP.Server
|
||||||
Messages.HorseSavedProfileMessageFormat = gameData.messages.meta.horse.saved_profile;
|
Messages.HorseSavedProfileMessageFormat = gameData.messages.meta.horse.saved_profile;
|
||||||
|
|
||||||
Messages.HorseNoAutoSell = gameData.messages.meta.horse.horse_inventory.no_auto_sell;
|
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_format;
|
||||||
Messages.HorseAutoSellPriceFormat = gameData.messages.meta.horse.horse_inventory.auto_sell;
|
Messages.HorseAutoSellFormat = gameData.messages.meta.horse.horse_inventory.auto_sell;
|
||||||
Messages.HorseCantAutoSellTacked = gameData.messages.meta.horse.horse_inventory.cannot_auto_sell_tacked;
|
Messages.HorseCantAutoSellTacked = gameData.messages.meta.horse.horse_inventory.cannot_auto_sell_tacked;
|
||||||
|
|
||||||
Messages.HorseCurrentlyCategoryFormat = gameData.messages.meta.horse.horse_inventory.marked_as;
|
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.HorsePetTooHappyFormat = gameData.messages.meta.horse.pet_horse_too_happy;
|
||||||
Messages.HorseSetNewCategoryMessageFormat = gameData.messages.meta.horse.horse_set_new_category;
|
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
|
// Horse Feed Menu
|
||||||
Messages.HorseCurrentStatusFormat = gameData.messages.meta.horse.feed_horse.current_status;
|
Messages.HorseCurrentStatusFormat = gameData.messages.meta.horse.feed_horse.current_status;
|
||||||
Messages.HorseHoldingHorseFeed = gameData.messages.meta.horse.feed_horse.holding_horse_feed;
|
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)");
|
Logger.ErrorPrint(sender.LoggedinUser.Username + " Tried to send a invalid dynamic input (private notes, wrong size)");
|
||||||
break;
|
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
|
case 12: // Abuse Report
|
||||||
if (dynamicInput.Length >= 2)
|
if (dynamicInput.Length >= 2)
|
||||||
{
|
{
|
||||||
|
@ -961,7 +997,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.MetaPriority = true;
|
sender.LoggedinUser.MetaPriority = true;
|
||||||
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
|
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
|
||||||
horseInstance.Name = HorseInfo.GenerateHorseName();
|
horseInstance.ChangeNameWithoutUpdatingDatabase(HorseInfo.GenerateHorseName());
|
||||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseDescriptionEditMeta(horseInstance));
|
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildHorseDescriptionEditMeta(horseInstance));
|
||||||
sender.SendPacket(metaPacket);
|
sender.SendPacket(metaPacket);
|
||||||
}
|
}
|
||||||
|
@ -1006,6 +1042,15 @@ namespace HISP.Server
|
||||||
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildFindNpcMenu());
|
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildFindNpcMenu());
|
||||||
sender.SendPacket(metaPacket);
|
sender.SendPacket(metaPacket);
|
||||||
break;
|
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
|
case "31": // Find Ranch
|
||||||
break;
|
break;
|
||||||
case "9": // View Tack
|
case "9": // View Tack
|
||||||
|
|
Loading…
Add table
Reference in a new issue