|
You last visited: Today at 19:41
Advertisement
Trying to add an NPC but...
Discussion on Trying to add an NPC but... within the CO2 Private Server forum part of the Conquer Online 2 category.
08/27/2019, 01:33
|
#1
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
Trying to add an NPC but...
Code:
#region Escort Chief
case 30165:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Do you want to clear your inventory? It's free.");
dialog.Option("Yes, actually i do.", 1);
dialog.Option("Just passing by.", 255);
dialog.Send();
break;
}
case 1:
{
dialog.Text("Are you sure?");
dialog.Option("Yes, i am.", 2);
dialog.Option("No, i don't know what i was thinking.", 255);
dialog.Send();
break;
}
case 2:
{
foreach (Game.Item I in GC.MyChar.Inventory)
GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
GC.MyChar.Inventory = new ArrayList(40);
dialog.Text("Well it's done.");
dialog.Option("Thanks.", 255);
dialog.Send();
break;
}
}
break;
}
#endregion
I'm trying to add this except I'm unsure as to what these lines should be
Code:
foreach (Game.Item I in GC.MyChar.Inventory)
GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
GC.MyChar.Inventory = new ArrayList(40);
I know it isn't GC.MyChar.Inventory or GC.AddSend but not really sure what it should be >.<
|
|
|
08/27/2019, 08:25
|
#2
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Unsure without the actual source code. I'd recommend looking at the Inventory class(?) and see what methods it exposes for clearing the list, and if deleting items also sends those packets to the client automatically. You reinitializing it as an ArrayList is odd to me. If you're not saving that to the database, then your characters are going to overflow items. Also, just some advice on coding indentation, I recommend indenting code in your foreach body so it's clear what's being repeated. For example:
Code:
foreach (Game.Item I in GC.MyChar.Inventory)
GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
GC.MyChar.Inventory = new ArrayList(40);
|
|
|
08/27/2019, 10:48
|
#3
|
elite*gold: 0
Join Date: Jul 2009
Posts: 943
Received Thanks: 408
|
Quote:
Originally Posted by Spirited
Unsure without the actual source code. I'd recommend looking at the Inventory class(?) and see what methods it exposes for clearing the list, and if deleting items also sends those packets to the client automatically. You reinitializing it as an ArrayList is odd to me. If you're not saving that to the database, then your characters are going to overflow items. Also, just some advice on coding indentation, I recommend indenting code in your foreach body so it's clear what's being repeated. For example:
Code:
foreach (Game.Item I in GC.MyChar.Inventory)
GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
GC.MyChar.Inventory = new ArrayList(40);
|
Well, it's cleaning the inventory but isn't saving (deleting btw) on the database. It's just sending the remove subtype and creating the inventory list again.
Code:
public enum ItemAction : uint
{
None = 0,
Buy = 1,
Sell = 2,
Remove = 3,
...
}
|
|
|
08/27/2019, 11:56
|
#4
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
It's actually code from NCOS, I just tried implementing it into the server lol
|
|
|
08/27/2019, 14:08
|
#5
|
elite*gold: 0
Join Date: Jul 2009
Posts: 943
Received Thanks: 408
|
Quote:
Originally Posted by denominator
It's actually code from NCOS, I just tried implementing it into the server lol
|
If you're cleaning the inventory you must delete the items from the database too, or you'll be loading them on the next login.
Code:
foreach (Game.Item I in GC.MyChar.Inventory)
{
GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
I.Delete();
}
GC.MyChar.Inventory = new ArrayList(40);
Or whichever code you have there.
|
|
|
08/28/2019, 19:38
|
#6
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
I actually don't even need it lol
|
|
|
08/28/2019, 20:19
|
#7
|
elite*gold: 0
Join Date: Jul 2009
Posts: 943
Received Thanks: 408
|
Since TQ Binaries times I never changed my mind. NPCs to clear the inventory are useless.
|
|
|
08/28/2019, 20:29
|
#8
|
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
|
I was just confused as to why I couldn't drop certain items, turns out I need to be wearing better quality gears to drop gears in my inventory lol
|
|
|
08/30/2019, 18:47
|
#9
|
elite*gold: 0
Join Date: Jul 2009
Posts: 943
Received Thanks: 408
|
Or send the merchant with packet 10017 and value 255
where Merchant = 38 and false is broadcast
Quote:
|
user.UpdateClient(ClientUpdateType.Merchant, 255, false);
|
|
|
|
Similar Threads
|
HELP GUYS im trying to add fastjobchange but something error
04/22/2018 - Flyff Private Server - 3 Replies
Neuz error C2039: 'UpdateJob' : is not a member of 'CDPClient'
how to fix this ?? i compare this to the other files but its the same nothing change when i compile i got this error
sorry for my bad english
|
looking for coder to add soul item npc and dmg- add npc
07/09/2011 - CO2 Private Server - 0 Replies
hey im looking for a coder that could add a npc which sells full dragon soul sets +12 -7 255 hp 2 soc for specific classes e.g. for a tro you would buy a soul set which has weapons armor coro necky boots armor and so on also i need a npc where you can buy dmg - to your equips for tortoise gems
|
All times are GMT +1. The time now is 19:43.
|
|