internal Map(string json_data) : base(json_data) { Name = GetString("name"); MatchID = GetInt("matchid"); GameTime = GetInt("game_time"); ClockTime = GetInt("clock_time"); IsDaytime = GetBool("daytime"); IsNightstalker_Night = GetBool("nightstalker_night"); GameState = GetEnum <DOTA_GameState>("game_state"); Win_team = GetEnum <PlayerTeam>("win_team"); CustomGameName = GetString("customgamename"); Ward_Purchase_Cooldown = GetInt("ward_purchase_cooldown"); }
internal Map(string json_data) : base(json_data) { Name = GetString("name"); MatchID = GetInt("matchid"); GameTime = GetInt("game_time"); ClockTime = GetInt("clock_time"); IsDaytime = GetBool("daytime"); IsNightstalker_Night = GetBool("nightstalker_night"); GameState = GetEnum<DOTA_GameState>("game_state"); Win_team = GetEnum<PlayerTeam>("win_team"); CustomGameName = GetString("customgamename"); Ward_Purchase_Cooldown = GetInt("ward_purchase_cooldown"); }
internal Map(string json_data) : base(json_data) { Name = GetString("name"); MatchID = GetLong("matchid"); GameTime = GetInt("game_time"); ClockTime = GetInt("clock_time"); IsDaytime = GetBool("daytime"); IsNightstalker_Night = GetBool("nightstalker_night"); GameState = GetEnum <DOTA_GameState>("game_state"); Win_team = GetEnum <PlayerTeam>("win_team"); CustomGameName = GetString("customgamename"); Ward_Purchase_Cooldown = GetInt("ward_purchase_cooldown"); Radiant_Ward_Purchase_Cooldown = GetInt("radiant_ward_purchase_cooldown"); Dire_Ward_Purchase_Cooldown = GetInt("dire_ward_purchase_cooldown"); System.Console.WriteLine(GetString("roshan_state")); RoshanState = GetEnum <RoshanState>("roshan_state"); RoshanStateEndTime = GetInt("roshan_state_end_seconds"); }
/// <summary> /// Called every tick. Must return near-instantly. /// </summary> public void Tick() { if (!_state.EntityPool.Has<GameRules>()) return; var gr = _state.EntityPool.GetSingle<GameRules>(); var gs = gr.GameState.Value; if (gs != oldState) { log.DebugFormat("State {0} => {1}", oldState.ToString("G"), gs.ToString("G")); oldState = gr.GameState.Value; } if (gs >= DOTA_GameState.DOTA_GAMERULES_STATE_HERO_SELECTION && !_hasSentHello) { _hasSentHello = true; Say("Hello, welcome to DOTA!"); log.DebugFormat("Sent message to all chat."); } foreach (var msg in _state.ChatMessages) { log.Debug("[ALLCHAT] " + msg.prefix + ": " + msg.text); if (msg.text.Contains("!pause")) { if (gr.PauseTeam.Value == GameRules.DOTA_ServerTeam.DIRE || gr.PauseTeam.Value == GameRules.DOTA_ServerTeam.RADIANT) { Say("The game is already paused by " + (gr.PauseTeam.Value == GameRules.DOTA_ServerTeam.RADIANT ? "radiant." : "dire.")); } else { Say("Pausing the game by request from " + msg.prefix + "!"); _commander.Submit("dota_pause"); } }else if (msg.text.Contains("!whoami")) { Say("You are "+msg.prefix+"!"); }else if (msg.text.Contains("!time")) { Say("Current game time is "+gr.GameTime.Value+", game started at "+gr.GameStartTime.Value+"."); }else if (msg.text.Contains("!timeofday")) { Say("Time of day is: "+gr.NetTimeOfDay.Value); } } _state.ChatMessages.Clear(); foreach (var msg in _state.ChatEvents) { log.Debug("[CHATEVENT] " + msg.type.ToString("G") + ": " + msg.value); switch (msg.type) { case DOTA_CHAT_MESSAGE.CHAT_MESSAGE_FIRSTBLOOD: Say("Nice firstblood Kappa."); break; case DOTA_CHAT_MESSAGE.CHAT_MESSAGE_RECONNECT: case DOTA_CHAT_MESSAGE.CHAT_MESSAGE_CONNECT: Say("Welcome back "+msg.value+"."); break; case DOTA_CHAT_MESSAGE.CHAT_MESSAGE_HERO_KILL: Say("Wow, that guy is totally feeding."); break; case DOTA_CHAT_MESSAGE.CHAT_MESSAGE_TOWER_KILL: Say("Boom! The tower went down."); break; } } _state.ChatEvents.Clear(); /*foreach (var msg in _state.GameEvents) { log.Debug("[GAMEEVENT] "+msg.eventid); }*/ _state.GameEvents.Clear(); }