www.pudn.com > boogiebot.zip > AreaTable.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace BoogieBot.Common
{
/// Object to access AreaTable.dbc
public class AreaTable : DBCFile
{
public AreaTable() : base(@"DBFilesClient\AreaTable.dbc")
{
}
/// Returns Area Name for a given AreaID (eg, Northshire Valley, Sentinel Hill, Moonbrook, etc)
public String getAreaName(uint areaid)
{
for (uint i = 0; i < wdbc_header.nRecords; i++)
{
uint id = getFieldAsUint32(i, 0);
if (id == areaid)
return getStringForField(i, 11);
}
throw new Exception("areaid wasn't found");
}
/// Returns MapID for a given AreaID (eg, Goldshire is on MapID=0, Astranaar is on MapID=1)
public uint getMapId(uint areaid)
{
for (uint i = 0; i < wdbc_header.nRecords; i++)
{
uint id = getFieldAsUint32(i, 0);
if (id == areaid)
return getFieldAsUint32(i, 1);
}
throw new Exception("areaid wasn't found");
}
/// Returns RegionID for a given AreaID (wtf is a RegionID though?)
public uint getRegionID(uint areaid)
{
for (uint i = 0; i < wdbc_header.nRecords; i++)
{
uint id = getFieldAsUint32(i, 0);
if (id == areaid)
return getFieldAsUint32(i, 2);
}
throw new Exception("areaid wasn't found");
}
}
}