Clothe Shop finished
This commit is contained in:
@@ -1,233 +0,0 @@
|
|||||||
import * as NativeUI from 'NativeUI';
|
|
||||||
|
|
||||||
const UIMenu = NativeUI.Menu;
|
|
||||||
const UIMenuItem = NativeUI.UIMenuItem;
|
|
||||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
|
||||||
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
|
||||||
const BadgeStyle = NativeUI.BadgeStyle;
|
|
||||||
const Point = NativeUI.Point;
|
|
||||||
const ItemsCollection = NativeUI.ItemsCollection;
|
|
||||||
const Color = NativeUI.Color;
|
|
||||||
|
|
||||||
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
|
||||||
let saveItem = new UIMenuItem("Bestätigen", "");
|
|
||||||
saveItem.BackColor = new Color(13, 71, 161);
|
|
||||||
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
|
||||||
|
|
||||||
let cancelItem = new UIMenuItem("Abbrechen", "");
|
|
||||||
cancelItem.BackColor = new Color(213, 0, 0);
|
|
||||||
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
|
||||||
|
|
||||||
export default function clotheShopList(globalData: GlobalData) {
|
|
||||||
|
|
||||||
const categoryTitles = {
|
|
||||||
clothes: {
|
|
||||||
1: "Masks",
|
|
||||||
2: "Hair Styles",
|
|
||||||
3: "Torsos",
|
|
||||||
4: "Legs",
|
|
||||||
5: "Bags and Parachutes",
|
|
||||||
6: "Shoes",
|
|
||||||
7: "Accessories",
|
|
||||||
8: "Undershirts",
|
|
||||||
9: "Body Armors",
|
|
||||||
10: "Decals",
|
|
||||||
11: "Tops"
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
|
||||||
0: "Hats",
|
|
||||||
1: "Glasses",
|
|
||||||
2: "Ears",
|
|
||||||
6: "Watches",
|
|
||||||
7: "Bracelets"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const localPlayer = mp.players.local;
|
|
||||||
|
|
||||||
let mainMenu = null;
|
|
||||||
let categoryMenus = [];
|
|
||||||
let clothingData = {} as any;
|
|
||||||
let currentMenuIdx = -1;
|
|
||||||
let menuTransition = false; // workaround for ItemSelect event being called twice between menu transitions
|
|
||||||
let lastClothing = null;
|
|
||||||
|
|
||||||
function addClothingItems(type, bannerSprite, key, value) {
|
|
||||||
mainMenu.AddItem(new UIMenuItem(categoryTitles[type][key], `${type === "props" ? "Prop category." : "Clothing category."}`));
|
|
||||||
|
|
||||||
// Create category menu
|
|
||||||
const categoryMenu = new UIMenu("", categoryTitles[type][key].toUpperCase(), new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
|
||||||
categoryMenu.Visible = false;
|
|
||||||
|
|
||||||
// Fill it
|
|
||||||
const itemDescription = (type === "props" ? "Prop item." : "Clothing item.");
|
|
||||||
|
|
||||||
for (const item of value) {
|
|
||||||
const tempItem = new UIMenuItem(item.name, itemDescription);
|
|
||||||
tempItem.SetRightLabel(`${Number.isInteger(item.price) ? `$${item.price}` : "FREE"}`);
|
|
||||||
|
|
||||||
categoryMenu.AddItem(tempItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
categoryMenus.push({
|
|
||||||
menu: categoryMenu,
|
|
||||||
type: type,
|
|
||||||
slotIdx: Number(key)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function submenuItemChangeHandler(newIndex) {
|
|
||||||
const currentMenu = categoryMenus[currentMenuIdx];
|
|
||||||
const currentItem = clothingData[currentMenu.type][currentMenu.slotIdx][newIndex];
|
|
||||||
|
|
||||||
switch (currentMenu.type) {
|
|
||||||
case "clothes":
|
|
||||||
localPlayer.setComponentVariation(currentMenu.slotIdx, currentItem.drawable, currentItem.texture, 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "props":
|
|
||||||
if (currentItem.drawable === -1) {
|
|
||||||
localPlayer.clearProp(currentMenu.slotIdx);
|
|
||||||
} else {
|
|
||||||
localPlayer.setPropIndex(currentMenu.slotIdx, currentItem.drawable, currentItem.texture, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetPreview() {
|
|
||||||
if (lastClothing) {
|
|
||||||
switch (lastClothing.type) {
|
|
||||||
case "clothes":
|
|
||||||
localPlayer.setComponentVariation(lastClothing.slotIdx, lastClothing.drawable, lastClothing.texture, 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "props":
|
|
||||||
if (lastClothing.drawable === -1) {
|
|
||||||
localPlayer.clearProp(lastClothing.slotIdx);
|
|
||||||
} else {
|
|
||||||
localPlayer.setPropIndex(lastClothing.slotIdx, lastClothing.drawable, lastClothing.texture, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastClothing = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mp.events.add("clothesMenu:updateData", (jsonBannerSprite, jsonData) => {
|
|
||||||
var bannerSprite = JSON.parse(jsonBannerSprite);
|
|
||||||
var data = JSON.parse(jsonData);
|
|
||||||
|
|
||||||
// Default menu banner
|
|
||||||
if (bannerSprite == null) {
|
|
||||||
bannerSprite = {
|
|
||||||
library: "commonmenu",
|
|
||||||
texture: "interaction_bgd"
|
|
||||||
};
|
|
||||||
} else if (bannerSprite == 1) {
|
|
||||||
bannerSprite = {
|
|
||||||
library: "shopui_title_lowendfashion",
|
|
||||||
texture: "shopui_title_lowendfashion"
|
|
||||||
};
|
|
||||||
} else if (bannerSprite == 2) {
|
|
||||||
bannerSprite = {
|
|
||||||
library: "shopui_title_midfashion",
|
|
||||||
texture: "shopui_title_midfashion"
|
|
||||||
};
|
|
||||||
} else if (bannerSprite == 3) {
|
|
||||||
bannerSprite = {
|
|
||||||
library: "shopui_title_highendfashion",
|
|
||||||
texture: "shopui_title_highendfashion"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// Hide the chat
|
|
||||||
mp.gui.chat.show(false);
|
|
||||||
|
|
||||||
// Reset some variables
|
|
||||||
categoryMenus = [];
|
|
||||||
currentMenuIdx = -1;
|
|
||||||
menuTransition = false;
|
|
||||||
lastClothing = null;
|
|
||||||
|
|
||||||
// Create a new main menu
|
|
||||||
mainMenu = new UIMenu("", "SELECT A CATEGORY", new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
|
||||||
mainMenu.Visible = true;
|
|
||||||
|
|
||||||
// Update clothingData
|
|
||||||
clothingData = data;
|
|
||||||
|
|
||||||
// Add clothes
|
|
||||||
for (const [key, value] of Object.entries(clothingData)) addClothingItems("clothes", bannerSprite, key, value);
|
|
||||||
|
|
||||||
// Add props
|
|
||||||
// for (const [key, value] of Object.entries(clothingData.props)) addClothingItems("props", bannerSprite, key, value);
|
|
||||||
|
|
||||||
// Submenu events
|
|
||||||
for (const item of categoryMenus) {
|
|
||||||
// Preview hovering item
|
|
||||||
item.menu.IndexChange.on(submenuItemChangeHandler);
|
|
||||||
|
|
||||||
// Buy hovering item
|
|
||||||
item.menu.ItemSelect.on((selectedItem, itemIndex) => {
|
|
||||||
if (menuTransition) {
|
|
||||||
menuTransition = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentMenu = categoryMenus[currentMenuIdx];
|
|
||||||
const currentItem = clothingData[currentMenu.type][currentMenu.slotIdx][itemIndex];
|
|
||||||
mp.events.callRemote("buyClothingItem", currentMenu.type, currentMenu.slotIdx, currentItem.texture, currentItem.drawable, currentItem.price);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset preview when player backs out of category menu
|
|
||||||
item.menu.MenuClose.on(() => {
|
|
||||||
resetPreview();
|
|
||||||
|
|
||||||
currentMenuIdx = -1;
|
|
||||||
mainMenu.Visible = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main menu events
|
|
||||||
mainMenu.ItemSelect.on((selectedItem, itemIndex) => {
|
|
||||||
const nextMenu = categoryMenus[itemIndex];
|
|
||||||
const slot = Number(nextMenu.slotIdx);
|
|
||||||
|
|
||||||
lastClothing = {
|
|
||||||
type: nextMenu.type,
|
|
||||||
slotIdx: slot,
|
|
||||||
drawable: (nextMenu.type === "props" ? localPlayer.getPropIndex(slot) : localPlayer.getDrawableVariation(slot)),
|
|
||||||
texture: (nextMenu.type === "props" ? localPlayer.getPropTextureIndex(slot) : localPlayer.getTextureVariation(slot))
|
|
||||||
};
|
|
||||||
|
|
||||||
currentMenuIdx = itemIndex;
|
|
||||||
mainMenu.Visible = false;
|
|
||||||
nextMenu.menu.Visible = true;
|
|
||||||
menuTransition = true;
|
|
||||||
|
|
||||||
submenuItemChangeHandler(nextMenu.menu.CurrentSelection);
|
|
||||||
});
|
|
||||||
|
|
||||||
mainMenu.MenuClose.on(() => {
|
|
||||||
mp.gui.chat.show(true);
|
|
||||||
|
|
||||||
currentMenuIdx = -1;
|
|
||||||
lastClothing = null;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
mp.events.add("clothesMenu:updateLast", (drawable, texture) => {
|
|
||||||
if (lastClothing) {
|
|
||||||
lastClothing.drawable = drawable;
|
|
||||||
lastClothing.texture = texture;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mp.events.add("clothesMenu:close", () => {
|
|
||||||
if (currentMenuIdx !== -1) categoryMenus[currentMenuIdx].menu.Close();
|
|
||||||
if (mainMenu && mainMenu.Visible) mainMenu.Close();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
393
ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts
Normal file
393
ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts
Normal file
@@ -0,0 +1,393 @@
|
|||||||
|
import * as NativeUI from 'NativeUI';
|
||||||
|
import maleTops from "./male_tops.json";
|
||||||
|
import maleShoes from "./male_shoes.json";
|
||||||
|
import maleLegs from "./male_legs.json";
|
||||||
|
import maleUndershirts from "./male_undershirts.json";
|
||||||
|
import maleAccessoires from "./male_accessories.json";
|
||||||
|
import male_combination from "./male_torso_top_combination.json";
|
||||||
|
import playerBlips from '../../Gui/blips.js';
|
||||||
|
|
||||||
|
const UIMenu = NativeUI.Menu;
|
||||||
|
const UIMenuItem = NativeUI.UIMenuItem;
|
||||||
|
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||||
|
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||||
|
const BadgeStyle = NativeUI.BadgeStyle;
|
||||||
|
const Point = NativeUI.Point;
|
||||||
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
|
const Color = NativeUI.Color;
|
||||||
|
|
||||||
|
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||||
|
let saveItem = new UIMenuItem("Bestätigen", "");
|
||||||
|
saveItem.BackColor = new Color(13, 71, 161);
|
||||||
|
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
||||||
|
|
||||||
|
let cancelItem = new UIMenuItem("Abbrechen", "");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
|
||||||
|
export default function clotheShopList(globalData: GlobalData) {
|
||||||
|
const categoryTitles = {
|
||||||
|
clothes: {
|
||||||
|
1: "Masks",
|
||||||
|
2: "Hair Styles",
|
||||||
|
3: "Torsos",
|
||||||
|
4: "Legs",
|
||||||
|
5: "Bags and Parachutes",
|
||||||
|
6: "Shoes",
|
||||||
|
7: "Accessories",
|
||||||
|
8: "Undershirts",
|
||||||
|
9: "Body Armors",
|
||||||
|
10: "Decals",
|
||||||
|
11: "Tops"
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
0: "Hats",
|
||||||
|
1: "Glasses",
|
||||||
|
2: "Ears",
|
||||||
|
6: "Watches",
|
||||||
|
7: "Bracelets"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const localPlayer = mp.players.local;
|
||||||
|
var playerPos;
|
||||||
|
var myVar;
|
||||||
|
|
||||||
|
let mainMenu = null;
|
||||||
|
let categoryMenus = [];
|
||||||
|
let clothingData = [];
|
||||||
|
let currentMenuIdx = -1;
|
||||||
|
let menuTransition = false; // workaround for ItemSelect event being called twice between menu transitions
|
||||||
|
let lastClothing = null;
|
||||||
|
|
||||||
|
function getClothingName(key, ClotheId) {
|
||||||
|
var textures = []
|
||||||
|
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") {
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
textures.push(newData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
for (var i = 0; i < Object.keys(maleShoes[ClotheId]).length; i++) {
|
||||||
|
if (maleShoes[ClotheId][i].Localized != "NULL") {
|
||||||
|
const newData = {
|
||||||
|
id: i,
|
||||||
|
data: [maleShoes[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") {
|
||||||
|
const newData = {
|
||||||
|
id: i,
|
||||||
|
data: [maleLegs[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") {
|
||||||
|
const newData = {
|
||||||
|
id: i,
|
||||||
|
data: [maleAccessoires[ClotheId][i]]
|
||||||
|
}
|
||||||
|
textures.push(newData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addClothingItems(type, bannerSprite, key, value) {
|
||||||
|
var categoryMenu;
|
||||||
|
var cloth = [];
|
||||||
|
var tx = [];
|
||||||
|
|
||||||
|
if (Object.keys(categoryMenus).length > 0) {
|
||||||
|
for (var i = 0; i < categoryMenus.length; i++) {
|
||||||
|
if (categoryMenus[i].slotIdx == key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mainMenu.AddItem(new UIMenuItem(categoryTitles[type][key], `${type === "props" ? "Prop category." : "Clothing category."}`));
|
||||||
|
// Create category menu
|
||||||
|
categoryMenu = new UIMenu("", categoryTitles[type][key].toUpperCase(), new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
||||||
|
categoryMenu.Visible = false;
|
||||||
|
} else {
|
||||||
|
mainMenu.AddItem(new UIMenuItem(categoryTitles[type][key], `${type === "props" ? "Prop category." : "Clothing category."}`));
|
||||||
|
// Create category menu
|
||||||
|
categoryMenu = new UIMenu("", categoryTitles[type][key].toUpperCase(), new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
||||||
|
categoryMenu.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainMenu.Item
|
||||||
|
|
||||||
|
// Fill it
|
||||||
|
|
||||||
|
for (const item of value) {
|
||||||
|
if (item.ComponentId == key) {
|
||||||
|
var txData = getClothingName(key, item.ClotheId);
|
||||||
|
|
||||||
|
for (const x of txData) {
|
||||||
|
var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : "Clothing item.");
|
||||||
|
if (itemDescription == "NULL") {
|
||||||
|
itemDescription = "Clothing item.";
|
||||||
|
}
|
||||||
|
const tempItem = new UIMenuItem(mp.game.ui.getLabelText(x.data[0].GXT), itemDescription);
|
||||||
|
|
||||||
|
tempItem.SetRightLabel(`${item.Price > 0 ? `$${item.Price}` : "FREE"}`);
|
||||||
|
|
||||||
|
categoryMenu.AddItem(tempItem);
|
||||||
|
|
||||||
|
cloth.push(item);
|
||||||
|
tx.push(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
categoryMenus.push({
|
||||||
|
menu: categoryMenu,
|
||||||
|
type: type,
|
||||||
|
slotIdx: Number(key),
|
||||||
|
item: cloth,
|
||||||
|
texture: tx
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function submenuItemChangeHandler(newIndex) {
|
||||||
|
const currentMenu = categoryMenus[currentMenuIdx];
|
||||||
|
const currentItem = currentMenu.item[newIndex];
|
||||||
|
const currentTexture = currentMenu.texture[newIndex].id;
|
||||||
|
//const currentItem = clothingData[currentMenu.type][currentMenu.slotIdx][newIndex];
|
||||||
|
|
||||||
|
if (currentMenu.slotIdx == 11) {
|
||||||
|
const currentTorso = currentMenu.texture[newIndex].torso[0];
|
||||||
|
const currentUndershirt = currentMenu.texture[newIndex].undershirt;
|
||||||
|
mp.players.local.setComponentVariation(3, currentTorso, 0, 2); //set Torso
|
||||||
|
mp.players.local.setComponentVariation(8, currentUndershirt[0], currentUndershirt[2], 2); //set Undershirt
|
||||||
|
mp.players.local.setComponentVariation(currentMenu.slotIdx, currentItem.ClotheId, currentTexture, 2); //set Top
|
||||||
|
} else {
|
||||||
|
mp.players.local.setComponentVariation(currentMenu.slotIdx, currentItem.ClotheId, currentTexture, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
case "props":
|
||||||
|
if (currentItem.drawable === -1) {
|
||||||
|
localPlayer.clearProp(currentMenu.slotIdx);
|
||||||
|
} else {
|
||||||
|
localPlayer.setPropIndex(currentMenu.slotIdx, currentItem.drawable, currentItem.texture, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPreview() {
|
||||||
|
if (lastClothing) {
|
||||||
|
switch (lastClothing.type) {
|
||||||
|
case "clothes":
|
||||||
|
if (lastClothing.slotIdx == 11) {
|
||||||
|
localPlayer.setComponentVariation(3, lastClothing.torso, 0, 2);
|
||||||
|
localPlayer.setComponentVariation(8, lastClothing.undershirt[0], lastClothing.undershirt[1], 2);
|
||||||
|
localPlayer.setComponentVariation(lastClothing.slotIdx, lastClothing.drawable, lastClothing.texture, 2);
|
||||||
|
} else {
|
||||||
|
localPlayer.setComponentVariation(lastClothing.slotIdx, lastClothing.drawable, lastClothing.texture, 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "props":
|
||||||
|
if (lastClothing.drawable === -1) {
|
||||||
|
localPlayer.clearProp(lastClothing.slotIdx);
|
||||||
|
} else {
|
||||||
|
localPlayer.setPropIndex(lastClothing.slotIdx, lastClothing.drawable, lastClothing.texture, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastClothing = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function myTimer() {
|
||||||
|
let dist = mp.game.gameplay.getDistanceBetweenCoords(localPlayer.position.x, localPlayer.position.y, 0, playerPos.x, playerPos.y, 0, false);
|
||||||
|
if (dist > 3) {
|
||||||
|
clearInterval(myVar);
|
||||||
|
resetPreview();
|
||||||
|
if (currentMenuIdx !== -1) categoryMenus[currentMenuIdx].menu.Close();
|
||||||
|
if (mainMenu && mainMenu.Visible) mainMenu.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mp.events.add("clothesMenu:updateData", (jsonBannerSprite, jsonData) => {
|
||||||
|
if (!globalData.InMenu) {
|
||||||
|
globalData.InMenu = true;
|
||||||
|
playerPos = localPlayer.position;
|
||||||
|
var bannerSprite = JSON.parse(jsonBannerSprite);
|
||||||
|
var data = JSON.parse(jsonData);
|
||||||
|
|
||||||
|
// Default menu banner
|
||||||
|
if (bannerSprite == null) {
|
||||||
|
bannerSprite = {
|
||||||
|
library: "commonmenu",
|
||||||
|
texture: "interaction_bgd"
|
||||||
|
};
|
||||||
|
} else if (bannerSprite == 1) {
|
||||||
|
bannerSprite = {
|
||||||
|
library: "shopui_title_lowendfashion",
|
||||||
|
texture: "shopui_title_lowendfashion"
|
||||||
|
};
|
||||||
|
} else if (bannerSprite == 2) {
|
||||||
|
bannerSprite = {
|
||||||
|
library: "shopui_title_midfashion",
|
||||||
|
texture: "shopui_title_midfashion"
|
||||||
|
};
|
||||||
|
} else if (bannerSprite == 3) {
|
||||||
|
bannerSprite = {
|
||||||
|
library: "shopui_title_highendfashion",
|
||||||
|
texture: "shopui_title_highendfashion"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Hide the chat
|
||||||
|
mp.gui.chat.show(false);
|
||||||
|
|
||||||
|
// Reset some variables
|
||||||
|
categoryMenus = [];
|
||||||
|
currentMenuIdx = -1;
|
||||||
|
menuTransition = false;
|
||||||
|
lastClothing = null;
|
||||||
|
|
||||||
|
// Create a new main menu
|
||||||
|
mainMenu = new UIMenu("", "SELECT A CATEGORY", new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
||||||
|
mainMenu.Visible = true;
|
||||||
|
|
||||||
|
// Update clothingData
|
||||||
|
clothingData = data;
|
||||||
|
|
||||||
|
// 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]);
|
||||||
|
myVar = setInterval(myTimer, 100);
|
||||||
|
// Add props
|
||||||
|
// for (const [key, value] of Object.entries(clothingData.props)) addClothingItems("props", bannerSprite, key, value);
|
||||||
|
|
||||||
|
// Submenu events
|
||||||
|
for (const item of categoryMenus) {
|
||||||
|
// Preview hovering item
|
||||||
|
item.menu.IndexChange.on(submenuItemChangeHandler);
|
||||||
|
|
||||||
|
// Buy hovering item
|
||||||
|
item.menu.ItemSelect.on((selectedItem, itemIndex) => {
|
||||||
|
if (menuTransition) {
|
||||||
|
menuTransition = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentMenu = categoryMenus[currentMenuIdx];
|
||||||
|
const currentItem = currentMenu.item[itemIndex];
|
||||||
|
const currentTexture = currentMenu.texture[itemIndex].id;
|
||||||
|
if (currentMenu.slotIdx == 11) {
|
||||||
|
const currentTorso = currentMenu.texture[itemIndex].torso[0];
|
||||||
|
const currentUndershirt = currentMenu.texture[itemIndex].undershirt;
|
||||||
|
var serverData = [currentMenu.slotIdx, currentTexture, currentItem.ClotheId, currentTorso, currentUndershirt[0], currentUndershirt[2], currentItem.Price];
|
||||||
|
if (lastClothing.drawable == currentItem.ClotheId && lastClothing.texture == currentTexture && lastClothing.undershirt[0] == currentUndershirt[0] && lastClothing.undershirt[1] == currentUndershirt[2]) {
|
||||||
|
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
|
||||||
|
} else {
|
||||||
|
mp.events.callRemote("SERVER:BuyCharacterClothes", "clothe", JSON.stringify(serverData));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var serverData = [currentMenu.slotIdx, currentTexture, currentItem.ClotheId, -1, -1, -1, currentItem.Price];
|
||||||
|
if (lastClothing.drawable == currentItem.ClotheId && lastClothing.texture == currentTexture) {
|
||||||
|
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
|
||||||
|
} else {
|
||||||
|
mp.events.callRemote("SERVER:BuyCharacterClothes", "clothe", JSON.stringify(serverData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reset preview when player backs out of category menu
|
||||||
|
item.menu.MenuClose.on(() => {
|
||||||
|
resetPreview();
|
||||||
|
|
||||||
|
currentMenuIdx = -1;
|
||||||
|
mainMenu.Visible = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main menu events
|
||||||
|
mainMenu.ItemSelect.on((selectedItem, itemIndex) => {
|
||||||
|
const nextMenu = categoryMenus[itemIndex];
|
||||||
|
const slot = Number(nextMenu.slotIdx);
|
||||||
|
|
||||||
|
lastClothing = {
|
||||||
|
type: nextMenu.type,
|
||||||
|
slotIdx: slot,
|
||||||
|
drawable: (nextMenu.type === "props" ? localPlayer.getPropIndex(slot) : localPlayer.getDrawableVariation(slot)),
|
||||||
|
texture: (nextMenu.type === "props" ? localPlayer.getPropTextureIndex(slot) : localPlayer.getTextureVariation(slot)),
|
||||||
|
undershirt: [localPlayer.getDrawableVariation(8), localPlayer.getTextureVariation(8)],
|
||||||
|
torso: localPlayer.getDrawableVariation(3)
|
||||||
|
};
|
||||||
|
|
||||||
|
currentMenuIdx = itemIndex;
|
||||||
|
mainMenu.Visible = false;
|
||||||
|
nextMenu.menu.Visible = true;
|
||||||
|
menuTransition = true;
|
||||||
|
|
||||||
|
submenuItemChangeHandler(nextMenu.menu.CurrentSelection);
|
||||||
|
});
|
||||||
|
|
||||||
|
mainMenu.MenuClose.on(() => {
|
||||||
|
globalData.InMenu = false;
|
||||||
|
mp.gui.chat.show(true);
|
||||||
|
|
||||||
|
currentMenuIdx = -1;
|
||||||
|
lastClothing = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("clothesMenu:updateLast", (drawable, texture, undershirt, undershirtTexture, torso) => {
|
||||||
|
if (lastClothing) {
|
||||||
|
lastClothing.drawable = drawable;
|
||||||
|
lastClothing.texture = texture;
|
||||||
|
lastClothing.undershirt[0] = undershirt;
|
||||||
|
lastClothing.undershirt[1] = undershirtTexture;
|
||||||
|
lastClothing.torso = torso;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("clothesMenu:close", () => {
|
||||||
|
if (currentMenuIdx !== -1) categoryMenus[currentMenuIdx].menu.Close();
|
||||||
|
if (mainMenu && mainMenu.Visible) mainMenu.Close();
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("clothesMenu:Error", () => {
|
||||||
|
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -187,200 +187,20 @@
|
|||||||
"0": {
|
"0": {
|
||||||
"GXT": "T_FMM_10_0",
|
"GXT": "T_FMM_10_0",
|
||||||
"Localized": "White Tie"
|
"Localized": "White Tie"
|
||||||
},
|
|
||||||
"1": {
|
|
||||||
"GXT": "T_FMM_10_1",
|
|
||||||
"Localized": "Gray Tie"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"GXT": "T_FMM_10_2",
|
|
||||||
"Localized": "Black Tie"
|
|
||||||
},
|
|
||||||
"3": {
|
|
||||||
"GXT": "T_FMM_10_3",
|
|
||||||
"Localized": "Blue Tie"
|
|
||||||
},
|
|
||||||
"4": {
|
|
||||||
"GXT": "T_FMM_10_4",
|
|
||||||
"Localized": "Navy Tie"
|
|
||||||
},
|
|
||||||
"5": {
|
|
||||||
"GXT": "T_FMM_10_5",
|
|
||||||
"Localized": "Red Tie"
|
|
||||||
},
|
|
||||||
"6": {
|
|
||||||
"GXT": "T_FMM_10_6",
|
|
||||||
"Localized": "Green Tie"
|
|
||||||
},
|
|
||||||
"7": {
|
|
||||||
"GXT": "T_FMM_10_7",
|
|
||||||
"Localized": "Orange Tie"
|
|
||||||
},
|
|
||||||
"8": {
|
|
||||||
"GXT": "T_FMM_10_8",
|
|
||||||
"Localized": "Yellow Tie"
|
|
||||||
},
|
|
||||||
"9": {
|
|
||||||
"GXT": "T_FMM_10_9",
|
|
||||||
"Localized": "Purple Tie"
|
|
||||||
},
|
|
||||||
"10": {
|
|
||||||
"GXT": "T_FMM_10_10",
|
|
||||||
"Localized": "Brown Tie"
|
|
||||||
},
|
|
||||||
"11": {
|
|
||||||
"GXT": "T_FMM_10_11",
|
|
||||||
"Localized": "Stone Tie"
|
|
||||||
},
|
|
||||||
"12": {
|
|
||||||
"GXT": "T_FMM_10_12",
|
|
||||||
"Localized": "Two-Tone Plaid Tie"
|
|
||||||
},
|
|
||||||
"13": {
|
|
||||||
"GXT": "T_FMM_10_13",
|
|
||||||
"Localized": "Tan Plaid Tie"
|
|
||||||
},
|
|
||||||
"14": {
|
|
||||||
"GXT": "T_FMM_10_14",
|
|
||||||
"Localized": "Gold Striped Tie"
|
|
||||||
},
|
|
||||||
"15": {
|
|
||||||
"GXT": "T_FMM_10_15",
|
|
||||||
"Localized": "Red Striped Tie"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"11": {
|
|
||||||
"0": {
|
|
||||||
"GXT": "T_FMM_11_0",
|
|
||||||
"Localized": "White Bowtie"
|
|
||||||
},
|
|
||||||
"1": {
|
|
||||||
"GXT": "T_FMM_11_1",
|
|
||||||
"Localized": "Gray Bowtie"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"GXT": "T_FMM_11_2",
|
|
||||||
"Localized": "Black Bowtie"
|
|
||||||
},
|
|
||||||
"3": {
|
|
||||||
"GXT": "T_FMM_11_3",
|
|
||||||
"Localized": "Blue Bowtie"
|
|
||||||
},
|
|
||||||
"4": {
|
|
||||||
"GXT": "T_FMM_11_4",
|
|
||||||
"Localized": "Navy Bowtie"
|
|
||||||
},
|
|
||||||
"5": {
|
|
||||||
"GXT": "T_FMM_11_5",
|
|
||||||
"Localized": "Red Bowtie"
|
|
||||||
},
|
|
||||||
"6": {
|
|
||||||
"GXT": "T_FMM_11_6",
|
|
||||||
"Localized": "Green Bowtie"
|
|
||||||
},
|
|
||||||
"7": {
|
|
||||||
"GXT": "T_FMM_11_7",
|
|
||||||
"Localized": "Orange Bowtie"
|
|
||||||
},
|
|
||||||
"8": {
|
|
||||||
"GXT": "T_FMM_11_8",
|
|
||||||
"Localized": "Yellow Bowtie"
|
|
||||||
},
|
|
||||||
"9": {
|
|
||||||
"GXT": "T_FMM_11_9",
|
|
||||||
"Localized": "Purple Bowtie"
|
|
||||||
},
|
|
||||||
"10": {
|
|
||||||
"GXT": "T_FMM_11_10",
|
|
||||||
"Localized": "Brown Bowtie"
|
|
||||||
},
|
|
||||||
"11": {
|
|
||||||
"GXT": "T_FMM_11_11",
|
|
||||||
"Localized": "Stone Bowtie"
|
|
||||||
},
|
|
||||||
"12": {
|
|
||||||
"GXT": "T_FMM_11_12",
|
|
||||||
"Localized": "Blue Plaid Bowtie"
|
|
||||||
},
|
|
||||||
"13": {
|
|
||||||
"GXT": "T_FMM_11_13",
|
|
||||||
"Localized": "Orange Plaid Bowtie"
|
|
||||||
},
|
|
||||||
"14": {
|
|
||||||
"GXT": "T_FMM_11_14",
|
|
||||||
"Localized": "Earth Bowtie"
|
|
||||||
},
|
|
||||||
"15": {
|
|
||||||
"GXT": "T_FMM_11_15",
|
|
||||||
"Localized": "Red Plaid Bowtie"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"12": {
|
|
||||||
"0": {
|
|
||||||
"GXT": "T_FMM_12_0",
|
|
||||||
"Localized": "White Skinny Tie"
|
|
||||||
},
|
|
||||||
"1": {
|
|
||||||
"GXT": "T_FMM_12_1",
|
|
||||||
"Localized": "Gray Skinny Tie"
|
|
||||||
},
|
|
||||||
"2": {
|
|
||||||
"GXT": "T_FMM_12_2",
|
|
||||||
"Localized": "Black Skinny Tie"
|
|
||||||
},
|
|
||||||
"3": {
|
|
||||||
"GXT": "T_FMM_12_3",
|
|
||||||
"Localized": "Blue Skinny Tie"
|
|
||||||
},
|
|
||||||
"4": {
|
|
||||||
"GXT": "T_FMM_12_4",
|
|
||||||
"Localized": "Navy Skinny Tie"
|
|
||||||
},
|
|
||||||
"5": {
|
|
||||||
"GXT": "T_FMM_12_5",
|
|
||||||
"Localized": "Red Skinny Tie"
|
|
||||||
},
|
|
||||||
"6": {
|
|
||||||
"GXT": "T_FMM_12_6",
|
|
||||||
"Localized": "Green Skinny Tie"
|
|
||||||
},
|
|
||||||
"7": {
|
|
||||||
"GXT": "T_FMM_12_7",
|
|
||||||
"Localized": "Orange Skinny Tie"
|
|
||||||
},
|
|
||||||
"8": {
|
|
||||||
"GXT": "T_FMM_12_8",
|
|
||||||
"Localized": "Yellow Skinny Tie"
|
|
||||||
},
|
|
||||||
"9": {
|
|
||||||
"GXT": "T_FMM_12_9",
|
|
||||||
"Localized": "Purple Skinny Tie"
|
|
||||||
},
|
|
||||||
"10": {
|
|
||||||
"GXT": "T_FMM_12_10",
|
|
||||||
"Localized": "Brown Skinny Tie"
|
|
||||||
},
|
|
||||||
"11": {
|
|
||||||
"GXT": "T_FMM_12_11",
|
|
||||||
"Localized": "Stone Skinny Tie"
|
|
||||||
},
|
|
||||||
"12": {
|
|
||||||
"GXT": "T_FMM_12_12",
|
|
||||||
"Localized": "Two-Tone Plaid Skinny Tie"
|
|
||||||
},
|
|
||||||
"13": {
|
|
||||||
"GXT": "T_FMM_12_13",
|
|
||||||
"Localized": "Tan Plaid Skinny Tie"
|
|
||||||
},
|
|
||||||
"14": {
|
|
||||||
"GXT": "T_FMM_12_14",
|
|
||||||
"Localized": "Gold Striped Skinny Tie"
|
|
||||||
},
|
|
||||||
"15": {
|
|
||||||
"GXT": "T_FMM_12_15",
|
|
||||||
"Localized": "Red Striped Skinny Tie"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"11": {
|
||||||
|
"0": {
|
||||||
|
"GXT": "T_FMM_11_0",
|
||||||
|
"Localized": "White Bowtie"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"0": {
|
||||||
|
"GXT": "T_FMM_12_0",
|
||||||
|
"Localized": "White Skinny Tie"
|
||||||
|
}
|
||||||
|
},
|
||||||
"13": {
|
"13": {
|
||||||
"0": {
|
"0": {
|
||||||
"GXT": "T_FMM_13_0",
|
"GXT": "T_FMM_13_0",
|
||||||
|
|||||||
@@ -125,10 +125,6 @@
|
|||||||
"14": {
|
"14": {
|
||||||
"GXT": "U_FMM_1_14",
|
"GXT": "U_FMM_1_14",
|
||||||
"Localized": "Signs V Neck"
|
"Localized": "Signs V Neck"
|
||||||
},
|
|
||||||
"15": {
|
|
||||||
"GXT": "U_FMM_1_15",
|
|
||||||
"Localized": "Blue Striped V Neck"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -125,10 +125,6 @@
|
|||||||
"14": {
|
"14": {
|
||||||
"GXT": "U_FMM_1_14",
|
"GXT": "U_FMM_1_14",
|
||||||
"Localized": "Signs V Neck"
|
"Localized": "Signs V Neck"
|
||||||
},
|
|
||||||
"15": {
|
|
||||||
"GXT": "U_FMM_1_15",
|
|
||||||
"Localized": "Blue Striped V Neck"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
@@ -992,7 +988,7 @@
|
|||||||
"15": {
|
"15": {
|
||||||
"0": {
|
"0": {
|
||||||
"GXT": "NO_LABEL",
|
"GXT": "NO_LABEL",
|
||||||
"Localized": "NULL"
|
"Localized": "Nothing"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"16": {
|
"16": {
|
||||||
|
|||||||
@@ -183,3 +183,6 @@ PilotRouteList(globalData);
|
|||||||
|
|
||||||
import gangwarHandle from './util/Gangwar';
|
import gangwarHandle from './util/Gangwar';
|
||||||
gangwarHandle(globalData);
|
gangwarHandle(globalData);
|
||||||
|
|
||||||
|
import clotheShopList from './interaction/clothes/ClotheShop';
|
||||||
|
clotheShopList(globalData);
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
"rootDir": "./",
|
"rootDir": "./",
|
||||||
"outDir": "./tmp",
|
"outDir": "./tmp",
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
|
"module": "commonjs",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
"moduleResolution": "node"
|
"moduleResolution": "node"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class WeaponDealTimer : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "WeaponDealTime",
|
|
||||||
table: "Factions",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "PaydayTimer",
|
|
||||||
table: "Users",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "WeaponDealTime",
|
|
||||||
table: "Factions");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
|
||||||
name: "PaydayTimer",
|
|
||||||
table: "Users",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class SavedLocations : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Locations",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
Description = table.Column<string>(nullable: true),
|
|
||||||
X = table.Column<double>(nullable: false),
|
|
||||||
Y = table.Column<double>(nullable: false),
|
|
||||||
Z = table.Column<double>(nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Locations", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Locations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class FactionWeaponAmount : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "Ammount",
|
|
||||||
table: "FactionWeapons",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Ammount",
|
|
||||||
table: "FactionWeapons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class SavedLocationsHeading : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<double>(
|
|
||||||
name: "Heading",
|
|
||||||
table: "Locations",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Heading",
|
|
||||||
table: "Locations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class gtavdevdb : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class DriverLicenseVehicle : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "DriverLicenseVehicle",
|
|
||||||
table: "Users",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "DriverLicenseVehicle",
|
|
||||||
table: "Users");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class FlyingLicensePlane : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "FlyingLicensePlane",
|
|
||||||
table: "Users",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "FlyingLicensePlane",
|
|
||||||
table: "Users");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class SchoolId : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "SchoolId",
|
|
||||||
table: "ServerVehicles",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "SchoolId",
|
|
||||||
table: "ServerVehicles");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class DriverLicenseBike : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "DriverLicenseBike",
|
|
||||||
table: "Users",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "DriverLicenseBike",
|
|
||||||
table: "Users");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class Turfs : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Turfs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
FactionId = table.Column<int>(nullable: true),
|
|
||||||
Owner = table.Column<string>(nullable: true),
|
|
||||||
Name = table.Column<string>(nullable: true),
|
|
||||||
X = table.Column<float>(nullable: false),
|
|
||||||
Y = table.Column<float>(nullable: false),
|
|
||||||
Rotation = table.Column<float>(nullable: false),
|
|
||||||
Range = table.Column<float>(nullable: false),
|
|
||||||
Color = table.Column<int>(nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Turfs", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Turfs");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Database.Migrations
|
|
||||||
{
|
|
||||||
public partial class TurfVector : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Vector",
|
|
||||||
table: "Turfs",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Vector",
|
|
||||||
table: "Turfs");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,8 +9,8 @@ using ReallifeGamemode.Database.Models;
|
|||||||
namespace ReallifeGamemode.Database.Migrations
|
namespace ReallifeGamemode.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DatabaseContext))]
|
[DbContext(typeof(DatabaseContext))]
|
||||||
[Migration("20200113192903_TurfVector")]
|
[Migration("20200126141420_Initial")]
|
||||||
partial class TurfVector
|
partial class Initial
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -876,6 +876,28 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
b.HasDiscriminator<string>("Discriminator").HasValue("ServerVehicle");
|
b.HasDiscriminator<string>("Discriminator").HasValue("ServerVehicle");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopClothe", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Category");
|
||||||
|
|
||||||
|
b.Property<int>("ClotheId");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId");
|
||||||
|
|
||||||
|
b.Property<bool>("Gender");
|
||||||
|
|
||||||
|
b.Property<int>("Price");
|
||||||
|
|
||||||
|
b.Property<string>("TypeId");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ShopClothes");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
1285
ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs
Normal file
1285
ReallifeGamemode.Database/Migrations/20200126141420_Initial.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -874,6 +874,28 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
b.HasDiscriminator<string>("Discriminator").HasValue("ServerVehicle");
|
b.HasDiscriminator<string>("Discriminator").HasValue("ServerVehicle");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopClothe", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("Category");
|
||||||
|
|
||||||
|
b.Property<int>("ClotheId");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId");
|
||||||
|
|
||||||
|
b.Property<bool>("Gender");
|
||||||
|
|
||||||
|
b.Property<int>("Price");
|
||||||
|
|
||||||
|
b.Property<string>("TypeId");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ShopClothes");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b =>
|
modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
|||||||
@@ -24,4 +24,8 @@
|
|||||||
<HintPath>..\Import\Bootstrapper.dll</HintPath>
|
<HintPath>..\Import\Bootstrapper.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations\" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||||
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||||
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
|
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
|
||||||
|
ShopPoint nearestShopPoint = PositionManager.ShopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||||
if (nearestDuty != null)// Duty Point
|
if (nearestDuty != null)// Duty Point
|
||||||
{
|
{
|
||||||
var nameTagColor = new Color(0, 0, 0);
|
var nameTagColor = new Color(0, 0, 0);
|
||||||
@@ -325,6 +326,10 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
|
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
|
||||||
}
|
}
|
||||||
|
if(nearestShopPoint != null)
|
||||||
|
{
|
||||||
|
nearestShopPoint.clotheShop.LoadShopNUI(player);
|
||||||
|
}
|
||||||
if (user.FactionLeader)
|
if (user.FactionLeader)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("CLIENT:StartGangwar");
|
player.TriggerEvent("CLIENT:StartGangwar");
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
pV.SetSharedData("sirenSound", newValue);
|
pV.SetSharedData("sirenSound", newValue);
|
||||||
|
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("toggleVehicleSiren", pV, newValue);
|
NAPI.ClientEvent.TriggerClientEventForAll("toggleVehicleSiren", pV, newValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
player.ClearAccessory(1);
|
player.ClearAccessory(1);
|
||||||
player.ClearAccessory(2);
|
player.ClearAccessory(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("updateDutyCloth")]
|
[RemoteEvent("updateDutyCloth")]
|
||||||
@@ -152,5 +151,112 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("SERVER:BuyCharacterClothes")]
|
||||||
|
public void RmtEvent_BuyClothes(Client client, string type, string jsonData)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* [0] ComponentID
|
||||||
|
* [1] TextureID
|
||||||
|
* [2] ClotheID
|
||||||
|
* [3] TorsoID
|
||||||
|
* [4] UndershirtID
|
||||||
|
* [5] UndershirtTextureID
|
||||||
|
* [6] Price
|
||||||
|
*/
|
||||||
|
|
||||||
|
int[] data = JsonConvert.DeserializeObject<int[]>(jsonData);
|
||||||
|
User user = client.GetUser();
|
||||||
|
if (user.Handmoney < data[6])
|
||||||
|
{
|
||||||
|
client.TriggerEvent("clothesMenu:Error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == "clothe")
|
||||||
|
{
|
||||||
|
if (data[0] == 11)//for tops
|
||||||
|
{
|
||||||
|
client.SetClothes(11, data[2], data[1]); //set Top
|
||||||
|
client.SetClothes(8, data[4], data[5]); //set undershirt
|
||||||
|
client.SetClothes(3, data[3], 0); //set Torso
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client.SetClothes(data[0], data[2], data[1]);
|
||||||
|
}
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
|
||||||
|
var clothes = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == data[0] && c.Duty == false);
|
||||||
|
|
||||||
|
if(clothes == null)
|
||||||
|
{
|
||||||
|
CharacterCloth newCloth = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = false,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = data[0],
|
||||||
|
ClothId = data[2],
|
||||||
|
Texture = data[1]
|
||||||
|
};
|
||||||
|
dbContext.CharacterClothes.Add(newCloth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clothes.ClothId = data[2];
|
||||||
|
clothes.Texture = data[1];
|
||||||
|
}
|
||||||
|
if(data[0] == 11)
|
||||||
|
{
|
||||||
|
var torso = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == 3 && c.Duty == false);
|
||||||
|
var undershirt = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == 8 && c.Duty == false);
|
||||||
|
if(torso == null)
|
||||||
|
{
|
||||||
|
CharacterCloth newTorso = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = false,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 3,
|
||||||
|
ClothId = data[3]
|
||||||
|
};
|
||||||
|
dbContext.CharacterClothes.Add(newTorso);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
torso.ClothId = data[3];
|
||||||
|
}
|
||||||
|
if(undershirt == null)
|
||||||
|
{
|
||||||
|
CharacterCloth newUndershirt = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
Duty = false,
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 8,
|
||||||
|
ClothId = data[4],
|
||||||
|
Texture = data[5]
|
||||||
|
};
|
||||||
|
dbContext.CharacterClothes.Add(newUndershirt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
undershirt.ClothId = data[4];
|
||||||
|
undershirt.Texture = data[5];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.Handmoney -= data[6];
|
||||||
|
client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
client.TriggerEvent("clothesMenu:updateLast", data[2], data[1], data[4], data[5], data[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace ReallifeGamemode.Server
|
|||||||
};
|
};
|
||||||
|
|
||||||
InventoryManager.LoadItems();
|
InventoryManager.LoadItems();
|
||||||
|
ShopManager.LoadClotheShops();
|
||||||
|
|
||||||
TuningManager.LoadTuningGarages();
|
TuningManager.LoadTuningGarages();
|
||||||
|
|
||||||
@@ -81,6 +82,8 @@ namespace ReallifeGamemode.Server
|
|||||||
Economy.PaydayTimer();
|
Economy.PaydayTimer();
|
||||||
WeaponDealManager.WeaponDealTimer();
|
WeaponDealManager.WeaponDealTimer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,9 +110,12 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
houseBlips[house.Id] = NAPI.Blip.CreateBlip(40, house.Position, 0.7f, 11, "Haus", shortRange: true);
|
//houseBlips[house.Id] = NAPI.Blip.CreateBlip(40, house.Position, 0.7f, 11, "Haus", shortRange: true); too many blips
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
houseLabels[house.Id] = NAPI.TextLabel.CreateTextLabel(text, house.Position, 10f, 1f, 0, new Color(255, 255, 255));
|
houseLabels[house.Id] = NAPI.TextLabel.CreateTextLabel(text, house.Position, 10f, 1f, 0, new Color(255, 255, 255));
|
||||||
|
|
||||||
if (house.Price != 0)
|
if (house.Price != 0)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Shop.Clothing;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Managers
|
namespace ReallifeGamemode.Server.Managers
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
public static List<ElevatorPoint> ElevatorPoints = new List<ElevatorPoint>();
|
public static List<ElevatorPoint> ElevatorPoints = new List<ElevatorPoint>();
|
||||||
public static List<ColShape> ElevatorColShapes = new List<ColShape>();
|
public static List<ColShape> ElevatorColShapes = new List<ColShape>();
|
||||||
|
|
||||||
|
public static List<ShopPoint> ShopPoints = new List<ShopPoint>();
|
||||||
|
public static List<ColShape> ShopColShapes = new List<ColShape>();
|
||||||
|
|
||||||
[ServerEvent(Event.ResourceStart)]
|
[ServerEvent(Event.ResourceStart)]
|
||||||
public void OnResourceStart()
|
public void OnResourceStart()
|
||||||
{
|
{
|
||||||
@@ -48,8 +52,11 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
new Vector3(0, 0, 0), 3, new Color(255, 255, 255, 50), false, 0);
|
new Vector3(0, 0, 0), 3, new Color(255, 255, 255, 50), false, 0);
|
||||||
NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion DutyPoints
|
||||||
|
|
||||||
#region WeaponPoints
|
#region WeaponPoints
|
||||||
|
|
||||||
WeaponPoint weaponPointLSPD = new WeaponPoint()
|
WeaponPoint weaponPointLSPD = new WeaponPoint()
|
||||||
{
|
{
|
||||||
Position = new Vector3(460.3162, -981.0168, 30.68959),
|
Position = new Vector3(460.3162, -981.0168, 30.68959),
|
||||||
@@ -83,8 +90,11 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||||
NAPI.TextLabel.CreateTextLabel("Waffenspind - Dr\u00fccke ~y~E", w.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
NAPI.TextLabel.CreateTextLabel("Waffenspind - Dr\u00fccke ~y~E", w.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion WeaponPoints
|
||||||
|
|
||||||
#region JailReleasePoints
|
#region JailReleasePoints
|
||||||
|
|
||||||
JailReleasePoint jailPointLSPD = new JailReleasePoint()
|
JailReleasePoint jailPointLSPD = new JailReleasePoint()
|
||||||
{
|
{
|
||||||
Position = new Vector3(459.5327, -988.8435, 24.91487)
|
Position = new Vector3(459.5327, -988.8435, 24.91487)
|
||||||
@@ -103,8 +113,11 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
||||||
NAPI.TextLabel.CreateTextLabel("Gefängnis PC - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
NAPI.TextLabel.CreateTextLabel("Gefängnis PC - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion JailReleasePoints
|
||||||
|
|
||||||
#region ElevetaorPoints
|
#region ElevetaorPoints
|
||||||
|
|
||||||
ElevatorPoint FibElevatorPointEG = new ElevatorPoint()
|
ElevatorPoint FibElevatorPointEG = new ElevatorPoint()
|
||||||
{
|
{
|
||||||
Position = new Vector3(136.1958, -761.657, 242.152), //FBI oben
|
Position = new Vector3(136.1958, -761.657, 242.152), //FBI oben
|
||||||
@@ -134,32 +147,63 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
||||||
NAPI.TextLabel.CreateTextLabel("Aufzug - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
NAPI.TextLabel.CreateTextLabel("Aufzug - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion ElevetaorPoints
|
||||||
|
|
||||||
|
#region Shops
|
||||||
|
foreach (var shop in ShopManager.clotheStores)
|
||||||
|
{
|
||||||
|
shop.LoadClothes();
|
||||||
|
ShopPoint shopPoint = new ShopPoint()
|
||||||
|
{
|
||||||
|
Position = shop.vector,
|
||||||
|
clotheShop = shop
|
||||||
|
};
|
||||||
|
ShopPoints.Add(shopPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(ShopPoint s in ShopPoints)
|
||||||
|
{
|
||||||
|
NAPI.Marker.CreateMarker(1, new Vector3(s.Position.X, s.Position.Y, s.Position.Z - 2), new Vector3(s.Position.X, s.Position.Y, s.Position.Z + 1),
|
||||||
|
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
|
||||||
|
NAPI.TextLabel.CreateTextLabel("Kleiderladen - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Shops
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class DutyPoint
|
|
||||||
{
|
|
||||||
public Vector3 Position { get; set; }
|
|
||||||
public int FactionId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class WeaponPoint
|
|
||||||
{
|
|
||||||
public Vector3 Position { get; set; }
|
|
||||||
public int FactionId { get; set; }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class JailReleasePoint
|
public class DutyPoint
|
||||||
{
|
{
|
||||||
public Vector3 Position { get; set; }
|
public Vector3 Position { get; set; }
|
||||||
}
|
public int FactionId { get; set; }
|
||||||
public class ElevatorPoint
|
}
|
||||||
{
|
|
||||||
public Vector3 Position { get; set; }
|
public class WeaponPoint
|
||||||
public int FactionId { get; set; }
|
{
|
||||||
public string Stage { get; set; }
|
public Vector3 Position { get; set; }
|
||||||
}
|
public int FactionId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JailReleasePoint
|
||||||
|
{
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ShopPoint
|
||||||
|
{
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
public ClotheShop clotheShop { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ElevatorPoint
|
||||||
|
{
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
public int FactionId { get; set; }
|
||||||
|
public string Stage { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
51
ReallifeGamemode.Server/Managers/ShopManager.cs
Normal file
51
ReallifeGamemode.Server/Managers/ShopManager.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities.Saves;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
|
using ReallifeGamemode.Server.Shop.Clothing;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Managers
|
||||||
|
{
|
||||||
|
public class ShopManager
|
||||||
|
{
|
||||||
|
|
||||||
|
public static List<ClotheShop> clotheStores = new List<ClotheShop>();
|
||||||
|
|
||||||
|
public static void LoadClotheShops()
|
||||||
|
{
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
List<SavedBlip> discount = dbContext.Blips.ToList().FindAll(s => s.Name == "Binco" || s.Name == "Discount Store");
|
||||||
|
List<SavedBlip> midclass = dbContext.Blips.ToList().FindAll(s => s.Name == "Suburban");
|
||||||
|
List<SavedBlip> luxury = dbContext.Blips.ToList().FindAll(s => s.Name == "Ponsonbys");
|
||||||
|
|
||||||
|
foreach(var store in discount) {
|
||||||
|
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
|
||||||
|
ClotheShop newShop = new ClotheShop(1, pos);
|
||||||
|
clotheStores.Add(newShop);
|
||||||
|
NAPI.Util.ConsoleOutput($"Loading ClotheShop {store.Name}");
|
||||||
|
}
|
||||||
|
foreach(var store in midclass)
|
||||||
|
{
|
||||||
|
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
|
||||||
|
ClotheShop newShop = new ClotheShop(2, pos);
|
||||||
|
clotheStores.Add(newShop);
|
||||||
|
NAPI.Util.ConsoleOutput($"Loading ClotheShop {store.Name}");
|
||||||
|
}
|
||||||
|
foreach (var store in luxury)
|
||||||
|
{
|
||||||
|
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
|
||||||
|
ClotheShop newShop = new ClotheShop(2, pos);
|
||||||
|
clotheStores.Add(newShop);
|
||||||
|
NAPI.Util.ConsoleOutput($"Loading ClotheShop {store.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ReallifeGamemode.Database.Entities;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Shop.Clothing
|
|
||||||
{
|
|
||||||
public class Clothe : ShopClothe
|
|
||||||
{
|
|
||||||
public string clothe;
|
|
||||||
public int undershirtId;
|
|
||||||
public int torsoId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +1,52 @@
|
|||||||
using GTANetworkAPI;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using System.Linq;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Shop.Clothing
|
namespace ReallifeGamemode.Server.Shop.Clothing
|
||||||
{
|
{
|
||||||
public class ClotheShop
|
public class ClotheShop
|
||||||
{
|
{
|
||||||
public int category { get; set; } = 1;
|
public int category { get; set; }
|
||||||
|
public Vector3 vector { get; set; }
|
||||||
public List<ShopClothe> clotheList = new List<ShopClothe>();
|
public List<ShopClothe> clotheList = new List<ShopClothe>();
|
||||||
|
|
||||||
|
public ClotheShop(int category, Vector3 vector)
|
||||||
public ClotheShop(int category)
|
|
||||||
{
|
{
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
this.vector = vector;
|
||||||
LoadClothes();
|
LoadClothes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadClothes()
|
public void LoadClothes()
|
||||||
{
|
{
|
||||||
|
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
clotheList = dbContext.ShopClothes.ToList().FindAll(c => c.Category == category);
|
clotheList = dbContext.ShopClothes.ToList().FindAll(c => c.Category == category);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("buyclothes")]
|
|
||||||
public void LoadShopNUI(Client client)
|
public void LoadShopNUI(Client client)
|
||||||
{
|
{
|
||||||
LoadClothes();
|
bool gender = client.GetUser().GetCharacter().Gender;
|
||||||
|
List<ShopClothe> tops = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 11);
|
||||||
|
List<ShopClothe> legs = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 4);
|
||||||
|
List<ShopClothe> shoes = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 6);
|
||||||
|
List<ShopClothe> accessoires = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 7);
|
||||||
|
|
||||||
using (var dbContext = new DatabaseContext())
|
List<Array> clothes = new List<Array>
|
||||||
{
|
{
|
||||||
List<Clothe> clothes = new List<Clothe>();
|
tops.ToArray(),
|
||||||
bool gender = client.GetUser().Character.Gender;
|
legs.ToArray(),
|
||||||
foreach (var clothe in clotheList)
|
shoes.ToArray(),
|
||||||
{
|
accessoires.ToArray()
|
||||||
if(clothe.TypeId == "clothes" )
|
};
|
||||||
{
|
|
||||||
switch (clothe.ComponentId)
|
|
||||||
{
|
|
||||||
case 11: //tops
|
|
||||||
List<ClothCombination> combinations = dbContext.ClothCombinations.Where(c => c.Top == clothe.ClotheId && c.Gender == gender).ToList();
|
|
||||||
foreach (var combination in combinations)
|
|
||||||
{
|
|
||||||
var top = new Clothe
|
|
||||||
{
|
|
||||||
ComponentId = clothe.ComponentId, //needs to be fist bc it acts like an identifier in JS
|
|
||||||
ClotheId = clothe.ClotheId,
|
|
||||||
Gender = gender,
|
|
||||||
TypeId = "clothes",
|
|
||||||
clothe = "clothes",
|
|
||||||
Category = category,
|
|
||||||
Price = clothe.Price,
|
|
||||||
undershirtId = combination.Undershirt,
|
|
||||||
torsoId = combination.Torso
|
|
||||||
};
|
|
||||||
clothes.Add(top);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: //everything else
|
|
||||||
var garment = new Clothe
|
|
||||||
{
|
|
||||||
ComponentId = clothe.ComponentId, //needs to be fist bc it acts like an identifier in JS
|
|
||||||
ClotheId = clothe.ClotheId,
|
|
||||||
Gender = gender,
|
|
||||||
TypeId = "clothes",
|
|
||||||
clothe = "clothes",
|
|
||||||
Category = category,
|
|
||||||
Price = clothe.Price,
|
|
||||||
undershirtId = -1, //will not be used unless top
|
|
||||||
torsoId = -1 //will not be used unless top
|
|
||||||
};
|
|
||||||
clothes.Add(garment);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
client.TriggerEvent("clothesMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(clothes.ToArray()));
|
||||||
}
|
|
||||||
}
|
|
||||||
client.TriggerEvent("clothesMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(clothes.ToArray()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user