Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtraJuiceMan committed Apr 13, 2018
1 parent 58c0421 commit f426dbc
Show file tree
Hide file tree
Showing 24 changed files with 919 additions and 0 deletions.
Binary file added Libraries/0Harmony.dll
Binary file not shown.
Binary file added Libraries/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file added Libraries/Assembly-CSharp.dll
Binary file not shown.
Binary file added Libraries/Rocket.API.dll
Binary file not shown.
Binary file added Libraries/Rocket.Core.dll
Binary file not shown.
Binary file added Libraries/Rocket.Unturned.dll
Binary file not shown.
Binary file added Libraries/Uconomy.dll
Binary file not shown.
Binary file added Libraries/UnityEngine.dll
Binary file not shown.
25 changes: 25 additions & 0 deletions RealEstate.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealEstate", "RealEstate\RealEstate.csproj", "{EF549899-855F-4A80-86AB-4E5E3BD0933E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF549899-855F-4A80-86AB-4E5E3BD0933E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF549899-855F-4A80-86AB-4E5E3BD0933E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF549899-855F-4A80-86AB-4E5E3BD0933E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF549899-855F-4A80-86AB-4E5E3BD0933E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F840385C-38B7-47B1-9E75-1391D9532A5E}
EndGlobalSection
EndGlobal
53 changes: 53 additions & 0 deletions RealEstate/Commands/CommandAbandonHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandAbandonHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "abandonhouse";

public string Help => "Lets the player give up ownership of their house.";

public string Syntax => "/abandonhouse";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.abandonhouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
UnturnedPlayer player = (UnturnedPlayer)caller;

House h = RealEstate.manager.HouseFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("registered_house_not_found"), Color.red);
return;
}

if (h.OwnerId != player.CSteamID.m_SteamID)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("cannot_abandon"), Color.red);
return;
}

RealEstate.manager.SetHouseOwner(h.Id, null);
UnturnedChat.Say(caller, RealEstate.instance.Translate("abandoned"));
}
}
}
68 changes: 68 additions & 0 deletions RealEstate/Commands/CommandAddHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandAddHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "addhouse";

public string Help => "Allows the house that the caller is standing in to be sold at the defined price.";

public string Syntax => "/addhouse <price>";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.addhouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
if (args.Length < 1)
{
UnturnedChat.Say(caller, Syntax, Color.red);
return;
}

if (!Decimal.TryParse(args[0], out decimal price))
{
UnturnedChat.Say(caller, Syntax, Color.red);
return;
}

UnturnedPlayer player = (UnturnedPlayer)caller;

LevelObject h = RealEstate.manager.LevelObjectFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("house_not_found"), Color.red);
return;
}

if (RealEstate.manager.Homes.Any(x => x.Id == h.asset.id))
{
RealEstate.manager.SetHousePrice(h.id, price);
UnturnedChat.Say(caller, RealEstate.instance.Translate("house_updated", RealEstate.instance.Configuration.Instance.currencySymbol, price));
}
else
{
RealEstate.manager.AddHouse(new House(h.asset.id, price));
UnturnedChat.Say(caller, RealEstate.instance.Translate("house_added", RealEstate.instance.Configuration.Instance.currencySymbol, price));
}
}
}
}
68 changes: 68 additions & 0 deletions RealEstate/Commands/CommandBuyHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using fr34kyn01535.Uconomy;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandBuyHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "buyhouse";

public string Help => "Buys the house that the caller is standing in.";

public string Syntax => "/buyhouse";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.buyhouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
UnturnedPlayer player = (UnturnedPlayer)caller;

House h = RealEstate.manager.HouseFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("registered_house_not_found"), Color.red);
return;
}

int max = RealEstate.manager.GetPlayerMax(player);

if (RealEstate.manager.CountPlayerHouses(player.CSteamID.m_SteamID) >= max)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("max_reached", max), Color.red);
return;
}

if (h.OwnerId != null)
UnturnedChat.Say(caller, RealEstate.instance.Translate("owner_exists"));
else
{
if (Uconomy.Instance.Database.GetBalance(player.CSteamID.ToString()) < h.Price)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("cannot_afford", RealEstate.instance.Configuration.Instance.currencySymbol, h.Price), Color.red);
return;
}

Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), -h.Price);
UnturnedChat.Say(caller, RealEstate.instance.Translate("house_purchased", RealEstate.instance.Configuration.Instance.currencySymbol, h.Price));
RealEstate.manager.SetHouseOwner(h.Id, player.CSteamID.m_SteamID);
}
}
}
}
50 changes: 50 additions & 0 deletions RealEstate/Commands/CommandCheckHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandCheckHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "checkhouse";

public string Help => "Tells the caller the price and owner of the house that they are standing in.";

public string Syntax => "/checkhouse";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.checkhouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
UnturnedPlayer player = (UnturnedPlayer)caller;

House h = RealEstate.manager.HouseFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("registered_house_not_found"), Color.red);
return;
}

if (h.OwnerId != null)
UnturnedChat.Say(caller, RealEstate.instance.Translate("check_house_owned", RealEstate.manager.GetName(h.OwnerId.Value), RealEstate.instance.Configuration.Instance.currencySymbol, h.Price));
else
UnturnedChat.Say(caller, RealEstate.instance.Translate("check_house_unowned", RealEstate.instance.Configuration.Instance.currencySymbol, h.Price));
}
}
}
47 changes: 47 additions & 0 deletions RealEstate/Commands/CommandEvictHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandEvictHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "evicthouse";

public string Help => "Allows a player to reset the owner of the home that they are standing in.";

public string Syntax => "/evicthouse";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.evicthouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
UnturnedPlayer player = (UnturnedPlayer)caller;

House h = RealEstate.manager.HouseFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("registered_house_not_found"), Color.red);
return;
}

RealEstate.manager.SetHouseOwner(h.Id, null);
UnturnedChat.Say(caller, RealEstate.instance.Translate("eviction"));
}
}
}
48 changes: 48 additions & 0 deletions RealEstate/Commands/CommandRemoveHouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using ExtraConcentratedJuice.RealEstate.Entities;
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace ExtraConcentratedJuice.RealEstate.Commands
{
public class CommandRemoveHouse : IRocketCommand
{
#region Properties

public AllowedCaller AllowedCaller => AllowedCaller.Player;

public string Name => "removehouse";

public string Help => "Removes a house from the catalog.";

public string Syntax => "/removehouse";

public List<string> Aliases => new List<string>();

public List<string> Permissions => new List<string> { "realestate.removehouse" };

#endregion

public void Execute(IRocketPlayer caller, string[] args)
{
UnturnedPlayer player = (UnturnedPlayer)caller;

House h = RealEstate.manager.HouseFromPosition(player.Position);

if (h == null)
{
UnturnedChat.Say(caller, RealEstate.instance.Translate("registered_house_not_found"), Color.red);
return;
}

RealEstate.manager.RemoveHouse(h);
UnturnedChat.Say(caller, RealEstate.instance.Translate("removed"));
}
}
}
17 changes: 17 additions & 0 deletions RealEstate/Entities/DisplayName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ExtraConcentratedJuice.RealEstate.Entities
{
public class DisplayName
{
// Can't serialize a dictionary to XML for some reason, better go with this I guess.
public ulong Id { get; set; }
public string Name { get; set; }

public DisplayName(ulong id, string name)
{
Id = id;
Name = name;
}

public DisplayName() { }
}
}
Loading

0 comments on commit f426dbc

Please sign in to comment.