[#] Finish Inventory System
This commit is contained in:
@@ -692,6 +692,29 @@ t#tf_nameorid {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
#tf_acceptTrade {
|
||||
background-color: #009b03;
|
||||
border: none;
|
||||
height: 1.6vw;
|
||||
width: 4vw;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 0.5vw;
|
||||
font-color: white;
|
||||
position: absolute;
|
||||
color: #ffffff;
|
||||
top: 3vw;
|
||||
left: 29.3vw;
|
||||
opacity: 0.5;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
#tf_acceptTrade:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#tf_cancle3 {
|
||||
background-color: #ff0000;
|
||||
border: none;
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
|
||||
<div name="anfrageClass" class="something hidden">
|
||||
<div class="main">
|
||||
<button id='tf_acceptTrade' onclick="">Annehmen</button>
|
||||
<div class="title"><div class="titlecount"><span id="count4">0</span> Kilogramm</div><div class="titletext">Anfrage</div></div>
|
||||
<div class="items">
|
||||
<ul id="List3"></ul>
|
||||
@@ -108,6 +109,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
$("#tf_acceptTrade").unbind('click').click(function () {
|
||||
if (anfrageInv.length > 0) {
|
||||
mp.trigger("CEF:acceptTrade");
|
||||
}
|
||||
});
|
||||
|
||||
$("#tf_submitTrade").unbind('click').click(function () {
|
||||
if (handelInv.length > 0) {
|
||||
var handelItemID = [];
|
||||
@@ -116,7 +123,7 @@
|
||||
handelItemID.push(handelInv[i].ID);
|
||||
handelItemAmount.push(handelInv[i].Amount);
|
||||
}
|
||||
mp.trigger("CEF:tradeItem", 0, JSON.stringify(String($('#fname').val())), JSON.stringify(handelItemID), JSON.stringify(handelItemAmount))
|
||||
mp.trigger("CEF:tradeItem", 0, JSON.stringify(String($('#tf_nameorid').val())), JSON.stringify(handelItemID), JSON.stringify(handelItemAmount))
|
||||
}
|
||||
});
|
||||
$("#tf_cancle4").unbind('click').click(function () {
|
||||
@@ -872,7 +879,6 @@
|
||||
Litem.setAttribute("name", "List" + item.Category);
|
||||
Litem.appendChild(document.createTextNode(quantity + "x " + item.Name));
|
||||
Litem.appendChild(pictureElement);
|
||||
Litem.appendChild(blueButton);
|
||||
list.appendChild(Litem);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,16 +45,28 @@ export default function inventory(globalData: GlobalData): void {
|
||||
invBrowser = mp.browsers.new("package://assets/html/inventory/inventory.html");
|
||||
}
|
||||
});
|
||||
var offer = 0;
|
||||
|
||||
var tradeItemID;
|
||||
var tradeItemAmount;
|
||||
var tradeItemName;
|
||||
var tradeItemWeight;
|
||||
|
||||
mp.events.addDataHandler("tradeOffer", (entity, value) => {
|
||||
if (entity.type === "player") {
|
||||
let offer = parseInt(value);
|
||||
invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`);
|
||||
offer = parseInt(value);
|
||||
if (invBrowser != null)
|
||||
invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`);
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("addTradeItems", (itemId, itemAmount, itemName, weight) => {
|
||||
invBrowser.execute(`setAnfrage('${JSON.stringify(itemId)}','${JSON.stringify(itemAmount)}','${JSON.stringify(itemName)}','${JSON.stringify(weight)}');`);
|
||||
tradeItemID = JSON.stringify(itemId);
|
||||
tradeItemAmount = JSON.stringify(itemAmount);
|
||||
tradeItemName = JSON.stringify(itemName);
|
||||
tradeItemWeight = JSON.stringify(weight);
|
||||
if (invBrowser != null)
|
||||
invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`);
|
||||
});
|
||||
|
||||
mp.events.add("CEF:saveVehicleTransfer", (val, jsonOrigin, jsonInvID, jsonInvAmount, jsonVehAmount) => {
|
||||
@@ -75,6 +87,11 @@ export default function inventory(globalData: GlobalData): void {
|
||||
});
|
||||
|
||||
mp.events.add("CEF:InventoryLoaded", () => {
|
||||
if (offer == 1) {
|
||||
invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`);
|
||||
invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`);
|
||||
}
|
||||
|
||||
invBrowser.execute(`setItems('${JSON.stringify(itemNameArr)}','${JSON.stringify(itemIdArr)}','${JSON.stringify(itemAmountArr)}','${JSON.stringify(Players)}');`);
|
||||
invBrowser.execute(`setWeight('${JSON.stringify(invWeight)}');`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user