feat: custom item names (#307)
This commit is contained in:
parent
96fa616f3d
commit
b3794821c4
27
src/controllers/api/nameWeaponController.ts
Normal file
27
src/controllers/api/nameWeaponController.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { RequestHandler } from "express";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
|
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
|
interface INameWeaponRequest {
|
||||||
|
ItemName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const nameWeaponController: RequestHandler = async (req, res) => {
|
||||||
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
const body = getJSONfromString(req.body.toString()) as INameWeaponRequest;
|
||||||
|
const item = inventory[req.query.Category as string as TEquipmentKey].find(
|
||||||
|
item => item._id.toString() == (req.query.ItemId as string)
|
||||||
|
)!;
|
||||||
|
if (body.ItemName != "") {
|
||||||
|
item.ItemName = body.ItemName;
|
||||||
|
} else {
|
||||||
|
item.ItemName = undefined;
|
||||||
|
}
|
||||||
|
await inventory.save();
|
||||||
|
res.json({
|
||||||
|
InventoryChanges: await updateCurrency("webui" in req.query ? 0 : 15, true, accountId)
|
||||||
|
});
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { IUpgradesRequest } from "@/src/types/requestTypes";
|
import { IUpgradesRequest } from "@/src/types/requestTypes";
|
||||||
import { FocusSchool, IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { FocusSchool, IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { IMiscItem, IEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
switch (operation.UpgradeRequirement) {
|
switch (operation.UpgradeRequirement) {
|
||||||
case "/Lotus/Types/Items/MiscItems/OrokinReactor":
|
case "/Lotus/Types/Items/MiscItems/OrokinReactor":
|
||||||
case "/Lotus/Types/Items/MiscItems/OrokinCatalyst":
|
case "/Lotus/Types/Items/MiscItems/OrokinCatalyst":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 1;
|
item.Features |= 1;
|
||||||
@ -38,7 +38,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
break;
|
break;
|
||||||
case "/Lotus/Types/Items/MiscItems/UtilityUnlocker":
|
case "/Lotus/Types/Items/MiscItems/UtilityUnlocker":
|
||||||
case "/Lotus/Types/Items/MiscItems/WeaponUtilityUnlocker":
|
case "/Lotus/Types/Items/MiscItems/WeaponUtilityUnlocker":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 2;
|
item.Features |= 2;
|
||||||
@ -49,7 +49,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
case "/Lotus/Types/Items/MiscItems/WeaponPrimaryArcaneUnlocker":
|
case "/Lotus/Types/Items/MiscItems/WeaponPrimaryArcaneUnlocker":
|
||||||
case "/Lotus/Types/Items/MiscItems/WeaponSecondaryArcaneUnlocker":
|
case "/Lotus/Types/Items/MiscItems/WeaponSecondaryArcaneUnlocker":
|
||||||
case "/Lotus/Types/Items/MiscItems/WeaponMeleeArcaneUnlocker":
|
case "/Lotus/Types/Items/MiscItems/WeaponMeleeArcaneUnlocker":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 32;
|
item.Features |= 32;
|
||||||
@ -61,7 +61,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
case "/Lotus/Types/Items/MiscItems/FormaUmbra":
|
case "/Lotus/Types/Items/MiscItems/FormaUmbra":
|
||||||
case "/Lotus/Types/Items/MiscItems/FormaAura":
|
case "/Lotus/Types/Items/MiscItems/FormaAura":
|
||||||
case "/Lotus/Types/Items/MiscItems/FormaStance":
|
case "/Lotus/Types/Items/MiscItems/FormaStance":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.XP = 0;
|
item.XP = 0;
|
||||||
setSlotPolarity(item, operation.PolarizeSlot, operation.PolarizeValue);
|
setSlotPolarity(item, operation.PolarizeSlot, operation.PolarizeValue);
|
||||||
@ -72,7 +72,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "/Lotus/Types/Items/MiscItems/ModSlotUnlocker":
|
case "/Lotus/Types/Items/MiscItems/ModSlotUnlocker":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.ModSlotPurchases ??= 0;
|
item.ModSlotPurchases ??= 0;
|
||||||
item.ModSlotPurchases += 1;
|
item.ModSlotPurchases += 1;
|
||||||
@ -87,7 +87,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker":
|
case "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker":
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.CustomizationSlotPurchases ??= 0;
|
item.CustomizationSlotPurchases ??= 0;
|
||||||
item.CustomizationSlotPurchases += 1;
|
item.CustomizationSlotPurchases += 1;
|
||||||
@ -103,7 +103,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
break;
|
break;
|
||||||
case "":
|
case "":
|
||||||
console.assert(operation.OperationType == "UOT_SWAP_POLARITY");
|
console.assert(operation.OperationType == "UOT_SWAP_POLARITY");
|
||||||
for (const item of inventory[payload.ItemCategory as IEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
for (let i = 0; i != operation.PolarityRemap.length; ++i) {
|
for (let i = 0; i != operation.PolarityRemap.length; ++i) {
|
||||||
if (operation.PolarityRemap[i].Slot != i) {
|
if (operation.PolarityRemap[i].Slot != i) {
|
||||||
|
@ -55,6 +55,7 @@ import { getGuildDojoController } from "@/src/controllers/api/getGuildDojoContro
|
|||||||
import { syndicateSacrificeController } from "../controllers/api/syndicateSacrificeController";
|
import { syndicateSacrificeController } from "../controllers/api/syndicateSacrificeController";
|
||||||
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
|
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
|
||||||
import { queueDojoComponentDestructionController } from "@/src/controllers/api/queueDojoComponentDestructionController";
|
import { queueDojoComponentDestructionController } from "@/src/controllers/api/queueDojoComponentDestructionController";
|
||||||
|
import { nameWeaponController } from "@/src/controllers/api/nameWeaponController";
|
||||||
|
|
||||||
const apiRouter = express.Router();
|
const apiRouter = express.Router();
|
||||||
|
|
||||||
@ -120,5 +121,6 @@ apiRouter.post("/upgrades.php", upgradesController);
|
|||||||
apiRouter.post("/guildTech.php", guildTechController);
|
apiRouter.post("/guildTech.php", guildTechController);
|
||||||
apiRouter.post("/syndicateSacrifice.php", syndicateSacrificeController);
|
apiRouter.post("/syndicateSacrifice.php", syndicateSacrificeController);
|
||||||
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
|
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
|
||||||
|
apiRouter.post("/nameWeapon.php", nameWeaponController);
|
||||||
|
|
||||||
export { apiRouter };
|
export { apiRouter };
|
||||||
|
@ -59,7 +59,7 @@ export interface ITypeCount {
|
|||||||
ItemCount: number;
|
ItemCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IEquipmentKey =
|
export type TEquipmentKey =
|
||||||
| "Suits"
|
| "Suits"
|
||||||
| "LongGuns"
|
| "LongGuns"
|
||||||
| "Pistols"
|
| "Pistols"
|
||||||
|
@ -132,6 +132,9 @@ function updateInventory() {
|
|||||||
{
|
{
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
||||||
|
if (item.ItemName) {
|
||||||
|
td.textContent = item.ItemName + " (" + td.textContent + ")";
|
||||||
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -144,12 +147,21 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
addGearExp("Suits", item.ItemId.$oid, 1_600_000 - item.XP);
|
addGearExp("Suits", item.ItemId.$oid, 1_600_000 - item.XP);
|
||||||
};
|
};
|
||||||
a.textContent = "Make Rank 30";
|
a.title = "Make Rank 30";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`;
|
||||||
|
td.appendChild(a);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = "#";
|
||||||
|
a.onclick = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
const name = prompt("Enter new custom name:");
|
||||||
|
renameGear("Suits", item.ItemId.$oid, name);
|
||||||
|
};
|
||||||
|
a.title = "Rename";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 80V229.5c0 17 6.7 33.3 18.7 45.3l176 176c25 25 65.5 25 90.5 0L418.7 317.3c25-25 25-65.5 0-90.5l-176-176c-12-12-28.3-18.7-45.3-18.7H48C21.5 32 0 53.5 0 80zm112 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
|
|
||||||
const span = document.createElement("span");
|
|
||||||
span.innerHTML = " · ";
|
|
||||||
td.appendChild(span);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
@ -158,7 +170,8 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
disposeOfGear("Suits", item.ItemId.$oid);
|
disposeOfGear("Suits", item.ItemId.$oid);
|
||||||
};
|
};
|
||||||
a.textContent = "Remove";
|
a.title = "Remove";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
@ -173,6 +186,9 @@ function updateInventory() {
|
|||||||
{
|
{
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
td.textContent = itemMap[item.ItemType]?.name ?? item.ItemType;
|
||||||
|
if (item.ItemName) {
|
||||||
|
td.textContent = item.ItemName + " (" + td.textContent + ")";
|
||||||
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -185,12 +201,21 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
addGearExp(category, item.ItemId.$oid, 800_000 - item.XP);
|
addGearExp(category, item.ItemId.$oid, 800_000 - item.XP);
|
||||||
};
|
};
|
||||||
a.textContent = "Make Rank 30";
|
a.title = "Make Rank 30";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`;
|
||||||
|
td.appendChild(a);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = "#";
|
||||||
|
a.onclick = function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
const name = prompt("Enter new custom name:");
|
||||||
|
renameGear(category, item.ItemId.$oid, name);
|
||||||
|
};
|
||||||
|
a.title = "Rename";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 80V229.5c0 17 6.7 33.3 18.7 45.3l176 176c25 25 65.5 25 90.5 0L418.7 317.3c25-25 25-65.5 0-90.5l-176-176c-12-12-28.3-18.7-45.3-18.7H48C21.5 32 0 53.5 0 80zm112 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
|
|
||||||
const span = document.createElement("span");
|
|
||||||
span.innerHTML = " · ";
|
|
||||||
td.appendChild(span);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
@ -199,7 +224,8 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
disposeOfGear(category, item.ItemId.$oid);
|
disposeOfGear(category, item.ItemId.$oid);
|
||||||
};
|
};
|
||||||
a.textContent = "Remove";
|
a.title = "Remove";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
@ -241,14 +267,10 @@ function updateInventory() {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
a.target = "_blank";
|
a.target = "_blank";
|
||||||
a.textContent = "View Stats";
|
a.title = "View Stats";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V80zM0 272c0-26.5 21.5-48 48-48H80c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272zM368 96h32c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H368c-26.5 0-48-21.5-48-48V144c0-26.5 21.5-48 48-48z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
{
|
|
||||||
const span = document.createElement("span");
|
|
||||||
span.innerHTML = " · ";
|
|
||||||
td.appendChild(span);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = "#";
|
a.href = "#";
|
||||||
@ -256,7 +278,8 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
disposeOfGear("Upgrades", item.ItemId.$oid);
|
disposeOfGear("Upgrades", item.ItemId.$oid);
|
||||||
};
|
};
|
||||||
a.textContent = "Remove";
|
a.title = "Remove";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
@ -282,12 +305,9 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setFingerprint(item.ItemType, item.ItemId, { lvl: maxRank });
|
setFingerprint(item.ItemType, item.ItemId, { lvl: maxRank });
|
||||||
};
|
};
|
||||||
a.textContent = "Max Rank";
|
a.title = "Max Rank";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
|
|
||||||
const span = document.createElement("span");
|
|
||||||
span.innerHTML = " · ";
|
|
||||||
td.appendChild(span);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
@ -296,7 +316,8 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
disposeOfGear("Upgrades", item.ItemId.$oid);
|
disposeOfGear("Upgrades", item.ItemId.$oid);
|
||||||
};
|
};
|
||||||
a.textContent = "Remove";
|
a.title = "Remove";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
@ -327,14 +348,10 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setFingerprint(item.ItemType, item.LastAdded, { lvl: maxRank });
|
setFingerprint(item.ItemType, item.LastAdded, { lvl: maxRank });
|
||||||
};
|
};
|
||||||
a.textContent = "Max Rank";
|
a.title = "Max Rank";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.2L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
{
|
|
||||||
const span = document.createElement("span");
|
|
||||||
span.innerHTML = " · ";
|
|
||||||
td.appendChild(span);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = "#";
|
a.href = "#";
|
||||||
@ -342,7 +359,8 @@ function updateInventory() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
disposeOfItems("Upgrades", item.ItemType, item.ItemCount);
|
disposeOfItems("Upgrades", item.ItemType, item.ItemCount);
|
||||||
};
|
};
|
||||||
a.textContent = "Remove";
|
a.title = "Remove";
|
||||||
|
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M135.2 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8c-12.1 0-23.2 6.8-28.6 17.7zM416 128H32L53.2 467c1.6 25.3 22.6 45 47.9 45H346.9c25.3 0 46.3-19.7 47.9-45L416 128z"/></svg>`;
|
||||||
td.appendChild(a);
|
td.appendChild(a);
|
||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
@ -432,6 +450,20 @@ function addGearExp(category, oid, xp) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renameGear(category, oid, name) {
|
||||||
|
revalidateAuthz(() => {
|
||||||
|
$.post({
|
||||||
|
url: "/api/nameWeapon.php?" + window.authz + "&Category=" + category + "&ItemId=" + oid + "&webui=1",
|
||||||
|
contentType: "text/plain",
|
||||||
|
data: JSON.stringify({
|
||||||
|
ItemName: name
|
||||||
|
})
|
||||||
|
}).done(function () {
|
||||||
|
updateInventory();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function disposeOfGear(category, oid) {
|
function disposeOfGear(category, oid) {
|
||||||
const data = {
|
const data = {
|
||||||
SellCurrency: "SC_RegularCredits",
|
SellCurrency: "SC_RegularCredits",
|
||||||
|
@ -20,3 +20,10 @@ body:not(.logged-in) .nav-item.dropdown,
|
|||||||
body:not(.logged-in) #refresh-note {
|
body:not(.logged-in) #refresh-note {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td.text-end > a > svg {
|
||||||
|
fill: currentColor;
|
||||||
|
height: 1em;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
margin-bottom: 4px; /* to centre the icon */
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user