using System;
using System.Collections.Generic;
using ACE.DatLoader;
using ACE.DatLoader.FileTypes;
using ACE.Entity;
using ACE.Entity.Models;
namespace ACE.Server.WorldObjects
{
public class SpellComponent : Stackable
{
///
/// The DAT file containing DualDidMapper for spell component ids => wcids
///
public static uint SpellComponentDIDs = 0x27000002;
///
/// The spell components table from the portal.dat
///
public static SpellComponentsTable SpellComponentsTable { get => DatManager.PortalDat.SpellComponentsTable; }
///
/// A lookup table of spell component wcids => component ids
///
public static Dictionary SpellComponentWCIDs;
static SpellComponent()
{
BuildSpellComponentWCIDs();
}
public static void BuildSpellComponentWCIDs()
{
SpellComponentWCIDs = new Dictionary();
var dualDIDs = DatManager.PortalDat.ReadFromDat(SpellComponentDIDs);
foreach (var component_id in SpellComponentsTable.SpellComponents.Keys)
{
if (!dualDIDs.ClientEnumToID.TryGetValue(component_id, out var wcid))
{
Console.WriteLine($"BuildSpellComponentWCIDs({component_id}): couldn't find component ID");
continue;
}
SpellComponentWCIDs.Add(wcid, component_id);
}
}
///
/// Returns TRUE if the input wcid is a valid spell component
///
public static bool IsValid(uint wcid)
{
return SpellComponentWCIDs.ContainsKey(wcid);
}
///
/// A new biota be created taking all of its values from weenie.
///
public SpellComponent(Weenie weenie, ObjectGuid guid) : base(weenie, guid)
{
SetEphemeralValues();
}
///
/// Restore a WorldObject from the database.
///
public SpellComponent(Biota biota) : base(biota)
{
SetEphemeralValues();
}
private void SetEphemeralValues()
{
}
}
}