C#:
using System;
using ConVar;
using Oxide.Core.Plugins;
using UnityEngine;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using System.Collections.Generic;
namespace Oxide.Plugins {
[Info("IQPlagueSkill", "Sempai#3239", "1.0.6")]
[Description("Скилл система новых веков")]
class IQPlagueSkill : RustPlugin {
[PluginReference]
Plugin ImageLibrary, IQChat, Friends, Clans, Battles, Duel, IQEconomic, IQHeadReward, XDNotifications, IQCraftSystem, IQKits;
private bool IsClans(String userID, String targetID) {
if (Clans) {
String TagUserID = (String)Clans?.Call("GetClanOf", userID);
String TagTargetID = (String)Clans?.Call("GetClanOf", targetID);
if (TagUserID == null && TagTargetID == null) return false;
return (bool)(TagUserID == TagTargetID);
}
else return false;
}
int API_GET_RARE_IQKITS() => config.SkillSettings.NeutralSkills.IQKitsRare.RareUP;
void OnEntityDeath(BaseCombatEntity entity, HitInfo info) {
if (entity == null || info == null) return;
if (config.ReferenceSettings.IQEconomicUse) return;
BasePlayer player = info.InitiatorPlayer;
if (player == null || player.IsNpc || player.GetComponent<NPCPlayer>() != null || player.GetComponent<Zombie>() != null || player.GetComponent<HumanNPC>() != null) return;
var FarmingDNK = config.FarmingDNKS;
if (FarmingDNK.NPCKills.DNKKillNPC) if ((bool)(entity as NPCPlayer) || (bool)(entity as HumanNPC)) {
var FarmingNPC = FarmingDNK.NPCKills.GeneralSettingsFarmings;
if (!IsRare(FarmingNPC.RareGiveDNK)) return;
GiveDNK(player, FarmingNPC.MinimumDNK, FarmingNPC.MaximumDNK);
}
if (FarmingDNK.PlayerKills.DNKKillUser) if ((bool)(entity as BasePlayer)) {
if ((bool)(entity as NPCPlayer) || (bool)(entity as HumanNPC)) return;
BasePlayer targetPlayer = entity.ToPlayer();
if (targetPlayer == null) return;
if (targetPlayer.userID != player.userID) {
if (IsFriends(player.userID, targetPlayer.userID)) return;
if (IsClans(player.UserIDString, targetPlayer.UserIDString)) return;
if (IsDuel(player.userID)) return;
var FarmingPlayer = FarmingDNK.PlayerKills.GeneralSettingsFarmings;
if (!IsRare(FarmingPlayer.RareGiveDNK)) return;
GiveDNK(player, FarmingPlayer.MinimumDNK, FarmingPlayer.MaximumDNK);
}
}
if (FarmingDNK.AnimalKills.DNKKillAnimal) if ((bool)(entity as BaseAnimalNPC)) {
var FarmingAmimals = FarmingDNK.AnimalKills.GeneralSettingsFarmings;
if (!IsRare(FarmingAmimals.RareGiveDNK)) return;
GiveDNK(player, FarmingAmimals.MinimumDNK, FarmingAmimals.MaximumDNK);
}
}
public void Wounded(BasePlayer player) {
if (player == null) return;
var Wounded = config.SkillSettings.WoundedShakeSettings;
if (!Wounded.SkillTurn) return;
if (!DataSkills[player.userID].WoundedShake) return;
if (!IsRare(Wounded.Rare)) return;
timer.Once(Wounded.RareStartTime, () => {
if (player.IsWounded()) {
player.StopWounded();
SendChat(player, String.Format(lang.GetMessage("CHAT_SKILL_WOUNDED", this, player.UserIDString), Wounded.GeneralSettings.DisplayName));
if (Wounded.DropSkill) DataSkills[player.userID].WoundedShake = false;
}
}
);
}
[JsonProperty(LanguageEn ? "information about user skills" : "Информация о скиллах пользователей")]
public Dictionary<ulong, InformationSkills> DataSkills = new Dictionary<ulong, InformationSkills>();
private static string HexToRustFormat(string hex) {
Color color;
ColorUtility.TryParseHtmlString(hex, out color);
return string.Format("{0:F2} {1:F2} {2:F2} {3:F2}", color.r, color.g, color.b, color.a);
}
protected override void LoadDefaultConfig() => config = Configuration.GetNewConfiguration();
public void SendImage(BasePlayer player, string imageName, ulong imageId = 0) => ImageLibrary?.Call("SendImage", player, imageName, imageId);
void Interface_Skill_GatherFriends(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_GATHERFRIENDS");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.GatherFriendsSettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.GatherFriends ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_GATHERFRIENDS_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.GatherFriends ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study gatherfriends {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study gatherfriends {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_GATHERFRIENDS", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.1812513 0.2555555", AnchorMax = "0.2494792 0.3648151"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_GATHERFRIENDS", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_GATHERFRIENDS");
CuiHelper.AddUi(player, container);
}
void Interface_Skill_Military(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_MILITARY");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.MilitarySettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.Military ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_MILITARY_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.Military ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study military {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study military {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_MILITARY", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.4614567 0.6472288", AnchorMax = "0.543224 0.7750065"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_MILITARY", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_MILITARY");
CuiHelper.AddUi(player, container);
}
void Interface_Skill_Wounded(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_WOUNDED");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.WoundedShakeSettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.WoundedShake ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_WOUNDED_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.WoundedShake ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study wounded {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study wounded {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_WOUNDED", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.2067708 0.523148", AnchorMax = "0.2885418 0.653703"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_WOUNDED", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_WOUNDED");
CuiHelper.AddUi(player, container);
}
void Interface_Skill_GenesisGen(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_GENESISGENS");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.GenesisGensSettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.GenesisGens ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_GENESISGENS_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.GenesisGens ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study genesisgens {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study genesisgens {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_GENESISGENS", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.5697917 0.3074074", AnchorMax = "0.6718751 0.4722229"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_GENESISGENS", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_GENESISGENS");
CuiHelper.AddUi(player, container);
}
public float Military(BasePlayer player, Item item, float amount) {
float Damage = amount;
if (player == null) return Damage;
var Military = config.SkillSettings.MilitarySettings;
if (!Military.SkillTurn) return Damage;
if (!DataSkills.ContainsKey(player.userID)) {
RegisteredDataUser(player);
return Damage;
}
if (!DataSkills[player.userID].Military) return Damage;
var ItemCategory = ItemManager.FindItemDefinition(item.info.itemid).category;
if (ItemCategory != ItemCategory.Weapon) return Damage;
Damage = amount - (amount / 100 * Military.PercentNoBroken);
return Damage;
}
private void OnPlayerRespawned(BasePlayer player) {
if (player == null) return;
Metabolism(player);
}
int GetBalanceUser(ulong UserID) => (int)(IQEconomic?.Call("API_GET_BALANCE", UserID));
void OnLoseCondition(Item item, ref float amount) {
if (item == null) return;
BasePlayer player = item.GetOwnerPlayer();
if (player == null) return;
amount = Military(player, item, amount);
}
void Interface_Show_Information(BasePlayer player, Configuration.Skills.GeneralSettingsSkill Information, string Skill, TypeSkill typeSkill) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
var Interface = config.InterfaceSettings;
var Balance = IQEconomic ? config.ReferenceSettings.IQEconomicUse ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
string LogoTypeSkill = typeSkill == TypeSkill.Active ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_AVAILABLE_{Interface.IconsPNG.NeutralAvailableSkill}";
string LabelTypeSkill = typeSkill == TypeSkill.Active ? "<b>A</b>" : "<b>N</b>";
string CMD = $"iqps study {Skill} {Information.PriceDNK} false";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = PLAGUE_PARENT_PANEL_INFORMATION, Components = {
new CuiRawImageComponent {
Png = GetImage($"BACKGROUND_PLAGUE_TAKE_PANEL_{Interface.IconsPNG.BackgroundTakePanel}")
}
, new CuiRectTransformComponent {
AnchorMin = "0.3333333 0.3935185", AnchorMax = "0.65 0.6453695"
}
,
}
}
);
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0.06085521 0.7536785", AnchorMax = "0.7664474 0.9264706"
}
, Text = {
Text = $"<size=25><b>{Information.DisplayName}</b></size>", Color = HexToRustFormat(Interface.GeneralSettings.HexLabelTakePanel), Font = "robotocondensed-regular.ttf", Align = TextAnchor.UpperLeft
}
}
, PLAGUE_PARENT_PANEL_INFORMATION);
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0.06085521 0.1029415", AnchorMax = "0.7664474 0.7499998"
}
, Text = {
Text = $"<size=15><b>{Information.Description}</b></size>", Color = HexToRustFormat(Interface.GeneralSettings.HexLabelTakePanel), Font = "robotocondensed-regular.ttf", Align = TextAnchor.UpperLeft
}
}
, PLAGUE_PARENT_PANEL_INFORMATION);
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_PANEL_INFORMATION, Name = "CIRCLE", Components = {
new CuiImageComponent {
Sprite = "assets/icons/circle_open.png"
}
, new CuiRectTransformComponent {
AnchorMin = "0.8355262 0.7022083", AnchorMax = "0.9539473 0.9669153"
}
,
}
}
);
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_PANEL_INFORMATION, Name = "TYPE_SKILL", Components = {
new CuiRawImageComponent {
Png = GetImage(LogoTypeSkill)
}
, new CuiRectTransformComponent {
AnchorMin = "0.8355262 0.4191192", AnchorMax = "0.9539473 0.6580915"
}
,
}
}
);
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Text = {
Text = LabelTypeSkill, Color = HexToRustFormat(Interface.GeneralSettings.HexLabelTakePanel), Font = "robotocondensed-regular.ttf", Align = TextAnchor.MiddleCenter
}
}
, "TYPE_SKILL", "TYPE");
container.Add(new CuiLabel {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Text = {
Text = $"<size=25><b>{Information.PriceDNK}</b></size>", Color = HexToRustFormat(Interface.GeneralSettings.HexLabelTakePanel), Font = "robotocondensed-regular.ttf", Align = TextAnchor.MiddleCenter
}
}
, "CIRCLE");
if (Balance >= Information.PriceDNK) {
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_PANEL_INFORMATION, Name = "BTN_INFO", Components = {
new CuiRawImageComponent {
Png = GetImage($"BACKGROUND_PLAGUE_TAKE_BUTTON_{Interface.IconsPNG.ButtonTakeSkill}")
}
, new CuiRectTransformComponent {
AnchorMin = "0.7055923 0.08088271", AnchorMax = "0.9424341 0.2132361"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = CMD, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "BTN_INFO");
}
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "-30 0", OffsetMax = "-2 182"
}
, Button = {
Close = PLAGUE_PARENT_PANEL_INFORMATION, Color = HexToRustFormat("#1B0103E1")
}
, Text = {
Text = lang.GetMessage("EXIT_TAKE_PANEL", this, player.UserIDString), Color = HexToRustFormat("#FFFFFFFF"), Align = TextAnchor.MiddleCenter
}
}
, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.AddUi(player, container);
}
/// <summary>
/// Обновление 1.0.х
/// - Корректировка проверки в хуке - OnItemCraft
/// </summary>
private const Boolean LanguageEn = false;
void Interface_Skill_DropPercent_IQKits(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_IQKITS_PERCENT");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings.NeutralSkills.IQKitsCooldown;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
string SkillIcon = Skills.SkillTurn ? UserSkills.IQKitsCooldownPercent ? $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_RECEIVED_{Interface.IconsPNG.NeutralReceivedSkill}" : IsAvailable(Balance, Skills.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_AVAILABLE_{Interface.IconsPNG.NeutralAvailableSkill}" : $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.IconsPNG.NeutralBlockSkill}" : $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.IconsPNG.NeutralBlockSkill}";
CuiImageComponent Comp = String.IsNullOrWhiteSpace(Skills.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_IQCRAFTSYSTEM_{Skills.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skills.GeneralSettings.Sprite
}
;
string Command = UserSkills.IQKitsCooldownPercent ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study iqkits.cooldown {Skills.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skills.GeneralSettings.PriceDNK) ? $"iqps study iqkits.cooldown {Skills.GeneralSettings.PriceDNK} true" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_IQKITS_PERCENT", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.7119737 0.1592593", AnchorMax = "0.7744792 0.2574214"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_IQKITS_PERCENT", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_IQKITS_PERCENT");
CuiHelper.AddUi(player, container);
}
public bool IsAvailable(int Balance, int Price) {
if (Balance > 0 && Balance >= Price) return true;
else return false;
}
void Interface_Skill_PatogenArmory(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_PATOGENARMORY");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.PatogenAmrorySettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.PatogenAmrory ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_PATOGENARMORY_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.PatogenAmrory ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study patogenarmory {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study patogenarmory {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_PATOGENARMORY", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.8755208 0.2861111", AnchorMax = "1 0.4861257"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_PATOGENARMORY", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_PATOGENARMORY");
CuiHelper.AddUi(player, container);
}
static DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0);
static double CurrentTime() => DateTime.UtcNow.Subtract(epoch).TotalSeconds;
void ReadData() {
DataInformation = Oxide.Core.Interface.Oxide.DataFileSystem.ReadObject<Dictionary<ulong, int>>("IQPlagueSkill/InformationUser");
DataSkills = Oxide.Core.Interface.Oxide.DataFileSystem.ReadObject<Dictionary<ulong, InformationSkills>>("IQPlagueSkill/InformationSkills");
}
Dictionary<ulong, double> Cd = new Dictionary<ulong, double>();
void RedistributionHooks() {
var Skill = config.SkillSettings;
if (!Skill.AnabioticsSettings.SkillTurn) {
Unsubscribe("OnHealingItemUse");
Unsubscribe("OnItemAction");
}
if (!Skill.MetabolismSettings.SkillTurn) Unsubscribe("OnPlayerRespawned");
if (!Skill.GatherFriendsSettings.SkillTurn && !Skill.AnimalFriendsSettings.SkillTurn && !Skill.MinerSettings.SkillTurn) {
Unsubscribe("OnDispenserBonus");
Unsubscribe("OnDispenserGather");
}
if (!Skill.WoundedShakeSettings.SkillTurn) Unsubscribe("CanBeWounded");
if (!Skill.ThickSkinSettings.SkillTurn) Unsubscribe("OnRunPlayerMetabolism");
if (!Skill.MilitarySettings.SkillTurn) Unsubscribe("OnLoseCondition");
if (!Skill.CrafterSettings.SkillTurn) Unsubscribe("OnItemCraft");
}
void Interface_Skill_IQHeadReward(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_IQHEAD_REWARD");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings.NeutralSkills.SkillIQHeadRewards;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
string SkillIcon = Skills.SkillTurn ? UserSkills.IQHeadReward ? $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_RECEIVED_{Interface.IconsPNG.NeutralReceivedSkill}" : IsAvailable(Balance, Skills.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_AVAILABLE_{Interface.IconsPNG.NeutralAvailableSkill}" : $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.IconsPNG.NeutralBlockSkill}" : $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.IconsPNG.NeutralBlockSkill}";
CuiImageComponent Comp = String.IsNullOrWhiteSpace(Skills.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_IQHEAD_REWARD_{Skills.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skills.GeneralSettings.Sprite
}
;
string Command = UserSkills.IQHeadReward ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study iqheadreward {Skills.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skills.GeneralSettings.PriceDNK) ? $"iqps study iqheadreward {Skills.GeneralSettings.PriceDNK} true" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_IQHEAD_REWARD", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.4557309 0.118518", AnchorMax = "0.5421875 0.2592593"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_IQHEAD_REWARD", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_IQHEAD_REWARD");
CuiHelper.AddUi(player, container);
}
private void Init() => RedistributionHooks();
static string PLAGUE_PARENT_PANEL_INFORMATION = "PLAGUE_PARENT_PANEL_INFORMATION";
void LoadedImage() {
var Interface = config.InterfaceSettings.IconsPNG;
if (!HasImage($"BACKGROUND_PLAGUES_{Interface.BackgroundPNG}")) AddImage(Interface.BackgroundPNG, $"BACKGROUND_PLAGUES_{Interface.BackgroundPNG}");
if (!HasImage($"BACKGROUND_PLAGUE_TAKE_PANEL_{Interface.BackgroundTakePanel}")) AddImage(Interface.BackgroundTakePanel, $"BACKGROUND_PLAGUE_TAKE_PANEL_{Interface.BackgroundTakePanel}");
if (!HasImage($"BACKGROUND_PLAGUE_TAKE_BUTTON_{Interface.ButtonTakeSkill}")) AddImage(Interface.ButtonTakeSkill, $"BACKGROUND_PLAGUE_TAKE_BUTTON_{Interface.ButtonTakeSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.BlockSkill}")) AddImage(Interface.BlockSkill, $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.BlockSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.AvailableSkill}")) AddImage(Interface.AvailableSkill, $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.AvailableSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.ReceivedSkill}")) AddImage(Interface.ReceivedSkill, $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.ReceivedSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.NeutralBlockSkill}")) AddImage(Interface.NeutralBlockSkill, $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_BLOCK_{Interface.NeutralBlockSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_NEUTRAL_SKILL_AVAILABLE_{Interface.NeutralAvailableSkill}")) AddImage(Interface.NeutralAvailableSkill, $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_AVAILABLE_{Interface.NeutralAvailableSkill}");
if (!HasImage($"BACKGROUND_PLAGUE_NEUTRAL_SKILL_RECEIVED_{Interface.NeutralReceivedSkill}")) AddImage(Interface.NeutralReceivedSkill, $"BACKGROUND_PLAGUE_NEUTRAL_SKILL_RECEIVED_{Interface.NeutralReceivedSkill}");
try {
webrequest.Enqueue($"http://rust.skyplugins.ru/getimage/BACKGROUND_PLAGUE/12/IMAGELIBRARY_{Name}_{Author}_4961", null, (i, s) => {
if (i != 200) {
}
if (s.Contains("success")) {
AddImage(i.ToString(), $"{i.ToString()}_BACKGROUND_PLAGUE", ulong.Parse($"4961"));
}
if (s.Contains("fail")) {
return;
}
}
, this);
}
catch (Exception ex) {
}
var Skill = config.SkillSettings;
if (String.IsNullOrWhiteSpace(Skill.AnabioticsSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_ANABIOTICS_{Skill.AnabioticsSettings.GeneralSettings.PNG}")) AddImage(Skill.AnabioticsSettings.GeneralSettings.PNG, $"SKILL_ANABIOTICS_{Skill.AnabioticsSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.AnimalFriendsSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_ANIMALFRIENDS_{Skill.AnimalFriendsSettings.GeneralSettings.PNG}")) AddImage(Skill.AnimalFriendsSettings.GeneralSettings.PNG, $"SKILL_ANIMALFRIENDS_{Skill.AnimalFriendsSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.CrafterSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_CRAFTER_{Skill.CrafterSettings.GeneralSettings.PNG}")) AddImage(Skill.CrafterSettings.GeneralSettings.PNG, $"SKILL_CRAFTER_{Skill.CrafterSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.GatherFriendsSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_GATHERFRIENDS_{Skill.GatherFriendsSettings.GeneralSettings.PNG}")) AddImage(Skill.GatherFriendsSettings.GeneralSettings.PNG, $"SKILL_GATHERFRIENDS_{Skill.GatherFriendsSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.GenesisGensSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_GENESISGENS_{Skill.GenesisGensSettings.GeneralSettings.PNG}")) AddImage(Skill.GenesisGensSettings.GeneralSettings.PNG, $"SKILL_GENESISGENS_{Skill.GenesisGensSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.MetabolismSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_METABOLISM_{Skill.MetabolismSettings.GeneralSettings.PNG}")) AddImage(Skill.MetabolismSettings.GeneralSettings.PNG, $"SKILL_METABOLISM_{Skill.MetabolismSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.MilitarySettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_MILITARY_{Skill.MilitarySettings.GeneralSettings.PNG}")) AddImage(Skill.MilitarySettings.GeneralSettings.PNG, $"SKILL_MILITARY_{Skill.MilitarySettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.MinerSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_MINER_{Skill.MinerSettings.GeneralSettings.PNG}")) AddImage(Skill.MinerSettings.GeneralSettings.PNG, $"SKILL_MINER_{Skill.MinerSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.PatogenAmrorySettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_PATOGENARMORY_{Skill.PatogenAmrorySettings.GeneralSettings.PNG}")) AddImage(Skill.PatogenAmrorySettings.GeneralSettings.PNG, $"SKILL_PATOGENARMORY_{Skill.PatogenAmrorySettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.PatogenKillSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_PATOGENKILL_{Skill.PatogenKillSettings.GeneralSettings.PNG}")) AddImage(Skill.PatogenKillSettings.GeneralSettings.PNG, $"SKILL_PATOGENKILL_{Skill.PatogenKillSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.RegenerationSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_REGENERATION_{Skill.RegenerationSettings.GeneralSettings.PNG}")) AddImage(Skill.RegenerationSettings.GeneralSettings.PNG, $"SKILL_REGENERATION_{Skill.RegenerationSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.ThickSkinSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_THICKSSKIN_{Skill.ThickSkinSettings.GeneralSettings.PNG}")) AddImage(Skill.ThickSkinSettings.GeneralSettings.PNG, $"SKILL_THICKSSKIN_{Skill.ThickSkinSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.WoundedShakeSettings.GeneralSettings.Sprite)) if (!HasImage($"SKILL_WOUNDED_{Skill.WoundedShakeSettings.GeneralSettings.PNG}")) AddImage(Skill.WoundedShakeSettings.GeneralSettings.PNG, $"SKILL_WOUNDED_{Skill.WoundedShakeSettings.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.NeutralSkills.SkillIQHeadRewards.GeneralSettings.Sprite)) if (!HasImage($"SKILL_IQHEAD_REWARD_{Skill.NeutralSkills.SkillIQHeadRewards.GeneralSettings.PNG}")) AddImage(Skill.NeutralSkills.SkillIQHeadRewards.GeneralSettings.PNG, $"SKILL_IQHEAD_REWARD_{Skill.NeutralSkills.SkillIQHeadRewards.GeneralSettings.PNG}");
if (String.IsNullOrWhiteSpace(Skill.NeutralSkills.IQCraftSystemAdvancedCrafts.GeneralSettings.Sprite)) if (!HasImage($"SKILL_IQCRAFTSYSTEM_{Skill.NeutralSkills.IQCraftSystemAdvancedCrafts.GeneralSettings.PNG}")) AddImage(Skill.NeutralSkills.IQCraftSystemAdvancedCrafts.GeneralSettings.PNG, $"SKILL_IQCRAFTSYSTEM_{Skill.NeutralSkills.IQCraftSystemAdvancedCrafts.GeneralSettings.PNG}");
}
void Interface_Skill_Metabolism(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_METABOLISM");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.MetabolismSettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.Metabolism ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_METABOLISM_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
Sprite = Skill.GeneralSettings.Sprite
}
: new CuiImageComponent {
Sprite = "assets/icons/lock.png"
}
;
string Command = Skill.SkillTurn ? UserSkills.Metabolism ? "" : config.SkillSettings.ShowSkillNotDNK ? $"iqps study metabolism {Skill.GeneralSettings.PriceDNK} true" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"iqps study metabolism {Skill.GeneralSettings.PriceDNK} true" : "" : "";
container.Add(new CuiElement {
Parent = PLAGUE_PARENT_MAIN, Name = "SKILL_METABOLISM", Components = {
new CuiRawImageComponent {
Png = GetImage(SkillIcon)
}
, new CuiRectTransformComponent {
AnchorMin = "0.9369792 0", AnchorMax = "1 0.1074074"
}
,
}
}
);
container.Add(new CuiElement {
Parent = "SKILL_METABOLISM", Components = {
Comp, new CuiRectTransformComponent {
AnchorMin = "0.2499933 0.2260868", AnchorMax = "0.749979 0.782609"
}
,
}
}
);
container.Add(new CuiButton {
RectTransform = {
AnchorMin = "0 0", AnchorMax = "1 1"
}
, Button = {
Command = Command, Color = "0 0 0 0"
}
, Text = {
Text = "", Color = "0 0 0 0"
}
}
, "SKILL_METABOLISM");
CuiHelper.AddUi(player, container);
}
protected override void SaveConfig() => Config.WriteObject(config);
void Interface_Skill_Crafter(BasePlayer player) {
CuiElementContainer container = new CuiElementContainer();
CuiHelper.DestroyUi(player, PLAGUE_PARENT_PANEL_INFORMATION);
CuiHelper.DestroyUi(player, "SKILL_CRAFTER");
var Interface = config.InterfaceSettings;
var Skills = config.SkillSettings;
var UserSkills = DataSkills[player.userID];
var Balance = config.ReferenceSettings.IQEconomicUse ? IQEconomic ? GetBalanceUser(player.userID) : DataInformation[player.userID] : DataInformation[player.userID];
var Skill = Skills.CrafterSettings;
string SkillIcon = Skill.SkillTurn ? UserSkills.Crafter ? $"BACKGROUND_PLAGUE_SKILL_RECEIVED_{Interface.IconsPNG.ReceivedSkill}" : IsAvailable(Balance, Skill.GeneralSettings.PriceDNK) ? $"BACKGROUND_PLAGUE_SKILL_AVAILABLE_{Interface.IconsPNG.AvailableSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}" : $"BACKGROUND_PLAGUE_SKILL_BLOCK_{Interface.IconsPNG.BlockSkill}";
CuiImageComponent Comp = Skill.SkillTurn ? String.IsNullOrWhiteSpace(Skill.GeneralSettings.Sprite) ? new CuiImageComponent {
Png = GetImage($"SKILL_CRAFTER_{Skill.GeneralSettings.PNG}")
}
: new CuiImageComponent {
S
// ... [Code preview truncated due to length. Full source in attached file] ...