-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.js
35 lines (32 loc) · 1.11 KB
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Users = Meteor.users;
Planets = new Meteor.Collection('planets');
Soldiers = new Meteor.Collection('soldiers');
Chat = new Meteor.Collection('chat');
Battles = new Meteor.Collection('battles');
BattleLog = new Meteor.Collection('battlelog');
exp2level = [0, 0, 50, 100, 200, 400, 800, 1600, 3000, 6000, 12000,
24000, 48000, 100000, 200000, 300000,
400000, 500000, 600000, 800000, 1000000];
if (Meteor.isServer) {
// publish all the non-idle players.
Meteor.publish('userData', function () {
// return Users.find({idle: false},
// {fields: {'last_keepalive': 1,'idle': 1, 'username': 1, 'fuel': 1, 'planet': 1, 'soldierCount': 1, 'soldiers': 1}});
return Users.find({idle: false});
});
Meteor.publish('planets', function() {
return Planets.find();
});
Meteor.publish('soldiers', function() {
return Soldiers.find();
});
Meteor.publish('chat', function() {
return Chat.find({}, {limit: 8, sort: {time: -1}});
});
Meteor.publish('battles', function() {
return Battles.find();
});
Meteor.publish('battlelog', function() {
return BattleLog.find();
});
}