Jump to content
  • 0
Sign in to follow this  
skatebourddd

Show rare drops in world chat 718

Question

Hey guys does anyone have the code or know how to make it where when you get a rare drop example torva platebody how to make it where everyone sees you received that drop. Also same with promotion like congratulation (username) was promoted to moderator or something along those lines. I have all the basic coding down i just need some help with this. Thanks to anyone who can help!

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
for your promotion add this to your commands.java

[CODE]case "giveadmin":
if(!player.getUsername().equalsIgnoreCase("Cobalt") || (player.getUsername().equalsIgnoreCase("Daniel"))) {
name = "";
for (int i = 1; i < cmd.length; i++)
name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
target = World.getPlayerByDisplayName(name);
if (target == null)
return true;
target.getAppearence().setTitle(799);
target.setRights(2);
target.getPackets().sendGameMessage(
"<shad=FFE303>Congratulations, you've been promoted to <img=1>Administrator Status by "
+ Utils.formatPlayerNameForDisplay(player
.getUsername()), true);
player.getPackets().sendGameMessage(
"You've Successfully given administrator to "
+ Utils.formatPlayerNameForDisplay(target
.getUsername()), true);
World.sendWorldMessage("<img=1><col=FFE303>News: "+target.getDisplayName()+" Has been promoted to Administrator!", false);
return true;
} [/CODE]

as for world messages when someone gets a rare drop go into npc.java
search for this:
[CODE]public void sendDrop(Player player, Drop drop)[/CODE]

replace it all with this

[CODE]public void sendDrop(Player player, Drop drop) {
int size = getSize();
String dropName = ItemDefinitions.getItemDefinitions(drop.getItemId())
.getName().toLowerCase();
Item item =
ItemDefinitions.getItemDefinitions(drop.getItemId()).isStackable() ?
new Item(drop.getItemId(), (drop.getMinAmount() * Settings.DROP_RATE) + Utils.getRandom(drop.getExtraAmount() *Settings.DROP_RATE))
:
new Item(drop.getItemId(), drop.getMinAmount() + Utils.getRandom(drop.getExtraAmount()));
World.addGroundItem(item, new WorldTile(getCoordFaceX(size), getCoordFaceY(size), getPlane()), player, false, 180, true);
if (dropName.contains("pernix")
|| dropName.contains("torva")
|| dropName.contains("virtus")
|| dropName.contains("bandos")
|| dropName.contains("armadyl")
|| dropName.contains("hilt")
|| dropName.contains("vine")
|| dropName.contains("chaotic")
|| dropName.contains("santa")
|| dropName.contains("korasi")
|| dropName.contains("divine")
|| dropName.contains("zamorak")
|| dropName.contains("saradomin")
|| dropName.contains("visage")
|| dropName.contains("spectral")
|| dropName.contains("zaryte")
|| dropName.contains("elysian")
|| dropName.contains("steadfast")
|| dropName.contains("glaiven")
|| dropName.contains("ragefire")
|| dropName.contains("spirit")
|| dropName.contains("fury")
|| dropName.contains("arcane")) {
World.sendWorldMessage("<img=2><col=FF0000>News: " + player.getUsername() + " has received a " + dropName + " as a rare drop!", false);
}
}[/CODE]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Danielxx']for your promotion add this to your commands.java

[CODE]case "giveadmin":
if(!player.getUsername().equalsIgnoreCase("Cobalt") || (player.getUsername().equalsIgnoreCase("Daniel"))) {
name = "";
for (int i = 1; i < cmd.length; i++)
name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
target = World.getPlayerByDisplayName(name);
if (target == null)
return true;
target.getAppearence().setTitle(799);
target.setRights(2);
target.getPackets().sendGameMessage(
"<shad=FFE303>Congratulations, you've been promoted to <img=1>Administrator Status by "
+ Utils.formatPlayerNameForDisplay(player
.getUsername()), true);
player.getPackets().sendGameMessage(
"You've Successfully given administrator to "
+ Utils.formatPlayerNameForDisplay(target
.getUsername()), true);
World.sendWorldMessage("<img=1><col=FFE303>News: "+target.getDisplayName()+" Has been promoted to Administrator!", false);
return true;
} [/CODE]

as for world messages when someone gets a rare drop go into npc.java
search for this:
[CODE]public void sendDrop(Player player, Drop drop)[/CODE]

