First of all, TamerData is attached to a new byte array as you will see stated in the function, within the lobby class. Now the troubling area is that in the error log it shows that line 260 is incorrect, which is "qry.Add("maxHP", TamerData[charModel - 80001][3]);". Now TamerData is a byte array as i've said. Another error that is being recieved is, "CreateChar Ikuto Frosty Error: CreateCharacter()" <--- Main error being dealt with. This function is shown in the source code.
Line of Error
qry.Add("maxHP", TamerData[charModel - 80001][3]);
--Database-lobby.cs
public static byte[][] TamerData = new byte[][] { new byte[] { 10, 2, 90, 80 }, new byte[] { 8, 1, 100, 90 }, new byte[] { 8, 1, 90, 100 } };
public static int CreateCharacter(uint AcctId, int pos, int charModel, string charName, int digiModel)
{
int charId = -1;
try
{
using (MySqlConnection con = Connect())
{
Query qry = new Query(Query.QueryMode.INSERT, "chars");
qry.Add("charName", charName);
qry.Add("charModel", charModel);
qry.Add("accountId", AcctId);
qry.Add("inventory", new ItemList(63).Serialize());
qry.Add("storage", new ItemList(70).Serialize());
qry.Add("equipment", new ItemList(27).Serialize());
qry.Add("quests", new QuestList().Serialize());
qry.Add("maxHP", TamerData[charModel - 80001][3]);
qry.Add("maxDS", TamerData[charModel - 80001][2]);
qry.Add("HP", TamerData[charModel - 80001][1]);
qry.Add("DS", TamerData[charModel - 80001][2]);
qry.Add("AT", TamerData[charModel - 80001][0]);
qry.Add("DE", TamerData[charModel - 80001][1]);
using (MySqlCommand cmd = qry.GetCommand(con))
{
cmd.ExecuteNonQuery();
}
Error log below
[MapDB] Loaded 35 maps. [DigimonDB] Loaded 256 digimon. This server is configured to route players to the game server at 37.157.245.26:7000 ServerInfo found... Listening... Accepting a client: 151.226.122.217:62189 Accepted connection: 151.226.122.217:62189 CreateChar Ikuto Frosty Error: CreateCharacter() System.IndexOutOfRangeException: Index was outside the bounds of the array. at Digital_World.SqlDB.CreateCharacter(UInt32 AcctId, Int32 pos, Int32 charModel, String charName, Int32 digiModel) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\DigitalWorld\Database - Lobby.cs:line 261 Error: CreateDigimon() MySql.Data.MySqlClient.MySqlException (0x80004005): Out of range value for column 'characterId' at row 1 at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at Digital_World.SqlDB.CreateMercenary(UInt32 charId, String digiName, Int32 digiModel, Int32 digiScale, Int32 digiSize, Int32 intimacy) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\DigitalWorld\Database - Game.cs:line 410 System.InvalidCastException: Specified cast is not valid. at Digital_World.SqlDB.GetTamerPosition(UInt32 acctId, Int32 slot) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\DigitalWorld\Database - Lobby.cs:line 200 System.NullReferenceException: Object reference not set to an instance of an object.
Server stack trace: at Digital_World.PacketLogic.Process(Client client, Byte[] buffer, Settings Opt) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\Lobby Server\PacketLogic.cs:line 106 at Digital_World.LobbyMainWin.PacketProcessor(Client client, Byte[] buffer, Int32 length) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\Lobby Server\DigitalWorldLobby.xaml.cs:line 60 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) at Digital_World.Network.SocketWrapper.dlgRead.EndInvoke(IAsyncResult result) at Digital_World.Network.SocketWrapper.ProcessedRead(IAsyncResult ar) in C:\Users\Digimon Master\Dropbox\Digimon Master Project\DMOFrosty'sPost\Server\ServerBuildingSection\DigitalWorld\Network\Socket.cs:line 235
Thank you for any help that is given, sorry if my question isnt very specific or relevant to any other user, this has just been very troubling.