留意Consolesystem的代码放开,其他的为更新

This commit is contained in:
Longfeng Qin 2024-09-12 03:01:35 +08:00
parent 01b831e9fd
commit 4d6efa6b16
4 changed files with 36 additions and 32 deletions

View File

@ -955,7 +955,7 @@ namespace PSO2SERVER
// Couldn't find the username
if (!foundPlayer)
{
Logger.WriteError("[CMD] Could not find user " + name);
Logger.WriteError("[CMD] 未找到玩家 " + name);
return;
}
@ -976,18 +976,18 @@ namespace PSO2SERVER
//PSOLocation destination = new PSOLocation(float.Parse(args[2]), float.Parse(args[3]), float.Parse(args[4]), float.Parse(args[5]),float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8]));
PSOLocation destination = new PSOLocation(float.Parse(args[2]), float.Parse(args[3]), float.Parse(args[4]), float.Parse(args[5]), float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8]));
//ServerApp.Instance.Server.Clients[id].SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination));
ServerApp.Instance.Server.Clients[id].SendPacket(new TeleportTransferPacket(ObjectManager.Instance.getObjectByID("lobby", 443), destination));
context.SendPacket(0x8, 0xB, 0x0, ObjectManager.Instance.getObjectByID(443).GenerateSpawnBlob());
//var objects = ObjectManager.Instance.getObjectsForZone("casino").Values;
//foreach (var obj in objects)
//{
// context.SendPacket(0x8, 0xB, 0x0, obj.GenerateSpawnBlob());
//}
var objects = ObjectManager.Instance.GetObjectsForZone("casino");
foreach (var obj in objects)
{
context.SendPacket(0x8, 0xB, 0x0, obj.GenerateSpawnBlob());
}

View File

