[Only registered and activated users can see links. Click Here To Register...]Quote:
i know this is an old post but can anyone re-upload as meagupload links dont work anymore ?
[Only registered and activated users can see links. Click Here To Register...]Quote:
i know this is an old post but can anyone re-upload as meagupload links dont work anymore ?
The source is targeted a 5017 and setting it up is easy you just open Program.cs and scroll down a little bit and you will see a IP there change it to yours build then debug and your good to goQuote:
Hi,
Today, this source it is still good to learn?
by what I learned C#, and I want to know if I can use to create my server.
and also, someone could guide,i do not know how to connect the database at the source
and what client take??
Thank a lot all, and sorry for my bad english.
Not the most informative for a newbie.Quote:
The source is targeted a 5017 and setting it up is easy you just open Program.cs and scroll down a little bit and you will see a IP there change it to yours build then debug and your good to go
Use ConquerLoader if your not already [Only registered and activated users can see links. Click Here To Register...]Quote:
Hi,
Thank you both.
Hi,Quote:
Here we go.
Portals Implementation.
1) Create a new Class file in the folder Interfaces called "IPortals.cs"
2) Replace all the code in newly created file IPortals.cs with the code below.
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConquerServer_Basic { public interface IPortal { ushort CurrentMapID { get; set; } ushort CurrentX { get; set; } ushort CurrentY { get; set; } ushort DestinationMapID { get; set; } ushort DestinationX { get; set; } ushort DestinationY { get; set; } } public class Portal : IPortal { private ushort _CurrentMapID; private ushort _CurrentX; private ushort _CurrentY; private ushort _DestinationMapID; private ushort _DestinationX; private ushort _DestinationY; public Portal() { } public Portal(ushort CurrentMapID, ushort CurrentX, ushort CurrentY, ushort DestinationMapID, ushort DestinationX, ushort DestinationY) { _CurrentMapID = CurrentMapID; _CurrentX = CurrentX; _CurrentY = CurrentY; _DestinationMapID = DestinationMapID; _DestinationX = DestinationX; _DestinationY = DestinationY; } public ushort CurrentMapID { get { return _CurrentMapID; } set { _CurrentMapID = value; } } public ushort CurrentX { get { return _CurrentX; } set { _CurrentX = value; } } public ushort CurrentY { get { return _CurrentY; } set { _CurrentY = value; } } public ushort DestinationMapID { get { return _DestinationMapID; } set { _DestinationMapID = value; } } public ushort DestinationX { get { return _DestinationX; } set { _DestinationX = value; } } public ushort DestinationY { get { return _DestinationY; } set { _DestinationY = value; } } } }
3) In Database/Database.cs add the following code.
4) In Server Base Code/Kernel.cs add a new Dictionary to the Kernel class.Code:public static void LoadPortals() { string[] Portals = File.ReadAllLines(DatabasePath + @"\Misc\Portals.ini"); for (int i = 0; i < Portals.Length; i++) { string[] Portal = Portals[i].Split(' '); IPortal portal = new Portal(); portal.CurrentX = Convert.ToUInt16(Portal[0]); portal.CurrentY = Convert.ToUInt16(Portal[1]); portal.CurrentMapID = Convert.ToUInt16(Portal[2]); portal.DestinationX = Convert.ToUInt16(Portal[3]); portal.DestinationY = Convert.ToUInt16(Portal[4]); portal.DestinationMapID = Convert.ToUInt16(Portal[5]); if (!Kernel.Portals.ContainsKey(portal.CurrentX.ToString() + portal.CurrentY.ToString() + portal.CurrentMapID.ToString())) Kernel.Portals.Add(portal.CurrentX.ToString() + portal.CurrentY.ToString() + portal.CurrentMapID.ToString(), portal); else Console.WriteLine(portal.CurrentX.ToString() + " " + portal.CurrentY.ToString() + " " + portal.CurrentMapID.ToString()); } Console.WriteLine("Portals Loaded"); }
5) In Program.cs, in the class Main() under Database.LoadDatabase(); add.Code:public static Dictionary<string, IPortal> Portals = new Dictionary<string, IPortal>();
6) In Networking/Packets/Data Packet.cs add a new const ushort.Code:Database.LoadPortals();
7) In Networking/PacketProcessor.cs in the void Process, under the case 1010 add.Code:Portal = 85,
8) In Networking/PacketProcessor.cs add the following code to the PacketProcessor class.Code:case DataPacket.Portal: Portal(Client, cPacket); break;
9) Finally you'll need the portal database. Download the Portals.rar that I've included and place it into Database/MiscCode:public static void Portal(GameClient Client, DataPacket Packet) { ushort portal_X = (ushort)(Packet.dwParam & 0xFFFF); ushort portal_Y = (ushort)(Packet.dwParam >> 16); string portal_ID = portal_X.ToString() + portal_Y.ToString() + Client.Entity.MapID.ToString(); if (Kernel.Portals.ContainsKey(portal_ID)) { Console.WriteLine("Portal {0}, {1}, {2}", portal_X, portal_Y, Client.Entity.MapID); if (Kernel.GetDistance(portal_X, portal_Y, Client.Entity.X, Client.Entity.Y) <= 1) { Packet.ID = DataPacket.SetLocation; Packet.UID = Client.Entity.UID; Packet.dwParam = Kernel.Portals[portal_ID].DestinationMapID; Packet.wParam1 = Kernel.Portals[portal_ID].DestinationX; Packet.wParam2 = Kernel.Portals[portal_ID].DestinationY; Client.Entity.MapID = Kernel.Portals[portal_ID].DestinationMapID; Client.Entity.X = Kernel.Portals[portal_ID].DestinationX; Client.Entity.Y = Kernel.Portals[portal_ID].DestinationY; Client.Send(Packet); Client.Screen.Reload(true, delegate(IBaseEntity Sender, IBaseEntity Caller) { if (Caller.EntityFlag == EntityFlag.Player && Sender.EntityFlag == EntityFlag.Player) { GameClient __Client = Caller.Owner as GameClient; __Client.Send(Client.Entity.SpawnPacket); } return 0; } ); } else Client.Socket.Disconnect(); // INVALID_PORTAL (No Such Portal) } else { Console.WriteLine("Invailed Portal {0}, {1}, {2}", portal_X, portal_Y, Client.Entity.MapID); Client.Socket.Disconnect(); // INVALID_PORTAL (No Such Portal) } }
Tu considères pas que les erreurs sont assez explicites ?Quote:
Help please...
two errors after added code portal :(
1. The namespace «ConquerServer_Basic» already contains a definition for «Portal».
2. The name «cPacket» doesn't exist in the current context.