コード例 #1
0
ファイル: DiceInteractor.cs プロジェクト: Quackster/Kurkku
        /// <summary>
        /// Handle rolled dice (see task object it
        /// </summary>
        public void RolledDice(QueuedEvent queuedEvent)
        {
            if (!queuedEvent.HasAttribute(DiceAttributes.ENTITY))
            {
                return;
            }

            var diceRoll = random.Next(1, 7);

            Item.UpdateState(Convert.ToString(diceRoll));
            Item.Save();
        }
コード例 #2
0
ファイル: PlayerTaskObject.cs プロジェクト: Quackster/Kurkku
        /// <summary>
        /// Process typing status stopped after x seconds
        /// </summary>
        public void ProcessTypingStatus(QueuedEvent queuedEvent)
        {
            if (!(Entity is Player))
            {
                return;
            }

            var player = (Player)Entity;

            if (player.RoomUser.TimerManager.SpeechBubbleDate != -1 && DateUtil.GetUnixTimestamp() > player.RoomUser.TimerManager.SpeechBubbleDate)
            {
                player.RoomUser.TimerManager.ResetSpeechBubbleTimer();
                player.RoomUser.Room.Send(new TypingStatusComposer(player.RoomUser.InstanceId, false));
            }
        }
コード例 #3
0
ファイル: PlayerTaskObject.cs プロジェクト: Quackster/Kurkku
        /// <summary>
        /// Process effect expiry
        /// </summary>
        public void ProcessEffectExpiry(QueuedEvent queuedEvent)
        {
            if (!(Entity is Player))
            {
                return;
            }

            var player = (Player)Entity;

            foreach (var effect in player.EffectManager.Effects.Where(x => x.Value.Data.IsActivated && x.Value.Data.ExpiresAt != null && DateTime.Now > x.Value.Data.ExpiresAt).ToList())
            {
                if (effect.Value.Data.Quantity > 0)
                {
                    effect.Value.Data.Quantity--;
                }

                effect.Value.Data.ExpiresAt = null;

                if (effect.Value.Data.Quantity == 0)
                {
                    player.EffectManager.Effects.Remove(effect.Value.Id);
                    EffectDao.DeleteEffect(effect.Value.Data);
                }
                else
                {
                    EffectDao.UpdateEffect(effect.Value.Data);
                }

                player.Send(new EffectExpiredMessageComposer(effect.Value.Id));

                if (player.RoomEntity.EffectId == effect.Value.Id)
                {
                    player.RoomEntity.UseEffect(0);
                }
            }
        }