how to edit that client version tor run?at least for DCPS..
Printable View
I was looking at your code and a few things came up to me.
- Why are you using 4 if's if you can make it a switch? Would also save you the trouble to lowercase it.
- I'm not sure what channel means, but if possible you could use an enum. Avoid using magic numbers/strings
Because it was only a test. Before you can properly code you'll need to get the packet structure. I don't have a packet logger so I need to play around with things.. There is no proper code in the picture because the packet structure / variable types are unknown to me.
Anybody knows if this decryption method works with current client of drift city?
I asked that because of packet sniffing. I noticed the emulator is not very much completed, and if I can't sniff the official client for packets I couldnt do anything
To bad , this seems dead :)
Yes, still no notice about this encryption method.. not much for us to collaborate without it I suppose
Even though it shows that the server is running I can't connect (Login)
http://oi61.tinypic.com/zjdtw3.jpg
Servers stays offline , DB exists > db info correct > etc... any help?
I'm no expert of DC servers but I do know a few things that might help you out.
If you're trying to login on the same machine you're running the server, try to login with the IP of 127.0.0.1 or localhost.
If you're trying to login from a different machine, use the correct IP and open the right ports (or set it to DMZ host) on the host machine.
If both machines are connected to the same router, try login to the LAN IP of the machine within the network (e.g. 192.xxx.xxx.xxx/10.0.0.xx).
As of a week or so ago, RiceEmu on GitHub is only there to provide a base for the RZ community for Drift City emulator development. The open-source version is no longer being actively developed. I will be accepting any (reasonable) pull requests RZ users submit, but you're better off making a fork of the project.
EDIT: Made a price table on the shop structure i know its a bunch of ifs and else ifs but its just a test code!
Shop.cs (thx to GigaToni who made the original structure)
and it workedQuote:
using System;
using Rice.Server.Structures;
using System.Data.Common;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rice.Server.Core;
namespace Rice.Server.Packets.Game
{
public static class Shop
{
[RicePacket(405, RiceServer.ServerType.Game)]
public static void BuyItem(RicePacket packet)
{
// 0 = Item ID
// 1 = Dont have any Idea
// 2 = Quantity
int itemID = packet.Reader.ReadInt16();
int unknown = packet.Reader.ReadInt16();
int quantity = packet.Reader.ReadInt16();
int price = 400;
Log.WriteLine ("{0} {1} {2}", itemID, unknown, quantity);
// 0 = Item ID
// 1 = Dont have any idea
// 2 = Qauntity
//Price Table With Item ID
if (itemID == 0)
price = 250;
else if (itemID == 5)
price = 400;
else if (itemID == 10)
price = 1050;
else if (itemID == 15)
price = 2000;
else if (itemID == 20)
price = 3250;
else if (itemID == 25)
price = 250;
else if (itemID == 30)
price = 400;
else if (itemID == 35)
price = 1050;
else if (itemID == 40)
price = 2000;
else if (itemID == 45)
price = 3250;
else if (itemID == 50)
price = 250;
else if (itemID == 55)
price = 400;
else if (itemID == 60)
price = 1050;
else if (itemID == 65)
price = 2000;
else if (itemID == 70)
price = 3250;
else if (itemID == 75)
price = 250;
else if (itemID == 80)
price = 400;
else if (itemID == 85)
price = 1050;
else if (itemID == 90)
price = 2000;
else if (itemID == 95)
price = 3250;
else if (itemID == 1445)
price = 5000 * quantity;
else if (itemID == 1488)
price = 50 * quantity;
else if (itemID == 1502)
price = 200 * quantity;
else if (itemID == 1503)
price = 1000 * quantity;
else if (itemID == 1504)
price = 30000 * quantity;
else if (itemID == 1516)
price = 5000 * quantity;
else if (itemID == 1554)
price = 100 * quantity;
else if (itemID == 1561)
price = 1000 * quantity;
else if (itemID == 1568)
price = 500 * quantity;
else if (itemID == 1569)
price = 1000 * quantity;
else if (itemID == 1570)
price = 2000 * quantity;
else if (itemID == 1665)
price = 1000 * quantity;
else if (itemID == 1666)
price = 1000 * quantity;
else if (itemID == 1667)
price = 1000 * quantity;
else if (itemID == 1818)
price = 3000 * quantity;
else if (itemID == 1874)
price = 49000 * quantity;
else if (itemID == 1875)
price = 63000 * quantity;
else if (itemID == 1876)
price = 98000 * quantity;
else if (itemID == 1877)
price = 196000 * quantity;
else if (itemID == 2546)
price = 4000 * quantity;
else if (itemID == 2547)
price = 6000 * quantity;
else if (itemID == 2548)
price = 7000 * quantity;
else if (itemID == 1979)
price = 1200 * quantity;
else if (itemID == 1980)
price = 700 * quantity;
else if (itemID == 1981)
price = 2000 * quantity;
else if (itemID == 1982)
price = 100 * quantity;
else if (itemID == 2032)
price = 1000 * quantity;
else if (itemID == 1989)
price = 10000 * quantity;
else if (itemID == 2013)
price = 15000 * quantity;
else if (itemID == 2014)
price = 15000 * quantity;
else if (itemID == 2015)
price = 15000 * quantity;
else if (itemID == 2034)
price = 10000 * quantity;
else if (itemID == 2068)
price = 5000 * quantity;
else if (itemID == 2069)
price = 7000 * quantity;
else if (itemID == 2070)
price = 10000 * quantity;
else if (itemID == 2700)
price = 10000 * quantity;
else if (itemID == 2708)
price = 10000 * quantity;
else if (itemID == 2709)
price = 10000 * quantity;
else if (itemID == 2003)
price = 10000 * quantity;
else if (itemID == 2004)
price = 12000 * quantity;
else if (itemID == 2005)
price = 15000 * quantity;
else if (itemID == 2031)
price = 12000 * quantity;
else if (itemID == 2036)
price = 20000 * quantity;
else if (itemID == 2025)
price = 30000 * quantity;
var ack = new RicePacket(406);
ack.Writer.Write(itemID);
ack.Writer.Write(quantity);
ack.Writer.Write(price);
packet.Sender.Send(ack);
packet.Sender.Error ("This Item Should be in your Inventory but... :(");
}
}
}
https://forum.ragezone.com/cache.php...%2Frs9k2RK.png
Added the Inventory Level on database (HancoinInven)
Character.cs (/Game/Character.cs)
and worked pretty wellQuote:
using Rice.Server.Structures;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Rice.Game
{
public class Character
{
public User User;
public ulong UID;
public ulong CID;
public string Name;
public long Mito;
public int Avatar;
public int Level;
public int City;
public int CurrentCarID;
public int GarageLevel;
public int InventoryLevel;
public long TID;
private Character()
{
}
public CharInfo GetInfo()
{
return new CharInfo
{
Avatar = (ushort)Avatar,
Name = Name,
CID = CID,
City = City,
CurrentCarID = CurrentCarID,
ExpInfo = new ExpInfo // load this
{
BaseExp = 0,
CurExp = 0,
NextExp = 0
},
HancoinGarage = GarageLevel,
HancoinInven = InventoryLevel,
Level = (ushort)Level,
TeamId = TID,
TeamName = "Staff", // load this
MitoMoney = Mito
};
}
public static Character Retrieve(string charname)
{
DbConnection dbconn = Database.GetConnection();
DbCommand command = dbconn.CreateTextCommand("SELECT * FROM Characters WHERE Name = @char");
command.AddParameter("@char", charname);
Character character = null;
using (DbDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
character = new Character();
character.CID = Convert.ToUInt64(reader["CID"]);
character.UID = Convert.ToUInt64(reader["UID"]);
character.Name = reader["Name"] as string;
character.Mito = Convert.ToInt64(reader["Mito"]);
character.Avatar = Convert.ToInt32(reader["Avatar"]);
character.Level = Convert.ToInt32(reader["Level"]);
character.City = Convert.ToInt32(reader["City"]);
character.CurrentCarID = Convert.ToInt32(reader["CurrentCarID"]);
character.InventoryLevel = Convert.ToInt32(reader["InventoryLevel"]);
character.GarageLevel = Convert.ToInt32(reader["GarageLevel"]);
character.TID = Convert.ToInt64(reader["TID"]);
}
}
return character;
}
public static List<Character> Retrieve(ulong uid)
{
DbConnection dbconn = Database.GetConnection();
DbCommand command = dbconn.CreateTextCommand("SELECT * FROM Characters WHERE UID = @uid");
command.AddParameter("@uid", uid);
List<Character> chars = new List<Character>();
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
var character = new Character();
character.CID = Convert.ToUInt64(reader["CID"]);
character.UID = Convert.ToUInt64(reader["UID"]);
character.Name = reader["Name"] as string;
character.Mito = Convert.ToInt64(reader["Mito"]);
character.Avatar = Convert.ToInt32(reader["Avatar"]);
character.Level = Convert.ToInt32(reader["Level"]);
character.City = Convert.ToInt32(reader["City"]);
character.CurrentCarID = Convert.ToInt32(reader["CurrentCarID"]);
character.InventoryLevel = Convert.ToInt32(reader["InventoryLevel"]);
character.GarageLevel = Convert.ToInt32(reader["GarageLevel"]);
character.TID = Convert.ToInt64(reader["TID"]);
chars.Add(character);
}
}
return chars;
}
}
}
https://forum.ragezone.com/cache.php...%2FWyPLgFk.png
I'll keep this updated guys :)
UPDATE: i've not posted new things because i dont know anything about drift city packing method so i cant get the packets structures to keep this development
how to connect to run client?
configuration IP how
what you use client version ? for join game. i have client 2012 but got problem gameguard, can you help me join game ?
- - - Updated - - -
what a problem i use 2012 client.
http://i.imgur.com/K1tqmph.png
- - - Updated - - -
Delete Character Work
Quote:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rice.Server.Core;
namespace Rice.Server.Packets.Lobby
{
public static class User
{
[RicePacket(60, RiceServer.ServerType.Lobby)]
public static void UserInfo(RicePacket packet)
{
Log.WriteLine("UserInfo request.");
var settings = new RicePacket(30);
settings.Writer.Write(Static.GameSettings);
packet.Sender.Send(settings);
packet.Sender.Player.Characters = Rice.Game.Character.Retrieve(packet.Sender.Player.User.UID);
var ack = new RicePacket(61);
ack.Writer.Write(0); // Permissions
ack.Writer.Write(packet.Sender.Player.Characters.Count); // Character Count
ack.Writer.WriteUnicodeStatic(packet.Sender.Player.User.Name, 18); // Username
ack.Writer.Write((long)0);
ack.Writer.Write((long)0);
ack.Writer.Write((long)0);
ack.Writer.Write(0);
foreach (var character in packet.Sender.Player.Characters)
{
ack.Writer.WriteUnicodeStatic(character.Name, 21); // Name
ack.Writer.Write(character.CID); // ID
ack.Writer.Write(character.Avatar); // Avatar
ack.Writer.Write(character.Level); // Level
ack.Writer.Write(1);
ack.Writer.Write(0x50);
ack.Writer.Write(0);
ack.Writer.Write(int.MaxValue / 2); // Creation Date
ack.Writer.Write(character.TID); // Crew ID
ack.Writer.Write(0L); // Crew Image
ack.Writer.WriteUnicodeStatic("Staff", 12); // Crew Name
ack.Writer.Write((short)0);
ack.Writer.Write((short)-1);
ack.Writer.Write((short)0);
}
packet.Sender.Send(ack);
Log.WriteLine("Sent character list.");
}
[RicePacket(80, RiceServer.ServerType.Lobby)]
public static void CheckCharacterName(RicePacket packet)
{
string characterName = packet.Reader.ReadUnicode();
Log.WriteLine("VerifyCharName: {0}", characterName);
// TODO: Verify
var ack = new RicePacket(81);
ack.Writer.WriteUnicodeStatic(characterName, 21);
ack.Writer.Write(1); // Availability. 1 = Available, 0 = Unavailable.
packet.Sender.Send(ack);
}
[RicePacket(82, RiceServer.ServerType.Lobby)]
public static void CreateCharacter(RicePacket packet)
{
string characterName = packet.Reader.ReadUnicode();
/*
string UIDCreate = packet.Reader.ReadUnicode();
DbConnection dbconn_c = Database.GetConnection();
DbCommand crechar = dbconn_c.CreateCommand();
crechar.CommandText = @"Insert into characters (UID, Name) values ('" + UIDCreate + "', '" + characterName + "')";
*/
Log.WriteLine("Create Character Success Name: {0}", characterName);
// TODO: Verify, Handle
}
[RicePacket(50, RiceServer.ServerType.Lobby)]
public static void DeleteCharacter(RicePacket packet)
{
string characterName = packet.Reader.ReadUnicode();
DbConnection dbconn_d = Database.GetConnection();
DbCommand delchar = dbconn_d.CreateCommand();
delchar.CommandText = @"Delete from characters Where Name =
'" + characterName + " ' ";
delchar.ExecuteNonQuery();
Log.WriteLine("Delete Character Success Name: {0}", characterName);
// TODO: Verify
var ack = new RicePacket(84);
ack.Writer.WriteUnicodeStatic(characterName, 21);
packet.Sender.Send(ack);
}
}
}