Ejemplo n.º 1
0
		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));
		}
Ejemplo n.º 2
0
		public static void AccountAuth(NetState state, PacketReader reader) {
			int accountID = reader.ReadInt32();
			int loginID1 = reader.ReadInt32();
			int loginID2 = reader.ReadInt32();
			int unknown = reader.ReadInt16(); // offset 14 - 16
			int iSex = reader.ReadByte();
			EAccountSex sex = (EAccountSex)iSex;

			state.Account = (Account)World.Objects[EDatabaseType.Account, accountID];
			state.Account.Netstate = state;
			if (
				state.Account == null ||
				state.Account.AccountState != EAccountState.Login ||
				state.Account.LoginID1 != loginID1 ||
				state.Account.LoginID2 != loginID2 ||
				state.Account.Sex != sex
			) {
				// Wrong data - hack attempt?
				state.Account = null;
				state.Send(new CharacterResponseError((byte)0));
				return;
			}

			// Mark as authed in character server
			state.Account.AccountState = EAccountState.Char;
			state.Account.LoadChars();

			// Auth successfull, send a special packet containing the AccountID
			state.Send(new CharacterResponseSuccess(state.Account));
			// Send character list
			state.Send(new CharacterResponseList(state.Account));
		}
Ejemplo n.º 3
0
		/// 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
		}