Merge pull request #229 from ProjectSWGCore/Wave_Entertainer

Merge Wave_Entertainer
This commit is contained in:
Waverunner
2014-03-23 16:06:38 -04:00
35 changed files with 552 additions and 105 deletions
+5 -3
View File
@@ -11,8 +11,10 @@ def add(core, actor, buff):
if buffWorkshop is None:
return
buff.setDuration(3600) #1 hour
attached = actor.getAttachment('inspireDuration')
buff.setDuration(float(actor.getAttachment('inspireDuration') * 60))
for BuffItem in buffWorkshop:
core.skillModService.addSkillMod(actor, BuffItem.getSkillName(), BuffItem.getAffectAmount())
@@ -22,5 +24,5 @@ def remove(core, actor, buff):
for BuffItem in actor.getAttachment('buffWorkshop'):
core.skillModService.deductSkillMod(actor, BuffItem.getSkillName(), BuffItem.getAffectAmount())
actor.setAttachment('buffWorkshop', 'none')
actor.setAttachment('buffWorkshop', None)
return
+12
View File
@@ -0,0 +1,12 @@
from java.lang import System
import sys
def modify(core, actor, count):
return
def complete(core, actor, collection):
ghost = actor.getSlottedObject('ghost')
actor.sendSystemMessage('@collection_n:col_entertainer_01_finished', 0)
ghost.addAbility('bm_dancing_pet_entertainer')
return
+13 -5
View File
@@ -6,13 +6,21 @@ def setup():
def run(core, actor, target, commandString):
command = 'ColorLights1'
effect = 'entertainer_color_lights_level_1.cef'
effect = 'clienteffect/entertainer_color_lights_level_1.cef'
rLevel = 4 # minimum level to perform this effect
if actor.getLevel() < 4:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
return
if commandString == '2':
command = 'ColorLights2'
effect = 'clienteffect/entertainer_color_lights_level_2.cef'
rLevel = 20
# TODO: Find out levels for other colored light 2 and 3
elif commandString == '3':
command = 'ColorLights3'
effect = 'clienteffect/entertainer_color_lights_level_3.cef'
rLevel = 50
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_color_lights', 0)
+13 -5
View File
@@ -6,13 +6,21 @@ def setup():
def run(core, actor, target, commandString):
command = 'Dazzle1'
effect = 'entertainer_dazzle_level_1.cef'
effect = 'clienteffect/entertainer_dazzle_level_1.cef'
rLevel = 10 # minimum level to perform this effect
if actor.getLevel() < 10:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
return
if commandString == '2':
command = 'Dazzle2'
effect = 'clienteffect/entertainer_dazzle_level_2.cef'
rLevel = 20
# TODO: Find out levels for other dazzle 2 and 3
elif commandString == '3':
command = 'Dazzle3'
effect = 'clienteffect/entertainer_dazzle_level_3.cef'
rLevel = 30
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_dazzle', 0)
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'Distract1'
effect = 'entertainer_distract_level_1.cef'
effect = 'clienteffect/entertainer_distract_level_1.cef'
rLevel = 18 # minimum level to perform this effect
if actor.getLevel() < 18:
if commandString == '2':
command = 'Distract2'
effect = 'clienteffect/entertainer_distract_level_2.cef'
rLevel = 50
elif commandString == '3':
command = 'Distract3'
effect = 'clienteffect/entertainer_distract_level_3.cef'
rLevel = 75
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other distract 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_distract', 0)
return
+15 -6
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'FireJets1'
effect = 'entertainer_fire_jets_level_1.cef'
effect = 'clienteffect/entertainer_fire_jets_level_1.cef'
rLevel = 26 # minimum level to perform this effect
if actor.getLevel() < 26:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
if commandString == '2':
command = 'FireJets2'
effect = 'clienteffect/entertainer_fire_jets_level_2.cef'
rLevel = 50
elif commandString == '3':
command = 'FireJets3'
effect = 'clienteffect/entertainer_fire_jets_level_3.cef'
rLevel = 75
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other firejets 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_fire_jets', 0)
return
+1 -1
View File
@@ -7,7 +7,7 @@ def setup():
def run(core, actor, target, commandString):
playerObject = actor.getSlottedObject('ghost')
print playerObject.getProfession()
if not playerObject or playerObject.getProfession() != "entertainer_1a":
return
+13 -5
View File
@@ -6,13 +6,21 @@ def setup():
def run(core, actor, target, commandString):
command = 'SmokeBomb1'
effect = 'entertainer_smoke_bomb_level_1.cef'
effect = 'clienteffect/entertainer_smoke_bomb_level_1.cef'
rLevel = 50 # minimum level to perform this effect
if actor.getLevel() < 50:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
return
if commandString == '2':
command = 'SmokeBomb2'
effect = 'clienteffect/entertainer_smoke_bomb_level_2.cef'
rLevel = 75
# TODO: Find out levels for other smoke bomb 2 and 3
elif commandString == '3':
command = 'SmokeBomb3'
effect = 'clienteffect/entertainer_smoke_bomb_level_3.cef'
rLevel = 90
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_smoke_bomb', 0)
+14 -9
View File
@@ -8,17 +8,22 @@ def run(core, actor, target, commandString):
command = 'SpotLight1'
effect = 'clienteffect/entertainer_spot_light_level_1.cef'
rLevel = 1 # minimum level to perform this effect
# TODO: Figure out what levels the spotlight effects upgraded at.
if actor.getLevel() >= 80:
command == 'SpotLight3'
effect = 'clienteffect/entertainer_spot_light_level_3.cef'
elif actor.getLevel() >= 40:
command == 'SpotLight2'
if commandString == '2':
command = 'SpotLight2'
effect = 'clienteffect/entertainer_spot_light_level_2.cef'
rLevel = 20
elif commandString == '3':
command = 'SpotLight3'
effect = 'clienteffect/entertainer_spot_light_level_3.cef'
rLevel = 30
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
if core.entertainmentService.performEffect(actor, command, effect, None) is True:
actor.sendSystemMessage('@performance:effect_perform_spot_light', 0)
return
+1 -2
View File
@@ -77,7 +77,6 @@ def startDance(core, actor, danceName, visual):
#TODO: check costume
if actor.getPosture() != Posture.Upright:
print (' can\t dance because ' + str(actor.getPosture()))
actor.sendSystemMessage('@performance:dance_fail', 0)
return
@@ -97,7 +96,7 @@ def startDance(core, actor, danceName, visual):
actor.setPosture(0x09);
playerObject = actor.getSlottedObject('ghost')
if playerObject and playerObject.getProfession() == "entertainer_1a":
if playerObject and playerObject.getProfession() == "entertainer_1a" and actor.getLevel() != 90:
entSvc.startPerformanceExperience(actor)
dance = entSvc.getDance(visual)
+13 -5
View File
@@ -6,13 +6,21 @@ def setup():
def run(core, actor, target, commandString):
command = 'Ventriloquism1'
effect = 'entertainer_ventriloquism_level_1.cef'
effect = 'clienteffect/entertainer_ventriloquism_level_1.cef'
rLevel = 58 # minimum level to perform this effect
if actor.getLevel() < 58:
actor.sendSystemMessage('@performance:effect_lack_skill_self', 0)
return
if commandString == '2':
command = 'Ventriloquism2'
effect = 'clienteffect/entertainer_ventriloquism_level_2.cef'
rLevel = 75
# TODO: Find out levels for other ventriloquism 2 and 3
elif commandString == '3':
command = 'Ventriloquism3'
effect = 'clienteffect/entertainer_ventriloquism_level_3.cef'
rLevel = 90
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_ventriloquism', 0)
@@ -11,8 +11,8 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_1')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
def removeExpertisePoint(core, actor):
@@ -26,9 +26,8 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_1')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
# this checks what abilities the player gets by level, need to also call this on level-up
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_2')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_2')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_3')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_3')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_4')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_4')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_1')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_1')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_2')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_2')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_3')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_3')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_4')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_4')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
+13 -4
View File
@@ -4,11 +4,16 @@ import sys
def createRadial(core, owner, target, radials):
if target.getPosture() == Posture.SkillAnimating:
if target.getPerformanceType() is True:
radials.add(RadialOptions(0, 140, 1, 'Watch'))
if owner.getPerformanceWatchee() == target:
if target.getPerformanceType() is True:
radials.add(RadialOptions(0, 141, 3, 'Stop Watching'))
elif owner.getPerformanceListenee() == target: # TODO: Get rid of PerformanceWatchee variable, no need for listenee (same thing really)
radials.add(RadialOptions(0, 141, 3, 'Stop Listening'))
else:
radials.add(RadialOptions(0, 140, 1, 'Listen'))
if target.getPerformanceType() is True:
radials.add(RadialOptions(0, 140, 3, 'Watch'))
else:
radials.add(RadialOptions(0, 140, 3, 'Listen'))
return
def handleSelection(core, owner, target, option):
@@ -20,4 +25,8 @@ def handleSelection(core, owner, target, option):
# TODO: Insert callCommand /listen
return
return
if option == 141:
#core.commandService.callCommand(owner, 'stopwatching', target, '') #SWGList error for remove audience in CreatureObject
return
return
+2 -2
View File
@@ -16,10 +16,10 @@ def createRadial(core, owner, target, radials):
if targetPlayer is not None and targetPlayer.getSlottedObject('ghost') is not None:
if targetPlayer.getObjectID() == owner.getObjectID():
return
radials.add(RadialOptions(0, 69, 1, '@unity:mnu_propose'))
radials.add(RadialOptions(0, 69, 3, '@unity:mnu_propose'))
return
else:
radials.add(RadialOptions(0, 70, 1, '@unity:mnu_divorce'))
radials.add(RadialOptions(0, 70, 3, '@unity:mnu_divorce'))
return
return
@@ -0,0 +1,53 @@
/*******************************************************************************
* 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 protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
public class CollectionServerFirstListRequest extends SWGMessage {
private String server;
public CollectionServerFirstListRequest() {
}
@Override
public void deserialize(IoBuffer data) {
data.getShort();
data.getInt();
setServer(getAsciiString(data));
}
public String getServer() {
return server;
}
@Override
public IoBuffer serialize() {
return null;
}
public void setServer(String server) {
this.server = server;
}
}
@@ -0,0 +1,75 @@
/*******************************************************************************
* 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 protocol.swg;
import java.nio.ByteOrder;
import java.util.Map;
import java.util.Map.Entry;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import services.collections.ServerFirst;
import engine.resources.common.CRC;
public class CollectionServerFirstListResponse extends SWGMessage {
private Map<String, ServerFirst> sfList;
private String server;
public CollectionServerFirstListResponse(String server, Map<String, ServerFirst> serverFirstList){
this.sfList = serverFirstList;
this.server = server;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer;
int size = 0;
synchronized (sfList) {
for (Entry<String, ServerFirst> entry : sfList.entrySet()) {
size += entry.getValue().getBytes().length;
}
buffer = IoBuffer.allocate(12 + server.length() + size).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(CRC.StringtoCRC("CollectionServerFirstListResponse"));
buffer.put(getAsciiString(server));
buffer.putInt(sfList.size());
for (Entry<String, ServerFirst> entry : sfList.entrySet()) {
buffer.put(entry.getValue().getBytes());
}
return buffer.flip();
}
}
}
@@ -27,6 +27,7 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.RGB;
import resources.common.StringUtilities;
public class ShowFlyText extends ObjControllerObject {
@@ -70,6 +71,7 @@ public class ShowFlyText extends ObjControllerObject {
this.scale = scale;
this.color = color;
this.alternativeStructure = true;
this.displayType = displayType;
}
@Override
@@ -117,13 +119,16 @@ public class ShowFlyText extends ObjControllerObject {
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.put(getUnicodeString(customText));
result.putShort(xp);
result.put(getUnicodeString(customText)); // %TO?
result.putShort(xp); // %DI ?
result.putLong(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
result.flip();
//StringUtilities.printBytes(result.array());
return result;
}
}
@@ -23,6 +23,7 @@ package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.List;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
@@ -33,9 +34,15 @@ import resources.common.StringUtilities;
public class ShowLootBox extends ObjControllerObject {
private long playerId;
private SWGObject[] rewards;
private Vector<SWGObject> rewards;
private SWGObject reward;
public ShowLootBox(long playerId, SWGObject[] rewards) {
public ShowLootBox(long playerId, SWGObject reward) {
this.playerId = playerId;
this.rewards = rewards;
}
public ShowLootBox(long playerId, Vector<SWGObject> rewards) {
this.playerId = playerId;
this.rewards = rewards;
}
@@ -47,19 +54,24 @@ public class ShowLootBox extends ObjControllerObject {
@Override
public IoBuffer serialize() {
// Controller Type = 11
IoBuffer buffer = IoBuffer.allocate(20 + (rewards.length * 8)).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer buffer;
if (rewards != null)
buffer = IoBuffer.allocate(20 + (rewards.size() * 8)).order(ByteOrder.LITTLE_ENDIAN);
else
buffer = IoBuffer.allocate(28).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.SHOW_LOOT_BOX);
buffer.putLong(playerId);
buffer.putInt(0); // 1 for a black background on icon, 0 or 2 for transparent (default)
if (rewards.length == 1) {
if (rewards == null) {
buffer.putInt(1);
buffer.putLong(rewards[0].getObjectId());
buffer.putLong(reward.getObjectId());
} else {
buffer.putInt(rewards.length);
buffer.putInt(rewards.size());
for(SWGObject obj : rewards) {
buffer.putLong(obj.getObjectID());
}
+24
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.common;
import java.math.BigDecimal;
import engine.resources.scene.*;
public class MathUtilities {
@@ -43,5 +45,27 @@ public class MathUtilities {
q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x);
}
/**
* Converts seconds to a whole hour.
* @author Waverunner
* @param seconds
* @return hour(s)
*/
public static int secondsToWholeHours(int seconds) {
BigDecimal dec = new BigDecimal(seconds);
return dec.divide(new BigDecimal(3600), BigDecimal.ROUND_FLOOR).intValue();
}
/**
* Converts seconds to minutes of the hour.
* @author Waverunner
* @param seconds
* @return hour(s)
*/
public static int secondsToHourMinutes(int seconds) {
BigDecimal dec = new BigDecimal(seconds);
return dec.remainder(new BigDecimal(3600)).divide(new BigDecimal(60), BigDecimal.ROUND_FLOOR).intValue();
}
}
@@ -379,7 +379,12 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
buffer.put((byte) 0); // performing? boolean
buffer.put(creature.getDifficulty());
buffer.putInt(0xFFFFFFFF); // -1 normal appearance, 0 hologram
if(creature.isHologram())
buffer.putInt(0);
else
buffer.putInt(0xFFFFFFFF);
buffer.put((byte) 1); // visibleOnRadar? boolean
buffer.put((byte) 0); // no effect for 1?
buffer.put((byte) 0); // no effect for 1?
@@ -57,7 +57,7 @@ import engine.resources.scene.Quaternion;
import resources.objects.tangible.TangibleObject;
import resources.objects.weapon.WeaponObject;
@Entity(version=1)
@Entity(version=2)
public class CreatureObject extends TangibleObject implements IPersistent {
@NotPersistent
@@ -118,6 +118,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private byte moodId = 0;
private int performanceCounter = 0;
private int performanceId = 0;
private boolean hologram = false;
//FIXME: this is a bit of a hack.
private boolean performanceType = false;
//FIXME: hmm.. or persistent?
@@ -421,6 +422,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
if(performanceType) { next.sendSystemMessage("You stop watching " + getCustomName() + ".",(byte)0); }
else { next.sendSystemMessage("You stop listening to " + getCustomName() + ".",(byte)0); }
next.getSpectatorTask().cancel(true);
next.getInspirationTick().cancel(true);
}
//not sure if this behaviour is correct. might need fixing later.
performanceAudience = new SWGList<CreatureObject>();
@@ -435,11 +437,15 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
public ScheduledFuture<?> getInspirationTick() {
return inspirationTick;
synchronized(objectMutex) {
return inspirationTick;
}
}
public void setInspirationTick(ScheduledFuture<?> inspirationTick) {
this.inspirationTick = inspirationTick;
synchronized(objectMutex) {
this.inspirationTick = inspirationTick;
}
}
@Override
@@ -570,6 +576,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void addSkillMod(String name, int base) {
if(getSkillMod(name) == null) {
// TODO: This will need to be fixed as it doesn't update in the character sheet properly (wrong delta)
SkillMod skillMod = new SkillMod();
skillMod.setBase(base);
skillMod.setSkillModString(name);
@@ -1671,4 +1678,16 @@ public class CreatureObject extends TangibleObject implements IPersistent {
this.performingEffect = hasEffect;
}
}
public void setHologram(boolean isHologram) {
synchronized(objectMutex) {
this.hologram = isHologram;
}
}
public boolean isHologram() {
synchronized(objectMutex) {
return hologram;
}
}
}
@@ -321,6 +321,18 @@ public class TangibleObject extends SWGObject {
}
}
public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType, int unkInt) {
//Set<Client> observers = getObservers();
if (getClient() != null) {
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
}
/*for (Client client : observers) {
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
}*/
}
public void playEffectObject(String effectFile, String commandString) {
notifyObservers(new PlayClientEffectObjectMessage(effectFile, getObjectID(), commandString), true);
}
+3 -1
View File
@@ -72,7 +72,7 @@ public class BuffService implements INetworkDispatch {
addBuffToCreature(creature, buffName, creature);
}
public void addBuffToCreature(CreatureObject target, String buffName, CreatureObject buffer) {
public boolean addBuffToCreature(CreatureObject target, String buffName, CreatureObject buffer) {
/*if(!FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py")) {
//System.out.println("Buff script doesnt exist for: " + buffName);
@@ -82,8 +82,10 @@ public class BuffService implements INetworkDispatch {
final Buff buff = new Buff(buffName, buffer.getObjectID());
if(buff.isGroupBuff()) {
addGroupBuff(buffer, buffName, buffer);
return true;
} else {
doAddBuff(target, buffName, buffer);
return true;
}
}
+14
View File
@@ -195,6 +195,20 @@ public class ConnectionService implements INetworkDispatch {
object.setInviteCounter(0);
object.setInviteSenderId(0);
object.setInviteSenderName("");
if(object.getAttachment("inspireDuration") != null)
object.setAttachment("inspireDuration", null);
if(object.getInspirationTick() != null) {
object.getInspirationTick().cancel(true);
object.setInspirationTick(null);
}
if(object.getSpectatorTask() != null) {
object.getSpectatorTask().cancel(true);
object.setSpectatorTask(null);
}
core.groupService.handleGroupDisband(object);
for (CreatureObject opponent : object.getDuelList()) {
+87 -20
View File
@@ -4,6 +4,7 @@ import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
@@ -24,13 +25,16 @@ import protocol.swg.objectControllerObjects.BuffBuilderEndMessage;
import protocol.swg.objectControllerObjects.BuffBuilderStartMessage;
import resources.common.BuffBuilder;
import resources.common.Console;
import resources.common.MathUtilities;
import resources.common.ObjControllerOpcodes;
import resources.common.Performance;
import resources.common.PerformanceEffect;
import resources.common.RGB;
import resources.common.StringUtilities;
import resources.datatables.Posture;
import resources.objects.Buff;
import resources.objects.BuffItem;
import resources.objects.SWGList;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
@@ -38,6 +42,7 @@ import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.objects.SkillMod;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
@@ -52,6 +57,8 @@ public class EntertainmentService implements INetworkDispatch {
private ConcurrentHashMap<Integer,Performance> performancesByIndex = new ConcurrentHashMap<Integer,Performance>();
private ConcurrentHashMap<Integer,Performance> danceMap = new ConcurrentHashMap<Integer,Performance>();
private Random ranWorkshop = new Random();
private Map<String, PerformanceEffect> performanceEffects = new ConcurrentHashMap<String, PerformanceEffect>();
public EntertainmentService(NGECore core) {
@@ -70,7 +77,7 @@ public class EntertainmentService implements INetworkDispatch {
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
StringUtilities.printBytes(data.array());
Client client = core.getClient(session);
if(client == null)
@@ -145,8 +152,8 @@ public class EntertainmentService implements INetworkDispatch {
Vector<BuffItem> statBuffs = sentPacket.getStatBuffs();
SWGObject buffer = core.objectService.getObject(sentPacket.getBufferId());
SWGObject buffRecipient = core.objectService.getObject(sentPacket.getBuffRecipientId());
CreatureObject buffer = (CreatureObject) core.objectService.getObject(sentPacket.getBufferId());
CreatureObject buffRecipient = (CreatureObject) core.objectService.getObject(sentPacket.getBuffRecipientId());
if (buffer != buffRecipient) {
@@ -170,7 +177,7 @@ public class EntertainmentService implements INetworkDispatch {
}
}
giveInspirationBuff(buffRecipient, statBuffs);
giveInspirationBuff(buffRecipient, buffer, statBuffs);
BuffBuilderEndMessage endBuilder = new BuffBuilderEndMessage(changeMessage);
endBuilder.setObjectId(buffer.getObjectId());
@@ -200,7 +207,7 @@ public class EntertainmentService implements INetworkDispatch {
} else {
if (sentPacket.getAccepted() == true) {
giveInspirationBuff(buffRecipient, statBuffs);
giveInspirationBuff(buffRecipient, buffer, statBuffs);
BuffBuilderEndMessage endBuilder = new BuffBuilderEndMessage(sentPacket);
endBuilder.setObjectId(buffer.getObjectId());
@@ -354,8 +361,7 @@ public class EntertainmentService implements INetworkDispatch {
core.commandService.registerCommand("ventriloquism");
}
public void giveInspirationBuff(SWGObject reciever, Vector<BuffItem> buffVector) {
CreatureObject buffCreature = (CreatureObject) reciever;
public void giveInspirationBuff(CreatureObject reciever, CreatureObject buffer, Vector<BuffItem> buffVector) {
Vector<BuffBuilder> availableStats = buffBuilderSkills;
Vector<BuffItem> stats = new Vector<BuffItem>();
@@ -372,22 +378,35 @@ public class EntertainmentService implements INetworkDispatch {
BuffItem stat = new BuffItem(builder.getStatAffects(), item.getInvested(), item.getEntertainerBonus());
stat.setAffectAmount(affectTotal);
/*System.out.println("Invested Points: " + item.getInvested());
System.out.println("Entertainer Bonus: " + item.getEntertainerBonus());
System.out.println("Affect Total: " + affectTotal);*/
stats.add(stat);
break;
}
}
}
reciever.setAttachment("buffWorkshop", buffVector);
core.buffService.addBuffToCreature(buffCreature, "buildabuff_inspiration");
reciever.setAttachment("buffWorkshop", stats);
PlayerObject rPlayer = (PlayerObject) reciever.getSlottedObject("ghost");
long timeStamp = 0;
if (reciever.getAttachment("buffWorkshopTimestamp") != null)
timeStamp = (long) reciever.getAttachment("buffWorkshopTimestamp");
core.buffService.addBuffToCreature(reciever, "buildabuff_inspiration", buffer);
/*if (core.buffService.addBuffToCreature(reciever, "buildabuff_inspiration", buffer) && !rPlayer.getProfession().equals("entertainer_1a")) {
if (timeStamp == 0 || (System.currentTimeMillis() - timeStamp > 86400000)) {
float random = ranWorkshop.nextFloat();
if (random < 0.75f) {
if(rPlayer.getProfession().contains("trader")) { core.collectionService.addCollection(buffer, "prof_trader"); }
else {
core.collectionService.addCollection(buffer, rPlayer.getProfession());
}
}
} else { buffer.sendSystemMessage("@collection:buffed_too_soon", (byte) 0); }
reciever.setAttachment("buffWorkshopTimestamp", System.currentTimeMillis());
}*/
}
public int getDanceVisualId(String danceName) {
@@ -481,6 +500,7 @@ public class EntertainmentService implements INetworkDispatch {
}
public void startSpectating(final CreatureObject spectator, final CreatureObject performer) {
final ScheduledFuture<?> spectatorTask = scheduler.scheduleAtFixedRate(new Runnable() {
@Override
@@ -499,14 +519,20 @@ public class EntertainmentService implements INetworkDispatch {
}
spectator.setMoodAnimation("neutral");
performer.removeAudience(spectator);
spectator.getSpectatorTask().cancel(true);
if (spectator.getInspirationTick().cancel(true))
spectator.getSpectatorTask().cancel(true);
}
}
}, 2, 2, TimeUnit.SECONDS);
spectator.setSpectatorTask(spectatorTask);
if(((PlayerObject)performer.getSlottedObject("ghost")).getProfession().equals("entertainer_1a")) {
handleInspirationTicks(spectator, performer);
}
}
public void performFlourish(final CreatureObject performer, int flourish) {
@@ -547,8 +573,6 @@ public class EntertainmentService implements INetworkDispatch {
String performance = (performer.getPerformanceType()) ? "dance" : "music";
// TODO: Skill Level check
if(performer.isPerformingEffect()) {
performer.sendSystemMessage("@performance:effect_wait_self", (byte) 0);
return false;
@@ -591,6 +615,49 @@ public class EntertainmentService implements INetworkDispatch {
return true;
}
public void handleInspirationTicks(final CreatureObject spectator, final CreatureObject performer) {
// http://youtu.be/WqyAde-oC7o?t=11m14s << Player watching entertainer (Has ring only, no pet, + 15 min ticks)
// TODO: Camp/Cantina checks for expertise and duration bonus %. Right now only using basic values.
final ScheduledFuture<?> inspirationTick = scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
int time = 0; // current buff duration time (minutes)
int buffCap = 215; // 5 hours 35 minutes - 2 hours (buff duration increase bonus) << Taken from video, doesn't account for performance bonuses etc.
if (spectator.getAttachment("inspireDuration") != null)
time+= (int) spectator.getAttachment("inspireDuration");
if (performer.getSkillMod("expertise_en_inspire_buff_duration_increase") != null) {
SkillMod durationMod = performer.getSkillMod("expertise_en_inspire_buff_duration_increase");
buffCap += durationMod.getBase() + durationMod.getModifier();
}
if (time >= buffCap) {
spectator.setAttachment("inspireDuration", buffCap); // incase someone went over cap
spectator.getInspirationTick().cancel(true);
} else {
int entTick = 10;
if (performer.getSkillMod("expertise_en_inspire_pulse_duration_increase") != null) {
SkillMod pulseMod = performer.getSkillMod("expertise_en_inspire_pulse_duration_increase");
entTick += pulseMod.getBase() + pulseMod.getModifier();
}
int duration = (time + entTick); // minutes
int hMinutes = MathUtilities.secondsToHourMinutes(duration * 60);
int hours = MathUtilities.secondsToWholeHours(duration * 60);
spectator.showFlyText("spam", "buff_duration_tick_observer", String.valueOf(hours) + " hours , " + hMinutes + " minutes ", 0, (float) 0.66, new RGB(255, 182, 193), 3, 78);
spectator.setAttachment("inspireDuration", duration);
//System.out.println("Inspire Duration: " + spectator.getAttachment("inspireDuration") + " on " + spectator.getCustomName());
}
}
}, 10, 10, TimeUnit.SECONDS);
spectator.setInspirationTick(inspirationTick);
}
@Override
public void shutdown() {
+61 -6
View File
@@ -41,6 +41,8 @@ import org.apache.mina.core.session.IoSession;
import protocol.swg.CharacterSheetResponseMessage;
import protocol.swg.ClientIdMsg;
import protocol.swg.ClientMfdStatusUpdateMessage;
import protocol.swg.CollectionServerFirstListRequest;
import protocol.swg.CollectionServerFirstListResponse;
import protocol.swg.CreateClientPathMessage;
import protocol.swg.ExpertiseRequestMessage;
import protocol.swg.GuildRequestMessage;
@@ -57,6 +59,7 @@ import resources.common.ObjControllerOpcodes;
import resources.common.Opcodes;
import resources.common.RGB;
import resources.common.SpawnPoint;
import resources.common.StringUtilities;
import resources.datatables.PlayerFlags;
import resources.guild.Guild;
import resources.objects.Buff;
@@ -391,8 +394,30 @@ public class PlayerService implements INetworkDispatch {
swgOpcodes.put(Opcodes.CollectionServerFirstListRequest, new INetworkRemoteEvent() {
@Override
public void handlePacket(IoSession session, IoBuffer buffer) throws Exception {
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
data.position(0);
Client client = core.getClient(session);
if (client == null)
return;
SWGObject player = client.getParent();
if (player == null)
return;
CollectionServerFirstListRequest request = new CollectionServerFirstListRequest();
request.deserialize(data);
String server = request.getServer();
System.out.println(server);
if (server == null || server.equals(""))
return;
CollectionServerFirstListResponse response = new CollectionServerFirstListResponse(server, core.guildService.getGuildObject().getServerFirst());
session.write(response.serialize());
}
});
@@ -736,7 +761,7 @@ public class PlayerService implements INetworkDispatch {
}
if (rewards != null && !rewards.isEmpty()) {
giveItems(creature, (SWGObject[]) rewards.toArray());
giveItems(creature, rewards);
}
} catch (InstantiationException | IllegalAccessException e) {
@@ -750,6 +775,9 @@ public class PlayerService implements INetworkDispatch {
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
if(player.getProfession().equals("entertainer_1a") && creature.getLevel() == (short) 90)
creature.getEntertainerExperience().cancel(true);
//}
}
@@ -793,11 +821,38 @@ public class PlayerService implements INetworkDispatch {
}
/**
* Gives a player items and shows the "New Items" message.
* @param reciever Player receiving the items
* @param items The object(s) to be given. This will allow multiple arguments.
* Gives a player an item and shows the "New Items" message.
* @param reciever Player receiving the item.
* @param item The object to be given.
* @author Waverunner
*/
public void giveItems(CreatureObject reciever, SWGObject... items) {
public void giveItem(CreatureObject reciever, SWGObject item) {
if (reciever == null || item == null)
return;
if (reciever.getClient() == null)
return;
Client client = reciever.getClient();
if (client.getSession() == null)
return;
SWGObject inventory = reciever.getSlottedObject("inventory");
if (inventory == null)
return;
inventory.add(item);
ObjControllerMessage objController = new ObjControllerMessage(11, new ShowLootBox(reciever.getObjectID(), item));
client.getSession().write(objController.serialize());
}
/**
* Gives a player a variety of items and shows the "New Items" message.
* @param reciever Player receiving the items.
* @param items Vector of the items.
*/
public void giveItems(CreatureObject reciever, Vector<SWGObject> items) {
if (reciever == null || items == null)
return;
@@ -362,7 +362,7 @@ public class CollectionService implements INetworkDispatch {
}
if (trackServerFirst) {
if (core.guildService.getGuildObject().addServerFirst(collectionName, new ServerFirst(creature.getCustomName(), System.currentTimeMillis()))) {
if (core.guildService.getGuildObject().addServerFirst(collectionName, new ServerFirst(creature.getCustomName(), creature.getObjectId(), collectionName, System.currentTimeMillis()))) {
addCollection(creature, "bdg_server_first_01");
}
}
+23 -2
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package services.collections;
import org.apache.mina.core.buffer.IoBuffer;
import resources.objects.Delta;
import com.sleepycat.persist.model.Persistent;
@@ -29,11 +31,15 @@ import com.sleepycat.persist.model.Persistent;
public class ServerFirst extends Delta {
private String name;
private String collection;
private long time;
private long objectId;
public ServerFirst(String name, long time) {
public ServerFirst(String name, long objectId, String collection, long time) {
this.name = name;
this.objectId = objectId;
this.time = time;
this.collection = collection;
}
public ServerFirst() {
@@ -48,9 +54,24 @@ public class ServerFirst extends Delta {
return time;
}
public long getObjectId() {
return objectId;
}
public String getCollection() {
return collection;
}
@Override
public byte[] getBytes() {
return new byte[] { };
synchronized(objectMutex) {
IoBuffer buffer = createBuffer(18 + collection.length() + (name.length() * 2));
buffer.putInt((int) time / 1000);
buffer.put(getAsciiString(collection));
buffer.putLong(objectId);
buffer.put(getUnicodeString(name));
return buffer.array();
}
}
}