public static void CharacterCreation(NetState state, PacketReader reader) { if (state.Account == null || state.Account.AccountState != EAccountState.Char) { state.Disconnect(); return; } string name = reader.ReadString(24); byte attrStr = reader.ReadByte(); byte attrAgi = reader.ReadByte(); byte attrVit = reader.ReadByte(); byte attrInt = reader.ReadByte(); byte attrDex = reader.ReadByte(); byte attrLuk = reader.ReadByte(); byte slot = reader.ReadByte(); short hairColor = reader.ReadInt16(); short hairStyle = reader.ReadInt16(); Character newChar = null; ECharacterCreationResult result = Character.Create(state.Account, name, slot, attrStr, attrAgi, attrVit, attrInt, attrDex, attrLuk, hairColor, hairStyle, out newChar); if (result != ECharacterCreationResult.Success) { state.Send(new CharacterResponseCreation(result)); return; } // Creation was successfull, send new characterlist state.Send(new CharacterResponseNewData(newChar)); }
public static void AccountLogin(NetState state, PacketReader reader) { int clientVersion = reader.ReadInt32(); string loginName = reader.ReadString(24); string loginPassword = reader.ReadString(24); byte clientType = reader.ReadByte(); Account acc; EAccountLoadResult result = Account.Load(state, loginName, loginPassword, out acc, false); if (result != EAccountLoadResult.Success) { state.Send(new Response.LoginResponseAccountError((byte)result)); state.Disconnect(); return; } acc.AccountState = EAccountState.Login; acc.UpdateLastLogin(state.Address.ToString()); state.Send(new Response.LoginResponseServerList(acc)); }
/// Validates and processes global messages /// 008C/00F3 -1: <packet len>.W <text>.?B (<name> : <message>) 00 public static void GlobalMessage(NetState state, PacketReader reader) { if (state.IsValid(EAccountState.World) == false) { state.Disconnect(); return; } short textLen = (short)(reader.ReadInt16() - 4); string text = reader.ReadString(textLen); // TODO: // - check name/message // - check atcommand // - process message to all in range (9 cells) // - trigger listening npc's // - log chat }