/// <summary>
 /// Will retrieve all the available zones
 /// </summary>
 /// <returns></returns>
 public static List <Zone> GetAvailableZones()
 {
     //return ZoneHelper.GetLocalZones();
     return(ZoneHelper.GetAvailableZone());
 }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 1 && command.Length != 2)
            {
                UnturnedChat.Say(caller, $"Use /{Name} {Syntax}", Color.yellow);
                return;
            }

            var paycheckIndex = 0;
            var zones         = PaycheckPlugin.Config.PaycheckZones;

            if (command.Length == 2)
            {
                var paycheck = PaycheckHelper.FindBestMatchIndex(command[0]);
                if (paycheck == null)
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_paycheck_not_found", command[0]), Color.yellow);
                    return;
                }
                paycheckIndex = paycheck.Value;
                zones         = PaycheckPlugin.Config.Paychecks[paycheckIndex].PaycheckZones;
            }

            if (zones.Count == 0)
            {
                UnturnedChat.Say(caller,
                                 command.Length == 0
                                                ? PaycheckPlugin.Instance.Translate("command_default_no_zones")
                                                : PaycheckPlugin.Instance.Translate("command_paycheck_no_zones", PaycheckPlugin.Config.Paychecks[paycheckIndex].Name), Color.yellow);
                return;
            }

            if (!int.TryParse(command[command.Length - 1], out var index))
            {
                var bestMatchIndex = ZoneHelper.FindBestMatchIndex(zones, command[command.Length - 1]);
                if (bestMatchIndex != null)
                {
                    index = bestMatchIndex.Value;
                }
                else
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_delete_zone_no_parse"), Color.yellow);
                    return;
                }
            }
            else
            {
                index--;
                if (index >= zones.Count || index < 0)
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_invalid_out_of_bounds", index + 1, 1, zones.Count), Color.yellow);
                    return;
                }
            }

            // ReSharper disable once ConvertIfStatementToSwitchStatement
            if (command.Length == 1)
            {
                UnturnedChat.Say(caller,
                                 PaycheckPlugin.Instance.Translate("command_removed_zone_default",
                                                                   ZoneHelper.GetLocationString(PaycheckPlugin.Config.PaycheckZones[index])),
                                 Color.magenta);
                PaycheckPlugin.Config.PaycheckZones.RemoveAt(index);
            }
            else if (command.Length == 2)
            {
                UnturnedChat.Say(caller,
                                 PaycheckPlugin.Instance.Translate("command_removed_zone_paycheck",
                                                                   PaycheckPlugin.Config.Paychecks[paycheckIndex].Name,
                                                                   ZoneHelper.GetLocationString(PaycheckPlugin.Config.Paychecks[paycheckIndex].PaycheckZones[index])),
                                 Color.magenta);
                PaycheckPlugin.Config.Paychecks[paycheckIndex].PaycheckZones.RemoveAt(index);
            }
            PaycheckPlugin.Config.IsDirty = true;
        }
Пример #3
0
        public void GivenThePlayerIsInANorthToSouthHallway()
        {
            const string mapType = "North to South Hallway";

            ScenarioContext.Current.Add(string.Format("{0} map", mapType), ZoneHelper.BuildMapFromMapType(mapType));
        }
Пример #4
0
        public void GivenIHaveAZone(string mapType)
        {
            var zone = ZoneHelper.BuildMapFromMapType(mapType);

            ScenarioContext.Current.Add(string.Format("{0} map", mapType), zone);
        }
 private static void DeleteZone(Zone zone)
 {
     File.Delete(zone.Path);
     File.Delete(ZoneHelper.GetMetaNameFromZone(zone, false));
     File.Delete(ZoneHelper.GetImagePathFromZone(zone, false));
 }
        public async Task <Zone> GetZoneByPoint(Location point)
        {
            var zones = await GetAllZonesAsync();

            return(zones.FirstOrDefault(z => ZoneHelper.IsPointInside(point, z)));
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 2 && command.Length != 3 && command.Length != 4)
            {
                UnturnedChat.Say(caller, $"Use /{Name} {Syntax}", Color.yellow);
                return;
            }

            if (!float.TryParse(command[command.Length - 1], out var multiplier))
            {
                UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_parse_multiplier", command[command.Length - 1]), Color.yellow);
                return;
            }

            if (!float.TryParse(command[command.Length - 2], out var radius))
            {
                UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_parse_radius", command[command.Length - 2]), Color.yellow);
                return;
            }

            // ReSharper disable once ConvertIfStatementToSwitchStatement
            if (command.Length == 2)
            {
                if (caller.Id == "Console")
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_console"), Color.yellow);
                    return;
                }
                var zone = new PaycheckZone(Vector3Helper.Round(((UnturnedPlayer)caller).Position), radius, multiplier);
                PaycheckPlugin.Config.PaycheckZones.Add(zone);
                UnturnedChat.Say(caller,
                                 PaycheckPlugin.Instance.Translate("command_created_zone_default",
                                                                   ZoneHelper.GetLocationString(zone),
                                                                   zone.Multiplier + "x",
                                                                   zone.Radius),
                                 Color.cyan);
            }
            else if (command.Length == 3)
            {
                var paycheckIndex = PaycheckHelper.FindBestMatchIndex(command[0]);
                if (paycheckIndex != null)
                {
                    if (caller.Id == "Console")
                    {
                        UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_console"), Color.yellow);
                        return;
                    }
                    var zone = new PaycheckZone(Vector3Helper.Round(((UnturnedPlayer)caller).Position), radius, multiplier);
                    PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].PaycheckZones.Add(zone);
                    UnturnedChat.Say(caller,
                                     PaycheckPlugin.Instance.Translate("command_created_zone_paycheck",
                                                                       PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].Name,
                                                                       ZoneHelper.GetLocationString(zone),
                                                                       zone.Multiplier + "x",
                                                                       zone.Radius),
                                     Color.cyan);
                }
                else
                {
                    var pointResult = Vector3Helper.Parse(command[0]);
                    if (pointResult != null)
                    {
                        var zone = new PaycheckZone(Vector3Helper.Round(pointResult.Value), radius, multiplier);
                        PaycheckPlugin.Config.PaycheckZones.Add(zone);
                        UnturnedChat.Say(caller,
                                         PaycheckPlugin.Instance.Translate("command_created_zone_default",
                                                                           ZoneHelper.GetLocationString(zone),
                                                                           zone.Multiplier + "x",
                                                                           zone.Radius),
                                         Color.cyan);
                    }
                    else if (NodeHelper.Exists(command[0]))
                    {
                        var zone = new PaycheckZone(command[0], radius, multiplier);
                        PaycheckPlugin.Config.PaycheckZones.Add(zone);
                        UnturnedChat.Say(caller,
                                         PaycheckPlugin.Instance.Translate("command_created_zone_default",
                                                                           ZoneHelper.GetLocationString(zone),
                                                                           zone.Multiplier + "x",
                                                                           zone.Radius),
                                         Color.cyan);
                    }
                    else
                    {
                        UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_parse_paycheck_or_location", command[0]), Color.yellow);
                        return;
                    }
                }
            }
            else if (command.Length == 4)
            {
                var paycheckIndex = PaycheckHelper.FindBestMatchIndex(command[0]);
                if (paycheckIndex == null)
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_created_zone_paycheck", command[0]), Color.yellow);
                    return;
                }
                var pointResult = Vector3Helper.Parse(command[1]);
                if (pointResult != null)
                {
                    var zone = new PaycheckZone(Vector3Helper.Round(pointResult.Value), radius, multiplier);
                    PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].PaycheckZones.Add(zone);
                    UnturnedChat.Say(caller,
                                     PaycheckPlugin.Instance.Translate("command_created_zone_paycheck",
                                                                       PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].Name,
                                                                       ZoneHelper.GetLocationString(zone),
                                                                       zone.Multiplier + "x",
                                                                       zone.Radius),
                                     Color.cyan);
                }
                else if (NodeHelper.Exists(command[1]))
                {
                    var zone = new PaycheckZone(command[1], radius, multiplier);
                    PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].PaycheckZones.Add(zone);
                    UnturnedChat.Say(caller,
                                     PaycheckPlugin.Instance.Translate("command_created_zone_paycheck",
                                                                       PaycheckPlugin.Config.Paychecks[paycheckIndex.Value].Name,
                                                                       ZoneHelper.GetLocationString(zone),
                                                                       zone.Multiplier + "x",
                                                                       zone.Radius),
                                     Color.cyan);
                }
                else
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_no_parse_location", command[1]), Color.yellow);
                    return;
                }
            }
            PaycheckPlugin.Config.IsDirty = true;
        }
