Well, The last time i asked a question here i was having troubles with my Screen packets, i still have lol but ill be solving it later...
Ive been trying to load the items, inventory items and equipment but...
I'm getting dced, which packet should i send to load the items when the player login?
I created the load part, It's ok, if i dont send the Item Spawn Packet, the character completes its login, if i send the Packet, sometimes it disconnects even before the server load all items.
Code:
public void LoadItem(SocketClient Client)
{
MysqlCommand cmd = new MysqlCommand(CommandType.SELECT);
cmd.Select("*", "cq_item").Where("player_id", Client.Entity.UID);
cmd.Done();
while (cmd.DataReader.Read())
{
Console.WriteLine(cmd.Read("id").ToString() + " loaded.");
IExodusItem item = new ItemInformation();
item.UID = Convert.ToUInt32(cmd.Read("id"));
item.ID = Convert.ToUInt32(cmd.Read("type"));
item.Durability = Convert.ToUInt16(cmd.Read("amount"));
item.MaximDurability = Convert.ToUInt16(cmd.Read("amount_limit"));
item.Position = Convert.ToUInt16(cmd.Read("position"));
item.SocketOne = Convert.ToByte(cmd.Read("gem1"));
item.SocketTwo = Convert.ToByte(cmd.Read("gem2"));
item.Effect = Convert.ToByte(cmd.Read("magic1"));
item.Plus = Convert.ToByte(cmd.Read("magic3"));
item.Bless = Convert.ToByte(cmd.Read("reduce_dmg"));
item.Enchant = Convert.ToByte(cmd.Read("add_life"));
item.PlusProgress = Convert.ToUInt32(cmd.Read("Addlevel_exp"));
if (Convert.ToUInt32(cmd.Read("monopoly")) == 3)
{
item.Bound = 1;
}
item.Color = Convert.ToByte(cmd.Read("color"));
if (item.Position == (byte)ItemPosition.Inventory)
{
if (!Client.Entity.Inventory.Contains(item))
Client.Entity.Inventory.Add(item);
}
else if (item.Position >= 1 && item.Position <= 12)
{
if (!Client.Entity.Equipment.Contains(item))
Client.Entity.Equipment.Add(item);
}
}
Client.AppendMessage(new Message("Items: "+Client.Entity.Inventory.Count+" Inventory: "+Client.Entity.Inventory.Count, Client.Entity.Name, Color.Yellow, Message.Talk));
cmd.End();
}
This is the shit ive created lol The builder..
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExodusBinaries
{
public class ItemInformation : ExodusPacket, IExodusItem
{
public const ushort
Default = 1,
Trade = 2,
Update = 3,
View = 4,
ChatItem = 9;
public ItemInformation()
: base(48)
{
WORD(48, 0);
WORD(1008, 2);
WORD(ItemInformation.Default, 16);
}
public ItemInformation(IExodusItem item)
: base(48)
{
WORD(48, 0);
WORD(1008, 2);
DWORD(item.UID, 4);
DWORD(item.ID, 8);
WORD(item.Durability, 12);
WORD(item.MaximDurability, 14);
WORD(ItemInformation.Default, 16);
WORD(item.Position, 18);
Packet[22] = item.Effect;
Packet[24] = item.SocketOne;
Packet[25] = item.SocketTwo;
Packet[28] = item.Plus;
Packet[29] = item.Bless;
if (item.Bound == 3)
{
Packet[30] = 1;
}
Packet[31] = item.Enchant;
Packet[38] = item.Lock;
Packet[40] = item.Color;
DWORD(item.PlusProgress, 44);
}
public uint UID
{
get { return BitConverter.ToUInt32(Packet, 4); }
set { DWORD(value, 4); }
}
public uint ID
{
get { return BitConverter.ToUInt32(Packet, 8); }
set { DWORD(value, 8); }
}
public ushort Durability
{
get { return BitConverter.ToUInt16(Packet, 12); }
set { WORD(value, 12); }
}
public ushort MaximDurability
{
get { return BitConverter.ToUInt16(Packet, 14); }
set { WORD(value, 14); }
}
public byte Mode
{
get { return Packet[16]; }
set { Packet[16] = value; }
}
public ushort Position
{
get { return BitConverter.ToUInt16(Packet, 18); }
set { WORD(value, 18); }
}
public byte Effect
{
get { return Packet[22]; }
set { Packet[22] = value; }
}
public byte SocketOne
{
get { return Packet[24]; }
set { Packet[24] = value; }
}
public byte SocketTwo
{
get { return Packet[25]; }
set { Packet[25] = value; }
}
public byte Plus
{
get { return Packet[28]; }
set { Packet[28] = value; }
}
public byte Bless
{
get { return Packet[29]; }
set { Packet[29] = value; }
}
public ushort Bound
{
get { return BitConverter.ToUInt16(Packet, 30); }
set { WORD(value, 30); }
}
public byte Enchant
{
get { return Packet[31]; }
set { Packet[31] = value; }
}
public byte Lock
{
get { return Packet[38]; }
set { Packet[38] = value; }
}
public byte Color
{
get { return Packet[40]; }
set { Packet[40] = value; }
}
public uint PlusProgress
{
get { return BitConverter.ToUInt32(Packet, 44); }
set { DWORD(value, 44); }
}
public uint SocketProgress
{
get { return BitConverter.ToUInt32(Packet, 32); }
set { DWORD(value, 32); }
}
public ushort Warehouse
{
get;
set;
}
public bool Suspicious
{
get;
set;
}
public void Send(SocketClient Client)
{
Client.Send(this.Packet);
}
}
}
The packet 1009 is used just to equip, unequip, buy, sell items alright?
So i guess it doesnt have nothing to do with the log in item spawn packet...
Ive been working fine i guess hahah, I managed to make the Heaven Blessing fully working, still with some issues at teleporting, but It's ok and after finishing the items part (Buy, Sell the basic on shops) i will try to load the notibility ranking
And ive been reading many different sources, but i dont know, or i did get the wrong sources or most have some hidden things..
I am not copying codes, i'm trying to rewrite them, creating new structures and etc, my point now is put things to work, maybe later i can rebuild the source making it faster.
Yes, i'm using Exodus Binaries.
============= Edit ============
Since i was still having troubles with items spawn hahah, i've done something... wasnt hard tho, but it's working