Skip to content

Commit b9a46ac

Browse files
committed
2 parents b6184fb + 8f1c151 commit b9a46ac

22 files changed

Lines changed: 689 additions & 393 deletions

ngengine_public.jar

6.28 KB
Binary file not shown.

odb/building/placeholder.txt

Whitespace-only changes.

scripts/commands/lfg.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from resources.common import PlayerFlags
2+
import sys
3+
4+
def setup():
5+
return
6+
7+
def run(core, actor, target, commandString):
8+
ghost = actor.getSlottedObject('ghost')
9+
print ('Command recieved!')
10+
ghost.toggleFlag(PlayerFlags.LFG)
11+
return

scripts/commands/newbiehelper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from resources.common import PlayerFlags
2+
import sys
3+
4+
def setup():
5+
return
6+
7+
def run(core, actor, target, commandString):
8+
ghost = actor.getSlottedObject('ghost')
9+
ghost.toggleFlag(PlayerFlags.HELPER)
10+
return

scripts/commands/roleplay.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from java.lang import Integer
2+
from resources.common import PlayerFlags
3+
import sys
4+
5+
def setup():
6+
return
7+
8+
def run(core, actor, target, commandString):
9+
ghost = actor.getSlottedObject('ghost')
10+
ghost.toggleFlag(PlayerFlags.ROLEPLAYER)
11+
return

scripts/commands/server.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import sys
2+
from engine.resources.scene import Point3D
3+
4+
def setup():
5+
return
6+
7+
def run(core, actor, target, commandString):
8+
9+
playerObject = actor.getSlottedObject('ghost')
10+
11+
if not playerObject:
12+
return
13+
14+
commandArgs = commandString.split(' ')
15+
command = commandArgs[0]
16+
if len(commandArgs) > 1:
17+
arg1 = commandArgs[1]
18+
if len(commandArgs) > 2:
19+
arg2 = commandArgs[2]
20+
if len(commandArgs) > 3:
21+
arg3 = commandArgs[3]
22+
if len(commandArgs) > 4:
23+
arg4 = commandArgs[4]
24+
25+
if not command:
26+
return
27+
28+
if command == 'lockServer':
29+
core.setGalaxyStatus(3)
30+
if command == 'unlockServer':
31+
core.setGalaxyStatus(2)
32+
if command == 'info':
33+
actor.sendSystemMessage(str(core.getActiveZoneClients()) + ' online characters.', 0)
34+
35+
return

scripts/commands/setcurrentskilltitle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ def setup():
66
def run(core, actor, target, commandString):
77

88
playerObject = actor.getSlottedObject('ghost')
9-
print ("Title set to: " + commandString)
10-
print ("List of Titles: " + playerObject.getTitleList().toString())
9+
#print ("Title set to: " + commandString)
10+
#print ("List of Titles: " + playerObject.getTitleList().toString())
1111
if playerObject is None:
1212
return
1313

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from resources.common import PlayerFlags
2+
import sys
3+
4+
def setup():
5+
return
6+
7+
def run(core, actor, target, commandString):
8+
ghost = actor.getSlottedObject('ghost')
9+
ghost.toggleFlag(PlayerFlags.AFK)
10+
return

scripts/demo.py

Lines changed: 358 additions & 359 deletions
Large diffs are not rendered by default.

src/main/NGECore.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import java.util.concurrent.TimeUnit;
3636

3737
import org.apache.mina.core.service.IoHandler;
38+
39+
import protocol.swg.ChatSystemMessage;
3840
import net.engio.mbassy.bus.config.BusConfiguration;
3941
import resources.common.RadialOptions;
4042
import resources.common.ThreadMonitor;
@@ -108,6 +110,7 @@ public class NGECore {
108110

109111
private Config config = null;
110112

113+
private volatile boolean isShuttingDown = false;
111114

112115
private ConcurrentHashMap<Integer, Client> clients = new ConcurrentHashMap<Integer, Client>();
113116

@@ -168,6 +171,8 @@ public class NGECore {
168171

169172
private BusConfiguration eventBusConfig = BusConfiguration.Default(1, new ThreadPoolExecutor(1, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>()));
170173

174+
private ObjectDatabase buildingODB;
175+
171176

172177
public NGECore() {
173178

@@ -209,6 +214,7 @@ public void run() {
209214

210215
setGalaxyStatus(1);
211216
creatureODB = new ObjectDatabase("creature", true, false, true);
217+
buildingODB = new ObjectDatabase("building", true, false, true);
212218
mailODB = new ObjectDatabase("mails", true, false, true);
213219
guildODB = new ObjectDatabase("guild", true, false, true);
214220
// Services
@@ -305,6 +311,7 @@ public void run() {
305311
travelService.loadTravelPoints();
306312
simulationService = new SimulationService(this);
307313

314+
objectService.loadBuildings();
308315
terrainService.loadSnapShotObjects();
309316
simulationService.insertSnapShotObjects();
310317

@@ -438,6 +445,10 @@ public ObjectDatabase getGuildODB() {
438445
return guildODB;
439446
}
440447

448+
public ObjectDatabase getBuildingODB() {
449+
return buildingODB;
450+
}
451+
441452
public int getActiveClients() {
442453
int connections = 0;
443454
for (Map.Entry<Integer, Client> c : clients.entrySet()) {
@@ -495,5 +506,39 @@ public BusConfiguration getEventBusConfig() {
495506
return eventBusConfig;
496507
}
497508

509+
public void initiateShutdown() {
510+
if(isShuttingDown)
511+
return;
512+
try {
513+
514+
for(int minutes = 15; minutes > 1; minutes--) {
515+
simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + minutes + " minutes left)", (byte) 0 ).serialize());
516+
Thread.sleep(60000);
517+
}
518+
setGalaxyStatus(3);
519+
simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + 1 + " minutes left)", (byte) 0 ).serialize());
520+
Thread.sleep(30000);
521+
simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 30 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize());
522+
Thread.sleep(20000);
523+
simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 10 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize());
524+
Thread.sleep(10000);
525+
simulationService.notifyAllClients(new ChatSystemMessage("You will now be disconnected so the server can perform a final save before shutting down.", (byte) 0 ).serialize());
526+
527+
synchronized(getActiveConnectionsMap()) {
528+
for(Client client : getActiveConnectionsMap().values()) {
529+
client.getSession().close(true);
530+
}
531+
}
532+
533+
System.exit(0);
534+
535+
} catch (InterruptedException e) {
536+
e.printStackTrace();
537+
}
538+
539+
540+
541+
}
542+
498543
}
499544

0 commit comments

Comments
 (0)