Пример #8
0
        private void InitializeHistory()
        {
            var hasDamage      = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
            var hasHealing     = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
            var hasDamageTaken = ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

            if (hasDamage || hasHealing || hasDamageTaken)
            {
                var currentOverallStats = ParseControl.Timeline.Overall.Stats;
                var historyItem         = new ParseHistoryItem();
                var historyController   = historyItem.HistoryControl = new HistoryControl();
                foreach (var stat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Name, stat.Value);
                }
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDPS", currentOverallStats.GetStatValue("DPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDOTPS", currentOverallStats.GetStatValue("DOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHPS", currentOverallStats.GetStatValue("HPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOHPS", currentOverallStats.GetStatValue("HOHPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOTPS", currentOverallStats.GetStatValue("HOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHMPS", currentOverallStats.GetStatValue("HMPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTPS", currentOverallStats.GetStatValue("DTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTOTPS", currentOverallStats.GetStatValue("DTOTPS"));
                var playerList = ParseControl.Timeline.Party.ToArray();
                foreach (var player in playerList)
                {
                    var playerInstance = historyController.Timeline.GetSetPlayer(player.Name);
                    playerInstance.Last20DamageActions      = ((Player)player).Last20DamageActions.ToList();
                    playerInstance.Last20DamageTakenActions = ((Player)player).Last20DamageTakenActions.ToList();
                    playerInstance.Last20HealingActions     = ((Player)player).Last20HealingActions.ToList();
                    foreach (var stat in player.Stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }
                    RabbitHoleCopy(ref playerInstance, player);
                }
                var monsterList = ParseControl.Timeline.Monster.ToArray();
                foreach (var monster in monsterList)
                {
                    var monsterInstance = historyController.Timeline.GetSetMonster(monster.Name);
                    monsterInstance.Last20DamageActions      = ((Monster)monster).Last20DamageActions.ToList();
                    monsterInstance.Last20DamageTakenActions = ((Monster)monster).Last20DamageTakenActions.ToList();
                    monsterInstance.Last20HealingActions     = ((Monster)monster).Last20HealingActions.ToList();
                    foreach (var stat in monster.Stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }
                    RabbitHoleCopy(ref monsterInstance, monster);
                }
                historyItem.Start       = ParseControl.StartTime;
                historyItem.End         = DateTime.Now;
                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = String.Format("{0} -> {1} [{2}]", historyItem.Start, historyItem.End, historyItem.ParseLength);
                var zone             = "Unknown";
                if (PCWorkerDelegate.CurrentUser != null)
                {
                    var mapIndex = PCWorkerDelegate.CurrentUser.MapIndex;
                    zone = ZoneHelper.GetMapInfo(mapIndex)
                           .English;
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .French;
                        break;

                    case "German":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .German;
                        break;

                    case "Japanese":
                        zone = ZoneHelper.GetMapInfo(mapIndex)
                               .Japanese;
                        break;
                    }
                }
                var monsterName = "NULL";
                try
                {
                    StatGroup biggestMonster = null;
                    foreach (var monster in ParseControl.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }
                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex)
                {
                }
                foreach (var oStat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(oStat.Name, oStat.Value);
                }
                historyItem.Name = String.Format("{0} [{1}] {2}", zone, monsterName, parseTimeDetails);
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }
        }
Пример #9
0
        private void ConnectRooms()
        {
            zone.RecursivelySetZone();

            ZoneHelper.ConnectZone(zone.Rooms[1], Direction.West, 13, 108);
            //ZoneHelper.ConnectZone(zone.Rooms[47], Direction.North, x, x);

            ZoneHelper.ConnectRoom(zone.Rooms[1], Direction.East, zone.Rooms[2]);
            ZoneHelper.ConnectRoom(zone.Rooms[2], Direction.East, zone.Rooms[3]);
            ZoneHelper.ConnectRoom(zone.Rooms[3], Direction.East, zone.Rooms[4]);
            ZoneHelper.ConnectRoom(zone.Rooms[4], Direction.East, zone.Rooms[5]);
            ZoneHelper.ConnectRoom(zone.Rooms[5], Direction.East, zone.Rooms[6]);

            ZoneHelper.ConnectRoom(zone.Rooms[3], Direction.North, zone.Rooms[7]);
            ZoneHelper.ConnectRoom(zone.Rooms[4], Direction.South, zone.Rooms[8]);
            ZoneHelper.ConnectRoom(zone.Rooms[8], Direction.South, zone.Rooms[9]);
            ZoneHelper.ConnectRoom(zone.Rooms[9], Direction.South, zone.Rooms[10]);

            #region Cavern
            #region Correct Path
            ZoneHelper.ConnectRoom(zone.Rooms[10], Direction.South, zone.Rooms[11]);
            ZoneHelper.ConnectRoom(zone.Rooms[11], Direction.East, zone.Rooms[12]);
            ZoneHelper.ConnectRoom(zone.Rooms[12], Direction.East, zone.Rooms[13]);
            ZoneHelper.ConnectRoom(zone.Rooms[13], Direction.East, zone.Rooms[14]);
            ZoneHelper.ConnectRoom(zone.Rooms[14], Direction.East, zone.Rooms[15]);
            ZoneHelper.ConnectRoom(zone.Rooms[15], Direction.Up, zone.Rooms[16]);
            ZoneHelper.ConnectRoom(zone.Rooms[16], Direction.Up, zone.Rooms[17]);
            ZoneHelper.ConnectRoom(zone.Rooms[17], Direction.West, zone.Rooms[18]);
            ZoneHelper.ConnectRoom(zone.Rooms[18], Direction.West, zone.Rooms[19]);
            ZoneHelper.ConnectRoom(zone.Rooms[19], Direction.West, zone.Rooms[20]);
            ZoneHelper.ConnectRoom(zone.Rooms[20], Direction.North, zone.Rooms[21]);
            ZoneHelper.ConnectRoom(zone.Rooms[21], Direction.Down, zone.Rooms[22]);
            ZoneHelper.ConnectRoom(zone.Rooms[22], Direction.South, zone.Rooms[23]);
            ZoneHelper.ConnectRoom(zone.Rooms[23], Direction.South, zone.Rooms[24]);
            ZoneHelper.ConnectRoom(zone.Rooms[24], Direction.East, zone.Rooms[25]);
            ZoneHelper.ConnectRoom(zone.Rooms[25], Direction.Up, zone.Rooms[26]);
            ZoneHelper.ConnectRoom(zone.Rooms[26], Direction.East, zone.Rooms[27]);
            ZoneHelper.ConnectRoom(zone.Rooms[27], Direction.Up, zone.Rooms[28]);
            ZoneHelper.ConnectRoom(zone.Rooms[28], Direction.West, zone.Rooms[29]);
            ZoneHelper.ConnectRoom(zone.Rooms[29], Direction.West, zone.Rooms[30]);
            ZoneHelper.ConnectRoom(zone.Rooms[30], Direction.South, zone.Rooms[31]);
            ZoneHelper.ConnectRoom(zone.Rooms[31], Direction.South, zone.Rooms[32]);
            ZoneHelper.ConnectRoom(zone.Rooms[32], Direction.Up, zone.Rooms[33]);
            ZoneHelper.ConnectRoom(zone.Rooms[33], Direction.East, zone.Rooms[34]);
            ZoneHelper.ConnectRoom(zone.Rooms[34], Direction.East, zone.Rooms[35]);
            ZoneHelper.ConnectRoom(zone.Rooms[35], Direction.East, zone.Rooms[36]);
            ZoneHelper.ConnectRoom(zone.Rooms[36], Direction.Down, zone.Rooms[37]);
            ZoneHelper.ConnectRoom(zone.Rooms[37], Direction.North, zone.Rooms[38]);
            ZoneHelper.ConnectRoom(zone.Rooms[38], Direction.North, zone.Rooms[39]);
            ZoneHelper.ConnectRoom(zone.Rooms[39], Direction.North, zone.Rooms[40]);
            ZoneHelper.ConnectRoom(zone.Rooms[40], Direction.North, zone.Rooms[41]);
            ZoneHelper.ConnectRoom(zone.Rooms[41], Direction.Up, zone.Rooms[42]);
            ZoneHelper.ConnectRoom(zone.Rooms[42], Direction.South, zone.Rooms[43]);
            ZoneHelper.ConnectRoom(zone.Rooms[43], Direction.West, zone.Rooms[44]);
            ZoneHelper.ConnectRoom(zone.Rooms[44], Direction.Down, zone.Rooms[45]);
            ZoneHelper.ConnectRoom(zone.Rooms[45], Direction.North, zone.Rooms[46]);
            ZoneHelper.ConnectRoom(zone.Rooms[46], Direction.Down, zone.Rooms[47]);
            #endregion Correct Path

            ZoneHelper.ConnectRoom(zone.Rooms[12], Direction.South, zone.Rooms[48]);
            ZoneHelper.ConnectRoom(zone.Rooms[48], Direction.South, zone.Rooms[49]);
            ZoneHelper.ConnectRoom(zone.Rooms[49], Direction.Up, zone.Rooms[50]);
            ZoneHelper.ConnectRoom(zone.Rooms[50], Direction.South, zone.Rooms[51]);
            ZoneHelper.ConnectRoom(zone.Rooms[51], Direction.East, zone.Rooms[52]);
            ZoneHelper.ConnectRoom(zone.Rooms[52], Direction.East, zone.Rooms[53]);
            ZoneHelper.ConnectRoom(zone.Rooms[53], Direction.Down, zone.Rooms[54]);
            ZoneHelper.ConnectRoom(zone.Rooms[54], Direction.North, zone.Rooms[55]);
            ZoneHelper.ConnectRoom(zone.Rooms[55], Direction.North, zone.Rooms[56]);
            ZoneHelper.ConnectRoom(zone.Rooms[56], Direction.North, zone.Rooms[14]);

            ZoneHelper.ConnectRoom(zone.Rooms[51], Direction.West, zone.Rooms[57]);
            ZoneHelper.ConnectRoom(zone.Rooms[57], Direction.North, zone.Rooms[58]);
            ZoneHelper.ConnectRoom(zone.Rooms[58], Direction.Down, zone.Rooms[59]);
            ZoneHelper.ConnectRoom(zone.Rooms[59], Direction.North, zone.Rooms[60]);

            ZoneHelper.ConnectRoom(zone.Rooms[56], Direction.Up, zone.Rooms[61]);
            ZoneHelper.ConnectRoom(zone.Rooms[61], Direction.South, zone.Rooms[62]);
            ZoneHelper.ConnectRoom(zone.Rooms[62], Direction.Up, zone.Rooms[63]);
            ZoneHelper.ConnectRoom(zone.Rooms[63], Direction.Up, zone.Rooms[64]);
            ZoneHelper.ConnectRoom(zone.Rooms[64], Direction.Up, zone.Rooms[65]);
            ZoneHelper.ConnectRoom(zone.Rooms[65], Direction.West, zone.Rooms[66]);
            ZoneHelper.ConnectRoom(zone.Rooms[66], Direction.West, zone.Rooms[67]);
            ZoneHelper.ConnectRoom(zone.Rooms[67], Direction.North, zone.Rooms[68]);
            ZoneHelper.ConnectRoom(zone.Rooms[68], Direction.North, zone.Rooms[69]);
            ZoneHelper.ConnectRoom(zone.Rooms[69], Direction.Down, zone.Rooms[70]);
            ZoneHelper.ConnectRoom(zone.Rooms[70], Direction.North, zone.Rooms[71]);
            ZoneHelper.ConnectRoom(zone.Rooms[71], Direction.West, zone.Rooms[72]);
            ZoneHelper.ConnectRoom(zone.Rooms[72], Direction.Down, zone.Rooms[73]);
            ZoneHelper.ConnectRoom(zone.Rooms[73], Direction.South, zone.Rooms[74]);
            ZoneHelper.ConnectRoom(zone.Rooms[74], Direction.South, zone.Rooms[75]);
            ZoneHelper.ConnectRoom(zone.Rooms[75], Direction.South, zone.Rooms[76]);
            ZoneHelper.ConnectRoom(zone.Rooms[76], Direction.South, zone.Rooms[77]);
            ZoneHelper.ConnectRoom(zone.Rooms[77], Direction.Up, zone.Rooms[78]);
            ZoneHelper.ConnectRoom(zone.Rooms[78], Direction.North, zone.Rooms[79]);

            ZoneHelper.ConnectRoom(zone.Rooms[77], Direction.East, zone.Rooms[80]);
            ZoneHelper.ConnectRoom(zone.Rooms[80], Direction.East, zone.Rooms[81]);
            ZoneHelper.ConnectRoom(zone.Rooms[81], Direction.Up, zone.Rooms[82]);
            ZoneHelper.ConnectRoom(zone.Rooms[82], Direction.North, zone.Rooms[83]);
            ZoneHelper.ConnectRoom(zone.Rooms[83], Direction.Down, zone.Rooms[84]);
            ZoneHelper.ConnectRoom(zone.Rooms[84], Direction.Down, zone.Rooms[85]);
            ZoneHelper.ConnectRoom(zone.Rooms[85], Direction.Down, zone.Rooms[86]);
            ZoneHelper.ConnectRoom(zone.Rooms[86], Direction.North, zone.Rooms[87]);

            ZoneHelper.ConnectRoom(zone.Rooms[69], Direction.East, zone.Rooms[88]);
            ZoneHelper.ConnectRoom(zone.Rooms[88], Direction.North, zone.Rooms[89]);
            ZoneHelper.ConnectRoom(zone.Rooms[89], Direction.Down, zone.Rooms[90]);
            ZoneHelper.ConnectRoom(zone.Rooms[90], Direction.Down, zone.Rooms[91]);
            ZoneHelper.ConnectRoom(zone.Rooms[91], Direction.Down, zone.Rooms[92]);
            ZoneHelper.ConnectRoom(zone.Rooms[92], Direction.South, zone.Rooms[93]);
            ZoneHelper.ConnectRoom(zone.Rooms[93], Direction.East, zone.Rooms[94]);
            ZoneHelper.ConnectRoom(zone.Rooms[94], Direction.North, zone.Rooms[95]);
            ZoneHelper.ConnectRoom(zone.Rooms[95], Direction.Down, zone.Rooms[96]);
            ZoneHelper.ConnectRoom(zone.Rooms[96], Direction.West, zone.Rooms[97]);
            ZoneHelper.ConnectRoom(zone.Rooms[97], Direction.West, zone.Rooms[98]);

            #endregion Cavern
        }
Пример #10
0
        private void ConnectRooms()
        {
            zone.RecursivelySetZone();

            ZoneHelper.ConnectZone(zone.Rooms[1], Direction.South, 6, 25);
            ZoneHelper.ConnectRoom(zone.Rooms[1], Direction.Down, zone.Rooms[3]);
            ZoneHelper.ConnectRoom(zone.Rooms[1], Direction.North, zone.Rooms[39]);

            #region Basement
            ZoneHelper.ConnectRoom(zone.Rooms[2], Direction.East, zone.Rooms[3]);
            ZoneHelper.ConnectRoom(zone.Rooms[2], Direction.South, zone.Rooms[8]);
            ZoneHelper.ConnectRoom(zone.Rooms[3], Direction.East, zone.Rooms[4]);
            ZoneHelper.ConnectRoom(zone.Rooms[3], Direction.South, zone.Rooms[9]);
            ZoneHelper.ConnectRoom(zone.Rooms[4], Direction.East, zone.Rooms[5]);
            ZoneHelper.ConnectRoom(zone.Rooms[4], Direction.South, zone.Rooms[10]);
            ZoneHelper.ConnectRoom(zone.Rooms[5], Direction.East, zone.Rooms[6]);
            ZoneHelper.ConnectRoom(zone.Rooms[5], Direction.South, zone.Rooms[11]);
            ZoneHelper.ConnectRoom(zone.Rooms[6], Direction.East, zone.Rooms[7]);
            ZoneHelper.ConnectRoom(zone.Rooms[6], Direction.South, zone.Rooms[12]);
            ZoneHelper.ConnectRoom(zone.Rooms[7], Direction.South, zone.Rooms[13]);

            ZoneHelper.ConnectRoom(zone.Rooms[8], Direction.East, zone.Rooms[9]);
            ZoneHelper.ConnectRoom(zone.Rooms[8], Direction.South, zone.Rooms[14]);
            ZoneHelper.ConnectRoom(zone.Rooms[9], Direction.East, zone.Rooms[10]);
            ZoneHelper.ConnectRoom(zone.Rooms[9], Direction.South, zone.Rooms[15]);
            ZoneHelper.ConnectRoom(zone.Rooms[10], Direction.East, zone.Rooms[11]);
            ZoneHelper.ConnectRoom(zone.Rooms[10], Direction.South, zone.Rooms[16]);
            ZoneHelper.ConnectRoom(zone.Rooms[11], Direction.East, zone.Rooms[12]);
            ZoneHelper.ConnectRoom(zone.Rooms[11], Direction.South, zone.Rooms[17]);
            ZoneHelper.ConnectRoom(zone.Rooms[12], Direction.East, zone.Rooms[13]);
            ZoneHelper.ConnectRoom(zone.Rooms[12], Direction.South, zone.Rooms[18]);
            ZoneHelper.ConnectRoom(zone.Rooms[13], Direction.South, zone.Rooms[19]);

            ZoneHelper.ConnectRoom(zone.Rooms[14], Direction.East, zone.Rooms[15]);
            ZoneHelper.ConnectRoom(zone.Rooms[14], Direction.South, zone.Rooms[20]);
            ZoneHelper.ConnectRoom(zone.Rooms[15], Direction.East, zone.Rooms[16]);
            ZoneHelper.ConnectRoom(zone.Rooms[15], Direction.South, zone.Rooms[21]);
            ZoneHelper.ConnectRoom(zone.Rooms[16], Direction.East, zone.Rooms[17]);
            ZoneHelper.ConnectRoom(zone.Rooms[16], Direction.South, zone.Rooms[22]);
            ZoneHelper.ConnectRoom(zone.Rooms[17], Direction.East, zone.Rooms[18]);
            ZoneHelper.ConnectRoom(zone.Rooms[17], Direction.South, zone.Rooms[23]);
            ZoneHelper.ConnectRoom(zone.Rooms[18], Direction.East, zone.Rooms[19]);
            ZoneHelper.ConnectRoom(zone.Rooms[18], Direction.South, zone.Rooms[24]);
            ZoneHelper.ConnectRoom(zone.Rooms[19], Direction.South, zone.Rooms[25]);

            ZoneHelper.ConnectRoom(zone.Rooms[20], Direction.East, zone.Rooms[21]);
            ZoneHelper.ConnectRoom(zone.Rooms[20], Direction.South, zone.Rooms[26]);
            ZoneHelper.ConnectRoom(zone.Rooms[21], Direction.East, zone.Rooms[22]);
            ZoneHelper.ConnectRoom(zone.Rooms[21], Direction.South, zone.Rooms[27]);
            ZoneHelper.ConnectRoom(zone.Rooms[22], Direction.East, zone.Rooms[23]);
            ZoneHelper.ConnectRoom(zone.Rooms[22], Direction.South, zone.Rooms[28]);
            ZoneHelper.ConnectRoom(zone.Rooms[23], Direction.East, zone.Rooms[24]);
            ZoneHelper.ConnectRoom(zone.Rooms[23], Direction.South, zone.Rooms[29]);
            ZoneHelper.ConnectRoom(zone.Rooms[24], Direction.East, zone.Rooms[25]);
            ZoneHelper.ConnectRoom(zone.Rooms[24], Direction.South, zone.Rooms[30]);
            ZoneHelper.ConnectRoom(zone.Rooms[25], Direction.South, zone.Rooms[31]);

            ZoneHelper.ConnectRoom(zone.Rooms[26], Direction.East, zone.Rooms[27]);
            ZoneHelper.ConnectRoom(zone.Rooms[26], Direction.South, zone.Rooms[32]);
            ZoneHelper.ConnectRoom(zone.Rooms[27], Direction.East, zone.Rooms[28]);
            ZoneHelper.ConnectRoom(zone.Rooms[27], Direction.South, zone.Rooms[33]);
            ZoneHelper.ConnectRoom(zone.Rooms[28], Direction.East, zone.Rooms[29]);
            ZoneHelper.ConnectRoom(zone.Rooms[28], Direction.South, zone.Rooms[34]);
            ZoneHelper.ConnectRoom(zone.Rooms[29], Direction.East, zone.Rooms[30]);
            ZoneHelper.ConnectRoom(zone.Rooms[29], Direction.South, zone.Rooms[35]);
            ZoneHelper.ConnectRoom(zone.Rooms[30], Direction.East, zone.Rooms[31]);
            ZoneHelper.ConnectRoom(zone.Rooms[30], Direction.South, zone.Rooms[36]);
            ZoneHelper.ConnectRoom(zone.Rooms[31], Direction.South, zone.Rooms[37]);

            ZoneHelper.ConnectRoom(zone.Rooms[32], Direction.East, zone.Rooms[33]);
            ZoneHelper.ConnectRoom(zone.Rooms[33], Direction.East, zone.Rooms[34]);
            ZoneHelper.ConnectRoom(zone.Rooms[34], Direction.East, zone.Rooms[35]);
            ZoneHelper.ConnectRoom(zone.Rooms[35], Direction.East, zone.Rooms[36]);
            ZoneHelper.ConnectRoom(zone.Rooms[36], Direction.East, zone.Rooms[37]);

            #endregion Basement

            #region Library Upstairs

            ZoneHelper.ConnectRoom(zone.Rooms[38], Direction.North, zone.Rooms[41]);
            ZoneHelper.ConnectRoom(zone.Rooms[38], Direction.East, zone.Rooms[39]);
            ZoneHelper.ConnectRoom(zone.Rooms[39], Direction.North, zone.Rooms[42]);
            ZoneHelper.ConnectRoom(zone.Rooms[39], Direction.East, zone.Rooms[40]);
            ZoneHelper.ConnectRoom(zone.Rooms[40], Direction.North, zone.Rooms[43]);

            ZoneHelper.ConnectRoom(zone.Rooms[41], Direction.North, zone.Rooms[44]);
            ZoneHelper.ConnectRoom(zone.Rooms[41], Direction.East, zone.Rooms[42]);
            ZoneHelper.ConnectRoom(zone.Rooms[42], Direction.North, zone.Rooms[45]);
            ZoneHelper.ConnectRoom(zone.Rooms[42], Direction.East, zone.Rooms[43]);
            ZoneHelper.ConnectRoom(zone.Rooms[43], Direction.North, zone.Rooms[46]);

            ZoneHelper.ConnectRoom(zone.Rooms[44], Direction.North, zone.Rooms[47]);
            ZoneHelper.ConnectRoom(zone.Rooms[44], Direction.East, zone.Rooms[45]);
            ZoneHelper.ConnectRoom(zone.Rooms[45], Direction.North, zone.Rooms[48]);
            ZoneHelper.ConnectRoom(zone.Rooms[45], Direction.East, zone.Rooms[46]);
            ZoneHelper.ConnectRoom(zone.Rooms[46], Direction.North, zone.Rooms[49]);

            ZoneHelper.ConnectRoom(zone.Rooms[47], Direction.North, zone.Rooms[50]);
            ZoneHelper.ConnectRoom(zone.Rooms[47], Direction.East, zone.Rooms[48]);
            ZoneHelper.ConnectRoom(zone.Rooms[48], Direction.North, zone.Rooms[51]);
            ZoneHelper.ConnectRoom(zone.Rooms[48], Direction.East, zone.Rooms[49]);
            ZoneHelper.ConnectRoom(zone.Rooms[49], Direction.North, zone.Rooms[52]);

            ZoneHelper.ConnectRoom(zone.Rooms[50], Direction.East, zone.Rooms[51]);
            ZoneHelper.ConnectRoom(zone.Rooms[51], Direction.East, zone.Rooms[52]);

            ZoneHelper.ConnectRoom(zone.Rooms[53], Direction.Down, zone.Rooms[38]);
            ZoneHelper.ConnectRoom(zone.Rooms[55], Direction.Down, zone.Rooms[40]);
            ZoneHelper.ConnectRoom(zone.Rooms[62], Direction.Down, zone.Rooms[50]);
            ZoneHelper.ConnectRoom(zone.Rooms[64], Direction.Down, zone.Rooms[52]);

            ZoneHelper.ConnectRoom(zone.Rooms[53], Direction.East, zone.Rooms[54]);
            ZoneHelper.ConnectRoom(zone.Rooms[54], Direction.East, zone.Rooms[55]);
            ZoneHelper.ConnectRoom(zone.Rooms[62], Direction.East, zone.Rooms[63]);
            ZoneHelper.ConnectRoom(zone.Rooms[63], Direction.East, zone.Rooms[64]);

            ZoneHelper.ConnectRoom(zone.Rooms[53], Direction.North, zone.Rooms[56]);
            ZoneHelper.ConnectRoom(zone.Rooms[56], Direction.North, zone.Rooms[58]);
            ZoneHelper.ConnectRoom(zone.Rooms[58], Direction.North, zone.Rooms[60]);
            ZoneHelper.ConnectRoom(zone.Rooms[60], Direction.North, zone.Rooms[62]);

            ZoneHelper.ConnectRoom(zone.Rooms[55], Direction.North, zone.Rooms[57]);
            ZoneHelper.ConnectRoom(zone.Rooms[57], Direction.North, zone.Rooms[59]);
            ZoneHelper.ConnectRoom(zone.Rooms[59], Direction.North, zone.Rooms[61]);
            ZoneHelper.ConnectRoom(zone.Rooms[61], Direction.North, zone.Rooms[64]);

            #endregion Library Upstairs
        }
Пример #11
0
        private void ConnectRooms()
        {
            #region Rock Face
            ZoneHelper.ConnectRoom(Zone.Rooms[1], Direction.East, Zone.Rooms[2]);
            ZoneHelper.ConnectRoom(Zone.Rooms[2], Direction.East, Zone.Rooms[3]);
            ZoneHelper.ConnectRoom(Zone.Rooms[3], Direction.East, Zone.Rooms[4]);
            ZoneHelper.ConnectRoom(Zone.Rooms[4], Direction.East, Zone.Rooms[5]);

            ZoneHelper.ConnectRoom(Zone.Rooms[6], Direction.East, Zone.Rooms[7]);
            ZoneHelper.ConnectRoom(Zone.Rooms[7], Direction.East, Zone.Rooms[8]);
            ZoneHelper.ConnectRoom(Zone.Rooms[8], Direction.East, Zone.Rooms[9]);
            ZoneHelper.ConnectRoom(Zone.Rooms[9], Direction.East, Zone.Rooms[10]);

            ZoneHelper.ConnectRoom(Zone.Rooms[11], Direction.East, Zone.Rooms[12]);
            ZoneHelper.ConnectRoom(Zone.Rooms[12], Direction.East, Zone.Rooms[13]);
            ZoneHelper.ConnectRoom(Zone.Rooms[13], Direction.East, Zone.Rooms[14]);
            ZoneHelper.ConnectRoom(Zone.Rooms[14], Direction.East, Zone.Rooms[15]);

            ZoneHelper.ConnectRoom(Zone.Rooms[16], Direction.East, Zone.Rooms[17]);
            ZoneHelper.ConnectRoom(Zone.Rooms[17], Direction.East, Zone.Rooms[18]);
            ZoneHelper.ConnectRoom(Zone.Rooms[18], Direction.East, Zone.Rooms[19]);
            ZoneHelper.ConnectRoom(Zone.Rooms[19], Direction.East, Zone.Rooms[20]);

            ZoneHelper.ConnectRoom(Zone.Rooms[21], Direction.East, Zone.Rooms[22]);
            ZoneHelper.ConnectRoom(Zone.Rooms[22], Direction.East, Zone.Rooms[23]);
            ZoneHelper.ConnectRoom(Zone.Rooms[23], Direction.East, Zone.Rooms[24]);
            ZoneHelper.ConnectRoom(Zone.Rooms[24], Direction.East, Zone.Rooms[25]);
            ZoneHelper.ConnectRoom(Zone.Rooms[25], Direction.East, Zone.Rooms[40]);


            ZoneHelper.ConnectRoom(Zone.Rooms[1], Direction.Up, Zone.Rooms[6]);
            ZoneHelper.ConnectRoom(Zone.Rooms[2], Direction.Up, Zone.Rooms[7]);
            ZoneHelper.ConnectRoom(Zone.Rooms[3], Direction.Up, Zone.Rooms[8]);
            ZoneHelper.ConnectRoom(Zone.Rooms[4], Direction.Up, Zone.Rooms[9]);
            ZoneHelper.ConnectRoom(Zone.Rooms[5], Direction.Up, Zone.Rooms[10]);

            ZoneHelper.ConnectRoom(Zone.Rooms[6], Direction.Up, Zone.Rooms[11]);
            ZoneHelper.ConnectRoom(Zone.Rooms[7], Direction.Up, Zone.Rooms[12]);
            ZoneHelper.ConnectRoom(Zone.Rooms[8], Direction.Up, Zone.Rooms[13]);
            ZoneHelper.ConnectRoom(Zone.Rooms[9], Direction.Up, Zone.Rooms[14]);
            ZoneHelper.ConnectRoom(Zone.Rooms[10], Direction.Up, Zone.Rooms[15]);

            ZoneHelper.ConnectRoom(Zone.Rooms[11], Direction.Up, Zone.Rooms[16]);
            ZoneHelper.ConnectRoom(Zone.Rooms[12], Direction.Up, Zone.Rooms[17]);
            ZoneHelper.ConnectRoom(Zone.Rooms[13], Direction.Up, Zone.Rooms[18]);
            ZoneHelper.ConnectRoom(Zone.Rooms[14], Direction.Up, Zone.Rooms[19]);
            ZoneHelper.ConnectRoom(Zone.Rooms[15], Direction.Up, Zone.Rooms[20]);

            ZoneHelper.ConnectRoom(Zone.Rooms[16], Direction.Up, Zone.Rooms[21]);
            ZoneHelper.ConnectRoom(Zone.Rooms[17], Direction.Up, Zone.Rooms[22]);
            ZoneHelper.ConnectRoom(Zone.Rooms[18], Direction.Up, Zone.Rooms[23]);
            ZoneHelper.ConnectRoom(Zone.Rooms[19], Direction.Up, Zone.Rooms[24]);
            ZoneHelper.ConnectRoom(Zone.Rooms[20], Direction.Up, Zone.Rooms[25]);


            ZoneHelper.ConnectZone(Zone.Rooms[21], Direction.North, 22, 1);
            ZoneHelper.ConnectZone(Zone.Rooms[22], Direction.North, 22, 16);
            ZoneHelper.ConnectZone(Zone.Rooms[23], Direction.North, 22, 15);
            ZoneHelper.ConnectZone(Zone.Rooms[24], Direction.North, 22, 14);
            ZoneHelper.ConnectZone(Zone.Rooms[25], Direction.North, 22, 13);

            ZoneHelper.ConnectZone(Zone.Rooms[1], Direction.West, 16, 15);
            #endregion Rock Face

            #region Path
            ZoneHelper.ConnectRoom(Zone.Rooms[5], Direction.East, Zone.Rooms[26]);
            ZoneHelper.ConnectRoom(Zone.Rooms[26], Direction.East, Zone.Rooms[27]);
            ZoneHelper.ConnectRoom(Zone.Rooms[27], Direction.East, Zone.Rooms[28]);
            ZoneHelper.ConnectRoom(Zone.Rooms[28], Direction.Up, Zone.Rooms[29]);

            ZoneHelper.ConnectRoom(Zone.Rooms[29], Direction.West, Zone.Rooms[30]);
            ZoneHelper.ConnectRoom(Zone.Rooms[30], Direction.West, Zone.Rooms[31]);
            ZoneHelper.ConnectRoom(Zone.Rooms[31], Direction.West, Zone.Rooms[32]);
            ZoneHelper.ConnectRoom(Zone.Rooms[32], Direction.Up, Zone.Rooms[33]);

            ZoneHelper.ConnectRoom(Zone.Rooms[33], Direction.East, Zone.Rooms[34]);
            ZoneHelper.ConnectRoom(Zone.Rooms[34], Direction.East, Zone.Rooms[35]);
            ZoneHelper.ConnectRoom(Zone.Rooms[35], Direction.East, Zone.Rooms[36]);
            ZoneHelper.ConnectRoom(Zone.Rooms[36], Direction.Up, Zone.Rooms[37]);

            ZoneHelper.ConnectRoom(Zone.Rooms[37], Direction.West, Zone.Rooms[38]);
            ZoneHelper.ConnectRoom(Zone.Rooms[38], Direction.West, Zone.Rooms[39]);
            ZoneHelper.ConnectRoom(Zone.Rooms[39], Direction.West, Zone.Rooms[40]);
            #endregion Path
        }
Пример #12
0
        public static Search.Models.PlantInfo AsSearchModel(this Models.PlantInfo source, IEnumerable <Models.PlantLocation> plantLocations, IEnumerable <Models.Synonym> synonyms)
        {
            var plantLocationSearch = plantLocations?.Select(pl => pl.AsSearchModel()) ?? source.Locations?.Select(pl => pl.AsSearchModel());

            var bloomTimes = new List <Month>();

            if (source.BloomTime != null)
            {
                if (source.BloomTime.MinimumBloomTime > 0 && source.BloomTime.MaximumBloomTime > 0)
                {
                    for (var i = source.BloomTime.MinimumBloomTime; i <= source.BloomTime.MaximumBloomTime; i++)
                    {
                        bloomTimes.Add(i);
                    }
                }
                else
                {
                    if (source.BloomTime.MinimumBloomTime > 0)
                    {
                        bloomTimes.Add(source.BloomTime.MinimumBloomTime);
                    }
                    if (source.BloomTime.MaximumBloomTime > 0 && source.BloomTime.MinimumBloomTime != source.BloomTime.MaximumBloomTime)
                    {
                        bloomTimes.Add(source.BloomTime.MaximumBloomTime);
                    }
                }
            }

            var waterTypes = new List <WaterType>();

            if (source.Requirements?.WaterRequirements != null)
            {
                if (source.Requirements.WaterRequirements.MinimumWater != WaterType.Unknown &&
                    source.Requirements.WaterRequirements.MaximumWater != WaterType.Unknown)
                {
                    var minWater = source.Requirements.WaterRequirements.MinimumWater;
                    var maxWater = source.Requirements.WaterRequirements.MaximumWater;
                    for (var i = minWater; i <= maxWater; i++)
                    {
                        waterTypes.Add(i);
                    }
                }
                else
                {
                    if (source.Requirements.WaterRequirements.MinimumWater != WaterType.Unknown)
                    {
                        waterTypes.Add(source.Requirements.WaterRequirements.MinimumWater);
                    }
                    if (source.Requirements.WaterRequirements.MaximumWater != WaterType.Unknown)
                    {
                        waterTypes.Add(source.Requirements.WaterRequirements.MaximumWater);
                    }
                }
            }

            var lightTypes = new List <LightType>();

            if (source.Requirements?.LightRequirements != null)
            {
                if (source.Requirements.LightRequirements.MinimumLight != LightType.Unknown &&
                    source.Requirements.LightRequirements.MaximumLight != LightType.Unknown)
                {
                    var minLight = source.Requirements.LightRequirements.MinimumLight;
                    var maxLight = source.Requirements.LightRequirements.MaximumLight;
                    for (var i = minLight; i <= maxLight; i++)
                    {
                        lightTypes.Add(i);
                    }
                }
                else
                {
                    if (source.Requirements.LightRequirements.MinimumLight != LightType.Unknown)
                    {
                        lightTypes.Add(source.Requirements.LightRequirements.MinimumLight);
                    }
                    if (source.Requirements.LightRequirements.MaximumLight != LightType.Unknown)
                    {
                        lightTypes.Add(source.Requirements.LightRequirements.MaximumLight);
                    }
                }
            }

            var zones    = new List <Search.Models.Zone>();
            var allZones = ZoneHelper.GetZones();

            if (source.Requirements?.ZoneRequirements?.MinimumZone != null && source.Requirements?.ZoneRequirements?.MaximumZone != null)
            {
                for (var i = source.Requirements?.ZoneRequirements?.MinimumZone.Id; i <= source.Requirements?.ZoneRequirements?.MaximumZone.Id; i++)
                {
                    zones.Add(allZones.First(z => z.Id == i).AsSearchModel());
                }
            }
            else
            {
                if (source.Requirements?.ZoneRequirements?.MinimumZone != null)
                {
                    zones.Add(source.Requirements?.ZoneRequirements?.MinimumZone.AsSearchModel());
                }
                if (source.Requirements?.ZoneRequirements?.MaximumZone != null &&
                    source.Requirements?.ZoneRequirements?.MinimumZone.Id != source.Requirements?.ZoneRequirements?.MaximumZone.Id)
                {
                    zones.Add(source.Requirements?.ZoneRequirements?.MaximumZone.AsSearchModel());
                }
            }

            return(new Search.Models.PlantInfo
            {
                Id = source.PlantInfoId,
                CommonName = source.CommonName,
                ScientificName = source.ScientificName,
                Origin = source.Origin?.AsSearchModel(),
                Lifeform = source.Lifeform.AsSearchModel(),
                PlantLocations = plantLocationSearch,
                Synonyms = synonyms?.Select(s => s.AsSearchModel()),
                MinimumBloomTime = source.BloomTime != null && source.BloomTime?.MinimumBloomTime != Month.Unknown ? (short?)source.BloomTime.MinimumBloomTime : null,
                MaximumBloomTime = source.BloomTime != null && source.BloomTime?.MaximumBloomTime != Month.Unknown ? (short?)source.BloomTime.MaximumBloomTime : null,
                BloomTimes = bloomTimes.Any() ? bloomTimes : null,
                MinimumHeight = source.Height != null ? source.Height?.MinimumHeight : null,
                MaximumHeight = source.Height != null ? source.Height?.MaximumHeight : null,
                HeightUnit = source.Height != null && (source.Height.MinimumHeight.HasValue || source.Height.MaximumHeight.HasValue) ? DistanceUnit.Feet : null,
                MinimumSpread = source.Spread != null ? source.Spread?.MinimumSpread : null,
                MaximumSpread = source.Spread != null ? source.Spread?.MaximumSpread : null,
                SpreadUnit = source.Spread != null && (source.Spread.MinimumSpread.HasValue || source.Spread.MaximumSpread.HasValue) ? DistanceUnit.Feet : null,
                MinimumLight = source.Requirements?.LightRequirements?.MinimumLight != LightType.Unknown ? source.Requirements?.LightRequirements?.MinimumLight : null,
                MaximumLight = source.Requirements?.LightRequirements?.MaximumLight != LightType.Unknown ? source.Requirements?.LightRequirements?.MaximumLight : null,
                LightTypes = lightTypes.Any() ? lightTypes : null,
                MinimumWater = source.Requirements?.WaterRequirements?.MinimumWater != WaterType.Unknown ? source.Requirements?.WaterRequirements?.MinimumWater : null,
                MaximumWater = source.Requirements?.WaterRequirements?.MaximumWater != WaterType.Unknown ? source.Requirements?.WaterRequirements?.MaximumWater : null,
                WaterTypes = waterTypes.Any() ? waterTypes : null,
                MinimumZone = source.Requirements?.ZoneRequirements?.MinimumZone?.AsSearchModel(),
                MaximumZone = source.Requirements?.ZoneRequirements?.MaximumZone?.AsSearchModel(),
                Zones = zones.Any() ? zones : null,
                StratificationStages = source.Requirements?.StratificationStages?.Select(s => s.AsSearchModel()),
                Preferred = source.Preferred,
                Taxon = source.Taxon?.AsSearchModel(),
                WildlifeEffects = source.WildlifeEffects,
                SoilTypes = source.SoilTypes,
                Notes = source.Notes,
                Visibility = source.Visibility,
                User = source.User?.AsSearchModel(),
                CreatedBy = source.CreatedBy,
                ModifiedBy = source.ModifiedBy,
                DateCreated = source.DateCreated ?? DateTime.UtcNow,
                DateModified = source.DateModified
            });
        }
