Ejemplo n.º 1
0
        public void GetMapNamesTest(bool ignoreCache)
        {
            var actual   = GwApi.GetMapNames(ignoreCache);
            var expected = TestData.MapNameEntriesExpected;

            foreach (var pair in expected)
            {
                var actualEntry   = actual[pair.Key];
                var expectedEntry = pair.Value;
                Assert.NotNull(actualEntry);
                Assert.AreEqual(expectedEntry.Name, actualEntry.Name);
            }
        }
Ejemplo n.º 2
0
        public void EventsExample()
        {
            GwApi.Network = new NetworkHandler();
            // First lets find out what my world ID is
            var worldNames = GwApi.GetWorldNames();
            int world_id   = worldNames.Values.Single(w => w.Name == "Sorrow's Furnace").Id;

            // now lets get the event names and map names
            // These are lookups keyed on ID value
            var eventNames = GwApi.GetEventNames();
            var maps       = GwApi.GetMapNames();

            // Now lets get a list of events on my world
            // We can use include whatever information we want to query with
            // In this case we want all events where the world id = world_id
            // we could also reduce our search further by providing a map id or event an event id
            var events = GwApi.GetEvents(world_id, -1, null);

            // Lets print all of the active events
            // We can show the map the event is on and it's name
            var activeEvents = events.Where(e => e.State == EventState.Active);

            // Lets get the event details for all events
            // we could request a single event detail by providing the event id as well
            var eventDetails = GwApi.GetEventDetails();

            // we'll use a StringBuilder to compose our print list
            var sb = new StringBuilder("--- Active Event List ---\n");

            foreach (var e in activeEvents)
            {
                // event detail for current e
                var eventDetail = eventDetails[e.EventId];
                sb.AppendFormat("Name: {0}\n", eventDetail.Name);
                sb.AppendFormat("Map: {0}\n", maps[eventDetail.MapId].Name);
                sb.AppendFormat("Level: {0}\n", eventDetail.Level);
                sb.AppendLine("--------");
            }
            // Print the contents
            Console.WriteLine(sb.ToString());

            // We've just downloaded a bunch of data which takes a bit of time
            // Sepcifically the complete event details list
            // If we save this, the next time we need the list it will take very little time
            ResponseCache.Cache.Save();
        }
Ejemplo n.º 3
0
 public EntryDictionary <int, MapNameEntry> GetMapNames()
 {
     return(GwApi.GetMapNames());
 }
Ejemplo n.º 4
0
 public String GetMapName(int mapID)
 {
     return(GwApi.GetMapNames()[mapID].Name);
 }