[problem]stats

08/20/2009 04:18 coreymills#1
stats wont load for me

i made a new file called Stats
Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/18/2009
 * Time: 7:31 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;

namespace CoEmu_v2_GameServer.Structs
{
    /// <summary>
    /// Contains a struct for stats
    /// </summary>
    public partial class Struct
    {
        public class stats
        {
            public int Profession;
            public int Level;
            public int Strength;
            public int Vitality;
            public int Dexterity;
            public int Spirit;
        }
    }
}
database.cs

Code:
public static void GetStats(Character Client)
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `stats` WHERE `Profession` = " + (int)Client.Class + ", `level` = " + Client.Level + ", `strength` = " + Client.PkPoints + ", `xCord` = " + Client.X + ", `yCord` = " + Client.Y + ", `Map` = " + (int)Client.Map + ", `HairStyle` = " + Client.Hair + ", `Class` = " + (int)Client.Class +", `Str` = " + Client.Strength + ",`Vit` = " + Client.Vitality + ", `Spi` = " + Client.Spirit + ", `Dex` = " + Client.Dexterity + " WHERE `CharID` = " + Client.ID, DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose(); 
        }
Code:
public static Dictionary<int, Struct.stats> Stats = new Dictionary<int, Struct.stats>();
in public static void StartServer()
i added
Code:
Database.Database.GetStats();
in DataLoader.cs i added
Code:
public static void LoadStats()
        {
            Database.Database.GetStats();
        }
and the stats still will not load can anyone help me.
08/20/2009 04:23 CptSky#2
Code:
public static void GetStats(Character Client)
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `stats` WHERE `Profession` = " + (int)Client.Class + ", `level` = " + Client.Level + ", `strength` = " + Client.PkPoints + ", `xCord` = " + Client.X + ", `yCord` = " + Client.Y + ", `Map` = " + (int)Client.Map + ", `HairStyle` = " + Client.Hair + ", `Class` = " + (int)Client.Class +", `Str` = " + Client.Strength + ",`Vit` = " + Client.Vitality + ", `Spi` = " + Client.Spirit + ", `Dex` = " + Client.Dexterity + " WHERE `CharID` = " + Client.ID, DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose(); 
        }
Why you have the HairStyle, xCord, yCord... You use a Client for getting all the stats? Check your function...
08/20/2009 04:29 coreymills#3
no i copyed savechar and just edited that for the get stats and guess i never got them all

EDIT:: still not workin :(
08/20/2009 04:34 CptSky#4
Quote:
Originally Posted by coreymills View Post
no i copyed savechar and just edited that for the get stats and guess i never got them all
You don't understand the MySQL Function, I think... You can't get all the stats with a structure for update...

I have rapidly checked the CoEmu source, check for a load function like GetServerSkills(). The structure will work if you know how to adapt.
08/20/2009 04:39 coreymills#5
#request close
08/20/2009 14:39 tanelipe#6
#Closed