Added many things I can't recall but it has to do with inventory system and some minor fixes .. it's cool
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @overview Life of German Reallife - Gui Playerlist playerlist.js
|
||||
* @author VegaZ
|
||||
* @author VegaZ. Siga.
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
@@ -9,21 +9,25 @@ export default function playerList() {
|
||||
var playerlistBrowser
|
||||
var pList;
|
||||
|
||||
mp.events.add("showPlayerlist", () => {
|
||||
mp.events.add("showPlayerlist", (playersJson) => {
|
||||
if (!playerlistBrowser) {
|
||||
playerlistBrowser = mp.browsers.new('package://Gui/playerlist.html');
|
||||
playerlistBrowser = mp.browsers.new('package://assets/html/Playerlist/Tabliste.html');
|
||||
mp.gui.chat.activate(false);
|
||||
mp.gui.cursor.show(true, true);
|
||||
pList = JSON.parse(playersJson);
|
||||
pList.forEach((player) => {
|
||||
playerlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}',0,0,'${JSON.stringify(player.Ping)}');`);
|
||||
});
|
||||
} else {
|
||||
playerlistBrowser.destroy();
|
||||
playerlistBrowser = null;
|
||||
mp.gui.chat.activate(true);
|
||||
mp.gui.cursor.show(false, false);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("fetchPlayerList", (playersJson) => {
|
||||
mp.events.add("CEF:fetchPlayerList", () => {
|
||||
|
||||
pList = JSON.parse(playersJson);
|
||||
|
||||
pList.forEach((player) => {
|
||||
mp.gui.chat.push(player.Id + ", " + player.Name + ", " + player.Ping);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ export default function keys(globalData: GlobalData) {
|
||||
|
||||
//O //Spielerliste
|
||||
mp.keys.bind(0x4F, false, function () {
|
||||
if (!globalData.InChat) {
|
||||
if (!globalData.InChat && !globalData.InMenu) {
|
||||
mp.events.callRemote("keyPress:O");
|
||||
//mp.events.call("showPlayerlist");
|
||||
}
|
||||
|
||||
@@ -283,26 +283,27 @@ h5 {
|
||||
background-color: #313131; /* blau */
|
||||
border: none;
|
||||
height: 30px;
|
||||
width: 100%
|
||||
width: 124px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
left: 1.5%;
|
||||
color:#ffffff;
|
||||
color: #ffffff;
|
||||
}
|
||||
#tf_zahl {
|
||||
background-color: #313131; /* blau */
|
||||
border: none;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
width: 124px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
position: relative;
|
||||
left: 1.5%;
|
||||
left: 42%;
|
||||
top: 40%;
|
||||
color: #ffffff;
|
||||
}
|
||||
#tf_name {
|
||||
@@ -347,7 +348,8 @@ h5 {
|
||||
font-size: 16px;
|
||||
font-color: white;
|
||||
position: relative;
|
||||
left: 1.5%;
|
||||
left: 42%;
|
||||
top: 40%;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
30
ReallifeGamemode.Client/assets/html/Playerlist/Tabliste.html
Normal file
30
ReallifeGamemode.Client/assets/html/Playerlist/Tabliste.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tabliste</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
|
||||
|
||||
<div class='TabWrapper'>
|
||||
<div class='scroll' id='style1'>
|
||||
<table id='t1'>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Spielername</th>
|
||||
<th>Level</th>
|
||||
<th>Fraktion</th>
|
||||
<th>Ping</th>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script src="package://assets/js/jquery-3.3.1.min.js" type="text/javascript"></script>
|
||||
<script src="./script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
26
ReallifeGamemode.Client/assets/html/Playerlist/script.js
Normal file
26
ReallifeGamemode.Client/assets/html/Playerlist/script.js
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
|
||||
function ad_row(id, name, level, faction, ping) {
|
||||
var table_id = "t1";
|
||||
var table = document.getElementById(table_id);
|
||||
var rows = table.getElementsByTagName('tr').length;
|
||||
var tr = table.insertRow(rows);
|
||||
var td1 = document.createElement('td');
|
||||
var td2 = document.createElement('td');
|
||||
var td3 = document.createElement('td');
|
||||
var td4 = document.createElement('td');
|
||||
var td5 = document.createElement('td');
|
||||
var test = level;
|
||||
var test2 = faction;
|
||||
td1.innerHTML = ''+id;
|
||||
td2.innerHTML = name.slice(1, -1);
|
||||
td3.innerHTML = 'WIP';
|
||||
td4.innerHTML = 'WIP';
|
||||
td5.innerHTML = ''+ping;
|
||||
tr.appendChild(td1);
|
||||
tr.appendChild(td2);
|
||||
tr.appendChild(td3);
|
||||
tr.appendChild(td4);
|
||||
tr.appendChild(td5);
|
||||
}
|
||||
64
ReallifeGamemode.Client/assets/html/Playerlist/style.css
Normal file
64
ReallifeGamemode.Client/assets/html/Playerlist/style.css
Normal file
@@ -0,0 +1,64 @@
|
||||
/* style.css für Tabliste */
|
||||
.greyFont {
|
||||
color: gray;
|
||||
font-size: 14px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 500;
|
||||
color: #222;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: 700;
|
||||
font-size: 18px;
|
||||
color: white;
|
||||
margin:5px;
|
||||
padding: 5px;
|
||||
border: 1px solid #808080;
|
||||
width: 20.75em;
|
||||
}
|
||||
.TabWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 32%;
|
||||
top: 10%;
|
||||
}
|
||||
th, td {
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
width:10%;
|
||||
text-align: left;
|
||||
}
|
||||
.scroll {
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
font-size: 12px;
|
||||
overflow: auto;
|
||||
}
|
||||
.force-overflow {
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
#style1::-webkit-scrollbar-thumb {
|
||||
background-color: #FF0040;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<link rel="stylesheet" href="package://assets/css/inventory/style.css">
|
||||
</head>
|
||||
<!-- partial:index.partial.html -->
|
||||
<body>
|
||||
<body>
|
||||
<div class="pInvWrapper">
|
||||
<div>
|
||||
<div class=box1><h2> Inventar</h2></div>
|
||||
@@ -21,11 +21,6 @@
|
||||
<button id='buttonwegwerfen' onclick="wegwerfen()">Wegwerfen</button>
|
||||
<button id='buttonhandeln' onclick="handeln()">Handeln</button>
|
||||
</div>
|
||||
<div class="Betrag" style="display: none;">
|
||||
<input type="text" id="tf_zahl" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
|
||||
<button id='tf_submitZahl' onclick="submitZahl()">Bestätigen</button>
|
||||
</div>
|
||||
|
||||
<div class="phanWrapper" style="display: none;">
|
||||
<div><h2> Handel</h2></div>
|
||||
<div id="handelContainer">
|
||||
@@ -36,6 +31,11 @@
|
||||
<button id='tf_submit' onclick="submit()">Handeln</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="Betrag" style="display: none;">
|
||||
<input type="text" id="tf_zahl" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
|
||||
<button id='tf_submitZahl' onclick="submitZahl()">Bestätigen</button>
|
||||
</div>
|
||||
<!-- Task Systems -->
|
||||
<div class="tasksWrapper">
|
||||
<div id="tasksContainer">
|
||||
@@ -52,6 +52,6 @@
|
||||
<script src="package://assets/js/jquery-3.3.1.min.js" type="text/javascript"></script>
|
||||
<script src="package://assets/js/inventory/script.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Inventory</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- partial:index.partial.html -->
|
||||
<head>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
|
||||
</head>
|
||||
<body background="180610.jpg">
|
||||
|
||||
<div class="pKofWrapper">
|
||||
<div>
|
||||
<div class=box1><h2> Inventar </h2></div>
|
||||
<div class=box2><h4 id="gewicht"> 0/45kg</h4></div>
|
||||
</div>
|
||||
<div id="invContainer">
|
||||
</div>
|
||||
<div>
|
||||
<button id='buttonbenutzen' onclick="benutzen()">Benutzen</button>
|
||||
<button id='buttonwegwerfen' onclick="wegwerfen()">Wegwerfen</button>
|
||||
<button id='Fahrzeug'>Fahrzeug</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fahrzeugWrapper" style="display: none;">
|
||||
<div class=box1><h2> Kofferraum </h2></div>
|
||||
<div class=box2><h4 id="vehGewicht"> 0/250kg</h4></div>
|
||||
<div id="kofContainer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Betrag" style="display: none;">
|
||||
<input type="text" id="tf_zahl" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
|
||||
<button id='tf_submitZahl' onclick="submitZahl()">Bestätigen</button>
|
||||
</div>
|
||||
|
||||
<script src="package://assets/js/jquery-3.3.1.min.js" type="text/javascript"></script>
|
||||
<script src="./script.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,26 +1,38 @@
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
$(document).ready(function () {
|
||||
|
||||
//fire functions before page load
|
||||
drawToKofferraum();
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
mp.trigger("CEF:BrowserLoadedVehicle");
|
||||
console.log("loading finished");
|
||||
mp.trigger("CEF:BrowserLoadedTrade");
|
||||
|
||||
});
|
||||
var vehID;
|
||||
|
||||
var vehicleExtraSlot = 0;
|
||||
|
||||
function setItems(itemIdArr1, itemAmountArr1, vehicleExtraSlot1) {
|
||||
function setItems(itemIdArr1, itemAmountArr1) {
|
||||
var itemIdArr = JSON.parse(itemIdArr1);
|
||||
vehicleExtraSlot = JSON.parse(vehicleExtraSlot1);
|
||||
var itemAmountArr = JSON.parse(itemAmountArr1);
|
||||
var itemAmountArr = JSON.parse(itemAmountArr1);
|
||||
for (var i = 0; i < itemIdArr.length; i++) {
|
||||
for (x = 0; x < itemAmountArr[i]; x++) {
|
||||
commands.addToPlayerInv(itemIdArr[i]);
|
||||
console.log(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setVehItems(itemIdArr1, itemAmountArr1, vehID1) {
|
||||
vehID = vehID1;
|
||||
var itemIdArr = JSON.parse(itemIdArr1);
|
||||
var itemAmountArr = JSON.parse(itemAmountArr1);
|
||||
for (var i = 0; i < itemIdArr.length; i++) {
|
||||
for (x = 0; x < itemAmountArr[i]; x++) {
|
||||
commands.addToVehInv(itemIdArr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var holz = {
|
||||
name: "Holz",
|
||||
rarity: 'common',
|
||||
@@ -72,7 +84,7 @@ var cannabis = {
|
||||
var flunder = {
|
||||
name: "Flunder",
|
||||
weight: 7.7,
|
||||
currentWeight: 1,
|
||||
currentWeight: 7.7,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -87,7 +99,7 @@ var flunder = {
|
||||
var aal = {
|
||||
name: "Aal",
|
||||
weight: 3.6,
|
||||
currentWeight: 1,
|
||||
currentWeight: 3.6,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -102,7 +114,7 @@ var aal = {
|
||||
var barsch = {
|
||||
name: "Barsch",
|
||||
weight: 2.6,
|
||||
currentWeight: 1,
|
||||
currentWeight: 2.6,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -117,7 +129,7 @@ var barsch = {
|
||||
var lachs = {
|
||||
name: "Lachs",
|
||||
weight: 4.2,
|
||||
currentWeight: 1,
|
||||
currentWeight: 4.2,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -132,7 +144,7 @@ var lachs = {
|
||||
var thunfisch = {
|
||||
name: "Thunfisch",
|
||||
weight: 11,
|
||||
currentWeight: 1,
|
||||
currentWeight: 11,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -147,7 +159,7 @@ var thunfisch = {
|
||||
var zander = {
|
||||
name: "Zander",
|
||||
weight: 5,
|
||||
currentWeight: 1,
|
||||
currentWeight: 5,
|
||||
rarity: 'fishes',
|
||||
statSlots: [],
|
||||
runes: [],
|
||||
@@ -164,14 +176,13 @@ var allItems = [holz, hamburger, cocaine, cannabis, flunder, aal, barsch, lachs,
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Player Invenotry //
|
||||
////////////////////////
|
||||
|
||||
var vehInventory = [];
|
||||
var playerInventory = [];
|
||||
var EmptySlot = { name: 'blankSpace', rarity: '', object: 'false' };
|
||||
|
||||
|
||||
function addToVehInvenotry(addItem) {
|
||||
var cloneItem = Object.assign({}, addItem);
|
||||
var getExsistingId = cloneItem.itemId;
|
||||
@@ -179,50 +190,108 @@ function addToVehInvenotry(addItem) {
|
||||
|
||||
|
||||
//Checks to see if any items can be stacked, the location, and stack amount
|
||||
for (var i = 0; i < vehInventory.length; i++) {
|
||||
if (vehInventory[i].itemId === getExsistingId && cloneItem.stackable === 'true' && vehInventory[i].amount < 10) {
|
||||
for (var i = 24; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].itemId === getExsistingId && cloneItem.stackable === 'true' && playerInventory[i].amount < 10) {
|
||||
unfininshedStack = i
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cloneItem.currentWeight * cloneItem.amount + weightInv >= 25) {
|
||||
if (cloneItem.currentWeight * cloneItem.amount + weightInv >= 250) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Adds item to inventory
|
||||
for (var i = 0; i < vehInventory.length; i++) {
|
||||
for (var i = 24; i < playerInventory.length; i++) {
|
||||
if (unfininshedStack != undefined) {
|
||||
if (vehInventory[unfininshedStack].amount + cloneItem.amount <= 10) {
|
||||
vehInventory[unfininshedStack].amount += cloneItem.amount;
|
||||
if (playerInventory[unfininshedStack].amount + cloneItem.amount <= 30) {
|
||||
playerInventory[unfininshedStack].amount += cloneItem.amount;
|
||||
unfininshedStack = undefined;
|
||||
drawToPage();
|
||||
drawToKofferraum();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
else if (vehInventory[unfininshedStack].amount + cloneItem.amount > 10) {
|
||||
var stackRemainder = 10 - vehInventory[unfininshedStack].amount;
|
||||
vehInventory[unfininshedStack].amount += stackRemainder;
|
||||
else if (playerInventory[unfininshedStack].amount + cloneItem.amount > 30) {
|
||||
var stackRemainder = 30 - playerInventory[unfininshedStack].amount;
|
||||
playerInventory[unfininshedStack].amount += stackRemainder;
|
||||
cloneItem.amount -= stackRemainder;
|
||||
var recycleCloned = cloneItem;
|
||||
addToVehInvenotry(recycleCloned);
|
||||
addToInvenotry(recycleCloned);
|
||||
unfininshedStack = undefined;
|
||||
drawToKofferraum();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cloneItem.amount > 30 && playerInventory[i].object === 'false') {
|
||||
var reduceCloneAmount = Object.assign({}, cloneItem);
|
||||
reduceCloneAmount.amount = 30;
|
||||
playerInventory[i] = reduceCloneAmount;
|
||||
cloneItem.amount -= 30;
|
||||
addToInvenotry(cloneItem);
|
||||
drawToKofferraum();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
else if (unfininshedStack == undefined && playerInventory[i].object === 'false') {
|
||||
playerInventory[i] = cloneItem;
|
||||
drawToKofferraum();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addToInvenotry(addItem) {
|
||||
var cloneItem = Object.assign({}, addItem);
|
||||
var getExsistingId = cloneItem.itemId;
|
||||
var unfininshedStack;
|
||||
|
||||
|
||||
//Checks to see if any items can be stacked, the location, and stack amount
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].itemId === getExsistingId && cloneItem.stackable === 'true' && playerInventory[i].amount < 10) {
|
||||
unfininshedStack = i
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cloneItem.currentWeight * cloneItem.amount + weightInv >= 45) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Adds item to inventory
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (unfininshedStack != undefined) {
|
||||
if (playerInventory[unfininshedStack].amount + cloneItem.amount <= 10) {
|
||||
playerInventory[unfininshedStack].amount += cloneItem.amount;
|
||||
unfininshedStack = undefined;
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
else if (playerInventory[unfininshedStack].amount + cloneItem.amount > 10) {
|
||||
var stackRemainder = 10 - playerInventory[unfininshedStack].amount;
|
||||
playerInventory[unfininshedStack].amount += stackRemainder;
|
||||
cloneItem.amount -= stackRemainder;
|
||||
var recycleCloned = cloneItem;
|
||||
addToInvenotry(recycleCloned);
|
||||
unfininshedStack = undefined;
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cloneItem.amount > 10 && vehInventory[i].object === 'false') {
|
||||
else if (cloneItem.amount > 10 && playerInventory[i].object === 'false') {
|
||||
var reduceCloneAmount = Object.assign({}, cloneItem);
|
||||
reduceCloneAmount.amount = 10;
|
||||
vehInventory[i] = reduceCloneAmount;
|
||||
playerInventory[i] = reduceCloneAmount;
|
||||
cloneItem.amount -= 10;
|
||||
addToVehInvenotry(cloneItem);
|
||||
addToInvenotry(cloneItem);
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
else if (unfininshedStack == undefined && vehInventory[i].object === 'false') {
|
||||
vehInventory[i] = cloneItem;
|
||||
else if (unfininshedStack == undefined && playerInventory[i].object === 'false') {
|
||||
playerInventory[i] = cloneItem;
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
break;
|
||||
@@ -237,17 +306,117 @@ function getAllItemSlotData() {
|
||||
|
||||
|
||||
var currentSelected;
|
||||
function moveItemsInv() {
|
||||
getAllItemSlotData();
|
||||
for (var i = 0; i < getItemSlotData.length; i++) {
|
||||
$(getItemSlotData[i]).click(function () {
|
||||
if (this.getAttribute('inv-type') != 'p') {
|
||||
return;
|
||||
}
|
||||
if (this.classList.contains('selected')) {
|
||||
this.classList.remove('selected');
|
||||
currentSelected = undefined;
|
||||
}
|
||||
else if (this.getAttribute('object') === 'false' && isNaN(currentSelected)) {
|
||||
return;
|
||||
}
|
||||
else if (currentSelected) {
|
||||
if (playerInventory[currentSelected].stackable === 'false' || playerInventory[currentSelected].itemId != playerInventory[this.getAttribute('data-value')].itemId) {
|
||||
|
||||
if (playerInventory[this.getAttribute('data-value')] == EmptySlot && this.getAttribute('data-value') > 23 && currentSelected < 24) {
|
||||
|
||||
var hItem = this.getAttribute('data-value');
|
||||
var iItem = currentSelected;
|
||||
var Copy = Object.assign({}, playerInventory[iItem]);
|
||||
playerInventory.splice(hItem, 0, Copy);
|
||||
|
||||
if (playerInventory[currentSelected].stackable === 'false') {
|
||||
playerInventory[hItem].amount = playerInventory[iItem].amount;
|
||||
playerInventory[iItem] = EmptySlot;
|
||||
} else {
|
||||
$(".Betrag").show();
|
||||
$("#tf_submitZahl").click(function () {
|
||||
|
||||
if ($('#tf_zahl').val() < playerInventory[iItem].amount && playerInventory[currentSelected].stackable) {
|
||||
console.log(playerInventory[hItem].amount + " " + playerInventory[iItem].amount + " " + hItem);
|
||||
var y = parseInt($('#tf_zahl').val(), 10);
|
||||
|
||||
playerInventory[iItem].amount -= y;
|
||||
console.log(playerInventory[hItem].amount + " " + playerInventory[iItem] + " " + parseInt($('#tf_zahl').val(), 10) + " " + hItem);
|
||||
playerInventory[hItem].amount = y;
|
||||
console.log(playerInventory[hItem].amount + " " + playerInventory[iItem].amount + " " + parseInt($('#tf_zahl').val(), 10) + " " + hItem);
|
||||
} else {
|
||||
playerInventory[hItem].amount = playerInventory[iItem].amount;
|
||||
playerInventory[iItem] = EmptySlot;
|
||||
}
|
||||
|
||||
drawToPage();
|
||||
drawToKofferraum();
|
||||
currentSelected = undefined;
|
||||
getItemSlotData = document.getElementsByClassName('itemSlot');
|
||||
moveItemsInv();
|
||||
$(".Betrag").hide();
|
||||
saveAllItems();
|
||||
});
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
var swap = playerInventory[this.getAttribute('data-value')];
|
||||
playerInventory[this.getAttribute('data-value')] = playerInventory[currentSelected];
|
||||
playerInventory[currentSelected] = swap;
|
||||
drawToPage();
|
||||
drawToKofferraum();
|
||||
currentSelected = undefined;
|
||||
getItemSlotData = document.getElementsByClassName('itemSlot');
|
||||
moveItemsInv();
|
||||
}
|
||||
|
||||
}
|
||||
else if ((playerInventory[currentSelected].itemId == playerInventory[this.getAttribute('data-value')].itemId && playerInventory[currentSelected].stackable) && this.getAttribute('inv-type') === 'p') {
|
||||
$(".Betrag").show();
|
||||
$("#tf_submitZahl").click(function () {
|
||||
playerInventory[this.getAttribute('data-value')].amount += playerInventory[currentSelected].amount
|
||||
playerInventory[currentSelected] = EmptySlot;
|
||||
drawToPage();
|
||||
drawToKofferraum();
|
||||
currentSelected = undefined;
|
||||
getItemSlotData = document.getElementsByClassName('itemSlot');
|
||||
moveItemsInv();
|
||||
$(".Betrag").hide();
|
||||
saveAllItems();
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.className += ' selected';
|
||||
currentSelected = this.getAttribute('data-value');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//Inventar
|
||||
|
||||
function saveAllItems() {
|
||||
mp.trigger("CEF:saveItemsHelper", JSON.stringify(vehId));
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].object === 'true') {
|
||||
mp.trigger("CEF:saveItems", JSON.stringify(playerInventory[i].itemId), JSON.stringify(playerInventory[i].amount), JSON.stringify(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function refreshAllCurrentItems() {
|
||||
var remove = document.getElementById('hanContainer');
|
||||
var remove = document.getElementById('invContainer');
|
||||
while (remove.firstChild) remove.removeChild(remove.firstChild);
|
||||
}
|
||||
|
||||
|
||||
function fillOutEmptyInv() {
|
||||
for (var i = 0; i < 12 + vehicleExtraSlot; i++) {
|
||||
if (!vehInventory[i]) {
|
||||
vehInventory.push(EmptySlot);
|
||||
for (var i = 0; i < 24; i++) {
|
||||
if (!playerInventory[i]) {
|
||||
playerInventory.push(EmptySlot);
|
||||
drawToPage();
|
||||
}
|
||||
}
|
||||
@@ -256,15 +425,15 @@ var weightInv = 0;
|
||||
function drawToPage() {
|
||||
refreshAllCurrentItems();
|
||||
weightInv = 0;
|
||||
for (var i = 0; i < vehInventory.length; i++) {
|
||||
if (vehInventory[i].selected == 'true') {
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].selected == 'true') {
|
||||
var className = ' selected';
|
||||
}
|
||||
else {
|
||||
var className = '';
|
||||
}
|
||||
|
||||
if (i >= 60) {
|
||||
if (i >= 24) {
|
||||
//Keeps inventory set to 10 items max
|
||||
console.log('Inventory is full!')
|
||||
return;
|
||||
@@ -272,18 +441,18 @@ function drawToPage() {
|
||||
else {
|
||||
//creates item element
|
||||
var item = document.createElement("div");
|
||||
item.className = "itemSlot " + vehInventory[i].rarity + className;
|
||||
item.className = "itemSlot " + playerInventory[i].rarity + className;
|
||||
item.setAttribute("data-value", i);
|
||||
item.setAttribute("inv-type", 'p');
|
||||
item.setAttribute("object", vehInventory[i].object);
|
||||
item.setAttribute('style', 'background: url(' + vehInventory[i].img + '); background-size: contain;');
|
||||
item.setAttribute("object", playerInventory[i].object);
|
||||
item.setAttribute('style', 'background: url(' + playerInventory[i].img + '); background-size: contain;');
|
||||
|
||||
//show element amounts
|
||||
var itemAmount = document.createElement("div");
|
||||
itemAmount.className = "itemAmount";
|
||||
var itemAmountDisplay = document.createElement("p");
|
||||
if (vehInventory[i].amount) {
|
||||
var itemDisplayStatsName = document.createTextNode(vehInventory[i].amount);
|
||||
if (playerInventory[i].amount) {
|
||||
var itemDisplayStatsName = document.createTextNode(playerInventory[i].amount);
|
||||
}
|
||||
else {
|
||||
var itemDisplayStatsName = document.createTextNode('');
|
||||
@@ -294,28 +463,104 @@ function drawToPage() {
|
||||
|
||||
|
||||
//adds item element or elements
|
||||
document.getElementById("hanContainer").appendChild(item);
|
||||
document.getElementById("invContainer").appendChild(item);
|
||||
|
||||
//creates item display information
|
||||
if (vehInventory[i].object === 'true') {
|
||||
if (playerInventory[i].object === 'true') {
|
||||
var itemDesc = document.createElement("div");
|
||||
var itemDescTitle = document.createElement("h3");
|
||||
|
||||
var getItemTitle = document.createTextNode(vehInventory[i].name + " (" + Math.round(vehInventory[i].currentWeight * vehInventory[i].amount * 100) / 100 + " kg)");
|
||||
var getItemTitle = document.createTextNode(playerInventory[i].name + " (" + Math.round(playerInventory[i].currentWeight * playerInventory[i].amount * 100) / 100 + " kg)");
|
||||
itemDesc.className = "itemDesc";
|
||||
item.appendChild(itemDesc);
|
||||
itemDesc.appendChild(itemDescTitle);
|
||||
itemDescTitle.appendChild(getItemTitle);
|
||||
|
||||
weightInv += vehInventory[i].currentWeight * vehInventory[i].amount;
|
||||
document.getElementById('gewicht').innerText = Math.round(weightInv * 100) / 100 + "/25 kg";
|
||||
weightInv += playerInventory[i].currentWeight * playerInventory[i].amount;
|
||||
document.getElementById('gewicht').innerText = Math.round(weightInv * 100) / 100 + "/45 kg";
|
||||
}
|
||||
}
|
||||
}
|
||||
fillOutEmptyInv();
|
||||
}
|
||||
//Kofferraum
|
||||
|
||||
function refreshAllCurrentKofItems() {
|
||||
var remove = document.getElementById('kofContainer');
|
||||
while (remove.firstChild) remove.removeChild(remove.firstChild);
|
||||
}
|
||||
|
||||
|
||||
function fillOutEmptyInvKofferraum() {
|
||||
for (var i = 24; i < 54; i++) {
|
||||
if (!playerInventory[i]) {
|
||||
playerInventory.push(EmptySlot);
|
||||
drawToKofferraum();
|
||||
}
|
||||
}
|
||||
}
|
||||
var vehWeightInv = 0;
|
||||
function drawToKofferraum() {
|
||||
refreshAllCurrentKofItems();
|
||||
vehWeightInv = 0;
|
||||
for (var i = 24; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].selected == 'true') {
|
||||
var className = ' selected';
|
||||
}
|
||||
else {
|
||||
var className = '';
|
||||
}
|
||||
|
||||
if (i >= 54) {
|
||||
//Keeps inventory set to 10 items max
|
||||
console.log('Inventory is full!')
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//creates item element
|
||||
var item = document.createElement("div");
|
||||
item.className = "itemSlot " + playerInventory[i].rarity + className;
|
||||
item.setAttribute("data-value", i);
|
||||
item.setAttribute("inv-type", 'p');
|
||||
item.setAttribute("object", playerInventory[i].object);
|
||||
item.setAttribute('style', 'background: url(' + playerInventory[i].img + '); background-size: contain;');
|
||||
|
||||
//show element amounts
|
||||
var itemAmount = document.createElement("div");
|
||||
itemAmount.className = "itemAmount";
|
||||
var itemAmountDisplay = document.createElement("p");
|
||||
if (playerInventory[i].amount) {
|
||||
var itemDisplayStatsName = document.createTextNode(playerInventory[i].amount);
|
||||
}
|
||||
else {
|
||||
var itemDisplayStatsName = document.createTextNode('');
|
||||
}
|
||||
item.appendChild(itemAmount);
|
||||
itemAmount.appendChild(itemAmountDisplay);
|
||||
itemAmountDisplay.appendChild(itemDisplayStatsName);
|
||||
|
||||
|
||||
//adds item element or elements
|
||||
document.getElementById("kofContainer").appendChild(item);
|
||||
|
||||
//creates item display information
|
||||
if (playerInventory[i].object === 'true') {
|
||||
var itemDesc = document.createElement("div");
|
||||
var itemDescTitle = document.createElement("h3");
|
||||
|
||||
var getItemTitle = document.createTextNode(playerInventory[i].name + " (" + Math.round(playerInventory[i].currentWeight * playerInventory[i].amount * 100) / 100 + " kg)");
|
||||
itemDesc.className = "itemDesc";
|
||||
item.appendChild(itemDesc);
|
||||
itemDesc.appendChild(itemDescTitle);
|
||||
itemDescTitle.appendChild(getItemTitle);
|
||||
|
||||
vehWeightInv += playerInventory[i].currentWeight * playerInventory[i].amount;
|
||||
document.getElementById('vehGewicht').innerText = Math.round(weightInv * 100) / 100 + "/250 kg";
|
||||
}
|
||||
}
|
||||
}
|
||||
fillOutEmptyInvKofferraum();
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// Dev Commands //
|
||||
@@ -323,6 +568,13 @@ function drawToPage() {
|
||||
|
||||
var commands = {
|
||||
addToPlayerInv: function (itemGiveId) {
|
||||
for (var i = 0; i < allItems.length; i++) {
|
||||
if (allItems[i].itemId === itemGiveId) {
|
||||
addToInvenotry(allItems[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
addToVehInv: function(itemGiveId) {
|
||||
for (var i = 0; i < allItems.length; i++) {
|
||||
if (allItems[i].itemId === itemGiveId) {
|
||||
addToVehInvenotry(allItems[i]);
|
||||
@@ -330,18 +582,27 @@ var commands = {
|
||||
}
|
||||
},
|
||||
clearPlayerInv: function () {
|
||||
vehInventory = [];
|
||||
playerInventory = [];
|
||||
drawToPage();
|
||||
drawToKofferraum();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
//Handel Akzeptierenfenster
|
||||
|
||||
$("#buttonakzeptieren").click(function () {
|
||||
mp.trigger('CEF:acceptTrade');
|
||||
});
|
||||
|
||||
$("#buttonablehnen").click(function () {
|
||||
mp.trigger('CEF:declineTrade');
|
||||
var trade = 1;
|
||||
$("#Fahrzeug").click(function () {
|
||||
if (trade == 1) {
|
||||
$(".fahrzeugWrapper").show();
|
||||
drawToKofferraum();
|
||||
drawToPage();
|
||||
|
||||
moveItemsInv();
|
||||
trade = 0;
|
||||
} else {
|
||||
$(".fahrzeugWrapper").hide();
|
||||
trade = 1;
|
||||
}
|
||||
currentSelected = undefined;
|
||||
});
|
||||
|
||||
@@ -13,6 +13,8 @@ body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
#buttonbenutzen {
|
||||
background-color: #4CAF50; /* gruen */
|
||||
border: none;
|
||||
@@ -73,6 +75,18 @@ body {
|
||||
position: relative;
|
||||
left: 18%;
|
||||
}
|
||||
#Fahrzeug {
|
||||
background-color: #008CBA; /* blau */
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 12px 24px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
position: relative;
|
||||
left: 1.5%;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 125px;
|
||||
@@ -100,12 +114,13 @@ h2 {
|
||||
.box1 {
|
||||
float: left;
|
||||
width: 50%;
|
||||
top:auto;
|
||||
}
|
||||
.box2 {
|
||||
|
||||
padding: 2px;
|
||||
top: auto;
|
||||
}
|
||||
padding-bottom:30px;
|
||||
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
@@ -120,25 +135,46 @@ h4 {
|
||||
|
||||
.pakWrapper {
|
||||
background: rgba(0,0,0,0.4);
|
||||
height: 395px;
|
||||
height: 170px;
|
||||
width: 394px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
top: 0;
|
||||
}
|
||||
.pukWrapper {
|
||||
background: rgba(0,0,0,0.4);
|
||||
height: 395px;
|
||||
width: 394px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 55%;
|
||||
top: 0;
|
||||
left: 38%;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
.pInvWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 395px;
|
||||
width: 394px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 10%;
|
||||
}
|
||||
|
||||
.pKofWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 395px;
|
||||
width: 394px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 40%;
|
||||
|
||||
}
|
||||
|
||||
.fahrzeugWrapper {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 395px;
|
||||
width: 394px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
left: 40%;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
#invContainer{
|
||||
width: 110%;
|
||||
@@ -149,12 +185,21 @@ h4 {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
#hanContainer {
|
||||
#kofContainer{
|
||||
width: 110%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#hanContainer h3 {
|
||||
#kofContainer h3 {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
#fahrzeugContainer{
|
||||
width: 110%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#fahrzeugContainer h3 {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
@@ -266,6 +311,17 @@ h4 {
|
||||
color: white;
|
||||
}
|
||||
/*Handelfenster */
|
||||
.Betrag {
|
||||
background: rgba(0,0,0,0.6);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: block;
|
||||
transform: translate(-50%, -50%);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
#tf_betrag {
|
||||
background-color: #008CBA; /* blau */
|
||||
border: none;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Inventory</title>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="pakWrapper">
|
||||
<div class="tWrapper">
|
||||
<div class=box1><h2>Inventar</h2></div>
|
||||
<div class=box2><h4 id="gewicht"> 0/25 kg</h4></div>
|
||||
</div>
|
||||
<div id="invContainer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="pukWrapper">
|
||||
<div class="tWrapper">
|
||||
<div class=box1><h2>Kofferraum</h2></div>
|
||||
<div class=box2><h4 id="gewicht"> 0/25 kg</h4></div>
|
||||
</div>
|
||||
<div id="hanContainer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="package://assets/js/jquery-3.3.1.min.js" type="text/javascript"></script>
|
||||
<script src="./script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -184,22 +184,22 @@ function addToInvenotry(addItem) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cloneItem.currentWeight * cloneItem.amount + weightInv >= 25) {
|
||||
if (cloneItem.currentWeight * cloneItem.amount + weightInv >= 45) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Adds item to inventory
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (unfininshedStack != undefined) {
|
||||
if (playerInventory[unfininshedStack].amount + cloneItem.amount <= 99) {
|
||||
if (playerInventory[unfininshedStack].amount + cloneItem.amount <= 10) {
|
||||
playerInventory[unfininshedStack].amount += cloneItem.amount;
|
||||
unfininshedStack = undefined;
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
break;
|
||||
}
|
||||
else if (playerInventory[unfininshedStack].amount + cloneItem.amount > 99) {
|
||||
var stackRemainder = 99 - playerInventory[unfininshedStack].amount;
|
||||
else if (playerInventory[unfininshedStack].amount + cloneItem.amount > 10) {
|
||||
var stackRemainder = 10 - playerInventory[unfininshedStack].amount;
|
||||
playerInventory[unfininshedStack].amount += stackRemainder;
|
||||
cloneItem.amount -= stackRemainder;
|
||||
var recycleCloned = cloneItem;
|
||||
@@ -210,11 +210,11 @@ function addToInvenotry(addItem) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cloneItem.amount > 99 && playerInventory[i].object === 'false') {
|
||||
else if (cloneItem.amount > 10 && playerInventory[i].object === 'false') {
|
||||
var reduceCloneAmount = Object.assign({}, cloneItem);
|
||||
reduceCloneAmount.amount = 99;
|
||||
reduceCloneAmount.amount = 10;
|
||||
playerInventory[i] = reduceCloneAmount;
|
||||
cloneItem.amount -= 99;
|
||||
cloneItem.amount -= 10;
|
||||
addToInvenotry(cloneItem);
|
||||
drawToPage();
|
||||
moveItemsInv();
|
||||
@@ -254,11 +254,12 @@ function moveItemsInv() {
|
||||
if (playerInventory[currentSelected].stackable === 'false' || playerInventory[currentSelected].itemId != playerInventory[this.getAttribute('data-value')].itemId) {
|
||||
|
||||
if (playerInventory[this.getAttribute('data-value')] == EmptySlot && this.getAttribute('data-value') > 23) {
|
||||
$(".Betrag").show();
|
||||
|
||||
var hItem = this.getAttribute('data-value');
|
||||
var iItem = currentSelected;
|
||||
var Copy = Object.assign({}, playerInventory[iItem]);
|
||||
playerInventory.splice(hItem, 0, Copy);
|
||||
$(".Betrag").show();
|
||||
$("#tf_submitZahl").click(function () {
|
||||
|
||||
if ($('#tf_zahl').val() < playerInventory[iItem].amount && playerInventory[currentSelected].stackable) {
|
||||
@@ -270,8 +271,8 @@ function moveItemsInv() {
|
||||
playerInventory[hItem].amount = y;
|
||||
console.log(playerInventory[hItem].amount + " " + playerInventory[iItem].amount + " " + parseInt($('#tf_zahl').val(), 10) + " " + hItem);
|
||||
} else {
|
||||
playerInventory[hItem].amount = playerInventory[currentSelected].amount;
|
||||
playerInventory[currentSelected] = EmptySlot;
|
||||
playerInventory[hItem].amount = playerInventory[iItem].amount;
|
||||
playerInventory[iItem] = EmptySlot;
|
||||
}
|
||||
|
||||
drawToPage();
|
||||
@@ -331,6 +332,7 @@ var weightInv = 0;
|
||||
function drawToPage() {
|
||||
refreshAllCurrentItems();
|
||||
weightInv = 0;
|
||||
document.getElementById('gewicht').innerText = "0/45 kg";
|
||||
for (var i = 0; i < playerInventory.length; i++) {
|
||||
if (playerInventory[i].selected == 'true') {
|
||||
var className = ' selected';
|
||||
@@ -383,7 +385,7 @@ function drawToPage() {
|
||||
itemDescTitle.appendChild(getItemTitle);
|
||||
|
||||
weightInv += playerInventory[i].currentWeight * playerInventory[i].amount;
|
||||
document.getElementById('gewicht').innerText = Math.round(weightInv * 100) / 100 + "/25 kg";
|
||||
document.getElementById('gewicht').innerText = Math.round(weightInv * 100) / 100 + "/45 kg";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,12 +522,38 @@ $("#buttonbenutzen").click(function () {
|
||||
|
||||
$("#buttonwegwerfen").click(function () {
|
||||
if (currentSelected) {
|
||||
|
||||
if (playerInventory[currentSelected].stackable == 'false') {
|
||||
mp.trigger('CEF:invThrowItem', playerInventory[currentSelected].itemId, playerInventory[currentSelected].amount);
|
||||
weightInv -= playerInventory[currentSelected].weight;
|
||||
playerInventory[currentSelected] = EmptySlot;
|
||||
currentSelected = undefined;
|
||||
drawToPage();
|
||||
drawToHandel();
|
||||
moveItemsInv();
|
||||
mp.trigger('CEF:invThrowItem', playerInventory[currentSelected].itemId);
|
||||
playerInventory[currentSelected] = EmptySlot;
|
||||
return;
|
||||
}
|
||||
|
||||
$(".Betrag").show();
|
||||
var iItem = currentSelected;
|
||||
$("#tf_submitZahl").click(function () {
|
||||
|
||||
if ($('#tf_zahl').val() < playerInventory[iItem].amount && playerInventory[currentSelected].stackable) {
|
||||
var y = parseInt($('#tf_zahl').val(), 10);
|
||||
|
||||
playerInventory[iItem].amount -= y;
|
||||
mp.trigger('CEF:invThrowItem', playerInventory[currentSelected].itemId, y);
|
||||
} else {
|
||||
mp.trigger('CEF:invThrowItem', playerInventory[currentSelected].itemId, playerInventory[currentSelected].amount);
|
||||
playerInventory[iItem] = EmptySlot;
|
||||
}
|
||||
$(".Betrag").hide();
|
||||
currentSelected = undefined;
|
||||
drawToPage();
|
||||
drawToHandel();
|
||||
moveItemsInv();
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ export default function inventory(globalData: GlobalData): void {
|
||||
var invBrowser: BrowserMp = null;
|
||||
var itemIdArr;
|
||||
var itemAmountArr;
|
||||
var vehItemIdArr;
|
||||
var vehItemAmountArr;
|
||||
var money;
|
||||
var vehId;
|
||||
|
||||
mp.events.add("openTradeWindow", (money1, itemIdArr1, itemAmountArr1) => {
|
||||
if (!globalData.InMenu) {
|
||||
@@ -28,6 +31,31 @@ export default function inventory(globalData: GlobalData): void {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mp.events.add('vehInventoryShow', (itemIdArr1, itemAmountArr1, vehItemIdArr1, vehItemAmountArr1, vehId1) => {
|
||||
if (!globalData.InMenu) {
|
||||
if (invBrowser !== null) {
|
||||
try {
|
||||
invBrowser.destroy()
|
||||
invBrowser = null;
|
||||
}
|
||||
finally {
|
||||
mp.gui.cursor.show(false, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mp.gui.cursor.show(true, true);
|
||||
invBrowser = mp.browsers.new("package://assets/html/inventory/vehicle/index.html");
|
||||
|
||||
itemIdArr = itemIdArr1;
|
||||
itemAmountArr = itemAmountArr1;
|
||||
vehItemIdArr = vehItemIdArr1;
|
||||
vehItemAmountArr = vehItemAmountArr1;
|
||||
vehId = vehId1;
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('inventoryShow', (itemIdArr1, itemAmountArr1) => {
|
||||
if (!globalData.InMenu) {
|
||||
if (invBrowser !== null) {
|
||||
@@ -48,8 +76,8 @@ export default function inventory(globalData: GlobalData): void {
|
||||
itemAmountArr = itemAmountArr1;
|
||||
}
|
||||
});
|
||||
mp.events.add("CEF:invThrowItem", (itemId) => {
|
||||
mp.events.callRemote('invThrowItem', itemId);
|
||||
mp.events.add("CEF:invThrowItem", (itemId, amount) => {
|
||||
mp.events.callRemote('invThrowItem', itemId, amount);
|
||||
});
|
||||
|
||||
|
||||
@@ -59,6 +87,12 @@ export default function inventory(globalData: GlobalData): void {
|
||||
mp.events.add("CEF:BrowserLoadedTrade", () => {
|
||||
invBrowser.execute(`setItems("${JSON.stringify(itemIdArr)}","${JSON.stringify(itemAmountArr)}","${JSON.stringify(money)}");`);
|
||||
});
|
||||
mp.events.add("CEF:BrowserLoadedVehicle", () => {
|
||||
invBrowser.execute(`setItems("${JSON.stringify(itemIdArr)}","${JSON.stringify(itemAmountArr)}");`);
|
||||
invBrowser.execute(`setVehItems("${JSON.stringify(vehItemIdArr)}","${JSON.stringify(vehItemAmountArr)}","${JSON.stringify(vehId)}");`);
|
||||
});
|
||||
|
||||
|
||||
|
||||
mp.events.add("CEF:acceptTrade", () => {
|
||||
if (invBrowser !== null) {
|
||||
@@ -79,6 +113,13 @@ export default function inventory(globalData: GlobalData): void {
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("CEF:saveItems", (saveItemsArr, saveAmountArr, saveItemsSlotArr) => {
|
||||
mp.events.callRemote('saveItems', saveItemsArr, saveAmountArr, saveItemsSlotArr);
|
||||
});
|
||||
mp.events.add("CEF:saveItemsHelper", (vehI5) => {
|
||||
mp.events.callRemote('saveHelper', vehI5);
|
||||
});
|
||||
|
||||
mp.events.add("CEF:UseItemInv", (itemId) => {
|
||||
mp.events.callRemote('invUseItem', itemId);
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"include": [
|
||||
"**/*",
|
||||
"node_modules/NativeUI/index.ts"
|
||||
"node_modules/NativeUI/index.ts", "../ReallifeGamemode.Server/Inventory/Items/Cannabis.cs"
|
||||
],
|
||||
"files": [
|
||||
"node_modules/NativeUI/index.ts"
|
||||
|
||||
@@ -979,7 +979,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
foreach (var managedClient in peopleInRange)
|
||||
{
|
||||
if (!managedClient.IsLoggedIn()) return;
|
||||
ChatService.SendMessage(managedClient, "* " + player.Name + " hat eine " + number + " gewürfelt.";
|
||||
ChatService.SendMessage(managedClient, "* " + player.Name + " hat eine " + number + " gewürfelt.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
foreach (var managedClient in peopleInRange)
|
||||
{
|
||||
if (!managedClient.IsLoggedIn()) return;
|
||||
ChatService.SendMessage(managedClient, "* " + player.Name + " hat eine " + number + " gewürfelt.";
|
||||
ChatService.SendMessage(managedClient, "* " + player.Name + " hat eine " + number + " gewürfelt.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
34
ReallifeGamemode.Server/Entities/VehicleItem.cs
Normal file
34
ReallifeGamemode.Server/Entities/VehicleItem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
|
||||
namespace ReallifeGamemode.Server.Entities
|
||||
{
|
||||
public class VehicleItem
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ItemId { get; set; }
|
||||
|
||||
[ForeignKey("ServerVehicle")]
|
||||
public int VehicleId { get; set; }
|
||||
public ServerVehicle Vehicle { get; set; }
|
||||
|
||||
public int Amount { get; set; }
|
||||
public int Slot { get; set; }
|
||||
|
||||
public ServerVehicle GetVehicle()
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
return dbContext.ServerVehicles.FirstOrDefault(v => v.Id == VehicleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
p.Name,
|
||||
p.Ping
|
||||
});
|
||||
player.TriggerEvent("fetchPlayerList", JsonConvert.SerializeObject(listPlayers));
|
||||
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
|
||||
}
|
||||
|
||||
[RemoteEvent("keyPress:K")]
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public override int Id => 6;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override int Gewicht => 3600;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public override int Id => 7;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override int Gewicht => 2600;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
23
ReallifeGamemode.Server/Inventory/Items/Cannabis.cs
Normal file
23
ReallifeGamemode.Server/Inventory/Items/Cannabis.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
public class Cannabis : IDroppableItem
|
||||
{
|
||||
public int Id => 4;
|
||||
public string Name => "Grünes Gift";
|
||||
public string Description => "puff puff and pass";
|
||||
public int Gewicht => 50;
|
||||
public string Einheit => "g";
|
||||
public uint Object => 1805779401;
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,12 @@ using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
public class Chickenburger : FoodItem
|
||||
public class Cocain : FoodItem
|
||||
{
|
||||
public override int Id => 3;
|
||||
public override string Name => "Chickenburger";
|
||||
public override string Description => "Hühnchenburger";
|
||||
public override int Gewicht => 330;
|
||||
public override string Name => "Kosks";
|
||||
public override string Description => "Rave";
|
||||
public override int Gewicht => 50;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 25;
|
||||
public override uint Object => 2240524752;
|
||||
@@ -1,24 +0,0 @@
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
public class Hamburger : FoodItem
|
||||
{
|
||||
public override int Id => 1;
|
||||
public override string Name => "Hamburger";
|
||||
public override string Description => "Ein leckerer Hamburger.";
|
||||
public override int Gewicht => 300;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 2240524752;
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
public class Holz : IDroppableItem
|
||||
{
|
||||
public int Id => 4;
|
||||
public int Id => 1;
|
||||
public string Name => "Holz";
|
||||
public string Description => "Ich und mein Holz.";
|
||||
public int Gewicht => 1000;
|
||||
public int Gewicht => 650;
|
||||
public string Einheit => "g";
|
||||
public uint Object => 1805779401;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public class Kraftstoff : DropItem
|
||||
{
|
||||
public override int Id => 5;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override string Name => "Flunder";
|
||||
public override string Description => "ja";
|
||||
public override int Gewicht => 7700;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public override int Id => 8;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override int Gewicht => 4200;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public override int Id => 9;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override int Gewicht => 11000;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
||||
public override int Id => 10;
|
||||
public override string Name => "Kraftstoff";
|
||||
public override string Description => "Der Stoff gibt dir Kraft.";
|
||||
public override int Gewicht => 1000;
|
||||
public override int Gewicht => 5000;
|
||||
public override string Einheit => "g";
|
||||
public override int HpAmount => 20;
|
||||
public override uint Object => 786272259;
|
||||
|
||||
@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -24,6 +25,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
List<int> ItemId = new List<int>();
|
||||
List<int> amount = new List<int>();
|
||||
List<int> vehItemId = new List<int>();
|
||||
List<int> vehAmount = new List<int>();
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
List<UserItem> userItems = context.UserItems.ToList().FindAll(i => i.UserId == user.Id);
|
||||
@@ -32,6 +35,26 @@ namespace ReallifeGamemode.Server.Managers
|
||||
ItemId.Add(item.ItemId);
|
||||
amount.Add(item.Amount);
|
||||
}
|
||||
foreach(Vehicle veh in NAPI.Pools.GetAllVehicles())
|
||||
{
|
||||
if(veh.Position.DistanceTo(client.Position) < 1)
|
||||
{
|
||||
if (VehicleStreaming.GetDoorState(veh, DoorID.DoorTrunk) == DoorState.DoorOpen)
|
||||
{
|
||||
ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context);
|
||||
List<VehicleItem> vehicleItems = context.VehicleItems.ToList().FindAll(i => i.VehicleId == serverVehicle.Id);
|
||||
foreach (var vehItem in vehicleItems)
|
||||
{
|
||||
vehItemId.Add(vehItem.ItemId);
|
||||
vehAmount.Add(vehItem.Amount);
|
||||
}
|
||||
client.TriggerEvent("vehInventoryShow", ItemId.ToArray(), amount.ToArray(), vehItemId.ToArray(), vehAmount.ToArray(), serverVehicle.Id);
|
||||
return;
|
||||
}
|
||||
ChatService.SendMessage(client, "Kofferraum ist zu nigger!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
client.TriggerEvent("inventoryShow", ItemId.ToArray(), amount.ToArray());
|
||||
}
|
||||
}
|
||||
@@ -52,21 +75,109 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
context.UserItems.Remove(item);
|
||||
}
|
||||
client.SendNotification("Du hast ~g~" + item.Amount + " ~y~" + InventoryManager.GetItemById(itemId).Name + " ~s~ benutzt.", false);
|
||||
|
||||
context.SaveChanges();
|
||||
return;
|
||||
}
|
||||
}
|
||||
[RemoteEvent("saveHelper")]
|
||||
public void ServerEvent_invSaveHelper(Client client, string vehID)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
int serVehID = JsonConvert.DeserializeObject<int>(vehID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("saveItems")]
|
||||
public void ServerEvent_invSaveItems(Client client, string itemIdArr, string itemAmountArr, string SlotArr)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
|
||||
int itemId = JsonConvert.DeserializeObject<int>(itemIdArr);
|
||||
int itemAmount = JsonConvert.DeserializeObject<int>(itemAmountArr);
|
||||
int Slot = JsonConvert.DeserializeObject<int>(SlotArr);
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
if (Slot < 24)
|
||||
{
|
||||
UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
item.Amount += itemAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newItem = new UserItem
|
||||
{
|
||||
ItemId = itemId,
|
||||
UserId = user.Id,
|
||||
Amount = itemAmount,
|
||||
Slot = -1
|
||||
};
|
||||
|
||||
context.UserItems.Add(newItem);
|
||||
}
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Vehicle veh in NAPI.Pools.GetAllVehicles())
|
||||
{
|
||||
if (veh.Position.DistanceTo(client.Position) < 1)
|
||||
{
|
||||
if (VehicleStreaming.GetDoorState(veh, DoorID.DoorTrunk) == DoorState.DoorOpen)
|
||||
{
|
||||
ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(veh, context);
|
||||
VehicleItem vehItem = context.VehicleItems.Where(v => v.VehicleId == serverVehicle.Id && v.ItemId == itemId).FirstOrDefault();
|
||||
if (vehItem != null)
|
||||
{
|
||||
vehItem.Amount = itemAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newItem = new VehicleItem
|
||||
{
|
||||
ItemId = itemId,
|
||||
VehicleId = serverVehicle.Id,
|
||||
Amount = itemAmount,
|
||||
Slot = -1
|
||||
};
|
||||
|
||||
context.VehicleItems.Add(newItem);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[RemoteEvent("invThrowItem")]
|
||||
public void ServerEvent_invThrowItem(Client client, int itemId)
|
||||
public void ServerEvent_invThrowItem(Client client, int itemId, int amount)
|
||||
{
|
||||
User user = client.GetUser();
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
UserItem item = context.UserItems.Where(u => u.UserId == user.Id && u.ItemId == itemId).FirstOrDefault();
|
||||
if (item.Amount > amount)
|
||||
{
|
||||
item.Amount -= amount;
|
||||
client.SendNotification("Du hast ~g~" + amount + " ~y~" + InventoryManager.GetItemById(itemId).Name + " ~s~weggeworfen.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.SendNotification("Du hast ~g~" + item.Amount + " ~y~" + InventoryManager.GetItemById(itemId).Name + " ~s~weggeworfen.", false);
|
||||
context.UserItems.Remove(item);
|
||||
}
|
||||
context.SaveChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
public partial class FactionWeaponsRemovedHash : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WeaponHash",
|
||||
table: "FactionWeapons");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WeaponHash",
|
||||
table: "FactionWeapons",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ using ReallifeGamemode.Server.Models;
|
||||
namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20190721184931_FactionWeaponsRemovedHash")]
|
||||
partial class FactionWeaponsRemovedHash
|
||||
[Migration("20190805184145_VehicleItems")]
|
||||
partial class VehicleItems
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -396,7 +396,7 @@ namespace ReallifeGamemode.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("FactionId");
|
||||
b.Property<int?>("FactionId");
|
||||
|
||||
b.Property<int>("Rank");
|
||||
|
||||
@@ -465,10 +465,14 @@ namespace ReallifeGamemode.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("CanRentIn");
|
||||
|
||||
b.Property<int?>("OwnerId");
|
||||
|
||||
b.Property<int>("Price");
|
||||
|
||||
b.Property<int>("RentalFee");
|
||||
|
||||
b.Property<string>("Type");
|
||||
|
||||
b.Property<float>("X");
|
||||
@@ -484,6 +488,24 @@ namespace ReallifeGamemode.Migrations
|
||||
b.ToTable("Houses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int?>("HouseId");
|
||||
|
||||
b.Property<int?>("UserId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HouseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("HouseRentals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -788,6 +810,8 @@ namespace ReallifeGamemode.Migrations
|
||||
|
||||
b.Property<float>("Heading");
|
||||
|
||||
b.Property<int>("Livery");
|
||||
|
||||
b.Property<bool>("Locked");
|
||||
|
||||
b.Property<uint>("Model");
|
||||
@@ -956,6 +980,26 @@ namespace ReallifeGamemode.Migrations
|
||||
b.ToTable("UserItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Amount");
|
||||
|
||||
b.Property<int>("ItemId");
|
||||
|
||||
b.Property<int>("Slot");
|
||||
|
||||
b.Property<int>("VehicleId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehicleId");
|
||||
|
||||
b.ToTable("VehicleItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1119,8 +1163,7 @@ namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
|
||||
.WithMany()
|
||||
.HasForeignKey("FactionId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.HasForeignKey("FactionId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
||||
@@ -1137,6 +1180,17 @@ namespace ReallifeGamemode.Migrations
|
||||
.HasForeignKey("OwnerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.House", "House")
|
||||
.WithMany()
|
||||
.HasForeignKey("HouseId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer")
|
||||
@@ -1199,6 +1253,14 @@ namespace ReallifeGamemode.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehicleId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle")
|
||||
@@ -0,0 +1,50 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
public partial class VehicleItems : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VehicleItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ItemId = table.Column<int>(nullable: false),
|
||||
VehicleId = table.Column<int>(nullable: false),
|
||||
Amount = table.Column<int>(nullable: false),
|
||||
Slot = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VehicleItems", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_VehicleItems_ServerVehicles_VehicleId",
|
||||
column: x => x.VehicleId,
|
||||
principalTable: "ServerVehicles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_VehicleItems_VehicleId",
|
||||
table: "VehicleItems",
|
||||
column: "VehicleId");
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "VehicleItems");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,7 +394,7 @@ namespace ReallifeGamemode.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("FactionId");
|
||||
b.Property<int?>("FactionId");
|
||||
|
||||
b.Property<int>("Rank");
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace ReallifeGamemode.Migrations
|
||||
b.ToTable("Houses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b =>
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
@@ -978,6 +978,26 @@ namespace ReallifeGamemode.Migrations
|
||||
b.ToTable("UserItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Amount");
|
||||
|
||||
b.Property<int>("ItemId");
|
||||
|
||||
b.Property<int>("Slot");
|
||||
|
||||
b.Property<int>("VehicleId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehicleId");
|
||||
|
||||
b.ToTable("VehicleItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1141,8 +1161,7 @@ namespace ReallifeGamemode.Migrations
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction")
|
||||
.WithMany()
|
||||
.HasForeignKey("FactionId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.HasForeignKey("FactionId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b =>
|
||||
@@ -1159,7 +1178,7 @@ namespace ReallifeGamemode.Migrations
|
||||
.HasForeignKey("OwnerId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b =>
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.House", "House")
|
||||
.WithMany()
|
||||
@@ -1232,6 +1251,14 @@ namespace ReallifeGamemode.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehicleId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle")
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace ReallifeGamemode.Server.Models
|
||||
// Server Vehicles
|
||||
public DbSet<Entities.ServerVehicle> ServerVehicles { get; set; }
|
||||
public DbSet<Entities.VehicleMod> VehicleMods { get; set; }
|
||||
public DbSet<Entities.VehicleItem> VehicleItems { get; set; }
|
||||
|
||||
// Whitelist
|
||||
public DbSet<Entities.Whitelist> WhitelistEntries { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user