private bool TriggerRoomChars3(TriggerData t) { if (!ListeningRoomChars) { return(false); } string n = t.Msg.Msg; Mob m = GetMob(ref n); t.Msg.Msg = n; if (m == null) { return(false); } if (RoomInfoEntry != uint.MaxValue) { if (!foundMobs.Contains(m)) { foundMobs.Add(m); } bool f = false; foreach (MobLocation x in m.Locations) { if (x.RoomEntry != RoomInfoEntry) { continue; } f = true; if (CurrentTime - x.LastVisited >= 600) { x.CountSeen++; } break; } if (!f) { MobLocation ml = new MobLocation(); ml.RoomEntry = RoomInfoEntry; ml.MobEntry = m.Entry; ml.LastVisited = CurrentTime; ml.TimesSeen = 0; ml.TimesVisited = 0; ml.CountSeen = 1; m.Locations.Add(ml); if (!RoomLocations.ContainsKey(RoomInfoEntry)) { RoomLocations[RoomInfoEntry] = new List <MobLocation>(); } RoomLocations[RoomInfoEntry].Add(ml); } } return(false); }
public override void OnEnteredCommandBefore(ref string Msg, uint ClientId, int AuthLevel) { base.OnEnteredCommandBefore(ref Msg, ClientId, AuthLevel); if (ChooseFromUnknown == 2) { int i; if (int.TryParse(Msg, out i) && i >= 1 && i <= UnknownMobs.Count) { Msg = null; i--; ChooseFromUnknown = 0; Mob m = new Mob(++_guidMob); m.Name = new[] { AddMobName }; m.Longname = UnknownMobs[i]; UnknownMobs.RemoveAt(i); m.Level = AddMobLevel; m.Keyword = AddMobKeywords; m.Areas = new[] { AddMobArea }; IMobs[m.Entry] = m; if (RoomInfoEntry != uint.MaxValue) { MobLocation ml = new MobLocation(); ml.CountSeen = 1; ml.LastVisited = 0; ml.MobEntry = m.Entry; ml.RoomEntry = RoomInfoEntry; ml.TimesSeen = 1; ml.TimesVisited = 1; m.Locations.Add(ml); if (!RoomLocations.ContainsKey(RoomInfoEntry)) { RoomLocations[RoomInfoEntry] = new List <MobLocation>(); } RoomLocations[RoomInfoEntry].Add(ml); } World.Instance.SendMessage("@wAdded a new mob to database '@G" + m.Names + " @w' [@Y" + m.Entry + "@w] and set location to current room."); } } }