mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
magic carpet + save template fix
This commit is contained in:
parent
4f7b9bac57
commit
6401d30b79
4 changed files with 30 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package core.game.content.dialogue;
|
package core.game.content.dialogue;
|
||||||
|
|
||||||
import core.cache.def.impl.NPCDefinition;
|
import core.cache.def.impl.NPCDefinition;
|
||||||
|
import core.game.container.impl.EquipmentContainer;
|
||||||
import core.plugin.Initializable;
|
import core.plugin.Initializable;
|
||||||
import core.game.node.entity.skill.agility.AgilityHandler;
|
import core.game.node.entity.skill.agility.AgilityHandler;
|
||||||
import core.game.interaction.OptionHandler;
|
import core.game.interaction.OptionHandler;
|
||||||
|
|
@ -14,6 +15,9 @@ import core.game.world.map.Location;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
import core.plugin.PluginManager;
|
import core.plugin.PluginManager;
|
||||||
|
import core.tools.Items;
|
||||||
|
|
||||||
|
import static core.tools.stringtools.StringToolsKt.colorize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dialogue plugin used for the rug merchant.
|
* The dialogue plugin used for the rug merchant.
|
||||||
|
|
@ -147,8 +151,12 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
destination = options.length == 1 ? options[0] : options[buttonId - 1];
|
destination = options.length == 1 ? options[0] : options[buttonId - 1];
|
||||||
if (player.getInventory().remove(new Item(995, 200))) {
|
if(player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null){
|
||||||
destination.travel(current, player);
|
player.sendMessage(colorize("%RYou must unequip all your weapons before you can fly on a carpet."));
|
||||||
|
} else {
|
||||||
|
if (player.getInventory().remove(new Item(995, 200))) {
|
||||||
|
destination.travel(current, player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
end();
|
end();
|
||||||
break;
|
break;
|
||||||
|
|
@ -272,6 +280,9 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||||
player.lock();
|
player.lock();
|
||||||
player.getConfigManager().set(499, 0);
|
player.getConfigManager().set(499, 0);
|
||||||
player.getImpactHandler().setDisabledTicks(GameWorld.getTicks() + 200);
|
player.getImpactHandler().setDisabledTicks(GameWorld.getTicks() + 200);
|
||||||
|
player.getInterfaceManager().hideTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13);
|
||||||
|
player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
|
||||||
|
player.getPacketDispatch().sendInterfaceConfig(548,69,true);
|
||||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||||
int count;
|
int count;
|
||||||
int index;
|
int index;
|
||||||
|
|
@ -300,11 +311,13 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
player.getConfigManager().set(499, 1);
|
player.getConfigManager().set(499, 1);
|
||||||
player.animate(FLOATING_ANIMATION);
|
|
||||||
break;
|
break;
|
||||||
case 200:
|
case 200:
|
||||||
break;
|
break;
|
||||||
case 901:
|
case 901:
|
||||||
|
player.getEquipment().replace(null,EquipmentContainer.SLOT_WEAPON);
|
||||||
|
player.getInterfaceManager().restoreTabs();
|
||||||
|
player.getPacketDispatch().sendInterfaceConfig(548,69,false);
|
||||||
player.getImpactHandler().setDisabledTicks(0);
|
player.getImpactHandler().setDisabledTicks(0);
|
||||||
player.unlock();
|
player.unlock();
|
||||||
player.animate(new Animation(-1));
|
player.animate(new Animation(-1));
|
||||||
|
|
@ -319,7 +332,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (index == 0 || player.getLocation().equals(locs[index - 1])) {
|
if (index == 0 || player.getLocation().equals(locs[index - 1])) {
|
||||||
AgilityHandler.forceWalk(player, -1, player.getLocation(), locs[index++], FLOATING_ANIMATION, 40, 0.0, null);
|
AgilityHandler.walk(player,-1,player.getLocation(),locs[index++],null,0.0,null,true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ public final class PlayerParser {
|
||||||
if (JSON.exists()) { //parse the new JSON type.
|
if (JSON.exists()) { //parse the new JSON type.
|
||||||
new PlayerSaveParser(player).parse();
|
new PlayerSaveParser(player).parse();
|
||||||
} else { //Create new save
|
} else { //Create new save
|
||||||
|
if(!(new File(ServerConstants.PLAYER_SAVE_PATH + "template/template.json")).exists()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
makeFromTemplate(player);
|
makeFromTemplate(player);
|
||||||
new PlayerSaveParser(player).parse();
|
new PlayerSaveParser(player).parse();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,10 @@ public final class AgilityHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message){
|
||||||
|
walk(player,courseIndex,start,end,animation,experience,message,false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses the walking queue to walk across an obstacle.
|
* Uses the walking queue to walk across an obstacle.
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
|
|
@ -236,19 +240,19 @@ public final class AgilityHandler {
|
||||||
* @param experience The agility experience.
|
* @param experience The agility experience.
|
||||||
* @param message The message to send upon completion.
|
* @param message The message to send upon completion.
|
||||||
*/
|
*/
|
||||||
public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message) {
|
public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message, final boolean infiniteRun) {
|
||||||
if (!player.getLocation().equals(start)) {
|
if (!player.getLocation().equals(start)) {
|
||||||
player.getPulseManager().run(new MovementPulse(player, start) {
|
player.getPulseManager().run(new MovementPulse(player, start) {
|
||||||
@Override
|
@Override
|
||||||
public boolean pulse() {
|
public boolean pulse() {
|
||||||
walk(player, courseIndex, start, end, animation, experience, message);
|
walk(player, courseIndex, start, end, animation, experience, message, infiniteRun);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}, "movement");
|
}, "movement");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.getWalkingQueue().reset();
|
player.getWalkingQueue().reset();
|
||||||
player.getWalkingQueue().addPath(end.getX(), end.getY(), true);
|
player.getWalkingQueue().addPath(end.getX(), end.getY(), !infiniteRun);
|
||||||
int ticks = player.getWalkingQueue().getQueue().size();
|
int ticks = player.getWalkingQueue().getQueue().size();
|
||||||
player.getImpactHandler().setDisabledTicks(ticks);
|
player.getImpactHandler().setDisabledTicks(ticks);
|
||||||
player.lock(1 + ticks);
|
player.lock(1 + ticks);
|
||||||
|
|
@ -259,6 +263,7 @@ public final class AgilityHandler {
|
||||||
if (animation != null) {
|
if (animation != null) {
|
||||||
player.getAppearance().setAnimations(animation);
|
player.getAppearance().setAnimations(animation);
|
||||||
}
|
}
|
||||||
|
player.getSettings().setRunEnergy(100.0);
|
||||||
GameWorld.getPulser().submit(new Pulse(ticks, player) {
|
GameWorld.getPulser().submit(new Pulse(ticks, player) {
|
||||||
@Override
|
@Override
|
||||||
public boolean pulse() {
|
public boolean pulse() {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import core.cache.def.impl.ItemDefinition
|
||||||
import core.cache.def.impl.ObjectDefinition
|
import core.cache.def.impl.ObjectDefinition
|
||||||
import core.cache.def.impl.VarbitDefinition
|
import core.cache.def.impl.VarbitDefinition
|
||||||
import core.game.component.Component
|
import core.game.component.Component
|
||||||
|
import core.game.container.impl.EquipmentContainer
|
||||||
import core.game.node.`object`.GameObject
|
import core.game.node.`object`.GameObject
|
||||||
import core.game.node.entity.player.info.Rights
|
import core.game.node.entity.player.info.Rights
|
||||||
import core.game.node.entity.player.link.RunScript
|
import core.game.node.entity.player.link.RunScript
|
||||||
|
|
@ -26,6 +27,7 @@ import core.game.ge.OfferState
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
import core.game.node.entity.state.newsys.states.FarmingState
|
import core.game.node.entity.state.newsys.states.FarmingState
|
||||||
import core.tools.Components
|
import core.tools.Components
|
||||||
|
import core.tools.Items
|
||||||
import core.tools.stringtools.colorize
|
import core.tools.stringtools.colorize
|
||||||
import java.awt.Toolkit
|
import java.awt.Toolkit
|
||||||
import java.awt.datatransfer.StringSelection
|
import java.awt.datatransfer.StringSelection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue