|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
01-20-2015, 02:54 PM
|
Sarnak
|
|
Join Date: Aug 2009
Location: Somewhere
Posts: 53
|
|
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;
}
|
|
|
|
|
|
|
01-21-2015, 11:58 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Maybe I am mistaken, but I seem to recall that on Live you did not necessarily have to be moving. I vaguely recall swimming into a wall and setting something on my up arrow button to make it continue to try to swim in a direction even though it was stuck up against a wall. I would just leave that overnight and be maxed in swimming the next day or whatever.
Maybe they have since corrected that on Live, or maybe the client sends position updates with different locations due to the attempts to move in that direction (which then get auto-corrected back to the original position). Or, it could be that I did that only on Emu, but I kinda doubt that. If it only checks for being in water on Emu, I don't know why I would have had to swim up against a wall to do it.
Last I checked, I believe Frogloks automatically started with 100 swimming, and they may have made all classes start with 100 as well since then (though I would have to check on that). They tend to dumb things down as the years pass.
Just trying to give a bit of feedback in case we want to emulate live exactly (which is normally the case). I don't see a reason not to have this check in place.
|
|
|
|
01-21-2015, 01:34 PM
|
|
Developer
|
|
Join Date: Nov 2012
Location: Halas
Posts: 355
|
|
- Swim to the middle of the ocean.
- Sticky tape UP and LEFT keys down.
- Profit.
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?
|
01-21-2015, 06:34 PM
|
Sarnak
|
|
Join Date: Aug 2009
Location: Somewhere
Posts: 53
|
|
That is true, on Live you didn't have to be 'moving' as in X/Y changing, but you did have to have a movement key pressed. Currently in EQEMU it just checks if you are in water and that's it. It also sets swimming to 100 at character creation, but I commented that out for my server
I'll test if this patch works for swimming against a wall...
|
01-21-2015, 08:15 PM
|
Demi-God
|
|
Join Date: Apr 2008
Location: MA
Posts: 1,164
|
|
Quote:
Originally Posted by iluvseq
It also sets swimming to 100 at character creation
|
It used to not skill up at all.
Last edited by demonstar55; 01-22-2015 at 01:50 PM..
|
01-22-2015, 09:29 AM
|
Sarnak
|
|
Join Date: Aug 2009
Location: Somewhere
Posts: 53
|
|
Actually, there appears to be a problem with wtr maps in the current codebase (from the merge a couple of days ago). I'm still tracing down the issue, but since I did a pull on the 20th, zone->watermap->InLiquid() always returns false.
|
|
|
|
01-22-2015, 11:27 AM
|
Sarnak
|
|
Join Date: Aug 2009
Location: Somewhere
Posts: 53
|
|
Ok, figured it out. The current codebase has a bug with watermap v1 files. Basically all the calls to InWater() etc were converted to pass an xyz_location struct instead of y,x,z directly, but those function signatures were never added to water_map_v1. So if a user loads v1 watermaps (which are the only kind I can find anywhere anyway) InWater() and related calls always return false due to the virtual signature in water_map.h.
This patch fixes that, by adding xyz_location based versions to water_map_v1. I left in the legacy (y,x,z) signatures as well, even though they are never called, just in case there's some code somewhere that depends on it that I'm missing.
Code:
diff --git a/zone/water_map_v1.cpp b/zone/water_map_v1.cpp
index 4f3797a..2fd63d3 100644
--- a/zone/water_map_v1.cpp
+++ b/zone/water_map_v1.cpp
@@ -14,6 +14,26 @@ WaterRegionType WaterMapV1::ReturnRegionType(float y, float x, float z) const {
return BSPReturnRegionType(1, y, x, z);
}
+WaterRegionType WaterMapV1::ReturnRegionType(const xyz_location& location) const {
+ return BSPReturnRegionType(1, location.m_X, location.m_Y, location.m_Z);
+}
+
+bool WaterMapV1::InWater(const xyz_location& location) const {
+ return ReturnRegionType(location) == RegionTypeWater;
+}
+
+bool WaterMapV1::InVWater(const xyz_location& location) const {
+ return ReturnRegionType(location) == RegionTypeVWater;
+}
+
+bool WaterMapV1::InLava(const xyz_location& location) const {
+ return ReturnRegionType(location) == RegionTypeLava;
+}
+
+bool WaterMapV1::InLiquid(const xyz_location& location) const {
+ return InWater(location) || InLava(location);
+}
+
bool WaterMapV1::InWater(float y, float x, float z) const {
return ReturnRegionType(y, x, z) == RegionTypeWater;
}
diff --git a/zone/water_map_v1.h b/zone/water_map_v1.h
index dfac5f9..061b475 100644
--- a/zone/water_map_v1.h
+++ b/zone/water_map_v1.h
@@ -24,6 +24,11 @@ public:
virtual bool InVWater(float y, float x, float z) const;
virtual bool InLava(float y, float x, float z) const;
virtual bool InLiquid(float y, float x, float z) const;
+ virtual WaterRegionType ReturnRegionType(const xyz_location& location) const;
+ virtual bool InWater(const xyz_location& location) const;
+ virtual bool InVWater(const xyz_location& location) const;
+ virtual bool InLava(const xyz_location& location) const;
+ virtual bool InLiquid(const xyz_location& location) const;
protected:
virtual bool Load(FILE *fp);
Trevius: You are correct, if a user finds a spot to 'skill up' swimming that doesn't result in any actual movement, the skillup patch I submitted above will not kick in. They'll have to either use Drajor's trick or go against a zone wall with a slightly upper angle so that they are constantly moving a little. Seems legit and live-like to me
Sorry this patch isn't a git 'pull' request, but I'm still learning git and don't quite know how to do that yet...
|
|
|
|
01-23-2015, 06:12 AM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
Water maps are also checking x & y coords backwards which is not very good.
|
01-24-2015, 04:24 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
Water maps should be fixed on master now.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 11:46 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|