mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
Fix Pinto Bugs?
This commit is contained in:
parent
92643bf4e2
commit
9eefcc6b6d
8 changed files with 105 additions and 50 deletions
|
@ -162,7 +162,7 @@ namespace HISP.Game.Inventory
|
||||||
if(HasItemId(item.ItemId))
|
if(HasItemId(item.ItemId))
|
||||||
{
|
{
|
||||||
InventoryItem items = GetItemByItemId(item.ItemId);
|
InventoryItem items = GetItemByItemId(item.ItemId);
|
||||||
if (items.ItemInstances.Length >= ConfigReader.MAX_STACK)
|
if (items.ItemInstances.Length >= Item.MAX_STACK)
|
||||||
{
|
{
|
||||||
throw new InventoryMaxStackException();
|
throw new InventoryMaxStackException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ namespace HISP.Game.Items
|
||||||
{
|
{
|
||||||
public class Item
|
public class Item
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public const int MAX_STACK = 50;
|
||||||
|
|
||||||
public struct Effects
|
public struct Effects
|
||||||
{
|
{
|
||||||
public string EffectsWhat;
|
public string EffectsWhat;
|
||||||
|
|
|
@ -2701,8 +2701,20 @@ namespace HISP.Game
|
||||||
statCalculator = speedStat;
|
statCalculator = speedStat;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(statCalculator.BreedValue < statCalculator.MaxValue)
|
bool allowed = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pinto bug: If you try to train a horse, but doing so would go over the maximum amount
|
||||||
|
* Then it just says its maxed trained, and u have to use a ranch.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ConfigReader.FixOfficalBugs)
|
||||||
|
allowed = (statCalculator.BreedValue < statCalculator.MaxValue);
|
||||||
|
else
|
||||||
|
allowed = (statCalculator.BreedValue + statCalculator.BreedOffset < statCalculator.MaxValue);
|
||||||
|
|
||||||
|
if(allowed)
|
||||||
message += Messages.FormatTrainerTrainInEntry(horse.Name, statCalculator.BreedValue, statCalculator.MaxValue, horse.RandomId);
|
message += Messages.FormatTrainerTrainInEntry(horse.Name, statCalculator.BreedValue, statCalculator.MaxValue, horse.RandomId);
|
||||||
else
|
else
|
||||||
message += Messages.FormatTrainerFullyTrained(horse.Name, statCalculator.BreedValue);
|
message += Messages.FormatTrainerFullyTrained(horse.Name, statCalculator.BreedValue);
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace HISP.Player
|
||||||
if (Trader.Inventory.HasItemId(inst[0].ItemId))
|
if (Trader.Inventory.HasItemId(inst[0].ItemId))
|
||||||
{
|
{
|
||||||
InventoryItem items = Trader.Inventory.GetItemByItemId(inst[0].ItemId);
|
InventoryItem items = Trader.Inventory.GetItemByItemId(inst[0].ItemId);
|
||||||
if (items.ItemInstances.Length + inst.Length > ConfigReader.MAX_STACK)
|
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
|
||||||
{
|
{
|
||||||
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeYouCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeYouCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
||||||
|
@ -186,7 +186,7 @@ namespace HISP.Player
|
||||||
if (OtherTrade.Trader.Inventory.HasItemId(inst[0].ItemId))
|
if (OtherTrade.Trader.Inventory.HasItemId(inst[0].ItemId))
|
||||||
{
|
{
|
||||||
InventoryItem items = OtherTrade.Trader.Inventory.GetItemByItemId(inst[0].ItemId);
|
InventoryItem items = OtherTrade.Trader.Inventory.GetItemByItemId(inst[0].ItemId);
|
||||||
if (items.ItemInstances.Length + inst.Length > ConfigReader.MAX_STACK)
|
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
|
||||||
{
|
{
|
||||||
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeOtherCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeOtherCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
||||||
|
|
|
@ -1,30 +1,43 @@
|
||||||
# HISP Default Configuration File
|
# =======================
|
||||||
|
# Server Configuration
|
||||||
|
# =======================
|
||||||
|
|
||||||
# Ip address the server will bind to (default: 0.0.0.0 ALL INTERFACES)
|
# Ip address the server will bind to (default: 0.0.0.0 ALL INTERFACES)
|
||||||
ip=0.0.0.0
|
ip=0.0.0.0
|
||||||
# Port the server will bind to (default: 12321)
|
|
||||||
|
# Port the server will bind to defaults: (on beta.horseisle.com: 12321, on pinto.horseisle.com: 443)
|
||||||
|
# Though, 443 is likely to interfere with TLS, if you happen to have a web server or something
|
||||||
|
# running on the same port, so i prefer 12321.
|
||||||
port=12321
|
port=12321
|
||||||
|
|
||||||
# MariaDB Database
|
# MariaDB Database Information
|
||||||
|
# For best performance, the database should be hosted on the SAME MACHINE as the HISP server.
|
||||||
|
# Or atleast, on a local network.
|
||||||
db_ip=127.0.0.1
|
db_ip=127.0.0.1
|
||||||
db_name=beta
|
db_name=game1
|
||||||
db_username=root
|
db_username=root
|
||||||
db_password=test123
|
db_password=test123
|
||||||
db_port=3306
|
db_port=3306
|
||||||
|
|
||||||
# Map Data
|
# File that contains the map tile data
|
||||||
|
# the default was downloaded from the original server
|
||||||
map=HI1.MAP
|
map=HI1.MAP
|
||||||
|
|
||||||
# JSON Format Data
|
# This file contains all definitions in the game
|
||||||
|
# such as items, horses. and quest data.
|
||||||
gamedata=gamedata.json
|
gamedata=gamedata.json
|
||||||
|
|
||||||
# Cross-Domain Policy File
|
# =======================
|
||||||
|
# Security
|
||||||
|
# =======================
|
||||||
|
|
||||||
|
# Adobe Flash; Cross-Domain Policy File. (see: https://help.adobe.com/en_US/air/html/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c60.html)
|
||||||
|
# The default file, just allows all domains access to all ports.
|
||||||
crossdomain=CrossDomainPolicy.xml
|
crossdomain=CrossDomainPolicy.xml
|
||||||
|
|
||||||
# Red Text Stating "Todays Note:"
|
# =======================
|
||||||
motd=April 11, 2020. New breed, Camarillo White Horse. Two new quests.
|
# Chat Filter Settings
|
||||||
|
# =======================
|
||||||
# Chat Filter Settings
|
|
||||||
|
|
||||||
# Wether to block 'bad' words
|
# Wether to block 'bad' words
|
||||||
# ex 'Fuck You!' gets blocked
|
# ex 'Fuck You!' gets blocked
|
||||||
|
@ -40,24 +53,32 @@ enable_corrections=true
|
||||||
# and FULL CAPS messages.
|
# and FULL CAPS messages.
|
||||||
non_violation=true
|
non_violation=true
|
||||||
|
|
||||||
# Should the server consider all users "Subscribers"
|
|
||||||
# (warning might make ranches be in use forever.)
|
|
||||||
all_users_subscribed=false
|
|
||||||
|
|
||||||
# Limits ad and global chat
|
# Limits ad and global chat
|
||||||
# to just a few messages every minute
|
# to just a few messages every minute
|
||||||
# by each user
|
# by each user
|
||||||
enable_spam_filter=true
|
enable_spam_filter=true
|
||||||
|
|
||||||
|
# =======================
|
||||||
|
# Misc Settings.
|
||||||
|
# =======================
|
||||||
|
|
||||||
|
# Should the server consider all users "Subscribers"
|
||||||
|
# (warning: makes ranches be in use forever.)
|
||||||
|
all_users_subscribed=false
|
||||||
|
|
||||||
|
# Red Text Stating "Todays Note:"
|
||||||
|
# Default is "April 11, 2020. New breed, Camarillo White Horse. Two new quests."
|
||||||
|
motd=April 11, 2020. New breed, Camarillo White Horse. Two new quests.
|
||||||
|
|
||||||
# Equation is: BANK_BALANCE * (1/INTREST_RATE);
|
# Equation is: BANK_BALANCE * (1/INTREST_RATE);
|
||||||
# on All servers except Black its 3333, on black its 1000.
|
# on All servers except Black its 3333, on black its 1000.
|
||||||
# but of course you can make it whatever you want
|
# but of course you can make it whatever you want
|
||||||
intrest_rate=3333
|
intrest_rate=3333
|
||||||
|
|
||||||
# Allows all users to use BBCODE in chat
|
# Should i fix bugs all the bugs
|
||||||
# BBCode is the [b] [blue] etc colors
|
# That were in the original Horse Isle Game??
|
||||||
# If false, this only works for admins and moderators.
|
# (eg training, special treat, ranch descriptions, etc)
|
||||||
allow_bbcode_in_chat=false
|
fix_offical_bugs=false
|
||||||
|
|
||||||
# Should print extra debug logs
|
# Should print extra debug logs
|
||||||
# 0 - no logs
|
# 0 - no logs
|
||||||
|
|
|
@ -6,38 +6,37 @@ namespace HISP.Server
|
||||||
|
|
||||||
public class ConfigReader
|
public class ConfigReader
|
||||||
{
|
{
|
||||||
public static int Port;
|
public static int Port = 12321;
|
||||||
public static string BindIP = "0.0.0.0";
|
public static string BindIP = "0.0.0.0";
|
||||||
|
|
||||||
public static string DatabaseIP;
|
public static string DatabaseIP = "127.0.0.1";
|
||||||
public static string DatabaseUsername;
|
public static string DatabaseName = "game1";
|
||||||
public static string DatabaseName;
|
public static string DatabaseUsername = "root";
|
||||||
public static string DatabasePassword;
|
public static string DatabasePassword = "test123";
|
||||||
public static int DatabasePort;
|
|
||||||
public static int IntrestRate;
|
|
||||||
public static string Motd;
|
|
||||||
public static string MapFile;
|
|
||||||
public static string GameDataFile;
|
|
||||||
public static string CrossDomainPolicyFile;
|
|
||||||
|
|
||||||
public static int LogLevel = 0;
|
public static int DatabasePort = 3306;
|
||||||
|
public static int IntrestRate = 3333;
|
||||||
|
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
||||||
|
public static string MapFile = "HI1.MAP";
|
||||||
|
public static string GameDataFile = "gamedata.json";
|
||||||
|
public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
|
||||||
|
|
||||||
|
public static int LogLevel = 4;
|
||||||
public static bool EnableSpamFilter = true;
|
public static bool EnableSpamFilter = true;
|
||||||
public static bool AllUsersSubbed = false;
|
public static bool AllUsersSubbed = false;
|
||||||
public static bool AllowBbcode = false;
|
public static bool FixOfficalBugs = false;
|
||||||
public static bool BadWords = true;
|
public static bool BadWords = true;
|
||||||
public static bool DoCorrections = true;
|
public static bool DoCorrections = true;
|
||||||
public static bool DoNonViolations = true;
|
public static bool DoNonViolations = true;
|
||||||
|
|
||||||
public const int MAX_STACK = 50;
|
|
||||||
|
|
||||||
private static string ConfigurationFileName = "server.properties";
|
private static string ConfigurationFileName = "server.properties";
|
||||||
public static void OpenConfig()
|
public static void OpenConfig()
|
||||||
{
|
{
|
||||||
if (!File.Exists(ConfigurationFileName))
|
if (!File.Exists(ConfigurationFileName))
|
||||||
{
|
{
|
||||||
Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
|
Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
|
||||||
File.WriteAllText(ConfigurationFileName,Resources.DefaultServerProperties);
|
File.WriteAllText(ConfigurationFileName, Resources.DefaultServerProperties);
|
||||||
Logger.InfoPrint("! Its very likely database connection will fail...");
|
Logger.WarnPrint("! Its very likely database connection will fail...");
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] configFile = File.ReadAllLines(ConfigurationFileName);
|
string[] configFile = File.ReadAllLines(ConfigurationFileName);
|
||||||
|
@ -108,8 +107,8 @@ namespace HISP.Server
|
||||||
case "enable_spam_filter":
|
case "enable_spam_filter":
|
||||||
EnableSpamFilter = data == "true";
|
EnableSpamFilter = data == "true";
|
||||||
break;
|
break;
|
||||||
case "allow_bbcode_in_chat":
|
case "fix_offical_bugs":
|
||||||
AllowBbcode = data == "true";
|
FixOfficalBugs = data == "true";
|
||||||
break;
|
break;
|
||||||
case "enable_word_filter":
|
case "enable_word_filter":
|
||||||
BadWords = data == "true";
|
BadWords = data == "true";
|
||||||
|
|
|
@ -387,6 +387,19 @@ namespace HISP.Server
|
||||||
|
|
||||||
public void Login(int id)
|
public void Login(int id)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Check for duplicate user
|
||||||
|
* and disconnect them.
|
||||||
|
*/
|
||||||
|
foreach (GameClient Client in GameClient.ConnectedClients)
|
||||||
|
{
|
||||||
|
if (Client.LoggedIn)
|
||||||
|
{
|
||||||
|
if (Client.LoggedinUser.Id == id)
|
||||||
|
Client.Kick(Messages.KickReasonDuplicateLogin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoggedinUser = new User(this, id);
|
LoggedinUser = new User(this, id);
|
||||||
LoggedIn = true;
|
LoggedIn = true;
|
||||||
|
|
||||||
|
|
|
@ -2659,8 +2659,16 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
byte[] descriptionEditedMessage = PacketBuilder.CreateChat(Messages.RanchSavedRanchDescripton, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] descriptionEditedMessage = PacketBuilder.CreateChat(Messages.RanchSavedRanchDescripton, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
sender.SendPacket(descriptionEditedMessage);
|
sender.SendPacket(descriptionEditedMessage);
|
||||||
// Completely forgot! public server opens your stats menu when you save your ranch info like DUH!!
|
|
||||||
UpdateStats(sender);
|
/*
|
||||||
|
* Pinto bug: Saving ranch description will take you to the STATS menu
|
||||||
|
* instead of just back to your ranch.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ConfigReader.FixOfficalBugs)
|
||||||
|
UpdateArea(sender);
|
||||||
|
else
|
||||||
|
UpdateStats(sender);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5921,10 +5929,6 @@ namespace HISP.Server
|
||||||
message = Chat.DoCorrections(message);
|
message = Chat.DoCorrections(message);
|
||||||
message = Chat.EscapeMessage(message);
|
message = Chat.EscapeMessage(message);
|
||||||
|
|
||||||
// Encode bbcode message.
|
|
||||||
if(ConfigReader.AllowBbcode || (sender.LoggedinUser.Moderator || sender.LoggedinUser.Administrator))
|
|
||||||
message = BBCode.EncodeBBCodeToMeta(message);
|
|
||||||
|
|
||||||
string failedReason = Chat.NonViolationChecks(sender.LoggedinUser, message);
|
string failedReason = Chat.NonViolationChecks(sender.LoggedinUser, message);
|
||||||
if (failedReason != null)
|
if (failedReason != null)
|
||||||
{
|
{
|
||||||
|
@ -6464,6 +6468,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.Inventory.Add(new ItemInstance(newItem));
|
sender.LoggedinUser.Inventory.Add(new ItemInstance(newItem));
|
||||||
|
@ -7080,7 +7085,7 @@ namespace HISP.Server
|
||||||
if (sender.LoggedinUser.Inventory.HasItemId(itemId))
|
if (sender.LoggedinUser.Inventory.HasItemId(itemId))
|
||||||
{
|
{
|
||||||
InventoryItem items = sender.LoggedinUser.Inventory.GetItemByItemId(itemId);
|
InventoryItem items = sender.LoggedinUser.Inventory.GetItemByItemId(itemId);
|
||||||
if (items.ItemInstances.Length + count > ConfigReader.MAX_STACK)
|
if (items.ItemInstances.Length + count > Item.MAX_STACK)
|
||||||
{
|
{
|
||||||
goto showError;
|
goto showError;
|
||||||
}
|
}
|
||||||
|
@ -7398,6 +7403,8 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sender.Login(userId);
|
sender.Login(userId);
|
||||||
sender.LoggedinUser.Password = password;
|
sender.LoggedinUser.Password = password;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue