public MapInstance(Map map, Guid guid, bool shopAllowed, MapInstanceType type, InstanceBag instanceBag) { Buttons = new List <MapButton>(); XpRate = 1; DropRate = 1; InstanceMusic = map.Music; ShopAllowed = shopAllowed; MapInstanceType = type; _isSleeping = true; LastUserShopId = 0; InstanceBag = instanceBag; Clock = new Clock(3); _random = new Random(); Map = map; MapInstanceId = guid; ScriptedInstances = new List <ScriptedInstance>(); OnCharacterDiscoveringMapEvents = new List <Tuple <EventContainer, List <long> > >(); OnMoveOnMapEvents = new ThreadSafeGenericList <EventContainer>(); OnAreaEntryEvents = new ThreadSafeGenericList <ZoneEvent>(); WaveEvents = new List <EventWave>(); OnMapClean = new List <EventContainer>(); _monsters = new ThreadSafeSortedList <long, MapMonster>(); _npcs = new ThreadSafeSortedList <long, MapNpc>(); _mapMonsterIds = new ThreadSafeSortedList <int, int>(); _mapNpcIds = new ThreadSafeSortedList <int, int>(); DroppedList = new ThreadSafeSortedList <long, MapItem>(); Portals = new List <Portal>(); UnlockEvents = new List <EventContainer>(); UserShops = new Dictionary <long, MapShop>(); StartLife(); }
public MapInstance(Map map, Guid guid, bool shopAllowed, MapInstanceType type, InstanceBag instanceBag) { Buttons = new List <MapButton>(); XpRate = 1; DropRate = 1; _isShopAllowed = shopAllowed; MapInstanceType = type; _isSleeping = true; LastUserShopId = 0; InstanceBag = instanceBag; Clock = new Clock(3); _random = new Random(); Map = map; MapInstanceId = guid; UnlockEvents = new ConcurrentBag <EventContainer>(); ScriptedInstances = new List <ScriptedInstance>(); OnCharacterDiscoveringMapEvents = new ConcurrentBag <Tuple <EventContainer, List <long> > >(); OnMoveOnMapEvents = new ConcurrentBag <EventContainer>(); OnAreaEntryEvents = new ConcurrentBag <ZoneEvent>(); WaveEvents = new ConcurrentBag <EventWave>(); OnMapClean = new ConcurrentBag <EventContainer>(); _monsters = new ConcurrentDictionary <long, MapMonster>(); _npcs = new ConcurrentDictionary <long, MapNpc>(); _lastMapId = 1; DroppedList = new ConcurrentDictionary <long, MapItem>(); Portals = new List <Portal>(); UserShops = new Dictionary <long, MapShop>(); MapDesignObjects = new ConcurrentBag <MapDesignObject>(); MonsterLocker = new Locker(); ButtonLocker = new Locker(); StartLife(); }
public MapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType type, IMapItemGenerationService mapItemGenerationService, ILogger logger) { LastPackets = new ConcurrentQueue <IPacket>(); XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; Portals = new List <Portal>(); _monsters = new ConcurrentDictionary <int, MapMonster>(); _npcs = new ConcurrentDictionary <int, MapNpc>(); MapItems = new ConcurrentDictionary <long, MapItem>(); _isSleeping = true; LastUnregister = SystemTime.Now().AddMinutes(-1); ExecutionEnvironment.TryGetCurrentExecutor(out var executor); Sessions = new DefaultChannelGroup(executor); _mapItemGenerationService = mapItemGenerationService; _logger = logger; Requests = new Dictionary <Type, Subject <RequestData <MapInstance> > > { [typeof(IMapInstanceEntranceEventHandler)] = new Subject <RequestData <MapInstance> >() }; }
public MapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType type, IMapItemProvider mapItemProvider, ILogger logger, List <IMapInstanceEventHandler> mapInstanceEventHandler) { LastPackets = new ConcurrentQueue <IPacket>(); XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; Portals = new List <Portal>(); _monsters = new ConcurrentDictionary <int, MapMonster>(); _npcs = new ConcurrentDictionary <int, MapNpc>(); MapItems = new ConcurrentDictionary <long, MapItem>(); _isSleeping = true; LastUnregister = SystemTime.Now().AddMinutes(-1); ExecutionEnvironment.TryGetCurrentExecutor(out var executor); Sessions = new DefaultChannelGroup(executor); _mapItemProvider = mapItemProvider; _logger = logger; Requests = new Dictionary <MapInstanceEventType, Subject <RequestData <MapInstance> > >(); _mapInstanceEventHandler = mapInstanceEventHandler; foreach (var eventTypes in Enum.GetValues(typeof(MapInstanceEventType))) { Requests[(MapInstanceEventType)eventTypes !] = new Subject <RequestData <MapInstance> >();
public MapInstance(Map map, Guid guid, bool shopAllowed, MapInstanceType type, InstanceBag instanceBag, bool dropAllowed = false) { OnSpawnEvents = new List <EventContainer>(); Buttons = new List <MapButton>(); XpRate = 0; if (type == MapInstanceType.BaseMapInstance) { XpRate = map.XpRate; } //check here MinLevel = 1; MaxLevel = 99; if (type != MapInstanceType.TimeSpaceInstance && type != MapInstanceType.RaidInstance) { switch (map.MapId) { case 154: // Caligor's Realm MinLevel = 80; break; case 228: // Cylloan MinLevel = 88; break; } } DropRate = 0; DropAllowed = dropAllowed; InstanceMusic = map.Music; ShopAllowed = shopAllowed; MapInstanceType = type; _isSleeping = true; LastUserShopId = 0; InstanceBag = instanceBag; Clock = new Clock(3); _random = new Random(); Map = map; MapInstanceId = guid; ScriptedInstances = new List <ScriptedInstance>(); OnCharacterDiscoveringMapEvents = new List <Tuple <EventContainer, List <long> > >(); OnMoveOnMapEvents = new ThreadSafeGenericList <EventContainer>(); OnAreaEntryEvents = new ThreadSafeGenericList <ZoneEvent>(); WaveEvents = new List <EventWave>(); OnMapClean = new List <EventContainer>(); _monsters = new ThreadSafeSortedList <long, MapMonster>(); _delayedMonsters = new ThreadSafeSortedList <long, MapMonster>(); _npcs = new ThreadSafeSortedList <long, MapNpc>(); _mapMonsterIds = new ThreadSafeSortedList <int, int>(); _mapNpcIds = new ThreadSafeSortedList <int, int>(); DroppedList = new ThreadSafeSortedList <long, MapItem>(); Portals = new List <Portal>(); UnlockEvents = new List <EventContainer>(); UserShops = new Dictionary <long, MapShop>(); RemovedMobNpcList = new List <object>(); StartLife(); }
public MapInstance(MapDTO map, Guid guid, bool shopAllowed, MapInstanceType type) { XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; _monsters = new ConcurrentDictionary <long, MapMonster>(); _npcs = new ConcurrentDictionary <long, MapNpcDTO>(); }
public MapInstance GenerateMapInstance(short mapId, MapInstanceType type) { Map.Map map = _maps.Find(m => m.MapId.Equals(mapId)); if (map == null) { return(null); } Guid guid = Guid.NewGuid(); MapInstance mapInstance = new MapInstance(map, guid, false, type); _mapinstances.TryAdd(guid, mapInstance); return(mapInstance); }
public MapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType type) { XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; Portals = new List <Portal>(); _monsters = new ConcurrentDictionary <long, MapMonster>(); _npcs = new ConcurrentDictionary <long, MapNpc>(); _isSleeping = true; }
public MapInstance GenerateMapInstance(short mapId, MapInstanceType type) { var map = Maps.Find(m => m.MapId.Equals(mapId)); if (map == null) { return(null); } var guid = Guid.NewGuid(); var mapInstance = new MapInstance(map, guid, false, type); mapInstance.LoadPortals(); Mapinstances.TryAdd(guid, mapInstance); return(mapInstance); }
public static void GenerateRaid(MapInstanceType raidType, byte faction) { ServerManager.GetMapInstance(ServerManager.GetBaseMapInstanceIdByMapId((short)(129 + faction))).CreatePortal(new Portal() { SourceMapId = (short)(129 + faction), SourceX = 53, SourceY = 53, DestinationMapId = 0, DestinationX = 1, DestinationY = 1, Type = (short)(9 + faction) }); Act4RaidThread raidThread = new Act4RaidThread(); Observable.Timer(TimeSpan.FromMinutes(0)).Subscribe(X => raidThread.Run(raidType, faction)); }
public MapInstance(Map map, Guid guid, bool shopAllowed, MapInstanceType type) { ShopAllowed = shopAllowed; MapInstanceType = type; _isSleeping = true; LastUserShopId = 0; _random = new Random(); ShopAllowed = true; Map = map; MapInstanceId = guid; _monsters = new ThreadSafeSortedList <long, MapMonster>(); _mapMonsterIds = new List <int>(); DroppedList = new ThreadSafeSortedList <long, MapItem>(); _portals = new List <Portal>(); UserShops = new Dictionary <long, MapShop>(); _npcs = new List <MapNpc>(); _npcs.AddRange(ServerManager.Instance.GetMapNpcsByMapId(Map.MapId).AsEnumerable()); }
public MapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType type, List <NpcMonsterDto> npcMonsters) { _npcMonsters = npcMonsters; XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; Portals = new List <Portal>(); _monsters = new ConcurrentDictionary <long, MapMonster>(); _npcs = new ConcurrentDictionary <long, MapNpc>(); DroppedList = new ConcurrentDictionary <long, MapItem>(); _isSleeping = true; LastUnregister = DateTime.Now.AddMinutes(-1); ExecutionEnvironment.TryGetCurrentExecutor(out var executor); Sessions = new DefaultChannelGroup(executor); }
public MapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType type, IMapItemProvider mapItemProvider, IAdapter adapter, ILogger logger) { XpRate = 1; DropRate = 1; ShopAllowed = shopAllowed; MapInstanceType = type; Map = map; MapInstanceId = guid; Portals = new List <Portal>(); _monsters = new ConcurrentDictionary <int, MapMonster>(); _npcs = new ConcurrentDictionary <int, MapNpc>(); MapItems = new ConcurrentDictionary <long, MapItem>(); _isSleeping = true; LastUnregister = SystemTime.Now().AddMinutes(-1); ExecutionEnvironment.TryGetCurrentExecutor(out var executor); Sessions = new DefaultChannelGroup(executor); _mapItemProvider = mapItemProvider; _adapter = adapter; _logger = logger; }
public static void GenerateRaid(MapInstanceType raidtype, byte faction) { MapInstance bitoren = ServerManager.GetMapInstance(ServerManager.GetBaseMapInstanceIdByMapId(134)); bitoren.CreatePortal(new Portal { SourceMapId = 134, SourceX = 140, SourceY = 100, DestinationMapId = 153, DestinationX = 0, DestinationY = 0, Type = -1 }); MapInstance map = ServerManager.GetMapInstanceByMapId(153); map.MapInstanceType = MapInstanceType.Ac4Raid; map.IsPVP = true; map.SummonMonster(new MonsterToSummon(2305, new MapCell { X = 88, Y = 82 }, -1, true, isBoss: true, faction: faction)); }
public void Run(MapInstanceType raidType, byte faction) { _raidType = raidType; _faction = faction; switch (raidType) { // Morcos is default case MapInstanceType.Act4Hatus: _mapId = 137; _bossMapId = 138; _bossVNum = 577; _bossX = 36; _bossY = 18; _sourcePortalX = 37; _sourcePortalY = 156; _destPortalX = 36; _destPortalY = 58; _bossMove = false; break; case MapInstanceType.Act4Calvina: _mapId = 139; _bossMapId = 140; _bossVNum = 629; _bossX = 26; _bossY = 26; _sourcePortalX = 194; _sourcePortalY = 17; _destPortalX = 9; _destPortalY = 41; _bossMove = true; break; case MapInstanceType.Act4Berios: _mapId = 141; _bossMapId = 142; _bossVNum = 624; _bossX = 29; _bossY = 29; _sourcePortalX = 188; _sourcePortalY = 96; _destPortalX = 29; _destPortalY = 54; _bossMove = true; break; } int raidTime = 3600; const int interval = 30; //Run once to load everything in place refreshRaid(raidTime); ServerManager.Instance.Act4RaidStart = DateTime.Now; while (raidTime > 0) { raidTime -= interval; Thread.Sleep(interval * 1000); refreshRaid(raidTime); } endRaid(); }
public MapInstance CreateMapInstance(Map.Map map, Guid guid, bool shopAllowed, MapInstanceType normalInstance, List <IMapInstanceEventHandler> mapInstanceEventHandler) { return(new MapInstance(map, guid, shopAllowed, normalInstance, _mapItemProvider, _logger, mapInstanceEventHandler)); }
public MapInstance(Map map, Guid guid, bool shopAllowed, MapInstanceType type, InstanceBag instanceBag, bool dropAllowed = false) { OnSpawnEvents = new List <EventContainer>(); Buttons = new List <MapButton>(); XpRate = 0; if (type == MapInstanceType.BaseMapInstance) { XpRate = map.XpRate; } MinLevel = 1; MaxLevel = 99; MinHeroLevel = 0; MaxHeroLevel = 100; if (type != MapInstanceType.TimeSpaceInstance && type != MapInstanceType.RaidInstance) { switch (map.MapId) { case 154: // Caligor's Realm MinLevel = 80; break; case 170: // Desert case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: case 180: case 181: case 182: case 183: case 184: case 185: case 186: case 187: case 188: case 189: case 190: case 191: case 192: case 193: case 194: case 195: case 196: case 197: case 198: case 199: case 200: case 201: case 202: case 203: case 204: case 205: case 207: case 208: case 209: case 210: case 211: case 212: case 223: case 224: case 225: case 226: case 227: MinLevel = 70; break; case 228: //Cylloan case 229: case 230: case 231: case 232: case 233: case 234: case 235: case 236: case 237: case 238: case 239: case 240: case 241: case 242: case 243: case 244: case 245: case 246: MinLevel = 85; break; case 2628: case 2629: case 2630: case 2631: case 2632: case 2633: case 2634: case 2635: case 2636: case 2637: case 2638: case 2639: case 2640: case 2641: case 2642: case 2643: case 2644: case 2645: case 2646: case 2647: case 2648: case 2649: case 2650: MinLevel = 88; MinHeroLevel = 10; break; } } DropRate = 0; DropAllowed = dropAllowed; InstanceMusic = map.Music; ShopAllowed = shopAllowed; MapInstanceType = type; _isSleeping = true; LastUserShopId = 0; InstanceBag = instanceBag; Clock = new Clock(3); _random = new Random(); Map = map; MapInstanceId = guid; ScriptedInstances = new List <ScriptedInstance>(); OnCharacterDiscoveringMapEvents = new List <Tuple <EventContainer, List <long> > >(); OnMoveOnMapEvents = new ThreadSafeGenericList <EventContainer>(); OnAreaEntryEvents = new ThreadSafeGenericList <ZoneEvent>(); WaveEvents = new List <EventWave>(); OnMapClean = new List <EventContainer>(); _monsters = new ThreadSafeSortedList <long, MapMonster>(); _delayedMonsters = new ThreadSafeSortedList <long, MapMonster>(); _npcs = new ThreadSafeSortedList <long, MapNpc>(); _mapMonsterIds = new ThreadSafeSortedList <int, int>(); _mapNpcIds = new ThreadSafeSortedList <int, int>(); DroppedList = new ThreadSafeSortedList <long, MapItem>(); Portals = new List <Portal>(); UnlockEvents = new List <EventContainer>(); UserShops = new Dictionary <long, MapShop>(); RemovedMobNpcList = new List <object>(); StartLife(); }
public void Run(MapInstanceType raidType, byte faction) { _raidType = raidType; _faction = faction; switch (raidType) { // Morcos is default case MapInstanceType.Act4Hatus: _mapId = 137; _bossMapId = 138; _bossVNum = 577; _bossX = 36; _bossY = 18; _sourcePortalX = 37; _sourcePortalY = 156; _destPortalX = 36; _destPortalY = 58; _bossMove = false; break; case MapInstanceType.Act4Calvina: _mapId = 139; _bossMapId = 140; _bossVNum = 629; _bossX = 26; _bossY = 26; _sourcePortalX = 194; _sourcePortalY = 17; _destPortalX = 9; _destPortalY = 41; _bossMove = true; break; case MapInstanceType.Act4Berios: _mapId = 141; _bossMapId = 142; _bossVNum = 624; _bossX = 29; _bossY = 29; _sourcePortalX = 188; _sourcePortalY = 96; _destPortalX = 29; _destPortalY = 54; _bossMove = true; break; } int raidTime = 3600; const int interval = 30; //Run once to load everything in place RefreshRaid(raidTime); ServerManager.Instance.Act4RaidStart = DateTime.UtcNow; for (int i = interval; i < raidTime; i += interval) { Observable.Timer(TimeSpan.FromSeconds(i)).Subscribe(observer => { raidTime -= interval; RefreshRaid(raidTime); }); } Observable.Timer(TimeSpan.FromSeconds(raidTime)).Subscribe(observer => EndRaid()); }
public static void GenerateRaid(MapInstanceType raidType, byte faction) { Guardians = new List <MapMonster>(); MapInstance bitoren = ServerManager.GetMapInstance(ServerManager.GetBaseMapInstanceIdByMapId(134)); bitoren.CreatePortal(new Portal { SourceMapId = 134, SourceX = 140, SourceY = 100, DestinationMapId = 0, DestinationX = 1, DestinationY = 1, Type = (short)(9 + faction) }); #region Guardian Spawning Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 147, MapY = 88, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 149, MapY = 94, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 147, MapY = 101, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 139, MapY = 105, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 132, MapY = 101, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 129, MapY = 94, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); Guardians.Add(new MapMonster { MonsterVNum = (short)(678 + faction), MapX = 132, MapY = 88, MapId = 134, Position = 2, IsMoving = false, MapMonsterId = bitoren.GetNextMonsterId(), ShouldRespawn = false, IsHostile = true }); #endregion foreach (MapMonster monster in Guardians) { monster.Initialize(bitoren); bitoren.AddMonster(monster); bitoren.Broadcast(monster.GenerateIn()); } Act4RaidThread raidThread = new Act4RaidThread(); Observable.Timer(TimeSpan.FromMinutes(0)).Subscribe(x => raidThread.Run(raidType, faction)); }