Ejemplo n.º 1
0
        private bool ServerRemote_UseItem(IItem item)
        {
            var character = ServerRemoteContext.Character;

            this.ServerValidateItemForRemoteCall(item, character);

            var teleportObjects = Server.World
                                  .GetStaticWorldObjectsOfProto <TObjectTeleport>()
                                  .ToList();

            var knownTeleportPositions = TeleportsSystem.ServerGetDiscoveredTeleports(character);

            teleportObjects.RemoveAll(t => knownTeleportPositions.Contains(t.TilePosition));
            if (teleportObjects.Count == 0)
            {
                // no teleports to reveal
                return(false);
            }

            // reveal a single random teleport
            TeleportsSystem.ServerAddTeleportToDiscoveredList(character,
                                                              teleportObjects.TakeByRandom());

            Server.Items.SetCount(item, item.Count - 1);
            NotificationSystem.ServerSendItemsNotification(character, protoItem: this, deltaCount: -1);
            Logger.Important("Discovered a teleport with " + this.ShortId, character);
            return(true);
        }
Ejemplo n.º 2
0
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskState state)
        {
            var totalTeleportsCount = TeleportsSystem.ServerAllTeleports.Count;

            return(totalTeleportsCount > 0 &&
                   (TeleportsSystem.ServerGetDiscoveredTeleports(character).Count
                    >= totalTeleportsCount));
        }