Exemplo n.º 1
0
        private static void DoReadSave(string[] args)
        {
            if (args.Length < 2 || !File.Exists(args[1]) || Path.GetExtension(args[1]).ToLower() != ".sav")
            {
                Console.WriteLine("Please provide save game file name.");
                return;
            }

            using (var save = new SaveGame(args[1]))
            {
                if (args.Length == 2)
                {
                    Console.WriteLine(save);
                }
                else
                {
                    switch (args[2].ToLower())
                    {
                    case "header":
                        var loc = save.Events.Locations.FirstOrDefault(
                            l => l.Id == save.Header.LocationId);
                        Console.WriteLine("Location: " + loc);
                        break;

                    case "party":
                        foreach (var c in save.Party.Characters)
                        {
                            Console.WriteLine(c.ShortName + ":");

                            var itemsWithNames = from item in c.ItemList.Items
                                                 where !item.IsEmpty
                                                 select string.Join(" ",
                                                                    "\tType:" + item.Type,
                                                                    "QL:" + item.Quality,
                                                                    "#:" + item.Quantity,
                                                                    "Weight:" + item.Weight,
                                                                    StaticDataService.ItemDefinitions.First(i => i.Id == item.Id).Name);

                            Console.WriteLine(string.Join("\n", itemsWithNames));
                        }
                        break;

                    case "events":
                        foreach (var q in QuestModel.FromEvents(
                                     save.Events.Events, save.Events.Locations, StaticDataService.ItemDefinitions))
                        {
                            Console.WriteLine(q);
                        }

                        break;

                    default:
                        Console.WriteLine(save);
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public QuestTabViewModel(SaveEvents saveEvents)
        {
            var quests = QuestModel.FromEvents(
                saveEvents.Events, saveEvents.Locations, StaticDataService.ItemDefinitions).ToList();

            QuestVm = new QuestListViewModel(quests);

            Header = "Quests (" + quests.Count() + ")";
        }