|
HELP!
This is a discussion on HELP! within the CO2 PServer - Discussions / Questions forum part of the Conquer Online 2 category; [code]#region Adding Enemies
string Name = ""; for (int i = 14; i < 14 + Data[13]; i++) { Name ...
01-12-2010, 06:29
|
#1
|
Senior Member
Join Date: Apr 2006
Posts: 533
Received Thanks: 57
|
HELP!
[code]#region Adding Enemies
string Name = ""; for (int i = 14; i < 14 + Data[13]; i++) { Name += Convert.ToChar(Data[i]); }
if (GC.MyChar.MyGuild.Enemies.Count < 5)
{
foreach (KeyValuePair<int, Struct.Guilds> Guilds in Guilds)
{
Struct.Guilds TGuild = Guilds.Value;
if (TGuild.Name != GC.MyChar.MyGuild.GuildID)
{
if (!GC.MyChar.MyGuild.Enemies.Contains(TGuild.ID))
{
if (TGuild.Name == Name)
{
Struct.Guilds GuildUpdate = NewestCoServer.Guilds[GC.MyChar.MyGuild];
GuildUpdate.Enemies.Add(TGuild.ID, TGuild);
GC.AddSend(Packets.NPCSay("Done."));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
Database.database.UpdateGuild(GC.MyChar.MyGuild);
foreach (GC Socket in Database.ClientPool.Values)
{
string[] Names = new string[1];
Names[0] = TGuild.Name;
Socket.GetType(NewestCoServer.String(Names, TGuild.ID, Struct.StringType.GuildEnemies, 1));
PacketHandler.Guild.SendGuildScreen(Socket);
}
}
}
else { GC.AddSend(Packets.NPCSay("This is guild already is your enemy."));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
}
}
else { GC.AddSend(Packets.NPCSay("You are full enemies."));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
#endregion
What do I need to put because I am changing the npc text etc but some of the things are puzzling to me especially such as this part >.< Just a few things that won`t accept >.<
|
|
|
01-12-2010, 06:37
|
#2
|
Cookies?!
Join Date: Oct 2009
Posts: 975
Received Thanks: 542
|
What was the original code and what did you change. It would be easier if you pointed it out.
|
|
|
01-12-2010, 07:11
|
#3
|
Senior Member
Join Date: Apr 2006
Posts: 533
Received Thanks: 57
|
[code]#region Adding Enemies
string Name = ""; for (int i = 14; i < 14 + Data[13]; i++) { Name += Convert.ToChar(Data[i]); }
if (CSocket.Client.Guild.Enemies.Count < 5)
{
foreach (KeyValuePair<int, Struct.Guilds> Guilds in Nano.Guilds)
{
Struct.Guilds TGuild = Guilds.Value;
if (TGuild.Name != CSocket.Client.Guild.Name)
{
if (!CSocket.Client.Guild.Enemies.ContainsKey(TGuild. ID))
{
if (TGuild.Name == Name)
{
Struct.Guilds GuildUpdate = Nano.Guilds[CSocket.Client.GuildID];
GuildUpdate.Enemies.Add(TGuild.ID, TGuild);
Text("Done.", CSocket);
Link("Thanks.", 255, CSocket);
End(CSocket);
Database.Database.UpdateGuild(CSocket.Client.Guild );
foreach (ClientSocket Socket in Nano.ClientPool.Values)
{
string[] Names = new string[1];
Names[0] = TGuild.Name;
Socket.Send(ConquerPacket.String(Names, TGuild.ID, Struct.StringType.GuildEnemies, 1));
Handlers.Guilds.SendGuildScreen(Socket);
}
}
}
else { ErrorMsg("This is guild already is your enemy.", CSocket); }
}
}
}
else { ErrorMsg("You are full enemies.", CSocket); }
#endregion
This is the original I am attempting to make it work for 5165
|
|
|
01-12-2010, 07:40
|
#4
|
Senior Member
Join Date: Jul 2005
Posts: 2,015
Received Thanks: 756
|
What errors are you getting?
I haven't used the source so it's hard for me to tell but from a purely structural level things seemed to make some sense (note: please use the [code] system properly.. makes everything infinitely more readable)
|
|
|
01-12-2010, 09:05
|
#5
|
Conquer 2 Moderator
Join Date: Mar 2006
Posts: 3,205
Received Thanks: 911
|
You havent explained whats wrong at all lol, how are people supposed to help you?
|
|
|
01-12-2010, 19:40
|
#6
|
Senior Member
Join Date: Apr 2006
Posts: 533
Received Thanks: 57
|
Huh@Korvacs? "This is the original I am attempting to make it work for 5165" I would have thought with the words GUILDS and ENEMIES it would have been obvious considering 5165 has no allies and enemies for guilds >.< In fairness my only posts recently have been for 5165.
Ok the original code is for coemuv2 thought checking through sources this would have been obvious since 5017 is completely different with no script liike this for GuildNPC. So far I have seen this code only once unless you count binaries.
This is the part that confuses me because I am not sure what the 5165 should read >.<
[code]
Database.database.UpdateGuild(GC.MyChar.MyGuild);
foreach (GC Socket in Database.ClientPool.Values)
{
string[] Names = new string[1];
Names[0] = TGuild.Name;
Socket.GetType(NewestCoServer.String(Names, TGuild.ID, Struct.StringType.GuildEnemies, 1));
PacketHandler.Guild.SendGuildScreen(Socket);
}
}
With all due respect pro4never I am forever trying to use the [code] thing and STILL have no idea how to do it lmao.
Last edited by WHITELIONX; 01-12-2010 at 19:50.
|
|
|
01-12-2010, 21:02
|
#7
|
Senior Member
Join Date: Jul 2005
Posts: 2,015
Received Thanks: 756
|
[ code ]
text
[ / code ]
that's allt here is to it. Just like any other forum based syntax.
It makes everything so much more readable by keeping all the indentation and formating the same so people can actually read it :P
So you are still in the process of converting the last bit of the code... but what errors are you getting?
Again I can't help much cause I've not used the source.
|
|
|
|
The Following User Says Thank You to pro4never For This Useful Post:
|
|
01-12-2010, 21:37
|
#8
|
Senior Member
Join Date: Apr 2006
Posts: 533
Received Thanks: 57
|
Ok cool I think I understand the code thing now  Some of the words are not found in that little part now but I have no idea what the words should be >.<
Basically Database is fine but Database.database is not fine because database comes up as an issue. So the words causing me a problem in this little part would be Struct, Guilds, NewestCoServer, Getstats and ClientPool
|
|
|
01-12-2010, 23:34
|
#9
|
Senior Member
Join Date: Jul 2005
Posts: 2,015
Received Thanks: 756
|
Database.Database is because you are converting it from a CoEmu source that has a folder named Database with a .cs file in it named Database.cs (therefore Database.Database.functionname)
Where is your guild structures handled? again, CoEmu has a folder named Struct>Guilds.cs for handling guild structures.
basically you just need to link the problem areas up with where the code exists in your source. client pool would indicate all connected clients, easiest way to find that would be to find where new connections are being accepted. Once authenticated/logged in fully they should be being added to a client thread... Client Pool I am 90 pct sure refers to what it is called in CoEmu but it should still function similarly
|
|
|
01-13-2010, 00:41
|
#10
|
Senior Member
Join Date: Apr 2006
Posts: 533
Received Thanks: 57
|
Ahhhhhhhhhh so I need it to be something like Database.Features.functionname? Ok so I have Guilds.cs in Features but I also have Guild stuff in Database.cs and Guild.cs in PacketHandling
Meh I give up I have absolutely no idea what is supposed to be where and when I try to change it well it just gives new errors >.<
Last edited by WHITELIONX; 01-14-2010 at 03:12.
|
|
|
All times are GMT +2. The time now is 12:41.
|
|