Merge develop into feature/inventory-system
This commit is contained in:
347
.gitignore
vendored
347
.gitignore
vendored
@@ -1,15 +1,338 @@
|
||||
bin/*
|
||||
|
||||
obj/*
|
||||
|
||||
Migrations/*
|
||||
|
||||
Properties/*
|
||||
*.csproj
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
!.gitkeep
|
||||
yolo/*
|
||||
/mycmds.cs
|
||||
/Server/Commands/mycmds.cs
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Migrations Folder
|
||||
Migrations/
|
||||
/Properties/launchSettings.json
|
||||
|
||||
@@ -2,7 +2,7 @@ stages:
|
||||
- build
|
||||
|
||||
before_script:
|
||||
- "../database_password.sh"
|
||||
- "../gm_database_password.sh"
|
||||
- "dotnet restore"
|
||||
|
||||
build:
|
||||
@@ -10,4 +10,4 @@ build:
|
||||
only:
|
||||
- develop
|
||||
script:
|
||||
- "dotnet build"
|
||||
- "dotnet build -c ServerBuild"
|
||||
|
||||
5
Client/DoorManager/doormanager.js
Normal file
5
Client/DoorManager/doormanager.js
Normal file
@@ -0,0 +1,5 @@
|
||||
mp.events.add('changeDoorState', (doorHash, x, y, z, locked, p5, p6, p7) => {
|
||||
locked === 1 ? locked = true : locked = false;
|
||||
|
||||
mp.game.object.doorControl(doorHash, x, y, z, locked, p5, p6, p7);
|
||||
});
|
||||
@@ -11,24 +11,6 @@ mp.events.add('manageFactionRanks', (ranks) => {
|
||||
if (manageFactionRanksBrowser !== null) return;
|
||||
manageFactionRanksBrowser = mp.browsers.new('package://FactionManagement/Ranks/index.html');
|
||||
|
||||
//var testRanks = {
|
||||
// FactionId: 3,
|
||||
// Ranks: [
|
||||
// {
|
||||
// Id: 5,
|
||||
// Name: "Officer"
|
||||
// },
|
||||
// {
|
||||
// Id: 6,
|
||||
// Name: "Sergeant"
|
||||
// }
|
||||
// ]
|
||||
//};
|
||||
|
||||
//var json = JSON.stringify(testRanks);
|
||||
|
||||
//mp.events.callRemote('OnFactionRanksEdit', json);
|
||||
|
||||
mp.gui.chat.activate(false);
|
||||
rankData = JSON.parse(ranks);
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ mp.events.add("respawnDeathPlayer", () => {
|
||||
});
|
||||
|
||||
mp.events.add("updateDutyMedics", (count) => {
|
||||
if (count == true)
|
||||
if (count === true)
|
||||
{
|
||||
dutyMedics++;
|
||||
}
|
||||
@@ -70,11 +70,11 @@ mp.events.add("render", () => {
|
||||
if (dutyMedics > 0) {
|
||||
medicString = "Derzeit sind ~g~" + dutyMedics + " Medics ~s~im Dienst ~c~und versuchen dich wiederzubeleben...";
|
||||
} else {
|
||||
medicString = "Derzeit sind ~r~keine Medics ~s~im Dienst."
|
||||
medicString = "Derzeit sind ~r~keine Medics ~s~im Dienst.";
|
||||
}
|
||||
|
||||
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
|
||||
var alpha = fade + (Math.floor((currentDate.getTime() / 1000) - (deathDate.getTime() / 1000)));
|
||||
var alpha = fade + Math.floor(currentDate.getTime() / 1000 - deathDate.getTime() / 1000);
|
||||
if (deathSeconds >= 0) {
|
||||
mp.game.graphics.drawSprite("Mptattoos", "clearout", 0.625, 0.52, 0.1, 0.1, 0, 255, 255, 255, 236);
|
||||
mp.game.graphics.drawText("Respawn in: ~y~" + deathSeconds, [0.5, 0.5],
|
||||
@@ -83,14 +83,14 @@ mp.events.add("render", () => {
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.8, 0.8],
|
||||
outline: true
|
||||
})
|
||||
});
|
||||
mp.game.graphics.drawText(medicString, [0.5, 0.975],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.4, 0.4],
|
||||
outline: true
|
||||
})
|
||||
});
|
||||
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, alpha);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@ var dateString;
|
||||
var timeString;
|
||||
|
||||
var draw = false;
|
||||
var editMode = false;
|
||||
|
||||
let posX = 0.92;
|
||||
let posY = 0.45;
|
||||
@@ -43,6 +44,26 @@ mp.events.add("draw", (pName, pId) => {
|
||||
|
||||
});
|
||||
|
||||
mp.events.add("toggleEditMode", (toggle) => {
|
||||
editMode = toggle;
|
||||
});
|
||||
|
||||
mp.events.add("toggleUi", (show) => {
|
||||
if (show === false) {
|
||||
draw = false;
|
||||
mp.game.ui.displayRadar(false);
|
||||
mp.game.ui.displayHud(false);
|
||||
mp.gui.chat.show(false);
|
||||
globalData.HideGui = true;
|
||||
} else {
|
||||
draw = true;
|
||||
mp.game.ui.displayRadar(true);
|
||||
mp.game.ui.displayHud(true);
|
||||
mp.gui.chat.show(true);
|
||||
globalData.HideGui = false;
|
||||
}
|
||||
});
|
||||
|
||||
//function currencyFormatDE(num) {
|
||||
// return ('$' + num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.'));
|
||||
//}
|
||||
@@ -173,4 +194,13 @@ mp.events.add("render", () => {
|
||||
outline: true
|
||||
})
|
||||
}
|
||||
if (editMode === true) {
|
||||
mp.game.graphics.drawText("~r~EDIT-MODE AKTIV", [0.5, 0],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.7, 0.7],
|
||||
outline: true
|
||||
})
|
||||
}
|
||||
});
|
||||
57
Client/Gui/nametags.js
Normal file
57
Client/Gui/nametags.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const maxDistance = 25 * 25;
|
||||
const width = 0.03;
|
||||
const height = 0.0065;
|
||||
const border = 0.001;
|
||||
const color = [255, 255, 255, 255];
|
||||
|
||||
mp.nametags.enabled = false;
|
||||
|
||||
mp.events.add('render', (nametags) => {
|
||||
const graphics = mp.game.graphics;
|
||||
const screenRes = graphics.getScreenResolution(0, 0);
|
||||
|
||||
nametags.forEach(nametag => {
|
||||
let [player, x, y, distance] = nametag;
|
||||
|
||||
if (distance <= maxDistance) {
|
||||
let scale = distance / maxDistance;
|
||||
if (scale < 0.6) scale = 0.6;
|
||||
|
||||
var health = player.getHealth();
|
||||
health = health < 100 ? 0 : (health - 100) / 100;
|
||||
|
||||
var armour = player.getArmour() / 100;
|
||||
|
||||
y -= scale * (0.005 * (screenRes.y / 1080));
|
||||
|
||||
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.4, 0.4],
|
||||
outline: true
|
||||
});
|
||||
|
||||
if (mp.game.player.isFreeAimingAtEntity(player.handle)) {
|
||||
let y2 = y + 0.042;
|
||||
|
||||
if (armour > 0) {
|
||||
graphics.drawRect(x, y2, width + border * 2, 0.0085, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
|
||||
|
||||
x2 = x + width / 2 + border / 2;
|
||||
|
||||
graphics.drawRect(x, y2 + height, width + border * 2, height + border * 2, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2 + height, width, height, 41, 66, 78, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - armour), y2 + height, width * armour, height, 48, 108, 135, 200);
|
||||
}
|
||||
else {
|
||||
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
|
||||
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
|
||||
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
108
Client/Player/dutycloth.js
Normal file
108
Client/Player/dutycloth.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* @overview Life of German Reallife - Player DutyClothes dutyclothes.js
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
const NativeUI = require("nativeui");
|
||||
const Menu = NativeUI.Menu;
|
||||
const UIMenuItem = NativeUI.UIMenuItem;
|
||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||
const BadgeStyle = NativeUI.BadgeStyle;
|
||||
const Point = NativeUI.Point;
|
||||
const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
|
||||
var hats;
|
||||
var tops;
|
||||
var legs;
|
||||
var shoes;
|
||||
|
||||
var hat = -1;
|
||||
var top;
|
||||
var leg;
|
||||
var shoe;
|
||||
|
||||
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||
|
||||
var dutyMenu;
|
||||
let saveItem = new UIMenuItem("Speichern", "Speichert deine Dienstkleidung");
|
||||
saveItem.BackColor = new Color(13, 71, 161);
|
||||
saveItem.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);
|
||||
|
||||
|
||||
//Cloth Menu
|
||||
|
||||
mp.events.add('showDutyClothMenu', (hatsArr, topsArr, legsArr, shoesArr) => {
|
||||
|
||||
mp.gui.chat.activate(false);
|
||||
hats = hatsArr;
|
||||
tops = topsArr;
|
||||
legs = legsArr;
|
||||
shoes = shoesArr;
|
||||
|
||||
dutyMenu = new Menu("Dienstkleidung", "Stelle deine Dienstkleidung zusammen", new Point(0, screenRes.y/2));
|
||||
|
||||
dutyMenu.AddItem(new UIMenuListItem("Hut", "", new ItemsCollection(hats)));
|
||||
dutyMenu.AddItem(new UIMenuListItem("Top", "", new ItemsCollection(tops)));
|
||||
dutyMenu.AddItem(new UIMenuListItem("Hose", "", new ItemsCollection(legs)));
|
||||
dutyMenu.AddItem(new UIMenuListItem("Schuhe", "", new ItemsCollection(shoes)));
|
||||
dutyMenu.AddItem(saveItem);
|
||||
dutyMenu.AddItem(cancelItem);
|
||||
dutyMenu.Visible = true;
|
||||
|
||||
dutyMenu.ListChange.on((item, index) => {
|
||||
switch (item.Text) {
|
||||
case "Hut":
|
||||
if (item.SelectedItem.DisplayText === "Keinen") {
|
||||
hat = -1;
|
||||
mp.events.callRemote("updateDutyProp", 0, -1);
|
||||
} else {
|
||||
hat = parseInt(item.SelectedItem.DisplayText);
|
||||
mp.events.callRemote("updateDutyProp", 0, hat);
|
||||
}
|
||||
break;
|
||||
case "Top":
|
||||
top = parseInt(item.SelectedItem.DisplayText);
|
||||
mp.events.callRemote("updateDutyCloth", 11, top);
|
||||
break;
|
||||
case "Hose":
|
||||
leg = parseInt(item.SelectedItem.DisplayText);
|
||||
mp.events.callRemote("updateDutyCloth", 4, leg);
|
||||
break;
|
||||
case "Schuhe":
|
||||
shoe = parseInt(item.SelectedItem.DisplayText);
|
||||
mp.events.callRemote("updateDutyCloth", 6, shoe);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
dutyMenu.ItemSelect.on((item) => {
|
||||
if (item.Text === "Speichern") {
|
||||
var slotType = [1, 0, 0, 0];
|
||||
var slotId = [0, 11, 4, 6];
|
||||
var clothId = [hat, top, leg, shoe];
|
||||
mp.events.callRemote("saveCharacterCloth", JSON.stringify(slotType), JSON.stringify(slotId), JSON.stringify(clothId));
|
||||
dutyMenu.Visible = false;
|
||||
mp.gui.chat.activate(true);
|
||||
} else if (item.Text === "Abbrechen") {
|
||||
dutyMenu.Visible = false;
|
||||
mp.gui.chat.activate(true);
|
||||
mp.events.callRemote("defaultCharacterCloth");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dutyMenu.MenuClose.on(() => {
|
||||
dutyMenu.Visible = false;
|
||||
mp.gui.chat.activate(true);
|
||||
mp.events.callRemote("defaultCharacterCloth");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
|
||||
|
||||
var chat = false;
|
||||
<<<<<<< HEAD
|
||||
var showInventory = false;
|
||||
=======
|
||||
var showGui = true;
|
||||
>>>>>>> develop
|
||||
|
||||
//ENTER
|
||||
mp.keys.bind(0x0D, false, function () {
|
||||
@@ -16,7 +20,32 @@ mp.keys.bind(0x0D, false, function () {
|
||||
}
|
||||
});
|
||||
|
||||
//I
|
||||
|
||||
//F7 //Unshowalles
|
||||
mp.keys.bind(0x76, false, function () {
|
||||
if (showGui === true) {
|
||||
showGui = false;
|
||||
mp.events.call("toggleUi", false);
|
||||
} else {
|
||||
showGui = true;
|
||||
mp.events.call("toggleUi", true);
|
||||
}
|
||||
});
|
||||
|
||||
//NUM2 //Save Blips in Edit Mode
|
||||
mp.keys.bind(0x62, false, function () {
|
||||
mp.events.callRemote("keyPress:NUM2");
|
||||
});
|
||||
|
||||
//E
|
||||
mp.keys.bind(0x45, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:E");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//I //Spielerliste
|
||||
mp.keys.bind(0x49, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:I");
|
||||
@@ -24,6 +53,7 @@ mp.keys.bind(0x49, false, function () {
|
||||
}
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
//J
|
||||
mp.keys.bind(0x4A, false, function () {
|
||||
if (showInventory === false) {
|
||||
@@ -36,6 +66,23 @@ mp.keys.bind(0x4A, false, function () {
|
||||
});
|
||||
|
||||
//N
|
||||
=======
|
||||
//K //Dienstkleidung
|
||||
mp.keys.bind(0x4B, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:K");
|
||||
}
|
||||
});
|
||||
|
||||
//L //Türen auf / zuschließen
|
||||
mp.keys.bind(0x4C, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:L");
|
||||
}
|
||||
});
|
||||
|
||||
//N //Motor Starten
|
||||
>>>>>>> develop
|
||||
mp.keys.bind(0x4E, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:N");
|
||||
@@ -49,9 +96,10 @@ mp.keys.bind(0x54, false, function () {
|
||||
}
|
||||
});
|
||||
|
||||
//X
|
||||
//X //Anschnallen
|
||||
mp.keys.bind(0x58, false, function () {
|
||||
if (!chat) {
|
||||
mp.events.callRemote("keyPress:X");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function saveData() {
|
||||
let blipRotation = document.getElementById("blipRotation").value;
|
||||
let blipDimension = document.getElementById("blipDimension").value;
|
||||
|
||||
mp.trigger("saveData", blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension);
|
||||
mp.trigger("saveBlipData", blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension);
|
||||
}
|
||||
|
||||
function cancelData() {
|
||||
@@ -7,12 +7,12 @@ var saveBrowser;
|
||||
|
||||
mp.events.add('saveBlip', () => {
|
||||
|
||||
saveBrowser = mp.browsers.new('package://Save/save.html');
|
||||
saveBrowser = mp.browsers.new('package://Save/blip/save.html');
|
||||
mp.gui.chat.activate(false);
|
||||
mp.gui.cursor.show(true, true);
|
||||
});
|
||||
|
||||
mp.events.add('saveData', (blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension) => {
|
||||
mp.events.add('saveBlipData', (blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension) => {
|
||||
if (saveBrowser) {
|
||||
saveBrowser.destroy();
|
||||
}
|
||||
|
||||
1628
Client/Speedometer/cef/css/style.css
Normal file
1628
Client/Speedometer/cef/css/style.css
Normal file
File diff suppressed because it is too large
Load Diff
3
Client/Speedometer/cef/js/gauge.js
Normal file
3
Client/Speedometer/cef/js/gauge.js
Normal file
File diff suppressed because one or more lines are too long
167
Client/Speedometer/cef/speedometer.html
Normal file
167
Client/Speedometer/cef/speedometer.html
Normal file
@@ -0,0 +1,167 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css\style.css">
|
||||
<script src="js\gauge.js"></script>
|
||||
<script>
|
||||
function update(speed, rpm, gas)
|
||||
{
|
||||
updateSpeed(speed);
|
||||
updateKM(speed);
|
||||
updateRpm(rpm);
|
||||
updateGas(gas);
|
||||
}
|
||||
function updateSpeed(speed)
|
||||
{
|
||||
document.getElementById("tacho").dataset.value = speed;
|
||||
}
|
||||
function updateKM(km)
|
||||
{
|
||||
var kilometerstandt = ( km )
|
||||
document.getElementById("tacho").dataset.valueText = kilometerstandt.toFixed(1) + " km/h";
|
||||
}
|
||||
function updateRpm(rpm)
|
||||
{
|
||||
document.getElementById("rpm").dataset.value = rpm;
|
||||
}
|
||||
function updateGas(gas)
|
||||
{
|
||||
document.getElementById("gas").dataset.value = gas;
|
||||
//if(gas >= 15){
|
||||
// document.getElementById("gasState").innerHTML = ""
|
||||
//}
|
||||
//if(gas < 15){
|
||||
// document.getElementById("gasState").innerHTML = "<img src=\"..\\Images\\gas_critical.png\" width=\"22px\">";
|
||||
//}
|
||||
//if( gas > 15 && gas < 50 ){
|
||||
// document.getElementById("gasState").innerHTML = "<img src=\"..\\Images\\gas_low.png\" width=\"22px\">";
|
||||
//}
|
||||
}
|
||||
function updateHealth(rotation)
|
||||
{
|
||||
if(rotation >= 50){
|
||||
document.getElementById("repairState").innerHTML = ""
|
||||
}
|
||||
if(rotation < 25){
|
||||
document.getElementById("repairState").innerHTML = "<img src=\"..\\Images\\engine_critical.png\" width=\"18px\">";
|
||||
}
|
||||
if( rotation > 25 && rotation < 50 ){
|
||||
document.getElementById("repairState").innerHTML = "<img src=\"..\\Images\\engine_soft.png\" width=\"18px\">";
|
||||
}
|
||||
}
|
||||
|
||||
function showSpeedo()
|
||||
{
|
||||
document.body.className = "fade";
|
||||
}
|
||||
function hideSpeedo()
|
||||
{
|
||||
document.body.className = "";
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.blinker_arrow{
|
||||
color: #FFF;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="hideSpeedo()">
|
||||
<div class="w3-container" style="width:350px; position:fixed; bottom: 60px; right:20px;">
|
||||
<div class="w3-display-container" style="height:200px">
|
||||
<div class="w3-display-middle">
|
||||
<canvas id="tacho" data-type="radial-gauge"
|
||||
data-width="200"
|
||||
data-height="200"
|
||||
data-units="Km/h"
|
||||
data-title="false"
|
||||
data-value="0"
|
||||
data-min-value="0"
|
||||
data-max-value="320"
|
||||
data-major-ticks="0,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,320"
|
||||
data-minor-ticks="2"
|
||||
data-stroke-ticks="false"
|
||||
data-highlights='[
|
||||
{ "from": 200, "to": 320, "color": "rgba(255, 0, 0, .25)" }
|
||||
]'
|
||||
data-border-outer-width=1
|
||||
data-border-middle-width=1
|
||||
data-animation="false"
|
||||
data-color-plate="#222"
|
||||
data-color-major-ticks="#f5f5f5"
|
||||
data-color-minor-ticks="#ddd"
|
||||
data-color-title="#fff"
|
||||
data-color-units="#ccc"
|
||||
data-color-numbers="#eee"
|
||||
data-color-needle-start="rgba(240, 128, 128, 1)"
|
||||
data-color-needle-end="rgba(255, 160, 122, .9)"
|
||||
data-value-box="true"
|
||||
data-value-text="0 Km/h"
|
||||
data-font-value="Arial"
|
||||
></canvas>
|
||||
</div>
|
||||
<div class="w3-display-bottomleft" style="z-index:-5;">
|
||||
<canvas id="gas" data-type="radial-gauge"
|
||||
data-width="100"
|
||||
data-height="100"
|
||||
data-start-angle="20"
|
||||
data-ticks-angle="140"
|
||||
data-title="false"
|
||||
data-value="0"
|
||||
data-min-value="0"
|
||||
data-max-value="100"
|
||||
data-major-ticks="E,F"
|
||||
data-minor-ticks="2"
|
||||
data-stroke-ticks="false"
|
||||
data-value-box="false"
|
||||
data-animation="false"
|
||||
data-highlights='[
|
||||
{ "from": 0, "to": 15, "color": "rgba(255,0,0,.25)" }
|
||||
]'
|
||||
data-border-outer-width=1
|
||||
data-border-middle-width=1
|
||||
data-color-plate="#222"
|
||||
data-color-major-ticks="#f5f5f5"
|
||||
data-color-minor-ticks="#ddd"
|
||||
data-font-numbers-size="32"
|
||||
data-color-title="#fff"
|
||||
data-color-units="#ccc"
|
||||
data-color-numbers="#eee"
|
||||
data-color-needle-start="rgba(240, 128, 128, 1)"
|
||||
data-color-needle-end="rgba(255, 160, 122, .9)"
|
||||
></canvas>
|
||||
</div>
|
||||
<div class="w3-display-bottomright" style="z-index:-5;">
|
||||
<canvas id="rpm" data-type="radial-gauge"
|
||||
data-width="100"
|
||||
data-height="120"
|
||||
data-units="RPM"
|
||||
data-title="false"
|
||||
data-value="0"
|
||||
data-min-value="0"
|
||||
data-max-value="1000"
|
||||
data-major-ticks="0,1,2,3,4,5,6,7,8,9,10"
|
||||
data-minor-ticks="2"
|
||||
data-stroke-ticks="false"
|
||||
data-value-box="false"
|
||||
data-animation="false"
|
||||
data-highlights='[
|
||||
{ "from": 800, "to": 1000, "color": "rgba(255,0,0,.25)" }
|
||||
]'
|
||||
data-border-outer-width=1
|
||||
data-border-middle-width=1
|
||||
data-font-numbers-size="32"
|
||||
data-color-plate="#222"
|
||||
data-color-major-ticks="#f5f5f5"
|
||||
data-color-minor-ticks="#ddd"
|
||||
data-color-title="#fff"
|
||||
data-color-units="#ccc"
|
||||
data-color-numbers="#eee"
|
||||
data-color-needle-start="rgba(240, 128, 128, 1)"
|
||||
data-color-needle-end="rgba(255, 160, 122, .9)"
|
||||
data-font-value="Led"
|
||||
></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
30
Client/Speedometer/index.js
Normal file
30
Client/Speedometer/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
let speedo = mp.browsers.new("package://speedometer/CEF/speedometer.html");
|
||||
let showed = false;
|
||||
let player = mp.players.local;
|
||||
|
||||
mp.events.add('render', () =>
|
||||
{
|
||||
if (player.vehicle && player.vehicle.getPedInSeat(-1) === player.handle && !globalData.InTuning && !globalData.HideGui) // Check if player is in vehicle and is driver
|
||||
{
|
||||
if(showed === false) // Check if speedo is already showed
|
||||
{
|
||||
speedo.execute("showSpeedo();");
|
||||
showed = true;
|
||||
}
|
||||
/*Get vehicle infos*/
|
||||
let vel = player.vehicle.getSpeed() * 3.6; //Doc: https://wiki.rage.mp/index.php?title=Entity::getSpeed
|
||||
let rpm = player.vehicle.rpm * 1000; //Doc: https://wiki.rage.mp/index.php?title=Vehicle::rpm
|
||||
let gas = player.vehicle.getPetrolTankHealth(); //Doc: https://wiki.rage.mp/index.php?title=Vehicle::getPetrolTankHealth
|
||||
gas = gas < 0 ? 0: gas / 10;
|
||||
|
||||
speedo.execute(`update(${vel}, ${rpm}, ${gas});`); // Send data do CEF
|
||||
}
|
||||
else
|
||||
{
|
||||
if(showed)
|
||||
{
|
||||
speedo.execute("hideSpeedo();");
|
||||
showed = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
var keyBound = false;
|
||||
|
||||
var carModTypes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 22, 23];
|
||||
var carModTypes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 22, 25, 27, 28, 30, 33, 34, 35, 38, 46, 48];
|
||||
|
||||
var carModSlotName = [
|
||||
{ Slot: 0, Name: "Spoiler" }, // 0
|
||||
@@ -39,6 +39,33 @@ var customPartNames = [
|
||||
Name: "Lüftungsschlitze"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
Model: 159274291,
|
||||
Names: [
|
||||
{
|
||||
Slot: 8,
|
||||
Name: "Kotflügel"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
Model: 223240013,
|
||||
Names: [
|
||||
{
|
||||
Slot: 9,
|
||||
Name: "Heckkotflügel"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
Model: 1031562256,
|
||||
Names: [
|
||||
{
|
||||
Slot: 5,
|
||||
Name: "Stoßdämpfer"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -56,13 +83,13 @@ const ItemsCollection = NativeUI.ItemsCollection;
|
||||
const Color = NativeUI.Color;
|
||||
const ListItem = NativeUI.ListItem;
|
||||
|
||||
var mainMenu;
|
||||
|
||||
mp.events.add('showTuningInfo', () => {
|
||||
mp.game.ui.setTextComponentFormat('STRING');
|
||||
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Fahrzeug zu modifizieren');
|
||||
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
||||
|
||||
mp.gui.chat.push("Model: " + mp.players.local.vehicle.model);
|
||||
|
||||
mp.keys.bind(0x45, false, keyPressHandler);
|
||||
keyBound = true;
|
||||
});
|
||||
@@ -71,6 +98,11 @@ mp.events.add('hideTuningInfo', (unbind) => {
|
||||
mp.game.ui.clearHelp(true);
|
||||
mp.gui.chat.show(true);
|
||||
|
||||
if (typeof mainMenu !== "undefined" && unbind) {
|
||||
mainMenu.Visible = false;
|
||||
globalData.InTuning = false;
|
||||
}
|
||||
|
||||
if (keyBound && unbind) {
|
||||
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||
keyBound = false;
|
||||
@@ -88,7 +120,13 @@ mp.events.add("showTuningMenu", () => {
|
||||
var localPlayer = mp.players.local;
|
||||
var localVehicle = localPlayer.vehicle;
|
||||
|
||||
var mainMenu = new Menu("Fahrzeugwerkstatt", "Modifiziere dein Fahrzeug", new Point(50, 50));
|
||||
if (typeof mainMenu !== "undefined" && mainMenu.Visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
globalData.InTuning = true;
|
||||
|
||||
mainMenu = new Menu("Fahrzeugwerkstatt", "Modifiziere dein Fahrzeug", new Point(50, 50));
|
||||
|
||||
carModTypes.forEach((modType) => {
|
||||
if (localVehicle.getModSlotName(modType) !== "undefined") {
|
||||
@@ -99,6 +137,8 @@ mp.events.add("showTuningMenu", () => {
|
||||
if (slotName === undefined) slotName = getSlotName(modType);
|
||||
}
|
||||
|
||||
if (slotName === "undefined") slotName = "Slot " + modType;
|
||||
|
||||
var menuItem = new UIMenuItem(slotName);
|
||||
|
||||
if(localVehicle.getNumMods(modType) !== 0) mainMenu.AddItem(menuItem);
|
||||
@@ -107,25 +147,60 @@ mp.events.add("showTuningMenu", () => {
|
||||
|
||||
mainMenu.Visible = true;
|
||||
|
||||
mainMenu.ItemSelect.on(item => {
|
||||
mainMenu.ItemSelect.on((item) => {
|
||||
var modSlot = getSlotId(item.Text);
|
||||
var currentMod = localVehicle.getMod(modSlot);
|
||||
var currentModItem;
|
||||
|
||||
if (item.Text.startsWith("Slot")) {
|
||||
restStr = item.Text.substring(5);
|
||||
modSlot = parseInt(restStr);
|
||||
}
|
||||
|
||||
var modNum = localVehicle.getNumMods(modSlot);
|
||||
|
||||
var modMenu = new Menu(item.Text, "Änderung: " + item.Text, new Point(50, 50));
|
||||
|
||||
modMenu.AddItem(new UIMenuItem("Serie", ""));
|
||||
for (var i = -1; i < modNum; i++) {
|
||||
var modItem;
|
||||
|
||||
for (var i = 0; i < modNum; i++) {
|
||||
var modName = localVehicle.getModTextLabel(modSlot, i);
|
||||
var realModName = mp.game.ui.getLabelText(modName);
|
||||
var modItem = new UIMenuItem(realModName, "");
|
||||
if (i === -1) {
|
||||
modItem = new UIMenuItem("Serie", "");
|
||||
} else {
|
||||
var modName = localVehicle.getModTextLabel(modSlot, i);
|
||||
var realModName = mp.game.ui.getLabelText(modName);
|
||||
modItem = new UIMenuItem(realModName, "");
|
||||
}
|
||||
|
||||
if (i === currentMod) {
|
||||
modItem.SetRightBadge(BadgeStyle.Car);
|
||||
currentModItem = modItem;
|
||||
modFound = true;
|
||||
}
|
||||
|
||||
modMenu.AddItem(modItem);
|
||||
}
|
||||
|
||||
modMenu.IndexChange.on(index => {
|
||||
modMenu.ItemSelect.on((selectedItem, index) => {
|
||||
if (currentModItem !== undefined) {
|
||||
currentModItem.SetRightBadge(BadgeStyle.None);
|
||||
}
|
||||
if (selectedItem !== undefined) {
|
||||
selectedItem.SetRightBadge(BadgeStyle.Car);
|
||||
currentModItem = selectedItem;
|
||||
}
|
||||
mp.events.callRemote("setVehicleMod", modSlot, index);
|
||||
if (index === 0) index = -1;
|
||||
currentMod = index - 1;
|
||||
});
|
||||
|
||||
modMenu.IndexChange.on((index) => {
|
||||
if (index === 0) index = -1;
|
||||
localVehicle.setMod(modSlot, index - 1);
|
||||
});
|
||||
|
||||
modMenu.MenuClose.on(() => {
|
||||
localVehicle.setMod(modSlot, currentMod);
|
||||
});
|
||||
|
||||
modMenu.MenuClose.on(() => {
|
||||
@@ -138,11 +213,16 @@ mp.events.add("showTuningMenu", () => {
|
||||
});
|
||||
|
||||
mainMenu.MenuClose.on(() => {
|
||||
globalData.InTuning = false;
|
||||
mp.events.call("hideTuningInfo", false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
mp.events.add("playerLeaveVehicle", () => {
|
||||
mp.events.call("hideTuningInfo", true);
|
||||
});
|
||||
|
||||
function getSlotName(slot) {
|
||||
var toReturn = "undefined";
|
||||
|
||||
|
||||
@@ -4,20 +4,30 @@
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
let globalData = {
|
||||
InTuning: false,
|
||||
HideGui: false
|
||||
};
|
||||
|
||||
require('./CharCreator/index.js');
|
||||
|
||||
require('./Login/main.js');
|
||||
require('./FactionManagement/main.js');
|
||||
|
||||
require('./Save/main.js');
|
||||
require('./DoorManager/doormanager.js');
|
||||
|
||||
require('./Gui/deathscreen.js');
|
||||
require('./Gui/infobox.js');
|
||||
require('./Gui/nametags.js');
|
||||
require('./Gui/playerlist.js');
|
||||
require('./Gui/Inventory/inventory.js');
|
||||
|
||||
require('./Login/main.js');
|
||||
|
||||
require('./Player/dutycloth.js');
|
||||
require('./Player/keys.js');
|
||||
|
||||
require('./FactionManagement/main.js');
|
||||
require('./Save/main.js');
|
||||
|
||||
require('./Tuning/main.js');
|
||||
require('./Speedometer/index.js');
|
||||
|
||||
require('./Tuning/main.js');
|
||||
|
||||
25
Main.cs
25
Main.cs
@@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Managers;
|
||||
using reallife_gamemode.Server.Saves;
|
||||
using reallife_gamemode.Server.Util;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Main Class (Main.cs)
|
||||
@@ -22,6 +24,8 @@ namespace reallife_gamemode
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
{
|
||||
NAPI.Server.SetGlobalServerChat(false);
|
||||
|
||||
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
||||
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
|
||||
NAPI.Server.SetAutoSpawnOnConnect(false);
|
||||
@@ -29,17 +33,22 @@ namespace reallife_gamemode
|
||||
NAPI.Data.SetWorldData("playerCreatorDimension", 0);
|
||||
|
||||
InventoryManager.LoadItems();
|
||||
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5));
|
||||
DatabaseHelper.InitDatabaseFirstTime();
|
||||
FactionHelper.CheckFactionBankAccounts();
|
||||
|
||||
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5), new Vector3(-334, -143, 41));
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
TempBlip tempBlip = new TempBlip()
|
||||
{
|
||||
context.Bans.FirstOrDefault();
|
||||
Color = 1,
|
||||
Name = "",
|
||||
Transparency = 0,
|
||||
ShortRange = true,
|
||||
Sprite = 1,
|
||||
Scale = 1,
|
||||
};
|
||||
|
||||
context.Factions.FirstOrDefault();
|
||||
context.Users.FirstOrDefault();
|
||||
context.SaveChanges();
|
||||
}
|
||||
NAPI.Data.SetWorldData("blipTemplate", tempBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - DatabaseContext.cs
|
||||
@@ -37,11 +31,15 @@ namespace reallife_gamemode.Model
|
||||
}
|
||||
|
||||
//User
|
||||
public DbSet<Server.Entities.Ban> Bans { get; set; }
|
||||
public DbSet<Server.Entities.Character> Characters { get; set; }
|
||||
public DbSet<Server.Entities.CharacterCloth> CharacterClothes { get; set; }
|
||||
public DbSet<Server.Entities.DutyCloth> DutyClothes { get; set; }
|
||||
public DbSet<Server.Entities.ClothCombination> ClothCombinations { get; set; }
|
||||
public DbSet<Server.Entities.User> Users { get; set; }
|
||||
public DbSet<Server.Entities.UserVehicle> UserVehicles { get; set; }
|
||||
public DbSet<Server.Entities.UserBankAccount> UserBankAccounts { get; set; }
|
||||
public DbSet<Server.Entities.Ban> Bans { get; set; }
|
||||
public DbSet<Server.Entities.Character> Characters { get; set; }
|
||||
|
||||
|
||||
//Inventar
|
||||
public DbSet<Server.Entities.UserItem> UserItems { get; set; }
|
||||
@@ -62,6 +60,7 @@ namespace reallife_gamemode.Model
|
||||
|
||||
//Saves
|
||||
public DbSet<Server.Saves.SavedBlip> Blips { get; set; }
|
||||
public DbSet<Server.Entities.Door> Doors { get; set; }
|
||||
public DbSet<Server.Entities.GotoPoint> GotoPoints { get; set; }
|
||||
public DbSet<Server.Saves.SavedMarker> Markers { get; set; }
|
||||
public DbSet<Server.Saves.SavedPed> Peds { get; set; }
|
||||
@@ -69,5 +68,8 @@ namespace reallife_gamemode.Model
|
||||
public DbSet<Server.Saves.SavedTextLabel> TextLabels { get; set; }
|
||||
public DbSet<Server.Saves.SavedVehicle> Vehicles { get; set; }
|
||||
public DbSet<Server.Entities.ShopVehicle> ShopVehicles { get; set; }
|
||||
|
||||
// Control Panel
|
||||
public DbSet<Server.Entities.News> News { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -78,7 +78,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByName(name);
|
||||
Client target = ClientService.GetClientByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
@@ -109,7 +109,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByName(name);
|
||||
Client target = ClientService.GetClientByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
@@ -149,7 +149,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByName(name);
|
||||
Client target = ClientService.GetClientByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
@@ -239,27 +239,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("duty", "~m~Benutzung: ~s~/duty")]
|
||||
public void CmdFactionDuty(Client player)
|
||||
{
|
||||
if (player.GetUser()?.FactionId == null)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.GetData("duty") != true)
|
||||
{
|
||||
player.SetData("duty", true);
|
||||
player.SendNotification("Du bist nun ~g~im Dienst.");
|
||||
if(player.GetUser().FactionId == 2)
|
||||
{
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetData("duty", false);
|
||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -27,9 +27,18 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
player.ResetData("accept_data");
|
||||
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
Client leader = NAPI.Player.GetPlayerFromHandle((NetHandle)player.GetData("accept_invite"));
|
||||
|
||||
if(leader == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Die Einladung ist abgelaufen.");
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.User u = leader.GetUser(dbContext);
|
||||
Entities.User own = player.GetUser(dbContext);
|
||||
|
||||
|
||||
28
Server/Entities/CharacterCloth.cs
Normal file
28
Server/Entities/CharacterCloth.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities CharacterCloth CharacterCloth.cs
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class CharacterCloth
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[ForeignKey("User")]
|
||||
public int UserId { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
public bool Duty { get; set; }
|
||||
|
||||
public byte SlotType { get; set; }
|
||||
public int SlotId { get; set; }
|
||||
public int ClothId { get; set; }
|
||||
}
|
||||
}
|
||||
25
Server/Entities/ClothCombination.cs
Normal file
25
Server/Entities/ClothCombination.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities MaleCombination (MaleCombination.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class ClothCombination
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public bool Gender { get; set; }
|
||||
public int Top { get; set; }
|
||||
public int Torso { get; set; }
|
||||
public int Undershirt { get; set; }
|
||||
}
|
||||
}
|
||||
33
Server/Entities/Door.cs
Normal file
33
Server/Entities/Door.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities Door (Door.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class Door
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Locked { get; set; }
|
||||
public int Model { get; set; }
|
||||
public float X { get; set; }
|
||||
public float Y { get; set; }
|
||||
public float Z { get; set; }
|
||||
public float Radius { get; set; }
|
||||
|
||||
[ForeignKey("FactionId")]
|
||||
public int? FactionId { get; set; }
|
||||
public Faction Faction { get; set; }
|
||||
}
|
||||
}
|
||||
31
Server/Entities/DutyCloth.cs
Normal file
31
Server/Entities/DutyCloth.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities DutyCloth DutyCloth.cs
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class DutyCloth
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[ForeignKey("Faction")]
|
||||
public int FactionId { get; set; }
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
public bool Gender { get; set; }
|
||||
|
||||
public byte SlotType { get; set; }
|
||||
public int SlotId { get; set; }
|
||||
public int ClothId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
@@ -13,14 +16,28 @@ using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class Faction
|
||||
public class Faction : IBankAccountOwner
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
[StringLength(32)]
|
||||
public string Name { get; set; }
|
||||
public int BankAccount { get; set; }
|
||||
public bool StateOwned { get; set; }
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Text;
|
||||
*/
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class FactionBankAccount
|
||||
public class FactionBankAccount : IBankAccount
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
||||
24
Server/Entities/News.cs
Normal file
24
Server/Entities/News.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class News
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[ForeignKey("User")]
|
||||
public int? UserId { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
public string Caption { get; set; }
|
||||
public string Content { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public int Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,7 +17,7 @@ using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class User
|
||||
public class User : IBankAccountOwner
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -28,8 +29,8 @@ namespace reallife_gamemode.Server.Entities
|
||||
[StringLength(64)]
|
||||
public string Password { get; set; }
|
||||
public int LogUserId { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] RegistrationDate { get; set; }
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public DateTime RegistrationDate { get; set; }
|
||||
|
||||
[EmailAddress]
|
||||
[StringLength(64)]
|
||||
@@ -122,12 +123,11 @@ namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
using (var unbanUser = new DatabaseContext())
|
||||
{
|
||||
var targetUser = unbanUser.Bans.FirstOrDefault(u => u.Id == BanId);
|
||||
unbanUser.Bans.Remove(targetUser);
|
||||
User user = admin.GetUser();
|
||||
var targetUser = unbanUser.Users.FirstOrDefault(u => u.Id == user.Id);
|
||||
targetUser.BanId = null;
|
||||
unbanUser.SaveChanges();
|
||||
}
|
||||
admin.SendChatMessage(this.Name + " wurde entbannt.");
|
||||
//TODO ***Admin Info: {ADMIN-NAME} hat {USER-NAME} entbannt.
|
||||
}
|
||||
|
||||
public List<UserItem> GetItems()
|
||||
@@ -138,5 +138,20 @@ namespace reallife_gamemode.Server.Entities
|
||||
}
|
||||
}
|
||||
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
|
||||
|
||||
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
|
||||
{
|
||||
if (databaseContext == null)
|
||||
{
|
||||
using (databaseContext = new DatabaseContext())
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ using System.Linq;
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class UserBankAccount
|
||||
public class UserBankAccount : IBankAccount
|
||||
{
|
||||
[NotMapped]
|
||||
private int _balance;
|
||||
|
||||
[Key]
|
||||
@@ -38,7 +39,7 @@ namespace reallife_gamemode.Server.Entities
|
||||
_balance = value;
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
ClientService.GetClientByName(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
||||
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
Server/Events/Chat.cs
Normal file
13
Server/Events/Chat.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace reallife_gamemode.Server.Events
|
||||
{
|
||||
public class Chat : Script
|
||||
{
|
||||
[ServerEvent(Event.ChatMessage)]
|
||||
public void ChatEvent(Client player, string message)
|
||||
{
|
||||
NAPI.Player.GetPlayersInRadiusOfPlayer(10, player).ForEach(p => p.SendChatMessage($"{player.Name} sagt: {message}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,7 @@ namespace reallife_gamemode.Server.Events
|
||||
"datgame_",
|
||||
"xSprite",
|
||||
"xPrike",
|
||||
"balboistderbeste",
|
||||
"xNccPlay",
|
||||
"Marvino01"
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +73,7 @@ namespace reallife_gamemode.Server.Events
|
||||
if (bannedUser.Applied == bannedUser.UntilDateTime)
|
||||
{
|
||||
player.SendChatMessage("!{#FF4040}Du wurdest permanent gebannt! [" + bannedUser.Reason + "]");
|
||||
//player.Kick();
|
||||
player.Kick();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -86,14 +83,14 @@ namespace reallife_gamemode.Server.Events
|
||||
if(timeStamp > unixTimestamp)
|
||||
{
|
||||
player.SendChatMessage("Du bist noch bis zum !{#FF4040}" + dt.AddSeconds(timeStamp).ToLocalTime() + " Uhr ~s~gebannt. [" + bannedUser.Reason + "]");
|
||||
player.Kick();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.GetUser().BanId = null;
|
||||
user.BanId = null;
|
||||
loginUser.SaveChanges();
|
||||
player.TriggerEvent("showLogin");
|
||||
}
|
||||
//player.Kick();
|
||||
}
|
||||
}
|
||||
}
|
||||
else player.TriggerEvent("showLogin");
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Managers;
|
||||
using reallife_gamemode.Server.Saves;
|
||||
using reallife_gamemode.Server.Services;
|
||||
using reallife_gamemode.Server.Util;
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Key (Key.cs)
|
||||
@@ -14,6 +21,81 @@ namespace reallife_gamemode.Server.Events
|
||||
{
|
||||
public class Key : Script
|
||||
{
|
||||
[RemoteEvent("keyPress:NUM2")]
|
||||
public void KeyPressNUM2(Client player)
|
||||
{
|
||||
if(player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||
{
|
||||
TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate");
|
||||
SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(),
|
||||
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
|
||||
player.SendNotification("~y~Blip~s~ erstellt!", false);
|
||||
}
|
||||
}
|
||||
[RemoteEvent("keyPress:E")]
|
||||
public void KeyPressE(Client player)
|
||||
{
|
||||
var user = player.GetUser();
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
DutyPoint nearest = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5);
|
||||
if (nearest == null) return;
|
||||
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
|
||||
{
|
||||
var nameTagColor = new Color(0, 0, 0);
|
||||
var factionId = user.FactionId;
|
||||
|
||||
if (player.GetData("duty") == false)
|
||||
{
|
||||
player.SetData("duty", true);
|
||||
player.SendNotification("Du bist nun ~g~im Dienst.");
|
||||
if (player.GetUser().FactionId == 2) //Fire Department
|
||||
{
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", true);
|
||||
}
|
||||
switch (factionId)
|
||||
{
|
||||
//LSPD
|
||||
case 1:
|
||||
nameTagColor = new Color(28, 134, 238);
|
||||
break;
|
||||
}
|
||||
player.NametagColor = nameTagColor;
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
List<CharacterCloth> clothes = context.CharacterClothes.ToList().FindAll(u => u.UserId == user.Id && u.Duty == true);
|
||||
|
||||
foreach(var cloth in clothes)
|
||||
{
|
||||
if(cloth.SlotType == 0)
|
||||
{
|
||||
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cloth.ClothId != -1)
|
||||
{
|
||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ClearAccessory(cloth.SlotId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetData("duty", false);
|
||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||
player.NametagColor = new Color(255, 255, 255);
|
||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[RemoteEvent("keyPress:I")]
|
||||
public void KeyPressI(Client player)
|
||||
{
|
||||
@@ -31,36 +113,78 @@ namespace reallife_gamemode.Server.Events
|
||||
}
|
||||
player.TriggerEvent("fetchPlayerList", JsonConvert.SerializeObject(ListPlayers));
|
||||
}
|
||||
[RemoteEvent("keyPress:K")]
|
||||
public void KeyPressK(Client player)
|
||||
{
|
||||
var user = player.GetUser();
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
DutyPoint nearest = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5);
|
||||
if (nearest == null) return;
|
||||
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
|
||||
{
|
||||
List<string> hats = new List<string>();
|
||||
List<string> tops = new List<string>();
|
||||
List<string> legs = new List<string>();
|
||||
List<string> shoes = new List<string>();
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
List<DutyCloth> clothes = context.DutyClothes.ToList().FindAll(c => c.FactionId == user.FactionId && c.Gender == user.GetCharacter().Gender);
|
||||
foreach(var cloth in clothes)
|
||||
{
|
||||
if(cloth.SlotType == 1)
|
||||
{
|
||||
if (cloth.ClothId != -1)
|
||||
{
|
||||
hats.Add(cloth.ClothId.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
hats.Add("Keinen");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (cloth.SlotId)
|
||||
{
|
||||
case 11:
|
||||
tops.Add(cloth.ClothId.ToString());
|
||||
break;
|
||||
case 4:
|
||||
legs.Add(cloth.ClothId.ToString());
|
||||
break;
|
||||
case 6:
|
||||
shoes.Add(cloth.ClothId.ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
[RemoteEvent("keyPress:L")]
|
||||
public void KeyPressL(Client player)
|
||||
{
|
||||
DoorManager.ChangeDoorState(player);
|
||||
}
|
||||
[RemoteEvent("keyPress:N")]
|
||||
public void KeyPressN(Client player)
|
||||
{
|
||||
if (NAPI.Player.IsPlayerInAnyVehicle(player))
|
||||
if (player.IsInVehicle && player.VehicleSeat == -1)
|
||||
{
|
||||
bool engineStatus = NAPI.Vehicle.GetVehicleEngineStatus(player.Vehicle);
|
||||
if (engineStatus == false)
|
||||
{
|
||||
player.Vehicle.EngineStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Vehicle.EngineStatus = false;
|
||||
}
|
||||
player.Vehicle.EngineStatus = !player.Vehicle.EngineStatus;
|
||||
}
|
||||
}
|
||||
[RemoteEvent("keyPress:X")]
|
||||
public void KeyPressX(Client player)
|
||||
{
|
||||
if (NAPI.Player.IsPlayerInAnyVehicle(player))
|
||||
if (player.IsInVehicle)
|
||||
{
|
||||
if (player.Seatbelt == false)
|
||||
{
|
||||
player.Seatbelt = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Seatbelt = false;
|
||||
}
|
||||
player.Seatbelt = !player.Seatbelt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@ namespace reallife_gamemode.Server.Events
|
||||
player.SetData("spec", true);
|
||||
player.SetData("duty", false);
|
||||
|
||||
if(user.IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||
{
|
||||
player.SetData("editmode", false);
|
||||
}
|
||||
|
||||
var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id);
|
||||
userBankAccount.Balance = userBankAccount.Balance;
|
||||
|
||||
@@ -66,8 +71,9 @@ namespace reallife_gamemode.Server.Events
|
||||
else
|
||||
{
|
||||
CharacterCreator.ApplyCharacter(player);
|
||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
||||
player.TriggerEvent("draw", player.Name, player.Handle.Value);
|
||||
player.TriggerEvent("draw", player.Name, player.Handle.Value);
|
||||
}
|
||||
if (user.Dead == true)
|
||||
{
|
||||
|
||||
156
Server/Events/UpdateCharacterCloth.cs
Normal file
156
Server/Events/UpdateCharacterCloth.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
|
||||
namespace reallife_gamemode.Server.Events
|
||||
{
|
||||
public class UpdateCharacterCloth : Script
|
||||
{
|
||||
[RemoteEvent("updateDutyProp")]
|
||||
public void UpdateDutyProp(Client player, int componentId, int componentVariation)
|
||||
{
|
||||
if (componentId != -1)
|
||||
{
|
||||
player.SetAccessories(componentId, componentVariation, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ClearAccessory(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RemoteEvent("updateDutyCloth")]
|
||||
public void UpdateDutyCloth(Client player, int componentId, int componentVariation)
|
||||
{
|
||||
if (componentId == 11)
|
||||
{
|
||||
//TODO Spezielle Duty Kleidung in Datenbank einpflegen (Ergibt bei Cop-Kleidung NULL)
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
var character = player.GetUser().GetCharacter();
|
||||
|
||||
var combination = context.ClothCombinations.FirstOrDefault(c => c.Top == componentVariation && c.Gender == character.Gender);
|
||||
player.SetClothes(11, componentVariation, 0);
|
||||
if (combination != null)
|
||||
{
|
||||
player.SetClothes(3, combination.Torso, 0);
|
||||
player.SetClothes(8, combination.Undershirt, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetClothes(componentId, componentVariation, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("saveCharacterCloth")]
|
||||
public void SaveDutyCloth(Client client, string JSlotType, string JSlotId, string JClothId)
|
||||
{
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
int[] slotType = JsonConvert.DeserializeObject<int[]>(JSlotType);
|
||||
int[] slotId = JsonConvert.DeserializeObject<int[]>(JSlotId);
|
||||
int[] clothId = JsonConvert.DeserializeObject<int[]>(JClothId);
|
||||
|
||||
User user = client.GetUser();
|
||||
user = context.Users.FirstOrDefault(u => u.Id == user.Id);
|
||||
|
||||
var character = client.GetUser().GetCharacter();
|
||||
|
||||
var charClothes = context.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id);
|
||||
if (charClothes == null)
|
||||
{
|
||||
for (var x = 0; x < slotType.Length; x++)
|
||||
{
|
||||
CharacterCloth newCloth = new CharacterCloth
|
||||
{
|
||||
UserId = user.Id,
|
||||
|
||||
Duty = true,
|
||||
|
||||
SlotType = (byte)slotType[x],
|
||||
SlotId = slotId[x],
|
||||
ClothId = clothId[x]
|
||||
};
|
||||
context.CharacterClothes.Add(newCloth);
|
||||
}
|
||||
if (user.GetCharacter().Gender == false)
|
||||
{
|
||||
CharacterCloth newTorso = new CharacterCloth
|
||||
{
|
||||
UserId = user.Id,
|
||||
|
||||
Duty = true,
|
||||
|
||||
SlotType = 0,
|
||||
SlotId = 3,
|
||||
ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Torso
|
||||
};
|
||||
CharacterCloth newUndershirt = new CharacterCloth
|
||||
{
|
||||
UserId = user.Id,
|
||||
|
||||
Duty = true,
|
||||
|
||||
SlotType = 0,
|
||||
SlotId = 8,
|
||||
ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Undershirt
|
||||
};
|
||||
context.CharacterClothes.Add(newTorso);
|
||||
context.CharacterClothes.Add(newUndershirt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var x = 0; x < slotType.Length; x++)
|
||||
{
|
||||
var loopCloth = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == slotType[x] && u.SlotId == slotId[x]);
|
||||
loopCloth.ClothId = clothId[x];
|
||||
}
|
||||
CharacterCloth torso = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == 0 && u.SlotId == 3);
|
||||
CharacterCloth undershirt = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == 0 && u.SlotId == 8);
|
||||
|
||||
torso.ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Torso;
|
||||
undershirt.ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Undershirt;
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
LoadCharacterDefaults(client);
|
||||
}
|
||||
|
||||
[RemoteEvent("defaultCharacterCloth")]
|
||||
public static void LoadCharacterDefaults(Client player)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
List<CharacterCloth> charClothes = context.CharacterClothes.ToList().FindAll(c => c.UserId == user.Id && c.Duty == false);
|
||||
player.ClearAccessory(0);
|
||||
player.ClearAccessory(1);
|
||||
player.ClearAccessory(2);
|
||||
player.ClearAccessory(6);
|
||||
player.ClearAccessory(7);
|
||||
|
||||
foreach (var cloth in charClothes)
|
||||
{
|
||||
if(cloth.SlotType == 1)
|
||||
{
|
||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Server/Extensions/AdminLevelExtension.cs
Normal file
35
Server/Extensions/AdminLevelExtension.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using reallife_gamemode.Server.Util;
|
||||
using static reallife_gamemode.Server.Util.AdminLevel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class AdminLevelExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt den richtigen Namen eines Admin Levels zurück
|
||||
/// </summary>
|
||||
/// <param name="level">Das Admin Level, dessen Namen man bekommen möchte</param>
|
||||
/// <returns></returns>
|
||||
public static string GetName(this AdminLevel level)
|
||||
{
|
||||
switch(level)
|
||||
{
|
||||
case SUPPORTER:
|
||||
return "Supporter";
|
||||
case ADMIN:
|
||||
case ADMIN2:
|
||||
case ADMIN3:
|
||||
return "Admin";
|
||||
case HEADADMIN:
|
||||
return "Headadmin";
|
||||
case PROJEKTLEITUNG:
|
||||
return "Projektleiter";
|
||||
default:
|
||||
return "Spieler";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,13 @@ namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class ClientExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt das User-Objekt eines Client's zurück.
|
||||
/// Gibt nichts zurück, wenn der Client nicht eingeloggt ist
|
||||
/// </summary>
|
||||
/// <param name="client">Der Client, dessen User man bekommen möchte</param>
|
||||
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
|
||||
/// <returns></returns>
|
||||
public static User GetUser(this Client client, DatabaseContext context = null)
|
||||
{
|
||||
if (!client.IsLoggedIn()) return null;
|
||||
@@ -35,6 +42,26 @@ namespace reallife_gamemode.Server.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
public static Character GetCharacter(this User user, DatabaseContext context = null)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt zurück, ob ein Client eingeloggt ist
|
||||
/// </summary>
|
||||
/// <param name="player">Der Client, dessen Login-Status man bekommen möchte</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsLoggedIn(this Client player)
|
||||
{
|
||||
return player.HasData("isLoggedIn") ? player.GetData("isLoggedIn") : false;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using GTANetworkAPI;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Faction Extension (FactionExtension.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class FactionExtension
|
||||
{
|
||||
public static FactionBankAccount GetFactionBankAccount(this Faction faction, DatabaseContext context = null)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return context.FactionBankAccounts.FirstOrDefault(u => u.FactionId == faction.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.FactionBankAccounts.FirstOrDefault(u => u.FactionId == faction.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using GTANetworkAPI;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - User Extension (UserExtension.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class UserExtension
|
||||
{
|
||||
public static UserBankAccount GetUserBankAccount(this User user, DatabaseContext context = null)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return context.UserBankAccounts.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.UserBankAccounts.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
public static Character GetUserCharacter(this User user, DatabaseContext context = null)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
using (context = new DatabaseContext())
|
||||
{
|
||||
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.Characters.FirstOrDefault(u => u.UserId == user.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,11 @@ namespace reallife_gamemode.Server.Extensions
|
||||
{
|
||||
public static class VehicleExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Gibt zurück, ob das Vehicle ein Fraktions-Fahrzeug ist
|
||||
/// </summary>
|
||||
/// <param name="vehicle">Das Vehicle, von dem man wissen möchte, ob es ein Fraktionsfahrzeug ist</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsFactionVehicle(this Vehicle vehicle)
|
||||
{
|
||||
return LoadManager.FactionVehicleList.Contains(vehicle);
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace reallife_gamemode.Server.Logs
|
||||
public int Fee { get; set; }
|
||||
[StringLength(32)]
|
||||
public string Origin { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace reallife_gamemode.Server.Logs
|
||||
|
||||
[StringLength(64)]
|
||||
public string CauseOfDeath { get; set; }
|
||||
[Timestamp]
|
||||
public byte[] Timestamp { get; set; }
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public DateTime Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Util;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Managers BankManager (BankManager.cs)
|
||||
@@ -17,99 +18,42 @@ namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
public class BankManager : Script
|
||||
{
|
||||
public static void TransferUserMoneyToUser(User sender, User receiver, int amount, string origin)
|
||||
public static TransactionResult TransferMoney(IBankAccountOwner sender, IBankAccountOwner receiver, int amount, string origin)
|
||||
{
|
||||
using (var transferMoney = new Model.DatabaseContext())
|
||||
{
|
||||
if (amount < 0) return TransactionResult.NEGATIVE_MONEY_SENT;
|
||||
|
||||
IBankAccount senderAccount = sender.GetBankAccount(transferMoney);
|
||||
IBankAccount receiverAccount = receiver.GetBankAccount(transferMoney);
|
||||
|
||||
if (senderAccount == null) return TransactionResult.SENDER_NO_BANKACCOUNT;
|
||||
if (receiverAccount == null) return TransactionResult.RECEIVER_NO_BANKACCOUNT;
|
||||
|
||||
if (senderAccount.Balance < amount) return TransactionResult.SENDER_NOT_ENOUGH_MONEY;
|
||||
|
||||
var transactionLog = new Logs.BankAccountTransactionHistory
|
||||
{
|
||||
Sender = sender.Name,
|
||||
SenderBalance = sender.GetUserBankAccount().Balance,
|
||||
MoneySent = amount,
|
||||
SenderBalance = senderAccount.Balance,
|
||||
Receiver = receiver.Name,
|
||||
ReceiverBalance = receiver.GetUserBankAccount().Balance,
|
||||
NewReceiverBalance = receiver.GetUserBankAccount().Balance + amount,
|
||||
NewSenderBalance = sender.GetUserBankAccount().Balance - amount,
|
||||
ReceiverBalance = receiverAccount.Balance,
|
||||
NewReceiverBalance = receiverAccount.Balance + amount,
|
||||
NewSenderBalance = senderAccount.Balance - amount,
|
||||
MoneySent = amount,
|
||||
Fee = 0,
|
||||
Origin = origin
|
||||
};
|
||||
|
||||
// add log
|
||||
transferMoney.BankAccountTransactionLogs.Add(transactionLog);
|
||||
sender.GetUserBankAccount(transferMoney).Balance -= amount;
|
||||
receiver.GetUserBankAccount(transferMoney).Balance += amount;
|
||||
|
||||
senderAccount.Balance -= amount;
|
||||
receiverAccount.Balance += amount;
|
||||
|
||||
transferMoney.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static void TransferUserMoneyToFaction(User sender, Faction receiver, int amount, string origin)
|
||||
{
|
||||
using (var transferMoney = new Model.DatabaseContext())
|
||||
{
|
||||
var transactionLog = new Logs.BankAccountTransactionHistory
|
||||
{
|
||||
Sender = sender.Name,
|
||||
SenderBalance = sender.GetUserBankAccount().Balance,
|
||||
MoneySent = amount,
|
||||
Receiver = receiver.Name,
|
||||
ReceiverBalance = receiver.BankAccount,
|
||||
NewReceiverBalance = receiver.BankAccount + amount,
|
||||
NewSenderBalance = sender.GetUserBankAccount().Balance - amount,
|
||||
Fee = 0,
|
||||
Origin = origin
|
||||
};
|
||||
|
||||
transferMoney.BankAccountTransactionLogs.Add(transactionLog);
|
||||
sender.GetUserBankAccount(transferMoney).Balance -= amount;
|
||||
receiver.BankAccount += amount;
|
||||
transferMoney.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static void TransferFactionMoneyToUser(Faction sender, User receiver, int amount, string origin)
|
||||
{
|
||||
using (var transferMoney = new Model.DatabaseContext())
|
||||
{
|
||||
var transactionLog = new Logs.BankAccountTransactionHistory
|
||||
{
|
||||
Sender = sender.Name,
|
||||
SenderBalance = sender.BankAccount,
|
||||
MoneySent = amount,
|
||||
Receiver = receiver.Name,
|
||||
ReceiverBalance = receiver.GetUserBankAccount().Balance,
|
||||
NewReceiverBalance = receiver.GetUserBankAccount().Balance + amount,
|
||||
NewSenderBalance = sender.BankAccount - amount,
|
||||
Fee = 0,
|
||||
Origin = origin
|
||||
};
|
||||
|
||||
transferMoney.BankAccountTransactionLogs.Add(transactionLog);
|
||||
sender.BankAccount -= amount;
|
||||
receiver.GetUserBankAccount(transferMoney).Balance += amount;
|
||||
transferMoney.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static void TransferFactionMoneyToFaction(Faction sender, Faction receiver, int amount, string origin)
|
||||
{
|
||||
using (var transferMoney = new Model.DatabaseContext())
|
||||
{
|
||||
var transactionLog = new Logs.BankAccountTransactionHistory
|
||||
{
|
||||
Sender = sender.Name,
|
||||
SenderBalance = sender.GetFactionBankAccount().Balance,
|
||||
MoneySent = amount,
|
||||
Receiver = receiver.Name,
|
||||
ReceiverBalance = receiver.BankAccount,
|
||||
NewReceiverBalance = receiver.BankAccount + amount,
|
||||
NewSenderBalance = sender.BankAccount - amount,
|
||||
Fee = 0,
|
||||
Origin = origin
|
||||
};
|
||||
|
||||
transferMoney.BankAccountTransactionLogs.Add(transactionLog);
|
||||
sender.BankAccount -= amount;
|
||||
receiver.BankAccount += amount;
|
||||
transferMoney.SaveChanges();
|
||||
return TransactionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +179,10 @@ namespace reallife_gamemode.Server.Managers
|
||||
player.Dimension = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wendet den Character eines Spielers auf diesen an
|
||||
/// </summary>
|
||||
/// <param name="player">Der Client, dessen Aussehen man setzen will</param>
|
||||
public static void ApplyCharacter(Client player)
|
||||
{
|
||||
var userId = player.GetUser().Id;
|
||||
|
||||
51
Server/Managers/DoorManager.cs
Normal file
51
Server/Managers/DoorManager.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Util;
|
||||
/**
|
||||
* @overview Life of German Reallife - Managers BankManager (BankManager.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
public class DoorManager : Script
|
||||
{
|
||||
public static void ChangeDoorState(Client player)
|
||||
{
|
||||
List<Door> NearDoors = new List<Door>();
|
||||
var user = player.GetUser();
|
||||
|
||||
using (var saveDoor = new DatabaseContext())
|
||||
{
|
||||
NearDoors = saveDoor.Doors.ToList().FindAll(d => new Vector3(d.X, d.Y, d.Z).DistanceTo(player.Position) <= d.Radius);
|
||||
foreach (Door d in NearDoors)
|
||||
{
|
||||
Door currentDoor = saveDoor.Doors.FirstOrDefault(c => c.Id == d.Id);
|
||||
|
||||
if(!user.IsAdmin(AdminLevel.ADMIN) && (d.FactionId != user.FactionId || d.FactionId == null))
|
||||
{
|
||||
string lockState = "~r~Du hast kein Recht diese T\u00fcr " + (d.Locked == true ? "auf" : "ab") + "zuschlie\u00dfen!";
|
||||
player.SendNotification(lockState, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
currentDoor.Locked = !currentDoor.Locked;
|
||||
|
||||
string notStr = d.Name + " " + (d.Locked == false ? "~g~auf" : "~r~ab") + "geschlossen";
|
||||
|
||||
player.SendNotification(notStr, true);
|
||||
|
||||
NAPI.Pools.GetAllPlayers().ForEach(p => p.TriggerEvent("changeDoorState", d.Model, d.X, d.Y, d.Z, (currentDoor.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
saveDoor.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ namespace reallife_gamemode.Server.Managers
|
||||
public static List<Vehicle> ShopVehicleList = new List<Vehicle>();
|
||||
public static List<Vehicle> UserVehicleList = new List<Vehicle>();
|
||||
|
||||
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
{
|
||||
@@ -69,7 +68,7 @@ namespace reallife_gamemode.Server.Managers
|
||||
NAPI.Vehicle.SetVehicleEngineHealth(current, 0);
|
||||
var tLabel = NAPI.TextLabel.CreateTextLabel(v.ModelName + " | " + v.Price + "~g~$", new Vector3(v.PositionX, v.PositionY, v.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false, v.Dimension);
|
||||
current.SetData("shopVehicleId", v.Id);
|
||||
tLabel.AttachTo(current, "SKEL_ROOT", new Vector3(v.PositionX, v.PositionY, v.PositionZ + 1.5), new Vector3(0, 0, 0));
|
||||
tLabel.AttachTo(current, "chassis", new Vector3(0, 0, 1.5), new Vector3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
foreach (UserVehicle v in loadData.UserVehicles)
|
||||
|
||||
41
Server/Managers/PositionManager.cs
Normal file
41
Server/Managers/PositionManager.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
|
||||
namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
public class PositionManager : Script
|
||||
{
|
||||
public static List<DutyPoint> DutyPoints = new List<DutyPoint>();
|
||||
public static List<ColShape> DutyColShapes = new List<ColShape>();
|
||||
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
{
|
||||
DutyPoint dutyPointLSPD = new DutyPoint()
|
||||
{
|
||||
Position = new Vector3(458.24, -990.86, 30.68),
|
||||
FactionId = 1
|
||||
};
|
||||
|
||||
DutyPoints.Add(dutyPointLSPD);
|
||||
|
||||
foreach (DutyPoint d in DutyPoints)
|
||||
{
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(d.Position.X, d.Position.Y, d.Position.Z - 2), new Vector3(d.Position.X, d.Position.Y, d.Position.Z + 1),
|
||||
new Vector3(0,0,0), 3, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DutyPoint
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public int FactionId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace reallife_gamemode.Server.Events
|
||||
public class SaveManager : Script
|
||||
{
|
||||
[RemoteEvent("OnSaveBlipData")]
|
||||
public void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||
public static void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
||||
{
|
||||
float x = player.Position.X;
|
||||
@@ -162,7 +162,7 @@ namespace reallife_gamemode.Server.Events
|
||||
foreach (Vehicle v in LoadManager.FactionVehicleList)
|
||||
{
|
||||
int factionId = v.GetData("factionId");
|
||||
Entities.UserVehicle factionVehicle = saveAll.UserVehicles.FirstOrDefault(u => u.UserId == factionId);
|
||||
Entities.FactionVehicle factionVehicle = saveAll.FactionVehicles.FirstOrDefault(u => u.FactionId == factionId);
|
||||
factionVehicle.PositionX = v.Position.X;
|
||||
factionVehicle.PositionY = v.Position.Y;
|
||||
factionVehicle.PositionZ = v.Position.Z;
|
||||
|
||||
@@ -7,15 +7,19 @@ namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
private static List<ColShape> tuningGarages = new List<ColShape>();
|
||||
|
||||
public static void AddTuningGarage(Vector3 pos1, Vector3 pos2)
|
||||
/// <summary>
|
||||
/// Fügt eine Tuning-Garage zum Spiel hinzu
|
||||
/// </summary>
|
||||
/// <param name="pos">Die Position der Garage</param>
|
||||
public static void AddTuningGarage(Vector3 pos)
|
||||
{
|
||||
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos1, 10, 0);
|
||||
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos, 10, 0);
|
||||
|
||||
colShape.OnEntityEnterColShape += (cs, c) =>
|
||||
{
|
||||
if(c.IsInVehicle)
|
||||
{
|
||||
c.TriggerEvent("showTuningInfo");
|
||||
c.TriggerEvent("showTuningInfo", c.GetData("duty"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -35,4 +35,14 @@ namespace reallife_gamemode.Server.Saves
|
||||
public byte Dimension { get; set; }
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
|
||||
public class TempBlip
|
||||
{
|
||||
public byte Color { get; set; }
|
||||
public string Name { get; set; }
|
||||
public byte Transparency { get; set; }
|
||||
public bool ShortRange { get; set; }
|
||||
public uint Sprite { get; set; }
|
||||
public float Scale { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,11 @@ namespace reallife_gamemode.Server.Services
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Die Aktion wurde nicht ausgeführt.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sendet eine Nachricht an eine Liste von Fraktionen
|
||||
/// </summary>
|
||||
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
|
||||
/// <param name="factions">Die Liste an Fraktionen, die diese Nachricht bekommen sollen</param>
|
||||
public static void BroadcastFaction(string message, List<Faction> factions)
|
||||
{
|
||||
foreach (Client c in NAPI.Pools.GetAllPlayers())
|
||||
@@ -52,11 +57,21 @@ namespace reallife_gamemode.Server.Services
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sendet eine Nachricht an eine Fraktion
|
||||
/// </summary>
|
||||
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
|
||||
/// <param name="f">Die Fraktion, die diese Nachricht bekommen soll</param>
|
||||
public static void BroadcastFaction(string message, Faction f)
|
||||
{
|
||||
BroadcastFaction(message, new List<Faction>() { f });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sendet eine Nachricht an alle Spieler mit einem bestimmten Admin Level
|
||||
/// </summary>
|
||||
/// <param name="message">Die Nachricht, die gesendet werden soll</param>
|
||||
/// <param name="minLevel">Das mindest Admin Level, das für das Erhalten dieser Nachricht benötigt wird</param>
|
||||
public static void BroadcastAdmin(string message, AdminLevel minLevel)
|
||||
{
|
||||
NAPI.Pools.GetAllPlayers().ForEach(p =>
|
||||
|
||||
@@ -13,29 +13,29 @@ namespace reallife_gamemode.Server.Services
|
||||
{
|
||||
class ClientService
|
||||
{
|
||||
public static Client GetClientByName(string name)
|
||||
/// <summary>
|
||||
/// Gibt einen Client anhand seines Namens oder der ID zurück
|
||||
/// </summary>
|
||||
/// <param name="nameOrId">Die ID oder der Name, nach dem gesucht werden soll</param>
|
||||
/// <returns></returns>
|
||||
public static Client GetClientByNameOrId(string nameOrId)
|
||||
{
|
||||
/* Funktionsaufbau: Prüft erst, ob ein Spieler mit exakt diesem Namen online ist
|
||||
* Wenn Ja: Wird dieser zurückgegeben
|
||||
* Wenn Nein: Wird der erste Spieler zurückgegeben, dessen Namen mit dem eingegebenen Parameter übereinstimmt
|
||||
* Gibt "null" zurück, falls kein Client gefunden wurde
|
||||
*/
|
||||
Client toReturn = null;
|
||||
name = name.ToLower();
|
||||
nameOrId = nameOrId.ToLower();
|
||||
|
||||
List<Client> playerList = NAPI.Pools.GetAllPlayers();
|
||||
|
||||
if(int.TryParse(name, out int id))
|
||||
if(int.TryParse(nameOrId, out int id))
|
||||
{
|
||||
toReturn = playerList.Find(p => p.Handle.Value == id);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
toReturn = playerList.Find(p => p.Name.ToLower() == name);
|
||||
toReturn = playerList.Find(p => p.Name.ToLower() == nameOrId);
|
||||
|
||||
if(toReturn == null)
|
||||
{
|
||||
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(name));
|
||||
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(nameOrId));
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
||||
@@ -12,8 +12,12 @@ namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
public enum AdminLevel : int
|
||||
{
|
||||
PLAYER,
|
||||
SUPPORTER,
|
||||
ADMIN
|
||||
PLAYER = 0,
|
||||
SUPPORTER = 1,
|
||||
ADMIN = 2,
|
||||
ADMIN2 = 3,
|
||||
ADMIN3 = 4,
|
||||
HEADADMIN = 1337,
|
||||
PROJEKTLEITUNG = 1338
|
||||
}
|
||||
}
|
||||
|
||||
40
Server/Util/Converter.cs
Normal file
40
Server/Util/Converter.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using GTANetworkAPI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
public class Converter
|
||||
{
|
||||
public static Color HexToColor(string hexColor)
|
||||
{
|
||||
//Remove # if present
|
||||
if (hexColor.IndexOf('#') != -1)
|
||||
hexColor = hexColor.Replace("#", "");
|
||||
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int blue = 0;
|
||||
|
||||
if (hexColor.Length == 6)
|
||||
{
|
||||
//#RRGGBB
|
||||
red = int.Parse(hexColor.Substring(0, 2), NumberStyles.AllowHexSpecifier);
|
||||
green = int.Parse(hexColor.Substring(2, 2), NumberStyles.AllowHexSpecifier);
|
||||
blue = int.Parse(hexColor.Substring(4, 2), NumberStyles.AllowHexSpecifier);
|
||||
}
|
||||
else if (hexColor.Length == 3)
|
||||
{
|
||||
//#RGB
|
||||
red = int.Parse(hexColor[0].ToString() + hexColor[0].ToString(), NumberStyles.AllowHexSpecifier);
|
||||
green = int.Parse(hexColor[1].ToString() + hexColor[1].ToString(), NumberStyles.AllowHexSpecifier);
|
||||
blue = int.Parse(hexColor[2].ToString() + hexColor[2].ToString(), NumberStyles.AllowHexSpecifier);
|
||||
}
|
||||
|
||||
Color returnColor = new Color(red, green, blue);
|
||||
return returnColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Server/Util/DatabaseHelper.cs
Normal file
22
Server/Util/DatabaseHelper.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
class DatabaseHelper
|
||||
{
|
||||
public static void InitDatabaseFirstTime()
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("Initializing database...");
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
dbContext.Users.First();
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Server/Util/FactionHelper.cs
Normal file
37
Server/Util/FactionHelper.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
class FactionHelper
|
||||
{
|
||||
public static void CheckFactionBankAccounts()
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("Checking faction bank accounts...");
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
foreach(Faction faction in dbContext.Factions)
|
||||
{
|
||||
if(faction.GetBankAccount(dbContext) == null)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("Adding bank account for faction: " + faction.Name);
|
||||
FactionBankAccount factionBankAccount = new FactionBankAccount()
|
||||
{
|
||||
Balance = 0,
|
||||
Bic = "",
|
||||
Iban = "",
|
||||
FactionId = faction.Id,
|
||||
Active = true
|
||||
};
|
||||
dbContext.FactionBankAccounts.Add(factionBankAccount);
|
||||
}
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Server/Util/IBankAccount.cs
Normal file
11
Server/Util/IBankAccount.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
public interface IBankAccount
|
||||
{
|
||||
int Balance { get; set; }
|
||||
}
|
||||
}
|
||||
14
Server/Util/IBankAccountOwner.cs
Normal file
14
Server/Util/IBankAccountOwner.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using reallife_gamemode.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
public interface IBankAccountOwner
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
IBankAccount GetBankAccount(DatabaseContext databaseContext = null);
|
||||
}
|
||||
}
|
||||
15
Server/Util/TransactionResult.cs
Normal file
15
Server/Util/TransactionResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Util
|
||||
{
|
||||
public enum TransactionResult
|
||||
{
|
||||
SUCCESS,
|
||||
SENDER_NO_BANKACCOUNT,
|
||||
RECEIVER_NO_BANKACCOUNT,
|
||||
SENDER_NOT_ENOUGH_MONEY,
|
||||
NEGATIVE_MONEY_SENT
|
||||
}
|
||||
}
|
||||
23
build.csproj
23
build.csproj
@@ -1,23 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RootNamespace>reallife_gamemode</RootNamespace>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="meta.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="gtanetwork.api" Version="0.3.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
28
reallife-gamemode.csproj
Normal file
28
reallife-gamemode.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RootNamespace>reallife_gamemode</RootNamespace>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(ConfigurationName)' != 'ServerBuild'">
|
||||
<Reference Include="Bootstrapper">
|
||||
<HintPath>..\..\bridge\runtime\Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(ConfigurationName)' == 'ServerBuild'">
|
||||
<Reference Include="Bootstrapper">
|
||||
<HintPath>..\Bootstrapper.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(ConfigurationName)' == 'Debug'">
|
||||
<Exec Command="del "..\..\client_packages\*" /Q /S
xcopy "$(OutDir)*" "..\..\bridge\resources\reallife-gamemode" /Y /Q
del "..\..\client_packages\*.*" /Q
xcopy "..\..\reallife-gamemode\reallife-gamemode\Client\*" "..\..\client_packages\" /S /Q /Y
" />
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user