mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
GCW Zone implementation, functions for guilds
This commit is contained in:
+15
-4
@@ -39,6 +39,8 @@ import services.SimulationService;
|
||||
import services.TerrainService;
|
||||
import services.chat.ChatService;
|
||||
import services.command.CommandService;
|
||||
import services.gcw.GCWService;
|
||||
import services.guild.GuildService;
|
||||
import services.map.MapService;
|
||||
import services.object.ObjectService;
|
||||
import services.object.UpdateService;
|
||||
@@ -95,7 +97,8 @@ public class NGECore {
|
||||
public ChatService chatService;
|
||||
public AttributeService attributeService;
|
||||
public SUIService suiService;
|
||||
|
||||
public GuildService guildService;
|
||||
public GCWService gcwService;
|
||||
|
||||
// Login Server
|
||||
public NetworkDispatch loginDispatch;
|
||||
@@ -106,9 +109,7 @@ public class NGECore {
|
||||
private MINAServer zoneServer;
|
||||
|
||||
private ObjectDatabase creatureODB;
|
||||
|
||||
private ObjectDatabase mailODB;
|
||||
|
||||
|
||||
public NGECore() {
|
||||
|
||||
@@ -144,6 +145,7 @@ public class NGECore {
|
||||
chatService = new ChatService(this);
|
||||
attributeService = new AttributeService(this);
|
||||
suiService = new SUIService(this);
|
||||
|
||||
// Ping Server
|
||||
try {
|
||||
PingServer pingServer = new PingServer(config.getInt("PING.PORT"));
|
||||
@@ -151,12 +153,14 @@ public class NGECore {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Login Server
|
||||
loginDispatch = new NetworkDispatch(this, false);
|
||||
loginDispatch.addService(loginService);
|
||||
|
||||
loginServer = new MINAServer(loginDispatch, config.getInt("LOGIN.PORT"));
|
||||
loginServer.start();
|
||||
|
||||
// Zone Server
|
||||
zoneDispatch = new NetworkDispatch(this, true);
|
||||
zoneDispatch.addService(connectionService);
|
||||
@@ -173,10 +177,17 @@ public class NGECore {
|
||||
// Planets
|
||||
terrainService.addPlanet(1, "tatooine", "terrain/tatooine.trn", true);
|
||||
|
||||
|
||||
terrainService.loadSnapShotObjects();
|
||||
|
||||
// Zone services that need to be loaded after the above
|
||||
simulationService = new SimulationService(this);
|
||||
zoneDispatch.addService(simulationService);
|
||||
|
||||
guildService = new GuildService(this);
|
||||
zoneDispatch.addService(guildService);
|
||||
|
||||
gcwService = new GCWService(this);
|
||||
zoneDispatch.addService(gcwService);
|
||||
|
||||
didServerCrash = false;
|
||||
System.out.println("Started Server.");
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects;
|
||||
|
||||
public class CurrentServerGCWZoneInfo {
|
||||
@@ -35,8 +35,8 @@ public class CurrentServerGCWZoneInfo {
|
||||
this.percent = percent;
|
||||
}
|
||||
|
||||
public CurrentServerGCWZoneInfo() {
|
||||
|
||||
public CurrentServerGCWZoneInfo(String zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
public byte getUnknown1() {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects;
|
||||
|
||||
public class CurrentServerGCWZonePercent {
|
||||
@@ -33,8 +33,8 @@ public class CurrentServerGCWZonePercent {
|
||||
this.percent = percent;
|
||||
}
|
||||
|
||||
public CurrentServerGCWZonePercent() {
|
||||
|
||||
public CurrentServerGCWZonePercent(String zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
public byte getUnknown() {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects;
|
||||
|
||||
public class Guild {
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects;
|
||||
|
||||
public class OtherServerGCWZonePercent {
|
||||
|
||||
private byte unknown = 0;
|
||||
private String server = "";
|
||||
private String server = "SWG";
|
||||
private String zone = "";
|
||||
private int percent = 50;
|
||||
|
||||
@@ -35,8 +35,8 @@ public class OtherServerGCWZonePercent {
|
||||
this.percent = percent;
|
||||
}
|
||||
|
||||
public OtherServerGCWZonePercent() {
|
||||
|
||||
public OtherServerGCWZonePercent(String zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
public byte getUnknown() {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects.guild;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
@@ -65,7 +65,8 @@ public class GuildMessageBuilder extends ObjectMessageBuilder {
|
||||
public IoBuffer buildBaseline6() {
|
||||
GuildObject guilds = (GuildObject) object;
|
||||
|
||||
int capacity = 77;
|
||||
int capacity = 82;
|
||||
//int capacity = 77;
|
||||
capacity += (guilds.getCurrentServerGCWZonePercentList().size() * 30);
|
||||
capacity += (guilds.getCurrentServerGCWTotalPercentList().size() * 14);
|
||||
capacity += (guilds.getCurrentServerGCWZoneInfoList().size() * 34);
|
||||
@@ -125,6 +126,7 @@ public class GuildMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.put(getAsciiString(object.getZone()));
|
||||
buffer.putInt(object.getPercent());
|
||||
}
|
||||
buffer.putInt(5); // Unknown
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package resources.objects.guild;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -33,7 +33,9 @@ import com.sleepycat.persist.model.NotPersistent;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.SWGObject;
|
||||
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
public class GuildObject extends SWGObject {
|
||||
|
||||
@@ -49,7 +51,7 @@ public class GuildObject extends SWGObject {
|
||||
private int guildListUpdateCounter = 0;
|
||||
|
||||
// GILD 6
|
||||
private int serverId = 0x41000000;
|
||||
private int serverId = 0x00000041;
|
||||
//private String STFName = "string_id_table";
|
||||
private int unknown1 = 0;
|
||||
private short unknown2 = 0;
|
||||
@@ -81,8 +83,8 @@ public class GuildObject extends SWGObject {
|
||||
@NotPersistent
|
||||
private GuildMessageBuilder messageBuilder;
|
||||
|
||||
public GuildObject() {
|
||||
super();
|
||||
public GuildObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, position, orientation, Template);
|
||||
messageBuilder = new GuildMessageBuilder(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services.gcw;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import resources.objects.CurrentServerGCWZoneInfo;
|
||||
import resources.objects.CurrentServerGCWZonePercent;
|
||||
import resources.objects.OtherServerGCWZonePercent;
|
||||
import resources.objects.guild.GuildObject;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
public class GCWService implements INetworkDispatch {
|
||||
|
||||
private NGECore core;
|
||||
private GuildObject object;
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
public GCWService(final NGECore core) {
|
||||
this.core = core;
|
||||
|
||||
// The GCW object is also the guild object; someone at SOE got lazy
|
||||
object = this.core.guildService.getGuildObject();
|
||||
|
||||
// Load GCW Zones
|
||||
// TODO load from the stf file in future
|
||||
String[] zones =
|
||||
{
|
||||
"corellia_airspace", "corellia_pve", "corellia_pvp", "dantooine_airspace",
|
||||
"dantooine_pve", "dantooine_pvp", "dathomir_airspace", "dathomir_pve", "dathomir_pvp",
|
||||
"endor_airspace", "endor_pve", "endor_pvp", "endor_pvp_battlefield",
|
||||
"gcw_region_corellia_1", "gcw_region_corellia_10", "gcw_region_corellia_11",
|
||||
"gcw_region_corellia_12", "gcw_region_corellia_13", "gcw_region_corellia_14",
|
||||
"gcw_region_corellia_2", "gcw_region_corellia_3", "gcw_region_corellia_4",
|
||||
"gcw_region_corellia_5", "gcw_region_corellia_6", "gcw_region_corellia_7",
|
||||
"gcw_region_corellia_8", "gcw_region_corellia_9", "gcw_region_dantooine_1",
|
||||
"gcw_region_dantooine_10", "gcw_region_dantooine_11", "gcw_region_dantooine_12",
|
||||
"gcw_region_dantooine_13", "gcw_region_dantooine_14", "gcw_region_dantooine_15",
|
||||
"gcw_region_dantooine_16", "gcw_region_dantooine_17", "gcw_region_dantooine_2",
|
||||
"gcw_region_dantooine_3", "gcw_region_dantooine_4", "gcw_region_dantooine_5",
|
||||
"gcw_region_dantooine_6", "gcw_region_dantooine_7", "gcw_region_dantooine_8",
|
||||
"gcw_region_dantooine_9", "gcw_region_dathomir_1", "gcw_region_dathomir_10",
|
||||
"gcw_region_dathomir_11", "gcw_region_dathomir_12", "gcw_region_dathomir_13",
|
||||
"gcw_region_dathomir_2", "gcw_region_dathomir_3", "gcw_region_dathomir_4",
|
||||
"gcw_region_dathomir_5", "gcw_region_dathomir_6", "gcw_region_dathomir_7",
|
||||
"gcw_region_dathomir_8", "gcw_region_dathomir_9", "gcw_region_endor_1",
|
||||
"gcw_region_endor_10", "gcw_region_endor_11", "gcw_region_endor_12",
|
||||
"gcw_region_endor_13", "gcw_region_endor_14", "gcw_region_endor_15",
|
||||
"gcw_region_endor_16", "gcw_region_endor_2", "gcw_region_endor_3",
|
||||
"gcw_region_endor_4", "gcw_region_endor_5", "gcw_region_endor_6",
|
||||
"gcw_region_endor_7", "gcw_region_endor_8", "gcw_region_endor_9", "gcw_region_lok_1",
|
||||
"gcw_region_lok_10", "gcw_region_lok_11", "gcw_region_lok_12", "gcw_region_lok_13",
|
||||
"gcw_region_lok_14", "gcw_region_lok_2", "gcw_region_lok_3", "gcw_region_lok_4",
|
||||
"gcw_region_lok_5", "gcw_region_lok_6", "gcw_region_lok_7", "gcw_region_lok_8",
|
||||
"gcw_region_lok_9", "gcw_region_naboo_1", "gcw_region_naboo_10",
|
||||
"gcw_region_naboo_11", "gcw_region_naboo_12", "gcw_region_naboo_13",
|
||||
"gcw_region_naboo_14", "gcw_region_naboo_2", "gcw_region_naboo_3",
|
||||
"gcw_region_naboo_4", "gcw_region_naboo_5", "gcw_region_naboo_6", "gcw_region_naboo_7",
|
||||
"gcw_region_naboo_8", "gcw_region_naboo_9", "gcw_region_rori_1", "gcw_region_rori_10",
|
||||
"gcw_region_rori_11", "gcw_region_rori_12", "gcw_region_rori_13", "gcw_region_rori_2",
|
||||
"gcw_region_rori_3", "gcw_region_rori_4", "gcw_region_rori_5", "gcw_region_rori_6",
|
||||
"gcw_region_rori_7", "gcw_region_rori_8", "gcw_region_rori_9", "gcw_region_talus_1",
|
||||
"gcw_region_talus_10", "gcw_region_talus_11", "gcw_region_talus_12", "gcw_region_talus_13",
|
||||
"gcw_region_talus_14", "gcw_region_talus_15", "gcw_region_talus_16", "gcw_region_talus_2",
|
||||
"gcw_region_talus_3", "gcw_region_talus_4", "gcw_region_talus_5", "gcw_region_talus_6",
|
||||
"gcw_region_talus_7", "gcw_region_talus_8", "gcw_region_talus_9", "gcw_region_tatooine_1",
|
||||
"gcw_region_tatooine_10", "gcw_region_tatooine_11", "gcw_region_tatooine_12",
|
||||
"gcw_region_tatooine_13", "gcw_region_tatooine_2", "gcw_region_tatooine_3",
|
||||
"gcw_region_tatooine_4", "gcw_region_tatooine_5", "gcw_region_tatooine_6",
|
||||
"gcw_region_tatooine_7", "gcw_region_tatooine_8", "gcw_region_tatooine_9",
|
||||
"gcw_region_yavin4_1", "gcw_region_yavin4_10", "gcw_region_yavin4_11",
|
||||
"gcw_region_yavin4_12", "gcw_region_yavin4_13", "gcw_region_yavin4_14",
|
||||
"gcw_region_yavin4_15", "gcw_region_yavin4_16", "gcw_region_yavin4_17",
|
||||
"gcw_region_yavin4_18", "gcw_region_yavin4_2", "gcw_region_yavin4_3",
|
||||
"gcw_region_yavin4_4", "gcw_region_yavin4_5", "gcw_region_yavin4_6",
|
||||
"gcw_region_yavin4_7", "gcw_region_yavin4_8", "gcw_region_yavin4_9", "lok_airspace",
|
||||
"lok_pve", "lok_pvp", "naboo_airspace", "naboo_pve", "naboo_pvp", "rori_airspace",
|
||||
"rori_pve", "rori_pvp", "space_corellia_space_pve", "space_corellia_space_pvp",
|
||||
"space_dantooine_space_pve", "space_dantooine_space_pvp", "space_dathomir_space_pve",
|
||||
"space_dathomir_space_pvp", "space_endor_space_pve", "space_endor_space_pvp",
|
||||
"space_lok_space_pve", "space_lok_space_pvp", "space_naboo_space_pve",
|
||||
"space_naboo_space_pvp", "space_tatooine_space_pve", "space_tatooine_space_pvp",
|
||||
"space_yavin4_space_pve", "space_yavin4_space_pvp", "talus_airspace", "talus_pve",
|
||||
"talus_pvp", "tatooine_airspace", "tatooine_pve", "tatooine_pvp", "yavin4_airspace",
|
||||
"yavin4_pve", "yavin4_pvp", "yavin4_pvp_battlefield"
|
||||
};
|
||||
|
||||
List<String> zoneList = Arrays.asList(zones);
|
||||
|
||||
for (int i = 0; i < zoneList.size(); i++) {
|
||||
object.getCurrentServerGCWZonePercentList().add(new CurrentServerGCWZonePercent(zoneList.get(i)));
|
||||
object.getCurrentServerGCWZoneInfoList().add(new CurrentServerGCWZoneInfo(zoneList.get(i)));
|
||||
object.getOtherServerGCWZonePercentList().add(new OtherServerGCWZonePercent(zoneList.get(i)));
|
||||
object.setCurrentServerGCWZonePercentListUpdateCounter(object.getCurrentServerGCWZonePercentListUpdateCounter() + 1);
|
||||
object.setCurrentServerGCWZoneInfoListUpdateCounter(object.getCurrentServerGCWZoneInfoListUpdateCounter() + 1);
|
||||
object.setOtherServerGCWZonePercentListUpdateCounter(object.getOtherServerGCWZonePercentListUpdateCounter() + 1);
|
||||
}
|
||||
|
||||
// Load GCW Totals
|
||||
// TODO load from the stf file in future
|
||||
String[] totals =
|
||||
{
|
||||
"corellia", "dantooine", "dathomir", "endor", "galaxy",
|
||||
"lok", "naboo", "rori", "talus", "tatooine", "yavin4"
|
||||
};
|
||||
|
||||
List<String> totalList = Arrays.asList(totals);
|
||||
|
||||
for (int i = 0; i < totalList.size(); i++) {
|
||||
object.getCurrentServerGCWTotalPercentList().add(new CurrentServerGCWZonePercent(totalList.get(i)));
|
||||
object.getCurrentServerGCWTotalInfoList().add(new CurrentServerGCWZoneInfo(totalList.get(i)));
|
||||
object.getOtherServerGCWTotalPercentList().add(new OtherServerGCWZonePercent(totalList.get(i)));
|
||||
object.setCurrentServerGCWTotalPercentListUpdateCounter(object.getCurrentServerGCWTotalPercentListUpdateCounter() + 1);
|
||||
object.setCurrentServerGCWTotalInfoListUpdateCounter(object.getCurrentServerGCWTotalInfoListUpdateCounter() + 1);
|
||||
object.setOtherServerGCWTotalPercentListUpdateCounter(object.getOtherServerGCWTotalPercentListUpdateCounter() + 1);
|
||||
}
|
||||
|
||||
// Update the GCW Zones every minute as in live
|
||||
scheduler.scheduleAtFixedRate(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized(core.getActiveConnectionsMap()) {
|
||||
for (Client c : core.getActiveConnectionsMap().values()) {
|
||||
if (c.getParent() != null) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 1, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0, Map<Integer, INetworkRemoteEvent> arg1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package services.guild;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
import resources.common.Opcodes;
|
||||
import resources.objects.Guild;
|
||||
import resources.objects.guild.GuildObject;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
|
||||
public class GuildService implements INetworkDispatch {
|
||||
|
||||
private NGECore core;
|
||||
private GuildObject object;
|
||||
|
||||
public GuildService(NGECore core) {
|
||||
this.core = core;
|
||||
|
||||
object = (GuildObject) this.core.objectService.createObject("object/guild/shared_guild_object.iff", core.terrainService.getPlanetList().get(0));
|
||||
}
|
||||
|
||||
public Guild createGuild(String abbreviation, String name) {
|
||||
int id = ((object.getGuildList().get(object.getGuildList().size()).getId()) + 1);
|
||||
Guild guild = new Guild(id, abbreviation, name);
|
||||
|
||||
object.getGuildList().add(guild);
|
||||
|
||||
return guild;
|
||||
}
|
||||
|
||||
public void addGuild(Guild guild) {
|
||||
object.getGuildList().add(guild);
|
||||
}
|
||||
|
||||
public GuildObject getGuildObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
public List<Guild> getGuildList() {
|
||||
return object.getGuildList();
|
||||
}
|
||||
|
||||
public Guild getGuildById(int id) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getId() == id) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Guild getGuildByAbbreviation(String abbreviation) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getAbbreviation().equals(abbreviation)) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Guild getGuildByName(String name) {
|
||||
for (int i = 0; i < object.getGuildList().size(); i++) {
|
||||
if (object.getGuildList().get(i).getName().equals(name)) {
|
||||
return object.getGuildList().get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean removeGuild(int id) {
|
||||
Guild guild = getGuildById(id);
|
||||
|
||||
if (guild != null) {
|
||||
object.getGuildList().add(guild);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeGuild(String abbreviation) {
|
||||
Guild guild = getGuildByAbbreviation(abbreviation);
|
||||
|
||||
if (guild != null) {
|
||||
object.getGuildList().add(guild);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
|
||||
|
||||
swgOpcodes.put(Opcodes.CmdSceneReady, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
Client client = core.getClient((Integer) session.getAttribute("connectionId"));
|
||||
|
||||
object.sendCreate(client);
|
||||
object.sendBaselines(client);
|
||||
object.sendSceneEndBaselines(client);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -67,6 +67,7 @@ import main.NGECore;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.guild.GuildObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.staticobject.StaticObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -151,6 +152,10 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
object = new StaticObject(objectID, planet, position, orientation, Template);
|
||||
|
||||
} else if(Template.startsWith("object/guild")) {
|
||||
|
||||
object = new GuildObject(objectID, planet, position, orientation, Template);
|
||||
|
||||
} else {
|
||||
|
||||
return null;
|
||||
@@ -186,11 +191,11 @@ public class ObjectService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public SWGObject createObject(String Template, Planet planet) {
|
||||
return createObject(Template, 0, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 0));
|
||||
return createObject(Template, 0, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1));
|
||||
}
|
||||
|
||||
public SWGObject createObject(String Template, Planet planet, float x, float z, float y) {
|
||||
return createObject(Template, 0, planet, new Point3D(x, y, z), new Quaternion(0, 0, 0, 0));
|
||||
return createObject(Template, 0, planet, new Point3D(x, y, z), new Quaternion(0, 0, 0, 1));
|
||||
}
|
||||
|
||||
public void addObjectToScene(SWGObject object) {
|
||||
|
||||
Reference in New Issue
Block a user