Fixed hat clipping + sack bug + made farmer payment requests more human parsable

This commit is contained in:
Ceikry 2021-03-14 17:09:05 -05:00
parent 396f5c2775
commit ee2e7d5f7e
4 changed files with 56 additions and 21 deletions

View file

@ -28530,7 +28530,8 @@
"equipment_slot": "0",
"ge_buy_limit": "2",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "2634",
@ -28553,7 +28554,8 @@
"equipment_slot": "0",
"ge_buy_limit": "2",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "2636",
@ -28576,7 +28578,8 @@
"equipment_slot": "0",
"ge_buy_limit": "2",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "2638",
@ -97038,7 +97041,8 @@
"grand_exchange_price": "64066",
"equipment_slot": "0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "10694",
@ -97051,7 +97055,8 @@
"grand_exchange_price": "158274",
"equipment_slot": "0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "10695",
@ -97064,7 +97069,8 @@
"grand_exchange_price": "281900",
"equipment_slot": "0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "10696",
@ -128305,7 +128311,8 @@
"absorb": "0,0,0",
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "13812",
@ -128321,7 +128328,8 @@
"absorb": "0,0,0",
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "13813",
@ -128337,7 +128345,8 @@
"absorb": "0,0,0",
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"archery_ticket_price": "0",
"durability": null
"durability": null,
"remove_head": true
},
{
"id": "13814",

View file

@ -6,15 +6,12 @@ import core.game.container.impl.EquipmentContainer;
import core.game.node.entity.combat.equipment.WeaponInterface;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import rs09.game.system.config.ItemConfigParser;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.player.AppearanceFlag;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import java.nio.ByteBuffer;
import rs09.game.system.config.ItemConfigParser;
/**
* Represents an appearance managing class of a player.
@ -237,6 +234,10 @@ public final class Appearance {
this.bodyParts[part] = 0;
}
public void flagHatClipping() {
this.bodyParts[8] = 0x100;
}
/**
* Prepares the data used for the appearance update mask.
* @param player The player.
@ -302,7 +303,7 @@ public final class Appearance {
drawClothes(7, getLegs().getLook());
}
if ((hat != null && hat.getDefinition().getConfiguration(ItemConfigParser.REMOVE_HEAD, false)) || castleWarsHood) {
clearBodyPart(8);
flagHatClipping();
} else {
drawClothes(8, getHair().getLook());
}

View file

@ -9,6 +9,7 @@ import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items
@Initializable
class FarmerPayOptionHandler : OptionHandler() {
@ -76,10 +77,24 @@ class FarmerPayOptionHandler : OptionHandler() {
return true
} else {
item = patch?.plantable?.protectionItem
val protectionText = when(item?.id){
Items.COMPOST_6032 -> if(item?.amount == 1) "bucket of compost" else "buckets of compost"
Items.POTATOES10_5438 -> if(item?.amount == 1) "sack of potatoes" else "sacks of potatoes"
Items.ONIONS10_5458 -> if(item?.amount == 1) "sack of onions" else "sacks of onions"
Items.CABBAGES10_5478 -> if(item?.amount == 1) "sack of cabbages" else "sacks of cabbages"
Items.JUTE_FIBRE_5931 -> "jute fibres"
Items.APPLES5_5386 -> if(item?.amount == 1) "basket of apples" else "baskets of apples"
Items.MARIGOLDS_6010 -> "harvest of marigold"
Items.TOMATOES5_5968 -> if(item?.amount == 1) "basket of tomatoes" else "baskets of tomatoes"
Items.ORANGES5_5396 -> if(item?.amount == 1) "basket of oranges" else "baskets of oranges"
Items.COCONUT_5974 -> "coconuts"
Items.STRAWBERRIES5_5406 -> if(item?.amount == 1) "basket of strawberries" else "baskets of strawberries"
Items.BANANAS5_5416 -> if(item?.amount == 1) "basket of bananas" else "baskets of bananas"
else -> item?.name?.toLowerCase()
}
if(item == null) npc("Sorry, I won't protect that.").also { stage = 1000 }
else{
val name = item?.name?.toLowerCase()
npc("I would like ${item?.amount} $name","to protect that patch.")
npc("I would like ${item?.amount} $protectionText","to protect that patch.")
stage = 0
}
}

View file

@ -114,13 +114,23 @@ class SackBasketOptionHandler : OptionHandler() {
val container = BasketsAndSacks.forId(containerID)
val produce = if(container == null){
var selected = 0
for(i in (fruit + produce)){
if(player.inventory.contains(i,1)){
selected = i
break
if(containerID == Items.EMPTY_SACK_5418) {
for (i in (produce)) {
if (player.inventory.contains(i, 1)) {
selected = i
break
}
}
selected
} else {
for (i in (fruit)) {
if (player.inventory.contains(i, 1)) {
selected = i
break
}
}
selected
}
selected
} else {
container.produceID
}