Exemple #1
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));
		}
Exemple #2
0
		/// <summary>
		/// <para>ID 0x0436</para>
		/// <para>Length 19</para>
		/// <para>First packet after selecting a character</para>
		/// </summary>
		public static void WantToConnect(NetState state, PacketReader reader) {
			int accountID = reader.ReadInt32();
			int charID = reader.ReadInt32();
			int loginID1 = reader.ReadInt32();
			int clientTick = reader.ReadInt32();
			byte iSex = reader.ReadByte();
			EAccountSex sex = (EAccountSex)iSex;

			state.Account = World.GetAccount(accountID);
			if (state.Account == null || state.Account.AccountState != EAccountState.Char) {
				state.Disconnect();
				return;
			}
			if (state.Account.LoginID1 != loginID1 || state.Account.Sex != sex) {
				state.Disconnect();
				return;
			}
			if (state.Account.ActiveChar == null || state.Account.ActiveChar.ID != charID) {
				state.Disconnect();
				return;
			}

			// Mark as authed
			state.Account.AccountState = EAccountState.World;
			state.Send(new Response.WorldAuthOK(state.Account));
		}
Exemple #3
0
		public static void KeepAlive(NetState state, PacketReader reader) {
			int accountID = reader.ReadInt32();
			if (state.Account == null || state.Account.AccountState != EAccountState.Char || accountID != state.Account.Serial.Value) {
				state.Disconnect();
				return;
			}

			//state.UpdateAcitivty();
		}
Exemple #4
0
		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));
		}
Exemple #5
0
		/// 014f 6: <state>.L
		public static void GuildRequestInfo(NetState state, PacketReader reader) {
			if (state.IsValid(EAccountState.World) == false) {
				state.Disconnect();
				return;
			}

			Character c = state.Account.ActiveChar;
			// Nothing to send?
			if (!(c.GuildID is Serial)) {
				// TODO: or battleground ID
				return;
			}

			int requestType = reader.ReadInt32();
			switch (requestType) {
				case 0:
					//clif_guild_basicinfo(sd);
					//clif_guild_allianceinfo(sd);
					break;
				case 1:
					//clif_guild_positionnamelist(sd);
					//clif_guild_memberlist(sd);
					break;
				case 2:
					//clif_guild_positionnamelist(sd);
					//clif_guild_positioninfolist(sd);
					break;
				case 3:
					//clif_guild_skillinfo(sd);
					break;
				case 4:
					//clif_guild_expulsionlist(sd);
					break;
				default:
					ServerConsole.ErrorLine("GuildRequestInfo: Unknown request type {0}", requestType);
					break;
			}
		}
Exemple #6
0
		/// Notification of the state of client command /effect (CZ_LESSEFFECT)
		/// 021D 6: <state>.L
		public static void LessEffect(NetState state, PacketReader reader) {
			if (state.IsValid(EAccountState.World) == false) {
				state.Disconnect();
				return;
			}

			// 0 = Full effects
			// 1 = Reduced effects
			int lessEffect = reader.ReadInt32();
		}
Exemple #7
0
		/// Request to walk
		/// 0x00A7 9: 
		public static void WalkToXY(NetState state, PacketReader reader) {
			if (state.IsValid(EAccountState.World) == false) {
				state.Disconnect();
				return;
			}

			Character c = state.Account.ActiveChar;

			int unkInt = reader.ReadInt32();
			// Since 2008-08-27aRagexeRE, X/Y starts at pos 6
			byte b1 = reader.ReadByte();
			byte b2 = reader.ReadByte();
			byte b3 = reader.ReadByte();
			int x = b1 * 4 + (b2 >> 6);
			int y = ((b2 & 0x3f) << 4) + (b3 >> 4);
			Point2D targetLoc = new Point2D(x, y);
			c.TargetLocation = c.Location.Point + (c.Location.Point - targetLoc);
		}
Exemple #8
0
		/// Requesting unit's name
		/// 0094 6: <object id>.L
		public static void CharNameRequest(NetState state, PacketReader reader) {
			if (state.IsValid(EAccountState.World) == false) {
				state.Disconnect();
				return;
			}

			int id = reader.ReadInt32();
			// Disguises using -ID..
			if (id < 0 && -id == state.Account.ID) {
				id = (int)state.Account.ID;
			}

			SerialObject obj = World.GetObject(id);
			if (obj == null) {
				// Lagged clients could request names of already gone mobs/players..
				// so no disconnect on invalid requests..
				//state.Disconnect();
				return;
			}

			if (obj.Location.Map != state.Account.ActiveChar.Location.Map) {
				// || !check_distance_bl(&sd->bl, bl, AREA_SIZE)
				return; // Block namerequests past view range
			}

			// 'see people in GM hide' cheat detection
			/* disabled due to false positives (network lag + request name of char that's about to hide = race condition)
			sc = status_get_sc(bl);
			if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl) &&
				bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple
				pc_isGM(sd) < battle_config.hack_info_GM_level
			) {
				char gm_msg[256];
				sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
				ShowWarning(gm_msg);
				// information is sent to all online GMs
				intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
				return;
			}
			*/

			// TODO: implement me :o
			//clif_charnameack(fd, bl);
		}