public static void HandleTransfer(LoginConnector lc, InterPacket packet) { byte v; if (!packet.TryReadByte(out v)) { return; } if (v == 0) { byte admin; int accountid; string username, hash, hostip; if (!packet.TryReadInt(out accountid) || !packet.TryReadString(out username) || !packet.TryReadString(out hash) || !packet.TryReadByte(out admin) || !packet.TryReadString(out hostip)) { return; } ClientTransfer ct = new ClientTransfer(accountid, username, admin, hostip, hash); ClientManager.Instance.AddTransfer(ct); } else if (v == 1) { byte admin; int accountid; string username, charname, hostip; ushort randid; if (!packet.TryReadInt(out accountid) || !packet.TryReadString(out username) || !packet.TryReadString(out charname) || !packet.TryReadUShort(out randid) || !packet.TryReadByte(out admin) || !packet.TryReadString(out hostip)) { return; } ClientTransfer ct = new ClientTransfer(accountid, username, charname, randid, admin, hostip); ClientManager.Instance.AddTransfer(ct); } }
public void AddTransfer(ClientTransfer transfer) { if (transfer.Type != TransferType.WORLD) { Log.WriteLine(LogLevel.Warn, "Received a GAME transfer request. Trashing it."); return; } if (transfers.ContainsKey(transfer.Hash)) { ClientTransfer trans; if (transfers.TryRemove(transfer.Hash, out trans)) { Log.WriteLine(LogLevel.Warn, "Duplicate client transfer hash. {0} hacked into {1}", transfer.HostIP, trans.HostIP); } } if (!transfers.TryAdd(transfer.Hash, transfer)) { Log.WriteLine(LogLevel.Warn, "Error registering client transfer."); } }
public void AddTransfer(ClientTransfer transfer) { if (transfer.Type != TransferType.GAME) { Log.WriteLine(LogLevel.Warn, "Zone received a World transfer request. Trashing it."); return; } if (transfers.ContainsKey(transfer.CharacterName)) { ClientTransfer trans; if (transfers.TryRemove(transfer.CharacterName, out trans)) { Log.WriteLine(LogLevel.Warn, "Duplicate client transfer (Char={0}) attempt from {1}.", transfer.CharacterName, trans.HostIP); } } if (!transfers.TryAdd(transfer.CharacterName, transfer)) { Log.WriteLine(LogLevel.Warn, "Error registering client transfer for {0}.", transfer.CharacterName); } else Log.WriteLine(LogLevel.Debug, "Transfering {0}.", transfer.CharacterName); }