Merge branch 'develop' into 'master'

Revert "wie parke ich jetzt mein fahrzeug??"

See merge request log-gtav/reallife-gamemode!77
This commit is contained in:
hydrant
2021-05-27 20:27:53 +00:00
86 changed files with 8429 additions and 1248 deletions

View File

@@ -4,7 +4,7 @@
* @copyright (c) 2008 - 2018 Life of German * @copyright (c) 2008 - 2018 Life of German
*/ */
export default function factionManagement() { export default function factionManagement(globalData: IGlobalData) {
var manageFactionRanksBrowser = null; var manageFactionRanksBrowser = null;
var rankData = null; var rankData = null;
@@ -21,7 +21,7 @@ export default function factionManagement() {
manageFactionRanksBrowser.execute(`setFactionName('${rankData.FactionName}')`); manageFactionRanksBrowser.execute(`setFactionName('${rankData.FactionName}')`);
manageFactionRanksBrowser.execute(`loadData(` + JSON.stringify(rankData.Ranks) + `)`); manageFactionRanksBrowser.execute(`loadData(` + JSON.stringify(rankData.Ranks) + `)`);
mp.gui.cursor.show(true, true); mp.gui.cursor.show(true, true);
this.data.InMenu = true; globalData.InMenu = true;
} }
}); });
@@ -30,7 +30,7 @@ export default function factionManagement() {
manageFactionRanksBrowser.destroy(); manageFactionRanksBrowser.destroy();
mp.gui.cursor.show(false, false); mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true); mp.gui.chat.activate(true);
this.data.InMenu = false; globalData.InMenu = false;
var obj: FactionRanks = { var obj: FactionRanks = {
factionId: rankData.FactionId, factionId: rankData.FactionId,

View File

@@ -31,7 +31,7 @@ export default function factionInteraction(globalData: IGlobalData) {
var ticketName: string; var ticketName: string;
var pointsName: string; var pointsName: string;
var factionInteractionMenu; var factionInteractionMenu: NativeUI.Menu;
var healTaskMenuMedic; var healTaskMenuMedic;
var reviveTaskMenuMedic; var reviveTaskMenuMedic;
var insDate; var insDate;
@@ -42,7 +42,10 @@ export default function factionInteraction(globalData: IGlobalData) {
//LSPD //LSPD
let ticketTaskMenuLSPD; let ticketTaskMenuLSPD;
let pointsTaskMenuLSPD; let pointsTaskMenuLSPD;
let wantedsMenuLSPD let wantedsMenuLSPD;
let friskUserMenuItem: NativeUI.UIMenuItem;
let friskVehicleMenuItem: NativeUI.UIMenuItem;
if (userFactionId == 1 || userFactionId == 3) { if (userFactionId == 1 || userFactionId == 3) {
if (isDuty) { if (isDuty) {
mp.gui.chat.activate(false); mp.gui.chat.activate(false);
@@ -59,6 +62,12 @@ export default function factionInteraction(globalData: IGlobalData) {
wantedsMenuLSPD = new UIMenuItem("Verbrecher Liste"); wantedsMenuLSPD = new UIMenuItem("Verbrecher Liste");
factionInteractionMenu.AddItem(wantedsMenuLSPD); factionInteractionMenu.AddItem(wantedsMenuLSPD);
friskUserMenuItem = new UIMenuItem("Spieler durchsuchen", "Einen Spieler auf illegale Gegenstände durchsuchen.");
factionInteractionMenu.AddItem(friskUserMenuItem);
friskVehicleMenuItem = new UIMenuItem("Fahrzeug durchsuchen", "Das nächste Fahrzeug auf illegale Gegenstände durchsuchen.")
factionInteractionMenu.AddItem(friskVehicleMenuItem);
/*TaskMenuLSPD = new UIMenuItem(""); /*TaskMenuLSPD = new UIMenuItem("");
TaskMenuLSPD.SetRightLabel(""); TaskMenuLSPD.SetRightLabel("");
factionInteractionMenu.AddItem(TaskMenuLSPD);*/ //weiteres factionInteractionMenu.AddItem(TaskMenuLSPD);*/ //weiteres
@@ -107,6 +116,20 @@ export default function factionInteraction(globalData: IGlobalData) {
globalData.InMenu = false; globalData.InMenu = false;
mp.events.callRemote("CLIENT:wantedlist"); mp.events.callRemote("CLIENT:wantedlist");
break; break;
case friskUserMenuItem:
factionInteractionMenu.Visible = false;
var input = new InputHelper("Welchen Spieler möchtest du durchsuchen (Name / ID)?", globalData);
input.show();
input.getValue(name => {
mp.events.callRemote("CLIENT:InteractionMenu_LSPD_FriskUser", name);
globalData.InMenu = false;
});
break;
case friskVehicleMenuItem:
factionInteractionMenu.Close();
mp.events.callRemote("CLIENT:InteractionMenu_LSPD_FriskVehicle");
} }
}); });
@@ -273,7 +296,7 @@ export default function factionInteraction(globalData: IGlobalData) {
mp.gui.chat.activate(true); mp.gui.chat.activate(true);
globalData.InMenu = false; globalData.InMenu = false;
mp.events.callRemote("updateMedicTask", 1, activeTask.Victim, true); mp.events.callRemote("updateMedicTask", 1, activeTask.Victim, true);
mp.events.call("destroyMedicTaskCheckpoint"); mp.events.call("destroyMedicTaskCheckpoint");
break; break;
} }
@@ -357,7 +380,7 @@ export default function factionInteraction(globalData: IGlobalData) {
} }
aTask1.SetRightLabel(mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[i].Position.x, tasks[i].Position.y, tasks[i].Position.z, true).toFixed(2).toString() + " ~g~m"); aTask1.SetRightLabel(mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[i].Position.x, tasks[i].Position.y, tasks[i].Position.z, true).toFixed(2).toString() + " ~g~m");
healTaskMenuMedic.AddItem(aTask1); healTaskMenuMedic.AddItem(aTask1);
} }
let backItem1 = new UIMenuItem("Zur\u00fcck", "Zur\u00fcck zur Fraktionsinteraktion."); let backItem1 = new UIMenuItem("Zur\u00fcck", "Zur\u00fcck zur Fraktionsinteraktion.");

View File

