Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace zBot
- {
- class Action
- {
- public static bool UseReturn()
- {
- bool success = false;
- Packet packet = new Packet((ushort)GameOpcodes.CLIENT_OPCODES.INVENTORY_USE, true, enumDestination.Server);
- for (byte i = 0; i < CharData.CharacterData.Items.Length; i++)
- {
- string type = CharData.CharacterData.Items[i].Type;
- if (type == "ITEM_ETC_SCROLL_RETURN_NEWBIE_01" || type == "ITEM_ETC_SCROLL_RETURN_03" || type == "ITEM_ETC_SCROLL_RETURN_02" || type == "ITEM_ETC_SCROLL_RETURN_01")
- {
- packet.data.AddBYTE(i);
- packet.data.AddWORD(0x0C30);
- packet.data.AddWORD((ushort)Functions.UsageID.RETURN);
- Globals.ServerPC.SendPacket(packet);
- success = true;
- break;
- }
- else
- {
- if (i + 1 == CharData.CharacterData.Items.Length)
- {
- Globals.UpdateLogs("Return Scroll Not Found");
- }
- }
- }
- return success;
- }
- public static void UseZerk()
- {
- Packet packet = new Packet((ushort)GameOpcodes.CLIENT_OPCODES.ZERK, false, enumDestination.Server);
- packet.data.AddBYTE(0x01);
- Globals.ServerPC.SendPacket(packet);
- }
- public static void WalkTo(int X, int Y)
- {
- int xPos = 0;
- int yPos = 0;
- if (X > 0 && Y > 0)
- {
- xPos = (int)((X % 192) * 10);
- yPos = (int)((Y % 192) * 10);
- }
- else
- {
- if (X < 0 && Y > 0)
- {
- xPos = (int)((192 + (X % 192)) * 10);
- yPos = (int)((Y % 192) * 10);
- }
- else
- {
- if (X > 0 && Y < 0)
- {
- xPos = (int)((X % 192) * 10);
- yPos = (int)((192 + (Y % 192)) * 10);
- }
- }
- }
- byte xSector = (byte)((X - (int)(xPos / 10)) / 192 + 135);
- byte ySector = (byte)((Y - (int)(yPos / 10)) / 192 + 92);
- if (MainData.Cave.InCave == true)
- {
- byte xsec_off = (byte)(MainData.Cave.xSec - xSector);
- xSector = MainData.Cave.xSec;
- xPos -= (int)(1920 * xsec_off);
- byte ysec_off = (byte)(MainData.Cave.ySec - ySector);
- yPos -= (int)(1920 * ysec_off);
- ySector = MainData.Cave.ySec;
- }
- Packet packet = new Packet((ushort)GameOpcodes.CLIENT_OPCODES.OBJECT_MOVEMENT, false, enumDestination.Server);
- packet.data.AddBYTE(0x01);
- int xposition = (int)((X - (int)((xSector - 135) * 192)) * 10);
- int yposition = (int)((Y - (int)((ySector - 92) * 192)) * 10);
- packet.data.AddBYTE(xSector);
- packet.data.AddBYTE(ySector);
- if (MainData.Cave.InCave)
- {
- packet.data.AddDWORD_Signed(xposition);
- packet.data.AddDWORD_Signed(0x00000000);
- packet.data.AddDWORD_Signed(yposition);
- }
- else
- {
- packet.data.AddWORD((ushort)xposition);
- packet.data.AddWORD(0x0000);
- packet.data.AddWORD((ushort)yposition);
- }
- Globals.ServerPC.SendPacket(packet);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment