Use more locale strings

This commit is contained in:
Vortrex
2022-06-07 10:26:54 -05:00
parent b15b14fdf4
commit 6c979f6971

View File

@@ -296,24 +296,26 @@ function pickupItemCommand(command, params, client) {
if (!getItemData(itemId)) { if (!getItemData(itemId)) {
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`); //messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item data for item ${itemId} on ground returned false.`); submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item data for item ${itemId} on ground returned false.`);
return false; return false;
} }
if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) { if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) {
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`); //messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} on ground returned false.`); submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} on ground returned false.`);
return false; return false;
} }
if (getDistance(getPlayerPosition(client), getItemData(itemId).position) > getGlobalConfig().droppedItemPickupRange) { if (getDistance(getPlayerPosition(client), getItemData(itemId).position) > getGlobalConfig().droppedItemPickupRange) {
messagePlayerError(client, `You're too far away!`); messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
return false; return false;
} }
let firstSlot = getPlayerFirstEmptyHotBarSlot(client); let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
if (firstSlot == -1) { if (firstSlot == -1) {
messagePlayerError(client, `You don't have any space to carry this (full inventory)!`); messagePlayerError(client, getPlayerLocale(client, "NoSpaceSelfInventory"));
return false; return false;
} }
@@ -359,25 +361,25 @@ function dropItemCommand(command, params, client) {
} }
if (hotBarSlot == -1) { if (hotBarSlot == -1) {
messagePlayerError(client, `You don't have any item selected/equipped.`); messagePlayerError(client, getLocaleString(client, "NoItemEquipped"));
return false; return false;
} }
if (getPlayerData(client).hotBarItems[hotBarSlot] == -1) { if (getPlayerData(client).hotBarItems[hotBarSlot] == -1) {
messagePlayerError(client, `You don't have an item in your active slot.`); messagePlayerError(client, getLocaleString(client, "NoItemInActiveSlot"));
return false; return false;
} }
let itemId = getPlayerData(client).hotBarItems[hotBarSlot]; let itemId = getPlayerData(client).hotBarItems[hotBarSlot];
if (!getItemData(itemId)) { if (!getItemData(itemId)) {
messagePlayerError(client, `The item you're trying to drop is bugged. A bug report has been sent to the server developers.`); messagePlayerError(client, getLocaleString(client, "DropItemBugged"));
submitBugReport(client, `(AUTOMATED REPORT) Drop Item: Getting item data for item ${itemId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`); submitBugReport(client, `(AUTOMATED REPORT) Drop Item: Getting item data for item ${itemId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`);
return false; return false;
} }
if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) { if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) {
messagePlayerError(client, `The item you're trying to drop is bugged. A bug report has been sent to the server developers.`); messagePlayerError(client, getLocaleString(client, "DropItemBugged"));
submitBugReport(client, `(AUTOMATED REPORT) Drop Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`); submitBugReport(client, `(AUTOMATED REPORT) Drop Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} in player hotbar slot ${hotBarSlot} (cache ${getPlayerData(client).hotBarItems[hotBarSlot]}) returned false.`);
return false; return false;
} }
@@ -393,7 +395,7 @@ function dropItemCommand(command, params, client) {
} }
if (isPlayerItemFromJobEquipment(client, hotBarSlot)) { if (isPlayerItemFromJobEquipment(client, hotBarSlot)) {
messagePlayerError(client, `You can't drop job items`); messagePlayerError(client, getLocaleString(client, "CantDropJobEquipmentItem"));
return false; return false;
} }
@@ -449,7 +451,7 @@ function putItemCommand(command, params, client) {
} }
if (isPlayerItemFromJobEquipment(client, hotBarSlot)) { if (isPlayerItemFromJobEquipment(client, hotBarSlot)) {
messagePlayerError(client, `You can't put job items`); messagePlayerError(client, getLocaleString(client, "CantPutJobEquipmentItem"));
return false; return false;
} }
@@ -480,7 +482,7 @@ function takeItemCommand(command, params, client) {
let firstSlot = getPlayerFirstEmptyHotBarSlot(client); let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
if (firstSlot == -1) { if (firstSlot == -1) {
messagePlayerError(client, `You don't have any space to hold another item (full inventory)!`); messagePlayerError(client, getLocaleString(client, "NoSpaceSelfInventory"));
return false; return false;
} }
@@ -490,7 +492,7 @@ function takeItemCommand(command, params, client) {
let itemId = bestOwner[2]; let itemId = bestOwner[2];
if (bestOwner[1] == VRR_ITEM_OWNER_NONE) { if (bestOwner[1] == VRR_ITEM_OWNER_NONE) {
messagePlayerError(client, `You aren't near anything to take items from!`); messagePlayerError(client, getLocaleString(client, "NothingToTakeItemFrom"));
return false; return false;
} }
@@ -758,12 +760,16 @@ function playerUseItem(client, hotBarSlot) {
} }
} }
} }
messagePlayerError(client, `You don't have any ammo to load into your ${itemTypeData.name}!`); messagePlayerError(client, getLocaleString(client, "NoAmmoToLoadIntoWeapon", itemTypeData.name));
break; break;
} }
case VRR_ITEM_USETYPE_AMMO_CLIP: { case VRR_ITEM_USETYPE_AMMO_CLIP: {
messagePlayerError(client, `To load this ammo into a weapon, equip the weapon and ${(doesPlayerHaveKeyBindForCommand(client, "use")) ? `press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "use").key))}` : `{ALTCOLOUR}/use`}`); if (doesPlayerHaveKeyBindForCommand(client, "use")) {
messagePlayerError(client, getLocaleString(client, "LoadAmmoIntoWeaponHelpKeyPress", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "use").key))}{MAINCOLOUR}`));
} else {
messagePlayerError(client, getLocaleString(client, "LoadAmmoIntoWeaponHelpCommand", `{ALTCOLOUR}/use{MAINCOLOUR}`));
}
break; break;
} }
@@ -806,17 +812,17 @@ function playerUseItem(client, hotBarSlot) {
let closestPlayer = getClosestPlayer(getPlayerPosition(client), client); let closestPlayer = getClosestPlayer(getPlayerPosition(client), client);
if (!getPlayerData(closestPlayer)) { if (!getPlayerData(closestPlayer)) {
messagePlayerError(client, "There isn't anyone close enough to tie up!"); messagePlayerError(client, getLocaleString(client, "NobodyCloseEnoughToTie"));
return false; return false;
} }
if (getDistance(getPlayerPosition(closestPlayer), getPlayerPosition(client)) > getGlobalConfig().handcuffPlayerDistance) { if (getDistance(getPlayerPosition(closestPlayer), getPlayerPosition(client)) > getGlobalConfig().handcuffPlayerDistance) {
messagePlayerError(client, "There isn't anyone close enough to tie up!"); messagePlayerError(client, getLocaleString(client, "NobodyCloseEnoughToTie"));
return false; return false;
} }
if (!isPlayerSurrendered(closestPlayer)) { if (!isPlayerSurrendered(closestPlayer)) {
messagePlayerError(client, `${getCharacterFullName(closestPlayer)} can't be tied! They either need to have their hands up, be knocked out, or tazed`); messagePlayerError(client, getLocaleString(client, "PlayerNotSurrenderedTie", getCharacterFullName(closestPlayer)));
return false; return false;
} }
@@ -839,12 +845,12 @@ function playerUseItem(client, hotBarSlot) {
let closestPlayer = getClosestPlayer(getPlayerPosition(client), client); let closestPlayer = getClosestPlayer(getPlayerPosition(client), client);
if (!getPlayerData(closestPlayer)) { if (!getPlayerData(closestPlayer)) {
messagePlayerError(client, "There isn't anyone close enough to handcuff!"); messagePlayerError(client, getLocaleString(client, "NobodyCloseEnoughToHandcuff"));
return false; return false;
} }
if (getDistance(getPlayerPosition(closestPlayer), getPlayerPosition(client)) > getGlobalConfig().handcuffPlayerDistance) { if (getDistance(getPlayerPosition(closestPlayer), getPlayerPosition(client)) > getGlobalConfig().handcuffPlayerDistance) {
messagePlayerError(client, "There isn't anyone close enough to handcuff!"); messagePlayerError(client, getLocaleString(client, "NobodyCloseEnoughToHandcuff"));
return false; return false;
} }
@@ -853,7 +859,7 @@ function playerUseItem(client, hotBarSlot) {
meActionToNearbyPlayers(client, `takes their key and removes the handcuffs from ${getCharacterFullName(closestPlayer)}`); meActionToNearbyPlayers(client, `takes their key and removes the handcuffs from ${getCharacterFullName(closestPlayer)}`);
} else { } else {
if (!isPlayerSurrendered(closestPlayer)) { if (!isPlayerSurrendered(closestPlayer)) {
messagePlayerError(client, `${getCharacterFullName(closestPlayer)} can't be cuffed! They either need to have their hands up, be knocked out, or tazed`); messagePlayerError(client, getLocaleString(client, "PlayerNotSurrenderedHandcuffed", getCharacterFullName(closestPlayer)));
return false; return false;
} }