Post your NPCS.
I'm just going on examples of item adding from within the source, although i will look into what your saying at a later stage, thanks for the input.Quote:
You should probably just change the source to use incremental UIDs on items.
Even TQ does. If for some reason all the UIDs were taken up (lol, that'd be a fuckload of items), you'd have threads locked all over the place. It's much easier to just store the incremented UID than if you're storing all of those.
default:
{
Text("NPC " + ID + "'s dialog is not coded.", CSocket);
Link("Aw! That's too bad!", 255, CSocket);
Face(10, CSocket);
End(CSocket);
break;
}
case 380://Guild Controller
{
if (LinkBack == 0)
{
Text("Hello, I can send you to the guild area for free. Would you like to go?", CSocket);
Link("Yes, please send me there.", 1, CSocket);
Link("I'll take a look around here.", 255, CSocket);
Face(20, CSocket);
End(CSocket);
}
else if(LinkBack == 1)
{
Teleport(1038, 349, 340, 0, CSocket);
}
break;
}
case 7000://GuldKeeper
{
if (LinkBack == 0)
{
Text("Hello, I can send you back to TwinCity for free. Would you like to go?", CSocket);
Link("Yes, please send me there.", 1, CSocket);
Link("I'll take a look around here.", 255, CSocket);
Face(20, CSocket);
End(CSocket);
}
else if (LinkBack == 1)
{
Teleport(1002, 430, 380, 0, CSocket);
}
break;
}
/*
* Created by SharpDevelop.
* User: sams
* Date: 3/14/2009
* Time: 1:56 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;
namespace CoEmu_v2_GameServer.Handlers
{
/// <summary>
/// Handles teleportations in the Conquer worls
/// </summary>
public partial class Handler
{
public static void Teleport(int Map, int X, int Y, int Instance, ClientSocket CSocket)
{
if (Map > 0 && X > 0 && Y > 0 && CSocket != null)
{
ConquerPacket.ToLocal(ConquerPacket.General(CSocket.Client.ID, CSocket.Client.X, CSocket.Client.Y, 0, 0, 0, Struct.DataType.EntityRemove), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
CSocket.Client.RecordMap = (int)CSocket.Client.Map;
CSocket.Client.RecordX = CSocket.Client.X;
CSocket.Client.RecordY = CSocket.Client.Y;
CSocket.Client.Map = (Struct.Maps)Map;
CSocket.Client.X = X;
CSocket.Client.Y = Y;
//TODO: Instance pairing.
CSocket.Send(ConquerPacket.General(CSocket.Client.ID, (int)CSocket.Client.Map, 0, CSocket.Client.X, CSocket.Client.Y, 0, Struct.DataType.ChangeMap));
CSocket.Send(ConquerPacket.General(CSocket.Client.ID, Nano.TintR, Nano.TintG, 0, 0, 0, Struct.DataType.CompleteMapChange));
CSocket.Send(ConquerPacket.NewMap((int)CSocket.Client.Map));
CSocket.Send(ConquerPacket.General(CSocket.Client.ID, 2, 0, CSocket.Client.X, CSocket.Client.Y, 0, Struct.DataType.MapShow3));
ConquerPacket.ToLocal(ConquerPacket.SpawnCharacter(CSocket), CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.ID);
CSocket.Client.PrevX = 0;
CSocket.Client.PrevY = 0;
Spawn.All(CSocket);
}
}
}
}
case 45: // Mark. Controller
{
if (LinkBack == 0)
{
Text("Hello I can teleport You outside of the market for free! Do you want to leave?", CSocket);
Link("Why would you be so kind to do so?", 1, CSocket);
Link("No, Thank you anyway.", 255, CSocket);
End(CSocket);
}
else if (LinkBack == 1)
{
if (CSocket.Client.RecordMap == 1002) //Twin City
{
Teleport(1002, 430, 380, 0, CSocket);
}
else if (CSocket.Client.RecordMap == 1011) //phoniex
{
Teleport(1011, 232, 260, 0, CSocket);
}
else if (CSocket.Client.RecordMap == 1020) //apecity
{
Teleport(1020, 565, 565, 0, CSocket);
}
else if (CSocket.Client.RecordMap == 1000) //desertcity
{
Teleport(1000, 496, 649, 0, CSocket);
}
else if (CSocket.Client.RecordMap == 1015) //birdisland
{
Teleport(1015, 723, 573, 0, CSocket);
}
else //For Other Map
Teleport(1002, 430, 380, 0, CSocket);
}
break;
}
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 + ", `CPoints` = " + Client.CPs + ", `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();
}
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 + ", `CPoints` = " + Client.CPs + ", `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();
}
Client.RecordMap = Convert.ToInt32(DR["RecordMap"]);
Client.RecordX = Convert.ToInt32(DR["RecordX"]);
Client.RecordY = Convert.ToInt32(DR["RecordY"]);
You forgot to make it load after relog :OQuote:
xd, Replace in Database.cs
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 + ", `CPoints` = " + Client.CPs + ", `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(); }
Client.RecordMap = Convert.ToInt32(DR["RecordMap"]);
Client.RecordX = Convert.ToInt32(DR["RecordX"]);
Client.RecordY = Convert.ToInt32(DR["RecordY"]);
'CoEmu_v2_GameServer.Entities.Character' does not contain a definition for 'RecordMap' and no extension method 'RecordMap' accepting a first argument of type 'CoEmu_v2_GameServer.Entities.Character' could be found (are you missing a using directive or an assembly reference?)
case 10003://Guild dude
{
if (LinkBack == 0)
{
Text("Greetings! I am the guild director, in charge of administrating and managing guilds. What business do you have with me?", CSocket);
Link("Create a guild", 255, CSocket);
Link("Disband my guild", 255, CSocket);
Link("Donate money", 255, CSocket);
Link("Pass my leadership", 255, CSocket);
Link("Assign Deputy Guild Leader", 255, CSocket);
Link("Remove sb. from office", 255, CSocket);
Link("Inquire about guild", 255, CSocket);
Link("Others", 1, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
{
Text("I am in charge of all guilds in Twim City. You may consult me for anything related to the guilds.", CSocket);
Link("Create Branch", 255, CSocket);
Link("Assign Branch Manager", 255, CSocket);
Link("Transfer fund.", 255, CSocket);
Link("Others", 0, CSocket);
Face(30, CSocket);End(CSocket);
}
}
break;
}
case 10002://Barber Bitch
{
if (LinkBack == 0)
{
Text("I'm capable of doing more hairstyles now! A New Dynasty Hairstyles is worth 10000 Silvers. Previous hairstyles cost 500 silvers.", CSocket);
Link("New Dynasty Hairstyles.", 1, CSocket);
Link("New Styles.", 2, CSocket);
Link("Nostalgic styles.", 3, CSocket);
Link("Keep my current style.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
{
Text("Which style would you like to select from?.", CSocket);
Link("1", 255, CSocket);
Link("2", 255, CSocket);
Link("2.", 255, CSocket);
Link("I changed my mind.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
else if (LinkBack == 2)
{
{
Text("Which style would you like to select from?.", CSocket);
Link("1", 255, CSocket);
Link("2", 255, CSocket);
Link("2.", 255, CSocket);
Link("I changed my mind.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
else if (LinkBack == 3)
{
{
Text("Which style would you like to select from?.", CSocket);
Link("1", 255, CSocket);
Link("2", 255, CSocket);
Link("2.", 255, CSocket);
Link("I changed my mind.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
else
{
Text("Dare you try to rip me off?! Be gone, fool!", CSocket);
Link("Sorry sir.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
break;
}
case 10063://shopboy dude
{
if (LinkBack == 0)
{
Text("Our shop is famous for dyeing. If you want to have your equipment dyed please wear the item before you enter. You have a wide choice of colors. One meteor will be charged before you try the colors. Do you want a try?", CSocket);
Link("Yes, here is a meteor.", 1, CSocket);
Link("Can you dye my armor black?", 2, CSocket);
Link("Just passing by.", 255, CSocket);
Face(30, CSocket);
End(CSocket);
}
else if (LinkBack == 1)
{
{
Teleport(1008, 22, 26, 0, CSocket);
}
}
else if (LinkBack == 2)
{
{
Text("Sure. Once your armor is dyed black, it will never fade no matter how it is updated, unless i dye it to other colors, i wil charge 1 dragon ball to do it.", CSocket);
Link("Yes, here is a Dragonball.", 3, CSocket);
Link("Let me think it over.", 255, CSocket);
Face(30, CSocket);Face(30, CSocket);End(CSocket);
}
}
else if (LinkBack == 3)
{
{
Teleport(1008, 22, 26, 0, CSocket);
}
}
else
{
Text("Dare you try to rip me off?! Be gone, fool!", CSocket);
Link("Sorry sir.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
break;
}
case 1061://Wh Pass Bitch
{
if (LinkBack == 0)
{
Text("Thieves are only one step behind security. Even those who hoard their treasures", CSocket);
Text(" in their warehouse are at risk. So, I offer you the opportunity to set a special", CSocket);
Text(" password for your warehouse. What do you say?", CSocket);
Text("Thieves are only one step behind security. Even those who hoard their treasures", CSocket);
Link("I want to set a password.", 1, CSocket);
Link("Let me see.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
{
Text("Passwords can be up to nine digits long, the first of which cannot be zero.", CSocket);
Text(" Enter numbers only. If you make a mistake your warehouse will be locked.", CSocket);
Text(" Please check carefully before you enter the password.", CSocket);
Link("Let me think.", 2, CSocket);
Link("Let me think.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
else if(LinkBack == 2)
{
Text("Sorry not owrking yet.", CSocket);
Link("I see.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
break;
}
case 923:// Lady Luck
{
if (LinkBack == 0)
{
Text("Welcome to the Lottery Center! There are meny LuckyBoxes which have innumerable treasure such as super gems,two-socket gears, up to 500,000,000 silvers etc. in them. If you are level 70 or above, you are allowed to enter the Lottery Center and try your luck at most ten times a day.", CSocket);
Text("And I charge you only 27 CPs for each admission.Come on, Try your luck right now!", CSocket);
Link("Wow, good deal!", 1, CSocket);
Link("May I know the rules first?", 2, CSocket);
Link("No Thanks!", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
if(CSocket.Client.Level >= 70)
{
if (CSocket.Client.CPs >= 27)
{
Teleport(700, 50, 50, 0, CSocket);
CPs(-27, CSocket);
}
else
{
Text("I'm sorry you do not have the required CPs.", CSocket);
Link("Okay, I will be back when I have 27 CPs.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
else
{
Text("I'm sorry you do not have the required Level 70.", CSocket);
Link("Okay, I will be back when I have level 70.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
}
if (LinkBack == 2)
{
Text("you will be teleported to Lottery Center where there are menny LuckyBoxes after you pay me 27 CPs. You may choose one box to try your luck at your will. Remeber you have only one chance to open a LuckyBox every time. If you want to open another box, you have to leave the room to re-enrol in Market.", CSocket);
Link("OK I see.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
break;
}
case 925: // LuckyBox
case 926: // LuckyBox
case 927: // LuckyBox
case 928: // LuckyBox
case 929: // LuckyBox
case 930: // LuckyBox
case 931: // LuckyBox
case 932: // LuckyBox
case 933: // LuckyBox
case 934: // LuckyBox
case 935: // LuckyBox
case 936: // LuckyBox
case 937: // LuckyBox
case 938: // LuckyBox
case 939: // LuckyBox
case 940: // LuckyBox
case 941: // LuckyBox
case 942: // LuckyBox
case 943: // LuckyBox
case 944: // LuckyBox
{
if (LinkBack == 0)
{
Text("Do you want to Chose this box ?.", CSocket);
Link("Yes ,", 1, CSocket);
Link("No I need to think more...", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
{
Teleport(1036, 217, 190, 0, CSocket);
}
}
break;
}
case 924: // Lady Luck
{
if (LinkBack == 0)
{
Text("Do you want to leave Lottery Center and go back to the Market?.", CSocket);
Link("Yes Please,", 1, CSocket);
Link("No Thank you I want to stay.", 255, CSocket);
Face(30, CSocket);End(CSocket);
}
else if (LinkBack == 1)
{
{
Teleport(1036, 217, 190, 0, CSocket);
}
}
break;
}
Put this in Character.csQuote:
felipeboladao first of all :)
secound ! dont we need to addCode:'CoEmu_v2_GameServer.Entities.Character' does not contain a definition for 'RecordMap' and no extension method 'RecordMap' accepting a first argument of type 'CoEmu_v2_GameServer.Entities.Character' could be found (are you missing a using directive or an assembly reference?)
"RecordMap" "RecordX" "RecordY" rows to our database char tables ?
public int RecordMap = 0; public int RecordX = 0; public int RecordY = 0;