import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.InetAddress; import java.net.Socket; import java.net.URL; public class mudclient extends GameConnection { /** * Defines the maximum number of items in the right-click context menu. * * @see mudclient#menuIndices * @see mudclient#menuItemX * @see mudclient#menuItemY * @see mudclient#menuItemText1 * @see mudclient#menuSourceType * @see mudclient#menuSourceIndex * @see mudclient#menuTargetIndex * @see mudclient#menuItemID * @see mudclient#menuItemText2 */ private final int menuMaxSize = 250; private final int pathStepsMax = 8000; /** * Defines the maximum number of player characters supported. * * @see mudclient#playerServerIndexes * @see mudclient#players * @see mudclient#knownPlayers */ private final int playersMax = 500; /** * Defines thet maximum number of non-player characters supported. * * @see mudclient#npcsCache * @see mudclient#npcs */ private final int npcsMax = 500; /** * Defines the maximum number of wall objects supported. * * @see mudclient#wallObjectDirection * @see mudclient#wallObjectId * @see mudclient#wallObjectAlreadyInMenu * @see mudclient#wallObjectModel * @see mudclient#wallObjectX * @see mudclient#wallObjectY */ private final int wallObjectsMax = 500; private final int playersServerMax = 4000; private final int groundItemsMax = 5000; private final int npcsServerMax = 5000; private final int objectsMax = 1500; /** * The number of player skills. * * @see mudclient#playerStatCurrent * @see mudclient#playerStatBase * @see mudclient#playerExperience */ private final int playerStatCount = 18; /** * The number of quests shown to the player and read from the server * * @see mudclient#questComplete * @see mudclient#questName */ private final int questCount = 50;// seems most likely private final int playerStatEquipmentCount = 5;// not sure, could also be the number of messages shown on the screen /** * Represents the players local x coordinate in the current region *
* World coordinate obtained by localRegionX + {@link mudclient#regionX} */ int localRegionX; /** * @see mudclient#localRegionX */ int localRegionY; /** * The players index in the server's player array *
* Used to create {@link mudclient#localPlayer}, the player's {@link GameCharacter} reference */ int localPlayerServerIndex; /** * Handle to the control on the {@link Panel} {@link mudclient#panelMessageTabs} * for the chat history text list * * @see mudclient#messageTabSelected */ int controlTextListChat; /** * Handle to the control on the {@link Panel} {@link mudclient#panelMessageTabs} * for all the history text list, as well as the text input * * @see mudclient#messageTabSelected */ int controlTextListAll; /** * Handle to the control on the {@link Panel} {@link mudclient#panelMessageTabs} * for the quest history text list * * @see mudclient#messageTabSelected */ int controlTextListQuest; /** * Handle to the control on the {@link Panel} {@link mudclient#panelMessageTabs} * for the private history text list * * @see mudclient#messageTabSelected */ int controlTextListPrivate; /** * Determines which chat history tab is active. *
* Can be 0 through 3 to represent {@link mudclient#controlTextListAll}, {@link mudclient#controlTextListChat}, * {@link mudclient#controlTextListQuest} or {@link mudclient#controlTextListPrivate} respetively */ int messageTabSelected; /** * Stores the x screen coordinate history of our mouse clicks. Only used in * {@link mudclient#handleMouseDown(int, int, int)} to call {@link mudclient#sendLogout} * if we've been clicking on the same place for a while (presumably to stop dumb powerminers */ int mouseClickXHistory[]; /** * @see mudclient#mouseClickXHistory */ int mouseClickYHistory[]; /** * Holds the message for messages the player has received that are to be shown above players or npcs heads */ String receivedMessages[]; /** * The screen x coordinate to draw the little x that comes up when the screen has been clicked */ int mouseClickXX; /** * @see mudclient#mouseClickXX */ int mouseClickXY; /** * Handle to the control on the {@link Panel} {@link mudclient#panelSocialList} * to list friends or ignores based on {@link mudclient#uiTabSocialSubTab}. *
* Shown when moused over the smiley face ui tab which sets {@link mudclient#showUiTab} = 5 * * @see mudclient#messageTabSelected */ int controlListSocialPlayers; /** * Which sub tab is selected on the {@link Panel} {@link mudclient#panelSocialList} * 0 for friends, 1 for ignore *
* Affects the list shown in {@link mudclient#controlListSocialPlayers} */ int uiTabSocialSubTab; /** * The hash of the target for the private message box. Set when clicked on an entry in the friend list and * {@link mudclient#showDialogSocialInput} = 2 * * @see mudclient #controlListSocialPlayers */ long privateMessageTarget; /** * The name of the item selected from the inventory and ready to be used on something */ String selectedItemName; /** * Handle to the control on the {@link Panel} {@link mudclient#panelQuestList} * to list stats or quests based on {@link mudclient#uiTabPlayerInfoSubTab}. *
* Shown when moused over the chart ui tab which sets {@link mudclient#showUiTab} = 3
*
* @see mudclient#messageTabSelected
*/
int controlListQuest;
/**
* Which sub tab is selected on the player info ui tab
* 0 for player stats, 1 for {@link mudclient#controlListQuest}
*/
int uiTabPlayerInfoSubTab;
int controlListMagic;
int tabMagicPrayer;
private int packetErrorCount;
private int menuIndices[];
private boolean cameraAutoAngleDebug;
private int mouseButtonDownTime;
private int mouseButtonItemCountIncrement;
private int wallObjectDirection[];
private int wallObjectId[];
private int anInt659;
private int anInt660;
private int cameraRotationX;
private int cameraRotationXIncrement;
private Scene scene;
private int inventoryMaxItemCount;
private int bankItemsMax;
private String optionMenuEntry[];
private int newBankItems[];
private int newBankItemsCount[];
private int showDialogReportAbuseStep;
private int loginScreen;
private int teleportBubbleTime[];
private boolean showDialogTradeConfirm;
private boolean tradeConfirmAccepted;
private int receivedMessageX[];
private int receivedMessageY[];
private int receivedMessageMidPoint[];
private int receivedMessageHeight[];
private GameCharacter localPlayer;
private SurfaceSprite surface;
/**
* The Panel instance for messaging tabs.
*/
private Panel panelMessageTabs;
private int menuItemX[];
private int menuItemY[];
private boolean showDialogTrade;
private int bankItems[];
private int bankItemsCount[];
private StreamAudioPlayer audioPlayer;
private int appearanceHeadType;
private int appearanceBodyGender;
private int appearance2Colour;
private int appearanceHairColour;
private int appearanceTopColour;
private int appearanceBottomColour;
private int appearanceSkinColour;
private int appearanceHeadGender;
private String loginUser;
private String loginPass;
private int showDialogSocialInput;
private int cameraAngle;
private int anInt707;
private boolean members;
private int deathScreenTimeout;
private boolean optionSoundDisabled;
private boolean showRightClickMenu;
private int cameraRotationY;
private int cameraRotationYIncrement;
private boolean objectAlreadyInMenu[];
private int combatStyle;
private String menuItemText1[];
private int welcomeUnreadMessages;
private int controlButtonAppearanceHead1;
private int controlButtonAppearanceHead2;
private int controlButtonAppearanceHair1;
private int controlButtonAppearanceHair2;
private int controlButtonAppearanceGender1;
private int controlButtonAppearanceGender2;
private int controlButtonAppearanceTop1;
private int controlButtonAppearanceTop2;
private int controlButtonAppearanceSkin1;
private int controlButtonAppearanceSkin2;
private int controlButtonAppearanceBottom1;
private int controlButtonAppearanceBottom2;
private int controlButtonAppearanceAccept;
private int logoutTimeout;
private long tradeRecipientConfirmHash;
private int loginTimer;
private int npcCombatModelArray2[] = {
0, 0, 0, 0, 0, 1, 2, 1
};
private int systemUpdate;
private String duelOpponentName;
private int lastObjectAnimationNumberFireLightningSpell;
private int lastObjectAnimationNumberTorch;
private int lastOjectAnimationNumberClaw;
//private Graphics graphics;
private int regionX;
private int regionY;
private int planeIndex;
//private String aString744;// unused
private boolean welcomScreenAlreadyShown;
private int mouseButtonClick;
private boolean isSleeping;
private int cameraRotation;
private String questName[] = {
"Black knight's fortress", "Cook's assistant", "Demon slayer", "Doric's quest", "The restless ghost", "Goblin diplomacy", "Ernest the chicken", "Imp catcher", "Pirate's treasure", "Prince Ali rescue",
"Romeo & Juliet", "Sheep shearer", "Shield of Arrav", "The knight's sword", "Vampire slayer", "Witch's potion", "Dragon slayer", "Witch's house (members)", "Lost city (members)", "Hero's quest (members)",
"Druidic ritual (members)", "Merlin's crystal (members)", "Scorpion catcher (members)", "Family crest (members)", "Tribal totem (members)", "Fishing contest (members)", "Monk's friend (members)", "Temple of Ikov (members)", "Clock tower (members)", "The Holy Grail (members)",
"Fight Arena (members)", "Tree Gnome Village (members)", "The Hazeel Cult (members)", "Sheep Herder (members)", "Plague City (members)", "Sea Slug (members)", "Waterfall quest (members)", "Biohazard (members)", "Jungle potion (members)", "Grand tree (members)",
"Shilo village (members)", "Underground pass (members)", "Observatory quest (members)", "Tourist trap (members)", "Watchtower (members)", "Dwarf Cannon (members)", "Murder Mystery (members)", "Digsite (members)", "Gertrude's Cat (members)", "Legend's Quest (members)"
};
private int teleportBubbleX[];
private boolean errorLoadingData;
private int playerExperience[];
private int healthBarCount;
private int spriteMedia;
private int spriteUtil;
private int spriteItem;
private int spriteProjectile;
private int spriteTexture;
private int spriteTextureWorld;
private int spriteLogo;
private int controlLoginStatus;
private int controlLoginUser;
private int controlLoginPass;
private int controlLoginOk;
private int controlLoginCancel;
private boolean tradeRecipientAccepted;
private boolean tradeAccepted;
private int teleportBubbleCount;
private int mouseClickCount;
private int shopSellPriceMod;
private int shopBuyPriceMod;
private boolean showDialogWelcome;
private int duelOptionRetreat;
private int duelOptionMagic;
private int duelOptionPrayer;
private int duelOptionWeapons;
private int playerServerIndexes[];
private int groundItemCount;
private int teleportBubbleY[];
private int receivedMessagesCount;
private int messageTabFlashAll;
private int messageTabFlashHistory;
private int messtageTabFlashQuest;
private int messageTabFlashPrivate;
private boolean showDialogDuelConfirm;
private boolean duelAccepted;
private GameCharacter players[];
private int bankItemCount;
private boolean prayerOn[];
//private String aString793;// unused
private int menuSourceType[];
private int menuSourceIndex[];
private int menuTargetIndex[];
private boolean wallObjectAlreadyInMenu[];
private int objectAnimationNumberFireLightningSpell;
private int objectAnimationNumberTorch;
private int objectAnimationNumberClaw;
private int magicLoc;
private int loggedIn;
private int npcCount;
private int npcCacheCount;
private int objectAnimationCount;
private boolean errorLoadingMemory;
private boolean fogOfWar;
private int gameWidth;
private int gameHeight;
private int const_9;
private int tradeConfirmItemsCount;
private int tradeConfirmItems[];
private int tradeConfirmItemCount[];
private String tradeRecipientName;
private int selectedSpell;
private boolean showOptionMenu;
private int mouseClickXStep;
private int newBankItemCount;
private int npcAnimationArray[][] = {
{
11, 2, 9, 7, 1, 6, 10, 0, 5, 8,
3, 4
}, {
11, 2, 9, 7, 1, 6, 10, 0, 5, 8,
3, 4
}, {
11, 3, 2, 9, 7, 1, 6, 10, 0, 5,
8, 4
}, {
3, 4, 2, 9, 7, 1, 6, 10, 8, 11,
0, 5
}, {
3, 4, 2, 9, 7, 1, 6, 10, 8, 11,
0, 5
}, {
4, 3, 2, 9, 7, 1, 6, 10, 8, 11,
0, 5
}, {
11, 4, 2, 9, 7, 1, 6, 10, 0, 5,
8, 3
}, {
11, 2, 9, 7, 1, 6, 10, 0, 5, 8,
4, 3
}
};
private int playerStatCurrent[];
private int controlWelcomeNewuser;
private int controlWelcomeExistinguser;
private int npcWalkModel[] = {
0, 1, 2, 1
};
private int referid;
private int anInt827;
private int controlLoginNewOk;
private int teleportBubbleType[];
private Panel panelLoginWelcome;
private int combatTimeout;
private Panel panelLoginNewuser;
private int optionMenuCount;
private boolean errorLoadingCodebase;
private boolean showDialogShop;
private int shopItem[];
private int shopItemCount[];
private int shopItemPrice[];
private boolean duelOfferOpponentAccepted;
private boolean duelOfferAccepted;
private GameModel gameModels[];
private int reportAbuseOffence;
private boolean showDialogDuel;
private String serverMessage;
private boolean serverMessageBoxTop;
private int cameraRotationTime;
private int duelOpponentItemsCount;
private int duelOpponentItems[];
private int duelOpponentItemCount[];
private int duelItemsCount;
private int duelItems[];
private int duelItemCount[];
private Panel panelSocialList;
private int playerStatBase[];
private GameCharacter npcsCache[];
private boolean appletMode;
private int characterSkinColours[] = {
0xecded0, 0xccb366, 0xb38c40, 0x997326, 0x906020
};
private int groundItemX[];
private int groundItemY[];
private int groundItemId[];
private int groundItemZ[];
private int bankSelectedItemSlot;
private int bankSelectedItem;
private int duelOfferOpponentItemCount;
private int duelOfferOpponentItemId[];
private int duelOfferOpponentItemStack[];
private int messageHistoryTimeout[];
private boolean optionCameraModeAuto;
private int objectX[];
private int objectY[];
private int objectId[];
private int objectDirection[];
private int characterTopBottomColours[] = {
0xff0000, 0xff8000, 0xffe000, 0xa0e000, 57344, 32768, 41088, 45311, 33023, 12528,
0xe000e0, 0x303030, 0x604000, 0x805000, 0xffffff
};
private int itemsAboveHeadCount;
private int showUiWildWarn;
private int selectedItemInventoryIndex;
private byte soundData[];
private int statFatigue;
private int fatigueSleeping;
private boolean loadingArea;
private int tradeRecipientConfirmItemsCount;
private int tradeRecipientConfirmItems[];
private int tradeRecipientConfirmItemCount[];
private int tradeRecipientItemsCount;
private int tradeRecipientItems[];
private int tradeRecipientItemCount[];
private boolean showDialogServermessage;
private int menuItemID[];
private boolean questComplete[];
private GameModel wallObjectModel[];
private int menuX;
private int menuY;
private int menuWidth;
private int menuHeight;
private int menuItemsCount;
private int actionBubbleX[];
private int actionBubbleY[];
private Panel panelQuestList;
private int cameraZoom;
private Panel panelMagic;
private int showUiTab;
private int tradeItemsCount;
private int tradeItems[];
private int tradeItemCount[];
private int planeWidth;
private int planeHeight;
private int planeMultiplier;
private int lastHeightOffset;
//private int anInt917;// unused
private boolean duelSettingsRetreat;
private boolean duelSettingsMagic;
private boolean duelSettingsPrayer;
private boolean duelSettingsWeapons;
private boolean showDialogBank;
private int playerQuestPoints;
private String loginUserDesc;
private String loginUserDisp;
private int characterHairColours[] = {
0xffc030, 0xffa040, 0x805030, 0x604020, 0x303030, 0xff6020, 0xff4000, 0xffffff, 65280, 65535
};
private int bankActivePage;
private int welcomeLastLoggedInDays;
private String equipmentStatNames[] = {
"Armour", "WeaponAim", "WeaponPower", "Magic", "Prayer"
};
private boolean optionMouseButtonOne;
private int inventoryItemsCount;
private int inventoryItemId[];
private int inventoryItemStackCount[];
private int inventoryEquipped[];
private String skillNameShort[] = {
"Attack", "Defense", "Strength", "Hits", "Ranged", "Prayer", "Magic", "Cooking", "Woodcut", "Fletching",
"Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblaw", "Agility", "Thieving"
};
private GameCharacter knownPlayers[];
private String messageHistory[];
private long duelOpponentNameHash;
private Panel panelAppearance;
private int minimapRandom_1;
private int minimapRandom_2;
private Panel panelLoginExistinguser;
private boolean reportAbuseMute;
private int objectCount;
private int duelOfferItemCount;
private int duelOfferItemId[];
private int duelOfferItemStack[];
private int cameraAutoRotatePlayerX;
private int cameraAutoRotatePlayerY;
private int actionBubbleScale[];
private int actionBubbleItem[];
private boolean sleepWordDelay;
private boolean showAppearanceChange;
private int shopSelectedItemIndex;
private int shopSelectedItemType;
private int projectileMaxRange;
private String sleepingStatusText;
private int npcCombatModelArray1[] = {
0, 1, 2, 1, 0, 0, 0, 0
};
private GameCharacter npcs[];
private int experienceArray[];
private int healthBarX[];
private int healthBarY[];
private int healthBarMissing[];
private String skillNameLong[] = {
"Attack", "Defense", "Strength", "Hits", "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching",
"Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblaw", "Agility", "Thieving"
};
private GameCharacter playerServer[];
private int playerCount;
private int knownPlayerCount;
private int spriteCount;
private int walkPathX[];
private int walkPathY[];
private String welcomeLastLoggedInHost;
private int wallObjectCount;
private int wallObjectX[];
private int wallObjectY[];
private int welcomeRecoverySetDays;
private int localLowerX;
private int localLowerY;
private int localUpperX;
private int localUpperY;
private int welcomeLastLoggedInIP;
private String menuItemText2[];
private GameCharacter npcsServer[];
private int sleepWordDelayTimer;
private int playerStatEquipment[];
private World world;
private GameModel objectModel[];
public mudclient() {
menuIndices = new int[menuMaxSize];
cameraAutoAngleDebug = false;
wallObjectDirection = new int[wallObjectsMax];
wallObjectId = new int[wallObjectsMax];
cameraRotationXIncrement = 2;
inventoryMaxItemCount = 30;
bankItemsMax = 48;
optionMenuEntry = new String[5];
newBankItems = new int[256];
newBankItemsCount = new int[256];
teleportBubbleTime = new int[50];
showDialogTradeConfirm = false;
tradeConfirmAccepted = false;
receivedMessageX = new int[50];
receivedMessageY = new int[50];
receivedMessageMidPoint = new int[50];
receivedMessageHeight = new int[50];
localPlayer = new GameCharacter();
localPlayerServerIndex = -1;
menuItemX = new int[menuMaxSize];
menuItemY = new int[menuMaxSize];
showDialogTrade = false;
bankItems = new int[256];
bankItemsCount = new int[256];
appearanceBodyGender = 1;
appearance2Colour = 2;
appearanceHairColour = 2;
appearanceTopColour = 8;
appearanceBottomColour = 14;
appearanceHeadGender = 1;
loginUser = "";
loginPass = "";
cameraAngle = 1;
members = false;
optionSoundDisabled = false;
showRightClickMenu = false;
cameraRotationYIncrement = 2;
objectAlreadyInMenu = new boolean[objectsMax];
menuItemText1 = new String[menuMaxSize];
duelOpponentName = "";
lastObjectAnimationNumberFireLightningSpell = -1;
lastObjectAnimationNumberTorch = -1;
lastOjectAnimationNumberClaw = -1;
planeIndex = -1;
//aString744 = "";// unused
welcomScreenAlreadyShown = false;
isSleeping = false;
cameraRotation = 128;
teleportBubbleX = new int[50];
errorLoadingData = false;
playerExperience = new int[playerStatCount];
tradeRecipientAccepted = false;
tradeAccepted = false;
mouseClickXHistory = new int[8192];
mouseClickYHistory = new int[8192];
showDialogWelcome = false;
playerServerIndexes = new int[playersMax];
teleportBubbleY = new int[50];
receivedMessages = new String[50];
showDialogDuelConfirm = false;
duelAccepted = false;
players = new GameCharacter[playersMax];
prayerOn = new boolean[50];
//aString793 = "";// unused
menuSourceType = new int[menuMaxSize];
menuSourceIndex = new int[menuMaxSize];
menuTargetIndex = new int[menuMaxSize];
wallObjectAlreadyInMenu = new boolean[wallObjectsMax];
magicLoc = 128;
errorLoadingMemory = false;
fogOfWar = false;
gameWidth = appletWidth; // 512
gameHeight = appletHeight - 10; // 334
const_9 = 9;
tradeConfirmItems = new int[14];
tradeConfirmItemCount = new int[14];
tradeRecipientName = "";
selectedSpell = -1;
showOptionMenu = false;
playerStatCurrent = new int[playerStatCount];
teleportBubbleType = new int[50];
errorLoadingCodebase = false;
showDialogShop = false;
shopItem = new int[256];
shopItemCount = new int[256];
shopItemPrice = new int[256];
duelOfferOpponentAccepted = false;
duelOfferAccepted = false;
gameModels = new GameModel[1000];
showDialogDuel = false;
serverMessage = "";
serverMessageBoxTop = false;
duelOpponentItems = new int[8];
duelOpponentItemCount = new int[8];
duelItems = new int[8];
duelItemCount = new int[8];
playerStatBase = new int[playerStatCount];
npcsCache = new GameCharacter[npcsMax];
appletMode = true;
groundItemX = new int[groundItemsMax];
groundItemY = new int[groundItemsMax];
groundItemId = new int[groundItemsMax];
groundItemZ = new int[groundItemsMax];
bankSelectedItemSlot = -1;
bankSelectedItem = -2;
duelOfferOpponentItemId = new int[8];
duelOfferOpponentItemStack = new int[8];
messageHistoryTimeout = new int[5];
optionCameraModeAuto = true;
objectX = new int[objectsMax];
objectY = new int[objectsMax];
objectId = new int[objectsMax];
objectDirection = new int[objectsMax];
selectedItemInventoryIndex = -1;
selectedItemName = "";
loadingArea = false;
tradeRecipientConfirmItems = new int[14];
tradeRecipientConfirmItemCount = new int[14];
tradeRecipientItems = new int[14];
tradeRecipientItemCount = new int[14];
showDialogServermessage = false;
menuItemID = new int[menuMaxSize];
questComplete = new boolean[questCount];
wallObjectModel = new GameModel[wallObjectsMax];
actionBubbleX = new int[50];
actionBubbleY = new int[50];
cameraZoom = 550;
tradeItems = new int[14];
tradeItemCount = new int[14];
lastHeightOffset = -1;
//anInt917 = 12345678;// unused
duelSettingsRetreat = false;
duelSettingsMagic = false;
duelSettingsPrayer = false;
duelSettingsWeapons = false;
showDialogBank = false;
loginUserDesc = "";
loginUserDisp = "";
optionMouseButtonOne = false;
inventoryItemId = new int[35];
inventoryItemStackCount = new int[35];
inventoryEquipped = new int[35];
knownPlayers = new GameCharacter[playersMax];
messageHistory = new String[5];
reportAbuseMute = false;
duelOfferItemId = new int[8];
duelOfferItemStack = new int[8];
actionBubbleScale = new int[50];
actionBubbleItem = new int[50];
sleepWordDelay = true;
showAppearanceChange = false;
shopSelectedItemIndex = -1;
shopSelectedItemType = -2;
projectileMaxRange = 40;
npcs = new GameCharacter[npcsMax];
experienceArray = new int[99];
healthBarX = new int[50];
healthBarY = new int[50];
healthBarMissing = new int[50];
playerServer = new GameCharacter[playersServerMax];
walkPathX = new int[pathStepsMax];
walkPathY = new int[pathStepsMax];
wallObjectX = new int[wallObjectsMax];
wallObjectY = new int[wallObjectsMax];
menuItemText2 = new String[menuMaxSize];
npcsServer = new GameCharacter[npcsServerMax];
playerStatEquipment = new int[playerStatEquipmentCount];
objectModel = new GameModel[objectsMax];
}
public static void main(String args[]) {
mudclient mc = new mudclient();
mc.appletMode = false;
if (args.length > 0 && args[0].equals("members"))
mc.members = true;
if (args.length > 1)
mc.server = args[1];
if (args.length > 2)
mc.port = Integer.parseInt(args[2]);
if (args.length > 3)
Version.CLIENT = Integer.parseInt(args[3]);
mc.startApplication(mc.gameWidth, mc.gameHeight + 11, "Runescape by Andrew Gower", false);
mc.threadSleep = 10;
}
private static String formatNumber(int i) // wonder why this wasn't in the utility class
{
String s = String.valueOf(i);
for (int j = s.length() - 3; j > 0; j -= 3)
s = s.substring(0, j) + "," + s.substring(j);
if (s.length() > 8)
s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
else if (s.length() > 4)
s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
return s;
}
private void playSoundFile(String s) {
if (audioPlayer == null)
return;
if (!optionSoundDisabled)
audioPlayer.writeStream(soundData, Utility.getDataFileOffset(s + ".pcm", soundData), Utility.getDataFileLength(s + ".pcm", soundData));
}
private void drawDialogReportAbuse() {
reportAbuseOffence = 0;
int y = 135;
for (int i = 0; i < 12; i++) {
if (super.mouseX > 66 && super.mouseX < 446 && super.mouseY >= y - 12 && super.mouseY < y + 3)
reportAbuseOffence = i + 1;
y += 14;
}
if (mouseButtonClick != 0 && reportAbuseOffence != 0) {
mouseButtonClick = 0;
showDialogReportAbuseStep = 2;
super.inputTextCurrent = "";
super.inputTextFinal = "";
return;
}
y += 15;
if (mouseButtonClick != 0) {
mouseButtonClick = 0;
if (super.mouseX < 56 || super.mouseY < 35 || super.mouseX > 456 || super.mouseY > 325) {
showDialogReportAbuseStep = 0;
return;
}
if (super.mouseX > 66 && super.mouseX < 446 && super.mouseY >= y - 15 && super.mouseY < y + 5) {
showDialogReportAbuseStep = 0;
return;
}
}
surface.drawBox(56, 35, 400, 290, 0);
surface.drawBoxEdge(56, 35, 400, 290, 0xffffff);
y = 50;
surface.drawStringCenter("This form is for reporting players who are breaking our rules", 256, y, 1, 0xffffff);
y += 15;
surface.drawStringCenter("Using it sends a snapshot of the last 60 secs of activity to us", 256, y, 1, 0xffffff);
y += 15;
surface.drawStringCenter("If you misuse this form, you will be banned.", 256, y, 1, 0xff8000);
y += 15;
y += 10;
surface.drawStringCenter("First indicate which of our 12 rules is being broken. For a detailed", 256, y, 1, 0xffff00);
y += 15;
surface.drawStringCenter("explanation of each rule please read the manual on our website.", 256, y, 1, 0xffff00);
y += 15;
int textColour;
if (reportAbuseOffence == 1) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("1: Offensive language", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 2) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("2: Item scamming", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 3) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("3: Password scamming", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 4) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("4: Bug abuse", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 5) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("5: Jagex Staff impersonation", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 6) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("6: Account sharing/trading", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 7) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("7: Macroing", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 8) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("8: Mutiple logging in", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 9) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("9: Encouraging others to break rules", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 10) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("10: Misuse of customer support", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 11) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("11: Advertising / website", 256, y, 1, textColour);
y += 14;
if (reportAbuseOffence == 12) {
surface.drawBoxEdge(66, y - 12, 380, 15, 0xffffff);
textColour = 0xff8000;
} else {
textColour = 0xffffff;
}
surface.drawStringCenter("12: Real world item trading", 256, y, 1, textColour);
y += 14;
y += 15;
textColour = 0xffffff;
if (super.mouseX > 196 && super.mouseX < 316 && super.mouseY > y - 15 && super.mouseY < y + 5)
textColour = 0xffff00;
surface.drawStringCenter("Click here to cancel", 256, y, 1, textColour);
}
private boolean walkToActionSource(int startX, int startY, int x1, int y1, int x2, int y2, boolean checkObjects, boolean walkToAction) {
int steps = world.route(startX, startY, x1, y1, x2, y2, walkPathX, walkPathY, checkObjects);
if (steps == -1)
if (walkToAction) {
steps = 1;
walkPathX[0] = x1;
walkPathY[0] = y1;
} else {
return false;
}
steps--;
startX = walkPathX[steps];
startY = walkPathY[steps];
steps--;
if (walkToAction)
super.clientStream.newPacket((Command.CL_WALK_ACTION));
else
super.clientStream.newPacket((Command.CL_WALK));
super.clientStream.putShort(startX + regionX);
super.clientStream.putShort(startY + regionY);
if (walkToAction && steps == -1 && (startX + regionX) % 5 == 0)
steps = 0;
for (int l1 = steps; l1 >= 0 && l1 > steps - 25; l1--) {
super.clientStream.putByte(walkPathX[l1] - startX);
super.clientStream.putByte(walkPathY[l1] - startY);
}
super.clientStream.sendPacket();
mouseClickXStep = -24;
mouseClickXX = super.mouseX;
mouseClickXY = super.mouseY;
return true;
}
private boolean walkTo(int startX, int startY, int x1, int y1, int x2, int y2, boolean checkObjects,
boolean walkToAction) {
int steps = world.route(startX, startY, x1, y1, x2, y2, walkPathX, walkPathY, checkObjects);
if (steps == -1)
return false;
steps--;
startX = walkPathX[steps];
startY = walkPathY[steps];
steps--;
if (walkToAction)
super.clientStream.newPacket((Command.CL_WALK_ACTION));
else
super.clientStream.newPacket((Command.CL_WALK));
super.clientStream.putShort(startX + regionX);
super.clientStream.putShort(startY + regionY);
if (walkToAction && steps == -1 && (startX + regionX) % 5 == 0)
steps = 0;
for (int l1 = steps; l1 >= 0 && l1 > steps - 25; l1--) {
super.clientStream.putByte(walkPathX[l1] - startX);
super.clientStream.putByte(walkPathY[l1] - startY);
}
super.clientStream.sendPacket();
mouseClickXStep = -24;
mouseClickXX = super.mouseX;
mouseClickXY = super.mouseY;
return true;
}
/*
public String getParameter(String s) {
return super.getParameter(s);
}*/
private void drawMinimapEntity(int x, int y, int c) {
surface.setPixel(x, y, c);
surface.setPixel(x - 1, y, c);
surface.setPixel(x + 1, y, c);
surface.setPixel(x, y - 1, c);
surface.setPixel(x, y + 1, c);
}
private void updateBankItems() {
bankItemCount = newBankItemCount;
for (int i = 0; i < newBankItemCount; i++) {
bankItems[i] = newBankItems[i];
bankItemsCount[i] = newBankItemsCount[i];
}
for (int invidx = 0; invidx < inventoryItemsCount; invidx++) {
if (bankItemCount >= bankItemsMax)
break;
int invid = inventoryItemId[invidx];
boolean hasitemininv = false;
for (int bankidx = 0; bankidx < bankItemCount; bankidx++) {
if (bankItems[bankidx] != invid)
continue;
hasitemininv = true;
break;
}
if (!hasitemininv) {
bankItems[bankItemCount] = invid;
bankItemsCount[bankItemCount] = 0;
bankItemCount++;
}
}
}
private void drawDialogWildWarn() {
int y = 97;
surface.drawBox(86, 77, 340, 180, 0);
surface.drawBoxEdge(86, 77, 340, 180, 0xffffff);
surface.drawStringCenter("Warning! Proceed with caution", 256, y, 4, 0xff0000);
y += 26;
surface.drawStringCenter("If you go much further north you will enter the", 256, y, 1, 0xffffff);
y += 13;
surface.drawStringCenter("wilderness. This a very dangerous area where", 256, y, 1, 0xffffff);
y += 13;
surface.drawStringCenter("other players can attack you!", 256, y, 1, 0xffffff);
y += 22;
surface.drawStringCenter("The further north you go the more dangerous it", 256, y, 1, 0xffffff);
y += 13;
surface.drawStringCenter("becomes, but the more treasure you will find.", 256, y, 1, 0xffffff);
y += 22;
surface.drawStringCenter("In the wilderness an indicator at the bottom-right", 256, y, 1, 0xffffff);
y += 13;
surface.drawStringCenter("of the screen will show the current level of danger", 256, y, 1, 0xffffff);
y += 22;
int j = 0xffffff;
if (super.mouseY > y - 12 && super.mouseY <= y && super.mouseX > 181 && super.mouseX < 331)
j = 0xff0000;
surface.drawStringCenter("Click here to close window", 256, y, 1, j);
if (mouseButtonClick != 0) {
if (super.mouseY > y - 12 && super.mouseY <= y && super.mouseX > 181 && super.mouseX < 331)
showUiWildWarn = 2;
if (super.mouseX < 86 || super.mouseX > 426 || super.mouseY < 77 || super.mouseY > 257)
showUiWildWarn = 2;
mouseButtonClick = 0;
}
}
private void drawAboveHeadStuff() {
for (int msgidx = 0; msgidx < receivedMessagesCount; msgidx++) {
int txtheight = surface.textHeight(1);
int x = receivedMessageX[msgidx];
int y = receivedMessageY[msgidx];
int mid = receivedMessageMidPoint[msgidx];
int msgheight = receivedMessageHeight[msgidx];
boolean flag = true;
while (flag) {
flag = false;
for (int i4 = 0; i4 < msgidx; i4++)
if (y + msgheight > receivedMessageY[i4] - txtheight && y - txtheight < receivedMessageY[i4] + receivedMessageHeight[i4] && x - mid < receivedMessageX[i4] + receivedMessageMidPoint[i4] && x + mid > receivedMessageX[i4] - receivedMessageMidPoint[i4] && receivedMessageY[i4] - txtheight - msgheight < y) {
y = receivedMessageY[i4] - txtheight - msgheight;
flag = true;
}
}
receivedMessageY[msgidx] = y;
surface.centrepara(receivedMessages[msgidx], x, y, 1, 0xffff00, 300);
}
for (int itemidx = 0; itemidx < itemsAboveHeadCount; itemidx++) {
int x = actionBubbleX[itemidx];
int y = actionBubbleY[itemidx];
int scale = actionBubbleScale[itemidx];
int id = actionBubbleItem[itemidx];
int scaleX = (39 * scale) / 100;
int scaleY = (27 * scale) / 100;
surface.drawActionBubble(x - scaleX / 2, y - scaleY, scaleX, scaleY, spriteMedia + 9, 85);
int scaleXClip = (36 * scale) / 100;
int scaleYClip = (24 * scale) / 100;
surface.spriteClipping(x - scaleXClip / 2, (y - scaleY + scaleY / 2) - scaleYClip / 2, scaleXClip, scaleYClip, GameData.itemPicture[id] + spriteItem, GameData.itemMask[id], 0, 0, false);
}
for (int j1 = 0; j1 < healthBarCount; j1++) {
int i2 = healthBarX[j1];
int l2 = healthBarY[j1];
int k3 = healthBarMissing[j1];
surface.drawBoxAlpha(i2 - 15, l2 - 3, k3, 5, 65280, 192);
surface.drawBoxAlpha((i2 - 15) + k3, l2 - 3, 30 - k3, 5, 0xff0000, 192);
}
}
protected Socket createSocket(String addr, int port) throws IOException {
Socket socket1;
/*if (getStartedAsApplet())
socket1 = new Socket(InetAddress.getByName(getCodeBase().getHost()), port);
else*/
socket1 = new Socket(InetAddress.getByName(addr), port);
socket1.setSoTimeout(30000);
socket1.setTcpNoDelay(true);
return socket1;
}
private void walkToActionSource(int sx, int sy, int dx, int dy, boolean action) {
walkToActionSource(sx, sy, dx, dy, dx, dy, false, action);
}
private void createMessageTabPanel() {
panelMessageTabs = new Panel(surface, 10);
controlTextListChat = panelMessageTabs.addTextList(5, 269, 502, 56, 1, 20, true);
controlTextListAll = panelMessageTabs.addTextListInput(7, 324, 498, 14, 1, 80, false, true);
controlTextListQuest = panelMessageTabs.addTextList(5, 269, 502, 56, 1, 20, true);
controlTextListPrivate = panelMessageTabs.addTextList(5, 269, 502, 56, 1, 20, true);
panelMessageTabs.setFocus(controlTextListAll);
}
private void disposeAndCollect() {
try {
if (surface != null) {
surface.clear();
surface.pixels = null;
surface = null;
}
if (scene != null) {
scene.dispose();
scene = null;
}
gameModels = null;
objectModel = null;
wallObjectModel = null;
playerServer = null;
players = null;
npcsServer = null;
npcs = null;
localPlayer = null;
if (world != null) {
world.terrainModels = null;
world.wallModels = null;
world.roofModels = null;
world.parentModel = null;
world = null;
}
System.gc();
return;
} catch (Exception Ex) {
return;
}
}
private void drawUi() {
if (logoutTimeout != 0)
drawDialogLogout();
else if (showDialogWelcome)
drawDialogWelcome();
else if (showDialogServermessage)
drawDialogServermessage();
else if (showUiWildWarn == 1)
drawDialogWildWarn();
else if (showDialogBank && combatTimeout == 0)
drawDialogBank();
else if (showDialogShop && combatTimeout == 0)
drawDialogShop();
else if (showDialogTradeConfirm)
drawDialogTradeConfirm();
else if (showDialogTrade)
drawDialogTrade();
else if (showDialogDuelConfirm)
drawDialogDuelConfirm();
else if (showDialogDuel)
drawDialogDuel();
else if (showDialogReportAbuseStep == 1)
drawDialogReportAbuse();
else if (showDialogReportAbuseStep == 2)
drawDialogReportAbuseInput();
else if (showDialogSocialInput != 0) {
drawDialogSocialInput();
} else {
if (showOptionMenu)
drawOptionMenu();
if (localPlayer.animationCurrent == 8 || localPlayer.animationCurrent == 9)
drawDialogCombatStyle();
setActiveUiTab();
boolean nomenus = !showOptionMenu && !showRightClickMenu;
if (nomenus)
menuItemsCount = 0;
if (showUiTab == 0 && nomenus)
createRightClickMenu();
if (showUiTab == 1)
drawUiTabInventory(nomenus);
if (showUiTab == 2)
drawUiTabMinimap(nomenus);
if (showUiTab == 3)
drawUiTabPlayerInfo(nomenus);
if (showUiTab == 4)
drawUiTabMagic(nomenus);
if (showUiTab == 5)
drawUiTabSocial(nomenus);
if (showUiTab == 6)
drawUiTabOptions(nomenus);
if (!showRightClickMenu && !showOptionMenu)
createTopMouseMenu();
if (showRightClickMenu && !showOptionMenu)
drawRightClickMenu();
}
mouseButtonClick = 0;
}
private void drawDialogTrade() {
if (mouseButtonClick != 0 && mouseButtonItemCountIncrement == 0)
mouseButtonItemCountIncrement = 1;
if (mouseButtonItemCountIncrement > 0) {
int mouseX = super.mouseX - 22;
int mouseY = super.mouseY - 36;
if (mouseX >= 0 && mouseY >= 0 && mouseX < 468 && mouseY < 262) {
if (mouseX > 216 && mouseY > 30 && mouseX < 462 && mouseY < 235) {
int slot = (mouseX - 217) / 49 + ((mouseY - 31) / 34) * 5;
if (slot >= 0 && slot < inventoryItemsCount) {
boolean sendUpdate = false;
int itemCountAdd = 0;
int itemType = inventoryItemId[slot];
for (int itemIndex = 0; itemIndex < tradeItemsCount; itemIndex++)
if (tradeItems[itemIndex] == itemType)
if (GameData.itemStackable[itemType] == 0) {
for (int i4 = 0; i4 < mouseButtonItemCountIncrement; i4++) {
if (tradeItemCount[itemIndex] < inventoryItemStackCount[slot])
tradeItemCount[itemIndex]++;
sendUpdate = true;
}
} else {
itemCountAdd++;
}
if (getInventoryCount(itemType) <= itemCountAdd)
sendUpdate = true;
if (GameData.itemSpecial[itemType] == 1) { // quest items? or just tagged as 'special'
showMessage("This object cannot be traded with other players", 3);
sendUpdate = true;
}
if (!sendUpdate && tradeItemsCount < 12) {
tradeItems[tradeItemsCount] = itemType;
tradeItemCount[tradeItemsCount] = 1;
tradeItemsCount++;
sendUpdate = true;
}
if (sendUpdate) {
super.clientStream.newPacket((Command.CL_TRADE_ITEM_UPDATE));
super.clientStream.putByte(tradeItemsCount);
for (int j4 = 0; j4 < tradeItemsCount; j4++) {
super.clientStream.putShort(tradeItems[j4]);
super.clientStream.putInt(tradeItemCount[j4]);
}
super.clientStream.sendPacket();
tradeRecipientAccepted = false;
tradeAccepted = false;
}
}
}
if (mouseX > 8 && mouseY > 30 && mouseX < 205 && mouseY < 133) {
int itemIndex = (mouseX - 9) / 49 + ((mouseY - 31) / 34) * 4;
if (itemIndex >= 0 && itemIndex < tradeItemsCount) {
int itemType = tradeItems[itemIndex];
for (int i2 = 0; i2 < mouseButtonItemCountIncrement; i2++) {
if (GameData.itemStackable[itemType] == 0 && tradeItemCount[itemIndex] > 1) {
tradeItemCount[itemIndex]--;
continue;
}
tradeItemsCount--;
mouseButtonDownTime = 0;
for (int l2 = itemIndex; l2 < tradeItemsCount; l2++) {
tradeItems[l2] = tradeItems[l2 + 1];
tradeItemCount[l2] = tradeItemCount[l2 + 1];
}
break;
}
super.clientStream.newPacket((Command.CL_TRADE_ITEM_UPDATE));
super.clientStream.putByte(tradeItemsCount);
for (int i3 = 0; i3 < tradeItemsCount; i3++) {
super.clientStream.putShort(tradeItems[i3]);
super.clientStream.putInt(tradeItemCount[i3]);
}
super.clientStream.sendPacket();
tradeRecipientAccepted = false;
tradeAccepted = false;
}
}
if (mouseX >= 217 && mouseY >= 238 && mouseX <= 286 && mouseY <= 259) {
tradeAccepted = true;
super.clientStream.newPacket((Command.CL_TRADE_ACCEPT));
super.clientStream.sendPacket();
}
if (mouseX >= 394 && mouseY >= 238 && mouseX < 463 && mouseY < 259) {
showDialogTrade = false;
super.clientStream.newPacket((Command.CL_TRADE_DECLINE));
super.clientStream.sendPacket();
}
} else if (mouseButtonClick != 0) {
showDialogTrade = false;
super.clientStream.newPacket((Command.CL_TRADE_DECLINE));
super.clientStream.sendPacket();
}
mouseButtonClick = 0;
mouseButtonItemCountIncrement = 0;
}
if (!showDialogTrade)
return;
byte dialogX = 22;
byte dialogY = 36;
surface.drawBox(dialogX, dialogY, 468, 12, 192);
surface.drawBoxAlpha(dialogX, dialogY + 12, 468, 18, 0x989898, 160);
surface.drawBoxAlpha(dialogX, dialogY + 30, 8, 248, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 205, dialogY + 30, 11, 248, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 462, dialogY + 30, 6, 248, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 8, dialogY + 133, 197, 22, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 8, dialogY + 258, 197, 20, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 216, dialogY + 235, 246, 43, 0x989898, 160);
surface.drawBoxAlpha(dialogX + 8, dialogY + 30, 197, 103, 0xd0d0d0, 160);
surface.drawBoxAlpha(dialogX + 8, dialogY + 155, 197, 103, 0xd0d0d0, 160);
surface.drawBoxAlpha(dialogX + 216, dialogY + 30, 246, 205, 0xd0d0d0, 160);
for (int j2 = 0; j2 < 4; j2++)
surface.drawLineHoriz(dialogX + 8, dialogY + 30 + j2 * 34, 197, 0);
for (int j3 = 0; j3 < 4; j3++)
surface.drawLineHoriz(dialogX + 8, dialogY + 155 + j3 * 34, 197, 0);
for (int l3 = 0; l3 < 7; l3++)
surface.drawLineHoriz(dialogX + 216, dialogY + 30 + l3 * 34, 246, 0);
for (int k4 = 0; k4 < 6; k4++) {
if (k4 < 5)
surface.drawLineVert(dialogX + 8 + k4 * 49, dialogY + 30, 103, 0);
if (k4 < 5)
surface.drawLineVert(dialogX + 8 + k4 * 49, dialogY + 155, 103, 0);
surface.drawLineVert(dialogX + 216 + k4 * 49, dialogY + 30, 205, 0);
}
surface.drawstring("Trading with: " + tradeRecipientName, dialogX + 1, dialogY + 10, 1, 0xffffff);
surface.drawstring("Your Offer", dialogX + 9, dialogY + 27, 4, 0xffffff);
surface.drawstring("Opponent's Offer", dialogX + 9, dialogY + 152, 4, 0xffffff);
surface.drawstring("Your Inventory", dialogX + 216, dialogY + 27, 4, 0xffffff);
if (!tradeAccepted)
surface.drawSprite(dialogX + 217, dialogY + 238, spriteMedia + 25);
surface.drawSprite(dialogX + 394, dialogY + 238, spriteMedia + 26);
if (tradeRecipientAccepted) {
surface.drawStringCenter("Other player", dialogX + 341, dialogY + 246, 1, 0xffffff);
surface.drawStringCenter("has accepted", dialogX + 341, dialogY + 256, 1, 0xffffff);
}
if (tradeAccepted) {
surface.drawStringCenter("Waiting for", dialogX + 217 + 35, dialogY + 246, 1, 0xffffff);
surface.drawStringCenter("other player", dialogX + 217 + 35, dialogY + 256, 1, 0xffffff);
}
for (int itemIndex = 0; itemIndex < inventoryItemsCount; itemIndex++) {
int slotX = 217 + dialogX + (itemIndex % 5) * 49;
int slotY = 31 + dialogY + (itemIndex / 5) * 34;
surface.spriteClipping(slotX, slotY, 48, 32, spriteItem + GameData.itemPicture[inventoryItemId[itemIndex]], GameData.itemMask[inventoryItemId[itemIndex]], 0, 0, false);
if (GameData.itemStackable[inventoryItemId[itemIndex]] == 0)
surface.drawstring(String.valueOf(inventoryItemStackCount[itemIndex]), slotX + 1, slotY + 10, 1, 0xffff00);
}
for (int itemIndex = 0; itemIndex < tradeItemsCount; itemIndex++) {
int slotX = 9 + dialogX + (itemIndex % 4) * 49;
int slotY = 31 + dialogY + (itemIndex / 4) * 34;
surface.spriteClipping(slotX, slotY, 48, 32, spriteItem + GameData.itemPicture[tradeItems[itemIndex]], GameData.itemMask[tradeItems[itemIndex]], 0, 0, false);
if (GameData.itemStackable[tradeItems[itemIndex]] == 0)
surface.drawstring(String.valueOf(tradeItemCount[itemIndex]), slotX + 1, slotY + 10, 1, 0xffff00);
if (super.mouseX > slotX && super.mouseX < slotX + 48 && super.mouseY > slotY && super.mouseY < slotY + 32)
surface.drawstring(GameData.itemName[tradeItems[itemIndex]] + ": @whi@" + GameData.itemDescription[tradeItems[itemIndex]], dialogX + 8, dialogY + 273, 1, 0xffff00);
}
for (int itemIndex = 0; itemIndex < tradeRecipientItemsCount; itemIndex++) {
int slotX = 9 + dialogX + (itemIndex % 4) * 49;
int slotY = 156 + dialogY + (itemIndex / 4) * 34;
surface.spriteClipping(slotX, slotY, 48, 32, spriteItem + GameData.itemPicture[tradeRecipientItems[itemIndex]], GameData.itemMask[tradeRecipientItems[itemIndex]], 0, 0, false);
if (GameData.itemStackable[tradeRecipientItems[itemIndex]] == 0)
surface.drawstring(String.valueOf(tradeRecipientItemCount[itemIndex]), slotX + 1, slotY + 10, 1, 0xffff00);
if (super.mouseX > slotX && super.mouseX < slotX + 48 && super.mouseY > slotY && super.mouseY < slotY + 32)
surface.drawstring(GameData.itemName[tradeRecipientItems[itemIndex]] + ": @whi@" + GameData.itemDescription[tradeRecipientItems[itemIndex]], dialogX + 8, dialogY + 273, 1, 0xffff00);
}
}
protected void resetGame() {
systemUpdate = 0;
combatStyle = 0;
logoutTimeout = 0;
loginScreen = 0;
loggedIn = 1;
resetPMText();
surface.blackScreen();
surface.draw(0, 0);
for (int i = 0; i < objectCount; i++) {
scene.removeModel(objectModel[i]);
world.removeObject(objectX[i], objectY[i], objectId[i]);
}
for (int j = 0; j < wallObjectCount; j++) {
scene.removeModel(wallObjectModel[j]);
world.removeWallObject(wallObjectX[j], wallObjectY[j], wallObjectDirection[j], wallObjectId[j]);
}
objectCount = 0;
wallObjectCount = 0;
groundItemCount = 0;
playerCount = 0;
for (int k = 0; k < playersServerMax; k++)
playerServer[k] = null;
for (int l = 0; l < playersMax; l++)
players[l] = null;
npcCount = 0;
for (int i1 = 0; i1 < npcsServerMax; i1++)
npcsServer[i1] = null;
for (int j1 = 0; j1 < npcsMax; j1++)
npcs[j1] = null;
for (int k1 = 0; k1 < 50; k1++)
prayerOn[k1] = false;
mouseButtonClick = 0;
super.lastMouseButtonDown = 0;
super.mouseButtonDown = 0;
showDialogShop = false;
showDialogBank = false;
isSleeping = false;
super.friendListCount = 0;
}
private void drawUiTabSocial(boolean nomenus) {
int uiX = surface.width2 - 199;
int uiY = 36;
surface.drawSprite(uiX - 49, 3, spriteMedia + 5);
int uiWidth = 196;//'\304';
int uiHeight = 182;//'\266';
int l;
int k = l = Surface.rgb2long(160, 160, 160);
if (uiTabSocialSubTab == 0)
k = Surface.rgb2long(220, 220, 220);
else
l = Surface.rgb2long(220, 220, 220);
surface.drawBoxAlpha(uiX, uiY, uiWidth / 2, 24, k, 128);
surface.drawBoxAlpha(uiX + uiWidth / 2, uiY, uiWidth / 2, 24, l, 128);
surface.drawBoxAlpha(uiX, uiY + 24, uiWidth, uiHeight - 24, Surface.rgb2long(220, 220, 220), 128);
surface.drawLineHoriz(uiX, uiY + 24, uiWidth, 0);
surface.drawLineVert(uiX + uiWidth / 2, uiY, 24, 0);
surface.drawLineHoriz(uiX, (uiY + uiHeight) - 16, uiWidth, 0);
surface.drawStringCenter("Friends", uiX + uiWidth / 4, uiY + 16, 4, 0);
surface.drawStringCenter("Ignore", uiX + uiWidth / 4 + uiWidth / 2, uiY + 16, 4, 0);
panelSocialList.clearList(controlListSocialPlayers);
if (uiTabSocialSubTab == 0) {
for (int i1 = 0; i1 < super.friendListCount; i1++) {
String s;
if (super.friendListOnline[i1] == 255)
s = "@gre@";
else if (super.friendListOnline[i1] > 0)
s = "@yel@";
else
s = "@red@";
panelSocialList.addListEntry(controlListSocialPlayers, i1, s + Utility.hash2username(super.friendListHashes[i1]) + "~439~@whi@Remove WWWWWWWWWW");
}
}
if (uiTabSocialSubTab == 1) {
for (int j1 = 0; j1 < super.ignoreListCount; j1++)
panelSocialList.addListEntry(controlListSocialPlayers, j1, "@yel@" + Utility.hash2username(super.ignoreList[j1]) + "~439~@whi@Remove WWWWWWWWWW");
}
panelSocialList.drawPanel();
if (uiTabSocialSubTab == 0) {
int k1 = panelSocialList.getListEntryIndex(controlListSocialPlayers);
if (k1 >= 0 && super.mouseX < 489) {
if (super.mouseX > 429)
surface.drawStringCenter("Click to remove " + Utility.hash2username(super.friendListHashes[k1]), uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
else if (super.friendListOnline[k1] == 255)
surface.drawStringCenter("Click to message " + Utility.hash2username(super.friendListHashes[k1]), uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
else if (super.friendListOnline[k1] > 0) {
if (super.friendListOnline[k1] < 200)
surface.drawStringCenter(Utility.hash2username(super.friendListHashes[k1]) + " is on world " + (super.friendListOnline[k1] - 9), uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
else
surface.drawStringCenter(Utility.hash2username(super.friendListHashes[k1]) + " is on classic " + (super.friendListOnline[k1] - 219), uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
} else {
surface.drawStringCenter(Utility.hash2username(super.friendListHashes[k1]) + " is offline", uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
}
} else {
surface.drawStringCenter("Click a name to send a message", uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
}
int colour;
if (super.mouseX > uiX && super.mouseX < uiX + uiWidth && super.mouseY > (uiY + uiHeight) - 16 && super.mouseY < uiY + uiHeight)
colour = 0xffff00;
else
colour = 0xffffff;
surface.drawStringCenter("Click here to add a friend", uiX + uiWidth / 2, (uiY + uiHeight) - 3, 1, colour);
}
if (uiTabSocialSubTab == 1) {
int l1 = panelSocialList.getListEntryIndex(controlListSocialPlayers);
if (l1 >= 0 && super.mouseX < 489 && super.mouseX > 429) {
if (super.mouseX > 429)
surface.drawStringCenter("Click to remove " + Utility.hash2username(super.ignoreList[l1]), uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
} else {
surface.drawStringCenter("Blocking messages from:", uiX + uiWidth / 2, uiY + 35, 1, 0xffffff);
}
int l2;
if (super.mouseX > uiX && super.mouseX < uiX + uiWidth && super.mouseY > (uiY + uiHeight) - 16 && super.mouseY < uiY + uiHeight)
l2 = 0xffff00;
else
l2 = 0xffffff;
surface.drawStringCenter("Click here to add a name", uiX + uiWidth / 2, (uiY + uiHeight) - 3, 1, l2);
}
if (!nomenus)
return;
uiX = super.mouseX - (surface.width2 - 199);
uiY = super.mouseY - 36;
if (uiX >= 0 && uiY >= 0 && uiX < 196 && uiY < 182) {
panelSocialList.handleMouse(uiX + (surface.width2 - 199), uiY + 36, super.lastMouseButtonDown, super.mouseButtonDown);
if (uiY <= 24 && mouseButtonClick == 1)
if (uiX < 98 && uiTabSocialSubTab == 1) {
uiTabSocialSubTab = 0;
panelSocialList.resetListProps(controlListSocialPlayers);
} else if (uiX > 98 && uiTabSocialSubTab == 0) {
uiTabSocialSubTab = 1;
panelSocialList.resetListProps(controlListSocialPlayers);
}
if (mouseButtonClick == 1 && uiTabSocialSubTab == 0) {
int i2 = panelSocialList.getListEntryIndex(controlListSocialPlayers);
if (i2 >= 0 && super.mouseX < 489)
if (super.mouseX > 429)
friendRemove(super.friendListHashes[i2]);
else if (super.friendListOnline[i2] != 0) {
showDialogSocialInput = 2;
privateMessageTarget = super.friendListHashes[i2];
super.inputPmCurrent = "";
super.inputPmFinal = "";
}
}
if (mouseButtonClick == 1 && uiTabSocialSubTab == 1) {
int j2 = panelSocialList.getListEntryIndex(controlListSocialPlayers);
if (j2 >= 0 && super.mouseX < 489 && super.mouseX > 429)
ignoreRemove(super.ignoreList[j2]);
}
if (uiY > 166 && mouseButtonClick == 1 && uiTabSocialSubTab == 0) {
showDialogSocialInput = 1;
super.inputTextCurrent = "";
super.inputTextFinal = "";
}
if (uiY > 166 && mouseButtonClick == 1 && uiTabSocialSubTab == 1) {
showDialogSocialInput = 3;
super.inputTextCurrent = "";
super.inputTextFinal = "";
}
mouseButtonClick = 0;
}
}
protected void handleKeyPress(int i) {
if (loggedIn == 0) {
if (loginScreen == 0 && panelLoginWelcome != null)
panelLoginWelcome.keyPress(i);
if (loginScreen == 1 && panelLoginNewuser != null)
panelLoginNewuser.keyPress(i);
if (loginScreen == 2 && panelLoginExistinguser != null)
panelLoginExistinguser.keyPress(i);
}
if (loggedIn == 1) {
if (showAppearanceChange && panelAppearance != null) {
panelAppearance.keyPress(i);
return;
}
if (showDialogSocialInput == 0 && showDialogReportAbuseStep == 0 && !isSleeping && panelMessageTabs != null)
panelMessageTabs.keyPress(i);
}
}
private void sendLogout() {
if (loggedIn == 0)
return;
if (combatTimeout > 450) {
showMessage("@cya@You can't logout during combat!", 3);
return;
}
if (combatTimeout > 0) {
showMessage("@cya@You can't logout for 10 seconds after combat", 3);
return;
} else {
super.clientStream.newPacket((Command.CL_LOGOUT));
super.clientStream.sendPacket();
logoutTimeout = 1000;
return;
}
}
private GameCharacter createPlayer(int serverIndex, int x, int y, int anim) {
if (playerServer[serverIndex] == null) {
playerServer[serverIndex] = new GameCharacter();
playerServer[serverIndex].serverIndex = serverIndex;
playerServer[serverIndex].serverId = 0;
}
GameCharacter character = playerServer[serverIndex];
boolean flag = false;
for (int i1 = 0; i1 < knownPlayerCount; i1++) {
if (knownPlayers[i1].serverIndex != serverIndex)
continue;
flag = true;
break;
}
if (flag) {
character.animationNext = anim;
int j1 = character.waypointCurrent;
if (x != character.waypointsX[j1] || y != character.waypointsY[j1]) {
character.waypointCurrent = j1 = (j1 + 1) % 10;
character.waypointsX[j1] = x;
character.waypointsY[j1] = y;
}
} else {
character.serverIndex = serverIndex;
character.movingStep = 0;
character.waypointCurrent = 0;
character.waypointsX[0] = character.currentX = x;
character.waypointsY[0] = character.currentY = y;
character.animationNext = character.animationCurrent = anim;
character.stepCount = 0;
}
players[playerCount++] = character;
return character;
}
private void drawDialogSocialInput() {
if (mouseButtonClick != 0) {
mouseButtonClick = 0;
if (showDialogSocialInput == 1 && (super.mouseX < 106 || super.mouseY < 145 || super.mouseX > 406 || super.mouseY > 215)) {
showDialogSocialInput = 0;
return;
}
if (showDialogSocialInput == 2 && (super.mouseX < 6 || super.mouseY < 145 || super.mouseX > 506 || super.mouseY > 215)) {
showDialogSocialInput = 0;
return;
}
if (showDialogSocialInput == 3 && (super.mouseX < 106 || super.mouseY < 145 || super.mouseX > 406 || super.mouseY > 215)) {
showDialogSocialInput = 0;
return;
}
if (super.mouseX > 236 && super.mouseX < 276 && super.mouseY > 193 && super.mouseY < 213) {
showDialogSocialInput = 0;
return;
}
}
int i = 145;
if (showDialogSocialInput == 1) {
surface.drawBox(106, i, 300, 70, 0);
surface.drawBoxEdge(106, i, 300, 70, 0xffffff);
i += 20;
surface.drawStringCenter("Enter name to add to friends list", 256, i, 4, 0xffffff);
i += 20;
surface.drawStringCenter(super.inputTextCurrent + "*", 256, i, 4, 0xffffff);
if (super.inputTextFinal.length() > 0) {
String s = super.inputTextFinal.trim();
super.inputTextCurrent = "";
super.inputTextFinal = "";
showDialogSocialInput = 0;
if (s.length() > 0 && Utility.username2hash(s) != localPlayer.hash)
friendAdd(s);
}
}
if (showDialogSocialInput == 2) {
surface.drawBox(6, i, 500, 70, 0);
surface.drawBoxEdge(6, i, 500, 70, 0xffffff);
i += 20;
surface.drawStringCenter("Enter message to send to " + Utility.hash2username(privateMessageTarget), 256, i, 4, 0xffffff);
i += 20;
surface.drawStringCenter(super.inputPmCurrent + "*", 256, i, 4, 0xffffff);
if (super.inputPmFinal.length() > 0) {
String s1 = super.inputPmFinal;
super.inputPmCurrent = "";
super.inputPmFinal = "";
showDialogSocialInput = 0;
int k = ChatMessage.scramble(s1);
sendPrivateMessage(privateMessageTarget, ChatMessage.scrambledbytes, k);
s1 = ChatMessage.descramble(ChatMessage.scrambledbytes, 0, k);
s1 = WordFilter.filter(s1);
showServerMessage("@pri@You tell " + Utility.hash2username(privateMessageTarget) + ": " + s1);
}
}
if (showDialogSocialInput == 3) {
surface.drawBox(106, i, 300, 70, 0);
surface.drawBoxEdge(106, i, 300, 70, 0xffffff);
i += 20;
surface.drawStringCenter("Enter name to add to ignore list", 256, i, 4, 0xffffff);
i += 20;
surface.drawStringCenter(super.inputTextCurrent + "*", 256, i, 4, 0xffffff);
if (super.inputTextFinal.length() > 0) {
String s2 = super.inputTextFinal.trim();
super.inputTextCurrent = "";
super.inputTextFinal = "";
showDialogSocialInput = 0;
if (s2.length() > 0 && Utility.username2hash(s2) != localPlayer.hash)
ignoreAdd(s2);
}
}
int j = 0xffffff;
if (super.mouseX > 236 && super.mouseX < 276 && super.mouseY > 193 && super.mouseY < 213)
j = 0xffff00;
surface.drawStringCenter("Cancel", 256, 208, 1, j);
}
private void createAppearancePanel() {
panelAppearance = new Panel(surface, 100);
panelAppearance.addText(256, 10, "Please design Your Character", 4, true);
int x = 140;
int y = 34;
x += 116;
y -= 10;
panelAppearance.addText(x - 55, y + 110, "Front", 3, true);
panelAppearance.addText(x, y + 110, "Side", 3, true);
panelAppearance.addText(x + 55, y + 110, "Back", 3, true);
byte xoff = 54;
y += 145;
panelAppearance.addBoxRounded(x - xoff, y, 53, 41);
panelAppearance.addText(x - xoff, y - 8, "Head", 1, true);
panelAppearance.addText(x - xoff, y + 8, "Type", 1, true);
panelAppearance.addSprite(x - xoff - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceHead1 = panelAppearance.addButton(x - xoff - 40, y, 20, 20);
panelAppearance.addSprite((x - xoff) + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceHead2 = panelAppearance.addButton((x - xoff) + 40, y, 20, 20);
panelAppearance.addBoxRounded(x + xoff, y, 53, 41);
panelAppearance.addText(x + xoff, y - 8, "Hair", 1, true);
panelAppearance.addText(x + xoff, y + 8, "Color", 1, true);
panelAppearance.addSprite((x + xoff) - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceHair1 = panelAppearance.addButton((x + xoff) - 40, y, 20, 20);
panelAppearance.addSprite(x + xoff + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceHair2 = panelAppearance.addButton(x + xoff + 40, y, 20, 20);
y += 50;
panelAppearance.addBoxRounded(x - xoff, y, 53, 41);
panelAppearance.addText(x - xoff, y, "Gender", 1, true);
panelAppearance.addSprite(x - xoff - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceGender1 = panelAppearance.addButton(x - xoff - 40, y, 20, 20);
panelAppearance.addSprite((x - xoff) + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceGender2 = panelAppearance.addButton((x - xoff) + 40, y, 20, 20);
panelAppearance.addBoxRounded(x + xoff, y, 53, 41);
panelAppearance.addText(x + xoff, y - 8, "Top", 1, true);
panelAppearance.addText(x + xoff, y + 8, "Color", 1, true);
panelAppearance.addSprite((x + xoff) - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceTop1 = panelAppearance.addButton((x + xoff) - 40, y, 20, 20);
panelAppearance.addSprite(x + xoff + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceTop2 = panelAppearance.addButton(x + xoff + 40, y, 20, 20);
y += 50;
panelAppearance.addBoxRounded(x - xoff, y, 53, 41);
panelAppearance.addText(x - xoff, y - 8, "Skin", 1, true);
panelAppearance.addText(x - xoff, y + 8, "Color", 1, true);
panelAppearance.addSprite(x - xoff - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceSkin1 = panelAppearance.addButton(x - xoff - 40, y, 20, 20);
panelAppearance.addSprite((x - xoff) + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceSkin2 = panelAppearance.addButton((x - xoff) + 40, y, 20, 20);
panelAppearance.addBoxRounded(x + xoff, y, 53, 41);
panelAppearance.addText(x + xoff, y - 8, "Bottom", 1, true);
panelAppearance.addText(x + xoff, y + 8, "Color", 1, true);
panelAppearance.addSprite((x + xoff) - 40, y, Panel.baseSpriteStart + 7);
controlButtonAppearanceBottom1 = panelAppearance.addButton((x + xoff) - 40, y, 20, 20);
panelAppearance.addSprite(x + xoff + 40, y, Panel.baseSpriteStart + 6);
controlButtonAppearanceBottom2 = panelAppearance.addButton(x + xoff + 40, y, 20, 20);
y += 82;
y -= 35;
panelAppearance.addButtonBackground(x, y, 200, 30);
panelAppearance.addText(x, y, "Accept", 4, false);
controlButtonAppearanceAccept = panelAppearance.addButton(x, y, 200, 30);
}
private void resetPMText() {
super.inputPmCurrent = "";
super.inputPmFinal = "";
}
private void drawDialogWelcome() {
int i = 65;
if (welcomeRecoverySetDays != 201)
i += 60;
if (welcomeUnreadMessages > 0)
i += 60;
if (welcomeLastLoggedInIP != 0)
i += 45;
int y = 167 - i / 2;
surface.drawBox(56, 167 - i / 2, 400, i, 0);
surface.drawBoxEdge(56, 167 - i / 2, 400, i, 0xffffff);
y += 20;
surface.drawStringCenter("Welcome to RuneScape " + loginUser, 256, y, 4, 0xffff00);
y += 30;
String s;
if (welcomeLastLoggedInDays == 0)
s = "earlier today";
else if (welcomeLastLoggedInDays == 1)
s = "yesterday";
else
s = welcomeLastLoggedInDays + " days ago";
if (welcomeLastLoggedInIP != 0) {
surface.drawStringCenter("You last logged in " + s, 256, y, 1, 0xffffff);
y += 15;
if (welcomeLastLoggedInHost == null)
welcomeLastLoggedInHost = getHostnameIP(welcomeLastLoggedInIP);
surface.drawStringCenter("from: " + welcomeLastLoggedInHost, 256, y, 1, 0xffffff);
y += 15;
y += 15;
}
if (welcomeUnreadMessages > 0) {
int k = 0xffffff;
surface.drawStringCenter("Jagex staff will NEVER email you. We use the", 256, y, 1, k);
y += 15;
surface.drawStringCenter("message-centre on this website instead.", 256, y, 1, k);
y += 15;
if (welcomeUnreadMessages == 1)
surface.drawStringCenter("You have @yel@0@whi@ unread messages in your message-centre", 256, y, 1, 0xffffff);
else
surface.drawStringCenter("You have @gre@" + (welcomeUnreadMessages - 1) + " unread messages @whi@in your message-centre", 256, y, 1, 0xffffff);
y += 15;
y += 15;
}
if (welcomeRecoverySetDays != 201) // this is an odd way of storing recovery day settings
{
if (welcomeRecoverySetDays == 200) // and this
{
surface.drawStringCenter("You have not yet set any password recovery questions.", 256, y, 1, 0xff8000);
y += 15;
surface.drawStringCenter("We strongly recommend you do so now to secure your account.", 256, y, 1, 0xff8000);
y += 15;
surface.drawStringCenter("Do this from the 'account management' area on our front webpage", 256, y, 1, 0xff8000);
y += 15;
} else {
String s1;
if (welcomeRecoverySetDays == 0)
s1 = "Earlier today";
else if (welcomeRecoverySetDays == 1)
s1 = "Yesterday";
else
s1 = welcomeRecoverySetDays + " days ago";
surface.drawStringCenter(s1 + " you changed your recovery questions", 256, y, 1, 0xff8000);
y += 15;
surface.drawStringCenter("If you do not remember making this change then cancel it immediately", 256, y, 1, 0xff8000);
y += 15;
surface.drawStringCenter("Do this from the 'account management' area on our front webpage", 256, y, 1, 0xff8000);
y += 15;
}
y += 15;
}
int l = 0xffffff;
if (super.mouseY > y - 12 && super.mouseY <= y && super.mouseX > 106 && super.mouseX < 406)
l = 0xff0000;
surface.drawStringCenter("Click here to close window", 256, y, 1, l);
if (mouseButtonClick == 1) {
if (l == 0xff0000)
showDialogWelcome = false;
if ((super.mouseX < 86 || super.mouseX > 426) && (super.mouseY < 167 - i / 2 || super.mouseY > 167 + i / 2))
showDialogWelcome = false;
}
mouseButtonClick = 0;
}
private void drawAppearancePanelCharacterSprites() {
surface.interlace = false;
surface.blackScreen();
panelAppearance.drawPanel();
int i = 140;
int j = 50;
i += 116;
j -= 25;
surface.spriteClipping(i - 32 - 55, j, 64, 102, GameData.animationNumber[appearance2Colour], characterTopBottomColours[appearanceBottomColour]);
surface.spriteClipping(i - 32 - 55, j, 64, 102, GameData.animationNumber[appearanceBodyGender], characterTopBottomColours[appearanceTopColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.spriteClipping(i - 32 - 55, j, 64, 102, GameData.animationNumber[appearanceHeadType], characterHairColours[appearanceHairColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.spriteClipping(i - 32, j, 64, 102, GameData.animationNumber[appearance2Colour] + 6, characterTopBottomColours[appearanceBottomColour]);
surface.spriteClipping(i - 32, j, 64, 102, GameData.animationNumber[appearanceBodyGender] + 6, characterTopBottomColours[appearanceTopColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.spriteClipping(i - 32, j, 64, 102, GameData.animationNumber[appearanceHeadType] + 6, characterHairColours[appearanceHairColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.spriteClipping((i - 32) + 55, j, 64, 102, GameData.animationNumber[appearance2Colour] + 12, characterTopBottomColours[appearanceBottomColour]);
surface.spriteClipping((i - 32) + 55, j, 64, 102, GameData.animationNumber[appearanceBodyGender] + 12, characterTopBottomColours[appearanceTopColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.spriteClipping((i - 32) + 55, j, 64, 102, GameData.animationNumber[appearanceHeadType] + 12, characterHairColours[appearanceHairColour], characterSkinColours[appearanceSkinColour], 0, false);
surface.drawSprite(0, gameHeight, spriteMedia + 22);
surface.draw(0, 0);
}
/*
public URL getDocumentBase() {
return super.getDocumentBase();
}*/
/*
public Graphics getGraphics() {
if (gameFrame != null)
return gameFrame.getGraphics();
else
return super.getGraphics();
}*/
/*
public URL getCodeBase() {
return super.getCodeBase();
}*/
void drawItem(int x, int y, int w, int h, int id, int tx, int ty) {
int picture = GameData.itemPicture[id] + spriteItem;
int mask = GameData.itemMask[id];
surface.spriteClipping(x, y, w, h, picture, mask, 0, 0, false);
}
private void handleGameInput() {
if (systemUpdate > 1)
systemUpdate--;
checkConnection();
if (logoutTimeout > 0)
logoutTimeout--;
if (super.mouseActionTimeout > 4500 && combatTimeout == 0 && logoutTimeout == 0) {
super.mouseActionTimeout -= 500;
sendLogout();
return;
}
if (localPlayer.animationCurrent == 8 || localPlayer.animationCurrent == 9)
combatTimeout = 500;
if (combatTimeout > 0)
combatTimeout--;
if (showAppearanceChange) {
handleAppearancePanelControls();
return;
}
for (int i = 0; i < playerCount; i++) {
GameCharacter character = players[i];
int k = (character.waypointCurrent + 1) % 10;
if (character.movingStep != k) {
int i1 = -1;
int l2 = character.movingStep;
int j4;
if (l2 < k)
j4 = k - l2;
else
j4 = (10 + k) - l2;
int j5 = 4;
if (j4 > 2)
j5 = (j4 - 1) * 4;
if (character.waypointsX[l2] - character.currentX > magicLoc * 3 || character.waypointsY[l2] - character.currentY > magicLoc * 3 || character.waypointsX[l2] - character.currentX < -magicLoc * 3 || character.waypointsY[l2] - character.currentY < -magicLoc * 3 || j4 > 8) {
character.currentX = character.waypointsX[l2];
character.currentY = character.waypointsY[l2];
} else {
if (character.currentX < character.waypointsX[l2]) {
character.currentX += j5;
character.stepCount++;
i1 = 2;
} else if (character.currentX > character.waypointsX[l2]) {
character.currentX -= j5;
character.stepCount++;
i1 = 6;
}
if (character.currentX - character.waypointsX[l2] < j5 && character.currentX - character.waypointsX[l2] > -j5)
character.currentX = character.waypointsX[l2];
if (character.currentY < character.waypointsY[l2]) {
character.currentY += j5;
character.stepCount++;
if (i1 == -1)
i1 = 4;
else if (i1 == 2)
i1 = 3;
else
i1 = 5;
} else if (character.currentY > character.waypointsY[l2]) {
character.currentY -= j5;
character.stepCount++;
if (i1 == -1)
i1 = 0;
else if (i1 == 2)
i1 = 1;
else
i1 = 7;
}
if (character.currentY - character.waypointsY[l2] < j5 && character.currentY - character.waypointsY[l2] > -j5)
character.currentY = character.waypointsY[l2];
}
if (i1 != -1)
character.animationCurrent = i1;
if (character.currentX == character.waypointsX[l2] && character.currentY == character.waypointsY[l2])
character.movingStep = (l2 + 1) % 10;
} else {
character.animationCurrent = character.animationNext;
}
if (character.messageTimeout > 0)
character.messageTimeout--;
if (character.bubbleTimeout > 0)
character.bubbleTimeout--;
if (character.combatTimer > 0)
character.combatTimer--;
if (deathScreenTimeout > 0) {
deathScreenTimeout--;
if (deathScreenTimeout == 0)
showMessage("You have been granted another life. Be more careful this time!", 3);
if (deathScreenTimeout == 0)
showMessage("You retain your skills. Your objects land where you died", 3);
}
}
for (int j = 0; j < npcCount; j++) {
GameCharacter character_1 = npcs[j];
int j1 = (character_1.waypointCurrent + 1) % 10;
if (character_1.movingStep != j1) {
int i3 = -1;
int k4 = character_1.movingStep;
int k5;
if (k4 < j1)
k5 = j1 - k4;
else
k5 = (10 + j1) - k4;
int l5 = 4;
if (k5 > 2)
l5 = (k5 - 1) * 4;
if (character_1.waypointsX[k4] - character_1.currentX > magicLoc * 3 || character_1.waypointsY[k4] - character_1.currentY > magicLoc * 3 || character_1.waypointsX[k4] - character_1.currentX < -magicLoc * 3 || character_1.waypointsY[k4] - character_1.currentY < -magicLoc * 3 || k5 > 8) {
character_1.currentX = character_1.waypointsX[k4];
character_1.currentY = character_1.waypointsY[k4];
} else {
if (character_1.currentX < character_1.waypointsX[k4]) {
character_1.currentX += l5;
character_1.stepCount++;
i3 = 2;
} else if (character_1.currentX > character_1.waypointsX[k4]) {
character_1.currentX -= l5;
character_1.stepCount++;
i3 = 6;
}
if (character_1.currentX - character_1.waypointsX[k4] < l5 && character_1.currentX - character_1.waypointsX[k4] > -l5)
character_1.currentX = character_1.waypointsX[k4];
if (character_1.currentY < character_1.waypointsY[k4]) {
character_1.currentY += l5;
character_1.stepCount++;
if (i3 == -1)
i3 = 4;
else if (i3 == 2)
i3 = 3;
else
i3 = 5;
} else if (character_1.currentY > character_1.waypointsY[k4]) {
character_1.currentY -= l5;
character_1.stepCount++;
if (i3 == -1)
i3 = 0;
else if (i3 == 2)
i3 = 1;
else
i3 = 7;
}
if (character_1.currentY - character_1.waypointsY[k4] < l5 && character_1.currentY - character_1.waypointsY[k4] > -l5)
character_1.currentY = character_1.waypointsY[k4];
}
if (i3 != -1)
character_1.animationCurrent = i3;
if (character_1.currentX == character_1.waypointsX[k4] && character_1.currentY == character_1.waypointsY[k4])
character_1.movingStep = (k4 + 1) % 10;
} else {
character_1.animationCurrent = character_1.animationNext;
if (character_1.npcId == 43)
character_1.stepCount++;
}
if (character_1.messageTimeout > 0)
character_1.messageTimeout--;
if (character_1.bubbleTimeout > 0)
character_1.bubbleTimeout--;
if (character_1.combatTimer > 0)
character_1.combatTimer--;
}
if (showUiTab != 2) {
if (Surface.anInt346 > 0)
sleepWordDelayTimer++;
if (Surface.anInt347 > 0)
sleepWordDelayTimer = 0;
Surface.anInt346 = 0;
Surface.anInt347 = 0;
}
for (int l = 0; l < playerCount; l++) {
GameCharacter character = players[l];
if (character.projectileRange > 0)
character.projectileRange--;
}
if (cameraAutoAngleDebug) {
if (cameraAutoRotatePlayerX - localPlayer.currentX < -500 || cameraAutoRotatePlayerX - localPlayer.currentX > 500 || cameraAutoRotatePlayerY - localPlayer.currentY < -500 || cameraAutoRotatePlayerY - localPlayer.currentY > 500) {
cameraAutoRotatePlayerX = localPlayer.currentX;
cameraAutoRotatePlayerY = localPlayer.currentY;
}
} else {
if (cameraAutoRotatePlayerX - localPlayer.currentX < -500 || cameraAutoRotatePlayerX - localPlayer.currentX > 500 || cameraAutoRotatePlayerY - localPlayer.currentY < -500 || cameraAutoRotatePlayerY - localPlayer.currentY > 500) {
cameraAutoRotatePlayerX = localPlayer.currentX;
cameraAutoRotatePlayerY = localPlayer.currentY;
}
if (cameraAutoRotatePlayerX != localPlayer.currentX)
cameraAutoRotatePlayerX += (localPlayer.currentX - cameraAutoRotatePlayerX) / (16 + (cameraZoom - 500) / 15);
if (cameraAutoRotatePlayerY != localPlayer.currentY)
cameraAutoRotatePlayerY += (localPlayer.currentY - cameraAutoRotatePlayerY) / (16 + (cameraZoom - 500) / 15);
if (optionCameraModeAuto) {
int k1 = cameraAngle * 32;
int j3 = k1 - cameraRotation;
byte byte0 = 1;
if (j3 != 0) {
anInt707++;
if (j3 > 128) {
byte0 = -1;
j3 = 256 - j3;
} else if (j3 > 0)
byte0 = 1;
else if (j3 < -128) {
byte0 = 1;
j3 = 256 + j3;
} else if (j3 < 0) {
byte0 = -1;
j3 = -j3;
}
cameraRotation += ((anInt707 * j3 + 255) / 256) * byte0;
cameraRotation &= 255;// 0xff;
} else {
anInt707 = 0;
}
}
}
if (sleepWordDelayTimer > 20) {
sleepWordDelay = false;
sleepWordDelayTimer = 0;
}
if (isSleeping) {
if (super.inputTextFinal.length() > 0)
if (super.inputTextFinal.equalsIgnoreCase("::lostcon") && !appletMode)
super.clientStream.closeStream();
else if (super.inputTextFinal.equalsIgnoreCase("::closecon") && !appletMode) {
closeConnection();
} else {
super.clientStream.newPacket((Command.CL_SLEEP_WORD));
super.clientStream.putString(super.inputTextFinal);
if (!sleepWordDelay) {
super.clientStream.putByte(0);
sleepWordDelay = true;
}
super.clientStream.sendPacket();
super.inputTextCurrent = "";
super.inputTextFinal = "";
sleepingStatusText = "Please wait...";
}
if (super.lastMouseButtonDown == 1 && super.mouseY > 275 && super.mouseY < 310 && super.mouseX > 56 && super.mouseX < 456) {
super.clientStream.newPacket((Command.CL_SLEEP_WORD));
super.clientStream.putString("-null-");
if (!sleepWordDelay) {
super.clientStream.putByte(0);
sleepWordDelay = true;
}
super.clientStream.sendPacket();
super.inputTextCurrent = "";
super.inputTextFinal = "";
sleepingStatusText = "Please wait...";
}
super.lastMouseButtonDown = 0;
return;
}
if (super.mouseY > gameHeight - 4) {
if (super.mouseX > 15 && super.mouseX < 96 && super.lastMouseButtonDown == 1)
messageTabSelected = 0;
if (super.mouseX > 110 && super.mouseX < 194 && super.lastMouseButtonDown == 1) {
messageTabSelected = 1;
panelMessageTabs.controlFlashText[controlTextListChat] = 999999;//0xf423f;
}
if (super.mouseX > 215 && super.mouseX < 295 && super.lastMouseButtonDown == 1) {
messageTabSelected = 2;
panelMessageTabs.controlFlashText[controlTextListQuest] = 999999;//0xf423f;
}
if (super.mouseX > 315 && super.mouseX < 395 && super.lastMouseButtonDown == 1) {
messageTabSelected = 3;
panelMessageTabs.controlFlashText[controlTextListPrivate] = 999999;//0xf423f;
}
if (super.mouseX > 417 && super.mouseX < 497 && super.lastMouseButtonDown == 1) {
showDialogReportAbuseStep = 1;
reportAbuseOffence = 0;
super.inputTextCurrent = "";
super.inputTextFinal = "";
}
super.lastMouseButtonDown = 0;
super.mouseButtonDown = 0;
}
panelMessageTabs.handleMouse(super.mouseX, super.mouseY, super.lastMouseButtonDown, super.mouseButtonDown);
if (messageTabSelected > 0 && super.mouseX >= 494 && super.mouseY >= gameHeight - 66)
super.lastMouseButtonDown = 0;
if (panelMessageTabs.isClicked(controlTextListAll)) {
String s = panelMessageTabs.getText(controlTextListAll);
panelMessageTabs.updateText(controlTextListAll, "");
if (s.startsWith("::")) {
if (s.equalsIgnoreCase("::closecon") && !appletMode)
super.clientStream.closeStream();
else if (s.equalsIgnoreCase("::logout") && !appletMode)
closeConnection();
else if (s.equalsIgnoreCase("::lostcon") && !appletMode)
lostConnection();
else
sendCommandString(s.substring(2));
} else {
int k3 = ChatMessage.scramble(s);
sendChatMessage(ChatMessage.scrambledbytes, k3);
s = ChatMessage.descramble(ChatMessage.scrambledbytes, 0, k3);
s = WordFilter.filter(s);
localPlayer.messageTimeout = 150;
localPlayer.message = s;
showMessage(localPlayer.name + ": " + s, 2);
}
}
if (messageTabSelected == 0) {
for (int l1 = 0; l1 < 5; l1++)
if (messageHistoryTimeout[l1] > 0)
messageHistoryTimeout[l1]--;
}
if (deathScreenTimeout != 0)
super.lastMouseButtonDown = 0;
if (showDialogTrade || showDialogDuel) {
if (super.mouseButtonDown != 0)
mouseButtonDownTime++;
else
mouseButtonDownTime = 0;
if (mouseButtonDownTime > 600)
mouseButtonItemCountIncrement += 5000;
else if (mouseButtonDownTime > 450)
mouseButtonItemCountIncrement += 500;
else if (mouseButtonDownTime > 300)
mouseButtonItemCountIncrement += 50;
else if (mouseButtonDownTime > 150)
mouseButtonItemCountIncrement += 5;
else if (mouseButtonDownTime > 50)
mouseButtonItemCountIncrement++;
else if (mouseButtonDownTime > 20 && (mouseButtonDownTime & 5) == 0)
mouseButtonItemCountIncrement++;
} else {
mouseButtonDownTime = 0;
mouseButtonItemCountIncrement = 0;
}
if (super.lastMouseButtonDown == 1)
mouseButtonClick = 1;
else if (super.lastMouseButtonDown == 2)
mouseButtonClick = 2;
scene.setMouseLoc(super.mouseX, super.mouseY);
super.lastMouseButtonDown = 0;
if (optionCameraModeAuto) {
if (anInt707 == 0 || cameraAutoAngleDebug) {
if (super.keyLeft) {
cameraAngle = cameraAngle + 1 & 7;
super.keyLeft = false;
if (!fogOfWar) {
if ((cameraAngle & 1) == 0)
cameraAngle = cameraAngle + 1 & 7;
for (int i2 = 0; i2 < 8; i2++) {
if (isValidCameraAngle(cameraAngle))
break;
cameraAngle = cameraAngle + 1 & 7;
}
}
}
if (super.keyRight) {
cameraAngle = cameraAngle + 7 & 7;
super.keyRight = false;
if (!fogOfWar) {
if ((cameraAngle & 1) == 0)
cameraAngle = cameraAngle + 7 & 7;
for (int j2 = 0; j2 < 8; j2++) {
if (isValidCameraAngle(cameraAngle))
break;
cameraAngle = cameraAngle + 7 & 7;
}
}
}
}
} else if (super.keyLeft)
cameraRotation = cameraRotation + 2 & 255;// 0xff;
else if (super.keyRight)
cameraRotation = cameraRotation - 2 & 255;// 0xff;
if (fogOfWar && cameraZoom > 550)
cameraZoom -= 4;
else if (!fogOfWar && cameraZoom < 750)
cameraZoom += 4;
if (mouseClickXStep > 0)
mouseClickXStep--;
else if (mouseClickXStep < 0)
mouseClickXStep++;
scene.doSOemthingWithTheFuckinFountainFuck(17);// 17 is fountain
objectAnimationCount++;
if (objectAnimationCount > 5) {
objectAnimationCount = 0;
objectAnimationNumberFireLightningSpell = (objectAnimationNumberFireLightningSpell + 1) % 3;
objectAnimationNumberTorch = (objectAnimationNumberTorch + 1) % 4;
objectAnimationNumberClaw = (objectAnimationNumberClaw + 1) % 5;
}
for (int k2 = 0; k2 < objectCount; k2++) {
int l3 = objectX[k2];
int l4 = objectY[k2];
if (l3 >= 0 && l4 >= 0 && l3 < 96 && l4 < 96 && objectId[k2] == 74)
objectModel[k2].rotate(1, 0, 0);
}
for (int i4 = 0; i4 < teleportBubbleCount; i4++) {
teleportBubbleTime[i4]++;
if (teleportBubbleTime[i4] > 50) {
teleportBubbleCount--;
for (int i5 = i4; i5 < teleportBubbleCount; i5++) {
teleportBubbleX[i5] = teleportBubbleX[i5 + 1];
teleportBubbleY[i5] = teleportBubbleY[i5 + 1];
teleportBubbleTime[i5] = teleportBubbleTime[i5 + 1];
teleportBubbleType[i5] = teleportBubbleType[i5 + 1];
}
}
}
}
private void renderLoginScreenViewports() {
int rh = 0;
byte rx = 50;//49;
byte ry = 50;//47;
world.loadSection(rx * 48 + 23, ry * 48 + 23, rh);
world.addModels(gameModels);
int x = 9728;// '\u2600'
int y = 6400;// '\u1900'
int zoom = 1100;// '\u044C'
int rotation = 888;// '\u0378'
scene.clipFar3d = 4100;
scene.clipFar2d = 4100;
scene.fogZFalloff = 1;
scene.fogZDistance = 4000;
surface.blackScreen();
scene.setCamera(x, -world.getElevation(x, y), y, 912, rotation, 0, zoom * 2);
scene.render();
surface.fade2black();
surface.fade2black();
surface.drawBox(0, 0, gameWidth, 6, 0);
for (int j = 6; j >= 1; j--)
surface.drawLineAlpha(0, j, 0, j, gameWidth, 8);
surface.drawBox(0, 194, 512, 20, 0);
for (int k = 6; k >= 1; k--)
surface.drawLineAlpha(0, k, 0, 194 - k, gameWidth, 8);
surface.drawSprite(gameWidth / 2 - surface.spriteWidth[spriteMedia + 10] / 2, 15, spriteMedia + 10); // runescape logo
surface.drawSprite(spriteLogo, 0, 0, gameWidth, 200);
surface.drawWorld(spriteLogo);
x = 9216;// '\u2400';
y = 9216;// '\u2400';
zoom = 1100;// '\u044C';
rotation = 888;// '\u0378';
scene.clipFar3d = 4100;
scene.clipFar2d = 4100;
scene.fogZFalloff = 1;
scene.fogZDistance = 4000;
surface.blackScreen();
scene.setCamera(x, -world.getElevation(x, y), y, 912, rotation, 0, zoom * 2);
scene.render();
surface.fade2black();
surface.fade2black();
surface.drawBox(0, 0, gameWidth, 6, 0);
for (int l = 6; l >= 1; l--)
surface.drawLineAlpha(0, l, 0, l, gameWidth, 8);
surface.drawBox(0, 194, gameWidth, 20, 0);
for (int i1 = 6; i1 >= 1; i1--)
surface.drawLineAlpha(0, i1, 0, 194 - i1, gameWidth, 8);
surface.drawSprite(gameWidth / 2 - surface.spriteWidth[spriteMedia + 10] / 2, 15, spriteMedia + 10);
surface.drawSprite(spriteLogo + 1, 0, 0, gameWidth, 200); // h was 200
surface.drawWorld(spriteLogo + 1);
for (int j1 = 0; j1 < 64; j1++) {
scene.removeModel(world.roofModels[0][j1]);
scene.removeModel(world.wallModels[1][j1]);
scene.removeModel(world.roofModels[1][j1]);
scene.removeModel(world.wallModels[2][j1]);
scene.removeModel(world.roofModels[2][j1]);
}
x = 11136;// '\u2B80';
y = 10368;// '\u2880';
zoom = 500;// '\u01F4';
rotation = 376;// '\u0178';
scene.clipFar3d = 4100;
scene.clipFar2d = 4100;
scene.fogZFalloff = 1;
scene.fogZDistance = 4000;
surface.blackScreen();
scene.setCamera(x, -world.getElevation(x, y), y, 912, rotation, 0, zoom * 2);
scene.render();
surface.fade2black();
surface.fade2black();
surface.drawBox(0, 0, gameWidth, 6, 0);
for (int k1 = 6; k1 >= 1; k1--)
surface.drawLineAlpha(0, k1, 0, k1, gameWidth, 8);
surface.drawBox(0, 194, gameWidth, 20, 0);
for (int l1 = 6; l1 >= 1; l1--)
surface.drawLineAlpha(0, l1, 0, 194, gameWidth, 8);
surface.drawSprite(gameWidth / 2 - surface.spriteWidth[spriteMedia + 10] / 2, 15, spriteMedia + 10);
surface.drawSprite(spriteMedia + 10, 0, 0, gameWidth, 200);
surface.drawWorld(spriteMedia + 10);
}
private void createLoginPanels() {
panelLoginWelcome = new Panel(surface, 50);
int y = 40;
int x = gameWidth / 2;
if (!members) {
panelLoginWelcome.addText(x, 200 + y, "Click on an option", 5, true);
panelLoginWelcome.addButtonBackground(x - 100, 240 + y, 120, 35);
panelLoginWelcome.addButtonBackground(x + 100, 240 + y, 120, 35);
panelLoginWelcome.addText(x - 100, 240 + y, "New User", 5, false);
panelLoginWelcome.addText(x + 100, 240 + y, "Existing User", 5, false);
controlWelcomeNewuser = panelLoginWelcome.addButton(x - 100, 240 + y, 120, 35);
controlWelcomeExistinguser = panelLoginWelcome.addButton(x + 100, 240 + y, 120, 35);
} else {
panelLoginWelcome.addText(x, 200 + y, "Welcome to RuneScape", 4, true);
panelLoginWelcome.addText(x, 215 + y, "You need a member account to use this server", 4, true);
panelLoginWelcome.addButtonBackground(x, 250 + y, 200, 35);
panelLoginWelcome.addText(x, 250 + y, "Click here to login", 5, false);
controlWelcomeExistinguser = panelLoginWelcome.addButton(x, 250 + y, 200, 35);
}
panelLoginNewuser = new Panel(surface, 50);
y = 230;
if (referid == 0) {
panelLoginNewuser.addText(x, y + 8, "To create an account please go back to the", 4, true);
y += 20;
panelLoginNewuser.addText(x, y + 8, "www.runescape.com front page, and choose 'create account'", 4, true);
} else if (referid == 1) {
panelLoginNewuser.addText(x, y + 8, "To create an account please click on the", 4, true);
y += 20;
panelLoginNewuser.addText(x, y + 8, "'create account' link below the game window", 4, true);
} else {
panelLoginNewuser.addText(x, y + 8, "To create an account please go back to the", 4, true);
y += 20;
panelLoginNewuser.addText(x, y + 8, "runescape front webpage and choose 'create account'", 4, true);
}
y += 30;
panelLoginNewuser.addButtonBackground(x, y + 17, 150, 34);
panelLoginNewuser.addText(x, y + 17, "Ok", 5, false);
controlLoginNewOk = panelLoginNewuser.addButton(x, y + 17, 150, 34);
panelLoginExistinguser = new Panel(surface, 50);
y = 230;
controlLoginStatus = panelLoginExistinguser.addText(x, y - 10, "Please enter your username and password", 4, true);
y += 28;
panelLoginExistinguser.addButtonBackground(x - 116, y, 200, 40);
panelLoginExistinguser.addText(x - 116, y - 10, "Username:", 4, false);
controlLoginUser = panelLoginExistinguser.addTextInput(x - 116, y + 10, 200, 40, 4, 12, false, false);
y += 47;
panelLoginExistinguser.addButtonBackground(x - 66, y, 200, 40);
panelLoginExistinguser.addText(x - 66, y - 10, "Password:", 4, false);
controlLoginPass = panelLoginExistinguser.addTextInput(x - 66, y + 10, 200, 40, 4, 20, true, false);
y -= 55;
panelLoginExistinguser.addButtonBackground(x + 154, y, 120, 25);
panelLoginExistinguser.addText(x + 154, y, "Ok", 4, false);
controlLoginOk = panelLoginExistinguser.addButton(x + 154, y, 120, 25);
y += 30;
panelLoginExistinguser.addButtonBackground(x + 154, y, 120, 25);
panelLoginExistinguser.addText(x + 154, y, "Cancel", 4, false);
controlLoginCancel = panelLoginExistinguser.addButton(x + 154, y, 120, 25);
y += 30;
panelLoginExistinguser.setFocus(controlLoginUser);
}
private void drawUiTabInventory(boolean nomenus) {
int uiX = surface.width2 - 248;
surface.drawSprite(uiX, 3, spriteMedia + 1);
for (int itemIndex = 0; itemIndex < inventoryMaxItemCount; itemIndex++) {
int slotX = uiX + (itemIndex % 5) * 49;
int slotY = 36 + (itemIndex / 5) * 34;
if (itemIndex < inventoryItemsCount && inventoryEquipped[itemIndex] == 1)
surface.drawBoxAlpha(slotX, slotY, 49, 34, 0xff0000, 128);
else
surface.drawBoxAlpha(slotX, slotY, 49, 34, Surface.rgb2long(181, 181, 181), 128);
if (itemIndex < inventoryItemsCount) {
surface.spriteClipping(slotX, slotY, 48, 32, spriteItem + GameData.itemPicture[inventoryItemId[itemIndex]], GameData.itemMask[inventoryItemId[itemIndex]], 0, 0, false);
if (GameData.itemStackable[inventoryItemId[itemIndex]] == 0)
surface.drawstring(String.valueOf(inventoryItemStackCount[itemIndex]), slotX + 1, slotY + 10, 1, 0xffff00);
}
}
for (int rows = 1; rows <= 4; rows++)
surface.drawLineVert(uiX + rows * 49, 36, (inventoryMaxItemCount / 5) * 34, 0);
for (int cols = 1; cols <= inventoryMaxItemCount / 5 - 1; cols++)
surface.drawLineHoriz(uiX, 36 + cols * 34, 245, 0);
if (!nomenus)
return;
int mouseX = super.mouseX - (surface.width2 - 248);
int mouseY = super.mouseY - 36;
if (mouseX >= 0 && mouseY >= 0 && mouseX < 248 && mouseY < (inventoryMaxItemCount / 5) * 34) {
int itemIndex = mouseX / 49 + (mouseY / 34) * 5;
if (itemIndex < inventoryItemsCount) {
int i2 = inventoryItemId[itemIndex];
if (selectedSpell >= 0) {
if (GameData.spellType[selectedSpell] == 3) {
menuItemText1[menuItemsCount] = "Cast " + GameData.spellName[selectedSpell] + " on";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 600;
menuSourceType[menuItemsCount] = itemIndex;
menuSourceIndex[menuItemsCount] = selectedSpell;
menuItemsCount++;
return;
}
} else {
if (selectedItemInventoryIndex >= 0) {
menuItemText1[menuItemsCount] = "Use " + selectedItemName + " with";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 610;
menuSourceType[menuItemsCount] = itemIndex;
menuSourceIndex[menuItemsCount] = selectedItemInventoryIndex;
menuItemsCount++;
return;
}
if (inventoryEquipped[itemIndex] == 1) {
menuItemText1[menuItemsCount] = "Remove";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 620;
menuSourceType[menuItemsCount] = itemIndex;
menuItemsCount++;
} else if (GameData.itemWearable[i2] != 0) {
if ((GameData.itemWearable[i2] & 24) != 0)// 0x18
menuItemText1[menuItemsCount] = "Wield";
else
menuItemText1[menuItemsCount] = "Wear";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 630;
menuSourceType[menuItemsCount] = itemIndex;
menuItemsCount++;
}
if (!GameData.itemCommand[i2].equals("")) {
menuItemText1[menuItemsCount] = GameData.itemCommand[i2];
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 640;
menuSourceType[menuItemsCount] = itemIndex;
menuItemsCount++;
}
menuItemText1[menuItemsCount] = "Use";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 650;
menuSourceType[menuItemsCount] = itemIndex;
menuItemsCount++;
menuItemText1[menuItemsCount] = "Drop";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 660;
menuSourceType[menuItemsCount] = itemIndex;
menuItemsCount++;
menuItemText1[menuItemsCount] = "Examine";
menuItemText2[menuItemsCount] = "@lre@" + GameData.itemName[i2];
menuItemID[menuItemsCount] = 3600;
menuSourceType[menuItemsCount] = i2;
menuItemsCount++;
}
}
}
}
private void autorotateCamera() {
if ((cameraAngle & 1) == 1 && isValidCameraAngle(cameraAngle))
return;
if ((cameraAngle & 1) == 0 && isValidCameraAngle(cameraAngle)) {
if (isValidCameraAngle(cameraAngle + 1 & 7)) {
cameraAngle = cameraAngle + 1 & 7;
return;
}
if (isValidCameraAngle(cameraAngle + 7 & 7))
cameraAngle = cameraAngle + 7 & 7;
return;
}
int ai[] = {
1, -1, 2, -2, 3, -3, 4
};
for (int i = 0; i < 7; i++) {
if (!isValidCameraAngle(cameraAngle + ai[i] + 8 & 7))
continue;
cameraAngle = cameraAngle + ai[i] + 8 & 7;
break;
}
if ((cameraAngle & 1) == 0 && isValidCameraAngle(cameraAngle)) {
if (isValidCameraAngle(cameraAngle + 1 & 7)) {
cameraAngle = cameraAngle + 1 & 7;
return;
}
if (isValidCameraAngle(cameraAngle + 7 & 7))
cameraAngle = cameraAngle + 7 & 7;
}
}
private void drawRightClickMenu() {
if (mouseButtonClick != 0) {
for (int i = 0; i < menuItemsCount; i++) {
int k = menuX + 2;
int i1 = menuY + 27 + i * 15;
if (super.mouseX <= k - 2 || super.mouseY <= i1 - 12 || super.mouseY >= i1 + 4 || super.mouseX >= (k - 3) + menuWidth)
continue;
menuItemClick(menuIndices[i]);
break;
}
mouseButtonClick = 0;
showRightClickMenu = false;
return;
}
if (super.mouseX < menuX - 10 || super.mouseY < menuY - 10 || super.mouseX > menuX + menuWidth + 10 || super.mouseY > menuY + menuHeight + 10) {
showRightClickMenu = false;
return;
}
surface.drawBoxAlpha(menuX, menuY, menuWidth, menuHeight, 0xd0d0d0, 160);
surface.drawstring("Choose option", menuX + 2, menuY + 12, 1, 65535);
for (int j = 0; j < menuItemsCount; j++) {
int l = menuX + 2;
int j1 = menuY + 27 + j * 15;
int k1 = 0xffffff;
if (super.mouseX > l - 2 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && super.mouseX < (l - 3) + menuWidth)
k1 = 0xffff00;
surface.drawstring(menuItemText1[menuIndices[j]] + " " + menuItemText2[menuIndices[j]], l, j1, 1, k1);
}
}
private void drawUiTabMinimap(boolean nomenus) {
int uiX = surface.width2 - 199;
int uiWidth = 156;// '\234';
int uiHeight = 152;// '\230';
surface.drawSprite(uiX - 49, 3, spriteMedia + 2);
uiX += 40;
surface.drawBox(uiX, 36, uiWidth, uiHeight, 0);
surface.setBounds(uiX, 36, uiX + uiWidth, 36 + uiHeight);
int k = 192 + minimapRandom_2;
int i1 = cameraRotation + minimapRandom_1 & 255;//0xff;
int k1 = ((localPlayer.currentX - 6040) * 3 * k) / 2048;
int i3 = ((localPlayer.currentY - 6040) * 3 * k) / 2048;
int k4 = Scene.sin2048Cache[1024 - i1 * 4 & 0x3ff];
int i5 = Scene.sin2048Cache[(1024 - i1 * 4 & 0x3ff) + 1024];
int k5 = i3 * k4 + k1 * i5 >> 18;
i3 = i3 * i5 - k1 * k4 >> 18;
k1 = k5;
surface.drawMinimapSprite((uiX + uiWidth / 2) - k1, 36 + uiHeight / 2 + i3, spriteMedia - 1, i1 + 64 & 255, k);// landscape
for (int i = 0; i < objectCount; i++) {
int l1 = (((objectX[i] * magicLoc + 64) - localPlayer.currentX) * 3 * k) / 2048;
int j3 = (((objectY[i] * magicLoc + 64) - localPlayer.currentY) * 3 * k) / 2048;
int l5 = j3 * k4 + l1 * i5 >> 18;
j3 = j3 * i5 - l1 * k4 >> 18;
l1 = l5;
drawMinimapEntity(uiX + uiWidth / 2 + l1, (36 + uiHeight / 2) - j3, 65535);
}
for (int j7 = 0; j7 < groundItemCount; j7++) {
int i2 = (((groundItemX[j7] * magicLoc + 64) - localPlayer.currentX) * 3 * k) / 2048;
int k3 = (((groundItemY[j7] * magicLoc + 64) - localPlayer.currentY) * 3 * k) / 2048;
int i6 = k3 * k4 + i2 * i5 >> 18;
k3 = k3 * i5 - i2 * k4 >> 18;
i2 = i6;
drawMinimapEntity(uiX + uiWidth / 2 + i2, (36 + uiHeight / 2) - k3, 0xff0000);
}
for (int k7 = 0; k7 < npcCount; k7++) {
GameCharacter character = npcs[k7];
int j2 = ((character.currentX - localPlayer.currentX) * 3 * k) / 2048;
int l3 = ((character.currentY - localPlayer.currentY) * 3 * k) / 2048;
int j6 = l3 * k4 + j2 * i5 >> 18;
l3 = l3 * i5 - j2 * k4 >> 18;
j2 = j6;
drawMinimapEntity(uiX + uiWidth / 2 + j2, (36 + uiHeight / 2) - l3, 0xffff00);
}
for (int l7 = 0; l7 < playerCount; l7++) {
GameCharacter character_1 = players[l7];
int k2 = ((character_1.currentX - localPlayer.currentX) * 3 * k) / 2048;
int i4 = ((character_1.currentY - localPlayer.currentY) * 3 * k) / 2048;
int k6 = i4 * k4 + k2 * i5 >> 18;
i4 = i4 * i5 - k2 * k4 >> 18;
k2 = k6;
int j8 = 0xffffff;
for (int k8 = 0; k8 < super.friendListCount; k8++) {
if (character_1.hash != super.friendListHashes[k8] || super.friendListOnline[k8] != 255)
continue;
j8 = 65280;
break;
}
drawMinimapEntity(uiX + uiWidth / 2 + k2, (36 + uiHeight / 2) - i4, j8);
}
surface.drawCircle(uiX + uiWidth / 2, 36 + uiHeight / 2, 2, 0xffffff, 255);
surface.drawMinimapSprite(uiX + 19, 55, spriteMedia + 24, cameraRotation + 128 & 255, 128);// compass
surface.setBounds(0, 0, gameWidth, gameHeight + 12);
if (!nomenus)
return;
int mouseX = super.mouseX - (surface.width2 - 199);
int mouseY = super.mouseY - 36;
if (mouseX >= 40 && mouseY >= 0 && mouseX < 196 && mouseY < 152) {
int c1 = 156;// '\234';
int c3 = 152;// '\230';
int l = 192 + minimapRandom_2;
int j1 = cameraRotation + minimapRandom_1 & 255;// 0xff
int j = surface.width2 - 199;
j += 40;
int dx = ((super.mouseX - (j + c1 / 2)) * 16384) / (3 * l);
int dy = ((super.mouseY - (36 + c3 / 2)) * 16384) / (3 * l);
int l4 = Scene.sin2048Cache[1024 - j1 * 4 & 1023];// 0x3ff
int j5 = Scene.sin2048Cache[(1024 - j1 * 4 & 1023) + 1024];// 0x3ff
int l6 = dy * l4 + dx * j5 >> 15;
dy = dy * j5 - dx * l4 >> 15;
dx = l6;
dx += localPlayer.currentX;
dy = localPlayer.currentY - dy;
if (mouseButtonClick == 1)
walkToActionSource(localRegionX, localRegionY, dx / 128, dy / 128, false);
mouseButtonClick = 0;
}
}
private void drawDialogTradeConfirm() {
byte dialogX = 22;
byte dialogY = 36;
surface.drawBox(dialogX, dialogY, 468, 16, 192);
surface.drawBoxAlpha(dialogX, dialogY + 16, 468, 246, 0x989898, 160);
surface.drawStringCenter("Please confirm your trade with @yel@" + Utility.hash2username(tradeRecipientConfirmHash), dialogX + 234, dialogY + 12, 1, 0xffffff);
surface.drawStringCenter("You are about to give:", dialogX + 117, dialogY + 30, 1, 0xffff00);
for (int j = 0; j < tradeConfirmItemsCount; j++) {
String s = GameData.itemName[tradeConfirmItems[j]];
if (GameData.itemStackable[tradeConfirmItems[j]] == 0)
s = s + " x " + formatNumber(tradeConfirmItemCount[j]);
surface.drawStringCenter(s, dialogX + 117, dialogY + 42 + j * 12, 1, 0xffffff);
}
if (tradeConfirmItemsCount == 0)
surface.drawStringCenter("Nothing!", dialogX + 117, dialogY + 42, 1, 0xffffff);
surface.drawStringCenter("In return you will receive:", dialogX + 351, dialogY + 30, 1, 0xffff00);
for (int k = 0; k < tradeRecipientConfirmItemsCount; k++) {
String s1 = GameData.itemName[tradeRecipientConfirmItems[k]];
if (GameData.itemStackable[tradeRecipientConfirmItems[k]] == 0)
s1 = s1 + " x " + formatNumber(tradeRecipientConfirmItemCount[k]);
surface.drawStringCenter(s1, dialogX + 351, dialogY + 42 + k * 12, 1, 0xffffff);
}
if (tradeRecipientConfirmItemsCount == 0)
surface.drawStringCenter("Nothing!", dialogX + 351, dialogY + 42, 1, 0xffffff);
surface.drawStringCenter("Are you sure you want to do this?", dialogX + 234, dialogY + 200, 4, 65535);
surface.drawStringCenter("There is NO WAY to reverse a trade if you change your mind.", dialogX + 234, dialogY + 215, 1, 0xffffff);
surface.drawStringCenter("Remember that not all players are trustworthy", dialogX + 234, dialogY + 230, 1, 0xffffff);
if (!tradeConfirmAccepted) {
surface.drawSprite((dialogX + 118) - 35, dialogY + 238, spriteMedia + 25);
surface.drawSprite((dialogX + 352) - 35, dialogY + 238, spriteMedia + 26);
} else {
surface.drawStringCenter("Waiting for other player...", dialogX + 234, dialogY + 250, 1, 0xffff00);
}
if (mouseButtonClick == 1) {
if (super.mouseX < dialogX || super.mouseY < dialogY || super.mouseX > dialogX + 468 || super.mouseY > dialogY + 262) {
showDialogTradeConfirm = false;
super.clientStream.newPacket((Command.CL_TRADE_DECLINE));
super.clientStream.sendPacket();
}
if (super.mouseX >= (dialogX + 118) - 35 && super.mouseX <= dialogX + 118 + 70 && super.mouseY >= dialogY + 238 && super.mouseY <= dialogY + 238 + 21) {
tradeConfirmAccepted = true;
super.clientStream.newPacket((Command.CL_TRADE_CONFIRM_ACCEPT));
super.clientStream.sendPacket();
}
if (super.mouseX >= (dialogX + 352) - 35 && super.mouseX <= dialogX + 353 + 70 && super.mouseY >= dialogY + 238 && super.mouseY <= dialogY + 238 + 21) {
showDialogTradeConfirm = false;
super.clientStream.newPacket((Command.CL_TRADE_DECLINE));
super.clientStream.sendPacket();
}
mouseButtonClick = 0;
}
}
private void setActiveUiTab() {
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 && super.mouseY < 35)
showUiTab = 1;
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 - 33 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 33 && super.mouseY < 35) {
showUiTab = 2;
minimapRandom_1 = (int) (Math.random() * 13D) - 6;
minimapRandom_2 = (int) (Math.random() * 23D) - 11;
}
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 - 66 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 66 && super.mouseY < 35)
showUiTab = 3;
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 - 99 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 99 && super.mouseY < 35)
showUiTab = 4;
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 - 132 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 132 && super.mouseY < 35)
showUiTab = 5;
if (showUiTab == 0 && super.mouseX >= surface.width2 - 35 - 165 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 165 && super.mouseY < 35)
showUiTab = 6;
if (showUiTab != 0 && super.mouseX >= surface.width2 - 35 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 && super.mouseY < 26)
showUiTab = 1;
if (showUiTab != 0 && showUiTab != 2 && super.mouseX >= surface.width2 - 35 - 33 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 33 && super.mouseY < 26) {
showUiTab = 2;
minimapRandom_1 = (int) (Math.random() * 13D) - 6;
minimapRandom_2 = (int) (Math.random() * 23D) - 11;
}
if (showUiTab != 0 && super.mouseX >= surface.width2 - 35 - 66 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 66 && super.mouseY < 26)
showUiTab = 3;
if (showUiTab != 0 && super.mouseX >= surface.width2 - 35 - 99 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 99 && super.mouseY < 26)
showUiTab = 4;
if (showUiTab != 0 && super.mouseX >= surface.width2 - 35 - 132 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 132 && super.mouseY < 26)
showUiTab = 5;
if (showUiTab != 0 && super.mouseX >= surface.width2 - 35 - 165 && super.mouseY >= 3 && super.mouseX < surface.width2 - 3 - 165 && super.mouseY < 26)
showUiTab = 6;
if (showUiTab == 1 && (super.mouseX < surface.width2 - 248 || super.mouseY > 36 + (inventoryMaxItemCount / 5) * 34))
showUiTab = 0;
if (showUiTab == 3 && (super.mouseX < surface.width2 - 199 || super.mouseY > 316))
showUiTab = 0;
if ((showUiTab == 2 || showUiTab == 4 || showUiTab == 5) && (super.mouseX < surface.width2 - 199 || super.mouseY > 240))
showUiTab = 0;
if (showUiTab == 6 && (super.mouseX < surface.width2 - 199 || super.mouseY > 311))
showUiTab = 0;
}
private void drawOptionMenu() {
if (mouseButtonClick != 0) {
for (int i = 0; i < optionMenuCount; i++) {
if (super.mouseX >= surface.textWidth(optionMenuEntry[i], 1) || super.mouseY <= i * 12 || super.mouseY >= 12 + i * 12)
continue;
super.clientStream.newPacket((Command.CL_CHOOSE_OPTION));
super.clientStream.putByte(i);
super.clientStream.sendPacket();
break;
}
mouseButtonClick = 0;
showOptionMenu = false;
return;
}
for (int j = 0; j < optionMenuCount; j++) {
int k = 65535;
if (super.mouseX < surface.textWidth(optionMenuEntry[j], 1) && super.mouseY > j * 12 && super.mouseY < 12 + j * 12)
k = 0xff0000;
surface.drawstring(optionMenuEntry[j], 6, 12 + j * 12, 1, k);
}
}
void drawNpc(int x, int y, int w, int h, int id, int tx, int ty) {
GameCharacter character = npcs[id];
int l1 = character.animationCurrent + (cameraRotation + 16) / 32 & 7;
boolean flag = false;
int i2 = l1;
if (i2 == 5) {
i2 = 3;
flag = true;
} else if (i2 == 6) {
i2 = 2;
flag = true;
} else if (i2 == 7) {
i2 = 1;
flag = true;
}
int j2 = i2 * 3 + npcWalkModel[(character.stepCount / GameData.npcWalkModel[character.npcId]) % 4];
if (character.animationCurrent == 8) {
i2 = 5;
l1 = 2;
flag = false;
x -= (GameData.npcCombatAnimation[character.npcId] * ty) / 100;
j2 = i2 * 3 + npcCombatModelArray1[(loginTimer / (GameData.npcCombatModel[character.npcId] - 1)) % 8];
} else if (character.animationCurrent == 9) {
i2 = 5;
l1 = 2;
flag = true;
x += (GameData.npcCombatAnimation[character.npcId] * ty) / 100;
j2 = i2 * 3 + npcCombatModelArray2[(loginTimer / GameData.npcCombatModel[character.npcId]) % 8];
}
for (int k2 = 0; k2 < 12; k2++) {
int l2 = npcAnimationArray[l1][k2];
int k3 = GameData.npcSprite[character.npcId][l2];
if (k3 >= 0) {
int i4 = 0;
int j4 = 0;
int k4 = j2;
if (flag && i2 >= 1 && i2 <= 3 && GameData.animationHasF[k3] == 1)
k4 += 15;
if (i2 != 5 || GameData.animationHasA[k3] == 1) {
int l4 = k4 + GameData.animationNumber[k3];
i4 = (i4 * w) / surface.spriteWidthFull[l4];
j4 = (j4 * h) / surface.spriteHeightFull[l4];
int i5 = (w * surface.spriteWidthFull[l4]) / surface.spriteWidthFull[GameData.animationNumber[k3]];
i4 -= (i5 - w) / 2;
int col = GameData.animationCharacterColour[k3];
int skincol = 0;
if (col == 1) {
col = GameData.npcColourHair[character.npcId];
skincol = GameData.npcColourSkin[character.npcId];
} else if (col == 2) {
col = GameData.npcColourTop[character.npcId];
skincol = GameData.npcColourSkin[character.npcId];
} else if (col == 3) {
col = GameData.npcColorBottom[character.npcId];
skincol = GameData.npcColourSkin[character.npcId];
}
surface.spriteClipping(x + i4, y + j4, i5, h, l4, col, skincol, tx, flag);
}
}
}
if (character.messageTimeout > 0) {
receivedMessageMidPoint[receivedMessagesCount] = surface.textWidth(character.message, 1) / 2;
if (receivedMessageMidPoint[receivedMessagesCount] > 150)
receivedMessageMidPoint[receivedMessagesCount] = 150;
receivedMessageHeight[receivedMessagesCount] = (surface.textWidth(character.message, 1) / 300) * surface.textHeight(1);
receivedMessageX[receivedMessagesCount] = x + w / 2;
receivedMessageY[receivedMessagesCount] = y;
receivedMessages[receivedMessagesCount++] = character.message;
}
if (character.animationCurrent == 8 || character.animationCurrent == 9 || character.combatTimer != 0) {
if (character.combatTimer > 0) {
int i3 = x;
if (character.animationCurrent == 8)
i3 -= (20 * ty) / 100;
else if (character.animationCurrent == 9)
i3 += (20 * ty) / 100;
int l3 = (character.healthCurrent * 30) / character.healthMax;
healthBarX[healthBarCount] = i3 + w / 2;
healthBarY[healthBarCount] = y;
healthBarMissing[healthBarCount++] = l3;
}
if (character.combatTimer > 150) {
int j3 = x;
if (character.animationCurrent == 8)
j3 -= (10 * ty) / 100;
else if (character.animationCurrent == 9)
j3 += (10 * ty) / 100;
surface.drawSprite((j3 + w / 2) - 12, (y + h / 2) - 12, spriteMedia + 12);
surface.drawStringCenter(String.valueOf(character.damageTaken), (j3 + w / 2) - 1, y + h / 2 + 5, 3, 0xffffff);
}
}
}
/*public Image createImage(int i, int j) {
if (gameFrame != null)
return gameFrame.createImage(i, j);
return super.createImage(i, j);
}*/
private void walkToWallObject(int i, int j, int k) {
if (k == 0) {
walkToActionSource(localRegionX, localRegionY, i, j - 1, i, j, false, true);
return;
}
if (k == 1) {
walkToActionSource(localRegionX, localRegionY, i - 1, j, i, j, false, true);
return;
} else {
walkToActionSource(localRegionX, localRegionY, i, j, i, j, true, true);
return;
}
}
private void loadGameConfig() {
byte buff[] = readDataFile("config" + Version.CONFIG + ".jag", "Configuration", 10);
if (buff == null) {
errorLoadingData = true;
return;
}
GameData.loadData(buff, members);
byte abyte1[] = readDataFile("filter" + Version.FILTER + ".jag", "Chat system", 15);
if (abyte1 == null) {
errorLoadingData = true;
return;
} else {
byte buffragments[] = Utility.loadData("fragmentsenc.txt", 0, abyte1);
byte buffbandenc[] = Utility.loadData("badenc.txt", 0, abyte1);
byte buffhostenc[] = Utility.loadData("hostenc.txt", 0, abyte1);
byte bufftldlist[] = Utility.loadData("tldlist.txt", 0, abyte1);
WordFilter.loadFilters(new Buffer(buffragments), new Buffer(buffbandenc), new Buffer(buffhostenc), new Buffer(bufftldlist));
return;
}
}
private GameCharacter addNpc(int serverIndex, int x, int y, int sprite, int type) {
if (npcsServer[serverIndex] == null) {
npcsServer[serverIndex] = new GameCharacter();
npcsServer[serverIndex].serverIndex = serverIndex;
}
GameCharacter character = npcsServer[serverIndex];
boolean foundNpc = false;
for (int i = 0; i < npcCacheCount; i++) {
if (npcsCache[i].serverIndex != serverIndex)
continue;
foundNpc = true;
break;
}
if (foundNpc) {
character.npcId = type;
character.animationNext = sprite;
int waypointIdx = character.waypointCurrent;
if (x != character.waypointsX[waypointIdx] || y != character.waypointsY[waypointIdx]) {
character.waypointCurrent = waypointIdx = (waypointIdx + 1) % 10;
character.waypointsX[waypointIdx] = x;
character.waypointsY[waypointIdx] = y;
}
} else {
character.serverIndex = serverIndex;
character.movingStep = 0;
character.waypointCurrent = 0;
character.waypointsX[0] = character.currentX = x;
character.waypointsY[0] = character.currentY = y;
character.npcId = type;
character.animationNext = character.animationCurrent = sprite;
character.stepCount = 0;
}
npcs[npcCount++] = character;
return character;
}
protected void resetLoginVars() {
systemUpdate = 0;
loginScreen = 0;
loggedIn = 0;
logoutTimeout = 0;
}
private void drawDialogBank() {
int dialogWidth = 408;// '\u0198';
int dialogHeight = 334;// '\u014E';
if (bankActivePage > 0 && bankItemCount <= 48)
bankActivePage = 0;
if (bankActivePage > 1 && bankItemCount <= 96)
bankActivePage = 1;
if (bankActivePage > 2 && bankItemCount <= 144)
bankActivePage = 2;
if (bankSelectedItemSlot >= bankItemCount || bankSelectedItemSlot < 0)
bankSelectedItemSlot = -1;
if (bankSelectedItemSlot != -1 && bankItems[bankSelectedItemSlot] != bankSelectedItem) {
bankSelectedItemSlot = -1;
bankSelectedItem = -2;
}
if (mouseButtonClick != 0) {
mouseButtonClick = 0;
int mouseX = super.mouseX - (gameWidth / 2 - dialogWidth / 2);
int mouseY = super.mouseY - (gameHeight / 2 - dialogHeight / 2);
//int mouseX = super.mouseX - (256 - dialogWidth / 2);
//int mouseY = super.mouseY - (170 - dialogHeight / 2);
if (mouseX >= 0 && mouseY >= 12 && mouseX < 408 && mouseY < 280) {
int i1 = bankActivePage * 48;
for (int l1 = 0; l1 < 6; l1++) {
for (int j2 = 0; j2 < 8; j2++) {
int l6 = 7 + j2 * 49;
int j7 = 28 + l1 * 34;
if (mouseX > l6 && mouseX < l6 + 49 && mouseY > j7 && mouseY < j7 + 34 && i1 < bankItemCount && bankItems[i1] != -1) {
bankSelectedItem = bankItems[i1];
bankSelectedItemSlot = i1;
}
i1++;
}
}
mouseX = 256 - dialogWidth / 2;
mouseY = 170 - dialogHeight / 2;
int slot;
if (bankSelectedItemSlot < 0)
slot = -1;
else
slot = bankItems[bankSelectedItemSlot];
if (slot != -1) {
int j1 = bankItemsCount[bankSelectedItemSlot];
if (GameData.itemStackable[slot] == 1 && j1 > 1)
j1 = 1;
if (j1 >= 1 && super.mouseX >= mouseX + 220 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 250 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(1);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (j1 >= 5 && super.mouseX >= mouseX + 250 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 280 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(5);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (j1 >= 25 && super.mouseX >= mouseX + 280 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 305 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(25);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (j1 >= 100 && super.mouseX >= mouseX + 305 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 335 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(100);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (j1 >= 500 && super.mouseX >= mouseX + 335 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 368 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(500);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (j1 >= 2500 && super.mouseX >= mouseX + 370 && super.mouseY >= mouseY + 238 && super.mouseX < mouseX + 400 && super.mouseY <= mouseY + 249) {
super.clientStream.newPacket((Command.CL_BANK_WITHDRAW));
super.clientStream.putShort(slot);
super.clientStream.putShort(2500);
super.clientStream.putInt(0x12345678);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 1 && super.mouseX >= mouseX + 220 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 250 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(1);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 5 && super.mouseX >= mouseX + 250 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 280 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(5);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 25 && super.mouseX >= mouseX + 280 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 305 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(25);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 100 && super.mouseX >= mouseX + 305 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 335 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(100);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 500 && super.mouseX >= mouseX + 335 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 368 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(500);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
if (getInventoryCount(slot) >= 2500 && super.mouseX >= mouseX + 370 && super.mouseY >= mouseY + 263 && super.mouseX < mouseX + 400 && super.mouseY <= mouseY + 274) {
super.clientStream.newPacket((Command.CL_BANK_DEPOSIT));
super.clientStream.putShort(slot);
super.clientStream.putShort(2500);
super.clientStream.putInt(0x87654321);
super.clientStream.sendPacket();
}
}
} else if (bankItemCount > 48 && mouseX >= 50 && mouseX <= 115 && mouseY <= 12)
bankActivePage = 0;
else if (bankItemCount > 48 && mouseX >= 115 && mouseX <= 180 && mouseY <= 12)
bankActivePage = 1;
else if (bankItemCount > 96 && mouseX >= 180 && mouseX <= 245 && mouseY <= 12)
bankActivePage = 2;
else if (bankItemCount > 144 && mouseX >= 245 && mouseX <= 310 && mouseY <= 12) {
bankActivePage = 3;
} else {
super.clientStream.newPacket((Command.CL_BANK_CLOSE));
super.clientStream.sendPacket();
showDialogBank = false;
return;
}
}
int x = gameWidth / 2 - dialogWidth / 2;
int y = gameHeight / 2 - dialogHeight / 2;
//int x = 256 - dialogWidth / 2;
//int y = 170 - dialogHeight / 2;
surface.drawBox(x, y, 408, 12, 192);
surface.drawBoxAlpha(x, y + 12, 408, 17, 0x989898, 160);
surface.drawBoxAlpha(x, y + 29, 8, 204, 0x989898, 160);
surface.drawBoxAlpha(x + 399, y + 29, 9, 204, 0x989898, 160);
surface.drawBoxAlpha(x, y + 233, 408, 47, 0x989898, 160);
surface.drawstring("Bank", x + 1, y + 10, 1, 0xffffff);
int xOff = 50;
if (bankItemCount > 48) {
int l2 = 0xffffff;
if (bankActivePage == 0)
l2 = 0xff0000;
else if (super.mouseX > x + xOff && super.mouseY >= y && super.mouseX < x + xOff + 65 && super.mouseY < y + 12)
l2 = 0xffff00;
surface.drawstring("