[FIX] HP Bar doesnt fill up 100%

07/06/2010 01:24 .Beatz#1
Hey guys I know a few people around this forum are having some trouble with their HP bars not filling up properly when you put something on like a Gold Cup or Trophy or something. This is a very easy fix as I will show you below.
Hit the thanks if you like this or use it.
100% coded by me.... Not leeched from anywhere.



Done all of them will now work :)
07/06/2010 01:51 kinshi88#2
Why not just read the itemtype.dat file? It contains all the item's info, including hp bonuses.
07/06/2010 02:00 .Beatz#3
Quote:
Originally Posted by kinshi88 View Post
Why not just read the itemtype.dat file? It contains all the item's info, including hp bonuses.
Yes but I added this for people to help them. I have had alot of people ask me how to fix this and I have explained it many many times and I am bored of explaining so I released this.
I know the Itemtype.dat file holds all that information thats how I done this code.
07/06/2010 02:18 kinshi88#4
You don't need to hard-code anything.

Get the info from the itemtype.txt (decrypted itemtype.dat)
Code:
            StreamReader sr = new StreamReader("./Database/itemtype.txt");
            while (!sr.EndOfStream)
            {
                string[] data = sr.ReadLine().Split(' ');
                BaseItem i = new BaseItem();
                i.ID = uint.Parse(data[0]);
                i.Name = data[1];
                i.ReqJob = byte.Parse(data[2]);
                i.ReqProfLvl = byte.Parse(data[3]);
                i.ReqLvl = byte.Parse(data[4]);
                i.ReqSex = byte.Parse(data[5]);
                i.ReqStr = ushort.Parse(data[6]);
                i.ReqAgi = ushort.Parse(data[7]);
                i.ReqVit = ushort.Parse(data[8]);
                i.ReqSpi = ushort.Parse(data[9]);
                i.Tradability = byte.Parse(data[10]);
                i.Weight = ushort.Parse(data[11]);
                i.ShopBuyPrice = uint.Parse(data[12]);
                i.Action = uint.Parse(data[13]);
                i.MaxPhysAtk = uint.Parse(data[14]);
                i.MinPhysAtk = uint.Parse(data[15]);
                i.PhysDefence = uint.Parse(data[16]);
                i.Dexerity = uint.Parse(data[17]);
                i.Dodge = uint.Parse(data[18]);
                i.PotAddHP = ushort.Parse(data[19]);
                i.PotAddMP = ushort.Parse(data[20]);
                i.Durability = ushort.Parse(data[21]);
                i.Arrows = ushort.Parse(data[22]);
                i.MAttack = uint.Parse(data[30]);
                i.Range = ushort.Parse(data[32]);
                i.Frequency = uint.Parse(data[33]);
                i.ShopCPPrice = uint.Parse(data[37]);
                i.Description = data[53];

                Kernel.BaseItems.ThreadSafeAdd<uint, BaseItem>(i.ID, i);
            }
Then when you're calculating hp, or attacking, take into account the BaseItem info.

Code:
Hitpoints += BaseItem[id].PotAddHP;
Then EVERY item ever is taken into account.
07/06/2010 02:34 .Beatz#5
Quote:
Originally Posted by kinshi88 View Post
You don't need to hard-code anything.

Get the info from the itemtype.txt (decrypted itemtype.dat)
Code:
            StreamReader sr = new StreamReader("./Database/itemtype.txt");
            while (!sr.EndOfStream)
            {
                string[] data = sr.ReadLine().Split(' ');
                BaseItem i = new BaseItem();
                i.ID = uint.Parse(data[0]);
                i.Name = data[1];
                i.ReqJob = byte.Parse(data[2]);
                i.ReqProfLvl = byte.Parse(data[3]);
                i.ReqLvl = byte.Parse(data[4]);
                i.ReqSex = byte.Parse(data[5]);
                i.ReqStr = ushort.Parse(data[6]);
                i.ReqAgi = ushort.Parse(data[7]);
                i.ReqVit = ushort.Parse(data[8]);
                i.ReqSpi = ushort.Parse(data[9]);
                i.Tradability = byte.Parse(data[10]);
                i.Weight = ushort.Parse(data[11]);
                i.ShopBuyPrice = uint.Parse(data[12]);
                i.Action = uint.Parse(data[13]);
                i.MaxPhysAtk = uint.Parse(data[14]);
                i.MinPhysAtk = uint.Parse(data[15]);
                i.PhysDefence = uint.Parse(data[16]);
                i.Dexerity = uint.Parse(data[17]);
                i.Dodge = uint.Parse(data[18]);
                i.PotAddHP = ushort.Parse(data[19]);
                i.PotAddMP = ushort.Parse(data[20]);
                i.Durability = ushort.Parse(data[21]);
                i.Arrows = ushort.Parse(data[22]);
                i.MAttack = uint.Parse(data[30]);
                i.Range = ushort.Parse(data[32]);
                i.Frequency = uint.Parse(data[33]);
                i.ShopCPPrice = uint.Parse(data[37]);
                i.Description = data[53];

                Kernel.BaseItems.ThreadSafeAdd<uint, BaseItem>(i.ID, i);
            }
