diff --git a/scripts/buffs/me_evasion_1.py b/scripts/buffs/me_evasion_1.py index 81115a7b..59984429 100644 --- a/scripts/buffs/me_evasion_1.py +++ b/scripts/buffs/me_evasion_1.py @@ -2,13 +2,13 @@ import sys def setup(core, actor, buff): core.skillModService.addSkillMod(actor, 'expertise_dodge', 35) - core.skillModService.addSkillMod(actor, 'expertise_evasion_chance', 50) + core.skillModService.addSkillMod(actor, 'display_only_evasion', 5000) core.skillModService.addSkillMod(actor, 'combat_evasion_value', 50) return def removeBuff(core, actor, buff): core.skillModService.deductSkillMod(actor, 'expertise_dodge', 35) - core.skillModService.deductSkillMod(actor, 'expertise_evasion_chance', 50) + core.skillModService.deductSkillMod(actor, 'display_only_evasion', 5000) core.skillModService.deductSkillMod(actor, 'combat_evasion_value', 50) return \ No newline at end of file diff --git a/scripts/commands/addfriend.py b/scripts/commands/addfriend.py index d839b59b..c612261d 100644 --- a/scripts/commands/addfriend.py +++ b/scripts/commands/addfriend.py @@ -5,7 +5,12 @@ def setup(): def run(core, actor, target, commandString): actorGhost = actor.getSlottedObject("ghost") + chatSrvc = core.chatService if chatSrvc and actorGhost and commandString: - chatSrvc.addFriend(actorGhost, commandString, 1) + if actorGhost.getFriendList().contains(commandString.split(" ")[0].lower()): + actor.sendSystemMessage(commandString.split(" ")[0].lower() + ' is already in your friend list.', 0) + return + else: + chatSrvc.addFriend(actorGhost, commandString) return \ No newline at end of file diff --git a/scripts/commands/addignore.py b/scripts/commands/addignore.py index d8da29a8..04b1ca6b 100644 --- a/scripts/commands/addignore.py +++ b/scripts/commands/addignore.py @@ -6,5 +6,14 @@ def setup(): def run(core, actor, target, commandString): actorGhost = actor.getSlottedObject("ghost") chatSrvc = core.chatService + + if not actorGhost and chatSrvc and commandString: + return + + if actorGhost.getIgnoreList().contains(commandString.split(" ")[0].lower()): + actor.sendSystemMessage(commandString.split(' ')[0].lower() + ' is already in your ignore list.', 0) + return + chatSrvc.addToIgnoreList(actor, commandString) + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_1.py b/scripts/commands/combat/fs_dm_1.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_1.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_2.py b/scripts/commands/combat/fs_dm_2.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_2.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_3.py b/scripts/commands/combat/fs_dm_3.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_3.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_4.py b/scripts/commands/combat/fs_dm_4.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_4.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_5.py b/scripts/commands/combat/fs_dm_5.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_5.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_6.py b/scripts/commands/combat/fs_dm_6.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_6.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_dm_7.py b/scripts/commands/combat/fs_dm_7.py new file mode 100644 index 00000000..825798d5 --- /dev/null +++ b/scripts/commands/combat/fs_dm_7.py @@ -0,0 +1,20 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_dm'): + command.setCooldown(command.getCooldown() + (actor.getSkillMod('expertise_cooldown_line_fs_dm').getBase()/10)) + + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_1.py b/scripts/commands/combat/fs_flurry_1.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_1.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_2.py b/scripts/commands/combat/fs_flurry_2.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_2.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_3.py b/scripts/commands/combat/fs_flurry_3.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_3.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_4.py b/scripts/commands/combat/fs_flurry_4.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_4.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_5.py b/scripts/commands/combat/fs_flurry_5.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_5.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_6.py b/scripts/commands/combat/fs_flurry_6.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_6.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_flurry_7.py b/scripts/commands/combat/fs_flurry_7.py new file mode 100644 index 00000000..1d6cd02c --- /dev/null +++ b/scripts/commands/combat/fs_flurry_7.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, actor, target, command): + if actor.getSkillMod('expertise_damage_line_fs_dm'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillMod('expertise_damage_line_fs_dm').getBase())/100)) + + if actor.getSkillMod('expertise_critical_line_fs_dm'): + command.setCriticalChance(command.getCriticalChance() + actor.getSkillMod('expertise_critical_line_fs_dm').getBase()) + + if actor.getSkillMod('expertise_action_line_fs_dm'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillMod('expertise_action_line_fs_dm').getBase())/100)) + + return + +def run(core, actor, target, commandString): + return \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_1.py b/scripts/commands/combat/fs_sweep_1.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_1.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_2.py b/scripts/commands/combat/fs_sweep_2.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_2.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_3.py b/scripts/commands/combat/fs_sweep_3.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_3.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_4.py b/scripts/commands/combat/fs_sweep_4.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_4.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_5.py b/scripts/commands/combat/fs_sweep_5.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_5.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_6.py b/scripts/commands/combat/fs_sweep_6.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_6.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/combat/fs_sweep_7.py b/scripts/commands/combat/fs_sweep_7.py new file mode 100644 index 00000000..6671e0ad --- /dev/null +++ b/scripts/commands/combat/fs_sweep_7.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, actor, target, command): + + if actor.getSkillMod('expertise_cooldown_line_fs_sweep'): + command.setCooldown(command.getCooldown() + (actor.getSkillModBase('expertise_cooldown_line_fs_sweep')/10)) + + if actor.getSkillMod('expertise_damage_line_fs_sweep'): + command.setAddedDamage(command.getAddedDamage() + ((command.getAddedDamage() * actor.getSkillModBase('expertise_damage_line_fs_sweep'))/100)) + + if actor.getSkillMod('expertise_action_line_fs_sweep'): + command.setActionCost(command.getActionCost() - ((command.getActionCost() * actor.getSkillModBase('expertise_action_line_fs_sweep'))/100)) + + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/scripts/commands/findfriend.py b/scripts/commands/findfriend.py index 992efa35..c6f528ac 100644 --- a/scripts/commands/findfriend.py +++ b/scripts/commands/findfriend.py @@ -1,3 +1,5 @@ +from resources.objects.waypoint import WaypointObject +from engine.resources.common import CRC import sys def setup(): @@ -11,8 +13,29 @@ def run(core, actor, target, commandString): friendObj = core.chatService.getObjectByFirstName(friend) if friendObj is not None: if friendObj.getSlottedObject('ghost').getFriendList().contains(actor.getCustomName().lower().split(' ')[0]): - fPos = friendObj.getPosition() - core.commandService.callCommand(actor, 'waypoint', None, friendObj.getPlanet().name + ' ' + str(fPos.x) + ' ' + str(fPos.z) + ' ' + str(fPos.y) + ' blue ' + friendObj.getCustomName()) + createWaypoint(core, actor, friendObj) return return - return \ No newline at end of file + return + + +def createWaypoint(core, actor, friendObj): + ghost = actor.getSlottedObject('ghost') + friendName = friendObj.getCustomName().split(' ')[0] + wp = WaypointObject() + + for wp in ghost.getWaypoints(): + if wp.getName() == friendName and wp.getPlanet() == friendObj.getPlanet(): + core.commandService.callCommand(actor, 'serverdestroyobject', wp, '') + break + + waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', friendObj.getPlanet(), friendObj.getWorldPosition().x, friendObj.getWorldPosition().z, friendObj.getWorldPosition().y) + waypoint.setName(friendName) + waypoint.setActive(True) + waypoint.setColor(WaypointObject.YELLOW) + waypoint.setName(friendName) + waypoint.setPlanetCRC(CRC.StringtoCRC(friendObj.getPlanet().name)) + waypoint.setStringAttribute('', '') + ghost.waypointAdd(waypoint) + actor.sendSystemMessage('A waypoint has been created in your datapad at the location.', 0) + return diff --git a/scripts/commands/getfriendlist.py b/scripts/commands/getfriendlist.py index 0a478a48..5826dfac 100644 --- a/scripts/commands/getfriendlist.py +++ b/scripts/commands/getfriendlist.py @@ -5,7 +5,7 @@ def setup(): return def run(core, actor, target, commandString): - ghost = actor.getSlottedObject('ghost') - friendsListMessage = ChatOnGetFriendsList(ghost) - actor.getClient().getSession().write(friendsListMessage.serialize()) + #ghost = actor.getSlottedObject('ghost') + #friendsListMessage = ChatOnGetFriendsList(ghost) + #actor.getClient().getSession().write(friendsListMessage.serialize()) return \ No newline at end of file diff --git a/scripts/commands/lfg.py b/scripts/commands/lfg.py index 3477098f..dc0033c5 100644 --- a/scripts/commands/lfg.py +++ b/scripts/commands/lfg.py @@ -6,6 +6,5 @@ def setup(): def run(core, actor, target, commandString): ghost = actor.getSlottedObject('ghost') - print ('Command recieved!') ghost.toggleFlag(PlayerFlags.LFG) return \ No newline at end of file diff --git a/scripts/commands/meditate.py b/scripts/commands/meditate.py index 2bc74a69..9c02f74f 100644 --- a/scripts/commands/meditate.py +++ b/scripts/commands/meditate.py @@ -6,6 +6,9 @@ def setup(): def run(core, actor, target, commandString): ##To do make it reset moodanimations when meditation is cancled. + if core.collectionService.isComplete(actor, 'inv_holocron_collection_02') is False: + return + if actor.getPosture() != 0x08: actor.sendSystemMessage('You need to sit',0) actor.setMoodAnimation('neutral') diff --git a/scripts/commands/toggleawayfromkeyboard.py b/scripts/commands/toggleawayfromkeyboard.py index 18dece5b..21fddc02 100644 --- a/scripts/commands/toggleawayfromkeyboard.py +++ b/scripts/commands/toggleawayfromkeyboard.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): @@ -7,4 +7,4 @@ def setup(): def run(core, actor, target, commandString): ghost = actor.getSlottedObject('ghost') ghost.toggleFlag(PlayerFlags.AFK) - return \ No newline at end of file + return diff --git a/scripts/commands/toggledisplayingfactionrank.py b/scripts/commands/toggledisplayingfactionrank.py index bf4ae34f..e39aad18 100644 --- a/scripts/commands/toggledisplayingfactionrank.py +++ b/scripts/commands/toggledisplayingfactionrank.py @@ -1,4 +1,4 @@ -from resources.common import PlayerFlags +from resources.datatables import PlayerFlags import sys def setup(): @@ -7,4 +7,4 @@ def setup(): def run(core, actor, target, commandString): ghost = actor.getSlottedObject('ghost') ghost.toggleFlag(PlayerFlags.FACTIONRANK) - return \ No newline at end of file + return diff --git a/scripts/commands/transferitemarmor.py b/scripts/commands/transferitemarmor.py index b5090996..2b890936 100644 --- a/scripts/commands/transferitemarmor.py +++ b/scripts/commands/transferitemarmor.py @@ -4,6 +4,9 @@ def setup(): return def run(core, actor, target, commandString): + if core.equipmentService.canEquip(actor, target) is False: + return + parsedMsg = commandString.split(' ', 3) objService = core.objectService containerID = long(parsedMsg[1]) diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 7a3f5199..79ef9455 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -4,6 +4,9 @@ def setup(): return def run(core, actor, target, commandString): + if core.equipmentService.canEquip(actor, target) is False: + return + parsedMsg = commandString.split(' ', 3) objService = core.objectService containerID = long(parsedMsg[1]) diff --git a/scripts/commands/transferitemweapon.py b/scripts/commands/transferitemweapon.py index 8c54e57a..9b403eaf 100644 --- a/scripts/commands/transferitemweapon.py +++ b/scripts/commands/transferitemweapon.py @@ -4,6 +4,9 @@ def setup(): return def run(core, actor, target, commandString): + if core.equipmentService.canEquip(actor, target) is False: + return + parsedMsg = commandString.split(' ', 3) objService = core.objectService containerID = long(parsedMsg[1]) diff --git a/scripts/commands/waypoint.py b/scripts/commands/waypoint.py index e0d3827c..b646ff14 100644 --- a/scripts/commands/waypoint.py +++ b/scripts/commands/waypoint.py @@ -22,7 +22,7 @@ def run(core, actor, target, commandString): planet = core.terrainService.getPlanetByName(commandArgs[0]) waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', planet, float(commandArgs[1]), float(commandArgs[2]), float(commandArgs[3])) waypoint.setActive(True) - waypoint.setColor(colorCheck(core, actor, target, commandString, commandArgs[4])) + waypoint.setColor(colorCheck(commandArgs[4])) name = commandString.split(" ", 5) waypoint.setName(name[5]) waypoint.setPlanetCRC(crc.StringtoCRC(planet.getName())) @@ -89,7 +89,10 @@ def run(core, actor, target, commandString): waypoint = core.objectService.createObject('object/waypoint/shared_waypoint.iff', actor.getPlanet(), actor.getWorldPosition().x, actor.getWorldPosition().z, actor.getWorldPosition().y) waypoint.setActive(True) waypoint.setColor(WaypointObject.BLUE) - waypoint.setName(commandString) + if commandString == '': + waypoint.setName(actor.getPlanet().name.capitalize()) + else: + waypoint.setName(commandString) waypoint.setPlanetCRC(crc.StringtoCRC(actor.getPlanet().getName())) waypoint.setStringAttribute('', '') # This simply allows the attributes to display (nothing else has to be done) actorPlayer.waypointAdd(waypoint) @@ -98,7 +101,7 @@ def run(core, actor, target, commandString): return -def colorCheck(core, actor, target, commandString, validcolors): +def colorCheck(validcolors): if validcolors == "blue": return WaypointObject.BLUE if validcolors == "green": diff --git a/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py b/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py new file mode 100644 index 00000000..faf7ac17 --- /dev/null +++ b/scripts/object/tangible/wearables/robe/item_npe_fs_robe_02_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + + object.setStfFilename('static_item_n') + object.setStfName('item_npe_fs_robe_02_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_npe_fs_robe_02_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 21) + object.setStringAttribute('protection_level', 'Faint') + object.setStringAttribute('class_required', 'Jedi') + object.setIntAttribute('required_combat_level', 20) + return diff --git a/scripts/object/weapon/melee/sword/crafted_saber/weapon_roadmap_lightsaber_02_02.py b/scripts/object/weapon/melee/sword/crafted_saber/weapon_roadmap_lightsaber_02_02.py new file mode 100644 index 00000000..38a9f07e --- /dev/null +++ b/scripts/object/weapon/melee/sword/crafted_saber/weapon_roadmap_lightsaber_02_02.py @@ -0,0 +1,12 @@ +import sys + +def setup(core, object): + object.setCustomName('First Generation Lightsaber') + + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 1) + object.setStringAttribute('class_required', 'Jedi') + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '200-400') + + ## finish this ## + return \ No newline at end of file diff --git a/scripts/roadmap/roadmap_rewards.py b/scripts/roadmap/roadmap_rewards.py index 2f11d77e..b1071bbc 100644 --- a/scripts/roadmap/roadmap_rewards.py +++ b/scripts/roadmap/roadmap_rewards.py @@ -1,4 +1,9 @@ import sys def get(name): - return "" + + if name == 'item_npe_fs_robe_02_02': + return "object/tangible/wearables/robe/shared_robe_jedi_padawan.iff" + + if name == 'weapon_roadmap_lightsaber_02_02': + return "object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_s1.iff" \ No newline at end of file diff --git a/scripts/static_spawns/lok.py b/scripts/static_spawns/lok.py new file mode 100644 index 00000000..acb0f8a6 --- /dev/null +++ b/scripts/static_spawns/lok.py @@ -0,0 +1,49 @@ + +import sys + +def addPlanetSpawns(core, planet): + + stcSvc = core.staticService +#Nym's Stronghold -Fingies + + #Outside + + nymtech = stcSvc.spawnObject('object/mobile/shared_dressed_nym_technician_2.iff', 'lok', long(0), float(372.87), float(11.99), float(4984.83), float(0.97), float(-0.21)) + nymtech.setCustomName2('Nym\'s Fuel Technician') + disgrunt1 = stcSvc.spawnObject('object/mobile/shared_nym_themepark_d_townsperson_lead.iff', 'lok', long(0), float(473.28), float(23.00), float(4945.03), float(0.043), float(0.99)) + disgrunt1.setCustomName2('a disgruntled townsperson') + guard1 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_nikto_m.iff', 'lok', long(0), float(472.82), float(22.57), float(4920.00), float(0), float(0)) + guard1.setCustomName2('Nym\'s Guard') + guard2 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_hum_m.iff', 'lok', long(0), float(480.74), float(22.64), float(4920.02), float(0), float(0)) + guard2.setCustomName2('Nym\'s Guard') + + #Nym's Palace - Interior + + brawl1 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_brawler_hum_f.iff', 'lok', long(6595511), float(5.7), float(1.3), float(-6.1), float(0.90), float(-0.42)) + brawl1.setCustomName2('Nym\'s Brawler') + surv1 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_surveyer_rod_m.iff', 'lok', long(6595511), float(4.5), float(1.3), float(-4.1), float(0.078), float(-0.99)) + surv1.setCustomName2('Nym\'s Surveyor') + bodyg1 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_bodyguard_hum_m.iff', 'lok', long(6595511), float(7.8), float(1.3), float(-6.8), float(0.782), float(0.622)) + bodyg1.setCustomName2('Nym\'s Bodyguard') + mako = stcSvc.spawnObject('object/mobile/shared_nym_themepark_mako_ghast.iff', 'lok', long(6595511), float(5.5), float(4.1), float(-13.9), float(0.309), float(0.951)) + mako.setCustomName2('Mako Ghast') + bodyg2 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_bodyguard_rod_m.iff', 'lok', long(6595511), float(0.3), float(1.3), float(3.2), float(0.707), float(0.707)) + bodyg2.setCustomName2('Nym\'s Bodyguard') + bodyg3 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_bodyguard_rod_m.iff', 'lok', long(6595511), float(-1.6), float(1.3), float(3.0), float(0.707), float(-0.707)) + bodyg3.setCustomName2('Nym\'s Bodyguard') + surv2 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_surveyer_rod_m.iff', 'lok', long(6595511), float(-9.1), float(1.3), float(-5.9), float(1), float(0)) + surv2.setCustomName2('Nym\'s Surveyor') + brawl2 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_brawler_tran_m.iff', 'lok', long(6595511), float(-9.1), float(1.3), float(-3.1), float(0.0087), float(0.999)) + brawl2.setCustomName2('Nym\'s Brawler') + guard3 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_hum_m.iff', 'lok', long(6595511), float(-19.7), float(2.3), float(-17.6), float(0.999), float(0.0087)) + guard3.setCustomName2('Nym\'s Guard') + creep1 = stcSvc.spawnObject('object/mobile/shared_slicer_kelson_sharphorn.iff', 'lok', long(6595511), float(-4.2), float(2.3), float(7.6), float(0.0174), float(0.9998)) + creep1.setCustomName2('Kelson Sharphorn') + guard4 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_hum_m.iff', 'lok', long(6595511), float(24.8), float(2.3), float(7.9), float(0.0174), float(0.9998)) + guard4.setCustomName2('Nym\'s Guard') + guard5 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_hum_m.iff', 'lok', long(6595511), float(3.7), float(4.1), float(-9.5), float(0.9998), float(0.0174)) + guard5.setCustomName2('Nym\'s Guard') + guard6 = stcSvc.spawnObject('object/mobile/shared_dressed_nym_guard_weak_rod_m.iff', 'lok', long(6595511), float(-3.7), float(4.1), float(-9.5), float(1), float(0)) + guard6.setCustomName2('Nym\'s Guard') + + diff --git a/scripts/static_spawns/tatooine.py b/scripts/static_spawns/tatooine.py index 2a84eb1f..9817b21c 100644 --- a/scripts/static_spawns/tatooine.py +++ b/scripts/static_spawns/tatooine.py @@ -1,8 +1,11 @@ import sys +from resources.datatables import Options +from resources.datatables import StateStatus def addPlanetSpawns(core, planet): stcSvc = core.staticService +# Wayfar Life Day, by Wefi stcSvc.spawnObject('object/mobile/shared_lifeday_saun_dann.iff', 'tatooine', long(0), float(-5037.00), float(75), float(-6561), float(-0.75), float(0)) # Life Day stcSvc.spawnObject('object/tangible/holiday/life_day/shared_main_lifeday_tree.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6541.00), float(0.999132931232), float(-0.0416347384453)) # Lifeday Tree @@ -17,6 +20,173 @@ def addPlanetSpawns(core, planet): bandtat4.setCustomName2('Sunil Eide') stcSvc.spawnObject('object/tangible/instrument/shared_nalargon.iff', 'tatooine', long(0), float(-5045.00), float(75), float(-6555), float(0.999132931232), float(-0.0416347384453)) # Drums stcSvc.spawnObject('object/tangible/instrument/shared_ommni_box.iff', 'tatooine', long(0), float(-5043.00), float(75), float(-6559), float(0.999132931232), float(-0.0416347384453)) # Box + +# Mos Eisley Spawns: WORK IN PROGRESS by Levarris + + #Cantina Interior + wuher = stcSvc.spawnObject('object/mobile/shared_wuher.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(0.4), float(0.71), float(0.71)) + wuher.setCustomName2('Wuher') + wuher.addOption(Options.INVULNERABLE) + wuher.setStateBitmask(StateStatus.SittingOnChair) + + chadraFanFemale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_female.iff', 'tatooine', long(1082877), float(10.6), float(-0.9), float(-1.5), float(0.42), float(0.90)) + chadraFanFemale.setCustomName2('a Chadra Fan Female') + + chadraFanMale = stcSvc.spawnObject('object/mobile/shared_chadra_fan_male.iff', 'tatooine', long(1082877), float(10.7), float(-0.9), float(-0.3), float(0.64), float(0.77)) + chadraFanMale.setCustomName2('a Chadra Fan Male') + + muftak = stcSvc.spawnObject('object/mobile/shared_muftak.iff', 'tatooine', long(1082877), float(20.3), float(-0.9), float(4.9), float(0.82), float(0.57)) + muftak.setCustomName2('Muftak') + + chissMale1 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(-5.0), float(0.71), float(0.71)) + chissMale1.setCustomName2('a Chiss Male') + + chissMale2 = stcSvc.spawnObject('object/mobile/ep3/shared_ep3_etyyy_chiss_poacher_02.iff', 'tatooine', long(1082877), float(3.4), float(-0.9), float(-4.8), float(0), float(0)) + chissMale2.setCustomName2('a Chiss Male') + + cantinaStorm = stcSvc.spawnObject('object/mobile/shared_stormtrooper.iff', 'tatooine', long(1082877), float(2.9), float(-0.9), float(-6.5), float(0.71), float(0.71)) + cantinaStorm.setCustomName2('a Stormtrooper') + + cantinaStormL = stcSvc.spawnObject('object/mobile/shared_stormtrooper_groupleader.iff', 'tatooine', long(1082877), float(3.6), float(-0.9), float(-7.9), float(0.71), float(0.71)) + cantinaStormL.setCustomName2('a Stormtrooper Squad Leader') + + figrinDan = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(3.7), float(-0.9), float(-14.4), float(0.42), float(0.91)) + figrinDan.setCustomName2('Figrin Dan') + + techMor = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(4.0), float(-0.9), float(-17.0), float(0.42), float(0.91)) + techMor.setCustomName2('Tech M\'or') + + doikkNats = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(2.2), float(-0.9), float(-16.4), float(0.42), float(0.91)) + doikkNats.setCustomName2('Doikk Na\'ts') + + tednDahai = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(1.3), float(-0.9), float(-15.2), float(0.42), float(0.91)) + tednDahai.setCustomName2('Tedn Dahai') + + nalanCheel = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_figrin_dan.iff', 'tatooine', long(1082880), float(0.5), float(-0.9), float(-17.1), float(0.42), float(0.91)) + nalanCheel.setCustomName2('Nalan Cheel') + + businessman1 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(1082877), float(10.7), float(-0.9), float(1.9), float(0.42), float(0.91)) + businessman1.setCustomName2('a Businessman') + + commoner1 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_01.iff', 'tatooine', long(1082877), float(10.3), float(-0.9), float(2.7), float(0.42), float(0.91)) + commoner1.setCustomName2('a Commoner') + + entertainer1 = stcSvc.spawnObject('object/mobile/shared_dressed_entertainer_trainer_twk_female_01.iff', 'tatooine', long(1082877), float(9.4), float(-0.9), float(3.9), float(0.42), float(0.91)) + entertainer1.setCustomName2('an Entertainer') + + noble1 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_trandoshan_male_01.iff', 'tatooine', long(1082877), float(8.6), float(-0.9), float(4.8), float(0.42), float(0.91)) + noble1.setCustomName2('a Noble') + + commoner2 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_female_01.iff', 'tatooine', long(1082877), float(4.1), float(-0.9), float(5.7), float(0.42), float(0.91)) + commoner2.setCustomName2('a Commoner') + + commoner3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_female_01.iff', 'tatooine', long(1082877), float(3.1), float(-0.9), float(5.9), float(0.42), float(0.91)) + commoner3.setCustomName2('a Commoner') + + commoner4 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_twilek_male_01.iff', 'tatooine', long(1082877), float(1.7), float(-0.9), float(6.0), float(0.42), float(0.91)) + commoner4.setCustomName2('a Commoner') + + commoner5 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_bothan_male_01.iff', 'tatooine', long(1082877), float(-0.4), float(-0.9), float(5.9), float(0.42), float(0.91)) + commoner5.setCustomName2('a Commoner') + + commoner6 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_05.iff', 'tatooine', long(1082877), float(16.0), float(-0.9), float(4.1), float(0.42), float(0.91)) + commoner6.setCustomName2('a Commoner') + + commoner7 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_fat_zabrak_male_01.iff', 'tatooine', long(1082877), float(8.8), float(-0.9), float(-6.0), float(0.42), float(0.91)) + commoner7.setCustomName2('a Patron') + + commoner8 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_08.iff', 'tatooine', long(1082877), float(6.8), float(-0.9), float(-6.5), float(0.42), float(0.91)) + commoner8.setCustomName2('a Patron') + + commoner9 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_male_09.iff', 'tatooine', long(1082877), float(1.1), float(-0.9), float(-7.7), float(0.42), float(0.91)) + commoner9.setCustomName2('a Commoner') + + commoner10 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_nikto_male_04.iff', 'tatooine', long(1082877), float(2.1), float(-0.9), float(-8.4), float(0.42), float(0.91)) + commoner10.setCustomName2('a Commoner') + + #Starport Interior + + #City Hall Interior + + #Lucky Despot Interior + + #Medical Center Interior + + #Theater Interior + + #Miscellaneous Building Interiors + + #Outside + businessman2 = stcSvc.spawnObject('object/mobile/shared_dressed_businessman_human_male_01.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + businessman2.setCustomName2('a Businessman') + + noble2 = stcSvc.spawnObject('object/mobile/shared_dressed_noble_human_female_01.iff', 'tatooine', long(0), float(3542.3), float(5.0), float(-4826.0), float(0.42), float(0.91)) + noble2.setCustomName2('a Noble') + + commoner11 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_human_male_06.iff', 'tatooine', long(0), float(3529.1), float(5.0), float(-4900.4), float(0.42), float(0.91)) + commoner11.setCustomName2('a Commoner') + + businessman3 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_trandoshan_male_02.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + businessman3.setCustomName2('a Businessman') + + jawa1 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3663.3), float(5.0), float(-4858.6), float(0), float(0)) + jawa1.setCustomName2('a Jawa') + + commoner12 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_moncal_male_01.iff', 'tatooine', long(0), float(3532.7), float(5.0), float(-4788.1), float(0), float(0)) + commoner12.setCustomName2('a Scientist') + + commoner13 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_naboo_zabrak_female_02.iff', 'tatooine', long(0), float(3559.7), float(5.0), float(-4725.9), float(0), float(0)) + commoner13.setCustomName2('a Commoner') + + commoner14 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_devaronian_male_01.iff', 'tatooine', long(0), float(3527.7), float(5.0), float(-4721.1), float(0), float(0)) + commoner14.setCustomName2('a Commoner') + + commoner15 = stcSvc.spawnObject('object/mobile/shared_dressed_commoner_tatooine_aqualish_female_01.iff', 'tatooine', long(0), float(3513.7), float(5.0), float(-4740.4), float(0), float(0)) + commoner15.setCustomName2('a Commoner') + + ltHarburik = stcSvc.spawnObject('object/mobile/tatooine_npc/shared_lt_harburik.iff', 'tatooine', long(0), float(3485.4), float(5.0), float(-4788.1), float(0), float(0)) + ltHarburik.setCustomName2('Lieutenant Harburik') + + jawa2 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3475.4), float(5.0), float(-4852.7), float(0), float(0)) + jawa2.setCustomName2('a Jawa') + + jawa3 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3469.3), float(5.0), float(-4861.5), float(0), float(0)) + jawa3.setCustomName2('a Jawa') + + jawa4 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3486.1), float(5.0), float(-4884.7), float(0), float(0)) + jawa4.setCustomName2('a Jawa') + + jawa5 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3487.1), float(5.0), float(-4886.0), float(0), float(0)) + jawa5.setCustomName2('a Jawa') + + jawa6 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3488.8), float(5.0), float(-4884.4), float(0), float(0)) + jawa6.setCustomName2('a Jawa') + + jawa7 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3472.2), float(5.0), float(-4918.4), float(0), float(0)) + jawa7.setCustomName2('a Jawa') + + jawa8 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3471.4), float(5.0), float(-4919.5), float(0), float(0)) + jawa8.setCustomName2('a Jawa') + + jawa9 = stcSvc.spawnObject('object/mobile/shared_jawa.iff', 'tatooine', long(0), float(3470.3), float(5.0), float(-4918.7), float(0), float(0)) + jawa9.setCustomName2('a Jawa') + + bib = stcSvc.spawnObject('object/mobile/shared_bib_fortuna.iff', 'tatooine', long(0), float(3552.4), float(5.0), float(-4933.2), float(0), float(0)) + bib.setCustomName2('Bib Fortuna') + +# Mos Espa NPC Spawns +# Mos Entha NPC Spawns + +# Bestine NPC Spawns + +# Anchorhead NPC Spawns + +# Mos Taike NPC Spawns + +# Wayfar NPC Spawns + +# Jabba's Palace Theme Park Spawns + return \ No newline at end of file diff --git a/src/protocol/swg/ChatFriendsListUpdate.java b/src/protocol/swg/ChatFriendsListUpdate.java index b804c17b..bd6debb0 100644 --- a/src/protocol/swg/ChatFriendsListUpdate.java +++ b/src/protocol/swg/ChatFriendsListUpdate.java @@ -29,12 +29,8 @@ public class ChatFriendsListUpdate extends SWGMessage { @Override public IoBuffer serialize() { - Config config = new Config(); - config.setFilePath("nge.cfg"); - if (!(config.loadConfigFile())) { - config = DefaultConfig.getConfig(); - } - String serverName = config.getString("GALAXY_NAME"); + + String serverName = NGECore.getInstance().getConfig().getString("GALAXY_NAME"); IoBuffer result = IoBuffer.allocate(50 + friendName.length()).order(ByteOrder.LITTLE_ENDIAN); result.putShort((short) 3); diff --git a/src/protocol/swg/ChatOnGetFriendsList.java b/src/protocol/swg/ChatOnGetFriendsList.java index ae0d52df..3e497bf1 100644 --- a/src/protocol/swg/ChatOnGetFriendsList.java +++ b/src/protocol/swg/ChatOnGetFriendsList.java @@ -9,6 +9,7 @@ import org.apache.mina.core.buffer.IoBuffer; import resources.objects.player.PlayerObject; +// This is possibly unused public class ChatOnGetFriendsList extends SWGMessage { private List friendList; @@ -24,8 +25,7 @@ public class ChatOnGetFriendsList extends SWGMessage { } @Override public void deserialize(IoBuffer data) { - // XXX Auto-generated method stub - + } @Override @@ -51,7 +51,6 @@ public class ChatOnGetFriendsList extends SWGMessage { int size = buffer.position(); buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size); buffer.flip(); - //System.out.println("ChatOnGetFriendsList: " + buffer.getHexDump()); return buffer; } diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index 29254766..2493d3a7 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -22,12 +22,12 @@ package resources.objects.player; import java.nio.ByteOrder; +import java.util.List; import java.util.Map.Entry; import org.apache.mina.core.buffer.IoBuffer; import engine.resources.common.CRC; - import resources.objects.ObjectMessageBuilder; import resources.objects.waypoint.WaypointObject; @@ -251,7 +251,7 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { if(player.getFriendList().isEmpty()) { buffer.putInt(0); - buffer.putInt(0); + buffer.putInt(0); } else { buffer.putInt(player.getFriendList().size()); buffer.putInt(player.getFriendListUpdateCounter()); @@ -261,7 +261,6 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { for(String friend : player.getFriendList()) { buffer.put(getAsciiString(friend)); } - } } @@ -515,60 +514,70 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { } - public IoBuffer buildFriendAddDelta(String friend) { + public IoBuffer buildFriendAddDelta(List friends) { + + IoBuffer buffer = bufferPool.allocate(13 + (friends.size() * 2), false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); - IoBuffer buffer = bufferPool.allocate(13 + friend.length(), false).order(ByteOrder.LITTLE_ENDIAN); PlayerObject player = (PlayerObject) object; buffer.putInt(1); buffer.putInt(player.getFriendListUpdateCounter()); - buffer.put((byte) 1); // updateType (SubType) + buffer.put((byte) 3); // updateType (SubType) - buffer.putShort((short) player.getFriendList().indexOf(friend)); - buffer.put(getAsciiString(friend)); + buffer.putShort((short) (player.getFriendList().size())); + for (String f : friends) { + buffer.put(getAsciiString(f)); + } int size = buffer.position(); buffer.flip(); buffer = createDelta("PLAY", (byte) 9, (short) 1, (short) 7, buffer, size + 4); - - return buffer; - - } - - public IoBuffer buildFriendRemoveDelta(String friend) { - - IoBuffer buffer = bufferPool.allocate(11, false).order(ByteOrder.LITTLE_ENDIAN); - PlayerObject player = (PlayerObject) object; - - buffer.putInt(1); - buffer.putInt(player.getFriendListUpdateCounter()); - buffer.put((byte) 0); // updateType (SubType) + return buffer; - buffer.putShort((short) player.getFriendList().indexOf(friend)); + } + + public IoBuffer buildFriendRemoveDelta(List friends) { + + IoBuffer buffer = bufferPool.allocate(13 + (friends.size() * 2), false).order(ByteOrder.LITTLE_ENDIAN); + PlayerObject player = (PlayerObject) object; + + buffer.putInt(1); + buffer.putInt(player.getFriendListUpdateCounter()); + + buffer.put((byte) 3); // updateType (SubType) + + buffer.putShort((short) friends.size()); + for (String f : friends) { + buffer.put(getAsciiString(f)); + } int size = buffer.position(); buffer.flip(); buffer = createDelta("PLAY", (byte) 9, (short) 1, (short) 7, buffer, size + 4); - + return buffer; - } + - public IoBuffer buildIgnoreAddDelta(String ignoreName) { - IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN); + public IoBuffer buildIgnoreAddDelta(List ignoreList) { + IoBuffer buffer = bufferPool.allocate(13 + (ignoreList.size() * 2) , false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); PlayerObject player = (PlayerObject) object; buffer.putInt(1); buffer.putInt(player.getIgnoreListUpdateCounter()); - buffer.put((byte) 1); // updateType (SubType) + buffer.put((byte) 3); // updateType (SubType) - buffer.putShort((short) player.getIgnoreList().indexOf(ignoreName)); - buffer.put(getAsciiString(ignoreName)); + buffer.putShort((short) ignoreList.size()); + for (String ignore : ignoreList) { + buffer.put(getAsciiString(ignore)); + } int size = buffer.position(); buffer.flip(); @@ -578,15 +587,20 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { return buffer; } - public IoBuffer buildIgnoreRemoveDelta(String removeName) { - IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN); + public IoBuffer buildIgnoreRemoveDelta(List ignoreList) { + IoBuffer buffer = bufferPool.allocate(13 + (ignoreList.size() * 2) , false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); PlayerObject player = (PlayerObject) object; buffer.putInt(1); buffer.putInt(player.getIgnoreListUpdateCounter()); - buffer.put((byte) 0); - buffer.putShort((short) player.getIgnoreList().indexOf(removeName)); + buffer.put((byte) 3); // updateType (SubType) + + buffer.putShort((short) ignoreList.size()); + for (String ignore : ignoreList) { + buffer.put(getAsciiString(ignore)); + } int size = buffer.position(); buffer.flip(); diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 15758b21..44cd7b84 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -427,7 +427,7 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { setFriendListUpdateCounter(getFriendListUpdateCounter() + 1); friendList.add(friend); - getContainer().getClient().getSession().write(messageBuilder.buildFriendAddDelta(friend)); + getContainer().getClient().getSession().write(messageBuilder.buildFriendAddDelta(getFriendList())); } } @@ -435,7 +435,7 @@ public class PlayerObject extends IntangibleObject { synchronized(objectMutex) { setFriendListUpdateCounter(getFriendListUpdateCounter() + 1); friendList.remove(friend); - getContainer().getClient().getSession().write(messageBuilder.buildFriendRemoveDelta(friend)); + getContainer().getClient().getSession().write(messageBuilder.buildFriendRemoveDelta(getFriendList())); } } @@ -452,16 +452,16 @@ public class PlayerObject extends IntangibleObject { public void ignoreAdd(String ignoreName) { synchronized(objectMutex) { setIgnoreListUpdateCounter(getIgnoreListUpdateCounter() + 1); - getContainer().getClient().getSession().write(messageBuilder.buildIgnoreAddDelta(ignoreName)); ignoreList.add(ignoreName); + getContainer().getClient().getSession().write(messageBuilder.buildIgnoreAddDelta(getIgnoreList())); } } public void ignoreRemove(String removeName) { synchronized(objectMutex) { setIgnoreListUpdateCounter(getIgnoreListUpdateCounter() + 1); - getContainer().getClient().getSession().write(messageBuilder.buildIgnoreRemoveDelta(removeName)); ignoreList.remove(removeName); + getContainer().getClient().getSession().write(messageBuilder.buildIgnoreRemoveDelta(getIgnoreList())); } } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index a1fe700f..fcb47aef 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -147,6 +147,12 @@ public class TangibleObject extends SWGObject { } } + public boolean getOption(int option) { + synchronized(objectMutex) { + return ((optionsBitmask & option) == option); + } + } + public void addOption(int option) { setOptionsBitmask(getOptionsBitmask() | option); } diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 33e40de1..3f803056 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -461,5 +461,34 @@ public class CharacterService implements INetworkDispatch { } return characters; } + + /** + * Checks the database for if the name of the player exists. The name is + * formated automatically in the method for checking the database, so no conversion is required. + * @param name Name to check for in the database + * @return Returns True if the player exists + */ + public boolean playerExists(String name) { + if (!name.equals("")) { + if (name.contains(" ")) { + name = name.split(" ")[0]; + } + name = name.replace("'", "''"); + name = name.toLowerCase(); + try { + PreparedStatement ps = databaseConnection.preparedStatement("SELECT id FROM characters WHERE LOWER(\"firstName\")=?"); + ps.setString(1, name); + ResultSet resultSet = ps.executeQuery(); + + boolean isDuplicate = resultSet.next(); + resultSet.getStatement().close(); + if (isDuplicate) { return true; } + else { return false; } + } + + catch (SQLException e) { e.printStackTrace(); } + } + return false; + } } diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index 584bf73d..dc249362 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -189,6 +189,7 @@ public class ConnectionService implements INetworkDispatch { object.setInviteCounter(0); object.setInviteSenderId(0); object.setInviteSenderName(""); + core.groupService.handleGroupDisband(object); object.setClient(null); PlayerObject ghost = (PlayerObject) object.getSlottedObject("ghost"); diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index 9055579b..f96e0e2c 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -24,13 +24,16 @@ package services; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; + import org.python.core.Py; import org.python.core.PyObject; + import resources.objects.creature.CreatureObject; import main.NGECore; import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; +import resources.objects.player.PlayerObject; public class EquipmentService implements INetworkDispatch { @@ -50,26 +53,111 @@ public class EquipmentService implements INetworkDispatch { } + public void weaponCriticalToDisplay(CreatureObject actor, SWGObject item, boolean add) { + + if (add == true) { + + switch(item.getStringAttribute("cat_wpn_damage.wpn_category")) { + + case "Rifle": actor.addSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_rifle") * 100); // rifle + case "Carbine": actor.addSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_carbine") * 100); // carbine + case "Pistol": actor.addSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_pistol") * 100); // pistol + case "One-Handed Melee": actor.addSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_1h") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // one-handed + case "Two-Handed Melee": actor.addSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_2h") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // two-handed + case "Unarmed": actor.addSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_unarmed") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // unarmed + case "Polearm": actor.addSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_polearm") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // polearm + case "Free Targeting Heavy Weapon": actor.addSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_heavy") * 100); // Heavy + + + } + + } + + if (add == false) { + + switch(item.getStringAttribute("cat_wpn_damage.wpn_category")) { + + case "Rifle": actor.deductSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_rifle") * 100); // rifle + case "Carbine": actor.deductSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_carbine") * 100); // carbine + case "Pistol": actor.deductSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_pistol") * 100); // pistol + case "One-Handed Melee": actor.deductSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_1h") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // one-handed + case "Two-Handed Melee": actor.deductSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_2h") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // two-handed + case "Unarmed": actor.deductSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_unarmed") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // unarmed + case "Polearm": actor.deductSkillMod("display_only_critical", ((actor.getSkillModBase("expertise_critical_polearm") + actor.getSkillModBase("expertise_critical_melee")) * 100)); // polearm + case "Free Targeting Heavy Weapon": actor.deductSkillMod("display_only_critical", actor.getSkillModBase("expertise_critical_heavy") * 100); // Heavy + } + } + } + + public String getFormalProfessionName(String stfName) { + String formalName = ""; + + switch (stfName) { + case "force_sensitive_1a": formalName = "Jedi"; break; + case "bounty_hunter_1a": formalName = "Bounty Hunter"; break; + case "officer_1a": formalName = "Officer"; break; + case "smuggler_1a": formalName = "Smuggler"; break; + case "entertainer_1a": formalName = "Entertainer"; break; + case "spy_1a": formalName = "Spy"; break; + case "medic_1a": formalName = "Medic"; break; + case "commando_1a": formalName = "Commando"; break; + + default: formalName = "Trader"; break; // Ziggy: Trader profession names are a bit irregular, so this is used. + + } + return formalName; + } + + public boolean canEquip(CreatureObject actor, SWGObject item) { + boolean result = true; + + if (item.getStringAttribute("class_required") != null) { + String profession = ((PlayerObject) actor.getSlottedObject("ghost")).getProfession(); + if (item.getStringAttribute("class_required").contentEquals(getFormalProfessionName(profession))) { + result = true; + } else{ + return false; + } + } + + return result; + } + public void equip(CreatureObject actor, SWGObject item) { - //if(replacedItem != null) - // unequip(actor, replacedItem); - - String template = item.getTemplate(); + String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); String serverTemplate = template.replace(".iff", ""); PyObject func = core.scriptService.getMethod("scripts/" + serverTemplate.split("shared_" , 2)[0].replace("shared_", ""), serverTemplate.split("shared_" , 2)[1], "equip"); if(func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item)); - // TODO: add health/action bonus from crafted weapon with augmentations + // TODO: add health/action bonus from crafted weapon with augmentations (also seen with cybernetics) + // TODO: faction restrictions - You had to be a Combatant as minimum in order to EQUIP an item. + // TODO: Species restrictions + // TODO: Gender restrictions + // TODO: crit enhancement from crafted weapons + // TODO: Jedi robes Force Protection Intensity + // TODO: check for armor category in order to add resistance to certain DoT types + // TODO: Calculate actual armor values (REMINDER: Check if the player is wearing a jedi robe/cloak (look for force protection intensity). If they are, they shouldn't receive any additional protection from other items with armour.) + // TODO: bio-link (assign it by objectID with setAttachment and then just display it as a character name). + // TODO: item level requirement. if actorLevel >= itemLevel + // TODO: refactor equipable items that grant buffs. use setAttachment("itemBuff", "buffname") + + if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) + weaponCriticalToDisplay(actor, item, true); Map attributes = new TreeMap(item.getAttributes()); for(Entry e : attributes.entrySet()) { - if(e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) { core.skillModService.addSkillMod(actor, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) { + actor.setMaxHealth(actor.getMaxHealth() + Integer.parseInt((String) e.getValue())); + } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { + actor.setMaxAction(actor.getMaxAction() + Integer.parseInt((String) e.getValue())); + } } @@ -80,13 +168,14 @@ public class EquipmentService implements INetworkDispatch { public void unequip(CreatureObject actor, SWGObject item) { - String template = item.getTemplate(); + String template = ((item.getAttachment("customServerTemplate") == null) ? item.getTemplate() : (item.getTemplate().split("shared_")[0] + "shared_" + ((String) item.getAttachment("customServerTemplate")) + ".iff")); String serverTemplate = template.replace(".iff", ""); PyObject func = core.scriptService.getMethod("scripts/" + serverTemplate.split("shared_" , 2)[0].replace("shared_", ""), serverTemplate.split("shared_" , 2)[1], "unequip"); if(func != null) func.__call__(Py.java2py(core), Py.java2py(actor), Py.java2py(item)); - // TODO: remove health/action bonus from crafted weapon with augmentations + if (actor.getSlotNameForObject(item).contentEquals("hold_r") == true) + weaponCriticalToDisplay(actor, item, false); Map attributes = new TreeMap(item.getAttributes()); @@ -94,7 +183,13 @@ public class EquipmentService implements INetworkDispatch { if(e.getKey().startsWith("cat_skill_mod_bonus.@stat_n:")) { core.skillModService.deductSkillMod(actor, e.getKey().replace("cat_skill_mod_bonus.@stat_n:", ""), Integer.parseInt((String) e.getValue())); - } + } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_health")) { + actor.setMaxHealth(actor.getMaxHealth() - Integer.parseInt((String) e.getValue())); + } + if(e.getKey().startsWith("cat_attrib_mod_bonus.attr_action")) { + actor.setMaxAction(actor.getMaxAction() - Integer.parseInt((String) e.getValue())); + } } diff --git a/src/services/LoginService.java b/src/services/LoginService.java index 7f6ad1c7..d3713213 100644 --- a/src/services/LoginService.java +++ b/src/services/LoginService.java @@ -55,6 +55,7 @@ import protocol.swg.LoginEnumCluster; import protocol.swg.ServerNowEpochTime; import protocol.swg.StationIdHasJediSlot; import resources.common.*; +import resources.datatables.PlayerFlags; import resources.objects.creature.CreatureObject; @@ -176,26 +177,42 @@ public class LoginService implements INetworkDispatch{ data = data.order(ByteOrder.LITTLE_ENDIAN); data.position(0); - + DeleteCharacterMessage packet = new DeleteCharacterMessage(); packet.deserialize(data); Client client = core.getClient(session); - PreparedStatement preparedStatement; - - preparedStatement = databaseConnection1.preparedStatement("DELETE FROM characters WHERE \"id\"=? AND \"galaxyId\"=? AND \"accountId\"=?"); - preparedStatement.setLong(1, packet.getcharId()); - preparedStatement.setInt(2, packet.getgalaxyId()); - preparedStatement.setInt(3, (int) client.getAccountId()); - boolean resultSet = preparedStatement.execute(); - //TODO: send deletecharacter failed - if(!resultSet) { - core.getCreatureODB().delete(new Long(packet.getcharId()), Long.class, CreatureObject.class); - DeleteCharacterReplyMessage reply = new DeleteCharacterReplyMessage(0); - session.write(reply.serialize()); - } - preparedStatement.close(); - + PreparedStatement preparedStatement; + + preparedStatement = databaseConnection1.preparedStatement("DELETE FROM characters WHERE \"id\"=? AND \"galaxyId\"=? AND \"accountId\"=?"); + preparedStatement.setLong(1, packet.getcharId()); + preparedStatement.setInt(2, packet.getgalaxyId()); + preparedStatement.setInt(3, (int) client.getAccountId()); + boolean resultSet = preparedStatement.execute(); + + //TODO: send deletecharacter failed + if(!resultSet) { + CreatureObject object = core.objectService.getObject(packet.getcharId()); + + if (object != null) { + if (object.isInQuadtree() && object.getClient() != null) { + core.connectionService.disconnect(object.getClient().getSession()); + } + + if (object.isInQuadtree()) { + core.simulationService.remove(object, object.getPosition().x, object.getPosition().z, true); + } + + core.objectService.destroyObject(object); + } + + core.getCreatureODB().delete(new Long(packet.getcharId()), Long.class, CreatureObject.class); + DeleteCharacterReplyMessage reply = new DeleteCharacterReplyMessage(0); + session.write(reply.serialize()); + } + + preparedStatement.close(); + } }); diff --git a/src/services/StaticService.java b/src/services/StaticService.java index e8e72860..a0447d0a 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -55,6 +55,7 @@ public class StaticService implements INetworkDispatch { spawnPlanetStaticObjs("rori"); spawnPlanetStaticObjs("naboo"); spawnPlanetStaticObjs("tatooine"); + spawnPlanetStaticObjs("lok"); } @Override diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index fd941cd3..0a68ab4c 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -339,8 +339,7 @@ public class ChatService implements INetworkDispatch { ConcurrentHashMap clients = core.getActiveConnectionsMap(); for(Client client : clients.values()) { - - + if(client.getParent() == null) continue; @@ -360,128 +359,113 @@ public class ChatService implements INetworkDispatch { } public void removeFriend(PlayerObject actor, String friendName) { + CreatureObject creature = (CreatureObject) actor.getContainer(); + friendName = friendName.split(" ")[0].toLowerCase(); - friendName = friendName.toLowerCase(); - - //SWGObject friendObject = getObjectByFirstName(friendName); - - if (actor == null || actor.getContainer() == null) + if (actor == null || creature == null || friendName.equals("")) return; - List friendList = actor.getFriendList(); - - if(friendList.contains(friendName)) { - - actor.friendRemove(friendName); - - ChatOnChangeFriendStatus removeMessage = new ChatOnChangeFriendStatus(actor.getContainer().getObjectID(), friendName, 0); - actor.getContainer().getClient().getSession().write(removeMessage.serialize()); - - ChatOnGetFriendsList sendFriendsList = new ChatOnGetFriendsList(actor); - actor.getContainer().getClient().getSession().write(sendFriendsList.serialize()); - + if(actor.getFriendList().contains(friendName)) { + ChatOnChangeFriendStatus removeMessage = new ChatOnChangeFriendStatus(actor.getContainer().getObjectID(), friendName, 0); + creature.getClient().getSession().write(removeMessage.serialize()); + + actor.friendRemove(friendName); + } else { + creature.sendSystemMessage(friendName + " is not a valid friend name.", (byte) 0); } } - public void addFriend(PlayerObject actor, String friendName, boolean notify) { - // ChatOnAddFriend, ChatOnChangeFriendStatus, ChatFriendsListUpdate, ChatSystemMessage, ChatOnGetFriendsList - SWGObject friendObject = getObjectByFirstName(friendName); + public void addFriend(PlayerObject actor, String friend) { + CreatureObject creature = (CreatureObject) actor.getContainer(); - PlayerObject friend = (PlayerObject) friendObject.getSlottedObject("ghost"); - CreatureObject friendCreature = (CreatureObject) friend.getContainer(); - List friendList = actor.getFriendList(); - - if (actor == null || friendObject.getSlottedObject("ghost") == null) + if (actor == null || creature == null || friend.equals("")) return; - CreatureObject actorCreature = (CreatureObject) actor.getContainer(); - if (actorCreature == null) - return; + friend = friend.toLowerCase(); - boolean friendIsOnline = friendObject.isInQuadtree(); - - String friendShortName = friendCreature.getCustomName().toLowerCase(); - - if (friendCreature.getCustomName().contains(" ")) { - String[] splitName = friendCreature.getCustomName().toLowerCase().split(" "); - friendShortName = splitName[0]; + if (friend.contains(" ")) { + friend = friend.split(" ")[0]; } - if (friendList.contains(friendShortName)) { - actorCreature.sendSystemMessage(friendShortName + " is already on your friends list.", (byte) 0); - return; - } - - - - if (notify) { - ChatOnAddFriend init = new ChatOnAddFriend(); - actorCreature.getClient().getSession().write(init.serialize()); + if(core.characterService.playerExists(friend)) { - ChatOnChangeFriendStatus addMessage = new ChatOnChangeFriendStatus(actorCreature.getObjectID(), friendShortName, 1); - actorCreature.getClient().getSession().write(addMessage.serialize()); - - if(friendIsOnline) { - ChatFriendsListUpdate updateStatus = new ChatFriendsListUpdate(friendShortName, (byte)1); - actorCreature.getClient().getSession().write(updateStatus.serialize()); + if(actor.getIgnoreList().contains(friend)) { + creature.sendSystemMessage(friend + " is being ignored, unable to put in your friends list.", (byte) 0); } - } + + SWGObject friendObj = getObjectByFirstName(friend); + boolean isOnline = false; + + if (friendObj != null && friendObj.isInQuadtree()) + isOnline = true; + + ChatOnAddFriend init = new ChatOnAddFriend(); + creature.getClient().getSession().write(init.serialize()); - actor.friendAdd(friendShortName); - - if (actor.getFriendList().size() != 0) { - ChatOnGetFriendsList sendFriendsList = new ChatOnGetFriendsList(actor); - actorCreature.getClient().getSession().write(sendFriendsList.serialize()); + ChatOnChangeFriendStatus addFriend = new ChatOnChangeFriendStatus(creature.getObjectId(), friend, 1); + creature.getClient().getSession().write(addFriend.serialize()); + + if (isOnline) { + ChatFriendsListUpdate onlineUpdate = new ChatFriendsListUpdate(friend, (byte) 1); + creature.getClient().getSession().write(onlineUpdate.serialize()); + } + + actor.friendAdd(friend); + creature.sendSystemMessage(friend + " is now your friend.", (byte) 0); + + } else { + creature.sendSystemMessage(friend + " is not a valid friend name.", (byte) 0); } - - actorCreature.sendSystemMessage(friendShortName + " has been added to your friends list.", (byte) 0); - - } public void addToIgnoreList(SWGObject actor, String ignoreName) { + ignoreName = ignoreName.split(" ")[0].toLowerCase(); + if (actor == null) + return; + PlayerObject ghost = (PlayerObject) actor.getSlottedObject("ghost"); CreatureObject creature = (CreatureObject) actor; - List ignoreList = ghost.getIgnoreList(); - if (ignoreList.contains(ignoreName.toLowerCase())) { + if(ghost == null) + return; + + if (ghost.getIgnoreList().contains(ignoreName)) { creature.sendSystemMessage(ignoreName + " is already in your ignore list.", (byte) 0); return; - } else { - // TODO: Do check for valid names to ignore - - AddIgnoreMessage addIgnore = new AddIgnoreMessage(actor, ignoreName.toLowerCase(), true); - actor.getClient().getSession().write(addIgnore.serialize()); - Console.println("Sent the add ignore message!"); - ghost.ignoreAdd(ignoreName.toLowerCase()); - Console.println("Sent the add ignore delta!"); - creature.sendSystemMessage(ignoreName + " is now ignored.", (byte) 0); } + + if(!core.characterService.playerExists(ignoreName)) { + creature.sendSystemMessage(ignoreName + " is not a valid ignore name.", (byte) 0); + return; + } + + AddIgnoreMessage addIgnore = new AddIgnoreMessage(actor, ignoreName, true); + actor.getClient().getSession().write(addIgnore.serialize()); + ghost.ignoreAdd(ignoreName); + + creature.sendSystemMessage(ignoreName + " is now ignored.", (byte) 0); } public void removeFromIgnoreList(SWGObject actor, String ignoreName) { + if (actor == null) + return; + PlayerObject ghost = (PlayerObject) actor.getSlottedObject("ghost"); CreatureObject creature = (CreatureObject) actor; - List ignoreList = ghost.getIgnoreList(); - if (ignoreList.contains(ignoreName.toLowerCase())) { - for (String name : ignoreList) { - if(name.equalsIgnoreCase(ignoreName)) { - //Console.println("Name found!"); - AddIgnoreMessage removeIgnore = new AddIgnoreMessage(actor, ignoreName.toLowerCase(), false); - actor.getClient().getSession().write(removeIgnore.serialize()); - //Console.println("Sent AddIgnoreMessage to remove friend!"); - ghost.ignoreRemove(ignoreName.toLowerCase()); - //Console.println("Sent ignoreRemove delta!"); - creature.sendSystemMessage(ignoreName + " is no longer ignored.", (byte) 0); - - // TODO: Find out why player must click on name twice in list for name to be removed. - break; - } - } - } else { return; } + if (ghost == null || creature == null) + return; + + if (ghost.getIgnoreList().contains(ignoreName)) { + AddIgnoreMessage message = new AddIgnoreMessage(actor, ignoreName, false); + creature.getClient().getSession().write(message.serialize()); + + ghost.ignoreRemove(ignoreName); + + creature.sendSystemMessage(ignoreName + " is no longer ignored.", (byte) 0); + } } public void sendPersistentMessageHeader(Client client, Mail mail) { diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index b36e9bcc..9e4d2ba2 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -673,7 +673,7 @@ public class CombatService implements INetworkDispatch { if(r <= missChance) return HitType.MISS; } - float dodgeChance = (float) target.getSkillModBase("display_only_dodge") / 10000; + float dodgeChance = (float) (target.getSkillModBase("display_only_dodge") - attacker.getSkillModBase("display_only_opp_dodge_reduction")) / 10000; r = random.nextFloat(); if(r <= dodgeChance) @@ -683,7 +683,7 @@ public class CombatService implements INetworkDispatch { WeaponObject weapon2 = (WeaponObject) core.objectService.getObject(((CreatureObject) target).getWeaponId()); if(weapon2 != null && weapon2.isMelee()) { - float parryChance = (float) target.getSkillModBase("display_only_parry") / 10000; + float parryChance = (float) (target.getSkillModBase("display_only_parry") - attacker.getSkillModBase("display_only_parry_reduction"))/ 10000; r = random.nextFloat(); if(r <= parryChance) @@ -699,9 +699,23 @@ public class CombatService implements INetworkDispatch { } - float critChance = (float) (attacker.getSkillModBase("display_only_critical") - target.getSkillModBase("display_only_expertise_critical_hit_reduction")) / 10000; + float critChance = 0; + + critChance += (command.getCriticalChance()); + + critChance += ((float) attacker.getSkillModBase("display_only_critical") / 100); + + critChance -= ((float) target.getSkillModBase("display_only_expertise_critical_hit_reduction") / 100); + + critChance += ((float) target.getSkillModBase("critical_hit_vulnerable") / 100); + + if(target.isPlayer()) + critChance += attacker.getSkillModBase("expertise_critical_niche_pvp"); + critChance -= ((float) target.getSkillModBase("display_only_expertise_critical_hit_pvp_reduction") / 100); + r = random.nextFloat(); - if(r <= critChance) + + if(r <= ((float) critChance / 100)) return HitType.CRITICAL; // TODO: Punishing blow once AI is implemented @@ -715,7 +729,7 @@ public class CombatService implements INetworkDispatch { float r; Random random = new Random(); - float blockChance = (float) target.getSkillModBase("display_only_block") / 10000; + float blockChance = (float) (target.getSkillModBase("display_only_block") - attacker.getSkillModBase("display_only_opp_block_reduction"))/ 10000; r = random.nextFloat(); if(r <= blockChance) diff --git a/src/services/command/CombatCommand.java b/src/services/command/CombatCommand.java index 444d0895..a1559418 100644 --- a/src/services/command/CombatCommand.java +++ b/src/services/command/CombatCommand.java @@ -78,6 +78,7 @@ public class CombatCommand extends BaseSWGCommand { private float executeTime; private float warmupTime; private float vigorCost; // for commando kill meter and bm specials + private float criticalChance; public CombatCommand(String commandName) { super(commandName); @@ -705,6 +706,14 @@ public class CombatCommand extends BaseSWGCommand { public void setVigorCost(float vigorCost) { this.vigorCost = vigorCost; } + + public float getCriticalChance() { + return criticalChance; + } + + public void setCriticalChance(float criticalChance) { + this.criticalChance = criticalChance; + } diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 28160104..e6dc3bb5 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -609,8 +609,8 @@ public class ObjectService implements INetworkDispatch { PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost"); - ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost); - client.getSession().write(friendsListMessage.serialize()); + //ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost); + //client.getSession().write(friendsListMessage.serialize()); if (ghost != null) { ghost.clearFlagBitmask(PlayerFlags.LD); @@ -623,19 +623,19 @@ public class ObjectService implements INetworkDispatch { core.chatService.playerStatusChange(objectShortName, (byte) 1); - if (ghost.getFriendList().isEmpty() == false) { + if (!ghost.getFriendList().isEmpty()) { + // Find out what friends are online/offline for (String friend : ghost.getFriendList()) { - SWGObject friendObject = (SWGObject) core.chatService.getObjectByFirstName(friend); - if (friendObject == null) - continue; - if(friendObject.isInQuadtree() == true) { + SWGObject friendObject = core.chatService.getObjectByFirstName(friend); + + if(friendObject != null && friendObject.isInQuadtree()) { ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 1); client.getSession().write(onlineNotifyStatus.serialize()); } else { - ChatOnChangeFriendStatus changeStatus = new ChatOnChangeFriendStatus(creature.getObjectID(), friend, 0); - client.getSession().write(changeStatus.serialize()); + ChatFriendsListUpdate onlineNotifyStatus = new ChatFriendsListUpdate(friend, (byte) 0); + client.getSession().write(onlineNotifyStatus.serialize()); } } } diff --git a/src/services/trade/TradeService.java b/src/services/trade/TradeService.java index d1bd7b26..e425d282 100644 --- a/src/services/trade/TradeService.java +++ b/src/services/trade/TradeService.java @@ -202,8 +202,7 @@ public class TradeService implements INetworkDispatch{ } else { - - if (objectToTrade.getIntAttribute("no_trade") == 1) { + if(objectToTrade.getAttributes().toString().contains("no_trade")) { return; } diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index 5165e79c..488ae1e7 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -25,6 +25,7 @@ import java.nio.ByteOrder; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Random; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; @@ -42,6 +43,8 @@ import engine.clients.Client; import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import main.NGECore; @@ -319,7 +322,23 @@ public class TravelService implements INetworkDispatch { public void doTransport(SWGObject actor, TravelPoint tp) { Planet planet = core.terrainService.getPlanetByName(tp.getPlanetName()); - core.simulationService.transferToPlanet(actor, planet, tp.getSpawnLocation().getPosition(), tp.getSpawnLocation().getOrientation(), null); + + Random ran = new Random(); + + float oY = tp.getShuttle().getOrientation().y; + float dirDg = (float) ((Math.acos(oY) * 180 / Math.PI) * 2); + + ran.setSeed(32); + dirDg = dirDg - 18 + ran.nextFloat(); + float dirRadian = (float) (dirDg * Math.PI / 180); + ran.setSeed(3); + float distance = 13 + ran.nextFloat(); + + float x = (float) (tp.getSpawnLocation().getPosition().x + Math.sin(dirRadian) * distance); + float y = (float) (tp.getSpawnLocation().getPosition().y + Math.cos(dirRadian) * distance); + + Point3D spawnPoint = new Point3D(x, y, tp.getSpawnLocation().getPosition().z); + core.simulationService.transferToPlanet(actor, planet, spawnPoint, new Quaternion(0, 0, 0, 0), null); }