From c2342c0d7be407f65157a6e0e2c47179436d15bf Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sat, 2 Aug 2014 23:25:23 +0200 Subject: [PATCH] Added GCW tokens and rank progression - GCW tokens are now granted for invasions - GCW points correctly translate to GCW rank progression - Temp fixed GCW next update timer - Ensured thread termination of spawners - Prepared InvasionService in terms of timing for TestServer-deployment --- scripts/commands/pvp.py | 3 + scripts/commands/setgodmode.py | 19 +- .../ObjController_0250.java | 56 ++++++ src/services/LoginService.java | 2 + src/services/PlayerService.java | 46 +++++ src/services/gcw/GCWService.java | 18 +- src/services/gcw/GCWSpawner.java | 30 ++- src/services/gcw/InvasionService.java | 173 +++++++++++++----- 8 files changed, 293 insertions(+), 54 deletions(-) create mode 100644 src/protocol/swg/objectControllerObjects/ObjController_0250.java diff --git a/scripts/commands/pvp.py b/scripts/commands/pvp.py index 446f4f3c..cc30e82b 100644 --- a/scripts/commands/pvp.py +++ b/scripts/commands/pvp.py @@ -50,6 +50,9 @@ def run(core, actor, target, commandString): if faction == '': actor.setFactionStatus(FactionStatus.Combatant) # Must be! otherwise updatePVPstatus will be called with onLeave! actor.setFaction(commandString) + player = actor.getSlottedObject("ghost") + if player.getCurrentRank()==0: + player.setCurrentRank(1); faction = commandString if faction == 'neutral' or faction == '': diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index aebfd5c5..9f69c2cb 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -218,7 +218,24 @@ def run(core, actor, target, commandString): latargetID = long(actor.getIntendedTarget()) latarget = core.objectService.getObject(latargetID) actor.sendSystemMessage('Optionsbitmask for unit ' + latarget.getCustomName() + ' is %s' % latarget.getOptionsBitmask(), 0) - + + elif command == 'nextupd': + latargetID = long(actor.getIntendedTarget()) + latarget = core.objectService.getObject(latargetID) + player = actor.getSlottedObject("ghost") + #player.setNextUpdateTime(1324005720) #84000 60*60*24 86400 + # 1324005720 is 2:06 AM to set to zero! + + player.setNextUpdateTime(452783) #84000 60*60*24 86400 83980800 140400 21*60=1260 83840400 6*60+55 + + elif command == 'epoch': + core.gcwService.sendServerNowEpochTime(actor) + + elif command == 'pushGCW': + player = actor.getSlottedObject("ghost") + player.setCurrentRank(1); + player.setGcwPoints(player.getGcwPoints()+1000) + elif command == 'suitest': window = core.suiService.createSUIWindow('Script.countdownTimerBar', actor, None, 5) #window.setProperty('bg.caption.lblTitle:Text', 'Titletext') diff --git a/src/protocol/swg/objectControllerObjects/ObjController_0250.java b/src/protocol/swg/objectControllerObjects/ObjController_0250.java new file mode 100644 index 00000000..35a7a1e1 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/ObjController_0250.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * 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 . + * + * 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 protocol.swg.objectControllerObjects; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.ObjControllerMessage; +import resources.datatables.HitType; + +@SuppressWarnings("unused") +public class ObjController_0250 extends ObjControllerObject{ + + private long creatureId; + + public ObjController_0250(long creatureId) { + this.creatureId = creatureId; + } + + public void deserialize(IoBuffer data) { + + } + + public IoBuffer serialize() { + + IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + result.putInt((int)(System.currentTimeMillis()/1000)); + int packetSize = result.position(); + result = IoBuffer.allocate(packetSize).put(result.array(), 0, packetSize); + + return result.flip(); + + } + +} diff --git a/src/services/LoginService.java b/src/services/LoginService.java index eb843410..5bfde8b0 100644 --- a/src/services/LoginService.java +++ b/src/services/LoginService.java @@ -151,6 +151,8 @@ public class LoginService implements INetworkDispatch{ CharacterCreationDisabled charCreationDisabled = new CharacterCreationDisabled(0); StationIdHasJediSlot jediSlot = new StationIdHasJediSlot(false); ServerNowEpochTime time = new ServerNowEpochTime((int) (System.currentTimeMillis() / 1000)); + //System.out.println("ServerNowEpochTime " + (int) (System.currentTimeMillis() / 1000)); + //tools.CharonPacketUtils.printAnalysis(time.serialize(), "ServerNowEpochTime"); if (client.getSession().containsAttribute("tradeSession") == true) { System.out.println("Has attribute: " + session.getAttribute("tradeSession").toString()); diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 0b0242f5..91357c06 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -37,9 +37,11 @@ import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import java.util.concurrent.atomic.AtomicBoolean; + import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; + import protocol.swg.CharacterSheetResponseMessage; import protocol.swg.ClientIdMsg; import protocol.swg.ClientMfdStatusUpdateMessage; @@ -68,6 +70,8 @@ import resources.common.ProsePackage; import resources.common.SpawnPoint; import resources.datatables.DisplayType; import resources.datatables.FactionStatus; +import resources.datatables.Factions; +import resources.datatables.GcwRank; import resources.datatables.Options; import resources.datatables.PlayerFlags; import resources.datatables.Professions; @@ -137,6 +141,48 @@ public class PlayerService implements INetworkDispatch { player.setTotalPlayTime((int) (player.getTotalPlayTime() + ((System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000))); player.setLastPlayTimeUpdate(System.currentTimeMillis()); core.collectionService.checkExplorationRegions(creature); + + // GCW rank progress + if (creature.getFaction().equals("rebel") || creature.getFaction().equals("imperial")){ + int oldrank = player.getCurrentRank(); + //int oldprogress = (int) ((player.getRankProgress() > 100) ? 100 : player.getRankProgress()); + int oldprogress = 0; + int oldpoints = player.getGcwPoints(); + int newrank = oldrank; + int newprogress = oldprogress; + int oldranktotal = 0; + int oldrankprogress = 0; + int newranktotal = 0; + int newrankprogress = 0; + + oldrankprogress = oldprogress * 50; + oldranktotal = 5000 * (oldrank - 1) + oldrankprogress; + + newprogress = (int) core.gcwService.helper(oldpoints, oldrank); + + if (newprogress < -2000) { + newprogress = -2000; + } + + newranktotal = oldranktotal + newprogress; + + if (oldrank == GcwRank.LIEUTENANT && newprogress < 0 && newranktotal < 30000) { + newranktotal = 29999; + } + + newrank = oldrank; + + if (newrank > GcwRank.GENERAL) { + newrank = GcwRank.GENERAL; + newranktotal = 12 * 5000 - 1; + } + + newrankprogress = newranktotal - (newrank - 1) * 5000; + newprogress = newrankprogress * 100 / 5000; + + player.setRankProgress((float) Math.floor(newprogress)); + } + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/services/gcw/GCWService.java b/src/services/gcw/GCWService.java index 6a47d4cd..b82b9ac9 100644 --- a/src/services/gcw/GCWService.java +++ b/src/services/gcw/GCWService.java @@ -46,6 +46,7 @@ import org.python.google.common.collect.Multimap; import protocol.swg.GcwGroupsRsp; import protocol.swg.GcwRegionsReq; import protocol.swg.GcwRegionsRsp; +import protocol.swg.ServerNowEpochTime; import resources.common.Opcodes; import resources.common.OutOfBand; import resources.common.collidables.CollidableCircle; @@ -492,7 +493,7 @@ public class GCWService implements INetworkDispatch { /* Ported from javascript. * Written for us by Hendrik of http://swg.activeframe.de. */ - private double helper(int points, int rank) { + public double helper(int points, int rank) { int faktor = points / (MOD2[rank-1] - 250 * rank); int rt = points / (1 + faktor) - DECAY1[rank-1]; @@ -636,9 +637,22 @@ public class GCWService implements INetworkDispatch { c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); - return (int) ((c.getTimeInMillis() - now.getTime()) / 1000L); + // Theory:Due to the client refusing the ServerNowEpochTime packet, the client assumes an epoch time of 0 for GCW! + // An alternative theory would be that the GCWTime is independent from the ServerNowEpochTime + // 2nd theory more likely, because manually sending ServerNowEpochTime (confirmed by sniff) does nothing to the GCW time + // Conclusion: GCW epoch time is set independently somehow + + // The return value must be relative to epoch of 0, the client assumes 25.12.2011 current time/date + //return (int) ((c.getTimeInMillis() - now.getTime()) / 1000L); + return (int) (1324047960 + ((c.getTimeInMillis() - now.getTime()) / 1000L)); } + public void sendServerNowEpochTime(CreatureObject player){ + + ServerNowEpochTime time = new ServerNowEpochTime((int) (System.currentTimeMillis() / 1000)); + player.getClient().getSession().write(time.serialize()); + } + public void updateNextUpdateTime() { ODBCursor cursor = core.getSWGObjectODB().getCursor(); diff --git a/src/services/gcw/GCWSpawner.java b/src/services/gcw/GCWSpawner.java index 6e46394d..e692c1aa 100644 --- a/src/services/gcw/GCWSpawner.java +++ b/src/services/gcw/GCWSpawner.java @@ -24,8 +24,10 @@ package services.gcw; import java.util.Random; import java.util.Vector; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; + import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @@ -107,9 +109,14 @@ public class GCWSpawner extends TangibleObject{ public void setSpawnerType(int spawnerType) { this.spawnerType = spawnerType; if (spawnerType==SpawnerType.SoldierPatrol){ - scheduler.scheduleAtFixedRate(new Runnable() { + final Future[] fut1 = {null}; + fut1[0] = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { + if (NGECore.getInstance().invasionService.getInvasionPhase()>2){ + Thread.yield(); + fut1[0].cancel(false); + } spawnSoldier(); } catch (Exception e) { System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage()); @@ -119,9 +126,14 @@ public class GCWSpawner extends TangibleObject{ } if (spawnerType==SpawnerType.SoldierDefense){ - scheduler.scheduleAtFixedRate(new Runnable() { + final Future[] fut2 = {null}; + fut2[0] = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { + if (NGECore.getInstance().invasionService.getInvasionPhase()>2){ + Thread.yield(); + fut2[0].cancel(false); + } spawnSoldierDefender(); } catch (Exception e) { System.err.println("Exception in SoldierDefensePylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage()); @@ -131,9 +143,14 @@ public class GCWSpawner extends TangibleObject{ } if (spawnerType==SpawnerType.VehiclePatrol){ - scheduler.scheduleAtFixedRate(new Runnable() { + final Future[] fut3 = {null}; + fut3[0] = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { + if (NGECore.getInstance().invasionService.getInvasionPhase()>2){ + Thread.yield(); + fut3[0].cancel(false); + } spawnVehicle(); } catch (Exception e) { System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnVehicle() " + e.getMessage()); @@ -143,9 +160,14 @@ public class GCWSpawner extends TangibleObject{ } if (spawnerType==SpawnerType.SiegeVehiclePatrol){ - scheduler.scheduleAtFixedRate(new Runnable() { + final Future[] fut4 = {null}; + fut4[0] = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { + if (NGECore.getInstance().invasionService.getInvasionPhase()>2){ + Thread.yield(); + fut4[0].cancel(false); + } spawnSiegeVehicle(); } catch (Exception e) { System.err.println("Exception in SoldierPatrolPylon->scheduleAtFixedRate->spawnSoldier() " + e.getMessage()); diff --git a/src/services/gcw/InvasionService.java b/src/services/gcw/InvasionService.java index ae6f0e57..a45de17c 100644 --- a/src/services/gcw/InvasionService.java +++ b/src/services/gcw/InvasionService.java @@ -21,8 +21,6 @@ ******************************************************************************/ package services.gcw; -import java.util.Calendar; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,9 +32,7 @@ import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; - import org.apache.mina.core.session.IoSession; - import protocol.swg.CommPlayerMessage; import protocol.swg.PlayClientEffectObjectTransformMessage; import resources.common.OutOfBand; @@ -141,6 +137,7 @@ public class InvasionService implements INetworkDispatch { invasionScheduled=true; scheduleInvasionEventManager(); }, 60, TimeUnit.SECONDS); + // Local code to schedule a 20 minutes long phase2 invasion // Server code to schedule invasions hourly @@ -149,7 +146,8 @@ public class InvasionService implements INetworkDispatch { while (!invasionScheduled) { Calendar now = Calendar.getInstance(); // wait for the next full hour - if (now.get(Calendar.MINUTE)==0 && ! invasionScheduled){ + if (now.get(Calendar.MINUTE)==0 && ! invasionScheduled){ + temptimestartreference = System.currentTimeMillis(); scheduleInvasionManager(); scheduleInvasionEventManager(); invasionScheduled=true; @@ -236,13 +234,15 @@ public class InvasionService implements INetworkDispatch { public void invasionEventManager(){ - if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 60000 && ! ph1_message1sent){ + // First message at 0:00 + if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 10 && ! ph1_message1sent){ send_Phase1_InvaderMessage1(); send_Phase1_DefenderMessage1(); ph1_message1sent = true; System.out.println("Phase 1 msg1 sent "); } + // Message at 15:00 -> 900000 seconds if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 300000 && ! ph1_message2sent){ send_Phase1_InvaderMessage2(); send_Phase1_DefenderMessage2(); @@ -250,7 +250,7 @@ public class InvasionService implements INetworkDispatch { System.out.println("Phase 1 msg2 sent "); } - //if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 600000 && ! ph2_message1sent){ + // Message at 30:00 -> 1800000 seconds if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 35000 && ! ph2_message1sent){ invasionPhase=2; preparePhase2(); @@ -261,6 +261,7 @@ public class InvasionService implements INetworkDispatch { System.out.println("Defender msg1 sent "); } + // Message at 45:00 -> 2700000 seconds if (invasionPhase==2 && System.currentTimeMillis()>temptimestartreference + 900000 && ! ph2_message2sent){ // 1200000 send_Phase2_InvaderMessage2(); send_Phase2_DefenderMessage2(); @@ -276,7 +277,6 @@ public class InvasionService implements INetworkDispatch { System.out.println("Defender msg2 sent "); // Local server gives only 30 mins time, so its 20 mins for this phase } - if (defendingGeneral!=null){ if (invasionPhase==3 && defendingGeneral.getHealth()temptimestartreference + 1500000 && ! ph2_message3sent){ + sendDefenderWonMessage(); + sendInvaderLostMessage(); + ph2_message3sent = true; + invasionPhase=4; + + // Take care of GCW points + grantGCWPoints(invadingFaction,100); + grantGCWPoints(defendingFaction,1000); + + grantGCWTokens(invadingFaction,10); + grantGCWTokens(defendingFaction,130); + + // set up delayed tasks + //Clone Maps + Map invadingCreaturesClone = new ConcurrentHashMap(); + Map defendingCreaturesClone = new ConcurrentHashMap(); + for (Map.Entry entry : invadingCreatures.entrySet()) { + invadingCreaturesClone.put(entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : defendingCreatures.entrySet()) { + defendingCreaturesClone.put(entry.getKey(), entry.getValue()); + } + + Executors.newSingleThreadScheduledExecutor().schedule(() -> { + wipeInvaders(invadingCreaturesClone); + wipeDefenders(defendingCreaturesClone); // Make sure all are deleted + }, 360, TimeUnit.SECONDS); + + + withdrawInvaders(); + for (BuildingObject camp : offensiveCamps){ + core.simulationService.remove(camp, camp.getWorldPosition().x, camp.getWorldPosition().z, true); + core.objectService.destroyObject(camp.getObjectID()); + } + + for (CreatureObject officer : offensiveQuestOfficers){ + core.simulationService.remove(officer, officer.getWorldPosition().x, officer.getWorldPosition().z, true); + core.objectService.destroyObject(officer.getObjectID()); + } + for (TangibleObject banner : defensiveBanners){ + core.objectService.destroyObject(banner.getObjectID()); + } + + if (defensiveTable!=null) + core.objectService.destroyObject(defensiveTable.getObjectID()); + if (defendingGeneral!=null) + core.objectService.destroyObject(defendingGeneral.getObjectID()); + if (defendingQuestOfficer!=null) + core.objectService.destroyObject(defendingQuestOfficer.getObjectID()); + if (invasionGeneral!=null) + core.objectService.destroyObject(invasionGeneral.getObjectID()); + + deletePhase2Objects(); + generalWarningLevelMap.clear(); + offensiveSupplyTerminals = new Vector(); + invaderRegistryCounter = 0; + defenderRegistryCounter = 0; + defensiveBanners.clear(); + defensiveSupplyTerminals.clear(); + defensiveTable = null; + defendingGeneralTask.cancel(true); + defendingGeneralTask = null; + + invasionScheduled = false; // free Service + } + + // General defeated if (invasionPhase==3 && (defendingGeneral.getPosture()==13 || defendingGeneral.getPosture()==14) && ! ph2_message4sent){ sendInvaderWonMessage(); sendDefenderLostMessage(); @@ -295,7 +365,9 @@ public class InvasionService implements INetworkDispatch { // Take care of GCW points grantGCWPoints(invadingFaction,1000); grantGCWPoints(defendingFaction,100); - // ToDo: tokens + + grantGCWTokens(invadingFaction,130); + grantGCWTokens(defendingFaction,10); // Clean Up // wipeInvaders(); @@ -355,25 +427,13 @@ public class InvasionService implements INetworkDispatch { invasionScheduled = false; // free Service } + // General at half health if (invasionPhase==3 && defendingGeneral.getHealth()<0.5*defendingGeneral.getMaxHealth() &&(defendingGeneral.getPosture()!=13 || defendingGeneral.getPosture()!=14) && ! ph2_message5sent){ //sendInvaderGeneralHalfMessage(); sendDefenderGeneralHalfMessage(); ph2_message5sent = true; } - } else { - //defenders won 30 mins 1800000 - if (invasionPhase==2 && System.currentTimeMillis()>temptimestartreference + 1200000 && ! ph2_message3sent){ - sendDefenderWonMessage(); - sendInvaderLostMessage(); - ph2_message3sent = true; - invasionPhase=3; - - invasionScheduled = false; // free Service - System.out.println("Defender msg2 sent "); // Local server gives only 30 mins time, so its 20 mins for this phase - } - } - - + } } public void withdrawInvaders(){ @@ -403,6 +463,36 @@ public class InvasionService implements INetworkDispatch { } } + public void grantGCWTokens(int faction, int tokenamount){ + String factionName = getFactionName(faction); + Vector allPlayers = core.simulationService.getAllNearSameFactionPlayers(500,invasionLocationCenter, getInvasionPlanet(invasionLocation), factionName); + for (CreatureObject player : allPlayers) { + if (player.getFaction().length() > 0 && player.getFactionStatus() > FactionStatus.OnLeave) { + + String tokenTemplate = "object/tangible/gcw/shared_gcw_rebel_token.iff"; + String name = "item_gcw_rebel_token"; + String description = "item_gcw_rebel_token"; + if (player.getFaction().equals(Factions.Imperial)){ + tokenTemplate = "object/tangible/gcw/shared_gcw_imperial_token.iff"; + name = "item_gcw_imperial_token"; + description = "item_gcw_imperial_token"; + } + TangibleObject token = (TangibleObject) core.objectService.createObject(tokenTemplate, player.getPlanet()); + + token.setStfFilename("static_item_n"); + token.setStfName(name); + token.setDetailFilename("static_item_d"); + token.setDetailName(description); + + token.setUses(tokenamount); + + player.sendSystemMessage("@static_item_n:"+name+" \\#32CD32 x" + tokenamount +" have been placed in your inventory \\#FFFFFF", (byte)0); + core.playerService.giveItem(player, token); + } + } + + } + public void registerInvader(CreatureObject registrant){ // System.out.println("Registered! " + invaderRegistryCounter); invadingCreatures.put(invaderRegistryCounter++, registrant); @@ -628,8 +718,8 @@ public class InvasionService implements INetworkDispatch { } public void supplyTerminalSUI(CreatureObject user, int childMenu){ -// if (invasionPhase!=1) -// return; // prevent exploit + if (invasionPhase!=1) + return; // prevent exploit String terminalName = "@gcw:terminal_gcw_reb_def_n"; if (defendingFaction==Factions.Imperial) terminalName = "@gcw:terminal_gcw_imp_def_n"; @@ -647,8 +737,8 @@ public class InvasionService implements INetworkDispatch { { public void process(SWGObject owner, int eventType, Vector returnList) { -// if (invasionPhase!=1) -// return; // prevent exploit + if (invasionPhase!=1) + return; // prevent exploit int index = Integer.parseInt(returnList.get(0)); int childIndex = (int) window.getObjectIdByIndex(index); @@ -706,8 +796,8 @@ public class InvasionService implements INetworkDispatch { } public void supplyOffensiveTerminalSUI(CreatureObject user, int childMenu){ -// if (invasionPhase!=1) -// return; // prevent exploit + if (invasionPhase!=1) + return; // prevent exploit String terminalName = "@gcw:terminal_gcw_reb_offensiv_n"; if (defendingFaction==Factions.Imperial) terminalName = "@gcw:terminal_gcw_imp_offensiv_n"; @@ -722,8 +812,8 @@ public class InvasionService implements INetworkDispatch { { public void process(SWGObject owner, int eventType, Vector returnList) { -// if (invasionPhase!=1) -// return; // prevent exploit + if (invasionPhase!=1) + return; // prevent exploit int index = Integer.parseInt(returnList.get(0)); int childIndex = (int) window.getObjectIdByIndex(index); @@ -793,7 +883,6 @@ public class InvasionService implements INetworkDispatch { // determine pylon type int pylonType = pylon.getPylonType(); - String pylonName = (String)pylon.getAttachment("Name"); String toolTemplate = ""; switch (pylonType){ case PylonType.Barricade: toolTemplate="object/tangible/gcw/crafting_quest/shared_gcw_barricade_tool.iff"; @@ -1888,9 +1977,9 @@ public class InvasionService implements INetworkDispatch { public void sendDefenderWonMessage(){ String message = ""; - if (getInvasionLocationName().equals("talus_dearic")){ + if (getInvasionLocationName().equals("talus_dearic")){ if (defendingFaction==Factions.Imperial) - message = "@gcw:gcw_announcement_won_attack_imperial_" + getInvasionLocationName(); + message = "@gcw:gcw_announcement_won_attack_imeprial_" + getInvasionLocationName(); if (defendingFaction==Factions.Rebel) message = "@gcw:gcw_announcement_won_attack_rebel_" + getInvasionLocationName(); } else { @@ -1919,10 +2008,7 @@ public class InvasionService implements INetworkDispatch { message = "@gcw:gcw_announcement_city_end_safe_rebel_" + getInvasionLocationName(); sendMessageToClients(invadingFaction, message); } - - - - + public void sendDefenderLostMessage(){ String message = ""; if (defendingFaction==Factions.Imperial) @@ -1969,15 +2055,10 @@ public class InvasionService implements INetworkDispatch { } public void sendMessageToClients(int tofaction, String message){ -// String modelTemplate = defendingGeneral.getTemplate(); -// if (tofaction==Factions.Imperial) -// modelTemplate = invasionGeneral.getTemplate(); String modelTemplate = defendingGeneral.getTemplate(); if (invadingFaction==tofaction) modelTemplate = invasionGeneral.getTemplate(); - -// if (tofaction==Factions.Imperial) -// modelTemplate = invasionGeneral.getTemplate(); + ConcurrentHashMap clients = NGECore.getInstance().getActiveConnectionsMap(); for (Map.Entry entry : clients.entrySet()) { Client client = entry.getValue(); @@ -2210,9 +2291,7 @@ public class InvasionService implements INetworkDispatch { } @Override public void insertOpcodes(Map arg0, - Map arg1) { - // TODO Auto-generated method stub - + Map arg1) { } public class InvasionLocation {