Merge pull request #746 from fryguy503/mount-dismount-water

Rule: DismountWater - Causes mounts to dismount when entering liquid …
This commit is contained in:
Michael Cook (mackal) 2018-07-21 13:26:11 -04:00 committed by GitHub
commit 96d146f73c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 50 deletions

View File

@ -158,6 +158,7 @@ RULE_BOOL(Character, UseOldConSystem, false) // Grant Health of Target's Target
RULE_BOOL(Character, OPClientUpdateVisualDebug, false) // Shows a pulse and forward directional particle each time the client sends its position to server
RULE_BOOL(Character, AllowCrossClassTrainers, false)
RULE_BOOL(Character, PetsUseReagents, true) //Pets use reagent on spells
RULE_BOOL(Character, DismountWater, true) // Dismount horses when entering water
RULE_CATEGORY_END()
RULE_CATEGORY(Mercs)

View File

@ -4407,8 +4407,7 @@ void Client::Handle_OP_ClientTimeStamp(const EQApplicationPacket *app)
return;
}
void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
{
void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
if (IsAIControlled())
return;
@ -4419,7 +4418,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
if (app->size != sizeof(PlayerPositionUpdateClient_Struct)
&& app->size != (sizeof(PlayerPositionUpdateClient_Struct) + 1)
) {
Log(Logs::General, Logs::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", sizeof(PlayerPositionUpdateClient_Struct), app->size);
Log(Logs::General, Logs::Error, "OP size error: OP_ClientUpdate expected:%i got:%i",
sizeof(PlayerPositionUpdateClient_Struct), app->size);
return;
}
@ -4447,8 +4447,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
/* Update the boat's position on the server, without sending an update */
boat->GMMove(ppu->x_pos, ppu->y_pos, ppu->z_pos, EQ12toFloat(ppu->heading), false);
return;
}
else return;
} else return;
}
float dist = 0;
@ -4464,29 +4463,28 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
if (m_DistanceSinceLastPositionCheck > 0.0) {
uint32 cur_time = Timer::GetCurrentTime();
if ((cur_time - m_TimeSinceLastPositionCheck) > 0) {
float speed = (m_DistanceSinceLastPositionCheck * 100) / (float)(cur_time - m_TimeSinceLastPositionCheck);
float speed =
(m_DistanceSinceLastPositionCheck * 100) / (float) (cur_time - m_TimeSinceLastPositionCheck);
int runs = GetRunspeed();
if (speed > (runs * RuleR(Zone, MQWarpDetectionDistanceFactor))) {
if (!GetGMSpeed() && (runs >= GetBaseRunspeed() || (speed > (GetBaseRunspeed() * RuleR(Zone, MQWarpDetectionDistanceFactor))))) {
if (!GetGMSpeed() && (runs >= GetBaseRunspeed() ||
(speed > (GetBaseRunspeed() * RuleR(Zone, MQWarpDetectionDistanceFactor))))) {
if (IsShadowStepExempted()) {
if (m_DistanceSinceLastPositionCheck > 800) {
CheatDetected(MQWarpShadowStep, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
else if (IsKnockBackExempted()) {
} else if (IsKnockBackExempted()) {
if (speed > 30.0f) {
CheatDetected(MQWarpKnockBack, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
else if (!IsPortExempted()) {
} else if (!IsPortExempted()) {
if (!IsMQExemptedArea(zone->GetZoneID(), ppu->x_pos, ppu->y_pos, ppu->z_pos)) {
if (speed > (runs * 2 * RuleR(Zone, MQWarpDetectionDistanceFactor))) {
m_TimeSinceLastPositionCheck = cur_time;
m_DistanceSinceLastPositionCheck = 0.0f;
CheatDetected(MQWarp, ppu->x_pos, ppu->y_pos, ppu->z_pos);
//Death(this, 10000000, SPELL_UNKNOWN, _1H_BLUNT);
}
else {
} else {
CheatDetected(MQWarpLight, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
@ -4500,43 +4498,39 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
m_DistanceSinceLastPositionCheck = 0.0f;
m_CheatDetectMoved = false;
}
}
else {
} else {
m_TimeSinceLastPositionCheck = Timer::GetCurrentTime();
m_CheatDetectMoved = false;
}
}
else {
} else {
m_DistanceSinceLastPositionCheck += dist;
m_CheatDetectMoved = true;
if (m_TimeSinceLastPositionCheck == 0) {
m_TimeSinceLastPositionCheck = Timer::GetCurrentTime();
}
else {
} else {
uint32 cur_time = Timer::GetCurrentTime();
if ((cur_time - m_TimeSinceLastPositionCheck) > 2500) {
float speed = (m_DistanceSinceLastPositionCheck * 100) / (float)(cur_time - m_TimeSinceLastPositionCheck);
float speed =
(m_DistanceSinceLastPositionCheck * 100) / (float) (cur_time - m_TimeSinceLastPositionCheck);
int runs = GetRunspeed();
if (speed > (runs * RuleR(Zone, MQWarpDetectionDistanceFactor))) {
if (!GetGMSpeed() && (runs >= GetBaseRunspeed() || (speed > (GetBaseRunspeed() * RuleR(Zone, MQWarpDetectionDistanceFactor))))) {
if (!GetGMSpeed() && (runs >= GetBaseRunspeed() ||
(speed > (GetBaseRunspeed() * RuleR(Zone, MQWarpDetectionDistanceFactor))))) {
if (IsShadowStepExempted()) {
if (m_DistanceSinceLastPositionCheck > 800) {
CheatDetected(MQWarpShadowStep, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
else if (IsKnockBackExempted()) {
} else if (IsKnockBackExempted()) {
if (speed > 30.0f) {
CheatDetected(MQWarpKnockBack, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
else if (!IsPortExempted()) {
} else if (!IsPortExempted()) {
if (!IsMQExemptedArea(zone->GetZoneID(), ppu->x_pos, ppu->y_pos, ppu->z_pos)) {
if (speed > (runs * 2 * RuleR(Zone, MQWarpDetectionDistanceFactor))) {
m_TimeSinceLastPositionCheck = cur_time;
m_DistanceSinceLastPositionCheck = 0.0f;
CheatDetected(MQWarp, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
else {
} else {
CheatDetected(MQWarpLight, ppu->x_pos, ppu->y_pos, ppu->z_pos);
}
}
@ -4620,7 +4614,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
is_client_moving = (ppu->y_pos == m_Position.y && ppu->x_pos == m_Position.x) ? false : true;
if (is_client_moving) {
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is moving - scan timer is: %u", client_scan_npc_aggro_timer.GetDuration());
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is moving - scan timer is: %u",
client_scan_npc_aggro_timer.GetDuration());
if (client_scan_npc_aggro_timer.GetDuration() > 1000) {
npc_close_scan_timer.Disable();
@ -4630,9 +4625,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
client_scan_npc_aggro_timer.Start(500);
}
}
else {
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is NOT moving - scan timer is: %u", client_scan_npc_aggro_timer.GetDuration());
} else {
Log(Logs::Detail, Logs::Normal, "ClientUpdate: Client is NOT moving - scan timer is: %u",
client_scan_npc_aggro_timer.GetDuration());
if (client_scan_npc_aggro_timer.GetDuration() < 1000) {
npc_close_scan_timer.Disable();
@ -4653,7 +4648,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
/* Visual Debugging */
if (RuleB(Character, OPClientUpdateVisualDebug)) {
Log(Logs::General, Logs::Debug, "ClientUpdate: ppu x: %f y: %f z: %f h: %u", ppu->x_pos, ppu->y_pos, ppu->z_pos, ppu->heading);
Log(Logs::General, Logs::Debug, "ClientUpdate: ppu x: %f y: %f z: %f h: %u", ppu->x_pos, ppu->y_pos, ppu->z_pos,
ppu->heading);
this->SendAppearanceEffect(78, 0, 0, 0, 0);
this->SendAppearanceEffect(41, 0, 0, 0, 0);
}
@ -4672,8 +4668,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
if (gm_hide_me) {
entity_list.QueueClientsStatus(this, outapp, true, Admin(), 250);
}
else {
} else {
entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, ClientPositionUpdates), nullptr, true);
}
@ -4684,8 +4679,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
if (raid) {
raid->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1));
}
else if (group) {
} else if (group) {
group->QueueClients(this, outapp, true, true, (RuleI(Range, ClientPositionUpdates) * -1));
}
@ -4693,11 +4687,17 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
}
if (zone->watermap) {
if (zone->watermap->InLiquid(glm::vec3(m_Position)))
if (zone->watermap->InLiquid(glm::vec3(m_Position))) {
CheckIncreaseSkill(EQEmu::skills::SkillSwimming, nullptr, -17);
// Dismount horses when entering water
if (GetHorseId() && RuleB(Character, DismountWater)) {
SetHorseId(0);
BuffFadeByEffect(SE_SummonHorse);
}
}
CheckRegionTypeChanges();
}
return;
}