Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
@@ -0,0 +1,79 @@
package content.global.skill.crafting.gem;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the pulse used to cut a gem.
* @author 'Vexia
*/
public final class GemCutPulse extends SkillPulse<Item> {
/**
* Represents the chisel item.
*/
private static final Item CHISEL = new Item(1755);
/**
* Represents the gem to cut.
*/
private final Gems gem;
/**
* Represents the amount to make.
*/
private int amount;
/**
* Represents the ticks passed.
*/
private int ticks;
/**
* Constructs a new {@code GemCuttingPulse} {@Code Object}
* @param player the player.
* @param item the item cut.
*/
public GemCutPulse(Player player, Item item, int ammount, final Gems gem) {
super(player, item);
this.amount = ammount;
this.gem = gem;
this.resetAnimation = false;
}
@Override
public boolean checkRequirements() {
if (!player.getInventory().containsItem(CHISEL)) {
return false;
}
if (!player.getInventory().containsItem(gem.getUncut())) {
return false;
}
if (player.getSkills().getLevel(Skills.CRAFTING) < gem.getLevel()) {
player.getPacketDispatch().sendMessage("You need a crafting level of " + gem.getLevel() + " to craft this gem.");
return false;
}
return true;
}
@Override
public void animate() {
if (ticks % 5 == 0 || ticks < 1) {
player.getAudioManager().send(2586);
player.animate(gem.getAnimation());
}
}
@Override
public boolean reward() {
if (player.getInventory().remove(gem.getUncut())) {
final Item item = gem.getGem();
player.getInventory().add(item);
player.getSkills().addExperience(Skills.CRAFTING, gem.getExp(), true);
}
amount--;
return amount < 1;
}
}
@@ -0,0 +1,114 @@
package content.global.skill.crafting.gem;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
/**
* Represents a gem enumeration.
* @author 'Vexia
*/
public enum Gems {
SAPPHIRE(new Item(1623), new Item(1607), 20, new Animation(888), 50),
EMERALD(new Item(1621), new Item(1605), 27, new Animation(889), 67),
RUBY(new Item(1619), new Item(1603), 34, new Animation(887), 85),
DIAMOND(new Item(1617), new Item(1601), 43, new Animation(886), 107.5),
DRAGONSTONE(new Item(1631), new Item(1615), 55, new Animation(885), 137.5),
ONYX(new Item(6571), new Item(6573), 67, new Animation(2717), 168),
OPAL(new Item(1625), new Item(1609), 1, new Animation(890), 10),
JADE(new Item(1627), new Item(1611), 13, new Animation(891), 20),
RED_TOPAZ(new Item(1629), new Item(1613), 16, new Animation(892), 25);
/**
* Represents the raw gem.
*/
private final Item uncut;
/**
* Represents the gem cut.
*/
private final Item gem;
/**
* Represents the level needed.
*/
private final int level;
/**
* Represents the animation used.
*/
private final Animation animation;
/**
* Represents the experience gained.
*/
private final double exp;
/**
* Constructs a new {@code Gems} {@code Object}.
* @param uncut the uncut.
* @param gem the gem.
* @param level the level.
* @param animation the animation.
* @param exp the exp.
*/
private Gems(Item uncut, Item gem, int level, Animation animation, double exp) {
this.uncut = uncut;
this.gem = gem;
this.level = level;
this.animation = animation;
this.exp = exp;
}
/**
* Gets the gem by the id.
* @return the gem.
*/
public static Gems forId(final Item item) {
for (Gems gem : Gems.values()) {
if (gem.getUncut().getId() == item.getId()) {
return gem;
}
}
return null;
}
/**
* Gets the uncut.
* @return The uncut.
*/
public Item getUncut() {
return uncut;
}
/**
* Gets the gem.
* @return The gem.
*/
public Item getGem() {
return gem;
}
/**
* Gets the level.
* @return The level.
*/
public int getLevel() {
return level;
}
/**
* Gets the animation.
* @return The animation.
*/
public Animation getAnimation() {
return animation;
}
/**
* Gets the exp.
* @return The exp.
*/
public double getExp() {
return exp;
}
}