private void onFailure(Client client, FailurePacket packet) { if (packet.ErrorMessage.IndexOf("server.realm_full") != -1) { //Console.WriteLine("Realm is full."); } switch (packet.ErrorId) { case FailurePacket.INCORRECT_VERSION: Console.WriteLine("Game updated to version " + packet.ErrorMessage + "."); FailurePacket.ActualBuildVersion = packet.ErrorMessage; break; case FailurePacket.BAD_KEY: //Console.WriteLine(packet.errorDescription); break; case FailurePacket.INVALID_TELEPORT_TARGET: //Console.WriteLine(packet.errorDescription); break; case FailurePacket.EMAIL_VERIFICATION_NEEDED: //Console.WriteLine(packet.errorDescription); break; case FailurePacket.TELEPORT_REALM_BLOCK: //Console.WriteLine(packet.errorDescription); break; } }
public async Task RespondWithFailure(ResponseOrFailureCode responseCode) { ReceivedFromNeighborNullable?.AssertIsNotDisposed(); var failure = new FailurePacket { ReqP2pSeq16 = ReqP2pSeq16, ResponseCode = responseCode, }; var failureUdpData = failure.Encode_OpionallySignNeighborHMAC(ReceivedFromNeighborNullable); await _engine.OptionallySendUdpRequestAsync_Retransmit_WaitForNeighborPeerAck("RoutedRequest failure 123123", failureUdpData, ReceivedFromEndpoint, failure.ReqP2pSeq16, ReceivedFromNeighborNullable, failure.GetSignedFieldsForNeighborHMAC); }
private void OnFailure(IncomingPacket p) { FailurePacket failure = (FailurePacket)p; Debug.Log("Failure: " + ((FailurePacket)p).ErrorDescription + "."); /* Possible errors : * "Email Verification needed" * "Protocol error" * "Account in use" * "Account is already in use" * and more... */ }
async Task WaitForFailureAsync(string completionActionVisibleId) { var tr1 = _engine.CreateTracker("WaitForFailureAsync"); var failureScanner = FailurePacket.GetScanner(_logger, _sentReqP2pSeq16, _destinationNeighborNullable); // the scanner verifies neighborHMAC _logger.WriteToLog_detail($"waiting for FAILURE"); _pendingFailureRequest = new PendingLowLevelUdpRequest(completionActionVisibleId, _destinationEndpoint, failureScanner, _engine.DateTimeNowUtc, _engine.Configuration.Ack1TimoutS ); tr1.Dispose(); _failureUdpData = await _engine.WaitForUdpResponseAsync(_pendingFailureRequest); _pendingFailureRequest = null; _waitForFailureCompleted = true; }
private void HelloPacketRecieved(Socket client, HelloPacket packet) { Console.WriteLine("Recieved HELLO packet from {0}", packet.Name); if (packet.Password == "Password") { InfoPacket info = new InfoPacket(); info.ConnectedClients = Networking.ConnectedClients.Count; info.Message = "Welcome " + packet.Name + "!"; client.Send(info); } else { FailurePacket failure = new FailurePacket(); failure.ErrorId = 0; failure.ErrorMessage = "WRONG PASSWORD!"; client.Send(failure); Networking.Kick(client); } }
public void Initialize(Proxy proxy) { targets = new List <Target> (); playerPositions = new Dictionary <int, Target> (); portals = new List <Portal> (); enemies = new List <Enemy> (); obstacles = new List <Obstacle> (); obstacleIds = new List <ushort> (); GameData.Objects.Map.ForEach((kvp) => { if (kvp.Value.FullOccupy || kvp.Value.OccupySquare) { obstacleIds.Add(kvp.Key); } }); PluginUtils.Log("FameBot", "Found {0} obstacles.", obstacleIds.Count); gui = new FameBotGUI(); PluginUtils.ShowGUI(gui); config = ConfigManager.GetConfiguration(); Process[] processes = Process.GetProcessesByName(config.FlashPlayerName); if (processes.Length == 1) { Log("Automatically bound to client."); flashPtr = processes[0].MainWindowHandle; gui?.SetHandle(flashPtr); if (config.AutoConnect) { Start(); } } else if (processes.Length > 1) { Log("Multiple flash players running. Use the /bind command on the client you want to use."); } else { Log("Couldn't find flash player. Use the /bind command in game, then start the bot."); } #region Proxy Hooks proxy.HookCommand("bind", ReceiveCommand); proxy.HookCommand("start", ReceiveCommand); proxy.HookCommand("gui", ReceiveCommand); proxy.HookCommand("famebot", ReceiveCommand); proxy.HookCommand("stop1", ReceiveCommand); proxy.HookCommand("options", ReceiveCommand); proxy.HookPacket(PacketType.RECONNECT, OnReconnect); proxy.HookPacket(PacketType.UPDATE, OnUpdate); proxy.HookPacket(PacketType.NEWTICK, OnNewTick); proxy.HookPacket(PacketType.PLAYERHIT, OnHit); proxy.HookPacket(PacketType.MAPINFO, OnMapInfo); proxy.HookPacket(PacketType.TEXT, OnText); proxy.HookPacket(PacketType.GOTOACK, (client, packet) => { if (blockNextAck) { packet.Send = false; blockNextAck = false; } }); #endregion proxy.ClientConnected += (client) => { connectedClient = client; targets.Clear(); playerPositions.Clear(); enemies.Clear(); obstacles.Clear(); followTarget = false; isInNexus = false; ResetAllKeys(); }; proxy.ClientDisconnected += (client) => { Log("Client disconnected. Waiting a few seconds before trying to press play..."); PressPlay(); }; guiEvent += (evt) => { switch (evt) { case GuiEvent.StartBot: Start(); break; case GuiEvent.StopBot: Stop(); break; case GuiEvent.SettingsChanged: Log("Updated config"); config = ConfigManager.GetConfiguration(); break; } }; sendMessage += (message) => { if (!(connectedClient?.Connected ?? false)) { return; } PlayerTextPacket packet = (PlayerTextPacket)Packet.Create(PacketType.PLAYERTEXT); packet.Text = message; connectedClient.SendToServer(packet); }; proxy.HookPacket(PacketType.FAILURE, (client, packet) => { FailurePacket p = packet as FailurePacket; if (p.ErrorId != 9) { Console.WriteLine("<FAILURE> ID: " + p.ErrorId + " Message: " + p.ErrorMessage); } if (p.ErrorMessage == "{\"key\":\"server.realm_full\"}") { Attempts++; if (Attempts >= 2 && bestName != "") { _bestName = bestName; ReconnectPacket reconnect = (ReconnectPacket)Packet.Create(PacketType.RECONNECT); reconnect.Name = "{\"text\":\"server.realm_of_the_mad_god\"}"; reconnect.Host = ""; reconnect.Stats = ""; reconnect.Port = -1; reconnect.GameId = -3; reconnect.KeyTime = -1; reconnect.IsFromArena = false; reconnect.Key = new byte[0]; connectedClient.SendToClient(reconnect); Attempts = 0; loopingforrealm = true; } } }); proxy.HookPacket(PacketType.CREATESUCCESS, (client, packet) => { target_ = null; if (enabled) { PluginUtils.Delay(200, () => Stop()); PluginUtils.Delay(500, () => Stop()); PluginUtils.Delay(1300, () => Stop()); PluginUtils.Delay(2200, () => Start()); } }); }
// Token: 0x06000232 RID: 562 RVA: 0x0000FDC0 File Offset: 0x0000DFC0 private void HandlePacket(Packet packet) { UpdatePacket updatePacket = packet as UpdatePacket; if (updatePacket != null) { this._objectTracker.Update(updatePacket); this.SafeWalk.Update(updatePacket); this._autoNexus.Update(updatePacket); this._fameHelper.Update(updatePacket); this._accuracyFarm.Update(updatePacket); this._antiLag.Update(updatePacket); this._autoLoot.Update(updatePacket); this._mapHack.Update(updatePacket); this._o3Helper.Update(updatePacket); this._showLHPot.Update(updatePacket); return; } NewTickPacket newTickPacket = packet as NewTickPacket; if (newTickPacket != null) { this._objectTracker.NewTick(newTickPacket); this._antiDebuffs.NewTick(newTickPacket); this._autoNexus.NewTick(newTickPacket); this._antiDdos.NewTick(); this._fameHelper.NewTick(newTickPacket); this._accuracyFarm.NewTick(newTickPacket); this._antiLag.NewTick(newTickPacket); this._o3Helper.NewTick(newTickPacket); this._autoNexus2.NewTick(newTickPacket); return; } MovePacket movePacket = packet as MovePacket; if (movePacket != null) { this.PreviousTime = movePacket._Nx46RcGIU0H1BCGWaJXjN1ieopt; this._objectTracker.move(movePacket); this._antiDebuffs.Move(movePacket); this._autoLoot.Move(movePacket); this.AntiAfk.move(movePacket); this._autoNexus.move(movePacket); this._autoNexus2.move(movePacket); return; } MapInfoPacket mapInfoPacket = packet as MapInfoPacket; if (mapInfoPacket != null) { Console.WriteLine("Client: Map is " + mapInfoPacket.Name); this._objectTracker.MapInfo(mapInfoPacket); this._autoNexus2.MapInfo(mapInfoPacket); this.SafeWalk.MapInfo(mapInfoPacket); this._autoNexus.MapInfo(mapInfoPacket); this._autoLoot.MapInfo(mapInfoPacket); this._fameHelper.MapInfo(); _accuracyFarm.MapInfo(); this._antiLag.MapInfo(mapInfoPacket); this._mapHack.MapInfo(mapInfoPacket); this._o3Helper.MapInfo(mapInfoPacket); this._showLHPot.MapInfo(mapInfoPacket); return; } PlayerTextPacket playerTextPacket = packet as PlayerTextPacket; if (playerTextPacket != null) { this._teleportTools.text(playerTextPacket); this._ipJoin.text(playerTextPacket); this._fameHelper._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket); this._antiLag.PlayerText(playerTextPacket); this._mapHack.text(playerTextPacket); this._autoNexus._QrK9KtR4xguWgEYrBE9xnEwwcqd(playerTextPacket); return; } _5Qyhf9ImNgkDzh4BmaDRKP646iH createSuccessPacket = packet as _5Qyhf9ImNgkDzh4BmaDRKP646iH; if (createSuccessPacket != null) { this.PlayerId = createSuccessPacket.ObjectId; this._objectTracker._1lYB9SyYVs1zUAIHgLGbUs7pmeb(); this._bazaarTimer.CreateSuccess(); this._autoNexus2._1lYB9SyYVs1zUAIHgLGbUs7pmeb(); return; } FailurePacket failurePacket = packet as FailurePacket; if (failurePacket != null) { Console.WriteLine(string.Format("Client: Got failure {0}, {1} ({2})", failurePacket.ErrorId, failurePacket.ErrorMessage, failurePacket.ErrorPlace)); return; } ReconnectPacket reconnectPacket = packet as ReconnectPacket; if (reconnectPacket != null) { this.Reconnect(reconnectPacket); return; } HelloPacket helloPacket = packet as HelloPacket; if (helloPacket != null) { this.Hello(helloPacket); return; } PlayerHitPacket playerHitPacket = packet as PlayerHitPacket; if (playerHitPacket != null) { this._autoNexus.PlayerHit(playerHitPacket); this._antiDebuffs.PlayerHit(playerHitPacket); return; } AoEPacket pqhqze9k9pObME2LmlIcbfEeSYS = packet as AoEPacket; if (pqhqze9k9pObME2LmlIcbfEeSYS != null) { this._autoNexus._M1PxW31jx87SGG4gvOYAwe86vjg(pqhqze9k9pObME2LmlIcbfEeSYS); this._antiDebuffs.AoE(pqhqze9k9pObME2LmlIcbfEeSYS); return; } AoEAckPacket x7UwVkbcYG7VnZWu4HCA8hCeQtS = packet as AoEAckPacket; if (x7UwVkbcYG7VnZWu4HCA8hCeQtS != null) { this._autoNexus._iKqf12lpU2ifSlxUxUegqEC5CVe(x7UwVkbcYG7VnZWu4HCA8hCeQtS); return; } GroundDamagePacket hllcDvAIxPBOvJZP4BFTFQUoryN = packet as GroundDamagePacket; if (hllcDvAIxPBOvJZP4BFTFQUoryN != null) { this._autoNexus._524YRDmz9HCOj575eu5oeD5ruJb(hllcDvAIxPBOvJZP4BFTFQUoryN); return; } _6lHFncsY9352Wg3pNnnFZ49g5xA 6lHFncsY9352Wg3pNnnFZ49g5xA = packet as QuestObjIdPacket; if (6lHFncsY9352Wg3pNnnFZ49g5xA != null) { this._teleportTools._FMTVFcTfzNRteqoB3XiUkaNps7l(6lHFncsY9352Wg3pNnnFZ49g5xA); return; } ShowEffectPacket showEffectPacket = packet as ShowEffectPacket; if (showEffectPacket != null) { this._antiLag.ShowEffect(showEffectPacket); this._autoNexus._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket); this._o3Helper._1nwhQXngJ6rNjd7Ufx1bWeF0vhM(showEffectPacket); return; } _4wU9AwmH67XtmNygsXuDz9DUXYm 4wU9AwmH67XtmNygsXuDz9DUXYm = packet as _4wU9AwmH67XtmNygsXuDz9DUXYm; if (4wU9AwmH67XtmNygsXuDz9DUXYm != null) { this._antiLag._Q1PiJQ99KBCJeLcZ0HOk3AUAjIP(4wU9AwmH67XtmNygsXuDz9DUXYm); return; } PlayerShootPacket fbqBESNaaIBpK5dNK9X5lWOOll = packet as PlayerShootPacket; if (fbqBESNaaIBpK5dNK9X5lWOOll != null) { this._autoNexus2.PlayerShoot(fbqBESNaaIBpK5dNK9X5lWOOll); return; } TextPacket cbwOjnzusZzuPkHfx7wuwePHqrf = packet as TextPacket; if (cbwOjnzusZzuPkHfx7wuwePHqrf != null) { this._antiSpam._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf); this._antiLag.Text(cbwOjnzusZzuPkHfx7wuwePHqrf); this._o3Helper._IDtpCgDjmC1AQOcZCJSFNAYjlbH(cbwOjnzusZzuPkHfx7wuwePHqrf); return; } UseItemPacket lylWoxWrca2h31SiYiDb8gyQP0o = packet as UseItemPacket; if (lylWoxWrca2h31SiYiDb8gyQP0o != null) { this._autoNexus2.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o); this._fameHelper.UseItem(lylWoxWrca2h31SiYiDb8gyQP0o); return; } EnemyShootPacket cbwrHXLbrCktla3qkqXNmNymbvH = packet as EnemyShootPacket; if (cbwrHXLbrCktla3qkqXNmNymbvH != null) { this._objectTracker._Qz49aY7UXgmnBNNMA6Q6IEQtadk(cbwrHXLbrCktla3qkqXNmNymbvH); return; } InvSwapPacket maJp2qic3r54gk5Eg1eeMowxvXh = packet as InvSwapPacket; if (maJp2qic3r54gk5Eg1eeMowxvXh != null) { this._autoLoot.InvSwap(maJp2qic3r54gk5Eg1eeMowxvXh); this._autoNexus._ZHfjECn2B9JJHnVF67eBaO57JUp(maJp2qic3r54gk5Eg1eeMowxvXh); return; } EscapePacket m74ADSrj0VfuNwRBO916gAw0Nu = packet as EscapePacket; if (m74ADSrj0VfuNwRBO916gAw0Nu != null) { this.Escape(m74ADSrj0VfuNwRBO916gAw0Nu); return; } InvitedToGuildPacket tJHGMoVf7DhHyQm8a6SCuL1cSWl = packet as InvitedToGuildPacket; if (tJHGMoVf7DhHyQm8a6SCuL1cSWl != null) { this._antiDdos.Invite(tJHGMoVf7DhHyQm8a6SCuL1cSWl); return; } TeleportPacket rvckmor8bw91EVaRfdwc25aHYbc = packet as TeleportPacket; if (rvckmor8bw91EVaRfdwc25aHYbc != null) { this._fameHelper.Teleport(rvckmor8bw91EVaRfdwc25aHYbc); this._accuracyFarm.Teleport(rvckmor8bw91EVaRfdwc25aHYbc); return; } _6UIiGxMChbVinHsvx5uqg8WrMRc 6UIiGxMChbVinHsvx5uqg8WrMRc = packet as InvResultPacket; if (6UIiGxMChbVinHsvx5uqg8WrMRc != null) { this._autoLoot._yOjSn1WKSXsXVziJpL1eH5gSoWg(6UIiGxMChbVinHsvx5uqg8WrMRc); return; } NotificationPacket zIBPB6zZVww7yGWtjJqRMmACh1q = packet as NotificationPacket; if (zIBPB6zZVww7yGWtjJqRMmACh1q != null) { this._autoNexus._4GSfC8bADOwIwOXLYze8EOUBQxJ(zIBPB6zZVww7yGWtjJqRMmACh1q); return; } AccountListPacket k4pBHmoGRyaE6dWf1FIvL0dcuzKA = packet as AccountListPacket; if (k4pBHmoGRyaE6dWf1FIvL0dcuzKA != null) { this._antiLag.AccountList(k4pBHmoGRyaE6dWf1FIvL0dcuzKA); return; } EditAccountListPacket co7ACSeK1WWaCGAPAqLaov37Wqdb = packet as EditAccountListPacket; if (co7ACSeK1WWaCGAPAqLaov37Wqdb != null) { this._antiLag.EditAccountList(co7ACSeK1WWaCGAPAqLaov37Wqdb); return; } _7k8aOfI7MhNrVnHioUXbsPAxkbm 7k8aOfI7MhNrVnHioUXbsPAxkbm = packet as EnemyHitPacket; if (7k8aOfI7MhNrVnHioUXbsPAxkbm != null) { this._o3Helper._9BgsXisaUbFFlj5HLRd76sERUUX(7k8aOfI7MhNrVnHioUXbsPAxkbm); return; } DeathPacket wOmvsGmaE1PheZ2fPjD9V16UEseb = packet as DeathPacket; if (wOmvsGmaE1PheZ2fPjD9V16UEseb != null) { this._autoNexus._qQsqaOxgCR9yg9ky7erATaKrgCC(wOmvsGmaE1PheZ2fPjD9V16UEseb); return; } }
private void OnFailure(FailurePacket failure) { Log($"Failure: {failure.ErrorDescription}"); }
private void Failure(FailurePacket packet) { Console.WriteLine("FAILURE: ({0}) {1}", packet.ErrorId, packet.ErrorMessage); }
protected override void OnReceive(int size, byte opcode, byte[] packet) { InPacket in_packet = InPacket.Parse((Opcode)opcode, packet); switch ((Opcode)opcode) { case Opcode.FAILURE: if (this.OnFailure != null) { FailurePacket failure = (FailurePacket)in_packet; this.OnFailure(failure.ErrorId, failure.ErrorDescription); } break; case Opcode.CREATE_SUCCESS: if (this.OnCreateSuccess != null) { CreateSuccessPacket create_success = (CreateSuccessPacket)in_packet; this.OnCreateSuccess(create_success.ObjectId, create_success.CharId); } break; case Opcode.TEXT: if (this.OnText != null) { TextPacket text = (TextPacket)in_packet; this.OnText(text.Name, text.ObjectId, text.ObjectType, text.Texture1Id, text.Texture2Id, text.NumStars, text.Recipient, text.Text, text.CleanText); } break; case Opcode.SHOOT: if (this.OnShoot != null) { ShootPacket shoot = (ShootPacket)in_packet; this.OnShoot(shoot.BulletId, shoot.OwnerId, shoot.ContainerType, shoot.StartingPosition, shoot.Angle, shoot.Damage); } break; case Opcode.DAMAGE: if (this.OnDamage != null) { DamagePacket damage = (DamagePacket)in_packet; this.OnDamage(damage.TargetId, damage.ConditionEffect, damage.DamageAmount, damage.BulletId, damage.ObjectId); } break; case Opcode.UPDATE: if (this.OnUpdate != null) { UpdatePacket update = (UpdatePacket)in_packet; this.OnUpdate(update.Tiles, update.NewObjects, update.Drops); } break; case Opcode.NOTIFICATION: if (this.OnNotification != null) { NotificationPacket notification = (NotificationPacket)in_packet; this.OnNotification(notification.ObjectId, notification.Text); } break; case Opcode.NEW_TICK: if (this.OnNewTick != null) { NewTickPacket new_tick = (NewTickPacket)in_packet; this.OnNewTick(new_tick.TickId, new_tick.TickTime, new_tick.Statuses); } break; case Opcode.MAPINFO: if (this.OnMapInfo != null) { MapInfoPacket map_info = (MapInfoPacket)in_packet; this.OnMapInfo(map_info.Width, map_info.Height, map_info.Name, map_info.FP, map_info.Background, map_info.AllowPlayerTeleport, map_info.ShowDisplays, map_info.ExtraXml); } break; } }
public async Task <byte[]> SendRequestAsync(string completionActionVisibleId) { // wait for NPACK (-accepted or -failure) _logger.WriteToLog_detail($"[{completionActionVisibleId}] >> SendRequestAsync() _requestUdpData={MiscProcedures.GetArrayHashCodeString(_requestUdpData)}"); await _engine.OptionallySendUdpRequestAsync_Retransmit_WaitForNeighborPeerAck(completionActionVisibleId + "_first_npack", _requestUdpData, _destinationEndpoint, _sentReqP2pSeq16); // wait for ACK1 OR FAILURE await Task.WhenAny( WaitForAck1Async(completionActionVisibleId + "_ack1"), WaitForFailureAsync(completionActionVisibleId + "_failure") ); if (_pendingAck1Request != null) { _engine.CancelPendingRequest(_pendingAck1Request); _pendingAck1Request = null; } if (_pendingFailureRequest != null) { _engine.CancelPendingRequest(_pendingFailureRequest); _pendingFailureRequest = null; } if (_waitForAck1Completed) { if (Ack1UdpData == null) { ThrowTimeoutException(completionActionVisibleId); } _logger.WriteToLog_detail($"received ACK1"); return(Ack1UdpData); } else if (_waitForFailureCompleted) { if (_failureUdpData == null) { ThrowTimeoutException(completionActionVisibleId); } _logger.WriteToLog_detail($"received FAILURE"); var failure = FailurePacket.DecodeAndOptionallyVerify(_failureUdpData, _sentReqP2pSeq16); if (_failureUdpData != null) { // send NPACK to FAILURE var npAckToFailure = new NeighborPeerAckPacket { ReqP2pSeq16 = _sentReqP2pSeq16, ResponseCode = ResponseOrFailureCode.accepted }; if (_destinationNeighborNullable != null) { npAckToFailure.NeighborToken32 = _destinationNeighborNullable.RemoteNeighborToken32; npAckToFailure.NeighborHMAC = _destinationNeighborNullable.GetNeighborHMAC(w => npAckToFailure.GetSignedFieldsForNeighborHMAC(w, failure.GetSignedFieldsForNeighborHMAC)); } var npAckToFailureUdpData = npAckToFailure.Encode(_destinationNeighborNullable == null); _engine.RespondToRequestAndRetransmissions(_failureUdpData, npAckToFailureUdpData, _destinationEndpoint); } throw new RequestRejectedException(failure.ResponseCode); } else { throw new InvalidOperationException(); } }