private void HandlePortal(Player player, Portal portal) { if (portal == null || !portal.Usable) { return; } using (TimedLock.Lock(portal.CreateWorldLock)) { var world = portal.WorldInstance; //if (player.Owner.Opener != player.Name && player.Credits < 1000 && // (portal.ObjectType == 0x22c3 || portal.ObjectType == 0x63ae || portal.ObjectType == 0x612b || portal.ObjectType == 0x75b3)) { // player.SendError("You do not have enough gold to enter this raid!"); // return; // } // special portal case lookup if (world == null && _realmPortals.Contains(portal.ObjectType)) { world = player.Manager.GetRandomGameWorld(); if (world == null) { return; } } if (world is Realm && !player.Manager.Resources.GameData.ObjectTypeToId[portal.ObjectDesc.ObjectType].Contains("Cowardice")) { player.FameCounter.CompleteDungeon(player.Owner.Name); } if (world != null) { player.Reconnect(world); if (portal.WorldInstance?.Invites != null) { portal.WorldInstance.Invites.Remove(player.Name.ToLower()); } if (portal.WorldInstance?.Invited != null) { portal.WorldInstance.Invited.Add(player.Name.ToLower()); } return; } // dynamic case lookup if (portal.CreateWorldTask == null || portal.CreateWorldTask.IsCompleted) { portal.CreateWorldTask = Task.Factory .StartNew(() => portal.CreateWorld(player)) .ContinueWith(e => Log.Error(e.Exception.InnerException.ToString()), TaskContinuationOptions.OnlyOnFaulted); } portal.WorldInstanceSet += player.Reconnect; } }
private static void HandleGuildPortal(Player player, GuildHallPortal portal) { if (portal.ObjectType == 0x072f) { var proto = player.Manager.Resources.Worlds["GuildHall"]; var world = player.Manager.GetWorld(proto.id); player.Reconnect(world); return; } player.SendInfo("Portal not implemented."); }