Register for your free account! | Forgot your password?

You last visited: Today at 08:44

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] cq_actions for COEMU v2

Discussion on [Release] cq_actions for COEMU v2 within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old 05/29/2009, 15:50   #16
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Quote:
Originally Posted by $HaDoW View Post
works but it has bugs and still lots of ranslate and codeing is waiting !
Explain the bugs please.
nTL3fTy is offline  
Old 05/29/2009, 16:14   #17
 
$HaDoW's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 285
Received Thanks: 78
some npcs dont do what they have to do ! gives free stuff and so on !
$HaDoW is offline  
Old 05/29/2009, 22:40   #18
 
elite*gold: 0
Join Date: Mar 2009
Posts: 56
Received Thanks: 31
default:
{
if (LinkBack == 0)
{
CSocket.Client.NpcTasks.Clear();<-- error
Database.Database.GetNPCTask(ID, CSocket);
break;
}
else
{
int task = 0;
foreach (DictionaryEntry DE in CSocket.Client.NpcTasks)<-- Error
{
if (Convert.ToInt32(DE.Key) == LinkBack)
{ task = Convert.ToInt32(DE.Value); }
}
Database.Database.GetTaskAction(task, CSocket);
break;
}
~*Dutchess*~ is offline  
Old 05/30/2009, 01:40   #19
 
felipeboladao's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 255
Received Thanks: 273
Quote:
Originally Posted by ~*Dutchess*~ View Post
default:
{
if (LinkBack == 0)
{
CSocket.Client.NpcTasks.Clear();<-- error
Database.Database.GetNPCTask(ID, CSocket);
break;
}
else
{
int task = 0;
foreach (DictionaryEntry DE in CSocket.Client.NpcTasks)<-- Error
{
if (Convert.ToInt32(DE.Key) == LinkBack)
{ task = Convert.ToInt32(DE.Value); }
}
Database.Database.GetTaskAction(task, CSocket);
break;
}
Go to Database and search for

Code:
static void GetNPCTask(int MyID, ClientSocket CSocket)
And replace

Code:
public static void GetNPCTask(int MyID, ClientSocket CSocket)
felipeboladao is offline  
Old 05/30/2009, 01:46   #20
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Quote:
Originally Posted by felipeboladao View Post
Go to Database and search for

Code:
static void GetNPCTask(int MyID, ClientSocket CSocket)
And replace

Code:
public static void GetNPCTask(int MyID, ClientSocket CSocket)
His problem is that he didn't define the variable..
nTL3fTy is offline  
Old 07/11/2009, 23:49   #21

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
I was wondering if this was still being developed? oh and #bump
Kiyono is offline  
Old 07/12/2009, 00:33   #22
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
Quote:
Originally Posted by master15 View Post
im coding a system to read the cq_nps, check the cq_task and load cq_actions

there is just some types working yet:

Npc Text,
Npc Link,
Npc Face,
Npc End,
Npc Char stats Check (not all coded),
Npc Teleport,
Npc Save old MapID, X, and Y when you are teleported


Now let's start

into GameServerProject find it: public static void LoadNpcs() in Database.cs

change to:

Code:
	public static void LoadNpcs()
		{
			MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `cq_npc`", DatabaseConnection.NewConnection());
			MySqlDataReader DR = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
			while(DR.Read())
			{
				Struct.NPC NPC = new Struct.NPC();
				NPC.Direction = Convert.ToInt32(DR["type"]);
				NPC.Flag = Convert.ToInt32(DR["sort"]);
				NPC.ID = Convert.ToInt32(DR["id"]);
				NPC.Map = Convert.ToInt32(DR["mapid"]);
				NPC.SubType = Convert.ToInt32(DR["lookface"]);
				NPC.Type = Convert.ToInt32(DR["id"]);
				NPC.X = Convert.ToInt32(DR["cellx"]);
				NPC.Y = Convert.ToInt32(DR["celly"]);
				if(!Nano.Npcs.ContainsKey(NPC.ID))
					Nano.Npcs.Add(NPC.ID, NPC);
			}
			Console.WriteLine("[GameServer] Loaded " + Nano.Npcs.Count + " npcs into the world.");
			DR.Close();
			Cmd.Dispose();
		}
now bellow of it add this voids:

Code:
 public static void GetNPCTask(int MyID, ClientSocket CSocket)
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `cq_npc` WHERE `id` = " + MyID + "", DatabaseConnection.NewConnection());
            MySqlDataReader DR = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
            while (DR.Read())
            {
                int task0 = Convert.ToInt32(DR["task0"]);
                int task1 = Convert.ToInt32(DR["task1"]);
                int actions = 0;
                if (task0 != 0) { actions = task0; }
                else if (task1 != 0) { actions = task1; }

                if (actions != 0)
                {
                    GetTaskAction(task0, CSocket);
                }
            }
            DR.Close();
            Cmd.Dispose();
        }
        public static void LoadActions(int ActionID, ClientSocket CSocket)
        {
            MySqlCommand CMD = new MySqlCommand("SELECT * FROM `actions` WHERE `id` = " + ActionID + "", DatabaseConnection.NewConnection());
            MySqlDataReader DR = CMD.ExecuteReader(CommandBehavior.CloseConnection);
            while (DR.Read())
            {
                bool callfail = false;

                int id_next = Convert.ToInt32(DR["id_next"]);
                int id_fail = Convert.ToInt32(DR["id_nextfail"]);
                int type = Convert.ToInt32(DR["type"]);
                int data = Convert.ToInt32(DR["data"]);
                string param = Convert.ToString(DR["param"]);

                if (type == 101) //npc text
                {
                    param.Replace("%user_name", CSocket.Client.Name);

                    Handlers.Handler.Text(param, CSocket);
                }
                else if (type == 102) //npc link
                {
                    string[] spit = param.Split(' ');
                    int a = CSocket.Client.NpcTasks.Count +1;
                    int link = 0;

                    try { link = Convert.ToInt32(spit[1]); }
                    catch { }

                    CSocket.Client.NpcTasks.Add(a, link);
                    Handlers.Handler.Link(spit[0], a, CSocket);
                }
                else if (type == 103)//npc input
                {
                    string[] spit = param.Split(' ');
                    int a = CSocket.Client.NpcTasks.Count + 1;
                    int link = 0; int unk = 0;

                    try { link = Convert.ToInt32(spit[1]); unk = Convert.ToInt32(spit[0]); }
                    catch { }

                    CSocket.Client.NpcTasks.Add(a, link);
                    Handlers.Handler.Input(spit[2], link, CSocket);
                }
                else if (type == 104)//npc face
                {
                    string[] spit = param.Split(' ');
                    int face = 0;

                    try { face = Convert.ToInt32(spit[2]); }
                    catch { }

                    Handlers.Handler.Face(face, CSocket);
                }
                else if (type == 120)//npc end
                { Handlers.Handler.End(CSocket); }
                else if (type == 1001)//check user
                {
                    string[] spit = param.Split(' ');
                    string tocheck = spit[0];  string operatorr = spit[1]; string value = spit[2];

                    callfail = NpcActions.TQCheckUserStats(tocheck, operatorr, value, CSocket);
                }
                else if (type == 1003)//transport to map
                {
                     string[] spit = param.Split(' ');
                     Handlers.Handler.Teleport(int.Parse(spit[0]), int.Parse(spit[1]), int.Parse(spit[2]), 0, CSocket);
                }
                else if (type == 1004) //save map
                {
                    string[] spit = param.Split(' ');
                    CSocket.Client.RecordMap = int.Parse(spit[0]);
                    CSocket.Client.RecordX = int.Parse(spit[1]);
                    CSocket.Client.RecordY = int.Parse(spit[2]);
                    Database.SaveCharacter(CSocket.Client);
                }
                else if (type == 1006) //transport to recored map
                {
                    Handlers.Handler.Teleport(CSocket.Client.RecordMap, CSocket.Client.RecordX, CSocket.Client.RecordY, 0, CSocket);
                }
                if (id_next != 0 && callfail == false) { LoadActions(id_next, CSocket); }

                if (id_fail != 0 && callfail == true) { LoadActions(id_fail, CSocket); }

            }
            CMD.Dispose();
            DR.Close();
        }
        public static void GetTaskAction(int taskID, ClientSocket CSocket)
        {
            MySqlCommand CMD = new MySqlCommand("SELECT * FROM `task` WHERE `id` = " + taskID + "", DatabaseConnection.NewConnection());
            MySqlDataReader DR = CMD.ExecuteReader(CommandBehavior.CloseConnection);
            while (DR.Read())
            {
                int id_next = Convert.ToInt32(DR["id_next"]);
                LoadActions(id_next, CSocket);
            }
            CMD.Dispose();
            DR.Close();
        }
now go to handlers folder and open NpcTalk.cs and replace all the lines for this

Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/18/2009
 * Time: 8:02 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using Lua511;
using LuaInterface;

namespace CoEmu_v2_GameServer.Handlers
{
	/// <summary>
	/// Description of NpcTalk.
	/// </summary>
	public partial class Handler
	{
		public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack)
		{
			if(ID > 0)
				CSocket.Client.LastNPC = ID;
			switch(ID)
			{
				case 8://TC - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
				case 10012://PC - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
				case 10011://DC - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
				case 10028://AM - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
				case 10027://BI - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
				case 44://MA - WHS
					{
						CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 4, 0, 0, 0, 0, Struct.DataType.Dialog));
						break;
					}
					default:
					{
                        if (LinkBack == 0)
                        {
                            CSocket.Client.NpcTasks.Clear();
                            Database.Database.GetNPCTask(ID, CSocket);
                            break;
                        }
                        else
                        {
                            int task = 0;
                            foreach (DictionaryEntry DE in CSocket.Client.NpcTasks)
                            {
                                if (Convert.ToInt32(DE.Key) == LinkBack)
                                { task = Convert.ToInt32(DE.Value); }
                            }
                            Database.Database.GetTaskAction(task, CSocket);
                            break;
                        }
					}
			}
		}
		public static void Text(string value, ClientSocket CSocket)
		{
			CSocket.Send(ConquerPacket.NPCTalk(255, 1, value));
		}
		public static void Money(int value, ClientSocket CSocket)
		{
			CSocket.Client.Money += value;
			CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.Money, Struct.StatusTypes.InvMoney));
		}
		public static void CPs(int value, ClientSocket CSocket)
		{
			CSocket.Client.CPs += value;
			CSocket.Send(ConquerPacket.Status(CSocket, 2, CSocket.Client.CPs, Struct.StatusTypes.InvCPoints));
		}
		public static void Link(string value, int LinkBack, ClientSocket CSocket)
		{
			CSocket.Send(ConquerPacket.NPCTalk(LinkBack, 2, value));
		}
		public static void Input(string text, int LinkBack, ClientSocket CSocket)
		{
			CSocket.Send(ConquerPacket.NPCTalk(LinkBack, 3, text));
		}
        public static void Face(int Face, ClientSocket CSocket)
        {
            CSocket.Send(ConquerPacket.NPCTalk(2544, Face, 255, 4));
        }
		public static void End(ClientSocket CSocket)
		{
			CSocket.Send(ConquerPacket.NPCTalk(0, 0, 255, 100));
		}
	}
}
now go find it: public bool Dead = false; in Character.cs

and under of this code add:

Code:
public Hashtable NpcTasks = new Hashtable();//temp npctask loads

        public int RecordMap = 1002;
        public int RecordX = 438;
        public int RecordY = 377;
now, go to Database.cs again and find it: Client.Class = (Struct.ClassType)Convert.ToInt32(DR["Class"]);

bellow of it add

Client.RecordMap = Convert.ToInt32(DR["RecordMap"]);
Client.RecordX = Convert.ToInt32(DR["RecordX"]);
Client.RecordY = Convert.ToInt32(DR["RecordY"]);

and now find it: public static void SaveCharacter(Character Client)

and change for

Code:
public static void SaveCharacter(Character Client)
		{
            MySqlCommand Cmd = new MySqlCommand("UPDATE `characters` SET `Level` = " + Client.Level + ", `WHMoney` = " + Client.WHMoney + ", `PkPoints` = " + Client.PkPoints + ", `xCord` = " + Client.X + ", `yCord` = " + Client.Y + ", `Map` = " + (int)Client.Map + ", `HairStyle` = " + Client.Hair + ", `Class` = " + (int)Client.Class + ", `Exp` = " + Client.Exp + ", `Money` = " + Client.Money + ", `Str` = " + Client.Strength + ",`Vit` = " + Client.Vitality + ", `Spi` = " + Client.Spirit + ", `Dex` = " + Client.Dexterity + ", `StatPoints` = " + Client.StatPoints + ", `FirstLog` = " + 1 + ", `Reborn` = " + Client.Reborn + ", `HP` = " + Client.CurrentHP + ", `MP` = " + Client.CurrentMP + ", `RecordMap` = " + Client.RecordMap + ", `RecordX` = " + Client.RecordX + ", `RecordY` = " + Client.RecordY +" WHERE `CharID` = " + Client.ID, DatabaseConnection.NewConnection());
			Cmd.ExecuteNonQuery();
			Cmd.Connection.Close();
			Cmd.Connection.Dispose();
			Cmd.Dispose();
		}
