|
You last visited: Today at 21:01
Advertisement
[Release] Extremely basic (but working/bugless) C# Source
Discussion on [Release] Extremely basic (but working/bugless) C# Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
05/13/2009, 16:39
|
#106
|
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
|
Thnx for the reply xD
Quote:
public static void SaveProf(GameClient Client)
{
IniFile wrtr = new IniFile(DatabasePath + @"\Profs\" + Client.Username + ".ini");
sbyte i = 0;
foreach (ISkill Prof in Client.Profs)
{
wrtr.Write("Proficiencys", "Prof[" + i.ToString() + "]", Prof.ToString());
i++;
}
wrtr.Write("Proficiencys", "Count", i.ToString());
}
private static void LoadProf(GameClient Client)
{
IniFile rdr = new IniFile(DatabasePath + @"\Profs\" + Client.Username + ".ini");
sbyte count = rdr.ReadSByte("Proficiencys", "Count", 0);
for (sbyte i = 0; i < count; i++)
{
string[] Prof = (rdr.ReadString("Proficiencys", "Prof[" + i.ToString() + "]", String.Empty)).Split(' ');
ProfPacket LoadedProf = new ProfPacket(true);
LoadedProf.ID = ushort.Parse(Prof[0]);
LoadedProf.Level = ushort.Parse(Prof[1]);
LoadedProf.Experience = uint.Parse(Prof[2]);
Client.LearnProf(LoadedProf);
}
}
|
This is what I got for saving and loading (i watched how SaveInventory and LoadInventory was done I added SaveProf(Client); under SaveInventory in the SaveCharacter method and i also put LoadProf(Client); under LoadInventory in the LoadCharacter method.
I got this in GameClient:
public Dictionary<ushort, ISkill> m_Profs = new Dictionary<ushort, ISkill>(50);
public ISkill[] Profs;
When i use the command @prof 480 5 it says: [Command Error] Object reference not set to an instance of an object.
Do you know what I did wrong? :P
|
|
|
05/13/2009, 19:54
|
#107
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
when adding a skill/prof you add it in the m_Profs or Profs? adding it in m_Profs wouldnt give any error, but adding it in Profs ( ISkill[] Profs; ) should... anyway I use the dictionary because its more easy to handle it(as for me)...
|
|
|
05/13/2009, 21:04
|
#108
|
elite*gold: 20
Join Date: Jan 2006
Posts: 890
Received Thanks: 241
|
Quote:
Originally Posted by kinshi88
Anyone still developing this like me?
|
nope, just working on my own source still
|
|
|
05/14/2009, 07:38
|
#109
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
Quote:
Originally Posted by lostsolder05
nope, just working on my own source still 
|
Well, I dont either now, started my own source yesterday and its going to be 5018+ from its first start.
|
|
|
05/14/2009, 13:46
|
#110
|
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
|
Quote:
Originally Posted by alexbigfoot
when adding a skill/prof you add it in the m_Profs or Profs? adding it in m_Profs wouldnt give any error, but adding it in Profs ( ISkill[] Profs; ) should... anyway I use the dictionary because its more easy to handle it(as for me)...
|
uhm i add it in m_Profs like this:
Quote:
private void CreateProfInstance()
{
ISkill[] temp = new ISkill[m_Profs.Count];
m_Profs.Values.CopyTo(temp, 0);
Profs = temp;
}
/* Returns false if already contained, true if it is added */
public bool LearnProf(ISkill Prof)
{
if (m_Profs.ContainsKey(Prof.ID))
{
m_Profs[Prof.ID] = Prof;
Prof.Send(this);
CreateProfInstance();
return false;
}
else
{
this.m_Profs.Add(Prof.ID, Prof);
Prof.Send(this);
CreateProfInstance();
return true;
}
}
|
This is how I let a prof be learned :P
So I add the Profs to m_Profs and the values from m_Profs go
into Profs and it saves with a foreach ISkill Prof in Profs.
I think thats wrong?
Quote:
public static void SaveProf(GameClient Client)
{
IniFile wrtr = new IniFile(DatabasePath + @"\Profs\" + Client.Username + ".ini");
sbyte i = 0;
int numberOfProfs = Client.m_Profs.Count;
for (ushort num=0; num <= numberOfProfs; num++)
{
wrtr.Write("Proficiencys", "Prof[" + i.ToString() + "]", Client.m_Profs[num].ToString());
}
wrtr.Write("Proficiencys", "Count", i.ToString());
}
|
Is this a better way of saving?
|
|
|
05/14/2009, 17:37
|
#111
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
Quote:
Originally Posted by taushif
Is this a better way of saving?
|
Well, if it works it is... anyway it would work faster i think with
Code:
IniFile wrtr = new IniFile(DatabasePath + @"\Profs\" + Client.Username + ".ini");
sbyte profscount = 0;
foreach(ISkill prof in Client.m_Profs.Values)
{
wrtr.Write("Proficiencys", "Prof[" + profscount.ToString() + "]", prof.ToString());
profscount++;
}
wrtr.Write("Proficiencys", "Count", profscount.ToString());
|
|
|
05/14/2009, 20:57
|
#112
|
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
|
Uhm it works same as ur save what u posted.
But it doesnt save good like mine did.
It only save:
Quote:
It doesnt save the prof's so I think maybe its a Null pointer exception or something?
Means that the m_Profs is empty :P and that means that @prof ID Level
doesnt work that good or LearnProf works not good?
Or must I code something that will display the Prof in the client?
because when i use @prof 480 2 i dont see anything in the prof section in the client
but it has to display a club image with lvl 2 :P
|
|
|
05/14/2009, 23:27
|
#113
|
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
|
I dont really know.
|
|
|
05/15/2009, 01:36
|
#114
|
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
|
Can someone give me a download link to a 5017 client? Can only find some spanish thing.
|
|
|
05/15/2009, 06:12
|
#115
|
elite*gold: 0
Join Date: May 2009
Posts: 68
Received Thanks: 16
|
Here it is :
|
|
|
05/15/2009, 11:26
|
#116
|
elite*gold: 0
Join Date: May 2009
Posts: 18
Received Thanks: 0
|
Nice dude
|
|
|
05/15/2009, 12:54
|
#117
|
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
|
Quote:
Originally Posted by alexbigfoot
I dont really know.
|
So you mean that if I use @prof 480 2, then the client knows
what 480 is?
|
|
|
05/15/2009, 13:15
|
#118
|
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
|
Quote:
Originally Posted by taushif
So you mean that if I use @prof 480 2, then the client knows
what 480 is?
|
Yes.
|
|
|
05/15/2009, 18:53
|
#119
|
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
|
Quote:
Originally Posted by tao4229
Yes.
|
***** I just tested Alex his prof version and it works :P
Tao's prof version doesn't work with me xD
|
|
|
05/15/2009, 19:56
|
#120
|
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
|
I am!
Quote:
Originally Posted by kinshi88
Anyone still developing this like me?
|
I am! Well not really i am helping out my friend who is developing on the server that we will run together while i teach him C# i continue with my source in vb.net. I am Semi-Pro vb.net user and can make a server in C# but i am not great at it (guess u could said it would turn out worse then loft). I got out C# server along with my VB server working with newest patch yet again. But this time i dint use the Manged OpenSSL. I will post some codes later on for some things if i can get around to it . Right now i cant be bothered to fix some of my mistakes and post it i guess i am lazy right now. But i hope everyone that is still developing a server under this marvelous release will have some curtsy and help keep it alive.
|
|
|
 |
|
Similar Threads
|
[Huge-Release] All-In-One Basic NPC Scripts For The 5165 Source!
02/19/2010 - CO2 PServer Guides & Releases - 30 Replies
Well I'm sorry that I spammed the whole forum full of my posts So pro4never and .Ryu gave me the idea of making this All-In-One thread about all my NPC's! THESE ARE UPDATED DAILY!
NOTE: TO PEOPLE... SOME OF THE CODES ARE NOT MADE BY ME! I USUALLY JUST FIXED/UPDATED THE BASIC ONES! SORRY I'M LEARNING ON HOW TO CODE!
1. Birth-Island-NPC's(The NPC text is not from "REAL CONQUER" SORRY!...)
#region BirthOldGeneralYang
case 425:
{
|
[FINAL RELEASE]HuB- Source (BASIC) (Original LOTF easier workable)
11/14/2009 - CO2 PServer Guides & Releases - 25 Replies
#REMOVED
|
[RELEASE] Basic LOTF Source
09/03/2009 - CO2 PServer Guides & Releases - 17 Replies
hey this is a basic lotf source edited based off shadowco, if you dont like it then dont post here... flames will be told on!!! :D i will tell on you to the mods if you flame
What it has...
- LuckyTime
- Guard
- 24/7 GW
|
All times are GMT +1. The time now is 21:02.
|
|