[HELP]

04/07/2009 00:34 ferone#31
how i make ?

Help me plz.

Thanks
04/07/2009 12:00 Retribution74#32
Hmm....

I have the same problem. -.-

How make a save command ?

please tell me.
04/07/2009 23:37 ferone#33
any1 help plz ?

I don't know, how i make save command to save attribute points

thanks
04/08/2009 10:45 Korvacs#34
I told you on the last page
04/08/2009 14:22 Retribution74#35
Sorry Korvacs ...

You could not be more precise?

I do not know how to code in C #

If you can help me.

Thanks
04/08/2009 19:32 Korvacs#36
Put your save character function in a code block and post here like this

Code:
Heres some code
and do the same for your get charinfo function
04/08/2009 19:57 Retribution74#37
Hmm Ok. This code is ok ?, but don't save attributes


Code:
     public static void GetCharInfo(Character Charr, string UserName)
        {
            try
            {
                DataSet DSet = new DataSet();
                MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", LoginConnection);
                DataAdapter.Fill(DSet, "Character");
                if (DSet != null && DSet.Tables["Character"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Character"].Rows[0];
04/08/2009 19:59 Korvacs#38
All of that function, right down to the last bracket of the getcharinfo function.
04/08/2009 20:06 Retribution74#39
This is all that is down.


Code:
       public static void GetCharInfo(Character Charr, string UserName)
        {
            try
            {
                DataSet DSet = new DataSet();
                MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", LoginConnection);
                DataAdapter.Fill(DSet, "Character");
                if (DSet != null && DSet.Tables["Character"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Character"].Rows[0];


                    Charr.UID = (uint)DR["UID"];
                    Charr.Name = (string)DR["CharName"];
                    Charr.Job = Convert.ToByte((uint)DR["Job"]);
                    Charr.Level = Convert.ToByte((uint)DR["Level"]);
                    Charr.Exp = (uint)DR["Exp"];
                    Charr.Model = Convert.ToUInt16((uint)DR["Model"]);
                    Charr.Avatar = Convert.ToUInt16((uint)DR["Avatar"]);
                    Charr.Hair = Convert.ToUInt16((uint)DR["Hair"]);
                    Charr.LocX = Convert.ToUInt16((uint)DR["LocationX"]);
                    Charr.LocY = Convert.ToUInt16((uint)DR["LocationY"]);
                    Charr.LocMap = Convert.ToUInt16((uint)DR["LocationMap"]);
                    Charr.Str = Convert.ToUInt16((uint)DR["Strength"]);
                    Charr.Agi = Convert.ToUInt16((uint)DR["Agility"]);
                    Charr.Vit = Convert.ToUInt16((uint)DR["Vitality"]);
                    Charr.Spi = Convert.ToUInt16((uint)DR["Spirit"]);
                    Charr.Silvers = (uint)DR["Money"];
                    Charr.CPs = (uint)DR["CPs"];
                    Charr.CurHP = Convert.ToUInt16((uint)DR["CurrentHP"]);
                    Charr.PKPoints = Convert.ToUInt16((uint)DR["PKPoints"]);
                    Charr.RBCount = Convert.ToByte((uint)DR["RBCount"]);
                    Charr.PackedInventory = (string)DR["Inventory"];
                    Charr.PackedEquips = (string)DR["Equipment"];
                    Charr.PackedSkills = (string)DR["Skills"];
                    Charr.PackedProfs = (string)DR["Profs"];
                    Charr.WHSilvers = (uint)DR["WHMoney"];
                    Charr.PackedWHs = (string)DR["Warehouses"];
                    Charr.PackedFriends = (string)DR["Friends"];
                    Charr.PackedEnemies = (string)DR["Enemies"];
                    Charr.VP = (uint)DR["VP"];
                    Charr.GuildDonation = (uint)DR["GuildDonation"];
                    Charr.GuildID = Convert.ToUInt16((uint)DR["MyGuild"]);
                    Charr.GuildPosition = Convert.ToByte((uint)DR["GuildPos"]);
                    Charr.PrevMap = Convert.ToUInt16((uint)DR["PrevMap"]);
                    if (Guilds.AllGuilds.Contains(Charr.GuildID))
                        Charr.MyGuild = (Guild)Guilds.AllGuilds[Charr.GuildID];
                    Charr.MinAtk = Charr.Str;
                    Charr.MaxAtk = Charr.Str;
                    Charr.Potency = Charr.Level;
                    Charr.RealModel = Charr.Model;
                    Charr.RealAvatar = Charr.Avatar;
                    Charr.MaxHP = Charr.BaseMaxHP();
                    Charr.RealAgi = Charr.Agi;
                    Charr.QuestKO = Convert.ToUInt16((uint)DR["QuestKO"]);
                    Charr.QuestMob = (string)DR["QuestMob"];
                    Charr.QuestFrom = (string)DR["QuestFrom"];
                    Charr.KO = Convert.ToUInt16((uint)DR["KO"]);
                    Charr.OldKO = Convert.ToUInt16((uint)DR["OldKO"]);
                    Charr.ClaimPrize = Convert.ToUInt16((uint)DR["ClaimPrize"]);
                    Charr.Prize = (string)DR["Prize"];
                    Charr.WHPW = (string)DR["WHPW"];
                    Charr.WHPWcheck = Convert.ToUInt16((uint)DR["WHPWcheck"]);
                    Charr.CardPoints = Convert.ToUInt16((uint)DR["CardPoints"]);
                    Charr.StatP = Convert.ToUInt16((uint)DR["StatPoints"]);
                    Charr.LuckTime = (uint)DR["LuckyTime"];
                    Charr.DExp2 = (uint)DR["DoubleExp"];
                    Charr.Spouse = (string)DR["Spouse"];
                    if ((string)DR["VIPClaimDate"] != "")
                        Charr.VIPClaimDateS = (string)DR["VIPClaimDate"];
                    Charr.CurseTime = Convert.ToUInt32((uint)DR["CurseTime"]);
                    Charr.DisKO = Convert.ToUInt16((uint)DR["DisKo"]);
                    Charr.DisToKill = Convert.ToUInt16((uint)DR["DisToKill"]);
                    Charr.PrevJob = Convert.ToByte((uint)DR["PrevJob"]);
                }
                else
                    General.WriteLine("Char not found.");
            /*}
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }*/
            /*catch (InvalidOperationException exc)
            {
                General.WriteLine(Convert.ToString(exc));
                LoginConnection.Open();
            }*/
        }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }

        public static bool CreateCharacter(string Name, byte Class, uint Model, uint Avatar, Client UClient)
        {
            try
            {
                string str = "0";
                string agi = "0";
                string vit = "0";
                string spi = "0";

                if (Class == 10)
                {
                    str = (Stats.ReadValue("Trojan", "Strength[1]"));
                    agi = (Stats.ReadValue("Trojan", "Agility[1]"));
                    vit = (Stats.ReadValue("Trojan", "Vitality[1]"));
                    spi = (Stats.ReadValue("Trojan", "Spirit[1]"));
                }
                if (Class == 20)
                {
                    str = (Stats.ReadValue("Warrior", "Strength[1]"));
                    agi = (Stats.ReadValue("Warrior", "Agility[1]"));
                    vit = (Stats.ReadValue("Warrior", "Vitality[1]"));
                    spi = (Stats.ReadValue("Warrior", "Spirit[1]"));
                }
                if (Class == 40)
                {
                    str = (Stats.ReadValue("Archer", "Strength[1]"));
                    agi = (Stats.ReadValue("Archer", "Agility[1]"));
                    vit = (Stats.ReadValue("Archer", "Vitality[1]"));
                    spi = (Stats.ReadValue("Archer", "Spirit[1]"));
                }
                if (Class == 100)
                {
                    str = (Stats.ReadValue("Taoist", "Strength[1]"));
                    agi = (Stats.ReadValue("Taoist", "Agility[1]"));
                    vit = (Stats.ReadValue("Taoist", "Vitality[1]"));
                    spi = (Stats.ReadValue("Taoist", "Spirit[1]"));
                }
                string hp = Convert.ToString((short.Parse(vit) * 24 + short.Parse(str) * 3 + short.Parse(agi) * 3 + short.Parse(spi) * 3));
                ulong uid = (uint)General.Rand.Next(1000001, 19999999);

                try
                {
                    MySqlCommand Command = null;
                    Command = new MySqlCommand("INSERT INTO characters (CharName,Account,Level,Exp,Strength,Agility,Vitality,Spirit,Job,Model,Money,CPs,CurrentHP,StatPoints,LocationMap,LocationX,LocationY,UID,Hair,Equipment,Inventory,PKPoints,Skills,Profs,RBCount,Avatar,WHMoney,Warehouses,VP,Friends,Enemies,GuildDonation,MyGuild,GuildPos,PrevMap) VALUES ('" + Name + "','" + UClient.Account + "',1,0," + str + "," + agi + "," + vit + "," + spi + "," + Class + "," + Model + ",100,0," + hp + ",0,1010,061,109," + uid + ",410,'','',0,'','',0," + Avatar + ",0,'',0,'','',0,0,0,1010)", Connection);
                    Command.ExecuteNonQuery();

                    Command = new MySqlCommand("UPDATE `accounts` SET `LogonType` = 1 WHERE `AccountID` = '" + UClient.Account + "'", Connection);
                    Command.ExecuteNonQuery();

                    Command = new MySqlCommand("UPDATE `accounts` SET `Charr` = '" + Name + "' WHERE `AccountID` = '" + UClient.Account + "'", Connection);
                    Command.ExecuteNonQuery();
                }
                catch { return false; }

                return true;
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); return false; }
        }

        public static byte Authenticate(string UserName, string Password)
        {
            try
            {
                MySqlDataAdapter DataAdapter = null;
                DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", LoginConnection);
                DataSet DSet = new DataSet();

                DataAdapter.Fill(DSet, "Account");

                if (DSet != null && DSet.Tables["Account"].Rows.Count > 0)
                //if (DSet.Tables["Account"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Account"].Rows[0];

                    string Pass = (string)DR["Password"];
                    if (Pass == Password || Pass == "")
                    {
                        if (Pass == "")
                        {
                            MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", LoginConnection);
                            Command.ExecuteNonQuery();
                        }

                        uint LogonCount = (uint)DR["LogonCount"];
                        LogonCount++;

                        MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", LoginConnection);
                        Comm.ExecuteNonQuery();

                        return Convert.ToByte((uint)DR["LogonType"]);
                    }
                    else
                        return 0;
                }
                else
                    return 0;
            }
            catch (Exception Exc) { General.WriteLine(Exc.ToString()); return 0; }
        }
    }
}
04/08/2009 20:10 Korvacs#40
Ok thats all fine, do you have a save char command anywhere?
04/08/2009 20:16 Retribution74#41
Everything is OK, but I do not know why it does not save the attribute points, I'm using the CoV2 Source.

Would you tell me why it does not save?
04/08/2009 22:22 Ultimatum#42
If its not saving your attr points. Either you aint got a function saving it or like most lotf sources the database instance is screwed basically.
04/08/2009 23:00 Retribution74#43
I wish someone told me how to code to save the attr Points


Its SaveChar code its ok ?

public static void SaveChar(Character Charr)
{
try
{
Charr.PackInventory();
Charr.PackEquips();
Charr.PackSkills();
Charr.PackProfs();
Charr.PackWarehouses();
Charr.PackEnemies();
Charr.PackFriends();

MySqlCommand Command = null;
Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "',`Spouse` = '" + Charr.Spouse + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp + ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`VP` = " + Charr.VP + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestKO` = '" + Charr.QuestKO + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestFrom` = '" + Charr.QuestFrom + "',`Prize` = '" + Charr.Prize + "',`ClaimPrize` = '" + Charr.ClaimPrize + "',`LuckyTime` = '" + Charr.LuckTime + "',`DoubleExp` = '" + Charr.DExp2 + "',`VIPClaimDate` = '" + Charr.VIPClaimDateS + "',`CurseTime` = '" + Charr.CurseTime + "',`DisKo` = '" + Charr.DisKO + "',`DisToKill` = '" + Charr.DisToKill + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
Command.ExecuteNonQuery();
}
catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc));}
}
04/09/2009 17:10 ferone#44
Hmm. Ihave this problem 2.

U using cov2 source right ?

idk How to solve this problem...

Any1 help plz ?
04/09/2009 18:46 CoAttack#45
Quote:
Originally Posted by ferone View Post
Hmm. Ihave this problem 2.

U using cov2 source right ?

idk How to solve this problem...

Any1 help plz ?
Stop using Cov2 Source...it wasn't even coded correctly.. it has many things repeating and it has two sources in one source... Basically double the files.