for (int i = 0; i < gCli.gCon.world.objects.size(); i++) {
if ((gCli.gCon.world.objects.get(i).isPlayer()) && (gCli.gCon.world.objects.get(i).getPosition().distanceTo(gCli.gCon.world.getPosition()) < distance)
&& (gCli.gCon.world.objects.get(i).getHealth() != 0)) {
id = i;
distance = gCli.gCon.world.objects.get(i).getPosition().distanceTo(gCli.gCon.world.getPosition());
}
}
if (distance < 8.6) {
ObjectStatus obj = gCli.gCon.world.objects.get(id);
if (obj != null){
double angle = ((float) Math.toRadians(gCli.gCon.world.getPosition().getAngleTo(obj.getPosition())));
angle = (angle + (Math.PI * 3/ 2)) % (Math.PI *2);
if (obj != null){
PLAYERSHOOT_Packet shoot = new PLAYERSHOOT_Packet();
shoot.angle_ = (float) angle;
shoot.bulletId_ = bulletID;
shoo*****ntainerType_ = 2711;
shoot.startingPos_ = gCli.gCon.world.getPosition();
shoot.time_ = gCli.currentTime();
gCli.gCon.sendPacket(shoot); //simply adds packet to queue for sending
ENEMYHIT_Packet hit = new ENEMYHIT_Packet();
hit.bulletId_ = bulletID;
hit.targetId_ = obj.objStatData.objectId;
hit.kill_ = ((obj.getHealth() - 10) < 0);
hit.time_ = gCli.currentTime();
try {
Thread.sleep((long) (distance * 5));
} catch (InterruptedException e) {
}
Random rnd = new Random();
if (rnd.nextLong() < 0.7){
gCli.gCon.sendPacket(hit);
bulletID = (bulletID + 1) % 255;
}
}
}
.
. I have not encountered the other problem, however when an error packet is received i simple reuse the last RECONNECT_Packet to try to establish a new connection and that seems to work fine, requires a bit of code though.
, anyone else managed to do it and wants to share?@override public void loopp(){ { USEITEM_Packet uppp = new USEITEM_Packet(); uppp.time_= 1000; uppp.slotObject_.objectId = FireBolt; uppp.slotObject_.slotId = 11; uppp.slotObject_.itemType = 2606; uppp.itemUsePos_ = gCli.gCon.world.getPosition(); gCon.sendQueue.add(uppp); } }
<Object type="0xa2e" id="Fire Spray Spell"> <Class>Equipment</Class> <Item/> <Texture><File>lofiObj6</File><Index>0x40</Index></Texture> <SlotType>11</SlotType> <Tier>0</Tier> <Description>A spell that shoots fire in all directions.</Description> <Sound>spell/fire_spray</Sound> <Projectile> <ObjectId>Fire Bolt</ObjectId> <Speed>160</Speed> <MinDamage>30</MinDamage> <MaxDamage>50</MaxDamage> <LifetimeMS>1000</LifetimeMS> </Projectile> <Usable/> <BagType>0</BagType> <MpCost>30</MpCost> <Activate>BulletNova</Activate> </Object>