mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 19:35:10 -06:00
Made crest persist through logout
This commit is contained in:
parent
d069269884
commit
2174719a4a
6 changed files with 16 additions and 7 deletions
|
|
@ -346,9 +346,9 @@ public final class BuildingUtils {
|
|||
objectId += player.getHouseManager().getCrest().ordinal();
|
||||
}
|
||||
if (objectId == object.getId() && hotspot.getCurrentX() == l.getChunkOffsetX() && hotspot.getCurrentY() == l.getChunkOffsetY()) {
|
||||
Decoration decoration = hotspot.getHotspot().getDecorations()[hotspot.getDecorationIndex()];
|
||||
player.animate(REMOVE_ANIMATION);
|
||||
removeDecoration(player, region, room, hotspot, object, style);
|
||||
Decoration decoration = Decoration.forObjectId(object.getId());
|
||||
for (Item item : decoration.getRefundItems()) {
|
||||
addItemOrDrop(player, item.getId(), item.getAmount());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import org.rs09.consts.Items
|
|||
|
||||
/**
|
||||
* Enumerates the various crests the player can purchase for the Construction skill, as well as their requirements.
|
||||
* ORDINAL BOUND, see HeraldicProduct.kt
|
||||
* ORDINAL BOUND
|
||||
* @author Bishop
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -899,7 +899,11 @@ public enum Decoration {
|
|||
if (h.getCurrentX() == l.getChunkOffsetX() && h.getCurrentY() == l.getChunkOffsetY()) {
|
||||
if (h.getDecorationIndex() != -1) {
|
||||
Decoration deco = h.getHotspot().getDecorations()[h.getDecorationIndex()];
|
||||
if (deco.getObjectId(player.getHouseManager().getStyle()) == object.getId()) {
|
||||
int id = deco.getObjectId(player.getHouseManager().getStyle());
|
||||
if (h.getHotspot().getType() == BuildHotspotType.CREST) {
|
||||
id += player.getHouseManager().getCrest().ordinal();
|
||||
}
|
||||
if (id == object.getId()) {
|
||||
return deco;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ public final class HouseManager {
|
|||
public void parse(JSONObject data){
|
||||
location = HouseLocation.values()[Integer.parseInt( data.get("location").toString())];
|
||||
style = HousingStyle.values()[Integer.parseInt( data.get("style").toString())];
|
||||
Object crestRaw = data.get("crest");
|
||||
if (crestRaw != null) {
|
||||
crest = CrestType.values()[Integer.parseInt(crestRaw.toString())];
|
||||
}
|
||||
Object servRaw = data.get("servant");
|
||||
if(servRaw != null){
|
||||
servant = Servant.parse((JSONObject) servRaw);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class SirReniteeDialogueFile : DialogueLabeller() {
|
|||
label("change_crest")
|
||||
npc(ChatAnim.NEUTRAL, "Mmm, very well. Changing your crest will cost", "5,000 coins.")
|
||||
exec { player, _ ->
|
||||
if (amountInInventory(player, Items.COINS_995) < CrestType.MISTHALIN.cost) {
|
||||
if (amountInInventory(player, Items.COINS_995) < CrestType.ASGARNIA.cost) {
|
||||
loadLabel(player, "no_money")
|
||||
} else {
|
||||
loadLabel(player, "choose_symbol")
|
||||
|
|
@ -213,7 +213,7 @@ class SirReniteeDialogueFile : DialogueLabeller() {
|
|||
|
||||
label("crest_buy")
|
||||
exec { player, _ ->
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.MISTHALIN)
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA)
|
||||
if (crest.eligible(player) && removeItem(player, Item(Items.COINS_995, crest.cost))) {
|
||||
player.houseManager.crest = crest
|
||||
if (crest == CrestType.SARADOMIN && !player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(2, 1)) {
|
||||
|
|
@ -227,7 +227,7 @@ class SirReniteeDialogueFile : DialogueLabeller() {
|
|||
|
||||
label("crest_buy_ok")
|
||||
manual { player, _ ->
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.MISTHALIN)
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA)
|
||||
val messages = when (crest) {
|
||||
CrestType.ARRAV ->
|
||||
arrayOf("Ah yes, the shield that you helped to retrieve. You have",
|
||||
|
|
@ -277,7 +277,7 @@ class SirReniteeDialogueFile : DialogueLabeller() {
|
|||
|
||||
label("crest_buy_fail")
|
||||
manual { player, _ ->
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.MISTHALIN)
|
||||
val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA)
|
||||
val messages = when (crest) {
|
||||
CrestType.ARRAV ->
|
||||
arrayOf("But that legendary shield is still lost! I don't think",
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ class PlayerSaver (val player: Player){
|
|||
val houseData = JSONObject()
|
||||
houseData.put("location",manager.location.ordinal.toString())
|
||||
houseData.put("style",manager.style.ordinal.toString())
|
||||
houseData.put("crest",manager.crest.ordinal.toString())
|
||||
if(manager.hasServant()){
|
||||
val servant = JSONObject()
|
||||
servant.put("type",manager.servant.type.ordinal.toString())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue