Quote:
Originally Posted by ElDeRnEcRo
using ConquerPatch._5017;
I`d need the packetID of the packet that allows you to buy stuff from shops, or if it`s a subtype of a packet, then the ID and the subtype. Btw, if anyone has a list of the PacketIDs (just the IDs, not the codes) for 5017, I`d be really grateful.
|
Anyway...you mean you cant buy in shop?
Try this code.... press Thanks if i helped..
Code:
#region shops
case 1:
{
Me.Ready = false;
uint ItemID = (uint)((Data[0x0b] << 24) + (Data[0x0a] << 16) + (Data[0x09] << 8) + Data[0x08]);
uint CPsVal = Data[18];
uint Value = (uint)((Data[0x07] << 24) + (Data[0x06] << 16) + (Data[0x05] << 8) + Data[0x04]);
byte Amount = Data[20];
int Money = Data[5];
if (Amount == 0)
Amount = 1;
string TehShop = System.IO.File.ReadAllText(System.Windows.Forms.Application.StartupPath + @"\Shop.dat");
try
{
if (Other.CharExist(Convert.ToString(ItemID), TehShop))
{
foreach (uint[] item in ExternalDatabase.Items)
{
if (ItemID == item[0])
{
Value = item[7];
CPsVal = item[15];
}
}
for (int i = 0; i < Amount; i++)
{
if (Me.ItemsInInventory > 39)
return;
if (Me.Coins >= Value && CPsVal == 0 || Me.ECs > CPsVal && CPsVal != 0)
{
if (CPsVal == 0)
Me.Coins -= Value;
if (CPsVal > 0)
Me.ECs -= CPsVal;
if (Me.Coins < 0)
Me.Coins = 0;
if (Me.ECs < 0)
Me.ECs = 0;
byte WithPlus = 0;
if (ItemID == 730003)
WithPlus = 3;
if (ItemID == 730004)
WithPlus = 4;
if (ItemID == 730005)
WithPlus = 5;
if (ItemID == 730006)
WithPlus = 6;
if (ItemID == 730007)
WithPlus = 7;
if (ItemID == 730008)
WithPlus = 8;
if (ItemID == 730009)
WithPlus = 9;
if (ItemID == 601819)
WithPlus = 9;
if (ItemID == 601829)
WithPlus = 10;
if (ItemID == 601839)
WithPlus = 11;
if (ItemID == 601849)
WithPlus = 12;
Me.AddItem(Convert.ToString(ItemID) + "-" + WithPlus + "-0-0-0-0", 0, (uint)Gen.Rand.Next(10000000));
Sp(Gen.MyPackets.Vital(Me.UID, 4, Me.Coins));
Sp(Gen.MyPackets.Vital(Me.UID, 30, Me.ECs));
}
else
{
Sp(Gen.MyPackets.SendMsg(MessageId, "SYSTEM", Me.Name, "You don't have " + Value + " silvers or " + CPsVal + " ECs.", 2005));
break;
}
}
}
else
{
Gen.WriteLine("There is no such item in Shop.dat.(" + ItemID + ")");
}
}
catch (Exception Exc) { Gen.WriteLine(Convert.ToString(Exc)); }
Me.Ready = true;
break;
}
#endregion
and you can there ID in shop.dat
Code:
[Shop0]
ID=3 [COLOR="Red"]<-----------ID[/COLOR]
Name=Drugstore [COLOR="Red"]<-------------NPC name[/COLOR]
Type=1
MoneyType=0 [COLOR="Red"]<---------0 for Golds and 1 for CPs[/COLOR]
ItemAmount=19
Item0=1000000
Item1=1000010
Item2=1000020
Item3=1000030
Item4=1001000
Item5=1001010
Item6=1001020
Item7=1002000
Item8=1002010
Item9=1002020
Item10=1060020
Item11=1001030
Item12=1001040
Item13=1002030
Item14=1002040
Item15=720011
Item16=720012
Item17=720013
Item18=1002050
Edit
ECs to
CPs and
Coins for
Silvers....Also
Me for
MyChar.
Sp(Gen.MyPackets.Vital(Me.UID, 30, Me.ECs)); to
SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
Its from my Own Source.....