void SetLootTableHandler(BinaryReader br) { LootTableArgs args = new LootTableArgs(); args.TableID = br.ReadInt32(); args.BaseDropChance = br.ReadSingle(); args.MarkerBonus = br.ReadSingle(); int ranges = br.ReadInt32(); if (ranges > 0) { args.Ranges = new LootTableArgs.Range[ranges]; for (int i = 0; i < ranges; i++) { LootTableArgs.Range range = new LootTableArgs.Range(); range.Percentage = br.ReadSingle(); int templateCount = br.ReadInt32(); if (templateCount > 0) { range.Templates = new int[templateCount]; for (int j = 0; j < templateCount; j++) range.Templates[j] = br.ReadInt32(); } args.Ranges[i] = range; } } OnSetLootTable(this, args); }
public void SetLootTable(LootTable lt) { LootTableArgs args = new LootTableArgs(); args.TableID = lt.TableID; args.BaseDropChance = lt.BaseDropChance; args.MarkerBonus = lt.MarkerBonus; List<LootTableArgs.Range> ranges = new List<LootTableArgs.Range>(); foreach (LootRange lr in lt.Ranges) { LootTableArgs.Range range = new LootTableArgs.Range(); range.Percentage = lr.Percentage; range.Templates = new int[lr.Templates.Length]; int index = 0; foreach( ItemTemplate it in lr.Templates ) range.Templates[index++] = it.TemplateID; ranges.Add(range); } args.Ranges = ranges.ToArray(); _ffc.SetLootTable(args); }