浏览代码

Fix WS_PerformCameraShakeMsg

Classic/DoF client use only a single float, then later a direction was added.  Not clear what version exactly, however struct will function despite the extra int8.
image 4 年之前
父节点
当前提交
c2ed1715e8
共有 2 个文件被更改,包括 17 次插入7 次删除
  1. 12 4
      EQ2/source/WorldServer/LuaFunctions.cpp
  2. 5 3
      server/WorldStructs.xml

+ 12 - 4
EQ2/source/WorldServer/LuaFunctions.cpp

@@ -177,12 +177,20 @@ int	EQ2Emu_lua_PerformCameraShake(lua_State* state) {
 		lua_interface->LogError("LUA PerformCameraShake command error: could not find client");
 		return 0;
 	}
-	int16 value1 = lua_interface->GetInt16Value(state, 2);
-	int16 value2 = lua_interface->GetInt16Value(state, 3);
+	float intensity = lua_interface->GetFloatValue(state, 2);
+	int8 direction = lua_interface->GetInt8Value(state, 3);
 	PacketStruct* packet = configReader.getStruct("WS_PerformCameraShakeMsg", client->GetVersion());
 	if (packet) {
-		packet->setDataByName("unknown1", value1);
-		packet->setDataByName("unknown2", value2);
+		/* Client Intensity Logic (does not restrict service side, but expect .01 - 1.0 range)
+			v1 = *(float *)(a1 + 4);
+				if ( v1 > 0.0 )
+				 v2 = fminf(v1, 1.0);
+			    else
+				 v2 = 0.1;
+		*/
+		packet->setDataByName("intensity", intensity);
+		if ( client->GetVersion() > 546 )
+			packet->setDataByName("direction", direction);
 		client->QueuePacket(packet->serialize());
 		safe_delete(packet);
 	}

+ 5 - 3
server/WorldStructs.xml

@@ -18763,9 +18763,11 @@ to zero and treated like placeholders." />
 <Data ElementName="body_age" Type="float" />
 </Struct>
 <Struct Name="WS_PerformCameraShakeMsg" ClientVersion="1" OpcodeName="OP_PerformCameraShakeMsg">
-	<Data ElementName="unknown1" Type="int16" />
-	<Data ElementName="unknown2" Type="int16" />
-	<Data ElementName="unknown3" Type="int8" />
+	<Data ElementName="intensity" Type="float" /> <!-- client supported range is 0.01 - 1.0 -->
+</Struct>
+<Struct Name="WS_PerformCameraShakeMsg" ClientVersion="547" OpcodeName="OP_PerformCameraShakeMsg">
+	<Data ElementName="intensity" Type="float" /> <!-- client supported range is 0.01 - 1.0 -->
+	<Data ElementName="direction" Type="int8" /> <!-- 0 = up/down camera shake, 1 = all around shake of camera -->
 </Struct>
 <Struct Name="WS_CommitAATemplate" ClientVersion="1" OpcodeName="OP_ClientCmdMsg" OpcodeType="OP_CommitAATemplate" >
 <Data ElementName="unknown1" Type="int32" Size="3"/>