@@ -127,6 +127,10 @@ export default function (globalData: IGlobalData) {
item.SetRightLabel("~r~- $" + moneyFormat(Number(p.healthInsurance.toFixed(2)))); item.SetRightLabel("~r~- $" + moneyFormat(Number(p.healthInsurance.toFixed(2))));
paycheckMenu.AddItem(item); paycheckMenu.AddItem(item);
item = new UIMenuItem("Rundfunkbeitrag");
item.SetRightLabel("~r~- $" + moneyFormat(Number(p.gez.toFixed(2))));
paycheckMenu.AddItem(item);
item = new UIMenuItem("Einkommensteuer"); item = new UIMenuItem("Einkommensteuer");
item.SetRightLabel(moneyFormat(Number((p.financialInterest * 100).toFixed(3))) + "%"); item.SetRightLabel(moneyFormat(Number((p.financialInterest * 100).toFixed(3))) + "%");

View File

@@ -0,0 +1,134 @@
import * as NativeUI from '../libs/NativeUI';
var fieldSelectColShape = mp.colshapes.newCircle(2415.229, 4993.037, 46.230038);
const Menu = NativeUI.Menu;
var fieldMenu: NativeUI.Menu;
const Point = NativeUI.Point;
const UIMenuListItem = NativeUI.UIMenuListItem;
const ItemsCollection = NativeUI.ItemsCollection;
const UIMenuItem = NativeUI.UIMenuItem;
const Color = NativeUI.Color;
let sendItem = new UIMenuItem("Starten", "Route starten");
sendItem.BackColor = new Color(13, 71, 161);
sendItem.HighlightedBackColor = new Color(25, 118, 210);
let cancelItem = new UIMenuItem("Abbrechen", "");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
var checkpoint = new mp.Vector3(2416.3723, 4993.94, 45);
export default function farmerFieldList(globalData: IGlobalData) {
var skillSelect;
var skill = 60;
var fieldSelected = false;
var fieldSelect;
mp.events.add(RageEnums.EventKey.PLAYER_EXIT_COLSHAPE, (colshape) => {
if (colshape == fieldSelectColShape) {
if (fieldMenu && fieldMenu.Visible) {
fieldMenu.Close();
}
}
});
mp.events.add('SERVER:selectField', () => {
skill = 100;
if (!globalData.InMenu) {
globalData.InMenu = true;
skillSelect = ["Knecht (1)", "Hilfsarbeiter (2)", "Ackersmann (3)", "Landwirt (4)", "Ökonom (5)"];
fieldMenu = new Menu("Bus Job", "", new Point(0, screenRes.y / 3), null, null);
fieldMenu.AddItem(new UIMenuListItem("Stufe wählen", "", new ItemsCollection(skillSelect)));
fieldSelect = "Anfänger";
fieldMenu.AddItem(sendItem);
fieldMenu.AddItem(cancelItem);
fieldMenu.Visible = true;
fieldMenu.ListChange.on((item, index) => {
switch (item.Text) {
case "Stufe wählen":
fieldSelect = String(item.SelectedItem.DisplayText);
break;
}
});
fieldMenu.ItemSelect.on((item) => {
if (item.Text === "Starten") {
if (fieldSelect == skillSelect[1] && skill < 5) {
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
}
else if (fieldSelect == skillSelect[2] && skill < 10) {
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
}
else if (fieldSelect == skillSelect[3] && skill < 25) {
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
}
else if (fieldSelect == skillSelect[4] && skill < 50) {
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
}
else {
mp.events.callRemote("CLIENT:StartFieldSelected", fieldSelect);
fieldSelected = true;
fieldMenu.Close();
globalData.InMenu = false;
}
} else if (item.Text === "Abbrechen") {
fieldMenu.Close();
}
});
fieldMenu.MenuClose.on(() => {
if (!fieldSelected) {
//mp.events.callRemote("CLIENT:Job_StopJob");
}
fieldSelected = false;
globalData.InMenu = false;
});
}
});
var activeCheckpoint;
var activeBlip = null;
var myVar;
var activeCheckpointId;
mp.events.add('farmerSetCheckpoint', (position, markerId, markerSize, cpId) => {
activeCheckpointId = cpId;
activeCheckpoint = mp.markers.new(markerId, position, markerSize, {
color: [255, 0, 0, 150],
visible: true,
dimension: 0
});
activeBlip = mp.blips.new(1, position,
{
color: 33,
alpha: 255,
shortRange: false,
});
activeBlip.setRoute(true);
activeBlip.setRouteColour(33);
clearInterval(myVar);
myVar = setInterval(checkpointTimer, 50);
});
function checkpointTimer() {
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, checkpoint.x, checkpoint.y, 0, false);
if (dist <= 2) {
clearInterval(myVar);
activeCheckpoint.destroy();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -57,7 +57,6 @@ const muellbaseVector2 = new mp.Vector3(454.88348, -2158.1938, 5.9788494);
const muellbaseVector3 = new mp.Vector3(529.06635, -2088.4097, 8.303088); const muellbaseVector3 = new mp.Vector3(529.06635, -2088.4097, 8.303088);
const krankenhausVector1 = new mp.Vector3(-508.50705, -351.24368, 34); const krankenhausVector1 = new mp.Vector3(-508.50705, -351.24368, 34);
//const krankenhausVector2 = new mp.Vector3(-437.00146, -357.10526, 32.735916
const krankenhausVector2 = new mp.Vector3(-442.62323, -356.99185, 33); const krankenhausVector2 = new mp.Vector3(-442.62323, -356.99185, 33);
const krankenhausVector3 = new mp.Vector3(-448.9346, -297.23972, 33.68); const krankenhausVector3 = new mp.Vector3(-448.9346, -297.23972, 33.68);
const krankenhausVector4 = new mp.Vector3(-504.952, -315.21698, 35.04881); const krankenhausVector4 = new mp.Vector3(-504.952, -315.21698, 35.04881);

View File

@@ -10,9 +10,7 @@ export default function () {
}); });
mp.events.addDataHandler("vehicleAdminSpeed2", (entity, newValue2) => { mp.events.addDataHandler("vehicleAdminSpeed2", (entity, newValue2) => {
if (!entity.isAVehicle()) return; if (!entity.isAVehicle()) return;
//entity.setEngineTorqueMultiplier(newValue2); entity.setEngineTorqueMultiplier(newValue2);
TorqueEntity = entity;
TorqueValue = newValue2;
}); });
/*mp.events.add('render', () => { /*mp.events.add('render', () => {
let vehicle = mp.players.local.vehicle; let vehicle = mp.players.local.vehicle;

View File

@@ -1,36 +1 @@
<?xml version="1.0" encoding="iso-8859-1"?> <svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m264.07 325.054c-.001-4.203-3.409-7.609-7.612-7.609-.001 0-.002 0-.003 0-4.204.001-7.61 3.411-7.609 7.614l.072 179.332c.001 4.203 3.409 7.609 7.612 7.609h.003c4.204-.001 7.61-3.411 7.609-7.614z" fill="#57cc62"/><path d="m339.319 454.146s-30.581-5.883-53.885-39.335c-25.318-36.343-28.975-79.606-28.975-79.606s39.269 18.354 64.587 54.697c23.304 33.453 18.273 64.244 18.273 64.244z" fill="#9affa3"/><path d="m321.046 389.902c-25.318-36.343-64.587-54.697-64.587-54.697s.779 9.196 4.097 22.665c10.179 8.375 21 19.049 30.044 32.032 13.29 19.077 17.36 37.278 18.408 49.407 16.288 12.126 30.312 14.837 30.312 14.837s5.03-30.791-18.274-64.244z" fill="#78f583"/><path d="m256.531 0s39.379 51.679 39.379 145.956c0 102.424-39.379 189.249-39.379 189.249s-39.379-86.826-39.379-189.249c0-94.277 39.379-145.956 39.379-145.956z" fill="#70e07a"/><path d="m256.531 0s-10.254 13.465-20.297 39.172c9.638 24.67 19.082 60.615 19.082 106.783 0 50.158-9.444 96.567-19.082 130.878 10.043 35.754 20.297 58.371 20.297 58.371s39.379-86.826 39.379-189.249c0-94.276-39.379-145.955-39.379-145.955z" fill="#56d661"/><path d="m462.193 129.131s-7.498 56.029-65.341 113.987c-62.841 62.967-140.322 92.087-140.322 92.087s29.062-77.636 91.903-140.603c57.843-57.958 113.76-65.471 113.76-65.471z" fill="#9affa3"/><path d="m417.982 144.266c-6.179 20.539-22.193 59.242-61.724 98.852-29.419 29.478-62.045 51.537-88.429 66.664-7.601 15.552-11.298 25.424-11.298 25.424s77.48-29.12 140.322-92.087c57.842-57.958 65.341-113.987 65.341-113.987s-18.036 2.427-44.212 15.134z" fill="#78f583"/><path d="m508.194 335.205s-38.963 29.809-110.042 29.809c-77.222 0-142.683-29.809-142.683-29.809s65.462-29.809 142.683-29.809c71.079 0 110.042 29.809 110.042 29.809z" fill="#70e07a"/><path d="m398.152 305.396c-7.257 0-14.41.264-21.415.741 58.877 4.599 90.863 29.068 90.863 29.068s-31.986 24.47-90.863 29.068c7.005.477 14.158.741 21.415.741 71.079 0 110.042-29.809 110.042-29.809s-38.963-29.809-110.042-29.809z" fill="#56d661"/><path d="m3.806 335.205s38.963-29.809 110.042-29.809c77.222 0 142.683 29.809 142.683 29.809s-65.462 29.809-142.683 29.809c-71.079 0-110.042-29.809-110.042-29.809z" fill="#70e07a"/><path d="m113.848 305.396c-6.679 0-13.074.264-19.18.741 67.532 4.599 121.268 29.068 121.268 29.068s-53.736 24.469-121.268 29.068c6.106.477 12.501.741 19.18.741 77.222 0 142.683-29.809 142.683-29.809s-65.461-29.809-142.683-29.809z" fill="#56d661"/><path d="m173.598 454.146s30.581-5.883 53.885-39.335c25.318-36.343 28.975-79.606 28.975-79.606s-39.269 18.354-64.587 54.697c-23.304 33.453-18.273 64.244-18.273 64.244z" fill="#9affa3"/><path d="m221.916 357.87c-3.879 15.752-11.231 37.35-24.879 56.941-7.525 10.802-15.806 18.716-23.573 24.499-.79 9.14.134 14.837.134 14.837s30.581-5.883 53.885-39.335c25.318-36.343 28.975-79.606 28.975-79.606s-16.227 7.595-34.542 22.664z" fill="#78f583"/><path d="m50.725 129.131s7.498 56.029 65.341 113.987c62.841 62.967 140.322 92.087 140.322 92.087s-29.062-77.636-91.903-140.603c-57.844-57.958-113.76-65.471-113.76-65.471z" fill="#9affa3"/><path d="m123.889 194.602c40.438 40.519 66.885 87.108 80.605 115.179 29.975 17.186 51.892 25.424 51.892 25.424s-29.062-77.636-91.903-140.603c-57.842-57.958-113.759-65.471-113.759-65.471s.754 5.621 3.617 15.135c19.92 9.67 44.552 25.29 69.548 50.336z" fill="#78f583"/></g></svg>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 505.501 505.501" style="enable-background:new 0 0 505.501 505.501;" xml:space="preserve" width="512" height="512">
<g>
<path style="fill:#A2DB18;" d="M470.802,163.55c-1.482-1.481-3.497-2.294-5.605-2.222l-12.513,0.384 c-1.963,0.06-3.825,0.878-5.198,2.282l-8.857,9.056l-12.673,0.32c-2.087,0.052-4.06,0.962-5.456,2.514l-8.48,9.428l-12.652,0.878 c-2.095,0.145-4.036,1.151-5.363,2.78l-8.033,9.857l-12.617,1.588c-2.11,0.266-4.012,1.404-5.244,3.137l-7.398,10.411 l-12.511,2.608c-2.137,0.446-3.979,1.789-5.057,3.689l-6.371,11.23l-12.186,4.326c-2.191,0.778-3.905,2.516-4.652,4.717 l-3.941,11.61l-10.74,5.878c-1.991,1.09-3.39,3.013-3.815,5.242l-2.269,11.908l-9.939,6.925c-1.817,1.266-2.991,3.262-3.215,5.465 l-1.219,11.993l-9.363,7.585c-1.7,1.377-2.724,3.42-2.809,5.606l-0.47,12.008l-8.907,8.058c-1.613,1.459-2.523,3.54-2.5,5.714 l0.129,12.004l-8.51,8.47c-1.465,1.459-2.273,3.451-2.237,5.518l0.212,12.037c0.072,4.091,3.371,7.39,7.462,7.462l12.025,0.212 c0.045,0,0.089,0.001,0.134,0.001c2.019,0,3.958-0.804,5.385-2.239l8.466-8.509l12.014,0.126c2.158,0.018,4.253-0.887,5.712-2.499 l8.063-8.91l12.01-0.471c2.185-0.086,4.228-1.109,5.605-2.808l7.589-9.366l11.993-1.219c2.203-0.224,4.199-1.398,5.465-3.215 l6.923-9.938l11.906-2.268c2.23-0.425,4.153-1.825,5.242-3.816l5.877-10.738l11.607-3.939c2.201-0.747,3.94-2.461,4.718-4.652 l4.327-12.188l11.231-6.372c1.899-1.077,3.242-2.919,3.688-5.056l2.61-12.515l10.413-7.401c1.734-1.232,2.871-3.134,3.137-5.243 l1.588-12.617l9.855-8.03c1.628-1.326,2.634-3.268,2.78-5.363l0.878-12.65l9.424-8.475c1.553-1.396,2.463-3.371,2.515-5.458 l0.318-12.665l9.056-8.859c1.403-1.372,2.221-3.235,2.281-5.198l0.384-12.521C473.088,167.06,472.284,165.031,470.802,163.55z"/>
<path style="fill:#A2DB18;" d="M264.193,376.4l-8.343-12.099l0.434-12.694c0.074-2.172-0.785-4.273-2.362-5.769l-8.707-8.266 l-0.158-12.003c-0.029-2.18-0.993-4.243-2.647-5.663l-9.125-7.837l-0.819-12.006c-0.149-2.194-1.242-4.215-2.995-5.541 l-9.631-7.286l-1.692-11.964c-0.314-2.215-1.587-4.179-3.481-5.369l-10.302-6.471l-2.994-11.804 c-0.57-2.248-2.136-4.113-4.251-5.063l-11.288-5.07l-5.479-11.694c-0.949-2.026-2.743-3.531-4.904-4.113l-12.397-3.338 l-6.957-10.774c-1.166-1.806-3.042-3.033-5.163-3.378l-12.577-2.044l-7.745-10.111c-1.284-1.676-3.207-2.742-5.308-2.942 l-12.643-1.209l-8.269-9.63c-1.364-1.588-3.322-2.543-5.412-2.64l-12.661-0.586l-8.679-9.244c-1.428-1.521-3.42-2.388-5.506-2.397 l-13.343-0.056l-12.542-8.908c-3.022-2.146-7.152-1.798-9.771,0.822c-2.62,2.621-2.968,6.75-0.821,9.771l8.912,12.546l0.057,13.345 c0.009,2.087,0.876,4.079,2.398,5.507l9.239,8.67l0.585,12.655c0.097,2.091,1.052,4.049,2.64,5.413l9.629,8.268l1.207,12.64 c0.2,2.102,1.267,4.025,2.942,5.308l10.112,7.746l2.045,12.58c0.345,2.121,1.572,3.997,3.377,5.163l10.777,6.96l3.339,12.4 c0.582,2.16,2.087,3.955,4.112,4.904l11.694,5.479l5.068,11.285c0.95,2.116,2.814,3.682,5.063,4.252l11.801,2.993l6.47,10.3 c1.189,1.895,3.154,3.168,5.369,3.482l11.962,1.692l7.286,9.63c1.326,1.753,3.347,2.846,5.54,2.996l12.011,0.821l7.839,9.126 c1.42,1.653,3.482,2.617,5.661,2.646l12.01,0.16l8.275,8.712c1.497,1.576,3.607,2.437,5.769,2.361l12.69-0.436l12.093,8.337 c1.307,0.901,2.812,1.342,4.309,1.342c1.96,0,3.905-0.756,5.375-2.225C265.904,383.491,266.275,379.418,264.193,376.4z"/>
<path style="fill:#6ABA0F;" d="M470.802,163.55c-1.482-1.481-3.497-2.294-5.605-2.222l-12.513,0.384 c-1.963,0.06-3.825,0.878-5.198,2.282l-4.855,4.963c0,0.066,0.006,0.131,0.004,0.198l-0.384,12.521 c-0.06,1.963-0.878,3.825-2.281,5.198l-9.056,8.859l-0.318,12.665c-0.052,2.088-0.962,4.062-2.515,5.458l-9.424,8.475l-0.878,12.65 c-0.145,2.095-1.151,4.037-2.78,5.363l-9.855,8.03l-1.588,12.617c-0.266,2.109-1.403,4.011-3.137,5.243l-10.413,7.401l-2.61,12.515 c-0.446,2.137-1.789,3.979-3.688,5.056l-11.231,6.372l-4.327,12.188c-0.778,2.191-2.516,3.905-4.718,4.652l-11.606,3.939 l-5.877,10.738c-1.09,1.991-3.013,3.391-5.242,3.816l-11.906,2.268l-6.923,9.938c-1.266,1.817-3.262,2.991-5.465,3.215 l-11.993,1.219l-7.589,9.366c-1.377,1.699-3.42,2.723-5.605,2.808l-12.01,0.471l-8.063,8.91c-1.459,1.612-3.554,2.516-5.712,2.499 l-12.014-0.126l-3.083,3.099c0.086,4.079,3.378,7.364,7.461,7.436l12.025,0.212c0.045,0,0.089,0.001,0.134,0.001 c2.019,0,3.958-0.804,5.385-2.239l8.466-8.509l12.014,0.126c2.158,0.018,4.253-0.887,5.712-2.499l8.063-8.91l12.01-0.471 c2.185-0.086,4.228-1.109,5.605-2.808l7.589-9.366l11.993-1.219c2.203-0.224,4.199-1.398,5.465-3.215l6.923-9.938l11.906-2.268 c2.23-0.425,4.153-1.825,5.242-3.816l5.877-10.738l11.607-3.939c2.201-0.747,3.94-2.461,4.718-4.652l4.327-12.188l11.231-6.372 c1.899-1.077,3.242-2.919,3.688-5.056l2.61-12.515l10.413-7.401c1.734-1.232,2.871-3.134,3.137-5.243l1.588-12.617l9.855-8.03 c1.628-1.326,2.634-3.268,2.78-5.363l0.878-12.65l9.424-8.475c1.553-1.396,2.463-3.371,2.515-5.458l0.318-12.665l9.056-8.859 c1.403-1.372,2.221-3.235,2.281-5.198l0.384-12.521C473.088,167.06,472.284,165.031,470.802,163.55z"/>
<path style="fill:#A2DB18;" d="M263.308,354.836c-2.816-2.816-7.329-2.979-10.34-0.374l-6.257,5.41l-6.502-1.556 c-3.175-0.758-6.481,0.594-8.211,3.362l-2.853,4.565l-5.292-1.004c-3.213-0.612-6.456,0.906-8.049,3.762l-2.639,4.728l-5.37-0.716 c-3.259-0.434-6.432,1.279-7.855,4.246l-2.367,4.937l-5.471-0.328c-3.321-0.2-6.392,1.789-7.565,4.906l-1.968,5.229l-5.593,0.27 c-3.414,0.164-6.297,2.588-7.046,5.922l-1.286,5.722l-5.985,1.473c-3.211,0.791-5.542,3.568-5.763,6.868l-0.409,6.078l-5.651,2.237 c-2.988,1.183-4.909,4.118-4.797,7.33l0.209,5.97l-5.355,2.636c-2.847,1.401-4.523,4.424-4.203,7.581l0.596,5.891l-5.154,2.905 c-2.748,1.549-4.253,4.633-3.782,7.752l0.88,5.829l-5.002,3.119c-2.671,1.666-4.038,4.806-3.437,7.897l1.364,7.011l-5.805,6.583 c-2.652,3.008-2.51,7.561,0.326,10.397c1.479,1.478,3.424,2.225,5.373,2.225c1.79,0,3.584-0.63,5.024-1.9l6.583-5.807l7.014,1.364 c3.088,0.598,6.232-0.768,7.897-3.44l3.112-4.995l5.821,0.88c3.121,0.473,6.206-1.034,7.754-3.782l2.903-5.152l5.886,0.597 c3.154,0.32,6.181-1.355,7.583-4.203l2.637-5.357l5.974,0.209c3.214,0.109,6.145-1.808,7.329-4.795l2.24-5.657l6.083-0.41 c3.299-0.222,6.076-2.553,6.866-5.763l1.474-5.986l5.721-1.286c3.335-0.749,5.758-3.633,5.922-7.047l0.269-5.589l5.225-1.966 c3.118-1.173,5.108-4.241,4.908-7.566l-0.328-5.469l4.936-2.366c2.967-1.421,4.681-4.592,4.248-7.853l-0.716-5.377l4.731-2.64 c2.855-1.594,4.371-4.836,3.762-8.048L251.904,389l4.573-2.862c2.767-1.731,4.118-5.035,3.359-8.209l-1.557-6.5l5.405-6.254 C266.288,362.163,266.124,357.651,263.308,354.836z"/>
<path style="fill:#A2DB18;" d="M391.025,478.043l-4.93-3.215l1.003-5.805c0.536-3.103-0.898-6.214-3.604-7.823l-5.073-3.016 l0.747-5.855c0.401-3.136-1.184-6.192-3.977-7.674l-5.249-2.783l0.421-5.928c0.227-3.182-1.559-6.166-4.471-7.471l-5.485-2.459 l-0.056-6.018c-0.03-3.25-2.124-6.121-5.21-7.142l-5.874-1.943l-0.899-6.14c-0.494-3.372-3.173-6.003-6.554-6.435l-5.654-0.723 l-1.68-5.432c-0.995-3.215-3.983-5.421-7.35-5.351l-5.529,0.067l-2.19-5.068c-1.312-3.036-4.438-4.874-7.726-4.546l-5.418,0.539 L303.754,373c-1.514-2.908-4.724-4.521-7.96-3.99l-5.33,0.868l-2.749-4.643c-1.665-2.81-4.937-4.241-8.132-3.557l-5.262,1.131 l-2.963-4.499c-1.826-2.772-5.241-4.04-8.43-3.127l-7.078,2.02c-2.525,0.721-4.498,2.694-5.219,5.218l-2.019,7.068 c-0.912,3.192,0.354,6.607,3.127,8.432l4.499,2.962l-1.13,5.272c-0.684,3.192,0.748,6.464,3.556,8.128l4.646,2.752l-0.868,5.331 c-0.527,3.235,1.081,6.443,3.987,7.958l4.829,2.515l-0.54,5.419c-0.328,3.291,1.511,6.416,4.547,7.727l5.066,2.188l-0.068,5.525 c-0.042,3.366,2.137,6.357,5.352,7.352l5.429,1.678l0.722,5.653c0.432,3.381,3.063,6.061,6.435,6.554l6.141,0.899l1.945,5.876 c1.021,3.084,3.89,5.178,7.139,5.209l6.024,0.058l2.462,5.49c1.305,2.911,4.286,4.698,7.47,4.469l5.928-0.421l2.78,5.245 c1.481,2.794,4.537,4.381,7.675,3.978l5.853-0.747l3.012,5.069c1.609,2.709,4.725,4.142,7.827,3.606l5.797-1.004l3.216,4.93 c1.422,2.179,3.832,3.446,6.361,3.446c0.546,0,1.096-0.059,1.645-0.181l7.402-1.64c2.883-0.639,5.135-2.89,5.773-5.773l1.639-7.398 C394.976,482.96,393.675,479.771,391.025,478.043z"/>
<path style="fill:#6ABA0F;" d="M391.025,478.043l-4.93-3.215l1.003-5.805c0.536-3.103-0.898-6.214-3.604-7.823l-5.073-3.016 l0.747-5.855c0.401-3.136-1.184-6.192-3.977-7.674l-5.249-2.783l0.421-5.928c0.227-3.182-1.559-6.166-4.471-7.471l-5.485-2.459 l-0.056-6.018c-0.03-3.25-2.124-6.121-5.21-7.142l-5.874-1.943l-0.899-6.14c-0.494-3.372-3.173-6.003-6.554-6.435l-5.654-0.723 l-1.68-5.432c-0.995-3.215-3.983-5.421-7.35-5.351l-5.529,0.067l-2.19-5.068c-1.312-3.036-4.438-4.874-7.726-4.546l-5.418,0.539 L303.754,373c-1.514-2.908-4.724-4.521-7.96-3.99l-5.33,0.868l-2.749-4.643c-1.665-2.81-4.937-4.241-8.132-3.557l-5.262,1.131 l-2.963-4.499c-1.826-2.772-5.241-4.04-8.43-3.127l-7.078,2.02c-2.22,0.634-4.012,2.237-4.903,4.33 c2.586,0.054,5.02,1.407,6.379,3.701l2.749,4.643l5.33-0.868c3.236-0.531,6.445,1.082,7.96,3.99l2.512,4.824l5.418-0.539 c3.289-0.327,6.415,1.51,7.726,4.546l2.19,5.068l5.529-0.067c3.367-0.07,6.355,2.137,7.35,5.351l1.68,5.432l5.654,0.723 c3.381,0.432,6.06,3.063,6.554,6.435l0.899,6.14l5.874,1.943c3.086,1.021,5.18,3.892,5.21,7.142l0.056,6.018l5.485,2.459 c2.911,1.305,4.697,4.289,4.471,7.471l-0.421,5.928l5.249,2.783c2.793,1.481,4.378,4.537,3.977,7.674l-0.747,5.855l5.073,3.016 c2.706,1.609,4.14,4.72,3.604,7.823l-1.003,5.805l4.93,3.215c2.65,1.728,3.951,4.918,3.266,8.006l-1.639,7.398 c-0.019,0.085-0.052,0.163-0.074,0.247c0.089-0.012,0.177-0.01,0.267-0.025l5.797-1.004l3.216,4.93 c1.422,2.179,3.832,3.446,6.361,3.446c0.546,0,1.096-0.059,1.645-0.181l7.402-1.64c2.883-0.639,5.135-2.89,5.773-5.773l1.639-7.398 C394.976,482.96,393.675,479.771,391.025,478.043z"/>
<path style="fill:#80C433;" d="M503.579,369.461l-6.7-7.528c-1.596-1.793-3.942-2.731-6.338-2.517l-9.538,0.835l-6.423-7.113 c-1.671-1.851-4.142-2.765-6.617-2.442l-9.508,1.235l-6.734-6.828c-1.76-1.784-4.289-2.583-6.753-2.143l-9.473,1.703l-7.132-6.465 c-1.877-1.701-4.477-2.356-6.937-1.743l-9.399,2.339l-7.682-5.913c-2.053-1.58-4.769-2.004-7.208-1.128l-9.255,3.333l-8.552-4.9 c-2.376-1.362-5.302-1.338-7.658,0.061l-7.971,4.738l-8.653-3.286c-2.515-0.955-5.347-0.508-7.446,1.173l-7.121,5.704l-8.821-2.3 c-2.547-0.664-5.259,0.038-7.164,1.857l-6.546,6.251l-8.892-1.646c-2.56-0.472-5.189,0.399-6.959,2.313l-6.118,6.616l-8.932-1.152 c-2.568-0.331-5.136,0.672-6.8,2.661l-5.772,6.902l-8.97-0.725c-2.522-0.207-4.971,0.857-6.547,2.83l-6.068,7.593 c-2.216,2.773-2.216,6.711-0.001,9.484l6.06,7.586c1.576,1.973,4.035,3.032,6.548,2.831l8.969-0.726l5.779,6.907 c1.664,1.989,4.227,2.993,6.798,2.66l8.937-1.151l6.12,6.617c1.769,1.914,4.396,2.787,6.958,2.312l8.899-1.645l6.546,6.251 c1.904,1.819,4.616,2.521,7.164,1.857l8.818-2.301l7.119,5.702c2.099,1.681,4.932,2.127,7.447,1.173l8.651-3.286l7.968,4.737 c1.195,0.711,2.539,1.067,3.882,1.067c1.303,0,2.606-0.335,3.777-1.005l8.553-4.9l9.259,3.333c2.438,0.879,5.154,0.452,7.206-1.128 l7.685-5.914l9.404,2.338c2.46,0.612,5.059-0.043,6.936-1.744l7.132-6.465l9.466,1.703c2.466,0.444,4.995-0.358,6.755-2.143 l6.732-6.827l9.504,1.236c2.476,0.323,4.948-0.592,6.619-2.444l6.415-7.109l9.539,0.835c2.392,0.215,4.741-0.725,6.338-2.517 l6.705-7.534C506.142,376.683,506.142,372.34,503.579,369.461z"/>
<g>
<path style="fill:#6ABA0F;" d="M357.496,413.941l-6.533,3.743c1.35,0.252,2.763,0.149,4.09-0.355l5.768-2.191L357.496,413.941z"/>
<path style="fill:#6ABA0F;" d="M357.495,335.085l3.323-1.197l-5.769-2.191c-1.326-0.503-2.738-0.607-4.086-0.356L357.495,335.085z "/>
<path style="fill:#6ABA0F;" d="M503.579,369.461l-6.7-7.528c-1.596-1.793-3.942-2.731-6.338-2.517l-9.538,0.835l-6.423-7.113 c-1.671-1.851-4.142-2.765-6.617-2.442l-9.508,1.235l-6.734-6.828c-1.76-1.784-4.289-2.583-6.753-2.143l-9.473,1.703l-7.132-6.465 c-1.877-1.701-4.477-2.356-6.937-1.743l-9.399,2.339l-7.682-5.913c-2.053-1.58-4.769-2.004-7.208-1.128l-9.255,3.333l-8.552-4.9 c-2.376-1.362-5.302-1.338-7.658,0.061l-1.83,1.088c1.473,0.101,2.909,0.618,4.115,1.546l7.682,5.913l9.399-2.339 c2.459-0.612,5.06,0.042,6.937,1.743l7.132,6.465l9.473-1.703c2.464-0.44,4.993,0.358,6.753,2.143l6.734,6.828l9.508-1.235 c2.474-0.322,4.945,0.592,6.617,2.442l6.423,7.113l9.538-0.835c2.396-0.214,4.742,0.724,6.338,2.517l6.7,7.528 c2.562,2.879,2.562,7.222,0,10.101l-6.705,7.534c-1.597,1.792-3.946,2.732-6.338,2.517l-9.539-0.835l-6.415,7.109 c-1.671,1.852-4.143,2.767-6.619,2.444l-9.504-1.236l-6.732,6.827c-1.76,1.785-4.29,2.586-6.755,2.143l-9.466-1.703l-7.132,6.465 c-1.876,1.701-4.476,2.356-6.936,1.744l-9.404-2.338l-7.685,5.914c-1.206,0.928-2.643,1.446-4.116,1.547l1.827,1.086 c1.195,0.711,2.539,1.067,3.882,1.067c1.303,0,2.606-0.335,3.777-1.005l8.553-4.9l9.259,3.333 c2.438,0.879,5.154,0.452,7.206-1.128l7.685-5.914l9.404,2.338c2.46,0.612,5.059-0.043,6.936-1.744l7.132-6.465l9.466,1.703 c2.466,0.444,4.995-0.358,6.755-2.143l6.732-6.827l9.504,1.236c2.476,0.323,4.948-0.592,6.619-2.444l6.415-7.109l9.539,0.835 c2.392,0.215,4.741-0.725,6.338-2.517l6.705-7.534C506.142,376.683,506.142,372.34,503.579,369.461z"/>
</g>
<path style="fill:#80C433;" d="M264.582,374.314c-0.756-3.679-4.082-6.25-7.84-6.058l-9.037,0.474l-5.622-7.054 c-1.616-2.027-4.158-3.094-6.731-2.821l-8.95,0.937l-5.936-6.763c-1.714-1.953-4.309-2.894-6.875-2.496l-8.916,1.384l-6.315-6.447 c-1.831-1.87-4.498-2.666-7.054-2.104l-8.865,1.945l-6.809-6.01c-1.992-1.758-4.758-2.347-7.293-1.555l-8.755,2.735l-7.501-5.3 c-2.238-1.581-5.154-1.833-7.63-0.663l-8.501,4.02l-8.959-4.041c-2.414-1.089-5.217-0.842-7.403,0.649l-8.062,5.498l-9.342-2.771 c-2.45-0.727-5.103-0.173-7.057,1.475l-7.38,6.222l-9.44-1.992c-2.463-0.519-5.023,0.214-6.837,1.96l-6.923,6.664l-9.491-1.456 c-2.467-0.377-4.969,0.481-6.681,2.301l-6.57,6.975l-9.53-1.031c-2.473-0.266-4.93,0.696-6.562,2.582l-6.837,7.9l-12.236,1.557 C2.843,371.513,0,374.742,0,378.567s2.844,7.053,6.639,7.536l12.242,1.556l6.839,7.901c1.633,1.886,4.089,2.851,6.563,2.581 l9.521-1.033l6.565,6.973c1.714,1.819,4.213,2.683,6.682,2.301l9.489-1.455l6.916,6.661c1.814,1.746,4.374,2.481,6.838,1.961 l9.442-1.992l7.384,6.224c1.954,1.647,4.607,2.202,7.056,1.475l9.345-2.77l8.066,5.499c2.187,1.491,4.992,1.737,7.403,0.648 l8.959-4.041l8.499,4.019c1.033,0.489,2.143,0.73,3.247,0.73c1.544,0,3.08-0.471,4.385-1.393l7.498-5.299l8.752,2.736 c2.535,0.792,5.301,0.203,7.293-1.555l6.808-6.008l8.863,1.945c2.555,0.562,5.222-0.233,7.053-2.103l6.323-6.451l8.918,1.384 c2.567,0.397,5.161-0.543,6.874-2.495l5.94-6.767l8.96,0.935c2.58,0.271,5.115-0.795,6.73-2.822l6.731-8.449l10.939-4.028 C263.29,381.674,265.337,377.994,264.582,374.314z"/>
<path style="fill:#80C433;" d="M318.583,193.964l-6.135-15.68l3.305-16.491c0.355-1.772,0.067-3.612-0.813-5.191l-8.128-14.585 l1.6-16.611c0.168-1.743-0.272-3.491-1.244-4.947l-9.237-13.833l0.503-16.62c0.052-1.725-0.484-3.416-1.521-4.796l-9.975-13.266 l-0.308-16.594c-0.032-1.713-0.642-3.366-1.731-4.688l-10.544-12.804l-1.002-16.556c-0.095-1.577-0.68-3.085-1.673-4.314 l-9.983-12.362c-1.442-1.786-3.615-2.824-5.91-2.824c-2.296,0-4.468,1.038-5.91,2.824l-9.981,12.36 c-0.993,1.229-1.577,2.737-1.673,4.314l-1.002,16.56l-10.547,12.809c-1.089,1.323-1.699,2.974-1.731,4.688l-0.309,16.596 l-9.975,13.269c-1.037,1.379-1.574,3.07-1.521,4.795l0.503,16.619l-9.236,13.832c-0.972,1.457-1.412,3.204-1.244,4.948 l1.601,16.608l-8.126,14.581c-0.88,1.579-1.168,3.419-0.813,5.191l3.305,16.488l-6.135,15.68c-0.708,1.808-0.696,3.819,0.033,5.619 l6.019,14.867l-3.354,15.667c-0.394,1.839-0.091,3.759,0.849,5.388l7.953,13.778l-1.637,15.815 c-0.188,1.817,0.284,3.641,1.331,5.137l9.083,12.983l-0.489,15.831c-0.055,1.799,0.53,3.56,1.651,4.967l9.849,12.366l0.376,15.804 c0.043,1.786,0.714,3.501,1.896,4.842l10.444,11.851l1.125,15.759c0.119,1.661,0.78,3.237,1.882,4.486l10.088,11.43 c1.442,1.634,3.516,2.57,5.696,2.57c2.179,0,4.253-0.936,5.696-2.57l10.084-11.424c1.102-1.248,1.763-2.825,1.882-4.486 l1.126-15.76l10.447-11.856c1.182-1.341,1.853-3.055,1.895-4.842l0.377-15.805l9.85-12.369c1.121-1.408,1.706-3.168,1.65-4.967 l-0.489-15.832l9.083-12.983c1.047-1.497,1.52-3.321,1.331-5.137l-1.638-15.814l7.952-13.776c0.94-1.629,1.243-3.549,0.849-5.389 l-3.354-15.664l6.018-14.866C319.279,197.783,319.291,195.772,318.583,193.964z"/>
<path style="fill:#6ABA0F;" d="M318.583,193.964l-6.135-15.68l3.305-16.491c0.355-1.772,0.067-3.612-0.813-5.191l-8.128-14.585 l1.6-16.611c0.168-1.743-0.272-3.491-1.244-4.947l-9.237-13.833l0.503-16.62c0.052-1.725-0.484-3.416-1.521-4.796l-9.975-13.266 l-0.308-16.594c-0.032-1.713-0.642-3.366-1.731-4.688l-10.544-12.804l-1.002-16.556c-0.095-1.577-0.68-3.085-1.673-4.314 l-9.983-12.362c-1.442-1.786-3.615-2.824-5.91-2.824c-2.296,0-4.468,1.038-5.91,2.824l-9.283,11.496l0.699,0.866 c0.993,1.229,1.577,2.737,1.673,4.314l1.002,16.556l10.544,12.804c1.089,1.323,1.699,2.975,1.731,4.688l0.308,16.594l9.975,13.266 c1.037,1.379,1.573,3.07,1.521,4.796l-0.503,16.62l9.237,13.833c0.972,1.457,1.412,3.204,1.244,4.947l-1.6,16.611l8.128,14.585 c0.88,1.579,1.168,3.419,0.813,5.191l-3.305,16.491l6.135,15.68c0.708,1.808,0.696,3.819-0.033,5.619l-6.018,14.866l3.354,15.664 c0.394,1.839,0.091,3.759-0.849,5.389l-7.952,13.776l1.638,15.814c0.188,1.817-0.284,3.641-1.331,5.137l-9.083,12.983l0.489,15.832 c0.055,1.799-0.53,3.559-1.65,4.967l-9.85,12.369l-0.377,15.805c-0.043,1.786-0.714,3.501-1.895,4.842l-10.447,11.856l-1.126,15.76 c-0.119,1.661-0.78,3.238-1.882,4.486l-0.585,0.663l9.498,10.761c1.442,1.634,3.516,2.57,5.696,2.57 c2.179,0,4.253-0.936,5.696-2.57l10.084-11.424c1.102-1.248,1.763-2.825,1.882-4.486l1.126-15.76l10.447-11.856 c1.182-1.341,1.853-3.055,1.895-4.842l0.377-15.805l9.85-12.369c1.121-1.408,1.706-3.168,1.65-4.967l-0.489-15.832l9.083-12.983 c1.047-1.497,1.52-3.321,1.331-5.137l-1.638-15.814l7.952-13.776c0.94-1.629,1.243-3.549,0.849-5.389l-3.354-15.664l6.018-14.866 C319.279,197.783,319.291,195.772,318.583,193.964z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><g><path d="m169.626 92.712-70.403 92.403 85.13 319.201c1.473 5.522 7.143 8.805 12.666 7.332l307.297-81.956c5.522-1.473 8.805-7.143 7.332-12.666l-100.796-377.938c-1.473-5.522-7.143-8.805-12.666-7.332z" fill="#ffdb0d"/></g><path d="m511.648 417.027-100.796-377.939c-1.473-5.522-7.143-8.805-12.666-7.332l-42.806 11.416c5.522-1.473 12.606 2.628 14.079 8.15l100.796 377.939c1.032 3.871-.278 7.81-3.053 10.329l37.114-9.898c5.522-1.472 8.805-7.143 7.332-12.665z" fill="#f2cf00"/><g><path d="m477.043 398.412c-1.106-4.141-5.358-6.598-9.499-5.5l-256.952 68.529c-4.141 1.105-6.604 5.358-5.5 9.5.927 3.472 4.065 5.763 7.494 5.763.662 0 1.335-.086 2.005-.264l256.952-68.529c4.142-1.104 6.605-5.358 5.5-9.499z" fill="#d6b80b"/><g><path d="m128.056 147.271-1.948 2.557 4.717-1.238c-1.003-.26-1.949-.695-2.769-1.319z" fill="#ffdb0d"/><path d="m384.613 81.962c4.141-1.105 6.604-5.358 5.5-9.499-1.106-4.141-5.36-6.599-9.5-5.5l-239.22 62.803-15.286 20.062z" fill="#d6b80b"/></g></g><g><circle cx="297.603" cy="271.702" fill="#f5f5f5" r="130.582"/><path d="m397.222 284.469c-20.723-9.596-44.51-5.671-64.952 2.633 17.847-20.726 32.659-45.451 30.549-73.853-23.764 10.994-41.628 34.966-51.21 58.724-2.253-31.776-10.15-64.798-36.512-85.529-12.551 31.141-2.923 63.752 10.978 92.453-20.101-15.824-47.596-28.604-73.76-25.508 12.249 25.779 37.59 39.805 63.372 48.868-21.981 2.927-44.884 11.313-58.116 30.125 22.114 8.353 48.483 3.767 68.407-7.984-1.851 17.024 3.739 27.816 3.739 27.816 11.051-5.822 18.862-15.753 22.133-27.84 8.403 8.4 19.47 13.635 31.416 13.558 0 0 1.019-11.943-8.936-26.43 22.954.393 48.076-8.871 62.892-27.033z" fill="#70e07a"/></g></g><g fill="#ab7f63"><ellipse cx="128.749" cy="33.77" rx="26.14" ry="16.927" transform="matrix(.54 -.841 .841 .54 30.76 123.852)"/><ellipse cx="71.519" cy="102.568" rx="16.927" ry="26.14" transform="matrix(.866 -.5 .5 .866 -41.702 49.501)"/><ellipse cx="23.827" cy="170.781" rx="16.927" ry="26.14" transform="matrix(.54 -.841 .841 .54 -132.746 98.541)"/><ellipse cx="24.175" cy="19.64" rx="26.14" ry="16.927" transform="matrix(.866 -.5 .5 .866 -6.581 14.719)"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><ellipse cx="346.95" cy="372.079" fill="#70e07a" rx="136.201" ry="136.115"/><path d="m346.949 235.964c-6.898 0-13.675.517-20.297 1.506 65.594 9.795 115.904 66.328 115.904 134.609s-50.31 124.814-115.904 134.609c6.622.989 13.399 1.506 20.297 1.506 75.222 0 136.201-60.941 136.201-136.115s-60.979-136.115-136.201-136.115z" fill="#56d661"/><g><g><path d="m436.605 412.934c-16.926-14.121-40.066-16.379-61.178-13.717 21.781-14.908 41.728-34.307 46.82-61.352-24.876 4.348-47.479 22.283-62.313 42.08 5.797-30.232 6.645-63.033-12.767-88.956-19.435 25.953-18.567 58.801-12.747 89.062-14.798-19.782-37.243-38.562-62.392-42.187 5.007 27.122 25.135 46.529 46.908 61.412-21.21-2.741-44.635-.614-61.64 13.657 18.531 13.307 44.242 15.591 65.728 9.581-5.955 15.436-3.428 26.905-3.428 26.905 11.744-2.684 21.491-10.012 27.543-20.484 5.743 9.936 14.754 17.58 25.905 20.484 0 0 3.918-10.898-1.759-26.905 21.289 6.084 47.001 3.69 65.32-9.58z" fill="#f5f5f5"/></g></g></g><g><g><path d="m396.727 161.373-297.295 329.017c-7.104 7.115-19.633 7.505-33.392 1.661-8.267-3.512-44.11 24.703-55.638 13.495-11.48-11.161 16.418-46.537 12.599-54.503-6.357-13.258-6.359-25.414.745-32.529l329.331-298.594 43.65-4.109z" fill="#ab7c5e"/><g><path d="m365.989 118.704 8.891 21.921-320.715 354.195c5.308-2.321 9.619-3.727 11.875-2.769 13.759 5.844 26.288 5.454 33.392-1.661l297.295-329.018v-45.562z" fill="#a17152"/></g><g><path d="m492.14 6.618 16.677 15.838c4.022 3.82 4.264 10.148.546 14.263l-112.636 124.654-43.65-41.453 125.142-113.462c3.967-3.597 10.038-3.527 13.921.16z" fill="#f5f5f5"/></g><path d="m508.817 22.456-14.618-13.882-119.319 132.051 21.847 20.748 112.635-124.654c3.719-4.116 3.477-10.443-.545-14.263z" fill="#ededed"/><path d="m23.001 451.043 10.375 17.841" fill="#ab7c5e"/></g><g><path d="m326.557 207.758c9.795 0 9.811-15.223 0-15.223-9.796 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m249.458 258.365c9.795 0 9.811-15.223 0-15.223-9.796 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m236.156 301.813c9.795 0 9.811-15.223 0-15.223-9.796 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m180.389 325.838c9.795 0 9.811-15.223 0-15.223-9.795 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m158.901 385.643c9.795 0 9.811-15.223 0-15.223-9.795 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m94.437 400.978c9.795 0 9.811-15.223 0-15.223-9.795 0-9.812 15.223 0 15.223z" fill="#916146"/></g><g><path d="m95.972 450.049c9.795 0 9.811-15.223 0-15.223-9.796 0-9.812 15.223 0 15.223z" fill="#916146"/></g></g><g fill="#c9ccd3"><path d="m37.106 213.1c0-4.204-3.408-7.611-7.611-7.611-4.204 0-7.611 3.408-7.611 7.611 0 11.76-4.139 17.182-9.38 24.047-5.862 7.677-12.504 16.378-12.504 33.284 0 16.908 6.642 25.611 12.502 33.288 5.241 6.866 9.381 12.29 9.381 24.052s-4.14 17.185-9.381 24.052c-5.86 7.676-12.502 16.379-12.502 33.287 0 4.204 3.408 7.612 7.611 7.612s7.611-3.408 7.611-7.612c0-11.762 4.14-17.185 9.381-24.052 5.86-7.677 12.502-16.38 12.502-33.287s-6.642-25.61-12.502-33.287c-5.241-6.867-9.381-12.29-9.381-24.052 0-11.76 4.139-17.182 9.38-24.047 5.862-7.678 12.504-16.379 12.504-33.285z"/><path d="m55.231 153.147c0-11.76 4.139-17.182 9.38-24.048 5.861-7.677 12.503-16.378 12.503-33.284 0-4.204-3.408-7.611-7.611-7.611s-7.611 3.408-7.611 7.611c0 11.76-4.139 17.182-9.38 24.047-5.86 7.677-12.503 16.378-12.503 33.284 0 16.908 6.642 25.61 12.502 33.287 5.241 6.866 9.381 12.29 9.381 24.052s-4.14 17.185-9.381 24.052c-5.86 7.677-12.502 16.38-12.502 33.288 0 4.204 3.408 7.612 7.611 7.612s7.611-3.408 7.611-7.612c0-11.762 4.14-17.185 9.381-24.052 5.86-7.677 12.502-16.38 12.502-33.287s-6.642-25.61-12.502-33.288c-5.241-6.866-9.381-12.29-9.381-24.051z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1 @@
<svg id="icons" enable-background="new 0 0 64 64" height="512" viewBox="0 0 64 64" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m7.502 1h33.996v62h-33.996z" fill="#ed5565"/><path d="m18 37.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m57.498 30c0 2.61-1.67 4.84-4 5.66-.63.22-1.3.34-2 .34s-1.37-.12-2-.34c-2.33-.82-4-3.05-4-5.66 0-3.31 2.69-6 6-6s6 2.69 6 6z" fill="#ffce54"/><path d="m53.498 35.66c-.63.22-1.3.34-2 .34s-1.37-.12-2-.34c-2.33-.82-4-3.05-4-5.66v3c0 2.61 1.67 4.84 4 5.65v.01c.63.22 1.3.34 2 .34s1.37-.12 2-.34v-.01c2.33-.811 4-3.04 4-5.65v-3c0 2.61-1.67 4.84-4 5.66z" fill="#f6bb42"/><path d="m20 28.5c0-.55.45-1 1-1h7c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1z" fill="#fff"/><path d="m20 38.5c0-.55.45-1 1-1h7c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1z" fill="#fff"/><path d="m20 18.5c0-.55.45-1 1-1h7c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1z" fill="#fff"/><path d="m18 27.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m18 17.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m38 17.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m38 27.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m38 37.5c.55 0 1 .45 1 1v7c0 .55-.45 1-1 1h-7c-.55 0-1-.45-1-1v-7c0-.55.45-1 1-1z" fill="#e6e9ed"/><path d="m41.502 64h-34c-.553 0-1-.447-1-1v-62c0-.553.447-1 1-1h34c.553 0 1 .447 1 1v62c0 .553-.447 1-1 1zm-33-2h32v-60h-32z" fill="#ed5565"/><path d="m25.499 21h-1.998c-.553 0-1-.447-1-1s.447-1 1-1h1.998c.553 0 1 .447 1 1s-.447 1-1 1z" fill="#656d78"/><path d="m25.499 25c-.553 0-1-.447-1-1v-4c0-.553.447-1 1-1s1 .447 1 1v4c0 .553-.447 1-1 1z" fill="#656d78"/><path d="m25.499 31h-1.998c-.553 0-1-.447-1-1s.447-1 1-1h1.998c.553 0 1 .447 1 1s-.447 1-1 1z" fill="#656d78"/><path d="m25.499 35c-.553 0-1-.447-1-1v-4c0-.553.447-1 1-1s1 .447 1 1v4c0 .553-.447 1-1 1z" fill="#656d78"/><path d="m25.499 41h-1.998c-.553 0-1-.447-1-1s.447-1 1-1h1.998c.553 0 1 .447 1 1s-.447 1-1 1z" fill="#656d78"/><path d="m25.499 45c-.553 0-1-.447-1-1v-4c0-.553.447-1 1-1s1 .447 1 1v4c0 .553-.447 1-1 1z" fill="#656d78"/><path d="m28.499 6c1.66 0 3 1.34 3 3s-1.34 3-3 3h-7.998c-1.66 0-3-1.34-3-3s1.34-3 3-3z" fill="#ffce54"/><path d="m28.499 10h-7.996c-.553 0-1-.447-1-1s.447-1 1-1h7.996c.553 0 1 .447 1 1s-.447 1-1 1z" fill="#f6bb42"/><g fill="#da4453"><path d="m35.5 53.001h-22c-.553 0-1-.447-1-1s.447-1 1-1h22c.553 0 1 .447 1 1s-.447 1-1 1z"/><path d="m35.5 56.001h-22c-.553 0-1-.447-1-1s.447-1 1-1h22c.553 0 1 .447 1 1s-.447 1-1 1z"/><path d="m30.5 59.001h-12c-.553 0-1-.447-1-1s.447-1 1-1h12c.553 0 1 .447 1 1s-.447 1-1 1z"/><path d="m37.528 10c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m34.528 10c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m14.506 10c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m11.506 10c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/></g><path d="m47.497 37.448c.579.521 1.25.94 2 1.202v-2.99c-.75-.265-1.421-.688-2-1.209z" fill="#edab37"/><path d="m53.499 38.65c.75-.262 1.421-.682 2-1.202v-2.997c-.579.521-1.25.944-2 1.209z" fill="#edab37"/><path d="m51.498 33c-.553 0-1-.447-1-1v-4c0-.553.447-1 1-1s1 .447 1 1v4c0 .553-.447 1-1 1z" fill="#edab37"/></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1 @@
<svg height="464pt" viewBox="0 -88 464 464" width="464pt" xmlns="http://www.w3.org/2000/svg"><path d="m464 288h-464v-168l56-56h352l56 56zm0 0" fill="#e04646"/><path d="m192 288h-192v-168l56-56h80l56 56zm0 0" fill="#e94f4f"/><path d="m136 64 56 56v40h272v-40l-56-56zm0 0" fill="#e04646"/><path d="m328 64h-32v-32h-80v32h-32v-32c0-17.671875 14.328125-32 32-32h80c17.671875 0 32 14.328125 32 32zm0 0" fill="#3d4d63"/><path d="m24 128h16v16h-16zm0 0" fill="#f26666"/><path d="m24 160h16v64h-16zm0 0" fill="#f26666"/><g fill="#cf3a3a"><path d="m192 152h272v16h-272zm0 0"/><path d="m344 128c8.835938 0 16 7.164062 16 16v32c0 8.835938-7.164062 16-16 16s-16-7.164062-16-16v-32c0-8.835938 7.164062-16 16-16zm0 0"/><path d="m328 152h32v16h-32zm0 0"/><path d="m124.6875 64 59.3125 59.3125v164.6875h16v-171.3125l-52.6875-52.6875zm0 0"/></g><path d="m328 128c8.835938 0 16 7.164062 16 16v32c0 8.835938-7.164062 16-16 16s-16-7.164062-16-16v-32c0-8.835938 7.164062-16 16-16zm0 0" fill="#d6d6d4"/><path d="m312 152h32v16h-32zm0 0" fill="#ccccca"/><path d="m352 224h80v32h-80zm0 0" fill="#f26666"/><path d="m184 48h32v16h-32zm0 0" fill="#2e3e51"/><path d="m296 48h32v16h-32zm0 0" fill="#2e3e51"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,443 @@
import { Menu, Point, UIMenuSliderItem, UIMenuItem, Color, UIMenuListItem, ItemsCollection } from "../libs/NativeUI";
import { createMenuItem } from "../util";
import moneyformat from "../moneyformat";
import { getAnimFromId } from "../util/animationSync";
import { getCreatedPedByName } from "../Ped/PedCreator";
import KeyBinder from 'ragemp-better-bindings';
export const hanfPlantObjects = {
stage1: mp.game.joaat('bkr_prop_weed_bud_pruned_01a'),
stage2: mp.game.joaat('bkr_prop_weed_bud_01b'),
stage3: mp.game.joaat('prop_weed_02'),
stage4: mp.game.joaat('prop_weed_01')
};
const hanfTimeToObject = [
{
minutes: 15,
object: hanfPlantObjects.stage1,
},
{
minutes: 60 * 1,
object: hanfPlantObjects.stage2
},
{
minutes: 60 * 3,
object: hanfPlantObjects.stage3
},
{
minutes: 60 * 4,
object: hanfPlantObjects.stage4
}
]
const minimumPlantDistance = 2;
const maximumPlantDuration = 6 * 60 * 60 * 1000; // 6 Stunden / 360 Minuten / 21600 Sekunden / 21600000 Millisekunden
const timeToHarvestPlant = 4 * 60 * 60 * 1000; // 4 Stunden
export default function hanfSystem(globalData: IGlobalData) {
let currentPlantingPreviewObject: ObjectMp = null;
let currentPlantingMarkerPreview: MarkerMp = null;
let currentlyPlanting: boolean = false;
let lastPlantingState = true;
mp.events.add("SERVER:Hanf_BuySeed", (maxSeedsToBuy, price) => {
if (globalData.InMenu || globalData.InChat) {
return;
}
globalData.InMenu = true;
var menu = new Menu("Samen kaufen", "Kaufe dir Hanfsamen", new Point(50, 50));
var seedsToBuy = 0;
var countItems = [...Array(maxSeedsToBuy).keys()].map(x => x + 1);
var soloPriceItem = createMenuItem("Einzelpreis", "Preis pro Samen", item => {
item.SetRightLabel("$" + moneyformat(price));
});
menu.AddItem(soloPriceItem);
var countItem = new UIMenuListItem("Anzahl", "Wähle die Anzahl der Samen aus", new ItemsCollection(countItems), 0);
menu.AddItem(countItem);
var buyItem = new UIMenuItem("Kaufen", "Kaufe die Samen");
buyItem.BackColor = new Color(0, 100, 0);
buyItem.HighlightedBackColor = new Color(0, 150, 0);
menu.AddItem(buyItem);
var completePriceItem = new UIMenuItem("Gesamtpreis", "Preis für alle Samen");
menu.AddItem(completePriceItem);
menu.ListChange.on((item, index) => {
if (item === countItem) {
seedsToBuy = Number(countItem.SelectedValue);
completePriceItem.SetRightLabel("$" + moneyformat(seedsToBuy * price));
}
});
menu.ItemSelect.on((item, index) => {
if (item === buyItem) {
mp.events.callRemote("CLIENT:Hanf_BuySeeds", seedsToBuy);
menu.Close();
}
});
menu.MenuClose.on(() => {
globalData.InMenu = false;
});
menu.Open();
});
mp.events.add("SERVER:Hanf_SellCannabisMenu", (maxCannabisToSell, price) => {
if (globalData.InMenu || globalData.InChat) {
return;
}
globalData.InMenu = true;
var menu = new Menu("Cannabis verkaufen", "Verkaufe dein Cannabis", new Point(50, 50));
var cannabisToSell = 0;
var countItems = [...Array(maxCannabisToSell).keys()].map(x => x + 1);
var soloPriceItem = createMenuItem("Einzelpreis", "Preis pro Hanfblüte", item => {
item.SetRightLabel("$" + moneyformat(price));
});
menu.AddItem(soloPriceItem);
var countItem = new UIMenuListItem("Anzahl", "Wähle die Anzahl der Blüten aus", new ItemsCollection(countItems), 0);
menu.AddItem(countItem);
var buyItem = new UIMenuItem("Verkaufen", "Verkaufe dein Cannabis");
buyItem.BackColor = new Color(0, 100, 0);
buyItem.HighlightedBackColor = new Color(0, 150, 0);
menu.AddItem(buyItem);
var completePriceItem = new UIMenuItem("Gesamtpreis", "Preis für alle Blüten");
menu.AddItem(completePriceItem);
menu.ListChange.on((item, index) => {
if (item === countItem) {
cannabisToSell = Number(countItem.SelectedValue);
completePriceItem.SetRightLabel("$" + moneyformat(cannabisToSell * price));
}
});
menu.ItemSelect.on((item, index) => {
if (item === buyItem) {
mp.events.callRemote("CLIENT:Hanf_SellCannabis", cannabisToSell);
menu.Close();
}
});
menu.MenuClose.on(() => {
globalData.InMenu = false;
});
menu.Open();
});
mp.events.add("SERVER:Hanf_PlayManufacturerAnim", animId => {
var anim = getAnimFromId(animId);
var npc = getCreatedPedByName("hanf_verarbeiter_typ");
npc.taskPlayAnim(anim.dict, anim.name, 1, 0, 1000 * 10, 1, 0, !1, !1, !1);
setTimeout(() => {
npc.stopAnim(anim.name, anim.dict, 3);
npc.stopAnimTask(anim.dict, anim.name, 3);
}, 1000 * 10);
});
mp.events.add("SERVER:Hanf_StartPlanting", _ => {
let player = mp.players.local;
currentPlantingPreviewObject = mp.objects.new(hanfPlantObjects.stage1, player.position, {
alpha: 255
});
currentPlantingPreviewObject.notifyStreaming = true;
currentlyPlanting = true;
});
mp.events.add(RageEnums.EventKey.RENDER, _ => {
if (!currentlyPlanting) {
return;
}
var player = mp.players.local;
var newPlantState = isAbleToPlant();
var markerColor: [number, number, number, number] = [0, 255, 0, 255];
if (!newPlantState) {
markerColor = [255, 0, 0, 255];
}
if (currentPlantingMarkerPreview) {
currentPlantingMarkerPreview.destroy();
}
var playerPos = player.position;
var objectPos = new mp.Vector3(playerPos.x, playerPos.y, playerPos.z - 1.0);
currentPlantingMarkerPreview = mp.markers.new(25, objectPos, 0.7, {
color: markerColor,
visible: true,
rotation: new mp.Vector3(1, 0, 0)
});
});
mp.events.add(RageEnums.EventKey.ENTITY_STREAM_IN, entity => {
if (entity === currentPlantingPreviewObject) {
currentPlantingPreviewObject.attachTo(Number(mp.players.local.handle), 0, 0, 0.2, -0.95, 0, 0, 0, true, false, false, false, 0, true);
}
});
function isAbleToPlant() {
var player = mp.players.local;
if (isNearPlant(minimumPlantDistance)) {
return false;
}
if (!isSurfaceAllowed()) {
return false;
}
if (currentPlantingPreviewObject) {
var objectPos = getPlantPreviewPosition();
var realZ = mp.game.gameplay.getGroundZFor3dCoord(objectPos.x, objectPos.y, objectPos.z + 1, 0, false);
if (realZ > objectPos.z + 1) {
return false;
}
}
if (player.isSwimming() || player.isSwimmingUnderWater() || !player.isOnFoot() || player.isSprinting() || player.isShooting()) {
return false;
}
return true;
}
const RAYCAST_POINT_TO_POINT_NATIVE = "0x377906D8A31E5586";
const GET_RAYCAST_RESULT_NATIVE = "0x65287525D951F6BE";
function isSurfaceAllowed() {
return true;
const player = mp.players.local;
var position = getPlantPreviewPosition();
var raycast = mp.game.invoke(RAYCAST_POINT_TO_POINT_NATIVE, position.x, position.y, position.z + 5, position.x, position.y, position.z - 5, 1, 0, 7);
mp.gui.chat.push("raycast = " + raycast);
var resultObj = {
hit: [false],
coord: [new mp.Vector3()],
surface: [new mp.Vector3()],
material: [0],
entityHit: [null]
};
var raycastResult = -1;
var retries = 10;
do {
raycastResult = mp.game.invoke(GET_RAYCAST_RESULT_NATIVE, raycast, resultObj.hit, resultObj.coord, resultObj.surface, resultObj.material, resultObj.entityHit);
retries--;
} while (raycastResult != 0 && raycastResult != 2 && retries > 0);
mp.gui.chat.push("result: " + raycastResult + ", result = " + JSON.stringify(resultObj));
return true;
}
KeyBinder.bind('e', _ => {
if (globalData.InChat) {
return;
}
if (!currentlyPlanting) {
var nearPlant = isNearPlant(0.5);
if (!nearPlant) {
return;
}
mp.events.callRemote("CLIENT:Hanf_HarvestHanf", nearPlant.Id);
return;
}
if (!lastPlantingState) {
mp.game.graphics.notify("~r~Hier kann kein Hanf platziert werden");
return;
}
currentlyPlanting = false;
var player = mp.players.local;
if (currentPlantingPreviewObject) {
currentPlantingPreviewObject.destroy();
currentPlantingPreviewObject = null;
}
if (currentPlantingMarkerPreview) {
currentPlantingMarkerPreview.destroy();
currentPlantingMarkerPreview = null;
}
var position = getPlantPreviewPosition();
var realZ = mp.game.gameplay.getGroundZFor3dCoord(position.x, position.y, position.z + 2, 0, false);
mp.events.callRemote("CLIENT:Hanf_PlantHanf", position.x, position.y, realZ);
});
function getPlantPreviewPosition(): Vector3Mp {
return mp.players.local.getOffsetFromInWorldCoords(0, 0.2, -1);
}
function getPlantText(plant: CannabisData) {
var time = Date.now() - Date.parse(plant.Time);
if (time > maximumPlantDuration) {
return ("~g~Hanf~n~~r~Verrottet");
}
return (`~g~Hanf~n~Fortschritt: ${getPlantPercentage(plant).toFixed(2)}%`);
}
function getPlantPercentage(plant: CannabisData) {
var time = Date.now() - Date.parse(plant.Time);
return Math.min((time / timeToHarvestPlant) * 100, 100);
}
function isNearPlant(distance: number): CannabisData {
var pos = getPlantPreviewPosition();
var nearPlants = currentHanfData.filter(h =>
mp.game.gameplay.getDistanceBetweenCoords(pos.x, pos.y, pos.z, h.X, h.Y, h.Z, true) < distance);
if (!nearPlants || nearPlants.length == 0) {
return null;
}
nearPlants = nearPlants.sort((a, b) =>
Number(mp.game.gameplay.getDistanceBetweenCoords(pos.x, pos.y, pos.z, a.X, a.Y, a.Z, true) <
mp.game.gameplay.getDistanceBetweenCoords(pos.x, pos.y, pos.z, b.X, b.Y, b.Z, true)));
return nearPlants[0];
}
let currentHanfData: Array<CannabisData> = [];
let hanfDataIdToObjectMap: Map<number, ObjectMp> = new Map<number, ObjectMp>();
let hanfDataIdToTextLabelMap: Map<number, TextLabelMp> = new Map<number, TextLabelMp>();
mp.events.add("SERVER:Hanf_UpdateHanfData", dataJson => {
mp.console.logInfo(dataJson);
var data: Array<CannabisData> = <Array<CannabisData>>JSON.parse(dataJson)
var newPlants = data.filter(d => currentHanfData.filter(x => x.Id === d.Id).length == 0);
var removedPlants = currentHanfData.filter(d => data.filter(x => x.Id === d.Id).length == 0);
var existingPlants = data.filter(d => currentHanfData.filter(x => x.Id === d.Id).length == 1);
newPlants.forEach(plant => {
var model = getPlantModel(plant);
var object = mp.objects.new(getPlantModel(plant), new mp.Vector3(plant.X, plant.Y, plant.Z));
hanfDataIdToObjectMap.set(plant.Id, object);
var textLabel = mp.labels.new(getPlantText(plant), new mp.Vector3(plant.X, plant.Y, plant.Z + 1), {
los: true,
drawDistance: 2
});
hanfDataIdToTextLabelMap.set(plant.Id, textLabel);
});
removedPlants.forEach(plant => {
var object = hanfDataIdToObjectMap.get(plant.Id);
hanfDataIdToObjectMap.delete(plant.Id);
object.destroy();
var textLabel = hanfDataIdToTextLabelMap.get(plant.Id);
textLabel.destroy();
hanfDataIdToTextLabelMap.delete(plant.Id);
});
existingPlants.forEach(plant => {
var object = hanfDataIdToObjectMap.get(plant.Id);
var model = getPlantModel(plant);
if (model != object.model) {
object.destroy();
var object = mp.objects.new(model, new mp.Vector3(plant.X, plant.Y, plant.Z));
hanfDataIdToObjectMap.delete(plant.Id);
hanfDataIdToObjectMap.set(plant.Id, object);
}
var textLabel = hanfDataIdToTextLabelMap.get(plant.Id);
textLabel.text = getPlantText(plant);
});
currentHanfData = data;
});
function getPlantModel(plant: CannabisData): number {
var diff = Date.now() - Date.parse(plant.Time);
var model = -1;
var dbgTxt;
if (diff <= 30 * 60 * 1000) { // 0 - 30 Minuten
model = hanfPlantObjects.stage1;
dbgTxt = "30 Minuten";
} else if (diff <= 4 * 60 * 60 * 1000) { // 30 - 240 Minuten / 4 Stunden
model = hanfPlantObjects.stage3;
dbgTxt = "3 Stunden";
} else { // Ausgewachsen / Ab 4 Stunden
model = hanfPlantObjects.stage4;
dbgTxt = "4 Stunden";
}
//mp.gui.chat.push("plant id = " + plant.Id + ", age = " + dbgTxt);
return model;
}
mp.events.addProc("SERVER:Hanf_GetModelToGivePlayer", id => {
var plant = currentHanfData.filter(x => x.Id == id)[0];
var model = getPlantModel(plant);
if (model == hanfPlantObjects.stage1) {
return 1;
} else if (model == hanfPlantObjects.stage3) {
return 2;
} else if (model == hanfPlantObjects.stage4) {
return 3;
}
});
//var rotationTestObject: ObjectMp = null;
//var a1: number, a2: number, a3: number, a4: number, a5: number, a6: number;
//mp.events.add(RageEnums.EventKey.PLAYER_COMMAND, (f) => {
// var args = f.split(' ');
// if (args[0] != "a") {
// return;
// }
// a1 = parseFloat(args[1] || "0");
// a2 = parseFloat(args[2] || "0");
// a3 = parseFloat(args[3] || "0");
// a4 = parseFloat(args[4] || "0");
// a5 = parseFloat(args[5] || "0");
// a6 = parseFloat(args[6] || "0");
// mp.gui.chat.push(`a1: ${a1.toFixed(2)}, a2: ${a2.toFixed(2)}, a3: ${a3.toFixed(2)}, a4: ${a4.toFixed(2)}, a5: ${a5.toFixed(2)}, a6: ${a6.toFixed(2)},`)
// if (rotationTestObject != null) {
// rotationTestObject.attachTo(Number(mp.players.local.handle), mp.players.local.getBoneIndex(57005), a1, a2, a3, a4, a5, a6, true, false, false, false, 0, true);
// return;
// }
// rotationTestObject = mp.objects.new(mp.game.joaat("prop_cs_trowel"), mp.players.local.position, {
// alpha: 255
// });
//});
}

View File

@@ -168,5 +168,5 @@ export {
EntityType, EntityType,
AccountData, AccountData,
VehicleData, VehicleData,
DoorState DoorState,
} }

View File

@@ -22,7 +22,7 @@ declare type AccountData = {
nextPayday: number; nextPayday: number;
stateFaction: boolean; stateFaction: boolean;
playTime: number; playTime: number;
userWarn: number; userWarn: number;
} }
declare type JobData = { declare type JobData = {
@@ -48,6 +48,7 @@ declare type Paycheck = {
amount: number; amount: number;
rentalFees: number; rentalFees: number;
healthInsurance: number; healthInsurance: number;
gez: number;
factionMoney: number; factionMoney: number;
otheramount: number; otheramount: number;
} }
@@ -96,6 +97,14 @@ declare type RentcarProperty = {
Price: number; Price: number;
} }
declare type CannabisData = {
Id: number;
X: number;
Y: number;
Z: number;
Time: string;
}
declare type PlayerCharacterData = { declare type PlayerCharacterData = {
Gender: boolean; Gender: boolean;
Father: number; Father: number;

View File

@@ -84,7 +84,7 @@ import doorManager from './DoorManager/doormanager';
doorManager(); doorManager();
import factionManagement from './FactionManagement/main'; import factionManagement from './FactionManagement/main';
factionManagement(); factionManagement(globalData);
import deathScreen from './Gui/deathscreen'; import deathScreen from './Gui/deathscreen';
deathScreen(); deathScreen();
@@ -177,6 +177,9 @@ vehicleIndicators();
import vehicleDoor from './vehiclesync/door'; import vehicleDoor from './vehiclesync/door';
vehicleDoor(); vehicleDoor();
import vehicleInWater from './vehiclesync/vehicleinwater';
vehicleInWater()
import freeze from './util/freeze'; import freeze from './util/freeze';
freeze(); freeze();
@@ -268,6 +271,9 @@ antiAfk(globalData);
import ammunation from './Interaction/ammunation/ammunation'; import ammunation from './Interaction/ammunation/ammunation';
ammunation(globalData); ammunation(globalData);
import farmerFieldList from './Jobs/FarmerFieldSelect';
farmerFieldList(globalData);
import handsup from './Player/handsup'; import handsup from './Player/handsup';
handsup(); handsup();
@@ -286,6 +292,12 @@ notification();
import rentCar from './util/rentcar'; import rentCar from './util/rentcar';
rentCar(globalData); rentCar(globalData);
import Carwash from './util/carwash';
Carwash(globalData);
import hanfSystem from './drugs/hanf';
hanfSystem(globalData);
require('./Gui/policedepartment'); require('./Gui/policedepartment');
require('./Gui/helptext'); require('./Gui/helptext');
require('./admin/spectate'); require('./admin/spectate');

View File

@@ -21,14 +21,14 @@
invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html'); invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html');
}); });
mp.events.add('inventoryShow', () => { mp.events.add('inventoryShow', (force = undefined) => {
if (!globalData.InMenu && !loaded) { if (!globalData.InMenu && !loaded || force === true) {
globalData.InMenu = true; globalData.InMenu = true;
mp.gui.cursor.show(true, true); mp.gui.cursor.show(true, true);
loaded = true; loaded = true;
invBrowser.execute(`showInventory()`); invBrowser.execute(`showInventory()`);
} else if (loaded) { } else if (loaded || force === false) {
globalData.InMenu = false; globalData.InMenu = false;
mp.gui.cursor.show(false, false); mp.gui.cursor.show(false, false);
loaded = false; loaded = false;

View File

@@ -1,5 +1,43 @@
import { debug } from "util"; import { debug } from "util";
const animationSyncData =
{
animations: [],
register: function (name, animDict, animName, duration, loop, flag, endless, eventAfter: string = null) {
let id = mp.game.joaat(name);
if (!this.animations.hasOwnProperty(id)) {
this.animations[id] =
{
id: id,
name: name,
animDict: animDict,
animName: animName,
duration: duration,
loop: loop,
flag: flag,
endless: endless,
eventAfter: eventAfter
};
} else {
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
}
},
getAnimFromId: function (name: string): { dict: string, name: string } {
var anim = this.animations[mp.game.joaat(name)];
return {
dict: anim.animDict,
name: anim.animName
}
}
};
export function getAnimFromId(name: string) {
return animationSyncData.getAnimFromId(name);
}
export default function animationSync() { export default function animationSync() {
let blockInput = false; let blockInput = false;
let animationBreakTimer; let animationBreakTimer;
@@ -12,37 +50,17 @@ export default function animationSync() {
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0, false); animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0, false);
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50, true); animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50, true);
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50, true); animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50, true);
animationSyncData.register("manufacturJoint", "anim@mp_snowball", "pickup_snowball", 1000 * 10, false, 1, false);
//animationSyncData.register("harvestPlantEnter", "amb@world_human_gardener_plant@female@enter", "enter_female", 1000 * 3.5, false, 1, false);
animationSyncData.register("harvestPlant", "amb@world_human_gardener_plant@male@base", "base", 1000 * 10, false, 1, false, "Hanf_FinishDiggingAnimation");
//animationSyncData.register("harvestPlantExit", "amb@world_human_gardener_plant@female@exit", "exit_female", 1000 * 3.5, false, 1, false, "Hanf_FinishDiggingAnimation");
animationSyncData.register("jointUse", "amb@world_human_smoking_pot@male@base", "base", 1000 * 10, false, 1, false);
}); });
const animationBreakMessage = [ const animationBreakMessage = [
{ animName: "Cuffed", msg: "Handschellen gebrochen." } { animName: "Cuffed", msg: "Handschellen gebrochen." }
]; ];
const animationSyncData =
{
animations: [],
register: function (name, animDict, animName, duration, loop, flag, endless) {
let id = mp.game.joaat(name);
if (!this.animations.hasOwnProperty(id)) {
this.animations[id] =
{
id: id,
name: name,
animDict: animDict,
animName: animName,
duration: duration,
loop: loop,
flag: flag,
endless: endless
};
} else {
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
}
}
};
/* /*
mp.events.add("entityStreamIn", (entity) => { mp.events.add("entityStreamIn", (entity) => {
if (entity.type === "player" && entity.animationData) { if (entity.type === "player" && entity.animationData) {
@@ -90,6 +108,7 @@ export default function animationSync() {
clearTimeout(animationBreakTimer); clearTimeout(animationBreakTimer);
animationBreakTimer = null; animationBreakTimer = null;
} }
if (string == null) { if (string == null) {
blockInput = false; blockInput = false;
return; return;
@@ -101,7 +120,7 @@ export default function animationSync() {
let animData = animationSyncData.animations[index]; let animData = animationSyncData.animations[index];
let { id, name, animDict, animName, duration, loop, flag, endless } = animData; let { id, name, animDict, animName, duration, loop, flag, endless, eventAfter } = animData;
loadAnimDict(animDict, function () { loadAnimDict(animDict, function () {
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1) mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
@@ -116,6 +135,9 @@ export default function animationSync() {
let a = setTimeout(function () { let a = setTimeout(function () {
clearTimeout(a); clearTimeout(a);
mp.events.callRemote("CLIENT:ClearAnimationData", true); mp.events.callRemote("CLIENT:ClearAnimationData", true);
if (eventAfter) {
mp.events.callRemote("CLIENT:" + eventAfter);
}
}, duration); }, duration);
} }
} }

View File

@@ -1,4 +1,5 @@
import { IGame, IEntity } from "../game"; import { IGame, IEntity } from "../game";
import { hanfPlantObjects } from "../drugs/hanf";
export default function attachmentManager(game: IGame) { export default function attachmentManager(game: IGame) {
mp.events.add("SERVER:LoadAttachments", () => { mp.events.add("SERVER:LoadAttachments", () => {
@@ -9,6 +10,10 @@ export default function attachmentManager(game: IGame) {
attachmentMngr.register("weapondeal1", "ex_office_swag_guns02", "chassis_dummy", new mp.Vector3(0, 0.8, 0), new mp.Vector3(0, 0, 0)); attachmentMngr.register("weapondeal1", "ex_office_swag_guns02", "chassis_dummy", new mp.Vector3(0, 0.8, 0), new mp.Vector3(0, 0, 0));
attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180)); attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180));
attachmentMngr.register("handcuffs", "p_cs_cuffs_02_s", 28422, new mp.Vector3(-0.05, 0, 0), new mp.Vector3(90, 90, 0)); attachmentMngr.register("handcuffs", "p_cs_cuffs_02_s", 28422, new mp.Vector3(-0.05, 0, 0), new mp.Vector3(90, 90, 0));
attachmentMngr.register("shovel", "prop_cs_trowel", 28422, new mp.Vector3(0.1, 0.0, 0.0), new mp.Vector3(120, 70, 0));
attachmentMngr.register("CannabisPlantInHand1", hanfPlantObjects.stage1, 28422, new mp.Vector3(), new mp.Vector3());
attachmentMngr.register("CannabisPlantInHand2", hanfPlantObjects.stage3, 28422, new mp.Vector3(), new mp.Vector3());
attachmentMngr.register("CannabisPlantInHand3", hanfPlantObjects.stage4, 28422, new mp.Vector3(), new mp.Vector3());
}); });
const attachmentMngr = const attachmentMngr =
@@ -140,7 +145,7 @@ export default function attachmentManager(game: IGame) {
targetEntity, bone, targetEntity, bone,
offset.x, offset.y, offset.z, offset.x, offset.y, offset.z,
rotation.x, rotation.y, rotation.z, rotation.x, rotation.y, rotation.z,
false, false, false, false, 2, true true, false, false, false, 0, true
); );
} }

View File

@@ -0,0 +1,27 @@
export default function Carwash(globalData: IGlobalData) {
mp.events.add('washcar', () => {
let vehicle = mp.players.local.vehicle;
vehicle.setDirtLevel(0);
});
mp.events.add('entityStreamIn', (entity) => {
if (entity.type !== 'vehicle') {
return;
}
var vehicle: VehicleMp = entity as VehicleMp;
vehicle.getDirtLevel();
let dirtLevel = vehicle.getDirtLevel();
entity.setDirtLevel(dirtLevel);
});
mp.events.add('getdirtlevel', () => {
let vehicle = mp.players.local.vehicle;
let num = vehicle.getDirtLevel();
mp.gui.chat.push("Dirtlevel = " + num);
});
}

View File

@@ -21,10 +21,12 @@ function isTargetInPolygon(pos): boolean {
export default function weapondamageUtil(globalData: IGlobalData) { export default function weapondamageUtil(globalData: IGlobalData) {
let blockInput = false; let blockInput = false;
mp.players.local.setSuffersCriticalHits(false);
mp.players.local.setSuffersCriticalHits(false);
mp.players.forEachInStreamRange((player) => { mp.players.forEachInStreamRange((player) => {
player.setSuffersCriticalHits(false); player.setSuffersCriticalHits(false);
}); });
mp.events.add(RageEnums.EventKey.INCOMING_DAMAGE, (sourceEntity: EntityMp, sourcePlayer: PlayerMp, targetEntity: EntityMp, weapon: number, boneIndex: number, damage: number) => { mp.events.add(RageEnums.EventKey.INCOMING_DAMAGE, (sourceEntity: EntityMp, sourcePlayer: PlayerMp, targetEntity: EntityMp, weapon: number, boneIndex: number, damage: number) => {

View File

@@ -0,0 +1,9 @@
export default function vehicleInWater() {
mp.events.add('CheckWaterCrash', (vehicle) => {
if (vehicle.isInWater() && !vehicle.getIsEngineRunning()) {
mp.events.callRemote("CheckWater", vehicle.id);
}
});
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace ReallifeGamemode.Database.Entities
{
public class CannabisPlant
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public DateTime PlantDate { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public bool Harvested { get; set; }
public User PlantedBy { get; set; }
[ForeignKey(nameof(PlantedBy))]
public int PlantedById { get; set; }
}
}

View File

@@ -129,6 +129,10 @@ namespace ReallifeGamemode.Database.Entities
public bool FreeSurgery { get; set; } = true; public bool FreeSurgery { get; set; } = true;
public DateTime? LastTimeBoughtCannabisSeeds { get; set; }
public int CannabisSeedsBoughtToday { get; set; }
[NotMapped] [NotMapped]
public Player Player public Player Player
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ReallifeGamemode.Database.Migrations
{
public partial class AddCannabisPlants : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CannabisPlants",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
PlantDate = table.Column<DateTime>(nullable: false),
X = table.Column<float>(nullable: false),
Y = table.Column<float>(nullable: false),
Z = table.Column<float>(nullable: false),
Harvested = table.Column<bool>(nullable: false),
PlantedById = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CannabisPlants", x => x.Id);
table.ForeignKey(
name: "FK_CannabisPlants_Users_PlantedById",
column: x => x.PlantedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CannabisPlants_PlantedById",
table: "CannabisPlants",
column: "PlantedById");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CannabisPlants");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace ReallifeGamemode.Database.Migrations
{
public partial class AddUserCannabisSeedBuyData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CannabisSeedsBoughtToday",
table: "Users",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "LastTimeBoughtCannabisSeeds",
table: "Users",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CannabisSeedsBoughtToday",
table: "Users");
migrationBuilder.DropColumn(
name: "LastTimeBoughtCannabisSeeds",
table: "Users");
}
}
}

View File

@@ -154,6 +154,37 @@ namespace ReallifeGamemode.Database.Migrations
b.ToTable("BusinessData"); b.ToTable("BusinessData");
}); });
modelBuilder.Entity("ReallifeGamemode.Database.Entities.CannabisPlant", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
b.Property<bool>("Harvested")
.HasColumnType("tinyint(1)");
b.Property<DateTime>("PlantDate")
.HasColumnType("datetime(6)");
b.Property<int>("PlantedById")
.HasColumnType("int");
b.Property<float>("X")
.HasColumnType("float");
b.Property<float>("Y")
.HasColumnType("float");
b.Property<float>("Z")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("PlantedById");
b.ToTable("CannabisPlants");
});
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@@ -1425,6 +1456,9 @@ namespace ReallifeGamemode.Database.Migrations
b.Property<int?>("BusinessId") b.Property<int?>("BusinessId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("CannabisSeedsBoughtToday")
.HasColumnType("int");
b.Property<int?>("CharacterId") b.Property<int?>("CharacterId")
.HasColumnType("int"); .HasColumnType("int");
@@ -1474,6 +1508,9 @@ namespace ReallifeGamemode.Database.Migrations
b.Property<int?>("JobId") b.Property<int?>("JobId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<DateTime?>("LastTimeBoughtCannabisSeeds")
.HasColumnType("datetime(6)");
b.Property<int>("LogUserId") b.Property<int>("LogUserId")
.HasColumnType("int"); .HasColumnType("int");
@@ -1931,6 +1968,15 @@ namespace ReallifeGamemode.Database.Migrations
.HasForeignKey("BusRouteId"); .HasForeignKey("BusRouteId");
}); });
modelBuilder.Entity("ReallifeGamemode.Database.Entities.CannabisPlant", b =>
{
b.HasOne("ReallifeGamemode.Database.Entities.User", "PlantedBy")
.WithMany()
.HasForeignKey("PlantedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b =>
{ {
b.HasOne("ReallifeGamemode.Database.Entities.User", "User") b.HasOne("ReallifeGamemode.Database.Entities.User", "User")

View File

@@ -179,6 +179,8 @@ namespace ReallifeGamemode.Database.Models
//Server Variablen //Server Variablen
public DbSet<Entities.ServerVariable> ServerVariables { get; set; } public DbSet<Entities.ServerVariable> ServerVariables { get; set; }
public DbSet<Entities.CannabisPlant> CannabisPlants { get; set; }
} }
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<DatabaseContext> public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<DatabaseContext>

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using ReallifeGamemode.Server.Log;
namespace ReallifeGamemode.Server
{
public abstract class BaseScript : Script
{
protected static ILogger logger { get; private set; }
public BaseScript()
{
logger = LogManager.GetLogger(this.GetType());
}
}
}

View File

@@ -1240,6 +1240,8 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
ChatService.SendMessage(player, $"~b~[AMDIN]~s~ Das Fahrzeug ~y~{serverVehicle.Id}~s~ wurde respawnt");
Vehicle newVeh = serverVehicle.Spawn(veh); Vehicle newVeh = serverVehicle.Spawn(veh);
newVeh.Repair(); newVeh.Repair();
newVeh.Rotation = new Vector3(0, 0, serverVehicle.Heading); newVeh.Rotation = new Vector3(0, 0, serverVehicle.Heading);
@@ -2229,26 +2231,20 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
var invWeight = 0; var invWeight = InventoryManager.GetUserInventoryWeight(target);
using (var context = new DatabaseContext()) IItem item = InventoryManager.GetItemById(itemId);
{
List<UserItem> userItems = context.UserItems.ToList().FindAll(i => i.UserId == target.GetUser().Id);
foreach (var uItem in userItems)
{
invWeight += uItem.Amount * InventoryManager.GetItemById(uItem.ItemId).Gewicht;
}
}
if (invWeight + (amount * InventoryManager.GetItemById(itemId).Gewicht) > 40000) if (invWeight + (amount * item.Gewicht) > InventoryManager.MAX_USER_INVENTORY)
{ {
ChatService.SendMessage(player, "~y~" + target.Name + " ~s~hat nicht mehr genug Platz in seinem Inventar."); ChatService.SendMessage(player, "~y~" + target.Name + " ~s~hat nicht mehr genug Platz in seinem Inventar.");
} }
else else
{ {
UserItem item = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount }; UserItem userItem = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount };
InventoryManager.AddItemToInventory(target, item.ItemId, item.Amount); InventoryManager.AddItemToInventory(target, userItem.ItemId, userItem.Amount);
ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du hast " + target.Name + " ~g~" + amount + "~s~ mal das Item gegeben."); ChatService.SendMessage(player, $"~b~[ADMIN]~s~ Du hast {target.Name} ~y~{amount}~s~x ~y~{item.Name}~s~ gegeben.");
ChatService.SendMessage(target, $"~b~[ADMIN]~s~ {player.Name} hat dir ~y~{amount}~s~x ~y~{item.Name}~s~ gegeben.");
} }
} }
@@ -2338,7 +2334,7 @@ namespace ReallifeGamemode.Server.Commands
} }
[Command("inventory", "~m~Benutzung: ~s~/inventory [Spieler]")] [Command("inventory", "~m~Benutzung: ~s~/inventory [Spieler]")]
public void CmdAdminGiveItem(Player player, string targetname) public void CmdAdminInventory(Player player, string targetname)
{ {
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
{ {
@@ -3396,6 +3392,19 @@ namespace ReallifeGamemode.Server.Commands
ChatService.SendMessage(player, "~b~[ADMIN]~s~ Die Türen wurden erfolgreich neugeladen."); ChatService.SendMessage(player, "~b~[ADMIN]~s~ Die Türen wurden erfolgreich neugeladen.");
} }
[Command("reloadhanf", "~m~Benutzung: ~s~/reloadhanf")]
public void CmdAdminReloadHanf(Player player)
{
if (!player.GetUser().IsAdmin(AdminLevel.HEADADMIN))
{
ChatService.NotAuthorized(player);
return;
}
HanfManager.UpdateHanfWorldData(new DatabaseContext());
ChatService.SendMessage(player, "~b~[ADMIN]~s~ Die Hanfpflanzen wurden erfolgreich neugeladen.");
}
//[Command("house", "~m~Benutzung: ~s~/house [add / remove / price / type / reloadhouses]", GreedyArg = true)] //[Command("house", "~m~Benutzung: ~s~/house [add / remove / price / type / reloadhouses]", GreedyArg = true)]
//public void CmdAdminHouse(Player player, string option1 = null, string option2 = null) //public void CmdAdminHouse(Player player, string option1 = null, string option2 = null)
//{ //{
@@ -3910,7 +3919,18 @@ namespace ReallifeGamemode.Server.Commands
ChatService.BroadcastAdmin("~b~[ADMIN]~s~ " + player.Name + " hat " + target.Name + " den Blackscreen entfernt. ", AdminLevel.ADMIN); ChatService.BroadcastAdmin("~b~[ADMIN]~s~ " + player.Name + " hat " + target.Name + " den Blackscreen entfernt. ", AdminLevel.ADMIN);
} }
} }
/*[Command("washcar", "~m~Benutzung: ~s~/washcar")]
public void washcar(Player player)
{
player.TriggerEvent("washcar");
}
[Command("getdirtlevel", "~m~Benutzung: ~s~/getdirtlevel")]
public void dirtlevel(Player player)
{
player.TriggerEvent("getdirtlevel");
}
*/
[Command("makeadmin", "~m~Benutzung: ~s~/makeadmin [Name] [Adminlevel]")] [Command("makeadmin", "~m~Benutzung: ~s~/makeadmin [Name] [Adminlevel]")]
public void CmdAdminMakeadmin(Player player, string name, int rank) public void CmdAdminMakeadmin(Player player, string name, int rank)
{ {

View File

@@ -237,7 +237,20 @@ namespace ReallifeGamemode.Server.Commands
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)] [Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
public void CmdFactionGiverank(Player player, string name, string rank) public void CmdFactionGiverank(Player player, string name, string rank)
{ {
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false) if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
User user = player.GetUser(dbContext);
if (user == null)
{
return;
}
if (user.FactionId == null || !user.FactionLeader)
{ {
ChatService.NotAuthorized(player); ChatService.NotAuthorized(player);
return; return;
@@ -250,28 +263,32 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId) User targetUser = target.GetUser(dbContext);
if (targetUser == null)
{
ChatService.PlayerNotFound(player);
return;
}
if (targetUser.FactionId != user.FactionId)
{ {
ChatService.ErrorMessage(player, "Dieser Spieler ist nicht in deiner Fraktion"); ChatService.ErrorMessage(player, "Dieser Spieler ist nicht in deiner Fraktion");
return; return;
} }
using (var dbContext = new DatabaseContext()) FactionRank fr = dbContext.FactionRanks.FirstOrDefault(r => r.Order == int.Parse(rank) && r.FactionId == user.FactionId);
if (fr == null)
{ {
FactionRank fr = dbContext.FactionRanks.FirstOrDefault(r => r.Order == int.Parse(rank) && r.FactionId == player.GetUser(dbContext).FactionId); ChatService.ErrorMessage(player, "Dieser Rang existiert nicht");
if (fr == null) return;
{
ChatService.ErrorMessage(player, "Dieser Rang existiert nicht");
return;
}
target.GetUser(dbContext).FactionRankId = fr.Id;
ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " den Rang '" + fr.RankName + "' (" + fr.Order + ") gegeben.");
ChatService.SendMessage(target, "!{02FCFF}Du hast von " + player.Name + " den Rang '" + fr.RankName + "' (" + fr.Order + ")' erhalten.");
dbContext.SaveChanges();
} }
targetUser.FactionRankId = fr.Id;
ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " den Rang '" + fr.RankName + "' (" + fr.Order + ") gegeben.");
ChatService.SendMessage(target, "!{02FCFF}Du hast von " + player.Name + " den Rang '" + fr.RankName + "' (" + fr.Order + ")' erhalten.");
dbContext.SaveChanges();
} }
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)] [Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -29,7 +29,7 @@ namespace ReallifeGamemode.Server.Commands
{ {
if (!player.IsLoggedIn()) return; if (!player.IsLoggedIn()) return;
if (option != "stop") if (option.ToLower() != "stop")
{ {
player.SendChatMessage("Mit \"/rent stop\" kannst du die Miete kündigen"); player.SendChatMessage("Mit \"/rent stop\" kannst du die Miete kündigen");
return; return;
@@ -61,7 +61,7 @@ namespace ReallifeGamemode.Server.Commands
PositionManager.eventportActive = true; PositionManager.eventportActive = true;
player.SendChatMessage("~y~Du hast hier erfolgreich einen Eventport gesetzt."); player.SendChatMessage("~y~Du hast hier erfolgreich einen Eventport gesetzt.");
ChatService.BroadcastAdmin($"~b~[ADMIN]~s~ ~y~{player.Name}~s~ hat einen Eventport erstellt.", AdminLevel.ADMIN); ChatService.BroadcastAdmin($"~y~[EVENTPORT] ~s~{player.Name} hat den Eventport aktiviert.", AdminLevel.ADMIN);
logger.LogInformation("Admin {0} created the eventport at x: {1}, y: {2}, z: {3}", player.Name, position.X, position.Y, position.Z); logger.LogInformation("Admin {0} created the eventport at x: {1}, y: {2}, z: {3}", player.Name, position.X, position.Y, position.Z);
return; return;
} }
@@ -74,14 +74,14 @@ namespace ReallifeGamemode.Server.Commands
} }
PositionManager.eventportActive = false; PositionManager.eventportActive = false;
player.SendChatMessage("~y~Du hast den Eventport deaktiviert."); player.SendChatMessage("~y~Du hast den Eventport deaktiviert.");
ChatService.BroadcastAdmin($"~b~[ADMIN]~s~ ~y~{player.Name}~s~ hat einen Eventport deaktiviert.", AdminLevel.ADMIN); ChatService.BroadcastAdmin($"~y~[EVENTPORT] ~s~{player.Name} hat den Eventport deaktiviert.", AdminLevel.ADMIN);
logger.LogInformation("Admin {0} removed the eventport", player.Name); logger.LogInformation("Admin {0} removed the eventport", player.Name);
return; return;
} }
if (!PositionManager.eventportActive || PositionManager.eventportPosition == null) if (!PositionManager.eventportActive || PositionManager.eventportPosition == null)
{ {
player.SendChatMessage("~y~Im Moment ist kein Eventport aktiv."); ChatService.ErrorMessage(player, "Es ist kein Eventport aktiv");
return; return;
} }
@@ -105,7 +105,7 @@ namespace ReallifeGamemode.Server.Commands
logger.LogInformation("Player {0} used the eventport to x: {1}, y: {2}, z: {3}", player.Name, currentEventport.X, currentEventport.Y, currentEventport.Z); logger.LogInformation("Player {0} used the eventport to x: {1}, y: {2}, z: {3}", player.Name, currentEventport.X, currentEventport.Y, currentEventport.Z);
player.SafeTeleport(teleportPosition); player.SafeTeleport(teleportPosition);
player.SendNotification("Du hast dich zum Event teleportiert"); player.SendChatMessage("~y~[EVENTPORT] ~s~Du hast dich zum Event teleportiert");
} }
[Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)] [Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)]

View File

@@ -83,6 +83,10 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("CLIENT:AddPed", 8, "ig_siemonyetarian", 1222.0868, 2726.5286, 38.00415, 113.77263, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Knast player.TriggerEvent("CLIENT:AddPed", 8, "ig_siemonyetarian", 1222.0868, 2726.5286, 38.00415, 113.77263, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Knast
player.TriggerEvent("CLIENT:AddPed", 9, "ig_siemonyetarian", -215.4218292236328, 6218.90478515625, 31.491567611694336, -135.07437133789062, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Paleto player.TriggerEvent("CLIENT:AddPed", 9, "ig_siemonyetarian", -215.4218292236328, 6218.90478515625, 31.491567611694336, -135.07437133789062, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Paleto
player.TriggerEvent("CLIENT:AddPed", 10, "ig_siemonyetarian", 818.239990234375, -1040.833984375, 26.750696182250977, 3.0542829036712646, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Lamesa player.TriggerEvent("CLIENT:AddPed", 10, "ig_siemonyetarian", 818.239990234375, -1040.833984375, 26.750696182250977, 3.0542829036712646, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Lamesa
NAPI.World.RemoveIpl("dt1_03_shutter"); // ips doors asservatenkammer
NAPI.World.RequestIpl("finbank"); // asservatenkammer (interior)
NAPI.World.RequestIpl("ferris_finale_Anim"); // Riesenrad
NAPI.World.RequestIpl("Carwash_with_spinners"); // Carwash
TimeSpan currentTime = TimeManager.CurrentTime; TimeSpan currentTime = TimeManager.CurrentTime;
bool disableLightMode = currentTime > LightModeTimeFrom && currentTime < LightModeTimeTo; bool disableLightMode = currentTime > LightModeTimeFrom && currentTime < LightModeTimeTo;

View File

@@ -47,6 +47,16 @@ namespace ReallifeGamemode.Server.Events
return; return;
} }
player.ToggleInventory(InventoryToggleOption.HIDE);
if (player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant"))
{
var currentModel = player.GetData<int>("HoldingCannabisPlant");
player.AddAttachment("CannabisPlantInHand" + currentModel, true);
player.ResetData("IsCarryingPlant");
}
using var dbContext = new DatabaseContext(); using var dbContext = new DatabaseContext();
User user = player.GetUser(dbContext); User user = player.GetUser(dbContext);
@@ -233,6 +243,7 @@ namespace ReallifeGamemode.Server.Events
public void RespawnPlayerAtHospital(Player player) public void RespawnPlayerAtHospital(Player player)
{ {
logger.LogInformation("Player {0} respawned at the hospital", player.Name); logger.LogInformation("Player {0} respawned at the hospital", player.Name);
InventoryManager.RemoveIllegalItemsFromInventory(player);
player.SetData("isDead", false); player.SetData("isDead", false);
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{ {

View File

@@ -41,6 +41,14 @@ namespace ReallifeGamemode.Server.Events
return; return;
} }
if (player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant"))
{
var currentModel = player.GetData<int>("HoldingCannabisPlant");
player.AddAttachment("CannabisPlantInHand" + currentModel, true);
player.ResetData("IsCarryingPlant");
}
var logEntry = new LoginLogoutLogEntry() var logEntry = new LoginLogoutLogEntry()
{ {
LoginLogout = false, LoginLogout = false,
@@ -195,11 +203,30 @@ namespace ReallifeGamemode.Server.Events
user.PositionX = pos.X; user.PositionX = pos.X;
user.PositionY = pos.Y; user.PositionY = pos.Y;
user.PositionZ = pos.Z; user.PositionZ = pos.Z;
saveUser.SaveChanges(); saveUser.SaveChanges();
user.Dead = player.HasData("isDead") ? (bool)player.GetData<bool>("isDead") : false; user.Dead = player.HasData("isDead") ? (bool)player.GetData<bool>("isDead") : false;
if (user.Wanteds > 0) if (player.IsInVehicle)
{
GTANetworkAPI.Vehicle vehicle = player.Vehicle;
ServerVehicle sV = vehicle.GetServerVehicle(saveUser);
if (sV is UserVehicle)
{
Vector3 pos1 = vehicle.Position;
sV.PositionX = pos1.X;
sV.PositionY = pos1.Y;
sV.PositionZ = pos1.Z;
sV.Heading = vehicle.Heading;
saveUser.SaveChanges();
}
}
if (user.Wanteds > 0)
{ {
ChatService.HQMessage("Der Straftäter " + user.Name + " ist vom Radar verschwunden"); ChatService.HQMessage("Der Straftäter " + user.Name + " ist vom Radar verschwunden");
} }

View File

@@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal; using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Database.Models;
namespace ReallifeGamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
@@ -22,7 +23,7 @@ namespace ReallifeGamemode.Server.Events
if (vehicle.HasMarkerBehind()) if (vehicle.HasMarkerBehind())
vehicle.RemoveMarkerBehind(); vehicle.RemoveMarkerBehind();
if(vehicle != null && !string.IsNullOrEmpty(client.Name)) if (vehicle != null && !string.IsNullOrEmpty(client.Name))
{ {
if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle)) if (!VehicleManager.lastDriversInVehicle.ContainsKey(vehicle))
{ {
@@ -32,6 +33,21 @@ namespace ReallifeGamemode.Server.Events
VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now; VehicleManager.lastDriversInVehicle[vehicle][client.Name] = DateTime.Now;
} }
using (var dbcontext = new DatabaseContext())
{
User u = client.GetUser(dbcontext);
if ((vehicle.Class != 16 && vehicle.Class != 15) && u.DriverLicenseVehicle == false)
{
client.SendNotification("Du besitzt keinen Führerschein!");
}
else if ((vehicle.Class == 16 && u.FlyingLicensePlane == false) || (vehicle.Class == 15 && u.FlyingLicensePlane == false)) //planes = 16 helicopter = 15
{
client.SendNotification("Du besitzt keinen Flugschein!");
}
}
if (vehicle.GetServerVehicle() is FactionVehicle veh) if (vehicle.GetServerVehicle() is FactionVehicle veh)
{ {
User u = client.GetUser(); User u = client.GetUser();
@@ -52,10 +68,8 @@ namespace ReallifeGamemode.Server.Events
&& vehicle.GetData<bool>("WeaponDealLoad") == true) && vehicle.GetData<bool>("WeaponDealLoad") == true)
{ {
BasePoints basePoints = new BasePoints(); BasePoints basePoints = new BasePoints();
basePoints.getbase(u.FactionId, client); basePoints.getbase(u.FactionId, client);
} }
} }
} }
} }

View File

@@ -31,7 +31,7 @@ namespace ReallifeGamemode.Server.Events
{ {
if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player)) if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player))
{ {
if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH) if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || (VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
{ {
if (WeaponDealManager.checkWeaponDbyVehicle(vehicle)) if (WeaponDealManager.checkWeaponDbyVehicle(vehicle))
return; return;

View File

@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal; using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Database.Models;
namespace ReallifeGamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
@@ -62,6 +63,7 @@ namespace ReallifeGamemode.Server.Events
{ {
client.TriggerEvent("SERVER:setMarkerBehindVehicle", vehicle); client.TriggerEvent("SERVER:setMarkerBehindVehicle", vehicle);
} }
client.TriggerEvent("CheckWaterCrash", vehicle);
} }
if (serverVehicle is SchoolVehicle schoolVehicle) if (serverVehicle is SchoolVehicle schoolVehicle)
{ {
@@ -76,6 +78,24 @@ namespace ReallifeGamemode.Server.Events
CheckPointHandle.DeleteCheckpoints(client); CheckPointHandle.DeleteCheckpoints(client);
} }
} }
using (var dbContext = new DatabaseContext())
{
ServerVehicle sV = vehicle.GetServerVehicle(dbContext);
if (sV is UserVehicle)
{
Vector3 pos = vehicle.Position;
sV.PositionX = pos.X;
sV.PositionY = pos.Y;
sV.PositionZ = pos.Z;
sV.Heading = vehicle.Heading;
dbContext.SaveChanges();
client.TriggerEvent("CheckWaterCrash", vehicle);
}
}
} }
} }
} }

View File

@@ -21,6 +21,9 @@ using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal; using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Log; using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Inventory.Items;
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Server.Wanted;
/** /**
* @overview Life of German Reallife - Event Key (Key.cs) * @overview Life of German Reallife - Event Key (Key.cs)
@@ -216,9 +219,61 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("keyPress:E")] [RemoteEvent("keyPress:E")]
public void KeyPressE(Player player) public void KeyPressE(Player player)
{ {
if (!player.IsLoggedIn() || player.GetData<bool>("isDead") || player.IsInVehicle) return; if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;
var user = player.GetUser(); var user = player.GetUser();
if (player.IsInVehicle
&& player.VehicleSeat == 0
&& player.Vehicle.Model == (uint)VehicleHash.Riot
&& (user.FactionId == 1 || user.FactionId == 3)
&& player.Position.DistanceTo(HanfManager.ASSERVATENKAMMER_POSITION) <= 3
/*&& player.IsDuty()*/)
{
using var dbContext = new DatabaseContext();
GTANetworkAPI.Vehicle veh = player.Vehicle;
ServerVehicle serverVehicle = veh.GetServerVehicle(dbContext);
List<VehicleItem> items = InventoryManager.GetVehicleItems(veh);
if (items.Count() == 0)
{
player.SendNotification("Der Riot ist leer");
return;
}
IIllegalItem cannabisItem = InventoryManager.GetItem<Cannabis>();
IIllegalItem cannabisSeedItem = InventoryManager.GetItem<CannabisSeeds>();
VehicleItem vehicleCannabisItem = items.Where(i => i.ItemId == cannabisItem.Id).FirstOrDefault();
VehicleItem vehicleCannabisSeedItem = items.Where(i => i.ItemId == cannabisSeedItem.Id).FirstOrDefault();
int cannabisAmount = vehicleCannabisItem?.Amount ?? 0;
int cannabisSeedAmount = vehicleCannabisSeedItem?.Amount ?? 0;
InventoryManager.RemoveVehicleItem(serverVehicle, vehicleCannabisItem, cannabisAmount, player);
InventoryManager.RemoveVehicleItem(serverVehicle, vehicleCannabisSeedItem, cannabisSeedAmount, player);
var price = cannabisSeedAmount * cannabisSeedItem.PriceForConfiscation + cannabisAmount * cannabisItem.PriceForConfiscation;
logger.LogInformation("Player {0} unloaded the riot truck with {1} cannabis and {2} cannabis seed and the faction got {3}", player.Name, cannabisAmount, cannabisSeedAmount, price);
var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in factions)
{
faction.BankAccount.Balance += price;
}
player.SendNotification("~g~Der Riot wurde erfolgreich entladen");
dbContext.SaveChanges();
return;
}
if (player.IsInVehicle)
{
return;
}
if (player.HasData("nearATM")) if (player.HasData("nearATM"))
{ {
ATMManager.ShowAtmUi(player, player.GetData<int>("nearATM")); ATMManager.ShowAtmUi(player, player.GetData<int>("nearATM"));
@@ -241,6 +296,10 @@ namespace ReallifeGamemode.Server.Events
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty")); Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
RentcarPoint nearestRentcarPoint = PositionManager.rentcarPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); RentcarPoint nearestRentcarPoint = PositionManager.rentcarPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
JailPoint nearestjailPoint = PositionManager.jailPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
bool isNearCannabisSeedBuyPoint = HanfManager.IsPlayerNearSeedBuyPoint(player);
bool isNearJointManufacturerPoint = HanfManager.IsPlayerNearJointManufacturer(player);
bool isNearCannabisSellPoint = HanfManager.IsPlayerNearCannabisSellPoint(player);
if (user?.FactionId != null) if (user?.FactionId != null)
{ {
@@ -502,6 +561,33 @@ namespace ReallifeGamemode.Server.Events
} }
} }
using var dbcontext = new DatabaseContext();
User client = player.GetUser(dbcontext);
if (nearestjailPoint != null)
{
int oStaatsfrak = NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsDuty() && p.IsLoggedIn() && p.GetUser(dbcontext).FactionId == 1).Count() +
NAPI.Pools.GetAllPlayers().Where(p => !p.IsAfk() && p.IsDuty() && p.IsLoggedIn() && p.GetUser(dbcontext).FactionId == 3).Count();
if (client.Wanteds <= 0)
{
player.SendNotification("~y~[Info]~w~ Du wirst nicht gesucht!");
return;
}
if (oStaatsfrak > 2)
{
player.SendNotification("~y~[Info]~w~ Es sind genügend Beamte im Dienst!");
return;
}
client.SetJailTime(false, dbcontext);
Jail.Check_PutBehindBars(client, JailInLocations.Outside);
player.SendNotification("Du hast dich selbst eingeknastet");
ChatService.HQMessage(player.Name + " wurde ins Gefängnis eingeliefert.");
dbcontext.SaveChanges();
}
//Rentcar Points //Rentcar Points
if (nearestRentcarPoint != null) if (nearestRentcarPoint != null)
{ {
@@ -593,6 +679,43 @@ namespace ReallifeGamemode.Server.Events
} }
} }
if (player.Position.DistanceTo(FarmerJob.POSITION_SCHEUNE) <= 1.5)
{
if (JobManager.GetJob<FarmerJob>().GetUsersInJob().Contains(player))
{
player.TriggerEvent("SERVER:selectField");
return;
}
}
if (player.Position.DistanceTo(FarmerJob.POSITION_FAHRZEUGHALLE) <= 1.5)
{
if (FarmerJob.playersWaitingForVehicle.Contains(player) || true)
{
FarmerJob.spawnVehicle(player);
return;
}
}
if (CharacterCreator.surgeryPoint.DistanceTo(player.Position) <= 1.5)
{
if (user.GetData<bool>("duty"))
{
player.SendNotification("~r~Im Dienst kannst du nicht operiert werden", false);
return;
}
if (JobBase.GetPlayerInJob().Contains(player))
{
player.SendNotification("~r~Im aktiven Job kannst du nicht operiert werden", false);
return;
}
if (user.Wanteds > 0)
{
player.SendNotification("~r~Wenn du gesucht wirst kannst du nicht operiert werden", false);
return;
}
}
//if (CharacterCreator.surgeryPoint.DistanceTo(player.Position) <= 1.5) //if (CharacterCreator.surgeryPoint.DistanceTo(player.Position) <= 1.5)
//{ //{
// if (user.GetData<bool>("duty")) // if (user.GetData<bool>("duty"))
@@ -695,6 +818,53 @@ namespace ReallifeGamemode.Server.Events
return; return;
} }
} }
if (isNearCannabisSeedBuyPoint && user.Faction?.GangOwned == true)
{
HanfManager.ShowPlayerBuySeedMenu(player);
return;
}
if (isNearJointManufacturerPoint && user.Faction?.GangOwned == true)
{
HanfManager.BuildJointsFromCannabis(player);
return;
}
if (isNearCannabisSellPoint && user.Faction?.GangOwned == true)
{
HanfManager.PlayerSellCannabis(player);
return;
}
if (player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant") && (user.FactionId == 3 || user.FactionId == 1) && player.IsDuty())
{
using var dbContext = new DatabaseContext();
FactionVehicle riot = dbContext.FactionVehicles.Where(f => f.Model == VehicleHash.Riot).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault();
if (riot == null)
{
return;
}
GTANetworkAPI.Vehicle riotVehicle = VehicleManager.GetVehicleFromServerVehicle(riot);
if (riotVehicle.Position.DistanceTo(player.Position) > 3)
{
return;
}
var currentModel = player.GetData<int>("HoldingCannabisPlant");
player.AddAttachment("CannabisPlantInHand" + currentModel, true);
player.ResetData("IsCarryingPlant");
var cannabisItem = InventoryManager.GetItem<Cannabis>();
var cannabisSeedsItem = InventoryManager.GetItem<CannabisSeeds>();
int itemIdToGive = currentModel == 3 ? cannabisItem.Id : cannabisSeedsItem.Id;
int amountToGive = currentModel == 3 ? new Random().Next(4, 10) + 1 : 1;
player.SendNotification($"Du hast {(currentModel == 3 ? "das Cannabis" : "die Samen")} in den Riot geladen");
InventoryManager.AddItemToVehicleInventory(riotVehicle, itemIdToGive, amountToGive);
}
} }
[RemoteEvent("keyPress:I")] [RemoteEvent("keyPress:I")]
@@ -703,7 +873,7 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return; if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;
if (player.GetData<bool>("isDead")) return; if (player.GetData<bool>("isDead")) return;
player.TriggerEvent("inventoryShow"); player.ToggleInventory();
InventoryManager.SetBackpackItems(player); InventoryManager.SetBackpackItems(player);
} }
@@ -976,7 +1146,7 @@ namespace ReallifeGamemode.Server.Events
} }
[RemoteEvent("keyPress:Z")] [RemoteEvent("keyPress:Z")]
public void KeyPressX(Player player) public void KeyPressZ(Player player)
{ {
if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return; if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;

View File

@@ -115,6 +115,8 @@ namespace ReallifeGamemode.Server.Events
ChatService.BroadcastGroup(msg, user.Group); ChatService.BroadcastGroup(msg, user.Group);
} }
HanfManager.UpdateHanfForPlayer(player);
string message = string.Empty; string message = string.Empty;
if (GlobalHelper.CustomJoinMessages.ContainsKey(player.SocialClubName)) if (GlobalHelper.CustomJoinMessages.ContainsKey(player.SocialClubName))

View File

@@ -7,6 +7,7 @@ using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using System; using System;
using ReallifeGamemode.Database.Entities.Logs; using ReallifeGamemode.Database.Entities.Logs;
using ReallifeGamemode.Server.Managers;
/** /**
* @overview Life of German Reallife - Event Register (Register.cs) * @overview Life of German Reallife - Event Register (Register.cs)
@@ -29,7 +30,7 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens 6 Zeichen bestehen."); player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens 6 Zeichen bestehen.");
return; return;
} }
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count()!= 0) if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() != 0)
{ {
player.TriggerEvent("SERVER:Login_Error", "Es ist schon ein Konto mit dieser Socialclub-ID registriert."); player.TriggerEvent("SERVER:Login_Error", "Es ist schon ein Konto mit dieser Socialclub-ID registriert.");
return; return;
@@ -79,10 +80,12 @@ namespace ReallifeGamemode.Server.Events
currentPlayerCreatorDimension++; currentPlayerCreatorDimension++;
NAPI.Data.SetWorldData("playerCreatorDimension", currentPlayerCreatorDimension); NAPI.Data.SetWorldData("playerCreatorDimension", currentPlayerCreatorDimension);
player.Dimension = NAPI.Data.GetWorldData("playerCreatorDimension"); player.Dimension = NAPI.Data.GetWorldData("playerCreatorDimension");
player.TriggerEvent("toggleCreator",false); player.TriggerEvent("toggleCreator", false);
player.SafeTeleport(new Vector3(402.8664, -996.4108, -99.00027)); player.SafeTeleport(new Vector3(402.8664, -996.4108, -99.00027));
//player.Position = new Vector3(user.PositionX, user.PositionY, user.PositionZ); //player.Position = new Vector3(user.PositionX, user.PositionY, user.PositionZ);
HanfManager.UpdateHanfForPlayer(player);
if (GlobalHelper.CountdownUntil > DateTime.Now) if (GlobalHelper.CountdownUntil > DateTime.Now)
{ {
player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText); player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText);

View File

@@ -1,17 +1,21 @@
using System; using System;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models; using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Types; using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal; using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Log;
namespace ReallifeGamemode.Server.Events namespace ReallifeGamemode.Server.Events
{ {
public class Vehicle : Script public class Vehicle : Script
{ {
private static readonly ILogger logger = LogManager.GetLogger<Vehicle>();
[RemoteEvent("VehicleMenu_ToggleEngine")] [RemoteEvent("VehicleMenu_ToggleEngine")]
public void VehicleMenuToggleEngineEvent(Player player) public void VehicleMenuToggleEngineEvent(Player player)
{ {
@@ -140,14 +144,9 @@ namespace ReallifeGamemode.Server.Events
{ {
ServerVehicle carlocked = v.GetServerVehicle(dbContext); ServerVehicle carlocked = v.GetServerVehicle(dbContext);
if (state == true) if (carlocked != null)
{ {
carlocked.Locked = true; carlocked.Locked = state;
dbContext.SaveChanges();
}
else
{
carlocked.Locked = false;
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
} }
@@ -208,14 +207,9 @@ namespace ReallifeGamemode.Server.Events
{ {
ServerVehicle carlocked = vehicle.GetServerVehicle(dbContext); ServerVehicle carlocked = vehicle.GetServerVehicle(dbContext);
if (state == true) if (carlocked != null)
{ {
carlocked.Locked = true; carlocked.Locked = state;
dbContext.SaveChanges();
}
else
{
carlocked.Locked = false;
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
} }
@@ -281,6 +275,9 @@ namespace ReallifeGamemode.Server.Events
sV.PositionZ = pos.Z; sV.PositionZ = pos.Z;
sV.Heading = v.Heading; sV.Heading = v.Heading;
logger.LogInformation("Player {0} parked the car {1} at x:{2}, y:{3}, z:{4}", player.Name, sV.Id, pos.X, pos.Y, pos.Z);
player.SendNotification("~g~Das Fahrzeug wurde geparkt."); player.SendNotification("~g~Das Fahrzeug wurde geparkt.");
dbContext.SaveChanges(); dbContext.SaveChanges();

View File

@@ -105,7 +105,7 @@ namespace ReallifeGamemode.Server.Extensions
time *= 2; time *= 2;
} }
int factionMoney = user.Wanteds * 6; int factionMoney = user.Wanteds * 25;
var executiveFactions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3); var executiveFactions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in executiveFactions) foreach (var faction in executiveFactions)
{ {
@@ -477,5 +477,17 @@ namespace ReallifeGamemode.Server.Extensions
if (player.GetUser().Wanteds > 0) if (player.GetUser().Wanteds > 0)
PositionManager.cuffPoints.Add(player); PositionManager.cuffPoints.Add(player);
} }
public static void ToggleInventory(this Player player, InventoryToggleOption option = InventoryToggleOption.TOGGLE)
{
if(option == InventoryToggleOption.TOGGLE)
{
player.TriggerEvent("inventoryShow");
}
else
{
player.TriggerEvent("inventoryShow", option == InventoryToggleOption.SHOW);
}
}
} }
} }

View File

@@ -1,4 +1,4 @@
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -47,16 +47,6 @@ namespace ReallifeGamemode.Server.Extensions
string numberplate = $"{veh.Id}"; string numberplate = $"{veh.Id}";
if (veh is FactionVehicle fV)
{
numberplate = $"F{string.Join(".", fV.GetOwners())} " + numberplate;
}
if (veh is UserVehicle uV)
{
numberplate = $"U{uV.UserId} " + numberplate;
}
if (veh is ShopVehicle sV) if (veh is ShopVehicle sV)
{ {
numberplate = "Shop"; numberplate = "Shop";
@@ -67,24 +57,6 @@ namespace ReallifeGamemode.Server.Extensions
newVeh.SetSharedData("shopVehicleTextLabel", label.Handle.Value); newVeh.SetSharedData("shopVehicleTextLabel", label.Handle.Value);
} }
if (veh is GroupVehicle gV)
{
numberplate = $"G{gV.GroupId} " + numberplate;
}
if (veh is JobVehicle jV)
{
numberplate = $"J{jV.JobId} " + numberplate;
}
if (veh is SchoolVehicle)
{
numberplate = "FS" + numberplate;
}
if (veh is NoobVehicle)
{
numberplate = "NV" + numberplate;
}
NAPI.Vehicle.SetVehicleNumberPlate(newVeh, numberplate); NAPI.Vehicle.SetVehicleNumberPlate(newVeh, numberplate);
veh.NumberPlate = numberplate; veh.NumberPlate = numberplate;

View File

@@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
public static List<MedicTask> HealTasks = new List<MedicTask>(); public static List<MedicTask> HealTasks = new List<MedicTask>();
public static List<MedicTask> FireTasks = new List<MedicTask>(); public static List<MedicTask> FireTasks = new List<MedicTask>();
public static List<HealDecision> HealDecisions = new List<HealDecision>(); public static List<HealDecision> HealDecisions = new List<HealDecision>();
public static int ReviveIncome = 100; public static int ReviveIncome = 50;
public static int dutyMedics = 0; public static int dutyMedics = 0;
public static int reviveTaskTime = 120; public static int reviveTaskTime = 120;

View File

@@ -105,6 +105,24 @@ namespace ReallifeGamemode.Server.Finance
healthInsurance = 0; healthInsurance = 0;
} }
if (healthInsurance > 150)
{
healthInsurance = 150;
}
int gez = (int)((bankAccount + user.Handmoney) * 0.001);
if (gez < 0)
{
gez = 0;
}
if (gez > 150)
{
gez = 150;
}
int? factionMoney = null; int? factionMoney = null;
if (user.Faction != null && user.FactionRank != null) if (user.Faction != null && user.FactionRank != null)
@@ -122,9 +140,9 @@ namespace ReallifeGamemode.Server.Finance
factionMoney = factionWage; factionMoney = factionWage;
} }
int otheramount = user.otheramount; int otheramount = user.otheramount;
int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees - healthInsurance + (factionMoney ?? 0) + otheramount; int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees - healthInsurance - gez + (factionMoney ?? 0) + otheramount;
Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees, healthInsurance, factionMoney, otheramount); Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees, healthInsurance, gez, factionMoney, otheramount);
Paychecks[user.Id] = paycheck; Paychecks[user.Id] = paycheck;
ReleasePayDay(client, paycheck, minusJail); ReleasePayDay(client, paycheck, minusJail);
} }
@@ -173,6 +191,7 @@ namespace ReallifeGamemode.Server.Finance
u.BankAccount.Balance + paycheck.Amount, u.BankAccount.Balance + paycheck.Amount,
paycheck.Wage, paycheck.Wage,
paycheck.FinancialInterest, paycheck.FinancialInterest,
paycheck.gez,
paycheck.otheramount); paycheck.otheramount);
u.BankAccount.Balance += paycheck.Amount; u.BankAccount.Balance += paycheck.Amount;
@@ -185,8 +204,12 @@ namespace ReallifeGamemode.Server.Finance
.ThenInclude(h => h.BankAccount) .ThenInclude(h => h.BankAccount)
.Where(hR => hR.UserId == u.Id); .Where(hR => hR.UserId == u.Id);
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance * 0.1); dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance);
logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance * 0.1, client.Name); logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance, client.Name);
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 9).First().BankAccount.Balance += (int)(paycheck.gez);
logger.LogInformation("NR faction got a gez payment of {0} dollars from player {1}", paycheck.gez, client.Name);
if (rentals.Any()) if (rentals.Any())
{ {
foreach (var rental in rentals) foreach (var rental in rentals)

View File

@@ -28,13 +28,16 @@ namespace ReallifeGamemode.Server.Finance
[JsonProperty("healthInsurance")] [JsonProperty("healthInsurance")]
public int HealthInsurance { get; set; } = 0; public int HealthInsurance { get; set; } = 0;
[JsonProperty("gez")]
public int gez { get; set; } = 0;
[JsonProperty("factionMoney")] [JsonProperty("factionMoney")]
public int? FactionMoney { get; set; } = 0; public int? FactionMoney { get; set; } = 0;
[JsonProperty("otheramount")] [JsonProperty("otheramount")]
public int? otheramount { get; set; } = 0; public int? otheramount { get; set; } = 0;
public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees, int HealthInsurance, int? FactionMoney, int? otheramount) public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees, int HealthInsurance, int gez, int? FactionMoney, int? otheramount)
{ {
this.FinancialHelp = FinancialHelp; this.FinancialHelp = FinancialHelp;
this.FinancialInterest = FinancialInterest; this.FinancialInterest = FinancialInterest;
@@ -44,6 +47,7 @@ namespace ReallifeGamemode.Server.Finance
this.Amount = Amount; this.Amount = Amount;
this.RentalFees = RentalFees; this.RentalFees = RentalFees;
this.HealthInsurance = HealthInsurance; this.HealthInsurance = HealthInsurance;
this.gez = gez;
this.FactionMoney = FactionMoney; this.FactionMoney = FactionMoney;
this.otheramount = otheramount; this.otheramount = otheramount;
} }

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Inventory.Interfaces
{
interface IIllegalItem : IItem
{
int PriceForConfiscation { get; }
}
}

View File

@@ -14,5 +14,7 @@ namespace ReallifeGamemode.Server.Inventory.Interfaces
int Gewicht { get; } int Gewicht { get; }
string Einheit { get; } string Einheit { get; }
int Price { get; } int Price { get; }
bool Legal { get; }
} }
} }

View File

@@ -1,4 +1,6 @@
using ReallifeGamemode.Database.Entities; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
/** /**
* @overview Life of German Reallife - Inventory Interfaces UsableItem (IUsableItem.cs) * @overview Life of German Reallife - Inventory Interfaces UsableItem (IUsableItem.cs)
@@ -10,6 +12,7 @@ namespace ReallifeGamemode.Server.Inventory.Interfaces
{ {
public interface IUsableItem : IItem, IDroppableItem //marker Interface public interface IUsableItem : IItem, IDroppableItem //marker Interface
{ {
bool Use(UserItem uItem); bool RemoveWhenUsed { get; }
bool Use(Player player, User user, DatabaseContext databaseContext);
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -20,10 +21,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override int Price => 50; public override int Price => 50;
public override float Cooldown => 60000; public override float Cooldown => 60000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -32,7 +31,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -21,10 +22,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 60000; public override float Cooldown => 60000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -33,7 +32,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -21,10 +22,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 180000; public override float Cooldown => 180000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -33,7 +32,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast ein ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast ein ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using ReallifeGamemode.Server.Inventory.Interfaces;
namespace ReallifeGamemode.Server.Inventory.Items
{
public abstract class BaseItem : IItem
{
public abstract int Id { get; }
public abstract string Name { get; }
public abstract string Description { get; }
public abstract int Gewicht { get; }
public abstract string Einheit { get; }
public abstract int Price { get; }
public virtual bool Legal => true;
}
}

View File

@@ -1,7 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
@@ -18,7 +20,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 1000; public override float Cooldown => 1000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
//nothing //nothing
} }

View File

@@ -9,13 +9,13 @@ using ReallifeGamemode.Server.Inventory.Interfaces;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Cannabis : ConsumableItem public class Cannabis : DropItem, IIllegalItem
{ {
public override int Id => 108; public override int Id => 108;
public override string Name => "Grünes Gift"; public override string Name => "Cannabis";
public override string Description => "puff puff and pass"; public override string Description => "kein brokkoli";
public override int Gewicht => 2; public override int Gewicht => 2;
@@ -25,13 +25,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override int Price => 0; public override int Price => 0;
public override int HpAmount => -5; public override bool Legal => false;
public override float Cooldown => 20000; public int PriceForConfiscation { get; } = 5;
public override void Consume(UserItem uItem)
{
//nothing
}
} }
} }

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Inventory.Items
{
public class CannabisSeeds : UseItem, IIllegalItem
{
public override int Id { get; } = 109;
public override string Name { get; } = "Cannabis Samen";
public override string Description { get; } = "vierhundertzwanzig lodere es";
public override int Gewicht { get; } = 10;
public override string Einheit { get; } = "g";
public override int Price { get; } = 0;
public override bool Legal => false;
public override uint Object { get; }
public override bool RemoveWhenUsed { get; } = false;
public int PriceForConfiscation { get; } = 10;
public override bool Use(Player player, User user, DatabaseContext databaseContext)
{
if (!player.IsInVehicle)
{
HanfManager.StartCannabisPlanting(player);
}
return true;
}
}
}

View File

@@ -1,5 +1,6 @@
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -23,10 +24,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override int Price => 100; public override int Price => 100;
public override float Cooldown => 120000; public override float Cooldown => 120000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -35,7 +34,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -21,10 +22,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 30000; public override float Cooldown => 30000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -33,7 +32,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -1,4 +1,6 @@
using ReallifeGamemode.Database.Entities; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
/** /**
* @overview Life of German Reallife - Inventory Items Chickenburger (Chickenburger.cs) * @overview Life of German Reallife - Inventory Items Chickenburger (Chickenburger.cs)
@@ -21,7 +23,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 20000; public override float Cooldown => 20000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
//nothing //nothing
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -8,38 +9,38 @@ using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class ConsumableItem : IUsableItem public abstract class ConsumableItem : UseItem
{ {
public abstract int HpAmount { get; } public abstract int HpAmount { get; }
public abstract int Id { get; } public override int Id { get; }
public abstract string Name { get; } public override string Name { get; }
public abstract string Description { get; } public override string Description { get; }
public abstract int Gewicht { get; } public override int Gewicht { get; }
public abstract string Einheit { get; } public override string Einheit { get; }
public abstract uint Object { get; } public override int Price { get; }
public abstract int Price { get; }
public abstract float Cooldown { get; } public abstract float Cooldown { get; }
public abstract override uint Object { get; }
public override bool RemoveWhenUsed => true;
public abstract void Consume(UserItem uItem); public abstract void Consume(Player player, User user, DatabaseContext databaseContext);
public bool Use(UserItem uItem) public override bool Use(Player player, User user, DatabaseContext databaseContext)
{ {
User user = uItem.GetUser();
if (user.Player == null || !user.Player.IsLoggedIn()) if (user.Player == null || !user.Player.IsLoggedIn())
return false; return false;
if (!HasCooldownElapsed(user)) if (!HasCooldownElapsed(user) && Cooldown > 0)
{ {
DateTime time = InventoryManager.itemCooldown[user.Id]; DateTime time = InventoryManager.itemCooldown[user.Id];
int timeUntillNextUse = (int)(time - DateTime.Now).TotalSeconds; int timeUntillNextUse = (int)(time - DateTime.Now).TotalSeconds;
uItem.GetUser().Player.TriggerEvent("Error", $"Versuche es nach {timeUntillNextUse} Sekunden erneut."); user.Player.TriggerEvent("Error", $"Versuche es nach {timeUntillNextUse} Sekunden erneut.");
return false; return false;
} }
DateTime cooldown = DateTime.Now.AddMilliseconds(Cooldown); DateTime cooldown = DateTime.Now.AddMilliseconds(Cooldown);
InventoryManager.itemCooldown.Add(user.Id, cooldown); InventoryManager.itemCooldown.Add(user.Id, cooldown);
Consume(uItem); Consume(player, user, databaseContext);
return true; return true;
} }

View File

@@ -6,15 +6,15 @@ using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class DropItem : IDroppableItem public abstract class DropItem : BaseItem, IDroppableItem
{ {
public abstract int Id { get; } public override int Id { get; }
public abstract string Name { get; } public override string Name { get; }
public abstract string Description { get; } public override string Description { get; }
public abstract int Gewicht { get; } public override int Gewicht { get; }
public abstract string Einheit { get; } public override string Einheit { get; }
public abstract uint Object { get; } public abstract uint Object { get; }
public abstract int Price { get; } public override int Price { get; }
public void Drop(UserItem uItem, Player player, int amount) public void Drop(UserItem uItem, Player player, int amount)
{ {

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Inventory.Items
{
public class Joint : UseItem, IIllegalItem
{
private static Dictionary<int, DateTime> lastJointUse = new Dictionary<int, DateTime>();
private static readonly TimeSpan _jointCooldown = TimeSpan.FromMinutes(10);
public override int Id { get; } = 110;
public override string Name { get; } = "Joint";
public override string Description { get; } = "stay high bis zum tod";
public override int Gewicht { get; } = 20;
public override string Einheit { get; } = "g";
public override int Price { get; } = 0;
public override uint Object { get; }
public override bool Legal => false;
public override bool RemoveWhenUsed => true;
public int PriceForConfiscation { get; } = 25;
public override bool Use(Player player, User user, DatabaseContext databaseContext)
{
if (!CanUserUseJoint(user))
{
player.TriggerEvent("Error", $"Versuche es nach {-1 * (int)((DateTime.Now - lastJointUse[user.Id]) - _jointCooldown).TotalSeconds} Sekunden erneut.");
return false;
}
player.SyncAnimation("jointUse");
player.ToggleInventory(InventoryToggleOption.HIDE);
int armorToSet = Math.Min(player.Armor + 25, 100);
player.SafeSetArmor(armorToSet);
lastJointUse[user.Id] = DateTime.Now;
return true;
}
private bool CanUserUseJoint(User user)
{
if(!lastJointUse.ContainsKey(user.Id))
{
return true;
}
return DateTime.Now - lastJointUse[user.Id] > _jointCooldown;
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using GTANetworkAPI; using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
@@ -21,10 +22,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override float Cooldown => 300000; public override float Cooldown => 300000;
public override void Consume(UserItem uItem) public override void Consume(Player player, User user, DatabaseContext databaseContext)
{ {
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount; int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100) if (player.Health + amountToAdd > 100)
{ {
@@ -33,7 +32,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
player.SafeSetHealth(player.Health + amountToAdd); player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast ein ~y~" + Name + " ~s~gegessen.", false); player.SendNotification("Du hast ein ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
} }
} }
} }

View File

@@ -0,0 +1,69 @@
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using System.Linq;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.WeaponDeal;
namespace ReallifeGamemode.Server.Inventory.Items
{
class Notfallkit : UseItem
{
public override int Id => 201;
public override string Name => "Notfallkit";
public override string Description => "Fahrzeug reparieren";
public override int Gewicht => 5000;
public override string Einheit => "g";
public override uint Object => 875075437;
public override int Price => 2500;
public override bool RemoveWhenUsed { get; } = true;
public override bool Use(Player player, User user, DatabaseContext databaseContext)
{
Vehicle veh = null;
var nearestVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault();
veh = nearestVeh;
if (veh == null)
{
player.SendNotification("Es befindet sich kein Fahrzeug in deiner Nähe!");
return false;
}
if (player.IsInVehicle)
{
player.SendNotification("Du musst aus deinem Fahrzeug aussteigen!");
return false;
}
if (veh.Controller == null)
{
player.SendNotification("Du kannst dieses Fahrzeug nicht reparieren, weil Jemand bereits im Fahrzeug sitzt");
return false;
}
if ((VehicleHash)veh.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || (VehicleHash)veh.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
{
player.SendNotification("Du kannst den Waffentransporter nicht reparieren!");
return false;
}
using (var dbContext = new DatabaseContext())
{
Vector3 position = veh.Position;
float heading = veh.Heading;
player.SendNotification("Du hast ~g~" + Name + " ~s~verwendet", false);
ServerVehicle serverVehicle = veh.GetServerVehicle(dbContext);
Vehicle newVeh = serverVehicle.Spawn(veh);
newVeh.Repair();
newVeh.Position = position;
newVeh.Rotation = new Vector3(0, 0, heading);
return true;
}
}
}
}

View File

@@ -1,4 +1,14 @@
namespace ReallifeGamemode.Server.Inventory.Items using System;
using System.Security.Cryptography;
using GTANetworkAPI;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Rubellos : UseItem public class Rubellos : UseItem
{ {
@@ -9,5 +19,24 @@
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 875075437; public override uint Object => 875075437;
public override int Price => 500; public override int Price => 500;
public override bool RemoveWhenUsed => true;
public override bool Use(Player player, User user, DatabaseContext databaseContext)
{
Random random = new Random();
int randomNumber = random.Next(1, 4);
if (randomNumber == 1)
{
user.Handmoney += 1000;
//player.TriggerEvent("SERVER:SET_HANDMONEY", winner.Handmoney);
player.SendNotification("Glückwunsch du hast ~g~$~w~1000 gewonnen!");
}
else
{
player.SendNotification("Leider kein Gewinn, viel Glück beim nächsten mal.");
}
player.SendNotification("Du hast ein ~g~" + Name + " ~s~verwendet.", false);
return true;
}
} }
} }

View File

@@ -10,44 +10,17 @@ using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class UseItem : IUsableItem public abstract class UseItem : BaseItem, IUsableItem
{ {
public abstract int Id { get; } public override int Id { get; }
public abstract string Name { get; } public override string Name { get; }
public abstract string Description { get; } public override string Description { get; }
public abstract int Gewicht { get; } public override int Gewicht { get; }
public abstract string Einheit { get; } public override string Einheit { get; }
public override int Price { get; }
public abstract uint Object { get; } public abstract uint Object { get; }
public abstract int Price { get; } public abstract bool RemoveWhenUsed { get; }
public bool Use(UserItem uItem) public abstract bool Use(Player player, User user, DatabaseContext databaseContext);
{
Player player = uItem.GetUser().Player;
if (uItem.ItemId != 200)
{
return false;
}
Random random = new Random();
int randomNumber = random.Next(1, 5);
if (randomNumber == 1)
{
using (var dbContext = new DatabaseContext())
{
User winner = player.GetUser(dbContext);
winner.Handmoney += 1000;
player.TriggerEvent("SERVER:SET_HANDMONEY", winner.Handmoney);
dbContext.SaveChanges();
}
Services.ChatService.SendMessage(player, "Glückwunsch, du hast $1000 gewonnen!");
}
else
{
Services.ChatService.SendMessage(player, "Leider kein Gewinn, viel Glück beim nächsten mal");
}
player.SendNotification("Du hast ~g~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~verwendet.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
return true;
}
} }
} }

View File

@@ -6,15 +6,15 @@ using ReallifeGamemode.Server.WeaponDeal;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class WeaponDealItem : IWeaponDealItem public abstract class WeaponDealItem : BaseItem, IWeaponDealItem
{ {
public abstract int Id { get; } public override int Id { get; }
public abstract string Name { get; } public override string Name { get; }
public abstract string Description { get; } public override string Description { get; }
public abstract int Gewicht { get; } public override int Gewicht { get; }
public abstract string Einheit { get; } public override string Einheit { get; }
public override int Price { get; }
public abstract uint Object { get; } public abstract uint Object { get; }
public abstract int Price { get; }
public bool noTransfer(Player client, UserItem uItem, FactionVehicle fVeh) public bool noTransfer(Player client, UserItem uItem, FactionVehicle fVeh)
{ {

View File

@@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Job
{
public class FarmerJob : JobBase
{
public override int Id => 5;
public override string Name => "Farmer";
public override bool NeedVehicleToStart => false;
public override bool Deactivated => true;
private static FarmerJob _Instance;
public static Vector3 POSITION_JOB_START = new Vector3(2434.2983, 4976.952, 46.571423);
public static Vector3 POSITION_SCHEUNE = new Vector3(2416.3723, 4993.94, 45);
public static Vector3 POSITION_SCHEUNE_LABEL = new Vector3(2416.3723, 4993.94, 46);
public static Vector3 POSITION_FAHRZEUGHALLE = new Vector3(2494.346, 4964.773, 43.5833);
public static Vector3 POSITION_FAHRZEUGHALLE_LABEL = new Vector3(2494.346, 4964.773, 44.5833);
private static TextLabel labelScheune = null;
private static TextLabel labelFahrzeughalle = null;
public static List<Player> playersWaitingForVehicle = new List<Player>();
public static Dictionary<Player, String> playerHasField = new Dictionary<Player, String>();
private static readonly Dictionary<Vector3, float> VEHICLE_SPAWNS = new Dictionary<Vector3, float>
{
{ new Vector3(2500.026, 4982.7485, 44.50283), (float)-148.8139 },
{ new Vector3(2511.2246, 4981.6924, 44.722702), (float)139.25208 },
{ new Vector3(2518.3486, 4977.3125, 44.716434), (float)131.3338 },
{ new Vector3(2522.8215, 4966.823, 44.53701), (float)118.17867 }
};
private static int spawnIndex = 0;
public static readonly List<Vector3> CHECKPOINTS_FIELD1 = new List<Vector3>()
{
new Vector3(2335.83984375, 5114.8525390625, 47.83000183105469),
new Vector3(2295.81201171875, 5153.26123046875, 54.64070129394531),
new Vector3(2277.558837890625, 5139.4453125, 53.3763542175293),
new Vector3(2318.217041015625, 5099.271484375, 46.98373031616211),
new Vector3(2283.467041015625, 5066.1025390625, 45.97780227661133),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3(),
new Vector3()
};
public FarmerJob()
{
JobStart += FarmerDriverJobJobStart;
JobStop += FarmerDriverJobJobStop;
}
public static FarmerJob GetInstance()
{
if (_Instance == null)
_Instance = new FarmerJob();
return _Instance;
}
private void FarmerDriverJobJobStart(Player player)
{
labelScheune = NAPI.TextLabel.CreateTextLabel("Scheune - Drücke ~y~E ~w~um ein Feld auszuwählen", POSITION_SCHEUNE_LABEL, 15, 1, 0, new Color(255, 255, 255), false, 0);
player.SendChatMessage("~y~[JOB]~w~ Begebe dich zur Scheune um Felder zu pachten");
player.TriggerEvent("farmerSetCheckpoint", POSITION_SCHEUNE, 1, 1, "scheune");
}
private void FarmerDriverJobJobStop(Player player)
{
player.SendChatMessage("Job stop");
}
[RemoteEvent("CLIENT:StartFieldSelected")]
public void startFieldSelected(Player player, String field)
{
labelScheune.Delete();
labelFahrzeughalle = NAPI.TextLabel.CreateTextLabel("Fahrzeughalle - Drücke ~y~E ~w~um dir ein Fahrzeug zu holen", POSITION_FAHRZEUGHALLE_LABEL, 15, 1, 0, new Color(255, 255, 255), false, 0);
player.SendChatMessage("~y~[JOB]~w~ Begebe dich zur nun zur Fahrzeughalle um dein Fahrzeug abzuholen");
player.TriggerEvent("farmerSetCheckpoint", POSITION_FAHRZEUGHALLE, 1, 1, "fahrzeughalle");
playersWaitingForVehicle.Add(player);
playerHasField.Add(player, field);
}
public static void spawnVehicle(Player player)
{
if (!playerHasField.ContainsKey(player))
playerHasField.Add(player, "Landwirt (4)");
player.SendChatMessage("player " + player.Name + " with field " + playerHasField[player]);
//NEXT: verschiedene spawnpositionen für fahrzeuge in VEHICLE_SPAWNS
//Vector3 spawnPoint = VEHICLE_SPAWNS[spawnIndex++ % VEHICLE_SPAWNS.Count];
Random rnd = new Random();
spawnIndex = rnd.Next(VEHICLE_SPAWNS.Count);
Vector3 spawnPoint = VEHICLE_SPAWNS.ElementAt(spawnIndex).Key;
float vehicleHeading = VEHICLE_SPAWNS[spawnPoint];
Vehicle vehicle = null;
if (playerHasField[player] == "Knecht (1)")
{
vehicle = NAPI.Vehicle.CreateVehicle(0x61D6BA8C, spawnPoint, vehicleHeading, 111, 111, "JOB");
} else if (playerHasField[player] == "Hilfsarbeiter (2)")
{
vehicle = NAPI.Vehicle.CreateVehicle(0x61D6BA8C, spawnPoint, vehicleHeading, 111, 111, "JOB");
}
else if (playerHasField[player] == "Ackersmann (3)")
{
vehicle = NAPI.Vehicle.CreateVehicle(0x843B73DE, spawnPoint, vehicleHeading, 111, 111, "JOB");
}
else if (playerHasField[player] == "Landwirt (4)")
{
vehicle = NAPI.Vehicle.CreateVehicle(0x843B73DE, spawnPoint, vehicleHeading, 111, 111, "JOB");
}
else if (playerHasField[player] == "Ökonom(5)")
{
vehicle = NAPI.Vehicle.CreateVehicle(0x843B73DE, spawnPoint, vehicleHeading, 111, 111, "JOB");
}
vehicle.NumberPlate = "JOB-" + vehicle.Id;
_CHANGING_VEHICLE.Add(player);
if (playerVehiclePair.ContainsKey(player))
{
Vehicle previousVehicle = null;
if (playerVehiclePair[player] != null)
previousVehicle = playerVehiclePair[player];
playerVehiclePair.Remove(player);
previousVehicle?.Delete();
}
playerVehiclePair.Add(player, vehicle);
player.SetIntoVehicle(vehicle.Handle, 0);
}
public override void LastCheckpoint(Player player)
{
//nothing
}
public override void StartJobEndTimer(Player player)
{
//nothing
}
public override bool CheckVehicle(Player player, Vehicle vehicle)
{
//nothig, kack jobsystem
return false;
}
}
}

View File

@@ -29,212 +29,213 @@ using System.IO;
namespace ReallifeGamemode.Server namespace ReallifeGamemode.Server
{ {
public class Main : Script public class Main : Script
{
public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-1033.93603515625, -2731.572998046875, 13.756634712219238);
public static readonly float DEFAULT_SPAWN_HEADING = -32.23991012573242f;
public static readonly CultureInfo SERVER_CULTURE = new CultureInfo("de-DE");
private Core.Events.EventHandler eventHandler;
private readonly Mutex logMutex = new Mutex(false, "RAGE_MAIN_LOG_MUTEX");
public Main()
{ {
public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-1033.93603515625, -2731.572998046875, 13.756634712219238); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
public static readonly float DEFAULT_SPAWN_HEADING = -32.23991012573242f; }
public static readonly CultureInfo SERVER_CULTURE = new CultureInfo("de-DE"); [ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
private Core.Events.EventHandler eventHandler; {
try
private readonly Mutex logMutex = new Mutex(false, "RAGE_MAIN_LOG_MUTEX"); {
if (System.Environment.GetEnvironmentVariable("RAGEMP_UPDATE_DATABASE_ON_STARTUP", System.EnvironmentVariableTarget.User) == "true")
public Main()
{ {
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; using var dbContext = new DatabaseContext(true);
}
var pendingMigrations = dbContext.Database.GetPendingMigrations();
if (!pendingMigrations.Any())
{
System.Console.WriteLine("No migrations to apply");
}
else
{
System.Console.WriteLine("Applying {0} migrations", pendingMigrations.Count());
foreach (var migration in pendingMigrations)
{
System.Console.WriteLine("\t{0}", migration);
}
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
try try
{ {
if (System.Environment.GetEnvironmentVariable("RAGEMP_UPDATE_DATABASE_ON_STARTUP", System.EnvironmentVariableTarget.User) == "true") dbContext.Database.Migrate();
{
using var dbContext = new DatabaseContext(true);
var pendingMigrations = dbContext.Database.GetPendingMigrations();
if (!pendingMigrations.Any())
{
System.Console.WriteLine("No migrations to apply");
}
else
{
System.Console.WriteLine("Applying {0} migrations", pendingMigrations.Count());
foreach (var migration in pendingMigrations)
{
System.Console.WriteLine("\t{0}", migration);
}
try
{
dbContext.Database.Migrate();
}
catch (System.Exception e)
{
System.Console.WriteLine("Error while updating database: {0}", e.ToString());
System.Console.ReadLine();
System.Environment.Exit(1);
}
System.Console.WriteLine("Migrations successfull");
}
}
var methods = Assembly.GetExecutingAssembly()
.GetTypes()
.SelectMany(t => t.GetMethods())
.Where(m => m.GetCustomAttributes(typeof(CommandAttribute), false).Length > 0)
.ToArray();
var cmdAttributes = methods.Select(c => c.GetCustomAttribute<CommandAttribute>()).ToList();
var registeredCommands = cmdAttributes.Select(c => c.CommandString).ToList();
cmdAttributes.Where(c => c.Alias?.Any() ?? false).ToList().ForEach(a =>
{
registeredCommands.AddRange(a.Alias.Split(','));
});
IAPI apiInstance = new RageAPI();
eventHandler = new Core.Events.EventHandler(apiInstance);
new Core.Main(apiInstance, eventHandler, registeredCommands.ToArray());
NAPI.Server.SetGlobalServerChat(false);
NAPI.Server.SetCommandErrorMessage("");
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
NAPI.Server.SetAutoSpawnOnConnect(false);
NAPI.Server.SetAutoRespawnAfterDeath(false);
NAPI.Data.SetWorldData("playerCreatorDimension", 0);
JsonConvert.DefaultSettings = () =>
{
return new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
};
};
InventoryManager.LoadItems();
ShopManager.LoadClotheShops();
ShopManager.LoadItemShops();
ShopManager.LoadFriseur();
ShopManager.LoadAmmunations();
TuningManager.LoadTuningGarages();
TimeManager.StartTimeManager();
VehicleManager.CheckEnabledMods();
DatabaseHelper.InitDatabaseFirstTime();
FactionHelper.CheckFactionBankAccounts();
BusinessManager.LoadBusinesses();
//InteriorManager.LoadInteriors();
DoorManager.LoadDoors();
ATMManager.InitATMs();
CityHallManager.LoadCityHall();
JobManager.LoadJobs();
//TaxiDriverJob.StartTaxiTimer(); Obselete
//HouseManager.LoadHouses();
DrivingSchool.DrivingSchool.Setup();
PlaneSchool.Setup();
Gangwar.Gangwar.loadTurfs();
Bank.Bank.Setup();
Introduction.Setup();
PositionManager.LoadPositionManager();
LoadManager.LoadLoadManager();
Rentcar.Setup();
World.WeatherSync.Load();
TempBlip tempBlip = new TempBlip()
{
Color = 1,
Name = "",
Transparency = 0,
ShortRange = true,
Sprite = 1,
Scale = 1,
};
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
//WantedEscapeTimer.WantedTimer(); Obselete
//Jail.JailTimer(); Obselete
//Economy.PaydayTimer(); Obselete
// WeaponDealManager.WeaponDealTimer(); Obselete
ThreadTimers.StartAllTimers();
Managers.SVarManager.LoadSVars();
UserBankAccount.BalanceChanged += (account) =>
{
using (var dbContext = new DatabaseContext())
{
var user = dbContext.Users.Where(u => u.BankAccountId == account.Id).Select(u => u.Name).FirstOrDefault();
if (user == null)
{
return;
}
Player player = PlayerService.GetPlayerByNameOrId(user);
if (player == null)
{
return;
}
player.TriggerEvent("updateMoney", account.Balance);
}
};
User.HandMoneyChanged += (user) =>
{
user.Player.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
};
//IPLS
NAPI.World.RequestIpl("vw_casino_garage");
} }
catch (Exception e) catch (System.Exception e)
{ {
Log(e.ToString()); System.Console.WriteLine("Error while updating database: {0}", e.ToString());
System.Console.ReadLine();
System.Environment.Exit(1);
} }
System.Console.WriteLine("Migrations successfull");
}
} }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) var methods = Assembly.GetExecutingAssembly()
.GetTypes()
.SelectMany(t => t.GetMethods())
.Where(m => m.GetCustomAttributes(typeof(CommandAttribute), false).Length > 0)
.ToArray();
var cmdAttributes = methods.Select(c => c.GetCustomAttribute<CommandAttribute>()).ToList();
var registeredCommands = cmdAttributes.Select(c => c.CommandString).ToList();
cmdAttributes.Where(c => c.Alias?.Any() ?? false).ToList().ForEach(a =>
{ {
Log(e.ExceptionObject.ToString()); registeredCommands.AddRange(a.Alias.Split(','));
} });
private void Log(string message) IAPI apiInstance = new RageAPI();
eventHandler = new Core.Events.EventHandler(apiInstance);
new Core.Main(apiInstance, eventHandler, registeredCommands.ToArray());
NAPI.Server.SetGlobalServerChat(false);
NAPI.Server.SetCommandErrorMessage("");
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
NAPI.Server.SetAutoSpawnOnConnect(false);
NAPI.Server.SetAutoRespawnAfterDeath(false);
NAPI.Data.SetWorldData("playerCreatorDimension", 0);
JsonConvert.DefaultSettings = () =>
{ {
string basePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); return new JsonSerializerSettings()
string log = Path.Combine(basePath, "log.txt"); {
NullValueHandling = NullValueHandling.Ignore
};
};
logMutex.WaitOne(); InventoryManager.LoadItems();
ShopManager.LoadClotheShops();
ShopManager.LoadItemShops();
ShopManager.LoadFriseur();
ShopManager.LoadAmmunations();
TuningManager.LoadTuningGarages();
if (!File.Exists(log)) TimeManager.StartTimeManager();
VehicleManager.CheckEnabledMods();
DatabaseHelper.InitDatabaseFirstTime();
FactionHelper.CheckFactionBankAccounts();
BusinessManager.LoadBusinesses();
//InteriorManager.LoadInteriors();
DoorManager.LoadDoors();
ATMManager.InitATMs();
CityHallManager.LoadCityHall();
JobManager.LoadJobs();
//TaxiDriverJob.StartTaxiTimer(); Obselete
//HouseManager.LoadHouses();
DrivingSchool.DrivingSchool.Setup();
PlaneSchool.Setup();
Gangwar.Gangwar.loadTurfs();
Bank.Bank.Setup();
Introduction.Setup();
PositionManager.LoadPositionManager();
LoadManager.LoadLoadManager();
Rentcar.Setup();
HanfManager.Load();
World.WeatherSync.Load();
TempBlip tempBlip = new TempBlip()
{
Color = 1,
Name = "",
Transparency = 0,
ShortRange = true,
Sprite = 1,
Scale = 1,
};
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
//WantedEscapeTimer.WantedTimer(); Obselete
//Jail.JailTimer(); Obselete
//Economy.PaydayTimer(); Obselete
// WeaponDealManager.WeaponDealTimer(); Obselete
ThreadTimers.StartAllTimers();
Managers.SVarManager.LoadSVars();
UserBankAccount.BalanceChanged += (account) =>
{
using (var dbContext = new DatabaseContext())
{
var user = dbContext.Users.Where(u => u.BankAccountId == account.Id).Select(u => u.Name).FirstOrDefault();
if (user == null)
{ {
File.Create(log); return;
} }
string msg = $"[{DateTime.Now:s}] - Error: {message}{Environment.NewLine}"; Player player = PlayerService.GetPlayerByNameOrId(user);
if (player == null)
{
return;
}
File.AppendAllText(log, msg); player.TriggerEvent("updateMoney", account.Balance);
}
};
logMutex.ReleaseMutex(); User.HandMoneyChanged += (user) =>
}
[RemoteEvent("CLIENT:Event")]
public void OnClientEvent(Player player, string dataStr)
{ {
var data = dataStr.DeserializeJson<List<object>>(); user.Player.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
eventHandler.HandleEvent(new RagePlayer(player), data); };
}
//IPLS
NAPI.World.RequestIpl("vw_casino_garage");
}
catch (Exception e)
{
Log(e.ToString());
}
} }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log(e.ExceptionObject.ToString());
}
private void Log(string message)
{
string basePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string log = Path.Combine(basePath, "log.txt");
logMutex.WaitOne();
if (!File.Exists(log))
{
File.Create(log);
}
string msg = $"[{DateTime.Now:s}] - Error: {message}{Environment.NewLine}";
File.AppendAllText(log, msg);
logMutex.ReleaseMutex();
}
[RemoteEvent("CLIENT:Event")]
public void OnClientEvent(Player player, string dataStr)
{
var data = dataStr.DeserializeJson<List<object>>();
eventHandler.HandleEvent(new RagePlayer(player), data);
}
}
} }

View File

@@ -0,0 +1,610 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using GTANetworkAPI;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Inventory.Items;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Managers
{
public class HanfManager : BaseScript
{
/// <summary>
/// Punkte zum Samen kaufen
/// </summary>
private readonly static List<Vector3> _seedsBuyPoints = new List<Vector3>();
private readonly static List<Vector3> _cannabisSellPoints = new List<Vector3>();
/// <summary>
/// Aktueller Samen-Preis
/// </summary>
public static int SEED_PRICE = 0;
private const int SEED_PRICE_MIN = 40;
private const int SEED_PRICE_MAX = 75;
/// <summary>
/// Aktueller Hanf-Verkaufspreis
/// </summary>
public static int CANNABIS_PRICE = 0;
private const int CANNABIS_PRICE_MIN = 50;
private const int CANNABIS_PRICE_MAX = 125;
/// <summary>
/// Wie viele Samen ein Spieler pro Tag maximal kaufen darf
/// </summary>
private const int MAX_SEEDS_PER_DAY = 50;
/// <summary>
/// Wie viel Cannabis man für einen Joint braucht
/// </summary>
private const int CANNABIS_NEEDED_FOR_JOINT = 10;
/// <summary>
/// Flag, ob der Verarbeiter aktuell benutzt wird
/// </summary>
private static bool _manufacturerCurrentlyUsed = false;
/// <summary>
/// Marihuana -> Joint
/// </summary>
private readonly static Vector3 _jointManufacturerPoint = new Vector3(-127.726105, 1921.5142, 197.31104);
/// <summary>
/// Animations-ID des Verarbeitens
/// </summary>
private const string _manufacturerAnim = "manufacturJoint";
/// <summary>
/// Data-Key, ob der Spieler grade eine Pflanze anpflanzt
/// </summary>
private const string PLAYER_CURRENTLY_PLANTING_DATA_KEY = "isPlantingCannabis";
/// <summary>
/// Ab welcher Zeit Pflanzen verwelken
/// </summary>
private static readonly TimeSpan MAX_PLANT_TIME = TimeSpan.FromHours(6);
private static readonly TimeSpan MIN_PLANT_TIME_TO_HARVEST = TimeSpan.FromHours(4);
/// <summary>
/// Timer der den Status des Verarbeiters zurücksetzt
/// </summary>
private static Timer _manufacturerDoneTimer = new Timer(TimeSpan.FromSeconds(10).TotalMilliseconds);
/// <summary>
/// Zufallsgenerator für weibliche Pflanze und erhaltenes Cannabis
/// </summary>
private static Random _random = new Random();
private static List<CannabisData> _currentCannabisData = new List<CannabisData>();
public static readonly Vector3 ASSERVATENKAMMER_POSITION = new Vector3(-5.45, -670.03, 32.33);
static HanfManager()
{
_manufacturerDoneTimer.Elapsed += ManufacturerDoneTimerCallback;
}
/// <summary>
/// Ladefunktion zum
/// </summary>
public static void Load()
{
var priceRandom = new Random();
SEED_PRICE = priceRandom.Next(SEED_PRICE_MIN, SEED_PRICE_MAX + 1);
CANNABIS_PRICE = priceRandom.Next(CANNABIS_PRICE_MIN, CANNABIS_PRICE_MAX + 1);
logger.LogInformation("Generated hanf prices: seed = {0}, cannabis = {1}", SEED_PRICE, CANNABIS_PRICE);
_seedsBuyPoints.Add(new Vector3(-30.21876, -585.3222, 17.917326));
_seedsBuyPoints.Add(new Vector3(-680.89386, -634.6783, 25.29923));
_seedsBuyPoints.Add(new Vector3(-1310.743, -608.9064, 29.382874));
_seedsBuyPoints.Add(new Vector3(-758.6156, -1595.2686, 6.302392));
_seedsBuyPoints.Add(new Vector3(-441.0504, 1595.4435, 358.4195));
ColShape colShape = null;
foreach (Vector3 buyPoint in _seedsBuyPoints)
{
colShape = NAPI.ColShape.CreateSphereColShape(buyPoint, 10.0f);
colShape.OnEntityEnterColShape += OnSeedBuyRangeColShapeEnter;
}
_cannabisSellPoints.Add(new Vector3(2220.04, 5614.24, 54.72));
_cannabisSellPoints.Add(new Vector3(201.77, 2442.06, 60.45));
_cannabisSellPoints.Add(new Vector3(155.87, -3103.26, 7.03));
foreach (Vector3 sellPoint in _cannabisSellPoints)
{
colShape = NAPI.ColShape.CreateSphereColShape(sellPoint, 10.0f);
colShape.OnEntityEnterColShape += OnCannabisSellRangeColShapeEnter;
}
NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White);
NAPI.TextLabel.CreateTextLabel("Asservatenkammer~n~Drücke ~y~E, um den ~y~Riot~s~ zu entladen", ASSERVATENKAMMER_POSITION, 10.0f, 10.0f, 0, Colors.White);
using var dbContext = new DatabaseContext();
HarvestRottenPlants(dbContext);
UpdateHanfWorldData(dbContext);
Timer updateHanfDataTimer = new Timer(TimeSpan.FromMinutes(1).TotalMilliseconds);
updateHanfDataTimer.Elapsed += UpdateHanfDataTimer_Elapsed;
updateHanfDataTimer.Start();
}
private static void OnCannabisSellRangeColShapeEnter(ColShape colShape, Player player)
{
if (!player.IsLoggedIn())
{
return;
}
var user = player.GetUser();
if (user?.Faction?.StateOwned == true || user.Faction?.GangOwned == false)
{
return;
}
ChatService.SendMessage(player, $"Fremder sagt: Pssst.. Hier kannst du dein Brokkoli loswerden.");
}
private static void HarvestRottenPlants(DatabaseContext dbContext)
{
var rottenPlants = dbContext.CannabisPlants.Where(p => EF.Functions.DateDiffHour(p.PlantDate, DateTime.Now) > MAX_PLANT_TIME.TotalHours);
foreach (var plant in rottenPlants)
{
plant.Harvested = true;
}
dbContext.SaveChanges();
}
private static void UpdateHanfDataTimer_Elapsed(object sender, ElapsedEventArgs e)
{
using var dbContext = new DatabaseContext();
UpdateHanfWorldData(dbContext);
}
private static void OnSeedBuyRangeColShapeEnter(ColShape colShape, Player player)
{
if (!player.IsLoggedIn())
{
return;
}
var user = player.GetUser();
if (user?.Faction?.StateOwned == true || user.Faction?.GangOwned == false)
{
return;
}
ChatService.SendMessage(player, $"Fremder sagt: Pssst.. Willst du Samen kaufen?");
}
internal static bool IsPlayerNearSeedBuyPoint(Player player)
{
return _seedsBuyPoints.Any(p => player.Position.DistanceTo(p) <= 2.5f);
}
internal static bool IsPlayerNearJointManufacturer(Player player)
{
return _jointManufacturerPoint.DistanceTo(player.Position) <= 2.5f;
}
internal static void StartCannabisPlanting(Player player)
{
player.ToggleInventory(InventoryToggleOption.HIDE);
if (!player.IsAlive())
{
return;
}
var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
if (user.Faction?.StateOwned ?? false || user.Faction?.GangOwned == false)
{
player.SendNotification("~r~Du darfst keine Hanfsamen einpflanzen");
return;
}
if (player.HasData(PLAYER_CURRENTLY_PLANTING_DATA_KEY) && player.GetData<bool>(PLAYER_CURRENTLY_PLANTING_DATA_KEY))
{
player.SendNotification("~r~Du pflanzt aktuell schon einen Hanfsamen ein");
return;
}
player.SetData(PLAYER_CURRENTLY_PLANTING_DATA_KEY, true);
player.TriggerEvent("SERVER:Hanf_StartPlanting");
}
[RemoteEvent("CLIENT:Hanf_PlantHanf")]
public void HanfManagerPlantHanf(Player player, float x, float y, float z)
{
player.ResetData(PLAYER_CURRENTLY_PLANTING_DATA_KEY);
IItem cannabisSeedItem = InventoryManager.GetItem<CannabisSeeds>();
UserItem userCannabisSeedsItem = InventoryManager.UserHasThisItem(player, cannabisSeedItem.Id);
if (userCannabisSeedsItem == null)
{
player.SendNotification("~r~Du hast keine Samen mehr");
return;
}
logger.LogInformation("Player {0} planted a cannabis plant at x: {1}, y: {2}, z: {3}", player.Name, x, y, z);
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
InventoryManager.RemoveUserItem(user, userCannabisSeedsItem, 1);
CannabisPlant newPlant = new CannabisPlant()
{
X = x,
Y = y,
Z = z,
PlantedBy = user,
PlantDate = DateTime.Now,
};
dbContext.CannabisPlants.Add(newPlant);
dbContext.SaveChanges();
UpdateHanfWorldData(dbContext);
}
public static void UpdateHanfWorldData(DatabaseContext dbContext)
{
var activePlants = dbContext.CannabisPlants.Where(p => !p.Harvested).Select(p => new CannabisData()
{
Id = p.Id,
Time = p.PlantDate,
X = p.X,
Y = p.Y,
Z = p.Z
}).ToList();
_currentCannabisData = activePlants;
NAPI.Pools.GetAllPlayers().ForEach(p =>
{
UpdateHanfForPlayer(p, activePlants);
});
}
public async static void UpdateHanfForPlayer(Player player, List<CannabisData> cannabisData = null)
{
cannabisData ??= _currentCannabisData;
await NAPI.Task.WaitForMainThread();
player.TriggerEvent("SERVER:Hanf_UpdateHanfData", JsonConvert.SerializeObject(cannabisData));
}
[RemoteEvent("CLIENT:Hanf_BuySeeds")]
public void HanfManagerBuySeeds(Player player, int amount)
{
if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
if (amount > GetAmountOfCannabisSeedsPlayerCanBuyToday(user))
{
player.SendNotification("~r~Du kannst heute nicht mehr so viele Samen kaufen");
return;
}
IItem seedItem = InventoryManager.GetItem<CannabisSeeds>();
var newAmount = seedItem.Gewicht * amount;
if (!InventoryManager.CanPlayerHoldMoreWeight(player, newAmount))
{
player.TriggerEvent("~r~So viele Samen passen nicht mehr in deine Hosentasche");
return;
}
var price = amount * SEED_PRICE;
if (user.Handmoney < price)
{
player.SendNotification("~r~Du hast nicht genug Geld dafür");
return;
}
logger.LogInformation("Player {0} bought {1} cannabis seeds for {2} dollars (price per seed: {3})", player.Name, amount, price, SEED_PRICE); // <-- WICHTIG LOGS
if (user.LastTimeBoughtCannabisSeeds == null || user.LastTimeBoughtCannabisSeeds.Value.Date != DateTime.Now.Date)
{
user.CannabisSeedsBoughtToday = amount;
}
else
{
user.CannabisSeedsBoughtToday += amount;
}
user.LastTimeBoughtCannabisSeeds = DateTime.Now;
user.Handmoney -= price;
dbContext.SaveChanges();
InventoryManager.AddItemToInventory(player, seedItem.Id, amount);
player.SendNotification($"Du hast {amount} Hanfsamen gekauft");
}
[RemoteEvent("CLIENT:Hanf_HarvestHanf")]
public async void HanfManagerHarvestHanf(Player player, long hanfId)
{
if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
User user = player.GetUser(dbContext);
CannabisPlant plant = dbContext.CannabisPlants.Include(p => p.PlantedBy).Where(p => p.Id == hanfId).FirstOrDefault();
if (plant == null)
{
logger.LogError("Player {0} tried to harvest cannabis plant {1} but it was not found in database", player.Name, hanfId);
return;
}
if (plant.Harvested)
{
return;
}
if (player.IsAdminDuty() && player.IsTSupport() && user.IsAdmin(AdminLevel.ADMIN))
{
player.SendNotification($"Du hast die Hanf-Pflanze von ~y~{plant.PlantedBy.Name}~s~ entfernt");
plant.Harvested = true;
dbContext.SaveChanges();
UpdateHanfWorldData(dbContext);
return;
}
if (user.Faction?.StateOwned == true)
{
if (!((user.FactionId == 1 || user.FactionId == 3) && player.IsDuty()))
{
player.SendNotification("~r~Du kannst kein Hanf ernten");
return;
}
}
//player.SyncAnimation(new[] { "harvestPlantEnter", "harvestPlant", "harvestPlantExit" }.ToList());
//player.SyncAnimation("harvestPlant");
//player.AddAttachment("shovel", false);
if (user.FactionId != 3 && user.FactionId != 1) // Zivi / Gangmember erntet ab
{
player.SyncAnimation("harvestPlant");
plant.Harvested = true;
bool isPlantRotten = DateTime.Now - plant.PlantDate > MAX_PLANT_TIME;
if (isPlantRotten)
{
player.SendNotification("~r~Die Pflanze ist leider verrottet");
}
else
{
bool isPlantReadyToHarvest = DateTime.Now - plant.PlantDate > MIN_PLANT_TIME_TO_HARVEST;
if (!isPlantReadyToHarvest) // Wenn die Pflanze noch nicht ausgewachsen ist
{
bool getSeedBack = _random.Next(0, 2) == 1; // 50% Chance
if (getSeedBack)
{
IItem cannabisSeedItem = InventoryManager.GetItem<CannabisSeeds>();
InventoryManager.AddItemToInventory(player, cannabisSeedItem.Id, 1);
player.SendNotification("~g~Du konntest den Samen wieder ausgraben");
}
else
{
player.SendNotification("~r~Du konntest den Samen leider nicht wieder ausgraben");
}
}
else
{
bool isFemalePlant = _random.Next(0, 10) + 1 <= 8; // 80% Chance dass es eine weibliche Pflanze ist
if (isFemalePlant)
{
int cannabisAmount = _random.Next(4, 10) + 1; // zwischen 5 und 10g Cannabis
IItem cannabisItem = InventoryManager.GetItem<Cannabis>();
var newWeight = cannabisAmount * cannabisItem.Gewicht;
if (!InventoryManager.CanPlayerHoldMoreWeight(player, newWeight))
{
int restWeightPlayerCanHold = InventoryManager.MAX_USER_INVENTORY - InventoryManager.GetUserInventoryWeight(player);
cannabisAmount = restWeightPlayerCanHold / cannabisItem.Gewicht;
player.SendNotification("~o~Warnung:~s~ Du hast nicht das komplette Cannabis der Pflanze erhalten, da dein Inventar voll ist");
}
player.SendNotification("~g~" + cannabisAmount + "g Cannabis geerntet");
InventoryManager.AddItemToInventory(player, cannabisItem.Id, cannabisAmount);
}
else
{
player.SendNotification("~r~Du hast die falschen Samen eingesät und keinen Ertrag aus dieser Pflanze erhalten");
}
}
}
}
else // FIB / LSPD erntet ab
{
if (!(player.HasData("IsCarryingPlant") || player.GetData<bool>("IsCarryingPlant")))
{
player.SetData("IsCarryingPlant", true);
player.SendNotification($"Du hast eine Pflanze von ~y~{plant.PlantedBy.Name}~s~ ausgegraben");
player.SyncAnimation("harvestPlant");
plant.Harvested = true;
var modelToGet = await player.TriggerProcedure("SERVER:Hanf_GetModelToGivePlayer", plant.Id);
player.SetData("HoldingCannabisPlant", modelToGet);
player.AddAttachment("CannabisPlantInHand" + modelToGet, false);
}
}
dbContext.SaveChanges();
UpdateHanfWorldData(dbContext);
}
internal static bool IsPlayerNearCannabisSellPoint(Player player)
{
return _cannabisSellPoints.Any(p => p.DistanceTo(player.Position) <= 3);
}
internal static void BuildJointsFromCannabis(Player player)
{
if (player.HasAnimation(_manufacturerAnim) || _manufacturerCurrentlyUsed)
{
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
var userItems = InventoryManager.GetUserItems(player, dbContext);
IItem cannabisItem = InventoryManager.GetItem<Cannabis>();
IItem jointItem = InventoryManager.GetItem<Joint>();
UserItem userCannabisItem = userItems.Where(i => i.ItemId == cannabisItem.Id).FirstOrDefault();
if (userCannabisItem == null || userCannabisItem.Amount < CANNABIS_NEEDED_FOR_JOINT)
{
player.SendNotification($"~r~Du hast nicht genug Cannabis dabei~n~Zur Herstellung eines Joints werden {CANNABIS_NEEDED_FOR_JOINT} Hanfblüten benötigt");
return;
}
_manufacturerCurrentlyUsed = true;
_manufacturerDoneTimer.Start();
player.SyncAnimation(_manufacturerAnim);
InventoryManager.RemoveUserItem(user, userCannabisItem, CANNABIS_NEEDED_FOR_JOINT);
InventoryManager.AddItemToInventory(player, jointItem.Id, 1);
player.SendNotification($"Du hast {CANNABIS_NEEDED_FOR_JOINT} Hanfblüten in einen Joint verarbeitet");
NAPI.ClientEvent.TriggerClientEventInRange(player.Position, 100.0f, "SERVER:Hanf_PlayManufacturerAnim", _manufacturerAnim);
}
private static void ManufacturerDoneTimerCallback(object sender, EventArgs args)
{
_manufacturerDoneTimer.Stop();
_manufacturerCurrentlyUsed = false;
}
[RemoteEvent("CLIENT:Hanf_FinishDiggingAnimation")]
public void HanfManagerFinishDiggingAnimation(Player player)
{
player.AddAttachment("shovel", true);
}
private static int GetAmountOfCannabisSeedsPlayerCanBuyToday(User user)
{
if (user.LastTimeBoughtCannabisSeeds == null)
{
return MAX_SEEDS_PER_DAY;
}
if (user.LastTimeBoughtCannabisSeeds.Value.Date != DateTime.Now.Date)
{
return MAX_SEEDS_PER_DAY;
}
return MAX_SEEDS_PER_DAY - user.CannabisSeedsBoughtToday;
}
internal static void ShowPlayerBuySeedMenu(Player player)
{
var user = player.GetUser();
if (user.Faction?.StateOwned == true)
{
return;
}
var seedsUserCanBuy = GetAmountOfCannabisSeedsPlayerCanBuyToday(user);
if (seedsUserCanBuy == 0)
{
player.SendNotification("~r~Du kannst heute keine Samen mehr kaufen");
return;
}
player.TriggerEvent("SERVER:Hanf_BuySeed", seedsUserCanBuy, SEED_PRICE);
}
internal static void PlayerSellCannabis(Player player)
{
if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
if (user.Faction?.StateOwned == true)
{
return;
}
List<UserItem> items = InventoryManager.GetUserItems(player, dbContext);
IItem cannabisItem = InventoryManager.GetItem<Cannabis>();
var cannabisAmount = items.Where(i => i.ItemId == cannabisItem.Id).FirstOrDefault()?.Amount ?? 0;
if (cannabisAmount == 0)
{
player.SendNotification("~r~Du hast kein Cannabis dabei");
return;
}
player.TriggerEvent("SERVER:Hanf_SellCannabisMenu", cannabisAmount, CANNABIS_PRICE);
}
[RemoteEvent("CLIENT:Hanf_SellCannabis")]
public void HanfManagerSellCannabis(Player player, int amount)
{
if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
List<UserItem> items = InventoryManager.GetUserItems(player, dbContext);
IItem cannabisItem = InventoryManager.GetItem<Cannabis>();
var cannabisUserItem = items.Where(i => i.ItemId == cannabisItem.Id).FirstOrDefault();
var cannabisAmount = cannabisUserItem?.Amount ?? 0;
if (cannabisAmount < amount)
{
player.SendNotification("~r~Du hast nicht so viel Cannabis dabei");
return;
}
var price = amount * CANNABIS_PRICE;
user.Handmoney += price;
InventoryManager.RemoveUserItem(user, cannabisUserItem, amount);
logger.LogInformation("Player {0} sold {1} cannabis to the server for {2} dollars", player.Name, amount, price);
player.SendNotification($"Du hast ~g~{amount} Hanfblüten~s~ für ~g~{price.ToMoneyString()}~s~ verkauft");
}
}
}

View File

@@ -18,6 +18,7 @@ using ReallifeGamemode.Server.Core.API;
using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Factions.Medic;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ReallifeGamemode.Server.Log; using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Inventory.Interfaces;
/** /**
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs) * @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
@@ -55,7 +56,7 @@ namespace ReallifeGamemode.Server.Managers
return; return;
} }
using (var dbContext = new DatabaseContext(true)) using (var dbContext = new DatabaseContext())
{ {
User u = leader.GetUser(dbContext); User u = leader.GetUser(dbContext);
User own = player.GetUser(dbContext); User own = player.GetUser(dbContext);
@@ -758,6 +759,156 @@ namespace ReallifeGamemode.Server.Managers
} }
} }
[RemoteEvent("CLIENT:InteractionMenu_LSPD_FriskUser")]
public void InteractionMenuLspdFriskUser(Player player, string name)
{
if (!player.IsLoggedIn())
{
return;
}
Player target = PlayerService.GetPlayerByNameOrId(name);
if (!target.IsLoggedIn())
{
ChatService.PlayerNotFound(player);
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
if ((user.FactionId != 1 && user.FactionId != 3) || !player.IsDuty())
{
return;
}
if (player.Position.DistanceTo(target.Position) > 5)
{
player.SendNotification("~r~Der Spieler ist nicht in deiner Nähe");
return;
}
var targetUser = target.GetUser(dbContext);
var targetItems = InventoryManager.GetUserItems(target, dbContext);
List<string> illItemsList = new List<string>();
bool illegalItemsFound = false;
var price = 0;
foreach (var targetItem in targetItems)
{
IItem item = InventoryManager.GetItemById(targetItem.ItemId);
if (!item.Legal)
{
illItemsList.Add($"{targetItem.Amount}x {item.Name}");
InventoryManager.RemoveUserItem(targetUser, targetItem, targetItem.Amount);
illegalItemsFound = true;
price += ((IIllegalItem)item).PriceForConfiscation * targetItem.Amount;
logger.LogInformation("Player {0} confiscated the illegal item {1} ({2}, amount: {3}) from player {4}", player.Name, item.Name, item.Id, targetItem.Amount, target.Name);
}
}
if (!illegalItemsFound)
{
player.SendNotification("~g~Der Spieler hat keine illegalen Gegenstände dabei");
return;
}
logger.LogInformation("executive factions got {0} dollars from the confiscation", price);
var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in factions)
{
faction.BankAccount.Balance += price;
}
dbContext.SaveChanges();
string illItemsStr = "~y~" + string.Join("~s~,~y~ ", illItemsList) + "~s~";
ChatService.SendMessage(player, $"Du hast ~y~{target.Name}~s~ folgende Gegenstände abgenommen: {illItemsStr}");
ChatService.SendMessage(target, $"~y~{player.Name}~s~ hat die folgende Gegenstände abgenommen: {illItemsStr}");
}
[RemoteEvent("CLIENT:InteractionMenu_LSPD_FriskVehicle")]
public void InteractionMenuLspdFriskVehicle(Player player)
{
if (!player.IsLoggedIn())
{
return;
}
using var dbContext = new DatabaseContext();
var user = player.GetUser(dbContext);
if ((user.FactionId != 1 && user.FactionId != 3) || !player.IsDuty())
{
return;
}
var vehicle = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault();
if (vehicle == null)
{
player.SendNotification("~r~Es befindet sich kein Fahrzeug in deiner Nähe");
return;
}
ServerVehicle serverVehicle = vehicle.GetServerVehicle(dbContext);
if (serverVehicle == null)
{
player.SendNotification("~r~Dieses Fahrzeug kann nicht durchsucht werden");
return;
}
if (serverVehicle.Model == VehicleHash.Riot)
{
player.SendNotification("~r~Der Riot muss zur Asservatenkammer gefahren werden");
return;
}
if (VehicleStreaming.GetLockState(vehicle) || serverVehicle.Locked)
{
player.SendNotification("~r~Dieses Fahrzeug ist abgeschlossen");
return;
}
var targetItems = InventoryManager.GetVehicleItems(vehicle);
List<string> illItemsList = new List<string>();
bool illegalItemsFound = false;
var price = 0;
foreach (var targetItem in targetItems)
{
IItem item = InventoryManager.GetItemById(targetItem.ItemId);
if (!item.Legal)
{
illItemsList.Add($"{targetItem.Amount}x {item.Name}");
InventoryManager.RemoveVehicleItem(serverVehicle, targetItem, targetItem.Amount, null);
illegalItemsFound = true;
price += ((IIllegalItem)item).PriceForConfiscation * targetItem.Amount;
logger.LogInformation("Player {0} confiscated the illegal item {1} ({2}, amount: {3}) from vehicle {4}", player.Name, item.Name, item.Id, targetItem.Amount, serverVehicle.Id);
}
}
if (!illegalItemsFound)
{
player.SendNotification("~g~Im Kofferraum sind keine illegalen Gegenstände");
return;
}
logger.LogInformation("executive factions got {0} dollars from the confiscation", price);
var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3);
foreach (var faction in factions)
{
faction.BankAccount.Balance += price;
}
dbContext.SaveChanges();
string illItemsStr = "~y~" + string.Join("~s~,~y~ ", illItemsList) + "~s~";
ChatService.SendInRange(player.Position, 20, $"{player.Name} hat aus dem Kofferraum folgende Gegenstände beschlagnahmt: {illItemsStr}");
}
[RemoteEvent("CLIENT:InteractionMenu_Pay")] [RemoteEvent("CLIENT:InteractionMenu_Pay")]
public void InteractionMenu_Pay(Player player, string jsonNameOrId, string stringAmount) public void InteractionMenu_Pay(Player player, string jsonNameOrId, string stringAmount)
{ {

View File

@@ -27,7 +27,7 @@ namespace ReallifeGamemode.Server.Managers
{ {
public class InventoryManager : Script public class InventoryManager : Script
{ {
private const int MAX_USER_INVENTORY = 40000; public const int MAX_USER_INVENTORY = 40000;
private static readonly ILogger logger = LogManager.GetLogger<InventoryManager>(); private static readonly ILogger logger = LogManager.GetLogger<InventoryManager>();
public static List<IItem> itemList; public static List<IItem> itemList;
@@ -47,7 +47,7 @@ namespace ReallifeGamemode.Server.Managers
public int Amount; public int Amount;
public int ItemId; public int ItemId;
public int Weight; public int Weight;
public Vehicle vehicle; public ushort vehicle;
} }
public static void SetBackpackItems(Player player) public static void SetBackpackItems(Player player)
@@ -75,14 +75,25 @@ namespace ReallifeGamemode.Server.Managers
player.SetSharedData("backpackItems", JsonConvert.SerializeObject(backpackItems[player].ToArray())); player.SetSharedData("backpackItems", JsonConvert.SerializeObject(backpackItems[player].ToArray()));
} }
internal static T GetItem<T>() where T : IItem
{
return (T)itemList.Where(i => i.GetType() == typeof(T)).First();
}
[RemoteEvent("CLIENT:getVehicleInventory")] [RemoteEvent("CLIENT:getVehicleInventory")]
public static void SetVehicleItems(Player player) public static void SetVehicleItems(Player player)
{ {
if (player.IsInVehicle) if (player.IsInVehicle)
{ {
player.TriggerEvent("Error", "Du kannst deinen Kofferraum gerade nicht öffnen."); player.TriggerEvent("Error", "Du kannst deinen Kofferraum gerade nicht öffnen.");
return;
} }
Vehicle veh = NAPI.Pools.GetAllVehicles().ToList().Where(v => v.Position.DistanceTo(player.Position) <= 2).FirstOrDefault();
Vehicle veh = NAPI.Pools.GetAllVehicles()
.ToList()
.Where(v => v.Position.DistanceTo(player.Position) <= 4)
.OrderBy(v => v.Position.DistanceTo(player.Position))
.FirstOrDefault();
if (veh == null) if (veh == null)
{ {
player.TriggerEvent("Error", "Kein Fahrzeug in der Nähe!"); player.TriggerEvent("Error", "Kein Fahrzeug in der Nähe!");
@@ -122,7 +133,7 @@ namespace ReallifeGamemode.Server.Managers
Amount = i.Amount, Amount = i.Amount,
ItemId = i.ItemId, ItemId = i.ItemId,
Weight = GetVehicleInventoryWeight(veh), Weight = GetVehicleInventoryWeight(veh),
vehicle = veh, vehicle = veh.Handle.Value,
}; };
vehicleItems[player].Add(newItem); vehicleItems[player].Add(newItem);
} }
@@ -130,6 +141,11 @@ namespace ReallifeGamemode.Server.Managers
player.SetSharedData("vehicleItems", JsonConvert.SerializeObject(vehicleItems[player].ToArray())); player.SetSharedData("vehicleItems", JsonConvert.SerializeObject(vehicleItems[player].ToArray()));
} }
public static bool CanPlayerHoldMoreWeight(Player player, int moreWeight)
{
return GetUserInventoryWeight(player) + moreWeight <= MAX_USER_INVENTORY;
}
public static void LoadItems() public static void LoadItems()
{ {
itemList = new List<IItem>(); itemList = new List<IItem>();
@@ -175,18 +191,18 @@ namespace ReallifeGamemode.Server.Managers
if (userItem.Amount == 0) if (userItem.Amount == 0)
{ {
dbContext.Remove(userItem); dbContext.Remove(userItem);
dbContext.SaveChanges();
} }
Player player = user.Player;
List<UserItem> itemList = GetUserItems(player);
if (itemList == null) return;
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
} }
public static void RemoveVehicleItem(ServerVehicle sVeh, VehicleItem item, int amount, Player player) public static void RemoveVehicleItem(ServerVehicle sVeh, VehicleItem item, int amount, Player player)
{ {
if (item == null)
{
return;
}
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{ {
var vehicleItem = dbContext.VehicleItems.FirstOrDefault(i => i.Id == item.Id); var vehicleItem = dbContext.VehicleItems.FirstOrDefault(i => i.Id == item.Id);
@@ -212,16 +228,29 @@ namespace ReallifeGamemode.Server.Managers
return new DatabaseContext().VehicleItems.ToList().FindAll(i => i.GetVehicle().GetVehicle() == vehicle); return new DatabaseContext().VehicleItems.ToList().FindAll(i => i.GetVehicle().GetVehicle() == vehicle);
} }
public static List<UserItem> GetUserItems(Player player) public static List<UserItem> GetUserItems(Player player, DatabaseContext dbContext = null)
{ {
var user = player.GetUser(); if (dbContext == null)
using (var context = new DatabaseContext())
{ {
return context.UserItems.ToList().FindAll(i => i.UserId == user.Id); using (dbContext = new DatabaseContext())
{
return GetUserItemsInternal(player, dbContext);
}
}
else
{
return GetUserItemsInternal(player, dbContext);
} }
} }
private static List<UserItem> GetUserItemsInternal(Player player, DatabaseContext dbContext)
{
var user = player.GetUser(dbContext);
return dbContext.UserItems.ToList().FindAll(i => i.UserId == user.Id);
}
public static int GetUserInventoryWeight(Player player) public static int GetUserInventoryWeight(Player player)
{ {
var user = player.GetUser(); var user = player.GetUser();
@@ -270,7 +299,7 @@ namespace ReallifeGamemode.Server.Managers
} }
} }
public static void GetUserItemsAsAdmin(Player player, User user) public static void GetUserItemsAsAdmin(Player admin, User user)
{ {
var inventoryWeight = 0; var inventoryWeight = 0;
@@ -292,7 +321,7 @@ namespace ReallifeGamemode.Server.Managers
items[userItems.IndexOf(item)][4] = item.Slot.ToString(); items[userItems.IndexOf(item)][4] = item.Slot.ToString();
items[userItems.IndexOf(item)][5] = item.Id.ToString(); items[userItems.IndexOf(item)][5] = item.Id.ToString();
} }
player.TriggerEvent("showInventoryToAdmin", user.Name, inventoryWeight, items); admin.TriggerEvent("showInventoryToAdmin", user.Name, inventoryWeight, items);
} }
} }
@@ -304,20 +333,29 @@ namespace ReallifeGamemode.Server.Managers
using (var context = new DatabaseContext()) using (var context = new DatabaseContext())
{ {
User user = player.GetUser(context);
if (!vehicleItems.ContainsKey(player)) if (!vehicleItems.ContainsKey(player))
vehicleItems.Add(player, new List<InventoryItem>()); vehicleItems.Add(player, new List<InventoryItem>());
Vehicle veh = null; Vehicle veh = null;
if (vehicleItems[player].Count != 0) if (vehicleItems[player].Count != 0)
veh = vehicleItems[player].FirstOrDefault().vehicle; veh = new NetHandle(vehicleItems[player].FirstOrDefault().vehicle, EntityType.Vehicle).Entity<Vehicle>();
ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context); ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context);
VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == serverVehicle.Id && v.ItemId == itemID).FirstOrDefault(); VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == serverVehicle.Id && v.ItemId == itemID).FirstOrDefault();
if (vehItem == null) if (vehItem == null)
{ {
player.TriggerEvent("Error", "Transfer nicht möglich."); player.TriggerEvent("Error", "Transfer nicht möglich.");
return; return;
} }
if (serverVehicle is FactionVehicle factionVehicle)
{
IItem item = GetItemById(itemID);
if (factionVehicle.Model == VehicleHash.Riot && user.Faction?.StateOwned == true)
{
player.TriggerEvent("Error", "Transfer nicht möglich.");
return;
}
}
RemoveVehicleItem(serverVehicle, vehItem, itemAmount, player); RemoveVehicleItem(serverVehicle, vehItem, itemAmount, player);
SetVehicleItems(player); SetVehicleItems(player);
@@ -510,10 +548,10 @@ namespace ReallifeGamemode.Server.Managers
int itemId = JsonConvert.DeserializeObject<int>(jsonItemId); int itemId = JsonConvert.DeserializeObject<int>(jsonItemId);
string type = JsonConvert.DeserializeObject<string>(jsonType); string type = JsonConvert.DeserializeObject<string>(jsonType);
User user = player.GetUser();
using (var context = new DatabaseContext()) using (var context = new DatabaseContext())
{ {
User user = player.GetUser(context);
UserItem fItem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault(); UserItem fItem = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault();
IItem iItem = GetItemById(fItem.ItemId); IItem iItem = GetItemById(fItem.ItemId);
@@ -534,10 +572,15 @@ namespace ReallifeGamemode.Server.Managers
if (iItem is IUsableItem usableItemObj) if (iItem is IUsableItem usableItemObj)
{ {
if (usableItemObj.Use(fItem)) logger.LogInformation("Player {0} used the item {1} ({2})", player.Name, iItem.Name, iItem.Id);
if (usableItemObj.Use(player, user, context))
{ {
SetBackpackItems(player); if (usableItemObj.RemoveWhenUsed)
player.TriggerEvent("aproveUse", 1, iItem.Name); {
RemoveUserItem(user, fItem, 1);
SetBackpackItems(player);
player.TriggerEvent("aproveUse", 1, iItem.Name);
}
} }
} }
else player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen."); else player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen.");
@@ -559,6 +602,7 @@ namespace ReallifeGamemode.Server.Managers
if (iItem is IDroppableItem usableItemObj2) if (iItem is IDroppableItem usableItemObj2)
{ {
logger.LogInformation("Player {0} dropped the item {1} ({2})", player.Name, iItem.Name, iItem.Id);
Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0); Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0);
//new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f); //new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f);
Random r = new Random(); Random r = new Random();
@@ -617,7 +661,6 @@ namespace ReallifeGamemode.Server.Managers
if (GetUserInventoryWeight(client) + shopItem.Gewicht > MAX_USER_INVENTORY) if (GetUserInventoryWeight(client) + shopItem.Gewicht > MAX_USER_INVENTORY)
{ {
return; return;
} }
@@ -642,5 +685,24 @@ namespace ReallifeGamemode.Server.Managers
//client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney); //client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
} }
} }
public static void RemoveIllegalItemsFromInventory(Player player)
{
if (!player.IsLoggedIn())
{
return;
}
var user = player.GetUser();
List<UserItem> items = GetUserItems(player);
foreach (var item in items)
{
if (!GetItemById(item.ItemId).Legal)
{
RemoveUserItem(user, item, item.Amount);
}
}
}
} }
} }

View File

@@ -100,7 +100,7 @@ namespace ReallifeGamemode.Server.Managers
return; return;
} }
if (u.DriverLicenseVehicle == false) if (jobId != 3 && u.DriverLicenseVehicle == false)
{ {
ChatService.ErrorMessage(player, "Um diesen Job annehmen zu können, musst du einen Führerschein besitzen"); ChatService.ErrorMessage(player, "Um diesen Job annehmen zu können, musst du einen Führerschein besitzen");
return; return;

View File

@@ -68,7 +68,8 @@ namespace ReallifeGamemode.Server.Managers
{ {
WeponDealPed, WeponDealPed,
DepartmentPed, DepartmentPed,
PrisonPed PrisonPed,
} }
public class PedData public class PedData

View File

@@ -7,6 +7,10 @@ using ReallifeGamemode.Server.Shop.Friseur;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Shop.Ammunation; using ReallifeGamemode.Server.Shop.Ammunation;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Job;
namespace ReallifeGamemode.Server.Managers namespace ReallifeGamemode.Server.Managers
{ {
@@ -34,6 +38,10 @@ namespace ReallifeGamemode.Server.Managers
public static List<RentcarPoint> rentcarPoints = new List<RentcarPoint>(); public static List<RentcarPoint> rentcarPoints = new List<RentcarPoint>();
public static List<CarwashPoint> carwashPoints = new List<CarwashPoint>();
public static List<JailPoint> jailPoints = new List<JailPoint>();
public static Vector3 eventportPosition; public static Vector3 eventportPosition;
public static bool eventportActive = false; public static bool eventportActive = false;
@@ -114,6 +122,25 @@ namespace ReallifeGamemode.Server.Managers
#endregion WeaponPoints #endregion WeaponPoints
#region JailPoints
JailPoint jail = new JailPoint()
{
Position = new Vector3(1854.06, 2582.38, 45.67)
};
jailPoints.Add(jail);
foreach (JailPoint j in jailPoints)
{
NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 0), false, 0);
NAPI.TextLabel.CreateTextLabel("Stellen - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
#endregion JailReleasePoints
#region JailReleasePoints #region JailReleasePoints
JailReleasePoint jailPointLSPD = new JailReleasePoint() JailReleasePoint jailPointLSPD = new JailReleasePoint()
@@ -201,11 +228,18 @@ namespace ReallifeGamemode.Server.Managers
jobId = 4, jobId = 4,
Skill = 0 Skill = 0
}; };
JobPoint jobPointFarmer = new JobPoint()
{
Position = FarmerJob.POSITION_JOB_START,
jobId = 5,
Skill = 0
};
JobPoints.Add(jobPointRefuseCollector); JobPoints.Add(jobPointRefuseCollector);
JobPoints.Add(jobPointPilot); JobPoints.Add(jobPointPilot);
JobPoints.Add(jobPointPilot2); JobPoints.Add(jobPointPilot2);
JobPoints.Add(jobPointBusDriver); JobPoints.Add(jobPointBusDriver);
JobPoints.Add(jobPointFarmer);
foreach (JobPoint p in JobPoints) foreach (JobPoint p in JobPoints)
{ {
@@ -234,6 +268,11 @@ namespace ReallifeGamemode.Server.Managers
NAPI.TextLabel.CreateTextLabel("Busfahrer - Dr\u00fccke ~y~E~s~ um Job zu starten/beenden", p.Position, 15, 1, 0, new Color(255, 255, 255), false, 0); NAPI.TextLabel.CreateTextLabel("Busfahrer - Dr\u00fccke ~y~E~s~ um Job zu starten/beenden", p.Position, 15, 1, 0, new Color(255, 255, 255), false, 0);
NAPI.Blip.CreateBlip(513, p.Position, 1f, 16, "Busfahrer", 255, 0, true); NAPI.Blip.CreateBlip(513, p.Position, 1f, 16, "Busfahrer", 255, 0, true);
} }
if (p.jobId == 5)
{
NAPI.TextLabel.CreateTextLabel("Farmer - Dr\u00fccke ~y~E~s~ um Job zu starten/beenden", p.Position, 15, 1, 0, new Color(255, 255, 255), false, 0);
NAPI.Blip.CreateBlip(369, p.Position, 1f, 16, "Farmer", 255, 0, true);
}
} }
#endregion JobPoints #endregion JobPoints
@@ -347,9 +386,57 @@ namespace ReallifeGamemode.Server.Managers
NAPI.Blip.CreateBlip(88, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 59, "Fahrzeugverleih", 255, 200, true, 0, 0); NAPI.Blip.CreateBlip(88, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 59, "Fahrzeugverleih", 255, 200, true, 0, 0);
} }
#endregion RentCar
#region Carwash
CarwashPoint Carwash = new CarwashPoint()
{
Position = new Vector3(26.37, -1391.99, 29.36)
};
carwashPoints.Add(Carwash);
foreach (CarwashPoint point in carwashPoints)
{
NAPI.Marker.CreateMarker(1, new Vector3(point.Position.X, point.Position.Y, point.Position.Z - 2), new Vector3(point.Position.X, point.Position.Y, point.Position.Z + 1),
new Vector3(0, 0, 0), 5.5f, new Color(255, 255, 255, 50), false, 0);
NAPI.TextLabel.CreateTextLabel("~y~Autowaschanlage", point.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
NAPI.Blip.CreateBlip(100, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 0, "´Carwash", 255, 200, true, 0, 0);
Vector3 pos = point.Position;
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos, 5, 0);
colShape.OnEntityEnterColShape += (cs, c) =>
{
if (!(c.IsInVehicle && c.VehicleSeat == 0)) return;
using (var dbcontext = new DatabaseContext())
{
User u = c.GetUser(dbcontext);
if(u.Handmoney < 0)
{
c.SendNotification("Du hast nicht genug Geld auf der Hand!");
return;
}
else {
c.TriggerEvent("washcar");
c.SendNotification("Die Autowäsche hat dich ~g~$~w~100 gekostet.");
u.Handmoney -= 100;
dbcontext.SaveChanges();
}
}
};
}
#endregion Carwash
} }
#endregion RentCar
[RemoteEvent("sendClientToStage")] [RemoteEvent("sendClientToStage")]
public void ElevatorSendToStage(Player player, string level) public void ElevatorSendToStage(Player player, string level)
{ {
@@ -486,3 +573,13 @@ public class RentcarPoint
public Vector3 Position { get; set; } public Vector3 Position { get; set; }
} }
public class CarwashPoint
{
public Vector3 Position { get; set; }
}
public class JailPoint
{
public Vector3 Position { get; set; }
}

View File

@@ -887,6 +887,32 @@ namespace ReallifeGamemode.Server.Managers
"pounder2" "pounder2"
}; };
public VehicleManager()
{
#region add_VehicleRespawnPoints
VehicleRespawnPoints.Add(pos1);
VehicleRespawnPoints.Add(pos2);
VehicleRespawnPoints.Add(pos3);
VehicleRespawnPoints.Add(pos4);
VehicleRespawnPoints.Add(pos5);
VehicleRespawnPoints.Add(pos6);
VehicleRespawnPoints.Add(pos7);
VehicleRespawnPoints.Add(pos8);
VehicleRespawnPoints.Add(pos9);
VehicleRespawnPoints.Add(pos10);
VehicleRespawnPoints.Add(pos11);
VehicleRespawnPoints.Add(pos12);
VehicleRespawnPoints.Add(pos13);
VehicleRespawnPoints.Add(pos14);
VehicleRespawnPoints.Add(pos15);
VehicleRespawnPoints.Add(pos16);
VehicleRespawnPoints.Add(pos17);
VehicleRespawnPoints.Add(pos18);
VehicleRespawnPoints.Add(pos19);
VehicleRespawnPoints.Add(pos20);
#endregion add_VehicleRespawnPoints
}
private static readonly Dictionary<int, ushort> _serverVehicles = new Dictionary<int, ushort>(); private static readonly Dictionary<int, ushort> _serverVehicles = new Dictionary<int, ushort>();
private static readonly Dictionary<NetHandle, Vector3> lastPositions = new Dictionary<NetHandle, Vector3>(); private static readonly Dictionary<NetHandle, Vector3> lastPositions = new Dictionary<NetHandle, Vector3>();
@@ -1088,11 +1114,51 @@ namespace ReallifeGamemode.Server.Managers
vehicle.Delete(); vehicle.Delete();
return; return;
} }
InventoryManager.RemoveAllItemsfromVehicleInventory(vehicle);
serverVehicle.Spawn(vehicle); CheckVehicleDeath(vehicle.Id);
} }
public static void CheckVehicleDeath(int id)
{
using (var dbContext = new DatabaseContext())
{
Vehicle vehicle = NAPI.Pools.GetAllVehicles().Find(v => v.Id == id);
ServerVehicle sV = vehicle.GetServerVehicle(dbContext);
if (sV is UserVehicle uV)
{
foreach (VehicleRespawnPoint point in VehicleRespawnPoints)
{
if (!NAPI.Pools.GetAllVehicles().Any(v => v.Position.DistanceTo(point.Position) < 1))
{
sV.PositionX = point.Position.X;
sV.PositionY = point.Position.Y;
sV.PositionZ = point.Position.Z;
sV.Heading = point.Heading;
dbContext.SaveChanges();
break;
}
}
User user = dbContext.Users.Find(uV.UserId);
user.Player?.SendNotification("Dein Fahrzeug ist zerstört~n~Du kannst es im Interaktionsmenü unter \"Fahrzeuge\" orten");
vehicle.Delete();
Vehicle newVeh = sV.Spawn(vehicle);
newVeh.Repair();
}
if (sV is FactionVehicle || sV is GroupVehicle)
{
vehicle.Delete();
Vehicle newVeh = sV.Spawn(vehicle);
newVeh.Repair();
}
InventoryManager.RemoveAllItemsfromVehicleInventory(vehicle);
}
}
[RemoteEvent("CLIENT:setMarkerBehindVehicle")] [RemoteEvent("CLIENT:setMarkerBehindVehicle")]
public void setVectorBehindVehicle(Player player, int id, string jsonX, string jsonY, string jsonZ) public void setVectorBehindVehicle(Player player, int id, string jsonX, string jsonY, string jsonZ)
{ {
@@ -1100,5 +1166,169 @@ namespace ReallifeGamemode.Server.Managers
Vector3 vector3 = new Vector3(Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonX)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonY)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonZ))); Vector3 vector3 = new Vector3(Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonX)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonY)), Convert.ToSingle((double)JsonConvert.DeserializeObject(jsonZ)));
vehicle.AddMarkerBehind(vector3); vehicle.AddMarkerBehind(vector3);
} }
#region spawnpositions-vehicleInWater
public static List<VehicleRespawnPoint> VehicleRespawnPoints = new List<VehicleRespawnPoint>();
VehicleRespawnPoint pos1 = new VehicleRespawnPoint()
{
Position = new Vector3(-307.84, -909.04, 31.07),
Heading = 167.46f
};
VehicleRespawnPoint pos2 = new VehicleRespawnPoint()
{
Position = new Vector3(-311.52, -908.40, 31.07),
Heading = 170.40f
};
VehicleRespawnPoint pos3 = new VehicleRespawnPoint()
{
Position = new Vector3(-315.18, -907.68, 31.07),
Heading = 167.17f
};
VehicleRespawnPoint pos4 = new VehicleRespawnPoint()
{
Position = new Vector3(-319.09, -906.68, 31.07),
Heading = 168.41f
};
VehicleRespawnPoint pos5 = new VehicleRespawnPoint()
{
Position = new Vector3(-322.48, -905.95, 31.07),
Heading = 169.00f
};
VehicleRespawnPoint pos6 = new VehicleRespawnPoint()
{
Position = new Vector3(-322.48, -905.95, 31.07),
Heading = 169.00f
};
VehicleRespawnPoint pos7 = new VehicleRespawnPoint()
{
Position = new Vector3(-325.95, -905.17, 31.07),
Heading = 168.26f
};
VehicleRespawnPoint pos8 = new VehicleRespawnPoint()
{
Position = new Vector3(-329.77, -904.33, 31.07),
Heading = 168.17f
};
VehicleRespawnPoint pos9 = new VehicleRespawnPoint()
{
Position = new Vector3(-333.31, -903.61, 31.07),
Heading = 169.17f
};
VehicleRespawnPoint pos10 = new VehicleRespawnPoint()
{
Position = new Vector3(-336.86, -902.80, 31.07),
Heading = 167.65f
};
VehicleRespawnPoint pos11 = new VehicleRespawnPoint()
{
Position = new Vector3(-340.41, -902.12, 31.07),
Heading = 162.65f
};
VehicleRespawnPoint pos12 = new VehicleRespawnPoint()
{
Position = new Vector3(-360.96, -893.13, 31.07),
Heading = -88.49f
};
VehicleRespawnPoint pos13 = new VehicleRespawnPoint()
{
Position = new Vector3(-360.80, -896.62, 31.07),
Heading = -88.13f
};
VehicleRespawnPoint pos14 = new VehicleRespawnPoint()
{
Position = new Vector3(-359.50, -944.78, 31.08),
Heading = -89.30f
};
VehicleRespawnPoint pos15 = new VehicleRespawnPoint()
{
Position = new Vector3(-361.17, -948.58, 31.08),
Heading = -85.58f
};
VehicleRespawnPoint pos16 = new VehicleRespawnPoint()
{
Position = new Vector3(-361.00, -952.27, 31.08),
Heading = -89.86f
};
VehicleRespawnPoint pos17 = new VehicleRespawnPoint()
{
Position = new Vector3(-360.99, -955.92, 31.08),
Heading = -87.21f
};
VehicleRespawnPoint pos18 = new VehicleRespawnPoint()
{
Position = new Vector3(-350.26, -972.01, 31.08),
Heading = -18.13f
};
VehicleRespawnPoint pos19 = new VehicleRespawnPoint()
{
Position = new Vector3(-346.58, -973.31, 31.08),
Heading = -19.79f
};
VehicleRespawnPoint pos20 = new VehicleRespawnPoint()
{
Position = new Vector3(-343.31, -974.59, 31.08),
Heading = -20.22f
};
/*
private readonly IReadOnlyCollection<Vector3> vector3s = new List<Vector3>
{
new Vector3(-343.31, -974.59, 31.08), //Heading -20.22
new Vector3(-339.67, -975.69, 31.08), //Heading -16.76
new Vector3(-336.38, -976.95, 31.08), //Heading -19.30
new Vector3(-332.50, -978.28, 31.08), //Heading -18.82
new Vector3(-329.48, -979.39, 31.08), //Heading -26.22
new Vector3(-325.96, -980.70, 31.08), //Heading -19.74
new Vector3(-360.85, -900.53, 31.07), //Heading -88.64
new Vector3(-360.71, -904.02, 31.07), //Heading -88.04
new Vector3(-360.56, -907.78, 31.07), //Heading -88.41
new Vector3(-360.41, -911.79, 31.08), //Heading -86.13
new Vector3(-360.30, -915.26, 31.08), //Heading -134.60
new Vector3(-360.12, -919.21, 31.08), //Heading -82.35
new Vector3(-360.03, -922.63, 31.08), //Heading -89.27
new Vector3(-359.78, -926.58, 31.08), //Heading -84.04
new Vector3(-359.73, -929.89, 31.08), //Heading -88.67
new Vector3(-359.66, -933.50, 31.08), //Heading -88.67
new Vector3(-359.54, -937.61, 31.08), //Heading -86.68
new Vector3(-359.48, -941.17, 31.08), //Heading -90.07
new Vector3(-336.84, -952.54, 31.08), //Heading 68.74
new Vector3(-355.55, -949.08, 31.08), //Heading 71.85
new Vector3(-334.47, -945.95, 31.08), //Heading 70.89
new Vector3(-333.11, -942.11, 31.08), //Heading 70.18
new Vector3(-331.90, -938.98, 31.08), //Heading 68.07
new Vector3(-330.65, -935.58, 31.08), //Heading 70.98
new Vector3(-329.24, -931.58, 31.08), //Heading 73.91
new Vector3(-328.12, -928.44, 31.08), //Heading 69.17
new Vector3(-326.67, -924.60, 31.08), //Heading 46.89
new Vector3(-322.36, -982.02, 31.08), //Heading -21.25059
new Vector3(-318.92, -983.19, 31.08), //Heading -20.580233
new Vector3(-315.42, -984.40, 31.08), //Heading -21.508415
new Vector3(-311.97, 985.60, 31.080), //Heading -20.866705
new Vector3(-308.43, -986.83, 31.08), //Heading -21.050055
new Vector3(-305.03, -988.07, 31.08), //Heading -21.021408
new Vector3(-301.48, -989.31, 31.08), //Heading -22.333475
new Vector3(-298.04, -990.48, 31.08), //Heading -26.02332
new Vector3(-342.30, -921.35, 31.0), //Heading-109.20534
new Vector3(-343.37, -925.01, 31.08), //Heading -111.86385
new Vector3(-344.68, -928.18, 31.08), //Heading -109.97883
new Vector3(-345.78, -931.86, 31.08), //Heading -110.89556
}.AsReadOnly();
*/
#endregion spawnpositions-vehicleInWater
[RemoteEvent("CheckWater")]
public static void CheckWater(Player player, int id)
{
CheckVehicleDeath(id);
}
} }
} }
public class VehicleRespawnPoint
{
public Vector3 Position { get; set; }
public float Heading { get; set; }
}

View File

@@ -139,11 +139,11 @@ public class AttachmentSyncExample : Script
public void attachment(Player player) public void attachment(Player player)
{ {
Vehicle veh = player.Vehicle; Vehicle veh = player.Vehicle;
if (!player.HasAttachment("ammobox")) if (!veh.HasAttachment("weapondeal"))
{ {
player.AddAttachment("ammobox", false); //player.AddAttachment("weapondeal", false);
//player.SyncAnimation("carryBox"); //player.SyncAnimation("carryBox");
//veh.AddAttachment("weapondeal1", false); //veh.AddAttachment("weapondeal", false);
//veh.AddAttachment("weapondeal2", false); //veh.AddAttachment("weapondeal2", false);
} }
else else

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Util
{
public class CannabisData
{
public long Id { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public DateTime Time { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
namespace ReallifeGamemode.Server.Util
{
public static class Colors
{
public static Color White = new Color(255, 255, 255);
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace ReallifeGamemode.Server.Util
{
public enum InventoryToggleOption
{
TOGGLE, SHOW, HIDE
}
}

View File

@@ -52,18 +52,23 @@ namespace ReallifeGamemode.Server.Util
{ {
noobspawnVehicleProperties.Add(new RentcarProperty("bmx", 10)); noobspawnVehicleProperties.Add(new RentcarProperty("bmx", 10));
noobspawnVehicleProperties.Add(new RentcarProperty("faggio3", 50)); noobspawnVehicleProperties.Add(new RentcarProperty("faggio3", 50));
noobspawnVehicleProperties.Add(new RentcarProperty("panto", 200));
stadthalleVehicleProperties.Add(new RentcarProperty("bmx", 10)); stadthalleVehicleProperties.Add(new RentcarProperty("bmx", 10));
stadthalleVehicleProperties.Add(new RentcarProperty("faggio3", 50)); stadthalleVehicleProperties.Add(new RentcarProperty("faggio3", 50));
stadthalleVehicleProperties.Add(new RentcarProperty("panto", 200));
knastVehicleProperties.Add(new RentcarProperty("bmx", 10)); knastVehicleProperties.Add(new RentcarProperty("bmx", 10));
knastVehicleProperties.Add(new RentcarProperty("faggio3", 50)); knastVehicleProperties.Add(new RentcarProperty("faggio3", 50));
knastVehicleProperties.Add(new RentcarProperty("panto", 200));
paletoVehicleProperties.Add(new RentcarProperty("bmx", 10)); paletoVehicleProperties.Add(new RentcarProperty("bmx", 10));
paletoVehicleProperties.Add(new RentcarProperty("faggio3", 50)); paletoVehicleProperties.Add(new RentcarProperty("faggio3", 50));
paletoVehicleProperties.Add(new RentcarProperty("panto", 200));
lamesaVehicleProperties.Add(new RentcarProperty("bmx", 10)); lamesaVehicleProperties.Add(new RentcarProperty("bmx", 10));
lamesaVehicleProperties.Add(new RentcarProperty("faggio3", 50)); lamesaVehicleProperties.Add(new RentcarProperty("faggio3", 50));
lamesaVehicleProperties.Add(new RentcarProperty("panto", 200));
} }
public static void cancelRent(Player player) public static void cancelRent(Player player)

View File

@@ -112,6 +112,7 @@ namespace ReallifeGamemode.Server.Wanted
user.SetJailTime(false, dbContext); user.SetJailTime(false, dbContext);
user.SetBlipAndNametagColor(); user.SetBlipAndNametagColor();
user.AnnouncePlayerJailedIn(); user.AnnouncePlayerJailedIn();
user.Wanteds = 0;
dbContext.SaveChanges(); dbContext.SaveChanges();
//HERE: Freilauf //HERE: Freilauf
Check_PutBehindBars(user, JailInLocations.Outside); Check_PutBehindBars(user, JailInLocations.Outside);
@@ -134,8 +135,10 @@ namespace ReallifeGamemode.Server.Wanted
if (user.JailTime <= 0) if (user.JailTime <= 0)
{ {
Jailtime.Remove(user.Id); Jailtime.Remove(user.Id);
user.Wanteds = 0;
player.SafeTeleport(JailOut_Point); player.SafeTeleport(JailOut_Point);
player.TriggerEvent("jailTime", 0); player.TriggerEvent("jailTime", 0);
dbContext.SaveChanges();
return; return;
} }
if (user.JailTime > 0) if (user.JailTime > 0)
@@ -175,6 +178,7 @@ namespace ReallifeGamemode.Server.Wanted
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{ {
player.GetUser(dbContext).JailTime = 0; player.GetUser(dbContext).JailTime = 0;
player.GetUser(dbContext).Wanteds = 0;
dbContext.SaveChanges(); dbContext.SaveChanges();
} }
player.SafeSetHealth(100); player.SafeSetHealth(100);
@@ -195,6 +199,7 @@ namespace ReallifeGamemode.Server.Wanted
Jailtime.Remove(user.Id); Jailtime.Remove(user.Id);
user.JailTime = 0; user.JailTime = 0;
user.Wanteds = 0;
dbContext.SaveChanges(); dbContext.SaveChanges();
target.SafeSetHealth(100); target.SafeSetHealth(100);

View File

@@ -49,7 +49,7 @@ namespace ReallifeGamemode.Server.WeaponDeal
return; return;
} }
using (var context = new DatabaseContext(true)) using (var context = new DatabaseContext())
{ {
FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == WEAPON_DEAL_GANG_VEHICLE_HASH || f.Model == WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH) FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.Model == WEAPON_DEAL_GANG_VEHICLE_HASH || f.Model == WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH)
.ToList() .ToList()