add debug message

This commit is contained in:
Siga
2020-03-23 16:14:50 +01:00
parent 2e06d14693
commit e59b84d6ac
4 changed files with 1561 additions and 27 deletions

View File

@@ -8,6 +8,7 @@
export default function playerBlips() {
mp.events.add("entityStreamIn", (entity) => {
if (entity.type === "player") {
console.log(entity.id);
let color = parseInt(entity.getVariable("blipColor"));
if (entity.blip == 0) entity.createBlip(1);
entity.setBlipColor(isNaN(color) ? 0 : color);

View File

@@ -6,6 +6,12 @@ import maleUndershirts from "./male_undershirts.json";
import maleAccessoires from "./male_accessories.json";
import male_combination from "./male_torso_top_combination.json";
import femaleTops from "./female_tops.json";
import femaleShoes from "./female_shoes.json";
import femaleLegs from "./female_legs.json";
import femaleUndershirts from "./female_undershirts.json";
import femaleAccessoires from "./female_accessories.json";
import female_combination from "./female_torso_top_combination.json";
const UIMenu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
@@ -53,21 +59,44 @@ export default function clotheShopList(globalData: GlobalData) {
let menuTransition = false; // workaround for ItemSelect event being called twice between menu transitions
let lastClothing = null;
function getClothingName(key, ClotheId) {
function getClothingName(key, ClotheId, gender) {
var textures = []
var comb;
var tops;
var undersh;
var shoes;
var legs;
var acces;
if (!gender) {
comb = male_combination;
tops = maleTops;
undersh = maleUndershirts;
shoes = maleShoes;
legs = maleLegs;
acces = maleAccessoires;
} else {
comb = female_combination;
tops = femaleTops;
undersh = femaleUndershirts;
shoes = femaleShoes;
legs = femaleLegs;
acces = femaleAccessoires;
}
switch (key) {
case 11:
for (var i = 0; i < Object.keys(maleTops[ClotheId]).length; i++) {
if (maleTops[ClotheId][i].Localized != "NULL") {
for (var x = 0; x < Object.keys(male_combination.combination).length; x++) {
if (male_combination.combination[x].Top == ClotheId) {
for (var y = 0; y < Object.keys(maleUndershirts[male_combination.combination[x].Undershirt]).length; y++) {
if (maleUndershirts[male_combination.combination[x].Undershirt][y].Localized != "NULL") {
for (var i = 0; i < Object.keys(tops[ClotheId]).length; i++) {
if (tops[ClotheId][i].Localized != "NULL") {
for (var x = 0; x < Object.keys(comb.combination).length; x++) {
if (comb.combination[x].Top == ClotheId) {
for (var y = 0; y < Object.keys(undersh[comb.combination[x].Undershirt]).length; y++) {
if (undersh[comb.combination[x].Undershirt][y].Localized != "NULL") {
const newData = {
id: i,
data: [maleTops[ClotheId][i]],
torso: [male_combination.combination[x].Torso],
undershirt: [male_combination.combination[x].Undershirt, maleUndershirts[male_combination.combination[x].Undershirt][y], y]
data: [tops[ClotheId][i]],
torso: [comb.combination[x].Torso],
undershirt: [comb.combination[x].Undershirt, undersh[comb.combination[x].Undershirt][y], y]
}
textures.push(newData);
}
@@ -78,33 +107,33 @@ export default function clotheShopList(globalData: GlobalData) {
}
break;
case 6:
for (var i = 0; i < Object.keys(maleShoes[ClotheId]).length; i++) {
if (maleShoes[ClotheId][i].Localized != "NULL") {
for (var i = 0; i < Object.keys(shoes[ClotheId]).length; i++) {
if (shoes[ClotheId][i].Localized != "NULL") {
const newData = {
id: i,
data: [maleShoes[ClotheId][i]]
data: [shoes[ClotheId][i]]
}
textures.push(newData);
}
}
break;
case 4:
for (var i = 0; i < Object.keys(maleLegs[ClotheId]).length; i++) {
if (maleLegs[ClotheId][i].Localized != "NULL") {
for (var i = 0; i < Object.keys(legs[ClotheId]).length; i++) {
if (legs[ClotheId][i].Localized != "NULL") {
const newData = {
id: i,
data: [maleLegs[ClotheId][i]]
data: [legs[ClotheId][i]]
}
textures.push(newData);
}
}
break;
case 7:
for (var i = 0; i < Object.keys(maleAccessoires[ClotheId]).length; i++) {
if (maleAccessoires[ClotheId][i].Localized != "NULL") {
for (var i = 0; i < Object.keys(acces[ClotheId]).length; i++) {
if (acces[ClotheId][i].Localized != "NULL") {
const newData = {
id: i,
data: [maleAccessoires[ClotheId][i]]
data: [acces[ClotheId][i]]
}
textures.push(newData);
}
@@ -114,7 +143,7 @@ export default function clotheShopList(globalData: GlobalData) {
return textures;
}
function addClothingItems(type, bannerSprite, key, value) {
function addClothingItems(type, bannerSprite, key, value, gender) {
var categoryMenu;
var cloth = [];
var tx = [];
@@ -142,7 +171,7 @@ export default function clotheShopList(globalData: GlobalData) {
for (const item of value) {
if (item.ComponentId == key) {
var txData = getClothingName(key, item.ClotheId);
var txData = getClothingName(key, item.ClotheId, gender);
for (const x of txData) {
var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : "Clothing item.");
@@ -234,7 +263,7 @@ export default function clotheShopList(globalData: GlobalData) {
}
mp.events.add("clothesMenu:updateData", (jsonBannerSprite, jsonData) => {
mp.events.add("clothesMenu:updateData", (jsonBannerSprite, jsonData, gender) => {
if (!globalData.InMenu) {
globalData.InMenu = true;
playerPos = localPlayer.position;
@@ -281,10 +310,10 @@ export default function clotheShopList(globalData: GlobalData) {
// Add clothes
addClothingItems("clothes", bannerSprite, 11, data[0]);
addClothingItems("clothes", bannerSprite, 4, data[1]);
addClothingItems("clothes", bannerSprite, 6, data[2]);
addClothingItems("clothes", bannerSprite, 7, data[3]);
addClothingItems("clothes", bannerSprite, 11, data[0], gender);
addClothingItems("clothes", bannerSprite, 4, data[1], gender);
addClothingItems("clothes", bannerSprite, 6, data[2], gender);
addClothingItems("clothes", bannerSprite, 7, data[3], gender);
myVar = setInterval(myTimer, 100);
// Add props
// for (const [key, value] of Object.entries(clothingData.props)) addClothingItems("props", bannerSprite, key, value);

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,7 @@ namespace ReallifeGamemode.Server.Shop.Clothing
accessoires.ToArray()
};
client.TriggerEvent("clothesMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(clothes.ToArray()));
client.TriggerEvent("clothesMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(clothes.ToArray()), gender);
}
}
}