/// <summary> /// Constructs a new PacketLibAttribute. /// </summary> /// <param name="rawVersion">The version Id sent by the client.</param> /// <param name="clientVersion">PacketLib client version.</param> public PacketLibAttribute(int rawVersion, GameClient.eClientVersion clientVersion) { m_rawVersion = rawVersion; m_clientVersion = clientVersion; }
/// <summary> /// Finds and creates packetlib for specified raw version. /// </summary> /// <param name="rawVersion">The version number sent by the client.</param> /// <param name="client">The client for which to create packet lib.</param> /// <param name="version">The client version of packetlib.</param> /// <returns>null if not found or new packetlib instance.</returns> public static IPacketLib CreatePacketLibForVersion(int rawVersion, GameClient client, out GameClient.eClientVersion version) { foreach (Type t in ScriptMgr.GetDerivedClasses(typeof(IPacketLib))) { foreach (PacketLibAttribute attr in t.GetCustomAttributes(typeof(PacketLibAttribute), false)) { if (attr.RawVersion == rawVersion) { try { IPacketLib lib = (IPacketLib)Activator.CreateInstance(t, new object[] { client }); version = attr.ClientVersion; return(lib); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("error creating packetlib (" + t.FullName + ") for raw version " + rawVersion, e); } } } } } version = GameClient.eClientVersion.VersionUnknown; return(null); }
public static IList <StartupLocation> GetAllStartupLocationForCharacter(DOLCharacters ch, GameClient.eClientVersion cli) { return(m_cachedLocations.Where(sl => sl.MinVersion <= (int)cli) .Where(sl => sl.ClassID == 0 || sl.ClassID == ch.Class) .Where(sl => sl.RaceID == 0 || sl.RaceID == ch.Race) .Where(sl => sl.RealmID == 0 || sl.RealmID == ch.Realm) .Where(sl => sl.ClientRegionID == 0 || sl.ClientRegionID == ch.Region) .OrderByDescending(sl => sl.MinVersion).ThenByDescending(sl => sl.ClientRegionID) .ThenByDescending(sl => sl.RealmID).ThenByDescending(sl => sl.ClassID) .ThenByDescending(sl => sl.RaceID).ToList()); }