Ejemplo n.º 1
0
 private void OnClientMessage(IPlayer fromPlayer, NetworkApiTestResponse networkMessage)
 {
     serverApi.SendMessageToGroup(
         GlobalConstants.GeneralChatGroup,
         "Received following response from " + fromPlayer.PlayerName + ": " + networkMessage.response,
         EnumChatType.Notification
         );
 }
Ejemplo n.º 2
0
        private void Event_PlayerDeath(IServerPlayer byPlayer, DamageSource damageSource)
        {
            string outstr = "";

            if (damageSource != null)
            {
                switch (damageSource.Type)
                {
                case EnumDamageType.Gravity:
                    if (deathTexts.Gravity != null)
                    {
                        int size  = deathTexts.Gravity.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Gravity[index];
                    }
                    break;

                case EnumDamageType.Fire:
                    if (deathTexts.Fire != null)
                    {
                        int size  = deathTexts.Fire.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Fire[index];
                    }
                    break;

                case EnumDamageType.BluntAttack:
                    if (deathTexts.BluntAttack != null)
                    {
                        int size  = deathTexts.BluntAttack.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.BluntAttack[index];
                    }
                    break;

                case EnumDamageType.SlashingAttack:
                    if (deathTexts.SlashingAttack != null)
                    {
                        int size  = deathTexts.SlashingAttack.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.SlashingAttack[index];
                    }
                    break;

                case EnumDamageType.PiercingAttack:
                    if (deathTexts.PiercingAttack != null)
                    {
                        int size  = deathTexts.PiercingAttack.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.PiercingAttack[index];
                    }
                    break;

                case EnumDamageType.Suffocation:
                    if (deathTexts.Suffocation != null)
                    {
                        int size  = deathTexts.Suffocation.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Suffocation[index];
                    }
                    break;

                case EnumDamageType.Heal:
                    if (deathTexts.Heal != null)
                    {
                        int size  = deathTexts.Heal.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Heal[index];
                    }
                    break;

                case EnumDamageType.Poison:
                    if (deathTexts.Poison != null)
                    {
                        int size  = deathTexts.Poison.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Poison[index];
                    }
                    break;

                case EnumDamageType.Hunger:
                    if (deathTexts.Hunger != null)
                    {
                        int size  = deathTexts.Hunger.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Hunger[index];
                    }
                    break;

                case EnumDamageType.Crushing:
                    if (deathTexts.Crushing != null)
                    {
                        int size  = deathTexts.Crushing.Count;
                        int index = rand.Next(size);
                        outstr = deathTexts.Crushing[index];
                    }
                    break;

                default:
                {
                    int size  = deathTexts.Void.Count;
                    int index = rand.Next(size);
                    outstr = deathTexts.Void[index];
                    break;
                }
                }
            }
            else
            {
                int size  = deathTexts.Void.Count;
                int index = rand.Next(size);
                outstr = deathTexts.Void[index];
            }

            if (outstr == null)
            {
                return;
            }

            if (outstr.IndexOf("{Name}") != -1)
            {
                outstr = outstr.Replace("{Name}", byPlayer.PlayerName);
            }

            SAPI.SendMessageToGroup(GlobalConstants.AllChatGroups, outstr, EnumChatType.Notification);
        }