public void Submit(string consoleCommand) { var cmd = new CNETMsg_StringCmd(); cmd.command = consoleCommand; connection.SendReliably(DotaGameConnection.ConvertProtoToMessage((uint)NET_Messages.net_StringCmd, cmd)); }
private Event?Process(CNETMsg_StringCmd message) { log.Debug(String.Format("CNETMsg_StringCmd: {0}", message.command)); return(null); }
private Events?Handle(CNETMsg_StringCmd message) { return(null); }
public void Tick() { UpdateEntities(); if (!zoo.Has <GameRules>() || !zoo.Has <PlayerResource>()) { return; } var resource = zoo.GetSingle <PlayerResource>(); if (!ourPlayerId.HasValue) { for (uint i = 0; i < resource.SteamIds.Value.Length; ++i) { if (steamId == resource.SteamIds.Value[i]) { ourPlayerId = i; break; } } } if (ourPlayerId.HasValue && !ourPlayer.HasValue) { ourPlayer = zoo .Get <Player>() .Where((p) => p.PlayerId.Value == ourPlayerId) .SingleOrDefault() .Id; } if (!ourPlayerId.HasValue) { return; } var us = zoo.Get <Player>(ourPlayer.Value); var rules = zoo.GetSingle <GameRules>(); if (rules.GameState.Value == GameState.PICK_BAN && rules.HeroPickState.Value == 1 && !reserved) { foreach (string command in new string[] { "dota_select_hero npc_dota_hero_furion reserve", "dota_select_hero npc_dota_hero_npc_dota_hero_furion" }) { var cmd = new CNETMsg_StringCmd(); cmd.command = command; var message = Connection.ConvertProtoToMessage <CNETMsg_StringCmd>( (uint)NET_Messages.net_StringCmd, cmd); connection.SendReliably(message); } reserved = true; log.Info("Sent Nature's Prophet reserve"); } else if (rules.GameState.Value == GameState.ACTIVE && us.Hero.Value.HasValue && !commanded) { commander.Submit(Order.MakeMouseClick( ImmutableList.Create(us.Hero.Value.Value), new Vector(-6219.188f, -5654.906f, 261.0313f))); commanded = true; log.Info("Made move command"); } else if (rules.GameState.Value == GameState.ACTIVE && us.Hero.Value.HasValue) { if (!lastTick.HasValue || lastTick != resource.TreeStateRadiant.ReadAt) { log.Warn(string.Join( ",", resource.TreeStateRadiant.Value.Select((x) => x.ToString()))); lastTick = resource.TreeStateRadiant.ReadAt.Value; } } }