Merge branch 'develop' into feature/inventory-system
This commit is contained in:
143
Client/Business/main.js
Normal file
143
Client/Business/main.js
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
var keyBound = false;
|
||||||
|
|
||||||
|
var closeMenu = false;
|
||||||
|
|
||||||
|
var businessName;
|
||||||
|
var businessMoney;
|
||||||
|
var mainMenu;
|
||||||
|
var bankMenu;
|
||||||
|
|
||||||
|
const NativeUI = require("nativeui");
|
||||||
|
const Menu = NativeUI.Menu;
|
||||||
|
const UIMenuItem = NativeUI.UIMenuItem;
|
||||||
|
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||||
|
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||||
|
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
|
||||||
|
const BadgeStyle = NativeUI.BadgeStyle;
|
||||||
|
const Point = NativeUI.Point;
|
||||||
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
|
const Color = NativeUI.Color;
|
||||||
|
const ListItem = NativeUI.ListItem;
|
||||||
|
|
||||||
|
const InputHelper = require("inputhelper");
|
||||||
|
|
||||||
|
mp.events.add('business_showHelp', (bizName, bizMoney) => {
|
||||||
|
mp.game.ui.setTextComponentFormat('STRING');
|
||||||
|
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Business zu verwalten');
|
||||||
|
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
||||||
|
|
||||||
|
businessName = bizName;
|
||||||
|
businessMoney = bizMoney;
|
||||||
|
|
||||||
|
mp.keys.bind(0x45, false, keyPressHandler);
|
||||||
|
keyBound = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('business_removeHelp', (unbind) => {
|
||||||
|
mp.game.ui.clearHelp(true);
|
||||||
|
mp.gui.chat.show(true);
|
||||||
|
|
||||||
|
if (keyBound && unbind) {
|
||||||
|
if (typeof mainMenu !== "undefined") mainMenu.Close();
|
||||||
|
if (typeof bankMenu !== "undefined") {
|
||||||
|
closeMenu = true;
|
||||||
|
bankMenu.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||||
|
keyBound = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('business_updateMoney', (newMoney) => {
|
||||||
|
businessMoney = newMoney;
|
||||||
|
});
|
||||||
|
|
||||||
|
function keyPressHandler() {
|
||||||
|
mp.events.call('business_removeHelp', false);
|
||||||
|
mp.gui.chat.show(false);
|
||||||
|
|
||||||
|
if (typeof mainMenu !== "undefined" && mainMenu.Visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof bankMenu !== "undefined" && bankMenu.Visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainMenu = new Menu("Businessverwaltung", businessName, new Point(50, 50));
|
||||||
|
|
||||||
|
var bankAccountItem = new UIMenuItem("Businesskasse", "Verwalte die Businesskasse");
|
||||||
|
bankAccountItem.SetRightLabel("~g~~h~" + businessMoney);
|
||||||
|
mainMenu.AddItem(bankAccountItem);
|
||||||
|
|
||||||
|
//var partnerItem = new UIMenuItem("Inteilhaber", "Verwalte den Inteilhaber");
|
||||||
|
//partnerItem.SetRightLabel("Niemand");
|
||||||
|
//mainMenu.AddItem(partnerItem);
|
||||||
|
|
||||||
|
mainMenu.Open();
|
||||||
|
|
||||||
|
mainMenu.ItemSelect.on((item, index) => {
|
||||||
|
if (item === bankAccountItem) {
|
||||||
|
// manage bank account
|
||||||
|
|
||||||
|
bankMenu = new Menu("Bankkonto", businessName, new Point(50, 50));
|
||||||
|
|
||||||
|
var infoItem = new UIMenuItem("Aktueller Kontostand");
|
||||||
|
infoItem.SetRightLabel("~g~~h~" + businessMoney);
|
||||||
|
bankMenu.AddItem(infoItem);
|
||||||
|
|
||||||
|
var depositItem = new UIMenuItem("Einzahlen", "Zahle Geld auf die Businesskasse ein");
|
||||||
|
bankMenu.AddItem(depositItem);
|
||||||
|
|
||||||
|
var withdrawItem = new UIMenuItem("Auszahlen", "Zahle Geld von der Businesskasse aus");
|
||||||
|
bankMenu.AddItem(withdrawItem);
|
||||||
|
|
||||||
|
bankMenu.ItemSelect.on((item, index) => {
|
||||||
|
if (item === depositItem) {
|
||||||
|
var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?");
|
||||||
|
depositInput.show();
|
||||||
|
depositInput.getValue((data) => {
|
||||||
|
var amount = parseInt(data);
|
||||||
|
if (isNaN(amount)) {
|
||||||
|
mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.events.callRemote('Business_DepositMoney', amount);
|
||||||
|
});
|
||||||
|
} else if (item === withdrawItem) {
|
||||||
|
var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?");
|
||||||
|
withdrawInput.show();
|
||||||
|
withdrawInput.getValue((data) => {
|
||||||
|
var amount = parseInt(data);
|
||||||
|
if (isNaN(amount)) {
|
||||||
|
mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.events.callRemote('Business_WithdrawMoney', amount);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
bankMenu.MenuClose.on(() => {
|
||||||
|
if (closeMenu) {
|
||||||
|
closeMenu = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainMenu.Visible = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
bankMenu.Visible = true;
|
||||||
|
mainMenu.Visible = false;
|
||||||
|
|
||||||
|
} else if (item === partnerItem) {
|
||||||
|
// manage partner
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainMenu.MenuClose.on(() => {
|
||||||
|
mp.events.call('business_removeHelp', false);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,587 +0,0 @@
|
|||||||
/*!
|
|
||||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
|
||||||
* Copyright 2011-2016 Twitter, Inc.
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
*/
|
|
||||||
.btn-default,
|
|
||||||
.btn-primary,
|
|
||||||
.btn-success,
|
|
||||||
.btn-info,
|
|
||||||
.btn-warning,
|
|
||||||
.btn-danger {
|
|
||||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
|
|
||||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
|
|
||||||
}
|
|
||||||
.btn-default:active,
|
|
||||||
.btn-primary:active,
|
|
||||||
.btn-success:active,
|
|
||||||
.btn-info:active,
|
|
||||||
.btn-warning:active,
|
|
||||||
.btn-danger:active,
|
|
||||||
.btn-default.active,
|
|
||||||
.btn-primary.active,
|
|
||||||
.btn-success.active,
|
|
||||||
.btn-info.active,
|
|
||||||
.btn-warning.active,
|
|
||||||
.btn-danger.active {
|
|
||||||
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
|
|
||||||
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
|
|
||||||
}
|
|
||||||
.btn-default.disabled,
|
|
||||||
.btn-primary.disabled,
|
|
||||||
.btn-success.disabled,
|
|
||||||
.btn-info.disabled,
|
|
||||||
.btn-warning.disabled,
|
|
||||||
.btn-danger.disabled,
|
|
||||||
.btn-default[disabled],
|
|
||||||
.btn-primary[disabled],
|
|
||||||
.btn-success[disabled],
|
|
||||||
.btn-info[disabled],
|
|
||||||
.btn-warning[disabled],
|
|
||||||
.btn-danger[disabled],
|
|
||||||
fieldset[disabled] .btn-default,
|
|
||||||
fieldset[disabled] .btn-primary,
|
|
||||||
fieldset[disabled] .btn-success,
|
|
||||||
fieldset[disabled] .btn-info,
|
|
||||||
fieldset[disabled] .btn-warning,
|
|
||||||
fieldset[disabled] .btn-danger {
|
|
||||||
-webkit-box-shadow: none;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
.btn-default .badge,
|
|
||||||
.btn-primary .badge,
|
|
||||||
.btn-success .badge,
|
|
||||||
.btn-info .badge,
|
|
||||||
.btn-warning .badge,
|
|
||||||
.btn-danger .badge {
|
|
||||||
text-shadow: none;
|
|
||||||
}
|
|
||||||
.btn:active,
|
|
||||||
.btn.active {
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-default {
|
|
||||||
text-shadow: 0 1px 0 #fff;
|
|
||||||
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
|
|
||||||
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #dbdbdb;
|
|
||||||
border-color: #ccc;
|
|
||||||
}
|
|
||||||
.btn-default:hover,
|
|
||||||
.btn-default:focus {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-default:active,
|
|
||||||
.btn-default.active {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
border-color: #dbdbdb;
|
|
||||||
}
|
|
||||||
.btn-default.disabled,
|
|
||||||
.btn-default[disabled],
|
|
||||||
fieldset[disabled] .btn-default,
|
|
||||||
.btn-default.disabled:hover,
|
|
||||||
.btn-default[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-default:hover,
|
|
||||||
.btn-default.disabled:focus,
|
|
||||||
.btn-default[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-default:focus,
|
|
||||||
.btn-default.disabled.focus,
|
|
||||||
.btn-default[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-default.focus,
|
|
||||||
.btn-default.disabled:active,
|
|
||||||
.btn-default[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-default:active,
|
|
||||||
.btn-default.disabled.active,
|
|
||||||
.btn-default[disabled].active,
|
|
||||||
fieldset[disabled] .btn-default.active {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-primary {
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #245580;
|
|
||||||
}
|
|
||||||
.btn-primary:hover,
|
|
||||||
.btn-primary:focus {
|
|
||||||
background-color: #265a88;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-primary:active,
|
|
||||||
.btn-primary.active {
|
|
||||||
background-color: #265a88;
|
|
||||||
border-color: #245580;
|
|
||||||
}
|
|
||||||
.btn-primary.disabled,
|
|
||||||
.btn-primary[disabled],
|
|
||||||
fieldset[disabled] .btn-primary,
|
|
||||||
.btn-primary.disabled:hover,
|
|
||||||
.btn-primary[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-primary:hover,
|
|
||||||
.btn-primary.disabled:focus,
|
|
||||||
.btn-primary[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-primary:focus,
|
|
||||||
.btn-primary.disabled.focus,
|
|
||||||
.btn-primary[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-primary.focus,
|
|
||||||
.btn-primary.disabled:active,
|
|
||||||
.btn-primary[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-primary:active,
|
|
||||||
.btn-primary.disabled.active,
|
|
||||||
.btn-primary[disabled].active,
|
|
||||||
fieldset[disabled] .btn-primary.active {
|
|
||||||
background-color: #265a88;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-success {
|
|
||||||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
|
|
||||||
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #3e8f3e;
|
|
||||||
}
|
|
||||||
.btn-success:hover,
|
|
||||||
.btn-success:focus {
|
|
||||||
background-color: #419641;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-success:active,
|
|
||||||
.btn-success.active {
|
|
||||||
background-color: #419641;
|
|
||||||
border-color: #3e8f3e;
|
|
||||||
}
|
|
||||||
.btn-success.disabled,
|
|
||||||
.btn-success[disabled],
|
|
||||||
fieldset[disabled] .btn-success,
|
|
||||||
.btn-success.disabled:hover,
|
|
||||||
.btn-success[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-success:hover,
|
|
||||||
.btn-success.disabled:focus,
|
|
||||||
.btn-success[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-success:focus,
|
|
||||||
.btn-success.disabled.focus,
|
|
||||||
.btn-success[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-success.focus,
|
|
||||||
.btn-success.disabled:active,
|
|
||||||
.btn-success[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-success:active,
|
|
||||||
.btn-success.disabled.active,
|
|
||||||
.btn-success[disabled].active,
|
|
||||||
fieldset[disabled] .btn-success.active {
|
|
||||||
background-color: #419641;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-info {
|
|
||||||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
|
|
||||||
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #28a4c9;
|
|
||||||
}
|
|
||||||
.btn-info:hover,
|
|
||||||
.btn-info:focus {
|
|
||||||
background-color: #2aabd2;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-info:active,
|
|
||||||
.btn-info.active {
|
|
||||||
background-color: #2aabd2;
|
|
||||||
border-color: #28a4c9;
|
|
||||||
}
|
|
||||||
.btn-info.disabled,
|
|
||||||
.btn-info[disabled],
|
|
||||||
fieldset[disabled] .btn-info,
|
|
||||||
.btn-info.disabled:hover,
|
|
||||||
.btn-info[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-info:hover,
|
|
||||||
.btn-info.disabled:focus,
|
|
||||||
.btn-info[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-info:focus,
|
|
||||||
.btn-info.disabled.focus,
|
|
||||||
.btn-info[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-info.focus,
|
|
||||||
.btn-info.disabled:active,
|
|
||||||
.btn-info[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-info:active,
|
|
||||||
.btn-info.disabled.active,
|
|
||||||
.btn-info[disabled].active,
|
|
||||||
fieldset[disabled] .btn-info.active {
|
|
||||||
background-color: #2aabd2;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-warning {
|
|
||||||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
|
|
||||||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #e38d13;
|
|
||||||
}
|
|
||||||
.btn-warning:hover,
|
|
||||||
.btn-warning:focus {
|
|
||||||
background-color: #eb9316;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-warning:active,
|
|
||||||
.btn-warning.active {
|
|
||||||
background-color: #eb9316;
|
|
||||||
border-color: #e38d13;
|
|
||||||
}
|
|
||||||
.btn-warning.disabled,
|
|
||||||
.btn-warning[disabled],
|
|
||||||
fieldset[disabled] .btn-warning,
|
|
||||||
.btn-warning.disabled:hover,
|
|
||||||
.btn-warning[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-warning:hover,
|
|
||||||
.btn-warning.disabled:focus,
|
|
||||||
.btn-warning[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-warning:focus,
|
|
||||||
.btn-warning.disabled.focus,
|
|
||||||
.btn-warning[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-warning.focus,
|
|
||||||
.btn-warning.disabled:active,
|
|
||||||
.btn-warning[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-warning:active,
|
|
||||||
.btn-warning.disabled.active,
|
|
||||||
.btn-warning[disabled].active,
|
|
||||||
fieldset[disabled] .btn-warning.active {
|
|
||||||
background-color: #eb9316;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.btn-danger {
|
|
||||||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
|
|
||||||
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #b92c28;
|
|
||||||
}
|
|
||||||
.btn-danger:hover,
|
|
||||||
.btn-danger:focus {
|
|
||||||
background-color: #c12e2a;
|
|
||||||
background-position: 0 -15px;
|
|
||||||
}
|
|
||||||
.btn-danger:active,
|
|
||||||
.btn-danger.active {
|
|
||||||
background-color: #c12e2a;
|
|
||||||
border-color: #b92c28;
|
|
||||||
}
|
|
||||||
.btn-danger.disabled,
|
|
||||||
.btn-danger[disabled],
|
|
||||||
fieldset[disabled] .btn-danger,
|
|
||||||
.btn-danger.disabled:hover,
|
|
||||||
.btn-danger[disabled]:hover,
|
|
||||||
fieldset[disabled] .btn-danger:hover,
|
|
||||||
.btn-danger.disabled:focus,
|
|
||||||
.btn-danger[disabled]:focus,
|
|
||||||
fieldset[disabled] .btn-danger:focus,
|
|
||||||
.btn-danger.disabled.focus,
|
|
||||||
.btn-danger[disabled].focus,
|
|
||||||
fieldset[disabled] .btn-danger.focus,
|
|
||||||
.btn-danger.disabled:active,
|
|
||||||
.btn-danger[disabled]:active,
|
|
||||||
fieldset[disabled] .btn-danger:active,
|
|
||||||
.btn-danger.disabled.active,
|
|
||||||
.btn-danger[disabled].active,
|
|
||||||
fieldset[disabled] .btn-danger.active {
|
|
||||||
background-color: #c12e2a;
|
|
||||||
background-image: none;
|
|
||||||
}
|
|
||||||
.thumbnail,
|
|
||||||
.img-thumbnail {
|
|
||||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
|
||||||
}
|
|
||||||
.dropdown-menu > li > a:hover,
|
|
||||||
.dropdown-menu > li > a:focus {
|
|
||||||
background-color: #e8e8e8;
|
|
||||||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
|
|
||||||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.dropdown-menu > .active > a,
|
|
||||||
.dropdown-menu > .active > a:hover,
|
|
||||||
.dropdown-menu > .active > a:focus {
|
|
||||||
background-color: #2e6da4;
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.navbar-default {
|
|
||||||
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
|
|
||||||
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-radius: 4px;
|
|
||||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
|
|
||||||
}
|
|
||||||
.navbar-default .navbar-nav > .open > a,
|
|
||||||
.navbar-default .navbar-nav > .active > a {
|
|
||||||
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
|
|
||||||
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
|
|
||||||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
|
|
||||||
}
|
|
||||||
.navbar-brand,
|
|
||||||
.navbar-nav > li > a {
|
|
||||||
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
|
|
||||||
}
|
|
||||||
.navbar-inverse {
|
|
||||||
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
|
|
||||||
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.navbar-inverse .navbar-nav > .open > a,
|
|
||||||
.navbar-inverse .navbar-nav > .active > a {
|
|
||||||
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
|
|
||||||
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
|
|
||||||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
|
|
||||||
}
|
|
||||||
.navbar-inverse .navbar-brand,
|
|
||||||
.navbar-inverse .navbar-nav > li > a {
|
|
||||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
|
|
||||||
}
|
|
||||||
.navbar-static-top,
|
|
||||||
.navbar-fixed-top,
|
|
||||||
.navbar-fixed-bottom {
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
@media (max-width: 767px) {
|
|
||||||
.navbar .navbar-nav .open .dropdown-menu > .active > a,
|
|
||||||
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
|
|
||||||
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
|
|
||||||
color: #fff;
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.alert {
|
|
||||||
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
|
|
||||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
.alert-success {
|
|
||||||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
|
|
||||||
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #b2dba1;
|
|
||||||
}
|
|
||||||
.alert-info {
|
|
||||||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
|
|
||||||
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #9acfea;
|
|
||||||
}
|
|
||||||
.alert-warning {
|
|
||||||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
|
|
||||||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #f5e79e;
|
|
||||||
}
|
|
||||||
.alert-danger {
|
|
||||||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
|
|
||||||
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #dca7a7;
|
|
||||||
}
|
|
||||||
.progress {
|
|
||||||
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
|
|
||||||
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar {
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar-success {
|
|
||||||
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
|
|
||||||
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar-info {
|
|
||||||
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
|
|
||||||
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar-warning {
|
|
||||||
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
|
|
||||||
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar-danger {
|
|
||||||
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
|
|
||||||
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.progress-bar-striped {
|
|
||||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
|
||||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
|
||||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
|
|
||||||
}
|
|
||||||
.list-group {
|
|
||||||
border-radius: 4px;
|
|
||||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
|
|
||||||
}
|
|
||||||
.list-group-item.active,
|
|
||||||
.list-group-item.active:hover,
|
|
||||||
.list-group-item.active:focus {
|
|
||||||
text-shadow: 0 -1px 0 #286090;
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #2b669a;
|
|
||||||
}
|
|
||||||
.list-group-item.active .badge,
|
|
||||||
.list-group-item.active:hover .badge,
|
|
||||||
.list-group-item.active:focus .badge {
|
|
||||||
text-shadow: none;
|
|
||||||
}
|
|
||||||
.panel {
|
|
||||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
|
|
||||||
}
|
|
||||||
.panel-default > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
|
|
||||||
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.panel-primary > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
|
|
||||||
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.panel-success > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
|
|
||||||
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.panel-info > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
|
|
||||||
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.panel-warning > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
|
|
||||||
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.panel-danger > .panel-heading {
|
|
||||||
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
|
|
||||||
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
}
|
|
||||||
.well {
|
|
||||||
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
|
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
|
|
||||||
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
border-color: #dcdcdc;
|
|
||||||
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
|
|
||||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
|
|
||||||
}
|
|
||||||
/*# sourceMappingURL=bootstrap-theme.css.map */
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6757
Client/Dependences/bootstrap-3.3.7/css/bootstrap.css
vendored
6757
Client/Dependences/bootstrap-3.3.7/css/bootstrap.css
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2377
Client/Dependences/bootstrap-3.3.7/js/bootstrap.js
vendored
2377
Client/Dependences/bootstrap-3.3.7/js/bootstrap.js
vendored
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
@@ -21,9 +21,9 @@
|
|||||||
<button class="save-btn">Speichern</button>
|
<button class="save-btn">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../jquery-3.3.1.min.js"></script>
|
<script src="package://Dependencies/jquery-3.3.1.min.js"></script>
|
||||||
<script src="jquery.tablednd.0.8.min.js"></script>
|
<script src="package://Dependencies/jquery.tablednd.0.8.min.js"></script>
|
||||||
<script src="jquery.gettable.js"></script>
|
<script src="package://Dependencies/jquery.gettable.js"></script>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1 +0,0 @@
|
|||||||
!function (n) { "use strict"; function e(e, t) { n.each(t, function (t, o) { n.inArray(o, e) < 0 && e.push(o) }) } function t(t, o) { function r(n) { var e; if (!c.rows[n]) for (e = 0; n >= e; e++)c.rows[e] = c.rows[e] || { cells: [], table: c }; return c.rows[n] } function l(n) { var e; if (!c.cols[n]) for (e = 0; n >= e; e++)c.cols[e] = c.cols[e] || { cells: [], table: c }; return c.cols[n] } var c = { rows: [], cols: [], cells: [] }, s = "number" == typeof o ? o : y.length, u = -1, a = {}, i = "table" === t.get(0).nodeName.toLowerCase() ? t.get(0) : function () { var n = t.closest("table"); return n.length ? n.get(0) : void 0 }(); return i ? (c.elm = i, n(i).data(N, "table:" + s), n.each(i.rows, function (e, t) { var o, i, f, h, w, v, g, m, b, d = 0; for (n(t).data(N, "table:" + s + ",row:" + e), function () { var e = 0; n.each(t.cells, function (n, t) { e += +t.colSpan || 1 }), e - 1 > u && (u = e - 1) }(), h = 0; u >= h; h++)if ((!a[e] || !a[e][h]) && (w = t.cells[d++])) { for (n(w).data(N, "table:" + s + ",cell:" + c.cells.length), f = { elm: w, rows: [], cols: [], table: c, iRow: e, iCol: h }, v = (+w.rowSpan || 1) - 1, g = (+w.colSpan || 1) - 1, m = 0; v >= m; m++)o = r(e + m), f.rows.push(o), o.cells.push(f); for (m = 0; g >= m; m++)i = l(h + m), f.cols.push(i), i.cells.push(f); for (m = 1; v >= m; m++)for (a[e + m] = a[e + m] || {}, b = 0; g >= b; b++)a[e + m][h + b] = !0; h += g, c.cells.push(f) } }), n.each(c.cells, function (t, o) { var r = [o]; n.each(o.rows.concat(o.cols), function (n, t) { e(r, t.cells) }), o.xCells = r }), n.each(c.rows, function (n, e) { e.cells.sort(function (n, e) { return n.iCol - e.iCol }) }), n.each(c.cols, function (n, e) { e.cells.sort(function (n, e) { return n.iRow - e.iRow }) }), y[s] = c, c) : null } function o(n) { for (var e, t = {}, o = n.data(N) || "", r = /\b(\w+):(\d+)/g; null !== (e = r.exec(o));)t[e[1]] = +e[2]; return t } function r(n, e) { var r = o(n).table; return e || "number" != typeof r || !y[r] ? t(n, r) : y[r] } function l(n) { return "table" === n } function c(n) { return "tr" === n } function s(n) { return "td" === n || "th" === n } function u(n) { return "thead" === n || "tfoot" === n || "tbody" === n } function a(n) { return l(n) || c(n) || s(n) || u(n) } function i(e) { return n.map(e, function (n) { return n.elm }) } function f(e) { return n(i(e)) } function h(t) { var a = []; return t.each(function () { var t, f = n(this), h = f.get(0).nodeName.toLowerCase(); l(h) && (t = r(f)) ? e(a, i(t.cells)) : c(h) && (t = r(f)) ? e(a, i(t.rows[o(f).row].cells)) : s(h) && (t = r(f)) ? e(a, [t.cells[o(f).cell].elm]) : u(h) && (t = r(f)) && n.each(f.get(0).rows, function (r, l) { e(a, i(t.rows[o(n(l)).row].cells)) }) }), n(a.length ? a : null) } function w(t) { var l = []; return t.each(function () { var t, c = n(this), u = c.get(0).nodeName.toLowerCase(); s(u) && (t = r(c)) && e(l, i(t.cells[o(c).cell].xCells)) }), n(l.length ? l : null) } function v(t) { var a = []; return t.each(function () { var t, i = n(this), f = i.get(0).nodeName.toLowerCase(); l(f) && (t = r(i)) ? e(a, t.rows) : c(f) && (t = r(i)) ? e(a, [t.rows[o(i).row]]) : s(f) && (t = r(i)) ? e(a, t.cells[o(i).cell].rows) : u(f) && (t = r(i)) && e(a, n.map(i.get(0).rows, function (e) { return t.rows[o(n(e)).row] })) }), a } function g(t) { var a = []; return t.each(function () { var t, i = n(this), f = i.get(0).nodeName.toLowerCase(); (l(f) || c(f) || u(f)) && (t = r(i)) ? e(a, t.cols) : s(f) && (t = r(i)) && e(a, t.cells[o(i).cell].cols) }), a } function m(e) { return n.map(v(e), function (n) { return f(n.cells) }) } function b(t) { var o = []; return n.each(v(t), function (n, t) { e(o, i(t.cells)) }), n(o.length ? o : null) } function d(e) { return n.map(g(e), function (n) { return f(n.cells) }) } function p(t) { var o = []; return n.each(g(t), function (n, t) { e(o, i(t.cells)) }), n(o.length ? o : null) } function C(t) { var o = []; return t.each(function () { var t, l = n(this), c = l.get(0).nodeName.toLowerCase(); a(c) && (t = r(l)) && e(o, [t.elm]) }), n(o.length ? o : null) } function L(e) { return e.each(function () { var e = n(this), t = e.get(0).nodeName.toLowerCase(); a(t) && r(e, !0) }) } var N = "getTable", y = []; n.fn[N] = function (n) { return "cells" === n ? h(this) : "xCells" === n ? w(this) : "rows" === n ? m(this) : "rowsCells" === n ? b(this) : "cols" === n ? d(this) : "colsCells" === n ? p(this) : "table" === n ? C(this) : L(this) } }(jQuery);
|
|
||||||
File diff suppressed because one or more lines are too long
2
Client/FactionManagement/jquery-3.3.1.min.js
vendored
2
Client/FactionManagement/jquery-3.3.1.min.js
vendored
File diff suppressed because one or more lines are too long
2
Client/Login/jquery-3.3.1.min.js
vendored
2
Client/Login/jquery-3.3.1.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -7,7 +7,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<script src="../Dependences/jquery-3.3.1.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="jquery-3.3.1.min.js"></script>
|
<script src="package://Dependencies/jquery-3.3.1.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(".message a").click(function () {
|
$(".message a").click(function () {
|
||||||
$(".form-l").animate({ height: "toggle", opacity: "toggle" }, "slow");
|
$(".form-l").animate({ height: "toggle", opacity: "toggle" }, "slow");
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<script src="../Dependences/jquery-3.3.1.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -67,6 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="package:///Dependencies/jquery-3.3.1.min.js"></script>
|
||||||
<script src="save.js" type="text/javascript"></script>
|
<script src="save.js" type="text/javascript"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -149,14 +149,14 @@ mp.events.add("showTuningMenu", () => {
|
|||||||
|
|
||||||
mainMenu.ItemSelect.on((item) => {
|
mainMenu.ItemSelect.on((item) => {
|
||||||
var modSlot = getSlotId(item.Text);
|
var modSlot = getSlotId(item.Text);
|
||||||
var currentMod = localVehicle.getMod(modSlot);
|
|
||||||
var currentModItem;
|
|
||||||
|
|
||||||
if (item.Text.startsWith("Slot")) {
|
if (item.Text.startsWith("Slot")) {
|
||||||
restStr = item.Text.substring(5);
|
restStr = item.Text.substring(5);
|
||||||
modSlot = parseInt(restStr);
|
modSlot = parseInt(restStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentMod = localVehicle.getMod(modSlot);
|
||||||
|
var currentModItem;
|
||||||
|
|
||||||
var modNum = localVehicle.getNumMods(modSlot);
|
var modNum = localVehicle.getNumMods(modSlot);
|
||||||
|
|
||||||
var modMenu = new Menu(item.Text, "Änderung: " + item.Text, new Point(50, 50));
|
var modMenu = new Menu(item.Text, "Änderung: " + item.Text, new Point(50, 50));
|
||||||
@@ -201,9 +201,6 @@ mp.events.add("showTuningMenu", () => {
|
|||||||
|
|
||||||
modMenu.MenuClose.on(() => {
|
modMenu.MenuClose.on(() => {
|
||||||
localVehicle.setMod(modSlot, currentMod);
|
localVehicle.setMod(modSlot, currentMod);
|
||||||
});
|
|
||||||
|
|
||||||
modMenu.MenuClose.on(() => {
|
|
||||||
mainMenu.Visible = true;
|
mainMenu.Visible = true;
|
||||||
modMenu.Visible = false;
|
modMenu.Visible = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,3 +31,5 @@ require('./Save/main.js');
|
|||||||
require('./Speedometer/index.js');
|
require('./Speedometer/index.js');
|
||||||
|
|
||||||
require('./Tuning/main.js');
|
require('./Tuning/main.js');
|
||||||
|
|
||||||
|
require('./Business/main.js');
|
||||||
|
|||||||
66
Client/inputhelper/index.js
Normal file
66
Client/inputhelper/index.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
class InputHelper {
|
||||||
|
constructor(title) {
|
||||||
|
this.title = title;
|
||||||
|
|
||||||
|
this.cefTitleCall = this.cefTitleCall.bind(this);
|
||||||
|
mp.events.add('cef_request_title', this.cefTitleCall);
|
||||||
|
|
||||||
|
this.cefCallback = this.cefCallback.bind(this);
|
||||||
|
mp.events.add('cef_inputhelper_sendvalue', this.cefCallback);
|
||||||
|
|
||||||
|
this.finish = this.finish.bind(this);
|
||||||
|
this.show = this.show.bind(this);
|
||||||
|
this.valueGetter = this.valueGetter.bind(this);
|
||||||
|
this.getValue = this.getValue.bind(this);
|
||||||
|
|
||||||
|
this.value = undefined;
|
||||||
|
|
||||||
|
mp.events.add('render', this.disableControls);
|
||||||
|
}
|
||||||
|
|
||||||
|
disableControls() {
|
||||||
|
for (var i = 0; i <= 33; i++) {
|
||||||
|
mp.game.controls.disableAllControlActions(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {
|
||||||
|
if (this.created) return;
|
||||||
|
this.created = true;
|
||||||
|
this.browser = mp.browsers.new('package://inputhelper/web/inputhelper.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
if (this.browser) {
|
||||||
|
mp.events.remove('cef_inputhelper_sendvalue');
|
||||||
|
mp.events.remove('cef_request_title');
|
||||||
|
mp.events.remove('render', this.disableControls);
|
||||||
|
this.browser.destroy();
|
||||||
|
this.created = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cefTitleCall() {
|
||||||
|
this.browser.execute(`setTitle('${this.title}')`);
|
||||||
|
}
|
||||||
|
|
||||||
|
cefCallback(val) {
|
||||||
|
this.value = val;
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
valueGetter() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setInterval(() => {
|
||||||
|
if (this.value !== undefined) resolve(this.value);
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getValue(callback) {
|
||||||
|
var getVal = await this.valueGetter();
|
||||||
|
callback(getVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports = InputHelper;
|
||||||
50
Client/inputhelper/web/inputhelper.css
Normal file
50
Client/inputhelper/web/inputhelper.css
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#black {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: -1;
|
||||||
|
background-color: rgba(0, 0, 0, .3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-main {
|
||||||
|
display: block;
|
||||||
|
width: 70%;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
background-color: rgba(0, 0, 0, .8);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-main h1 {
|
||||||
|
color: white;
|
||||||
|
font-size: 24px;
|
||||||
|
font-family: "Arial";
|
||||||
|
font-weight: lighter;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-main input {
|
||||||
|
width: 100%;
|
||||||
|
background-color: black;
|
||||||
|
outline: 0;
|
||||||
|
border: grey 1px solid;
|
||||||
|
color: white;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-family: "Arial";
|
||||||
|
font-weight: lighter;
|
||||||
|
}
|
||||||
|
|
||||||
32
Client/inputhelper/web/inputhelper.html
Normal file
32
Client/inputhelper/web/inputhelper.html
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="inputhelper.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="black"></div>
|
||||||
|
<div class="input-main">
|
||||||
|
<h1></h1>
|
||||||
|
<input id="input-value" autofocus>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript" src="package://Dependencies/jquery-3.3.1.min.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
mp.trigger('cef_request_title');
|
||||||
|
|
||||||
|
$('#input-value').keydown(function (e) {
|
||||||
|
if (e.keyCode != 13) return;
|
||||||
|
var currentValue = $('#input-value').val();
|
||||||
|
if (currentValue) {
|
||||||
|
mp.trigger('cef_inputhelper_sendvalue', currentValue);
|
||||||
|
console.log("triggered event: " + currentValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setTitle(title) {
|
||||||
|
$('.input-main h1').text(title);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
4
Main.cs
4
Main.cs
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -21,6 +22,8 @@ namespace reallife_gamemode
|
|||||||
public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-427.5189, 1116.453, 326.7829);
|
public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-427.5189, 1116.453, 326.7829);
|
||||||
public static readonly float DEFAULT_SPAWN_HEADING = 340.8f;
|
public static readonly float DEFAULT_SPAWN_HEADING = 340.8f;
|
||||||
|
|
||||||
|
public static readonly CultureInfo SERVER_CULTURE = new CultureInfo("de-DE");
|
||||||
|
|
||||||
[ServerEvent(Event.ResourceStart)]
|
[ServerEvent(Event.ResourceStart)]
|
||||||
public void OnResourceStart()
|
public void OnResourceStart()
|
||||||
{
|
{
|
||||||
@@ -36,6 +39,7 @@ namespace reallife_gamemode
|
|||||||
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5));
|
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5));
|
||||||
DatabaseHelper.InitDatabaseFirstTime();
|
DatabaseHelper.InitDatabaseFirstTime();
|
||||||
FactionHelper.CheckFactionBankAccounts();
|
FactionHelper.CheckFactionBankAccounts();
|
||||||
|
BusinessManager.LoadBusinesses();
|
||||||
|
|
||||||
|
|
||||||
TempBlip tempBlip = new TempBlip()
|
TempBlip tempBlip = new TempBlip()
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace reallife_gamemode.Model
|
|||||||
|
|
||||||
public DatabaseContext()
|
public DatabaseContext()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
@@ -28,6 +29,21 @@ namespace reallife_gamemode.Model
|
|||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Server.Entities.BusinessBankAccount>()
|
||||||
|
.HasIndex(b => b.BusinessId)
|
||||||
|
.IsUnique(true);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Server.Entities.User>()
|
||||||
|
.HasIndex(u => u.BusinessId)
|
||||||
|
.IsUnique(true);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Server.Entities.ServerVehicle>()
|
||||||
|
.Property(sv => sv.Active)
|
||||||
|
.HasDefaultValue(true);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Server.Entities.VehicleMod>()
|
||||||
|
.HasIndex(vM => new { vM.ServerVehicleId, vM.Slot }).IsUnique();
|
||||||
}
|
}
|
||||||
|
|
||||||
//User
|
//User
|
||||||
@@ -69,7 +85,14 @@ namespace reallife_gamemode.Model
|
|||||||
public DbSet<Server.Saves.SavedVehicle> Vehicles { get; set; }
|
public DbSet<Server.Saves.SavedVehicle> Vehicles { get; set; }
|
||||||
public DbSet<Server.Entities.ShopVehicle> ShopVehicles { get; set; }
|
public DbSet<Server.Entities.ShopVehicle> ShopVehicles { get; set; }
|
||||||
|
|
||||||
|
// Business
|
||||||
|
public DbSet<Server.Entities.BusinessBankAccount> BusinessBankAccounts { get; set; }
|
||||||
|
|
||||||
// Control Panel
|
// Control Panel
|
||||||
public DbSet<Server.Entities.News> News { get; set; }
|
public DbSet<Server.Entities.News> News { get; set; }
|
||||||
|
|
||||||
|
// Server Vehicles
|
||||||
|
public DbSet<Server.Entities.ServerVehicle> ServerVehicles { get; set; }
|
||||||
|
public DbSet<Server.Entities.VehicleMod> VehicleMods { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
Server/Business/BusinessBase.cs
Normal file
102
Server/Business/BusinessBase.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
using reallife_gamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Business
|
||||||
|
{
|
||||||
|
public abstract class BusinessBase : IBankAccountOwner
|
||||||
|
{
|
||||||
|
private TextLabel _informationLabel;
|
||||||
|
private Marker _marker;
|
||||||
|
private ColShape _colShape;
|
||||||
|
|
||||||
|
public abstract int Id { get; }
|
||||||
|
public abstract string Name { get; }
|
||||||
|
|
||||||
|
public abstract Vector3 Position { get; }
|
||||||
|
|
||||||
|
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||||
|
{
|
||||||
|
if (databaseContext == null)
|
||||||
|
{
|
||||||
|
using (databaseContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
_informationLabel = NAPI.TextLabel.CreateTextLabel(Name, Position.Add(new Vector3(0, 0, 0.5)), 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
||||||
|
_marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, Position.Subtract(new Vector3(0, 0, 1.5)), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255), true);
|
||||||
|
|
||||||
|
_colShape = NAPI.ColShape.CreateSphereColShape(Position.Subtract(new Vector3(0, 0, 1.5)), 3f);
|
||||||
|
_colShape.OnEntityEnterColShape += EntityEnterBusinessColShape;
|
||||||
|
_colShape.OnEntityExitColShape += EntityExitBusinessColShape;
|
||||||
|
|
||||||
|
if (GetBankAccount() == null)
|
||||||
|
{
|
||||||
|
NAPI.Util.ConsoleOutput("Creating Bank Account for Business: " + Name);
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
|
||||||
|
dbContext.BusinessBankAccounts.Add(new BusinessBankAccount()
|
||||||
|
{
|
||||||
|
BusinessId = Id,
|
||||||
|
Balance = 0
|
||||||
|
});
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EntityExitBusinessColShape(ColShape colShape, Client client)
|
||||||
|
{
|
||||||
|
client.TriggerEvent("business_removeHelp", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EntityEnterBusinessColShape(ColShape colShape, Client client)
|
||||||
|
{
|
||||||
|
if (GetOwner() != null && GetOwner().Id == client.GetUser()?.Id && !client.IsInVehicle)
|
||||||
|
{
|
||||||
|
client.TriggerEvent("business_showHelp", Name, (GetBankAccount()?.Balance ?? 0).ToMoneyString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(int? money = null)
|
||||||
|
{
|
||||||
|
if (money == null) money = GetBankAccount()?.Balance ?? 0;
|
||||||
|
User owner = GetOwner();
|
||||||
|
string infoText = Name + "\n" + "Besitzer: " + (owner == null ? "Niemand" : owner.Name) + "\nKasse: ~g~" + money.ToMoneyString();
|
||||||
|
_informationLabel.Text = infoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User GetOwner(DatabaseContext dbContext = null)
|
||||||
|
{
|
||||||
|
if(dbContext == null)
|
||||||
|
{
|
||||||
|
using (dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
return dbContext.Users.FirstOrDefault(u => u.BusinessId == Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dbContext.Users.FirstOrDefault(u => u.BusinessId == Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void Load();
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Server/Business/ShopBusiness.cs
Normal file
21
Server/Business/ShopBusiness.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Business
|
||||||
|
{
|
||||||
|
class ShopBusiness : BusinessBase
|
||||||
|
{
|
||||||
|
public override int Id => 2;
|
||||||
|
|
||||||
|
public override string Name => "24/7 Business";
|
||||||
|
|
||||||
|
public override Vector3 Position => new Vector3(-443, 1134, 326);
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Server/Business/TelefonBusiness.cs
Normal file
21
Server/Business/TelefonBusiness.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Business
|
||||||
|
{
|
||||||
|
public class TelefonBusiness : BusinessBase
|
||||||
|
{
|
||||||
|
public override int Id => 1;
|
||||||
|
|
||||||
|
public override string Name => "Telefon Business";
|
||||||
|
|
||||||
|
public override Vector3 Position => new Vector3(-423, 1130, 326);
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using reallife_gamemode.Server.Managers;
|
|||||||
using reallife_gamemode.Server.Inventory.Items;
|
using reallife_gamemode.Server.Inventory.Items;
|
||||||
using reallife_gamemode.Server.Inventory.Interfaces;
|
using reallife_gamemode.Server.Inventory.Interfaces;
|
||||||
using reallife_gamemode.Server.Saves;
|
using reallife_gamemode.Server.Saves;
|
||||||
|
using reallife_gamemode.Server.Business;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
||||||
@@ -216,11 +217,12 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (target == player) //TODO: wieder reintun, musste testen
|
if (target == player)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMsg(player);
|
ChatService.ErrorMsg(player);
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
player.SendChatMessage("~y~PM an " + target.Name + ": " + msg + " ");
|
player.SendChatMessage("~y~PM an " + target.Name + ": " + msg + " ");
|
||||||
string Message = "~y~PM von " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + msg + "";
|
string Message = "~y~PM von " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + msg + "";
|
||||||
NAPI.Chat.SendChatMessageToPlayer(target, Message);
|
NAPI.Chat.SendChatMessageToPlayer(target, Message);
|
||||||
@@ -244,6 +246,22 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("businesslist", "~m~Benutzung: ~s~/businesslist")]
|
||||||
|
public void CmdAdminBusinessList(Client player)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SendChatMessage("~m~__________ ~s~Businesses ~m~__________");
|
||||||
|
foreach (Business.BusinessBase b in BusinessManager.Businesses)
|
||||||
|
{
|
||||||
|
player.SendChatMessage(b.Id.ToString().PadRight(3) + " | " + b.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -309,11 +327,14 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var gotoString = "";
|
var gotoString = "";
|
||||||
foreach (GotoPoint point in LoadManager.GotoPointList)
|
using(var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
if (point.Active)
|
foreach (GotoPoint point in dbContext.GotoPoints)
|
||||||
{
|
{
|
||||||
gotoString += point.Description + ", ";
|
if (point.Active)
|
||||||
|
{
|
||||||
|
gotoString += point.Description + ", ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.SendChatMessage(gotoString);
|
player.SendChatMessage(gotoString);
|
||||||
@@ -594,7 +615,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
if (ban.Applied == ban.UntilDateTime)
|
if (ban.Applied == ban.UntilDateTime)
|
||||||
{
|
{
|
||||||
user.UnbanPlayer(admin);
|
user.UnbanPlayer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -605,7 +626,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user.UnbanPlayer(admin);
|
user.UnbanPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
string message = "~b~[ADMIN] ~s~Der Spieler ~y~" + user.Name + " ~s~wurde von ~y~" + admin.Name + " ~s~entbannt.";
|
string message = "~b~[ADMIN] ~s~Der Spieler ~y~" + user.Name + " ~s~wurde von ~y~" + admin.Name + " ~s~entbannt.";
|
||||||
@@ -841,7 +862,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("vdestroy")]
|
[Command("vdestroy")]
|
||||||
public void CmdAdminDelveh(Client player)
|
public void CmdAdminVdestroy(Client player)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? true)
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? true)
|
||||||
{
|
{
|
||||||
@@ -855,10 +876,16 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Checken, ob das Fahrzeug in einem System genutzt wird (Fraktions-Autos / Spieler-Auto)
|
Vehicle playerVeh = player.Vehicle;
|
||||||
* Wenn Ja: Abbrechen und mitteilen, dass man den System-spezifischen Befehl zu nutzen hat */
|
|
||||||
|
|
||||||
player.Vehicle.Delete();
|
ServerVehicle veh = VehicleManager.GetServerVehicleFromVehicle(playerVeh);
|
||||||
|
if(veh != null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Fahrzeug wird von einem Server-System benutzt: ~m~" + veh.GetType().Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VehicleManager.DeleteVehicle(playerVeh);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("vcolor", "~m~Benutzung: ~s~/vcolor [Farb-ID1] [Farb-ID2]")]
|
[Command("vcolor", "~m~Benutzung: ~s~/vcolor [Farb-ID1] [Farb-ID2]")]
|
||||||
@@ -1345,17 +1372,18 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = player.Vehicle;
|
Vehicle vehicle = player.Vehicle;
|
||||||
SaveManager.SaveVehicleData((VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
int playerSeat = player.VehicleSeat;
|
||||||
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), vehicle.Locked, vehicle.EngineStatus, Convert.ToByte(vehicle.Dimension));
|
vehicle = SaveManager.SaveVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
||||||
|
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), vehicle.Locked);
|
||||||
player.SendNotification("Fahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
player.SendNotification("Fahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
||||||
|
player.SetIntoVehicle(vehicle, playerSeat);
|
||||||
}
|
}
|
||||||
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||||
break;
|
break;
|
||||||
case "FVehicle":
|
case "FVehicle":
|
||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
if (player.GetUser().FactionId == null)
|
if (player.GetUser().GetFaction() == null)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~m~Du bist in keiner Fraktion! Invite dich erst mit ~y~/ainvite");
|
player.SendChatMessage("~m~Du bist in keiner Fraktion! Invite dich erst mit ~y~/ainvite");
|
||||||
return;
|
return;
|
||||||
@@ -1363,11 +1391,12 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Vehicle vehicle = player.Vehicle;
|
Vehicle vehicle = player.Vehicle;
|
||||||
SaveManager.SaveFactionVehicleData((VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
player.SendChatMessage("second color: " + vehicle.SecondaryColor);
|
||||||
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), vehicle.Locked, vehicle.EngineStatus, Convert.ToByte(vehicle.Dimension), player.GetUser().FactionId);
|
int playerSeat = player.VehicleSeat;
|
||||||
vehicle.SetData("factionId", player.GetUser().FactionId);
|
vehicle = SaveManager.SaveFactionVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
||||||
LoadManager.FactionVehicleList.Add(vehicle);
|
vehicle.PrimaryColor, vehicle.SecondaryColor, vehicle.Locked, vehicle.EngineStatus, player.GetUser().FactionId);
|
||||||
player.SendNotification("Fraktionsfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
player.SendNotification("Fraktionsfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
||||||
|
player.SetIntoVehicle(vehicle, playerSeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||||
@@ -1376,10 +1405,11 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = player.Vehicle;
|
Vehicle vehicle = player.Vehicle;
|
||||||
SaveManager.SaveShopVehicleData((VehicleHash)vehicle.Model, vehicle.DisplayName, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
int playerSeat = player.VehicleSeat;
|
||||||
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), Convert.ToByte(vehicle.Dimension), player.GetUser().FactionId);
|
vehicle = SaveManager.SaveShopVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.DisplayName, vehicle.Position, vehicle.Heading, vehicle.NumberPlate,
|
||||||
LoadManager.ShopVehicleList.Add(vehicle);
|
Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor));
|
||||||
player.SendNotification("Shopfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
player.SendNotification("Shopfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true);
|
||||||
|
player.SetIntoVehicle(vehicle, playerSeat);
|
||||||
}
|
}
|
||||||
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||||
break;
|
break;
|
||||||
@@ -1694,6 +1724,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Das Wetter konnte nicht geändert werden");
|
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Das Wetter konnte nicht geändert werden");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier]")] //TODO: Überarbeiten ?? SetPlayerVelocity ??
|
[Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier]")] //TODO: Überarbeiten ?? SetPlayerVelocity ??
|
||||||
public void CmdAdminAspeed(Client player, float modifier)
|
public void CmdAdminAspeed(Client player, float modifier)
|
||||||
{
|
{
|
||||||
@@ -1711,7 +1742,8 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
player.Vehicle.EnginePowerMultiplier = modifier;
|
player.Vehicle.EnginePowerMultiplier = modifier;
|
||||||
}
|
}
|
||||||
[Command("setmoney")]
|
|
||||||
|
[Command("setmoney", "~m~Benutzung: ~s~/setmoney [Name] [Menge]")]
|
||||||
public void SetPlayerMoney(Client player, string receiver, int amount)
|
public void SetPlayerMoney(Client player, string receiver, int amount)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
@@ -1735,7 +1767,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
target.SendChatMessage("~b~[ADMIN]~s~ Dein Geld wurde von Admin " + player.Name + " auf ~g~$" + amount + "~s~ gesetzt.");
|
target.SendChatMessage("~b~[ADMIN]~s~ Dein Geld wurde von Admin " + player.Name + " auf ~g~$" + amount + "~s~ gesetzt.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("givemoney")]
|
[Command("givemoney", "~m~Benutzung: ~s~/givemoney [Name] [Menge]")]
|
||||||
public void GivePlayerMoney(Client player, string receiver, int amount)
|
public void GivePlayerMoney(Client player, string receiver, int amount)
|
||||||
{
|
{
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
@@ -1743,6 +1775,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client target = ClientService.GetClientByNameOrId(receiver);
|
Client target = ClientService.GetClientByNameOrId(receiver);
|
||||||
if (target == null || !target.IsLoggedIn())
|
if (target == null || !target.IsLoggedIn())
|
||||||
{
|
{
|
||||||
@@ -1758,6 +1791,106 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.SendChatMessage("~b~[ADMIN]~s~ Du hast " + target.Name + " ~g~$" + amount + "~s~ gegeben.");
|
player.SendChatMessage("~b~[ADMIN]~s~ Du hast " + target.Name + " ~g~$" + amount + "~s~ gegeben.");
|
||||||
target.SendChatMessage("~b~[ADMIN]~s~ Admin " + player.Name + " hat dir ~g~$" + amount + "~s~ gegeben.");
|
target.SendChatMessage("~b~[ADMIN]~s~ Admin " + player.Name + " hat dir ~g~$" + amount + "~s~ gegeben.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("setbusinessowner", "~m~Benutzung: ~s~/setbusinessowner [Name] [Business ID]")]
|
||||||
|
public void CmdAdminSetbusinessowner(Client player, string name, int businessid)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByNameOrId(name);
|
||||||
|
if (target == null || !target.IsLoggedIn())
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(target.GetUser().BusinessId != null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Der Spieler besitzt momentan schon ein Business: ~o~" + BusinessManager.GetBusiness(target.GetUser().BusinessId).Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BusinessBase business = BusinessManager.GetBusiness(businessid);
|
||||||
|
if(business == null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business existiert nicht. ~m~/businesslist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(business.GetOwner() != null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Das Business hat momentan noch einen Besitzer: ~o~" + business.GetOwner().Name + "~s~. Entferne diesen Besitzer erst mit ~m~/clearbusiness");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
Entities.User targetUser = target.GetUser(dbContext);
|
||||||
|
targetUser.BusinessId = businessid;
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
business.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("clearbusiness", "~m~Benutzung:~s~ /clearbusiness [Business ID]")]
|
||||||
|
public void CmdAdminClearbusiness(Client player, int businessid)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BusinessBase business = BusinessManager.GetBusiness(businessid);
|
||||||
|
if (business == null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business existiert nicht. ~m~/businesslist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
Entities.User owner = business.GetOwner(dbContext);
|
||||||
|
if(owner == null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business hat momentan keinen Besitzer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
owner.BusinessId = null;
|
||||||
|
business.GetBankAccount(dbContext).Balance = 0;
|
||||||
|
|
||||||
|
owner.GetClient()?.SendChatMessage("~b~[ADMIN]~s~ Dir wurde von ~y~" + player.Name + "~s~ dein Business entzogen.");
|
||||||
|
player.SendChatMessage("~b~[ADMIN]~s~ Du hast ~y~" + owner.Name + "~s~ sein Business ~o~" + business.Name + "~s~ entzogen.");
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
business.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("setbusinessbankbalance", "~m~Benutzung: ~s~/setbusinessbankbalance [Business ID] [Menge]")]
|
||||||
|
public void CmdAdminGivebusinessbankbalance(Client player, int businessid, int amount)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BusinessBase business = BusinessManager.GetBusiness(businessid);
|
||||||
|
if (business == null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Business existiert nicht. ~m~/businesslist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BankManager.SetMoney(player, business, amount, "Admin");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ALevel1338
|
#region ALevel1338
|
||||||
@@ -1779,25 +1912,22 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
if (player.IsInVehicle)
|
if (player.IsInVehicle)
|
||||||
{
|
{
|
||||||
Vehicle playerVehicle = player.Vehicle;
|
Vehicle playerVehicle = player.Vehicle;
|
||||||
LoadManager.UserVehicleList.Add(playerVehicle);
|
|
||||||
using (var saveVehicle = new DatabaseContext())
|
using (var saveVehicle = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dataSet = new UserVehicle
|
var dataSet = new UserVehicle
|
||||||
{
|
{
|
||||||
UserId = player.GetUser().Id,
|
UserId = player.GetUser().Id,
|
||||||
Model = (VehicleHash) playerVehicle.Model,
|
Model = (VehicleHash)playerVehicle.Model,
|
||||||
PositionX = playerVehicle.Position.X,
|
PositionX = playerVehicle.Position.X,
|
||||||
PositionY = playerVehicle.Position.Y,
|
PositionY = playerVehicle.Position.Y,
|
||||||
PositionZ = playerVehicle.Position.Z,
|
PositionZ = playerVehicle.Position.Z,
|
||||||
Heading = playerVehicle.Heading,
|
Heading = playerVehicle.Heading,
|
||||||
NumberPlate = playerVehicle.NumberPlate,
|
NumberPlate = playerVehicle.NumberPlate,
|
||||||
PrimaryColor = Convert.ToByte(playerVehicle.PrimaryColor),
|
PrimaryColor = playerVehicle.PrimaryColor,
|
||||||
SecondaryColor = Convert.ToByte(playerVehicle.SecondaryColor),
|
SecondaryColor = playerVehicle.SecondaryColor,
|
||||||
Locked = playerVehicle.Locked,
|
Locked = playerVehicle.Locked,
|
||||||
Engine = playerVehicle.EngineStatus,
|
Active = true
|
||||||
Dimension = Convert.ToByte(playerVehicle.Dimension),
|
|
||||||
};
|
};
|
||||||
playerVehicle.SetData("ownerId",player.GetUser().Id);
|
|
||||||
saveVehicle.UserVehicles.Add(dataSet);
|
saveVehicle.UserVehicles.Add(dataSet);
|
||||||
saveVehicle.SaveChanges();
|
saveVehicle.SaveChanges();
|
||||||
}
|
}
|
||||||
@@ -1805,13 +1935,6 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TODO TEST COMMAND
|
|
||||||
|
|
||||||
//TEST COMMAND
|
//TEST COMMAND
|
||||||
[Command("myvehicles")]
|
[Command("myvehicles")]
|
||||||
public void CmdAdminMyVehicles(Client player)
|
public void CmdAdminMyVehicles(Client player)
|
||||||
@@ -1878,10 +2001,10 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
ShopVehicle sVehicle = getShopVehicle.ShopVehicles.FirstOrDefault(u => u.Id == shopVehicleId);
|
ShopVehicle sVehicle = getShopVehicle.ShopVehicles.FirstOrDefault(u => u.Id == shopVehicleId);
|
||||||
Entities.Faction receiverUser = getShopVehicle.Factions.FirstOrDefault(u => u.Name == "LSPD");
|
Entities.Faction receiverUser = getShopVehicle.Factions.FirstOrDefault(u => u.Name == "LSPD");
|
||||||
BankManager.TransferMoney(player.GetUser(), receiverUser, sVehicle.Price, "Fahrzeug gekauft: " + sVehicle.ModelName);
|
BankManager.TransferMoney(player.GetUser(), receiverUser, sVehicle.Price, "Fahrzeug gekauft: " + NAPI.Vehicle.GetVehicleDisplayName(sVehicle.Model));
|
||||||
//TODO Anpassen
|
//TODO Anpassen
|
||||||
Vehicle boughtVehicle = NAPI.Vehicle.CreateVehicle(sVehicle.Model, new Vector3(sVehicle.PositionX, sVehicle.PositionY + 10, sVehicle.PositionZ + 0.5), sVehicle.Heading,
|
Vehicle boughtVehicle = NAPI.Vehicle.CreateVehicle(sVehicle.Model, new Vector3(sVehicle.PositionX, sVehicle.PositionY + 10, sVehicle.PositionZ + 0.5), sVehicle.Heading,
|
||||||
sVehicle.PrimaryColor, sVehicle.SecondaryColor, "LoG", sVehicle.Alpha, false, true, 0);
|
sVehicle.PrimaryColor, sVehicle.SecondaryColor, "LoG", 255, false, true, 0);
|
||||||
player.SetIntoVehicle(boughtVehicle, 0);
|
player.SetIntoVehicle(boughtVehicle, 0);
|
||||||
//TODO fügt das Fahrzeug als Userfahrzeug hinzu
|
//TODO fügt das Fahrzeug als Userfahrzeug hinzu
|
||||||
CmdAdminOwn(player);
|
CmdAdminOwn(player);
|
||||||
|
|||||||
31
Server/Entities/BusinessBankAccount.cs
Normal file
31
Server/Entities/BusinessBankAccount.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using reallife_gamemode.Server.Business;
|
||||||
|
using reallife_gamemode.Server.Managers;
|
||||||
|
using reallife_gamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class BusinessBankAccount : IBankAccount
|
||||||
|
{
|
||||||
|
[NotMapped]
|
||||||
|
private int _balance;
|
||||||
|
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Balance {
|
||||||
|
get => _balance;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_balance = value;
|
||||||
|
BusinessManager.GetBusiness(BusinessId).Update(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int BusinessId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,28 +16,19 @@ using System.Text;
|
|||||||
|
|
||||||
namespace reallife_gamemode.Server.Entities
|
namespace reallife_gamemode.Server.Entities
|
||||||
{
|
{
|
||||||
public class FactionVehicle
|
[Table("FactionVehicles")]
|
||||||
|
public class FactionVehicle : ServerVehicle
|
||||||
{
|
{
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[ForeignKey("Faction")]
|
[ForeignKey("Faction")]
|
||||||
public int? FactionId { get; set; }
|
public int? FactionId { get; set; }
|
||||||
public Faction Faction { get; set; }
|
public Faction Faction { get; set; }
|
||||||
|
|
||||||
public VehicleHash Model { get; set; }
|
public Faction GetFaction()
|
||||||
public float PositionX { get; set; }
|
{
|
||||||
public float PositionY { get; set; }
|
using (var context = new DatabaseContext())
|
||||||
public float PositionZ { get; set; }
|
{
|
||||||
public float Heading { get; set; }
|
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
|
||||||
[StringLength(8)]
|
}
|
||||||
public string NumberPlate { get; set; }
|
}
|
||||||
public byte Alpha { get; set; }
|
|
||||||
public byte PrimaryColor { get; set; }
|
|
||||||
public byte SecondaryColor { get; set; }
|
|
||||||
public bool Locked { get; set; }
|
|
||||||
public bool Engine { get; set; }
|
|
||||||
public byte Dimension { get; set; }
|
|
||||||
public bool Active { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
Server/Entities/ServerVehicle.cs
Normal file
47
Server/Entities/ServerVehicle.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Managers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public abstract class ServerVehicle
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public VehicleHash Model { get; set; }
|
||||||
|
public float PositionX { get; set; }
|
||||||
|
public float PositionY { get; set; }
|
||||||
|
public float PositionZ { get; set; }
|
||||||
|
public float Heading { get; set; }
|
||||||
|
[StringLength(8)]
|
||||||
|
public string NumberPlate { get; set; }
|
||||||
|
public int PrimaryColor { get; set; }
|
||||||
|
public int SecondaryColor { get; set; }
|
||||||
|
public bool Locked { get; set; }
|
||||||
|
public bool Active { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
|
||||||
|
|
||||||
|
public Vehicle Spawn(Vehicle currentVeh = null)
|
||||||
|
{
|
||||||
|
if (currentVeh != null) VehicleManager.DeleteVehicle(currentVeh);
|
||||||
|
Vehicle veh = NAPI.Vehicle.CreateVehicle(this.Model, this.Position, this.Heading, this.PrimaryColor, this.SecondaryColor, this.NumberPlate, locked: this.Locked, engine: false);
|
||||||
|
VehicleManager.AddVehicle(this, veh);
|
||||||
|
|
||||||
|
if(this is FactionVehicle fV)
|
||||||
|
{
|
||||||
|
veh.NumberPlate = fV.GetFaction().Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return veh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,30 +14,12 @@ using System.Text;
|
|||||||
|
|
||||||
namespace reallife_gamemode.Server.Entities
|
namespace reallife_gamemode.Server.Entities
|
||||||
{
|
{
|
||||||
public class ShopVehicle
|
[Table("ShopVehicles")]
|
||||||
|
public class ShopVehicle : ServerVehicle
|
||||||
{
|
{
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("Shop")]
|
[ForeignKey("Shop")]
|
||||||
public int? ShopId { get; set; }
|
public int? ShopId { get; set; }
|
||||||
public Shop Shop { get; set; }
|
public Shop Shop { get; set; }
|
||||||
|
|
||||||
public VehicleHash Model { get; set; }
|
|
||||||
[StringLength(32)]
|
|
||||||
public string ModelName { get; set; }
|
|
||||||
public int Price { get; set; }
|
public int Price { get; set; }
|
||||||
public float PositionX { get; set; }
|
|
||||||
public float PositionY { get; set; }
|
|
||||||
public float PositionZ { get; set; }
|
|
||||||
public float Heading { get; set; }
|
|
||||||
[StringLength(8)]
|
|
||||||
public string NumberPlate { get; set; }
|
|
||||||
public byte Alpha { get; set; }
|
|
||||||
public byte PrimaryColor { get; set; }
|
|
||||||
public byte SecondaryColor { get; set; }
|
|
||||||
public byte Dimension { get; set; }
|
|
||||||
public bool Active { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ using reallife_gamemode.Model;
|
|||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Entities User (User.cs)
|
* @overview Life of German Reallife - Entities User (User.cs)
|
||||||
@@ -59,6 +57,8 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
public int? FactionRankId { get; set; }
|
public int? FactionRankId { get; set; }
|
||||||
public FactionRank FactionRank { get;set; }
|
public FactionRank FactionRank { get;set; }
|
||||||
|
|
||||||
|
public int? BusinessId { get; set; }
|
||||||
|
|
||||||
public Faction GetFaction()
|
public Faction GetFaction()
|
||||||
{
|
{
|
||||||
using(var context = new DatabaseContext())
|
using(var context = new DatabaseContext())
|
||||||
@@ -100,14 +100,16 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
{
|
{
|
||||||
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]");
|
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " permanent gebannt. [" + reason + "]");
|
||||||
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
|
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
|
||||||
//TODO user.Kick();
|
|
||||||
|
GetClient()?.Kick();
|
||||||
|
|
||||||
mins--;
|
mins--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]");
|
NAPI.Chat.SendChatMessageToAll("!{#FF4040}[BAN] " + this.Name + " wurde von " + admin.Name + " für " + mins + " Minuten gebannt. [" + reason + "]");
|
||||||
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 };
|
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp + mins * 60 };
|
||||||
//TODO user.Kick();
|
GetClient()?.Kick();
|
||||||
}
|
}
|
||||||
|
|
||||||
banUserContext.Bans.Add(banUser);
|
banUserContext.Bans.Add(banUser);
|
||||||
@@ -119,12 +121,11 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnbanPlayer(Client admin)
|
public void UnbanPlayer()
|
||||||
{
|
{
|
||||||
using (var unbanUser = new DatabaseContext())
|
using (var unbanUser = new DatabaseContext())
|
||||||
{
|
{
|
||||||
User user = admin.GetUser();
|
var targetUser = unbanUser.Users.FirstOrDefault(u => u.Id == this.Id);
|
||||||
var targetUser = unbanUser.Users.FirstOrDefault(u => u.Id == user.Id);
|
|
||||||
targetUser.BanId = null;
|
targetUser.BanId = null;
|
||||||
unbanUser.SaveChanges();
|
unbanUser.SaveChanges();
|
||||||
}
|
}
|
||||||
@@ -153,5 +154,10 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Client GetClient()
|
||||||
|
{
|
||||||
|
return NAPI.Player.GetPlayerFromName(Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,27 +14,11 @@ using System.Text;
|
|||||||
|
|
||||||
namespace reallife_gamemode.Server.Entities
|
namespace reallife_gamemode.Server.Entities
|
||||||
{
|
{
|
||||||
public class UserVehicle
|
[Table("UserVehicles")]
|
||||||
|
public class UserVehicle : ServerVehicle
|
||||||
{
|
{
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
[ForeignKey("User")]
|
[ForeignKey("User")]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
public VehicleHash Model { get; set; }
|
|
||||||
public float PositionX { get; set; }
|
|
||||||
public float PositionY { get; set; }
|
|
||||||
public float PositionZ { get; set; }
|
|
||||||
public float Heading { get; set; }
|
|
||||||
[StringLength(8)]
|
|
||||||
public string NumberPlate { get; set; }
|
|
||||||
public byte Alpha { get; set; }
|
|
||||||
public byte PrimaryColor { get; set; }
|
|
||||||
public byte SecondaryColor { get; set; }
|
|
||||||
public bool Locked { get; set; }
|
|
||||||
public bool Engine { get; set; }
|
|
||||||
public byte Dimension { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
Server/Entities/VehicleMod.cs
Normal file
22
Server/Entities/VehicleMod.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class VehicleMod
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Vehicle")]
|
||||||
|
public int ServerVehicleId { get; set; }
|
||||||
|
public ServerVehicle Vehicle { get; set; }
|
||||||
|
|
||||||
|
public int Slot { get; set; }
|
||||||
|
public int ModId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Server/Extensions/IntegerExtension.cs
Normal file
18
Server/Extensions/IntegerExtension.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Extensions
|
||||||
|
{
|
||||||
|
public static class IntegerExtension
|
||||||
|
{
|
||||||
|
public static string ToMoneyString(this int? money)
|
||||||
|
{
|
||||||
|
return ToMoneyString(money ?? 0);
|
||||||
|
}
|
||||||
|
public static string ToMoneyString(this int money)
|
||||||
|
{
|
||||||
|
return string.Format(Main.SERVER_CULTURE, "{0:C0}", money).Replace('€', '$');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +1,17 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using reallife_gamemode.Model;
|
|
||||||
using reallife_gamemode.Server.Entities;
|
using reallife_gamemode.Server.Entities;
|
||||||
using reallife_gamemode.Server.Managers;
|
using reallife_gamemode.Server.Managers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
/**
|
|
||||||
* @overview Life of German Reallife - Vehicle Extension (VehicleExtension.cs)
|
|
||||||
* @author hydrant
|
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace reallife_gamemode.Server.Extensions
|
namespace reallife_gamemode.Server.Extensions
|
||||||
{
|
{
|
||||||
public static class VehicleExtension
|
public static class VehicleExtension
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static ServerVehicle GetServerVehicle(this Vehicle veh)
|
||||||
/// Gibt zurück, ob das Vehicle ein Fraktions-Fahrzeug ist
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vehicle">Das Vehicle, von dem man wissen möchte, ob es ein Fraktionsfahrzeug ist</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsFactionVehicle(this Vehicle vehicle)
|
|
||||||
{
|
{
|
||||||
return LoadManager.FactionVehicleList.Contains(vehicle);
|
return VehicleManager.GetServerVehicleFromVehicle(veh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Server.Business;
|
||||||
using reallife_gamemode.Server.Entities;
|
using reallife_gamemode.Server.Entities;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
@@ -13,11 +14,44 @@ using reallife_gamemode.Server.Util;
|
|||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace reallife_gamemode.Server.Managers
|
namespace reallife_gamemode.Server.Managers
|
||||||
{
|
{
|
||||||
public class BankManager : Script
|
public class BankManager
|
||||||
{
|
{
|
||||||
|
public static TransactionResult SetMoney(Client admin, IBankAccountOwner owner, int amount, string reason = "Von Admin gesetzt")
|
||||||
|
{
|
||||||
|
using (var transferMoney = new Model.DatabaseContext())
|
||||||
|
{
|
||||||
|
if (amount < 0) return TransactionResult.NEGATIVE_MONEY_SENT;
|
||||||
|
|
||||||
|
IBankAccount account = owner.GetBankAccount(transferMoney);
|
||||||
|
|
||||||
|
if (account == null) return TransactionResult.RECEIVER_NO_BANKACCOUNT;
|
||||||
|
|
||||||
|
var transactionLog = new Logs.BankAccountTransactionHistory
|
||||||
|
{
|
||||||
|
Sender = "ADMIN: " + admin.Name,
|
||||||
|
SenderBalance = 0,
|
||||||
|
Receiver = owner.Name,
|
||||||
|
ReceiverBalance = amount,
|
||||||
|
NewReceiverBalance = amount,
|
||||||
|
NewSenderBalance = 0,
|
||||||
|
MoneySent = amount,
|
||||||
|
Fee = 0,
|
||||||
|
Origin = reason
|
||||||
|
};
|
||||||
|
|
||||||
|
// add log
|
||||||
|
transferMoney.BankAccountTransactionLogs.Add(transactionLog);
|
||||||
|
|
||||||
|
account.Balance = amount;
|
||||||
|
|
||||||
|
transferMoney.SaveChanges();
|
||||||
|
|
||||||
|
return TransactionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static TransactionResult TransferMoney(IBankAccountOwner sender, IBankAccountOwner receiver, int amount, string origin)
|
public static TransactionResult TransferMoney(IBankAccountOwner sender, IBankAccountOwner receiver, int amount, string origin)
|
||||||
{
|
{
|
||||||
using (var transferMoney = new Model.DatabaseContext())
|
using (var transferMoney = new Model.DatabaseContext())
|
||||||
|
|||||||
112
Server/Managers/BusinessManager.cs
Normal file
112
Server/Managers/BusinessManager.cs
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Server.Business;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
using reallife_gamemode.Server.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Managers
|
||||||
|
{
|
||||||
|
class BusinessManager : Script
|
||||||
|
{
|
||||||
|
public static List<BusinessBase> Businesses { get; private set; }
|
||||||
|
|
||||||
|
public static void LoadBusinesses()
|
||||||
|
{
|
||||||
|
Businesses = new List<BusinessBase>();
|
||||||
|
|
||||||
|
IEnumerable<Type> allTypes = Assembly.GetExecutingAssembly().GetTypes().Where(type => type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(BusinessBase)));
|
||||||
|
foreach (Type item in allTypes)
|
||||||
|
{
|
||||||
|
NAPI.Util.ConsoleOutput($"Loading Business {item.Name}");
|
||||||
|
if (Activator.CreateInstance(item) is BusinessBase o)
|
||||||
|
{
|
||||||
|
if (GetBusiness(o.Id) != null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Double Business ID found: {o.Id} | {o.Name}");
|
||||||
|
}
|
||||||
|
Businesses.Add(o);
|
||||||
|
o.Setup();
|
||||||
|
o.Load();
|
||||||
|
o.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetBusiness<T>() where T : BusinessBase
|
||||||
|
{
|
||||||
|
return (T)Businesses.Find(b => b.GetType() == typeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BusinessBase GetBusiness(int? id)
|
||||||
|
{
|
||||||
|
return Businesses.Find(b => b.Id == id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("Business_DepositMoney")]
|
||||||
|
public void BusinessDepositMoney(Client player, int amount)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
if(user == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BusinessBase playerBusiness = GetBusiness(user.BusinessId);
|
||||||
|
|
||||||
|
TransactionResult result = BankManager.TransferMoney(user, playerBusiness, amount, "Überweisung");
|
||||||
|
|
||||||
|
/*if(result == TransactionResult.NEGATIVE_MONEY_SENT)
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~Es können nur positive Beträge überwiesen werden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if(result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~Du hast nicht genug Geld");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else */if(result == TransactionResult.SUCCESS)
|
||||||
|
{
|
||||||
|
player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString());
|
||||||
|
player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("Business_WithdrawMoney")]
|
||||||
|
public void BusinessWithdrawMoney(Client player, int amount)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BusinessBase playerBusiness = GetBusiness(user.BusinessId);
|
||||||
|
|
||||||
|
TransactionResult result = BankManager.TransferMoney(playerBusiness, user, amount, "Überweisung");
|
||||||
|
|
||||||
|
if (result == TransactionResult.NEGATIVE_MONEY_SENT)
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~Es können nur positive Beträge überwiesen werden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~Es ist nicht genug Geld auf der Businesskasse vorhanden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (result == TransactionResult.SUCCESS)
|
||||||
|
{
|
||||||
|
player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString());
|
||||||
|
player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.Text;
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using reallife_gamemode.Model;
|
using reallife_gamemode.Model;
|
||||||
using reallife_gamemode.Server.Entities;
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs)
|
* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs)
|
||||||
@@ -15,10 +16,6 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
public class LoadManager : Script
|
public class LoadManager : Script
|
||||||
{
|
{
|
||||||
public static List<GotoPoint> GotoPointList = new List<GotoPoint>();
|
|
||||||
public static List<Vehicle> FactionVehicleList = new List<Vehicle>();
|
|
||||||
public static List<Vehicle> ShopVehicleList = new List<Vehicle>();
|
|
||||||
public static List<Vehicle> UserVehicleList = new List<Vehicle>();
|
|
||||||
|
|
||||||
[ServerEvent(Event.ResourceStart)]
|
[ServerEvent(Event.ResourceStart)]
|
||||||
public void OnResourceStart()
|
public void OnResourceStart()
|
||||||
@@ -33,51 +30,24 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
|
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (GotoPoint g in loadData.GotoPoints)
|
|
||||||
|
foreach(ServerVehicle veh in loadData.ServerVehicles)
|
||||||
{
|
{
|
||||||
if (g.Active == true)
|
if (!veh.Active) continue;
|
||||||
|
|
||||||
|
Vehicle current = veh.Spawn();
|
||||||
|
TuningManager.ApplyTuningToServerVehicle(veh);
|
||||||
|
|
||||||
|
if (veh is ShopVehicle shopV)
|
||||||
{
|
{
|
||||||
GotoPointList.Add(g);
|
string displayName = NAPI.Vehicle.GetVehicleDisplayName(shopV.Model);
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (Saves.SavedVehicle v in loadData.Vehicles)
|
|
||||||
{
|
|
||||||
if (v.Active == true)
|
|
||||||
{
|
|
||||||
NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor),
|
|
||||||
v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (FactionVehicle v in loadData.FactionVehicles)
|
|
||||||
{
|
|
||||||
if (v.Active == true)
|
|
||||||
{
|
|
||||||
Vehicle current = NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor),
|
|
||||||
v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension);
|
|
||||||
current.SetData("factionId", v.FactionId);
|
|
||||||
FactionVehicleList.Add(current);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (ShopVehicle v in loadData.ShopVehicles)
|
|
||||||
{
|
|
||||||
if (v.Active == true)
|
|
||||||
{
|
|
||||||
Vehicle current = NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor),
|
|
||||||
v.SecondaryColor, v.NumberPlate, v.Alpha, false, false, v.Dimension);
|
|
||||||
ShopVehicleList.Add(current);
|
|
||||||
NAPI.Vehicle.SetVehicleEngineHealth(current, 0);
|
NAPI.Vehicle.SetVehicleEngineHealth(current, 0);
|
||||||
var tLabel = NAPI.TextLabel.CreateTextLabel(v.ModelName + " | " + v.Price + "~g~$", new Vector3(v.PositionX, v.PositionY, v.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false, v.Dimension);
|
var tLabel = NAPI.TextLabel.CreateTextLabel(displayName + " | " + shopV.Price.ToMoneyString(), new Vector3(shopV.PositionX, shopV.PositionY, shopV.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false);
|
||||||
current.SetData("shopVehicleId", v.Id);
|
|
||||||
tLabel.AttachTo(current, "chassis", new Vector3(0, 0, 1.5), new Vector3(0, 0, 0));
|
tLabel.AttachTo(current, "chassis", new Vector3(0, 0, 1.5), new Vector3(0, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (UserVehicle v in loadData.UserVehicles)
|
|
||||||
{
|
|
||||||
Vehicle current = NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (v.PrimaryColor),
|
|
||||||
v.SecondaryColor, v.NumberPlate, v.Alpha, false, false, v.Dimension);
|
|
||||||
current.SetData("ownerId", v.UserId);
|
|
||||||
UserVehicleList.Add(current);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Managers;
|
using reallife_gamemode.Server.Managers;
|
||||||
|
using reallife_gamemode.Server.Saves;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -29,9 +32,9 @@ namespace reallife_gamemode.Server.Events
|
|||||||
|
|
||||||
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x,y,z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x,y,z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
||||||
|
|
||||||
using (var saveData = new Model.DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dataSet = new Server.Saves.SavedBlip
|
var dataSet = new SavedBlip
|
||||||
{
|
{
|
||||||
Sprite = sprite,
|
Sprite = sprite,
|
||||||
PositionX = x,
|
PositionX = x,
|
||||||
@@ -52,12 +55,12 @@ namespace reallife_gamemode.Server.Events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveVehicleData(VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
public static Vehicle SaveVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||||
string vehicleNumberPlate, byte vehiclePrimaryColor, byte vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, byte vehicleDimension)
|
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked)
|
||||||
{
|
{
|
||||||
using (var saveData = new Model.DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dataSet = new Server.Saves.SavedVehicle
|
var dataSet = new SavedVehicle
|
||||||
{
|
{
|
||||||
Model = vehicleModel,
|
Model = vehicleModel,
|
||||||
PositionX = vehiclePosition.X,
|
PositionX = vehiclePosition.X,
|
||||||
@@ -68,20 +71,21 @@ namespace reallife_gamemode.Server.Events
|
|||||||
PrimaryColor = vehiclePrimaryColor,
|
PrimaryColor = vehiclePrimaryColor,
|
||||||
SecondaryColor = vehicleSecondaryColor,
|
SecondaryColor = vehicleSecondaryColor,
|
||||||
Locked = vehicleLocked,
|
Locked = vehicleLocked,
|
||||||
Engine = vehicleEngine,
|
|
||||||
Dimension = vehicleDimension,
|
|
||||||
Active = true
|
Active = true
|
||||||
};
|
};
|
||||||
saveData.Vehicles.Add(dataSet);
|
saveData.Vehicles.Add(dataSet);
|
||||||
saveData.SaveChanges();
|
saveData.SaveChanges();
|
||||||
|
|
||||||
|
return dataSet.Spawn(veh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void SaveFactionVehicleData(VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||||
string vehicleNumberPlate, byte vehiclePrimaryColor, byte vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, byte vehicleDimension, int? factionId)
|
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int? factionId)
|
||||||
{
|
{
|
||||||
using (var saveData = new Model.DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dataSet = new Entities.FactionVehicle
|
Console.WriteLine("Adding Faction Vehicle Secondary Color: " + vehicleSecondaryColor);
|
||||||
|
var dataSet = new FactionVehicle
|
||||||
{
|
{
|
||||||
Model = vehicleModel,
|
Model = vehicleModel,
|
||||||
FactionId = factionId,
|
FactionId = factionId,
|
||||||
@@ -93,23 +97,22 @@ namespace reallife_gamemode.Server.Events
|
|||||||
PrimaryColor = vehiclePrimaryColor,
|
PrimaryColor = vehiclePrimaryColor,
|
||||||
SecondaryColor = vehicleSecondaryColor,
|
SecondaryColor = vehicleSecondaryColor,
|
||||||
Locked = vehicleLocked,
|
Locked = vehicleLocked,
|
||||||
Engine = vehicleEngine,
|
|
||||||
Dimension = vehicleDimension,
|
|
||||||
Active = true
|
Active = true
|
||||||
};
|
};
|
||||||
saveData.FactionVehicles.Add(dataSet);
|
saveData.FactionVehicles.Add(dataSet);
|
||||||
saveData.SaveChanges();
|
saveData.SaveChanges();
|
||||||
|
|
||||||
|
return dataSet.Spawn(veh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void SaveShopVehicleData(VehicleHash vehicleModel, string vehicleModelName, Vector3 vehiclePosition, float vehicleHeading,
|
public static Vehicle SaveShopVehicleData(Vehicle veh, VehicleHash vehicleModel, string vehicleModelName, Vector3 vehiclePosition, float vehicleHeading,
|
||||||
string vehicleNumberPlate, byte vehiclePrimaryColor, byte vehicleSecondaryColor, byte vehicleDimension, int? factionId)
|
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor)
|
||||||
{
|
{
|
||||||
using (var saveData = new Model.DatabaseContext())
|
using (var saveData = new DatabaseContext())
|
||||||
{
|
{
|
||||||
var dataSet = new Entities.ShopVehicle
|
var dataSet = new ShopVehicle
|
||||||
{
|
{
|
||||||
Model = vehicleModel,
|
Model = vehicleModel,
|
||||||
ModelName = vehicleModelName,
|
|
||||||
PositionX = vehiclePosition.X,
|
PositionX = vehiclePosition.X,
|
||||||
PositionY = vehiclePosition.Y,
|
PositionY = vehiclePosition.Y,
|
||||||
PositionZ = vehiclePosition.Z,
|
PositionZ = vehiclePosition.Z,
|
||||||
@@ -117,11 +120,12 @@ namespace reallife_gamemode.Server.Events
|
|||||||
NumberPlate = vehicleNumberPlate,
|
NumberPlate = vehicleNumberPlate,
|
||||||
PrimaryColor = vehiclePrimaryColor,
|
PrimaryColor = vehiclePrimaryColor,
|
||||||
SecondaryColor = vehicleSecondaryColor,
|
SecondaryColor = vehicleSecondaryColor,
|
||||||
Dimension = vehicleDimension,
|
|
||||||
Active = true
|
Active = true
|
||||||
};
|
};
|
||||||
saveData.ShopVehicles.Add(dataSet);
|
saveData.ShopVehicles.Add(dataSet);
|
||||||
saveData.SaveChanges();
|
saveData.SaveChanges();
|
||||||
|
|
||||||
|
return dataSet.Spawn(veh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,44 +143,31 @@ namespace reallife_gamemode.Server.Events
|
|||||||
};
|
};
|
||||||
saveData.GotoPoints.Add(dataSet);
|
saveData.GotoPoints.Add(dataSet);
|
||||||
saveData.SaveChanges();
|
saveData.SaveChanges();
|
||||||
LoadManager.GotoPointList.Add(dataSet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void SaveAllOnSave()
|
public static void SaveAllOnSave()
|
||||||
{
|
{
|
||||||
|
// Alle Fahrzeuge
|
||||||
using (var saveAll = new Model.DatabaseContext())
|
using (var saveAll = new Model.DatabaseContext())
|
||||||
{
|
{
|
||||||
//TODO Fahrzeugschäden und Tankfüllstände
|
foreach(ServerVehicle veh in saveAll.ServerVehicles)
|
||||||
//User Vehicle
|
|
||||||
foreach (Vehicle v in LoadManager.UserVehicleList)
|
|
||||||
{
|
{
|
||||||
int ownerId = v.GetData("ownerId");
|
Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh);
|
||||||
Entities.UserVehicle userVehicle = saveAll.UserVehicles.FirstOrDefault(u => u.UserId == ownerId);
|
|
||||||
userVehicle.PositionX = v.Position.X;
|
|
||||||
userVehicle.PositionY = v.Position.Y;
|
|
||||||
userVehicle.PositionZ = v.Position.Z;
|
|
||||||
userVehicle.Heading = v.Heading;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Faction Vehicle
|
veh.PositionX = v.Position.X;
|
||||||
foreach (Vehicle v in LoadManager.FactionVehicleList)
|
veh.PositionY = v.Position.Y;
|
||||||
{
|
veh.PositionZ = v.Position.Z;
|
||||||
int factionId = v.GetData("factionId");
|
veh.Heading = v.Heading;
|
||||||
Entities.FactionVehicle factionVehicle = saveAll.FactionVehicles.FirstOrDefault(u => u.FactionId == factionId);
|
|
||||||
factionVehicle.PositionX = v.Position.X;
|
|
||||||
factionVehicle.PositionY = v.Position.Y;
|
|
||||||
factionVehicle.PositionZ = v.Position.Z;
|
|
||||||
factionVehicle.Heading = v.Heading;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Alle Spieler
|
//Alle Spieler
|
||||||
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
int userId = player.GetUser().Id;
|
Vector3 pos = player.Position;
|
||||||
Entities.User user = saveAll.Users.FirstOrDefault(u => u.Id == userId);
|
User user = player.GetUser(saveAll);
|
||||||
user.PositionX = player.Position.X;
|
user.PositionX = pos.X;
|
||||||
user.PositionY = player.Position.Y;
|
user.PositionY = pos.Y;
|
||||||
user.PositionZ = player.Position.Z;
|
user.PositionZ = pos.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAll.SaveChanges();
|
saveAll.SaveChanges();
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace reallife_gamemode.Server.Managers
|
namespace reallife_gamemode.Server.Managers
|
||||||
{
|
{
|
||||||
@@ -19,7 +23,12 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
if(c.IsInVehicle)
|
if(c.IsInVehicle)
|
||||||
{
|
{
|
||||||
c.TriggerEvent("showTuningInfo", c.GetData("duty"));
|
Vehicle v = c.Vehicle;
|
||||||
|
if(v.GetServerVehicle() is FactionVehicle fV && fV.GetFaction().StateOwned)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
c.TriggerEvent("showTuningInfo");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -31,6 +40,20 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
tuningGarages.Add(colShape);
|
tuningGarages.Add(colShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyTuningToServerVehicle(ServerVehicle sVeh)
|
||||||
|
{
|
||||||
|
Vehicle veh = VehicleManager.GetVehicleFromServerVehicle(sVeh);
|
||||||
|
if (veh == null) return;
|
||||||
|
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach(VehicleMod vMod in dbContext.VehicleMods.ToList().FindAll(vM => vM.ServerVehicleId == sVeh.Id))
|
||||||
|
{
|
||||||
|
veh.SetMod(vMod.Slot, vMod.ModId - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[RemoteEvent("startPlayerTuning")]
|
[RemoteEvent("startPlayerTuning")]
|
||||||
public void StartPlayerTuning(Client player)
|
public void StartPlayerTuning(Client player)
|
||||||
{
|
{
|
||||||
@@ -44,6 +67,42 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
if (index == 0) index--;
|
if (index == 0) index--;
|
||||||
player.Vehicle.SetMod(slot, index - 1);
|
player.Vehicle.SetMod(slot, index - 1);
|
||||||
|
|
||||||
|
ServerVehicle sV = player.Vehicle.GetServerVehicle();
|
||||||
|
if (sV == null) return;
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
VehicleMod vMod = dbContext.VehicleMods.FirstOrDefault(m => m.ServerVehicleId == sV.Id && m.Slot == slot);
|
||||||
|
if(vMod == null && index != -1)
|
||||||
|
{
|
||||||
|
vMod = new VehicleMod
|
||||||
|
{
|
||||||
|
ServerVehicleId = sV.Id,
|
||||||
|
Slot = slot,
|
||||||
|
ModId = index
|
||||||
|
};
|
||||||
|
dbContext.VehicleMods.Add(vMod);
|
||||||
|
}
|
||||||
|
else if(vMod != null && index == -1)
|
||||||
|
{
|
||||||
|
dbContext.VehicleMods.Remove(vMod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (vMod == null)
|
||||||
|
{
|
||||||
|
vMod = new VehicleMod
|
||||||
|
{
|
||||||
|
ServerVehicleId = sV.Id,
|
||||||
|
Slot = slot
|
||||||
|
};
|
||||||
|
dbContext.VehicleMods.Add(vMod);
|
||||||
|
}
|
||||||
|
vMod.ModId = index;
|
||||||
|
}
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
70
Server/Managers/VehicleManager.cs
Normal file
70
Server/Managers/VehicleManager.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Managers
|
||||||
|
{
|
||||||
|
public class VehicleManager
|
||||||
|
{
|
||||||
|
private static Dictionary<int, NetHandle> _serverVehicles = new Dictionary<int, NetHandle>();
|
||||||
|
|
||||||
|
public static void AddVehicle(ServerVehicle serverVehicle, Vehicle vehicle)
|
||||||
|
{
|
||||||
|
if(_serverVehicles.ContainsKey(serverVehicle.Id))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_serverVehicles.ContainsValue(vehicle.Handle))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_serverVehicles[serverVehicle.Id] = vehicle.Handle;
|
||||||
|
}
|
||||||
|
internal static void DeleteVehicle(Vehicle veh)
|
||||||
|
{
|
||||||
|
ServerVehicle sVeh;
|
||||||
|
if ((sVeh = GetServerVehicleFromVehicle(veh)) != null)
|
||||||
|
{
|
||||||
|
_serverVehicles.Remove(sVeh.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
veh.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vehicle GetVehicleFromHandle(NetHandle handle)
|
||||||
|
{
|
||||||
|
return NAPI.Pools.GetAllVehicles().Find(v => v.Handle == handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vehicle GetVehicleFromServerVehicle(ServerVehicle serverVehicle)
|
||||||
|
{
|
||||||
|
if(!_serverVehicles.ContainsKey(serverVehicle.Id))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetVehicleFromHandle(_serverVehicles[serverVehicle.Id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServerVehicle GetServerVehicleFromVehicle(Vehicle veh)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach(KeyValuePair<int, NetHandle> pair in _serverVehicles)
|
||||||
|
{
|
||||||
|
if (pair.Value == veh.Handle)
|
||||||
|
{
|
||||||
|
return dbContext.ServerVehicles.Find(pair.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.Text;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Saves SavedVehicle.cs
|
* @overview Life of German Reallife - Saves SavedVehicle.cs
|
||||||
@@ -13,24 +14,6 @@ using GTANetworkAPI;
|
|||||||
|
|
||||||
namespace reallife_gamemode.Server.Saves
|
namespace reallife_gamemode.Server.Saves
|
||||||
{
|
{
|
||||||
public class SavedVehicle
|
public class SavedVehicle : ServerVehicle
|
||||||
{
|
{ }
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
public VehicleHash Model { get; set; }
|
|
||||||
public float PositionX { get; set; }
|
|
||||||
public float PositionY { get; set; }
|
|
||||||
public float PositionZ { get; set; }
|
|
||||||
public float Heading { get; set; }
|
|
||||||
[StringLength(8)]
|
|
||||||
public string NumberPlate { get; set; }
|
|
||||||
public byte Alpha { get; set; }
|
|
||||||
public byte PrimaryColor { get; set; }
|
|
||||||
public byte SecondaryColor { get; set; }
|
|
||||||
public bool Locked { get; set; }
|
|
||||||
public bool Engine { get; set; }
|
|
||||||
public byte Dimension { get; set; }
|
|
||||||
public bool Active { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace reallife_gamemode.Server.Util
|
|||||||
NAPI.Util.ConsoleOutput("Initializing database...");
|
NAPI.Util.ConsoleOutput("Initializing database...");
|
||||||
using(var dbContext = new DatabaseContext())
|
using(var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
dbContext.Users.First();
|
dbContext.Users.FirstOrDefault();
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user