Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orders are added to the database but none appear in game #16

Open
SystemParadox opened this issue Jul 4, 2021 · 4 comments
Open

Orders are added to the database but none appear in game #16

SystemParadox opened this issue Jul 4, 2021 · 4 comments

Comments

@SystemParadox
Copy link

This mod appears to be adding orders but none of them show up in the game. Is there something else that needs to be done? Any tips on how to debug this?

Also, I'm a bit confused about whether this mod is needed or not. There's a builtin recreateNpcOrders cron job which runs and also creates orders, but without this mod the credits indicator never shows in the client and the market pages are not accessible?

@SystemParadox
Copy link
Author

The objects in the database seem to be missing createdTimestamp, price, amount, totalAmount, remainingAmount, created and user:

Order created by this mod:

  {
    type: 'sell',
    roomName: 'W10N10',
    resourceType: 'X',
    _id: '43813c249256dd1',
    meta: {
      revision: 1,
      created: 1625439750437,
      version: 0,
      updated: 1625439810444
    },
    '$loki': 57
  }

Order created by a player:

  {
    createdTimestamp: 1625439737307,
    user: 'd944353cff1a9b4',
    active: true,
    type: 'sell',
    amount: 20000,
    remainingAmount: 20000,
    resourceType: 'energy',
    price: 4000,
    totalAmount: 20000,
    roomName: 'W3N7',
    created: 9787,
    _id: '72d13c215dcdd15',
    meta: {
      revision: 1,
      created: 1625439737308,
      version: 0,
      updated: 1625439738295
    },
    '$loki': 1
  }

@SystemParadox
Copy link
Author

Ok this is because the config file is missing buyAmount and sellAmount. The latest version published to npm has an invalid market.example.yml file which contains buyMineralAmount and sellMineralAmount instead.

@SystemParadox
Copy link
Author

Nope, even with buyAmount/sellAmount set it's still not working. I've added some debugging and it appears to insert the orders with the correct values but they're still somehow ending up with loads of missing properties

@SystemParadox
Copy link
Author

Changing the update to wrap with $set fixes this:

db['market.orders'].update({ type: order.type, roomName: order.roomName, resourceType: order.resourceType },  { $set: order }, { upsert: true });

This looks like it might be a lokijs vs mongodb compatibility issue. Is lokijs a subset of mongo or are they completely different? I would hope that mods wouldn't have to deal with differences in storage backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant