From 1b6f522480bbf91204b58c38d09c0cd00b87dba4 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Mon, 4 Aug 2014 17:23:24 +0200 Subject: [PATCH] Added Sui functionality for GCW Objects --- scripts/buffs/gcw_fatigue.py | 16 +- scripts/commands/setgodmode.py | 19 ++- src/protocol/swg/ObjControllerMessage.java | 1 + src/protocol/swg/SUICreateTimerBar.java | 139 ++++++++++++++++++ .../QuestTaskTimerMessage.java | 65 ++++++++ .../objects/creature/CreatureObject.java | 6 +- .../objects/tangible/TangibleObject.java | 2 + src/services/BuffService.java | 8 +- src/services/gcw/FactionService.java | 15 ++ src/services/gcw/InvasionService.java | 83 ++++++----- src/services/gcw/InvasionService3.java | 2 +- src/services/sui/SUIService.java | 17 +++ 12 files changed, 321 insertions(+), 52 deletions(-) create mode 100644 src/protocol/swg/SUICreateTimerBar.java create mode 100644 src/protocol/swg/objectControllerObjects/QuestTaskTimerMessage.java diff --git a/scripts/buffs/gcw_fatigue.py b/scripts/buffs/gcw_fatigue.py index 61d5e796..2fc75c61 100644 --- a/scripts/buffs/gcw_fatigue.py +++ b/scripts/buffs/gcw_fatigue.py @@ -1,17 +1,25 @@ import sys +from java.lang import Short def setup(core, actor, buff): return def add(core, actor, buff): - actor.setGCWFatigue(actor.getGCWFatigue()+1) + + #fatigue = actor.getGCWFatigue() + 1 + #actor.setGCWFatigue(fatigue) return def remove(core, actor, buff): - if actor.getGCWFatigue()>0: - actor.setGCWFatigue(actor.getGCWFatigue()-1) - # clear defbuff + #if actor.getGCWFatigue()>0: + #fatigue = actor.getGCWFatigue() - 1 + #actor.setGCWFatigue(fatigue) + # Major flaw in Buff system. It does not consider infinite, stackable buffs + # The GCW buff gets automatically removed upon each new stack + # resulting in +1-1 Fatigue, if the fatigue gets set here. + # Only way is to set it, is in the java methods + # and then invent a way so that entertainer can heal this return \ No newline at end of file diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 9f69c2cb..9d93e5d7 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -237,11 +237,24 @@ def run(core, actor, target, commandString): player.setGcwPoints(player.getGcwPoints()+1000) elif command == 'suitest': - window = core.suiService.createSUIWindow('Script.countdownTimerBar', actor, None, 5) - #window.setProperty('bg.caption.lblTitle:Text', 'Titletext') + window = core.suiService.createSUIWindow('Script.CountdownTimerBar', actor, None, 5) + window.setProperty('modifySlot', 'modifySlot') + window.setProperty('comp.text:Text', '@gcw:pylon_construction_prompt') + window.setProperty('bg.caption.lblTitle:Text', 'quest_countdown_timer') + window.addDataItem('countdownTimerTimeValue', 'this') + core.suiService.openTimerSUIWindow(window, 18) + time.sleep(18) + core.suiService.closeSUIWindow(window.getOwner(),window.getWindowId()) + + elif command == 'suitest2': + window = core.suiService.createSUIWindow('Script.CountdownTimerBar', actor, None, 5) + # Packet43 #window.setProperty('text:Text', '10') #window.setProperty('bar.value:Page', '10') - window.addDataItem('bar.value', '10') + window.setProperty('comp.text:Text', '@gcw:pylon_construction_prompt') + window.setProperty('bg.caption.lblTitle:Text', 'quest_countdown_timer') + window.addDataItem('countdownTimerTimeValue', 'this') + #window.addDataItem('bar.value', '10') core.suiService.openSUIWindow(window) time.sleep(5) core.suiService.closeSUIWindow(window.getOwner(),window.getWindowId()) diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index ff025def..9fb333f9 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -78,6 +78,7 @@ public class ObjControllerMessage extends SWGMessage { public static final int RESOURCE_WEIGHTS = 0x0207; public static final int MISSION_ACCEPT_RESPONSE = 0x00FA; public static final int MISSION_ABORT_RESPONSE = 0x0142; + public static final int QUEST_TASK_TIMER_MESSAGE = 0x0441; public ObjControllerMessage() { diff --git a/src/protocol/swg/SUICreateTimerBar.java b/src/protocol/swg/SUICreateTimerBar.java new file mode 100644 index 00000000..6261c097 --- /dev/null +++ b/src/protocol/swg/SUICreateTimerBar.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * 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; + +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +import org.apache.mina.core.buffer.IoBuffer; + +import services.sui.SUIWindowComponent; + +public class SUICreateTimerBar extends SWGMessage{ + + private String script; + private int windowId; + private int startCount; + private int digitCount; + private List digits = new ArrayList(); + String prompt; + + public SUICreateTimerBar(String script, int windowId, String prompt, int startCount) { + + this.script = script; + this.windowId = windowId; + this.startCount = startCount; + this.prompt = prompt; + + digitCount = 3; + if (startCount>9) + digitCount = 4; + + while (startCount > 0) { + int d = startCount / 10; + int k = startCount - d * 10; + startCount = d; + digits.add((int)(Integer.toString(k).charAt(0))); + //System.out.println("digit: "+Integer.toHexString((int)(Integer.toString(k).charAt(0)))); + } +// digits.add(0x39); +// digits.add(0x31); + } + + public void deserialize(IoBuffer data) { + + } + + public IoBuffer serialize() { + + IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putShort((short) 2); + result.putInt(0xD44B7259); + + result.putInt(windowId); + result.put(getAsciiString(script)); + result.putInt(5); + result.putInt(5); + result.put((byte)0); + result.putInt(3); + result.putShort((short)0); + result.putShort((short)1); + result.put((byte)9); + + result.put(getAsciiString("modifySlot")); + result.putInt(5); + result.put((byte)0); + result.putInt(3); + result.putShort((short)0); + result.putShort((short)1); + result.put((byte)0xA); + result.put(getAsciiString("modifySlot")); + result.put((byte)3); + result.putInt(1); + + result.put(getUnicodeString(prompt)); + + result.putInt(2); + + result.put(getAsciiString("comp.text")); + result.put(getAsciiString("Text")); + + result.put((byte)3); + result.putInt(1); + + result.put(getUnicodeString("quest_countdown_timer")); + + result.putInt(2); + + result.put(getAsciiString("bg.caption.lblTitle")); + result.put(getAsciiString("Text")); + + + result.put((byte)3); + result.putInt(1); + result.putInt(digitCount); + + result.putShort((short)0x30); + result.putShort((short)0x2C); + for (int i=digits.size()-1;i>=0;i--) + result.putShort((short)((int)digits.get(i))); + + result.putInt(2); + result.put(getAsciiString("this")); + result.put(getAsciiString("countdownTimerTimeValue")); + + result.putLong(0); + result.putInt(0x7F7FFFFF); + result.putInt(0x7F7FFFFF); + result.putInt(0x7F7FFFFF); + result.putInt(0); + + int size = result.position(); + result = IoBuffer.allocate(size).put(result.array(), 0, size); + + return result.flip(); + } +} diff --git a/src/protocol/swg/objectControllerObjects/QuestTaskTimerMessage.java b/src/protocol/swg/objectControllerObjects/QuestTaskTimerMessage.java new file mode 100644 index 00000000..eaccc799 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/QuestTaskTimerMessage.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * 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; + +public class QuestTaskTimerMessage extends ObjControllerObject { + + private long objectId; + private String questName; + + public QuestTaskTimerMessage(long objectId, String questName) { + this.objectId = objectId; + this.questName = questName; + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + + IoBuffer buffer = IoBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putInt(ObjControllerMessage.QUEST_TASK_TIMER_MESSAGE); + buffer.putLong(objectId); + buffer.putInt(0); + buffer.put(getAsciiString("quest/ep3_trando_hssissk_zssik_10")); + buffer.putInt(1); + buffer.put(getUnicodeString("quest/groundquests:destroy_counter")); + buffer.putInt(0); + buffer.putInt(1); + + int size = buffer.position(); + buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); + + return buffer.flip(); + } + +} diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 61a92530..b64dbdda 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -187,7 +187,7 @@ public class CreatureObject extends TangibleObject implements Serializable { private transient CreatureObject calledPet; private byte locomotion = 0; - private short GCWFatigue = 0; + private int GCWFatigue = 0; private boolean isConstructing = false; public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { @@ -1888,11 +1888,11 @@ public class CreatureObject extends TangibleObject implements Serializable { this.calledPet = calledPet; } - public short getGCWFatigue() { + public int getGCWFatigue() { return GCWFatigue; } - public void setGCWFatigue(short gCWFatigue) { + public void setGCWFatigue(int gCWFatigue) { GCWFatigue = gCWFatigue; } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 583921c9..5cca5e91 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -244,6 +244,8 @@ public class TangibleObject extends SWGObject implements Serializable { public void setOptionsBitmask(int optionsBitmask) { notifyClients(getBaseline(3).set("optionsBitmask", optionsBitmask), true); + // This needs to be refactored to be sent to clients with different values depending on their faction + // A quest object for one faction, can't be quest object for opposing faction } public void setOptions(int options, boolean add) { diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 86ee2ddb..6c9c59f2 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -178,9 +178,11 @@ public class BuffService implements INetworkDispatch { if (buff.getDuration() != -1.0) if (otherBuff.getRemainingDuration() > buff.getDuration() && otherBuff.getStacks() >= otherBuff.getMaxStacks()) return null; - } - - removeBuffFromCreature(target, otherBuff); + } +// else { +// removeBuffFromCreature(target, otherBuff); // Seems more logical ToDo: Verify!!! +// } + removeBuffFromCreature(target, otherBuff); // Moved to else, otherwise buff will not stack break; } else { System.out.println("buff not added:" + buffName); diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index 0ac7621a..2ba2a347 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -587,6 +587,21 @@ public class FactionService implements INetworkDispatch { upvpm.setFaction(CRC.StringtoCRC(tano.getFaction())); upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((TangibleObject) destination.getParent(), tano)); destination.getSession().write(upvpm.serialize()); + + // Crashes client and more importantly should be done selectively with different destinations +// if (destination.getParent() instanceof CreatureObject){ +// //System.out.println("IN updatePVPFromNearbyNPCs!!!!!!!" + destination.getParent().getCustomName()); +// if (((CreatureObject) destination.getParent()).isPlayer() && ((CreatureObject) destination.getParent()).getFaction()!=tano.getFaction()){ +// int optionsBitMask = tano.getOptionsBitmask(); +// if (tano.getOption(Options.QUEST)) +// optionsBitMask = optionsBitMask & ~Options.QUEST; +// if (!tano.getOption(Options.ATTACKABLE)) +// optionsBitMask = optionsBitMask | Options.ATTACKABLE; +// +// tano.setOptionsBitmask(optionsBitMask); +// } +// } + } if (obj instanceof InstallationObject && !(obj instanceof TangibleObject)){ InstallationObject inso = (InstallationObject) obj; diff --git a/src/services/gcw/InvasionService.java b/src/services/gcw/InvasionService.java index a45de17c..24f7e211 100644 --- a/src/services/gcw/InvasionService.java +++ b/src/services/gcw/InvasionService.java @@ -32,9 +32,14 @@ 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.ObjControllerMessage; import protocol.swg.PlayClientEffectObjectTransformMessage; +import protocol.swg.objectControllerObjects.NpcConversationMessage; +import protocol.swg.objectControllerObjects.QuestTaskTimerMessage; import resources.common.OutOfBand; import resources.common.SpawnPoint; import resources.datatables.FactionStatus; @@ -239,26 +244,26 @@ public class InvasionService implements INetworkDispatch { send_Phase1_InvaderMessage1(); send_Phase1_DefenderMessage1(); ph1_message1sent = true; - System.out.println("Phase 1 msg1 sent "); + //System.out.println("Phase 1 msg1 sent "); } // Message at 15:00 -> 900000 seconds - if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 300000 && ! ph1_message2sent){ + if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 150000 && ! ph1_message2sent){ send_Phase1_InvaderMessage2(); send_Phase1_DefenderMessage2(); ph1_message2sent = true; - System.out.println("Phase 1 msg2 sent "); + //System.out.println("Phase 1 msg2 sent "); } // Message at 30:00 -> 1800000 seconds - if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 35000 && ! ph2_message1sent){ + if (invasionPhase==1 && System.currentTimeMillis()>temptimestartreference + 180000 && ! ph2_message1sent){ invasionPhase=2; preparePhase2(); System.out.println("PHASE 2"); send_Phase2_InvaderMessage1(); send_Phase2_DefenderMessage1(); ph2_message1sent = true; - System.out.println("Defender msg1 sent "); + //System.out.println("Defender msg1 sent "); } // Message at 45:00 -> 2700000 seconds @@ -274,7 +279,7 @@ public class InvasionService implements INetworkDispatch { defendingGeneral.updatePvpStatus(); makeDefensiveGeneralDefenderForNPCs(); - System.out.println("Defender msg2 sent "); // Local server gives only 30 mins time, so its 20 mins for this phase + //System.out.println("Defender msg2 sent "); // Local server gives only 30 mins time, so its ~15 mins for this phase } if (defendingGeneral!=null){ @@ -286,7 +291,7 @@ public class InvasionService implements INetworkDispatch { } - //defenders won 59:00 mins 3600000-60000 + //defenders won 59:00 mins 3600000-60000 = 3540000 if (invasionPhase==2 && System.currentTimeMillis()>temptimestartreference + 1500000 && ! ph2_message3sent){ sendDefenderWonMessage(); sendInvaderLostMessage(); @@ -360,7 +365,7 @@ public class InvasionService implements INetworkDispatch { sendDefenderLostMessage(); ph2_message4sent = true; invasionPhase=4; // Post-Invasion phase - System.out.println("Defender msg4 sent "); + //System.out.println("Defender msg4 sent "); // Take care of GCW points grantGCWPoints(invadingFaction,1000); @@ -526,7 +531,7 @@ public class InvasionService implements INetworkDispatch { if (creature.getAttachment("AI")!=null){ AIActor actor = (AIActor)creature.getAttachment("AI"); if (actor!=null){ - System.out.println("Preparing deletion " + creature.getObjectID()); + //System.out.println("Preparing deletion " + creature.getObjectID()); actor.prepareDeletion(); } } @@ -534,14 +539,14 @@ public class InvasionService implements INetworkDispatch { } Executors.newSingleThreadScheduledExecutor().schedule(() -> { - System.out.println("Started schedule to destroy " + invaderMap.entrySet().size()); + //System.out.println("Started schedule to destroy " + invaderMap.entrySet().size()); for (Map.Entry entry : invaderMap.entrySet()) { CreatureObject creature = entry.getValue(); if (creature!=null){ if (creature.getAttachment("AI")!=null){ AIActor actor = (AIActor)creature.getAttachment("AI"); core.simulationService.remove(creature, creature.getWorldPosition().x, creature.getWorldPosition().z, true); // Make sure - System.out.println("destroying Actor " + creature.getObjectID()); + //System.out.println("destroying Actor " + creature.getObjectID()); actor.destroyActor(); } } @@ -558,7 +563,7 @@ public class InvasionService implements INetworkDispatch { } } invaderMap.clear(); - System.out.println("Destroyed all invaders."); + //System.out.println("Destroyed all invaders."); }, 15, TimeUnit.SECONDS); // Make sure remaining AI is finished with moves that might make them re-appear } @@ -607,7 +612,7 @@ public class InvasionService implements INetworkDispatch { } } defenderMap.clear(); - System.out.println("Destroyed all defenders."); + //System.out.println("Destroyed all defenders."); }, 15, TimeUnit.SECONDS); // Make sure remaining AI is finished with moves that might make them re-appear } @@ -850,6 +855,7 @@ public class InvasionService implements INetworkDispatch { } public void usePylon(CreatureObject user, GCWPylon pylon){ + // check pylon filling status if (pylon.getAttachment("Filling")==null) return; @@ -940,18 +946,13 @@ public class InvasionService implements INetworkDispatch { PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/" + animName,pylon.getObjectID(),"lootMe",effectorPosition,effectorOrientation); //PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/" + animName, pylon.getObjectID(), ""); pylon.notifyObserversInRange(lmsg, false, 100); - + + int fatigue = user.getGCWFatigue(); + int constructiontimeagain = 10 + fatigue/10; SUIWindow window = core.suiService.createSUIWindow("Script.countdownTimerBar", user, null, 5); - window.setProperty("bg.caption.lblTitle:Text", "Titletext"); - window.setProperty("Prompt.lblPrompt:Text", "Prompttext"); // CodeData - window.setProperty("bar.value:Text", "Prompttext"); - //countdown time + core.suiService.openTimerSUIWindow(window, "@gcw:pylon_construction_prompt", constructiontimeagain); - core.suiService.openSUIWindow(window); - - short fatigue = user.getGCWFatigue(); - int constructiontimeagain = 10 + fatigue/10; int[] countdown = {constructiontimeagain}; final Point3D userpos = user.getWorldPosition(); user.setConstructing(true); @@ -962,8 +963,7 @@ public class InvasionService implements INetworkDispatch { @Override public void run() { try { - // Animate count-down timer-bar - user.sendSystemMessage(""+countdown[0], (byte)0); + //user.sendSystemMessage(""+countdown[0], (byte)0); countdown[0]--; // check if user has moved if (userpos.getDistance2D(user.getWorldPosition())>0.2){ @@ -1005,10 +1005,10 @@ public class InvasionService implements INetworkDispatch { TangibleObject tool = tools.get(0); updatePylonFilling(pylon, tool); user.setConstructing(false); - core.suiService.closeSUIWindow(window.getOwner(),window.getWindowId()); - // increase fatigue + core.suiService.closeSUIWindow(window.getOwner(),window.getWindowId()); core.buffService.addBuffToCreature(user, "gcw_fatigue", user); - System.out.println(" user.getGCWFatigue() "+user.getGCWFatigue()); + // increase fatigue + user.setGCWFatigue(user.getGCWFatigue()+1); } } catch (Exception e) { e.printStackTrace(); @@ -1024,7 +1024,7 @@ public class InvasionService implements INetworkDispatch { int pylonFilling = (int)pylon.getAttachment("Filling"); String pylonName = (String)pylon.getAttachment("Name"); // determine power of tool - int power = 20; // assume 20 for now + int power = 15; // assume 15 for now pylonFilling += power; if (pylonFilling>100) @@ -1060,6 +1060,10 @@ public class InvasionService implements INetworkDispatch { } else { // ToDo: IMPLEMENT BARRICADE QUEST CALL HERE user.sendSystemMessage("Barricade Quest not yet implemented!", (byte)0); + +// QuestTaskTimerMessage convoMessage = new QuestTaskTimerMessage(user.getObjectID(), "this"); +// ObjControllerMessage objController = new ObjControllerMessage(0x0B, convoMessage); +// user.getClient().getSession().write(objController.serialize()); } } @@ -1106,7 +1110,7 @@ public class InvasionService implements INetworkDispatch { } public void repairStructure(CreatureObject user, TangibleObject tool, TangibleObject structure){ - System.out.println("REPAIR STRUCT"); + int structureCondition = structure.getConditionDamage(); if (structureCondition>=structure.getMaximumCondition()){ return; @@ -1120,12 +1124,7 @@ public class InvasionService implements INetworkDispatch { SUIWindow window = core.suiService.createSUIWindow("Script.countdownTimerBar", user, null, 5); - window.setProperty("bg.caption.lblTitle:Text", "Titletext"); - window.setProperty("Prompt.lblPrompt:Text", "Prompttext"); // CodeData - window.setProperty("bar.value:Text", "Prompttext"); - //countdown time - // @gcw:reparing_gcw_object - core.suiService.openSUIWindow(window); + core.suiService.openTimerSUIWindow(window, "@gcw:reparing_gcw_object", 10); // also influenced by fatigue? user.setConstructing(true); int repairtimeagain = 10; @@ -1138,8 +1137,6 @@ public class InvasionService implements INetworkDispatch { @Override public void run() { try { - // Animate count-down timer-bar - user.sendSystemMessage(""+countdown[0], (byte)0); countdown[0]--; // check if user has moved if (userpos.getDistance2D(user.getWorldPosition())>0.2){ @@ -1610,6 +1607,16 @@ public class InvasionService implements INetworkDispatch { defendingGeneral = (CreatureObject) NGECore.getInstance().staticService.spawnObject(generalTemplate, "talus", 0L, 480.071F, 6, -3006.851F, 1, 0); } + if (defendingGeneral==null){ + try { + throw new Exception(); + } catch (Exception e) { + System.err.println("spawnDefendingGeneral()->General is null"); + e.printStackTrace(); + } + } + + defendingGeneralTask = scheduler.scheduleAtFixedRate(new Runnable() { @Override @@ -1657,7 +1664,7 @@ public class InvasionService implements INetworkDispatch { } public void spawnDefensiveQuestOfficer(){ - System.out.println("spawnDefensiveQuestOfficer"); + String questOfficerTemplate = ""; if (invadingFaction==Factions.Imperial){ questOfficerTemplate = "rebel_defensive_quest_officer"; diff --git a/src/services/gcw/InvasionService3.java b/src/services/gcw/InvasionService3.java index d8b0f48e..520d4fa8 100644 --- a/src/services/gcw/InvasionService3.java +++ b/src/services/gcw/InvasionService3.java @@ -498,7 +498,7 @@ public class InvasionService3 implements INetworkDispatch { core.suiService.openSUIWindow(window); - short fatigue = user.getGCWFatigue(); + int fatigue = user.getGCWFatigue(); int constructiontimeagain = 10 + fatigue/10; int[] countdown = {constructiontimeagain}; final Point3D userpos = user.getWorldPosition(); diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index 6b7a6fce..0165c5d1 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -37,6 +37,7 @@ import org.python.core.PyObject; import protocol.swg.ObjControllerMessage; import protocol.swg.ObjectMenuSelectMessage; import protocol.swg.SUICreatePageMessage; +import protocol.swg.SUICreateTimerBar; import protocol.swg.SUIEventNotification; import protocol.swg.SUIForceClosePageMessage; import protocol.swg.SUIUpdatePageMessage; @@ -490,10 +491,26 @@ public class SUIService implements INetworkDispatch { } SUICreatePageMessage create = new SUICreatePageMessage(window.getScript(), window.getWindowId(), window.getComponents(), rangeObjectId, range); + tools.CharonPacketUtils.printAnalysis(create.serialize(), "SUICreatePageMessage"); owner.getClient().getSession().write(create.serialize()); } + public void openTimerSUIWindow(SUIWindow window, String prompt, int startCount) { + + SWGObject owner = window.getOwner(); + + if(owner == null) + return; + + if(owner.getClient() == null || owner.getClient().getSession() == null) + return; + + SUICreateTimerBar create = new SUICreateTimerBar(window.getScript(), window.getWindowId(), prompt, startCount); + tools.CharonPacketUtils.printAnalysis(create.serialize(), "SUICreateTimerBar"); + owner.getClient().getSession().write(create.serialize()); + } + public void updateSUIWindow(SUIWindow window) { SWGObject owner = window.getOwner();