public Item Construct(Mobile from, bool spawning) { if (m_AtSpawnTime != spawning) { return(null); } int totalChance = 0; for (int i = 0; i < m_Items.Length; ++i) { totalChance += m_Items[i].Chance; } int rnd = Utility.Random(totalChance); for (int i = 0; i < m_Items.Length; ++i) { LootPackItem item = m_Items[i]; if (rnd < item.Chance) { return(Mutate(from, item.Construct(false, false))); } rnd -= item.Chance; } return(null); }
public Item Construct(Mobile from, int luckChance, bool spawning) { if (m_AtSpawnTime != spawning) { return(null); } int totalChance = 0; for (int i = 0; i < m_Items.Length; ++i) { totalChance += m_Items[i].Chance; } var inTokuno = Core.SE && IsInTokuno(from); var isMondain = Core.ML && (IsMondain(from) || (from.LastKiller != null ? from.LastKiller.Race : null) == Race.Elf); var isStygian = Core.SA && (IsStygian(from) || (from.LastKiller != null ? from.LastKiller.Race : null) == Race.Gargoyle); int rnd = Utility.Random(totalChance); for (int i = 0; i < m_Items.Length; ++i) { LootPackItem item = m_Items[i]; if (rnd < item.Chance) { return(Mutate(from, luckChance, item.Construct(inTokuno, isMondain, isStygian))); } rnd -= item.Chance; } return(null); }
public Item Construct() { int rnd = Utility.Random(m_TotalChance); for (int i = 0; i < m_Items.Length; ++i) { LootPackItem item = m_Items[i]; if (rnd < item.Chance) { return(Mutate(item.Construct())); } rnd -= item.Chance; } return(null); }
public Item Construct(IEntity from, int luckChance, LootStage stage, bool hasBeenStolenFrom) { int totalChance = 0; for (int i = 0; i < Items.Length; ++i) { totalChance += Items[i].Chance; } int rnd = Utility.Random(totalChance); for (int i = 0; i < Items.Length; ++i) { LootPackItem item = Items[i]; if (rnd < item.Chance) { Item loot = null; if (item.ConstructCallback != null) { loot = item.ConstructCallback(from); } else { loot = item.Construct(IsInTokuno(from), IsMondain(from), IsStygian(from)); } if (loot != null) { return(Mutate(from, luckChance, loot)); } } rnd -= item.Chance; } return(null); }