[RELEASE]Conquer Emulator Source 5165

07/29/2010 07:40 Fish*#1
Latest Version: v1.0.0
Last Updated: 07:37AM 29/07 2010


NPC Scripting:
Right now the NPC Scripting is the same as others.
There is a folder in the source called "NPC".
It will be for the NPC Dialogs soon. Im still working on it.

Download: (v1.0.0)
[Only registered and activated users can see links. Click Here To Register...]

Version 1.0.0:
The first version is very very basic and dosn't contains alot of things.
The things will come with time :)
All NPC's deleted and some made again :)
Goodluck

Features so far:
PHP Code:
-BanSystem (/ban charname)
-
No SpawnKill
-Unique PK/Jail System
-Other NPCScripting (Working on)
-
Load All DMaps
-More will come
-Version 5165 
I will work on this everyday, so please don't start flame already ;)

Setup:
Just extract source folder to any places on your pc.
Extract OldCODB in C:\
07/29/2010 08:54 smartsou#2
Thanks
07/29/2010 10:03 Sp!!ke#3
good work grill
07/29/2010 10:27 kaka12#4
Good luck
07/29/2010 12:48 .Beatz#5
Unless you are going to rewrite the source (the socket system) and others than this will just be another "fail" source. Only reason I say this is because everything that I can tell you have done (Delete the NPCs) can be done by anyone and replaced with all the NPCs on epvpers. I am guessing you are gonna copy and paste everything you can from epvpers :S


I would definatly suggest rewriting the socket system as this sucks!
Also if you could clean up the messy code this would help make this release alot better than any out there already.

This is not a flame just my thoughts and some helpful comments :)
07/29/2010 13:07 ~Yuki~#6
sockets are fine. Since i doubt you will get 150+ ppl online.
07/29/2010 13:12 Basser#7
I've known you for a while, probably as of you joined this forum, I've read a lot of your 'promises', and you never actually do what you're trying.
Sorry to be this so rude, but I really believe this will never really reach anything to be proud of, and I also believe this won't be a stable (or increasing the current stability) release.
07/29/2010 15:38 chickmagnet#8
isnt this still lotf?
07/29/2010 15:42 Escapex#9
awesome (: but you might want to release the /ban & /jail command =D! i been trying to find that <.<
07/29/2010 16:12 Fish*#10
@smythe
Cuz I always ends up gets flamed ;)
And last time I actually did it.
Also with the unbco source, i did release it :)


Ban: (I dont take credits for it)
Go to GameWorker.cs
Search for:
Code:
GC.Soc = StO.Sock;
Under that put:
Code:
                                if (GC.AuthInfo.LogonType == 3)
                                {
                                    GC.AddSend(Packets.SystemMessage(GC.MessageID, "MOTHERFUCKER YOU ARE BANNED, HAHAHAHAHA!!!!"));//You can edit the text to what u want
                                }
Now in Database.cs put:
Code:
        public static void AddBan(string Name)
        {
            if (!File.Exists(@"C:\OldCODB\banname.txt"))
            {
                File.AppendAllText(@"C:\OldCODB\banname.txt", Name + "\r\n");
            }
            else
            {
                if (!CheckBan(Name))
                {
                    File.AppendAllText(@"C:\OldCODB\banname.txt", Name + "\r\n");
                }
            }
        }
        public static bool CheckBan(string Name)
        {
            if (File.Exists(@"C:\OldCODB\banname.txt"))
            {
                string[] Lines = File.ReadAllLines(@"C:\OldCODB\banname.txt");
                foreach (string line in Lines)
                {
                    if (line.Contains(Name))
                        return true;
                }
            }
            return false;
        }
Now search for:
Code:
public static Main.AuthWorker.AuthInfo Authenticate(string User, string Password)
Replace the whole code with:
Code:
        public static Main.AuthWorker.AuthInfo Authenticate(string User, string Password)
        {
            Main.AuthWorker.AuthInfo Info = new COEmulator.Main.AuthWorker.AuthInfo();
            Info.Account = User;

            try
            {
                while (File.Exists(@"C:\OldCODB\Users\" + User + ".usr"))
                {
                    FileStream FS = new FileStream(@"C:\OldCODB\Users\" + User + ".usr", FileMode.Open);
                    BinaryReader BR = new BinaryReader(FS);
                    string RealPassword = Main.PassCrypto.EncryptPassword(Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte())));
                    string[] FileCaseSensitive = Directory.GetFiles(@"C:\OldCODB\Users\", User + ".usr");
                    string RealAccount = Path.GetFileNameWithoutExtension(FileCaseSensitive[0]);
                    if (RealPassword == Password && RealAccount == User)
                    {
                        Info.Status = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
                        Info.Character = "";
                        if (BR.BaseStream.Position != BR.BaseStream.Length)
                        {
                            byte len = BR.ReadByte();
                            Info.Character = Encoding.ASCII.GetString(BR.ReadBytes(len));
                        }

                        if (Info.Character == "")
                            Info.LogonType = 2;
                        else
                            Info.LogonType = 1;
                        if (CheckBan(RealAccount))
                            Info.LogonType = 3;
                    }
                    else
                        Info.LogonType = 255;
                    BR.Close();
                    FS.Close();

                    return Info;
                }
                Info.LogonType = 255;
            }
            catch (Exception Exc) { Console.WriteLine(Exc); }
            return Info;
        }
In Chat.cs find:
Code:

under it put:
Code:
                            if (Cmd[0] == "/ban" && GC.MyChar.MyClient.AuthInfo.Status == "[PM]" || Cmd[0] == "/ban" && GC.MyChar.MyClient.AuthInfo.Status == "[GM]")
                            {
                                foreach (Character C in World.H_Chars.Values)
                                {
                                    if (Cmd[1] == C.Name)
                                    {
                                            C.MyClient.Soc.Disconnect(false);
                                            Database.AddBan(C.MyClient.AuthInfo.Account);
                                            C.MyClient.Disconnect();
                                            Game.World.SendMsgToAll(GC.MyChar.Name, C.Name + " have been banned by " + GC.MyChar.Name, 2011, 0);//Fixed
                                    }
                                }
                            }
Now create a textfile in OldCODB named banname.txt
Done :)
07/29/2010 17:42 _DreadNought_#11
another copy & Paste source, great. Might release I source that I switched the sockets to hybrids. (Thanks hybrid!)
07/29/2010 18:14 Escapex#12
copy paste? did u even see this yet? in the top spoiler

This is a small project in NewestCOServer.
Why this?
To make a better NewestCOServer source.
Ive deleted alot things so far and started building things up.
I will work on this time after time, untill it will be good
Hope you find this useful
07/29/2010 22:40 _DreadNought_#13
Okay, I'm in DEV with this and will release my updates (and eventually the whole source) I will be cleaning it, socket system will be swapped to hybrids.

What I have done so far, Chat.cs commanding alot simpler:
Replace the whole chat.cs with this (NOTE: I cleaned it.)
Code:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;
using COEmulator.Game;

namespace COEmulator.PacketHandling
{
    public class Chat
    {
        public static void Handle(Main.GameClient GC, byte[] Data)
        {
            MemoryStream MS = new MemoryStream(Data);
            BinaryReader BR = new BinaryReader(MS);
            BR.ReadBytes(8);
            ushort ChatType = (ushort)BR.ReadUInt32();
            BR.ReadBytes(13);
            string From = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
            string To = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
            BR.ReadByte();
            string Message = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
            BR.Close();
            MS.Close();
            #region BadWords
            Message = Message.Replace("nigga", "*****");
            Message = Message.Replace("paki", "****");
            #endregion
            if (ChatType == 2104 && GC.MyChar.MyShop != null)
                GC.MyChar.MyShop.Hawk = Message;
            try
            {
                if (Message.StartsWith("@"))
                {
                    string[] Input = Message.Split(' ');
                    {
                        #region GM/PM
                        if (GC.GM)
                        {
                            switch (Input[0])
                            {
                                #region Scroll commands
                                case "scroll":
                                    {
                                        switch (Input[1])
                                        {
                                            case "tc":
                                                GC.MyChar.Teleport(1002, 429, 378);
                                                break;
                                            case "dc":
                                                GC.MyChar.Teleport(1000, 499, 650);
                                                break;
                                            case "pc":
                                                GC.MyChar.Teleport(1011, 232, 260);
                                                break;
                                            case "bi":
                                                GC.MyChar.Teleport(1015, 717, 576);
                                                break;
                                            case "am":
                                                GC.MyChar.Teleport(1015, 717, 576);
                                                break;
                                        }
                                        break;
                                    }
                                #endregion

                                case "@life":
                                    {
                                        GC.MyChar.CurHP = GC.MyChar.MaxHP;
                                        GC.MyChar.CurMP = GC.MyChar.CurMP;
                                        break;
                                    }
                                case "@cps":
                                    {
                                        GC.MyChar.CPs = 999999999;
                                        break;
                                    }
                                case "@silvers":
                                    {
                                        GC.MyChar.Silvers = 999999999;
                                        break;
                                    }
                                case "@level":
                                    {
                                        byte level = GC.MyChar.Level;
                                        byte.TryParse(Input[1], out level);
                                        level = Math.Min((byte)137, Math.Max((byte)1, level));
                                        GC.MyChar.Level = level;
                                        break;
                                    }
                                case "@playercount":
                                    {
                                        GC.LocalMessage(2000, "Players Online: " + Game.World.H_Chars.Count);
                                        break;
                                    }
                                case "@c":
                                    {
                                        Game.World.SendMsgToAll(GC.MyChar.Name, Message.Substring(Input[1].Length + 1), 2011, GC.MyChar.Mesh);
                                        break;
                                    }
                                case "@dc":
                                    {
                                        GC.Disconnect();
                                        break;
                                    }
                            }
                        }
                        else //LEAVE THIS
                        #endregion
                        #region Players
                        {
                            switch (Input[0])
                            {
                                case "@dc":
                                    {
                                        GC.Disconnect();
                                        break;
                                    }
                                case "@playercount":
                                    {
                                        GC.LocalMessage(2000, "Players Online: " + Game.World.H_Chars.Count);
                                        break;
                                    }
                            }
                        }
                        #endregion
                    }
                }
            }
            catch { }
        }
    }
}
will only be working on this tonight untill I lose motivation.

#Updated that ^^^ #Fixed it
07/30/2010 00:33 Arcо#14
All it looks to me is you changed some variable names and use some switches and put a few if/else checks.
Doesn't look too great.
07/30/2010 02:34 Fish*#15
I said only beggining.
Currently working on recreating database.