Иконка ресурса

FREE ArenaCS : 0.1.0 0.1.0

Нет прав для скачивания
C#:
// Requires: Arena
using Newtonsoft.Json;
using Oxide.Plugins.ArenaEx;
using System;
using System.Collections.Generic;
using UnityEngine;

///Скачано с дискорд сервера Rust Edit [PRO+]
///discord.gg/9vyTXsJyKR

namespace Oxide.Plugins
{
    [Info("ArenaCS", "discord.gg/9vyTXsJyKR", "0.1.0"), Description("Counterstrike event mode for Arena")]
    class ArenaCS : RustPlugin, IEventPlugin
    {
        #region Oxide Hooks
        private void OnServerInitialized()
        {
            Arena.RegisterEvent(EventName, this);

            GetMessage = Message;
        }

        protected override void LoadDefaultMessages() => lang.RegisterMessages(Messages, this);

        private void Unload()
        {
            if (!Arena.IsUnloading)
                Arena.UnregisterEvent(EventName);

            Configuration = null;
        }
        #endregion
        
        #region Event Checks
        public string EventName => "Counterstrike";
        
        public string EventIcon => Configuration.EventIcon;
        
        public bool InitializeEvent(Arena.EventConfig config)=> Arena.InitializeEvent<CounterstrikeEvent>(this, config);


        public bool CanUseClassSelector => false;

        public bool RequireTimeLimit => true;

        public bool RequireScoreLimit => false;

        public bool UseScoreLimit => true;

        public bool UseTimeLimit => true;

        public bool IsTeamEvent => true;

        public bool CanSelectTeam => true;

        public bool CanUseRustTeams => true;

        public bool IsRoundBased => true;

        public bool ProcessWinnersBetweenRounds => false;
        
        public bool CanUseBots => true;

        public string TeamAName => "Counter Terrorists";
        
        public string TeamBName => "Terrorists";

        public void FormatScoreEntry(Arena.ScoreEntry scoreEntry, ulong langUserId, out string score1, out string score2)
        {
            score1 = string.Format(Message("Score.Kills", langUserId), scoreEntry.value1);
            score2 = string.Format(Message("Score.Deaths", langUserId), scoreEntry.value2);
        }

        public List<Arena.EventParameter> AdditionalParameters { get; } = new List<Arena.EventParameter>();
        public string ParameterIsValid(string fieldName, object value) => null;
        #endregion
        
        #region Event Classes

        public class CounterstrikeEvent : Arena.BaseEventGame
        {
            protected override void GetWinningPlayers(ref List<Arena.BaseEventPlayer> list)
            {
                throw new NotImplementedException();
            }

            protected override void BuildScoreboard()
            {
                throw new NotImplementedException();
            }

            protected override float GetFirstScoreValue(Arena.BaseEventPlayer eventPlayer)
            {
                throw new NotImplementedException();
            }

            protected override float GetSecondScoreValue(Arena.BaseEventPlayer eventPlayer)
            {
                throw new NotImplementedException();
            }

            protected override void SortScores(ref List<Arena.ScoreEntry> list)
            {
                throw new NotImplementedException();
            }
        }
        #endregion
        
        #region Config        
        private static ConfigData Configuration;

        private class ConfigData
        {
            [JsonProperty(PropertyName = "Respawn time (seconds)")]
            public int RespawnTime { get; set; }

            public string EventIcon { get; set; }

            public Oxide.Core.VersionNumber Version { get; set; }
        }

        protected override void LoadConfig()
        {
            base.LoadConfig();
            Configuration = Config.ReadObject<ConfigData>();

            if (Configuration.Version < Version)
                UpdateConfigValues();

            Config.WriteObject(Configuration, true);
        }

        protected override void LoadDefaultConfig() => Configuration = GetBaseConfig();

        private ConfigData GetBaseConfig()
        {
            return new ConfigData
            {
                EventIcon = "https://www.rustedit.io/images/arena/arena_ffa.png",
                RespawnTime = 5,
                Version = Version
            };
        }

        protected override void SaveConfig() => Config.WriteObject(Configuration, true);

        private void UpdateConfigValues()
        {
            PrintWarning("Config update detected! Updating config values...");

            Configuration.Version = Version;
            PrintWarning("Config update completed!");
        }

        #endregion

        #region Localization
        public string Message(string key, ulong playerId = 0U) => lang.GetMessage(key, this, playerId != 0U ? playerId.ToString() : null);

        private static Func<string, ulong, string> GetMessage;

        private readonly Dictionary<string, string> Messages = new Dictionary<string, string>
        {
            ["Score.Kills"] = "Kills: {0}",
            ["Score.Deaths"] = "Deaths: {0}",
            ["Score.Name"] = "Kills",
            ["Score.Limit"] = "Score Limit : {0}",
            ["Round.Limit"] = "Round : {0} / {1}"
        };
        #endregion
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху