Merge pull request #181 from Ceikry/master

Lots of great things
This commit is contained in:
Daniel Ginovker 2020-03-20 08:50:40 -04:00 committed by GitHub
commit 10a13084c4
7 changed files with 62 additions and 35 deletions

View file

@ -73,6 +73,6 @@ public final class HouseZone extends MapZone {
return true;
}
}
return false;
return true;
}
}

View file

@ -7,11 +7,20 @@ import org.crandor.net.packet.context.CSConfigContext;
/**
* The outgoing packet for client script configs.
*
* @author Torchic
* @author Snickerize
*/
public class CSConfigPacket implements OutgoingPacket<CSConfigContext> {
@Override
public void send(CSConfigContext context) {
IoBuffer buffer = new IoBuffer(65);
buffer.putLEShort(context.getPlayer().getInterfaceManager().getPacketCount(1));
buffer.putC((byte) context.getValue());
buffer.putLEShortA(context.getId());
context.getPlayer().getDetails().getSession().write(buffer);
}
/*@Override
public void send(CSConfigContext context) {
IoBuffer buffer = new IoBuffer(115);
buffer.putShort(context.getId());
@ -27,5 +36,5 @@ public class CSConfigPacket implements OutgoingPacket<CSConfigContext> {
buffer.putInt(context.getValue());
context.getPlayer().getDetails().getSession().write(buffer);
}
}*/
}

View file

@ -7,11 +7,11 @@ import org.crandor.net.packet.context.RunScriptContext;
/**
* The run script outgoing packet.
* @author Emperor
* @author Snickerize
*/
public class RunScriptPacket implements OutgoingPacket<RunScriptContext> {
@Override
/*@Override
public void send(RunScriptContext context) {
String string = context.getString();
Object[] objects = context.getObjects();
@ -27,6 +27,27 @@ public class RunScriptPacket implements OutgoingPacket<RunScriptContext> {
}
j++;
}
buffer.putInt(context.getId());
context.getPlayer().getDetails().getSession().write(buffer);
}*/
@Override
public void send(RunScriptContext context) {
String types = context.getString();
Object[] objects = context.getObjects();
IoBuffer buffer = new IoBuffer(115, PacketHeader.SHORT);
buffer.putShort(context.getPlayer().getInterfaceManager().getPacketCount(1));
buffer.putString(types);
int j = 0;
for (int i = (types.length() - 1); i >= 0; i--) {
if (types.charAt(i) == 's') {
buffer.putString((String) objects[j]);
} else {
buffer.putInt((Integer) objects[j]);
}
j++;
}
buffer.putInt(context.getId());
context.getPlayer().getDetails().getSession().write(buffer);
}

View file

@ -181,6 +181,21 @@ public final class GameInterface extends ComponentPlugin {
return true;
}
/**
* World map
* Thanks, Snickerize!
*/
private void configureWorldMap(Player player) {
if (player.inCombat()) {
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
return;
}
player.getInterfaceManager().openWindowsPane(new Component(755), 2);
int posHash = (player.getLocation().getZ() << 28) | (player.getLocation().getX() << 14) | player.getLocation().getY();
player.getPacketDispatch().sendScriptConfigs(622, posHash, "", 0);
player.getPacketDispatch().sendScriptConfigs(674, posHash, "", 0);
}
/**
* Method used to open the report interface.
* @param player the player.
@ -216,27 +231,4 @@ public final class GameInterface extends ComponentPlugin {
* Configures the world map for a player.
* @param player The player.
*/
private void configureWorldMap(Player player) {
if (player.inCombat()) {
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
return;
}
// player.getInterfaceManager().openWindowsPane(new Component(755), 1);
// player.getPacketDispatch().sendScriptConfig(1187, 0, "ii", 0);
int position = player.getLocation().getX() << 14 | player.getLocation().getY() | player.getLocation().getZ() << 28;
// player.getPacketDispatch().sendScriptConfig(622, position, "ii");
// player.getPacketDispatch().sendScriptConfig(674, position, "ii");
// player.getPacketDispatch().sendScriptConfig(622, position);
// player.getPacketDispatch().sendScriptConfig(674, position);
System.out.println(position);
/*player.getPacketDispatch().sendWindowsPane(755, 1);
int hash = player.getLocation().getX() << 14 | player.getLocation().getY();
player.getPacketDispatch().sendRunScript(622, "", hash);
player.getPacketDispatch().sendRunScript(674, "", hash);
PacketRepository.send(InterfaceConfig.class, new InterfaceConfigContext(player, 371, 25, true));
player.setAttribute("worldMap:viewing", true);*/
}
}

View file

@ -21,14 +21,19 @@ public final class WorldMapInterface extends ComponentPlugin {
return this;
}
//Thanks snicker!
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
switch (button) {
case 3:
// player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
return true;
case 3:
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
player.getPacketDispatch().sendRunScript(1187, "ii", 0, 0);
player.updateSceneGraph(true);
return true;
default:
System.err.println("World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
return true;
}
return false;
}
}

View file

@ -42,9 +42,9 @@ public class BrokenCartBypass extends OptionHandler {
Location location = new Location(0,0);
Location playerloc = new Location(player.getLocation().getX(),player.getLocation().getY());
if(options.equals("look-at")) {
if (playerloc.getX() == 2880 && playerloc.getY() >= 2951 && playerloc.getY() <= 2953) {
if (playerloc.getX() > 2878) {
location = new Location(2876, 2952);
} else if (playerloc.getX() == 2876 && playerloc.getY() >= 2951 && playerloc.getY() <= 2953) {
} else if (playerloc.getX() < 2879) {
location = new Location(2880, 2952);
}
}

View file

@ -742,7 +742,7 @@ public class ShootingStarPlugin extends OptionHandler {
int cosmicRunes = (int) (Math.ceil(0.76 * dust) * AMPLIFIER);
int astralRunes = (int) (Math.ceil(0.26 * dust) * AMPLIFIER);
int goldOre = (int) (Math.ceil(0.1 * dust) * AMPLIFIER);
int coins = (int) (Math.ceil(50.1 * dust) * AMPLIFIER);
int coins = (int) (Math.ceil(250.0 * dust) * AMPLIFIER); // limits the amount of gp per turn-in to 90k, same as 2009 rs, and minimum from all stardust from a level 1 star works out to 50k, same as rs in 2009
player.getInventory().add(new Item(COSMIC_RUNE, cosmicRunes), player);
player.getInventory().add(new Item(ASTRAL_RUNE, astralRunes), player);
player.getInventory().add(new Item(GOLD_ORE, goldOre), player);