コード例 #1
0
ファイル: CmdMapInfo.cs プロジェクト: Peteys93/MCGalaxy
        void ShowEnv(Player p, MapInfoData data)
        {
            if (data.TerrainUrl != "")
            {
                Player.SendMessage(p, "Texture: %b" + data.TerrainUrl);
            }
            else
            {
                Player.SendMessage(p, "No custom texture set for this map.");
            }

            if (data.TextureUrl != "")
            {
                Player.SendMessage(p, "Texture pack: %b" + data.TextureUrl);
            }
            else
            {
                Player.SendMessage(p, "No custom texture pack set for this map.");
            }

            const string format = "Colors: Fog {0}, Sky {1}, Clouds {2}, Sunlight {3}, Shadowlight {4}";

            Player.SendMessage(p, String.Format(format, Color(data.Fog), Color(data.Sky), Color(data.Clouds),
                                                Color(data.Light), Color(data.Shadow)));

            Player.SendMessage(p, "Water Level: %b" + data.EdgeLevel + "%S, Clouds height: %b" + data.CloudsHeight
                               + "%S, Max fog distance: %b" + data.MaxFogDistance);
            Player.SendMessage(p, "Edge Block: %b" + data.EdgeBlock + "%S, Horizon Block: %b" + data.HorizonBlock);
        }
コード例 #2
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        public override void Use(Player p, string message, CommandData data)
        {
            string[] args = message.SplitSpaces();
            bool     env  = args[0].CaselessEq("env");
            string   map  = env ? (args.Length > 1 ? args[1] : "") : args[0];

            Level       lvl     = map.Length == 0 ? p.level : null;
            MapInfoData mapData = new MapInfoData();

            if (lvl == null)
            {
                if (!GetFromMap(p, mapData, map))
                {
                    return;
                }
            }
            else
            {
                mapData.FromOnlineLevel(lvl);
            }

            if (env)
            {
                ShowEnv(p, mapData, mapData.Config);
            }
            else
            {
                ShowNormal(p, mapData, mapData.Config);
            }
        }
コード例 #3
0
        private static MapInfoData LoadMapInfoData()
        {
            MapInfoData data;

            //if (File.Exists("Data/MapInfo.data"))
            //{
            //    Stream stream = File.OpenRead("Data/MapInfo.data");
            //    BinaryFormatter formatter = new BinaryFormatter();
            //    data.MapInfos = (List<MapInfo>)formatter.Deserialize(stream);
            //    data.SpawnPoints = (List<SpawnPoint>)formatter.Deserialize(stream);
            //    stream.Close();
            //}
            if (File.Exists("Data/MapInfo.xml"))
            {
                FileStream    stream     = File.Open("Data/MapInfo.xml", FileMode.Open, FileAccess.Read);
                XmlSerializer serializer = new XmlSerializer(typeof(MapInfoData));
                data = (MapInfoData)serializer.Deserialize(stream);
                stream.Close();
            }
            else
            {
                data             = new MapInfoData();
                data.MapInfos    = new List <MapInfo>();
                data.SpawnPoints = new List <SpawnPoint>();
            }

            return(data);
        }
コード例 #4
0
        public override void Use(Player p, string message)
        {
            string[] args = message.Split(' ');
            string   level;
            bool     env = args[0].CaselessEq("env");

            level = env ? (args.Length > 1 ? args[1] : "") : args[0];

            Level       lvl  = level == "" ? p.level : LevelInfo.Find(level);
            MapInfoData data = new MapInfoData();

            if (lvl != null)
            {
                data.FromOnlineLevel(lvl);
            }
            else
            {
                string map = LevelInfo.FindMapMatches(p, level);
                if (map == null)
                {
                    return;
                }
                data.FromOfflineLevel(map);
            }

            if (env)
            {
                ShowEnv(p, data);
            }
            else
            {
                ShowNormal(p, data);
            }
        }
コード例 #5
0
        private string GetMapGauge(dynamic data)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(GeneralRes.MapGauges);

            foreach (dynamic elem in data)
            {
                int         mapID = (int)elem.api_id;
                MapInfoData map   = KCDatabase.Instance.MapInfo[mapID];

                if (map != null)
                {
                    if (map.RequiredDefeatedCount != -1 && elem.api_defeat_count())
                    {
                        sb.AppendFormat("{0}-{1}: " + GeneralRes.Defeated + " {2}/{3} " + GeneralRes.Times + "\r\n", map.MapAreaID, map.MapInfoID, (int)elem.api_defeat_count, map.RequiredDefeatedCount);
                    }
                    else if (elem.api_eventmap())
                    {
                        sb.AppendFormat("{0}-{1} : HP {2}/{3}\r\n", map.MapAreaID, map.MapInfoID, (int)elem.api_eventmap.api_now_maphp, (int)elem.api_eventmap.api_max_maphp);
                    }
                }
            }

            return(sb.ToString());
        }
コード例 #6
0
        void ShowEnv(Player p, MapInfoData data)
        {
            if (data.TerrainUrl != "")
            {
                Player.Message(p, "Texture: %b" + data.TerrainUrl);
            }
            else
            {
                Player.Message(p, "No custom texture set for this map.");
            }

            if (data.TextureUrl != "")
            {
                Player.Message(p, "Texture pack: %b" + data.TextureUrl);
            }
            else
            {
                Player.Message(p, "No custom texture pack set for this map.");
            }

            const string format = "Colors: Fog {0}, Sky {1}, Clouds {2}, Sunlight {3}, Shadowlight {4}";

            Player.Message(p, format, Color(data.Fog), Color(data.Sky), Color(data.Clouds),
                           Color(data.Light), Color(data.Shadow));

            Player.Message(p, "Water level: &b{0}%S, Clouds height: &b{1}%S, Max fog distance: &b{2}",
                           data.EdgeLevel, data.CloudsHeight, data.MaxFog);
            Player.Message(p, "Edge Block: &b{0}%S, Horizon Block: &b{1}", data.EdgeBlock, data.HorizonBlock);
            Player.Message(p, "Clouds speed: &b{0}%%S, Weather speed: &b{1}%",
                           (data.CloudsSpeed / 256f).ToString("F2"),
                           (data.WeatherSpeed / 256f).ToString("F2"));
            Player.Message(p, "Weather fade rate: &b{0}%",
                           (data.WeatherFade / 128).ToString("F2"));
        }
コード例 #7
0
        void ShowPermissions(Player p, MapInfoData data)
        {
            List <string> vWhitelist = data.VisitWhitelist, vBlacklist = data.VisitBlacklist;
            List <string> bWhitelist = data.BuildWhitelist, bBlacklist = data.BuildBlacklist;

            GetBlacklistedPlayers(data.Name, vBlacklist);

            StringBuilder visitPerms = new StringBuilder("  Visitable by ");

            PrintRanks(p, data.visit, data.visitmax, vWhitelist, vBlacklist, visitPerms);
            Player.Message(p, visitPerms.ToString());

            StringBuilder buildPerms = new StringBuilder("  Modifiable by ");

            PrintRanks(p, data.build, data.buildmax, bWhitelist, bBlacklist, buildPerms);
            Player.Message(p, buildPerms.ToString());

            if (String.IsNullOrEmpty(data.RealmOwner))
            {
                data.RealmOwner = GetRealmMapOwner(data.Name);
            }
            if (String.IsNullOrEmpty(data.RealmOwner))
            {
                return;
            }

            string[] owners = data.RealmOwner.Replace(" ", "").Split(',');
            Player.Message(p, "  This map is a personal realm of {0}",
                           owners.Join(n => PlayerInfo.GetColoredName(p, n)));
        }
コード例 #8
0
        private string GetMapGauge(dynamic data)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("[海域ゲージ]");

            foreach (dynamic elem in data)
            {
                int         mapID = (int)elem.api_id;
                MapInfoData map   = KCDatabase.Instance.MapInfo[mapID];

                if (map != null)
                {
                    if (map.RequiredDefeatedCount != -1 && elem.api_defeat_count())
                    {
                        sb.AppendFormat("{0}-{1} : 撃破 {2}/{3} 回\r\n", map.MapAreaID, map.MapInfoID, (int)elem.api_defeat_count, map.RequiredDefeatedCount);
                    }
                    else if (elem.api_eventmap())
                    {
                        string difficulty = "";
                        if (elem.api_eventmap.api_selected_rank())
                        {
                            difficulty = "[" + Constants.GetDifficulty((int)elem.api_eventmap.api_selected_rank) + "] ";
                        }

                        sb.AppendFormat("{0}-{1} {2}: {3} {4}/{5}\r\n",
                                        map.MapAreaID, map.MapInfoID, difficulty,
                                        elem.api_eventmap.api_gauge_type() && (int)elem.api_eventmap.api_gauge_type == 3 ? "TP" : "HP",
                                        (int)elem.api_eventmap.api_now_maphp, (int)elem.api_eventmap.api_max_maphp);
                    }
                }
            }

            return(sb.ToString());
        }
コード例 #9
0
        // UI --------------------------------------------------------------------------------------------------------------------------------------
        #region UI

        private async Task LoadMapInfo()
        {
            string mapName = map;

            if (mapName.Length > 18)
            {
                mapName = mapName.Substring(0, 18) + "...";
            }
            MapsMap.Title = mapName + " [" + EFilter_ToString.toString2(game) + "]";

            // running query and assigning to map information objects
            var mapInfoDatum = await mapsViewModel.GetMapInfo(game, map);

            mapInfoData = mapInfoDatum?.data;
            if (mapInfoData is null)
            {
                return;
            }

            var mapPointsDatum = await mapsViewModel.GetMapPoints(game, map);

            pointsData = mapPointsDatum?.data;
            if (pointsData is null)
            {
                return;
            }

            mapSettings = mapInfoData.MapSettings;
            mappers     = mapInfoData.Mappers;
            mapType     = (EFilter_MapType)int.Parse(mapSettings.maptype);

            // filling in UI and setting zone options
            LayoutGeneralMapInfo();
            LayoutMappers();
            LayoutStats();

            stageCount = int.Parse(mapSettings.cp_count);
            bonusCount = int.Parse(mapSettings.b_count);
            if ((int)mapType == 1)
            {
                stageCount = 0;
            }
            else
            {
                for (int i = 1; i <= stageCount; i++)
                {
                    zonePickerList.Add("S" + i);
                }
            }
            for (int i = 1; i <= bonusCount; i++)
            {
                zonePickerList.Add("B" + i);
            }

            LayoutPoints();
        }
 public void LoadData(Text loadText)
 {
     Debug.Log("Data Loading");
     if (PlayerPrefs.HasKey(loadText.text))
     {
         MapInfoData temp = JsonUtility.FromJson <MapInfoData>(PlayerPrefs.GetString(loadText.text));
         Debug.Log(temp.ToString());
         temp.UnpackToMapInfo(mapInfo);
         renderController.RenderMap();
     }
     Debug.Log("Data Loaded");
 }
 public void SaveData()
 {
     if (saveText.text.Length != 0)
     {
         MapInfoData temp = new MapInfoData(mapInfo);
         Debug.Log(temp.ToString());
         PlayerPrefs.SetString(saveText.text, JsonUtility.ToJson(temp));
         saves.Add(saveText.text);
         Debug.Log(saves.Count);
         PlayerPrefs.SetString(Keys.Data.SAVES_LIST, JsonUtility.ToJson(saves));
     }
     Debug.Log("Data Saved");
 }
コード例 #12
0
 private void UpdateMoneyBox(MapInfoData mapInfo)
 {
     moneyBox         = (long)mapInfo.moneyBox;
     moneyBox        += (long)((Time.time - updateTime) * mapInfo.producePerSecond);
     curGoldText.text = GameUtils.GetCurrencyString(moneyBox);
     if (moneyBox > 100)
     {
         reapBtn.interactable = true;
     }
     else
     {
         reapBtn.interactable = false;
     }
     goldProgress = (float)moneyBox / mapInfo.limit;
 }
コード例 #13
0
        void ShowZombieSurvival(Player p, MapInfoData data, LevelConfig cfg)
        {
            if (!Server.zombie.IsZombieMap(data.Name))
            {
                return;
            }

            string[] authors = cfg.Authors.Replace(" ", "").Split(',');
            Player.Message(p, "Map authors: {0}",
                           authors.Join(n => PlayerInfo.GetColoredName(p, n)));
            int winChance = cfg.RoundsPlayed == 0 ? 100 : (cfg.RoundsHumanWon * 100) / cfg.RoundsPlayed;

            Player.Message(p, "&a{0} %Srounds played total, &a{1}% %Swin chance for humans.",
                           cfg.RoundsPlayed, winChance);
            Player.Message(p, "This map has &a{0} likes %Sand &c{1} dislikes",
                           cfg.Likes, cfg.Dislikes);
        }
コード例 #14
0
        void ShowZombieSurvival(Player p, MapInfoData data)
        {
            if (!Server.zombie.IsZombieMap(data.Name))
            {
                return;
            }

            string[] authors = data.Authors.Replace(" ", "").Split(',');
            Player.Message(p, "Map authors: {0}",
                           authors.Join(n => PlayerInfo.GetColoredName(p, n)));
            int winChance = data.TotalRounds == 0 ? 100 : (data.HumanRounds * 100) / data.TotalRounds;

            Player.Message(p, "&a{0} %Srounds played total, &a{1}% %Swin chance for humans.",
                           data.TotalRounds, winChance);
            Player.Message(p, "This map has &a{0} likes %Sand &c{1} dislikes",
                           data.Likes, data.Dislikes);
        }
コード例 #15
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        void ShowZombieSurvival(Player p, MapInfoData data, LevelConfig cfg)
        {
            if (!ZSGame.Instance.HasMap(data.MapName))
            {
                return;
            }

            string[] authors = cfg.Authors.SplitComma();
            p.Message("Map authors: {0}",
                      authors.Join(n => PlayerInfo.GetColoredName(p, n)));
            int winChance = cfg.RoundsPlayed == 0 ? 100 : (cfg.RoundsHumanWon * 100) / cfg.RoundsPlayed;

            p.Message("&a{0} %Srounds played total, &a{1}% %Swin chance for humans.",
                      cfg.RoundsPlayed, winChance);
            p.Message("This map has &a{0} likes %Sand &c{1} dislikes",
                      cfg.Likes, cfg.Dislikes);
        }