now add in the project the NpcActions.cs (NpcActions.cs.rar)

and execute the batch of my sql (it will add table: actions, task, cq_npc, and update the character table (Junior_SQL.rar)

Credits goto:

Me (all code is mine work)
felipeboladao (for a little help) thx dude
magnon for the cq_actions very thx

More Updates coming soon when i get free time to code
and for who have a must english database and want help me/us to make it much perfect pm me
good job, imnot gonna use since im strictly a lotf user lol
Arcotemple:) is offline  
Old 07/12/2009, 00:40   #23
 
elite*gold: 0
Join Date: May 2008
Posts: 103
Received Thanks: 3
i add the npcactions.cs in CoEmu v2\CoEmu v2 GameServer\Handlers are this right or not
and i have this only error
The name 'NpcActions' does not exist in the current context
please help
m7med is offline  
Old 07/14/2009, 18:17   #24
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Quote:
Originally Posted by Arcotemple:) View Post
good job, imnot gonna use since im strictly a lotf user lol
Sometimes you have to move on to bigger and better things 0.0
hunterman01 is offline  
Old 07/14/2009, 18:44   #25
 
sawickas's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 617
Received Thanks: 38
For me it dont work i add npctalk.cs but have a lot of erors if any body make it work uplaud it here thanks
sawickas is offline  
Old 10/13/2009, 12:16   #26
 