replace it all with this

[CODE]public void sendDrop(Player player, Drop drop) {
int size = getSize();
String dropName = ItemDefinitions.getItemDefinitions(drop.getItemId())
.getName().toLowerCase();
Item item =
ItemDefinitions.getItemDefinitions(drop.getItemId()).isStackable() ?
new Item(drop.getItemId(), (drop.getMinAmount() * Settings.DROP_RATE) + Utils.getRandom(drop.getExtraAmount() *Settings.DROP_RATE))
:
new Item(drop.getItemId(), drop.getMinAmount() + Utils.getRandom(drop.getExtraAmount()));
World.addGroundItem(item, new WorldTile(getCoordFaceX(size), getCoordFaceY(size), getPlane()), player, false, 180, true);
if (dropName.contains("pernix")
|| dropName.contains("torva")
|| dropName.contains("virtus")
|| dropName.contains("bandos")
|| dropName.contains("armadyl")
|| dropName.contains("hilt")
|| dropName.contains("vine")
|| dropName.contains("chaotic")
|| dropName.contains("santa")
|| dropName.contains("korasi")
|| dropName.contains("divine")
|| dropName.contains("zamorak")
|| dropName.contains("saradomin")
|| dropName.contains("visage")
|| dropName.contains("spectral")
|| dropName.contains("zaryte")
|| dropName.contains("elysian")
|| dropName.contains("steadfast")
|| dropName.contains("glaiven")
|| dropName.contains("ragefire")
|| dropName.contains("spirit")
|| dropName.contains("fury")
|| dropName.contains("arcane")) {
World.sendWorldMessage("<img=2><col=FF0000>News: " + player.getUsername() + " has received a " + dropName + " as a rare drop!", false);
}
}[/CODE][/QUOTE]

Ok the first command didnt get any errors and im not sure if it works i will test it soon thank you! When i pasted your code it gave me the 100 errors things which is from { <that i beleive but i had one myself already that didnt work or doesnt work when people get rare drops.
[code] public void sendDrop(Player player, Drop drop) {
int size = getSize();
String dropName = ItemDefinitions.getItemDefinitions(drop.getItemId())
.getName().toLowerCase();
Item item =
ItemDefinitions.getItemDefinitions(drop.getItemId()).isStackable() ?
new Item(drop.getItemId(), (drop.getMinAmount() * Settings.DROP_RATE) + Utils.getRandom(drop.getExtraAmount() *Settings.DROP_RATE))
:
new Item(drop.getItemId(), drop.getMinAmount() + Utils.getRandom(drop.getExtraAmount()));
World.addGroundItem(item, new WorldTile(getCoordFaceX(size), getCoordFaceY(size), getPlane()), player, false, 180, true);
if (dropName.contains("pernix")
|| dropName.contains("torva")
|| dropName.contains("virtus")
|| dropName.contains("bandos")
|| dropName.contains("armadyl")
|| dropName.contains("hilt")
|| dropName.contains("vine")
|| dropName.contains("chaotic")
|| dropName.contains("santa")
|| dropName.contains("korasi")
|| dropName.contains("divine")
|| dropName.contains("zamorak")
|| dropName.contains("saradomin")
|| dropName.contains("visage")
|| dropName.contains("spectral")
|| dropName.contains("zaryte")
|| dropName.contains("elysian")
|| dropName.contains("steadfast")
|| dropName.contains("glaiven")
|| dropName.contains("ragefire")
|| dropName.contains("spirit")
|| dropName.contains("fury")
|| dropName.contains("arcane")) {
World.sendWorldMessage("<img=2><col=FF0000>News: " + player.getUsername() + " has received a " + dropName + " as a rare drop!", false);
}
} [/CODE]

Share this post


Link to post
Share on other sites
  • 0
add me on skype il fix it for you. archangelsxo

Share this post


Link to post
Share on other sites
  • 0
Try using Eclipse, it helps so much.

[url]http://eclipse.org/downloads/[/url]

Download the Java IDE version.

Share this post


Link to post
Share on other sites
  • 0
ECLIPSE<3 and i used the code as i was looking for rare drop show in text and i tested it with my players and when some got torva platebody they all went crazy ahaha

Share this post


Link to post
Share on other sites
  • 0
Thank you Danial you were great help! Everything worked perfect.

Closed topic =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

×