コード例 #16
0
ファイル: CmdMapInfo.cs プロジェクト: Peteys93/MCGalaxy
        void ShowPermissions(Player p, MapInfoData data)
        {
            Player.SendMessage(p, "Build rank = " + Group.findPerm(data.build).ColoredName +
                               " %S: Visit rank = " + Group.findPerm(data.visit).ColoredName);
            Player.SendMessage(p, "BuildMax Rank = " + Group.findPerm(data.buildmax).ColoredName +
                               " %S: VisitMax Rank = " + Group.findPerm(data.visitmax).ColoredName);
            List <string> whitelist = data.VisitWhitelist;
            List <string> blacklist = data.VisitBlacklist;

            GetBlacklistedPlayers(data.Name, blacklist);
            if (whitelist.Count > 0)
            {
                Player.SendMessage(p, "Visit whitelist: &a" + String.Join("%S, &a", whitelist));
            }
            if (blacklist.Count > 0)
            {
                Player.SendMessage(p, "Visit blacklist: &c" + String.Join("%S, &c", blacklist));
            }
        }
コード例 #17
0
        private string GetMapGauge(dynamic data)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("[海域ゲージ]");

            foreach (dynamic elem in data)
            {
                int         mapID = (int)elem.api_id;
                MapInfoData map   = KCDatabase.Instance.MapInfo[mapID];

                if (map != null)
                {
                    if (map.RequiredDefeatedCount != -1 && elem.api_defeat_count())
                    {
                        sb.AppendFormat("{0}-{1} : 撃破 {2}/{3} 回\r\n", map.MapAreaID, map.MapInfoID, (int)elem.api_defeat_count, map.RequiredDefeatedCount);
                    }
                    else if (elem.api_eventmap())
                    {
                        string difficulty = "";
                        if (elem.api_eventmap.api_selected_rank())
                        {
                            switch ((int)elem.api_eventmap.api_selected_rank)
                            {
                            case 1:
                                difficulty = "[丙] "; break;

                            case 2:
                                difficulty = "[乙] "; break;

                            case 3:
                                difficulty = "[甲] "; break;
                            }
                        }

                        sb.AppendFormat("{0}-{1} {2}: HP {3}/{4}\r\n", map.MapAreaID, map.MapInfoID, difficulty, (int)elem.api_eventmap.api_now_maphp, (int)elem.api_eventmap.api_max_maphp);
                    }
                }
            }

            return(sb.ToString());
        }
コード例 #18
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        void ShowNormal(Player p, MapInfoData data, LevelConfig cfg)
        {
            p.Message("&bAbout {0}%S: Width={1} Height={2} Length={3}",
                      cfg.Color + data.Name, data.Width, data.Height, data.Length);

            string physicsState = CmdPhysics.states[cfg.Physics];

            p.Message("  Physics are {0}%S, gun usage is {1}",
                      physicsState, cfg.Guns ? "&aenabled" : "&cdisabled");

            DateTime createTime  = File.GetCreationTimeUtc(LevelInfo.MapPath(data.MapName));
            TimeSpan createDelta = DateTime.UtcNow - createTime;
            string   backupPath  = LevelInfo.BackupBasePath(data.MapName);

            if (Directory.Exists(backupPath))
            {
                int      latest      = LevelInfo.LatestBackup(data.MapName);
                DateTime backupTime  = File.GetCreationTimeUtc(LevelInfo.BackupFilePath(data.MapName, latest.ToString()));
                TimeSpan backupDelta = DateTime.UtcNow - backupTime;
                p.Message("  Created {2} ago, last backup ({1} ago): &a{0}",
                          latest, backupDelta.Shorten(), createDelta.Shorten());
            }
            else
            {
                p.Message("  Created {0} ago, no backups yet", createDelta.Shorten());
            }

            if (data.BlockDBEntries != -1)
            {
                p.Message("  BlockDB (Used for /b) is {0} %Swith {1} entries",
                          cfg.UseBlockDB ? "&aEnabled" : "&cDisabled", data.BlockDBEntries);
            }
            else
            {
                p.Message("  BlockDB (Used for /b) is {0}",
                          cfg.UseBlockDB ? "&aEnabled" : "&cDisabled");
            }

            ShowPermissions(p, data, cfg);
            p.Message("Use %T/mi env {0} %Sto see environment settings.", data.MapName);
            ShowZombieSurvival(p, data, cfg);
        }
コード例 #19
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        bool GetFromMap(Player p, MapInfoData data, string map)
        {
            map = Matcher.FindMaps(p, map);
            if (map == null)
            {
                return(false);
            }

            Level lvl = LevelInfo.FindExact(map);

            if (lvl != null)
            {
                data.FromOnlineLevel(lvl);
            }
            else
            {
                data.FromOfflineLevel(map);
            }
            return(true);
        }
コード例 #20
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        void ShowPermissions(Player p, MapInfoData data, LevelConfig cfg)
        {
            PrintRanks(p, data.Visit, "  Visitable by ");
            PrintRanks(p, data.Build, "  Modifiable by ");

            string realmOwner = cfg.RealmOwner;

            if (String.IsNullOrEmpty(cfg.RealmOwner))
            {
                realmOwner = DefaultRealmOwner(data.MapName);
            }
            if (String.IsNullOrEmpty(realmOwner))
            {
                return;
            }

            string[] owners = realmOwner.SplitComma();
            p.Message("  This map is a personal realm of {0}",
                      owners.Join(n => PlayerInfo.GetColoredName(p, n)));
        }
