Finish WeaponDeal System - Improved Inventory
This commit is contained in:
@@ -619,7 +619,7 @@ t#tf_nameorid {
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.5vw;
|
||||
font-size: 0.6vw;
|
||||
position: relative;
|
||||
left: 19vw;
|
||||
top: 13vw;
|
||||
@@ -634,7 +634,7 @@ t#tf_nameorid {
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
font-size: 0.5vw;
|
||||
font-color: white;
|
||||
position: relative;
|
||||
left: 17.8vw;
|
||||
@@ -723,7 +723,7 @@ t#tf_nameorid {
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
font-size: 0.5vw;
|
||||
font-color: white;
|
||||
position: relative;
|
||||
left: 17.8vw;
|
||||
@@ -731,7 +731,7 @@ t#tf_nameorid {
|
||||
color: #ffffff;
|
||||
opacity: 0.5;
|
||||
transition: 0.3s;
|
||||
}
|
||||
}i
|
||||
|
||||
#tf_cancle3:hover {
|
||||
opacity: 1
|
||||
@@ -753,7 +753,7 @@ t#tf_nameorid {
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.5vw;
|
||||
font-size: 0.6vw;
|
||||
position: relative;
|
||||
left: 19vw;
|
||||
top: 13vw;
|
||||
@@ -768,7 +768,7 @@ t#tf_nameorid {
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.5vw;
|
||||
font-size: 0.7vw;
|
||||
font-color: white;
|
||||
position: relative;
|
||||
left: 21vw;
|
||||
@@ -784,8 +784,8 @@ t#tf_nameorid {
|
||||
|
||||
.BoxBlue {
|
||||
background-color: #1b1b1b;
|
||||
height: 10vw;
|
||||
width: 20vw;
|
||||
height: 11.1vw;
|
||||
width: 20.2vw;
|
||||
position: relative;
|
||||
margin-top: 11vw;
|
||||
margin-left: 16vw;
|
||||
@@ -809,12 +809,12 @@ t#tf_nameorid {
|
||||
#tf_submitZahlToHandel {
|
||||
background-color: #008CBA;
|
||||
border: none;
|
||||
height: 1vw;
|
||||
height: 1.4vw;
|
||||
width: 7vw;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.4vw;
|
||||
font-size: 0.6vw;
|
||||
position: relative;
|
||||
left: -3vw;
|
||||
top: 7vw;
|
||||
@@ -830,15 +830,15 @@ t#tf_nameorid {
|
||||
#tf_submitZahlToVehicle {
|
||||
background-color: #008CBA;
|
||||
border: none;
|
||||
height: 1vw;
|
||||
width: 8vw;
|
||||
height: 1.3vw;
|
||||
width: 7.8vw;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.5vw;
|
||||
font-size: 0.6vw;
|
||||
position: relative;
|
||||
left: 10.8vw;
|
||||
top: 5.95vw;
|
||||
top: 5.45vw;
|
||||
color: #ffffff;
|
||||
opacity: 0.5;
|
||||
transition: 0.3s;
|
||||
@@ -871,14 +871,14 @@ select.select_box2 {
|
||||
.blueIcon1 {
|
||||
position: relative;
|
||||
height: 3vw;
|
||||
margin-bottom: -4vw;
|
||||
margin-bottom: -3.1vw;
|
||||
margin-left: 13.4vw;
|
||||
}
|
||||
|
||||
.blueIcon2 {
|
||||
position: relative;
|
||||
height: 3vw;
|
||||
margin-bottom: -3.1vw;
|
||||
margin-bottom: 0.9vw;
|
||||
margin-left: 3.4vw;
|
||||
}
|
||||
|
||||
@@ -916,3 +916,56 @@ select.select_box2 {
|
||||
top: 3vw;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
.alert_green {
|
||||
z-index: 2;
|
||||
background: rgba(85, 255, 0, 0.90);
|
||||
position: relative;
|
||||
width: 17vw;
|
||||
height: 1vw;
|
||||
margin-left: 74.1vw;
|
||||
padding-bottom: 3vw;
|
||||
margin-top: -9.5vw;
|
||||
font-family: 'OSL';
|
||||
font-size: 0.9vw;
|
||||
text-align: center;
|
||||
line-height: 3.9vw;
|
||||
}
|
||||
|
||||
.alert_red {
|
||||
z-index: 2;
|
||||
background: rgba(175, 0, 0, 0.9);
|
||||
position: relative;
|
||||
width: 17vw;
|
||||
height: 1vw;
|
||||
margin-left: 74.1vw;
|
||||
padding-bottom: 3vw;
|
||||
margin-top: -9.5vw;
|
||||
font-family: 'OSL';
|
||||
text-align: center;
|
||||
line-height: 3.9vw;
|
||||
font-size: 0.7vw;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alert_blue {
|
||||
z-index: 2;
|
||||
background: rgba(0, 140, 186, 0.90);
|
||||
position: relative;
|
||||
width: 17vw;
|
||||
height: 1vw;
|
||||
margin-left: 74.1vw;
|
||||
padding-bottom: 3vw;
|
||||
margin-top: -9.5vw;
|
||||
font-family: 'OSL';
|
||||
text-align: center;
|
||||
line-height: 3.9vw;
|
||||
font-size: 0.7vw;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alerts {
|
||||
margin-bottom: 47.5vw;
|
||||
padding-top: 43.3vw;
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
<body>
|
||||
|
||||
<div class="alerts" id='alertbox'>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="sidebar">
|
||||
<ul>
|
||||
@@ -112,7 +116,9 @@
|
||||
function getVehicle() {
|
||||
if (vehInv.length > 0) {
|
||||
switchSite('vehClass');
|
||||
}
|
||||
} else {
|
||||
mp.trigger("Error", "Kofferraum leer oder kein Fahrzeug in der Nähe.")
|
||||
}
|
||||
}
|
||||
|
||||
$("#tf_acceptTrade").unbind('click').click(function () {
|
||||
@@ -258,7 +264,7 @@
|
||||
var redButton = document.createElement("div");
|
||||
var redButtonImg = document.createElement("img");
|
||||
redButton.setAttribute("class", "red");
|
||||
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ");");
|
||||
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ","+ i +");");
|
||||
redButtonImg.setAttribute("src", "img/backpack/trash.svg");
|
||||
redButtonImg.setAttribute("class", "redImg");
|
||||
redButton.appendChild(redButtonImg);
|
||||
@@ -267,7 +273,7 @@
|
||||
var blueButton = document.createElement("div");
|
||||
var blueButtonImg = document.createElement("img");
|
||||
blueButton.setAttribute("class", "blue2");
|
||||
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ");");
|
||||
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ","+ i +");");
|
||||
blueButtonImg.setAttribute("src", "img/backpack/paper-plane.svg");
|
||||
blueButtonImg.setAttribute("class", "blueImg");
|
||||
blueButton.appendChild(blueButtonImg);
|
||||
@@ -381,26 +387,104 @@
|
||||
|
||||
var clnc = 1;
|
||||
|
||||
function alertGreen(JsonAmount, JsonName) {
|
||||
var amount = JSON.parse(JsonAmount);
|
||||
var name = JSON.parse(JsonName);
|
||||
|
||||
var list = document.getElementById("alertbox");
|
||||
var Litem = document.createElement("div");
|
||||
Litem.setAttribute("class", "alert_green");
|
||||
Litem.appendChild(document.createTextNode("Du hast " + amount + "x " + name + " benutzt."));
|
||||
$(Litem).hide().appendTo(list).fadeIn(500);
|
||||
$(Litem).fadeIn(500);
|
||||
setTimeout(function () {
|
||||
$(Litem).fadeOut(500, function () {
|
||||
$(Litem).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function alertRed(JsonAmount, JsonName) {
|
||||
var amount = JSON.parse(JsonAmount);
|
||||
var name = JSON.parse(JsonName);
|
||||
|
||||
var list = document.getElementById("alertbox");
|
||||
var Litem = document.createElement("div");
|
||||
Litem.setAttribute("class", "alert_red");
|
||||
Litem.appendChild(document.createTextNode("Du hast " + amount + "x " + name + " weggeworfen."));
|
||||
$(Litem).hide().appendTo(list).fadeIn(500);
|
||||
$(Litem).fadeIn(500);
|
||||
setTimeout(function () {
|
||||
$(Litem).fadeOut(500, function () {
|
||||
$(Litem).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function alertError(jsonString) {
|
||||
var string = JSON.parse(jsonString);
|
||||
|
||||
var list = document.getElementById("alertbox");
|
||||
var Litem = document.createElement("div");
|
||||
Litem.setAttribute("class", "alert_red");
|
||||
Litem.appendChild(document.createTextNode(string));
|
||||
$(Litem).hide().appendTo(list).fadeIn(500);
|
||||
$(Litem).fadeIn(500);
|
||||
setTimeout(function () {
|
||||
$(Litem).fadeOut(500, function () {
|
||||
$(Litem).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function alertBlue(JsonAmount, JsonName, JsonTransferInv) {
|
||||
var amount = JSON.parse(JsonAmount);
|
||||
var name = JSON.parse(JsonName);
|
||||
var transferInv = JSON.parse(JsonTransferInv);
|
||||
|
||||
var list = document.getElementById("alertbox");
|
||||
var Litem = document.createElement("div");
|
||||
Litem.setAttribute("class", "alert_blue");
|
||||
Litem.appendChild(document.createTextNode("Du hast " + amount + "x " + name + " ins "+transferInv+" transferiert."));
|
||||
$(Litem).hide().appendTo(list).fadeIn(500);
|
||||
$(Litem).fadeIn(500);
|
||||
setTimeout(function () {
|
||||
$(Litem).fadeOut(500, function () {
|
||||
$(Litem).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function removeItems(JsonId, JsonAmount) {
|
||||
|
||||
var amount = JSON.parse(JsonAmount);
|
||||
var id = JSON.parse(JsonId);
|
||||
console.log("start : " + amount +" " + id);
|
||||
for (var i = 0; i < rucksackInv.length; i++) {
|
||||
console.log(i);
|
||||
if (rucksackInv[i].ID == id) {
|
||||
console.log("in Arr : " + i);
|
||||
if (rucksackInv[i].Amount > amount) {
|
||||
rucksackInv[i].Amount -= amount;
|
||||
|
||||
} else if (rucksackInv[i].Amount <= amount) {
|
||||
|
||||
rucksackInv.splice(i, 1);
|
||||
}
|
||||
|
||||
drawRucksack();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onAction(action, id, ammount, i) {
|
||||
$(".Betrag").hide();
|
||||
|
||||
if (action == 0)//green
|
||||
{
|
||||
$(".Betrag").show();
|
||||
$("#tf_submitZahl").unbind('click').click(function () {
|
||||
|
||||
if ($('#tf_zahl').val() < ammount && ammount > 0) {
|
||||
rucksackInv[i].Amount -= $('#tf_zahl').val();
|
||||
} else if ($('#tf_zahl').val() >= ammount) {
|
||||
rucksackInv.splice(i, 1);
|
||||
}
|
||||
|
||||
console.log(i);
|
||||
$(".Betrag").hide();
|
||||
drawRucksack();
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
});
|
||||
mp.trigger("CEF:useItem", JSON.stringify("use"), JSON.stringify(0), JSON.stringify(id))
|
||||
}
|
||||
if (action == 1)//red
|
||||
{
|
||||
@@ -408,14 +492,10 @@
|
||||
$("#tf_submitZahl").unbind('click').click(function () {
|
||||
|
||||
if ($('#tf_zahl').val() < ammount && ammount > 0) {
|
||||
rucksackInv[i].Amount -= $('#tf_zahl').val();
|
||||
mp.trigger("CEF:throwItem", JSON.stringify("drop"), JSON.stringify($('#tf_zahl').val()), JSON.stringify(rucksackInv[i].ID))
|
||||
mp.trigger("CEF:useItem", JSON.stringify("drop"), JSON.stringify($('#tf_zahl').val()), JSON.stringify(rucksackInv[i].ID))
|
||||
} else if ($('#tf_zahl').val() >= ammount) {
|
||||
mp.trigger("CEF:throwItem", JSON.stringify("drop"), JSON.stringify(ammount), JSON.stringify(rucksackInv[i].ID))
|
||||
rucksackInv.splice(i, 1);
|
||||
mp.trigger("CEF:useItem", JSON.stringify("drop"), JSON.stringify(ammount), JSON.stringify(rucksackInv[i].ID))
|
||||
}
|
||||
|
||||
console.log(i);
|
||||
$(".Betrag").hide();
|
||||
drawRucksack();
|
||||
drawVehicle();
|
||||
@@ -479,7 +559,7 @@
|
||||
event.stopPropagation()
|
||||
return;
|
||||
}
|
||||
|
||||
Origin[0] = 0;
|
||||
var y = parseInt($('#tf_zahl2').val(), 10);
|
||||
if ($('#tf_zahl2').val() < ammount && ammount > 0) {
|
||||
|
||||
@@ -555,7 +635,7 @@
|
||||
} else if ($('#tf_zahl3').val() >= ammount) {
|
||||
for (x = 0; x < rucksackInv.length; x++) {
|
||||
if (rucksackInv[x].ID == Copy.ID) {
|
||||
rucksackInv[x].Amount += y;
|
||||
rucksackInv[x].Amount += ammount;
|
||||
handelInv.splice(i, 1);
|
||||
$(".Betrag3").hide();
|
||||
drawHandel();
|
||||
@@ -580,37 +660,39 @@
|
||||
$(".Betrag4").show();
|
||||
var Copy = Object.assign({}, vehInv[i]);
|
||||
$("#tf_submitZahl4").unbind('click').click(function () {
|
||||
Origin[0] = 1;
|
||||
var y = parseInt($('#tf_zahl4').val(), 10);
|
||||
if ($('#tf_zahl4').val() < ammount && ammount > 0) {
|
||||
|
||||
|
||||
for (x = 0; x < rucksackInv.length; x++) {
|
||||
if (rucksackInv[x].ID == Copy.ID) {
|
||||
rucksackInv[x].Amount += y;
|
||||
vehInv[i].Amount -= y;
|
||||
$(".Betrag2").hide();
|
||||
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(vehInv[i].Amount), JSON.stringify(y));
|
||||
drawVehicle();
|
||||
drawRucksack();
|
||||
drawVehicle();
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(rucksackInv);
|
||||
rucksackInv.push(Copy);
|
||||
rucksackInv[rucksackInv.length - 1].Amount = y;
|
||||
rucksackInv[rucksackInv.length - 1].Category = 2;
|
||||
vehInv[i].Amount -= y;
|
||||
mp.trigger("CEF:saveVehicleTransfer",0, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(vehInv[i].Amount), JSON.stringify(y));
|
||||
console.log(rucksackInv);
|
||||
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(vehInv[i].Amount), JSON.stringify(y));
|
||||
} else if ($('#tf_zahl4').val() >= ammount) {
|
||||
for (x = 0; x < rucksackInv.length; x++) {
|
||||
if (rucksackInv[x].ID == Copy.ID) {
|
||||
rucksackInv[x].Amount += y;
|
||||
rucksackInv[x].Amount += ammount;
|
||||
vehInv.splice(i, 1);
|
||||
$(".Betrag2").hide();
|
||||
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
|
||||
drawVehicle();
|
||||
drawRucksack();
|
||||
drawVehicle();
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
return;
|
||||
@@ -618,13 +700,16 @@
|
||||
}
|
||||
|
||||
rucksackInv.push(Copy);
|
||||
rucksackInv[rucksackInv.length - 1].Amount = ammount;
|
||||
rucksackInv[rucksackInv.length - 1].Category = 2;
|
||||
vehInv.splice(i, 1);
|
||||
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
|
||||
}
|
||||
$(".Betrag4").hide();
|
||||
drawVehicle();
|
||||
|
||||
drawRucksack();
|
||||
drawVehicle();
|
||||
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
});
|
||||
@@ -793,7 +878,7 @@
|
||||
var redButton = document.createElement("div");
|
||||
var redButtonImg = document.createElement("img");
|
||||
redButton.setAttribute("class", "red");
|
||||
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ");");
|
||||
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ","+ i +");");
|
||||
redButtonImg.setAttribute("src", "img/backpack/trash.svg");
|
||||
redButtonImg.setAttribute("class", "redImg");
|
||||
redButton.appendChild(redButtonImg);
|
||||
@@ -802,7 +887,7 @@
|
||||
var blueButton = document.createElement("div");
|
||||
var blueButtonImg = document.createElement("img");
|
||||
blueButton.setAttribute("class", "blue2");
|
||||
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ");");
|
||||
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ","+ i +");");
|
||||
blueButtonImg.setAttribute("src", "img/backpack/paper-plane.svg");
|
||||
blueButtonImg.setAttribute("class", "blueImg");
|
||||
blueButton.appendChild(blueButtonImg);
|
||||
|
||||
Reference in New Issue
Block a user