Esempio n. 1
0
 void tas_BattleMapChanged(object sender, TasEventArgs e)
 {
     if (config.DisplayMapLink)
     {
         SayBattle("maplink: " + linker.GetMapBounceLink(tas.GetBattle().Map.Name));
     }
 }
Esempio n. 2
0
        private void tas_BattleMapChanged(object sender, TasEventArgs e)
        {
            if (config.DisplayMapLink)
            {
                SayBattle("maplink: " + linker.GetMapBounceLink(tas.GetBattle().Map.Name));
            }
            foreach (UserBattleStatus p in tas.GetBattle().Users)
            {
                //ring all people that host changed the map
                tas.Ring(p.name);
            }
            Battle b       = tas.GetBattle();
            string mapName = b.Map.ArchiveName.ToLower();

            if (MapBoxes.ContainsKey(mapName))
            {
                for (int i = 0; i < b.Rectangles.Count; ++i)
                {
                    tas.RemoveBattleRectangle(i);
                }
                Dictionary <int, BattleRect> dict = MapBoxes[mapName];
                foreach (KeyValuePair <int, BattleRect> v in dict)
                {
                    tas.AddBattleRectangle(v.Key, v.Value);
                }
            }
        }
Esempio n. 3
0
        private void tas_BattleMapChanged(object sender, TasEventArgs e)
        {
            if (config.DisplayMapLink)
            {
                SayBattle("maplink: " + linker.GetMapBounceLink(tas.GetBattle().Map.Name));
            }

            var    b       = tas.GetBattle();
            string mapName = b.Map.ArchiveName.ToLower();

            if (MapBoxes.ContainsKey(mapName))
            {
                for (int i = 0; i < b.Rectangles.Count; ++i)
                {
                    tas.RemoveBattleRectangle(i);
                }
                var dict = MapBoxes[mapName];
                foreach (var v in dict)
                {
                    tas.AddBattleRectangle(v.Key, v.Value);
                }
            }


            if (Program.main.config.PlanetWarsEnabled)
            {
                try {
                    var pw = Program.main.PlanetWars;

                    string name    = tas.GetBattle().Map.Name;
                    var    mapInfo = pw.GetAttackOptions().Find(m => m.MapName == name);
                    if (mapInfo.StartBoxes != null && mapInfo.StartBoxes.Count > 0)
                    {
                        int rectangles = tas.GetBattle().Rectangles.Count;
                        for (int i = 0; i < rectangles; ++i)
                        {
                            tas.RemoveBattleRectangle(i);
                        }
                        for (int i = 0; i < mapInfo.StartBoxes.Count; ++i)
                        {
                            var mi = mapInfo.StartBoxes[i];
                            tas.AddBattleRectangle(i, new BattleRect(mi.Left, mi.Top, mi.Right, mi.Bottom));
                        }
                    }

                    foreach (var command in mapInfo.AutohostCommands)
                    {
                        tas.Say(TasClient.SayPlace.Channel, tas.UserName, command, false);
                    }

                    SayBattle("Planet changed succesfully!");

                    var notifyList = pw.GetPlayersToNotify(name);
                    notifyList.ForEach(userName => tas.Say(TasClient.SayPlace.User, userName, string.Format("Your planet {0} is under attack! Come defend it!", mapInfo.Name), false));
                } catch (Exception ex) {
                    SayBattle(string.Format("Error setting planet starting boxes: {0}", ex.Message));
                }
            }
        }