gulpi_de_gulat's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 71
Received Thanks: 40
no error but nothing happens still desame
gulpi_de_gulat is offline  
Old 10/13/2009, 12:33   #27
 
sawickas's Avatar
 
elite*gold: 0
Join Date: Sep 2008
Posts: 617
Received Thanks: 38
Quote:
Originally Posted by gulpi_de_gulat View Post
no error but nothing happens still desame
yuo need build,and if no erors can yuo post it plyz?
sawickas is offline  
Old 10/13/2009, 12:46   #28
 
elite*gold: 0
Join Date: Oct 2006
Posts: 164
Received Thanks: 17
Quote:
Originally Posted by IcedEarth View Post
lawl ? I just tried and it works just fine
UMM HAY MILEY IM A "NOT FAN" btw arnt you a guy...



@Topic - nice coding in MYSQL
PropItem is offline  
Old 10/13/2009, 13:53   #29
 
elite*gold: 0
Join Date: Sep 2009
Posts: 260
Received Thanks: 59
You guys should write your own npc talk system..
ImmortalYashi is offline  
Old 11/12/2009, 19:50   #30
 
elite*gold: 0
Join Date: Jun 2008
Posts: 30
Received Thanks: 0
i got some problems :S
it says that the 'CoEmu_v2_GameServer.Packets.ConquerPacket' don't know what is 'NPCTalk'
darkichou is offline  
Reply


Similar Threads Similar Threads
[Release] Trading (CoEmu v2)
02/04/2012 - CO2 PServer Guides & Releases - 60 Replies
Yes yes I know, I haven't released anything for a long time. Well, thought I might as well release some basic stuff for CoEmu v2. So here's a Simple Trading code. Packet Processor: #region Trading case 1056: // Trading {
[HELP] PLEASE Coemu release 180
09/08/2010 - CO2 Private Server - 2 Replies
Hello everyone good morning everyone! Well folks I'm trying to use the Coemu but the recent release that came out good I downloaded the source code and compiled it, if I did not know but was sure: D lol but one detail appeared very npcs are with the dialogues as if I was not wrong. Can someone give me a Help please or copille me if I did something wrong! ss follows below! http://img822.imageshack.us/img822/9706/1942037.t h.jpg Uploaded with ImageShack.us
[Release] >>>> CoEmu.V3
11/09/2009 - CO2 PServer Guides & Releases - 20 Replies
i got a new CoEmu from a china site but i don't know how to setup it this is the link of the source 4shared.com - online file sharing and storage - download NewCoemu.rar pass: AhmedZero
[Release] Second Reborn (CoEmu v2)
09/07/2009 - CO2 PServer Guides & Releases - 17 Replies
Hello!! It can have some bugs yet because it's on development! but here we go!! Obs.: 1º: Don't flame.... 2º if you wanna help... feel free to post!! First at all you need to have the first rb maded by samehvan!! and them you can make this... now Lets begin!
[Release] JewelerSun NPC (CoEmu V2)
08/08/2009 - CO2 PServer Guides & Releases - 16 Replies
hi guys i just finished it it took from me like 20 minute its big code i dont know why if any one have it more simple tell me here is the code in NpcTalk.Cs before case 390: add that code #region JewelerSun case 3953: { if (LinkBack == 0)



All times are GMT +2. The time now is 08:44.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.