Player username case is now consistent

This commit is contained in:
Player Name
2023-09-20 06:50:37 +00:00
committed by Ryan
parent 0b6be66cfd
commit 5e6f750cee
20 changed files with 35 additions and 36 deletions
@@ -23,7 +23,7 @@ class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventN
val id = ids.toList()[index]
this.transform(id)
this.attack(player)
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
this.isRespawn = false
}
@@ -37,9 +37,9 @@ class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventN
this.terminate()
}
if(getWorldTicks() % 10 == 0){
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
}
super.tick()
if(!player.viewport.currentPlane.npcs.contains(this)) this.clear()
}
}
}
@@ -9,7 +9,7 @@ import org.rs09.consts.Items
class GenieDialogue() : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
0 -> npcl(FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.name.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish."). also { stage++ }
0 -> npcl(FacialExpression.NEUTRAL, "Ah, so you are there, ${player!!.username.capitalize()}. I'm so glad you summoned me. Please take this lamp and make your wish."). also { stage++ }
1 -> {
end()
addItemOrDrop(player!!, Items.LAMP_2528)
@@ -17,4 +17,4 @@ class GenieDialogue() : DialogueFile() {
}
}
}
}
}
@@ -13,7 +13,7 @@ class GenieNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPC
override fun tick() {
if(RandomFunction.random(1,15) == 5){
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
}
super.tick()
}
@@ -21,10 +21,10 @@ class GenieNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPC
override fun init() {
super.init()
playAudio(player, Sounds.GENIE_APPEAR_2301)
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
}
override fun talkTo(npc: NPC) {
player.dialogueInterpreter.open(GenieDialogue(),npc)
}
}
}
@@ -8,13 +8,13 @@ import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
class SandwichLadyRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.SANDWICH_LADY_3117) {
val phrases = arrayOf("Hello, @name, can you hear me?","Sandwiches, @name!","Are you ignoring me @name??","Yoohoo! Sandwiches, @name!","Hello, @name?", "Come get your sandwiches @name!", "How could you ignore me like this @name?!", "Do you even want your sandwiches, @name?")
val phrases = arrayOf("Hello, @name, can you hear me?","Sandwiches, @name!","Are you ignoring me, @name??","Yoohoo! Sandwiches, @name!","Hello, @name?", "Come get your sandwiches, @name!", "How could you ignore me like this, @name?!", "Do you even want your sandwiches, @name?")
var assigned_item = 0
val items = arrayOf(Items.BAGUETTE_6961,Items.TRIANGLE_SANDWICH_6962,Items.SQUARE_SANDWICH_6965,Items.ROLL_6963,Items.MEAT_PIE_2327,Items.KEBAB_1971,Items.CHOCOLATE_BAR_1973)
override fun tick() {
if(RandomFunction.random(1,15) == 5){
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
}
super.tick()
}
@@ -22,7 +22,7 @@ class SandwichLadyRENPC(override var loot: WeightBasedTable? = null) : RandomEve
override fun init() {
super.init()
assignItem()
sendChat(phrases.random().replace("@name",player.name.capitalize()))
sendChat(phrases.random().replace("@name",player.username.capitalize()))
}
fun assignItem(){
@@ -33,4 +33,4 @@ class SandwichLadyRENPC(override var loot: WeightBasedTable? = null) : RandomEve
override fun talkTo(npc: NPC) {
player.dialogueInterpreter.open(SandwichLadyDialogue(false),npc)
}
}
}
@@ -21,7 +21,7 @@ class UnferthDialogue(player: Player? = null) : DialoguePlugin(player) {
// 2 -> playerl(FacialExpression.FRIENDLY, "I'm so sorry Unferth.").also { stage++ }
// 3 -> npcl(FacialExpression.FRIENDLY, "Gertrude asked me if I'd like one of her new kittens. I don't think I'm ready for that yet.").also { stage++ }
// 4 -> playerl(FacialExpression.FRIENDLY, "Give it time. Things will get better, I promise.").also { stage++ }
// 5 -> npcl(FacialExpression.FRIENDLY, "Thanks ${player.name}.").also { stage = END_DIALOGUE }
// 5 -> npcl(FacialExpression.FRIENDLY, "Thanks, ${player.username}.").also { stage = END_DIALOGUE }
// }
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.GUILTY, "Hello.").also { stage++ }
@@ -29,7 +29,7 @@ class ZandarHorfyreDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int) : Boolean {
when (stage) {
-1 -> npcl(FacialExpression.NEUTRAL,"My name is Zandar Horfyre, and you ${ player.name } are trespassing in my tower, not to mention attacking my students! I thank you to leave immediately!").also{ stage++ }
-1 -> npcl(FacialExpression.NEUTRAL,"My name is Zandar Horfyre, and you, ${ player.username }, are trespassing in my tower, not to mention attacking my students! I thank you to leave immediately!").also{ stage++ }
0 -> options("Ok, I was going anyway.", "No, I think I'll stay for a bit.").also{ stage++ }
1 -> when(buttonId) {
1 -> player("Ok, I was going anyway.").also{ stage = 10 }
@@ -50,4 +50,4 @@ class ZandarHorfyreDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun getIds() : IntArray {
return intArrayOf(3308)
}
}
}
@@ -32,7 +32,7 @@ class BjornAndEldgrimDialogues(player: Player? = null) : DialoguePlugin(player){
1 -> player(FacialExpression.ASKING, "The who?").also { stage++ }
2 -> npcl(FacialExpression.DRUNK, "That guy over there by that stuff! (hic) Yeh, abshoultely! He's da bosh!").also { stage = END_DIALOGUE }
10 -> player(FacialExpression.ASKING, "${player.name}?").also { stage++ }
10 -> player(FacialExpression.ASKING, "${player.username}?").also { stage++ }
11 -> npcl(FacialExpression.DRUNK, "Nah nah nah, not them, the other one, whatshyerfashe!").also { stage++ }
12 -> player(FacialExpression.ASKING, "${player.getAttribute("fremennikname","fremmyname")}?").also { stage++ }
13 -> npc(FacialExpression.DRUNK, "Thatsh what I said diddle I?").also { stage++ }
@@ -354,7 +354,7 @@ class TFTInteractionListeners : InteractionListener {
class LyreConcertPulse(val player: Player, val Lyre: Int) : Pulse(){
val GENERIC_LYRICS = arrayOf(
"${player.name?.capitalize()} is my name,",
"${player.username?.capitalize()} is my name,",
"I haven't much to say",
"But since I have to sing this song.",
"I'll just go ahead and play."
@@ -487,4 +487,4 @@ class TFTInteractionListeners : InteractionListener {
return false
}
}
}
}
@@ -52,7 +52,7 @@ class TheLadyOfTheLake(player: Player? = null) : DialoguePlugin(player) {
100 -> npcl(FacialExpression.HAPPY,"I am the Lady of the Lake.").also { stage = 145 }
110 -> player("And I'm-").also { stage++ }
111 -> npc(
"You're " + player.name + ". And I see from the sign you",
"You're " + player.username + ". And I see from the sign you",
"wear that you have earned the trust of Sir Kay."
).also { stage++ }
112 -> player("It was nothing.. really...").also { stage++ }
@@ -157,4 +157,4 @@ class TheLadyOfTheLake(player: Player? = null) : DialoguePlugin(player) {
override fun getIds(): IntArray {
return intArrayOf(250)
}
}
}
@@ -19,7 +19,7 @@ class CrompertyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlu
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npcl(core.game.dialogue.FacialExpression.HAPPY,"Hello ${player.name}, I'm Cromperty. Sedridor has told me about you. As a wizard and an inventor he has aided me in my great invention!")
npcl(core.game.dialogue.FacialExpression.HAPPY,"Hello, ${player.username}, I'm Cromperty. Sedridor has told me about you. As a wizard and an inventor he has aided me in my great invention!")
stage = 0
return true
}
@@ -36,7 +36,7 @@ class BonzaraDialogue(player: Player? = null) : DialoguePlugin(player){
20 -> npcl(FacialExpression.OLD_DEFAULT, "Never mind that child. You should worry more about who you are and the nature of the forces that have driven you here.").also { stage++ }
21 -> player(FacialExpression.THINKING, "I'll ... keep that in mind, thanks.").also { stage++ }
22 -> npc(FacialExpression.OLD_DEFAULT, "We WILL meet again, " + player.name + ".").also { stage++ }
22 -> npc(FacialExpression.OLD_DEFAULT, "We WILL meet again, " + player.username + ".").also { stage++ }
23 -> player(FacialExpression.SUSPICIOUS, "Ok...").also { stage = 99 }
99 -> end()
@@ -18,7 +18,7 @@ class MazionDialogue(player: Player? = null) : DialoguePlugin(player){
npc = args[0] as NPC
when ((1..3).random()) {
1 -> npc(FacialExpression.FRIENDLY, "Nice weather we're having today!").also { stage = 99 }
2 -> npc(FacialExpression.FRIENDLY, "Hello " + player.name + ", fine day today!").also { stage = 99 }
2 -> npc(FacialExpression.FRIENDLY, "Hello, " + player.username + ", fine day today!").also { stage = 99 }
3 -> npc(FacialExpression.ANNOYED, "Please leave me alone, a parrot stole my banana.").also { stage = 99 }
}
return true
@@ -16,7 +16,7 @@ class DwarfsDialogue(player: Player? = null) : DialoguePlugin(player) {
var random = arrayOf(1, 2, 3, 4, 5).random()
when (random) {
1 -> npcl(FacialExpression.OLD_DEFAULT, "I hope the goblins are properly maintaining their stretch of track! I'd hate to see them spoil good Dwarven workmanship.").also { stage = END_DIALOGUE }
2 -> npcl(FacialExpression.OLD_DEFAULT, "You're ${player.name}, aren't you? It's a good job you did helping to get this train link open.").also { stage = END_DIALOGUE }
2 -> npcl(FacialExpression.OLD_DEFAULT, "You're ${player.username}, aren't you? It's a good job you did helping to get this train link open.").also { stage = END_DIALOGUE }
3 -> npcl(FacialExpression.OLD_DEFAULT, "Y'know, at first I didn't like the idea of visiting a goblin city, but these cave goblins are alright.").also { stage = END_DIALOGUE }
4 -> npcl(FacialExpression.OLD_DEFAULT, "These goblins have so much more advanced technology than us. Take a look at their magical lights! We could never create something like them.").also { stage = END_DIALOGUE }
5 -> npcl(FacialExpression.OLD_DEFAULT, "Dorgesh-Kaan's very nice to visit, but I don't think I'd want to live there.").also { stage = END_DIALOGUE }
@@ -33,4 +33,4 @@ class DwarfsDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun getIds(): IntArray {
return intArrayOf(NPCs.DWARF_5880, NPCs.DWARF_5881, NPCs.DWARF_5882, NPCs.DWARF_5883, NPCs.DWARF_5884, NPCs.DWARF_5885)
}
}
}
@@ -20,8 +20,8 @@ class DwarvenBoatmanForthDialogue(player: Player? = null) : DialoguePlugin(playe
if (!getAttribute(player, "/save:keldagrim-visited", false)) {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_HAPPY, "Ho there, human!").also { stage++ }
1 -> playerl(FacialExpression.FRIENDLY, "${player.name}.").also { stage++ }
2 -> npcl(FacialExpression.OLD_HAPPY, "Ho there, ${player.name}! Want to take a ride with me?").also { stage++ }
1 -> playerl(FacialExpression.FRIENDLY, "${player.username}.").also { stage++ }
2 -> npcl(FacialExpression.OLD_HAPPY, "Ho there, ${player.username}! Want to take a ride with me?").also { stage++ }
3 -> playerl(FacialExpression.FRIENDLY, "Where are you going? Across the river?").also { stage++ }
4 -> npcl(FacialExpression.OLD_HAPPY, "No no, that's what the ferryman is for! I'm going to Keldagrim, my home!").also { stage++ }
5 -> playerl(FacialExpression.FRIENDLY, "How much will that cost me then?").also { stage++ }
@@ -54,7 +54,7 @@ class DwarvenBoatmanForthDialogue(player: Player? = null) : DialoguePlugin(playe
}
} else {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_HAPPY, "Hello again, ${player.name}! Want to go back to Keldagrim?").also { stage++ }
START_DIALOGUE -> npcl(FacialExpression.OLD_HAPPY, "Hello again, ${player.username}! Want to go back to Keldagrim?").also { stage++ }
1 -> showTopics(
Topic(FacialExpression.FRIENDLY, "Yes, please take me.", 2),
Topic(FacialExpression.FRIENDLY, "What, on your ship? No way.", 3),
@@ -149,4 +149,4 @@ class TravelBackPulse(val player: Player): Pulse(1){
}
return false
}
}
}
@@ -18,7 +18,7 @@ class BlaecDialogue(player: Player? = null) : DialoguePlugin(player){
npc = args[0] as NPC
when ((1..3).random()) {
1 -> npc(FacialExpression.FRIENDLY,"Wunnerful weather we're having today!").also { stage = 99 }
2 -> npc(FacialExpression.FRIENDLY,"Greetin's " + player.name + ", fine day today!").also { stage = 99 }
2 -> npc(FacialExpression.FRIENDLY,"Greetin's, " + player.username + ", fine day today!").also { stage = 99 }
3 -> npcl(FacialExpression.ANNOYED,"Please leave me alone, I'm busy trapping the pygmy shrews.").also { stage = 99 }
}
return true
@@ -20,7 +20,7 @@ class randomChildrenDialogue(player: Player? = null) : DialoguePlugin(player){
npc = args[0] as NPC
when ((1..5).random()) {
1 -> npc(FacialExpression.OLD_NORMAL, "Are you a surface-dweller?").also { stage = 0 }
2 -> npcl(a, "Are you " + player.name + "? Did you help Zanik save the city?").also { stage = 10 }
2 -> npcl(a, "Are you " + player.username + "? Did you help Zanik save the city?").also { stage = 10 }
3 -> npc(a, "Sorry, I'm not meant to talk to strangers.").also { stage = 99 }
4 -> npc(a, "Shh! Don't tell anyone!").also { stage = 20 }
5 -> npc(a, "Help! Help! The surface people are attacking!").also { stage = 30 }
@@ -64,7 +64,7 @@ class LumbridgeCookDialogue (player: Player? = null) : DialoguePlugin(player){
1 -> npc("It looked a bit like a goblin, but it had big bulging eyes.","It wasn't wearing armour, but it had this odd helmet","with a light on it.").also { stage++ }
2 -> npc("The tunnel was too dark for me to follow it, so I went","to tell the Duke. But when we went down to the cellar","the hole had been blocked up, and no one believes me.").also { stage++ }
3 -> player("I believe you.").also { stage++ }
4 -> npc("Thank you, ${player.name}! If you can convince the Duke","I'm telling the truth then we can get to the bottom of","this mystery.").also { stage = 1000; player.questRepository.getQuest("Lost Tribe").setStage(player,20) }
4 -> npc("Thank you, ${player.username}! If you can convince the Duke","I'm telling the truth then we can get to the bottom of","this mystery.").also { stage = 1000; player.questRepository.getQuest("Lost Tribe").setStage(player,20) }
5 -> end()
}
return true
@@ -280,4 +280,4 @@ class LumbridgeCookDialogue (player: Player? = null) : DialoguePlugin(player){
override fun getIds(): IntArray {
return intArrayOf(278)
}
}
}
@@ -15,7 +15,6 @@ class PerfectJewelryHandler (player: Player? = null): DialoguePlugin(player){
}
override fun open(vararg args: Any?): Boolean {
println(player.name)
if(player.inventory.containItems(2365, 1603)){
options("Craft perfect ruby ring", "Craft perfect ruby necklace")
stage = 1
@@ -33,7 +33,7 @@ class ElfTrackerDialogue(player: Player? = null) : DialoguePlugin(player){
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> npc(FacialExpression.SUSPICIOUS, "Human! You must be one of Tyras's men...").also { stage++ }
1 -> playerl(FacialExpression.HALF_GUILTY, "No, I'm " + player.name + "! Lord Iorwerth said you might be able to help me.").also { stage++ }
1 -> playerl(FacialExpression.HALF_GUILTY, "No, I'm " + player.username + "! Lord Iorwerth said you might be able to help me.").also { stage++ }
2 -> npc(FacialExpression.SUSPICIOUS, "And you have something to prove this?").also { stage++ }
3 -> {
//todo check quest stages whenever it's added
@@ -613,7 +613,7 @@ public class Player extends Entity {
}
if (killer instanceof Player && getWorldTicks() - killer.getAttribute("/save:last-murder-news", 0) >= 500) {
Item wep = getItemFromEquipment((Player) killer, EquipmentSlot.WEAPON);
sendNews(killer.getName() + " has murdered " + getName() + " with " + (wep == null ? "their fists." : (StringUtils.isPlusN(wep.getName()) ? "an " : "a ") + wep.getName()));
sendNews(killer.getUsername() + " has murdered " + getUsername() + " with " + (wep == null ? "their fists." : (StringUtils.isPlusN(wep.getName()) ? "an " : "a ") + wep.getName()));
killer.setAttribute("/save:last-murder-news", getWorldTicks());
}
getPacketDispatch().sendMessage("Oh dear, you are dead!");