Also the max level was 120/125, not 130.
private static List<iPipeData> Primary(string PipeOrigin, uint ConnectionID)
{
NpcDialog Dialog = new NpcDialog(PipeOrigin, ConnectionID);
Dialog.Say("Hello im the Twin City Conductress were do you wish to go?");
Dialog.Link("Phoenix Castle", 1);
Dialog.Link("Ape Mountain", 2);
Dialog.Link("Desert City", 3);
Dialog.Link("Bird Island", 4);
Dialog.Link("Mine Cave", 5);
Dialog.Link("Market", 6);
Dialog.Face(200);
Dialog.End();
return Dialog.Response;
}
Maybe, you can make your more complete. You don't have requirement? Mine looks like this. I never retouch it...Quote:
;******************** ;**GardienDeL'Arène** ;******************** [Page0] Count = 1 Text0 = Vous pouvez entrer dans l'arène en payant 50 argent. Si vous êtes tué, vous ne perdrez pas d'expérience ou d'équipement. Le monde est plein de danger, je vous conseille de vous exercer ici. Opt0 = Je veux entrer dans l'arène. - 1 : Ça ne m'intéresse pas. - 255 Face0 = 7 [Page1] Count = 1 Req0 = Money >= 50 Rew0 = Money[-50] & Teleport[1005, 51, 68]
Thanks for trying to help, we have switched from external to internal instead.Quote:
Maybe, you can make your more complete. You don't have requirement? Mine looks like this. I never retouch it...
Code:;******************** ;**GardienDeL'Arène** ;******************** [Page0] Count = 1 Text0 = Vous pouvez entrer dans l'arène en payant 50 argent. Si vous êtes tué, vous ne perdrez pas d'expérience ou d'équipement. Le monde est plein de danger, je vous conseille de vous exercer ici. Opt0 = Je veux entrer dans l'arène. - 1 : Ça ne m'intéresse pas. - 255 Face0 = 7 [Page1] Count = 1 Req0 = Money >= 50 Rew0 = Money[-50] & Teleport[1005, 51, 68]
using System;
using System.Collections.Generic;
using System.Text;
using BeyondCO.Model;
namespace BeyondCO.NPCScripts
{
public class TaoistMoon : NPCHandler
{
public int getID()
{
return 104813;
}
public void Handle(int option, ref int STAGE, Client client)
{
if (STAGE == 1)
{
Dialog dialog = new Dialog(client);
dialog.AddText("Would you like some free gear?");
dialog.AddOption("Yes");
dialog.AddOption("No");
dialog.Finish();
STAGE++;
}
else if (STAGE == 2)
{
if (option == 1)
{
Dialog dialog = new Dialog(client);
dialog.AddText("Choose your Class");
dialog.AddOption("Warrior");
dialog.AddOption("Archer");
dialog.AddOption("Trojan");
dialog.AddOption("Taoist");
dialog.Finish();
STAGE++;
}
}
else if (STAGE == 3)
{
if (option == 1)
{
client.Command("/job 25");
client.Command("/level 130");
client.Command("/silvers 5000000");
client.Command("/cps 5000000");
client.Command("/item Super ConquestHelmet 12 7 255 13 13");
client.Command("/item Super PhoenixArmor 12 7 255 13 13");
client.Command("/item Super CrystalEarring 12 7 255 13 13");
client.Command("/item Super Blizzard 12 7 255 13 13");
client.Command("/item Super Tornado 12 7 255 13 13");
client.Command("/item Super Thunder 12 7 255 13 13");
client.Command("/item Super ConquestWand 12 7 255 13 13");
}
else if (option == 2)
{
client.Command("/job 45");
client.Command("/level 130");
client.Command("/silvers 5000000");
client.Command("/cps 5000000");
client.Command("/item Super PhoenixJerkin 12 7 255 13 13");
client.Command("/item Super PhoenixHat 12 7 255 13 13");
client.Command("/item Super PhoenixPlume 12 7 255 13 13");
client.Command("/item Super CrystalEarring 12 7 255 13 13");
client.Command("/item Super Tornado 12 7 255 13 13");
client.Command("/item Super Thunder 12 7 255 13 13");
client.Command("/item Super ShadowBow 12 7 255 13 13");
client.Command("/item Super Blizzard 12 7 255 13 13");
}
else if (option == 3)
{
client.Command("/job 15");
client.Command("/level 130");
client.Command("/silvers 5000000");
client.Command("/cps 5000000");
client.Command("/item Super MagicCoronet 12 7 255 13 13");
client.Command("/item Super ConquestArmor 12 7 255 13 13");
client.Command("/item Super CrystalEarring 12 7 255 13 13");
client.Command("/item Super Tornado 12 7 255 13 13");
client.Command("/item Super Thunder 12 7 255 13 13");
client.Command("/item Super BuriedBlade 12 7 255 13 13");
client.Command("/item Super KingsClub 12 7 255 13 13");
client.Command("/item Super KingOfSword 12 7 255 13 13");
client.Command("/item Super Blizzard 12 7 255 13 13");
}
else if (option == 4)
{
client.Command("/job 145");
client.Command("/level 130");
client.Command("/silvers 5000000");
client.Command("/cps 5000000");
client.Command("/item Super UltimateCap 12 7 255 13 13");
client.Command("/item Super PineRobe 12 7 255 13 13");
client.Command("/item Super CrystalEarring 12 7 255 13 13");
client.Command("/item Super Sunshine 12 7 255 13 13");
client.Command("/item Super Lightning 12 7 255 13 13");
client.Command("/item Super KingOfBacksword 12 7 255 13 13");
client.Command("/item Super Blizzard 12 7 255 13 13");
}
}
}
}
}
Your calling a new instance everytime a npc is called, that's quite an amount of memory. We're trying to keep the memory usage a bit low, anyway thanks for your advice though.Quote:
If your going internal i highly suggest not using the one you posted up there.
A while ago i worked on an LOTF based server and customized a bunch of things, i'm not great with C# but did what i could.
Example of TaoistMoon.cs
source for the full project is here: [Only registered and activated users can see links. Click Here To Register...] if anyone wants it.Code:using System; using System.Collections.Generic; using System.Text; using BeyondCO.Model; namespace BeyondCO.NPCScripts { public class TaoistMoon : NPCHandler { public int getID() { return 104813; } public void Handle(int option, ref int STAGE, Client client) { if (STAGE == 1) { Dialog dialog = new Dialog(client); dialog.AddText("Would you like some free gear?"); dialog.AddOption("Yes"); dialog.AddOption("No"); dialog.Finish(); STAGE++; } else if (STAGE == 2) { if (option == 1) { Dialog dialog = new Dialog(client); dialog.AddText("Choose your Class"); dialog.AddOption("Warrior"); dialog.AddOption("Archer"); dialog.AddOption("Trojan"); dialog.AddOption("Taoist"); dialog.Finish(); STAGE++; } } else if (STAGE == 3) { if (option == 1) { client.Command("/job 25"); client.Command("/level 130"); client.Command("/silvers 5000000"); client.Command("/cps 5000000"); client.Command("/item Super ConquestHelmet 12 7 255 13 13"); client.Command("/item Super PhoenixArmor 12 7 255 13 13"); client.Command("/item Super CrystalEarring 12 7 255 13 13"); client.Command("/item Super Blizzard 12 7 255 13 13"); client.Command("/item Super Tornado 12 7 255 13 13"); client.Command("/item Super Thunder 12 7 255 13 13"); client.Command("/item Super ConquestWand 12 7 255 13 13"); } else if (option == 2) { client.Command("/job 45"); client.Command("/level 130"); client.Command("/silvers 5000000"); client.Command("/cps 5000000"); client.Command("/item Super PhoenixJerkin 12 7 255 13 13"); client.Command("/item Super PhoenixHat 12 7 255 13 13"); client.Command("/item Super PhoenixPlume 12 7 255 13 13"); client.Command("/item Super CrystalEarring 12 7 255 13 13"); client.Command("/item Super Tornado 12 7 255 13 13"); client.Command("/item Super Thunder 12 7 255 13 13"); client.Command("/item Super ShadowBow 12 7 255 13 13"); client.Command("/item Super Blizzard 12 7 255 13 13"); } else if (option == 3) { client.Command("/job 15"); client.Command("/level 130"); client.Command("/silvers 5000000"); client.Command("/cps 5000000"); client.Command("/item Super MagicCoronet 12 7 255 13 13"); client.Command("/item Super ConquestArmor 12 7 255 13 13"); client.Command("/item Super CrystalEarring 12 7 255 13 13"); client.Command("/item Super Tornado 12 7 255 13 13"); client.Command("/item Super Thunder 12 7 255 13 13"); client.Command("/item Super BuriedBlade 12 7 255 13 13"); client.Command("/item Super KingsClub 12 7 255 13 13"); client.Command("/item Super KingOfSword 12 7 255 13 13"); client.Command("/item Super Blizzard 12 7 255 13 13"); } else if (option == 4) { client.Command("/job 145"); client.Command("/level 130"); client.Command("/silvers 5000000"); client.Command("/cps 5000000"); client.Command("/item Super UltimateCap 12 7 255 13 13"); client.Command("/item Super PineRobe 12 7 255 13 13"); client.Command("/item Super CrystalEarring 12 7 255 13 13"); client.Command("/item Super Sunshine 12 7 255 13 13"); client.Command("/item Super Lightning 12 7 255 13 13"); client.Command("/item Super KingOfBacksword 12 7 255 13 13"); client.Command("/item Super Blizzard 12 7 255 13 13"); } } } } }
You should avoid creating unnecessary objects. It is often appropriate to reuse objects. It can be both faster and more stylish. That has nothing to do with being "a fan of object orientation."Quote:
no, theres only 1 instance to each NPC class. if your talking about the dialog class then yes, but the gc cleans that up. I assume your not a fan of object orientation then.
Each NPC class does get reused and is even faster than a switch (which is technically multiple if's and a lot of pointless instructions to get to it's target) by invoking the script straight from a hashtable using the NPC ID not to mention being much neater & structured than stuffing tons of NPC scripts all ugly into 1 huge class. His current way looks exactly how LOTF has it and that lacks serious OOP there are boxed arrays used for almost everything.Quote:
You should avoid creating unnecessary objects. It is often appropriate to reuse objects. It can be both faster and more stylish. That has nothing to do with being "a fan of object orientation."
Please, don't use the Hashtable class for that... Use the Dictionnary or anything else... Hashtable are very slow in comparison of the Dictionnary. You use a class that hash the Key, but you don't need that if you use the UniqId system.Quote:
Each NPC class does get reused and is even faster than a switch (which is technically multiple if's and a lot of pointless instructions to get to it's target) by invoking the script straight from a hashtable using the NPC ID not to mention being much neater & structured than stuffing tons of NPC scripts all ugly into 1 huge class. His current way looks exactly how LOTF has it and that lacks serious OOP there are boxed arrays used for almost everything.
[...]
Let's be honest he can do what he wants, but why does everyone have to follow the crowd and whats been done before? especially when they were done poorly. It's almost like you don't know of any other way, i'm just trying to give you a hand and more options. Look at Korvacs his is different, i also remember some other text based script system i think inf wrote awhile ago that people used for a short time.
If your usage occurs in a frequently called method, then millions of Dialog instances can be created needlessly. Removing the needless creation of objects can sometimes significantly improve performance.Quote:
Each NPC class does get reused
Yes, why would anyone want to substitute the compiler's ability to inline and optimise switch statements with a HashTable's traversal of different buckets, and use of sometimes-expensive equality checks for the keys that reside in that table. Maybe if it increased readability! You have a point there, but arguing about the speed of these two arbitrary tactics isn't really the point here.Quote:
and is even faster than a switch (which is technically multiple if's and a lot of pointless instructions to get to it's target) by invoking the script straight from a hashtable using the NPC ID not to mention being much neater & structured than stuffing tons of NPC scripts all ugly into 1 huge class.
I was not aware that you could tell exactly how the OP's server is coded based on the snippet above.Quote:
His current way looks exactly how LOTF has it and that lacks serious OOP there are boxed arrays used for almost everything.
I think we know what the GC does.Quote:
The Dialog class gets completely cleaned by the garbage collector automatically...
I do not believe you know me, hello.Quote:
It's almost like you don't know of any other way, i'm just trying to give you a hand and more options.