void
NetGameClient::DoObjDamage(NetMsg* msg)
{
	if (!msg) return;

	NetObjDamage obj_damage;
	obj_damage.Unpack(msg->Data());

	Ship* ship = FindShipByObjID(obj_damage.GetObjID());
	if (ship) {
		Sim*        sim         = Sim::GetSim();
		Shot*       shot        = FindShotByObjID(obj_damage.GetShotID());
		const Ship* owner       = 0;
		const char* owner_name  = "[NET]";

		ship->InflictNetDamage(obj_damage.GetDamage(), shot);

		if (shot && sim) {
			if (shot->Owner()) {
				owner       = shot->Owner();
				owner_name  = owner->Name();
			}

			if (shot->IsMissile()) {
				SimRegion*  region = ship->GetRegion();
				float       scale  = ship->Design()->explosion_scale;

				if (scale <= 0)
				scale = ship->Design()->scale;

				if (owner) {
					const ShipDesign* owner_design = owner->Design();
					if (owner_design && owner_design->scale < scale)
					scale = (float) owner_design->scale;
				}

				sim->CreateExplosion(shot->Location(), Point(), Explosion::SHOT_BLAST, 20.0f * scale, scale, region);
			}

			if (!shot->IsBeam()) {
				if (owner) {
					ShipStats* stats = ShipStats::Find(owner_name);

					if (stats) {
						if (shot->IsPrimary())
						stats->AddGunHit();
						else if (shot->Damage() > 0)
						stats->AddMissileHit();
					}
				}

				shot->Destroy();
			}
		}
	}
}
bool
NetPlayer::DoObjHyper(NetObjHyper* obj_hyper)
{
	if (ship && obj_hyper) {
		Sim*        sim       = Sim::GetSim();
		SimRegion*  rgn       = sim->FindRegion(obj_hyper->GetRegion());
		DWORD       fc1_id    = obj_hyper->GetFarcaster1();
		DWORD       fc2_id    = obj_hyper->GetFarcaster2();
		Ship*       fc1       = 0;
		Ship*       fc2       = 0;
		int         trans     = obj_hyper->GetTransitionType();

		if (ship->GetRegion() == rgn) {
			::Print("NetPlayer::DoObjHyper ship: '%s' rgn: '%s' trans: %d (IGNORED)\n\n",
			ship->Name(), obj_hyper->GetRegion().data(), trans);

			return false;
		}

		::Print("NetPlayer::DoObjHyper ship: '%s' rgn: '%s' trans: %d\n\n",
		ship->Name(), obj_hyper->GetRegion().data(), trans);

		// orbital transition?
		if (trans == Ship::TRANSITION_DROP_ORBIT) {
			ship->SetTransition(1.0f, Ship::TRANSITION_DROP_ORBIT, ship->Location());
			ship->CompleteTransition();
		}

		else if (trans == Ship::TRANSITION_MAKE_ORBIT) {
			ship->SetTransition(1.0f, Ship::TRANSITION_MAKE_ORBIT, ship->Location());
			ship->CompleteTransition();
		}

		else {
			if (fc1_id)
			fc1 = sim->FindShipByObjID(fc1_id);

			if (fc2_id)
			fc2 = sim->FindShipByObjID(fc2_id);

			sim->CreateExplosion(ship->Location(), Point(0,0,0), 
			Explosion::QUANTUM_FLASH, 1.0f, 0, ship->GetRegion());

			sim->RequestHyperJump(ship, rgn, obj_hyper->GetLocation(), trans, fc1, fc2);

			ShipStats* stats = ShipStats::Find(ship->Name());
			stats->AddEvent(SimEvent::QUANTUM_JUMP, rgn->Name());
		}

		return true;
	}

	return false;
}