View Single Post
  #1  
Old 01-20-2015, 02:54 PM
iluvseq
Sarnak
 
Join Date: Aug 2009
Location: Somewhere
Posts: 53
Default Patch: Only check for swimming skill ups if client is moving

The current code checks for swimming skill increases every ClientUpdate packet even if the character is not moving around. On live, a client has to actually be moving through the water to get a skill increase.

This patch fixes that (and also gives a bigger modifier to the check, so that swimming skill ups aren't as frequent).

Of course, this probably only matters for servers who have commented out SetSkill(SkillSwimming, 100); which should probably be modified to be a server rule rather than hard-coded...

Code:
diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp
index 46c00bf..fc8b6c6 100644
--- a/zone/client_packet.cpp
+++ b/zone/client_packet.cpp
@@ -4556,7 +4556,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
  }

  // Break Hide if moving without sneaking and set rewind timer if moved
+ bool moving = false;
  if(ppu->y_pos != m_Position.m_Y || ppu->x_pos != m_Position.m_X){
+   moving = true;
    if((hidden || improved_hidden) && !sneaking){
      hidden = false;
      improved_hidden = false;
@@ -4595,8 +4597,8 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
    safe_delete(outapp);
  }

- if(zone->watermap && zone->watermap->InLiquid(m_Position))
-        CheckIncreaseSkill(SkillSwimming, nullptr, -17);
+ if(zone->watermap && zone->watermap->InLiquid(m_Position) && moving)
+        CheckIncreaseSkill(SkillSwimming, nullptr, -25);

  return;
 }
Reply With Quote