import React from 'react';
import md5 from 'crypto-js/md5';
const finderSpan = (finder, possessive = false, ownItem = false) => (
{finder}{possessive ? "'s" : null}
);
const recipientSpan = (recipient, possessive = false, ownItem = false) => (
{recipient}{possessive ? "'s" : null}
);
const itemSpan = (item, unique) => {item};
const locationSpan = (location) => {location};
const entranceSpan = (entrance) => {entrance};
class MonitorTools {
/** Convert plaintext into a React-friendly div */
static createTextDiv = (text) => (
{text}
);
/** Sent an item to another player */
static sentItem = (finder, recipient, item, location, iAmFinder = false, iAmRecipient = false, unique = false) => (
{finderSpan(finder, false, iAmFinder)} found {recipientSpan(recipient, true, iAmRecipient)}
{itemSpan(item, unique)} at {locationSpan(location)}
)
/** Received item from another player */
static receivedItem = (finder, item, location, itemIndex, queueLength, unique = false) => (
({itemIndex}/{queueLength}) {finderSpan(finder, false)} found your
{itemSpan(item, unique)} at {locationSpan(location)}
)
/** Player found their own item (local or remote player) */
static foundItem = (finder, item, location, iAmFinder = false, unique = false) => (
{finderSpan(finder, false, iAmFinder)} found their own {itemSpan(item, unique)} at {locationSpan(location)}
)
/** Hint message */
static hintMessage = (finder, recipient, item, location, found, iAmFinder = false, iAmRecipient = false,
entranceLocation = null) => (
{recipientSpan(recipient, true, iAmRecipient)} {itemSpan(item)} can be found in
{finderSpan(finder, true, iAmFinder)} world at {locationSpan(location)}
{ entranceLocation ? [', which is at ', entranceSpan(entranceLocation)] : null }
({found ? '✔' : '❌'})
)
}
export default MonitorTools;