C#:
/***********************************************************************************************************************/
/*** DO NOT edit this file! Edit the files under `oxide/config`, created once plugin has loaded. ***/
/*** Please note, support cannot be provided if the plugin has been modified. Please try a fresh copy if modified. ***/
/***********************************************************************************************************************/
/*** Developed and maintained by Drxp ***/
/*** Support Discord: https://discord.gg/q2QSGS2sb6 ***/
/***********************************************************************************************************************/
using System;
using Oxide.Core;
using Oxide.Core.Plugins;
using UnityEngine;
using Oxide.Game.Rust.Cui;
using System.Collections.Generic;
using System.Linq;
#region Changelog
/*
* v.1.1.8 - Bug Fixes
* v.1.1.9 - added remove command.
* v.2.0.0 - Bug fixes, UI fixes / Updates.
* v.2.0.1/2 - Fixed Repair, Fixed Remove Tool(Hammer)
* v.2.0.3 - Fixed UI Anchors.
* Added the new skin for the (Stone Building.)
*/
#endregion
namespace Oxide.Plugins
{
[Info("BaseUpgrade", "Drxp", "2.0.3")]
[Description("Upgrade and repair your full base from UI buttons.")]
public class BaseUpgrade : RustPlugin
{
[PluginReference]
private Plugin NoEscape;
private const ulong AdobeSkinID = 10220;
private const ulong BrickSkinID = 10223;
private const ulong MetalSkinID = 10221;
private const ulong StoneSkinID = 10225;
private float hammerDuration;
private float UpgradeDelay => Config.Get<float>("UpgradeDelay(0.0 = insta upgrade)");
private float CommandCooldown => Config.Get<float>("CommandCooldown(in secs)");
private Dictionary<string, float> lastCommandUsage = new Dictionary<string, float>();
private bool RefundOnDowngrade => Config.Get<bool>("RefundOnDowngrade");
private const string permWood = "baseupgrade.up_wood";
private const string permStone = "baseupgrade.up_stone";
private const string permMetal = "baseupgrade.up_metal";
private const string permHQM = "baseupgrade.up_hqm";
private const string permRepair = "baseupgrade.up_repair";
private const string permDowngrade = "baseupgrade.downgrade";
private const string permRemove = "baseupgrade.remove";
private const string permShow = "baseupgrade.show";
#region Config
protected override void LoadDefaultConfig()
{
PrintWarning("Config file has been made/updated.");
Config["UpgradeDelay(0.0 = insta upgrade)"] = 0.5f;
Config["CommandCooldown(in secs)"] = 60.0f;
Config["Hammer Duration"] = 300.0f;
Config["DefaultHammerSkin"] = 252490; // Default skinID value
Config["RefundOnDowngrade"] = true; // Default is true, but server owners can change it to false if they don't want refunds.
Config["RepairCosts"] = new Dictionary<string, int>
{
["Wood"] = 50,
["Stone"] = 100,
["Metal"] = 70,
["TopTier"] = 10
};
Config["UpgradeCosts"] = new Dictionary<string, int>
{
["Wood"] = 150,
["Stone"] = 300,
["Metal"] = 200,
["TopTier"] = 25
};
SaveConfig();
}
#endregion
[HookMethod("Init")]
protected void Init()
{
permission.RegisterPermission(permWood, this);
permission.RegisterPermission(permStone, this);
permission.RegisterPermission(permMetal, this);
permission.RegisterPermission(permHQM, this);
permission.RegisterPermission(permRepair, this);
permission.RegisterPermission(permDowngrade, this);
permission.RegisterPermission(permRemove, this);
permission.RegisterPermission(permShow, this);
}
#region Commands
[ConsoleCommand("up_wood")]
private void MyUpgradeCommand(ConsoleSystem.Arg args)
{
UpgradeCommandHandler(args, BuildingGrade.Enum.Wood, permWood);
}
[ConsoleCommand("up_stone")]
private void MyUpgradeToStoneCommand(ConsoleSystem.Arg args)
{
UpgradeCommandHandler(args, BuildingGrade.Enum.Stone, permStone);
}
[ConsoleCommand("up_metal")]
private void MyUpgradeToMetalCommand(ConsoleSystem.Arg args)
{
UpgradeCommandHandler(args, BuildingGrade.Enum.Metal, permMetal);
}
[ConsoleCommand("up_hqm")]
private void MyUpgradeToHQMCommand(ConsoleSystem.Arg args)
{
UpgradeCommandHandler(args, BuildingGrade.Enum.TopTier, permHQM);
}
[ConsoleCommand("skins")]
private void SkinsCommand(ConsoleSystem.Arg args)
{
var player = args.Player();
if (player == null) return; // Ensure the command was run by a player
toggleskins(player);
}
[ConsoleCommand("remove_block")]
private void RemoveBlockCommand(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
if (IsPlayerRaidBlocked(player) || IsPlayerCombatBlocked(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You cannot remove while raid blocked or combat blocked.");
return;
}
// Cooldown check
if (lastCommandUsage.TryGetValue(player.UserIDString, out float lastUseTime))
{
float timeSinceLastUse = Time.realtimeSinceStartup - lastUseTime;
if (timeSinceLastUse < CommandCooldown)
{
float secondsLeft = CommandCooldown - timeSinceLastUse;
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: You need to wait {Math.Ceiling(secondsLeft)} more seconds before using this command again.");
return;
}
}
// Permission check
if (!permission.UserHasPermission(player.UserIDString, permRemove))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You don't have permission to use this command.");
return;
}
// Grant the special skinned hammer
ulong hammerSkinID = Convert.ToUInt64(Config["DefaultHammerSkin"]);
Item hammer = ItemManager.CreateByName("hammer", 1, hammerSkinID);
if (hammer != null)
{
player.GiveItem(hammer);
}
else
{
Puts("Failed to create the skinned hammer.");
return;
}
// Timer to remove the hammer after the specified duration
float hammerDuration = Convert.ToSingle(Config["Hammer Duration"]);
player.ChatMessage($"<color=green>[BaseUpgrade]</color>: You've received the removal hammer. Hit a building block to remove it. The hammer will be removed in {hammerDuration} seconds.");
timer.Once(hammerDuration, () =>
{
if (player != null && !player.IsDead())
{
ulong configuredHammerSkinID = Convert.ToUInt64(Config["DefaultHammerSkin"]);
foreach (Item item in player.inventory.AllItems())
{
if (item.info.shortname == "hammer" && item.skin == configuredHammerSkinID)
{
item.Remove();
player.ChatMessage("<color=red>[BaseUpgrade]</color>: Your removal hammer has expired.");
break;
}
}
}
});
// Update the cooldown timestamp after successful command execution
lastCommandUsage[player.UserIDString] = Time.realtimeSinceStartup;
}
private object OnHammerHit(BasePlayer player, HitInfo info)
{
if (player == null || info == null || info.HitEntity == null)
return null;
if (!(info.HitEntity is BuildingBlock))
return null;
BuildingBlock block = info.HitEntity as BuildingBlock;
// Check if the player has the skinned hammer equipped
ulong configuredHammerSkinID = Convert.ToUInt64(Config["DefaultHammerSkin"]);
if (player.GetActiveItem()?.info?.shortname == "hammer" && player.GetActiveItem().skin == configuredHammerSkinID)
{
if (!permission.UserHasPermission(player.UserIDString, permRemove))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You don't have permission to remove blocks.");
return null;
}
// Check if the player is authorized on the TC
BuildingPrivlidge tc = block.GetBuildingPrivilege();
if (tc == null || !tc.IsAuthed(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You are not authorized on the Tool Cupboard. You cannot remove blocks.");
return null;
}
// Refund the resources
int refundAmount = GetUpgradeCost(block.grade);
int itemId = GetItemId(block.grade);
Item refundItem = ItemManager.CreateByItemID(itemId, refundAmount);
player.GiveItem(refundItem);
// Remove the block
block.Kill();
player.ChatMessage($"<color=green>[BaseUpgrade]</color>: Block removed. You've been refunded {refundAmount} resources.");
// Cancel the default hammer hit behavior to prevent the RPC error
return false;
}
return null;
}
#endregion Commands
#region SkinMenu
[ConsoleCommand("apply_skin_adobe")]
private void ApplyAdobeSkinCommand(ConsoleSystem.Arg args)
{
ApplySkinCommandHandler(args, AdobeSkinID, BuildingGrade.Enum.Stone); // Assuming Adobe skin is for Stone
}
[ConsoleCommand("apply_skin_Brutalist")]
private void ApplyBrutalistSkinCommand(ConsoleSystem.Arg args)
{
ApplySkinCommandHandler(args, StoneSkinID, BuildingGrade.Enum.Stone);
}
[ConsoleCommand("apply_skin_brick")]
private void ApplyBrickSkinCommand(ConsoleSystem.Arg args)
{
ApplySkinCommandHandler(args, BrickSkinID, BuildingGrade.Enum.Stone); // Assuming Brick skin is for Stone
}
[ConsoleCommand("apply_skin_metal")]
private void ApplyMetalSkinCommand(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
ulong skinID = 10221; // The skin ID for metal
BuildingPrivlidge privilege = player.GetBuildingPrivilege();
if (privilege == null || !privilege.IsAuthed(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You need building privilege to apply skins.");
return;
}
List<BuildingBlock> blocks = new List<BuildingBlock>();
Vis.Entities(privilege.transform.position, 25.0f, blocks);
bool hasMetalBlocks = blocks.Any(block => block.grade == BuildingGrade.Enum.Metal);
if (!hasMetalBlocks)
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: Upgrade your base to metal first before applying the skin.");
return;
}
foreach (var block in blocks)
{
if (block.grade == BuildingGrade.Enum.Metal)
{
// Temporarily downgrade to stone
block.ChangeGrade(BuildingGrade.Enum.Stone);
block.SendNetworkUpdateImmediate(true);
// Upgrade back to metal with the desired skin
block.skinID = skinID;
block.ChangeGrade(BuildingGrade.Enum.Metal);
block.SendNetworkUpdateImmediate(true);
}
}
player.ChatMessage($"<color=green>[BaseUpgrade]</color>: Skin applied on all metal building blocks within your building privilege.");
lastCommandUsage[player.UserIDString] = Time.realtimeSinceStartup;
}
private void ApplySkinCommandHandler(ConsoleSystem.Arg args, ulong skinID, BuildingGrade.Enum requiredGrade)
{
BasePlayer player = args.Player();
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
string playerId = player.UserIDString;
if (lastCommandUsage.ContainsKey(player.UserIDString))
{
float timeElapsedSinceLastCommand = Time.realtimeSinceStartup - lastCommandUsage[player.UserIDString];
if (timeElapsedSinceLastCommand < CommandCooldown)
{
float remainingCooldown = CommandCooldown - timeElapsedSinceLastCommand;
// Convert the remaining cooldown time to minutes and seconds for a more readable format
int minutes = Mathf.FloorToInt(remainingCooldown / 60);
int seconds = Mathf.RoundToInt(remainingCooldown % 60);
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: You must wait {minutes} minutes and {seconds} seconds before using this command again.");
return;
}
}
lastCommandUsage[player.UserIDString] = Time.realtimeSinceStartup;
BuildingPrivlidge privilege = player.GetBuildingPrivilege();
if (privilege == null || !privilege.IsAuthed(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You need building privilege to apply skins.");
return;
}
List<BuildingBlock> blocks = new List<BuildingBlock>();
Vis.Entities(privilege.transform.position, 25.0f, blocks);
foreach (var block in blocks)
{
if (block.grade != requiredGrade)
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: Please upgrade all building blocks to {requiredGrade} before applying this skin.");
return;
}
block.skinID = skinID;
block.SendNetworkUpdateImmediate(true);
}
player.ChatMessage($"<color=green>[BaseUpgrade]</color>: Skin applied to all building blocks within your building privilege.");
// Update the last usage time for the player
lastCommandUsage[playerId] = Time.realtimeSinceStartup;
}
[ConsoleCommand("open.panelremove")]
private void CmdOpenPanelRemove(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
panelremove(player);
}
#endregion
[ConsoleCommand("up_repair")]
private void MyRepairCommand(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
if (!permission.UserHasPermission(player.UserIDString, permRepair))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You don't have permission to use this command.");
return;
}
// Cooldown check
if (lastCommandUsage.TryGetValue(player.UserIDString, out float lastUseTime))
{
float timeElapsed = Time.realtimeSinceStartup - lastUseTime;
if (timeElapsed < CommandCooldown)
{
float remainingCooldown = CommandCooldown - timeElapsed;
int minutes = Mathf.FloorToInt(remainingCooldown / 60);
int seconds = Mathf.RoundToInt(remainingCooldown % 60);
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: You must wait {minutes} minutes and {seconds} seconds before using this command again.");
return;
}
}
lastCommandUsage[player.UserIDString] = Time.realtimeSinceStartup;
if (IsPlayerRaidBlocked(player) || IsPlayerCombatBlocked(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You cannot upgrade while raid blocked or combat blocked.");
return;
}
BuildingPrivlidge privilege = player.GetBuildingPrivilege();
if (privilege == null || !privilege.IsAuthed(player))
{
player.ChatMessage("You do not have building privilege.");
return;
}
List<BuildingBlock> blocks = new List<BuildingBlock>();
Vis.Entities(privilege.transform.position, 25.0f, blocks);
RepairBlocksSequentially(player, blocks, privilege, false);
}
private void RepairBlocksSequentially(BasePlayer player, List<BuildingBlock> blocks, BuildingPrivlidge privilege, bool repairedAny)
{
if (blocks.Count == 0)
{
if (!repairedAny)
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: No blocks were repaired.");
}
else
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: Repair process completed.");
}
return;
}
BuildingBlock block = blocks[0];
blocks.RemoveAt(0);
if (block.health == block.MaxHealth())
{
RepairBlocksSequentially(player, blocks, privilege, repairedAny);
return;
}
int repairCost = GetRepairCost(block.grade);
int itemId = GetItemId(block.grade);
string materialName = GetMaterialName(block.grade);
var item = privilege.inventory.itemList.FirstOrDefault(i => i.info.itemid == itemId);
if (item == null || item.amount < repairCost)
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: Repair halted due to insufficient {materialName} in the Tool Cupboard.");
return;
}
item.UseItem(repairCost);
block.health = block.MaxHealth();
block.SendNetworkUpdate();
RepairBlocksSequentially(player, blocks, privilege, true);
}
private int GetRepairCost(BuildingGrade.Enum grade)
{
var repairCosts = Config["RepairCosts"] as Dictionary<string, object>;
if (repairCosts == null)
{
PrintWarning("Repair costs not found in the configuration!");
return 0;
}
switch (grade)
{
case BuildingGrade.Enum.Wood:
return Convert.ToInt32(repairCosts["Wood"]);
case BuildingGrade.Enum.Stone:
return Convert.ToInt32(repairCosts["Stone"]);
case BuildingGrade.Enum.Metal:
return Convert.ToInt32(repairCosts["Metal"]);
case BuildingGrade.Enum.TopTier:
return Convert.ToInt32(repairCosts["TopTier"]);
default:
return 0;
}
}
private void UpgradeCommandHandler(ConsoleSystem.Arg args, BuildingGrade.Enum targetGrade, string permissionName)
{
BasePlayer player = args.Player();
string playerId = player.UserIDString;
if (IsPlayerRaidBlocked(player) || IsPlayerCombatBlocked(player))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You cannot upgrade while raid blocked or combat blocked.");
return;
}
if (lastCommandUsage.ContainsKey(player.UserIDString))
{
float timeElapsedSinceLastCommand = Time.realtimeSinceStartup - lastCommandUsage[player.UserIDString];
if (timeElapsedSinceLastCommand < CommandCooldown)
{
float remainingCooldown = CommandCooldown - timeElapsedSinceLastCommand;
// Convert the remaining cooldown time to minutes and seconds for a more readable format
int minutes = Mathf.FloorToInt(remainingCooldown / 60);
int seconds = Mathf.RoundToInt(remainingCooldown % 60);
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: You must wait {minutes} minutes and {seconds} seconds before using this command again.");
return;
}
}
lastCommandUsage[player.UserIDString] = Time.realtimeSinceStartup;
if (!permission.UserHasPermission(player.UserIDString, permissionName))
{
player.ChatMessage("<color=red>[BaseUpgrade]</color>: You don't have permission to use this command.");
return;
}
if (player == null)
{
Puts("Command must be called by a player.");
return;
}
BuildingPrivlidge privilege = player.GetBuildingPrivilege();
if (privilege == null || !privilege.IsAuthed(player))
{
Puts("Player does not have building privilege.");
return;
}
List<BuildingBlock> blocks = new List<BuildingBlock>();
Vis.Entities(privilege.transform.position, 29.0f, blocks);
foreach (var block in blocks)
{
block.skinID = 0; // Reset to no skin
block.SendNetworkUpdate();
}
UpgradeBlocksSequentially(player, blocks, privilege, 0, targetGrade);
}
private bool IsPlayerRaidBlocked(BasePlayer player)
{
if (NoEscape == null)
{
Puts("No Escape plugin not found or not loaded. Donwload -> https://umod.org/plugins/no-escape");
return false;
}
bool isBlocked = (bool)NoEscape.CallHook("IsRaidBlocked", player);
return isBlocked;
}
private bool IsPlayerCombatBlocked(BasePlayer player)
{
if (NoEscape == null)
{
Puts("No Escape plugin not found or not loaded. Donwload -> https://umod.org/plugins/no-escape");
return false;
}
bool isBlocked = (bool)NoEscape.CallHook("IsCombatBlocked", player);
return isBlocked;
}
private int GetTotalResourceInTC(BuildingPrivlidge privilege, int itemId)
{
int totalResource = 0;
foreach (var item in privilege.inventory.itemList)
{
if (item.info.itemid == itemId)
{
totalResource += item.amount;
}
}
return totalResource;
}
private void DeductResourceFromTC(BuildingPrivlidge privilege, int itemId, int amount)
{
foreach (var item in privilege.inventory.itemList)
{
if (item.info.itemid == itemId)
{
if (item.amount <= amount)
{
amount -= item.amount;
item.Remove();
}
else
{
item.UseItem(amount);
break;
}
}
}
}
private void UpgradeBlocksSequentially(BasePlayer player, List<BuildingBlock> blocks, BuildingPrivlidge privilege, int currentIndex, BuildingGrade.Enum targetGrade)
{
if (currentIndex >= blocks.Count)
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: Upgrade process to {targetGrade} completed.");
return;
}
BuildingBlock block = blocks[currentIndex];
// Check for downgrade first
if (targetGrade < block.grade)
{
if (!permission.UserHasPermission(player.UserIDString, permDowngrade))
{
player.ChatMessage("You don't have permission to downgrade.");
return;
}
if (RefundOnDowngrade)
{
int refundAmount = GetUpgradeCost(block.grade);
int itemId = GetItemId(block.grade);
// Refund to the TC
var tcInventory = privilege.inventory;
var tempItem = ItemManager.CreateByItemID(itemId, refundAmount);
if (tcInventory.CanAcceptItem(tempItem, -1) == ItemContainer.CanAcceptResult.CanAccept)
{
tcInventory.GiveItem(tempItem);
}
else
{
tempItem.Remove();
}
}
}
if (block.grade == targetGrade)
{
UpgradeBlocksSequentially(player, blocks, privilege, currentIndex + 1, targetGrade);
return;
}
int upgradeCost = GetUpgradeCost(targetGrade);
int itemIdForUpgrade = GetItemId(targetGrade);
string materialName = GetMaterialName(targetGrade);
int totalResource = GetTotalResourceInTC(privilege, itemIdForUpgrade);
if (totalResource >= upgradeCost)
{
DeductResourceFromTC(privilege, itemIdForUpgrade, upgradeCost);
block.ChangeGrade(targetGrade);
block.health = block.MaxHealth(); // Set block health to full after upgrade
block.SendNetworkUpdate();
Effect.server.Run($"assets/bundled/prefabs/fx/build/promote_{materialName}.prefab", block, 0, Vector3.zero, Vector3.forward);
timer.Once(UpgradeDelay, () => UpgradeBlocksSequentially(player, blocks, privilege, currentIndex + 1, targetGrade));
}
else
{
player.ChatMessage($"<color=red>[BaseUpgrade]</color>: Upgrade halted due to insufficient {materialName} in the Tool Cupboard.");
return;
}
}
private int GetUpgradeCost(BuildingGrade.Enum grade)
{
var upgradeCosts = Config["UpgradeCosts"] as Dictionary<string, object>;
if (upgradeCosts == null)
{
PrintWarning("Upgrade costs not found in the configuration!");
return 0;
}
switch (grade)
{
case BuildingGrade.Enum.Wood:
return Convert.ToInt32(upgradeCosts["Wood"]);
case BuildingGrade.Enum.Stone:
return Convert.ToInt32(upgradeCosts["Stone"]);
case BuildingGrade.Enum.Metal:
return Convert.ToInt32(upgradeCosts["Metal"]);
case BuildingGrade.Enum.TopTier:
return Convert.ToInt32(upgradeCosts["TopTier"]);
default:
return 0;
}
}
private int GetItemId(BuildingGrade.Enum targetGrade)
{
switch (targetGrade)
{
case BuildingGrade.Enum.Wood:
return -151838493; // This is the item ID for Wood
case BuildingGrade.Enum.Stone:
return -2099697608; // This is the item ID for Stone
case BuildingGrade.Enum.Metal:
return 69511070; // This is the item ID for Metal
case BuildingGrade.Enum.TopTier:
return 317398316; // This is the item ID for HQM
default:
return 0;
}
}
private string GetMaterialName(BuildingGrade.Enum targetGrade)
{
switch (targetGrade)
{
case BuildingGrade.Enum.Wood:
return "Wood";
case BuildingGrade.Enum.Stone:
return "Stone";
case BuildingGrade.Enum.Metal:
return "Metal";
case BuildingGrade.Enum.TopTier:
return "TopTier";
default:
return "Unknown";
}
}
private void OnLootEntity(BasePlayer player, BaseEntity entity)
{
if (!permission.UserHasPermission(player.UserIDString, permShow))
{
return;
}
var tc = entity as BuildingPrivlidge;
if (tc != null)
{
Panel_6168(player);
}
}
private void OnLootEntityEnd(BasePlayer player, BaseEntity entity)
{
var tc = entity as BuildingPrivlidge;
if (tc != null)
{
CuiHelper.DestroyUi(player, "Panel_6168");
CuiHelper.DestroyUi(player, "toggleskins");
CuiHelper.DestroyUi(player, "removepanel");
CuiHelper.DestroyUi(player, "panelremove");
}
}
private void toggleskins(BasePlayer player)
{
var container = new CuiElementContainer();
container.Add(new CuiPanel
{
CursorEnabled = false,
Image = { Color = "0.1333333 0.1333333 0.1333333 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-213.331 -29.613", OffsetMax = "189.729 333.213" }
}, "Overlay", "toggleskins");
container.Add(new CuiPanel
{
CursorEnabled = false,
Image = { Color = "0.1333333 0.1333333 0.1333333 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-201.53 120.4", OffsetMax = "201.53 201.607" }
}, "toggleskins", "Panel_2557");
container.Add(new CuiElement
{
Name = "Label_8613",
Parent = "toggleskins",
Components = {
new CuiTextComponent { Text = "Build Skins", Font = "robotocondensed-regular.ttf", FontSize = 14, Align = TextAnchor.MiddleCenter, Color = "0.9433962 0.1379494 0.1379494 1" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-201.53 162.067", OffsetMax = "201.53 201.613" }
}
});
container.Add(new CuiElement
{
Name = "Brick",
Parent = "toggleskins",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/SMyiYex.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-182.279 83.336", OffsetMax = "-100.119 162.065" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "apply_skin_brick" },
Text = { Text = "Upgrade(Stone)", Font = "robotocondensed-regular.ttf", FontSize = 20, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "47.136 -39.365", OffsetMax = "338.231 39.365" }
}, "Brick", "Button_8444");
container.Add(new CuiElement
{
Name = "Adobe",
Parent = "toggleskins",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/K3aJrSH.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-182.279 -1.414", OffsetMax = "-100.119 77.315" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "apply_skin_adobe" },
Text = { Text = "Upgrade(Stone)", Font = "robotocondensed-regular.ttf", FontSize = 20, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "46.353 -39.364", OffsetMax = "337.447 39.366" }
}, "Adobe", "Button_8444");
container.Add(new CuiElement
{
Name = "BrutalistSkin",
Parent = "toggleskins",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/c8KcGhc.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-182.282 -87.262", OffsetMax = "-100.122 -8.533" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "apply_skin_Brutalist" },
Text = { Text = "Upgrade(Stone)", Font = "robotocondensed-regular.ttf", FontSize = 20, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "46.453 -39.365", OffsetMax = "337.547 39.365" }
}, "BrutalistSkin", "Button_8444");
container.Add(new CuiElement
{
Name = "ShippingContainer",
Parent = "toggleskins",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/9Ogweib.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-182.282 -174.462", OffsetMax = "-100.122 -95.733" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "apply_skin_metal" },
Text = { Text = "Upgrade(Metal)", Font = "robotocondensed-regular.ttf", FontSize = 20, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "46.453 -39.365", OffsetMax = "337.547 39.365" }
}, "ShippingContainer", "Button_8444");
CuiHelper.DestroyUi(player, "toggleskins");
CuiHelper.AddUi(player, container);
}
private void Panel_6168(BasePlayer player)
{
var container = new CuiElementContainer();
container.Add(new CuiPanel
{
CursorEnabled = true,
Image = { Color = "0.1320755 0.1320755 0.1320755 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "298.717 257.713", OffsetMax = "571.743 324.487" }
}, "Overlay", "Panel_6168");
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "up_wood" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-133.004 -28.571", OffsetMax = "-67.796 28.571" }
}, "Panel_6168", "WoodButton");
container.Add(new CuiElement
{
Name = "Image_2871",
Parent = "WoodButton",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/supvXqG.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.571", OffsetMax = "32.604 28.571" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "up_stone" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-65.208 -28.571", OffsetMax = "0 28.571" }
}, "Panel_6168", "StoneButton");
container.Add(new CuiElement
{
Name = "Image_2871 (1)",
Parent = "StoneButton",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/WkMZyfW.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.571", OffsetMax = "32.604 28.571" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "up_metal" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "1.996 -28.571", OffsetMax = "67.204 28.571" }
}, "Panel_6168", "MetalFragsButton");
container.Add(new CuiElement
{
Name = "Image_2871 (2)",
Parent = "MetalFragsButton",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/dS0VjEM.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.371", OffsetMax = "32.604 28.771" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "up_hqm" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "68.496 -28.371", OffsetMax = "133.704 28.771" }
}, "Panel_6168", "HQMButton");
container.Add(new CuiElement
{
Name = "Image_2871 (3)",
Parent = "HQMButton",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/oh2tFst.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.571", OffsetMax = "32.604 28.571" }
}
});
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "skins" },
Text = { Text = "Skins", Font = "robotocondensed-regular.ttf", FontSize = 14, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "33.704 35.541", OffsetMax = "133.704 65.459" }
}, "Panel_6168", "SkinsButton");
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "up_repair" },
Text = { Text = "Repair", Font = "robotocondensed-regular.ttf", FontSize = 14, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-67.796 35.541", OffsetMax = "32.204 65.459" }
}, "Panel_6168", "Repair");
container.Add(new CuiPanel
{
CursorEnabled = true,
Image = { Color = "0.1320755 0.1320755 0.1320755 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-147.871 -33.387", OffsetMax = "-137.689 33.387" }
}, "Panel_6168", "removepanel");
container.Add(new CuiButton
{
Button = { Color = "0.07843138 0.07843138 0.07843138 1", Command = "open.panelremove" },
Text = { Text = "<", Font = "robotocondensed-regular.ttf", FontSize = 14, Align = TextAnchor.MiddleCenter, Color = "1 1 1 1" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-5.09 -33.388", OffsetMax = "5.091 33.387" }
}, "removepanel", "Button_8391");
CuiHelper.DestroyUi(player, "Panel_6168");
CuiHelper.AddUi(player, container);
}
private void panelremove(BasePlayer player)
{
var container = new CuiElementContainer();
container.Add(new CuiPanel
{
CursorEnabled = true,
Image = { Color = "0.1320755 0.1320755 0.1320755 1", FadeIn = 0 },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "229.125 257.713", OffsetMax = "298.715 324.487" }
}, "Overlay", "panelremove");
container.Add(new CuiButton
{
Button = { Color = "0.2784314 0.2784314 0.2784314 1", Command = "remove_block" },
RectTransform = { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.571", OffsetMax = "32.604 28.571" }
}, "panelremove", "Button_2118 (4)");
container.Add(new CuiElement
{
Name = "Image_2871",
Parent = "Button_2118 (4)",
Components = {
new CuiRawImageComponent { Color = "1 1 1 1", Url = "https://i.imgur.com/AHu6SRj.png" },
new CuiOutlineComponent { Color = "0 0 0 0.5", Distance = "1 -1" },
new CuiRectTransformComponent { AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-32.604 -28.571", OffsetMax = "32.604 28.571" }
}
});
CuiHelper.DestroyUi(player, "panelremove");
CuiHelper.AddUi(player, container);
}
}
}