├── .gmsignore ├── resource └── fonts │ ├── subwayticker.ttf │ ├── orbitronregular.ttf │ └── montserratregular.ttf ├── materials ├── glorified_banking │ ├── back.png │ ├── exit.png │ ├── user.png │ ├── check.png │ ├── chevron.png │ ├── circle.png │ ├── close.png │ ├── cursor.png │ ├── money.png │ ├── player.png │ ├── warning.png │ ├── bank_card.png │ ├── lockdown.png │ ├── transfer.png │ ├── cursor_hover.png │ ├── logo_small.png │ ├── transaction.png │ ├── slideshow │ │ ├── bank.png │ │ ├── robbery.png │ │ └── transaction.png │ └── loading_spinner.png └── sterling │ ├── glorifiedpig_atm_main.vtf │ ├── glorifiedpig_atm_norm.vtf │ ├── glorifiedpig_atm_lights.vtf │ ├── glorifiedpig_rgb_lights.vtf │ ├── glorifiedpig_atm_lightmask.vtf │ ├── glorifiedpig_cardreader_main.vtf │ ├── glorifiedpig_cardreader_norm.vtf │ ├── glorifiedpig_atm_lights.vmt │ ├── glorifiedpig_rgb_lights.vmt │ ├── glorifiedpig_cardreader_main.vmt │ └── glorifiedpig_atm_main.vmt ├── models └── sterling │ ├── glorifiedpig_atm.mdl │ ├── glorifiedpig_atm.phy │ ├── glorifiedpig_atm.vvd │ ├── glorifiedpig_atm.sw.vtx │ ├── glorifiedpig_atm.dx80.vtx │ ├── glorifiedpig_atm.dx90.vtx │ ├── glorifiedpig_cardreader.mdl │ ├── glorifiedpig_cardreader.phy │ ├── glorifiedpig_cardreader.vvd │ ├── glorifiedpig_cardreader.sw.vtx │ ├── glorifiedpig_cardreader.dx80.vtx │ └── glorifiedpig_cardreader.dx90.vtx ├── sound └── glorified_banking │ ├── beep_error.mp3 │ ├── beep_normal.mp3 │ ├── card_insert.mp3 │ ├── card_remove.mp3 │ ├── key_press.mp3 │ ├── money_out.mp3 │ ├── money_in_loop.wav │ ├── beep_attention.mp3 │ ├── money_in_finish.mp3 │ └── money_in_start.mp3 ├── lua ├── glorifiedbanking │ ├── modules │ │ ├── core │ │ │ ├── sv_glorifiedbanking_lockdown.lua │ │ │ ├── sv_glorifiedbanking_dropmoneyondeath.lua │ │ │ ├── sv_glorifiedbanking_salarytobank.lua │ │ │ ├── sv_glorifiedbanking_permissions.lua │ │ │ ├── cl_glorifiedbanking_playermeta.lua │ │ │ ├── cl_glorifiedbanking_interest.lua │ │ │ ├── cl_glorifiedbanking_carddesigner.lua │ │ │ ├── sv_glorifiedbanking_carddesigner.lua │ │ │ ├── sv_glorifiedbanking_interest.lua │ │ │ ├── sv_glorifiedbanking_logging.lua │ │ │ ├── sv_glorifiedbanking_backups.lua │ │ │ └── sv_glorifiedbanking_playermeta.lua │ │ ├── ui │ │ │ ├── cl_glorifiedbanking_dropdown.lua │ │ │ ├── cl_glorifiedbanking_draggablelabel.lua │ │ │ ├── cl_glorifiedbanking_scrollpanel.lua │ │ │ ├── cl_glorifiedbanking_players.lua │ │ │ ├── cl_glorifiedbanking_circleavatar.lua │ │ │ ├── cl_glorifiedbanking_adminmenu.lua │ │ │ ├── cl_glorifiedbanking_settings.lua │ │ │ ├── cl_glorifiedbanking_adminnavbar.lua │ │ │ ├── cl_glorifiedbanking_setbalancepopup.lua │ │ │ ├── cl_glorifiedbanking_confirmationpopup.lua │ │ │ ├── cl_glorifiedbanking_player.lua │ │ │ ├── cl_glorifiedbanking_paginator.lua │ │ │ ├── cl_glorifiedbanking_log.lua │ │ │ ├── cl_glorifiedbanking_logs.lua │ │ │ └── cl_glorifiedbanking_carddesigner.lua │ │ ├── integrations │ │ │ ├── sv_glorifiedbanking_zerosaddons.lua │ │ │ ├── sv_glorifiedbanking_blogs.lua │ │ │ ├── sv_glorifiedbanking_bluesatm.lua │ │ │ └── sv_glorifiedbanking_arcbank.lua │ │ └── sql │ │ │ └── sv_glorifiedbanking_playersql.lua │ ├── libraries │ │ ├── sh_glorifiedbanking_largernetstrings.lua │ │ ├── cl_glorifiedbanking_uilib.lua │ │ ├── sh_glorifiedbanking_i18n.lua │ │ ├── cl_glorifiedbanking_themes.lua │ │ ├── sv_glorifiedbanking_sql.lua │ │ └── sv_glorifiedbanking_gpe.lua │ ├── sh_glorifiedbanking_compatibility.lua │ ├── sh_glorifiedbanking_config.lua │ ├── sv_glorifiedbanking_config.lua │ └── localization │ │ ├── sh_glorifiedbanking_chinese.lua │ │ ├── sh_glorifiedbanking_polish.lua │ │ ├── sh_glorifiedbanking_spanish.lua │ │ ├── sh_glorifiedbanking_german.lua │ │ ├── sh_glorifiedbanking_russian.lua │ │ ├── sh_glorifiedbanking_french.lua │ │ ├── sh_glorifiedbanking_english.lua │ │ └── sh_glorifiedbanking_turkish.lua ├── entities │ ├── glorifiedbanking_cardreader │ │ ├── shared.lua │ │ └── init.lua │ ├── glorifiedbanking_atm │ │ └── shared.lua │ └── glorifiedbanking_cardreader_controller.lua ├── wire │ └── stools │ │ └── wire_gbcardreader.lua ├── weapons │ ├── glorifiedbanking_card.lua │ └── gmod_tool │ │ └── stools │ │ └── gbatmplacer.lua └── autorun │ ├── sh_glorifiedbanking_autoincluder.lua │ └── sh_glorifiedbanking_resources.lua └── README.md /.gmsignore: -------------------------------------------------------------------------------- 1 | README.md 2 | .gmsignore -------------------------------------------------------------------------------- /resource/fonts/subwayticker.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/resource/fonts/subwayticker.ttf -------------------------------------------------------------------------------- /resource/fonts/orbitronregular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/resource/fonts/orbitronregular.ttf -------------------------------------------------------------------------------- /materials/glorified_banking/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/back.png -------------------------------------------------------------------------------- /materials/glorified_banking/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/exit.png -------------------------------------------------------------------------------- /materials/glorified_banking/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/user.png -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.mdl -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.phy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.phy -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.vvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.vvd -------------------------------------------------------------------------------- /resource/fonts/montserratregular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/resource/fonts/montserratregular.ttf -------------------------------------------------------------------------------- /materials/glorified_banking/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/check.png -------------------------------------------------------------------------------- /materials/glorified_banking/chevron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/chevron.png -------------------------------------------------------------------------------- /materials/glorified_banking/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/circle.png -------------------------------------------------------------------------------- /materials/glorified_banking/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/close.png -------------------------------------------------------------------------------- /materials/glorified_banking/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/cursor.png -------------------------------------------------------------------------------- /materials/glorified_banking/money.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/money.png -------------------------------------------------------------------------------- /materials/glorified_banking/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/player.png -------------------------------------------------------------------------------- /materials/glorified_banking/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/warning.png -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.sw.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.sw.vtx -------------------------------------------------------------------------------- /sound/glorified_banking/beep_error.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/beep_error.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/beep_normal.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/beep_normal.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/card_insert.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/card_insert.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/card_remove.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/card_remove.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/key_press.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/key_press.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/money_out.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/money_out.mp3 -------------------------------------------------------------------------------- /materials/glorified_banking/bank_card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/bank_card.png -------------------------------------------------------------------------------- /materials/glorified_banking/lockdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/lockdown.png -------------------------------------------------------------------------------- /materials/glorified_banking/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/transfer.png -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.dx80.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.dx80.vtx -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_atm.dx90.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_atm.dx90.vtx -------------------------------------------------------------------------------- /sound/glorified_banking/money_in_loop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/money_in_loop.wav -------------------------------------------------------------------------------- /materials/glorified_banking/cursor_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/cursor_hover.png -------------------------------------------------------------------------------- /materials/glorified_banking/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/logo_small.png -------------------------------------------------------------------------------- /materials/glorified_banking/transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/transaction.png -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_main.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_atm_main.vtf -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_norm.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_atm_norm.vtf -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.mdl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.mdl -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.phy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.phy -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.vvd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.vvd -------------------------------------------------------------------------------- /sound/glorified_banking/beep_attention.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/beep_attention.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/money_in_finish.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/money_in_finish.mp3 -------------------------------------------------------------------------------- /sound/glorified_banking/money_in_start.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/sound/glorified_banking/money_in_start.mp3 -------------------------------------------------------------------------------- /materials/glorified_banking/slideshow/bank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/slideshow/bank.png -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_lights.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_atm_lights.vtf -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_rgb_lights.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_rgb_lights.vtf -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.sw.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.sw.vtx -------------------------------------------------------------------------------- /materials/glorified_banking/loading_spinner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/loading_spinner.png -------------------------------------------------------------------------------- /materials/glorified_banking/slideshow/robbery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/slideshow/robbery.png -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_lightmask.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_atm_lightmask.vtf -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.dx80.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.dx80.vtx -------------------------------------------------------------------------------- /models/sterling/glorifiedpig_cardreader.dx90.vtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/models/sterling/glorifiedpig_cardreader.dx90.vtx -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_cardreader_main.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_cardreader_main.vtf -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_cardreader_norm.vtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/sterling/glorifiedpig_cardreader_norm.vtf -------------------------------------------------------------------------------- /materials/glorified_banking/slideshow/transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GlorifiedPig/GlorifiedBanking/HEAD/materials/glorified_banking/slideshow/transaction.png -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_lights.vmt: -------------------------------------------------------------------------------- 1 | "UnlitGeneric" 2 | { 3 | "$basetexture" "sterling/glorifiedpig_atm_lights" 4 | Proxies 5 | { 6 | TextureScroll 7 | { 8 | texturescrollvar $BaseTextureTransform 9 | texturescrollrate 0.1 10 | texturescrollangle 0 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_rgb_lights.vmt: -------------------------------------------------------------------------------- 1 | "UnlitGeneric" 2 | { 3 | "$basetexture" "sterling/glorifiedpig_rgb_lights" 4 | Proxies 5 | { 6 | TextureScroll 7 | { 8 | texturescrollvar $BaseTextureTransform 9 | texturescrollrate 0.1 10 | texturescrollangle 0 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_lockdown.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.LockdownEnabled = false 3 | 4 | function GlorifiedBanking.ToggleLockdown() 5 | GlorifiedBanking.LockdownEnabled = !GlorifiedBanking.LockdownEnabled 6 | end 7 | 8 | function GlorifiedBanking.SetLockdownStatus( lockdownStatus ) 9 | GlorifiedBanking.LockdownEnabled = lockdownStatus 10 | end -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_cardreader_main.vmt: -------------------------------------------------------------------------------- 1 | "VertexlitGeneric" 2 | { 3 | "$basetexture" "sterling/glorifiedpig_cardreader_main" 4 | "$bumpmap" "sterling/glorifiedpig_cardreader_norm" 5 | 6 | "$envmap" "env_cubemap" 7 | "$normalmapalphaenvmapmask" "1" 8 | "$envmaptint" "[0.05 0.05 0.05]" 9 | 10 | "$phong" "1" 11 | "$phongBoost" ".5" 12 | "$phongexponent" "1.5" 13 | "$phongfresnelranges" "[0.8 0.8 0.8]" 14 | 15 | } 16 | -------------------------------------------------------------------------------- /materials/sterling/glorifiedpig_atm_main.vmt: -------------------------------------------------------------------------------- 1 | "VertexlitGeneric" 2 | { 3 | "$basetexture" "sterling/glorifiedpig_atm_main" 4 | "$bumpmap" "sterling/glorifiedpig_atm_norm" 5 | "$selfillummask" "sterling/glorifiedpig_atm_lightmask" 6 | 7 | "$selfillum" "1" 8 | "$envmap" "env_cubemap" 9 | "$normalmapalphaenvmapmask" "1" 10 | "$envmaptint" "[0.05 0.05 0.05]" 11 | 12 | "$phong" "1" 13 | "$phongBoost" ".5" 14 | "$phongexponent" "1.5" 15 | "$phongfresnelranges" "[0.5 0.5 0.5]" 16 | 17 | } 18 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_dropmoneyondeath.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.DROP_MONEY_ON_DEATH then return end 3 | 4 | hook.Add( "PlayerDeath", "GlorifiedBanking.DropMoneyOnDeath.PlayerDeath", function( ply ) 5 | GlorifiedBanking.RemovePlayerBalance( ply, GlorifiedBanking.Config.DROP_MONEY_ON_DEATH_AMOUNT ) 6 | GlorifiedBanking.Notify( ply, NOTIFY_ERROR, 5, GlorifiedBanking.i18n.GetPhrase( "gbDropMoneyOnDeath", GlorifiedBanking.Config.DROP_MONEY_ON_DEATH_AMOUNT ) ) 7 | end ) 8 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_salarytobank.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.SALARY_TO_BANK then return end 3 | 4 | hook.Add( "playerGetSalary", "GlorifiedBanking.SalaryToBank.playerGetSalary", function( ply, amount ) 5 | GlorifiedBanking.AddPlayerBalance( ply, amount ) 6 | return false, GlorifiedBanking.i18n.GetPhrase( "gbSalaryToBank", GlorifiedBanking.FormatMoney( amount ) ), 0 7 | -- Be sure to override the default message and return a salary of $0 so the player doesn't receive wallet cash on top of their initial salary. 8 | end ) 9 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_permissions.lua: -------------------------------------------------------------------------------- 1 | 2 | function GlorifiedBanking.HasPermission( ply, permission, callbackFunc ) 3 | return CAMI.PlayerHasAccess( ply, permission, callbackFunc ) or ply:IsSuperAdmin() 4 | end 5 | 6 | function GlorifiedBanking.RegisterPermission( permission, minAccess, description ) 7 | CAMI.RegisterPrivilege( { 8 | Name = permission, 9 | MinAccess = minAccess, 10 | Description = description 11 | } ) 12 | end 13 | 14 | for k, v in pairs( GlorifiedBanking.Config.CAMI_PERMISSION_DEFAULTS ) do 15 | GlorifiedBanking.RegisterPermission( k, v.MinAccess, v.Description ) 16 | end -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/cl_glorifiedbanking_playermeta.lua: -------------------------------------------------------------------------------- 1 | 2 | function GlorifiedBanking.GetPlayerBalance() 3 | return tonumber( LocalPlayer():GetNW2String( "GlorifiedBanking.Balance" ) ) or 0 4 | end 5 | 6 | function GlorifiedBanking.CanPlayerAfford( affordAmount ) 7 | local numberedAffordAmount = tonumber( affordAmount ) 8 | if numberedAffordAmount != nil then 9 | return GlorifiedBanking.GetPlayerBalance( ply ) >= numberedAffordAmount 10 | end 11 | end 12 | 13 | local plyMeta = FindMetaTable( "Player" ) 14 | function plyMeta:GetBankBalance() 15 | return GlorifiedBanking.GetPlayerBalance() 16 | end 17 | 18 | function plyMeta:CanAffordBank( affordAmount ) 19 | return GlorifiedBanking.CanPlayerAfford( affordAmount ) 20 | end -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/cl_glorifiedbanking_interest.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.INTEREST_ENABLED then return end 3 | 4 | -- This function is noted properly in sv_glorifiedbanking_interest.lua 5 | function GlorifiedBanking.GetPlayerInterestAmount() 6 | local customFunc = GlorifiedBanking.Config.INTEREST_AMOUNT_CUSTOMFUNC 7 | local percentage = GlorifiedBanking.Config.DEFAULT_INTEREST_PERCENTAGE 8 | if customFunc then 9 | local customFuncReturn = customFunc( LocalPlayer() ) 10 | if customFuncReturn and customFuncReturn != nil and customFuncReturn != 0 then 11 | percentage = customFuncReturn 12 | end 13 | end 14 | return math.Round( ( GlorifiedBanking.GetPlayerBalance() / 100 ) * percentage ) 15 | end -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_dropdown.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self.Theme = self:GetParent().Theme 6 | 7 | self.DropButton:SetVisible(false) 8 | 9 | self:SetFont("GlorifiedBanking.AdminMenu.Dropdown") 10 | self:SetColor(self.Theme.Data.Colors.dropdownSelectedTextCol) 11 | 12 | self.BackgroundColour = Color(0, 0, 0) 13 | end 14 | 15 | function PANEL:Paint(w, h) 16 | self.BackgroundColour = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, self.BackgroundColour, self:IsHovered() and self.Theme.Data.Colors.dropdownBackgroundHoverCol or self.Theme.Data.Colors.dropdownBackgroundCol) 17 | 18 | draw.RoundedBox(h * .2, 0, 0, w, h, self.BackgroundColour) 19 | end 20 | 21 | vgui.Register("GlorifiedBanking.Dropdown", PANEL, "DComboBox") 22 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/cl_glorifiedbanking_carddesigner.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.CardDesign = { 3 | imgur = "Filf1VB", 4 | namePos = { .042, .73 }, 5 | nameAlign = TEXT_ALIGN_LEFT, 6 | idPos = { .042, .85 }, 7 | idAlign = TEXT_ALIGN_LEFT 8 | } 9 | 10 | net.Receive("GlorifiedBanking.CardDesigner.SendDesignInfo", function() 11 | GlorifiedBanking.CardDesign = { 12 | imgur = net.ReadString(), 13 | idPos = {net.ReadFloat(), net.ReadFloat()}, 14 | idAlign = net.ReadUInt( 2 ), 15 | namePos = {net.ReadFloat(), net.ReadFloat()}, 16 | nameAlign = net.ReadUInt( 2 ) 17 | } 18 | 19 | GlorifiedBanking.UI.GetImgur(GlorifiedBanking.CardDesign.imgur, function(mat) 20 | GlorifiedBanking.CardMaterial = mat 21 | end) 22 | end) 23 | 24 | GlorifiedBanking.UI.GetImgur(GlorifiedBanking.CardDesign.imgur, function(mat) 25 | GlorifiedBanking.CardMaterial = mat 26 | end) 27 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/sh_glorifiedbanking_largernetstrings.lua: -------------------------------------------------------------------------------- 1 | 2 | if not net.WriteLargeString then 3 | function net.WriteLargeString( largeString ) 4 | local compressedString = util.Compress( largeString ) 5 | local byteCount = string.len( compressedString ) 6 | net.WriteUInt( byteCount, 16 ) 7 | net.WriteData( compressedString, byteCount ) 8 | end 9 | end 10 | 11 | if not net.WriteTableAsString then 12 | function net.WriteTableAsString( tbl ) 13 | net.WriteLargeString( util.TableToJSON( tbl or {} ) ) 14 | end 15 | end 16 | 17 | if not net.ReadLargeString then 18 | function net.ReadLargeString() 19 | local byteCount = net.ReadUInt( 16 ) 20 | return util.Decompress( net.ReadData( byteCount ) ) 21 | end 22 | end 23 | 24 | if not net.ReadTableAsString then 25 | function net.ReadTableAsString() 26 | return util.JSONToTable( net.ReadLargeString() ) 27 | end 28 | end -------------------------------------------------------------------------------- /lua/entities/glorifiedbanking_cardreader/shared.lua: -------------------------------------------------------------------------------- 1 | 2 | ENT.Type = "anim" 3 | ENT.Base = "base_gmodentity" 4 | ENT.PrintName = "Glorified Card Reader" 5 | ENT.Category = "GlorifiedBanking" 6 | ENT.Author = "Tom.bat" 7 | ENT.Spawnable = true 8 | ENT.AdminOnly = true 9 | 10 | --Set up the network vars 11 | function ENT:SetupDataTables() 12 | self:NetworkVar("Int", 0, "ScreenID") 13 | self:NetworkVar("Int", 1, "TransactionAmount") 14 | self:NetworkVar("Entity", 0, "owning_ent") 15 | 16 | if SERVER then 17 | self:SetScreenID(1) 18 | self:SetTransactionAmount(0) 19 | end 20 | end 21 | 22 | --Use entity ownership to get the merchant user 23 | function ENT:GetMerchant() 24 | return GlorifiedBanking.GetEntOwner(self) 25 | end 26 | 27 | --Define all of our possible screens 28 | ENT.Screens = { 29 | [1] = {}, --Amount entry screen 30 | [2] = {}, --Payment screen 31 | [3] = {}, --Present payment device screen 32 | [4] = {} --Loading screen 33 | } 34 | -------------------------------------------------------------------------------- /lua/wire/stools/wire_gbcardreader.lua: -------------------------------------------------------------------------------- 1 | 2 | WireToolSetup.setCategory("Input, Output/Glorified Banking") 3 | WireToolSetup.open("gbcardreader", "Card Reader Controller", "glorifiedbanking_cardreader_controller", nil, "Card Reader Controller") 4 | 5 | if CLIENT then 6 | language.Add("tool.wire_gbcardreader.name", GlorifiedBanking.i18n.GetPhrase("gbWireToolName")) 7 | language.Add("tool.wire_gbcardreader.desc", GlorifiedBanking.i18n.GetPhrase("gbWireToolDesc")) 8 | language.Add("tool.wire_gbcardreader.0", GlorifiedBanking.i18n.GetPhrase("gbWireToolStep1")) 9 | language.Add("tool.wire_gbcardreader.1", GlorifiedBanking.i18n.GetPhrase("gbWireToolStep2")) 10 | end 11 | 12 | WireToolSetup.BaseLang() 13 | WireToolSetup.SetupMax(2) 14 | 15 | TOOL.NoLeftOnClass = true 16 | TOOL.ClientConVar = { 17 | model = "models/jaanus/wiretool/wiretool_siren.mdl" 18 | } 19 | 20 | WireToolSetup.SetupLinking(true) 21 | 22 | function TOOL.BuildCPanel(panel) 23 | ModelPlug_AddToCPanel(panel, "Misc_Tools", "wire_gbcardreader", nil, 1) 24 | end 25 | 26 | WireToolSetup.close() 27 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_draggablelabel.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self:SetMouseInputEnabled(true) 6 | end 7 | 8 | function PANEL:Think() 9 | if self.Dragging then 10 | local mousex = math.Clamp(gui.MouseX(), 1, ScrW() - 1) 11 | local mousey = math.Clamp(gui.MouseY(), 1, ScrH() - 1) 12 | 13 | local x = mousex - self.Dragging[1] 14 | local y = mousey - self.Dragging[2] 15 | 16 | local parentw, parenty = self:GetParent():GetSize() 17 | 18 | x = math.Clamp(x, 0, parentw - self:GetWide()) 19 | y = math.Clamp(y, 0, parenty - self:GetTall()) 20 | 21 | self:SetPos(x, y) 22 | end 23 | end 24 | 25 | function PANEL:OnMousePressed() 26 | self.Dragging = {gui.MouseX() - self.x, gui.MouseY() - self.y} 27 | self:MouseCapture(true) 28 | end 29 | 30 | function PANEL:OnMouseReleased() 31 | self.Dragging = nil 32 | self:MouseCapture(false) 33 | 34 | self:OnDropped(self:GetPos()) 35 | end 36 | 37 | function PANEL:OnDropped(x, y) end 38 | 39 | vgui.Register("GlorifiedBanking.DraggableLabel", PANEL, "DLabel") 40 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/integrations/sv_glorifiedbanking_zerosaddons.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.SUPPORT_ZEROS_ADDONS then return end 3 | 4 | if zwf and zwf.f and zwf.f.GiveMoney then 5 | local oldzwffunc = zwf.f.GiveMoney 6 | function zwf.f.GiveMoney( ply, money ) 7 | if money >= 0 then 8 | GlorifiedBanking.AddPlayerBalance( ply, money ) 9 | else 10 | oldzwffunc( ply, money ) 11 | end 12 | end 13 | end 14 | 15 | if zrmine and zrmine.f and zrmine.f.GiveMoney then 16 | local oldzrminefunc = zrmine.f.GiveMoney 17 | function zrmine.f.GiveMoney( ply, money ) 18 | if money >= 0 then 19 | GlorifiedBanking.AddPlayerBalance( ply, money ) 20 | else 21 | oldzrminefunc( ply, money ) 22 | end 23 | end 24 | end 25 | 26 | if ztm and ztm.f and ztm.f.GiveMoney then 27 | local oldztmfunc = ztm.f.GiveMoney 28 | function ztm.f.GiveMoney( ply, money ) 29 | if money >= 0 then 30 | GlorifiedBanking.AddPlayerBalance( ply, money ) 31 | else 32 | oldztmfunc( ply, money ) 33 | end 34 | end 35 | end -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_scrollpanel.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self.Theme = self:GetParent().Theme 6 | 7 | self.VBar:SetHideButtons(true) 8 | 9 | function self.VBar:Paint(w, h) end 10 | 11 | self.VBar.btnGrip.Color = Color(255, 255, 255) 12 | self.VBar.btnGrip.Paint = function(s, w, h) 13 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 15, s.Color, (self.VBar.Dragging or s:IsHovered()) and self.Theme.Data.Colors.scrollBarHoverCol or self.Theme.Data.Colors.scrollBarCol) 14 | draw.RoundedBox(w * .46, 0, 0, w, h, s.Color) 15 | end 16 | end 17 | 18 | function PANEL:PerformLayout(w, h) 19 | if not (w or h) then return end 20 | 21 | self.VBar:SetWidth(w * .018) 22 | self.VBar:Dock(RIGHT) 23 | 24 | self:Rebuild() 25 | 26 | self.VBar:SetUp(h, self.pnlCanvas:GetTall()) 27 | 28 | if self.VBar.Enabled then w = w - self.VBar:GetWide() end 29 | 30 | self.pnlCanvas:SetPos(0, self.VBar:GetOffset()) 31 | self.pnlCanvas:SetWide(w) 32 | 33 | self:Rebuild() 34 | 35 | if h != self.pnlCanvas:GetTall() then 36 | self.VBar:SetScroll(self.VBar:GetScroll()) 37 | end 38 | end 39 | 40 | vgui.Register("GlorifiedBanking.ScrollPanel", PANEL, "DScrollPanel") 41 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/sh_glorifiedbanking_compatibility.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.HookRunName = "DarkRPFinishedLoading" -- Which hook should we start loading GlorifiedBanking files in? 3 | 4 | function GlorifiedBanking.CanWalletAfford( ply, amount ) 5 | return ply:canAfford( amount ) 6 | end 7 | 8 | function GlorifiedBanking.FormatMoney( amount ) 9 | return DarkRP.formatMoney( tonumber( amount ) ) 10 | end 11 | 12 | function GlorifiedBanking.GetEntOwner( ent ) 13 | local owner = ent:CPPIGetOwner() 14 | if owner then return owner end 15 | return ent.Getowning_ent and ent:Getowning_ent() 16 | end 17 | 18 | if SERVER then 19 | function GlorifiedBanking.AddCash( ply, amount ) 20 | return ply:addMoney( amount ) 21 | end 22 | 23 | function GlorifiedBanking.RemoveCash( ply, amount ) 24 | return ply:addMoney( -amount ) 25 | end 26 | 27 | function GlorifiedBanking.Notify( ply, msgType, time, message ) 28 | DarkRP.notify( ply, msgType, time, message ) 29 | end 30 | 31 | function GlorifiedBanking.SetEntOwner( ent, ply ) 32 | if ent.Setowning_ent then ent:Setowning_ent(ply) end 33 | ent:CPPISetOwner(ply) 34 | end 35 | else 36 | function GlorifiedBanking.Notify( msgType, time, message ) 37 | notification.AddLegacy( message, msgType, time ) 38 | end 39 | end 40 | 41 | hook.Add("playerBoughtCustomEntity", "GlorifiedBanking.Compatability.playerBoughtCustomEntity", function(ply, entTbl, ent, price) 42 | if ent:GetClass() == "glorifiedbanking_cardreader" then ent:SetMerchant(ply) end 43 | end) 44 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/integrations/sv_glorifiedbanking_blogs.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.SUPPORT_BLOGS then return end 3 | 4 | local WITHDRAWAL_MODULE = GAS.Logging:MODULE() 5 | 6 | WITHDRAWAL_MODULE.Category = "GlorifiedBanking" 7 | WITHDRAWAL_MODULE.Name = "Withdrawals" 8 | WITHDRAWAL_MODULE.Colour = Color( 0, 255, 0 ) 9 | 10 | WITHDRAWAL_MODULE:Hook( "GlorifiedBanking.PlayerWithdrawal", "withdrawal", function( ply, withdrawalAmount ) 11 | WITHDRAWAL_MODULE:Log( "{1} withdrew {2}.", GAS.Logging:FormatPlayer( ply ), GAS.Logging:Highlight( GlorifiedBanking.FormatMoney( withdrawalAmount ) ) ) 12 | end ) 13 | 14 | GAS.Logging:AddModule( WITHDRAWAL_MODULE ) 15 | 16 | local DEPOSIT_MODULE = GAS.Logging:MODULE() 17 | 18 | DEPOSIT_MODULE.Category = "GlorifiedBanking" 19 | DEPOSIT_MODULE.Name = "Deposits" 20 | DEPOSIT_MODULE.Colour = Color( 255, 0, 0 ) 21 | 22 | DEPOSIT_MODULE:Hook( "GlorifiedBanking.PlayerDeposit", "deposit", function( ply, depositAmount ) 23 | DEPOSIT_MODULE:Log( "{1} deposited {2}.", GAS.Logging:FormatPlayer( ply ), GAS.Logging:Highlight( GlorifiedBanking.FormatMoney( depositAmount ) ) ) 24 | end ) 25 | 26 | GAS.Logging:AddModule( DEPOSIT_MODULE ) 27 | 28 | local TRANSFER_MODULE = GAS.Logging:MODULE() 29 | 30 | TRANSFER_MODULE.Category = "GlorifiedBanking" 31 | TRANSFER_MODULE.Name = "Transfers" 32 | TRANSFER_MODULE.Colour = Color( 0, 0, 255 ) 33 | 34 | TRANSFER_MODULE:Hook( "GlorifiedBanking.PlayerTransfer", "transfer", function( ply, receiver, transferAmount ) 35 | TRANSFER_MODULE:Log( "{1} transferred {2} to {3}.", GAS.Logging:FormatPlayer( ply ), GAS.Logging:FormatPlayer( receiver ), GAS.Logging:Highlight( GlorifiedBanking.FormatMoney( transferAmount ) ) ) 36 | end ) 37 | 38 | GAS.Logging:AddModule( TRANSFER_MODULE ) -------------------------------------------------------------------------------- /lua/entities/glorifiedbanking_atm/shared.lua: -------------------------------------------------------------------------------- 1 | 2 | ENT.Type = "anim" 3 | ENT.Base = "base_gmodentity" 4 | ENT.PrintName = "Glorified ATM" 5 | ENT.Category = "GlorifiedBanking" 6 | ENT.Author = "Tom.bat" 7 | ENT.Spawnable = true 8 | ENT.AdminOnly = true 9 | 10 | --Set up the network vars 11 | function ENT:SetupDataTables() 12 | self:NetworkVar("Int", 0, "ScreenID") 13 | self:NetworkVar("Int", 1, "WithdrawalFee") 14 | self:NetworkVar("Int", 2, "DepositFee") 15 | self:NetworkVar("Int", 3, "TransferFee") 16 | self:NetworkVar("String", 0, "SignText") 17 | self:NetworkVar("Entity", 0, "CurrentUser") 18 | 19 | if SERVER then 20 | self:SetScreenID(1) 21 | self:SetCurrentUser(NULL) 22 | self:SetWithdrawalFee(0) 23 | self:SetDepositFee(0) 24 | self:SetTransferFee(0) 25 | self:SetSignText("ATM") 26 | else 27 | self:NetworkVarNotify("ScreenID", self.OnScreenChange) 28 | end 29 | end 30 | 31 | --Define all of our possible screens 32 | ENT.Screens = { 33 | [1] = { --Idle screen 34 | hideCursor = true 35 | }, 36 | [2] = { --Lockdown screen 37 | hideCursor = true 38 | }, 39 | [3] = { --Main Menu 40 | loggedIn = true 41 | }, 42 | [4] = { --Withdrawal screen 43 | loggedIn = true, 44 | previousPage = 3, 45 | takesKeyInput = true 46 | }, 47 | [5] = { --Deposit screen 48 | loggedIn = true, 49 | previousPage = 3, 50 | takesKeyInput = true 51 | }, 52 | [6] = { --Transfer screen 53 | loggedIn = true, 54 | previousPage = 3, 55 | takesKeyInput = true 56 | }, 57 | [7] = { --Transactions screen 58 | loggedIn = true, 59 | previousPage = 3, 60 | takesKeyInput = true 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/sh_glorifiedbanking_config.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ Addon Integrations ]]-- 3 | GlorifiedBanking.Config.SUPPORT_ZEROS_ADDONS = false -- If you have any of Zero's addons on your server, you can choose for your income to go to your bank with this option. 4 | GlorifiedBanking.Config.SUPPORT_BLOGS = false -- Set this to true if you'd like to log withdrawals, deposits and transfers via bLogs. 5 | GlorifiedBanking.Config.SUPPORT_GSMARTWATCH = false -- Set this to true if you'd like to allow payment via smart watch. 6 | --[[ End Addon Integrations ]]-- 7 | 8 | --[[ Interest Settings ]]-- 9 | GlorifiedBanking.Config.INTEREST_ENABLED = true -- Should interest be enabled or not? 10 | GlorifiedBanking.Config.INTEREST_TIMER = 120 -- How often should the player receive interest? This amount is in seconds. 11 | GlorifiedBanking.Config.INTEREST_MAX = 10000 -- What's the maximum amount a player can receive in interest? 12 | GlorifiedBanking.Config.DEFAULT_INTEREST_PERCENTAGE = 0.1 -- What % should the player get for interest per x seconds? Set to 0 to disable interest for normal players. 13 | GlorifiedBanking.Config.INTEREST_AMOUNT_CUSTOMFUNC = function( ply ) -- Special function to return different interest for certain players. 14 | local specialGroups = { 15 | ["donator"] = 0.2, 16 | ["superadmin"] = 1 17 | } 18 | if specialGroups[ply:GetUserGroup()] then return specialGroups[ply:GetUserGroup()] end 19 | end 20 | --[[ End Interest Settings ]]-- 21 | 22 | --[[ Other Config ]]-- 23 | GlorifiedBanking.Config.CARD_PAYMENT_FEE = 0 --Percentage fee (0-100) taken from transactions done via card readers. 24 | GlorifiedBanking.Config.MAXIMUM_DISTANCE_FROM_ATM = 250 -- What is the maximum distance for the validation checks on the ATMs? 25 | --[[ End Other Config ]]-- 26 | -------------------------------------------------------------------------------- /lua/entities/glorifiedbanking_cardreader_controller.lua: -------------------------------------------------------------------------------- 1 | 2 | if not WireLib then return end 3 | 4 | AddCSLuaFile() 5 | 6 | DEFINE_BASECLASS( "base_wire_entity" ) 7 | 8 | ENT.PrintName = "Glorified Card Reader Controller" 9 | ENT.WireDebugName = "Glorified Card Reader Controller" 10 | 11 | if CLIENT then return end 12 | 13 | function ENT:Initialize() 14 | self:PhysicsInit(SOLID_VPHYSICS) 15 | self:SetMoveType(MOVETYPE_VPHYSICS) 16 | self:SetSolid(SOLID_VPHYSICS) 17 | self:SetUseType(SIMPLE_USE) 18 | 19 | self.Inputs = WireLib.CreateInputs(self, {}) 20 | self.Outputs = WireLib.CreateOutputs(self, {"Sender [ENTITY]", "Merchant [ENTITY]", "Amount"}) 21 | 22 | self.WInputs = {} 23 | end 24 | 25 | function ENT:LinkEnt(CardReader) 26 | if not IsValid(CardReader) or CardReader:GetClass() != "glorifiedbanking_cardreader" then 27 | return false, GlorifiedBanking.i18n.GetPhrase("gbOnlyLinkReaders") 28 | end 29 | 30 | CardReader.OnTransfer = function(s, sender, merchant, amount) 31 | WireLib.TriggerOutput(self, "Sender", sender) 32 | WireLib.TriggerOutput(self, "Merchant", merchant) 33 | WireLib.TriggerOutput(self, "Amount", amount) 34 | end 35 | 36 | self:SetReader(CardReader) 37 | WireLib.SendMarks(self, {CardReader}) 38 | 39 | return true 40 | end 41 | function ENT:UnlinkEnt() 42 | if IsValid(self.CardReader) then 43 | self.CardReader.OnTransfer = function(s, sender, merchant, amount) end 44 | end 45 | 46 | self.CardReader = nil 47 | 48 | WireLib.SendMarks(self, {}) 49 | 50 | return true 51 | end 52 | 53 | function ENT:SetReader(CardReader) 54 | if not IsValid(CardReader) or CardReader:GetClass() != "glorifiedbanking_cardreader" then return false end 55 | 56 | self.CardReader = CardReader 57 | 58 | return true 59 | end 60 | 61 | duplicator.RegisterEntityClass("glorifiedbanking_cardreader_controller", WireLib.MakeWireEnt, "Data") 62 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_carddesigner.lua: -------------------------------------------------------------------------------- 1 | 2 | local defaultDesign = { 3 | imgur = "Filf1VB", 4 | namePos = { .042, .73 }, 5 | nameAlign = TEXT_ALIGN_LEFT, 6 | idPos = { .042, .85 }, 7 | idAlign = TEXT_ALIGN_LEFT 8 | } 9 | 10 | local cardDesign 11 | 12 | function GlorifiedBanking.GetCardDesign() 13 | return cardDesign 14 | end 15 | 16 | function GlorifiedBanking.SetCardDesign( imgurId, idX, idY, idAlign, nameX, nameY, nameAlign ) 17 | cardDesign = { 18 | imgur = imgurId, 19 | idPos = {idX, idY}, 20 | idAlign = idAlign, 21 | namePos = {nameX, nameY}, 22 | nameAlign = nameAlign 23 | } 24 | 25 | cookie.Set( "GlorifiedBanking.CardDesign", util.TableToJSON( cardDesign ) ) 26 | end 27 | 28 | function GlorifiedBanking.SendCardDesign( recipients ) 29 | net.Start( "GlorifiedBanking.CardDesigner.SendDesignInfo" ) 30 | net.WriteString( cardDesign.imgur ) 31 | net.WriteFloat( cardDesign.idPos[1] ) 32 | net.WriteFloat( cardDesign.idPos[2] ) 33 | net.WriteUInt( cardDesign.idAlign, 2) 34 | net.WriteFloat( cardDesign.namePos[1] ) 35 | net.WriteFloat( cardDesign.namePos[2] ) 36 | net.WriteUInt( cardDesign.nameAlign, 2 ) 37 | net.Send( recipients ) 38 | end 39 | 40 | hook.Add( "PlayerInitialSpawn", "GlorifiedBanking.CardDesigner.PlayerInitialSpawn", function( ply ) 41 | hook.Add( "SetupMove", "GlorifiedBanking.CardDesigner.FullLoad." .. ply:UserID(), function( ply2, _, cmd ) 42 | if ply != ply2 or cmd:IsForced() then return end 43 | GlorifiedBanking.SendCardDesign( ply ) 44 | hook.Remove( "SetupMove", "GlorifiedBanking.CardDesigner.FullLoad." .. ply:UserID() ) 45 | end ) 46 | end ) 47 | 48 | hook.Add( "PlayerDisconnected", "GlorifiedBanking.CardDesigner.PlayerDisconnected", function( ply ) 49 | hook.Remove( "SetupMove", "GlorifiedBanking.CardDesigner.FullLoad." .. ply:UserID() ) 50 | end ) 51 | 52 | cardDesign = util.JSONToTable(cookie.GetString( "GlorifiedBanking.CardDesign", "" )) or table.Copy(defaultDesign) 53 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/cl_glorifiedbanking_uilib.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.UI = GlorifiedBanking.UI or {} 3 | 4 | local lerp = Lerp 5 | function GlorifiedBanking.UI.LerpColor( t, from, to ) 6 | local col = Color( 0, 0, 0 ) 7 | 8 | col.r = lerp( t, from.r, to.r ) 9 | col.g = lerp( t, from.g, to.g ) 10 | col.b = lerp( t, from.b, to.b ) 11 | col.a = lerp( t, from.a, to.a ) 12 | 13 | return col 14 | end 15 | 16 | function GlorifiedBanking.UI.StartCutOut(areaDraw) 17 | render.ClearStencil() 18 | render.SetStencilEnable(true) 19 | render.SetStencilCompareFunction(STENCIL_ALWAYS) 20 | render.SetStencilPassOperation(STENCIL_REPLACE) 21 | render.SetStencilFailOperation(STENCIL_KEEP) 22 | render.SetStencilZFailOperation(STENCIL_KEEP) 23 | 24 | render.SetStencilWriteMask(1) 25 | render.SetStencilTestMask(1) 26 | render.SetStencilReferenceValue(1) 27 | 28 | render.OverrideColorWriteEnable(true, false) 29 | 30 | areaDraw() 31 | 32 | render.OverrideColorWriteEnable(false, false) 33 | 34 | render.SetStencilCompareFunction(STENCIL_EQUAL) 35 | end 36 | 37 | function GlorifiedBanking.UI.EndCutOut() 38 | render.SetStencilEnable(false) 39 | end 40 | 41 | file.CreateDir("glorifiedbanking") 42 | function GlorifiedBanking.UI.GetImgur(id, callback, useproxy) 43 | if file.Exists("glorifiedbanking/" .. id .. ".png", "DATA") then 44 | return callback(Material("../data/glorifiedbanking/" .. id .. ".png", "noclamp smooth")) 45 | end 46 | 47 | http.Fetch(useproxy and "https://proxy.duckduckgo.com/iu/?u=https://i.imgur.com" or "https://i.imgur.com/" .. id .. ".png", 48 | function(body, len, headers, code) 49 | file.Write("glorifiedbanking/" .. id .. ".png", body) 50 | return callback(Material("../data/glorifiedbanking/" .. id .. ".png", "noclamp smooth")) 51 | end, 52 | function(error) 53 | if useproxy then return callback(Material("nil")) end 54 | return GlorifiedBanking.UI.GetImgur(id, callback, true) 55 | end 56 | ) 57 | end 58 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_interest.lua: -------------------------------------------------------------------------------- 1 | 2 | if not GlorifiedBanking.Config.INTEREST_ENABLED then return end 3 | 4 | -- Make this a function in the GlorifiedBanking table so it can be easily accessed for display purposes, for example. 5 | function GlorifiedBanking.GetPlayerInterestAmount( ply ) 6 | local customFunc = GlorifiedBanking.Config.INTEREST_AMOUNT_CUSTOMFUNC 7 | local percentage = GlorifiedBanking.Config.DEFAULT_INTEREST_PERCENTAGE 8 | if customFunc then 9 | local customFuncReturn = customFunc( ply ) 10 | if customFuncReturn and customFuncReturn != nil and customFuncReturn != 0 then 11 | percentage = customFuncReturn 12 | end 13 | end 14 | return math.Round( ( GlorifiedBanking.GetPlayerBalance( ply ) / 100 ) * percentage ) 15 | end 16 | 17 | function GlorifiedBanking.ApplyPlayerInterest( ply ) 18 | local interestAmount = GlorifiedBanking.GetPlayerInterestAmount( ply ) -- Fetch the player's interest amount from the above function. 19 | if interestAmount <= 0 or not ply:IsValid() or not ply:IsPlayer() or ply:IsBot() then return end -- A few validation checks. 20 | interestAmount = math.Clamp( interestAmount, 0, GlorifiedBanking.Config.INTEREST_MAX ) -- Clamp to make sure it doesn't go below zero and doesn't go above the maximum interest amount. 21 | GlorifiedBanking.AddPlayerBalance( ply, interestAmount ) -- Add the actual interest amount to the player's balance. 22 | GlorifiedBanking.Notify( ply, NOTIFY_GENERIC, 5, GlorifiedBanking.i18n.GetPhrase( "gbInterestReceived", GlorifiedBanking.FormatMoney( interestAmount ) ) ) -- Notify the player that they have received their interest. 23 | hook.Run( "GlorifiedBanking.PlayerInterestReceived", ply, interestAmount ) -- Calls upon interest received with the args ( ply, interestAmount ). 24 | end 25 | 26 | hook.Add( "InitPostEntity", "GlorifiedBanking.Interest.InitPostEntity", function() 27 | timer.Create( "GlorifiedBanking.InterestTimer", GlorifiedBanking.Config.INTEREST_TIMER, 0, function() 28 | for k, v in pairs( player.GetAll() ) do 29 | GlorifiedBanking.ApplyPlayerInterest( v ) 30 | end 31 | end ) 32 | end ) 33 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/sh_glorifiedbanking_i18n.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | GlorifiedPig's Localization & Internationalization Library 4 | © 2020 GlorifiedPig 5 | Please read usage guide @ https://github.com/GlorifiedPig/gmod-i18n 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: {{ user_id | 25 }} 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 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. 9 | ]]-- 10 | 11 | GlorifiedBanking.i18n = {} 12 | 13 | local language = GetConVar( "gmod_language" ) 14 | local registeredPhrases = {} 15 | 16 | function GlorifiedBanking.i18n.RegisterPhrase( languageIdentifier, phraseId, text ) 17 | if not registeredPhrases[languageIdentifier] then registeredPhrases[languageIdentifier] = {} end 18 | registeredPhrases[languageIdentifier][phraseId] = text 19 | end 20 | 21 | function GlorifiedBanking.i18n.RegisterPhrases( languageIdentifier, phraseTbl ) 22 | for k, v in pairs( phraseTbl ) do 23 | GlorifiedBanking.i18n.RegisterPhrase( languageIdentifier, k, v ) 24 | end 25 | end 26 | 27 | function GlorifiedBanking.i18n.GetPhrase( phraseIdentifier, ... ) 28 | local phraseLanguage = registeredPhrases[language:GetString()] or registeredPhrases["en"] 29 | local finalPhrase = registeredPhrases["en"][phraseIdentifier] 30 | if phraseLanguage[phraseIdentifier] then finalPhrase = phraseLanguage[phraseIdentifier] end 31 | 32 | return table.Count( { ... } ) > 0 and string.format( finalPhrase, ... ) or finalPhrase 33 | end 34 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_players.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | net.Start("GlorifiedBanking.AdminPanel.PlayerListOpened") 6 | net.SendToServer() 7 | 8 | self.Theme = self:GetParent().Theme 9 | 10 | self.TopBar = vgui.Create("Panel", self) 11 | self.TopBar.Theme = self:GetParent().Theme 12 | self.TopBar.Paint = function(s, w, h) 13 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbPlayersOnline", #self.Players), "GlorifiedBanking.AdminMenu.TransactionTypeSelect", w * .024, h * .46, self.Theme.Data.Colors.logsMenuTransactionTypeTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 14 | end 15 | 16 | self.ScrollPanel = vgui.Create("GlorifiedBanking.ScrollPanel", self) 17 | 18 | self.Players = {} 19 | end 20 | 21 | function PANEL:AddPlayer(ply, balance) 22 | local playerid = #self.Players + 1 23 | 24 | self.Players[playerid] = vgui.Create("GlorifiedBanking.Player", self.ScrollPanel) 25 | self.Players[playerid].Theme = self.Theme 26 | self.Players[playerid].CanEditPlayers = self.CanEditPlayers 27 | self.Players[playerid]:AddPlayer(ply, balance) 28 | end 29 | 30 | function PANEL:ResetPlayers() 31 | self.ScrollPanel:Clear() 32 | table.Empty(self.Players) 33 | end 34 | 35 | function PANEL:PerformLayout(w, h) 36 | self.TopBar:SetSize(w, h * .05) 37 | self.TopBar:Dock(TOP) 38 | 39 | self.ScrollPanel:Dock(FILL) 40 | self.ScrollPanel:DockMargin(0, 0, 0, h * .02) 41 | self.ScrollPanel:DockPadding(0, 0, w * .013, 0) 42 | 43 | local plyh = h * .08 44 | local plymarginx, plymarginy = w * .026, h * .008 45 | for k,v in ipairs(self.Players) do 46 | v:SetHeight(plyh) 47 | v:Dock(TOP) 48 | v:DockMargin(plymarginx, plymarginy, plymarginx, plymarginy) 49 | end 50 | end 51 | 52 | vgui.Register("GlorifiedBanking.Players", PANEL, "Panel") 53 | 54 | net.Receive("GlorifiedBanking.AdminPanel.PlayerListOpened.SendInfo", function() 55 | local playersBals = net.ReadTableAsString() 56 | if not playersBals then return end 57 | 58 | local panel = GlorifiedBanking.UI.AdminMenu.Page 59 | if not panel.ResetPlayers then return end 60 | 61 | panel:ResetPlayers() 62 | 63 | for k, v in ipairs(player.GetAll()) do 64 | panel:AddPlayer( v, playersBals[v:UserID()] or -1 ) 65 | end 66 | end) 67 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_circleavatar.lua: -------------------------------------------------------------------------------- 1 | local PANEL = {} 2 | 3 | AccessorFunc(PANEL, "m_masksize", "MaskSize", FORCE_NUMBER) 4 | 5 | function PANEL:Init() 6 | self.Avatar = vgui.Create("AvatarImage", self) 7 | self.Avatar:SetPaintedManually(true) 8 | 9 | self:SetMaskSize(1) 10 | 11 | self:SetText("") 12 | end 13 | 14 | function PANEL:DoClick() 15 | if not self.SteamID then return end 16 | 17 | gui.OpenURL("https://steamcommunity.com/profiles/" .. self.SteamID) 18 | end 19 | 20 | function PANEL:PerformLayout() 21 | self.Avatar:SetSize(self:GetWide(), self:GetTall()) 22 | end 23 | 24 | function PANEL:SetPlayer(id, size) 25 | self.Avatar:SetPlayer(id, size) 26 | end 27 | 28 | function PANEL:SetSteamID(steamid, size) 29 | if not isstring(steamid) then return end 30 | 31 | self.SteamID = steamid 32 | self.Avatar:SetSteamID(steamid, size) 33 | end 34 | 35 | function PANEL:Paint(w, h) 36 | render.ClearStencil() 37 | render.SetStencilEnable(true) 38 | render.SetStencilWriteMask(1) 39 | render.SetStencilTestMask(1) 40 | render.SetStencilFailOperation(STENCILOPERATION_REPLACE) 41 | render.SetStencilPassOperation(STENCILOPERATION_ZERO) 42 | render.SetStencilZFailOperation(STENCILOPERATION_ZERO) 43 | render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_NEVER) 44 | render.SetStencilReferenceValue(1) 45 | 46 | local _m = self.m_masksize 47 | local circle, t = {}, 0 48 | 49 | for i = 1, 360 do 50 | t = math.rad(i * 720) / 720 51 | 52 | circle[i] = { 53 | x = w / 2 + math.cos(t) * _m, 54 | y = h / 2 + math.sin(t) * _m 55 | } 56 | end 57 | 58 | draw.NoTexture() 59 | surface.SetDrawColor(color_white) 60 | surface.DrawPoly(circle) 61 | render.SetStencilFailOperation(STENCILOPERATION_ZERO) 62 | render.SetStencilPassOperation(STENCILOPERATION_REPLACE) 63 | render.SetStencilZFailOperation(STENCILOPERATION_ZERO) 64 | render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL) 65 | render.SetStencilReferenceValue(1) 66 | 67 | self.Avatar:SetPaintedManually(false) 68 | self.Avatar:PaintManual() 69 | self.Avatar:SetPaintedManually(true) 70 | 71 | render.SetStencilEnable(false) 72 | render.ClearStencil() 73 | end 74 | 75 | vgui.Register("GlorifiedBanking.CircleAvatar", PANEL, "DButton") 76 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/cl_glorifiedbanking_themes.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.Themes = {} 3 | 4 | local registeredThemes = {} 5 | local defaultTheme = "Dark" 6 | local selectedTheme 7 | 8 | function GlorifiedBanking.Themes.Register( id, name, data ) 9 | if not registeredThemes[id] then 10 | registeredThemes[id] = {} 11 | end 12 | 13 | registeredThemes[id].DisplayName = name 14 | registeredThemes[id].Data = id == defaultTheme and data or table.Merge( GlorifiedBanking.Themes.Get( defaultTheme ).Data, data ) 15 | end 16 | 17 | function GlorifiedBanking.Themes.Get( id ) 18 | return registeredThemes[id] or registeredThemes[defaultTheme] or false 19 | end 20 | 21 | function GlorifiedBanking.Themes.GetCurrent() 22 | return GlorifiedBanking.Themes.Get( selectedTheme ) 23 | end 24 | 25 | function GlorifiedBanking.Themes.GetAll() 26 | return registeredThemes 27 | end 28 | 29 | function GlorifiedBanking.Themes.GetByName( name ) 30 | local returnedTheme = registeredThemes[defaultTheme] 31 | for k, v in pairs( registeredThemes ) do 32 | if v.DisplayName == name then returnedTheme = v break end 33 | end 34 | return returnedTheme 35 | end 36 | 37 | function GlorifiedBanking.Themes.GenerateFonts() 38 | for k, v in pairs( GlorifiedBanking.Themes.GetCurrent().Data.Fonts ) do 39 | if isfunction(v.size) then 40 | v.size = v.size() 41 | end 42 | 43 | surface.CreateFont( "GlorifiedBanking." .. k, v ) 44 | end 45 | end 46 | 47 | function GlorifiedBanking.Themes.Select( id ) 48 | if registeredThemes[id] then 49 | GlorifiedBanking.Themes.GenerateFonts() 50 | 51 | cookie.Set( "GlorifiedBanking.Theme", tostring( id ) ) 52 | selectedTheme = tostring( id ) 53 | 54 | hook.Run( "GlorifiedBanking.ThemeUpdated", GlorifiedBanking.Themes.GetCurrent() ) 55 | end 56 | end 57 | 58 | hook.Add( "OnScreenSizeChanged", "GlorifiedBanking.Themes.OnScreenSizeChanged", function() 59 | GlorifiedBanking.Themes.GenerateFonts() 60 | end ) 61 | 62 | hook.Add("InitPostEntity", "GlorifiedBanking.Themes.InitPostEntity", function() 63 | GlorifiedBanking.Themes.Select( cookie.GetString( "GlorifiedBanking.Theme", defaultTheme ) ) 64 | end ) 65 | 66 | concommand.Add( "glorifiedbanking_theme", function( ply, args ) 67 | if ply != LocalPlayer() then return end 68 | local theme = string.lower( args[1] ) 69 | GlorifiedBanking.Themes.Select( theme ) 70 | end ) -------------------------------------------------------------------------------- /lua/entities/glorifiedbanking_cardreader/init.lua: -------------------------------------------------------------------------------- 1 | 2 | AddCSLuaFile("cl_init.lua") 3 | AddCSLuaFile("shared.lua") 4 | 5 | include("shared.lua") 6 | 7 | function ENT:Initialize() 8 | self:SetModel("models/sterling/glorifiedpig_cardreader.mdl") 9 | self:PhysicsInit(SOLID_VPHYSICS) 10 | self:SetMoveType(MOVETYPE_VPHYSICS) 11 | self:SetSolid(SOLID_VPHYSICS) 12 | self:SetUseType(SIMPLE_USE) 13 | 14 | local physObj = self:GetPhysicsObject() 15 | if (physObj:IsValid()) then 16 | physObj:Wake() 17 | end 18 | end 19 | 20 | --Merchant setter, use in a hook when buying entities if the merchant isn't setting 21 | function ENT:SetMerchant(ply) 22 | return GlorifiedBanking.SetEntOwner(self, ply) 23 | end 24 | 25 | --OnTransfer can be overriden to get data about transfers when complete 26 | function ENT:OnTransfer(sender, merchant, amount) end 27 | 28 | --Transfer money method, the main function of the card reader 29 | function ENT:Transfer(sender) 30 | local merchant = self:GetMerchant() 31 | if not IsValid(merchant) then return end 32 | if sender == merchant then return end 33 | 34 | local amount = self:GetTransactionAmount(0) 35 | if amount <= 0 then 36 | GlorifiedBanking.Notify(sender, NOTIFY_ERROR, 5, GlorifiedBanking.i18n.GetPhrase("gbInvalidAmount")) 37 | return 38 | end 39 | 40 | local fee = math.Clamp(math.floor(amount / 100 * GlorifiedBanking.Config.CARD_PAYMENT_FEE), 0, amount) 41 | 42 | if not GlorifiedBanking.CanPlayerAfford(sender, amount) then 43 | GlorifiedBanking.Notify(sender, NOTIFY_ERROR, 5, GlorifiedBanking.i18n.GetPhrase("gbCannotAfford")) 44 | return 45 | end 46 | 47 | GlorifiedBanking.RemovePlayerBalance(sender, fee) 48 | hook.Run("GlorifiedBanking.FeeTaken", sender, fee) 49 | 50 | self:SetScreenID(4) 51 | 52 | timer.Simple(3, function() --Wait while we contact the server 53 | GlorifiedBanking.TransferAmount(sender, merchant, amount) 54 | 55 | if not IsValid(self) then return end 56 | 57 | self:SetTransactionAmount(0) 58 | self:SetScreenID(1) 59 | 60 | self:OnTransfer(sender, merchant, amount) 61 | 62 | GlorifiedBanking.Notify(sender, NOTIFY_GENERIC, 5, GlorifiedBanking.i18n.GetPhrase("gbPaidByCard", merchant:Name(), GlorifiedBanking.FormatMoney(amount))) 63 | GlorifiedBanking.Notify(merchant, NOTIFY_GENERIC, 5, GlorifiedBanking.i18n.GetPhrase("gbPaidByCardReceive", sender:Name(), GlorifiedBanking.FormatMoney(amount))) 64 | end) 65 | end 66 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_logging.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.SQL.Query( "CREATE TABLE IF NOT EXISTS `gb_logs` ( `Date` INT(32) NOT NULL , `Type` VARCHAR(16) NOT NULL , `SteamID` VARCHAR(32) NOT NULL , `ReceiverSteamID` VARCHAR(32) , `Amount` BIGINT(64) NOT NULL )" ) 3 | 4 | GlorifiedBanking.Logs = GlorifiedBanking.Logs or {} 5 | 6 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_logs`", function( queryResult ) if queryResult then GlorifiedBanking.Logs = queryResult end end ) 7 | 8 | function GlorifiedBanking.LogWithdrawal( ply, withdrawAmount ) 9 | GlorifiedBanking.SQL.Query( "INSERT INTO `gb_logs`( `Date`, `Type`, `SteamID`, `Amount` ) VALUES ( " .. os.time() .. ", 'Withdrawal', '" .. ply:SteamID64() .. "', " .. withdrawAmount .. " )" ) 10 | table.insert( GlorifiedBanking.Logs, { 11 | ["Date"] = os.time(), 12 | ["Type"] = "Withdrawal", 13 | ["SteamID"] = ply:SteamID64(), 14 | ["Amount"] = withdrawAmount 15 | } ) 16 | end 17 | 18 | function GlorifiedBanking.LogDeposit( ply, depositAmount ) 19 | GlorifiedBanking.SQL.Query( "INSERT INTO `gb_logs`( `Date`, `Type`, `SteamID`, `Amount` ) VALUES ( " .. os.time() .. ", 'Deposit', '" .. ply:SteamID64() .. "', " .. depositAmount .. " )" ) 20 | table.insert( GlorifiedBanking.Logs, { 21 | ["Date"] = os.time(), 22 | ["Type"] = "Deposit", 23 | ["SteamID"] = ply:SteamID64(), 24 | ["Amount"] = depositAmount 25 | } ) 26 | end 27 | 28 | function GlorifiedBanking.LogTransfer( ply, receiver, transferAmount ) 29 | GlorifiedBanking.SQL.Query( "INSERT INTO `gb_logs`( `Date`, `Type`, `SteamID`, `ReceiverSteamID`, `Amount` ) VALUES ( " .. os.time() .. ", 'Transfer', '" .. ply:SteamID64() .. "', '" .. receiver:SteamID64() .. "', " .. transferAmount .. " )" ) 30 | table.insert( GlorifiedBanking.Logs, { 31 | ["Date"] = os.time(), 32 | ["Type"] = "Transfer", 33 | ["SteamID"] = ply:SteamID64(), 34 | ["ReceiverSteamID"] = receiver:SteamID64(), 35 | ["Amount"] = transferAmount 36 | } ) 37 | end 38 | 39 | util.AddNetworkString( "GlorifiedBanking.PlayerOpenedLogs" ) 40 | concommand.Add( "glorifiedbanking_logs", function( ply ) 41 | if ply:IsSuperAdmin() or CAMI.PlayerHasAccess( "glorifiedbanking_openlogs" ) then 42 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_logs` LIMIT 750", function( queryResult ) 43 | net.Start( "GlorifiedBanking.PlayerOpenedLogs" ) 44 | net.WriteTableAsString( queryResult ) 45 | net.Send( ply ) 46 | end ) 47 | end 48 | end ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/sv_glorifiedbanking_sql.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.SQL = {} 3 | if GlorifiedBanking.Config.SQL_TYPE == "mysqloo" then 4 | require( "mysqloo" ) 5 | 6 | if mysqloo then 7 | local connectionDetails = GlorifiedBanking.Config.SQL_DETAILS 8 | GlorifiedBanking.SQL.Database = mysqloo.connect( connectionDetails[ "host" ], connectionDetails[ "user" ], connectionDetails[ "pass" ], connectionDetails[ "database" ], connectionDetails[ "port" ] ) 9 | function GlorifiedBanking.SQL.Database:onConnected() print( "[GlorifiedBanking] MySQL database connected, MySQLOO version " .. mysqloo.VERSION .. "." ) end 10 | function GlorifiedBanking.SQL.Database:onConnectionFailed( error ) print( "[GlorifiedBanking] MySQL database connection failed:\n" .. error ) end 11 | GlorifiedBanking.SQL.Database:connect() 12 | end 13 | end 14 | 15 | function GlorifiedBanking.SQL.GetType() 16 | if mysqloo and GlorifiedBanking.Config.SQL_TYPE == "mysqloo" then return "mysqloo" end return "sqlite" 17 | end 18 | 19 | function GlorifiedBanking.SQL.EscapeString( string ) 20 | if GlorifiedBanking.SQL.Database then 21 | return GlorifiedBanking.SQL.Database:escape( string ) 22 | else 23 | return sql.SQLStr( string, true ) 24 | end 25 | end 26 | 27 | GlorifiedBanking.SQL.CachedErrors = {} 28 | function GlorifiedBanking.SQL.ThrowError( error ) 29 | print( "[GlorifiedBanking] An error occurred while trying to perform an SQL query:\n" .. error .. "\n" ) 30 | table.insert( GlorifiedBanking.SQL.CachedErrors, error ) 31 | end 32 | 33 | function GlorifiedBanking.SQL.Query( sqlQuery, successFunc ) 34 | if GlorifiedBanking.SQL.GetType() == "mysqloo" then 35 | local query = GlorifiedBanking.SQL.Database:query( sqlQuery ) 36 | if successFunc then 37 | function query:onSuccess( queryData ) 38 | successFunc( queryData ) 39 | end 40 | end 41 | function query:onError( error ) GlorifiedBanking.SQL.ThrowError( error ) end 42 | query:start() 43 | else 44 | local queryData = sql.Query( sqlQuery ) 45 | if queryData == false then 46 | if sql.LastError() then 47 | GlorifiedBanking.SQL.ThrowError( sql.LastError() ) 48 | end 49 | return 50 | end 51 | if successFunc then successFunc( queryData ) end 52 | end 53 | end 54 | 55 | concommand.Add( "glorifiedbanking_printsqlerrors", function( ply ) 56 | if ply == NULL or ply:IsSuperAdmin() then 57 | PrintTable( GlorifiedBanking.SQL.CachedErrors ) 58 | end 59 | end ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_adminmenu.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self:SetSize(ScrH() * .746, ScrH() * .8) 6 | self:Center() 7 | self:MakePopup() 8 | 9 | self.Theme = GlorifiedBanking.Themes.GetCurrent() 10 | 11 | self.Navbar = vgui.Create("GlorifiedBanking.AdminNavbar", self) 12 | 13 | local function changePage(page) 14 | if not IsValid(self.Page) then 15 | self.Page = vgui.Create(page, self) 16 | self.Page:Dock(FILL) 17 | self.Page.CanEditPlayers = self.CanEditPlayers 18 | 19 | return 20 | end 21 | 22 | self.Page:AlphaTo(0, 0.15, 0, function(anim, panel) 23 | self.Page:Remove() 24 | 25 | self.Page = vgui.Create(page, self) 26 | self.Page:Dock(FILL) 27 | self.Page:SetAlpha(0) 28 | self.Page:AlphaTo(255, 0.15) 29 | self.Page.CanEditPlayers = self.CanEditPlayers 30 | end) 31 | end 32 | 33 | self.Navbar:AddItem(GlorifiedBanking.i18n.GetPhrase("gbAdminMenuPlayers"), LEFT, function(s) changePage("GlorifiedBanking.Players") end) 34 | self.Navbar:AddItem(GlorifiedBanking.i18n.GetPhrase("gbAdminMenuLogs"), LEFT, function(s) changePage("GlorifiedBanking.Logs") end) 35 | 36 | self.Navbar:AddItem("LOCK", LEFT, function(s) 37 | self.LockdownMode = not self.LockdownMode 38 | 39 | net.Start("GlorifiedBanking.AdminPanel.SetLockdownStatus") 40 | net.WriteBool(self.LockdownMode) 41 | net.SendToServer() 42 | end) 43 | 44 | self.Navbar:AddItem("X", RIGHT, function(s) 45 | self:AlphaTo(0, 0.3, 0, function(anim, panel) 46 | panel:Remove() 47 | end) 48 | end) 49 | 50 | self.Navbar:SelectTab(1) 51 | timer.Simple(0, function() 52 | changePage("GlorifiedBanking.Players") 53 | end) 54 | 55 | self:SetAlpha(0) 56 | self:AlphaTo(255, 0.3) 57 | end 58 | 59 | function PANEL:PerformLayout(w, h) 60 | self.Navbar:Dock(TOP) 61 | self.Navbar:SetSize(w, h * .06) 62 | 63 | if IsValid(self.Page) then 64 | self.Page:Dock(FILL) 65 | end 66 | end 67 | 68 | function PANEL:Paint(w, h) 69 | draw.RoundedBox(6, 0, 0, w, h, self.Theme.Data.Colors.adminMenuBackgroundCol) 70 | end 71 | 72 | vgui.Register("GlorifiedBanking.AdminMenu", PANEL, "EditablePanel") 73 | 74 | function GlorifiedBanking.UI.OpenAdminMenu(lockdownEnabled, canEditPlayers) 75 | if not IsValid(LocalPlayer()) then return end 76 | 77 | if IsValid(GlorifiedBanking.UI.AdminMenu) then 78 | GlorifiedBanking.UI.AdminMenu:Remove() 79 | GlorifiedBanking.UI.AdminMenu = nil 80 | end 81 | 82 | GlorifiedBanking.UI.AdminMenu = vgui.Create("GlorifiedBanking.AdminMenu") 83 | GlorifiedBanking.UI.AdminMenu.LockdownMode = lockdownEnabled 84 | GlorifiedBanking.UI.AdminMenu.CanEditPlayers = canEditPlayers 85 | end 86 | 87 | net.Receive("GlorifiedBanking.AdminPanel.OpenAdminPanel", function() 88 | GlorifiedBanking.UI.OpenAdminMenu(net.ReadBool(), net.ReadBool()) 89 | end) 90 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_backups.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.LastBackup = cookie.GetNumber( "GlorifiedBanking.LastBackup", os.time() ) 3 | 4 | local function EnsureBackupDirectories() 5 | if not file.Exists( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME, "DATA" ) then 6 | file.CreateDir( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME ) 7 | end 8 | end 9 | 10 | local function DeleteOldBackups() 11 | EnsureBackupDirectories() 12 | local fileTbl = file.Find( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME .. "/*.txt", "DATA", "dateasc" ) 13 | local fileCount = table.Count( fileTbl ) 14 | if fileCount <= GlorifiedBanking.Config.MAX_BACKUPS then return end 15 | local deleteCount = fileCount - GlorifiedBanking.Config.MAX_BACKUPS 16 | for i = 1, deleteCount do 17 | file.Delete( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME .. "/" .. fileTbl[i] ) 18 | end 19 | end 20 | 21 | function GlorifiedBanking.CreateNewBackupFile() 22 | EnsureBackupDirectories() 23 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_players`", function( queryResult ) 24 | if not queryResult then return end 25 | cookie.Set( "GlorifiedBanking.LastBackup", os.time() ) 26 | GlorifiedBanking.LastBackup = os.time() 27 | file.Write( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME .. "/gb_backup_" .. os.time() .. ".txt", util.Compress( util.TableToJSON( queryResult ) ) ) 28 | DeleteOldBackups() 29 | end ) 30 | end 31 | 32 | function GlorifiedBanking.ReadBackupFile( fileTime ) 33 | local readFile = file.Read( GlorifiedBanking.Config.BACKUPS_FOLDER_NAME .. "/gb_backup_" .. fileTime .. ".txt" ) 34 | if readFile then 35 | readFile = util.Decompress( readFile ) 36 | readFile = util.JSONToTable( readFile ) 37 | end 38 | return readFile 39 | end 40 | 41 | function GlorifiedBanking.LoadBackupFile( fileTime ) 42 | local readFile = GlorifiedBanking.ReadBackupFile( fileTime ) 43 | if readFile then 44 | GlorifiedBanking.SQL.Query( "DELETE FROM `gb_players`", function() 45 | for k, v in pairs( readFile ) do 46 | GlorifiedBanking.SQL.Query( "INSERT INTO `gb_players`( `SteamID`, `Balance` ) VALUES ( '" .. v["SteamID"] .. "', " .. v["Balance"] .. " ) ") 47 | end 48 | print( "[GlorifiedBanking] Loaded backup number " .. fileTime .. "." ) 49 | end ) 50 | end 51 | end 52 | 53 | hook.Add( "InitPostEntity", "GlorifiedBanking.Backups.InitPostEntity", function() 54 | timer.Create( "GlorifiedBanking.BackupEnsureTimer", 60, 0, function() 55 | -- Multiply by 3600 so that we can convert hours to seconds. 56 | if os.time() >= GlorifiedBanking.LastBackup + ( GlorifiedBanking.Config.BACKUP_FREQUENCY * 3600 ) then 57 | GlorifiedBanking.CreateNewBackupFile() 58 | end 59 | end ) 60 | end ) 61 | 62 | concommand.Add( "glorifiedbanking_restorebackup", function( ply, args ) 63 | if ply == NULL or GlorifiedBanking.HasPermission( ply, "glorifiedbanking_restorebackups" ) then 64 | GlorifiedBanking.LoadBackupFile( args[1] ) 65 | end 66 | end ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/sv_glorifiedbanking_config.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ SQL Configuration ]]-- 3 | GlorifiedBanking.Config.SQL_TYPE = "sqlite" -- 'sqlite' or 'mysqloo' 4 | GlorifiedBanking.Config.SQL_DETAILS = { 5 | [ "host" ] = "localhost", 6 | [ "user" ] = "root", 7 | [ "pass" ] = "", 8 | [ "database" ] = "glorifiedbanking", 9 | [ "port" ] = 3306 10 | } 11 | --[[ End SQL Configuration ]]-- 12 | 13 | --[[ Backup System Configuration ]]-- 14 | GlorifiedBanking.Config.BACKUPS_ENABLED = true -- Should the backup system be enabled? 15 | GlorifiedBanking.Config.BACKUP_FREQUENCY = 12 -- How often should backups occur in hours? 16 | GlorifiedBanking.Config.MAX_BACKUPS = 10 -- What are the maximum amount of backups allowed before old ones start getting deleted? 17 | GlorifiedBanking.Config.BACKUPS_FOLDER_NAME = "glorifiedbanking_backups" -- What should the file name in the data folder be? 18 | --[[ End Backup System Configuration ]]-- 19 | 20 | --[[ Other Options ]]-- 21 | GlorifiedBanking.Config.USE_FASTDL = false --Should we use FastDL or WorkshopDL? True for FastDL, false for Workshop 22 | GlorifiedBanking.Config.LAST_ACTION_TIMEOUT = false -- How long should we wait after an action on the ATM before timing out the user? False to disable. 23 | GlorifiedBanking.Config.SALARY_TO_BANK = true -- Should the player's salary get transferred to his bank account? 24 | GlorifiedBanking.Config.STARTING_BALANCE = 5000 -- How much money to start with in the player's bank account? 25 | GlorifiedBanking.Config.DROP_MONEY_ON_DEATH = false -- Whether or not money should be dropped on death. 26 | GlorifiedBanking.Config.DROP_MONEY_ON_DEATH_AMOUNT = 500 -- If the above is set to true, how much should the player drop on death? 27 | --[[ End Other Options ]]-- 28 | 29 | --[[ Permissions Settings ]]-- 30 | GlorifiedBanking.Config.CAMI_PERMISSION_DEFAULTS = { 31 | ["glorifiedbanking_openadminpanel"] = { 32 | MinAccess = "admin", 33 | Description = "Determines whether or not the player can open the GlorifiedBanking admin panel." 34 | }, 35 | ["glorifiedbanking_togglelockdown"] = { 36 | MinAccess = "admin", 37 | Description = "Permission for which usergroups are able to enable/disable lockdown mode." 38 | }, 39 | ["glorifiedbanking_restorebackups"] = { 40 | MinAccess = "superadmin", 41 | Description = "Permission for which usergroups are able to restore to a previous backup." 42 | }, 43 | ["glorifiedbanking_placeatms"] = { 44 | MinAccess = "superadmin", 45 | Description = "Permission to place and remove ATMs with the toolgun around the map." 46 | }, 47 | ["glorifiedbanking_setplayerbalance"] = { 48 | MinAccess = "superadmin", 49 | Description = "Permission to set player's balances in the admin panel." 50 | }, 51 | ["glorifiedbanking_changecarddesign"] = { 52 | MinAccess = "superadmin", 53 | Description = "Permission to change the look of the bank card." 54 | } 55 | } 56 | --[[ End Permissions Settings ]]-- 57 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/sql/sv_glorifiedbanking_playersql.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.SQL.Query( "CREATE TABLE IF NOT EXISTS `gb_players`( `SteamID` VARCHAR(32) NOT NULL, `Balance` BIGINT(64) NOT NULL, `LastName` VARCHAR(64) DEFAULT '' , PRIMARY KEY( `SteamID` ) )" ) 3 | 4 | local startingBalance = GlorifiedBanking.Config.STARTING_BALANCE 5 | hook.Add( "PlayerInitialSpawn", "GlorifiedBanking.SQLPlayer.PlayerInitialSpawn", function( ply ) 6 | if ply:IsBot() then return end 7 | if not ply.GlorifiedBanking then ply.GlorifiedBanking = {} end 8 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_players` WHERE `SteamID` = '" .. ply:SteamID64() .. "' LIMIT 1", function( queryResult ) 9 | if queryResult and table.IsEmpty( queryResult ) == false then 10 | ply.GlorifiedBanking.Balance = queryResult[1]["Balance"] 11 | ply:SetNW2String( "GlorifiedBanking.Balance", tostring( queryResult[1]["Balance"] ) ) 12 | GlorifiedBanking.SQL.Query( "UPDATE `gb_players` SET `LastName` = '" .. GlorifiedBanking.SQL.EscapeString( ply:Nick() ) .. "' WHERE `SteamID` = '" .. ply:SteamID64() .. "'" ) 13 | else 14 | ply.GlorifiedBanking.Balance = startingBalance 15 | ply:SetNW2String( "GlorifiedBanking.Balance", tostring( startingBalance ) ) 16 | GlorifiedBanking.SQL.Query( "INSERT INTO `gb_players`( `SteamID`, `Balance`, `LastName` ) VALUES ( '" .. ply:SteamID64() .. "', '" .. startingBalance .. "', '" .. GlorifiedBanking.SQL.EscapeString( ply:Nick() ) .. "' )" ) 17 | end 18 | end ) 19 | end ) 20 | 21 | -- This command is intensive, don't spam it! 22 | concommand.Add( "glorifiedbanking_sqlsidto64", function( ply ) 23 | if ply == NULL or ply:IsSuperAdmin() then 24 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_players` WHERE LEFT( `SteamID`, 5 ) = 'STEAM'", function( queryResult ) 25 | local isSQLite = GlorifiedBanking.SQL.GetType() == "sqlite" 26 | if isSQLite then sql.Begin() end 27 | for k, v in pairs( queryResult ) do 28 | local plySteamID = v["SteamID"] 29 | local plySteamID64 = util.SteamIDTo64( plySteamID ) 30 | GlorifiedBanking.SQL.Query( "SELECT * FROM `gb_players` WHERE `SteamID` = '" .. plySteamID64 .. "'", function( queryResult2 ) 31 | if queryResult2 and table.IsEmpty( queryResult2 ) == false then 32 | GlorifiedBanking.SQL.Query( "UPDATE `gb_players` SET `Balance` = '" .. v["Balance"] .. "' WHERE `SteamID` = '" .. plySteamID64 .. "'" ) 33 | else 34 | GlorifiedBanking.SQL.Query( "UPDATE `gb_players` SET `SteamID` = '" .. plySteamID64 .. "' WHERE `SteamID` = '" .. plySteamID .. "'" ) 35 | end 36 | GlorifiedBanking.SQL.Query( "DELETE FROM `gb_players` WHERE `SteamID` = '" .. plySteamID .. "'" ) 37 | end ) 38 | end 39 | GlorifiedBanking.SQL.Query( "DROP TABLE `gb_logs`" ) 40 | if isSQLite then sql.Commit() end 41 | print( "[GlorifiedBanking] Database structure converted. Please restart your server." ) 42 | end ) 43 | end 44 | end ) 45 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/integrations/sv_glorifiedbanking_bluesatm.lua: -------------------------------------------------------------------------------- 1 | 2 | function GlorifiedBanking.ImportSteamIDFromBluesATM( steamid, balance ) 3 | if steamid == "BOT" then return end 4 | GlorifiedBanking.SQL.Query( "REPLACE INTO `gb_players`( `SteamID`, `Balance` ) VALUES ( '" .. steamid .. "', '" .. balance .. "' )", function() 5 | local ply = player.GetBySteamID( steamid ) 6 | 7 | if ply and ply:IsPlayer() then 8 | ply.GlorifiedBanking.Balance = balance 9 | ply:SetNW2String( "GlorifiedBanking.Balance", tostring( balance ) ) 10 | end 11 | end ) 12 | end 13 | 14 | concommand.Add( "glorifiedbanking_importbluesdata", function( ply ) 15 | if ply == NULL or ply:IsSuperAdmin() and BATM then 16 | if BATM.Config.UseMySQL == false then 17 | if sql.TableExists( "batm_personal_accounts" ) then 18 | local accountDataTbl = sql.Query( "SELECT * FROM `batm_personal_accounts`" ) 19 | for k, v in ipairs( accountDataTbl ) do 20 | local steamid = v["steamid"] 21 | local balance = util.JSONToTable( v["accountinfo"] )["balance"] 22 | 23 | GlorifiedBanking.ImportSteamIDFromBluesATM( steamid, balance ) 24 | end 25 | print( "[GlorifiedBanking] SQLite data found, conversion success. Please uninstall Blue's ATM and restart your server." ) 26 | else 27 | print( "[GlorifiedBanking] No Blue's ATM data for SQLite found. Conversion failed." ) 28 | end 29 | else 30 | require( "mysqloo" ) 31 | if not mysqloo then print( "[GlorifiedBanking] Failed to load MySQLOO for the Blue's ATM data importer, are you sure it is installed?" ) end 32 | local BATMDB = mysqloo.connect( BATM.Config.MySQLDetails.host, 33 | BATM.Config.MySQLDetails.username, 34 | BATM.Config.MySQLDetails.password, 35 | BATM.Config.MySQLDetails.databasename, 36 | tonumber( BATM.Config.MySQLDetails.port ) ) 37 | 38 | function BATMDB:onConnected() 39 | local query = BATMDB:query( "SELECT * FROM `batm_personal_accounts`" ) 40 | 41 | function query:onSuccess( queryData ) 42 | for k, v in ipairs( queryData ) do 43 | local steamid = v["steamid"] 44 | local balance = util.JSONToTable( v["accountinfo"] )["balance"] 45 | 46 | GlorifiedBanking.ImportSteamIDFromBluesATM( steamid, balance ) 47 | end 48 | print( "[GlorifiedBanking] MySQL data found, conversion success. Please uninstall Blue's ATM and restart your server." ) 49 | end 50 | 51 | function query:onError() 52 | print( "[GlorifiedBanking] Error in MySQL for Blue's ATM data importer. Conversion failed." ) 53 | end 54 | 55 | query:start() 56 | query:wait() 57 | end 58 | BATM:connect() 59 | BATM:wait() 60 | end 61 | else 62 | print( "[GlorifiedBanking] Blue's ATM not found on the server. Conversion failed." ) 63 | end 64 | end ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_settings.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | local logStruct = { 5 | type = "Deposit", 6 | time = "19:05:16", 7 | date = "14/04/2020", 8 | amount = "$10,000,000", 9 | username = "Tom.bat", 10 | steamid = "STEAM_0:0:127595314" 11 | } 12 | 13 | local logStructForTransfers = { 14 | type = "Transfer", 15 | time = "19:05:16", 16 | date = "14/04/2020", 17 | amount = "$10,000,000", 18 | username = "Tom.bat", 19 | steamid = "STEAM_0:0:127595314", 20 | username2 = "GlorifiedPig", 21 | steamid2 = "STEAM_0:0:56521306", 22 | } 23 | 24 | function PANEL:Init() 25 | self.Theme = self:GetParent().Theme 26 | 27 | self.TopBar = vgui.Create("Panel", self) 28 | self.TopBar.Theme = self:GetParent().Theme 29 | self.TopBar.Paint = function(s, w, h) 30 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbTransactionType"), "GlorifiedBanking.AdminMenu.TransactionTypeSelect", w * .024, h * .46, self.Theme.Data.Colors.logsMenuTransactionTypeTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 31 | end 32 | 33 | self.TransactionTypeSelect = vgui.Create("GlorifiedBanking.Dropdown", self.TopBar) 34 | 35 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeAll")) 36 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeWithdrawals")) 37 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeDeposits")) 38 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeTransfers")) 39 | self.TransactionTypeSelect:ChooseOptionID(1) 40 | 41 | self.TransactionTypeSelect.OnSelect = function(s, index, value, data) 42 | s:SizeToContents() 43 | end 44 | 45 | self.ScrollPanel = vgui.Create("GlorifiedBanking.ScrollPanel", self) 46 | 47 | self.Paginator = vgui.Create("GlorifiedBanking.Paginator", self) 48 | self.Paginator:SetupPaginator(100) 49 | 50 | self.Logs = {} 51 | for i = 1, 20 do 52 | self.Logs[i] = vgui.Create("GlorifiedBanking.Log", self.ScrollPanel) 53 | self.Logs[i].Theme = self.Theme 54 | self.Logs[i]:AddData(math.random(1, 2) == 1 and logStruct or logStructForTransfers) 55 | end 56 | end 57 | 58 | function PANEL:PerformLayout(w, h) 59 | self.TopBar:SetSize(w, h * .05) 60 | self.TopBar:Dock(TOP) 61 | 62 | surface.SetFont("GlorifiedBanking.AdminMenu.TransactionTypeSelect") 63 | local dropx = surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbTransactionType")) 64 | 65 | self.TransactionTypeSelect:SetSize(w * .1, h * .032) 66 | self.TransactionTypeSelect:SetPos(w * .024 + dropx + w * .01, h * .011) 67 | self.TransactionTypeSelect:SizeToContents() 68 | 69 | self.ScrollPanel:Dock(FILL) 70 | self.ScrollPanel:DockPadding(0, 0, w * .013, 0) 71 | 72 | if IsValid(self.Paginator) then 73 | self.Paginator:SetSize(w, h * .07) 74 | self.Paginator:Dock(BOTTOM) 75 | end 76 | 77 | local logh = h * .08 78 | local logmarginx, logmarginy = w * .026, h * .008 79 | for k,v in ipairs(self.Logs) do 80 | v:SetHeight(logh) 81 | v:Dock(TOP) 82 | v:DockMargin(logmarginx, logmarginy, logmarginx, logmarginy) 83 | end 84 | end 85 | 86 | vgui.Register("GlorifiedBanking.Settings", PANEL, "Panel") 87 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_adminnavbar.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self.Theme = self:GetParent().Theme 6 | 7 | self.Buttons = {} 8 | self.SelectedTab = 0 9 | end 10 | 11 | function PANEL:PerformLayout(w, h) 12 | surface.SetFont("GlorifiedBanking.AdminMenu.NavbarItem") 13 | 14 | for k,v in ipairs(self.Buttons) do 15 | v:SetSize((v.Text == "X" and w * .055) or (v.Text == "LOCK" and surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbAdminMenuLockdown")) + w * .06) or surface.GetTextSize(v.Text) + w * .06, h) 16 | v:Dock(v.DockType) 17 | end 18 | end 19 | 20 | local lerp = Lerp 21 | 22 | function PANEL:AddItem(name, dockType, onClick) 23 | local button = vgui.Create("DButton", self) 24 | button.Text = name 25 | button.DockType = dockType 26 | 27 | local btnID = #self.Buttons + 1 28 | button.DoClick = function(s) 29 | if self:SelectTab(btnID) then return end 30 | onClick(s) 31 | end 32 | 33 | button:SetText("") 34 | button.Color = self.Theme.Data.Colors.adminMenuNavbarItemCol 35 | 36 | if name == "X" then 37 | button.Paint = function(s, w, h) 38 | local iconSize = h * .4 39 | 40 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, s:IsHovered() and self.Theme.Data.Colors.adminMenuCloseButtonHoverCol or self.Theme.Data.Colors.adminMenuCloseButtonCol) 41 | 42 | surface.SetDrawColor(s.Color) 43 | surface.SetMaterial(self.Theme.Data.Materials.close) 44 | surface.DrawTexturedRect(w / 2 - iconSize / 2, h / 2 - iconSize / 2, iconSize, iconSize) 45 | end 46 | elseif name == "LOCK" then 47 | button.Paint = function(s, w, h) 48 | local lockdown = self:GetParent().LockdownMode 49 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, lockdown and self.Theme.Data.Colors.adminMenuNavbarLockdownCol or self.Theme.Data.Colors.adminMenuNavbarItemCol) 50 | 51 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbAdminMenuLockdown"), "GlorifiedBanking.AdminMenu.NavbarItem", w / 2, h / 2, lockdown and ColorAlpha(s.Color, math.abs(math.sin(CurTime())) * 255) or s.Color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 52 | end 53 | else 54 | button.UnderlineY = 0 55 | 56 | button.Paint = function(s, w, h) 57 | local underlineh = math.Round(h * .06) 58 | 59 | s.UnderlineY = lerp(FrameTime() * 13, s.UnderlineY, (button.Selected or s:IsHovered()) and 0 or underlineh) 60 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, button.Selected and self.Theme.Data.Colors.adminMenuNavbarSelectedItemCol or self.Theme.Data.Colors.adminMenuNavbarItemCol) 61 | 62 | local underliney = math.Round(h - underlineh + s.UnderlineY) 63 | 64 | surface.SetDrawColor(s.Color) 65 | surface.DrawRect(0, underliney, w, underlineh) 66 | 67 | draw.SimpleText(s.Text, "GlorifiedBanking.AdminMenu.NavbarItem", w / 2, underliney / 2, s.Color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 68 | end 69 | end 70 | 71 | self.Buttons[btnID] = button 72 | end 73 | 74 | function PANEL:SelectTab(id) 75 | if self.SelectedTab == id then return true end 76 | if not self.Buttons[id] then return true end 77 | if self.Buttons[id].Text == "LOCK" then return false end 78 | 79 | for k,v in ipairs(self.Buttons) do 80 | v.Selected = k == id 81 | end 82 | 83 | self.SelectedTab = id 84 | end 85 | 86 | function PANEL:Paint(w, h) 87 | draw.RoundedBoxEx(6, 0, 0, w, h, self.Theme.Data.Colors.adminMenuNavbarBackgroundCol, true, true, false, false) 88 | end 89 | 90 | vgui.Register("GlorifiedBanking.AdminNavbar", PANEL, "Panel") 91 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_setbalancepopup.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self:SetSize(ScrH() * .4, ScrH() * .18) 6 | self:Center() 7 | self:MakePopup() 8 | 9 | self.Theme = GlorifiedBanking.Themes.GetCurrent() 10 | 11 | self.Close = vgui.Create("DButton", self) 12 | self.Close:SetText("") 13 | 14 | self.Close.DoClick = function(s) 15 | self:Remove() 16 | end 17 | 18 | self.Close.Color = Color(255, 255, 255) 19 | self.Close.Paint = function(s, w, h) 20 | local iconSize = h * .5 21 | 22 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, s:IsHovered() and self.Theme.Data.Colors.adminMenuCloseButtonHoverCol or self.Theme.Data.Colors.adminMenuCloseButtonCol) 23 | 24 | surface.SetDrawColor(s.Color) 25 | surface.SetMaterial(self.Theme.Data.Materials.close) 26 | surface.DrawTexturedRect(w / 2 - iconSize / 2, h / 2 - iconSize / 2, iconSize, iconSize) 27 | end 28 | 29 | self.Entry = vgui.Create("DTextEntry", self) 30 | self.Entry:SetValue("0") 31 | self.Entry:SetFont("GlorifiedBanking.AdminMenu.SetBalanceEntry") 32 | self.Entry:SetNumeric(true) 33 | 34 | self.Enter = vgui.Create("DButton", self) 35 | self.Enter:SetText("") 36 | 37 | self.Enter.Color = Color(255, 255, 255) 38 | self.Enter.Paint = function(s, w, h) 39 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.setBalanceButtonBackgroundHoverCol or self.Theme.Data.Colors.setBalanceButtonBackgroundCol) 40 | 41 | draw.RoundedBox(h * .1, 0, 0, w, h, s.Color) 42 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbEnter"), "GlorifiedBanking.AdminMenu.SetBalanceButton", w / 2, h * .43, self.Theme.Data.Colors.setBalanceButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 43 | end 44 | 45 | self.Enter.DoClick = function(s) 46 | if not self.SteamID then return end 47 | if tonumber(self.Entry:GetValue()) < 0 then 48 | GlorifiedBanking.Notify(NOTIFY_ERROR, 3, GlorifiedBanking.i18n.GetPhrase("gbCantHaveNegative")) 49 | return 50 | end 51 | 52 | net.Start("GlorifiedBanking.AdminPanel.SetPlayerBalance") 53 | net.WriteString(self.SteamID) 54 | net.WriteDouble(tonumber(self.Entry:GetValue())) 55 | net.SendToServer() 56 | 57 | net.Start("GlorifiedBanking.AdminPanel.PlayerListOpened") 58 | net.SendToServer() 59 | 60 | self:Remove() 61 | end 62 | 63 | timer.Simple(0, function() 64 | if self.Username then return end 65 | steamworks.RequestPlayerInfo(self.SteamID, function(name) 66 | self.Username = name 67 | end) 68 | end) 69 | end 70 | 71 | function PANEL:PerformLayout(w, h) 72 | self.Close:SetSize(h * .18, h * .18) 73 | self.Close:SetPos(w - h * .18, 0) 74 | 75 | self.Entry:SetSize(w * .95, h * .2) 76 | self.Entry:SetPos(w * .025, h * .4) 77 | 78 | self.Enter:SetSize(w * .95, h * .2) 79 | self.Enter:SetPos(w * .025, h * .73) 80 | end 81 | 82 | function PANEL:Think() 83 | self:MoveToFront() 84 | end 85 | 86 | function PANEL:Paint(w, h) 87 | draw.RoundedBox(6, 0, 0, w, h, self.Theme.Data.Colors.adminMenuBackgroundCol) 88 | draw.RoundedBoxEx(6, 0, 0, w, h * .18, self.Theme.Data.Colors.adminMenuNavbarBackgroundCol, true, true) 89 | 90 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbSetBalance"), "GlorifiedBanking.AdminMenu.SetBalanceTitle", w * .021, h * .08, self.Theme.Data.Colors.adminMenuNavbarItemCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 91 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbEnterBalance", self.Username and self.Username or self.SteamID or "undefined"), "GlorifiedBanking.AdminMenu.SetBalanceDescription", w * .021, h * .23, self.Theme.Data.Colors.adminMenuNavbarItemCol) 92 | end 93 | 94 | vgui.Register("GlorifiedBanking.BalancePopup", PANEL, "EditablePanel") 95 | -------------------------------------------------------------------------------- /lua/weapons/glorifiedbanking_card.lua: -------------------------------------------------------------------------------- 1 | 2 | SWEP.PrintName = GlorifiedBanking.i18n.GetPhrase("gbCardName") 3 | SWEP.Category = "GlorifiedBanking" 4 | SWEP.Author = "Tom.bat" 5 | SWEP.Instructions = GlorifiedBanking.i18n.GetPhrase("gbCardInstructions") 6 | 7 | SWEP.Spawnable = true 8 | SWEP.AdminOnly = false 9 | 10 | SWEP.Primary.ClipSize = -1 11 | SWEP.Primary.DefaultClip = -1 12 | SWEP.Primary.Automatic = false 13 | SWEP.Primary.Ammo = "none" 14 | 15 | SWEP.Secondary.ClipSize = -1 16 | SWEP.Secondary.DefaultClip = -1 17 | SWEP.Secondary.Automatic = false 18 | SWEP.Secondary.Ammo = "none" 19 | 20 | SWEP.Weight = 6 21 | SWEP.AutoSwitchTo = true 22 | SWEP.AutoSwitchFrom = false 23 | 24 | SWEP.UseHands = true 25 | SWEP.WorldModel = "" 26 | 27 | function SWEP:Initialize() 28 | self:SetHoldType("normal") 29 | 30 | if SERVER then return end 31 | 32 | local ply = self:GetOwner() 33 | self.CardDisplayName = ply:Name() 34 | 35 | local id = tostring(ply:SteamID64() or "1234123412341234"):sub(-16) 36 | self.CardDisplayID = id:sub(1, 4) 37 | 38 | for i = 4, 15, 4 do 39 | self.CardDisplayID = self.CardDisplayID .. " " .. id:sub(i, i + 3) 40 | end 41 | 42 | self.CardDesign = table.Copy(GlorifiedBanking.CardDesign) 43 | end 44 | 45 | function SWEP:Deploy() 46 | if CLIENT or not IsValid(self:GetOwner()) then return true end 47 | self:GetOwner():DrawWorldModel(false) 48 | return true 49 | end 50 | 51 | function SWEP:SecondaryAttack() end 52 | 53 | if SERVER then 54 | function SWEP:PrimaryAttack() 55 | if not game.SinglePlayer() then return end 56 | self:CallOnClient("PrimaryAttack") 57 | end 58 | end 59 | 60 | if SERVER then return end 61 | 62 | SWEP.Slot = 1 63 | SWEP.SlotPos = 2 64 | SWEP.DrawAmmo = false 65 | SWEP.DrawCrosshair = false 66 | 67 | SWEP.BounceWeaponIcon = false 68 | 69 | local theme = GlorifiedBanking.Themes.GetCurrent() 70 | hook.Add("GlorifiedBanking.ThemeUpdated", "GlorifiedBanking.CardSWEP.ThemeUpdated", function(newTheme) 71 | theme = newTheme 72 | end) 73 | 74 | function SWEP:DrawHUDBackground() 75 | local scrw, scrh = ScrW(), ScrH() 76 | local scale = scrh / 1080 77 | local pad = scale * 30 78 | local cardw, cardh = scale * 420, scale * 240 79 | local cardx = scrw - pad - cardw 80 | 81 | surface.SetDrawColor(color_white) 82 | surface.SetMaterial(GlorifiedBanking.CardMaterial) 83 | surface.DrawTexturedRect(cardx, scrh - pad - cardh, cardw, cardh) 84 | 85 | draw.SimpleText(self.CardDisplayID, "GlorifiedBanking.CardSWEP.Info", cardx + cardw * self.CardDesign.idPos[1], scrh - pad - cardh + cardh * self.CardDesign.idPos[2], theme.Data.Colors.cardNumberTextCol, self.CardDesign.idAlign) 86 | draw.SimpleText(self.CardDisplayName, "GlorifiedBanking.CardSWEP.Info", cardx + cardw * self.CardDesign.namePos[1], scrh - pad - cardh + cardh * self.CardDesign.namePos[2], theme.Data.Colors.cardNameTextCol, self.CardDesign.nameAlign) 87 | end 88 | 89 | function SWEP:PrimaryAttack() 90 | if not game.SinglePlayer() and not IsFirstTimePredicted() then return end 91 | 92 | local ply = self:GetOwner() 93 | 94 | local tr = ply:GetEyeTraceNoCursor() 95 | if not tr.Hit then return end 96 | 97 | local maxDist = GlorifiedBanking.Config.MAXIMUM_DISTANCE_FROM_ATM 98 | if tr.HitPos:DistToSqr(ply:GetPos()) > maxDist * maxDist then 99 | GlorifiedBanking.Notify(NOTIFY_ERROR, 3, GlorifiedBanking.i18n.GetPhrase("gbCardTooFarAway")) 100 | return 101 | end 102 | 103 | if not tr.Entity.InsertCard then 104 | local cantInsertPhrase = GlorifiedBanking.i18n.GetPhrase("gbCardCantInsert") 105 | if tr.Entity:GetClass() == "worldspawn" then cantInsertPhrase = GlorifiedBanking.i18n.GetPhrase("gbCardInsertAir") end 106 | GlorifiedBanking.Notify(NOTIFY_ERROR, 3, cantInsertPhrase) 107 | 108 | return 109 | end 110 | 111 | tr.Entity:InsertCard() 112 | end 113 | 114 | function SWEP:PreDrawViewModel() 115 | return true 116 | end 117 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_confirmationpopup.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self:SetSize(ScrH() * .4, ScrH() * .18) 6 | self:Center() 7 | self:MakePopup() 8 | 9 | self.Theme = GlorifiedBanking.Themes.GetCurrent() 10 | 11 | self.Close = vgui.Create("DButton", self) 12 | self.Close:SetText("") 13 | 14 | self.Close.DoClick = function(s) 15 | self:Remove() 16 | end 17 | 18 | self.Close.Color = Color(255, 255, 255) 19 | self.Close.Paint = function(s, w, h) 20 | local iconSize = h * .5 21 | 22 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, s:IsHovered() and self.Theme.Data.Colors.adminMenuCloseButtonHoverCol or self.Theme.Data.Colors.adminMenuCloseButtonCol) 23 | 24 | surface.SetDrawColor(s.Color) 25 | surface.SetMaterial(self.Theme.Data.Materials.close) 26 | surface.DrawTexturedRect(w / 2 - iconSize / 2, h / 2 - iconSize / 2, iconSize, iconSize) 27 | end 28 | 29 | self.Yes = vgui.Create("DButton", self) 30 | self.Yes:SetText("") 31 | 32 | self.Yes.Color = Color(255, 255, 255) 33 | self.Yes.Paint = function(s, w, h) 34 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.resetBalanceYesButtonBackgroundHoverCol or self.Theme.Data.Colors.resetBalanceYesButtonBackgroundCol) 35 | 36 | draw.RoundedBox(h * .1, 0, 0, w, h, s.Color) 37 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbYes"), "GlorifiedBanking.AdminMenu.SetBalanceButton", w / 2, h * .43, self.Theme.Data.Colors.setBalanceButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 38 | end 39 | 40 | self.Yes.DoClick = function(s) 41 | if not self.SteamID then return end 42 | 43 | net.Start("GlorifiedBanking.AdminPanel.SetPlayerBalance") 44 | net.WriteString(self.SteamID) 45 | net.WriteDouble(0) 46 | net.SendToServer() 47 | 48 | net.Start("GlorifiedBanking.AdminPanel.PlayerListOpened") 49 | net.SendToServer() 50 | 51 | self:Remove() 52 | end 53 | 54 | self.No = vgui.Create("DButton", self) 55 | self.No:SetText("") 56 | 57 | self.No.Color = Color(255, 255, 255) 58 | self.No.Paint = function(s, w, h) 59 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.resetBalanceNoButtonBackgroundHoverCol or self.Theme.Data.Colors.resetBalanceNoButtonBackgroundCol) 60 | 61 | draw.RoundedBox(h * .1, 0, 0, w, h, s.Color) 62 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbNo"), "GlorifiedBanking.AdminMenu.SetBalanceButton", w / 2, h * .43, self.Theme.Data.Colors.setBalanceButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 63 | end 64 | 65 | self.No.DoClick = function(s) 66 | self:Remove() 67 | end 68 | 69 | timer.Simple(0, function() 70 | if self.Username then return end 71 | steamworks.RequestPlayerInfo(self.SteamID, function(name) 72 | self.Username = name 73 | end) 74 | end) 75 | end 76 | 77 | function PANEL:PerformLayout(w, h) 78 | self.Close:SetSize(h * .18, h * .18) 79 | self.Close:SetPos(w - h * .18, 0) 80 | 81 | self.Yes:SetSize(w * .95, h * .2) 82 | self.Yes:SetPos(w * .025, h * .5) 83 | 84 | self.No:SetSize(w * .95, h * .2) 85 | self.No:SetPos(w * .025, h * .73) 86 | end 87 | 88 | function PANEL:Think() 89 | self:MoveToFront() 90 | end 91 | 92 | function PANEL:Paint(w, h) 93 | draw.RoundedBox(6, 0, 0, w, h, self.Theme.Data.Colors.adminMenuBackgroundCol) 94 | draw.RoundedBoxEx(6, 0, 0, w, h * .18, self.Theme.Data.Colors.adminMenuNavbarBackgroundCol, true, true) 95 | 96 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbConfirmation"), "GlorifiedBanking.AdminMenu.SetBalanceTitle", w * .021, h * .08, self.Theme.Data.Colors.adminMenuNavbarItemCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 97 | draw.DrawText(GlorifiedBanking.i18n.GetPhrase("gbConfirmationBalance", self.Username and self.Username or self.SteamID or "undefined"), "GlorifiedBanking.AdminMenu.SetBalanceDescription", w * .021, h * .23, self.Theme.Data.Colors.adminMenuNavbarItemCol) 98 | end 99 | 100 | vgui.Register("GlorifiedBanking.ConfirmationPopup", PANEL, "EditablePanel") 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | # GlorifiedBanking 5 | 6 | Please do not contact me for support. I will not assist you. This is open source with an issues section for a reason. 7 | 8 | ## Installation & Usage 9 | 10 | ### Guide 11 | 12 | - Download the latest version. 13 | - Open the zip file using WinRar or 7-Zip. 14 | - Drag & drop the folder into your addon's folder. 15 | - Configure at `lua/addons/glorifiedbanking/xx_config.lua`. 16 | - Add `glorifiedbanking_card` to your DarkRP loadout. 17 | - Add [this](https://steamcommunity.com/sharedfiles/filedetails/?id=2101502704) workshop link to your server's collection. 18 | 19 | ### Spawning ATMs 20 | 21 | 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. 22 | 23 | ### Using the Admin Panel 24 | 25 | Type `glorifiedbanking_admin` in your console if you would like to access the panel. 26 | 27 | ### Restoring Backups 28 | 29 | - Go to your server's `data` folder. 30 | - Open the `glorifiedbanking_backups` folder. 31 | - Look for the timestamp you would like to restore to. 32 | - Type `glorifiedbanking_restorebackup timestamp` in your server's console. 33 | - Restart your server. 34 | 35 | ### Importing Blue's ATM Data 36 | 37 | - Make sure your SQL config is set up in GlorifiedBanking. 38 | - Make sure Blue's ATM is on your server and the SQL is set up correctly. 39 | - Type `glorifiedbanking_importbluesdata` in console and make sure it prints that the transfer was successful. 40 | - Restart your server. 41 | 42 | ## Description 43 | 44 | 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. 45 | 46 | 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. 47 | 48 | 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. 49 | 50 | ### Key Features 51 | 52 | - Easy and powerful configuration 53 | - MySQL and SQLite compatibility 54 | - Blue's ATM data importer so your players don't lose out 55 | - Lockdown mode in the event of an emergency 56 | - Exploit prevention and validation checks 57 | - A built-in logging system in our admin panel 58 | - Custom card designer to let the cards fit your server's theme 59 | - Card reader entity for your stores to have direct transactions 60 | - Wiremod outputs for card readers 61 | 62 | ### Features 63 | 64 | - Interest system, custom checks for certain use cases such as restricting to donators 65 | - Lightweight with top tier optimisation 66 | - In-depth backup system for damage control, fully configurable 67 | - Integrated with numerous other addons due to our powerful API 68 | - A built-in logging system in our admin panel 69 | - System for your paychecks to go straight to your bank 70 | - A custom model with animations and a 3D2D menu 71 | - Transaction history, for individuals and admins 72 | - ATM entities save per map and work through admin cleanups 73 | - CAMI support for certain admin privileges 74 | - Custom Immersive and responsive audio 75 | - Withdrawals, deposits and transfers with the ability to set fees per ATM 76 | - Administration panel to take full control of your server 77 | - Easily customisation UI themes with our easy-to-understand theme library 78 | - Add support for other gamemodes with our easy-to-use compatibility file 79 | - Toolgun to consistently place ATMs at the same height, consistent distances and set appropriate fees 80 | - Translate to your own language with ease using our localisation library 81 | - DRM free and zero obfuscation 82 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_chinese.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "cn", { 3 | gbSystemName = "光荣银行", 4 | gbSystemNameCaps = "光荣银行", 5 | gbCardReader = "读卡器", 6 | gbLoading = "加载中", 7 | gbEnterCard = "插入你的银行卡", 8 | gbToContinue = "继续", 9 | gbAtmDisabled = "该ATM机已暂时停用,如有任何不便,敬请谅解。", 10 | gbBackShortly = "我们的系统很快就会重新上线", 11 | gbWelcomeBack = "欢迎回来,%s!", 12 | gbAccountBalance = "账户余额:%s", 13 | gbBack = "返回", 14 | gbHidden = "隐藏", 15 | gbMenuWithdraw = "撤回", 16 | gbMenuDeposit = "存款", 17 | gbMenuTransfer = "转账", 18 | gbMenuTransactions = "交易", 19 | gbMenuSettings = "设置", 20 | gbWithdrawAmount = "输入你要取出的金额", 21 | gbWithdrawalFree = "本次取款免费", 22 | gbWithdrawalHasFee = "本次取款要抽出%s%%的手续费", 23 | gbWithdrawalDisclaimer = "光荣银行不承担取款后的任何资金问题", 24 | gbDepositAmount = "输入你想存入的金额", 25 | gbDepositFree = "本次存款免费", 26 | gbDepositHasFee = "本次存款要抽出%s%%的手续费", 27 | gbDepositDisclaimer = "光荣银行不承担存款后的任何资金问题", 28 | gbTransferFree = "本次转账免费", 29 | gbTransferHasFee = "本次转账要抽出%s%%的手续费", 30 | gbSelectPlayer = "请选择一个玩家来转账。", 31 | gbTransactionTypeAmount = "输入金额", 32 | gbContactingServer = "与服务器通讯中", 33 | gbTakeDispensed = "请取走弹出的钱", 34 | gbInsertMoney = "请将钱存入", 35 | gbPleaseWait = "请稍等", 36 | gbCardName = "光荣银行卡", 37 | gbTransactionType = "交易类型", 38 | gbTransactionLogsFor = "交易记录为:%s", 39 | gbPlayersOnline = "在线玩家:%s", 40 | gbSetBalance = "设定余额", 41 | gbEnterBalance = "输入%s的新余额:", 42 | gbEnter = "输入", 43 | gbConfirmation = "确认", 44 | gbConfirmationBalance = "是否要重置%s的余额?", 45 | gbYes = "是", 46 | gbNo = "否", 47 | gbCancel = "取消", 48 | gbPaymentOf = "付款方式", 49 | gbToAccount = "给%s", 50 | gbPleasePresent = "请出示你的支付工具。", 51 | gbCantPaySelf = "你不能自己付钱!", 52 | gbCantPayOther = "你不能为别人的交易付款!", 53 | gbCantCancelOthers = "你不能取消别人的交易!", 54 | gbOnlyMerchantCancel = "只有商家才能取消交易!", 55 | gbNeedCard = "你需要有一个支付设备在手,才能进行支付!", 56 | gbConfirm = "确定", 57 | gbReaderLoading = "请稍候", 58 | gbEnterAmount = "输入金额", 59 | gbAdminMenuPlayers = "玩家", 60 | gbAdminMenuLogs = "日志", 61 | gbAdminMenuSettings = "设置", 62 | gbAdminMenuLockdown = "封锁模式", 63 | gbTransactionsTime = "时间", 64 | gbTransactionsType = "类型", 65 | gbTransactionsUsers = "发件人", 66 | gbTransactionsTotal = "总计", 67 | gbResetBalance = "重置余额", 68 | gbViewTransactions = "交易", 69 | gbTypeAll = "全部", 70 | gbTypeWithdrawals = "取款", 71 | gbTypeDeposits = "存款", 72 | gbTypeTransfers = "转账", 73 | gbItemsPerPage = "每页的物品", 74 | gbLogInfoType = "类型:", 75 | gbLogInfoTime = "时间:", 76 | gbLogInfoDate = "日期:", 77 | gbCardDesigner = "卡设计师", 78 | gbEnterImgur = "输入Imgur ID:", 79 | gbSave = "保存", 80 | gbResetDefaults = "重设为默认值", 81 | gbCantHaveNegative = "你不能将余额设定为负数!", 82 | gbLoggedOutInactive = "你已因闲置时间过长而被注销。", 83 | gbCardInstructions = "按下左键将卡片插入到设备中。", 84 | gbCardInsertAir = "不,你面前只是一堆空气。", 85 | gbCardCantInsert = "该设备没有卡槽。", 86 | gbCardTooFarAway = "你离得太远了,没办法将卡插入!", 87 | gbCardAtmInUse = "这台ATM机正在使用中。", 88 | gbDarkTheme = "黑暗主题", 89 | gbInterestReceived = "你收到了%s的利息。", 90 | gbSalaryToBank = "你的工资%s已被转到银行。", 91 | gbDropMoneyOnDeath = "你付了%s的医院账单。", 92 | gbCashWithdrawn = "你退出了%s。", 93 | gbCashDeposited = "你存了%s的钱。", 94 | gbCashTransferred = "你把%s转到了%s。", 95 | gbCashTransferReceive = "%s已将%s转移到你的帐户。", 96 | gbPaidByCard = "你用银行卡支付了%s%s。", 97 | gbPaidByCardReceive = "%s用银行卡支付%s到你的账户。", 98 | gbCannotAfford = "你不能这样做。", 99 | gbInvalidAmount = "请输入有效金额。", 100 | gbToolName = "ATM放置器", 101 | gbToolCategory = "光荣银行", 102 | gbToolDescription = "用于在墙上放置ATM机,并配置其单独的设置。", 103 | gbToolLeftClick = "放置一个永久ATM机", 104 | gbToolRightClick = "移除一个永久ATM机", 105 | gbToolReload = "将设置应用到ATM上", 106 | gbToolSignText = "签署文本:", 107 | gbToolSignTextHelp = "ATM标志上显示的文字。", 108 | gbToolWithdrawalFee = "提取费用:", 109 | gbToolWithdrawalFeeHelp = "使用该ATM机进行的取款交易手续费。", 110 | gbToolDepositFee = "存款费用:", 111 | gbToolDepositFeeHelp = "使用该ATM机进行的存款交易手续费。", 112 | gbToolTransferFee = "转账费用:", 113 | gbToolTransferFeeHelp = "使用该ATM机进行的转账交易手续费。", 114 | gbToolSnap = "抓取量:", 115 | gbToolSnapHelp = "每个捕捉点之间的距离。", 116 | gbToolHeight = "高度偏差:", 117 | gbToolHeightHelp = "自动取款机离地面的距离;", 118 | gbWireToolName = "读卡器控制器", 119 | gbWireToolDesc = "生成/链接一个读卡器控制器。", 120 | gbWireToolStep1 = "左键:创建读卡器控制器。右键:链接控制器。", 121 | gbWireToolStep2 = "选择一个读卡器来链接。", 122 | gbOnlyLinkReaders = "你只能将读卡器与控制器连接起来。" 123 | } ) 124 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_polish.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "pl", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbLoading = "ŁADOWANIE", 5 | gbEnterCard = "WŁÓŻ KARTĘ", 6 | gbToContinue = "KONTYNUUJ", 7 | gbAtmDisabled = "TEN BANKOMAT ZOSTAŁ TYMCZASOWO WYŁĄCZONY\nPRZEPRASZAMY ZA WSZELKIE NIEDOGODNOŚCI", 8 | gbBackShortly = "NASZE SYSTEMY WKRÓTCE WRÓCĄ DO DZIAŁANIA", 9 | gbWelcomeBack = "WITAJ Z POWROTEM, %s!", 10 | gbAccountBalance = "SALDO KONTA: %s", 11 | gbHidden = "UKRYTE", 12 | gbMenuWithdraw = "WYPŁAĆ", 13 | gbMenuDeposit = "WPŁAĆ", 14 | gbMenuTransfer = "PRZELEW", 15 | gbMenuTransactions = "TRANSAKCJE", 16 | gbMenuSettings = "USTAWIENIA", 17 | gbWithdrawAmount = "WYBIERZ KWOTĘ, KTÓRĄ CHCIAŁBYŚ WYPŁACIĆ", 18 | gbWithdrawalFree = "TO WYPŁACENIE JEST ZA BEZPŁATNE", 19 | gbWithdrawalHasFee = "TO WYPŁACENIE BĘDZIE MIAŁO %s%% OPŁATY DODATKOWEJ", 20 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING NIE PONOSI ODPOWIEDZIALNOŚCI ZA UTRATĘ PIENIĘDZY PO WYPŁACIE.", 21 | gbDepositAmount = "WYBIERZ KWOTĘ, KTÓRĄ CHCIAŁBYŚ WPŁACIĆ", 22 | gbDepositFree = "TA WPŁATA JEST BEZPŁATNA", 23 | gbDepositHasFee = "Z TEJ WYPŁATY ZOSTANIE POBRANE %s%% OPŁATY DODATKOWEJ", 24 | gbDepositDisclaimer = "GLORIFIEDBANKING NIE PONOSI ODPOWIEDZIALNOŚCI ZA UTRATĘ PIENIĘDZY PO WPŁACIE", 25 | gbTransferFree = "TEN PRZELEW JEST BEZPŁATNY", 26 | gbTransferHasFee = "DO TEGO PRZELEWU ZOSTANIE DOLICZONE %s%% OPŁATY DODATKOWEJ", 27 | gbSelectPlayer = "Wybierz gracza do którego chcesz przelać pieniądze", 28 | gbTransactionTypeAmount = "WPROWADŹ KWOTĘ", 29 | gbContactingServer = "ŁĄCZENIE Z SERWEREM", 30 | gbTakeDispensed = "ODBIERZ SWOJĄ WYPŁACONĄ GOTÓWKĘ", 31 | gbInsertMoney = "WŁÓŻ PIENIĄDZE KTÓRE CHCESZ WPŁACIĆ", 32 | gbPleaseWait = "POCZEKAJ CHWILĘ", 33 | gbCardName = "Karta GlorifiedBanking", 34 | gbTransactionType = "Rodzaj transakcji", 35 | gbTransactionLogsFor = "Dzienniki transakcji: %s", 36 | gbPlayersOnline = "Gracze online: %s", 37 | gbSetBalance = "Ustaw saldo", 38 | gbEnterBalance = "Wprowadź nowe saldo dla %s:", 39 | gbEnter = "Wprowadź", 40 | gbConfirmation = "Potwierdzenie", 41 | gbConfirmationBalance = "Chcesz zresetować saldo gracza %s's ?", 42 | gbYes = "Tak", 43 | gbNo = "Nie", 44 | gbAdminMenuPlayers = "GRACZE", 45 | gbAdminMenuLogs = "LOGI", 46 | gbAdminMenuSettings = "USTAWIENIA", 47 | gbAdminMenuLockdown = "TYP BLOKOWANIA", 48 | gbTransactionsTime = "CZAS", 49 | gbTransactionsType = "RODZAJ", 50 | gbTransactionsUsers = "NADAWCA", 51 | gbTransactionsTotal = "RAZEM", 52 | gbResetBalance = "Wyzerowanie salda", 53 | gbViewTransactions = "Transakcje", 54 | gbTypeAll = "Wszystko", 55 | gbTypeWithdrawals = "Wypłaty", 56 | gbTypeDeposits = "Wpłaty", 57 | gbTypeTransfers = "Przelewy", 58 | gbItemsPerPage = "Elementy na stronę", 59 | gbLogInfoType = "Rodzaj: ", 60 | gbLogInfoTime = "Czas: ", 61 | gbLogInfoDate = "Data: ", 62 | gbCantHaveNegative = "Nie możesz ustawić ujemnego salda!", 63 | gbLoggedOutInactive = "Zostałeś wylogowany z bankomatu z powodu braku aktywności.", 64 | gbCardInstructions = "Użyj lewego przycisku myszy, aby włożyć kartę do urządzenia.", 65 | gbCardInsertAir = "Nie możesz włożyć karty do powietrza!", 66 | gbCardCantInsert = "Tu nie ma miejsca na karty!", 67 | gbCardTooFarAway = "To za daleko, żeby włożyć kartę!", 68 | gbCardAtmInUse = "Ten bankomat jest obecnie w użyciu.", 69 | gbDarkTheme = "Ciemny", 70 | gbInterestReceived = "Otrzymałeś %s Odsetek.", 71 | gbSalaryToBank = "Twoja pensja %s została przelana do twojego banku.", 72 | gbDropMoneyOnDeath = "Zapłaciłeś % w rachunkach szpitalnych.", 73 | gbCashWithdrawn = "Wypłaciłeś %s.", 74 | gbCashDeposited = "Wypłaciłeś %s.", 75 | gbCashTransferred = "Przelałeś %s do %s.", 76 | gbCashTransferReceive = "%s przelał %s na twoje konto.", 77 | gbCannotAfford = "Nie stać cię na to.", 78 | gbInvalidAmount = "Proszę wpisać prawidłową kwotę.", 79 | gbToolName = "ATM Placer", 80 | gbToolCategory = "Glorified Banking", 81 | gbToolDescription = "Służy do umieszczania bankomatów na ścianie i konfigurowania ich indywidualnych ustawień.", 82 | gbToolLeftClick = "Umieszczenie stałego bankomatu", 83 | gbToolRightClick = "Usunięcie stałego bankomatu", 84 | gbToolReload = "Zastosuj ustawienia do bankomatu", 85 | gbToolSignText = "Napisz tekst:", 86 | gbToolSignTextHelp = "Tekst wyświetlany na znaku bankomatu.", 87 | gbToolWithdrawalFee = "Opłata z wypłatę środków:", 88 | gbToolWithdrawalFeeHelp = "Opłata transakcyjna za wszystkie wypłaty dokonane przy użyciu tego bankomatu w procentach.", 89 | gbToolDepositFee = "Opłata za wpłacenie środków:", 90 | gbToolDepositFeeHelp = "Opłata transakcyjna za wszystkie wpłaty dokonane w tym bankomacie w procentach.", 91 | gbToolTransferFee = "Opłata za przelew:", 92 | gbToolTransferFeeHelp = "Opłata transakcyjna za wszystkie przelewy dokonane przy użyciu tego bankomatu w procentach.", 93 | gbToolSnap = "Wyświetl kwotę:", 94 | gbToolSnapHelp = "Odległość pomiędzy poszczególnymi punktami.", 95 | gbToolHeight = "Odstęp wysokości:", 96 | gbToolHeightHelp = "Odległość od podłogi, na której zostanie umieszczony bankomat." 97 | } ) 98 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_spanish.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "es", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbLoading = "CARGANDO", 5 | gbEnterCard = "INGRESE SU TARJETA", 6 | gbToContinue = "PARA CONTINUAR", 7 | gbAtmDisabled = "ESTE CAJERO ESTÁ DESHABILITADO\nDISCULPAS POR LOS INCONVENIENTES", 8 | gbBackShortly = "NUESTROS SISTEMAS ESTARÁN DE VUELTA PRONTO", 9 | gbWelcomeBack = "¡BIENVENIDO DE VUELTA, %s!", 10 | gbAccountBalance = "BALANCE DE LA CUENTA: %s", 11 | gbHidden = "OCULTO", 12 | gbMenuWithdraw = "RETIRAR", 13 | gbMenuDeposit = "DEPOSITAR", 14 | gbMenuTransfer = "TRANSFERIR", 15 | gbMenuTransactions = "TRANSACCIONES", 16 | gbMenuSettings = "CONFIGURACIÓN", 17 | gbWithdrawAmount = "SELECCIONA UNA CANTIDAD QUE DESEE RETIRAR", 18 | gbWithdrawalFree = "ESTE RETIRO ES GRATIS", 19 | gbWithdrawalHasFee = "ESTE RETIRO TENDRÁ %s%% DE COMISIÓN", 20 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING NO ES RESPONSABLE DE LA PÉRDIDA DEL DINERO LUEGO DE SER RETIRADO", 21 | gbDepositAmount = "SELECCIONA UNA CANTIDAD PARA DEPOSITAR", 22 | gbDepositFree = "ESTE DEPÓSITO ES GRATIS", 23 | gbDepositHasFee = "ESTE DEPÓSITO TENDRÁ %s%% DE COMISIÓN", 24 | gbDepositDisclaimer = "GLORIFIEDBANKING NO ES RESPONSABLE DE LA PÉRDIDA DEL DINERO LUEGO DE SER DEPOSITADO", 25 | gbTransferFree = "ESTA TRANSFERENCIA ES GRATIS", 26 | gbTransferHasFee = "ESTA TRANSFERENCIA TENDRÁ %s%% DE COMISIÓN", 27 | gbSelectPlayer = "Selecciona al usuario que quieres transferirle este dinero.", 28 | gbTransactionTypeAmount = "ESCRIBE UNA CANTIDAD", 29 | gbContactingServer = "CONTACTANDO SERVIDOR", 30 | gbTakeDispensed = "POR FAVOR RECOJA EL DINERO EXTRAÍDO", 31 | gbInsertMoney = "POR FAVOR INSERTE EL DINERO A DEPOSITAR", 32 | gbPleaseWait = "POR FAVOR ESPERE UN MOMENTO", 33 | gbCardName = "Tarjeta GlorifiedBanking", 34 | gbTransactionType = "Tipo de Transacción", 35 | gbTransactionLogsFor = "Registro de transacción para: %s", 36 | gbPlayersOnline = "Usuarios en línea: %s", 37 | gbSetBalance = "Establecer balance", 38 | gbEnterBalance = "Escribe un nuevo balance %s:", 39 | gbEnter = "OK", 40 | gbConfirmation = "Confirmación", 41 | gbConfirmationBalance = "¿Quieres reiniciar el balance de %s?", 42 | gbYes = "Sí", 43 | gbNo = "No", 44 | gbAdminMenuPlayers = "JUGADORES", 45 | gbAdminMenuLogs = "REGISTROS", 46 | gbAdminMenuSettings = "CONFIGURACIÓN", 47 | gbAdminMenuLockdown = "MODO BLOQUEO", 48 | gbTransactionsTime = "TIEMPO", 49 | gbTransactionsType = "ESCRIBIR", 50 | gbTransactionsUsers = "REMITENTE", 51 | gbTransactionsTotal = "TOTAL", 52 | gbResetBalance = "Reiniciar balance", 53 | gbViewTransactions = "Transacciones", 54 | gbTypeAll = "Todo", 55 | gbTypeWithdrawals = "Retiros", 56 | gbTypeDeposits = "Depositos", 57 | gbTypeTransfers = "Transferencias", 58 | gbItemsPerPage = "Registros por página", 59 | gbLogInfoType = "Tipo: ", 60 | gbLogInfoTime = "Tiempo: ", 61 | gbLogInfoDate = "Fecha: ", 62 | gbCantHaveNegative = "¡No puedes establecer un balance negativo!", 63 | gbLoggedOutInactive = "Se ha cerrado tu sesión por estar inactivo en el CAJERO.", 64 | gbCardInstructions = "Usa click izquierdo para poner la tarjeta en el cajero.", 65 | gbCardInsertAir = "¡No puedes poner la tarjeta en el aire!", 66 | gbCardCantInsert = "¡Eso no tiene una ranura para la tarjeta!", 67 | gbCardTooFarAway = "¡Estás muy lejos para poner la tarjeta!", 68 | gbCardAtmInUse = "Este cajero ya está en uso.", 69 | gbDarkTheme = "Oscuro", 70 | gbInterestReceived = "Has recibido %s de interés.", 71 | gbSalaryToBank = "Tu salario de %s fue transferido a tu cuenta bancaria.", 72 | gbDropMoneyOnDeath = "Has pagado %s por el servicio hospitalario.", 73 | gbCashWithdrawn = "Has retirado %s.", 74 | gbCashDeposited = "Has depositado %s.", 75 | gbCashTransferred = "Has transferido %s a %s.", 76 | gbCashTransferReceive = "%s transfirió %s a tu cuenta.", 77 | gbCannotAfford = "No puedes pagar eso.", 78 | gbInvalidAmount = "Por favor ingrese una cantidad válida.", 79 | gbToolName = "Herramienta de CAJERO", 80 | gbToolCategory = "Glorified Banking", 81 | gbToolDescription = "Usado para poner cajeros y configurarlos.", 82 | gbToolLeftClick = "Poner un cajero permanente", 83 | gbToolRightClick = "Remover un cajero permanente", 84 | gbToolReload = "Aplicar configuración a un cajero", 85 | gbToolSignText = "Firma:", 86 | gbToolSignTextHelp = "El texto mostrado en la firma del cajero.", 87 | gbToolWithdrawalFee = "Comisión de retiro:", 88 | gbToolWithdrawalFeeHelp = "El costo de la transacción para retiros son hechos con este cajero por porcentaje.", 89 | gbToolDepositFee = "Comisión por depósito:", 90 | gbToolDepositFeeHelp = "El costo de la transacción para depósitos son hechos con este cajero por porcentaje.", 91 | gbToolTransferFee = "Comisión por transferencia:", 92 | gbToolTransferFeeHelp = "El costo de la transacción para transferencias son hechos con este cajero por porcentaje.", 93 | gbToolSnap = "Distancia de encaje:", 94 | gbToolSnapHelp = "La distancia necesaria para que el cajero encaje en la zona.", 95 | gbToolHeight = "Altura sobre el piso:", 96 | gbToolHeightHelp = "La distancia a la cual el cajero es establecido del piso." 97 | } ) 98 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_player.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:AddPlayer(ply, balance) 5 | self.Player = ply 6 | self.Balance = balance 7 | 8 | self.Avatar = vgui.Create("GlorifiedBanking.CircleAvatar", self) 9 | 10 | self.SetBalance = vgui.Create("DButton", self) 11 | self.SetBalance:SetText("") 12 | self.SetBalance.Color = Color(255, 255, 255) 13 | self.SetBalance.Paint = function(s, w, h) 14 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.playersMenuSetButtonBackgroundHoverCol or self.Theme.Data.Colors.playersMenuSetButtonBackgroundCol) 15 | 16 | draw.RoundedBox(h * .22, 0, 0, w, h, s.Color) 17 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbSetBalance"), "GlorifiedBanking.AdminMenu.PlayerSetBalance", w / 2, h / 2, self.Theme.Data.Colors.playersMenuButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 18 | end 19 | 20 | self.SetBalance.DoClick = function(s) 21 | if IsValid(GlorifiedBanking.UI.BalancePopup) then return end 22 | 23 | GlorifiedBanking.UI.BalancePopup = vgui.Create("GlorifiedBanking.BalancePopup") 24 | GlorifiedBanking.UI.BalancePopup.SteamID = self.Player:SteamID64() 25 | end 26 | 27 | self.ResetBalance = vgui.Create("DButton", self) 28 | self.ResetBalance:SetText("") 29 | self.ResetBalance.Color = Color(255, 255, 255) 30 | self.ResetBalance.Paint = function(s, w, h) 31 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.playersMenuResetButtonBackgroundHoverCol or self.Theme.Data.Colors.playersMenuResetButtonBackgroundCol) 32 | 33 | draw.RoundedBox(h * .22, 0, 0, w, h, s.Color) 34 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbResetBalance"), "GlorifiedBanking.AdminMenu.PlayerSetBalance", w / 2, h / 2, self.Theme.Data.Colors.playersMenuButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 35 | end 36 | 37 | self.ResetBalance.DoClick = function(s) 38 | if IsValid(GlorifiedBanking.UI.ConfirmationPopup) then return end 39 | 40 | GlorifiedBanking.UI.ConfirmationPopup = vgui.Create("GlorifiedBanking.ConfirmationPopup") 41 | GlorifiedBanking.UI.ConfirmationPopup.SteamID = self.Player:SteamID64() 42 | end 43 | 44 | self.ViewTransactions = vgui.Create("DButton", self) 45 | self.ViewTransactions:SetText("") 46 | self.ViewTransactions.Color = Color(255, 255, 255) 47 | self.ViewTransactions.Paint = function(s, w, h) 48 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.playersMenuTransactionsButtonBackgroundHoverCol or self.Theme.Data.Colors.playersMenuTransactionsButtonBackgroundCol) 49 | 50 | draw.RoundedBox(h * .22, 0, 0, w, h, s.Color) 51 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbViewTransactions"), "GlorifiedBanking.AdminMenu.PlayerSetBalance", w / 2, h / 2, self.Theme.Data.Colors.playersMenuButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 52 | end 53 | 54 | self.ViewTransactions.DoClick = function(s) 55 | local parent = self:GetParent():GetParent():GetParent() 56 | parent:AlphaTo(0, 0.15, 0, function(anim, panel) 57 | parent:Remove() 58 | 59 | local menuPanel = parent:GetParent() 60 | menuPanel.Page = vgui.Create("GlorifiedBanking.Logs", menuPanel) 61 | menuPanel.Page:Dock(FILL) 62 | menuPanel.Page:SetAlpha(0) 63 | menuPanel.Page:AlphaTo(255, 0.15) 64 | menuPanel.Page:SetSteamID(ply:SteamID64()) 65 | end) 66 | end 67 | 68 | local function drawPlayerInfo(playerno, x, containerh, align) 69 | local centerh = containerh / 2 70 | local spacing = containerh * .1 71 | 72 | draw.SimpleText(self.Player:Name(), "GlorifiedBanking.AdminMenu.LogPlayerInfo", x, centerh - spacing, self.Theme.Data.Colors.logsMenuLogPlayerNameTextCol, align, TEXT_ALIGN_CENTER) 73 | draw.SimpleText(self.Player:SteamID(), "GlorifiedBanking.AdminMenu.LogPlayerInfo", x, centerh + spacing, self.Theme.Data.Colors.logsMenuLogPlayerSteamIDTextCol, align, TEXT_ALIGN_CENTER) 74 | end 75 | 76 | function self:Paint(w, h) 77 | draw.RoundedBox(h * .1, 0, 0, w, h, self.Theme.Data.Colors.logsMenuLogBackgroundCol) 78 | 79 | drawPlayerInfo(1, h * .77, h, TEXT_ALIGN_LEFT) 80 | 81 | draw.SimpleText(GlorifiedBanking.FormatMoney(self.Balance), "GlorifiedBanking.AdminMenu.LogMoney", w * .95, h / 2, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) 82 | end 83 | end 84 | 85 | function PANEL:PerformLayout(w, h) 86 | local avatarsize = h * .65 87 | 88 | self.Avatar:SetSize(avatarsize, avatarsize) 89 | self.Avatar:SetMaskSize(avatarsize * .5) 90 | self.Avatar:SetPos(h * .08, h * .18) 91 | self.Avatar:SetSteamID(self.Player:SteamID64(), avatarsize) 92 | 93 | self.SetBalance:SetSize(w * .12, h * .4) 94 | self.SetBalance:SetPos(w * .3, h * .3) 95 | 96 | self.ResetBalance:SetSize(w * .14, h * .4) 97 | self.ResetBalance:SetPos(w * .43, h * .3) 98 | 99 | if not self.CanEditPlayers then 100 | self.SetBalance:SetVisible(false) 101 | self.ResetBalance:SetVisible(false) 102 | end 103 | 104 | self.ViewTransactions:SetSize(w * .13, h * .4) 105 | self.ViewTransactions:SetPos(w * .58, h * .3) 106 | end 107 | 108 | vgui.Register("GlorifiedBanking.Player", PANEL, "Panel") 109 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_german.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "de", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbLoading = "LÄDT", 5 | gbEnterCard = "GEBEN SIE IHRE KARTE EIN", 6 | gbToContinue = "WEITER", 7 | gbAtmDisabled = "DIESER GELDAUTOMAT WURDE VORÜBERGEHEND DEAKTIVIERT\nENTSCHULDIGUNG FÜR JEGLICHE UNANNEHMLICHKEITEN", 8 | gbBackShortly = "UNSERE SYSTEME SIND IN KÜRZE WIEDER ONLINE", 9 | gbWelcomeBack = "WILLKOMMEN ZURÜCK, %s!", 10 | gbAccountBalance = "KONTOSTAND: %s", 11 | gbHidden = "VERSTECKT", 12 | gbMenuWithdraw = "ABHEBEN", 13 | gbMenuDeposit = "EINZAHLEN", 14 | gbMenuTransfer = "ÜBERWEISEN", 15 | gbMenuTransactions = "ÜBERWEISUNGEN", 16 | gbMenuSettings = "EINSTELLUNGEN", 17 | gbWithdrawAmount = "WÄHLEN SIE EINEN BETRAG, DEN SIE ABHEBEN MÖCHTEN", 18 | gbWithdrawalFree = "ES FALLEN DURCH DAS ABHEBEN KEINE GEBÜREN AN", 19 | gbWithdrawalHasFee = "ES FALLEN %s%% GEBÜREN FÜR DAS ABHEBEN AN", 20 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING IST NICHT VERANTWORTLICH FÜR GELDVERLUST NACH DEM ABHEBEN", 21 | gbDepositAmount = "WÄHLEN SIE EINEN BETRAG, DEN SIE EINZAHLEN MÖCHTEN", 22 | gbDepositFree = "ES FALLEN FÜR DAS EINZAHLEN KEINE GEBÜREN AN", 23 | gbDepositHasFee = "ES FALLEN A %s%% GEBÜREN FÜR DAS EINZAHLEN AN", 24 | gbDepositDisclaimer = "GLORIFIEDBANKING IST NICHT VERANTWORTLICH FÜR GELDVERLUST NACH EINZAHLUNG", 25 | gbTransferFree = "DIESE ÜBERWEISUNG IST KOSTENLOS", 26 | gbTransferHasFee = "ES FALLEN %s%% GEBÜREN FÜR DIESE ÜBERWEISUNG AN", 27 | gbSelectPlayer = "Bitte wählen Sie einen Spieler aus, an den Sie Geld überweisen möchten.", 28 | gbTransactionTypeAmount = "GEBEN SIE EINEN BETRAG EIN", 29 | gbContactingServer = "SERVER WIRD KONTAKTIERT", 30 | gbTakeDispensed = "BITTE ENTNEHMEN SIE DAS GELD", 31 | gbInsertMoney = "BITTE LEGEN SIE DAS GELD ZUR EINZAHLUNG EIN", 32 | gbPleaseWait = "BITTE WARTE SIE EINEN MOMENT", 33 | gbCardName = "GlorifiedBanking Karte", 34 | gbTransactionType = "Art der Transaktion", 35 | gbTransactionLogsFor = "Transaktionsprotokoll für: %s", 36 | gbPlayersOnline = "Spieler online: %s", 37 | gbSetBalance = "Kontostant einstellen", 38 | gbEnterBalance = "Geben Sie einen neuen Kontostand für %s ein", 39 | gbEnter = "Eingeben", 40 | gbConfirmation = "Bestätigung", 41 | gbConfirmationBalance = "Möchtest du den Kontostant von %s zurücksetzen?", 42 | gbYes = "Ja", 43 | gbNo = "Nein", 44 | gbAdminMenuPlayers = "SPIELER", 45 | gbAdminMenuLogs = "LOGS", 46 | gbAdminMenuSettings = "EINSTELLUNGEN", 47 | gbAdminMenuLockdown = "LOCKDOWN-MODUS", 48 | gbTransactionsTime = "ZEIT", 49 | gbTransactionsType = "TYP", 50 | gbTransactionsUsers = "ABSENDER", 51 | gbTransactionsTotal = "GESAMT", 52 | gbResetBalance = "Kontostant zurücksetzen", 53 | gbViewTransactions = "Überweisungen", 54 | gbTypeAll = "Alle", 55 | gbTypeWithdrawals = "Abhebungen", 56 | gbTypeDeposits = "Einzahlungen", 57 | gbTypeTransfers = "Überweisungen", 58 | gbItemsPerPage = "Objekte pro Seite", 59 | gbLogInfoType = "Typ: ", 60 | gbLogInfoTime = "Zeit: ", 61 | gbLogInfoDate = "Datum: ", 62 | gbCantHaveNegative = "Sie können keinen negativen Saldo einstellen!", 63 | gbLoggedOutInactive = "Sie wurden aufgrund von Inaktivität vom Geldautomaten abgemeldet.", 64 | gbCardInstructions = "Verwenden Sie die linke Maustaste, um die Karte in ein Gerät einzulegen.", 65 | gbCardInsertAir = "Sie können die Karte nicht in die Luft stecken!", 66 | gbCardCantInsert = "Das hat keinen Kartensteckplatz!", 67 | gbCardTooFarAway = "Das ist zu weit weg, um Ihre Karte einzulegen!", 68 | gbCardAtmInUse = "Dieser Geldautomat wird derzeit verwendet.", 69 | gbDarkTheme = "Dunkel", 70 | gbInterestReceived = "Sie haben %s Zinsen erhalten.", 71 | gbSalaryToBank = "Ihr Gehalt von %s wurde an Ihre Bank überwiesen.", 72 | gbDropMoneyOnDeath = "Sie haben %s in Krankenhausrechnungen bezahlt.", 73 | gbCashWithdrawn = "Du hast %s ausgezahlt.", 74 | gbCashDeposited = "Du hast %s eingezahlt.", 75 | gbCashTransferred = "Sie haben %s an %s übertragen.", 76 | gbCashTransferReceive = "%s hat %s auf dein Konto übertragen.", 77 | gbCannotAfford = "Das kannst du dir nicht leisten.", 78 | gbInvalidAmount = "Bitte geben Sie einen gültigen Betrag ein.", 79 | gbToolName = "ATM Placer", 80 | gbToolCategory = "Glorified Banking", 81 | gbToolDescription = "Wird verwendet, um Geldautomaten an der Wand zu platzieren und ihre individuellen Einstellungen zu konfigurieren.", 82 | gbToolLeftClick = "Platzieren Sie einen permanenten Geldautomaten auf", 83 | gbToolRightClick = "Entferne einen permanenten Geldautomaten", 84 | gbToolReload = "Wenden Sie Einstellungen auf einen Geldautomaten an", 85 | gbToolSignText = "Schild Text:", 86 | gbToolSignTextHelp = "Der auf dem Geldautomatenschild angezeigte Text.", 87 | gbToolWithdrawalFee = "Abhebegebühr:", 88 | gbToolWithdrawalFeeHelp = "Die Transaktionsgebühr für alle mit diesem Geldautomaten vorgenommenen Abhebungen in Prozent.", 89 | gbToolDepositFee = "Einzahlungsgebühr:", 90 | gbToolDepositFeeHelp = "Die Transaktionsgebühr für alle Einzahlungen mit diesem Geldautomaten in Prozent.", 91 | gbToolTransferFee = "Überweisungsgebür:", 92 | gbToolTransferFeeHelp = "Die Transaktionsgebühr für alle mit diesem Geldautomaten getätigten Überweisungen in Prozent.", 93 | gbToolSnap = "Einrast Einstellung:", 94 | gbToolSnapHelp = "Der Abstand zwischen den einzelnen Einrastpunkten.", 95 | gbToolHeight = "Höhenversatz:", 96 | gbToolHeightHelp = "Der Abstand zum Boden, auf dem sich der Geldautomat befindet." 97 | } ) 98 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_paginator.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self.Theme = self:GetParent().Theme 6 | 7 | self.ItemsPerPage = 20 8 | self.ItemCount = 0 9 | self.PageCount = 0 10 | self.SelectedPage = 1 11 | 12 | self.ItemCountSelector = vgui.Create("GlorifiedBanking.Dropdown", self) 13 | 14 | self.ItemCountSelector:SetSortItems(false) 15 | 16 | self.ItemCountSelector:AddChoice(5) 17 | self.ItemCountSelector:AddChoice(10) 18 | self.ItemCountSelector:AddChoice(20) 19 | self.ItemCountSelector:AddChoice(50) 20 | self.ItemCountSelector:ChooseOptionID(3) 21 | 22 | self.ItemCountSelector.OnSelect = function(s, index, value, data) 23 | s:SizeToContents() 24 | 25 | self.ItemsPerPage = value 26 | self:SetupPaginator(self.ItemCount, true) 27 | end 28 | 29 | self.Buttons = {} 30 | end 31 | 32 | function PANEL:Paint(w, h) 33 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbItemsPerPage"), "GlorifiedBanking.AdminMenu.PaginatorPerPage", w * .024, h * .48, self.Theme.Data.Colors.logsMenuTransactionTypeTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 34 | end 35 | 36 | function PANEL:OnPageSelected(pageNo, limit) 37 | print("Selected page: " .. pageNo) 38 | end 39 | 40 | function PANEL:SelectPage(no) 41 | if no < 1 or no > self.PageCount then return end 42 | 43 | self.SelectedPage = no 44 | 45 | local buttonNo = 1 46 | if self.PageCount > 10 then 47 | buttonNo = no - 2 > 0 and no - 2 or 1 48 | buttonNo = buttonNo > self.PageCount - 9 and self.PageCount - 9 or buttonNo 49 | end 50 | 51 | for k,v in ipairs(self.Buttons) do 52 | if not tonumber(v.Text) then continue end 53 | 54 | v.Text = tostring(buttonNo) 55 | v.Page = buttonNo 56 | v.Selected = no == buttonNo 57 | 58 | buttonNo = buttonNo + 1 59 | end 60 | 61 | self:OnPageSelected(no, self.ItemsPerPage) 62 | end 63 | 64 | function PANEL:ClearButtons() 65 | for k,v in ipairs(self.Buttons) do 66 | v:Remove() 67 | self.Buttons[k] = nil 68 | end 69 | end 70 | 71 | function PANEL:CreatePageButton(text, drawbg, onClick) 72 | local btn = vgui.Create("DButton", self) 73 | 74 | btn.Text = text 75 | btn:SetText("") 76 | btn.DoClick = onClick 77 | 78 | btn.BackgroundColour = Color(0, 0, 0, 0) 79 | btn.Paint = function(s, w, h) 80 | if drawbg then 81 | s.BackgroundColour = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.BackgroundColour, s:IsHovered() and self.Theme.Data.Colors.paginatorArrowButtonBackgroundHoverCol or self.Theme.Data.Colors.paginatorArrowButtonBackgroundCol) 82 | else 83 | s.BackgroundColour = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.BackgroundColour, s.Selected and self.Theme.Data.Colors.paginatorNumberButtonSelectedBackgroundCol or s:IsHovered() and self.Theme.Data.Colors.paginatorNumberButtonBackgroundHoverCol or self.Theme.Data.Colors.paginatorNumberButtonBackgroundCol) 84 | end 85 | 86 | draw.RoundedBox(h * .15, 0, 0, w, h, s.BackgroundColour) 87 | draw.SimpleText(s.Text, "GlorifiedBanking.AdminMenu.PaginatorButton", w / 2, h / 2, self.Theme.Data.Colors.paginatorButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 88 | end 89 | 90 | return btn 91 | end 92 | 93 | function PANEL:SetupPaginator(itemcount, force) 94 | if not force and self.ItemCount > 0 then return end 95 | 96 | self:ClearButtons() 97 | 98 | self.ItemCount = itemcount 99 | self.PageCount = math.ceil(itemcount / self.ItemsPerPage) 100 | 101 | if self.PageCount <= 1 then 102 | if force then self:SelectPage(1) end 103 | self:Remove() 104 | return 105 | end 106 | 107 | if self.PageCount > 10 then 108 | self.Buttons[1] = self:CreatePageButton("<<", true, function(s) 109 | self:SelectPage(1) 110 | end) 111 | end 112 | 113 | self.Buttons[#self.Buttons + 1] = self:CreatePageButton("<", true, function(s) 114 | self:SelectPage(self.SelectedPage - 1) 115 | end) 116 | 117 | local function doClick(s) 118 | self:SelectPage(s.Page) 119 | end 120 | 121 | for i = 1, math.min(self.PageCount, 10) do 122 | self.Buttons[#self.Buttons + 1] = self:CreatePageButton(tostring(i), false, doClick) 123 | self.Buttons[#self.Buttons].Page = i 124 | end 125 | 126 | self.Buttons[#self.Buttons + 1] = self:CreatePageButton(">", true, function(s) 127 | self:SelectPage(self.SelectedPage + 1) 128 | end) 129 | 130 | if self.PageCount > 10 then 131 | self.Buttons[#self.Buttons + 1] = self:CreatePageButton(">>", true, function(s) 132 | self:SelectPage(self.PageCount) 133 | end) 134 | end 135 | 136 | self:SelectPage(1) 137 | end 138 | 139 | function PANEL:PerformLayout(w, h) 140 | surface.SetFont("GlorifiedBanking.AdminMenu.PaginatorPerPage") 141 | local dropx = surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbItemsPerPage")) 142 | 143 | self.ItemCountSelector:SetSize(10, h * .8) 144 | self.ItemCountSelector:SetPos(w * .024 + dropx + w * .008, h * .3) 145 | self.ItemCountSelector:SizeToContents() 146 | 147 | local btncount = #self.Buttons 148 | local btnsize = w * .034 149 | local btnx, btny = w / 2 - (btncount * btnsize + (btncount * w * .005)) / 2, h * .27 150 | 151 | for k,v in ipairs(self.Buttons) do 152 | v:SetSize(btnsize, btnsize) 153 | v:SetPos(btnx, btny) 154 | 155 | btnx = btnx + btnsize + w * .005 156 | end 157 | end 158 | 159 | vgui.Register("GlorifiedBanking.Paginator", PANEL, "Panel") 160 | -------------------------------------------------------------------------------- /lua/autorun/sh_glorifiedbanking_autoincluder.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking = GlorifiedBanking or { 3 | Config = {}, 4 | Version = "3.2.2" 5 | } 6 | 7 | print( "[GlorifiedBanking] This server is running version " .. GlorifiedBanking.Version .. "." ) 8 | 9 | --[[ 10 | GlorifiedInclude - A library for including files & folders with ease. 11 | © 2020 GlorifiedInclude Developers 12 | 13 | Please read usage guide @ https://github.com/GlorifiedPig/glorifiedinclude/blob/master/README.md 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 16 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | 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. 18 | ]]-- 19 | 20 | local giVersion = 1.4 21 | 22 | if not GlorifiedInclude or GlorifiedInclude.Version < giVersion then 23 | GlorifiedInclude = { 24 | Version = giVersion, 25 | Realm = { 26 | Server = 0, 27 | Client = 1, 28 | Shared = 2 29 | } 30 | } 31 | 32 | local isAddon = debug.getinfo( 1, "S" ).short_src[1] == "a" 33 | local include = include 34 | local AddCSLuaFile = AddCSLuaFile 35 | local SERVER = SERVER 36 | 37 | local GlorifiedInclude_Realm = GlorifiedInclude.Realm 38 | 39 | local includedFiles = {} 40 | 41 | function GlorifiedInclude.IncludeFile( fileName, realm, forceInclude, calledFromFolder, printName ) 42 | if isAddon == false and not calledFromFolder then fileName = GM.FolderName .. "/gamemode/" .. fileName end 43 | if not forceInclude and includedFiles[fileName] then return end 44 | includedFiles[fileName] = true 45 | 46 | if realm == GlorifiedInclude_Realm.Shared or fileName:find( "sh_" ) then 47 | if printName then 48 | print( printName .. " > Including SH file '" .. fileName .. "'" ) 49 | end 50 | if SERVER then AddCSLuaFile( fileName ) end 51 | include( fileName ) 52 | elseif realm == GlorifiedInclude_Realm.Server or ( SERVER and fileName:find( "sv_" ) ) then 53 | if printName then 54 | print( printName .. " > Including SV file '" .. fileName .. "'" ) 55 | end 56 | include( fileName ) 57 | elseif realm == GlorifiedInclude_Realm.Client or fileName:find( "cl_" ) then 58 | if printName then 59 | print( printName .. " > Including CL file '" .. fileName .. "'" ) 60 | end 61 | if SERVER then AddCSLuaFile( fileName ) 62 | else include( fileName ) end 63 | end 64 | end 65 | 66 | function GlorifiedInclude.IncludeFolder( folderName, ignoreFiles, ignoreFolders, forceInclude, printName ) 67 | if not isAddon then folderName = GM.FolderName .. "/gamemode/" .. folderName end 68 | 69 | if string.Right( folderName, 1 ) ~= "/" then folderName = folderName .. "/" end 70 | 71 | local filesInFolder, foldersInFolder = file.Find( folderName .. "*", "LUA" ) 72 | 73 | if ignoreFiles ~= true then 74 | for _, v in ipairs( filesInFolder ) do 75 | GlorifiedInclude.IncludeFile( folderName .. v, nil, forceInclude, true, printName ) 76 | end 77 | end 78 | 79 | if ignoreFolders ~= true then 80 | for _, v in ipairs( foldersInFolder ) do 81 | GlorifiedInclude.IncludeFolder( folderName .. v .. "/", ignoreFiles, ignoreFolders, forceInclude, printName ) 82 | end 83 | end 84 | end 85 | end 86 | 87 | --[[ 88 | -- Common practice would be to put all your includes here, for example: 89 | GlorifiedInclude.IncludeFolder( "modules/" ) 90 | GlorifiedInclude.IncludeFile( "sh_config.lua" ) 91 | -- Remember that files load in the order you include them in. 92 | ]]-- 93 | 94 | local function gbIncludeFile( fileName ) GlorifiedInclude.IncludeFile( fileName, nil, nil, nil, "GlorifiedBanking" ) end 95 | local function gbIncludeFolder( folderName ) GlorifiedInclude.IncludeFolder( folderName, nil, nil, nil, "GlorifiedBanking" ) end 96 | gbIncludeFile( "glorifiedbanking/sh_glorifiedbanking_compatibility.lua" ) 97 | local function IncludeGBFiles() 98 | gbIncludeFile( "glorifiedbanking/sv_glorifiedbanking_config.lua" ) 99 | gbIncludeFile( "glorifiedbanking/sh_glorifiedbanking_config.lua") 100 | gbIncludeFolder( "glorifiedbanking/libraries/" ) 101 | gbIncludeFolder( "glorifiedbanking/localization/" ) 102 | gbIncludeFile( "glorifiedbanking/themes/cl_glorifiedbanking_dark.lua" ) 103 | gbIncludeFolder( "glorifiedbanking/themes/" ) 104 | gbIncludeFolder( "glorifiedbanking/modules/sql/" ) 105 | gbIncludeFolder( "glorifiedbanking/modules/" ) 106 | hook.Run( "GlorifiedBanking.FinishedLoading" ) 107 | end 108 | 109 | hook.Add( GlorifiedBanking.HookRunName, "GlorifiedBanking.AutoIncluder.IncludeGBFiles", IncludeGBFiles ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_log.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:AddData(data) 5 | data.SteamID64 = data.SteamID 6 | if data.ReceiverSteamID then data.ReceiverSteamID64 = data.ReceiverSteamID end 7 | 8 | data.Time = os.date("%H:%M:%S", data.Date) 9 | data.Date = os.date("%d/%m/%Y", data.Date) 10 | 11 | data.Username = "" 12 | data.ReceiverUsername = "" 13 | 14 | data.Amount = GlorifiedBanking.FormatMoney(data.Amount) 15 | 16 | self.Data = data 17 | 18 | steamworks.RequestPlayerInfo(data.SteamID64, function(name) 19 | self.Data.Username = name 20 | end) 21 | 22 | if data.ReceiverSteamID then 23 | steamworks.RequestPlayerInfo(data.ReceiverSteamID64, function(name) 24 | self.Data.ReceiverUsername = name 25 | end) 26 | end 27 | 28 | self.Avatar = vgui.Create("GlorifiedBanking.CircleAvatar", self) 29 | if data.ReceiverSteamID then self.Avatar2 = vgui.Create("GlorifiedBanking.CircleAvatar", self) end 30 | 31 | local function drawInfo(containerw, infoy) 32 | surface.SetFont("GlorifiedBanking.AdminMenu.LogInfoBold") 33 | local infow = surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbLogInfoType")) 34 | infow = infow + surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbLogInfoTime")) 35 | infow = infow + surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbLogInfoDate")) 36 | 37 | surface.SetFont("GlorifiedBanking.AdminMenu.LogInfo") 38 | infow = infow + surface.GetTextSize(self.Data.Type) 39 | infow = infow + surface.GetTextSize(self.Data.Time) 40 | infow = infow + surface.GetTextSize(self.Data.Date) 41 | 42 | infow = infow + containerw * .03 43 | 44 | local infox = containerw / 2 - infow / 2 45 | infox = infox + draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbLogInfoType"), "GlorifiedBanking.AdminMenu.LogInfoBold", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 46 | infox = infox + draw.SimpleText(self.Data.Type, "GlorifiedBanking.AdminMenu.LogInfo", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 47 | infox = infox + containerw * .015 48 | 49 | infox = infox + draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbLogInfoTime"), "GlorifiedBanking.AdminMenu.LogInfoBold", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 50 | infox = infox + draw.SimpleText(self.Data.Time, "GlorifiedBanking.AdminMenu.LogInfo", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 51 | infox = infox + containerw * .015 52 | 53 | infox = infox + draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbLogInfoDate"), "GlorifiedBanking.AdminMenu.LogInfoBold", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 54 | infox = infox + draw.SimpleText(self.Data.Date, "GlorifiedBanking.AdminMenu.LogInfo", infox, infoy, self.Theme.Data.Colors.logsMenuLogInfoTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 55 | end 56 | 57 | local function drawPlayerInfo(playerno, x, containerh, align) 58 | local centerh = containerh / 2 59 | local spacing = containerh * .1 60 | 61 | draw.SimpleText(playerno == 1 and self.Data.Username or self.Data.ReceiverUsername, "GlorifiedBanking.AdminMenu.LogPlayerInfo", x, centerh - spacing, self.Theme.Data.Colors.logsMenuLogPlayerNameTextCol, align, TEXT_ALIGN_CENTER) 62 | draw.SimpleText(playerno == 1 and self.Data.SteamID or self.Data.ReceiverSteamID, "GlorifiedBanking.AdminMenu.LogPlayerInfo", x, centerh + spacing, self.Theme.Data.Colors.logsMenuLogPlayerSteamIDTextCol, align, TEXT_ALIGN_CENTER) 63 | end 64 | 65 | function self:Paint(w, h) 66 | draw.RoundedBox(h * .1, 0, 0, w, h, self.Theme.Data.Colors.logsMenuLogBackgroundCol) 67 | 68 | drawPlayerInfo(1, h * .77, h, TEXT_ALIGN_LEFT) 69 | drawInfo(w, h / 2) 70 | 71 | draw.SimpleText(self.Data.Amount, "GlorifiedBanking.AdminMenu.LogMoney", w * .99, h / 2, self.Data.Type == "Withdrawal" and self.Theme.Data.Colors.logsMenuLogMoneyNegativeTextCol or self.Theme.Data.Colors.logsMenuLogMoneyPositiveTextCol, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) 72 | end 73 | 74 | if self.Data.Type != "Transfer" then return end 75 | 76 | function self:Paint(w, h) 77 | draw.RoundedBox(h * .1, 0, 0, w, h, self.Theme.Data.Colors.logsMenuLogBackgroundCol) 78 | 79 | drawPlayerInfo(1, h * .77, h, TEXT_ALIGN_LEFT) 80 | drawPlayerInfo(2, w - h * .82, h, TEXT_ALIGN_RIGHT) 81 | drawInfo(w, h * .7) 82 | 83 | draw.SimpleText(self.Data.Amount, "GlorifiedBanking.AdminMenu.LogMoney", w / 2, h * .3, self.Theme.Data.Colors.logsMenuLogPlayerNameTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 84 | end 85 | end 86 | 87 | function PANEL:PerformLayout(w, h) 88 | if IsValid(self.Avatar) then 89 | local avatarsize = h * .65 90 | local avatarpadx, avatarpady = h * .08, h * .18 91 | 92 | self.Avatar:SetSize(avatarsize, avatarsize) 93 | self.Avatar:SetMaskSize(avatarsize * .5) 94 | self.Avatar:SetPos(avatarpadx, avatarpady) 95 | self.Avatar:SetSteamID(self.Data.SteamID64, avatarsize) 96 | 97 | if IsValid(self.Avatar2) then 98 | self.Avatar2:SetSize(avatarsize, avatarsize) 99 | self.Avatar2:SetMaskSize(avatarsize * .5) 100 | self.Avatar2:SetPos(w - avatarpadx - avatarsize, avatarpady) 101 | self.Avatar2:SetSteamID(self.Data.ReceiverSteamID64, avatarsize) 102 | end 103 | end 104 | end 105 | 106 | vgui.Register("GlorifiedBanking.Log", PANEL, "Panel") 107 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_russian.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "ru", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbSystemNameCaps = "GLORIFIEDBANKING", 5 | gbCardReader = "ПЛАТЁЖНЫЙ ТЕРМИНАЛ", 6 | gbLoading = "ЗАГРУЗКА", 7 | gbEnterCard = "ВСТАВЬТЕ ВАШУ КАРТУ", 8 | gbToContinue = "ДЛЯ ПРОДОЛЖЕНИЯ", 9 | gbAtmDisabled = "БАНКОМАТ НЕДОСТУПЕН\nПРОСИМ ИЗВИНЕНИЯ ЗА ДОСТАВЛЕННЫЕ НЕУДОБСТВА", 10 | gbBackShortly = "БАНКОМАТ БУДЕТ ДОСТУПЕН В БЛИЖАЙШЕЕ ВРЕМЯ", 11 | gbWelcomeBack = "ДОБРО ПОЖАЛОВАТЬ, %s!", 12 | gbAccountBalance = "БАЛАНС: %s", 13 | gbBack = "НАЗАД", 14 | gbHidden = "СКРЫТО", 15 | gbMenuWithdraw = "СНЯТИЕ ДЕНЕГ", 16 | gbMenuDeposit = "ВНЕСЕНИЕ ДЕНЕГ", 17 | gbMenuTransfer = "ПЕРЕВОД ДЕНЕГ", 18 | gbMenuTransactions = "ВАШИ ПЕРЕВОДЫ", 19 | gbMenuSettings = "НАСТРОЙКИ", 20 | gbWithdrawAmount = "ВВЕДИТЕ СУММУ ДЛЯ СНЯТИЯ", 21 | gbWithdrawalFree = "БЕЗ КОМИССИИ", 22 | gbWithdrawalHasFee = "КОМИССИЯ ЗА СНЯТИЕ %s%%", 23 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING НЕ НЕСЁТ ОТВЕТСТВЕННОСТИ ЗА ПОТЕРЮ ДЕНЕГ ПОСЛЕ ИХ СНЯТИЯ", 24 | gbDepositAmount = "ВВЕДИТЕ СУММУ ДЛЯ ВНЕСЕНИЯ", 25 | gbDepositFree = "БЕЗ КОМИССИИ", 26 | gbDepositHasFee = "КОМИССИЯ НА ВНЕСЕНИЕ %s%%", 27 | gbDepositDisclaimer = "GLORIFIEDBANKING НЕ НЕСЁТ ОТВЕТСТВЕННОСТИ ЗА ПОТЕРЮ ДЕНЕГ ПОСЛЕ ИХ ВНЕСЕНИЯ", 28 | gbTransferFree = "БЕЗ КОМИССИИ", 29 | gbTransferHasFee = "КОМИССИЯ НА ПЕРЕВОД %s%%", 30 | gbSelectPlayer = "Для перевода необходимо выбрать игрока.", 31 | gbTransactionTypeAmount = "СУММА", 32 | gbContactingServer = "ОПЕРАЦИЯ ВЫПОЛНЯЕТСЯ", 33 | gbTakeDispensed = "ВОЗЬМИТЕ ДЕНЬГИ", 34 | gbInsertMoney = "ВНЕСИТЕ ДЕНЬГИ", 35 | gbPleaseWait = "ПОЖАЛУЙСТА ПОДОЖДИТЕ", 36 | gbCardName = "Банковская карта GlorifiedBanking", 37 | gbTransactionType = "Тип операции", 38 | gbTransactionLogsFor = "Архив переводов для %s", 39 | gbPlayersOnline = "Игроков онлайн: %s", 40 | gbSetBalance = "Назначить", 41 | gbEnterBalance = "Введите новый баланс для %s:", 42 | gbEnter = "Ввод", 43 | gbConfirmation = "Подтверждение", 44 | gbConfirmationBalance = "Вы действительно хотите сбросить баланс игроку %s?", 45 | gbYes = "Да", 46 | gbNo = "Нет", 47 | gbPaymentOf = "ПЛАТЁЖ НА СУММУ", 48 | gbToAccount = "ИГРОКУ %s", 49 | gbCantPaySelf = "Вы не можете оплатить свой счёт!", 50 | gbNeedCard = "Для совершения платежа вам необходимо держать карту в руках.", 51 | gbConfirm = "ПЛАТЁЖ", 52 | gbReaderLoading = "ПРОИЗВОДИТСЯ ОПЛАТА", 53 | gbEnterAmount = "ВВЕДИТЕ СУММУ", 54 | gbAdminMenuPlayers = "ИГРОКИ", 55 | gbAdminMenuLogs = "АРХИВ", 56 | gbAdminMenuSettings = "НАСТРОЙКИ", 57 | gbAdminMenuLockdown = "ЭКСТРЕННОЕ ВЫКЛЮЧЕНИЕ", 58 | gbTransactionsTime = "ВРЕМЯ", 59 | gbTransactionsType = "ТИП", 60 | gbTransactionsUsers = "ОТПРАВИТЕЛЬ", 61 | gbTransactionsTotal = "ВСЕГО", 62 | gbResetBalance = "Сбросить", 63 | gbViewTransactions = "Переводы", 64 | gbTypeAll = "Все", 65 | gbTypeWithdrawals = "Снятие", 66 | gbTypeDeposits = "Внесение", 67 | gbTypeTransfers = "Переводы", 68 | gbItemsPerPage = "Предметов на странице", 69 | gbLogInfoType = "Тип: ", 70 | gbLogInfoTime = "Время: ", 71 | gbLogInfoDate = "Дата: ", 72 | gbCardDesigner = "Дизайнер карыт", 73 | gbEnterImgur = "Введите ID Imgur:", 74 | gbSave = "Сохранить", 75 | gbResetDefaults = "Сбросить настройки", 76 | gbCantHaveNegative = "Отрицательный баланс не допускается.", 77 | gbLoggedOutInactive = "Вы вышли из банкомата из-за неактивности.", 78 | gbCardInstructions = "Чтобы вставить карту в банкомат, используйте левую кнопку мыши.", 79 | gbCardInsertAir = "Вам некуда вставлять карту!", 80 | gbCardCantInsert = "Это оборудование не имеет разъема для банковских карт.", 81 | gbCardTooFarAway = "Это оборудование слишком далеко!", 82 | gbCardAtmInUse = "Этот банкомат уже используется.", 83 | gbDarkTheme = "Тёмная тема", 84 | gbInterestReceived = "Получен вклад в размере %s.", 85 | gbSalaryToBank = "Зарплата в размере %s была переведена в банк.", 86 | gbDropMoneyOnDeath = "Вы выбросили %s из-за вашей смерти.", 87 | gbCashWithdrawn = "Вы сняли %s.", 88 | gbCashDeposited = "Вы внесли %s.", 89 | gbCashTransferred = "Вы перевели %s игроку %s.", 90 | gbCashTransferReceive = "Игрок %s перевёл %s на ваш счёт.", 91 | gbPaidByCard = "Вы перевели %s %s через терминал.", 92 | gbPaidByCardReceive = "%s перевёл %s на ваш счёт через терминал.", 93 | gbCannotAfford = "Вы не можете себе этого позволить.", 94 | gbInvalidAmount = "Неверная сумма для ввода.", 95 | gbToolName = "Размещение", 96 | gbToolCategory = "Glorified Banking", 97 | gbToolDescription = "Используется для размещения банкомата и его настройки.", 98 | gbToolLeftClick = "Установить банкомат (с сохранением позиции)", 99 | gbToolRightClick = "Удалить банкомат", 100 | gbToolReload = "Применить текущие настройки", 101 | gbToolSignText = "Текст надписи:", 102 | gbToolSignTextHelp = "Текст, отображаемый на вывеске банкомата сверху.", 103 | gbToolWithdrawalFee = "Комиссия за снятие:", 104 | gbToolWithdrawalFeeHelp = "Комиссия за снятие средств в процентах.", 105 | gbToolDepositFee = "Комиссия за внесение:", 106 | gbToolDepositFeeHelp = "Комиссия за внесение средств в процентах.", 107 | gbToolTransferFee = "Комиссия за перевод:", 108 | gbToolTransferFeeHelp = "Комиссия за переводы средств с помощью этого банкомата в процентах.", 109 | gbToolSnap = "Интервал между банкоматами:", 110 | gbToolSnapHelp = "Расстояние между банкоматами.", 111 | gbToolHeight = "Высота:", 112 | gbToolHeightHelp = "Высота от пола, на которой будет размещён банкомат." 113 | } ) 114 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_logs.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | function PANEL:Init() 5 | self.Theme = self:GetParent().Theme 6 | 7 | self.TopBar = vgui.Create("Panel", self) 8 | self.TopBar.Theme = self:GetParent().Theme 9 | self.TopBar.Paint = function(s, w, h) 10 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbTransactionType"), "GlorifiedBanking.AdminMenu.TransactionTypeSelect", self.Back and w * .06 or w * .024, h * .46, self.Theme.Data.Colors.logsMenuTransactionTypeTextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 11 | end 12 | 13 | self.TransactionTypeSelect = vgui.Create("GlorifiedBanking.Dropdown", self.TopBar) 14 | 15 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeAll"), "All") 16 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeWithdrawals"), "Withdrawal") 17 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeDeposits"), "Deposit") 18 | self.TransactionTypeSelect:AddChoice(GlorifiedBanking.i18n.GetPhrase("gbTypeTransfers"), "Transfer") 19 | self.TransactionTypeSelect:ChooseOptionID(1) 20 | 21 | self.TransactionTypeSelect.OnSelect = function(s, index, value, data) 22 | s:SizeToContents() 23 | self:RequestLogs() 24 | end 25 | 26 | self.ScrollPanel = vgui.Create("GlorifiedBanking.ScrollPanel", self) 27 | 28 | self.Paginator = vgui.Create("GlorifiedBanking.Paginator", self) 29 | 30 | self.Paginator.OnPageSelected = function() 31 | self:RequestLogs() 32 | end 33 | 34 | self.Logs = {} 35 | timer.Simple(0, function() 36 | self:RequestLogs() 37 | end) 38 | end 39 | 40 | function PANEL:RequestLogs() 41 | net.Start("GlorifiedBanking.AdminPanel.RequestLogUpdate") 42 | net.WriteUInt(self.Paginator.SelectedPage or 1, 16) 43 | net.WriteUInt(self.Paginator.ItemsPerPage or 20, 6) 44 | net.WriteString(self.TransactionTypeSelect:GetOptionData(self.TransactionTypeSelect:GetSelectedID())) 45 | net.WriteString(self.SteamID or "NONE") 46 | net.SendToServer() 47 | end 48 | 49 | function PANEL:AddLog(logData) 50 | local logid = #self.Logs + 1 51 | 52 | self.Logs[logid] = vgui.Create("GlorifiedBanking.Log", self.ScrollPanel) 53 | self.Logs[logid].Theme = self.Theme 54 | self.Logs[logid]:AddData(logData) 55 | end 56 | 57 | function PANEL:ResetLogs() 58 | self.ScrollPanel:Clear() 59 | table.Empty(self.Logs) 60 | end 61 | 62 | function PANEL:SetSteamID(steamid) 63 | self.SteamID = steamid 64 | 65 | self.Back = vgui.Create("DButton", self.TopBar) 66 | self.Back:SetText("") 67 | 68 | self.Back.Color = self.Theme.Data.Colors.adminMenuNavbarItemCol 69 | self.Back.Paint = function(s, w, h) 70 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.logsMenuBackButtonHoverCol or self.Theme.Data.Colors.logsMenuBackButtonCol) 71 | 72 | local iconSize = h * .8 73 | surface.SetDrawColor(s.Color) 74 | surface.SetMaterial(self.Theme.Data.Materials.chevron) 75 | surface.DrawTexturedRectRotated(w / 2, h / 2, iconSize, iconSize, 180) 76 | end 77 | 78 | self.Back.DoClick = function(s) 79 | self:AlphaTo(0, 0.15, 0, function(anim, panel) 80 | self:Remove() 81 | 82 | local menuPanel = self:GetParent() 83 | menuPanel.Page = vgui.Create("GlorifiedBanking.Players", menuPanel) 84 | menuPanel.Page.CanEditPlayers = menuPanel.CanEditPlayers 85 | menuPanel.Page:Dock(FILL) 86 | menuPanel.Page:SetAlpha(0) 87 | menuPanel.Page:AlphaTo(255, 0.15) 88 | end) 89 | end 90 | 91 | local oldDraw = self.TopBar.Paint 92 | self.TopBar.Paint = function(s, w, h) 93 | oldDraw(s, w, h) 94 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbTransactionLogsFor", steamid), "GlorifiedBanking.AdminMenu.TransactionTypeSelect", w - w * .024, h * .46, self.Theme.Data.Colors.logsMenuTransactionTypeTextCol, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER) 95 | end 96 | end 97 | 98 | function PANEL:PerformLayout(w, h) 99 | self.TopBar:SetSize(w, h * .05) 100 | self.TopBar:Dock(TOP) 101 | 102 | local topOffset = 0 103 | if IsValid(self.Back) then 104 | self.Back:SetSize(h * .032, h * .032) 105 | self.Back:SetPos(w * .018, h * .011) 106 | 107 | topOffset = h * .032 + w * .002 108 | end 109 | 110 | surface.SetFont("GlorifiedBanking.AdminMenu.TransactionTypeSelect") 111 | topOffset = topOffset + surface.GetTextSize(GlorifiedBanking.i18n.GetPhrase("gbTransactionType")) 112 | 113 | self.TransactionTypeSelect:SetSize(w * .1, h * .032) 114 | self.TransactionTypeSelect:SetPos(topOffset + w * .035, h * .011) 115 | self.TransactionTypeSelect:SizeToContents() 116 | 117 | self.ScrollPanel:Dock(FILL) 118 | self.ScrollPanel:DockPadding(0, 0, w * .013, 0) 119 | 120 | if IsValid(self.Paginator) then 121 | self.Paginator:SetSize(w, h * .07) 122 | self.Paginator:Dock(BOTTOM) 123 | end 124 | 125 | local logh = h * .08 126 | local logmarginx, logmarginy = w * .026, h * .008 127 | for k,v in ipairs(self.Logs) do 128 | v:SetHeight(logh) 129 | v:Dock(TOP) 130 | v:DockMargin(logmarginx, logmarginy, logmarginx, logmarginy) 131 | end 132 | end 133 | 134 | vgui.Register("GlorifiedBanking.Logs", PANEL, "Panel") 135 | 136 | net.Receive("GlorifiedBanking.AdminPanel.RequestLogUpdate.SendInfo", function() 137 | local logs = util.JSONToTable(net.ReadLargeString()) 138 | if not logs then return end 139 | 140 | local panel = GlorifiedBanking.UI.AdminMenu.Page 141 | if not panel.ResetLogs then return end 142 | 143 | 144 | if IsValid(panel.Paginator) then 145 | panel.Paginator:SetupPaginator(net.ReadUInt(32)) 146 | end 147 | 148 | panel:ResetLogs() 149 | 150 | for k,v in ipairs(logs) do 151 | panel:AddLog(v) 152 | end 153 | end) 154 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_french.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "fr", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbSystemNameCaps = "GLORIFIEDBANKING", 5 | gbCardReader = "LECTEUR DE CARTE", 6 | gbLoading = "CHARGEMENT", 7 | gbEnterCard = "INSÉREZ VOTRE CARTE", 8 | gbToContinue = "POUR CONTINUER", 9 | gbAtmDisabled = "CETTE MACHINE EST TEMPORAIREMENT DÉSACTIVÉE\nVEUILLEZ NOUS EXCUSER POUR L'INCONVÉNIENT", 10 | gbBackShortly = "NOS SERVICES SERONT DE RETOUR SOUS PEU", 11 | gbWelcomeBack = "BON RETOUR, %s !", 12 | gbAccountBalance = "SOLDE BANCAIRE: %s", 13 | gbBack = "RETOUR", 14 | gbHidden = "CACHÉ", 15 | gbMenuWithdraw = "RETRAIT", 16 | gbMenuDeposit = "DÉPÔT", 17 | gbMenuTransfer = "TRANSFERT", 18 | gbMenuTransactions = "TRANSACTIONS", 19 | gbMenuSettings = "RÉGLAGES", 20 | gbWithdrawAmount = "CHOISISSEZ LE MONTANT QUE VOUS SOUHAITEZ RETIRER", 21 | gbWithdrawalFree = "CE RETRAIT EST GRATUIT", 22 | gbWithdrawalHasFee = "CE RETRAIT AJOUTERA UNE TAXE DE %s%%", 23 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING N'EST PAS RESPONSABLE DES PERTES D'ARGENT APRÈS LE RETRAIT", 24 | gbDepositAmount = "CHOISISSEZ LE MONTANT QUE VOUS SOUHAITEZ DÉPOSER", 25 | gbDepositFree = "CE DÉPÔT EST GRATUIT", 26 | gbDepositHasFee = "CE DÉPÔT AJOUTERA UNE TAXE DE %s%%", 27 | gbDepositDisclaimer = "GLORIFIEDBANKING N'EST PAS RESPONSABLE DES PERTES D'ARGENT APRÈS LE DÉPÔT", 28 | gbTransferFree = "CE TRANSFERT EST GRATUIT", 29 | gbTransferHasFee = "CE TRANSEFERT AJOUTERA UNE TAXE DE %s%%", 30 | gbSelectPlayer = "Veuillez sélectionner un joueur vers lequel vous souhaitez transférer de l'argent.", 31 | gbTransactionTypeAmount = "ENTREZ UN MONTANT", 32 | gbContactingServer = "CONTACT AVEC LE SERVEUR", 33 | gbTakeDispensed = "VEUILLEZ RETIRER L'ARGENT", 34 | gbInsertMoney = "VEUILLEZ INSÉRER L'ARGENT", 35 | gbPleaseWait = "MERCI DE PATIENTER UN MOMENT", 36 | gbCardName = "Carte bancaire GlorifiedBanking", 37 | gbTransactionType = "Type de transaction", 38 | gbTransactionLogsFor = "Logs de transactions de: %s", 39 | gbPlayersOnline = "Joueurs en ligne: %s", 40 | gbSetBalance = "Définir", 41 | gbEnterBalance = "Nouveau solde de %s:", 42 | gbEnter = "Saisissez", 43 | gbConfirmation = "Confirmation", 44 | gbConfirmationBalance = "Voulez-vous réinitialiser le compte de %s ?", 45 | gbYes = "Oui", 46 | gbNo = "Non", 47 | gbPaymentOf = "PAIEMENT DE", 48 | gbToAccount = "À %s", 49 | gbCantPaySelf = "Vous ne pouvez pas vous payer vous même !", 50 | gbNeedCard = "Vous devez avoir votre carte bancaire dans les mains pour faire ce paiement !", 51 | gbConfirm = "CONFIRMER", 52 | gbReaderLoading = "VEUILLEZ PATIENTER", 53 | gbEnterAmount = "ENTREZ LE MONTANT", 54 | gbAdminMenuPlayers = "JOUEURS", 55 | gbAdminMenuLogs = "LOGS", 56 | gbAdminMenuSettings = "RÉGLAGES", 57 | gbAdminMenuLockdown = "MODE VERROUILLAGE", 58 | gbTransactionsTime = "HEURE", 59 | gbTransactionsType = "TYPE", 60 | gbTransactionsUsers = "EXPÉDITEUR", 61 | gbTransactionsTotal = "TOTAL", 62 | gbResetBalance = "Réinitialiser", 63 | gbViewTransactions = "Transactions", 64 | gbTypeAll = "Tout", 65 | gbTypeWithdrawals = "Retraits", 66 | gbTypeDeposits = "Dépôts", 67 | gbTypeTransfers = "Transferts", 68 | gbItemsPerPage = "Lignes par page", 69 | gbLogInfoType = "Type: ", 70 | gbLogInfoTime = "Heure: ", 71 | gbLogInfoDate = "Date: ", 72 | gbCardDesigner = "Éditeur de carte", 73 | gbEnterImgur = "Entrez une ID Imgur:", 74 | gbSave = "Sauvegarder", 75 | gbResetDefaults = "Réinitialiser", 76 | gbCantHaveNegative = "Vous ne pouvez pas établir un solde négatif !", 77 | gbLoggedOutInactive = "Vous avez été déconnecté de l'ATM pour cause d'inactivité.", 78 | gbCardInstructions = "Utilisez le clic gauche pour insérer la carte dans un appareil.", 79 | gbCardInsertAir = "Vous ne pouvez pas insérer la carte dans les airs !", 80 | gbCardCantInsert = "Il n'y a pas de fente pour les cartes !", 81 | gbCardTooFarAway = "C'est trop loin pour y mettre votre carte !", 82 | gbCardAtmInUse = "Cette machine est déjà en cours d'utilisation.", 83 | gbDarkTheme = "Foncé", 84 | gbInterestReceived = "Vous avez reçu un intérêt de %s.", 85 | gbSalaryToBank = "Votre salaire de %s a été transféré à votre banque.", 86 | gbDropMoneyOnDeath = "Vous avez payé %s de frais médicaux.", 87 | gbCashWithdrawn = "Vous avez retiré %s.", 88 | gbCashDeposited = "Vous avez déposé %s.", 89 | gbCashTransferred = "Vous avez transféré %s à %s.", 90 | gbCashTransferReceive = "%s a transféré %s à votre compte.", 91 | gbPaidByCard = "Vous avez payé %s %s en utilisant la carte.", 92 | gbPaidByCardReceive = "%s a payé %s à votre compte en utilisant la carte.", 93 | gbCannotAfford = "Vous ne pouvez pas vous permettre ceci.", 94 | gbInvalidAmount = "Veuillez entrer un montant valide.", 95 | gbToolName = "Placeur d'ATM", 96 | gbToolCategory = "GlorifiedBanking", 97 | gbToolDescription = "Permet de placer des ATM sur les murs et de régler leur paramètres individuels.", 98 | gbToolLeftClick = "Placer un ATM permanent", 99 | gbToolRightClick = "Retirer un ATM permanent", 100 | gbToolReload = "Appliquer des paramètres à un ATM", 101 | gbToolSignText = "Titre de l'ATM:", 102 | gbToolSignTextHelp = "Le text affiché sur le panneau de l'ATM.", 103 | gbToolWithdrawalFee = "Frais de retrait:", 104 | gbToolWithdrawalFeeHelp = "Les frais de transaction pour tous les retraits effectués avec ce distributeur. (en pourcentage)", 105 | gbToolDepositFee = "Frais de dépôt:", 106 | gbToolDepositFeeHelp = "Les frais de transaction pour tous les dépôts effectués avec ce distributeur. (en pourcentage)", 107 | gbToolTransferFee = "Frais de transfert:", 108 | gbToolTransferFeeHelp = "Les frais de transaction pour tous les transferts effectués avec ce distributeur. (en pourcentage)", 109 | gbToolSnap = "Écart:", 110 | gbToolSnapHelp = "La distance entre chaque point d'écart.", 111 | gbToolHeight = "Décalage en hauteur:", 112 | gbToolHeightHelp = "La distance du placement de l'ATM par rapport au sol." 113 | } ) 114 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_english.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "en", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbSystemNameCaps = "GLORIFIEDBANKING", 5 | gbCardReader = "CARD READER", 6 | gbLoading = "LOADING", 7 | gbEnterCard = "ENTER YOUR CARD", 8 | gbToContinue = "TO CONTINUE", 9 | gbAtmDisabled = "THIS ATM HAS BEEN TEMPORARILY DISABLED\nSORRY FOR ANY INCONVENIENCE", 10 | gbBackShortly = "OUR SYSTEMS WILL BE BACK ONLINE SHORTLY", 11 | gbWelcomeBack = "WELCOME BACK, %s!", 12 | gbAccountBalance = "ACCOUNT BALANCE: %s", 13 | gbBack = "BACK", 14 | gbHidden = "HIDDEN", 15 | gbMenuWithdraw = "WITHDRAW", 16 | gbMenuDeposit = "DEPOSIT", 17 | gbMenuTransfer = "TRANSFER", 18 | gbMenuTransactions = "TRANSACTIONS", 19 | gbMenuSettings = "SETTINGS", 20 | gbWithdrawAmount = "SELECT AN AMOUNT YOU WOULD LIKE TO WITHDRAW", 21 | gbWithdrawalFree = "THIS WITHDRAWAL IS FREE", 22 | gbWithdrawalHasFee = "THIS WITHDRAWAL WILL HAVE A %s%% FEE ADDED", 23 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING IS NOT RESPONSIBLE FOR LOSS OF MONEY AFTER WITHDRAWAL", 24 | gbDepositAmount = "SELECT AN AMOUNT YOU WOULD LIKE TO DEPOSIT", 25 | gbDepositFree = "THIS DEPOSIT IS FREE", 26 | gbDepositHasFee = "THIS DEPOSIT WILL HAVE A %s%% FEE ADDED", 27 | gbDepositDisclaimer = "GLORIFIEDBANKING IS NOT RESPONSIBLE FOR LOSS OF MONEY AFTER DEPOSIT", 28 | gbTransferFree = "THIS TRANSFER IS FREE", 29 | gbTransferHasFee = "THIS TRANSFER WILL HAVE A %s%% FEE ADDED", 30 | gbSelectPlayer = "Please select a player to transfer money to.", 31 | gbTransactionTypeAmount = "TYPE AN AMOUNT", 32 | gbContactingServer = "CONTACTING SERVER", 33 | gbTakeDispensed = "PLEASE TAKE THE MONEY DISPENSED", 34 | gbInsertMoney = "PLEASE INSERT THE MONEY TO DEPOSIT", 35 | gbPleaseWait = "PLEASE WAIT A MOMENT", 36 | gbCardName = "GlorifiedBanking Card", 37 | gbTransactionType = "Transaction Type", 38 | gbTransactionLogsFor = "Transaction logs for: %s", 39 | gbPlayersOnline = "Players online: %s", 40 | gbSetBalance = "Set Balance", 41 | gbEnterBalance = "Enter a new balance for %s:", 42 | gbEnter = "Enter", 43 | gbConfirmation = "Confirmation", 44 | gbConfirmationBalance = "Do want to reset %s's balance?", 45 | gbYes = "Yes", 46 | gbNo = "No", 47 | gbCancel = "CANCEL", 48 | gbPaymentOf = "PAYMENT OF", 49 | gbToAccount = "TO %s", 50 | gbPleasePresent = "PLEASE PRESENT YOUR\n PAYMENT DEVICE", 51 | gbCantPaySelf = "You can't pay yourself!", 52 | gbCantPayOther = "You can't pay another's transaction!", 53 | gbCantCancelOthers = "You can't cancel another's transaction!", 54 | gbOnlyMerchantCancel = "Only the merchant can cancel the transaction!", 55 | gbNeedCard = "You need a payment device in hand to make this payment!", 56 | gbConfirm = "CONFIRM", 57 | gbReaderLoading = "PLEASE WAIT", 58 | gbEnterAmount = "ENTER AMOUNT", 59 | gbAdminMenuPlayers = "PLAYERS", 60 | gbAdminMenuLogs = "LOGS", 61 | gbAdminMenuSettings = "SETTINGS", 62 | gbAdminMenuLockdown = "LOCKDOWN MODE", 63 | gbTransactionsTime = "TIME", 64 | gbTransactionsType = "TYPE", 65 | gbTransactionsUsers = "SENDER", 66 | gbTransactionsTotal = "TOTAL", 67 | gbResetBalance = "Reset Balance", 68 | gbViewTransactions = "Transactions", 69 | gbTypeAll = "All", 70 | gbTypeWithdrawals = "Withdrawals", 71 | gbTypeDeposits = "Deposits", 72 | gbTypeTransfers = "Transfers", 73 | gbItemsPerPage = "Items Per Page", 74 | gbLogInfoType = "Type: ", 75 | gbLogInfoTime = "Time: ", 76 | gbLogInfoDate = "Date: ", 77 | gbCardDesigner = "Card Designer", 78 | gbEnterImgur = "Enter an Imgur ID:", 79 | gbSave = "Save", 80 | gbResetDefaults = "Reset To Defaults", 81 | gbCantHaveNegative = "You can't set a negative balance!", 82 | gbLoggedOutInactive = "You have been logged out of the ATM due to inactivity.", 83 | gbCardInstructions = "Use left click to insert the card into a device.", 84 | gbCardInsertAir = "You can't insert the card into the air!", 85 | gbCardCantInsert = "That doesn't have a card slot!", 86 | gbCardTooFarAway = "That is too far away to insert your card!", 87 | gbCardAtmInUse = "This ATM is currently in use.", 88 | gbDarkTheme = "Dark", 89 | gbInterestReceived = "You received %s in interest.", 90 | gbSalaryToBank = "Your salary of %s was transferred to your bank.", 91 | gbDropMoneyOnDeath = "You paid %s in hospital bills.", 92 | gbCashWithdrawn = "You withdrew %s.", 93 | gbCashDeposited = "You deposited %s.", 94 | gbCashTransferred = "You transferred %s to %s.", 95 | gbCashTransferReceive = "%s transferred %s to your account.", 96 | gbPaidByCard = "You paid %s %s via card.", 97 | gbPaidByCardReceive = "%s paid %s to your account via card.", 98 | gbCannotAfford = "You cannot afford that.", 99 | gbInvalidAmount = "Please enter a valid amount.", 100 | gbToolName = "ATM Placer", 101 | gbToolCategory = "GlorifiedBanking", 102 | gbToolDescription = "Used to place ATMs on the wall and configure their individual settings.", 103 | gbToolLeftClick = "Place a permanent ATM", 104 | gbToolRightClick = "Remove a permanent ATM", 105 | gbToolReload = "Apply settings to an ATM", 106 | gbToolSignText = "Sign Text:", 107 | gbToolSignTextHelp = "The text displayed on the ATM sign.", 108 | gbToolWithdrawalFee = "Withdrawal Fee:", 109 | gbToolWithdrawalFeeHelp = "The transaction fee for all withdrawals made with this ATM in percent.", 110 | gbToolDepositFee = "Deposit Fee:", 111 | gbToolDepositFeeHelp = "The transaction fee for all deposits made with this ATM in percent.", 112 | gbToolTransferFee = "Transfer Fee:", 113 | gbToolTransferFeeHelp = "The transaction fee for all transfers made with this ATM in percent.", 114 | gbToolSnap = "Snap Amount:", 115 | gbToolSnapHelp = "The distance between each snapping point.", 116 | gbToolXOffset = "X Offset:", 117 | gbToolXOffsetHelp = "The offset on the X axis.", 118 | gbToolYOffset = "Y Offset:", 119 | gbToolYOffsetHelp = "The offset on the Y axis.", 120 | gbToolZOffset = "Z Offset:", 121 | gbToolZOffsetHelp = "The offset on the Z axis.", 122 | gbWireToolName = "Card Reader Controller", 123 | gbWireToolDesc = "Spawn/link a card reader controller.", 124 | gbWireToolStep1 = "Primary: Create card reader controller. Secondary: Link controller.", 125 | gbWireToolStep2 = "Now select a card reader to link to.", 126 | gbOnlyLinkReaders = "You can only link card readers to the controller." 127 | } ) 128 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/libraries/sv_glorifiedbanking_gpe.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | GlorifiedPersistentEnts - A library to make persistent entities painless for specific addons 4 | Read more @ https://github.com/GlorifiedPig/gpe 5 | ]]-- 6 | 7 | local gpeVersion = 1.4 8 | 9 | if not GlorifiedPersistentEnts or not gpeVersion or not GlorifiedPersistentEnts.Version or GlorifiedPersistentEnts.Version < gpeVersion then 10 | GlorifiedPersistentEnts = { 11 | Version = giVersion, 12 | EntClasses = {}, 13 | ShutdownCalled = false 14 | } 15 | 16 | sql.Query( "CREATE TABLE IF NOT EXISTS `gpe` ( `Class` VARCHAR(48) NOT NULL , `Map` VARCHAR(64) NOT NULL , `PosInfo` JSON NOT NULL, `NetworkVars` JSON )" ) 17 | 18 | function GlorifiedPersistentEnts.SaveEntityData( ent ) 19 | if not GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then return end 20 | 21 | local entData = {} 22 | entData.Class = ent:GetClass() 23 | entData.Map = game.GetMap() 24 | entData.PosInfo = util.TableToJSON( { 25 | Pos = ent:GetPos(), 26 | Angles = ent:GetAngles() 27 | } ) 28 | entData.NetworkVars = util.TableToJSON( ent:GetNetworkVars() ) 29 | 30 | if ent.GPE_EntID != nil then 31 | sql.Query( "UPDATE `gpe` SET `PosInfo` = '" .. entData.PosInfo .. "', `NetworkVars` = '" .. entData.NetworkVars .. "' WHERE `RowID` = " .. ent.GPE_EntID ) 32 | else 33 | sql.Query( "INSERT INTO `gpe` ( `Class`, `Map`, `PosInfo`, `NetworkVars` ) VALUES ( '" .. entData.Class .. "', '" .. entData.Map .. "', '" .. entData.PosInfo .. "', '" .. entData.NetworkVars .. "' )" ) 34 | local lastRowID = sql.Query( "SELECT last_insert_rowid() AS last_insert" )[1].last_insert 35 | ent.GPE_EntID = lastRowID 36 | end 37 | end 38 | 39 | function GlorifiedPersistentEnts.RemoveEntityFromDB( ent ) 40 | if not GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then return end 41 | if ent.GPE_EntID != nil then 42 | print( "[GlorifiedPersistentEnts] Deleted Entity ID " .. ent.GPE_EntID .. " from GPE table" ) 43 | sql.Query( "DELETE FROM `gpe` WHERE `RowID` = " .. ent.GPE_EntID ) 44 | SafeRemoveEntity( ent ) 45 | end 46 | end 47 | 48 | function GlorifiedPersistentEnts.ClearDataByClass( class ) 49 | print( "[GlorifiedPersistentEnts] Cleared GPE table" ) 50 | sql.Query( "DELETE FROM `gpe` WHERE `Class` = '" .. class .. "'") 51 | for k, v in pairs( ents.FindByClass( class ) ) do 52 | SafeRemoveEntity( v ) 53 | end 54 | end 55 | 56 | function GlorifiedPersistentEnts.LoadEntities() 57 | local queryResult = sql.Query( "SELECT * FROM `gpe`" ) 58 | if queryResult == nil or not istable( queryResult ) then return end 59 | for k, v in pairs( queryResult ) do 60 | if v["Map"] != game.GetMap() then continue end 61 | local gpeEntityInfo = util.JSONToTable( v["PosInfo"] ) 62 | local gpeEntity = ents.Create( v["Class"] ) 63 | gpeEntity:SetPos( gpeEntityInfo.Pos ) 64 | gpeEntity:SetAngles( gpeEntityInfo.Angles ) 65 | gpeEntity:Spawn() 66 | if gpeEntity:GetPhysicsObject():IsValid() then 67 | gpeEntity:GetPhysicsObject():EnableMotion( false ) 68 | end 69 | gpeEntity.GPE_EntID = k 70 | 71 | local networkVars = util.JSONToTable( v["NetworkVars"] ) 72 | for k2, v2 in pairs( networkVars ) do 73 | if not isfunction( gpeEntity["Set" .. k2] ) then continue end 74 | gpeEntity["Set" .. k2]( gpeEntity, v2 ) 75 | end 76 | end 77 | end 78 | 79 | function GlorifiedPersistentEnts.AddEntClassToTable( entClass ) 80 | GlorifiedPersistentEnts.EntClasses[entClass] = true 81 | end 82 | 83 | hook.Add( "OnPhysgunFreeze", "GPE.OnPhysgunFreeze", function( wep, physObj, ent, ply ) 84 | if GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then 85 | GlorifiedPersistentEnts.SaveEntityData( ent ) 86 | end 87 | end ) 88 | 89 | hook.Add( "PhysgunDrop", "GPE.PhysgunDrop", function( ply, ent ) 90 | if GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then 91 | GlorifiedPersistentEnts.SaveEntityData( ent ) 92 | end 93 | end ) 94 | 95 | hook.Add( "PlayerSpawnedSENT", "GPE.PlayerSpawnedSENT", function( ply, ent ) 96 | if GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then 97 | GlorifiedPersistentEnts.SaveEntityData( ent ) 98 | end 99 | end ) 100 | 101 | hook.Add( "InitPostEntity", "GPE.InitPostEntity", GlorifiedPersistentEnts.LoadEntities ) 102 | hook.Add( "PostCleanupMap", "GPE.PostCleanupMap", GlorifiedPersistentEnts.LoadEntities ) 103 | 104 | concommand.Add( "gpe_removeents", function( ply ) 105 | if ply == NULL or ply:IsSuperAdmin() then 106 | print( "[GlorifiedPersistentEnts] Cleared GPE table." ) 107 | sql.Query( "DELETE FROM `gpe`") 108 | for k, v in pairs( GlorifiedPersistentEnts.EntClasses ) do 109 | for k2, v2 in pairs( ents.FindByClass( k ) ) do 110 | SafeRemoveEntity( v2 ) 111 | end 112 | end 113 | end 114 | end ) 115 | 116 | concommand.Add( "gpe_removeent", function( ply ) 117 | if IsValid( ply ) and ply:IsSuperAdmin() then 118 | local lookingAtEnt = ply:GetEyeTrace().Entity 119 | if IsValid( lookingAtEnt ) and GlorifiedPersistentEnts.EntClasses[lookingAtEnt:GetClass()] then 120 | GlorifiedPersistentEnts.RemoveEntityFromDB( lookingAtEnt ) 121 | end 122 | end 123 | end ) 124 | 125 | concommand.Add( "gpe_saveents", function( ply ) 126 | if ply == NULL or ply:IsSuperAdmin() then 127 | print( "[GlorifiedPersistentEnts] Saved all GPE entities." ) 128 | for k, v in pairs( GlorifiedPersistentEnts.EntClasses ) do 129 | for k2, v2 in pairs( ents.FindByClass( k ) ) do 130 | GlorifiedPersistentEnts.SaveEntityData( v2 ) 131 | end 132 | end 133 | end 134 | end ) 135 | 136 | hook.Add( "ShutDown", "GlorifiedPersistentEnts.ServerShutdown", function() 137 | GlorifiedPersistentEnts.ShutdownCalled = true 138 | end ) 139 | 140 | hook.Add( "EntityRemoved", "GlorifiedPersistentEnts.EntityRemoved", function( ent ) 141 | if GlorifiedPersistentEnts.ShutdownCalled then return end 142 | if IsValid( ent ) and GlorifiedPersistentEnts.EntClasses[ent:GetClass()] then 143 | GlorifiedPersistentEnts.RemoveEntityFromDB( ent ) 144 | end 145 | end ) 146 | end 147 | 148 | GlorifiedPersistentEnts.AddEntClassToTable( "glorifiedbanking_atm" ) -------------------------------------------------------------------------------- /lua/glorifiedbanking/localization/sh_glorifiedbanking_turkish.lua: -------------------------------------------------------------------------------- 1 | 2 | GlorifiedBanking.i18n.RegisterPhrases( "tr", { 3 | gbSystemName = "GlorifiedBanking", 4 | gbSystemNameCaps = "GLORIFIEDBANKING", 5 | gbCardReader = "KART OKUYUCU", 6 | gbLoading = "YUKLENIYOR", 7 | gbEnterCard = "KARTINIZI GIRINIZ", 8 | gbToContinue = "DEVAM ETMEK ICIN", 9 | gbAtmDisabled = "ATM GECICI OLARAK DEVRE DISIDIR\n VERDIGIMIZ RAHATSIZLIKTAN DOLAYI OZUR DILERIZ", 10 | gbBackShortly = "SISTEMIMIZ KISA BIR SURE SONRA DUZELICEKTIR. LUTFEN BEKLEYINIZ", 11 | gbWelcomeBack = "HOS GELDIN, %s!", 12 | gbAccountBalance = "HESAP BAKIYESI: %s", 13 | gbBack = "GERI", 14 | gbHidden = "GIZLI", 15 | gbMenuWithdraw = "PARA CEK", 16 | gbMenuDeposit = "PARA YATIR", 17 | gbMenuTransfer = "HAVALE", 18 | gbMenuTransactions = "ISLEMLER", 19 | gbMenuSettings = "AYARLAR", 20 | gbWithdrawAmount = "CEKMEK ISTEDIGINIZ PARA MIKTARINI GIRINIZ", 21 | gbWithdrawalFree = "YAPICAGINIZ PARA CEKME ISLEMI UCRETSIZ", 22 | gbWithdrawalHasFee = "YAPICAGINIZ PARA CEKME ISLEMINE EKSTRA %s%% UCRET EKLENDI", 23 | gbWithdrawalDisclaimer = "GLORIFIEDBANKING PARA CEKTIKTEN SONRA KAYBETTIGINIZ PARADAN SORUMLU DEGILDIR", 24 | gbDepositAmount = "YATIRMAK ISTEDIGINIZ PARA MIKTARINI SECINIZ", 25 | gbDepositFree = "YAPICAGINIZ PARA YATIRMA ISLEMI UCRETSIZ", 26 | gbDepositHasFee = "YAPICAGINIZ PARA YATIRMA ISLEMINE EKSTRA %s%% UCRET EKLENDI", 27 | gbDepositDisclaimer = "GLORIFIEDBANKING PARA YATIRDIKTAN SONRA KAYBETTIGINIZ PARALARDAN SORUMLU DEGILDIR", 28 | gbTransferFree = "YAPICAGINIZ PARA TRANSFER ISLEMI UCRETSIZ", 29 | gbTransferHasFee = "YAPICAGINIZ PARA TRANSFER ISLEMINE EKSTRA %s%% UCRET EKLENDI", 30 | gbSelectPlayer = "Lütfen para aktaracağınız kişiyi seçiniz.", 31 | gbTransactionTypeAmount = "MIKTAR GIRINIZ", 32 | gbContactingServer = "BANKA SISTEMINE ULASILIYOR", 33 | gbTakeDispensed = "LUTFEN CEKTIGINIZ PARAYI ALINIZ ", 34 | gbInsertMoney = "LUTFEN YATIRACAGINIZ PARAYI ATMYE SOKUN", 35 | gbPleaseWait = "LUTFEN BEKLEYINIZ", 36 | gbCardName = "GLORIFIEDBANKING Banka Kartı", 37 | gbTransactionType = "İşlem Tipi", 38 | gbTransactionLogsFor = "İşlem kayıtları : %s", 39 | gbPlayersOnline = "Aktif Oyuncu Sayısı: %s", 40 | gbSetBalance = "Bakiyeyi Ayarla", 41 | gbEnterBalance = "Yeni bakiyeyi ayarlamak icin %s:", 42 | gbEnter = "Giriş", 43 | gbConfirmation = "Onayla", 44 | gbConfirmationBalance = "%s'nin bakiyesini sıfırlamak istedigine emin misin??", 45 | gbYes = "Evet", 46 | gbNo = "Hayır", 47 | gbCancel = "IPTAL", 48 | gbPaymentOf = "ODEME", 49 | gbToAccount = "SU HESABA %s", 50 | gbPleasePresent = "LÜTFEN\n ÖDEME CİHAZINIZI SECINIZ", 51 | gbCantPaySelf = "Kendinize ödeme yapamazsınız!", 52 | gbCantPayOther = "Başkasının işlemini ödeyemezsiniz!", 53 | gbCantCancelOthers = "Başka birinin işlemini iptal edemezsiniz!", 54 | gbOnlyMerchantCancel = "İşlemi yalnızca satıcı iptal edebilir!", 55 | gbNeedCard = "Bu ödemeyi yapmak için bir ödeme cihazına ihtiyacınız var!", 56 | gbConfirm = "ONAYLA", 57 | gbReaderLoading = "LUTFEN BEKLEYIN", 58 | gbEnterAmount = "MIKTARI GIRINIZ", 59 | gbAdminMenuPlayers = "OYUNCULAR", 60 | gbAdminMenuLogs = "KAYITLAR", 61 | gbAdminMenuSettings = "AYARLAR", 62 | gbAdminMenuLockdown = "KILITLEME MODU", 63 | gbTransactionsTime = "ZAMAN", 64 | gbTransactionsType = "HAVALE TÜRÜ", 65 | gbTransactionsUsers = "GÖNDEREN", 66 | gbTransactionsTotal = "TOPLAM", 67 | gbResetBalance = "Bakiyeyi Sıfırla", 68 | gbViewTransactions = "Havale İşlemleri", 69 | gbTypeAll = "Hepsi", 70 | gbTypeWithdrawals = "Para çekimleri", 71 | gbTypeDeposits = "Para yatırma(lar)", 72 | gbTypeTransfers = "Havaleler", 73 | gbItemsPerPage = "Eşya başına sayfa", 74 | gbLogInfoType = "Tür: ", 75 | gbLogInfoTime = "Zaman: ", 76 | gbLogInfoDate = "Tarih: ", 77 | gbCardDesigner = "Kart Tasarımcısı", 78 | gbEnterImgur = "Imgur ID Gir:", 79 | gbSave = "Kaydet", 80 | gbResetDefaults = "Varsayılana sıfırla", 81 | gbCantHaveNegative = "Negatif bir değer giremezsiniz!", 82 | gbLoggedOutInactive = "Haraketsizliğinizden dolayı ATM'den çıkış yaptınız.", 83 | gbCardInstructions = "Sol tıka basarak Banka Kartınızı ATM'ye sokabilirsiniz.", 84 | gbCardInsertAir = "Banka Kartınızı havaya yerleştiremezsiniz!", 85 | gbCardCantInsert = "Bu objenin, kart sokulacak bir yeri yok!", 86 | gbCardTooFarAway = "Bu obje, karti kullanmak icin cok uzak", 87 | gbCardAtmInUse = "ATM başka biri tarafından kullanılıyor..", 88 | gbDarkTheme = "Karanlık", 89 | gbInterestReceived = "%s kadar miktarı faizden elde ettin.", 90 | gbSalaryToBank = "%s maaşın bankaya yatırıldı.", 91 | gbDropMoneyOnDeath = "%s kadar hastane masrafı ödedin.", 92 | gbCashWithdrawn = "%s kadar para çektin.", 93 | gbCashDeposited = "%s kadar para yatırdın.", 94 | gbCashTransferred = " %s kadar miktar parayı, %s kişisine aktardın.", 95 | gbCashTransferReceive = "%s hesabına %s miktar para gönderdi.", 96 | gbPaidByCard = "%s %s kartla ödedin", 97 | gbPaidByCardReceive = "%s senin %s hesabina kart ile ödedi.", 98 | gbCannotAfford = "Bunu karşılayamazsın.", 99 | gbInvalidAmount = "Lütfen geçerli bir miktar giriniz.", 100 | gbToolName = "ATM Yerlestirici", 101 | gbToolCategory = "GLORIFIEDBANKING", 102 | gbToolDescription = "ATM'leri duvara yerlestirip ozelliklerini ayarlamaya yarar.", 103 | gbToolLeftClick = "Kalici bir ATM yerlestir", 104 | gbToolRightClick = "Kalici ATM'yi sil", 105 | gbToolReload = "ATM'ye yapilan degisiklikleri kaydet", 106 | gbToolSignText = "ATM üstünde bulunacak yazı:", 107 | gbToolSignTextHelp = "ATM'nin üstünde bulunacak yazı.", 108 | gbToolWithdrawalFee = "Para Çekme Ücreti:", 109 | gbToolWithdrawalFeeHelp = "Para cekme isleminden alinan ekstra para.", 110 | gbToolDepositFee = "Para Yatırma Ücreti:", 111 | gbToolDepositFeeHelp = "Para Yatırma islemlerinden alinan ekstra para.", 112 | gbToolTransferFee = "Havale Ücreti:", 113 | gbToolTransferFeeHelp = "Para transferi işlemlerinden alınan ekstra para..", 114 | gbToolSnap = "Hizalama Miktari:", 115 | gbToolSnapHelp = "Hizalanan noktalar arasindaki mesafe.", 116 | gbToolXOffset = "X Denkleştirmek:", 117 | gbToolXOffsetHelp = "Y eksenindeki ofset.", 118 | gbToolYOffset = "Y Denkleştirmek:", 119 | gbToolYOffsetHelp = "Y eksenindeki ofset.", 120 | gbToolZOffset = "Z Denkleştirmek:", 121 | gbToolZOffsetHelp = "Z eksenindeki ofset", 122 | gbWireToolName = "Kart Okuyucu Kontrolleri", 123 | gbWireToolDesc = "Yarat/link kart okuyucu.", 124 | gbWireToolStep1 = "Birincil: Kart okuyucu denetleyicisi oluşturun. İkincil: Bağlantı denetleyicisi.", 125 | gbWireToolStep2 = "Şimdi bağlantı kurulacak bir kart okuyucu seçin.", 126 | gbOnlyLinkReaders = "Kart okuyucuları yalnızca denetleyiciye bağlayabilirsiniz." 127 | } ) 128 | -------------------------------------------------------------------------------- /lua/autorun/sh_glorifiedbanking_resources.lua: -------------------------------------------------------------------------------- 1 | 2 | local atmSoundLevel = 50 3 | 4 | sound.Add({ 5 | name = "GlorifiedBanking.Key_Press", 6 | channel = CHAN_AUTO, 7 | volume = 1.0, 8 | level = atmSoundLevel, 9 | pitch = 100, 10 | sound = "glorified_banking/key_press.mp3" 11 | }) 12 | 13 | sound.Add({ 14 | name = "GlorifiedBanking.Beep_Normal", 15 | channel = CHAN_AUTO, 16 | volume = 1.0, 17 | level = atmSoundLevel, 18 | pitch = 100, 19 | sound = "glorified_banking/beep_normal.mp3" 20 | }) 21 | 22 | sound.Add({ 23 | name = "GlorifiedBanking.Beep_Attention", 24 | channel = CHAN_AUTO, 25 | volume = 1.0, 26 | level = atmSoundLevel, 27 | pitch = 100, 28 | sound = "glorified_banking/beep_attention.mp3" 29 | }) 30 | 31 | sound.Add({ 32 | name = "GlorifiedBanking.Beep_Error", 33 | channel = CHAN_AUTO, 34 | volume = 1.0, 35 | level = atmSoundLevel, 36 | pitch = 100, 37 | sound = "glorified_banking/beep_error.mp3" 38 | }) 39 | 40 | sound.Add({ 41 | name = "GlorifiedBanking.Card_Insert", 42 | channel = CHAN_AUTO, 43 | volume = 1.0, 44 | level = atmSoundLevel, 45 | pitch = 100, 46 | sound = "glorified_banking/card_insert.mp3" 47 | }) 48 | 49 | sound.Add({ 50 | name = "GlorifiedBanking.Card_Remove", 51 | channel = CHAN_AUTO, 52 | volume = 1.0, 53 | level = atmSoundLevel, 54 | pitch = 100, 55 | sound = "glorified_banking/card_remove.mp3" 56 | }) 57 | 58 | sound.Add({ 59 | name = "GlorifiedBanking.Money_In_Start", 60 | channel = CHAN_AUTO, 61 | volume = 1.0, 62 | level = atmSoundLevel, 63 | pitch = 100, 64 | sound = "glorified_banking/money_in_start.mp3" 65 | }) 66 | 67 | sound.Add({ 68 | name = "GlorifiedBanking.Money_In_Loop", 69 | channel = CHAN_AUTO, 70 | volume = 1.0, 71 | level = atmSoundLevel, 72 | pitch = 100, 73 | sound = "glorified_banking/money_in_loop.wav" 74 | }) 75 | 76 | sound.Add({ 77 | name = "GlorifiedBanking.Money_In_Finish", 78 | channel = CHAN_AUTO, 79 | volume = 1.0, 80 | level = atmSoundLevel, 81 | pitch = 100, 82 | sound = "glorified_banking/money_in_finish.mp3" 83 | }) 84 | 85 | sound.Add({ 86 | name = "GlorifiedBanking.Money_Out", 87 | channel = CHAN_AUTO, 88 | volume = 1.0, 89 | level = atmSoundLevel, 90 | pitch = 100, 91 | sound = "glorified_banking/money_out.mp3" 92 | }) 93 | 94 | local readerSoundlevel = 40 95 | 96 | sound.Add({ 97 | name = "GlorifiedBanking.Beep_Reader_Normal", 98 | channel = CHAN_AUTO, 99 | volume = 1.0, 100 | level = readerSoundlevel, 101 | pitch = 60, 102 | sound = "glorified_banking/beep_normal.mp3" 103 | }) 104 | 105 | sound.Add({ 106 | name = "GlorifiedBanking.Beep_Reader_Error", 107 | channel = CHAN_AUTO, 108 | volume = 1.0, 109 | level = readerSoundlevel, 110 | pitch = 60, 111 | sound = "glorified_banking/beep_error.mp3" 112 | }) 113 | 114 | if SERVER then 115 | AddCSLuaFile() 116 | 117 | if not GlorifiedBanking.Config.USE_FASTDL then 118 | resource.AddWorkshop( "2101502704" ) 119 | return 120 | end 121 | 122 | --Sounds 123 | resource.AddFile("sound/glorified_banking/beep_attention.mp3") 124 | resource.AddFile("sound/glorified_banking/beep_error.mp3") 125 | resource.AddFile("sound/glorified_banking/beep_normal.mp3") 126 | resource.AddFile("sound/glorified_banking/beep_reader_normal.mp3") 127 | resource.AddFile("sound/glorified_banking/beep_reader_error.mp3") 128 | resource.AddFile("sound/glorified_banking/card_insert.mp3") 129 | resource.AddFile("sound/glorified_banking/card_remove.mp3") 130 | resource.AddFile("sound/glorified_banking/key_press.mp3") 131 | resource.AddFile("sound/glorified_banking/money_in_finish.mp3") 132 | resource.AddFile("sound/glorified_banking/money_in_loop.mp3") 133 | resource.AddFile("sound/glorified_banking/money_in_start.mp3") 134 | resource.AddFile("sound/glorified_banking/money_out.mp3") 135 | 136 | --Models 137 | resource.AddFile("models/sterling/glorifiedpig_atm.dx80.vtx") 138 | resource.AddFile("models/sterling/glorifiedpig_atm.dx90.vtx") 139 | resource.AddFile("models/sterling/glorifiedpig_atm.mdl") 140 | resource.AddFile("models/sterling/glorifiedpig_atm.phy") 141 | resource.AddFile("models/sterling/glorifiedpig_atm.sw.vtx") 142 | resource.AddFile("models/sterling/glorifiedpig_atm.vvd") 143 | resource.AddFile("models/sterling/glorifiedpig_cardreader.dx80.vtx") 144 | resource.AddFile("models/sterling/glorifiedpig_cardreader.dx90.vtx") 145 | resource.AddFile("models/sterling/glorifiedpig_cardreader.mdl") 146 | resource.AddFile("models/sterling/glorifiedpig_cardreader.phy") 147 | resource.AddFile("models/sterling/glorifiedpig_cardreader.sw.vtx") 148 | resource.AddFile("models/sterling/glorifiedpig_cardreader.vvd") 149 | 150 | --Model Materials 151 | resource.AddFile("materials/sterling/glorifiedpig_atm_lightmask.vtf") 152 | resource.AddFile("materials/sterling/glorifiedpig_atm_lights.vmt") 153 | resource.AddFile("materials/sterling/glorifiedpig_atm_lights.vtf") 154 | resource.AddFile("materials/sterling/glorifiedpig_atm_main.vmt") 155 | resource.AddFile("materials/sterling/glorifiedpig_atm_main.vtf") 156 | resource.AddFile("materials/sterling/glorifiedpig_atm_norm.vtf") 157 | resource.AddFile("materials/sterling/glorifiedpig_cardreader_main.vmt") 158 | resource.AddFile("materials/sterling/glorifiedpig_cardreader_main.vtf") 159 | resource.AddFile("materials/sterling/glorifiedpig_cardreader_norm.vtf") 160 | resource.AddFile("materials/sterling/glorifiedpig_rgb_lights.vmt") 161 | resource.AddFile("materials/sterling/glorifiedpig_rgb_lights.vtf") 162 | 163 | --UI Materials 164 | resource.AddFile("materials/glorified_banking/back.png") 165 | resource.AddFile("materials/glorified_banking/bank_card.png") 166 | resource.AddFile("materials/glorified_banking/check.png") 167 | resource.AddFile("materials/glorified_banking/chevron.png") 168 | resource.AddFile("materials/glorified_banking/circle.png") 169 | resource.AddFile("materials/glorified_banking/close.png") 170 | resource.AddFile("materials/glorified_banking/cursor.png") 171 | resource.AddFile("materials/glorified_banking/cursor_hover.png") 172 | resource.AddFile("materials/glorified_banking/exit.png") 173 | resource.AddFile("materials/glorified_banking/lockdown.png") 174 | resource.AddFile("materials/glorified_banking/logo_small.png") 175 | resource.AddFile("materials/glorified_banking/money.png") 176 | resource.AddFile("materials/glorified_banking/player.png") 177 | resource.AddFile("materials/glorified_banking/transaction.png") 178 | resource.AddFile("materials/glorified_banking/transfer.png") 179 | resource.AddFile("materials/glorified_banking/user.png") 180 | resource.AddFile("materials/glorified_banking/warning.png") 181 | resource.AddFile("materials/glorified_banking/loading_spinner.png") 182 | 183 | --Slideshow Materials 184 | resource.AddFile("materials/glorified_banking/slideshow/bank.png") 185 | resource.AddFile("materials/glorified_banking/slideshow/robbery.png") 186 | resource.AddFile("materials/glorified_banking/slideshow/transaction.png") 187 | 188 | --Fonts 189 | resource.AddFile("resource/fonts/montserratregular.ttf") 190 | resource.AddFile("resource/fonts/orbitronregular.ttf") 191 | resource.AddFile("resource/fonts/subwayticker.ttf") 192 | end 193 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/core/sv_glorifiedbanking_playermeta.lua: -------------------------------------------------------------------------------- 1 | 2 | local function minClamp( num, minimum ) 3 | return math.max( minimum, num ) 4 | end 5 | 6 | -- A few validation checks just in case anything slips through. 7 | local function ValidationChecks( ply, balance ) 8 | return not ( GlorifiedBanking.LockdownEnabled 9 | or not balance 10 | or balance == nil 11 | or balance < 0 12 | or not ply:IsValid() 13 | or ply:IsBot() 14 | or not ply:IsFullyAuthenticated() 15 | or not ply:IsConnected() ) 16 | end 17 | 18 | function GlorifiedBanking.SetPlayerBalance( ply, balance ) 19 | if not ValidationChecks( ply, balance ) then return end -- Always validate before doing important functions to keep things secure. 20 | balance = tonumber( balance ) -- Make sure to convert "500" to 500, just in case some function provides a string for whatever reason. 21 | balance = math.Round( balance ) -- Make sure the balance is always rounded to an integer, we don't want floats slipping through. 22 | balance = minClamp( balance, 0 ) -- Make sure the balance never goes below zero. 23 | if not ply.GlorifiedBanking then ply.GlorifiedBanking = {} end -- Initialize the player's GlorifiedBanking table if it doesn't already exist. 24 | hook.Run( "GlorifiedBanking.PlayerBalanceUpdated", ply, GlorifiedBanking.GetPlayerBalance( ply ), balance ) -- Args are ply, oldBalance and then newBalance. Documented in the markdown file. 25 | GlorifiedBanking.SQL.Query( "UPDATE `gb_players` SET `Balance` = '" .. balance .. "' WHERE `SteamID` = '" .. ply:SteamID64() .. "'" ) -- Update the player's SQL data. 26 | ply.GlorifiedBanking.Balance = balance -- Cache the balance for easier usage elsewhere without the need to call another SQL query. 27 | ply:SetNW2String( "GlorifiedBanking.Balance", tostring( balance ) ) -- Set the networked balance so we don't have to include it in the net messages later. 28 | end 29 | 30 | function GlorifiedBanking.SetPlayerBalanceBySteamID( steamID, balance ) 31 | if not balance or balance == nil or balance < 0 then return end 32 | balance = tonumber( balance ) 33 | balance = math.Round( balance ) 34 | balance = minClamp( balance, 0 ) 35 | local plyFromSteamID64 = player.GetBySteamID64( steamID ) 36 | if plyFromSteamID64 then 37 | GlorifiedBanking.SetPlayerBalance( plyFromSteamID64, balance ) 38 | else 39 | GlorifiedBanking.SQL.Query( "UPDATE `gb_players` SET `Balance` = '" .. balance .. "' WHERE `SteamID` = '" .. steamID .. "'" ) -- Update the player's SQL data. 40 | end 41 | end 42 | 43 | function GlorifiedBanking.GetPlayerBalance( ply ) 44 | if not ply.GlorifiedBanking then ply.GlorifiedBanking = {} end -- Initialize the player's GlorifiedBanking table if it doesn't already exist. 45 | return tonumber( ply.GlorifiedBanking.Balance ) or 0 -- Be sure to return zero if the "Balance" variable is nil. 46 | end 47 | 48 | function GlorifiedBanking.AddPlayerBalance( ply, addAmount ) 49 | if not ValidationChecks( ply, addAmount ) then return end -- Always validate before doing important functions to keep things secure. 50 | addAmount = tonumber( addAmount ) -- Make sure to convert "500" to 500, just in case some function provides a string for whatever reason. 51 | GlorifiedBanking.SetPlayerBalance( ply, GlorifiedBanking.GetPlayerBalance( ply ) + addAmount ) 52 | end 53 | 54 | function GlorifiedBanking.RemovePlayerBalance( ply, removeAmount ) 55 | if not ValidationChecks( ply, removeAmount ) then return end -- Always validate before doing important functions to keep things secure. 56 | removeAmount = tonumber( removeAmount ) -- Make sure to convert "500" to 500, just in case some function provides a string for whatever reason. 57 | removeAmount = minClamp( removeAmount, 0 ) -- Make sure we don't remove into a negative number as that would cause major consequences, always clamp to zero. 58 | GlorifiedBanking.SetPlayerBalance( ply, GlorifiedBanking.GetPlayerBalance( ply ) - removeAmount, 0 ) 59 | end 60 | 61 | function GlorifiedBanking.CanPlayerAfford( ply, affordAmount ) 62 | local numberedAffordAmount = tonumber( affordAmount ) 63 | if numberedAffordAmount != nil then 64 | return GlorifiedBanking.GetPlayerBalance( ply ) >= numberedAffordAmount 65 | end 66 | end 67 | 68 | function GlorifiedBanking.WithdrawAmount( ply, withdrawAmount ) 69 | if not ValidationChecks( ply, withdrawAmount ) then return end -- Always validate before doing important functions to keep things secure. 70 | if GlorifiedBanking.CanPlayerAfford( ply, withdrawAmount ) then 71 | GlorifiedBanking.AddCash( ply, withdrawAmount ) 72 | GlorifiedBanking.RemovePlayerBalance( ply, withdrawAmount ) 73 | GlorifiedBanking.LogWithdrawal( ply, withdrawAmount ) 74 | hook.Run( "GlorifiedBanking.PlayerWithdrawal", ply, withdrawAmount ) -- Calls upon withdrawal with the args ( ply, withdrawAmount ). 75 | end 76 | end 77 | 78 | function GlorifiedBanking.DepositAmount( ply, depositAmount ) 79 | if not ValidationChecks( ply, depositAmount ) then return end -- Always validate before doing important functions to keep things secure. 80 | if GlorifiedBanking.CanWalletAfford( ply, depositAmount ) then 81 | GlorifiedBanking.RemoveCash( ply, depositAmount ) 82 | GlorifiedBanking.AddPlayerBalance( ply, depositAmount ) 83 | GlorifiedBanking.LogDeposit( ply, depositAmount ) 84 | hook.Run( "GlorifiedBanking.PlayerDeposit", ply, depositAmount ) -- Calls upon deposit with the args ( ply, depositAmount ). 85 | end 86 | end 87 | 88 | function GlorifiedBanking.TransferAmount( ply, receiver, transferAmount ) 89 | if not ValidationChecks( ply, transferAmount ) then return end -- Always validate before doing important functions to keep things secure. 90 | if not receiver then return end 91 | if GlorifiedBanking.CanPlayerAfford( ply, transferAmount ) then 92 | GlorifiedBanking.RemovePlayerBalance( ply, transferAmount ) 93 | GlorifiedBanking.AddPlayerBalance( receiver, transferAmount ) 94 | GlorifiedBanking.LogTransfer( ply, receiver, transferAmount ) 95 | hook.Run( "GlorifiedBanking.PlayerTransfer", ply, receiver, transferAmount ) -- Calls upon transfer with the args ( ply, receiver, transferAmount ). 96 | end 97 | end 98 | 99 | -- Below are just meta functions in case people prefer using ply:GetBankBalance() over GlorifiedBanking.GetBankBalance( ply ). 100 | local plyMeta = FindMetaTable( "Player" ) 101 | function plyMeta:SetBankBalance( balance ) 102 | GlorifiedBanking.SetPlayerBalance( self, balance ) 103 | end 104 | 105 | function plyMeta:GetBankBalance() 106 | return GlorifiedBanking.GetPlayerBalance( self ) 107 | end 108 | 109 | function plyMeta:AddBankBalance( addAmount ) 110 | GlorifiedBanking.AddPlayerBalance( self, addAmount ) 111 | end 112 | 113 | function plyMeta:RemoveBankBalance( removeAmount ) 114 | GlorifiedBanking.RemovePlayerBalance( self, removeAmount ) 115 | end 116 | 117 | function plyMeta:CanAffordBank( affordAmount ) 118 | return GlorifiedBanking.CanPlayerAfford( self, affordAmount ) 119 | end 120 | 121 | function plyMeta:WithdrawFromBank( withdrawAmount ) 122 | GlorifiedBanking.WithdrawAmount( self, withdrawAmount ) 123 | end 124 | 125 | function plyMeta:DepositToBank( depositAmount ) 126 | GlorifiedBanking.DepositAmount( self, depositAmount ) 127 | end 128 | 129 | function plyMeta:TransferBankMoney( receiver, transferAmount ) 130 | GlorifiedBanking.TransferAmount( self, receiver, transferAmount ) 131 | end 132 | -------------------------------------------------------------------------------- /lua/weapons/gmod_tool/stools/gbatmplacer.lua: -------------------------------------------------------------------------------- 1 | 2 | TOOL.Name = "#tool.gbatmplacer.name" 3 | TOOL.Category = GlorifiedBanking.i18n.GetPhrase("gbToolCategory") 4 | TOOL.Desc = "#tool.gbatmplacer.desc" 5 | TOOL.Author = "Tom.bat" 6 | TOOL.ConfigName = "" 7 | 8 | TOOL.ClientConVar["xOffset"] = 0 9 | TOOL.ClientConVar["yOffset"] = 0 10 | TOOL.ClientConVar["zOffset"] = 50 11 | TOOL.ClientConVar["snap"] = 0 12 | TOOL.ClientConVar["signtext"] = "ATM" 13 | TOOL.ClientConVar["withdrawalfee"] = 0 14 | TOOL.ClientConVar["depositfee"] = 0 15 | TOOL.ClientConVar["transferfee"] = 0 16 | 17 | if CLIENT then 18 | TOOL.Information = { 19 | {name = "info", stage = 1}, 20 | {name = "left"}, 21 | {name = "right"}, 22 | {name = "reload"} 23 | } 24 | 25 | language.Add("tool.gbatmplacer.name", GlorifiedBanking.i18n.GetPhrase("gbToolName")) 26 | language.Add("tool.gbatmplacer.desc", GlorifiedBanking.i18n.GetPhrase("gbToolDescription")) 27 | language.Add("tool.gbatmplacer.left", GlorifiedBanking.i18n.GetPhrase("gbToolLeftClick")) 28 | language.Add("tool.gbatmplacer.right", GlorifiedBanking.i18n.GetPhrase("gbToolRightClick")) 29 | language.Add("tool.gbatmplacer.reload", GlorifiedBanking.i18n.GetPhrase("gbToolReload")) 30 | 31 | local backgroundCol = Color(20, 20, 20) 32 | function TOOL:DrawToolScreen(w, h) 33 | surface.SetDrawColor(backgroundCol) 34 | surface.DrawRect(0, 0, w, h) 35 | 36 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbToolCategory"), "GlorifiedBanking.ATMPlaceTool.Display", w / 2, h / 2 - 16, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 37 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbToolName"), "GlorifiedBanking.ATMPlaceTool.Display", w / 2, h / 2 + 16, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 38 | end 39 | 40 | function TOOL.BuildCPanel(panel) 41 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolSnap"), "gbatmplacer_snap", 0, 150, 2) 42 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolSnapHelp")) 43 | panel:Help("") 44 | 45 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolXOffset"), "gbatmplacer_xOffset", -150, 150, 2) 46 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolXOffsetHelp")) 47 | panel:Help("") 48 | 49 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolYOffset"), "gbatmplacer_yOffset", -150, 150, 2) 50 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolYOffsetHelp")) 51 | panel:Help("") 52 | 53 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolZOffset"), "gbatmplacer_zOffset", -150, 150, 2) 54 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolZOffsetHelp")) 55 | panel:Help("") 56 | 57 | panel:TextEntry(GlorifiedBanking.i18n.GetPhrase("gbToolSignText"), "gbatmplacer_signtext") 58 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolSignTextHelp")) 59 | panel:Help("") 60 | 61 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolWithdrawalFee"), "gbatmplacer_withdrawalfee", 0, 99, 2) 62 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolWithdrawalFeeHelp")) 63 | panel:Help("") 64 | 65 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolDepositFee"), "gbatmplacer_depositfee", 0, 99, 2) 66 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolDepositFeeHelp")) 67 | panel:Help("") 68 | 69 | panel:NumSlider(GlorifiedBanking.i18n.GetPhrase("gbToolTransferFee"), "gbatmplacer_transferfee", 0, 99, 2) 70 | panel:ControlHelp(GlorifiedBanking.i18n.GetPhrase("gbToolTransferFeeHelp")) 71 | end 72 | end 73 | 74 | local function getAtmPos(tr, posOffset, snap) 75 | if not tr.Hit or IsValid(tr.Entity) then return false end 76 | 77 | local angles = tr.HitNormal:Angle() 78 | if angles[1] != 0 then return false end 79 | 80 | local floorTr = util.TraceLine({ 81 | start = tr.HitPos, 82 | endpos = tr.HitPos + Vector(0, 0, -1000000), 83 | filter = function() return true end 84 | }) 85 | 86 | if not floorTr.Hit then return false end 87 | 88 | local distToFloor = math.abs(tr.HitPos[3] - floorTr.HitPos[3]) 89 | 90 | if snap > 0 then 91 | if (angles[2] > 180 and angles[2] <= 270) or angles[2] > 360 then 92 | tr.HitPos[1] = math.floor(tr.HitPos[1] / snap + 0.5) * snap 93 | else 94 | tr.HitPos[2] = math.floor(tr.HitPos[2] / snap + 0.5) * snap 95 | end 96 | end 97 | 98 | return tr.HitPos - (tr.HitNormal * -9.6) + Vector( posOffset.x, posOffset.y, -( distToFloor - posOffset.z ) ), angles 99 | end 100 | 101 | function TOOL:UpdateGhost(ent, ply) 102 | if not IsValid(ent) then return end 103 | 104 | local tr = ply:GetEyeTrace() 105 | local ghostPos, ghostAngles = getAtmPos(tr, Vector( self:GetClientNumber("xOffset"), self:GetClientNumber("yOffset"), self:GetClientNumber("zOffset") ), self:GetClientNumber("snap")) 106 | if not ghostPos or not ghostAngles then 107 | ent:SetNoDraw(true) 108 | return 109 | end 110 | 111 | ent:SetAngles(ghostAngles) 112 | ent:SetPos(ghostPos) 113 | ent:SetNoDraw(false) 114 | end 115 | 116 | function TOOL:Think() 117 | if SERVER and not game.SinglePlayer() then return end 118 | if CLIENT and game.SinglePlayer() then return end 119 | 120 | local ent = self.GhostEntity 121 | if not IsValid(ent) then 122 | self:MakeGhostEntity("models/sterling/glorifiedpig_atm.mdl", vector_origin, Angle()) 123 | end 124 | 125 | self:UpdateGhost(self.GhostEntity, self:GetOwner()) 126 | end 127 | 128 | if CLIENT then return end 129 | 130 | function TOOL:LeftClick( tr ) 131 | if GlorifiedBanking.HasPermission( self:GetOwner(), "glorifiedbanking_placeatms" ) then 132 | local atmPos, atmAngles = getAtmPos( tr, Vector( self:GetClientNumber("xOffset"), self:GetClientNumber("yOffset"), self:GetClientNumber("zOffset") ), self:GetClientNumber( "snap" ) ) 133 | if not atmPos or not atmAngles then return end 134 | 135 | local createdATM = ents.Create( "glorifiedbanking_atm" ) 136 | createdATM:SetPos( atmPos ) 137 | createdATM:SetAngles( atmAngles ) 138 | createdATM:SetWithdrawalFee( self:GetClientNumber( "withdrawalfee" ) ) 139 | createdATM:SetDepositFee( self:GetClientNumber( "depositfee" ) ) 140 | createdATM:SetTransferFee( self:GetClientNumber( "transferfee" ) ) 141 | createdATM:SetSignText( self:GetClientInfo( "signtext" ) ) 142 | createdATM:Spawn() 143 | createdATM:GetPhysicsObject():EnableMotion( false ) 144 | GlorifiedPersistentEnts.SaveEntityData( createdATM ) 145 | end 146 | end 147 | 148 | function TOOL:RightClick( tr ) 149 | print( "bababooey" ) 150 | local ent = tr.Entity 151 | if not IsValid( ent ) then return end 152 | if ent:GetClass() == "glorifiedbanking_atm" and GlorifiedBanking.HasPermission( self:GetOwner(), "glorifiedbanking_placeatms" ) then 153 | self:GetOwner():ConCommand( "gpe_removeent" ) 154 | end 155 | end 156 | 157 | function TOOL:Reload( tr ) 158 | if tr.Entity:GetClass() == "glorifiedbanking_atm" and GlorifiedBanking.HasPermission( self:GetOwner(), "glorifiedbanking_placeatms" ) then 159 | tr.Entity:SetWithdrawalFee( self:GetClientNumber( "withdrawalfee" ) ) 160 | tr.Entity:SetDepositFee( self:GetClientNumber( "depositfee" ) ) 161 | tr.Entity:SetTransferFee( self:GetClientNumber( "transferfee" ) ) 162 | tr.Entity:SetSignText( self:GetClientInfo( "signtext" ) ) 163 | end 164 | end 165 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/integrations/sv_glorifiedbanking_arcbank.lua: -------------------------------------------------------------------------------- 1 | GlorifiedBanking.ARCBank = {} 2 | 3 | concommand.Add("glorifiedbanking_importarcdata", function(ply) 4 | if IsValid(ply) and not ply:IsSuperAdmin() then 5 | ply:ChatPrint("You must be a SuperAdmin to run this command.") 6 | return false 7 | end 8 | 9 | local function notify(msg) 10 | if IsValid(ply) then 11 | ply:ChatPrint(msg) 12 | print("[GlorifiedBanking][Command] " .. msg) 13 | else 14 | print("[GlorifiedBanking] " .. msg) 15 | end 16 | end 17 | 18 | if not ARCBank then 19 | notify("ARCBank wasn't loaded.") 20 | end 21 | 22 | if ARCBank.MySQL.EnableMySQL then 23 | notify("Importing from MySQL") 24 | notify("This will lag the server, since we're going to use blocking DB calls.") 25 | GlorifiedBanking.ARCBank.ImportFromSQL(notify) 26 | end 27 | end) 28 | 29 | function GlorifiedBanking.ARCBank.ImportFromSQL(notify) 30 | require("mysqloo") 31 | if not mysqloo then notify("Failed to load MySQLOO for the ARCBank data importer, are you sure it is installed?") end 32 | 33 | local ARCDB = mysqloo.connect( 34 | ARCBank.MySQL.Host, 35 | ARCBank.MySQL.Username, 36 | ARCBank.MySQL.Password, 37 | ARCBank.MySQL.DatabaseName, 38 | tonumber(ARCBank.MySQL.DatabasePort) 39 | ) 40 | ARCDB:connect() 41 | 42 | local accounts = {} 43 | local owners = {} 44 | local groups = {} 45 | local perPage = 2000 46 | 47 | local query = ARCDB:query("SELECT COUNT(*) as `count` FROM ((SELECT account FROM `arcbank_accounts`) UNION (SELECT account FROM `arcbank_accounts_unused`)) AS `sq`") 48 | query:start() 49 | query:wait() 50 | local count = query:getData()[1].count 51 | 52 | local pages = math.ceil(count / perPage) 53 | local last = 0 54 | notify(("Parsing %s pages"):format(pages)) 55 | 56 | for page = 0, pages do 57 | local perc = math.ceil((page / pages) * 100) 58 | if (perc ~= last) and (perc ~= 100 or page == pages) then 59 | last = perc 60 | notify(("Fetching Accounts: %s%%"):format(perc)) 61 | end 62 | 63 | local accQuery = ARCDB:query("(SELECT account, name, owner, rank, (rank >= " .. ARCBANK_GROUPACCOUNTS_ .. " AND rank <= " .. ARCBANK_GROUPACCOUNTS_PREMIUM .. ") as `group`, 0 as money FROM `arcbank_accounts`) UNION (SELECT account, name, owner, rank, (rank >= " .. ARCBANK_GROUPACCOUNTS_ .. " AND rank <= " .. ARCBANK_GROUPACCOUNTS_PREMIUM .. ") as `group`, money FROM `arcbank_accounts_unused`) LIMIT " .. perPage .. (page ~= 0 and (" OFFSET " .. (page * perPage)) or "")) 64 | accQuery:start() 65 | accQuery:wait() 66 | local data = accQuery:getData() 67 | for _, account in ipairs(data) do 68 | accounts[account.account] = account.money 69 | owners[account.account] = {[account.owner] = account.money} 70 | groups[account.account] = account.group 71 | end 72 | end 73 | 74 | notify("Accounts Loaded, fetching group members.") 75 | 76 | query = ARCDB:query("SELECT COUNT(*) as `count` FROM ((SELECT account FROM arcbank_groups) UNION (SELECT account FROM arcbank_groups_unused)) AS `sq`") 77 | query:start() 78 | query:wait() 79 | count = query:getData()[1].count 80 | pages = math.ceil(count / perPage) 81 | last = 0 82 | notify(("Parsing %s pages"):format(pages)) 83 | 84 | for page = 0, pages do 85 | local perc = math.ceil((page / pages) * 100) 86 | if (perc ~= last) and (perc ~= 100 or page == pages) then 87 | last = perc 88 | notify(("Fetching Account Members: %s%%"):format(perc)) 89 | end 90 | 91 | local accQuery = ARCDB:query("(SELECT account, user FROM `arcbank_groups`) UNION (SELECT account, user FROM `arcbank_groups_unused`) LIMIT " .. perPage .. (page ~= 0 and (" OFFSET " .. (page * perPage)) or "")) 92 | accQuery:start() 93 | accQuery:wait() 94 | local data = accQuery:getData() 95 | for _, group in ipairs(data) do 96 | if owners[group.account] == nil then 97 | notify(("WARNING! %s wasn't defined when searching group members!"):format(group.account)) 98 | else 99 | owners[group.account][group.user] = 0 100 | end 101 | end 102 | end 103 | 104 | notify("Group Members Loaded, fetching log entries.") 105 | 106 | query = ARCDB:query("SELECT COUNT(*) as `count` FROM arcbank_log") 107 | query:start() 108 | query:wait() 109 | count = query:getData()[1].count 110 | pages = math.ceil(count / perPage) 111 | last = 0 112 | notify(("Parsing %s pages"):format(pages)) 113 | 114 | for page = 0, pages do 115 | local perc = math.ceil((page / pages) * 100) 116 | if (perc ~= last) and (perc ~= 100 or page == pages) then 117 | last = perc 118 | notify(("Fetching Log: %s%%"):format(perc)) 119 | end 120 | 121 | local logQuery = ARCDB:query("SELECT account1 as `account`, user1 as `user`, moneydiff as `diff` FROM arcbank_log ORDER BY transaction_id ASC LIMIT " .. perPage .. (page ~= 0 and (" OFFSET " .. (page * perPage)) or "")) 122 | logQuery:start() 123 | logQuery:wait() 124 | local data = logQuery:getData() 125 | for _, log in ipairs(data) do 126 | if accounts[log.account] ~= nil and owners[log.account] ~= nil then 127 | accounts[log.account] = (accounts[log.account] ~= nil and accounts[log.account] or 0) + log.diff 128 | 129 | if owners[log.account][log.user] ~= nil then 130 | owners[log.account][log.user] = owners[log.account][log.user] + log.diff 131 | end 132 | end 133 | end 134 | end 135 | 136 | -- We don't need to know overdrawn status. 137 | -- for accountId, amt in pairs(accounts) do 138 | -- if amt < 0 then 139 | -- notify(("%s is overdrawn (%s)"):format(accountId, amt)) 140 | -- end 141 | -- end 142 | 143 | -- for accountid, data in pairs(owners) do 144 | -- for steamid, amt in pairs(data) do 145 | -- if amt < 0 then 146 | -- notify(("%s withdrew more than they deposited (%s)"):format(steamid, amt)) 147 | -- end 148 | -- end 149 | -- end 150 | 151 | local newAccounts = {} 152 | for accountId, data in pairs(owners) do 153 | local account = { 154 | available = accounts[accountId] and accounts[accountId] or 0, 155 | owners = owners[accountId] and owners[accountId] or {BOT = 0}, 156 | group = tobool(groups[accountId] ~= nil and groups[accountId] or table.Count(owners[accountId]) ~= 1) 157 | } 158 | 159 | if not account.group then 160 | local owner 161 | for own, _ in pairs(account.owners) do 162 | owner = own 163 | break 164 | end 165 | 166 | newAccounts[owner] = newAccounts[owner] or {} 167 | newAccounts[owner][accountId] = account.available 168 | else 169 | local allChanges = 0 170 | for owner, change in pairs(account.owners) do 171 | if change > 0 then 172 | allChanges = allChanges + change 173 | end 174 | end 175 | if allChanges ~= 0 and account.available > 0 then 176 | for owner, change in pairs(account.owners) do 177 | local perc = change / allChanges 178 | newAccounts[owner] = newAccounts[owner] or {} 179 | newAccounts[owner][accountId] = (account.available * perc) 180 | end 181 | end 182 | end 183 | end 184 | 185 | for steamid, playerAccounts in pairs(newAccounts) do 186 | local refund = 0 187 | for accountId, amount in pairs(playerAccounts) do 188 | refund = refund + amount 189 | end 190 | refund = math.floor(refund) 191 | 192 | if refund <= 0 then 193 | notify(("%s doesn't haved enough banked money for a new account (%s$)"):format(steamid, refund)) 194 | elseif steamid ~= "BOT" then 195 | local sid = util.SteamIDTo64(steamid) 196 | sid = GlorifiedBanking.SQL.EscapeString(sid) 197 | GlorifiedBanking.SQL.Query("REPLACE INTO gb_players (`SteamID`, `Balance`) VALUES ('" .. sid .. "', " .. refund .. ")", function() 198 | local ply = player.GetBySteamID(steamid) 199 | if IsValid(ply) and ply:IsPlayer() then 200 | ply.GlorifiedBanking.Balance = refund 201 | ply:SetNW2Int("GlorifiedBanking.Balance", refund) 202 | end 203 | end) 204 | end 205 | end 206 | end 207 | -------------------------------------------------------------------------------- /lua/glorifiedbanking/modules/ui/cl_glorifiedbanking_carddesigner.lua: -------------------------------------------------------------------------------- 1 | 2 | local PANEL = {} 3 | 4 | local defId = "Filf1VB" 5 | local defNameX, defNameY = .042, .73 6 | local defIdX, defIdY = .042, .85 7 | 8 | function PANEL:Init() 9 | self:SetSize(ScrH() * .6, ScrH() * .6) 10 | self:Center() 11 | self:MakePopup() 12 | 13 | self.Theme = GlorifiedBanking.Themes.GetCurrent() 14 | 15 | self.Close = vgui.Create("DButton", self) 16 | self.Close:SetText("") 17 | 18 | self.Close.DoClick = function(s) 19 | self:Remove() 20 | end 21 | 22 | self.Close.Color = Color(255, 255, 255) 23 | self.Close.Paint = function(s, w, h) 24 | local iconSize = h * .5 25 | 26 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 5, s.Color, s:IsHovered() and self.Theme.Data.Colors.adminMenuCloseButtonHoverCol or self.Theme.Data.Colors.adminMenuCloseButtonCol) 27 | 28 | surface.SetDrawColor(s.Color) 29 | surface.SetMaterial(self.Theme.Data.Materials.close) 30 | surface.DrawTexturedRect(w / 2 - iconSize / 2, h / 2 - iconSize / 2, iconSize, iconSize) 31 | end 32 | 33 | self.Entry = vgui.Create("DTextEntry", self) 34 | self.Entry:SetValue(GlorifiedBanking.CardDesign.imgur) 35 | self.Entry:SetFont("GlorifiedBanking.AdminMenu.SetBalanceEntry") 36 | self.Entry:SetUpdateOnType(true) 37 | 38 | self.Entry.OnValueChange = function(s, value) 39 | GlorifiedBanking.UI.GetImgur(value, function(mat) 40 | self.CardMaterial = mat 41 | end) 42 | end 43 | 44 | self.CardPreview = vgui.Create("Panel", self) 45 | self.CardPreview.Paint = function(s, w, h) 46 | surface.SetDrawColor(color_white) 47 | surface.SetMaterial(self.CardMaterial or GlorifiedBanking.CardMaterial) 48 | surface.DrawTexturedRect(0, 0, w, h) 49 | end 50 | 51 | local ply = LocalPlayer() 52 | local id = ply:SteamID64():sub(-16) 53 | local cardID = id:sub(1, 4) 54 | for i = 4, 15, 4 do 55 | cardID = cardID .. " " .. id:sub(i, i + 3) 56 | end 57 | 58 | self.CardPreview.CardID = vgui.Create("GlorifiedBanking.DraggableLabel", self.CardPreview) 59 | self.CardPreview.CardID:SetText(cardID) 60 | self.CardPreview.CardID:SetFont("GlorifiedBanking.CardDesigner.CardInfo") 61 | self.CardPreview.CardID:SetTextColor(self.Theme.Data.Colors.cardNumberTextCol) 62 | self.CardPreview.CardID:SizeToContents() 63 | self.CardPreview.CardID.Pos = {GlorifiedBanking.CardDesign.idPos[1], GlorifiedBanking.CardDesign.idPos[2]} 64 | 65 | function self.CardPreview.CardID:OnDropped(x, y) 66 | local pw, ph = self:GetParent():GetSize() 67 | self.Pos = {x / pw, y / ph} 68 | end 69 | 70 | self.CardPreview.CardName = vgui.Create("GlorifiedBanking.DraggableLabel", self.CardPreview) 71 | self.CardPreview.CardName:SetText(ply:Name()) 72 | self.CardPreview.CardName:SetFont("GlorifiedBanking.CardDesigner.CardInfo") 73 | self.CardPreview.CardName:SetTextColor(self.Theme.Data.Colors.cardNameTextCol) 74 | self.CardPreview.CardName:SizeToContents() 75 | self.CardPreview.CardName.Pos = {GlorifiedBanking.CardDesign.namePos[1], GlorifiedBanking.CardDesign.namePos[2]} 76 | 77 | function self.CardPreview.CardName:OnDropped(x, y) 78 | local pw, ph = self:GetParent():GetSize() 79 | self.Pos = {x / pw, y / ph} 80 | end 81 | 82 | self.Save = vgui.Create("DButton", self) 83 | self.Save:SetText("") 84 | 85 | self.Save.Color = Color(255, 255, 255) 86 | self.Save.Paint = function(s, w, h) 87 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.setBalanceButtonBackgroundHoverCol or self.Theme.Data.Colors.setBalanceButtonBackgroundCol) 88 | 89 | draw.RoundedBox(h * .08, 0, 0, w, h, s.Color) 90 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbSave"), "GlorifiedBanking.AdminMenu.SetBalanceButton", w / 2, h * .43, self.Theme.Data.Colors.setBalanceButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 91 | end 92 | 93 | self.Save.DoClick = function(s) 94 | local parentWide = self.CardPreview:GetWide() 95 | 96 | local idCenterPos = (self.CardPreview.CardID:GetPos() + self.CardPreview.CardID:GetWide() / 2) / parentWide 97 | local idAlign = (idCenterPos > .4 and idCenterPos < .6) and 2 or idCenterPos > .6 and 1 or 0 98 | 99 | local idPos = self.CardPreview.CardID.Pos[1] 100 | if idAlign == 1 then 101 | idPos = idCenterPos 102 | elseif idAlign == 2 then 103 | idPos = (self.CardPreview.CardID:GetPos() + self.CardPreview.CardID:GetWide()) / parentWide 104 | end 105 | 106 | local nameCenterPos = (self.CardPreview.CardName:GetPos() + (self.CardPreview.CardName:GetWide() / 2)) / parentWide 107 | local nameAlign = (nameCenterPos > .4 and nameCenterPos < .6) and 1 or nameCenterPos > .6 and 2 or 0 108 | 109 | local namePos = self.CardPreview.CardName.Pos[1] 110 | if nameAlign == 1 then 111 | namePos = nameCenterPos 112 | elseif nameAlign == 2 then 113 | namePos = (self.CardPreview.CardName:GetPos() + self.CardPreview.CardName:GetWide()) / parentWide 114 | end 115 | 116 | net.Start( "GlorifiedBanking.CardDesigner.UpdateDesign" ) 117 | net.WriteString( self.Entry:GetValue() ) 118 | net.WriteFloat( idPos ) 119 | net.WriteFloat( self.CardPreview.CardID.Pos[2] ) 120 | net.WriteUInt( idAlign, 2) 121 | net.WriteFloat( namePos ) 122 | net.WriteFloat( self.CardPreview.CardName.Pos[2] ) 123 | net.WriteUInt( nameAlign, 2 ) 124 | net.SendToServer() 125 | 126 | self:Remove() 127 | end 128 | 129 | self.Reset = vgui.Create("DButton", self) 130 | self.Reset:SetText("") 131 | 132 | self.Reset.Color = Color(255, 255, 255) 133 | self.Reset.Paint = function(s, w, h) 134 | s.Color = GlorifiedBanking.UI.LerpColor(FrameTime() * 10, s.Color, s:IsHovered() and self.Theme.Data.Colors.resetBalanceNoButtonBackgroundHoverCol or self.Theme.Data.Colors.resetBalanceNoButtonBackgroundCol) 135 | 136 | draw.RoundedBox(h * .08, 0, 0, w, h, s.Color) 137 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbResetDefaults"), "GlorifiedBanking.AdminMenu.SetBalanceButton", w / 2, h * .43, self.Theme.Data.Colors.setBalanceButtonTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) 138 | end 139 | 140 | self.Reset.DoClick = function(s) 141 | self.Entry:SetValue(defId) 142 | self:ResetText(true) 143 | end 144 | end 145 | 146 | function PANEL:ResetText(toDefaults) 147 | local cardw, cardh = self.CardPreview:GetSize() 148 | 149 | if toDefaults then 150 | self.CardPreview.CardID.Pos = {defNameX, defNameY} 151 | self.CardPreview.CardName.Pos = {defIdX, defIdY} 152 | end 153 | 154 | self.CardPreview.CardID:SetPos(cardw * self.CardPreview.CardID.Pos[1], cardh * self.CardPreview.CardID.Pos[2]) 155 | self.CardPreview.CardName:SetPos(cardw * self.CardPreview.CardName.Pos[1], cardh * self.CardPreview.CardName.Pos[2]) 156 | end 157 | 158 | function PANEL:PerformLayout(w, h) 159 | self.Close:SetSize(h * .06, h * .06) 160 | self.Close:SetPos(w - h * .06, 0) 161 | 162 | self.Entry:SetSize(w * .97, h * .06) 163 | self.Entry:SetPos(w * .015, h * .12) 164 | 165 | local cardh = h * .55 166 | local cardw = 420 / 240 * cardh 167 | self.CardPreview:SetSize(cardw, cardh) 168 | self.CardPreview:SetPos((w - cardw) * .5, h * .225) 169 | 170 | self:ResetText() 171 | 172 | self.Save:SetSize(w * .97, h * .07) 173 | self.Save:SetPos(w * .015, h * .82) 174 | 175 | self.Reset:SetSize(w * .97, h * .07) 176 | self.Reset:SetPos(w * .015, h * .91) 177 | end 178 | 179 | function PANEL:Paint(w, h) 180 | draw.RoundedBox(6, 0, 0, w, h, self.Theme.Data.Colors.adminMenuBackgroundCol) 181 | draw.RoundedBoxEx(6, 0, 0, w, h * .06, self.Theme.Data.Colors.adminMenuNavbarBackgroundCol, true, true) 182 | 183 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbCardDesigner"), "GlorifiedBanking.AdminMenu.SetBalanceTitle", w * .013, h * .028, self.Theme.Data.Colors.adminMenuNavbarItemCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) 184 | draw.SimpleText(GlorifiedBanking.i18n.GetPhrase("gbEnterImgur"), "GlorifiedBanking.AdminMenu.SetBalanceDescription", w * .013, h * .07, self.Theme.Data.Colors.adminMenuNavbarItemCol) 185 | end 186 | 187 | vgui.Register("GlorifiedBanking.CardDesigner", PANEL, "EditablePanel") 188 | 189 | net.Receive("GlorifiedBanking.CardDesigner.OpenCardDesigner", function() 190 | if IsValid(GlorifiedBanking.UI.CardDesigner) then return end 191 | GlorifiedBanking.UI.CardDesigner = vgui.Create("GlorifiedBanking.CardDesigner") 192 | end) 193 | --------------------------------------------------------------------------------