diff --git a/ReallifeGamemode.Client/Gui/handmoney.ts b/ReallifeGamemode.Client/Gui/handmoney.ts new file mode 100644 index 00000000..0bfabeff --- /dev/null +++ b/ReallifeGamemode.Client/Gui/handmoney.ts @@ -0,0 +1,75 @@ +export default function handMoney() { + var currentMoney = null; + var showMoneyChange = null; + var difference; + var screen = mp.game.graphics.getScreenResolution(0, 0); + var res_X = screen.x; + + mp.events.add("SERVER:SET_HANDMONEY", (amount) => { + difference = currentMoney - amount; + if (difference != 0 && currentMoney != null) { + showMoneyChange = 1000; + } + currentMoney += amount; + }); + + mp.events.add("render", () => { + if (currentMoney != null) { + var numberFormat = formatNumber(currentMoney.toFixed(0)); + if (currentMoney >= 0) { + mp.game.graphics.drawText("+$" + numberFormat, [0.96, 0.1], + { + font: 7, + color: [115, 186, 131, 255], + scale: [0.65, 0.65], + outline: false, + centre: true, + }) + } + else { + mp.game.graphics.drawText("-$" + numberFormat, [0.96, 0.1], + { + font: 7, + color: [255, 0, 45, 255], + scale: [0.65, 0.65], + outline: false, + centre: true, + }) + } + if (showMoneyChange > 0) { + showMoneyChange--; + if (difference > 0) { + var alpha = 255; + if (showMoneyChange <= 70) { + alpha = (showMoneyChange * (255 / 70)) | 0; + } + mp.game.graphics.drawText("- $" + formatNumber(difference), [0.96, 0.145], { + font: 7, + color: [255, 0, 45, alpha], + scale: [0.65, 0.65], + outline: false, + centre: true + }) + + } else { + var nDef = difference * -1; + var alpha = 255; + if (showMoneyChange <= 70) { + alpha = (showMoneyChange * (255 / 70)) | 0; + } + mp.game.graphics.drawText("+ $" + formatNumber(nDef), [0.96, 0.145], { + font: 7, + color: [115, 186, 131, alpha], + scale: [0.65, 0.65], + outline: false, + centre: true + }) + } + } + } + }); + + function formatNumber(num) { + return num.toLocaleString('de-DE', { minimumFractionDigits: 0 }); + } +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/Interaction/worldinteraction.ts b/ReallifeGamemode.Client/Interaction/worldinteraction.ts index af17925b..3963e0a5 100644 --- a/ReallifeGamemode.Client/Interaction/worldinteraction.ts +++ b/ReallifeGamemode.Client/Interaction/worldinteraction.ts @@ -1,7 +1,8 @@ export default function worldInteraction() { var atmBrowser: BrowserMp; - mp.events.add("SERVER:ShowAtmUi", (atmId, atmBalance) => { + //INTERACT: ATM + mp.events.add("SERVER:ShowAtmUi", (atmId) => { mp.gui.cursor.show(true, true); mp.gui.chat.show(false); mp.game.ui.displayHud(false); @@ -9,4 +10,36 @@ atmBrowser = mp.browsers.new("package://assets/html/atm/index.html"); }); -} \ No newline at end of file + + mp.events.add("CEF:closeATM", () => { + mp.gui.cursor.show(false, false); + mp.gui.chat.show(true); + mp.game.ui.displayHud(true); + mp.game.ui.displayRadar(true); + + atmBrowser.destroy(); + }); + + mp.events.add("CEF:atmAction", (site, inputField1, inputField2) => { + + switch (site) { + //GELD EINZAHLEN in1 + case 0: + mp.events.call("SERVER:SET_HANDMONEY", inputField1 * -1); //GEHT NACH HANDMONEY.TS + mp.events.callRemote("CLIENT:ATM_ACTION", site, inputField1, inputField2); + break; + + //GELD AUSZAHLEN in1 + case 1: + mp.events.call("SERVER:SET_HANDMONEY", inputField1); //GEHT NACH HANDMONEY.TS + mp.events.callRemote("CLIENT:ATM_ACTION", site, inputField1, inputField2) + break; + + //GELD ÜBERWEISEN in1 = Kontonr // in2 = Betrag + case 2: + + break; + } + + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/Player/freecam.ts b/ReallifeGamemode.Client/Player/freecam.ts index be83aea3..5eb1b2fa 100644 --- a/ReallifeGamemode.Client/Player/freecam.ts +++ b/ReallifeGamemode.Client/Player/freecam.ts @@ -37,6 +37,7 @@ } mp.events.add('render', () => { + const controls = mp.game.controls; const fly = global.fly; direction = global.gameplayCam.getDirection(); @@ -50,13 +51,13 @@ direction.y = direction.y.toFixed(2); direction.z = direction.z.toFixed(2); - mp.game.graphics.drawText(`Coords: ${JSON.stringify(coords)}`, [0.5, 0.005], { - font: 0, - color: [255, 255, 255, 185], - scale: [0.3, 0.3], - outline: true, - centre: false - }); + //mp.game.graphics.drawText(`Coords: ${JSON.stringify(coords)}`, [0.5, 0.005], { + // font: 0, + // color: [255, 255, 255, 185], + // scale: [0.3, 0.3], + // outline: true, + // centre: false + //}); if (controls.isControlJustPressed(0, controlsIds.F5)) { fly.flying = !fly.flying; diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index 88767d5c..c662d3ee 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -30,11 +30,11 @@ export default function keys(globalData: GlobalData) { }); //UP ARROW (Interaktion mit Spielwelt) - //mp.keys.bind(0x26, false, function () { - // if (!globalData.InChat && !showInv && !globalData.Interaction) { - // mp.events.callRemote("keyPress:UP_ARROW"); - // } - //}); + mp.keys.bind(0x26, false, function () { + if (!globalData.InChat && !showInv && !globalData.Interaction) { + mp.events.callRemote("keyPress:UP_ARROW"); + } + }); //RIGHT ARROW (Fraktionsinteraktion) mp.keys.bind(0x27, false, function () { diff --git a/ReallifeGamemode.Client/assets/css/atm/atm.css b/ReallifeGamemode.Client/assets/css/atm/atm.css new file mode 100644 index 00000000..1908dc66 --- /dev/null +++ b/ReallifeGamemode.Client/assets/css/atm/atm.css @@ -0,0 +1,577 @@ +@font-face { + font-family: 'OSL'; + src: url('package://assets/font/OSL.ttf') format('truetype'); +} + +@font-face { + font-family: 'OSB'; + src: url('package://assets/font/OpenSans-Bold.ttf') format('truetype'); +} + + * { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + + .atm { + background:#6d6d6d; + position:absolute; + left:19.5vw; + top:1vw; + border-radius:1vw; + -webkit-box-shadow:0 0 25px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 25px -1px rgba(0,0,0,0.75); + box-shadow:0 0 25px -1px rgba(0,0,0,0.75); + z-index:3; + padding:33vw 30vw 10vw; + } + + .content { + position:absolute; + left:4vw; + top:2vw; + border-radius:1vw; + padding:29vw 26vw 5vw; + } + + .screen { + position:absolute; + left:5vw; + top:2vw; + -webkit-box-shadow:inset 0 0 19px -1px rgba(0,0,0,0.75); + -moz-box-shadow:inset 0 0 19px -1px rgba(0,0,0,0.75); + box-shadow:inset 0 0 19px -1px rgba(0,0,0,0.75); + background:#fff; + z-index:1; + padding:15vw 21vw; + } + + .b-left { + position:absolute; + left:-1.5vw; + top:11vw; + border-radius:1vw; + } + + .b-right { + position:absolute; + left:47.5vw; + top:11vw; + border-radius:1vw; + } + + .b { + background:#a7a7a7; + border-radius:.1vw .3vw .3vw .1vw; + margin-bottom:3vw; + padding:2vw 3vw; + } + + .b2 { + background:#a7a7a7; + border-radius:.3vw .1vw .1vw .3vw; + margin-bottom:3vw; + margin-left:.4vw; + padding:2vw 3vw; + } + + .b,.b2,.b3 { + cursor:pointer; + background:#a7a7a7; + margin-bottom:1vw; + -webkit-box-shadow:2px 3px 9px 3px rgba(99,99,99,1); + -moz-box-shadow:2px 3px 9px 3px rgba(99,99,99,1); + box-shadow:2px 3px 9px 3px rgba(99,99,99,1); + font-size:3vw; + color:#000; + padding:2vw 2.8vw; + border: 2px solid rgba(0, 0, 0, 0.5); + } + + .b:hover,.b2:hover,.b3:hover,.b3e:hover,.b4e:hover { + background:#949494; + } + + .b3 { + cursor:pointer; + background:#a7a7a7; + border-radius:.3vw; + margin-bottom:.2vw; + font-family:OSL; + font-size:1vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding: .14vw 2vw; + } + + .b3e { + cursor:pointer; + background:#a7a7a7; + border-radius:.3vw; + margin-bottom:.5vw; + font-family:OSL; + font-size:1vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding:1vw 4vw 1vw .5vw; + } + + .b4e { + cursor:pointer; + background:#a7a7a7; + border-radius:.3vw; + margin-bottom:.5vw; + font-family:OSL; + font-size:1vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + position:relative; + top:.2vw; + left:0; + padding:1vw 4vw 1vw .5vw; + } + + .numpad { + position:absolute; + top:0; + left:-4vw; + z-index:20; + } + + .bz1 { + position:absolute; + top:34.3vw; + left:21vw; + } + + .bz2 { + position:absolute; + top:34.3vw; + left:26vw; + } + + .bz3 { + position:absolute; + top:34.3vw; + left:31vw; + } + + .bz4 { + position:absolute; + top:35.3vw; + left:44.6vw; + } + + .bz5 { + position:absolute; + top:34.8vw; + left:37vw; + font-family:OSB!important; + } + + .bz6 { + position:absolute; + top:4.1vw; + } + + .b4 { + cursor:pointer; + width:0; + background:#cc2d2d; + border-radius:.3vw; + margin-bottom:1.5vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding:1.2vw; + } + + .b5 { + cursor:pointer; + width:0; + background:#ccb92e; + border-radius:.3vw; + margin-bottom:1.5vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding:1.2vw; + } + + .b6 { + cursor:pointer; + width:0; + background:#fff; + border-radius:.3vw; + margin-bottom:1.5vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding:1.2vw; + } + + .b7 { + cursor:pointer; + width:0; + background:#28bd26; + border-radius:.3vw; + margin-bottom:1.5vw; + -webkit-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + -moz-box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + box-shadow:0 0 6px -1px rgba(0,0,0,0.75); + padding:1.2vw; + } + + .header { + height:4vw; + width:42vw; + position:absolute; + top:0; + left:0; + background-image: linear-gradient(to right, #ff0d0d 80%, #ff1616e0 99%); + z-index: 2; + } + + .title { + text-align:center; + line-height:2; + font-size:1.6vw; + font-family:OSB; + color:#fff; + } + + .sub-title { + text-align:center; + line-height:3; + font-size:1.6vw; + font-family:OSB; + color:#000; + } + + .text { + text-align:center; + font-size:2vw; + font-family:OSL; + color:#000; + margin-top:2vw; + font-weight:700; + } + + .picture { + width:27vw; + margin-left:7.5vw; + margin-top:5.8vw; + } + + .show { + display:show!important; + } + + .hidden { + display:none!important; + } + + .menus { + font-family:OSB; + font-size: 0.8vw; + } + + .menu-list1 { + line-height:6.35; + margin-top:5.3vw; + margin-left:-1.4vw; + } + + .menu-list2 { + line-height:6.35; + margin-left:33vw; + margin-top:-20.7vw; + text-align:left!important; + } + + ul,menu,dir { + display:block; + list-style-type:disc; + -webkit-margin-before:1em; + -webkit-margin-after:1em; + -webkit-margin-start:0; + -webkit-margin-end:0; + -webkit-padding-start:40px; + } + + li { + display:block; + text-align:none; + } + + .circle { + background:#c9f0f55e; + position:absolute; + height:36vw; + top:0; + left:0; + z-index:-2; + width:10vw; + border-radius:0 380px 380px 0; + } + + .circle2 { + background:#c9f0f55e; + position:absolute; + height:36vw; + top:0; + left:32vw; + z-index:-2; + width:10vw; + border-radius:380px 0 0 380px; + } + + .randombox { + position:absolute; + z-index:0; + width:42vw; + height:9vw; + top:34vw; + left:13vw; + background:#6d6d6d; + } + + .bg-box1 { + background:#FFF; + width:18vw; + /* height:3vw; */ + padding-top: 1vw; + padding-bottom: 1vw; + position:absolute; + z-index:-1; + top: 9.6vw; + } + + .bg-box2 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top:14.4vw; + } + + .bg-box3 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top:19.4vw; + } + + .bg-box4 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top: 24.5vw; + } + + .bg-box5 { + background:#FFF; + width: 18vw; + height:3vw; + position:absolute; + z-index:-1; + top:9.4vw; + left:24vw; + } + + .bg-box6 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top:14.4vw; + left:24vw; + } + + .bg-box7 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top: 19.5vw; + left:24vw; + } + + .bg-box8 { + background:#FFF; + width:18vw; + height:3vw; + position:absolute; + z-index:-1; + top:24.4vw; + left:24vw; + } + + .input { + display:block; + width:30%; + height:1vw; + font-size:.7vw; + line-height:1.42857143; + color:#555; + background-color:#fff; + background-image:none; + margin-left:14vw; + border:1px solid #ccc; + border-radius:4px; + -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + -webkit-transition:border-color ease-in-out .15s, 0 ease-in-out .15s; + -o-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + padding:.4vw .5vw; + } + + .back { + font-size:1vw; + position:absolute; + font-family:OSB; + left:0; + top:9.5vw; + background:#fff; + padding:1vw 7vw 1vw 1vw; + } + + .back2 { + font-size:1vw; + position:absolute; + font-family:OSB; + left:0; + top: 14.3vw; + background:#fff; + padding:1vw 7vw 1vw 1vw; + } + + .back3 { + font-size:1vw; + position:absolute; + font-family:OSB; + left:0; + top: 19.5vw; + background:#fff; + padding:1vw 7vw 1vw 1vw; + } + + .back4 { + font-size:1vw; + position:absolute; + font-family:OSB; + left:0; + top: 24.5vw; + background:#fff; + padding:1vw 7vw 1vw 1vw; + } + + .back5 { + font-size:1vw; + position:absolute; + font-family:OSB; + left: 29.5vw; + top:9.5vw; + background:#fff; + padding: 1vw 2vw 1vw 7vw; + } + .back6 { + font-size:1vw; + position:absolute; + font-family:OSB; + left: 29.5vw; + top: 14.5vw; + background:#fff; + padding: 1vw 2vw 1vw 7vw; + } + .back7 { + font-size:1vw; + position:absolute; + font-family:OSB; + left: 29.5vw; + top: 19.5vw; + background:#fff; + padding: 1vw 2vw 1vw 7vw; + } + .helper { + position:absolute; + left:-5vw; + top:-2vw; + } + + .input2 { + display:block; + width:30%; + height:1vw; + font-size:.7vw; + line-height:1.42857143; + color:#000; + background-color:#fff; + background-image:none; + margin-left:14vw; + border:1px solid #ccc; + border-radius:4px; + -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + -webkit-transition:border-color ease-in-out .15s, 0 ease-in-out .15s; + -o-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + padding:.4vw .5vw; + font-family: 'OSL'; + } + + .input3 { + display:block; + width: 41%; + height: 17vw; + font-size:.7vw; + line-height:1.42857143; + color:#000; + background-color:#fff; + background-image:none; + margin-left: 12vw; + border:1px solid #ccc; + border-radius:4px; + -webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + box-shadow:inset 0 1px 1px rgba(0,0,0,0.075); + -webkit-transition:border-color ease-in-out .15s, 0 ease-in-out .15s; + -o-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s; + padding:.4vw .5vw; + font-family: 'OSL'; + } + + .bg-box5, .bg-box6, .bg-box7, .bg-box8 { + height: 1vw !important; + padding-top: 1vw !important; + padding-bottom: 1vw !important; + text-align: right; + width: 17vw !important; + padding-right: 1vw; + } + + .bg-box1, .bg-box2, .bg-box3, .bg-box4 { + +height: 1vw !important; + +padding-top: 1vw !important; + +padding-bottom: 1vw !important; + +padding-left: 1vw; + } \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/font/OSL.ttf b/ReallifeGamemode.Client/assets/font/OSL.ttf new file mode 100644 index 00000000..563872c7 Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/OSL.ttf differ diff --git a/ReallifeGamemode.Client/assets/font/OpenSans-ExtraBold.ttf b/ReallifeGamemode.Client/assets/font/OpenSans-ExtraBold.ttf new file mode 100644 index 00000000..21f6f84a Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/OpenSans-ExtraBold.ttf differ diff --git a/ReallifeGamemode.Client/assets/font/OpenSans-Light.ttf b/ReallifeGamemode.Client/assets/font/OpenSans-Light.ttf new file mode 100644 index 00000000..0d381897 Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/OpenSans-Light.ttf differ diff --git a/ReallifeGamemode.Client/assets/font/OpenSans-Regular.ttf b/ReallifeGamemode.Client/assets/font/OpenSans-Regular.ttf new file mode 100644 index 00000000..db433349 Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/OpenSans-Regular.ttf differ diff --git a/ReallifeGamemode.Client/assets/font/OpenSans-Semibold.ttf b/ReallifeGamemode.Client/assets/font/OpenSans-Semibold.ttf new file mode 100644 index 00000000..1a7679e3 Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/OpenSans-Semibold.ttf differ diff --git a/ReallifeGamemode.Client/assets/html/atm/index.html b/ReallifeGamemode.Client/assets/html/atm/index.html index 81415447..e17f122a 100644 --- a/ReallifeGamemode.Client/assets/html/atm/index.html +++ b/ReallifeGamemode.Client/assets/html/atm/index.html @@ -1,12 +1,396 @@ - + + + - - - + + + + + - - - +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
BANKAUTOMAT - SAN ANDREAS
+ +
+
+
+
+ + + + + + + + + + + + + + + +
+
+ +
+
+
+
1
+
4
+
7
+
+
2
+
5
+
8
+
0
+
+
3
+
6
+
9
+
+
ABBRUCH
+
BESTÄTIGUNG
+
+
+
+
+
+
+
+ + + + + + + - \ No newline at end of file + diff --git a/ReallifeGamemode.Client/assets/sound/atm/click.ogg b/ReallifeGamemode.Client/assets/sound/atm/click.ogg new file mode 100644 index 00000000..6f45d36a Binary files /dev/null and b/ReallifeGamemode.Client/assets/sound/atm/click.ogg differ diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 478a9c6e..019c75d9 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -11,6 +11,9 @@ let globalData: GlobalData = { InChat: false, }; +import handMoney from './Gui/handmoney' +handMoney(); + import business from './Business/main'; business(); @@ -53,6 +56,9 @@ interiors(globalData); import factionInteraction from './Interaction/factioninteraction'; factionInteraction(globalData); +import worldInteraction from './Interaction/worldinteraction'; +worldInteraction(); + import playerInteraction from './Interaction/playerinteraction'; playerInteraction(globalData); @@ -68,8 +74,8 @@ keys(globalData); import quitHandler from './Player/quit'; quitHandler(); -import freecam from './Player/freecam'; -freecam(); +import freeCam from './Player/freecam'; +freeCam(); import saveManager from './Save/main'; saveManager(); diff --git a/ReallifeGamemode.Client/package-lock.json b/ReallifeGamemode.Client/package-lock.json index c05a2c95..0bbfa8b5 100644 --- a/ReallifeGamemode.Client/package-lock.json +++ b/ReallifeGamemode.Client/package-lock.json @@ -1565,11 +1565,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1582,15 +1584,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -1693,7 +1698,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -1703,6 +1709,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1715,17 +1722,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -1742,6 +1752,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -1814,7 +1825,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -1824,6 +1836,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -1929,6 +1942,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 2f83833f..0b8aadd3 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1074,6 +1074,53 @@ namespace ReallifeGamemode.Server.Commands } #endregion #region ALevel1337 + [Command("sethandmoney", "~m~Benutzung: ~s~/sethandmoney [Target] [Geld]")] + public void CmdAdminSetUserHandMoney(Client admin, string targetname, int amount) + { + if (!admin.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(admin); + return; + } + + Client target = ClientService.GetClientByNameOrId(targetname); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(target); + return; + } + using (var context = new DatabaseContext()) + { + var user = target.GetUser(context); + user.Handmoney = amount; + context.SaveChanges(); + } + target.TriggerEvent("SERVER:SET_HANDMONEY", amount); + } + + [Command("givehandmoney", "~m~Benutzung: ~s~/givehandmoney [Target] [Geld]")] + public void CmdAdminGiveUserHandMoney(Client admin, string targetname, int amount) + { + if (!admin.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(admin); + return; + } + + Client target = ClientService.GetClientByNameOrId(targetname); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(target); + return; + } + using (var context = new DatabaseContext()) + { + var user = target.GetUser(context); + user.Handmoney += amount; + context.SaveChanges(); + target.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney); + } + } [Command("quicksavemode", "~m~Benutzung: ~s~/quicksavemode [Modus]\nModi (klein schreiben): ~g~blip, ~r~atm")] public void CmdAdminSetQuickSaveMode(Client player, string mode) @@ -1089,7 +1136,7 @@ namespace ReallifeGamemode.Server.Commands [Command("giveitem", "~m~Benutzung: ~s~/giveitem [Target] [Item ID] [Anzahl]")] public void CmdAdminGiveItem(Client player, string targetname, int itemId, int amount) { - if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) { ChatService.NotAuthorized(player); return; @@ -1127,7 +1174,7 @@ namespace ReallifeGamemode.Server.Commands [Command("inventory", "~m~Benutzung: ~s~/inventory [Spieler]")] public void CmdAdminGiveItem(Client player, string targetname) { - if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) { ChatService.NotAuthorized(player); return; diff --git a/ReallifeGamemode.Server/Entities/User.cs b/ReallifeGamemode.Server/Entities/User.cs index 5af59229..1aa3e142 100644 --- a/ReallifeGamemode.Server/Entities/User.cs +++ b/ReallifeGamemode.Server/Entities/User.cs @@ -36,6 +36,7 @@ namespace ReallifeGamemode.Server.Entities public AdminLevel AdminLevel { get; set; } public bool Dead { get; set; } + public int Handmoney { get; set; } public float PositionX { get; set; } public float PositionY { get; set; } diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 5773d589..4c64d1e4 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -44,6 +44,7 @@ namespace ReallifeGamemode.Server.Events player.SetData("isLoggedIn", true); player.SetData("spec", true); player.SetData("duty", false); + player.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney, 0); if (user.IsAdmin(AdminLevel.HEADADMIN) == true) { diff --git a/ReallifeGamemode.Server/Managers/ATMManager.cs b/ReallifeGamemode.Server/Managers/ATMManager.cs index b1ecbfa0..13ad299f 100644 --- a/ReallifeGamemode.Server/Managers/ATMManager.cs +++ b/ReallifeGamemode.Server/Managers/ATMManager.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using GTANetworkAPI; using ReallifeGamemode.Server.Entities; +using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Models; /** @@ -20,21 +21,24 @@ namespace ReallifeGamemode.Server.Managers public static void InitATMs() { + var addedATMs = 0; using (var dbContext = new DatabaseContext()) { foreach (var currentATM in dbContext.Blips) { if (currentATM.Sprite == 500) { - if(dbContext.ATMs.FirstOrDefault(a => a.X == currentATM.PositionX && a.Y == currentATM.PositionY && a.Z == currentATM.PositionZ) == null) + if(dbContext.ATMs.FirstOrDefault(a => a.Id == currentATM.Id) == null) { var dataSet = new ATM { + Id = currentATM.Id, X = currentATM.PositionX, Y = currentATM.PositionY, Z = currentATM.PositionZ }; dbContext.Add(dataSet); + addedATMs++; } else { @@ -42,6 +46,15 @@ namespace ReallifeGamemode.Server.Managers } } } + if(addedATMs > 0) + { + NAPI.Util.ConsoleOutput(addedATMs + " Geldautomaten hinzugefügt"); + } + else + { + NAPI.Util.ConsoleOutput("Keine Geldautomaten hinzugefügt"); + } + dbContext.SaveChanges(); LoadATMs(); } @@ -56,16 +69,13 @@ namespace ReallifeGamemode.Server.Managers currentColShape.OnEntityEnterColShape += EnterATMRange; currentColShape.OnEntityExitColShape += ExitATMRange; ATMColShapes.Add(currentColShape); + currentColShape.SetData("id", currentATM.Id); } } } public static void EnterATMRange(ColShape colShape, Client client) { - using (var dbContext = new DatabaseContext()) - { - var nearATM = dbContext.ATMs.FirstOrDefault(a => a.X == colShape.Position.X && a.Y == colShape.Position.Y && a.Z == colShape.Position.Z); - client.SetData("nearATM", nearATM.Id); - } + client.SetData("nearATM", colShape.GetData("id")); } public static void ExitATMRange(ColShape colShape, Client client) { @@ -73,11 +83,41 @@ namespace ReallifeGamemode.Server.Managers } public static void ShowAtmUi(Client player, int atmId) { + player.TriggerEvent("SERVER:ShowAtmUi", atmId); + } + + [RemoteEvent("CLIENT:ATM_ACTION")] + public void AtmAction(Client client, int site, int inputField1, int inputField2) + { + var user = client.GetUser(); using (var dbContext = new DatabaseContext()) { - var atmBalance = dbContext.ATMs.FirstOrDefault(a => a.Id == atmId); - player.TriggerEvent("SERVER:ShowAtmUi", atmId, atmBalance.Balance); + //SITE //0 Geld einzahlen //1 Geld auszahlen //2 Geld überweisen + switch (site) + { + //GELD EINZAHLEN in1 + case 0: + var updateHandMoneyIn = dbContext.Users.FirstOrDefault(u => u.Id == user.Id); + var updateBankMoneyIn = dbContext.UserBankAccounts.FirstOrDefault(b => b.UserId == user.Id); + updateHandMoneyIn.Handmoney -= inputField1; + updateBankMoneyIn.Balance += inputField1; + break; + + //GELD AUSZAHLEN in1 + case 1: + var updateHandMoneyOut = dbContext.Users.FirstOrDefault(u => u.Id == user.Id); + var updateBankMoneyOut = dbContext.UserBankAccounts.FirstOrDefault(b => b.UserId == user.Id); + updateHandMoneyOut.Handmoney += inputField1; + updateBankMoneyOut.Balance -= inputField1; + break; + + //GELD ÜBERWEISEN in1 = Kontonr // in2 = Betrag + case 2: + + break; + } + dbContext.SaveChanges(); } - } + } } } diff --git a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs index 4a66fda1..c69c7a58 100644 --- a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs @@ -728,6 +728,8 @@ namespace ReallifeGamemode.Migrations b.Property("FactionRankId"); + b.Property("Handmoney"); + b.Property("LogUserId"); b.Property("Name") diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..48e341a0 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +}