public static DamageEventPrototype Builder(Table table)
    {
        DamageEventPrototype proto = new DamageEventPrototype();

        DataPull(table, proto);
        return(proto);
    }
Beispiel #2
0
    public static SpellAction ParseAndCreateSpell(string fileName)
    {
        if (allAbilites == null)
        {
            allAbilites = new Dictionary <string, SpellAction>();
        }

        LuaFile file = new LuaFile();

        file.Setup("Spells/" + fileName);
        SpellAction newSpell = new SpellAction();

        newSpell.name         = file.GetValue("Name").ToString();
        newSpell.targetType   = (TargetType)Convert.ToInt32(file.GetValue("TargetType"));
        newSpell.targetFilter = (TargetFilter)Convert.ToInt32(file.GetValue("TargetFilter"));
        newSpell.targetRange  = (TargetRange)Convert.ToInt32(file.GetValue("TargetRange"));
        newSpell.targetAOE    = (TargetAOE)Convert.ToInt32(file.GetValue("TargetAOE"));
        if (newSpell.targetRange == TargetRange.Range)
        {
            newSpell.range = Convert.ToInt32(file.GetValue("Range"));
        }
        else
        {
            newSpell.range = 1;
        }

        Table table = (Table)file.GetValue("Events");
        Table insideTable;

        foreach (DynValue dy in table.Values)
        {
            insideTable = dy.Table;
            switch (insideTable.Get("Type").String)
            {
            case "DamageEvent":
                newSpell.protoEvents.Add(DamageEventPrototype.Builder(insideTable));
                break;

            case "SpawnEvent":
                newSpell.protoEvents.Add(SpawnEventPrototype.Builder(insideTable));
                break;

            case "BuffCastEvent":
                newSpell.protoEvents.Add(BuffCastEventPrototype.Builder(insideTable));
                break;

            default:
                break;
            }
        }
        return(newSpell);
    }
 private static void DataPull(Table table, DamageEventPrototype proto)
 {
     proto.amount     = (int)table.Get("Amount").Number;
     proto.damageType = (RuneManager.DamageEvent.DamageType)(int) table.Get("DamgeType").Number;
 }
 private static void DataPull(Table table, DamageEventPrototype proto)
 {
     proto.amount = (int)table.Get("Amount").Number;
     proto.damageType = (RuneManager.DamageEvent.DamageType)(int)table.Get("DamgeType").Number;
 }
 public static DamageEventPrototype Builder(Table table)
 {
     DamageEventPrototype proto = new DamageEventPrototype();
     DataPull(table, proto);
     return proto;
 }