private void OnGameEvent(GameEventEventArgs e) { try { var gameEvent = e.GameEvent; switch (gameEvent.Name) { case "dota_player_kill": case "dota_player_deny": { var id = gameEvent.GetInt32("victim_userid"); var handle = EntityManager.GetPlayerById(id)?.Hero?.Handle; var unit = (Hero9)EntityManager9.GetUnitFast(handle); if (unit == null || unit.Team == this.allyTeam) { break; } unit.BaseIsAlive = false; if (unit.IsVisible) { var delay = (int)(((unit.BaseHero.RespawnTime - GameManager.RawGameTime) + 0.5f) * 1000); if (delay <= 0) { break; } UpdateManager.BeginInvoke(delay, () => RespawnUnit(unit)); } } break; case "dota_buyback": { var id = gameEvent.GetInt32("player_id"); var handle = EntityManager.GetPlayerById(id)?.Hero?.Handle; var unit = EntityManager9.GetUnitFast(handle); if (unit == null || unit.Team == this.allyTeam) { break; } unit.BaseIsAlive = true; unit.BaseHealth = unit.MaximumHealth; unit.BaseMana = unit.MaximumMana; } break; } } catch (Exception ex) { Logger.Error(ex); } }
private void OnGameEvent(GameEventEventArgs args) { if (args.GameEvent.Name != "dota_player_shop_changed") { return; } this.OnUpdate(); }
private bool IsValid(GameEventEventArgs e) { if (this.ignoreUseless && this.ignored.Contains(e.GameEvent.Name)) { return(false); } return(true); }
private void GameOnGameEvent(GameEventEventArgs e) { if (!this.IsValid(e)) { return; } var item = new LogItem(LogType.GameEvent, Color.Yellow, "Game event"); item.AddLine("Name: " + e.GameEvent.Name, e.GameEvent.Name); this.log.Display(item); }
private void OnGameEvent(GameEventEventArgs e) { if (e.GameEvent.Name != "dota_roshan_kill") { return; } try { this.AegisSteal(null); } catch (Exception ex) { Logger.Error(ex); } }
private void OnGameEvent(GameEventEventArgs e) { var name = e.GameEvent.Name; if (name == "dota_roshan_kill") { RoshanDead = true; return; } if (RoshanMenu.PanelItem && RoshanMenu.AegisItem && name == "aegis_event") { AegisTime = GameManager.GameTime; AegisEvent = true; return; } }
private void OnGameEvent(GameEventEventArgs e) { var gameEvent = e.GameEvent; if (gameEvent.Name != "dota_buyback") { return; } try { var id = gameEvent.GetInt32("player_id"); this.units[id]?.BuybackSleeper.Sleep(GameData.BuybackCooldown); } catch (Exception ex) { Logger.Error(ex); } }
private void GameOnGameEvent(GameEventEventArgs e) { if (e.GameEvent.Name != "dota_player_update_selected_unit" && e.GameEvent.Name != "dota_player_update_query_unit") { return; } var unit = (this.player.QueryUnit ?? this.player.SelectedUnits.FirstOrDefault()) as Unit; if (unit?.IsValid != true) { return; } if (unit.Handle == this.lastUnitInfo) { return; } this.InformationOnPropertyChanged(null, null); }
private async void Engine_GameEvent(object sender, GameEventEventArgs e) { if (this.m_eventsToIgnore.Contains(e.Event)) { return; } switch (e.Event) { case GameEvent.switch_team: case GameEvent.teamchange_pending: case GameEvent.player_spawn: case GameEvent.player_spawned: case GameEvent.player_team: case GameEvent.player_death: case GameEvent.player_disconnect: case GameEvent.player_connect: await this.m_PluginHub.SetPlayers(await this.Engine.GetPlayers()); break; } await this.m_PluginHub.RaiseEvent(e.ToData()); }
private void GameManagerGameEvent(GameEventEventArgs e) { var gameEvent = e.GameEvent; if (gameEvent.Name == "entity_hurt") { Console.WriteLine(gameEvent.GetSingle("damage")); } /*Console.WriteLine(e.Name); * * foreach (var item in e.KeyValue.KeyValues) * { * Console.WriteLine(item.Name + " " + item.GetUInt64()); * } * * Console.WriteLine(EntityManager.LocalHero.Index); * * * Console.WriteLine();*/ }