|
You last visited: Today at 18:33
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/10/2010, 00:02
|
#241
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
Once you've updated the game server's cryptographer, and updated the packet structures, it will be easy to finish.
Monsters are easy since there's enough servers with examples, skills and that kinda stuff is a piece of **** if you ask me.
|
|
|
05/10/2010, 20:55
|
#242
|
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
|
Ok so I got NPC's implanted just wondering if this would work no errors so.... I am hoping this would work
Code:
#region Welcome NPC
case 10010:
{
switch(PageNumber)
{
case 0:
Text("Hi and welcome to the server, having fun?");
Link("Yes", 1);
break;
case 1:
Face(30);
Text("Thats glad to know ...");
Link("Cya", 255);
break;
}
Face(30);
Complete();
break;
}
#endregion
any help ???
also I said no errors
Quote:
|
Originally Posted by Ultimatum
Figured the npc system needed a little tlc.
Right i made this as the 'ProcessNPC.cs'
UPDATED
Code:
public class NPCStructure
{
public NpcReplyPacket NPC = new NpcReplyPacket();
public GameClient Client;
public void Text(string Text)
{
NPC.Reset();
NPC.Text = Text;
NPC.InteractType = (byte)[COLOR="Red"][B]NPCType[/B][/COLOR].Dialog;
Send();
}
public void Link(string Text, byte Number)
{
NPC.Reset();
NPC.Text = Text;
NPC.OptionID = Number;
NPC.InteractType = (byte)[COLOR="Red"][B]NPCType[/B][/COLOR].Option;
Send();
}
public void Input(byte Number, ushort MaxLength)
{
NPC.Reset();
NPC.OptionID = Number;
NPC.InteractType = (byte)[COLOR="Red"][B]NPCType[/B][/COLOR].Input;
Send();
}
public void Face(byte Number)
{
NPC.Reset();
NPC.wParam = Number;
NPC.InteractType = (byte)[COLOR="Red"][B]NPCType[/B][/COLOR].Avatar;
Send();
}
public void Complete()
{
NPC.Reset();
NPC.InteractType = (byte)[COLOR="Red"][B]NPCType[/B][/COLOR].Finish;
NPC.OptionID = 255;
NPC.DontDisplay = true;
Send();
}
public void Send()
{
Client.Send(NPC.Serialize());
}
}
Uses the Interaction Packet found in the source
Code:
public class NPCDialog : NPCStructure
{
public uint PageNumber;
public uint NPCID;
public string InputBoxString;
public NPCDialog(GameClient m_Client, uint m_UID, uint m_Number, string Input)
{
NPCID = m_UID;
InputBoxString = Input;
PageNumber = m_Number;
Client = m_Client;
ManageChat();
}
void ManageChat()
{
if (NPCID == 0)
NPCID = Client.ActiveNpcID;
switch (NPCID)
{
case 10010:
{
if (PageNumber == 0)
{
Face(30);
Text("Hi and welcome to the server, having fun?");
Link("Yes", 1);
Complete();
}
else if (PageNumber == 1)
{
Face(30);
Text("Thats glad to know ...");
Link("Cya", 255);
Complete();
}
break;
}
default:
{
Face(30);
Text("Hi am not implemented yet");
Link("Ok", 255);
Complete();
break;
}
}
}
}
Added npc 10010 just so you know how to work with npc pages.
Now as for the packethandler, i know this source as a npc dialog in so.
Code:
public static void [B][COLOR="Red"]HandleNPCRequest[/COLOR][/B](GameClient Client, [COLOR="Red"][B]NPCRequestPacket[/B][/COLOR] Packet)
{
NPCDialog[COLOR="Red"] Dialog[/COLOR] = new NPCDialog(Client, Packet.NpcID, Packet.OptionID, Packet.Input);
}
|
The code in RED are the errors
Errors are as follow:
Here's a picture becuase I am lazy to type all the errors out:
if you cannot see the picture
|
|
|
05/18/2010, 09:32
|
#243
|
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
|
Anyone still working on this?
|
|
|
05/18/2010, 09:46
|
#244
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
I am on a side project.
|
|
|
05/18/2010, 10:50
|
#245
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
And you have the database loaded right?
|
|
|
05/18/2010, 11:36
|
#246
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
|
#Requested ban for .Arco
Reason:
Quote:
oh and for double post hhhhhhhh
(kidding)
|
|
|
05/19/2010, 02:05
|
#247
|
elite*gold: 0
Join Date: Jul 2005
Posts: 111
Received Thanks: 5
|
I'm still working on it  . It's the best server to build off by far. Updated it from 5017-5257. A test server should be out soon
|
|
|
05/19/2010, 02:28
|
#248
|
elite*gold: 0
Join Date: Apr 2010
Posts: 116
Received Thanks: 12
|
Quote:
Originally Posted by ranny2
I'm still working on it  . It's the best server to build off by far. Updated it from 5017-5257. A test server should be out soon
|
Woah ranny that's pretty cool hope it all goes well
I started using this source today ha ^^ but i ain't good enough to up it to 5257
|
|
|
05/19/2010, 03:55
|
#249
|
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
|
Quote:
Originally Posted by ranny2
I'm still working on it  . It's the best server to build off by far. Updated it from 5017-5257. A test server should be out soon
|
Nice, would love to test it.
PM me if you need a tester.
|
|
|
05/19/2010, 18:19
|
#250
|
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
|
Quote:
Originally Posted by ranny2
I'm still working on it  . It's the best server to build off by far. Updated it from 5017-5257. A test server should be out soon
|
i wouldn't mind testing it aswell,
|
|
|
08/15/2010, 21:52
|
#251
|
elite*gold: 0
Join Date: Jan 2010
Posts: 54
Received Thanks: 11
|
Rev3: Freeze can't login.
|
|
|
08/15/2010, 22:00
|
#252
|
elite*gold: 0
Join Date: Jun 2009
Posts: 378
Received Thanks: 141
|
There is nothing wrong with Rev 3 , works fine. Did you change the ip in program.cs under auth receive?
|
|
|
08/16/2010, 11:30
|
#253
|
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
|
Quote:
Originally Posted by theloz
Rev3: Freeze can't login.
|
use nullable's loader v3
|
|
|
09/20/2010, 13:33
|
#254
|
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
|
Im working with it.
U got msn?
PM me it
|
|
|
10/24/2010, 20:31
|
#255
|
elite*gold: 0
Join Date: Jul 2005
Posts: 14
Received Thanks: 8
|
I have been working on this source for a few months and learn a lot from it  Just wanted to release something I made if anyone has a better way to make this just let me know  .
This is so when you equip and unequip Items the other player sees them
Frist in Entity.cs Search For
Code:
public string Name
{
get
{
return Encoding.ASCII.GetString(this.SpawnPacket, 82, 16).Trim(new char[] { (char)0x0000 });
}
set
{
if (value.Length > 15)
{
value = value.Substring(0, 15);
}
this.SpawnPacket[80] = 255;
this.SpawnPacket[81] = (byte)value.Length;
PacketBuilder.WriteString(value, this.SpawnPacket, 82);
}
}
Add this Under it
Code:
public uint HeadGear
{
get
{
return BitConverter.ToUInt32(this.SpawnPacket, 28);
}
set
{
PacketBuilder.WriteUInt32(value, this.SpawnPacket, 28);
}
}
public uint Armoer
{
get
{
return BitConverter.ToUInt32(this.SpawnPacket, 32);
}
set
{
PacketBuilder.WriteUInt32(value, this.SpawnPacket, 32);
}
}
public uint RightArm
{
get
{
return BitConverter.ToUInt32(this.SpawnPacket, 36);
}
set
{
PacketBuilder.WriteUInt32(value, this.SpawnPacket, 36);
}
}
public uint LeftArm
{
get
{
return BitConverter.ToUInt32(this.SpawnPacket, 40);
}
set
{
PacketBuilder.WriteUInt32(value, this.SpawnPacket, 40);
}
}
Than Search for EquipGear(GameClient Client, ItemUsagePacket Packet)
Replace with
Code:
public static void EquipGear(GameClient Client, ItemUsagePacket Packet)
{
IConquerItem EquipItem = Client.GetInventoryItem(Packet.UID);
if (EquipItem != null)
{
Client.RemoveInventory(EquipItem.UID);
ushort EquipSlot = (ushort)Packet.dwParam;
if (Client.Equipment.ContainsKey(EquipSlot))
{
if (!Client.Unequip(EquipSlot))
throw new Exception("PacketProcessor::EquipGear() -> Failed to call Client.Unequip()");
}
if (!Client.Equip(EquipItem, EquipSlot))
throw new Exception("PacketProcessor::EquipGear() -> Failed to call Client.Equip()");
if (EquipSlot == 9)
{
if (EquipItem.ID > 0)
{
Client.Entity.Armoer = EquipItem.ID;
}
}
if (EquipSlot == 0)
{
if (EquipItem.ID > 0)
{
Client.Entity.HeadGear = EquipItem.ID;
}
}
if (EquipSlot == 2)
{
if (Client.Entity.Armoer == 0)
{
Client.Entity.Armoer = EquipItem.ID;
}
}
if (EquipSlot == 4)
{
if (EquipItem.ID > 0)
{
Client.Entity.LeftArm = EquipItem.ID;
}
}
if (EquipSlot == 5)
{
if (EquipItem.ID > 0)
{
Client.Entity.RightArm = EquipItem.ID;
}
}
Client.CalculateStatBonus();
Client.CalculateHPBonus();
Client.CalculateDamageBoost();
Client.SendStatMessage();
Client.SendScreen(Client.Entity.SpawnPacket, true);
Client.Screen.Reload(true, null);
}
}
And Than Search for public static void UnequipGear(GameClient Client, ItemUsagePacket Packet)
and replace with
Code:
public static void UnequipGear(GameClient Client, ItemUsagePacket Packet)
{
ushort EquipSlot = (ushort)Packet.dwParam;
if (Client.Equipment.ContainsKey(EquipSlot))
{
if (!Client.Unequip(EquipSlot))
throw new Exception("PacketProcessor::UnequipGear() -> Failed to call Client.Unequip()");
if (EquipSlot == 9)
{
for (int ID = 1; ID < Client.Equipment.Count; ID++)
{
if (Client.Equipment.ContainsKey((ushort)ID))
{
if (Client.Equipment[(ushort)ID].ID >= 130203 && Client.Equipment[(ushort)ID].ID <= 139999)
{
Client.Entity.Armoer = Client.Equipment[(ushort)ID].ID;
}
}
}
}
if (EquipSlot == 3)
{
for (int ID = 1; ID < Client.Equipment.Count; ID++)
{
if (Client.Equipment.ContainsKey((ushort)ID))
{
if (Client.Equipment[(ushort)ID].ID <= 137300 && Client.Equipment[(ushort)ID].ID >= 137970)
{
Client.Entity.Armoer = Client.Equipment[(ushort)ID].ID;
}
}
}
}
if (EquipSlot == 5)
{
{
Client.Entity.RightArm = 0;
}
}
if (EquipSlot == 4)
{
{
Client.Entity.LeftArm = 0;
}
}
if (EquipSlot == 0)
{
{
Client.Entity.HeadGear = 0;
}
}
Client.SendScreen(Packet, true);
Client.CalculateStatBonus();
Client.CalculateHPBonus();
Client.CalculateDamageBoost();
Client.SendStatMessage();
Client.SendScreen(Client.Entity.SpawnPacket, true);
Client.Screen.Reload(true, null);
}
}
and also to Load and Save Equips in Database.cs Add
Code:
public static void LoadEquips(GameClient Client)
{
IniFile rdr = new IniFile(DatabasePath + @"\Equips\" + Client.Username + ".ini");
for (sbyte i = 0; i < 9; i++)
{
string[] Item = (rdr.ReadString("Equips", "Item[" + i.ToString() + "]", String.Empty)).Split(' ');
if (Item.Length < 2) continue;
ItemDataPacket LoadedItem = new ItemDataPacket(true);
LoadedItem.ID = uint.Parse(Item[0]);
LoadedItem.Plus = byte.Parse(Item[1]);
LoadedItem.Enchant = byte.Parse(Item[2]);
LoadedItem.Bless = byte.Parse(Item[3]);
LoadedItem.SocketOne = byte.Parse(Item[4]);
LoadedItem.SocketTwo = byte.Parse(Item[5]);
LoadedItem.UID = ItemDataPacket.NextItemUID;
Client.Equip(LoadedItem, (ushort)(i + 1));
if (i == 8)
{
if (LoadedItem.ID > 0)
{
Client.Entity.Armoer = LoadedItem.ID;
}
}
if (i == 0)
{
if (LoadedItem.ID > 0)
{
Client.Entity.HeadGear = LoadedItem.ID;
}
}
if (i == 0)
{
if (LoadedItem.ID > 0)
{
Client.Entity.HeadGear = LoadedItem.ID;
}
}
if (i == 3)
{
if (LoadedItem.ID > 0)
{
Client.Entity.LeftArm = LoadedItem.ID;
}
}
if (i == 4)
{
if (LoadedItem.ID > 0)
{
Client.Entity.RightArm = LoadedItem.ID;
}
}
}
}
public static void SaveEquips(GameClient Client)
{
IniFile wrtr = new IniFile(DatabasePath + @"\Equips\" + Client.Username + ".ini");
lock (Client.Equipment)
{
sbyte i = 0;
foreach (KeyValuePair<ushort, IConquerItem> DE in Client.Equipment)
{
wrtr.Write("Equips", "Item[" + (DE.Key - 1).ToString() + "]", DE.Value.ToString());
i++;
}
}
}
And in Save add
Code:
SaveEquips(Client);
Also add LoadCharcter
Code:
LoadEquips(Client);
|
|
|
 |
|
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 18:33.
|
|