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() { export default function playerBlips() {
mp.events.add("entityStreamIn", (entity) => { mp.events.add("entityStreamIn", (entity) => {
if (entity.type === "player") { if (entity.type === "player") {
console.log(entity.id);
let color = parseInt(entity.getVariable("blipColor")); let color = parseInt(entity.getVariable("blipColor"));
if (entity.blip == 0) entity.createBlip(1); if (entity.blip == 0) entity.createBlip(1);
entity.setBlipColor(isNaN(color) ? 0 : color); 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 maleAccessoires from "./male_accessories.json";
import male_combination from "./male_torso_top_combination.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 UIMenu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem; 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 menuTransition = false; // workaround for ItemSelect event being called twice between menu transitions
let lastClothing = null; let lastClothing = null;
function getClothingName(key, ClotheId) { function getClothingName(key, ClotheId, gender) {
var textures = [] 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) { switch (key) {
case 11: case 11:
for (var i = 0; i < Object.keys(maleTops[ClotheId]).length; i++) { for (var i = 0; i < Object.keys(tops[ClotheId]).length; i++) {
if (maleTops[ClotheId][i].Localized != "NULL") { if (tops[ClotheId][i].Localized != "NULL") {
for (var x = 0; x < Object.keys(male_combination.combination).length; x++) { for (var x = 0; x < Object.keys(comb.combination).length; x++) {
if (male_combination.combination[x].Top == ClotheId) { if (comb.combination[x].Top == ClotheId) {
for (var y = 0; y < Object.keys(maleUndershirts[male_combination.combination[x].Undershirt]).length; y++) { for (var y = 0; y < Object.keys(undersh[comb.combination[x].Undershirt]).length; y++) {
if (maleUndershirts[male_combination.combination[x].Undershirt][y].Localized != "NULL") { if (undersh[comb.combination[x].Undershirt][y].Localized != "NULL") {
const newData = { const newData = {
id: i, id: i,
data: [maleTops[ClotheId][i]], data: [tops[ClotheId][i]],
torso: [male_combination.combination[x].Torso], torso: [comb.combination[x].Torso],
undershirt: [male_combination.combination[x].Undershirt, maleUndershirts[male_combination.combination[x].Undershirt][y], y] undershirt: [comb.combination[x].Undershirt, undersh[comb.combination[x].Undershirt][y], y]
} }
textures.push(newData); textures.push(newData);
} }
@@ -78,33 +107,33 @@ export default function clotheShopList(globalData: GlobalData) {
} }
break; break;
case 6: case 6:
for (var i = 0; i < Object.keys(maleShoes[ClotheId]).length; i++) { for (var i = 0; i < Object.keys(shoes[ClotheId]).length; i++) {
if (maleShoes[ClotheId][i].Localized != "NULL") { if (shoes[ClotheId][i].Localized != "NULL") {
const newData = { const newData = {
id: i, id: i,
data: [maleShoes[ClotheId][i]] data: [shoes[ClotheId][i]]
} }
textures.push(newData); textures.push(newData);
} }
} }
break; break;
case 4: case 4:
for (var i = 0; i < Object.keys(maleLegs[ClotheId]).length; i++) { for (var i = 0; i < Object.keys(legs[ClotheId]).length; i++) {
if (maleLegs[ClotheId][i].Localized != "NULL") { if (legs[ClotheId][i].Localized != "NULL") {
const newData = { const newData = {
id: i, id: i,
data: [maleLegs[ClotheId][i]] data: [legs[ClotheId][i]]
} }
textures.push(newData); textures.push(newData);
} }
} }
break; break;
case 7: case 7:
for (var i = 0; i < Object.keys(maleAccessoires[ClotheId]).length; i++) { for (var i = 0; i < Object.keys(acces[ClotheId]).length; i++) {
if (maleAccessoires[ClotheId][i].Localized != "NULL") { if (acces[ClotheId][i].Localized != "NULL") {
const newData = { const newData = {
id: i, id: i,
data: [maleAccessoires[ClotheId][i]] data: [acces[ClotheId][i]]
} }
textures.push(newData); textures.push(newData);
} }
@@ -114,7 +143,7 @@ export default function clotheShopList(globalData: GlobalData) {
return textures; return textures;
} }
function addClothingItems(type, bannerSprite, key, value) { function addClothingItems(type, bannerSprite, key, value, gender) {
var categoryMenu; var categoryMenu;
var cloth = []; var cloth = [];
var tx = []; var tx = [];
@@ -142,7 +171,7 @@ export default function clotheShopList(globalData: GlobalData) {
for (const item of value) { for (const item of value) {
if (item.ComponentId == key) { if (item.ComponentId == key) {
var txData = getClothingName(key, item.ClotheId); var txData = getClothingName(key, item.ClotheId, gender);
for (const x of txData) { for (const x of txData) {
var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : "Clothing item."); 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) { if (!globalData.InMenu) {
globalData.InMenu = true; globalData.InMenu = true;
playerPos = localPlayer.position; playerPos = localPlayer.position;
@@ -281,10 +310,10 @@ export default function clotheShopList(globalData: GlobalData) {
// Add clothes // Add clothes
addClothingItems("clothes", bannerSprite, 11, data[0]); addClothingItems("clothes", bannerSprite, 11, data[0], gender);
addClothingItems("clothes", bannerSprite, 4, data[1]); addClothingItems("clothes", bannerSprite, 4, data[1], gender);
addClothingItems("clothes", bannerSprite, 6, data[2]); addClothingItems("clothes", bannerSprite, 6, data[2], gender);
addClothingItems("clothes", bannerSprite, 7, data[3]); addClothingItems("clothes", bannerSprite, 7, data[3], gender);
myVar = setInterval(myTimer, 100); myVar = setInterval(myTimer, 100);
// Add props // Add props
// for (const [key, value] of Object.entries(clothingData.props)) addClothingItems("props", bannerSprite, key, value); // 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() 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);
} }
} }
} }