@ -50,15 +50,15 @@ namespace PSO2SERVER.Object
var newObject = PSOObject.FromDBObject(dbObject);
objects.Add(newObject.Header.ID, newObject);
allTheObjects.Add(newObject.Header.ID, newObject);
Logger.WriteInternal("[OBJ] Loaded object {0} for zone {1} from the DB.", newObject.Name, zone);
Logger.WriteInternal("[OBJ] 从数据库中载入对象 {0} 所属区域 {1}.", newObject.Name, zone);
}
}
// Fallback
if (objects.Count < 1 && Directory.Exists("Resources/objects/" + zone))
if (objects.Count < 1 && Directory.Exists("Resources\\objects\\" + zone))
{
Logger.WriteWarning("[OBJ] No objects defined for zone {0} in the database, falling back to filesystem!", zone);
var objectPaths = Directory.GetFiles("Resources/objects/" + zone);
Logger.WriteWarning("[OBJ] 数据库中没有为该区域定义的对象 {0}, 回退到文件系统!", zone);
var objectPaths = Directory.GetFiles("Resources\\objects\\" + zone);
Array.Sort(objectPaths);
foreach (var path in objectPaths)
{
@ -67,7 +67,7 @@ namespace PSO2SERVER.Object
var newObject = PSOObject.FromPacketBin(File.ReadAllBytes(path));
objects.Add(newObject.Header.ID, newObject);
allTheObjects.Add(newObject.Header.ID, newObject);
Logger.WriteInternal("[OBJ] Loaded object ID {0} with name {1} pos: ({2}, {3}, {4})", newObject.Header.ID, newObject.Name, newObject.Position.PosX,
Logger.WriteInternal("[OBJ] BIN文件系统载入对象 ID {0} 名称 {1} 坐标: ({2}, {3}, {4})", newObject.Header.ID, newObject.Name, newObject.Position.PosX,
newObject.Position.PosY, newObject.Position.PosZ);
}
else if (Path.GetExtension(path) == ".json")
@ -75,7 +75,7 @@ namespace PSO2SERVER.Object
var newObject = JsonConvert.DeserializeObject<PSOObject>(File.ReadAllText(path));
objects.Add(newObject.Header.ID, newObject);
allTheObjects.Add(newObject.Header.ID, newObject);
Logger.WriteInternal("[OBJ] Loaded object ID {0} with name {1} pos: ({2}, {3}, {4})", newObject.Header.ID, newObject.Name, newObject.Position.PosX,
Logger.WriteInternal("[OBJ] JSON文件系统载入对象 ID {0} 名称 {1} 坐标: ({2}, {3}, {4})", newObject.Header.ID, newObject.Name, newObject.Position.PosX,
newObject.Position.PosY, newObject.Position.PosZ);
}
}
@ -134,7 +134,7 @@ namespace PSO2SERVER.Object
{
if (!allTheObjects.ContainsKey(ID))
{
Logger.WriteWarning("[OBJ] Client requested object {0} which we don't know about. Investigate.", ID);
Logger.WriteWarning("[OBJ] 客户端请求的对象 {0} 服务端未解析. 等待分析.", ID);
return new PSOObject() { Header = new ObjectHeader(ID, EntityType.Object), Name = "Unknown" };
}

View File

@ -16,23 +16,23 @@ namespace PSO2SERVER.Packets.Handlers
{
var reader = new PacketReader(data, position, size);
var info = string.Format("[<--] 接收到的数据 (hex): ");
Logger.WriteHex(info, data);
//var info = string.Format("[<--] 接收到的数据 (hex): ");
//Logger.WriteHex(info, data);
reader.BaseStream.Seek(0x2C, SeekOrigin.Current);
var macCount = reader.ReadMagic(0x5E6, 107);
reader.BaseStream.Seek(0x1C * macCount, SeekOrigin.Current);
reader.BaseStream.Seek(0x154, SeekOrigin.Current);
reader.BaseStream.Seek(0x280, SeekOrigin.Current);
//var username = reader.ReadFixedLengthAscii(64);
//var password = reader.ReadFixedLengthAscii(64);
var username = reader.ReadFixedLengthAscii(0x60);
var password = reader.ReadFixedLengthAscii(0x60);
var username = "sancaros";
var password = "12345678";
//var username = "sancaros";
//var password = "12345678";
Logger.Write("用户名 {0} 密码 {1}", username, password);
//Logger.Write("用户名 {0} 密码 {1}", username, password);
// What am I doing here even
using (var db = new ServerEf())
@ -73,17 +73,21 @@ namespace PSO2SERVER.Packets.Handlers
db.Players.Add(user);
db.SaveChanges();
// context.SendPacket(0x11, 0x1e, 0x0, new byte[0x44]); // Request nickname
context.SendPacket(0x11, 0x1e, 0x0, new byte[0x44]); // Request nickname
}
}
else
{
user = users.First();
//if (!BCrypt.Net.BCrypt.Verify(password, user.Password))
//{
// error = "密码错误.";
// user = null;
//}
if(password != user.Password)
{
if (!BCrypt.Net.BCrypt.Verify(password, user.Password))
{
error = "密码错误.";
user = null;
}
}
}
/* Mystery packet

View File

@ -24,7 +24,7 @@ namespace PSO2SERVER.Packets.Handlers
PackedData theFlags = (PackedData)dataFlags;
// Debug
Logger.WriteInternal("[MOV] Movement packet from {0} contains {1} data.", context.Character.Name, theFlags);
Logger.WriteInternal("[MOV] Movement 数据包来自 {0} 包含 {1} 数据.", context.Character.Name, theFlags);
// TODO: Maybe do this better someday
FullMovementData dstData = new FullMovementData();
@ -129,7 +129,7 @@ namespace PSO2SERVER.Packets.Handlers
}
Logger.WriteInternal("[MOV] Player moving! {0} -> ({1}, {2}, {3})", context.Character.Name, context.CurrentLocation.PosX,
Logger.WriteInternal("[MOV] 玩家 {0} 移动中 (坐标:{1}, {2}, {3})", context.Character.Name, context.CurrentLocation.PosX,
context.CurrentLocation.PosY, context.CurrentLocation.PosZ);
foreach (var c in Server.Instance.Clients)
@ -163,7 +163,7 @@ namespace PSO2SERVER.Packets.Handlers
PacketWriter writer = new PacketWriter();
writer.WriteStruct(movData);
Logger.WriteInternal("[MOV] {0} stopped moving at ({1}, {2}, {3})", context.Character.Name,
Logger.WriteInternal("[MOV] 玩家 {0} 停止移动 (坐标:{1}, {2}, {3})", context.Character.Name,
Helper.FloatFromHalfPrecision(movData.currentPos.x), Helper.FloatFromHalfPrecision(movData.currentPos.y),
Helper.FloatFromHalfPrecision(movData.currentPos.z));