Files
2009scape/Server/src/main/content/global/handlers/iface/GlassInterface.java
T
Zerken cef956722a Implemented water filling sounds for filling water vessels from all water sources
Implemented specific bucket water filling sound when filling from a well
Implemented emptying sounds for emptying vessels
Implemented cow milking sound
Implemented sound when smelting at a furnace
Implemented sound when smelting cannonballs at a furnace
Implemented sound when glassblowing
Fixed herb cleaning sound
Fixed regular wood door opening and closing sounds
Implemented metal door/gate opening and closing sounds
Implemented fence opening and closing sounds
Added Camelot castle main gate in door_configs.json
Fixed Sinclair mansion main gate to be a metal type door in door_configs.json
Implemented drinking sound when drinking from a waterskin in the desert
Implemented desert magic carpet travel take off and landing sound
Implemented desert magic carpet travel jingle/music
Fence around Falador cow farm is now properly identified as a fence and opens correctly
Fence id 34780 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 8810 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 2050-2051 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 1553 now has the correct open id in door_configs.json so it opens correctly
Fixed music tracks Relleka(289), Saga(290), and Borderlands(291) so they now play in their correct locations
Implemented jingle/music for sailing/chartering a ship(Trader crewmembers)
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Karamja
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Entrana
Implemented jingle/music for sailing/chartering a ship from/to Relleka/Neitiznot
Implemented jingle/music for sailing/chartering a ship from/to Relleka/Jatizso
Implemented jingle/music for sailing/chartering a ship from/to Ardougne/Brimmhaven
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Pest control
Fixed the music player to be more authentic. Now when songs end they will repeat instead of playing a random inauthentic song. The loop function now works correctly so the currently playing song will play endlessly without changing as the player moves.
Implemented playJingle function in contentAPI.kt
2023-06-21 14:57:01 +00:00

121 lines
3.3 KiB
Java

package content.global.handlers.iface;
import static core.api.ContentAPIKt.*;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.node.entity.player.Player;
import core.game.node.entity.skill.Skills;
import content.global.skill.crafting.GlassProduct;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
import kotlin.Unit;
import org.rs09.consts.Sounds;
/**
* Represents the glass making interface plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class GlassInterface extends ComponentPlugin {
/**
* Represents the animation to use.
*/
private static final Animation ANIMATION = new Animation(884);
/**
* Represents the molten glass item.
*/
private static final Item MOLTEN_GLASS = new Item(1775);
/**
* Represents the soda ash item.
*/
private static final Item SODA_ASH = new Item(1781, 1);
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ComponentDefinition.put(542, this);
return this;
}
@Override
public boolean handle(final Player p, Component component, int opcode, int button, int slot, int itemId) {
final GlassProduct def = GlassProduct.forId(button);
if (def == null) {
return true;
}
if (!p.getInventory().contains(1785, 1)) {
p.getPacketDispatch().sendMessage("You need a glassblowing pipe to do this.");
return true;
}
if (!p.getInventory().contains(1775, 1)) {
p.getPacketDispatch().sendMessage("You need molten glass to do this.");
return true;
}
if (p.getSkills().getLevel(Skills.CRAFTING) < def.getLevel()) {
p.getPacketDispatch().sendMessage("You need a crafting level of " + def.getLevel() + " to make this.");
return true;
}
int real = -1;
switch (opcode) {
case 230:
real = 1;
break;
case 205:
real = 5;
break;
case 127:
real = p.getInventory().getAmount(MOLTEN_GLASS);
break;
case 211:
sendInputDialogue(p, true, "Enter the amount:", (value) -> {
make(p, def, (int) value);
return Unit.INSTANCE;
});
break;
}
if (opcode == 211) {
return true;
}
make(p, def, real);
return true;
}
/**
* Method used to make a glass product.
* @param player the player.
* @param glass the glass.
* @param amount the amount.
*/
public static void make(final Player player, final GlassProduct glass, final int amount) {
player.getInterfaceManager().close();
player.animate(ANIMATION);
player.getPulseManager().clear();
player.getPulseManager().run(new Pulse(2, player) {
int amt = amount;
@Override
public boolean pulse() {
if (!player.getInventory().contains(1775, 1) || amt == 0) {
return true;
}
player.animate(ANIMATION);
player.getAudioManager().send(Sounds.GLASSBLOWING_2724);
player.getInventory().remove(MOLTEN_GLASS);
player.getInventory().add(new Item(glass.getProduct(), 1));
player.getSkills().addExperience(Skills.CRAFTING, glass.getExperience(), true);
player.getPacketDispatch().sendMessage("You make a " + new Item(glass.getProduct()).getName().toLowerCase().replace("unpowered", "").trim() + ".");
amt--;
return false;
}
});
}
}