//
Uhm I kinda released this already.Quote:
I took a look at the NPCs and it annoyed me so this is to make the system simpler.
Add this in packethandling/npcdialog.cs
Example:Code:public static void Text(string value, Main.GameClient GC) { GC.AddSend(Packets.NPCSay(value)); } public static void Link(string value, byte linkback, Main.GameClient GC) { GC.AddSend(Packets.NPCLink(value, linkback)); } public static void Face(ushort face, Main.GameClient GC) { GC.AddSend(Packets.NPCSetFace(face)); } public static void End(Main.GameClient GC) { GC.AddSend(Packets.NPCFinish()); } public static void Teleport(ushort map, ushort x, ushort y, Main.GameClient GC) { GC.MyChar.Teleport(map, x, y); }
instead ofCode:#region Leave TG case 600075: { if (Control == 0) { Text("Do you want to leave this place?", GC); Link("Yeah.", 1, GC); Link("No, I'll stay here.", 255, GC); Face(N.Avatar, GC); End(GC); } else if (Control == 1) { Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap]; Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC); } break; } #endregion
I did not test this a lot though, the example provided is the only NPC I tested it on.Code:#region Leave TG case 600075: { if (Control == 0) { GC.AddSend(Packets.NPCSay("Do you want to leave this place?")); GC.AddSend(Packets.NPCLink("Yeah.", 1)); GC.AddSend(Packets.NPCLink("No, I'll stay here.", 255)); GC.AddSend(Packets.NPCSetFace(N.Avatar)); GC.AddSend(Packets.NPCFinish()); } else if (Control == 1) { Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap]; GC.MyChar.Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y); } break; } #endregion
//edit Added Teleport.
I didn't knew that you also released something like this.Quote:
Uhm I kinda released this already.
Only thing different about yours is the Teleport.
And you need to be specific on where to add the code.
Because it won't work just anywhere in the packethandler.
Please test stuff before you release it.
#region Leave TG
case 600075:
{
switch (Control)
{
case 0:
Text("Do you want to leave this place?", GC);
Link("Yeah.", 1, GC);
Link("No, I'll stay here.", 255, GC);
break;
case 1:
Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC);
break;
}
Face(N.Avatar, GC);
End(GC);
break;
}
break;
I'm sorry to tell you but usingQuote:
I took a look at the NPCs and it annoyed me so this is to make the system simpler.
Add this in packethandling/npcdialog.cs
Example:Code:public static void Text(string value, Main.GameClient GC) { GC.AddSend(Packets.NPCSay(value)); } public static void Link(string value, byte linkback, Main.GameClient GC) { GC.AddSend(Packets.NPCLink(value, linkback)); } public static void Face(ushort face, Main.GameClient GC) { GC.AddSend(Packets.NPCSetFace(face)); } public static void End(Main.GameClient GC) { GC.AddSend(Packets.NPCFinish()); } public static void Teleport(ushort map, ushort x, ushort y, Main.GameClient GC) { GC.MyChar.Teleport(map, x, y); } public static void Silvers(uint value, Main.GameClient GC) { GC.MyChar.Silvers += value; } public static void CPs(uint value, Main.GameClient GC) { GC.MyChar.CPs += value; }
instead ofCode:#region Leave TG case 600075: { if (Control == 0) { Text("Do you want to leave this place?", GC); Link("Yeah.", 1, GC); Link("No, I'll stay here.", 255, GC); Face(N.Avatar, GC); End(GC); } else if (Control == 1) { Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap]; Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC); } break; } #endregion
To give 1000 silvers:Code:#region Leave TG case 600075: { if (Control == 0) { GC.AddSend(Packets.NPCSay("Do you want to leave this place?")); GC.AddSend(Packets.NPCLink("Yeah.", 1)); GC.AddSend(Packets.NPCLink("No, I'll stay here.", 255)); GC.AddSend(Packets.NPCSetFace(N.Avatar)); GC.AddSend(Packets.NPCFinish()); } else if (Control == 1) { Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap]; GC.MyChar.Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y); } break; } #endregion
To remove 1000 silvers:Code:Silvers(+1000, GC);
I did not test this a lot though, the example provided is the only NPC I tested it on.Code:Silvers(-1000, GC);
//edit Added Teleport.
public static void Silvers(uint value, Main.GameClient GC)
{
GC.MyChar.Silvers += value;
}
public static void CPs(uint value, Main.GameClient GC)
{
GC.MyChar.CPs += value;
}
public static void Silvers(int value, Main.GameClient GC)
{
if(value <= 0 && GC.MyChar.Silvers < -value)
return;
GC.MyChar.Silvers = (uint)(GC.MyChar.Silvers + value);
}
public static void CPs(int value, Main.GameClient GC)
{
if(value <= 0 && GC.MyChar.CPs < -value)
return;
GC.MyChar.CPs = (uint)(GC.MyChar.CPs + value);
}
It can be done for all methods, not that hard.Quote:
well, this is not really useful, if you can't use all methode types :)
like other statements instead of teleport, cps and silvers only :D
But also peoples get sone work then, to add them by them selves, but most peoples is just Copy + paste xD