コード例 #21
0
ファイル: CmdMapInfo.cs プロジェクト: DiresHosting/MCDire
        void ShowEnv(Player p, MapInfoData data, LevelConfig cfg)
        {
            string url = cfg.Terrain.Length > 0 ? cfg.Terrain : ServerConfig.DefaultTerrain;

            if (url.Length > 0)
            {
                p.Message("Terrain: &b" + url);
            }
            else
            {
                p.Message("No custom terrain set for this map.");
            }

            url = cfg.TexturePack.Length > 0 ? cfg.TexturePack : ServerConfig.DefaultTexture;
            if (url.Length > 0)
            {
                p.Message("Texture pack: &b" + url);
            }
            else
            {
                p.Message("No custom texture pack set for this map.");
            }

            const string format = "Colors: &eFog {0}, &eSky {1}, &eClouds {2}, &eSunlight {3}, &eShadowlight {4}";

            p.Message(format, Color(cfg.FogColor), Color(cfg.SkyColor),
                      Color(cfg.CloudColor), Color(cfg.LightColor), Color(cfg.ShadowColor));

            p.Message("Water level: &b{0}%S, Bedrock offset: &b{1}%S, Clouds height: &b{2}%S, Max fog distance: &b{3}",
                      cfg.EdgeLevel, cfg.SidesOffset, cfg.CloudsHeight, cfg.MaxFogDistance);
            p.Message("Edge Block: &b{0}%S, Horizon Block: &b{1}",
                      Block.GetName(p, cfg.EdgeBlock), Block.GetName(p, cfg.HorizonBlock));
            p.Message("Clouds speed: &b{0}%%S, Weather speed: &b{1}%",
                      (cfg.CloudsSpeed / 256f).ToString("F2"),
                      (cfg.WeatherSpeed / 256f).ToString("F2"));
            p.Message("Weather fade rate: &b{0}%%S, Exponential fog: {1}",
                      (cfg.WeatherFade / 128f).ToString("F2"),
                      cfg.ExpFog > 0 ? "&aON" : "&cOFF");
            p.Message("Skybox rotations: Horizontal &b{0}%S, Vertical &b{1}",
                      SkyboxSpeed(cfg.SkyboxHorSpeed), SkyboxSpeed(cfg.SkyboxVerSpeed));
        }
コード例 #22
0
    private void updateMapInfo()
    {
        goldEfect.SetActive(false);
        buyMinerPanel.gameObject.SetActive(false);
        if (user.mapInfo != null)
        {
            updateTime = Time.time;
            MapInfoData mapinfo = user.mapInfo;
            List <UIMiningIslandItem.MiningItemData> list = new List <UIMiningIslandItem.MiningItemData>();
            for (int i = 0; i < mapinfo.islandNames.Length; i++)
            {
                UIMiningIslandItem.MiningItemData itemData = new UIMiningIslandItem.MiningItemData();
                itemData.name       = mapinfo.islandNames[i];
                itemData.onAddMiner = OnAddMinerHandle;
                itemData.islandID   = (i + 1) % (mapinfo.islandNames.Length);
                if (i < mapinfo.mines.Length)
                {
                    itemData.minesData = mapinfo.mines[i];
                }
                list.Add(itemData);
            }
            scrollView.SetData(list);

            scrollView.SetSelected(GetCanBuyMinnerIsland());

            long produce = 0;
            foreach (MinesData md in mapinfo.mines)
            {
                if (md.miner != 0 && md.miner - 1 < md.produces.Length)
                {
                    produce += md.produces[md.miner - 1];
                }
            }

            goldEveryDayText.text = string.Format("{0}/天", GameUtils.GetCurrencyString(produce));
            //curGoldText.text = GameUtils.GetCurrencyString((long)mapinfo.moneyBox);
            allGoldText.text = GameUtils.GetCurrencyString(mapinfo.limit);
            UpdateMoneyBox(mapinfo);
        }
    }
コード例 #23
0
ファイル: CmdMapInfo.cs プロジェクト: Peteys93/MCGalaxy
        public override void Use(Player p, string message)
        {
            string[] args = message.Split(' ');
            string   level;
            bool     env = args[0].CaselessEq("env");

            level = env ? (args.Length > 1 ? args[1] : "") : args[0];
            bool perms = args[0].CaselessEq("perms");

            level = perms ? (args.Length > 1 ? args[1] : "") : args[0];

            Level       lvl  = level == "" ? p.level : LevelInfo.Find(level);
            MapInfoData data = new MapInfoData();

            if (lvl != null)
            {
                data.FromOnlineLevel(lvl);
            }
            else if (LevelInfo.ExistsOffline(level))
            {
                data.FromOfflineLevel(level);
            }
            else
            {
                Player.SendMessage(p, "Could not find specified level."); return;
            }

            if (env)
            {
                ShowEnv(p, data);
            }
            else if (perms)
            {
                ShowPermissions(p, data);
            }
            else
            {
                ShowNormal(p, data);
            }
        }
