diff --git a/ReallifeGamemode.Client/Business/main.ts b/ReallifeGamemode.Client/Business/main.ts index 614ec8e7..6a5fb561 100644 --- a/ReallifeGamemode.Client/Business/main.ts +++ b/ReallifeGamemode.Client/Business/main.ts @@ -12,7 +12,7 @@ const ListItem = NativeUI.ListItem; import InputHelper from '../inputhelper'; -export default function business() { +export default function business(globalData: GlobalData) { var keyBound = false; @@ -97,7 +97,7 @@ export default function business() { bankMenu.ItemSelect.on((item, index) => { if (item === depositItem) { - var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?"); + var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?", globalData); depositInput.show(); depositInput.getValue((data) => { var amount = parseInt(data); @@ -109,7 +109,7 @@ export default function business() { mp.events.callRemote('Business_DepositMoney', amount); }); } else if (item === withdrawItem) { - var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?"); + var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?", globalData); withdrawInput.show(); withdrawInput.getValue((data) => { var amount = parseInt(data); diff --git a/ReallifeGamemode.Client/Gui/Inventory/inventory.ts b/ReallifeGamemode.Client/Gui/Inventory/inventory.ts index bb6e1310..b58082cd 100644 --- a/ReallifeGamemode.Client/Gui/Inventory/inventory.ts +++ b/ReallifeGamemode.Client/Gui/Inventory/inventory.ts @@ -1,6 +1,6 @@ import InputHelper from '../../inputhelper'; -export default function inventory() { +export default function inventory(globalData: GlobalData) { var show = false; var showAdmin = false; @@ -806,7 +806,7 @@ export default function inventory() { mp.events.callRemote('sendTradeItemsToPartner', JSON.stringify(tradeItems), tradePrize, tradePartner); } if (isTrading && isMouseOverTradeDollar(x, y)) { - var tradeMoney = new InputHelper("Wie viel $ möchtest du für deine Items haben?"); + var tradeMoney = new InputHelper("Wie viel $ möchtest du für deine Items haben?", globalData); tradeMoney.show(); tradeMoney.getValue((data) => { var amount = parseInt(data); @@ -827,7 +827,7 @@ export default function inventory() { } else if (ifMouseSelectRadial(x, y)) { switch (radialSelect) { case "up": - var dropInput = new InputHelper("Wie viel Items möchtest du wegwerfen?"); + var dropInput = new InputHelper("Wie viel Items möchtest du wegwerfen?", globalData); dropInput.show(); dropInput.getValue((data) => { var amount = parseInt(data); diff --git a/ReallifeGamemode.Client/Gui/cityhall.ts b/ReallifeGamemode.Client/Gui/cityhall.ts index 12269fe2..bf963fcb 100644 --- a/ReallifeGamemode.Client/Gui/cityhall.ts +++ b/ReallifeGamemode.Client/Gui/cityhall.ts @@ -53,7 +53,7 @@ export default function (globalData: GlobalData) { menu.ItemSelect.on((item, index) => { if (index === 0) { // Gruppe - var input = new InputHelper("Wie soll die Gruppe heißen?"); + var input = new InputHelper("Wie soll die Gruppe heißen?", globalData); input.show(); input.getValue((name: string) => { mp.events.callRemote("CLIENT:CityHall_CreateGroup", name); diff --git a/ReallifeGamemode.Client/Interaction/interactionmenu.ts b/ReallifeGamemode.Client/Interaction/interactionmenu.ts index 1054eff9..6360ff52 100644 --- a/ReallifeGamemode.Client/Interaction/interactionmenu.ts +++ b/ReallifeGamemode.Client/Interaction/interactionmenu.ts @@ -54,8 +54,9 @@ export default function (globalData: GlobalData) { mp.gui.chat.show(false); globalData.InMenu = true; - menu.ItemSelect.on((item, index) => { + menu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => { if (item === acceptItem) { + mp.gui.chat.push("accept invite = " + acceptItem.SelectedValue); mp.events.callRemote("CLIENT:InteractionMenu_AcceptInvite", acceptItem.SelectedValue); } }); @@ -109,7 +110,7 @@ export default function (globalData: GlobalData) { factionMenu.ItemSelect.on((item, index) => { if (index === 0) { // Inviten - var input = new InputHelper("Welchen Spieler möchtest du inviten (Name / ID)?"); + var input = new InputHelper("Welchen Spieler möchtest du inviten (Name / ID)?", globalData); input.show(); input.getValue(name => { mp.events.callRemote("CLIENT:InteractionMenu_InviteFaction", name); diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index edaf872d..b021ffda 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -45,7 +45,7 @@ export default function keys(globalData: GlobalData) { //DOWN ARROW (Eigeninteraktion) mp.keys.bind(0x28, false, function () { - if (!globalData.InChat && !showInv && !globalData.InMenu) { + if (!globalData.InChat && !showInv && !globalData.InMenu && !globalData.InInput) { mp.events.callRemote("keyPress:DOWN_ARROW"); } }); @@ -84,7 +84,7 @@ export default function keys(globalData: GlobalData) { //I //Inventar mp.keys.bind(0x49, false, function () { - if (!globalData.InChat) { + if (!globalData.InChat && !globalData.InTuning && !globalData.InMenu) { if (showInv === false) { showInv = true; } else { diff --git a/ReallifeGamemode.Client/global.d.ts b/ReallifeGamemode.Client/global.d.ts index 88dee4de..b704cefa 100644 --- a/ReallifeGamemode.Client/global.d.ts +++ b/ReallifeGamemode.Client/global.d.ts @@ -3,7 +3,8 @@ HideGui: boolean, InMenu: boolean, InChat: boolean, - LoggedIn: boolean + LoggedIn: boolean, + InInput: boolean } declare interface AccountData { diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index c6b44afa..b9e55fdf 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -9,7 +9,8 @@ let globalData: GlobalData = { HideGui: false, InMenu: false, InChat: false, - LoggedIn: false + LoggedIn: false, + InInput: false }; import cityHall from './Gui/cityhall'; @@ -25,7 +26,7 @@ import handMoney from './Gui/handmoney' handMoney(); import business from './Business/main'; -business(); +business(globalData); import cardealer from './Business/cardealer'; cardealer(); @@ -55,7 +56,7 @@ import playerList from './Gui/playerlist'; playerList(); import inventory from './Gui/Inventory/inventory'; -inventory(); +inventory(globalData); import vehicleMenu from './Gui/vehiclemenu/main'; vehicleMenu(); diff --git a/ReallifeGamemode.Client/inputhelper/index.ts b/ReallifeGamemode.Client/inputhelper/index.ts index aa15e12d..78296256 100644 --- a/ReallifeGamemode.Client/inputhelper/index.ts +++ b/ReallifeGamemode.Client/inputhelper/index.ts @@ -3,9 +3,11 @@ private value: string; private created: boolean; private browser: BrowserMp; + private data: GlobalData; - constructor(title: string) { + constructor(title: string, globalData: GlobalData) { this.title = title; + this.data = globalData; this.cefTitleCall = this.cefTitleCall.bind(this); mp.events.add('cef_request_title', this.cefTitleCall); @@ -31,6 +33,7 @@ show() { if (this.created) return; + this.data.InInput = true; this.created = true; this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html'); } @@ -41,6 +44,7 @@ mp.events.remove('cef_request_title'); mp.events.remove('render', this.disableControls); this.browser.destroy(); + this.data.InInput = false; this.created = false; } } diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index a829d6b8..cbe14a3a 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -530,7 +530,7 @@ namespace ReallifeGamemode.Server.Commands player.SendChatMessage("~s~Die Dimension von ~y~" + target.Name + " ~s~wurde auf ~g~" + dimension + "~s~ geändert."); } - [Command("kick", "~m~Benutzung: ~s~/kick [Player] [Grund]")] + [Command("kick", "~m~Benutzung: ~s~/kick [Player] [Grund]", GreedyArg = true)] public void CmdAdminKick(Client player, string targetname, string reason) { if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) diff --git a/ReallifeGamemode.Server/sql.sql b/ReallifeGamemode.Server/sql.sql new file mode 100644 index 00000000..affe7698 --- /dev/null +++ b/ReallifeGamemode.Server/sql.sql @@ -0,0 +1,33 @@ +ALTER TABLE `Users` ADD `GroupId` int NULL; + +ALTER TABLE `Users` ADD `GroupRank` int NOT NULL DEFAULT 0; + +ALTER TABLE `ServerVehicles` ADD `GroupId` int NULL; + +CREATE TABLE `Groups` ( + `Id` int NOT NULL AUTO_INCREMENT, + `Name` longtext NULL, + CONSTRAINT `PK_Groups` PRIMARY KEY (`Id`) +); + +CREATE TABLE `GroupBankAccounts` ( + `Id` int NOT NULL AUTO_INCREMENT, + `GroupId` int NULL, + `Balance` int NOT NULL, + CONSTRAINT `PK_GroupBankAccounts` PRIMARY KEY (`Id`), + CONSTRAINT `FK_GroupBankAccounts_Groups_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Groups` (`Id`) ON DELETE RESTRICT +); + +CREATE INDEX `IX_Users_GroupId` ON `Users` (`GroupId`); + +CREATE INDEX `IX_ServerVehicles_GroupId` ON `ServerVehicles` (`GroupId`); + +CREATE INDEX `IX_GroupBankAccounts_GroupId` ON `GroupBankAccounts` (`GroupId`); + +ALTER TABLE `ServerVehicles` ADD CONSTRAINT `FK_ServerVehicles_Groups_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Groups` (`Id`) ON DELETE RESTRICT; + +ALTER TABLE `Users` ADD CONSTRAINT `FK_Users_Groups_GroupId` FOREIGN KEY (`GroupId`) REFERENCES `Groups` (`Id`) ON DELETE RESTRICT; + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('20190505154643_Groups', '2.2.0-rtm-35687'); +