[RELEASE]Conquer Emulator Source 5165

07/30/2010 17:04 _DreadNought_#16
NPCDialog.cs cleaned abit and made the NPC's run faster,
Replace all your npcdialog.cs with this (Made warehouses work, and a few other npcs, added leave jail )
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using COEmulator.Game;

namespace COEmulator.PacketHandling
{
    public class NPCDialog
    {
        static string ReadString(byte[] Data)
        {
            string Name = "";
            for (int i = 14; i < 14 + Data[13]; i++)
                Name += Convert.ToChar(Data[i]);
            return Name;
        }
        static void Say(string Text, Main.GameClient GC)
        {
            GC.AddSend(Packets.NPCSay(Text));
        }
        static void Link(string Text, byte DialNR, Main.GameClient GC)
        {
            GC.AddSend(Packets.NPCLink(Text, DialNR));
        }
        static void End(ushort Face, Main.GameClient GC)
        {
            GC.AddSend(Packets.NPCSetFace(Face));
            GC.AddSend(Packets.NPCFinish());
        }
        static void Teleport(ushort Map, ushort X, ushort Y, Main.GameClient GC)
        {
            GC.MyChar.Teleport(Map, X, Y);
        }
        public static void Handle(Main.GameClient GC, byte[] Data, uint NPC, byte Control)
        {
            Random Rnd = new Random();
            try
            {
                if (Game.World.H_NPCs.Contains(NPC) || (NPC >= 6700 && NPC <= 6702) || (NPC == 12))
                    if (Control != 255)
                    {
                        Game.NPC N = (Game.NPC)Game.World.H_NPCs[NPC];
                        switch (NPC)
                        {
                            #region Leave TG
                            case 453001://Leave TG
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to leave?", GC);
                                                Link("Yes.", 1, GC);
                                                Link("Yes.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Game.Vector2 V = (Game.Vector2)Database.DefaultCoords[GC.MyChar.Loc.PreviousMap];
                                                Teleport(GC.MyChar.Loc.PreviousMap, V.X, V.Y, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region LeaveJail
                            case 42:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to leave here?", GC);
                                                Link("Yeah.", 1, GC);
                                                Link("Just passing by.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                if (GC.MyChar.PKPoints <= 100)
                                                {
                                                    Teleport(1002, 400, 400, GC);
                                                }
                                                else
                                                {
                                                    Say("You must wait untill your PKPoints are below 100. Current PKPoints: " + GC.MyChar.PKPoints + ".", GC);
                                                    Link("Okay.", 255, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region LeaveGW
                            case 453002://Leave GW
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to go back to TwinCity?", GC);
                                                Link("Yes please.", 1, GC);
                                                Link("I'll stay.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Teleport(1002, 355, 337, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter Jail
                            case 43:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("What can I do for you?", GC);
                                                Link("Visit the jail.", 1, GC);
                                                Link("Just passing by.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Say("Give me 1000 silver, I will teleport you there. If your PK points are 100+, you will be put into the jail.", GC);
                                                Link("I will pay", 2, GC);
                                                Link("I will stay here.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 2:
                                            {
                                                if (GC.MyChar.Silvers >= 1000)
                                                {
                                                    GC.MyChar.Silvers -= 1000;
                                                    Teleport(6000, 100, 100, GC);
                                                }
                                                else
                                                {
                                                    Say("You do not have 1000 silvers.", GC);
                                                    Link("Ok.", 255, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter Arena
                            case 10021:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to enter the PKArena for an amount of 50 silvers?", GC);
                                                Link("Hell Yea.", 1, GC);
                                                Link("No Thanks.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                if (GC.MyChar.Silvers >= 50)
                                                {
                                                    GC.MyChar.Silvers -= 50;
                                                    Teleport(1005, 51, 71, GC);
                                                }
                                                else
                                                {
                                                    Say("You do not have enough silvers.", GC);
                                                    Link("I'll be back.", 255, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter GW
                            case 380://Enter GW
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to enter the GuildWar?", GC);
                                                Link("Yeah.", 1, GC);
                                                Link("Not really.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Teleport(1038, 350, 350, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter TwinCity Mine
                            case 453006:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to visit the mine?", GC);
                                                Link("Yeah.", 1, GC);
                                                Link("No.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Random EMine = new Random();
                                                int Nr = EMine.Next(1, 4);
                                                if (Nr == 1)
                                                {
                                                    Say("Answer the correct question to enter.", GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Pick Me.", 3, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                if (Nr == 2)
                                                {
                                                    Say("Answer the correct question to enter.", GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Pick me.", 3, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                if (Nr == 3)
                                                {
                                                    Say("Answer the correct question to enter.", GC);
                                                    Link("Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 3, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                if (Nr == 4)
                                                {
                                                    Say("Answer the correct question to enter.", GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    Link("Pick Me.", 3, GC);
                                                    Link("Don't Pick Me.", 2, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                break;
                                            }
                                        case 2:
                                            {
                                                Say("You didn't pick the right one. Wonna try again?", GC);
                                                Link("Yeah.", 1, GC);
                                                Link("Nah.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 3:
                                            {
                                                Teleport(1028, 155, 95, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Clear INV
                            case 453007:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("I can clear your inventory for free.", GC);
                                                Link("Clear it.", 1, GC);
                                                Link("No thanks.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                foreach (Game.Item I in GC.MyChar.Inventory)
                                                    GC.AddSend(Packets.ItemPacket(I.UID, 0, 3));
                                                GC.MyChar.Inventory = new ArrayList(40);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter DesertCity
                            case 453008:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Want to enter Desert Island?", GC);
                                                Link("Yes.", 1, GC);
                                                Link("Not really.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Teleport(1000, 973, 668, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region WeaponSockets
                            case 453009:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("Do you want to make sockets in your weapon for free?", GC);
                                                Link("Yea.", 1, GC);
                                                Link("No.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                Game.Item I = GC.MyChar.Equips.RightHand;
                                                if (I.ID != 0)
                                                {
                                                    if (I.Soc1 == COEmulator.Game.Item.Gem.NoSocket)
                                                    {
                                                        GC.MyChar.EquipStats(4, false);
                                                        I.Soc1 = COEmulator.Game.Item.Gem.EmptySocket;
                                                        GC.MyChar.Equips.Replace(4, I, GC.MyChar);
                                                        GC.MyChar.EquipStats(4, true);
                                                        Say("Here you are.", GC);
                                                        Link("Thanks.", 255, GC);
                                                        End(N.Avatar, GC);
                                                    }
                                                    else if (I.Soc2 == COEmulator.Game.Item.Gem.NoSocket)
                                                    {
                                                        GC.MyChar.EquipStats(4, false);
                                                        I.Soc2 = COEmulator.Game.Item.Gem.EmptySocket;
                                                        GC.MyChar.Equips.Replace(4, I, GC.MyChar);
                                                        GC.MyChar.EquipStats(4, true);
                                                        Say("Here you are.", GC);
                                                        Link("Thanks.", 255, GC);
                                                        End(N.Avatar, GC);
                                                    }
                                                    else
                                                    {
                                                        Say("Socketing failed.", GC);
                                                        Link("I see.", 255, GC);
                                                        End(N.Avatar, GC);
                                                    }
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Enter TG
                            case 453010:
                            case 453011:
                            case 453012:
                            case 453013:
                            case 453014:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("I can send you into TG for 1000 silvers.", GC);
                                                Link("Send me in.", 1, GC);
                                                Link("Dont need.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                if (GC.MyChar.Silvers >= 1000)
                                                {
                                                    GC.MyChar.Silvers -= 1000;
                                                    Teleport(1039, 300, 300, GC);
                                                    Say("Welcome to the training ground's.", GC);
                                                    Link("Thanks.", 255, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                else
                                                {
                                                    Say("You do not have enough silvers.", GC);
                                                    Link("I'll be back.", 255, GC);
                                                    End(N.Avatar, GC);
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }

                            #endregion

                            #region WuxenOven
                            case 453016:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("What do you want?", GC);
                                                Link("Compose.", 1, GC);
                                                Link("Enchant.", 2, GC);
                                                Link("Bless.", 3, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 1, N.Loc.X, N.Loc.Y, 0x7e));
                                                break;
                                            }
                                        case 2:
                                            {
                                                GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 0x443, GC.MyChar.Loc.X, GC.MyChar.Loc.Y, 116));
                                                break;
                                            }
                                        case 3:
                                            {
                                                Say("It will cost you 10 TortoiseGem's each Bless you want to add in your equipments.", GC);
                                                Say("The machine still needs to be done with repair, before I can start doing this again.", GC);
                                                Link("Okay", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            #region Warehouses
                            case 8:
                            case 10012:
                            case 10028:
                            case 10011:
                            case 10027:
                            case 44:
                            case 4101:
                                {
                                    GC.LocalMessage(2000, "You have successfull opened your warehouse.");
                                    GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID, 4, N.Loc.X, N.Loc.Y, 0x7e));
                                    break;
                                }
                            #endregion

                            #region CPAdmin
                            case 453024:
                                {
                                    switch (Control)
                                    {
                                        case 0:
                                            {
                                                Say("I can exchange DB's to CPs", GC);
                                                Link("Take my DragonBall.", 1, GC);
                                                Link("Take my DragonBall Scroll", 2, GC);
                                                Link("Just passing by.", 255, GC);
                                                End(N.Avatar, GC);
                                                break;
                                            }
                                        case 1:
                                            {
                                                if (GC.MyChar.InventoryContains(1088000, 1))
                                                {
                                                   Game.Item DB = null;
                                                   foreach (Game.Item I in GC.MyChar.Inventory)
                                                       if (I.ID == 1088000)
                                                       {DB = I; break;}
                                                    if (DB != null)
                                                    {
                                                        GC.MyChar.CPs += 215;
                                                        GC.MyChar.RemoveItem(DB);
                                                    }
                                                }
                                                break;
                                            }
                                        case 2:
                                            {
                                                if (GC.MyChar.InventoryContains(720028, 1))
                                                {
                                                   Game.Item DB = null;
                                                   foreach (Game.Item I in GC.MyChar.Inventory)
                                                       if (I.ID == 720028)
                                                       {DB = I; break;}
                                                    if (DB != null)
                                                    {
                                                        GC.MyChar.CPs += 2150;
                                                        GC.MyChar.RemoveItem(DB);
                                                    }
                                                }
                                                break;
                                            }
                                    }
                                    break;
                                }
                            #endregion

                            default:
                                {
                                    if (GC.MyChar.MyClient.AuthInfo.Status == "[PM]" || GC.MyChar.MyClient.AuthInfo.Status == "[GM]")
                                    {
                                        GC.LocalMessage(2000, "This NPC is not used. NPCID: " + NPC.ToString());
                                    }
                                    else
                                    {
                                        Say("Hello, I have no function for now.", GC);
                                        Link("OK.", 255, GC);
                                        if (N != null)
                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        else
                                            GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    break;
                                }
                        }
                    }
            }
            catch (Exception Exc) { Console.WriteLine(Exc); }
        }
    }
}
Removed CheckWarehouse Password because I will code a decent one later on.
07/30/2010 21:19 Basser#17
Quote:
Originally Posted by grillmad View Post
@smythe
Cuz I always ends up gets flamed ;)
And last time I actually did it.
Also with the unbco source, i did release it :)
Perhaps you released it, but I am certain it wasn't as good as you had written, or at least it wasn't as good as people expected.
Also, you do never get flamed without deserving to get flamed, I used to get flamed a lot, but not any more, and hell yes, I changed my attitude.
07/30/2010 23:02 Fish*#18
Quote:
Originally Posted by Basser View Post
Perhaps you released it, but I am certain it wasn't as good as you had written, or at least it wasn't as good as people expected.
Also, you do never get flamed without deserving to get flamed, I used to get flamed a lot, but not any more, and hell yes, I changed my attitude.
Well it was better, then the rest lotf source that been released ;)
08/01/2010 10:58 _DreadNought_#19
Well grillmad I knew it, Your know with a 5018 Project, hope that lasts 1 week at least. Never put faith in grillmad that hes gonna make a decent source. E*Pvp full of noobs/leechers.
08/01/2010 11:00 Arcо#20
Quote:
Originally Posted by Eliminationn View Post
E*Pvp full of noobs/leechers.
Irony at its finest.
08/01/2010 20:04 Fish*#21
Quote:
Originally Posted by Eliminationn View Post
Well grillmad I knew it, Your know with a 5018 Project, hope that lasts 1 week at least. Never put faith in grillmad that hes gonna make a decent source. E*Pvp full of noobs/leechers.
lol. Im still working on this.
Is it illegal to work on more then 1 project?

btw. I haven't leeched anything :)
08/16/2010 11:38 _DreadNought_#22
Still working on this then? I will make that 2 weeks.
08/16/2010 11:39 Fish*#23
I cant i lost all things on my pc lmao.
c#, c++, sources, clients, games.
I fucked my windows FTW.
lol, I got owned.
When I get all things again, I might do :)
08/31/2010 15:11 µ~Xero~µ#24
This project wont die. I join in.
09/01/2010 08:29 dowhatuwant#25
It is dead long time ago :P
I lost all sources etc.
for about 2 weeks ago, cuz my pc crashed.
I even lost the one from my server, but I had an old backup =]
lol

Im trying to do a new :D
So far removed some things to recode lol
09/01/2010 13:27 µ~Xero~µ#26
ight
09/01/2010 13:53 _DreadNought_#27
Ive got a copy of this source, I messed it up abit lol but I fixed few things n stuff

Fixed stamina bug, Re did the threading system (Thanks impulse's source)
09/01/2010 17:16 dowhatuwant#28
Dosnt matter now, cuz Im longer with the new.
Thanks anyway
09/25/2010 20:08 bowman5#29
thx so much
11/22/2010 19:29 MichaelJackso#30
Thx For /ban & /jail command :D