Merge remote-tracking branch 'origin/master'

This commit is contained in:
Woah 2021-03-11 00:07:27 -05:00
commit 6558990151
6 changed files with 32 additions and 9 deletions

View file

@ -1,6 +1,7 @@
package core.game.content.dialogue;
import core.cache.def.impl.NPCDefinition;
import core.game.container.impl.EquipmentContainer;
import core.plugin.Initializable;
import core.game.node.entity.skill.agility.AgilityHandler;
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.plugin.Plugin;
import core.plugin.PluginManager;
import core.tools.Items;
import static core.tools.stringtools.StringToolsKt.colorize;
/**
* The dialogue plugin used for the rug merchant.
@ -147,8 +151,12 @@ public final class RugMerchantDialogue extends DialoguePlugin {
return;
}
destination = options.length == 1 ? options[0] : options[buttonId - 1];
if (player.getInventory().remove(new Item(995, 200))) {
destination.travel(current, player);
if(player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null){
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();
break;
@ -272,6 +280,9 @@ public final class RugMerchantDialogue extends DialoguePlugin {
player.lock();
player.getConfigManager().set(499, 0);
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) {
int count;
int index;
@ -300,11 +311,13 @@ public final class RugMerchantDialogue extends DialoguePlugin {
break;
case 4:
player.getConfigManager().set(499, 1);
player.animate(FLOATING_ANIMATION);
break;
case 200:
break;
case 901:
player.getEquipment().replace(null,EquipmentContainer.SLOT_WEAPON);
player.getInterfaceManager().restoreTabs();
player.getPacketDispatch().sendInterfaceConfig(548,69,false);
player.getImpactHandler().setDisabledTicks(0);
player.unlock();
player.animate(new Animation(-1));
@ -319,7 +332,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
break;
}
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;
}

View file

@ -21,7 +21,7 @@ public final class EmptyOptionPlugin extends OptionHandler {
public static final String BUCKET_EMPTY_MSG = "You empty the contents of the bucket onto the floor.";
@Override
public boolean handle(Player player, Node node, String option) {
if (node.getName().contains("potion")) {
if (node.getName().contains("potion") || node.getName().toLowerCase().contains("antipoison")) {
player.getInventory().remove(node.asItem());
player.getInventory().add(EmptyItem.getEmpty(91));
return true;

View file

@ -30,6 +30,9 @@ public final class PlayerParser {
if (JSON.exists()) { //parse the new JSON type.
new PlayerSaveParser(player).parse();
} else { //Create new save
if(!(new File(ServerConstants.PLAYER_SAVE_PATH + "template/template.json")).exists()){
return true;
}
makeFromTemplate(player);
new PlayerSaveParser(player).parse();
}

View file

@ -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.
* @param player The player.
@ -236,19 +240,19 @@ public final class AgilityHandler {
* @param experience The agility experience.
* @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)) {
player.getPulseManager().run(new MovementPulse(player, start) {
@Override
public boolean pulse() {
walk(player, courseIndex, start, end, animation, experience, message);
walk(player, courseIndex, start, end, animation, experience, message, infiniteRun);
return true;
}
}, "movement");
return;
}
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();
player.getImpactHandler().setDisabledTicks(ticks);
player.lock(1 + ticks);
@ -259,6 +263,7 @@ public final class AgilityHandler {
if (animation != null) {
player.getAppearance().setAnimations(animation);
}
player.getSettings().setRunEnergy(100.0);
GameWorld.getPulser().submit(new Pulse(ticks, player) {
@Override
public boolean pulse() {

View file

@ -12,7 +12,7 @@ public enum FinishedPotion {
STRENGTH_POTION(UnfinishedPotion.TARROMIN, new Item(225), 12, 50, new Item(115)),
RESTORE_POTION(UnfinishedPotion.HARRALANDER, new Item(223), 22, 62.5, new Item(127)),
ENERGY_POTION(UnfinishedPotion.HARRALANDER, new Item(1975), 26, 67.5, new Item(3010)),
DEFENCE_POTION(UnfinishedPotion.MARRENTILL, new Item(6814), 30, 45, new Item(133)),
DEFENCE_POTION(UnfinishedPotion.RANARR, new Item(6814), 30, 45, new Item(133)),
AGILITY_POTION(UnfinishedPotion.TOADFLAX, new Item(2152), 34, 80, new Item(3034)),
COMBAT_POTION(UnfinishedPotion.HARRALANDER, new Item(9736), 36, 84, new Item(9741)),
PRAYER_POTION(UnfinishedPotion.RANARR, new Item(231), 38, 87.5, new Item(139)),

View file

@ -5,6 +5,7 @@ import core.cache.def.impl.ItemDefinition
import core.cache.def.impl.ObjectDefinition
import core.cache.def.impl.VarbitDefinition
import core.game.component.Component
import core.game.container.impl.EquipmentContainer
import core.game.node.`object`.GameObject
import core.game.node.entity.player.info.Rights
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.state.newsys.states.FarmingState
import core.tools.Components
import core.tools.Items
import core.tools.stringtools.colorize
import java.awt.Toolkit
import java.awt.datatransfer.StringSelection