7.4 .dat support, playing an actual server might not work yet
This commit is contained in:
parent
c2ff89b2cf
commit
6b46370d1a
|
@ -48,14 +48,18 @@ end
|
||||||
|
|
||||||
function g_game.getSupportedClients()
|
function g_game.getSupportedClients()
|
||||||
return {
|
return {
|
||||||
760, 770, 772, 780, 781, 782, 790,
|
740, 760, 770, 772,
|
||||||
792, 800, 810, 811, 840, 842, 850,
|
780, 781, 782, 790, 792,
|
||||||
853, 854, 860, 861, 862, 870, 910,
|
|
||||||
940, 944, 953, 954, 960, 961, 963,
|
800, 810, 811, 840, 842, 850,
|
||||||
970, 972, 973, 980, 981, 982, 983,
|
853, 854, 860, 861, 862, 870,
|
||||||
984, 985, 986, 1001, 1002, 1010,
|
|
||||||
1020, 1021, 1022, 1031, 1034, 1035,
|
910, 940, 944, 953, 954, 960, 961,
|
||||||
1036, 1037, 1038, 1039, 1040, 1041
|
963, 970, 972, 973, 980, 981, 982,
|
||||||
|
983, 984, 985, 986,
|
||||||
|
|
||||||
|
1001, 1002, 1010, 1020, 1021, 1022, 1031,
|
||||||
|
1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,6 @@ namespace Otc
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GameFeature {
|
enum GameFeature {
|
||||||
// 1-50 defined in c++
|
|
||||||
GameProtocolChecksum = 1,
|
GameProtocolChecksum = 1,
|
||||||
GameAccountNames = 2,
|
GameAccountNames = 2,
|
||||||
GameChallengeOnLogin = 3,
|
GameChallengeOnLogin = 3,
|
||||||
|
@ -352,7 +351,7 @@ namespace Otc
|
||||||
GameMagicEffectU16 = 16,
|
GameMagicEffectU16 = 16,
|
||||||
GamePlayerMarket = 17,
|
GamePlayerMarket = 17,
|
||||||
GameSpritesU32 = 18,
|
GameSpritesU32 = 18,
|
||||||
GameChargeableItems = 19,
|
// 19 unused
|
||||||
GameOfflineTrainingTime = 20,
|
GameOfflineTrainingTime = 20,
|
||||||
GamePurseSlot = 21,
|
GamePurseSlot = 21,
|
||||||
GameFormatCreatureName = 22,
|
GameFormatCreatureName = 22,
|
||||||
|
|
|
@ -1475,36 +1475,30 @@ void Game::setProtocolVersion(int version)
|
||||||
if(isOnline())
|
if(isOnline())
|
||||||
stdext::throw_exception("Unable to change protocol version while online");
|
stdext::throw_exception("Unable to change protocol version while online");
|
||||||
|
|
||||||
if(version != 0 && (version < 760 || version > 1041))
|
if(version != 0 && (version < 740 || version > 1041))
|
||||||
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
|
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
|
||||||
|
|
||||||
m_features.reset();
|
m_features.reset();
|
||||||
enableFeature(Otc::GameFormatCreatureName);
|
enableFeature(Otc::GameFormatCreatureName);
|
||||||
|
|
||||||
if(version >= 770)
|
if(version >= 770) {
|
||||||
{
|
|
||||||
enableFeature(Otc::GameLooktypeU16);
|
enableFeature(Otc::GameLooktypeU16);
|
||||||
enableFeature(Otc::GameMessageStatements);
|
enableFeature(Otc::GameMessageStatements);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(version >= 780)
|
if(version >= 780) {
|
||||||
{
|
|
||||||
enableFeature(Otc::GamePlayerAddons);
|
enableFeature(Otc::GamePlayerAddons);
|
||||||
enableFeature(Otc::GamePlayerStamina);
|
enableFeature(Otc::GamePlayerStamina);
|
||||||
enableFeature(Otc::GameNewFluids);
|
enableFeature(Otc::GameNewFluids);
|
||||||
enableFeature(Otc::GameMessageLevel);
|
enableFeature(Otc::GameMessageLevel);
|
||||||
enableFeature(Otc::GamePlayerStateU16);
|
enableFeature(Otc::GamePlayerStateU16);
|
||||||
enableFeature(Otc::GameNewOutfitProtocol); // This might be 790 not 780
|
enableFeature(Otc::GameNewOutfitProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(version >= 790) {
|
if(version >= 790) {
|
||||||
enableFeature(Otc::GameWritableDate);
|
enableFeature(Otc::GameWritableDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(version >= 780 && version <= 854) { // 780 might not be accurate
|
|
||||||
enableFeature(Otc::GameChargeableItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(version >= 840) {
|
if(version >= 840) {
|
||||||
enableFeature(Otc::GameProtocolChecksum);
|
enableFeature(Otc::GameProtocolChecksum);
|
||||||
enableFeature(Otc::GameAccountNames);
|
enableFeature(Otc::GameAccountNames);
|
||||||
|
@ -1611,7 +1605,7 @@ void Game::setClientVersion(int version)
|
||||||
if(isOnline())
|
if(isOnline())
|
||||||
stdext::throw_exception("Unable to change client version while online");
|
stdext::throw_exception("Unable to change client version while online");
|
||||||
|
|
||||||
if(version != 0 && (version < 760 || version > 1041))
|
if(version != 0 && (version < 740 || version > 1041))
|
||||||
stdext::throw_exception(stdext::format("Client version %d not supported", version));
|
stdext::throw_exception(stdext::format("Client version %d not supported", version));
|
||||||
|
|
||||||
m_clientVersion = version;
|
m_clientVersion = version;
|
||||||
|
|
|
@ -53,14 +53,12 @@ void ThingType::serialize(const FileStreamPtr& fin)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int attr = i;
|
int attr = i;
|
||||||
if(g_game.getFeature(Otc::GameChargeableItems)) {
|
if(g_game.getProtocolVersion() >= 780) {
|
||||||
if(attr == ThingAttrChargeable)
|
if(attr == ThingAttrChargeable)
|
||||||
attr = ThingAttrWritable;
|
attr = ThingAttrWritable;
|
||||||
else if(attr >= ThingAttrWritable)
|
else if(attr >= ThingAttrWritable)
|
||||||
attr += 1;
|
attr += 1;
|
||||||
}
|
} else if(g_game.getProtocolVersion() >= 1010) {
|
||||||
|
|
||||||
if(g_game.getProtocolVersion() >= 1010) {
|
|
||||||
if(attr == ThingAttrNoMoveAnimation)
|
if(attr == ThingAttrNoMoveAnimation)
|
||||||
attr = 16;
|
attr = 16;
|
||||||
else if(attr >= ThingAttrPickupable)
|
else if(attr >= ThingAttrPickupable)
|
||||||
|
@ -140,16 +138,8 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_game.getFeature(Otc::GameChargeableItems)) {
|
|
||||||
if(attr == ThingAttrWritable) {
|
|
||||||
m_attribs.set(ThingAttrChargeable, true);
|
|
||||||
continue;
|
|
||||||
} else if(attr > ThingAttrWritable)
|
|
||||||
attr -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(g_game.getProtocolVersion() >= 1010) {
|
if(g_game.getProtocolVersion() >= 1010) {
|
||||||
/* In 10.10 all attributes from 16 and up were
|
/* In 10.10+ all attributes from 16 and up were
|
||||||
* incremented by 1 to make space for 16 as
|
* incremented by 1 to make space for 16 as
|
||||||
* "No Movement Animation" flag.
|
* "No Movement Animation" flag.
|
||||||
*/
|
*/
|
||||||
|
@ -157,12 +147,58 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
|
||||||
attr = ThingAttrNoMoveAnimation;
|
attr = ThingAttrNoMoveAnimation;
|
||||||
else if(attr > 16)
|
else if(attr > 16)
|
||||||
attr -= 1;
|
attr -= 1;
|
||||||
|
} else if(g_game.getProtocolVersion() >= 780) {
|
||||||
|
/* In 7.80-8.54 all attributes from 8 and higher were
|
||||||
|
* incremented by 1 to make space for 8 as
|
||||||
|
* "Item Charges" flag.
|
||||||
|
*/
|
||||||
|
if(attr == 8) {
|
||||||
|
m_attribs.set(ThingAttrChargeable, true);
|
||||||
|
continue;
|
||||||
|
} else if(attr > 8)
|
||||||
|
attr -= 1;
|
||||||
|
} else if(g_game.getProtocolVersion() >= 755) {
|
||||||
|
/* In 7.55-7.72 attributes 23 is "Floor Change". */
|
||||||
|
if(attr == 23)
|
||||||
|
attr = ThingAttrFloorChange;
|
||||||
|
} else if(g_game.getProtocolVersion() >= 740) {
|
||||||
|
/* 7.4-7.5 */
|
||||||
|
if(attr > 0 && attr <= 15)
|
||||||
|
attr += 1;
|
||||||
|
else if(attr == 17)
|
||||||
|
attr = ThingAttrFloorChange;
|
||||||
|
else if(attr == 18)
|
||||||
|
attr += 12;
|
||||||
|
else if(attr == 19 || attr == 22)
|
||||||
|
attr += 6;
|
||||||
|
else if(attr == 16)
|
||||||
|
attr += 5;
|
||||||
|
else if(attr == 20)
|
||||||
|
attr += 4;
|
||||||
|
else if(attr == 24)
|
||||||
|
attr += 2;
|
||||||
|
else if(attr >= 25 && attr <= 27)
|
||||||
|
attr -= 8;
|
||||||
|
else if(attr == 23)
|
||||||
|
attr -= 3;
|
||||||
|
else if(attr == 28)
|
||||||
|
attr -= 1;
|
||||||
|
|
||||||
|
if(attr == ThingAttrMultiUse)
|
||||||
|
attr = ThingAttrForceUse;
|
||||||
|
else if(attr == ThingAttrForceUse)
|
||||||
|
attr = ThingAttrMultiUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(attr) {
|
switch(attr) {
|
||||||
case ThingAttrDisplacement: {
|
case ThingAttrDisplacement: {
|
||||||
m_displacement.x = fin->getU16();
|
if(g_game.getProtocolVersion() >= 755) {
|
||||||
m_displacement.y = fin->getU16();
|
m_displacement.x = fin->getU16();
|
||||||
|
m_displacement.y = fin->getU16();
|
||||||
|
} else {
|
||||||
|
m_displacement.x = 8;
|
||||||
|
m_displacement.y = 8;
|
||||||
|
}
|
||||||
m_attribs.set(attr, true);
|
m_attribs.set(attr, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +256,10 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS
|
||||||
m_layers = fin->getU8();
|
m_layers = fin->getU8();
|
||||||
m_numPatternX = fin->getU8();
|
m_numPatternX = fin->getU8();
|
||||||
m_numPatternY = fin->getU8();
|
m_numPatternY = fin->getU8();
|
||||||
m_numPatternZ = fin->getU8();
|
if(g_game.getProtocolVersion() >= 755)
|
||||||
|
m_numPatternZ = fin->getU8();
|
||||||
|
else
|
||||||
|
m_numPatternZ = 1;
|
||||||
m_animationPhases = fin->getU8();
|
m_animationPhases = fin->getU8();
|
||||||
|
|
||||||
int totalSprites = m_size.area() * m_layers * m_numPatternX * m_numPatternY * m_numPatternZ * m_animationPhases;
|
int totalSprites = m_size.area() * m_layers * m_numPatternX * m_numPatternY * m_numPatternZ * m_animationPhases;
|
||||||
|
|
|
@ -82,7 +82,8 @@ enum ThingAttr : uint8 {
|
||||||
ThingAttrOpacity = 100,
|
ThingAttrOpacity = 100,
|
||||||
ThingAttrNotPreWalkable = 101,
|
ThingAttrNotPreWalkable = 101,
|
||||||
|
|
||||||
ThingAttrNoMoveAnimation = 253, // real value is 16, but we need to do this for backwards compatibility
|
ThingAttrFloorChange = 252,
|
||||||
|
ThingAttrNoMoveAnimation = 253, // 10.10: real value is 16, but we need to do this for backwards compatibility
|
||||||
ThingAttrChargeable = 254, // deprecated
|
ThingAttrChargeable = 254, // deprecated
|
||||||
ThingLastAttr = 255
|
ThingLastAttr = 255
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue