Kamras
Member
I have adapter the XML sockets into my level system, at X level a socket is applied to a weapon. Getting the first initial socket is no problem, and replacing it with other socket variables is also not a problem. The issue is, lets say a player levels a katana up and obtains 2 sockets. Then they level it up again and obtain 2 more sockets for a total of 4. That works great, but the problem is, instead of incriminating the amount of sockets the weapon has on the xml attachment it replaces it entirely and removes any existing augments. Any one have any suggestions to make that work? here is a snippit of the code I'm using to make all this happen?
I just need each following level up to add sockets, not remove the existing ones. I tried referencing the sockets attachment but i'm not sure what i'm doing wrong.
I just need each following level up to add sockets, not remove the existing ones. I tried referencing the sockets attachment but i'm not sure what i'm doing wrong.
Code:
Item bww = from.FindItemOnLayer(Layer.TwoHanded);
if ( bww != null )
{
if (bww is BaseWeapon)
{
XmlLevelItem weapon1levelitem = (XmlLevelItem)XmlAttach.FindAttachment(bww, typeof(XmlLevelItem));
if (weapon1levelitem != null )
{
if ( weapon1levelitem.Level == 2)
{
XmlSockets twohandsocket1 = (XmlSockets)XmlAttach.FindAttachment(bww, typeof(XmlSockets));
if ( twohandsocket1 != null )
return;
else
from.LocalOverheadMessage(MessageType.Emote, 0x59, true, "Your weapon is glowing with potential. ");
from.LocalOverheadMessage(MessageType.Emote, 0x59, true, "Weapon can be further Enhanced!. ");
// XmlAttach.AttachTo(bww, new XmlSocketable(4)); //max sockets available
XmlAttach.AttachTo(bww, new XmlSockets(2));
}
else if ( weapon1levelitem.Level == 4)
{
XmlSockets twohandsocket2 = (XmlSockets)XmlAttach.FindAttachment(bww, typeof(XmlSockets));
int nSockets = 0;
nSockets = twohandsocket2.NSockets;
if(nSockets >= 4)
return;
else
from.LocalOverheadMessage(MessageType.Emote, 0x59, true, "Your weapon is glowing with potential. ");
from.LocalOverheadMessage(MessageType.Emote, 0x59, true, "Weapon can be further Enhanced!. ");
twohandsocket2 = new XmlSockets(4);
XmlAttach.AttachTo(bww,twohandsocket2);
}
else
return;
}
}
}