|
You last visited: Today at 18:59
Advertisement
[Help]Tinter
Discussion on [Help]Tinter within the CO2 Private Server forum part of the Conquer Online 2 category.
06/15/2009, 20:53
|
#1
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
[Help]Tinter
Okay, so I've been skimming around like crazy trying to find ways of making this work, I've altered it quite a few times, but the majority of what I do won't get accepted by the source. I'm not a great coder, I know this. The coding here is basically LOTF, just altered, and some parts still based for LOTF. Say what you want, but learning how to transfer a few things from LOTF to work on here will help me to understand this source slightly better, so hopefully in the future, I won't need to reult in threads like this.
Here's what I have so far, red highlights are portions that aren't accepted.
Code:
case 10064:// Tinter
{
if (LinkBack == 0)
{
Text("What would you like to dye?", CSocket);
Link("Armor.", 1, CSocket);
Link("Helmet.", 2, CSocket);
Link("Shield.", 3, CSocket);
Link("I'm think I'm good!", 255, CSocket);
End(CSocket);
}
else if (LinkBack == 1 || LinkBack == 2 || LinkBack == 3)
{
[COLOR="Red"]Color[/COLOR] = LinkBack;
Text("What Colour would you like to dye your armor?", CSocket);
Link("Orange", 4, CSocket);
Link("Light Blue", 5, CSocket);
Link("Red", 6, CSocket);
Link("Blue", 7, CSocket);
Link("Yellow", 8, CSocket);
Link("Purple", 9, CSocket);
Link("White", 10, CSocket);
End(CSocket);
}
else if (LinkBack == 4 || LinkBack == 5 || LinkBack == 6 || LinkBack == 7 || LinkBack == 8 || LinkBack == 9 || LinkBack == 10)
{
try
{
string[] item;
string[] item2 = null;
if (Color == 3)
item2 = CSocket.Client.Equipment[5].[COLOR="red"]Split[/COLOR]('-');
string newitem;
if (Color == 1 && CSocket.Client.Equipment[3] != null && [COLOR="red"]CSocket.Client.Equipment[3] != "0[/COLOR]")
item = CSocket.Client.Equipment[3].[COLOR="red"]Split[/COLOR]('-');
else if (Color == 2 && CSocket.Client.Equipment[1] != null && [COLOR="red"]CSocket.Client.Equipment[1] != "0[/COLOR]")
item = CSocket.Client.Equipment[1].[COLOR="red"]Split[/COLOR]('-');
else if (Color == 3)
if (CSocket.Client.Equipment[5] != null && [COLOR="red"]Other[/COLOR].WeaponType(uint.Parse(item2[0])) == 900)
item = CSocket.Client.Equipment[5].[COLOR="red"]Split[/COLOR]('-');
else
{
Text("You don't have a shield equipped.", CSocket);
Link("I'm sorry.", 255, CSocket);
End(CSocket);
}
else
return;
newitem = item[0];
newitem = newitem.Remove(newitem.Length - 3, 1);
if (LinkBack == 4)
newitem = newitem.Insert(newitem.Length - 2, "3");
if (LinkBack == 5)
newitem = newitem.Insert(newitem.Length - 2, "4");
if (LinkBack == 6)
newitem = newitem.Insert(newitem.Length - 2, "5");
if (LinkBack == 7)
newitem = newitem.Insert(newitem.Length - 2, "6");
if (LinkBack == 8)
newitem = newitem.Insert(newitem.Length - 2, "7");
if (LinkBack == 9)
newitem = newitem.Insert(newitem.Length - 2, "8");
if (LinkBack == 10)
newitem = newitem.Insert(newitem.Length - 2, "9");
if ([COLOR="red"]Color[/COLOR] == 1)
{
CSocket.Client.Equipment[3] = [COLOR="red"]newitem + "-" + item[1] + "-" + item[2] + "-" + item[3] + "-" + item[4] + "-" + item[5];[/COLOR]
CSocket.Send(ConquerPacket.ItemInfo(CSocket, 2, CSocket.Client.Equipment, Struct.[COLOR="red"]ItemInfo[/COLOR]));
ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
}
if ([COLOR="red"]Color[/COLOR] == 2)
{
CSocket.Client.Equipment[1] = [COLOR="red"]newitem + "-" + item[1] + "-" + item[2] + "-" + item[3] + "-" + item[4] + "-" + item[5];[/COLOR]
CSocket.Send(ConquerPacket.ItemInfo(CSocket, 2, CSocket.Client.Equipment, Struct.[COLOR="red"]ItemInfo[/COLOR]));
ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
}
if ([COLOR="red"]Color[/COLOR] == 3)
{
CSocket.Client.Equipment[5] = [COLOR="red"]newitem + "-" + item[1] + "-" + item[2] + "-" + item[3] + "-" + item[4] + "-" + item[5];[/COLOR]
CSocket.Send(ConquerPacket.ItemInfo(CSocket, 2, CSocket.Client.Equipment, Struct.[COLOR="red"]ItemInfo[/COLOR]));
ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
}
[COLOR="red"]Color[/COLOR] = 0;
}
catch (Exception Exc) { [COLOR="red"]General[/COLOR].WriteLine(Convert.ToString(Exc)); }
}
}
If someone can enlighten me as to what would be appropriate for the specific sections highlighted, it would help me understand this a bit better.
I've already went over a few releases by others here, compaired to LOTF, as soe of them were altered from it, and I understand how they all work, wasn't much that had to be changed with them, but this in itself is confusing me.
Thanks in advance anyone who is willing to help.
|
|
|
06/15/2009, 21:02
|
#2
|
elite*gold: 0
Join Date: Jun 2009
Posts: 92
Received Thanks: 8
|
Since Color is part of the ItemPacket now, you don't have to mess with the Items ID like LOTF did.
|
|
|
06/15/2009, 21:17
|
#3
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
Hmmm... Ok... I was trying not to bug you for help, lol. But I'll rearrange it in a few and see what I come up with.
|
|
|
06/16/2009, 00:43
|
#4
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
Don't mean to double post, but to avoid issues with an editted post not being ackowledged... Still having some issue with this, particularily the split. If anyone has insight on how to get this working, would be appreciated. My attempts have proven futile. However, I'm going to take a break on this for the time being and see about getting the healing skills to function.
|
|
|
06/16/2009, 02:27
|
#5
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
Use math, not string manipulation.
|
|
|
06/16/2009, 16:57
|
#6
|
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
|
I'm still having trouble with this cause im noob. but i tried making it int Color = 1...etc.... but was getting errors. And i know im probably completely wrong but it was worth a try
|
|
|
06/16/2009, 18:18
|
#7
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
Code:
if (LinkBack == 4)
newitem = newitem.Insert(newitem.Length - 2, "3");
if (LinkBack == 5)
newitem = newitem.Insert(newitem.Length - 2, "4");
if (LinkBack == 6)
newitem = newitem.Insert(newitem.Length - 2, "5");
if (LinkBack == 7)
newitem = newitem.Insert(newitem.Length - 2, "6");
if (LinkBack == 8)
newitem = newitem.Insert(newitem.Length - 2, "7");
if (LinkBack == 9)
newitem = newitem.Insert(newitem.Length - 2, "8");
if (LinkBack == 10)
newitem = newitem.Insert(newitem.Length - 2, "9");
This is the portion that deals with the colours. The main thing is having it read, and replace the proper piece of equipment. Probably going to take me awhile to figure it out, but I'm a noob aswell, lol. No real C# knowledge, I merely find ways of adapting to code I'm working with, and manipulating it for other purposes. However, this source is proving to be a nightmare for me. So as I said, going to take awhile.
Maybe that'll help you a bit better then it does me.
|
|
|
06/16/2009, 19:05
|
#8
|
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
|
Quote:
Originally Posted by Incariuz
Code:
if (LinkBack == 4)
newitem = newitem.Insert(newitem.Length - 2, "3");
if (LinkBack == 5)
newitem = newitem.Insert(newitem.Length - 2, "4");
if (LinkBack == 6)
newitem = newitem.Insert(newitem.Length - 2, "5");
if (LinkBack == 7)
newitem = newitem.Insert(newitem.Length - 2, "6");
if (LinkBack == 8)
newitem = newitem.Insert(newitem.Length - 2, "7");
if (LinkBack == 9)
newitem = newitem.Insert(newitem.Length - 2, "8");
if (LinkBack == 10)
newitem = newitem.Insert(newitem.Length - 2, "9");
This is the portion that deals with the colours. The main thing is having it read, and replace the proper piece of equipment. Probably going to take me awhile to figure it out, but I'm a noob aswell, lol. No real C# knowledge, I merely find ways of adapting to code I'm working with, and manipulating it for other purposes. However, this source is proving to be a nightmare for me. So as I said, going to take awhile.
Maybe that'll help you a bit better then it does me.
|
All that in shorter:
Code:
Item.Color = (LinkBack - 1);
|
|
|
06/17/2009, 00:15
|
#9
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
anytime I add "Color" to any segment, it doesn't work. I tried that on a different portion of the code. But I will give that a try when I take time to sit and work again, fo now, time to relax, been a long day.
|
|
|
06/17/2009, 04:42
|
#10
|
elite*gold: 0
Join Date: Jul 2008
Posts: 259
Received Thanks: 73
|
I'm just gonna do this NPC later unless it gets released xD
|
|
|
06/17/2009, 06:35
|
#11
|
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
|
It's actually **** easy, and can be done in a small amount of code. Think about using LinkBack + Mathematics, it could be done with one small line.
|
|
|
06/17/2009, 08:21
|
#12
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
Quote:
Originally Posted by Zeroxelli
It's actually **** easy, and can be done in a small amount of code. Think about using LinkBack + Mathematics, it could be done with one small line. 
|
It's all about **** string operations with these people today, it seems to be the new hype.
|
|
|
06/17/2009, 08:33
|
#13
|
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
|
Hey, I wish I had the time and patience to learn these languages like you guys. Unfortunatly, I don't always get much free time. And when I do, I'm ussually exhausted, and my brain doesn't want to function. To be honest, the only reason I even attempt to do anything is merely cause friends want to play a server where they don't have to worry about drama. Otherwise, I probably wouldn't bother trying to do this, and would just find something else to do with my spare time.
On a side note though. If you guys know where I can find some good tutorials, ones that won't keep me struggling to understand. Feel free to share.
|
|
|
06/17/2009, 08:42
|
#14
|
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
|
It's math bro, I'm sure you know math.
Just use the ol' thinker =P
|
|
|
All times are GMT +1. The time now is 19:00.
|
|