Then when you're calculating hp, or attacking, take into account the BaseItem info.

Code:
Hitpoints += BaseItem[id].PotAddHP;
Then EVERY item ever is taken into account.
Oh didn't understand what you were saying :)
Yeah thats a better way of doing it. I am still learning C# though :)
07/06/2010 04:22 kinshi88#6
Quote:
Originally Posted by mattyc2580 View Post
Oh didn't understand what you were saying :)
Yeah thats a better way of doing it. I am still learning C# though :)
Yup, just trying to help :)
07/06/2010 11:31 ~Yuki~#7
nice kinshi
07/06/2010 12:11 flex30#8
Quote:
Originally Posted by kinshi88 View Post
You don't need to hard-code anything.

Get the info from the itemtype.txt (decrypted itemtype.dat)
Code:
            StreamReader sr = new StreamReader("./Database/itemtype.txt");
            while (!sr.EndOfStream)
            {
                string[] data = sr.ReadLine().Split(' ');
                BaseItem i = new BaseItem();
                i.ID = uint.Parse(data[0]);
                i.Name = data[1];
                i.ReqJob = byte.Parse(data[2]);
                i.ReqProfLvl = byte.Parse(data[3]);
                i.ReqLvl = byte.Parse(data[4]);
                i.ReqSex = byte.Parse(data[5]);
                i.ReqStr = ushort.Parse(data[6]);
                i.ReqAgi = ushort.Parse(data[7]);
                i.ReqVit = ushort.Parse(data[8]);
                i.ReqSpi = ushort.Parse(data[9]);
                i.Tradability = byte.Parse(data[10]);
                i.Weight = ushort.Parse(data[11]);
                i.ShopBuyPrice = uint.Parse(data[12]);
                i.Action = uint.Parse(data[13]);
                i.MaxPhysAtk = uint.Parse(data[14]);
                i.MinPhysAtk = uint.Parse(data[15]);
                i.PhysDefence = uint.Parse(data[16]);
                i.Dexerity = uint.Parse(data[17]);
                i.Dodge = uint.Parse(data[18]);
                i.PotAddHP = ushort.Parse(data[19]);
                i.PotAddMP = ushort.Parse(data[20]);
                i.Durability = ushort.Parse(data[21]);
                i.Arrows = ushort.Parse(data[22]);
                i.MAttack = uint.Parse(data[30]);
                i.Range = ushort.Parse(data[32]);
                i.Frequency = uint.Parse(data[33]);
                i.ShopCPPrice = uint.Parse(data[37]);
                i.Description = data[53];

                Kernel.BaseItems.ThreadSafeAdd<uint, BaseItem>(i.ID, i);
            }
Then when you're calculating hp, or attacking, take into account the BaseItem info.

Code:
Hitpoints += BaseItem[id].PotAddHP;
Then EVERY item ever is taken into account.
It's not for 5165 LOTF?
Becose 5165 read Items.txt and don't use the same names ID.
07/06/2010 12:40 ~Yuki~#9
no its not for NewestCoServer Source. its an example. and fuck its not called LOTF when do ppl learn that finally
07/06/2010 13:34 flex30#10
Quote:
Originally Posted by ~Yuki~ View Post
no its not for NewestCoServer Source. its an example. and fuck its not called LOTF when do ppl learn that finally
You don't need to get angry for that, we're not all pro of Conquer PS..
07/06/2010 14:18 .Beatz#11
Mine is for NewestCoServer Source. But the other one is just an example for people to work off.
07/06/2010 19:01 MonstersAbroad#12
Few things,

1. Good work Kinishi.
2. Yuki your very right.
3.
Quote:
It's not for 5165 LOTF?
Becose 5165 read Items.txt and don't use the same names ID.
Of course thats not for "lotf" but can very easily be converted or the original to be changed.

Mattyc2580 - Just if every coder for newestcoserver source had common sence like you. :P
07/07/2010 08:15 Sp!!ke#13
thanks kinishi I finish to convert read of itemtype
07/07/2010 08:21 ~Yuki~#14
Same here but for my 5017 Lotfie^^