public void PlayerShoot(RealmTime time, PlayerShootPacket pkt) { // System.Diagnostics.Debug.WriteLine(pkt.Position); Item item = XmlDatas.ItemDescs[pkt.ContainerType]; var prjDesc = item.Projectiles[0]; //Assume only one projectileId = pkt.BulletId; Projectile prj = CreateProjectile(prjDesc, item.ObjectType, (int)statsMgr.GetAttackDamage(prjDesc.MinDamage, prjDesc.MaxDamage), pkt.Time + tickMapping, pkt.Position, pkt.Angle); Owner.EnterWorld(prj); Owner.BroadcastPacket(new AllyShootPacket() { OwnerId = Id, Angle = pkt.Angle, ContainerType = pkt.ContainerType, BulletId = pkt.BulletId }, this); fames.Shoot(prj); }
public void PlayerShoot(RealmTime time, PlayerShootPacket pkt) { System.Diagnostics.Debug.WriteLine(pkt.Position); // Was Commented! Item item = XmlDatas.ItemDescs[pkt.ContainerType]; if (item.ObjectType == Inventory[0].ObjectType || item.ObjectType == Inventory[1].ObjectType) { var prjDesc = item.Projectiles[0]; //Assume only one projectileId = pkt.BulletId; Projectile prj = CreateProjectile(prjDesc, item.ObjectType, 0, pkt.Time + tickMapping, pkt.Position, pkt.Angle); Owner.EnterWorld(prj); Owner.BroadcastPacket(new AllyShootPacket() { OwnerId = Id, Angle = pkt.Angle, ContainerType = pkt.ContainerType, BulletId = pkt.BulletId }, this); fames.Shoot(prj); } }
public void PlayerShoot(RealmTime time, PlayerShootPacket pkt) { Debug.WriteLine(pkt.Position); // Was Commented! var item = XmlDatas.ItemDescs[pkt.ContainerType]; if (item.ObjectType != Inventory[0].ObjectType && item.ObjectType != Inventory[1].ObjectType) return; if (item.DualShooting) { var arcGap1 = item.ArcGap1 * Math.PI / 180; var arcGap2 = item.ArcGap2 * Math.PI / 180; //var startAngle1 = Math.Atan2(target.Y - Y, target.X - X) - (item.NumProjectiles1 - 1) / 2 * arcGap1; //var startAngle2 = Math.Atan2(target.Y - Y, target.X - X) - (item.NumProjectiles2 - 1) / 2 * arcGap2; var startAngle1 = pkt.Angle - (item.NumProjectiles1 - 1) / 2 * arcGap1; var startAngle2 = pkt.Angle - (item.NumProjectiles2 - 1) / 2 * arcGap2; var prjDesc1 = item.Projectiles[0]; var prjDesc2 = item.Projectiles[1]; //Assume only two for (var i = 0; i < item.NumProjectiles1; i++) { var proj = CreateProjectile(prjDesc1, item.ObjectType, (int)statsMgr.GetAttackDamage(prjDesc1.MinDamage, prjDesc1.MaxDamage), time.tickTimes, new Position { X = X, Y = Y }, (float)(startAngle1 + arcGap1 * i)); Owner.EnterWorld(proj); Owner.BroadcastPacket(new AllyShootPacket { OwnerId = Id, Angle = (float)(startAngle1 + arcGap1 * i), ContainerType = pkt.ContainerType, BulletId = 0 }, this); fames.Shoot(proj); } for (var h = 0; h < item.NumProjectiles2; h++) { var proj = CreateProjectile(prjDesc2, item.ObjectType, (int)statsMgr.GetAttackDamage(prjDesc2.MinDamage, prjDesc2.MaxDamage), time.tickTimes, new Position { X = X, Y = Y }, (float)(startAngle2 + arcGap2 * h)); Owner.EnterWorld(proj); Owner.BroadcastPacket(new AllyShootPacket { OwnerId = Id, Angle = (float)(startAngle2 + arcGap2 * h), ContainerType = pkt.ContainerType, BulletId = 1 }, this); fames.Shoot(proj); } } else { var prjDesc = item.Projectiles[0]; //Assume only one projectileId = pkt.BulletId; var prj = CreateProjectile(prjDesc, item.ObjectType, 0, pkt.Time + tickMapping, pkt.Position, pkt.Angle); Owner.EnterWorld(prj); Owner.BroadcastPacket(new AllyShootPacket { OwnerId = Id, Angle = pkt.Angle, ContainerType = pkt.ContainerType, BulletId = pkt.BulletId }, this); fames.Shoot(prj); } }
public void PlayerShoot(RealmTime time, PlayerShootPacket pkt) { Console.WriteLine("Playershoot called!"); System.Diagnostics.Debug.WriteLine(pkt.Position); // Was Commented! Item item = XmlDatas.ItemDescs[pkt.ContainerType]; if (item.ObjectType == Inventory[0].ObjectType || item.ObjectType == Inventory[1].ObjectType) { var prjDesc = item.Projectiles[0]; //Assume only one projectileId = pkt.BulletId; Projectile prj = CreateProjectile(prjDesc, item.ObjectType, 0, pkt.Time + tickMapping, pkt.Position, pkt.Angle); Owner.EnterWorld(prj); #if false Owner.BroadcastPacket(new AllyShootPacket() { OwnerId = Id, Angle = pkt.Angle, ContainerType = pkt.ContainerType, BulletId = pkt.BulletId }, this); #endif Owner.BroadcastPacket(new ShootPacket() { BulletId = pkt.BulletId, OwnerId = Id, ContainerType = ObjectType, Position = prj.BeginPos, Angle = pkt.Angle, Damage = (short)prj.Damage }, null); fames.Shoot(prj); } }