Skip to content

Commit

Permalink
get project ready for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
GlorifiedPig committed Aug 20, 2021
1 parent 2e9c1c0 commit 5d2491b
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 49 deletions.
81 changes: 80 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@

<p align="center"><a href="https://www.youtube.com/watch?v=lhvtcBpmYhs"><img src="https://i.imgur.com/dtmjc3h.png"></a></p>

# GlorifiedBanking
A lightweight and effective ATM script which will fit all your DarkRP banking desires.

![https://img.shields.io/discord/329643791063449600?label=discord](https://img.shields.io/discord/329643791063449600?label=discord)

Please do not contact me for support. I will not assist you. This is open source with an issues section for a reason.

## Installation

- Download the latest version.
- Open the zip file using WinRar or 7-Zip.
- Drag & drop the folder into your addon's folder.
- Configure at `lua/addons/glorifiedbanking/xx_config.lua`.
- Add `glorifiedbanking_card` to your DarkRP loadout.
- Add [this](https://steamcommunity.com/sharedfiles/filedetails/?id=2101502704) workshop link to your server's collection.

## Spawning ATMs

If you would like to spawn and configure ATMs, open the spawn menu and select the ATM Placer toolgun. You can configure everything on the right, such as the withdrawal, deposit and transfer fees. Left click to place an ATM, right click to remove one and reload to update an existing ATM's settings.

## Using the Admin Panel

Type `glorifiedbanking_admin` in your console if you would like to access the panel.

## Restoring Backups

- Go to your server's `data` folder.
- Open the `glorifiedbanking_backups` folder.
- Look for the timestamp you would like to restore to.
- Type `glorifiedbanking_restorebackup timestamp` in your server's console.
- Restart your server.

## Importing Blue's ATM Data

- Make sure your SQL config is set up in GlorifiedBanking.
- Make sure Blue's ATM is on your server and the SQL is set up correctly.
- Type `glorifiedbanking_importbluesdata` in console and make sure it prints that the transfer was successful.
- Restart your server.

## Description

GlorifiedBanking was built with optimization in mind. It is lightweight, efficient and should fit all your needs for a roleplay banking system. When the player logs in for the first time, a bank account is created for him and he will be able to access it through one of the placed ATMs around the map. Administrators are able to use our built-in administration and logging panels, which provide you features such as transaction history, modifying players' bank accounts and more.

The addon also comes with various other quality of life features, such as your paychecks automatically being converted to money in your bank. There is also an interest system which can be configured to work with certain usergroups to give your donators or admins an extra amount.

Things don't always go as planned, and we understand that. There are numerous different tools included for damage control in the event that something goes wrong. Examples of these tools include our completely configurable and in-depth backup system which allow you to backup your database safely, as well as a lockdown mode that prevents any ATM usage which can be activated from one of your defined usergroups/admins in the event of an emergency.

### Key Features

- Easy and powerful configuration
- MySQL and SQLite compatibility
- Blue's ATM data importer so your players don't lose out
- Lockdown mode in the event of an emergency
- Exploit prevention and validation checks
- A built-in logging system in our admin panel
- Custom card designer to let the cards fit your server's theme
- Card reader entity for your stores to have direct transactions
- Wiremod outputs for card readers

### Features

- Interest system, custom checks for certain use cases such as restricting to donators
- Lightweight with top tier optimisation
- In-depth backup system for damage control, fully configurable
- Integrated with numerous other addons due to our powerful API
- A built-in logging system in our admin panel
- System for your paychecks to go straight to your bank
- A custom model with animations and a 3D2D menu
- Transaction history, for individuals and admins
- ATM entities save per map and work through admin cleanups
- CAMI support for certain admin privileges
- Custom Immersive and responsive audio
- Withdrawals, deposits and transfers with the ability to set fees per ATM
- Administration panel to take full control of your server
- Easily customisation UI themes with our easy-to-understand theme library
- Add support for other gamemodes with our easy-to-use compatibility file
- Toolgun to consistently place ATMs at the same height, consistent distances and set appropriate fees
- Translate to your own language with ease using our localisation library
- DRM free and zero obfuscation
71 changes: 28 additions & 43 deletions lua/autorun/sh_glorifiedbanking_autoincluder.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@

--[[
Script Ownership:
{{ user_id }}
Version: {{ script_version_name }}
]]--

GlorifiedBanking = GlorifiedBanking or {
Config = {},
Version = "3.2.1"
Version = "3.2.2"
}

print( "[GlorifiedBanking] This server is running version " .. GlorifiedBanking.Version .. "." )
local IsAddon = true -- Set this to 'true' if you're running from an addon, set to 'false' if you're running from a gamemode.

--[[
GlorifiedInclude - A library for including files & folders with ease.
Expand All @@ -24,10 +17,9 @@ local IsAddon = true -- Set this to 'true' if you're running from an addon, set
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]--

local giVersion = 1.2
local giVersion = 1.4

if not GlorifiedInclude or GlorifiedInclude.Version < giVersion then

GlorifiedInclude = {
Version = giVersion,
Realm = {
Expand All @@ -37,60 +29,59 @@ if not GlorifiedInclude or GlorifiedInclude.Version < giVersion then
}
}

local _include = include
local _AddCSLuaFile = AddCSLuaFile
local _SERVER = SERVER
local isAddon = debug.getinfo( 1, "S" ).short_src[1] == "a"
local include = include
local AddCSLuaFile = AddCSLuaFile
local SERVER = SERVER

local _GlorifiedInclude_Realm = GlorifiedInclude.Realm
local GlorifiedInclude_Realm = GlorifiedInclude.Realm

local includedFiles = {}

function GlorifiedInclude.IncludeFile( fileName, realm, forceInclude, calledFromFolder, printName )
if IsAddon == false and not calledFromFolder then fileName = GM.FolderName .. "/gamemode/" .. fileName end
if isAddon == false and not calledFromFolder then fileName = GM.FolderName .. "/gamemode/" .. fileName end
if not forceInclude and includedFiles[fileName] then return end
includedFiles[fileName] = true

if realm == _GlorifiedInclude_Realm.Shared or fileName:find( "sh_" ) then
if _SERVER then _AddCSLuaFile( fileName ) end
_include( fileName )
if realm == GlorifiedInclude_Realm.Shared or fileName:find( "sh_" ) then
if printName then
print( printName .. " > Included SH file '" .. fileName .. "'" )
print( printName .. " > Including SH file '" .. fileName .. "'" )
end
elseif realm == _GlorifiedInclude_Realm.Server or ( _SERVER and fileName:find( "sv_" ) ) then
_include( fileName )
if SERVER then AddCSLuaFile( fileName ) end
include( fileName )
elseif realm == GlorifiedInclude_Realm.Server or ( SERVER and fileName:find( "sv_" ) ) then
if printName then
print( printName .. " > Included SV file '" .. fileName .. "'" )
print( printName .. " > Including SV file '" .. fileName .. "'" )
end
elseif realm == _GlorifiedInclude_Realm.Client or fileName:find( "cl_" ) then
if _SERVER then _AddCSLuaFile( fileName )
else _include( fileName ) end
include( fileName )
elseif realm == GlorifiedInclude_Realm.Client or fileName:find( "cl_" ) then
if printName then
print( printName .. " > Included CL file '" .. fileName .. "'" )
print( printName .. " > Including CL file '" .. fileName .. "'" )
end
if SERVER then AddCSLuaFile( fileName )
else include( fileName ) end
end
end

function GlorifiedInclude.IncludeFolder( folderName, ignoreFiles, ignoreFolders, forceInclude, printName )
if IsAddon == false then folderName = GM.FolderName .. "/gamemode/" .. folderName end
if not isAddon then folderName = GM.FolderName .. "/gamemode/" .. folderName end

if string.Right( folderName, 1 ) != "/" then folderName = folderName .. "/" end
if string.Right( folderName, 1 ) ~= "/" then folderName = folderName .. "/" end

local filesInFolder, foldersInFolder = file.Find( folderName .. "*", "LUA" )

if forceInclude == nil then forceInclude = false end

if ignoreFiles != true then
for k, v in ipairs( filesInFolder ) do
if ignoreFiles ~= true then
for _, v in ipairs( filesInFolder ) do
GlorifiedInclude.IncludeFile( folderName .. v, nil, forceInclude, true, printName )
end
end

if ignoreFolders != true then
for k, v in ipairs( foldersInFolder ) do
if ignoreFolders ~= true then
for _, v in ipairs( foldersInFolder ) do
GlorifiedInclude.IncludeFolder( folderName .. v .. "/", ignoreFiles, ignoreFolders, forceInclude, printName )
end
end
end

end

--[[
Expand All @@ -99,6 +90,7 @@ end
GlorifiedInclude.IncludeFile( "sh_config.lua" )
-- Remember that files load in the order you include them in.
]]--

local function gbIncludeFile( fileName ) GlorifiedInclude.IncludeFile( fileName, nil, nil, nil, "GlorifiedBanking" ) end
local function gbIncludeFolder( folderName ) GlorifiedInclude.IncludeFolder( folderName, nil, nil, nil, "GlorifiedBanking" ) end
gbIncludeFile( "glorifiedbanking/sh_glorifiedbanking_compatibility.lua" )
Expand All @@ -114,11 +106,4 @@ local function IncludeGBFiles()
hook.Run( "GlorifiedBanking.FinishedLoading" )
end

hook.Add( GlorifiedBanking.HookRunName, "GlorifiedBanking.AutoIncluder.IncludeGBFiles", IncludeGBFiles )

hook.Add("libgmodstore_init", "GlorifiedBanking.AutoIncluder.InitLibGModStore",function()
libgmodstore:InitScript( 7140, "GlorifiedBanking", {
version = "{{ script_version_name }}",
licensee = "{{ user_id }}"
} )
end)
hook.Add( GlorifiedBanking.HookRunName, "GlorifiedBanking.AutoIncluder.IncludeGBFiles", IncludeGBFiles )
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end

if ztm and ztm.f and ztm.f.GiveMoney then
local oldztmfunc = ztm.f.GiveMoney
function ztm.f.GiveMoney( ply, money ) -- {{ user_id | 25 }}
function ztm.f.GiveMoney( ply, money )
if money >= 0 then
GlorifiedBanking.AddPlayerBalance( ply, money )
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hook.Add( "PlayerInitialSpawn", "GlorifiedBanking.SQLPlayer.PlayerInitialSpawn",
else
ply.GlorifiedBanking.Balance = startingBalance
ply:SetNW2String( "GlorifiedBanking.Balance", tostring( startingBalance ) )
GlorifiedBanking.SQL.Query( "INSERT INTO `gb_players`( `SteamID`, `Balance`, `LastName` ) VALUES ( '" .. ply:SteamID64() .. "', '" .. startingBalance .. "', '" .. GlorifiedBanking.SQL.EscapeString( ply:Nick() ) .. "' )" ) -- {{ user_id | 25 }}
GlorifiedBanking.SQL.Query( "INSERT INTO `gb_players`( `SteamID`, `Balance`, `LastName` ) VALUES ( '" .. ply:SteamID64() .. "', '" .. startingBalance .. "', '" .. GlorifiedBanking.SQL.EscapeString( ply:Nick() ) .. "' )" )
end
end )
end )
Expand Down
6 changes: 3 additions & 3 deletions lua/weapons/gmod_tool/stools/gbatmplacer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if CLIENT then
{name = "reload"}
}

language.Add("tool.gbatmplacer.name", GlorifiedBanking.i18n.GetPhrase("gbToolName")) -- {{ user_id | 25 }}
language.Add("tool.gbatmplacer.name", GlorifiedBanking.i18n.GetPhrase("gbToolName"))
language.Add("tool.gbatmplacer.desc", GlorifiedBanking.i18n.GetPhrase("gbToolDescription"))
language.Add("tool.gbatmplacer.left", GlorifiedBanking.i18n.GetPhrase("gbToolLeftClick"))
language.Add("tool.gbatmplacer.right", GlorifiedBanking.i18n.GetPhrase("gbToolRightClick"))
Expand Down Expand Up @@ -74,7 +74,7 @@ end
local function getAtmPos(tr, posOffset, snap)
if not tr.Hit or IsValid(tr.Entity) then return false end

local angles = tr.HitNormal:Angle() -- {{ user_id sha256 key }}
local angles = tr.HitNormal:Angle()
if angles[1] != 0 then return false end

local floorTr = util.TraceLine({
Expand Down Expand Up @@ -122,7 +122,7 @@ function TOOL:Think()
self:MakeGhostEntity("models/sterling/glorifiedpig_atm.mdl", vector_origin, Angle())
end

self:UpdateGhost(self.GhostEntity, self:GetOwner()) -- {{ user_id sha256 key }}
self:UpdateGhost(self.GhostEntity, self:GetOwner())
end

if CLIENT then return end
Expand Down

0 comments on commit 5d2491b

Please sign in to comment.