Quote:
Originally Posted by Derision
I never tested PVP fear, but I've looked at the code a bit more. There is some
code to disallow client-to-client fear, however with that commented out, you get
a message saying your are feared, but you actually aren't.
I'm speculating that that the server needs to send an OP_Fear packet to the
client to tell it it's feared, however I don't see such an opcode anywhere in
the source or .conf files.
Maybe if someone had a packet trace of a player being feared from back when the 6.2 client or Titanium where the live clients, that may help, or maybe it is not an opcode issue at all.
|
SOD has player fear, the packet is an apperancepacket that toggles "player loses control" on, but this is for an old client version, so I don't know if its applicable.
Code:
void LoseControl(bool interrupt_spells) { if (interrupt_spells) { InterruptSpell(); StopSong(); } Message_StringID(0,1461); SendAppearancePacket(14, 102); }
void RegainControl(bool interrupt_spells) { if (interrupt_spells) { InterruptSpell(); StopSong(); } SendAppearancePacket(14, 100); }
We've disabled the actual fear movement for the moment because its a lot more troublesome to keep players from going through walls than it is to do npcs, but if anyone wants to toy with it, it basically uses the same code with this movement function:
Code:
bool Client::FearMovement(float x, float y, float z)
{
if (IsRooted() || Casting())
{
SetRunAnimSpeed(0);
return true;
}
float nx = this->x_pos;
float ny = this->y_pos;
float nz = this->z_pos;
float vx, vy, vz;
float vb;
float speed = 0.35f;
float speed_mod = ((float)(speed*spellbonuses->movementspeed))/100.0f;
speed += speed_mod;
if (x_pos == x && y_pos == y)
{
SetRunAnimSpeed(0);
return false;
}
bool ret = true;
SetHeading(CalculateHeadingToTarget(x, y) * 8);
// --------------------------------------------------------------------------
// 1: get Vector AB (Vab = B-A)
// --------------------------------------------------------------------------
vx = x - nx;
vy = y - ny;
vz = z - nz;
speed *= 30; //First we recalc into clientside units. 1.2 = 36, etc.
SetRunAnimSpeed(speed);
//Now we recalc it into units per second moved.
speed *= 0.76;
//Divide by ten to account for movement happening every 0.1
speed /= 10;
// --------------------------------------------------------------------------
// 2: get unit vector
// --------------------------------------------------------------------------
vb = speed / sqrt (vx*vx + vy*vy);
if (vb >= 0.5) //Stop before we've reached the point in case it's too close to a wall
{
/*
x_pos = x;
y_pos = y;
if (zone->map == 0)
{
z_pos = z;
}
else
{
NodeRef pnode = zone->map->SeekNode( zone->map->GetRoot(), x_pos, y_pos );
if (pnode == NODE_NONE)
{
z_pos = z;
}
else
{
VERTEX me;
me.x = x_pos;
me.y = y_pos;
me.z = z + GetHeight();
VERTEX hit;
FACE *onhit;
float best_z = zone->map->FindBestZ(pnode, me, &hit, &onhit);
if (best_z != -999999 && fdiff(best_z,GetZ())<=12.0)
{
z_pos = best_z + 1;
}
else
{
z_pos = z;
}
}
}
*/
fear_walkto_x = x_pos;
fear_walkto_y = y_pos;
fear_walkto_z = z_pos;
ret = false;
}
else
{
// --------------------------------------------------------------------------
// 3: destination = start plus movementvector (unitvektor*speed)
// --------------------------------------------------------------------------
x_pos = x_pos + vx*vb;
y_pos = y_pos + vy*vb;
if (zone->map == 0)
{
z_pos = z_pos + vz*vb;
}
else
{
NodeRef pnode = zone->map->SeekNode( zone->map->GetRoot(), x_pos, y_pos );
if (pnode == NODE_NONE)
{
z_pos = z_pos + vz*vb;
}
else
{
VERTEX me;
me.x = x_pos;
me.y = y_pos;
me.z = z_pos + vz*vb + GetHeight();
VERTEX hit;
FACE *onhit;
float best_z = zone->map->FindBestZ(pnode, me, &hit, &onhit);
if (best_z != -999999 && fdiff(best_z,GetZ())<=12.0)
{
z_pos = best_z + 1;
}
else
{
z_pos = z_pos + vz*vb;
}
}
}
}
APPLAYER* app = new APPLAYER(OP_MobUpdate, sizeof(SpawnPositionUpdate_Struct));
SpawnPositionUpdate_Struct* spu = (SpawnPositionUpdate_Struct*)app->pBuffer;
MakeSpawnUpdate(spu);
app->priority = 6;
entity_list.QueueClients(this,app);
safe_delete(app);
return ret;
}
No guarantees on whether any of those packets will work with newer versions than 0.5.3