private void handleDrawObject(byte[] incMobile) { // Draw object really means draw mobile // May want to move mobiles to their own list? rather than item list uoobject myobject = new uoobject(); myobject.serial = ((incMobile[3] << 24) | (incMobile[4] << 16) | (incMobile[5] << 8) | (incMobile[6])); myobject.type = ((incMobile[7] << 8) | (incMobile[8] & 0xFF)); myobject.x = ((incMobile[9] << 8) | (incMobile[10] & 0xFF)); myobject.y = ((incMobile[11] << 8) | (incMobile[12] & 0xFF)); myobject.z = incMobile[13]; myobject.color = ((incMobile[14] << 8) | (incMobile[15])); // store the id in a 2nd array, if the id is found we update the data, if not we replace if (GameObjects.ContainsKey(myobject.serial)) { GameObjects.Remove(myobject.serial); GameObjects.Add(myobject.serial, myobject); } else { GameObjects.Add(myobject.serial, myobject); } display("Drawn Object ID: " + myobject.serial + " type: " + myobject.type + "X: " + myobject.x + "Y: " + myobject.y); }
private void handleUpdatePlayer(byte[] buffer) { uoobject tmpob = new uoobject(); tmpob.serial = (buffer[4] & 0xFF) | ((buffer[3] & 0xFF) << 8) | ((buffer[2] & 0xFF) << 16) | ((buffer[1] & 0xFF) << 24); tmpob.type = (buffer[6] & 0xFF) | ((buffer[5] & 0xFF) << 8); tmpob.x = (buffer[8] & 0xFF) | ((buffer[7] & 0xFF) << 8); tmpob.y = (buffer[10] & 0xFF) | ((buffer[9] & 0xFF) << 8); tmpob.z = (buffer[11] & 0xFF); int direction = (buffer[12] & 0xFF); tmpob.color = (buffer[14] & 0xFF) | ((buffer[13] & 0xFF) << 8); int flag = (buffer[15] & 0xFF); int highlightColor = (buffer[16] & 0xFF); if (GameObjects.ContainsKey(tmpob.serial)) { GameObjects.Remove(tmpob.serial); GameObjects.Add(tmpob.serial, tmpob); } else { GameObjects.Add(tmpob.serial, tmpob); } if (tmpob.serial == player.CharID) { player.CharPosX = tmpob.x; player.CharPosY = tmpob.y; player.CharPosZ = tmpob.z; } display("Update Player ID: " + tmpob.serial + " type: " + tmpob.type + "X: " + tmpob.x + "Y: " + tmpob.y); }
private void handleObjectInfo(byte[] incMobile) { // This should be all correct // need to remove 8000000 from ID uoobject tmpob = new uoobject(); int offset = 0; int direction = 0; tmpob.serial = ((incMobile[3] << 24) | (incMobile[4] << 16) | (incMobile[5] << 8) | (incMobile[6] & 0xFF)); tmpob.type = (incMobile[7] << 8) | (incMobile[8] & 0xFF); if ((tmpob.serial & 0x80000000) == 0x80000000) { tmpob.stack = ((incMobile[9] << 8) | (incMobile[10] & 0xFF)); //int temp2 = (incMobile[4] & 0x7F); tmpob.serial = (tmpob.serial & 0x7FFFFF); // Removes the 8000000 if its found offset = offset + 2; } if ((tmpob.type & 0x8000) == 0x8000) { offset = offset + 1; } tmpob.x = ((incMobile[9 + offset] << 8) | (incMobile[10 + offset] & 0xFF)); tmpob.x = (tmpob.x & 0x7FFF); int temp = (incMobile[11 + offset] & 0xF); tmpob.y = ((temp << 8) | (incMobile[12 + offset] & 0xFF)); if ((tmpob.x & 0x8000) == 0x8000) { direction = incMobile[13 + offset]; offset = offset + 1; } tmpob.z = incMobile[13 + offset]; if ((tmpob.y & 0x8000) == 0x8000) { tmpob.color = ((incMobile[14 + offset] << 8) | (incMobile[15 + offset] & 0xFF)); offset = offset + 2; } if ((tmpob.y & 0x4000) == 0x4000) { tmpob.flags = incMobile[14 + offset]; } if (GameObjects.ContainsKey(tmpob.serial)) { GameObjects.Remove(tmpob.serial); GameObjects.Add(tmpob.serial, tmpob); } else { GameObjects.Add(tmpob.serial, tmpob); } display("Object Info ID: " + tmpob.serial + " Type: " + tmpob.type + "X: " + tmpob.x + "Y: " + tmpob.y); }
public void main() { Active = false; //uoobject tempob = (uoobject)uonet.GameObjects[3]; //Events.Cast(Spell.Agility); uonet.displaywipe(); uonet.display("Script Started!"); Event Events = new Event(uonet); int cnt = 0; while (cnt < 10) { Events.UseObject(1076771726); while (uonet.UOClient.TargCurs == 0) { Thread.Sleep(10); } Events.TargetGround(2563, 489, 0, 0); for (int x = 0; x < 40; x++) { Thread.Sleep(100); String temp = (String)uonet.Journal[0]; if (temp.Contains("loosen")) { uonet.display("FoundLoosen"); break; } } //Thread.Sleep(3000); } uonet.display(Events.IntToEUO(uonet.player.CharID)); uoobject myobj = new uoobject(); foreach (DictionaryEntry Item in uonet.GameObjects) { uoobject mytemp = (uoobject)Item.Value; uonet.display("ID: " + mytemp.serial); } uonet.display("Script Ended!"); //Events.Move(3503, 2580, 0, 5); // uonet.Send(Packets.Send.Packets.MoveRequestPacket(Direction.West,0,0)); // Events.UseSkill(Skill.AnimalLore); //Thread.Sleep(500); //Events.UseSkill(Skill.Tracking); }
public uoobject Finditem(int Type) { uoobject myobj = new uoobject(); foreach (DictionaryEntry Item in uonet.GameObjects) { uoobject mytemp = (uoobject)Item.Value; if (mytemp.type == Type) { myobj = mytemp; break; } } return(myobj); }
private void handleDrawObject(byte[] buffer) { // Draw object really means draw mobile // May want to move mobiles to their own list? rather than item list boolean myresult = true; int size = ((buffer[1] & 0xFF) << 8) | (buffer[2] & 0xFF); byte[] incMobile = new byte[1]; try { incMobile = new byte[size]; } catch (ArrayIndexOutOfBoundsException e) { writeoutput("Error: Mobile data too long"); } for (int i = 0; i < incMobile.length; i++) { incMobile[i] = buffer[i]; } int itemid = ((incMobile[3] << 24) | (incMobile[4] << 16) | (incMobile[5] << 8) | (incMobile[6])); int type = ((incMobile[7] << 8) | (incMobile[8] & 0xFF)); int itemx = ((incMobile[9] << 8) | (incMobile[10] & 0xFF)); int itemy = ((incMobile[11] << 8) | (incMobile[12] & 0xFF)); int itemz = incMobile[13]; int color = ((incMobile[14] << 8) | (incMobile[15])); // store the id in a 2nd array, if the id is found we update the data, if not we replace drawdata = new UOObject(itemid, type, itemx, itemy, itemz, color); for (int i = 0; i < Listitemsindex.size(); i++) { if (itemid == Listitemsindex.get(i)) { Listitems.set(i, drawdata); myresult = false; break; } } if (myresult) { Listitemsindex.add(itemid); Listitems.add(drawdata); } //UOObject currentobj = Listitems.firstElement(); //writeoutput(incMobile[0] + " " + (incMobile[0] & 0xFF)); writeoutput("Draw Object ID: " + itemid + " type: " + type + "X: " + itemx + "Y: " + itemy); }
private void handleUpdatePlayer(byte[] buffer) { Boolean myresult = true; int itemid = (buffer[4] & 0xFF) | ((buffer[3] & 0xFF) << 8) | ((buffer[2] & 0xFF) << 16) | ((buffer[1] & 0xFF) << 24); int model = (buffer[6] & 0xFF) | ((buffer[5] & 0xFF) << 8); int x = (buffer[8] & 0xFF) | ((buffer[7] & 0xFF) << 8); int y = (buffer[10] & 0xFF) | ((buffer[9] & 0xFF) << 8); int z = (buffer[11] & 0xFF); int direction = (buffer[12] & 0xFF); int hue = (buffer[14] & 0xFF) | ((buffer[13] & 0xFF) << 8); int flag = (buffer[15] & 0xFF); int highlightColor = (buffer[16] & 0xFF); drawdata = new UOObject(itemid, model, x, y, z, hue); for (int i = 0; i < Listitemsindex.size(); i++) { if (itemid == Listitemsindex.get(i)) { Listitems.set(i, drawdata); myresult = false; break; } } if (myresult) { Listitemsindex.add(itemid); Listitems.add(drawdata); } if (itemid == player.getserial()) { player.setX(x); player.setY(y); player.setZ(z); packetOperator.processUpdatePlayer(); } writeoutput("Update Player ID: " + itemid + " type: " + model + "X: " + x + "Y: " + y + " Hue: " + hue + " Flags: " + flag); }
private void handleWornItem(byte[] buffer) { try { Boolean myresult = true; byte[] wornitem = new byte[15]; for (int i = 0; i < wornitem.length; i++) { wornitem[i] = buffer[i]; } int itemid = ((wornitem[1] << 24) | (wornitem[2] << 16) | (wornitem[3] << 8) | (wornitem[4])); int mobileid = ((wornitem[9] << 24) | (wornitem[10] << 16) | (wornitem[11] << 8) | (wornitem[12])); int itemx = 0; int itemy = 0; int itemz = 0; int hue = 0; int type = 0; //if (debug) writeoutput("wormitemid: " + itemid + "MobID: " + mobileid); drawdata = new UOObject(itemid, type, itemx, itemy, itemz, hue); for (int i = 0; i < Listitemsindex.size(); i++) { if (itemid == Listitemsindex.get(i)) { Listitems.set(i, drawdata); myresult = false; break; } } if (myresult) { Listitemsindex.add(itemid); Listitems.add(drawdata); } } catch (ArrayIndexOutOfBoundsException e) { writeoutput("Error: Wornitem packet too long: " + e); } }
private void handleObjectInfo(byte[] buffer) { // This should be all correct // need to remove 8000000 from ID boolean myresult = true; int offset = 0; int direction = 0; int stack = 0; int size = ((buffer[1] & 0xFF) << 8) | (buffer[2] & 0xFF); byte[] incMobile = new byte[1]; try { incMobile = new byte[size]; } catch (ArrayIndexOutOfBoundsException e) { writeoutput("Error: Mobile data too long"); } for (int i = 0; i < incMobile.length; i++) { incMobile[i] = buffer[i]; } int itemid = ((incMobile[3] << 24) | (incMobile[4] << 16) | (incMobile[5] << 8) | (incMobile[6] & 0xFF)); int type = (buffer[7] << 8) | (buffer[8] & 0xFF); if ((itemid & 0x80000000) == 0x80000000) { stack = ((incMobile[9] << 8) | (incMobile[10] & 0xFF)); //int temp2 = (incMobile[4] & 0x7F); itemid = (itemid & 0x7FFFFF); // Removes the 8000000 if its found offset = offset + 2; } if ((type & 0x8000) == 0x8000) { offset = offset + 1; } int itemx = ((incMobile[9 + offset] << 8) | (incMobile[10 + offset] & 0xFF)); int temp = (incMobile[11 + offset] & 0xF); int itemy = ((temp << 8) | (incMobile[12 + offset] & 0xFF)); if ((itemx & 0x8000) == 0x8000) { direction = incMobile[13 + offset]; offset = offset + 1; } int itemz = incMobile[13 + offset]; int hue = 0; if ((itemy & 0x8000) == 0x8000) { hue = ((incMobile[14 + offset] << 8) | (incMobile[15 + offset] & 0xFF)); offset = offset + 2; } int flags = 0; if ((itemy & 0x4000) == 0x4000) { flags = incMobile[14 + offset]; } drawdata = new UOObject(itemid, type, itemx, itemy, itemz, hue); for (int i = 0; i < Listitemsindex.size(); i++) { if (itemid == Listitemsindex.get(i)) { Listitems.set(i, drawdata); myresult = false; break; } } if (myresult) { Listitemsindex.add(itemid); Listitems.add(drawdata); } //System,out.println("Y: " (incMobile[])); writeoutput("Object Info ID: " + itemid + " type: " + type + "X: " + itemx + "Y: " + itemy + " Hue: " + hue + " Flags: " + flags); }