/// <summary> /// Spawn un groupe de monstre qui sera généré en fonction des constantes de générations. /// </summary> /// <param name="spawns"></param> /// <param name="quiet"></param> public void AddGeneratedMonsterGroup(AbstractMapInstance instance, MonsterSpawnRecord[] spawns, bool quiet) { AsyncRandom random = new AsyncRandom(); MonsterGroup group = new MonsterGroup(instance.Record); for (int w = 0; w < random.Next(1, instance.Record.BlueCells.Count + 1); w++) { int max = spawns.Sum((MonsterSpawnRecord entry) => entry.Probability); int num = random.Next(0, max); int num2 = 0; foreach (var monsterRecord in spawns) { num2 += monsterRecord.Probability; if (num <= num2) { MonsterRecord template = MonsterRecord.GetMonster(monsterRecord.MonsterId); Monster monster = new Monster(template, group, template.RandomGrade(random)); group.AddMonster(monster); break; } } } if (quiet) { instance.AddQuietEntity(group); } else { instance.AddEntity(group); } }
public MapInteractiveElement(AbstractMapInstance mapInstance, InteractiveElementRecord record) { this.Record = record; this.MapInstance = mapInstance; this.EnabledSkills = record.Skills.ConvertAll(x => new MapInteractiveElementSkill(this, x)); this.DisabledSkills = new List <MapInteractiveElementSkill>(); }
public Portal(PortalRecord template, AbstractMapInstance instance) { this.Template = template; this.m_Id = instance.PopNextNPEntityId(); this.CellId = instance.Record.RandomNoBorderCell(); this.Direction = DirectionsEnum.DIRECTION_SOUTH; this.Map = instance.Record; }
public DropItem(CharacterItemRecord record, ushort quantity, ushort cellid, AbstractMapInstance map) { this.Id = map.PopNextDropItemId(); this.Record = record; this.Map = map; this.CellId = cellid; this.Quantity = quantity; Timer = new ActionTimer(900000, Remove, false); PickedUp = false; }
public MapInteractiveElement GetMapInteractiveElement(AbstractMapInstance mapInstance) { if (Stated) { return(new MapStatedElement(mapInstance, this)); } else { return(new MapInteractiveElement(mapInstance, this)); } }
public void RemoveGroup(AbstractMapInstance instance, MonsterRecord[] monsterRecords) { foreach (var group in instance.GetEntities <MonsterGroup>()) { if (group.GetMonsters().All(x => monsterRecords.Contains(x.Template))) { instance.RemoveEntity(group); break; } } }
public bool GroupExist(AbstractMapInstance instance, MonsterRecord[] monsterRecords) { foreach (var group in instance.GetEntities <MonsterGroup>()) { if (group.GetMonsters().All(x => monsterRecords.Contains(x.Template))) { return(true); } } return(false); }
/// <summary> /// Spawn un groupe fixe de mobs /// </summary> /// <param name="instance"></param> /// <param name="monsterRecords"></param> /// <param name="quiet"></param> public void AddFixedMonsterGroup(AbstractMapInstance instance, MonsterRecord[] monsterRecords, bool quiet) { MonsterGroup group = new MonsterGroup(instance.Record); foreach (var template in monsterRecords) { Monster monster = new Monster(template, group); group.AddMonster(monster); } if (quiet) { instance.AddQuietEntity(group); } else { instance.AddEntity(group); } }
public void AddFixedMonsterGroup(AbstractMapInstance instance, MonsterRecord[] monsterRecords, sbyte[] grades, bool quiet) { if (monsterRecords.Length != grades.Length) { throw new Exception("Record array must have same lenght that grade array."); } MonsterGroup group = new MonsterGroup(instance.Record); for (int i = 0; i < monsterRecords.Length; i++) { Monster monster = new Monster(monsterRecords[i], group, grades[i]); group.AddMonster(monster); } if (quiet) { instance.AddQuietEntity(group); } else { instance.AddEntity(group); } }
public static DropItem Create(CharacterItemRecord record, ushort quantity, ushort cellid, AbstractMapInstance map) { return(new DropItem(record, quantity, cellid, map)); }
public MapStatedElement(AbstractMapInstance mapInstance, InteractiveElementRecord record) : base(mapInstance, record) { }