nmps-server

server-side nmps
git clone git://git.kocotian.pl/nmps-server.git
Log | Files | Refs | README

commit d6c467b906b7fc552a0f5df0ecfff851019b5c7a
parent 4f0136df6266d1d4aa8103260ea0f8d87ea815d6
Author: kocotian <kocotian@kocotian.pl>
Date:   Sun, 13 Dec 2020 16:05:25 +0100

doas, locations, moving, better items

Diffstat:
Adata/biomes/adjectives | 1+
Adata/biomes/nouns | 1+
Adoas.php | 16++++++++++++++++
Minv.php | 4++--
Amove.php | 35+++++++++++++++++++++++++++++++++++
Mneofetch.php | 2+-
Mrequire/nmps.php | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Awhereami.php | 4++++
8 files changed, 124 insertions(+), 7 deletions(-)

diff --git a/data/biomes/adjectives b/data/biomes/adjectives @@ -0,0 +1 @@ +Aback:Abaft:Abandoned:Abashed:Aberrant:Abhorrent:Abiding:Abject:Ablaze:Able:Abnormal:Aboard:Aboriginal:Abortive:Abounding:Abrasive:Abrupt:Absent:Absorbed:Absorbing:Abstracted:Absurd:Abundant:Abusive:Acceptable:Accessible:Accidental:Accurate:Acid:Acidic:Acoustic:Acrid:Actually:Ad hoc:Adamant:Adaptable:Addicted:Adhesive:Adjoining:Adorable:Adventurous:Afraid:Aggressive:Agonizing:Agreeable:Ahead:Ajar:Alcoholic:Alert:Alike:Alive:Alleged:Alluring:Aloof:Amazing:Amazing:Ambiguous:Ambitious:American:Amuck:Amused:Amusing:Ancient:Angry:Animated:Annoyed:Annoying:Anxious:Apathetic:Aquatic:Aromatic:Arrogant:Ashamed:Aspiring:Assorted:Astonishing:Attractive:Auspicious:Automatic:Available:Average:Awake:Aware:Awesome:Awful:Axiomatic:Bad:Barbarous:Bashful:Bawdy:Beautiful:Befitting:Belligerent:Beneficial:Bent:Berserk:Best:Better:Bewildered:Big:Billowy:Bite-sized:Bitter:Bizarre:Black:Black-and-white:Bloated:Bloody:Blue:Blue-eyed:Blushing:Boiling:Boorish:Bored:Boring:Bottom:Bouncy:Boundless:Brainy:Brash:Brave:Brawny:Breakable:Breezy:Brief:Bright:Bright:Broad:Broken:Brown:Brown:Bumpy:Burly:Bustling:Busy:Cagey:Calculating:Callous:Calm:Capable:Capricious:Careful:Careless:Caring:Cautious:Ceaseless:Certain:Changeable:Charming:Cheap:Cheerful:Chemical:Chief:Childlike:Chilly:Chivalrous:Chubby:Chunky:Clammy:Classy:Clean:Clean:Clear:Clever:Cloistered:Closed:Cloudy:Cloudy:Clumsy:Cluttered:Coherent:Cold:Cold:Colorful:Colossal:Combative:Comfortable:Common:Complete:Complex:Concerned:Condemned:Confused:Conscious:Cooing:Cool:Cool:Cooperative:Coordinated:Courageous:Cowardly:Crabby:Craven:Crazy:Creepy:Crooked:Crowded:Cruel:Cuddly:Cultured:Cumbersome:Curious:Curly:Curved:Curvy:Cut:Cute:Cute:Cyan:Cynical:Daffy:Daily:Damaged:Damaging:Damp:Dangerous:Dapper:Dark:Dashing:Dazzling:Dead:Deadpan:Deafening:Dear:Debonair:Decisive:Decorous:Deep:Deeply:Defeated:Defective:Defiant:Delicate:Delicious:Delightful:Delirious:Demonic:Dependent:Depressed:Deranged:Descriptive:Deserted:Detailed:Determined:Devilish:Didactic:Different:Difficult:Diligent:Direful:Dirty:Dirty:Disagreeable:Disastrous:Discreet:Disgusted:Disgusting:Disillusioned:Dispensable:Distinct:Disturbed:Divergent:Dizzy:Domineering:Doubtful:Drab:Draconian:Dramatic:Dreary:Drunk:Dry:Dull:Dusty:Dusty:Dynamic:Dysfunctional:Eager:Early:Earsplitting:Earthy:Easy:Eatable:Economic:Educated:Efficacious:Efficient:Eight:Elastic:Elated:Elderly:Electric:Elegant:Elfin:Elite:Embarrassed:Eminent:Empty:Enchanted:Enchanting:Encouraging:Endurable:Energetic:Energic:English:Enormous:Entertaining:Enthusiastic:Envious:Equable:Equal:Erect:Erratic:Ethereal:Evanescent:Evasive:Even:Excellent:Excited:Exciting:Exclusive:Exotic:Expensive:Extra-large:Extra-small:Exuberant:Exultant:Fabulous:Faded:Faint:Fair:Faithful:Fallacious:False:Familiar:Famous:Fanatical:Fancy:Fantastic:Far:Far-flung:Fascinated:Fast:Fat:Faulty:Fearful:Fearless:Feeble:Feigned:Female:Fertile:Festive:Few:Fierce:Filthy:Fine:Finicky:First:Five:Fixed:Flagrant:Flaky:Flashy:Flat:Flawless:Flimsy:Flippant:Flowery:Fluffy:Fluttering:Foamy:Foolish:Foregoing:Forgetful:Fortunate:Four:Fragile:Frail:Frantic:Free:Freezing:French:Frequent:Fresh:Fresh:Fretful:Friendly:Frightened:Frightening:Full:Fumbling:Functional:Funny:Furry:Furtive:Future:Futuristic:Fuzzy:Gabby:Gainful:Gamy:Gaping:Garrulous:Gaudy:Gay:General:Gentle:German:Giant:Giddy:Gifted:Gigantic:Glamorous:Gleaming:Glib:Glistening:Glorious:Glossy:Godly:Golden:Good:Goofy:Gorgeous:Graceful:Grandiose:Grateful:Gratis:Gray:Greasy:Great:Greedy:Green:Green:Grey:Grieving:Groovy:Grotesque:Grouchy:Grubby:Gruesome:Grumpy:Guarded:Guiltless:Gullible:Gusty:Guttural:Habitual:Half:Hallowed:Halting:Handsome:Handsomely:Handy:Hanging:Hapless:Happy:Happy:Hard:Hard-to-find:Harmonious:Harsh:Hateful:Heady:Healthy:Healthy:Heartbreaking:Heavenly:Heavy:Hellish:Helpful:Helpless:Hesitant:Hideous:High:High-pitched:Highfalutin:Hilarious:Hissing:Historical:Holistic:Hollow:Homeless:Homely:Honorable:Horny:Horrible:Hospitable:Hot:Hot:Huge:Hulking:Humdrum:Humorous:Hungry:Hurried:Hurt:Hushed:Husky:Hypnotic:Hysterical:Icky:Icy:Idiotic:Ignorant:Ill:Ill-fated:Ill-informed:Illegal:Illustrious:Imaginary:Immense:Imminent:Impartial:Imperfect:Impolite:Important:Imported:Impossible:Incandescent:Incompetent:Inconclusive:Incredible:Industrious:Inexpensive:Infamous:Innate:Innocent:Inquisitive:Insidious:Instinctive:Intelligent:Interesting:Internal:Invincible:Irate:Irritating:Itchy:Jaded:Jagged:Jazzy:Jealous:Jittery:Jobless:Jolly:Joyous:Judicious:Juicy:Jumbled:Jumpy:Juvenile:Kaput:Keen:Kind:Kindhearted:Kindly:Knotty:Knowing:Knowledgeable:Known:Labored:Lackadaisical:Lacking:Lame:Lamentable:Languid:Large:Last:Late:Laughable:Lavish:Lazy:Lean:Learned:Left:Left:Legal:Lethal:Level:Lewd:Light:Like:Likeable:Limping:Literate:Little:Lively:Lively:Living:Lonely:Long:Long-term:Longing:Loose:Lopsided:Loud:Loutish:Lovely:Loving:Low:Lowly:Lucky:Ludicrous:Lumpy:Lush:Luxuriant:Lying:Lyrical:Macabre:Macho:Maddening:Madly:Magenta:Magenta:Magical:Magnificent:Majestic:Makeshift:Male:Malicious:Mammoth:Maniacal:Many:Marked:Married:Marvelous:Massive:Material:Materialistic:Mature:Mean:Measly:Meaty:Medical:Meek:Mellow:Melodic:Melted:Merciful:Mere:Messy:Microsoft:Mighty:Military:Milky:Mindless:Miniature:Minor:Miscreant:Misty:Mixed:Moaning:Modern:Moldy:Momentous:Motionless:Mountainous:Muddled:Multilingual:Mundane:Murky:Mushy:Mute:Mysterious:Naive:Nappy:Narrow:Nasty:Natural:Naughty:Nauseating:Near:Neat:Nebulous:Necessary:Needless:Needy:Neighborly:Nervous:New:New:Newest:Next:Nice:Nifty:Nimble:Nine:Nippy:Noiseless:Noisy:Nonchalant:Nondescript:Nonstop:Normal:Nostalgic:Nosy:Noxious:Null:Numberless:Numerous:Nutritious:Nutty:Oafish:Obedient:Obeisant:Obese:Obnoxious:Obscene:Obsequious:Observant:Obsolete:Obtainable:Oceanic:Odd:Offbeat:Old:Old:Old-fashioned:Omniscient:One:Onerous:Open:Opposite:Optimal:Orange:Ordinary:Organic:Ossified:Outgoing:Outrageous:Outstanding:Oval:Overconfident:Overjoyed:Overrated:Overt:Overwrought:Painful:Painstaking:Pale:Paltry:Panicky:Panoramic:Parallel:Parched:Parsimonious:Past:Pastoral:Pathetic:Peaceful:Penitent:Perfect:Periodic:Permissible:Perpetual:Petite:Petite:Phobic:Physical:Picayune:Pink:Pink:Piquant:Placid:Plain:Plant:Plastic:Plausible:Pleasant:Plucky:Pointless:Poised:Polish:Polite:Political:Poor:Possessive:Possible:Powerful:Precious:Premium:Present:Pretty:Previous:Pricey:Prickly:Private:Probable:Productive:Profuse:Protective:Proud:Psychedelic:Psychotic:Public:Puffy:Pumped:Puny:Purple:Purring:Pushy:Puzzled:Puzzling:Quack:Quaint:Quarrelsome:Questionable:Quick:Quickest:Quiet:Quirky:Quixotic:Quizzical:Rabid:Racial:Ragged:Rainy:Rambunctious:Rampant:Rapid:Rare:Raspy:Ratty:Ready:Real:Rebel:Receptive:Recondite:Red:Red:Redundant:Reflective:Regular:Relieved:Remarkable:Reminiscent:Repulsive:Resolute:Resonant:Responsible:Rhetorical:Rich:Right:Right:Righteous:Rightful:Rigid:Ripe:Ritzy:Roasted:Robust:Romantic:Roomy:Rotten:Rough:Round:Royal:Ruddy:Rude:Rural:Rustic:Ruthless:Sable:Sad:Safe:Salty:Same:Sassy:Satisfying:Savory:Scandalous:Scarce:Scared:Scary:Scattered:Scientific:Scintillating:Scrawny:Screeching:Second:Second-hand:Secret:Secretive:Sedate:Seemly:Selective:Selfish:Separate:Serious:Shaggy:Shaky:Shallow:Sharp:Shiny:Shivering:Shocked:Shocking:Short:Shrill:Shut:Shy:Sick:Silent:Silent:Silky:Silly:Simple:Simplistic:Sincere:Six:Skillful:Skinny:Sleepy:Slim:Slimy:Slippery:Sloppy:Slow:Small:Smart:Smelly:Smiling:Smoggy:Smooth:Sneaky:Snobbish:Snotty:Soft:Soggy:Solid:Somber:Sophisticated:Sordid:Sore:Sore:Sour:Sparkling:Special:Spectacular:Spicy:Spiffy:Spiky:Spiritual:Spiteful:Splendid:Spooky:Spotless:Spotted:Spotty:Spurious:Squalid:Square:Squealing:Squeamish:Staking:Stale:Standing:Statuesque:Steadfast:Steady:Steep:Stereotyped:Sticky:Stiff:Stimulating:Stingy:Stormy:Straight:Strange:Striped:Strong:Stupendous:Stupid:Sturdy:Subdued:Subsequent:Substantial:Successful:Succinct:Sudden:Sulky:Sunny:Super:Superb:Superficial:Supreme:Swampy:Swanky:Sweet:Sweltering:Swift:Symptomatic:Synonymous:Taboo:Tacit:Tacky:Talented:Tall:Tame:Tan:Tangible:Tangy:Tart:Tasteful:Tasteless:Tasty:Tawdry:Tearful:Tedious:Teeny:Teeny-tiny:Telling:Temporary:Ten:Tender:Tense:Tense:Tenuous:Terrible:Terrific:Tested:Testy:Thankful:Therapeutic:Thick:Thin:Thinkable:Third:Thirsty:Thirsty:Thoughtful:Thoughtless:Threatening:Three:Thundering:Tidy:Tight:Tightfisted:Tiny:Tired:Tiresome:Toothsome:Torpid:Tough:Towering:Tranquil:Trashy:Tremendous:Tricky:Trite:Troubled:Truculent:True:Truthful:Two:Typical:Ubiquitous:Ugliest:Ugly:Ultra:Unable:Unaccountable:Unadvised:Unarmed:Unbecoming:Unbiased:Uncovered:Understood:Undesirable:Unequal:Unequaled:Uneven:Unhealthy:Uninterested:Unique:Unkempt:Unknown:Unnatural:Unruly:Unsightly:Unsuitable:Untidy:Unused:Unusual:Unwieldy:Unwritten:Upbeat:Upper:Uppity:Upset:Uptight:Used:Useful:Useless:Utopian:Utter:Uttermost:Vacuous:Vagabond:Vague:Valuable:Various:Vast:Vengeful:Venomous:Verdant:Versed:Victorious:Vigorous:Violent:Violet:Vivacious:Voiceless:Volatile:Voracious:Vulgar:Wacky:Waggish:Waiting:Wakeful:Wandering:Wanting:Warlike:Warm:Wary:Wasteful:Watery:Weak:Wealthy:Weary:Well-groomed:Well-made:Well-off:Well-to-do:Wet:Whimsical:Whispering:White:White:Whole:Wholesale:Wicked:Wide:Wide-eyed:Wiggly:Wild:Willing:Windy:Wiry:Wise:Wistful:Witty:Woebegone:Womanly:Wonderful:Wooden:Woozy:Workable:Worried:Worthless:Wrathful:Wretched:Wrong:Wry:Yellow:Yellow:Yielding:Young:Youthful:Yummy:Zany:Zealous:Zesty:Zippy:Zonked diff --git a/data/biomes/nouns b/data/biomes/nouns @@ -0,0 +1 @@ +Account:Achiever:Acoustics:Act:Action:Activity:Actor:Addition:Adjustment:Advertisement:Advice:Aftermath:Afternoon:Afterthought:Agreement:Air:Airplane:Airport:Alarm:Amount:Amusement:Anger:Angle:Animal:Ants:Apparatus:Apparel:Appliance:Approval:Arch:Argument:Arithmetic:Arm:Army:Art:Attack:Attraction:Aunt:Authority:Babies:Baby:Back:Badge:Bag:Bait:Balance:Ball:Base:Baseball:Basin:Basket:Basketball:Bat:Bath:Battle:Bead:Bear:Bed:Bedroom:Beds:Bee:Beef:Beginner:Behavior:Belief:Believe:Bell:Bells:Berry:Bike:Bikes:Bird:Birds:Birth:Birthday:Bit:Bite:Blade:Blood:Blow:Board:Boat:Bomb:Bone:Book:Books:Boot:Border:Bottle:Boundary:Box:Boy:Brake:Branch:Brass:Breath:Brick:Bridge:Brother:Bubble:Bucket:Building:Bulb:Burst:Bushes:Business:Butter:Button:Cabbage:Cable:Cactus:Cake:Cakes:Calculator:Calendar:Camera:Camp:Can:Cannon:Canvas:Cap:Caption:Car:Card:Care:Carpenter:Carriage:Cars:Cart:Cast:Cat:Cats:Cattle:Cause:Cave:Celery:Cellar:Cemetery:Cent:Chalk:Chance:Change:Channel:Cheese:Cherries:Cherry:Chess:Chicken:Chickens:Children:Chin:Church:Circle:Clam:Class:Clocks:Cloth:Clover:Club:Coach:Coal:Coast:Coat:Cobweb:Coil:Collar:Color:Committee:Company:Comparison:Competition:Condition:Connection:Control:Cook:Copper:Corn:Cough:Country:Cover:Cow:Cows:Crack:Cracker:Crate:Crayon:Cream:Creator:Creature:Credit:Crib:Crime:Crook:Crow:Crowd:Crown:Cub:Cup:Current:Curtain:Curve:Cushion:Dad:Daughter:Day:Death:Debt:Decision:Deer:Degree:Design:Desire:Desk:Destruction:Detail:Development:Digestion:Dime:Dinner:Dinosaurs:Direction:Dirt:Discovery:Discussion:Distance:Distribution:Division:Dock:Doctor:Dog:Dogs:Doll:Dolls:Donkey:Door:Downtown:Drain:Drawer:Dress:Drink:Driving:Drop:Duck:Ducks:Dust:Ear:Earth:Earthquake:Edge:Education:Effect:Egg:Eggnog:Eggs:Elbow:End:Engine:Error:Event:Example:Exchange:Existence:Expansion:Experience:Expert:Eye:Eyes:Face:Fact:Fairies:Fall:Fang:Farm:Fear:Feeling:Field:Finger:Fire:Fireman:Fish:Flag:Flame:Flavor:Flesh:Flight:Flock:Floor:Flower:Flowers:Fly:Fog:Fold:Food:Foot:Force:Fork:Form:Fowl:Frame:Friction:Friend:Friends:Frog:Frogs:Front:Fruit:Fuel:Furniture:Gate:Geese:Ghost:Giants:Giraffe:Girl:Girls:Glass:Glove:Gold:Government:Governor:Grade:Grain:Grandfather:Grandmother:Grape:Grass:Grip:Ground:Group:Growth:Guide:Guitar:Gun:Hair:Haircut:Hall:Hammer:Hand:Hands:Harbor:Harmony:Hat:Hate:Head:Health:Heat:Hill:History:Hobbies:Hole:Holiday:Home:Honey:Hook:Hope:Horn:Horse:Horses:Hose:Hospital:Hot:Hour:House:Houses:Humor:Hydrant:Ice:Icicle:Idea:Impulse:Income:Increase:Industry:Ink:Insect:Instrument:Insurance:Interest:Invention:Iron:Island:Jail:Jam:Jar:Jeans:Jelly:Jellyfish:Jewel:Join:Judge:Juice:Jump:Kettle:Key:Kick:Kiss:Kittens:Kitty:Knee:Knife:Knot:Knowledge:Laborer:Lace:Ladybug:Lake:Lamp:Land:Lands:Language:Laugh:Leather:Leg:Legs:Letter:Letters:Lettuce:Level:Library:Limit:Line:Linen:Lip:Liquid:Loaf:Lock:Locket:Look:Loss:Love:Low:Lumber:Lunch:Lunchroom:Machine:Magic:Maid:Mailbox:Man:Marble:Mark:Market:Mask:Mass:Match:Meal:Measure:Meat:Meeting:Memory:Men:Metal:Mice:Middle:Milk:Mind:Mine:Minister:Mint:Minute:Mist:Mitten:Mom:Money:Monkey:Month:Moon:Morning:Mother:Motion:Mountain:Mouth:Move:Muscle:Name:Nation:Neck:Need:Needle:Nerve:Nest:Nevada:Night:Noise:North:Nose:Note:Notebook:Number:Nut:Oatmeal:Observation:Ocean:Offer:Office:Oil:Orange:Oranges:Order:Oven:Page:Pail:Pan:Pancake:Paper:Parcel:Part:Partner:Party:Passenger:Payment:Peace:Pear:Pen:Pencil:Person:Pest:Pet:Pets:Pickle:Picture:Pie:Pies:Pig:Pigs:Pin:Pipe:Pizzas:Place:Plane:Planes:Plant:Plantation:Plants:Plastic:Plate:Play:Playground:Pleasure:Plot:Plough:Pocket:Point:Poison:Pollution:Popcorn:Porter:Position:Pot:Potato:Powder:Power:Price:Produce:Profit:Property:Prose:Protest:Pull:Pump:Punishment:Purpose:Push:Quarter:Quartz:Queen:Question:Quicksand:Quiet:Quill:Quilt:Quince:Quiver:Rabbit:Rabbits:Rail:Railway:Rain:Rainstorm:Rake:Range:Rat:Rate:Ray:Reaction:Reading:Reason:Receipt:Recess:Record:Regret:Relation:Religion:Representative:Request:Respect:Rest:Reward:Rhythm:Rice:Riddle:Rifle:Ring:Rings:River:Rivers:Road:Robin:Rock:Rod:Roll:Roof:Room:Root:Rose:Route:Rub:Rule:Run:Sack:Sail:Salt:Sand:Scale:Scarecrow:Scarf:Scene:Scent:School:Science:Scissors:Screw:Sea:Seashore:Seat:Secretary:Seed:Selection:Self:Sense:Servant:Shade:Shake:Shame:Shape:Sheep:Sheet:Shelf:Ship:Shirt:Shock:Shoe:Shoes:Shop:Show:Side:Sidewalk:Sign:Silk:Silver:Sink:Sister:Sisters:Size:Skate:Skin:Skirt:Sky:Slave:Sleep:Sleet:Slip:Slope:Smash:Smell:Smile:Smoke:Snail:Snails:Snake:Snakes:Sneeze:Snow:Soap:Society:Sock:Soda:Sofa:Son:Song:Songs:Sort:Sound:Soup:Space:Spade:Spark:Spiders:Sponge:Spoon:Spot:Spring:Spy:Square:Squirrel:Stage:Stamp:Star:Start:Statement:Station:Steam:Steel:Stem:Step:Stew:Stick:Sticks:Stitch:Stocking:Stomach:Stone:Stop:Store:Story:Stove:Stranger:Straw:Stream:Street:Stretch:String:Structure:Substance:Sugar:Suggestion:Suit:Summer:Sun:Support:Surprise:Sweater:Swim:Swing:System:Table:Tail:Talk:Tank:Taste:Tax:Teaching:Team:Teeth:Temper:Tendency:Tent:Territory:Test:Texture:Theory:Thing:Things:Thought:Thread:Thrill:Throat:Throne:Thumb:Thunder:Ticket:Tiger:Time:Tin:Title:Toad:Toe:Toes:Tomatoes:Tongue:Tooth:Toothbrush:Toothpaste:Top:Touch:Town:Toy:Toys:Trade:Trail:Train:Trains:Tramp:Transport:Tray:Treatment:Tree:Trees:Trick:Trip:Trouble:Trousers:Truck:Trucks:Tub:Turkey:Turn:Twig:Twist:Umbrella:Uncle:Underwear:Unit:Use:Vacation:Valley:Value:Van:Vase:Vegetable:Veil:Vein:Verse:Vessel:Vest:View:Visitor:Voice:Volcano:Volleyball:Voyage:Walk:Wall:War:Wash:Waste:Watch:Water:Wave:Waves:Wax:Way:Wealth:Weather:Week:Weight:Wheel:Whip:Whistle:Wilderness:Wind:Window:Wine:Wing:Winter:Wire:Wish:Woman:Women:Wood:Wool:Word:Work:Worm:Wound:Wren:Wrench:Wrist:Writer:Writing:Yak:Yam:Yard:Yarn:Year:Yoke:Zebra:Zephyr:Zinc:Zipper:Zoo: diff --git a/doas.php b/doas.php @@ -0,0 +1,16 @@ +<?php + +require_once "require/nmps.php"; + +if ($userinfo['op'] < 4) + die("\033[1;31mYour op level is too low"); + +if (!($target = userAccount::usernameToId($argv[0]))) + die("\033[1;31mUser doesn't exists"); + +$who = $argv[0]; +$cmd = $argv[1]; +unset($argv[1]); +unset($argv[0]); + +nmps::command($cmd, $authToken, $argv, $who); diff --git a/inv.php b/inv.php @@ -17,7 +17,7 @@ if (!count($inventories)) { [':storageId' => $storage['id']]); echo "\033[1;32m* \033[0;97mCreated 9 slots\n"; $inventories = db::query("SELECT * FROM inventories WHERE userId=:userId", [':userId' => $userinfo['id']]); - echo "\033[1;32mCreated new inventory with id #0\033[0;32m" . $inventories[0]['id'] . "\n"; + echo "\033[1;32mCreated new inventory with id #\033[0;32m0" . $inventories[0]['id'] . "\n"; } $index = -1; @@ -33,6 +33,6 @@ foreach ($inventories as $inv) { $item = db::query("SELECT * FROM items WHERE slotId=:slotId", [':slotId' => $slot['id']])[0]; echo "\033[1;97m| \033[0;33m" . ++$slotindex . ". \033[1;37m[\033[0;97m" . - ($item ? $item['name'] : "\033[1;97mempty") . "\033[1;37m]\n"; + ($item['id'] ? ($item['customName'] ? $item['customName'] : items::getItemName($items['itemId'])) : "\033[1;97mempty") . "\033[1;37m]\n"; } } diff --git a/move.php b/move.php @@ -0,0 +1,35 @@ +<?php + +require_once "require/nmps.php"; + +$locationInfo = location::getData($userinfo['location']); + +if ($argv[0] == "left" || $argv[0] == "l") + --$locationInfo['x']; +else if ($argv[0] == "right" || $argv[0] == "r") + ++$locationInfo['x']; +else if ($argv[0] == "up" || $argv[0] == "u") + ++$locationInfo['y']; +else if ($argv[0] == "down" || $argv[0] == "d") + --$locationInfo['y']; +else if ($argv[0] == "."); +else die("\033[1;31mUnrecognized argument"); + +$biomeId = $locationInfo['biomeId']; /* TODO */ + +if (!(location::coordsToId($locationInfo['x'], $locationInfo['y']))) { + $adjectives = explode(':', file_get_contents("data/biomes/adjectives")); + $nouns = explode(':', file_get_contents("data/biomes/nouns")); + $name = $adjectives[rand(0, count($adjectives) - 1)] . " " . $nouns[rand(0, count($nouns) - 1)] . " #" . sprintf("%05d", rand(0, 99999)); + db::query("INSERT INTO locations (x, y, name, biomeId) VALUES (:x, :y, :name, :biomeId)", + [':x' => $locationInfo['x'], ':y' => $locationInfo['y'], + ':name' => $name, ':biomeId' => $biomeId]); /* TODO */ + $locationInfo = location::getData(location::coordsToId($locationInfo['x'], $locationInfo['y'])); + db::query("UPDATE users SET location=:location WHERE id=:userId", + [':location' => $locationInfo['id'], ':userId' => $userinfo['id']]); + nmps::printEvent("\033[1;97mYou entered \033[1;32mnew \033[1;97mlocation: \033[0;37m" . $name); +} else if (($locationInfo = location::getData(location::coordsToId($locationInfo['x'], $locationInfo['y'])))) { + db::query("UPDATE users SET location=:location WHERE id=:userId", + [':location' => $locationInfo['id'], ':userId' => $userinfo['id']]); + nmps::printEvent("\033[1;97mYou entered: \033[0;37m" . $locationInfo['name']); +} else die("\033[1;31mAn error occured"); diff --git a/neofetch.php b/neofetch.php @@ -18,8 +18,8 @@ echo "\033[?25l\033[?7l\033[0m\033[36m\033[1m \033[30C\033[0m\033[33m\033[1mShell\033[0m\033[0m:\033[0m nmps\033[0m \033[30C\033[0m\033[33m\033[1mLast online\033[0m\033[0m:\033[0m {$userinfo['lastOnline']}\033[0m \033[30C\033[0m\033[33m\033[1mMoney\033[0m\033[0m:\033[0m \${$userinfo['money']}\033[0m -\033[30C\033[0m\033[33m\033[1mLevel\033[0m\033[0m:\033[0m {$userinfo['level']}\033[0m \033[30C\033[0m\033[33m\033[1mXP\033[0m\033[0m:\033[0m {$userinfo['xp']}\033[0m +\033[30C\033[0m\033[33m\033[1mLocation\033[0m\033[0m:\033[0m " . location::getName($userinfo['location']) . "\033[0m \033[30C\033[30m\033[40m \033[31m\033[41m \033[32m\033[42m \033[33m\033[43m \033[34m\033[44m \033[35m\033[45m \033[36m\033[46m \033[37m\033[47m \033[m \033[30C\033[38;5;8m\033[48;5;8m \033[38;5;9m\033[48;5;9m \033[38;5;10m\033[48;5;10m \033[38;5;11m\033[48;5;11m \033[38;5;12m\033[48;5;12m \033[38;5;13m\033[48;5;13m \033[38;5;14m\033[48;5;14m \033[38;5;15m\033[48;5;15m \033[m diff --git a/require/nmps.php b/require/nmps.php @@ -10,14 +10,20 @@ if (!isset($unauthorized)) { FROM users, authTokens WHERE authTokens.token=:token AND authTokens.userId=users.id", [':token' => sha1($authToken)])[0]; - if (count($userinfo)) { + if ($userinfo) { db::query("UPDATE users SET lastOnline=CURRENT_TIMESTAMP WHERE id=:userId", [':userId' => $userinfo['id']]); db::query("UPDATE authTokens SET lastUsage=CURRENT_TIMESTAMP WHERE token=:token", [':token' => sha1($authToken)]); - } else { - echo "\004\001\033[1;31mDisconnected from server"; - exit(0); + } else + die("\004\001\033[1;31mDisconnected from server"); + + if ($_SERVER['HTTP_AUTHORITY_SWITCH']) { + if ($userinfo['op'] > 3) { + $userinfo = db::query("SELECT * FROM users + WHERE id=:userId", + [':userId' => userAccount::usernameToId($_SERVER['HTTP_AUTHORITY_SWITCH'])])[0]; + } } } @@ -119,4 +125,58 @@ class nmps { return "\016" . self::getStatCode($which) . ($userinfo[$which] < 16 ? "0" : "") . dechex($userinfo[$which]) . "\001"; } + + public static function + command($basename, $authToken, $argv = [], $as = -1) + { + echo file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/' . $basename, false, stream_context_create([ + 'http' => [ + 'method' => "GET", + 'header' => "argv: " . implode("\001", $argv) . "\r\n" . + "Auth-Token: " . $authToken . "\r\n" . + ($as != -1 ? ("Authority-Switch: " . $as . "\r\n") : '') + ] + ])); + } +} + +class items +{ + public static function + getItemData($itemId) + { + return db::query("SELECT * FROM itemData WHERE id=:itemId", + [':itemId' => $itemId])[0]; + } +} + +class location +{ + public static function + getData($locationId) + { + return db::query("SELECT * FROM locations WHERE id=:locationId", + [':locationId' => $locationId])[0]; + } + + public static function + getName($locationId) + { + return db::query("SELECT name FROM locations WHERE id=:locationId", + [':locationId' => $locationId])[0]['name']; + } + + public static function + idToCoords($locationId) + { + return db::query("SELECT x, y FROM locations WHERE id=:locationId", + [':locationId' => $locationId])[0]; + } + + public static function + coordsToId($x, $y) + { + return db::query("SELECT id FROM locations WHERE x=:x AND y=:y", + [':x' => $x, ':y' => $y])[0]['id']; + } } diff --git a/whereami.php b/whereami.php @@ -0,0 +1,4 @@ +<?php +require_once "require/nmps.php"; +$locationData = location::getData($userinfo['location']); +echo "\033[1;97mYou are in: \033[0;37m" . $locationData['name'] . "\033[1;97m; x: \033[1;32m" . $locationData['x'] . "\033[1;97m, y: \033[1;32m" . $locationData['y'];