Пример #13
0
        public static Search.Models.PlantInfo AsSearchModel(this PlantInfo source, IEnumerable <PlantLocation> plantLocations, IEnumerable <Synonym> synonyms)
        {
            var plantLocationSearch = plantLocations?.Select(pl => pl.AsSearchModel()) ?? source.PlantLocations?.Select(pl => pl.AsSearchModel());

            var bloomTimes = new List <Month>();

            if (source.MinimumBloomTime > 0 && source.MaximumBloomTime > 0)
            {
                for (var i = source.MinimumBloomTime; i <= source.MaximumBloomTime; i++)
                {
                    bloomTimes.Add((Month)i);
                }
            }
            else
            {
                if (source.MinimumBloomTime > 0)
                {
                    bloomTimes.Add((Month)source.MinimumBloomTime);
                }
                if (source.MaximumBloomTime > 0 && source.MinimumBloomTime != source.MaximumBloomTime)
                {
                    bloomTimes.Add((Month)source.MaximumBloomTime);
                }
            }

            var waterTypes = new List <WaterType>();

            if (!string.IsNullOrEmpty(source.MinimumWater) && !string.IsNullOrEmpty(source.MaximumWater))
            {
                var minWater = Enum.Parse <WaterType>(source.MinimumWater);
                var maxWater = Enum.Parse <WaterType>(source.MaximumWater);
                for (var i = minWater; i <= maxWater; i++)
                {
                    waterTypes.Add(i);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(source.MinimumWater))
                {
                    var minWater = Enum.Parse <WaterType>(source.MinimumWater);
                    waterTypes.Add(minWater);
                }
                if (!string.IsNullOrEmpty(source.MaximumWater) && source.MinimumWater != source.MaximumWater)
                {
                    var maxWater = Enum.Parse <WaterType>(source.MaximumWater);
                    waterTypes.Add(maxWater);
                }
            }

            var lightTypes = new List <LightType>();

            if (!string.IsNullOrEmpty(source.MinimumLight) && !string.IsNullOrEmpty(source.MaximumLight))
            {
                var minLight = Enum.Parse <LightType>(source.MinimumLight);
                var maxLight = Enum.Parse <LightType>(source.MaximumLight);
                for (var i = minLight; i <= maxLight; i++)
                {
                    lightTypes.Add(i);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(source.MinimumLight))
                {
                    var minLight = Enum.Parse <LightType>(source.MinimumLight);
                    lightTypes.Add(minLight);
                }
                if (!string.IsNullOrEmpty(source.MaximumLight) && source.MinimumLight != source.MaximumLight)
                {
                    var maxLight = Enum.Parse <LightType>(source.MaximumLight);
                    lightTypes.Add(maxLight);
                }
            }

            var zones    = new List <Search.Models.Zone>();
            var allZones = ZoneHelper.GetZones();

            if (source.MinimumZone != null && source.MaximumZone != null)
            {
                for (var i = source.MinimumZone.Id; i <= source.MaximumZone.Id; i++)
                {
                    zones.Add(allZones.First(z => z.Id == i).AsSearchModel());
                }
            }
            else
            {
                if (source.MinimumZone != null)
                {
                    zones.Add(source.MinimumZone.AsSearchModel());
                }
                if (source.MaximumZone != null && source.MinimumZone.Id != source.MaximumZone.Id)
                {
                    zones.Add(source.MaximumZone.AsSearchModel());
                }
            }

            return(new Search.Models.PlantInfo
            {
                Id = source.Id,
                CommonName = source.CommonName,
                ScientificName = source.ScientificName,
                Origin = source.Origin?.AsSearchModel(),
                Lifeform = source.Lifeform.AsSearchModel(),
                PlantLocations = plantLocationSearch,
                Synonyms = synonyms?.Select(s => s.AsSearchModel()),
                MinimumBloomTime = source.MinimumBloomTime,
                MaximumBloomTime = source.MaximumBloomTime,
                BloomTimes = bloomTimes.Any() ? bloomTimes : null,
                MinimumHeight = source.MinimumHeight,
                MaximumHeight = source.MaximumHeight,
                HeightUnit = source.MinimumHeight.HasValue || source.MaximumHeight.HasValue ? DistanceUnit.Feet : null,
                MinimumSpread = source.MinimumSpread,
                MaximumSpread = source.MaximumSpread,
                SpreadUnit = source.MinimumSpread.HasValue || source.MaximumSpread.HasValue ? DistanceUnit.Feet : null,
                MinimumLight = !string.IsNullOrEmpty(source.MinimumLight) ? Enum.Parse <LightType>(source.MinimumLight) : null,
                MaximumLight = !string.IsNullOrEmpty(source.MaximumLight) ? Enum.Parse <LightType>(source.MaximumLight) : null,
                LightTypes = lightTypes.Any() ? lightTypes : null,
                MinimumWater = !string.IsNullOrEmpty(source.MinimumWater) ? Enum.Parse <WaterType>(source.MinimumWater) : null,
                MaximumWater = !string.IsNullOrEmpty(source.MaximumWater) ? Enum.Parse <WaterType>(source.MaximumWater) : null,
                WaterTypes = waterTypes.Any() ? waterTypes : null,
                MinimumZone = source.MinimumZone?.AsSearchModel(),
                MaximumZone = source.MaximumZone?.AsSearchModel(),
                Zones = zones.Any() ? zones : null,
                StratificationStages = source.StratificationStages != null?JsonConvert.DeserializeObject <List <Search.Models.StratificationStage> >(source.StratificationStages) : null,
                                           Preferred = source.Preferred,
                                           Taxon = source.Taxon?.AsSearchModel(),
                                           WildlifeEffects = source.WildlifeEffects != null?JsonConvert.DeserializeObject <List <WildlifeEffect> >(source.WildlifeEffects) : null,
                                                                 SoilTypes = source.SoilTypes != null?JsonConvert.DeserializeObject <List <SoilType> >(source.SoilTypes) : null,
                                                                                 Notes = source.Notes,
                                                                                 Visibility = source.Visibility,
                                                                                 User = source.User?.AsSearchModel(),
                                                                                 CreatedBy = source.CreatedBy,
                                                                                 ModifiedBy = source.ModifiedBy,
                                                                                 DateCreated = source.DateCreated,
                                                                                 DateModified = source.DateModified
            });
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            List <PaycheckZone> zones;
            Paycheck            paycheck = null;

            if (command.Length > 0)
            {
                paycheck = PaycheckHelper.FindBestMatch(command[0]);
                if (paycheck == null)
                {
                    UnturnedChat.Say(caller, PaycheckPlugin.Instance.Translate("command_paycheck_not_found", command[0]), Color.yellow);
                    return;
                }
                zones = paycheck.PaycheckZones;
            }
            else
            {
                zones = PaycheckPlugin.Config.PaycheckZones;
            }

            if (zones.Count == 0)
            {
                UnturnedChat.Say(caller,
                                 command.Length == 0
                                                ? PaycheckPlugin.Instance.Translate("command_default_no_zones")
                                                : PaycheckPlugin.Instance.Translate("command_paycheck_no_zones", paycheck?.Name), Color.yellow);
                return;
            }

            var zonesString = new StringBuilder();

            for (var i = 0; i < zones.Count; i++)
            {
                zonesString.AppendFormat(" [{0}] - {1}x {2} {3}m,", i + 1, zones[i].Multiplier, ZoneHelper.GetLocationString(zones[i]), zones[i].Radius);
            }
            zonesString.Remove(zonesString.Length - 1, 1);
            UnturnedChat.Say(caller,
                             command.Length == 0
                                        ? PaycheckPlugin.Instance.Translate("command_list_default_zones", zonesString.ToString())
                                        : PaycheckPlugin.Instance.Translate("command_list_paycheck_zones", paycheck?.Name, zonesString.ToString()), Color.green);
        }
        private static Dictionary <string, Zone> GetCurrentZoneDict()
        {
            var zone = ZoneHelper.GetMyLocalZones().ToDictionary(z => z.HashId, z => z);

            return(zone);
        }
Пример #16
0
            public static JsonParse ConvertParse()
            {
                var hasDamage      = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
                var hasHealing     = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
                var hasDamageTaken = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

                if (!hasDamage && !hasHealing && !hasDamageTaken)
                {
                    return(new JsonParse());
                }
                var currentOverallStats = ParseControl.Instance.Timeline.Overall.Stats;
                var historyItem         = new Dictionary <string, object>();
                var timeline            = new Dictionary <string, object>();
                var overall             = new Dictionary <string, object>
                {
                    {
                        "Stats", new Dictionary <string, object>()
                    }
                };

                foreach (var stat in currentOverallStats)
                {
                    ((Dictionary <string, object>)overall["Stats"]).Add(stat.Name, stat.Value);
                }
                timeline.Add("Overall", overall);
                var playerList = ParseControl.Instance.Timeline.Party.ToArray();
                var players    = new Dictionary <string, object>();

                foreach (var player in playerList)
                {
                    var playerItem = new Dictionary <string, object>
                    {
                        {
                            "Stats", new Dictionary <string, object>()
                        },
                        {
                            "Last20DamageActions", ((Player)player).Last20DamageActions.ToList()
                        },
                        {
                            "Last20DamageTakenActions", ((Player)player).Last20DamageTakenActions.ToList()
                        },
                        {
                            "Last20HealingActions", ((Player)player).Last20HealingActions.ToList()
                        },
                        {
                            "Last20Items", ((Player)player).Last20Items.ToList()
                        }
                    };
                    foreach (var stat in player.Stats)
                    {
                        ((Dictionary <string, object>)playerItem["Stats"]).Add(stat.Name, stat.Value);
                    }
                    players.Add(player.Name, playerItem);
                    RabbitHoleCopy(ref playerItem, player);
                }
                timeline.Add("Party", players);
                var monsterList = ParseControl.Instance.Timeline.Monster.ToArray();
                var monsters    = new Dictionary <string, object>();

                foreach (var monster in monsterList)
                {
                    var monsterItem = new Dictionary <string, object>
                    {
                        {
                            "Stats", new Dictionary <string, object>()
                        },
                        {
                            "Last20DamageActions", ((Monster)monster).Last20DamageActions.ToList()
                        },
                        {
                            "Last20DamageTakenActions", ((Monster)monster).Last20DamageTakenActions.ToList()
                        },
                        {
                            "Last20HealingActions", ((Monster)monster).Last20HealingActions.ToList()
                        },
                        {
                            "Last20Items", ((Monster)monster).Last20Items.ToList()
                        }
                    };
                    foreach (var stat in monster.Stats)
                    {
                        ((Dictionary <string, object>)monsterItem["Stats"]).Add(stat.Name, stat.Value);
                    }
                    monsters.Add(monster.Name, monsterItem);
                    RabbitHoleCopy(ref monsterItem, monster);
                }
                timeline.Add("Monster", monsters);
                historyItem.Add("Timeline", timeline);

                #region Resolve FileName Details

                var start            = ParseControl.Instance.StartTime;
                var end              = DateTime.Now;
                var parseLength      = end - start;
                var parseTimeDetails = String.Format("{0} -> {1} [{2}]", start, end, parseLength);
                var zone             = "UNKNOWN";
                if (XIVInfoViewModel.Instance.CurrentUser != null)
                {
                    var mapIndex = XIVInfoViewModel.Instance.CurrentUser.MapIndex;
                    zone = ZoneHelper.MapInfo(mapIndex).Name.English;
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = ZoneHelper.MapInfo(mapIndex).Name.French;
                        break;

                    case "Japanese":
                        zone = ZoneHelper.MapInfo(mapIndex).Name.Japanese;
                        break;

                    case "German":
                        zone = ZoneHelper.MapInfo(mapIndex).Name.German;
                        break;

                    case "Chinese":
                        zone = ZoneHelper.MapInfo(mapIndex).Name.Chinese;
                        break;
                    }
                }
                var monsterName = "NULL";
                try
                {
                    StatGroup biggestMonster = null;
                    foreach (var monster in ParseControl.Instance.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }
                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex)
                {
                }

                #endregion

                return(new JsonParse
                {
                    Name = String.Format("{0} [{1}] {2}", zone, monsterName, parseTimeDetails),
                    Parse = JsonConvert.SerializeObject(historyItem, new JsonSerializerSettings
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    })
                });
            }
Пример #17
0
 public void QueryZoneTest()
 {
     ZoneID zid = ZoneHelper.QueryZone(AccessKey, Bucket1);
 }