-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58c0421
commit f426dbc
Showing
24 changed files
with
919 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { } | ||
} | ||
} |
Oops, something went wrong.