コード例 #24
0
ファイル: CmdMapInfo.cs プロジェクト: Peteys93/MCGalaxy
        void ShowNormal(Player p, MapInfoData data)
        {
            Player.SendMessage(p, "&b" + data.Name + "%S: Width=" + data.Width + " Height=" + data.Height + " Depth=" + data.Length);
            string physicsState = CmdPhysics.states[data.Physics];

            Player.SendMessage(p, "Physics are " + physicsState + " %Son &b" + data.Name);

            string gunStatus = data.Guns ? "&aonline" : "&coffline";

            if (p == null || p.group.CanExecute("gun"))
            {
                Player.SendMessage(p, "&cGuns &eare " + gunStatus + " &eon " + data.Name + ".");
            }

            if (Directory.Exists(Server.backupLocation + "/" + data.Name))
            {
                int      latestBackup = Directory.GetDirectories(Server.backupLocation + "/" + data.Name).Length;
                DateTime time         = Directory.GetCreationTime(LevelInfo.BackupPath(data.Name, latestBackup.ToString()));
                Player.SendMessage(p, "Latest backup: &a" + latestBackup + " %Sat &a" + time.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else
            {
                Player.SendMessage(p, "No backups for this map exist yet.");
            }
            Player.SendMessage(p, "Use %T/mi env " + data.Name + " %Sto see environment settings.");
            Player.SendMessage(p, "Use %T/mi perms " + data.Name + " %Sto see permission settings.");

            if (!Server.zombie.IsZombieMap(data.Name))
            {
                return;
            }
            Player.SendMessage(p, "Map authors: " + data.Authors);
            int winChance = data.TotalRounds == 0 ? 100 : (data.HumanRounds * 100) / data.TotalRounds;

            Player.SendMessage(p, "&a" + data.TotalRounds + " %Srounds played total, with a &a"
                               + winChance + "% %Swin chance for humans.");
            Player.SendMessage(p, "This map has &a" + data.Likes + " likes %Sand &c" + data.Dislikes + " dislikes");
        }
コード例 #25
0
        private string GetMapGauge(dynamic data)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("[FontChs][ 海域血条 ]");

            var list = data.api_map_info() ? data.api_map_info : data;

            foreach (dynamic elem in list)
            {
                int         mapID = (int)elem.api_id;
                MapInfoData map   = KCDatabase.Instance.MapInfo[mapID];

                if (map != null)
                {
                    if (map.RequiredDefeatedCount != -1 && elem.api_defeat_count())
                    {
                        sb.AppendFormat("{0}-{1} : 击破 {2}/{3} 次\r\n", map.MapAreaID, map.MapInfoID, (int)elem.api_defeat_count, map.RequiredDefeatedCount);
                    }
                    else if (elem.api_eventmap())
                    {
                        string difficulty = "";
                        if (elem.api_eventmap.api_selected_rank())
                        {
                            difficulty = "[" + Constants.GetDifficulty((int)elem.api_eventmap.api_selected_rank, map.MapAreaID) + "] ";
                        }

                        sb.AppendFormat("{0}-{1} {2}: {3}{4} {5}/{6}\r\n",
                                        map.MapAreaID, map.MapInfoID, difficulty,
                                        elem.api_eventmap.api_gauge_num() ? ("#" + (int)elem.api_eventmap.api_gauge_num + " ") : "",
                                        elem.api_eventmap.api_gauge_type() && (int)elem.api_eventmap.api_gauge_type == 3 ? "TP" : "HP",
                                        (int)elem.api_eventmap.api_now_maphp, (int)elem.api_eventmap.api_max_maphp);
                    }
                }
            }

            return(sb.ToString());
        }
コード例 #26
0
        void ShowNormal(Player p, MapInfoData data)
        {
            Player.Message(p, "&bAbout {0}%S: Width={1} Height={2} Length={3}", data.Name, data.Width, data.Height, data.Length);
            string physicsState = CmdPhysics.states[data.Physics];

            if (p == null || p.group.CanExecute("gun"))
            {
                Player.Message(p, "  Physics are {0}%S, gun usage %Sis {1}",
                               physicsState, data.Guns ? "&aenabled" : "&cdisabled");
            }
            else
            {
                Player.Message(p, "  Physics are {0}", physicsState);
            }

            DateTime createTime  = File.GetCreationTimeUtc(LevelInfo.LevelPath(data.Name));
            TimeSpan createDelta = DateTime.UtcNow - createTime;

            if (Directory.Exists(Server.backupLocation + "/" + data.Name))
            {
                int      latest      = Directory.GetDirectories(Server.backupLocation + "/" + data.Name).Length;
                DateTime backupTime  = File.GetCreationTimeUtc(LevelInfo.BackupPath(data.Name, latest.ToString()));
                TimeSpan backupDelta = DateTime.UtcNow - backupTime;
                Player.Message(p, "  Created {2} ago, last backup ({1} ago): &a{0}",
                               latest, backupDelta.Shorten(), createDelta.Shorten());
            }
            else
            {
                Player.Message(p, "  Created {0} ago, no backups yet", createDelta.Shorten());
            }

            Player.Message(p, "  BlockDB (Used for /b) is {0}", data.blockDB ? "&aEnabled" : "&cDisabled");
            ShowPermissions(p, data);
            Player.Message(p, "Use %T/mi env {0} %Sto see environment settings.", data.Name);
            ShowZombieSurvival(p, data);
        }
コード例 #27
0
        public override void OnResponseReceived(dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";


            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (db.MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    db.MasterShips.Add(ship);
                }
                else
                {
                    db.MasterShips[id].LoadFromResponse(APIName, elem);
                }
            }

            //改装関連のデータ設定
            foreach (var ship in db.MasterShips)
            {
                int remodelID = ship.Value.RemodelAfterShipID;
                if (remodelID != 0)
                {
                    db.MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
                }
            }


            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (db.EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    db.EquipmentTypes.Add(eqt);
                }
                else
                {
                    db.EquipmentTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (db.ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    db.ShipTypes.Add(spt);
                }
                else
                {
                    db.ShipTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (db.MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    db.MasterEquipments.Add(eq);
                }
                else
                {
                    db.MasterEquipments[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (db.MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    db.MasterUseItems.Add(item);
                }
                else
                {
                    db.MasterUseItems[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_maparea
            foreach (var elem in data.api_mst_maparea)
            {
                int id = (int)elem.api_id;
                if (db.MapArea[id] == null)
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    db.MapArea.Add(item);
                }
                else
                {
                    db.MapArea[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (db.MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    db.MapInfo.Add(item);
                }
                else
                {
                    db.MapInfo[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (db.Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    db.Mission.Add(item);
                }
                else
                {
                    db.Mission[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_shipupgrade
            Dictionary <int, int> upgradeLevels = new Dictionary <int, int>();

            foreach (var elem in data.api_mst_shipupgrade)
            {
                int idbefore   = (int)elem.api_current_ship_id;
                int idafter    = (int)elem.api_id;
                var shipbefore = db.MasterShips[idbefore];
                var shipafter  = db.MasterShips[idafter];
                int level      = (int)elem.api_upgrade_level;

                if (upgradeLevels.ContainsKey(idafter))
                {
                    if (level < upgradeLevels[idafter])
                    {
                        shipafter.RemodelBeforeShipID = idbefore;
                        upgradeLevels[idafter]        = level;
                    }
                }
                else
                {
                    shipafter.RemodelBeforeShipID = idbefore;
                    upgradeLevels.Add(idafter, level);
                }

                if (shipbefore != null)
                {
                    shipbefore.NeedBlueprint        = (int)elem.api_drawing_count;
                    shipbefore.NeedCatapult         = (int)elem.api_catapult_count;
                    shipbefore.NeedActionReport     = (int)elem.api_report_count;
                    shipbefore.NeedAviationMaterial = (int)elem.api_aviation_mat_count;
                    shipbefore.NeedArmamentMaterial = elem.api_arms_mat_count() ? (int)elem.api_arms_mat_count : 0;
                }
            }


            foreach (var elem in data.api_mst_equip_ship)
            {
                int id = (int)elem.api_ship_id;
                db.MasterShips[id].specialEquippableCategory = (int[])elem.api_equip_type;
            }

            foreach (var elem in data.api_mst_equip_exslot_ship)
            {
                int id = (int)elem.api_slotitem_id;
                db.MasterEquipments[id].equippableShipsAtExpansion = (int[])elem.api_ship_ids;
            }


            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int id = (int)elem.api_id;
                if (db.ShipGraphics[id] == null)
                {
                    var sgd = new ShipGraphicData();
                    sgd.LoadFromResponse(APIName, elem);
                    db.ShipGraphics.Add(sgd);
                }
                else
                {
                    db.ShipGraphics[id].LoadFromResponse(APIName, elem);
                }
            }



            Utility.Logger.Add(2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。");

            base.OnResponseReceived((object)data);
        }
コード例 #28
0
        public override void OnResponseReceived(dynamic data)
        {
            KCDatabase db = KCDatabase.Instance;


            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";


            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (db.MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    db.MasterShips.Add(ship);
                }
                else
                {
                    db.MasterShips[id].LoadFromResponse(APIName, elem);
                }
            }

            //改装関連のデータ設定
            foreach (var ship in db.MasterShips)
            {
                int remodelID = ship.Value.RemodelAfterShipID;
                if (remodelID != 0)
                {
                    db.MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
                }
            }

            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int            id   = (int)elem.api_id;
                ShipDataMaster ship = db.MasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName    = elem.api_filename;
                    ship.ResourceVersion = elem.api_version;
                }
            }


            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (db.EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    db.EquipmentTypes.Add(eqt);
                }
                else
                {
                    db.EquipmentTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (db.ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    db.ShipTypes.Add(spt);
                }
                else
                {
                    db.ShipTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (db.MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    db.MasterEquipments.Add(eq);
                }
                else
                {
                    db.MasterEquipments[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_slotitemgraph

            /*
             * foreach ( var elem in data.api_mst_slotitemgraph ) {
             *
             *      int id = (int)elem.api_id;
             *      EquipmentDataMaster eq = db.MasterEquipments[id];
             *      if ( eq != null ) {
             *              eq.ResourceVersion = elem.api_version;
             *      }
             * }
             */

            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (db.MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    db.MasterUseItems.Add(item);
                }
                else
                {
                    db.MasterUseItems[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (db.MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    db.MapInfo.Add(item);
                }
                else
                {
                    db.MapInfo[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (db.Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    db.Mission.Add(item);
                }
                else
                {
                    db.Mission[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_shipupgrade
            Dictionary <int, int> upgradeLevels = new Dictionary <int, int>();

            foreach (var elem in data.api_mst_shipupgrade)
            {
                int idbefore   = (int)elem.api_current_ship_id;
                int idafter    = (int)elem.api_id;
                var shipbefore = db.MasterShips[idbefore];
                var shipafter  = db.MasterShips[idafter];
                int level      = (int)elem.api_upgrade_level;

                if (upgradeLevels.ContainsKey(idafter))
                {
                    if (level < upgradeLevels[idafter])
                    {
                        shipafter.RemodelBeforeShipID = idbefore;
                        upgradeLevels[idafter]        = level;
                    }
                }
                else
                {
                    shipafter.RemodelBeforeShipID = idbefore;
                    upgradeLevels.Add(idafter, level);
                }

                if (shipbefore != null)
                {
                    shipbefore.NeedBlueprint = (int)elem.api_drawing_count;
                    shipbefore.NeedCatapult  = (int)elem.api_catapult_count;
                }
            }


            Utility.Logger.Add(2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。");

            base.OnResponseReceived((object)data);
        }
コード例 #29
0
 public static void ReloadData()
 {
     _mapInfoData = LoadMapInfoData();
 }
コード例 #30
0
        public override void Use(Player p, string message)
        {
            Level       lvl  = message == "" ? p.level : LevelInfo.Find(message);
            MapInfoData data = new MapInfoData();

            if (lvl != null)
            {
                data.FromOnlineLevel(lvl);
            }
            else if (LevelInfo.ExistsOffline(message))
            {
                data.FromOfflineLevel(message);
            }
            else
            {
                Player.SendMessage(p, "Could not find specified level."); return;
            }

            Player.SendMessage(p, "&b" + data.name + "%S: Width=" + data.Width + " Height=" + data.Height + " Depth=" + data.Length);
            string physicsState = CmdPhysics.states[data.physics];

            Player.SendMessage(p, "Physics are " + physicsState + Server.DefaultColor + " on &b" + data.name);

            Player.SendMessage(p, "Build rank = " + Group.findPerm(data.build).color + Group.findPerm(data.build).trueName +
                               " %S: Visit rank = " + Group.findPerm(data.visit).color + Group.findPerm(data.visit).trueName);

            Player.SendMessage(p, "BuildMax Rank = " + Group.findPerm(data.buildmax).color + Group.findPerm(data.buildmax).trueName +
                               " %S: VisitMax Rank = " + Group.findPerm(data.visitmax).color + Group.findPerm(data.visitmax).trueName);

            string gunStatus = data.guns ? "&aonline" : "&coffline";

            Player.SendMessage(p, "&cGuns &eare " + gunStatus + " &eon " + data.name + ".");

            if (Directory.Exists(Server.backupLocation + "/" + data.name))
            {
                int      latestBackup = Directory.GetDirectories(Server.backupLocation + "/" + data.name).Length;
                DateTime time         = Directory.GetCreationTime(LevelInfo.BackupPath(data.name, latestBackup.ToString()));
                Player.SendMessage(p, "Latest backup: &a" + latestBackup + " %Sat &a" + time.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else
            {
                Player.SendMessage(p, "No backups for this map exist yet.");
            }

            if (data.terrainUrl != "")
            {
                Player.SendMessage(p, "TexturePack: %b" + data.terrainUrl);
            }
            else
            {
                Player.SendMessage(p, "No textures for this map exist yet.");
            }

            const string format = "Colors: Fog {0}, Sky {1}, Clouds {2}, Sunlight {3}, Shadowlight {4}";

            Player.SendMessage(p, String.Format(format, Color(data.Fog), Color(data.Sky), Color(data.Clouds),
                                                Color(data.Light), Color(data.Shadow)));

            Player.SendMessage(p, "Water Level: %b" + data.EdgeLevel + "%S, Clouds height: %b" + data.CloudsHeight
                               + "%S, Max fog distance: %b" + data.MaxFogDistance);
            Player.SendMessage(p, "Edge Block: %b" + data.EdgeBlock + "%S, Horizon Block: %b" + data.HorizonBlock);
        }