Пример #1
0
        public void ResetChain(MessageChainData chain)
        {
            if (chain == null)
                return;

            ResetChain(chain, chain.Message);
        }
Пример #2
0
        public void ResetChain(MessageChainData chain)
        {
            if (chain == null)
            {
                return;
            }

            ResetChain(chain, chain.Message);
        }
        private bool ShouldParticipateInChain(MessageChainData currentChain)
        {
            var baseChance = Double.Parse(Config.Get("MessageChainBaseChance", "0.125"));
            var multiplier = Double.Parse(Config.Get("MessageChainChanceMultiplier", "2"));
            var chanceOfParticipating = 0.0;

            if (currentChain.Length > 1)
            {
                chanceOfParticipating = baseChance * Math.Pow(multiplier, currentChain.Length-2);
            }

            return StaticRandom.NextDouble() < chanceOfParticipating;
        }
Пример #4
0
        private bool ShouldParticipateInChain(MessageChainData currentChain)
        {
            var baseChance            = Double.Parse(Config.Get("MessageChainBaseChance", "0.125"));
            var multiplier            = Double.Parse(Config.Get("MessageChainChanceMultiplier", "2"));
            var chanceOfParticipating = 0.0;

            if (currentChain.Length > 1)
            {
                chanceOfParticipating = baseChance * Math.Pow(multiplier, currentChain.Length - 2);
            }

            return(StaticRandom.NextDouble() < chanceOfParticipating);
        }
Пример #5
0
        public void AddMessage(string channel, string message)
        {
            MessageChainData currentChain;

            if (!chains.TryGetValue(channel, out currentChain))
            {
                currentChain = new MessageChainData()
                {
                    Message = message,
                    Length = 0
                };

                chains[channel] = currentChain;
            }

            if (currentChain.Message.Equals(message, StringComparison.InvariantCultureIgnoreCase))
            {
                currentChain.Length++;
            }
            else
            {
                ResetChain(currentChain, message);
            }
        }
Пример #6
0
        public void AddMessage(string channel, string message)
        {
            MessageChainData currentChain;

            if (!chains.TryGetValue(channel, out currentChain))
            {
                currentChain = new MessageChainData()
                {
                    Message = message,
                    Length  = 0
                };

                chains[channel] = currentChain;
            }

            if (currentChain.Message.Equals(message, StringComparison.InvariantCultureIgnoreCase))
            {
                currentChain.Length++;
            }
            else
            {
                ResetChain(currentChain, message);
            }
        }
Пример #7
0
 private void ResetChain(MessageChainData chain, string newMessage)
 {
     chain.Message = newMessage;
     chain.Length = 0;
 }
Пример #8
0
 private void ResetChain(MessageChainData chain, string newMessage)
 {
     chain.Message = newMessage;
     chain.Length  = 0;
 }