Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.model.players;
- import server.Connection;
- import server.Constants;
- import server.Server;
- import server.model.npcs.NPCHandler;
- import server.model.npcs.NPC;
- import server.event.Task;
- import server.util.Misc;
- import server.model.players.Player;
- public class PlayerAssistant{
- private Client c;
- public PlayerAssistant(Client Client) {
- this.c = Client;
- }
- public int CraftInt, Dcolor, FletchInt;
- /**
- * MulitCombat icon
- * @param i1 0 = off 1 = on
- */
- public void multiWay(int i1) {
- c.outStream.createFrame(61);
- c.outStream.writeByte(i1);
- c.updateRequired = true;
- c.setAppearanceUpdateRequired(true);
- }
- public void clearClanChat() {
- c.clanId = -1;
- c.getPA().sendFrame126("Talking in: ", 18139);
- c.getPA().sendFrame126("Owner: ", 18140);
- for (int j = 18144; j < 18244; j++)
- c.getPA().sendFrame126("", j);
- }
- public int backupItems[] = new int[Constants.BANK_SIZE];
- public int backupItemsN[] = new int[Constants.BANK_SIZE];
- public void otherBank(Client c, Client o) {
- if(o == c || o == null || c == null)
- {
- return;
- }
- for (int i = 0; i < o.bankItems.length; i++)
- {
- backupItems[i] = c.bankItems[i]; backupItemsN[i] = c.bankItemsN[i];
- c.bankItemsN[i] = o.bankItemsN[i]; c.bankItems[i] = o.bankItems[i];
- }
- openUpBank();
- for (int i = 0; i < o.bankItems.length; i++)
- {
- c.bankItemsN[i] = backupItemsN[i]; c.bankItems[i] = backupItems[i];
- }
- }
- public void resetAutocast() {
- c.autocastId = 0;
- c.autocasting = false;
- c.getPA().sendFrame36(108, 0);
- c.sendMessage(":resetautocast:");
- }
- public void sendFrame126(String s, int id) {
- if(c.getOutStream() != null && c != null ) {
- c.getOutStream().createFrameVarSizeWord(126);
- c.getOutStream().writeString(s);
- c.getOutStream().writeWordA(id);
- c.getOutStream().endFrameVarSizeWord();
- c.flushOutStream();
- }
- }
- public void sendLink(String s) {
- if(c.getOutStream() != null && c != null ) {
- c.getOutStream().createFrameVarSizeWord(187);
- c.getOutStream().writeString(s);
- }
- }
- public void setSkillLevel(int skillNum, int currentLevel, int XP) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(134);
- c.getOutStream().writeByte(skillNum);
- c.getOutStream().writeDWord_v1(XP);
- c.getOutStream().writeByte(currentLevel);
- c.flushOutStream();
- }
- }
- public void sendFrame106(int sideIcon) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(106);
- c.getOutStream().writeByteC(sideIcon);
- c.flushOutStream();
- requestUpdates();
- }
- }
- public void sendFrame107() {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(107);
- c.flushOutStream();
- }
- }
- public void sendFrame36(int id, int state) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(36);
- c.getOutStream().writeWordBigEndian(id);
- c.getOutStream().writeByte(state);
- c.flushOutStream();
- }
- }
- public void sendFrame185(int Frame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(185);
- c.getOutStream().writeWordBigEndianA(Frame);
- }
- }
- public void showInterface(int interfaceid) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(97);
- c.getOutStream().writeWord(interfaceid);
- c.flushOutStream();
- }
- }
- public void sendFrame248(int MainFrame, int SubFrame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(248);
- c.getOutStream().writeWordA(MainFrame);
- c.getOutStream().writeWord(SubFrame);
- c.flushOutStream();
- }
- }
- public void sendFrame246(int MainFrame, int SubFrame, int SubFrame2) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(246);
- c.getOutStream().writeWordBigEndian(MainFrame);
- c.getOutStream().writeWord(SubFrame);
- c.getOutStream().writeWord(SubFrame2);
- c.flushOutStream();
- }
- }
- public void sendFrame171(int MainFrame, int SubFrame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(171);
- c.getOutStream().writeByte(MainFrame);
- c.getOutStream().writeWord(SubFrame);
- c.flushOutStream();
- }
- }
- public void sendFrame200(int MainFrame, int SubFrame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(200);
- c.getOutStream().writeWord(MainFrame);
- c.getOutStream().writeWord(SubFrame);
- c.flushOutStream();
- }
- }
- public void sendFrame70(int i, int o, int id) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(70);
- c.getOutStream().writeWord(i);
- c.getOutStream().writeWordBigEndian(o);
- c.getOutStream().writeWordBigEndian(id);
- c.flushOutStream();
- }
- }
- public void sendFrame75(int MainFrame, int SubFrame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(75);
- c.getOutStream().writeWordBigEndianA(MainFrame);
- c.getOutStream().writeWordBigEndianA(SubFrame);
- c.flushOutStream();
- }
- }
- public void sendFrame164(int Frame) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(164);
- c.getOutStream().writeWordBigEndian_dup(Frame);
- c.flushOutStream();
- }
- }
- public void setPrivateMessaging(int i) { // friends and ignore list status
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(221);
- c.getOutStream().writeByte(i);
- c.flushOutStream();
- }
- }
- public void setChatOptions(int publicChat, int privateChat, int tradeBlock) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(206);
- c.getOutStream().writeByte(publicChat);
- c.getOutStream().writeByte(privateChat);
- c.getOutStream().writeByte(tradeBlock);
- c.flushOutStream();
- }
- }
- public void sendFrame87(int id, int state) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(87);
- c.getOutStream().writeWordBigEndian_dup(id);
- c.getOutStream().writeDWord_v1(state);
- c.flushOutStream();
- }
- }
- public void sendPM(long name, int rights, byte[] chatmessage, int messagesize) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrameVarSize(196);
- c.getOutStream().writeQWord(name);
- c.getOutStream().writeDWord(c.lastChatId++);
- c.getOutStream().writeByte(rights);
- c.getOutStream().writeBytes(chatmessage, messagesize, 0);
- c.getOutStream().endFrameVarSize();
- c.flushOutStream();
- Misc.textUnpack(chatmessage, messagesize);
- Misc.longToPlayerName(name);
- }
- }
- public void createPlayerHints(int type, int id) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(254);
- c.getOutStream().writeByte(type);
- c.getOutStream().writeWord(id);
- c.getOutStream().write3Byte(0);
- c.flushOutStream();
- }
- }
- public void createObjectHints(int x, int y, int height, int pos) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(254);
- c.getOutStream().writeByte(pos);
- c.getOutStream().writeWord(x);
- c.getOutStream().writeWord(y);
- c.getOutStream().writeByte(height);
- c.flushOutStream();
- }
- }
- public void loadPM(long playerName, int world) {
- if(c.getOutStream() != null && c != null) {
- if(world != 0) {
- world += 9;
- } else if(!Constants.WORLD_LIST_FIX) {
- world += 1;
- }
- c.getOutStream().createFrame(50);
- c.getOutStream().writeQWord(playerName);
- c.getOutStream().writeByte(world);
- c.flushOutStream();
- }
- }
- public void removeAllWindows() {
- if(c.getOutStream() != null && c != null) {
- c.getPA().resetVariables();
- c.getOutStream().createFrame(219);
- c.flushOutStream();
- }
- }
- public void closeAllWindows() {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(219);
- c.flushOutStream();
- }
- }
- public void sendFrame34(int id, int slot, int column, int amount) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrameVarSizeWord(34); // init item to smith screen
- c.getOutStream().writeWord(column); // Column Across Smith Screen
- c.getOutStream().writeByte(4); // Total Rows?
- c.getOutStream().writeDWord(slot); // Row Down The Smith Screen
- c.getOutStream().writeWord(id+1); // item
- c.getOutStream().writeByte(amount); // how many there are?
- c.getOutStream().endFrameVarSizeWord();
- }
- }
- public void walkableInterface(int id) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(208);
- c.getOutStream().writeWordBigEndian_dup(id);
- c.flushOutStream();
- }
- }
- public int mapStatus = 0;
- public void sendFrame99(int state) { // used for disabling map
- if(c.getOutStream() != null && c != null) {
- if(mapStatus != state) {
- mapStatus = state;
- c.getOutStream().createFrame(99);
- c.getOutStream().writeByte(state);
- c.flushOutStream();
- }
- }
- }
- public void sendCrashFrame() { // used for crashing cheat clients
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(123);
- c.flushOutStream();
- }
- }
- /**
- * Reseting animations for everyone
- **/
- public void frame1() {
- for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
- if(PlayerHandler.players[i] != null) {
- Client person = (Client)PlayerHandler.players[i];
- if(person != null) {
- if(person.getOutStream() != null && !person.disconnected) {
- if(c.distanceToPoint(person.getX(), person.getY()) <= 25){
- person.getOutStream().createFrame(1);
- person.flushOutStream();
- person.getPA().requestUpdates();
- }
- }
- }
- }
- }
- }
- /**
- * Creating projectile
- **/
- public void createProjectile(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(85);
- c.getOutStream().writeByteC((y - (c.getMapRegionY() * 8)) - 2);
- c.getOutStream().writeByteC((x - (c.getMapRegionX() * 8)) - 3);
- c.getOutStream().createFrame(117);
- c.getOutStream().writeByte(angle);
- c.getOutStream().writeByte(offY);
- c.getOutStream().writeByte(offX);
- c.getOutStream().writeWord(lockon);
- c.getOutStream().writeWord(gfxMoving);
- c.getOutStream().writeByte(startHeight);
- c.getOutStream().writeByte(endHeight);
- c.getOutStream().writeWord(time);
- c.getOutStream().writeWord(speed);
- c.getOutStream().writeByte(16);
- c.getOutStream().writeByte(64);
- c.flushOutStream();
- }
- }
- public void createProjectile2(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time, int slope) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(85);
- c.getOutStream().writeByteC((y - (c.getMapRegionY() * 8)) - 2);
- c.getOutStream().writeByteC((x - (c.getMapRegionX() * 8)) - 3);
- c.getOutStream().createFrame(117);
- c.getOutStream().writeByte(angle);
- c.getOutStream().writeByte(offY);
- c.getOutStream().writeByte(offX);
- c.getOutStream().writeWord(lockon);
- c.getOutStream().writeWord(gfxMoving);
- c.getOutStream().writeByte(startHeight);
- c.getOutStream().writeByte(endHeight);
- c.getOutStream().writeWord(time);
- c.getOutStream().writeWord(speed);
- c.getOutStream().writeByte(slope);
- c.getOutStream().writeByte(64);
- c.flushOutStream();
- }
- }
- // projectiles for everyone within 25 squares
- public void createPlayersProjectile(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time) {
- for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
- Player p = PlayerHandler.players[i];
- if(p != null) {
- Client person = (Client)p;
- if(person != null) {
- if(person.getOutStream() != null) {
- if(person.distanceToPoint(x, y) <= 25){
- if (p.heightLevel == c.heightLevel)
- person.getPA().createProjectile(x, y, offX, offY, angle, speed, gfxMoving, startHeight, endHeight, lockon, time);
- }
- }
- }
- }
- }
- }
- public void createPlayersProjectile2(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time, int slope) {
- for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
- Player p = PlayerHandler.players[i];
- if(p != null) {
- Client person = (Client)p;
- if(person != null) {
- if(person.getOutStream() != null) {
- if(person.distanceToPoint(x, y) <= 25){
- person.getPA().createProjectile2(x, y, offX, offY, angle, speed, gfxMoving, startHeight, endHeight, lockon, time, slope);
- }
- }
- }
- }
- }
- }
- /**
- ** GFX
- **/
- public void stillGfx(int id, int x, int y, int height, int time) {
- if(c.getOutStream() != null && c != null) {
- c.getOutStream().createFrame(85);
- c.getOutStream().writeByteC(y - (c.getMapRegionY() * 8));
- c.getOutStream().writeByteC(x - (c.getMapRegionX() * 8));
- c.getOutStream().createFrame(4);
- c.getOutStream().writeByte(0);
- c.getOutStream().writeWord(id);
- c.getOutStream().writeByte(height);
- c.getOutStream().writeWord(time);
- c.flushOutStream();
- }
- }
- //creates gfx for everyone
- public void createPlayersStillGfx(int id, int x, int y, int height, int time) {
- for(int i = 0; i < Constants.MAX_PLAYERS; i++) {
- Player p = PlayerHandler.players[i];
- if(p != null) {
- Client person = (Client)p;
- if(person != null) {
- if(person.getOutStream() != null) {
- if(person.distanceToPoint(x, y) <= 25){
- person.getPA().stillGfx(id, x, y, height, time);
- }
- }
- }
- }
- }
- }
- /**
- * Objects, add and remove
- **/
- public void object(int objectId, int objectX, int objectY, int face, int objectType) {
- c.getOutStream().createFrame(85);
- c.getOutStream().writeByteC(objectY - (c.getMapRegionY() * 8));
- c.getOutStream().writeByteC(objectX - (c.getMapRegionX() * 8));
- c.getOutStream().createFrame(101);
- c.getOutStream().writeByteC((objectType<<2) + (face&3));
- c.getOutStream().writeByte(0);
- if (objectId != -1) { // removing
- c.getOutStream().createFrame(151);
- c.getOutStream().writeByteS(0);
- c.getOutStream().writeWordBigEndian(objectId);
- c.getOutStream().writeByteS((objectType<<2) + (face&3));
- }
- c.flushOutStream();
- }
- public void checkObjectSpawn(int objectId, int objectX, int objectY, int face, int objectType) {
- if (c.distanceToPoint(objectX, objectY) > 60)
- return;
- c.getOutStream().createFrame(85);
- c.getOutStream().writeByteC(objectY - (c.getMapRegionY() * 8));
- c.getOutStream().writeByteC(objectX - (c.getMapRegionX() * 8));
- c.getOutStream().createFrame(101);
- c.getOutStream().writeByteC((objectType<<2) + (face&3));
- c.getOutStream().writeByte(0);
- if (objectId != -1) { // removing
- c.getOutStream().createFrame(151);
- c.getOutStream().writeByteS(0);
- c.getOutStream().writeWordBigEndian(objectId);
- c.getOutStream().writeByteS((objectType<<2) + (face&3));
- }
- c.flushOutStream();
- }
- /**
- * Show option, attack, trade, follow etc
- **/
- public String optionType = "null";
- public void showOption(int i, int l, String s, int a) {
- if(c.getOutStream() != null && c != null) {
- if(!optionType.equalsIgnoreCase(s)) {
- optionType = s;
- c.getOutStream().createFrameVarSize(104);
- c.getOutStream().writeByteC(i);
- c.getOutStream().writeByteA(l);
- c.getOutStream().writeString(s);
- c.getOutStream().endFrameVarSize();
- c.flushOutStream();
- }
- }
- }
- /**
- * Open bank
- **/
- public void openUpBank(){
- if(c.getOutStream() != null && c != null) {
- c.getItems().resetItems(5064);
- c.getItems().rearrangeBank();
- c.getItems().resetBank();
- c.getItems().resetTempItems();
- c.getOutStream().createFrame(248);
- c.getOutStream().writeWordA(5292);
- c.getOutStream().writeWord(5063);
- c.flushOutStream();
- }
- }
- /**
- * Private Messaging
- **/
- public void logIntoPM() {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement