some protocol 870 support
This commit is contained in:
		
							parent
							
								
									c0611bfe2a
								
							
						
					
					
						commit
						4bac617fd9
					
				
							
								
								
									
										2
									
								
								BUGS
								
								
								
								
							
							
						
						
									
										2
									
								
								BUGS
								
								
								
								
							|  | @ -5,3 +5,5 @@ some animated hits are displayed as 2 hits instead of one | |||
| skulls is rendering outside map bounds | ||||
| paste on x11 platform does not work correctly when doing ctrl+c in google chrome | ||||
| party options does not work when relogging inside a party | ||||
| 
 | ||||
| when the player gets disconnected it isn't removed from the map | ||||
|  |  | |||
|  | @ -55,13 +55,13 @@ end | |||
| function onGameLoginError(message) | ||||
|   CharacterList.destroyLoadBox() | ||||
|   local errorBox = displayErrorBox("Login Error", "Login error: " .. message) | ||||
|   errorBox.onOk = CharacterList.show | ||||
|   errorBox.onOk = CharacterList.showAgain | ||||
| end | ||||
| 
 | ||||
| function onGameConnectionError(message) | ||||
|   CharacterList.destroyLoadBox() | ||||
|   local errorBox = displayErrorBox("Login Error", "Connection error: " .. message) | ||||
|   errorBox.onOk = CharacterList.show | ||||
|   errorBox.onOk = CharacterList.showAgain | ||||
| end | ||||
| 
 | ||||
| -- public functions | ||||
|  | @ -73,14 +73,14 @@ function CharacterList.init() | |||
|   connect(g_game, { onLoginError = onGameLoginError }) | ||||
|   connect(g_game, { onConnectionError = onGameConnectionError }) | ||||
|   connect(g_game, { onGameStart = CharacterList.destroyLoadBox }) | ||||
|   connect(g_game, { onGameEnd = CharacterList.show }) | ||||
|   connect(g_game, { onGameEnd = CharacterList.showAgain }) | ||||
| end | ||||
| 
 | ||||
| function CharacterList.terminate() | ||||
|   disconnect(g_game, { onLoginError = onGameLoginError }) | ||||
|   disconnect(g_game, { onConnectionError = onGameConnectionError }) | ||||
|   disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox }) | ||||
|   disconnect(g_game, { onGameEnd = CharacterList.show }) | ||||
|   disconnect(g_game, { onGameEnd = CharacterList.showAgain }) | ||||
|   characterList = nil | ||||
|   charactersWindow:destroy() | ||||
|   charactersWindow = nil | ||||
|  | @ -144,6 +144,12 @@ function CharacterList.show() | |||
|   end | ||||
| end | ||||
| 
 | ||||
| function CharacterList.showAgain() | ||||
|   if characterList:hasChildren() then | ||||
|     CharacterList.show() | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| function CharacterList.isVisible() | ||||
|   if charactersWindow and charactersWindow:isVisible() then | ||||
|     return true | ||||
|  |  | |||
|  | @ -142,7 +142,6 @@ void Game::processDeath(int penality) | |||
| 
 | ||||
| void Game::processPing() | ||||
| { | ||||
|     m_protocolGame->sendPingResponse(); | ||||
|     g_lua.callGlobalField("g_game", "onPing"); | ||||
| } | ||||
| 
 | ||||
|  | @ -315,6 +314,10 @@ void Game::processWalkCancel(Otc::Direction direction) | |||
| 
 | ||||
| void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldHost, int worldPort, const std::string& characterName) | ||||
| { | ||||
|     if(m_protocolGame || isOnline()) { | ||||
|         logTraceError("unable to login into a world while already online or logging"); | ||||
|         return; | ||||
|     } | ||||
|     m_protocolGame = ProtocolGamePtr(new ProtocolGame); | ||||
|     m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName); | ||||
| } | ||||
|  | @ -333,7 +336,7 @@ void Game::forceLogout() | |||
|     if(!isOnline()) | ||||
|         return; | ||||
| 
 | ||||
|     m_protocolGame->sendLogout(); | ||||
|     //m_protocolGame->sendLogout();
 | ||||
|     processDisconnect(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ | |||
| 
 | ||||
| #include <otclient/global.h> | ||||
| 
 | ||||
| #if PROTOCOL < 860 || PROTOCOL > 862 | ||||
| #if PROTOCOL != 860 && PROTOCOL != 870 && PROTOCOL != 862 && PROTOCOL != 870 | ||||
| #error "the supplied protocol version is not supported" | ||||
| #endif | ||||
| 
 | ||||
|  | @ -47,10 +47,10 @@ namespace Proto { | |||
|     constexpr int ClientVersion = PROTOCOL; | ||||
|     constexpr int PicSignature = 0x4E119CBF; | ||||
| 
 | ||||
| #if PROTOCOL==860 | ||||
|     constexpr int NumViolationReasons = 20; | ||||
| #elif PROTOCOL==861 || PROTOCOL==862 | ||||
| #if PROTOCOL>=861 | ||||
|     constexpr int NumViolationReasons = 19; | ||||
| #elif PROTOCOL==860 | ||||
|     constexpr int NumViolationReasons = 20; | ||||
| #endif | ||||
| 
 | ||||
|     enum OsTypes { | ||||
|  | @ -118,8 +118,10 @@ namespace Proto { | |||
|         GameServerPlayerSkills = 161, | ||||
|         GameServerPlayerState = 162, | ||||
|         GameServerClearTarget = 163, | ||||
| #if PROTOCOL>=870 | ||||
|         GameServerSpellDelay = 164, | ||||
|         GameServerSpellGroupDelay = 165, | ||||
| #endif | ||||
|         GameServerTalk = 170, | ||||
|         GameServerChannels = 171, | ||||
|         GameServerOpenChannel = 172, | ||||
|  | @ -209,7 +211,9 @@ namespace Proto { | |||
|         ClientRefreshContainer = 202, | ||||
|         ClientRequestOutfit = 210, | ||||
|         ClientChangeOutfit = 211, | ||||
|         //ClientMount = 212,
 | ||||
| #if PROTOCOL>=870 | ||||
|         ClientMount = 212, | ||||
| #endif | ||||
|         ClientAddVip = 220, | ||||
|         ClientRemoveVip = 221, | ||||
|         //ClientBugReport = 230,
 | ||||
|  | @ -221,7 +225,7 @@ namespace Proto { | |||
|     }; | ||||
| 
 | ||||
|     enum ServerSpeakType { | ||||
| #if PROTOCOL==861 || PROTOCOL==862 | ||||
| #if PROTOCOL>=861 | ||||
|         ServerSpeakSay = 1, | ||||
|         ServerSpeakWhisper, | ||||
|         ServerSpeakYell, | ||||
|  | @ -265,7 +269,7 @@ namespace Proto { | |||
|     }; | ||||
| 
 | ||||
|     enum MessageTypes { | ||||
| #if PROTOCOL==862 || PROTOCOL==861 | ||||
| #if PROTOCOL>=862 | ||||
|         MessageConsoleOrange = 13, | ||||
|         MessageConsoleOrange2, | ||||
|         MessageWarning, | ||||
|  |  | |||
|  | @ -165,7 +165,12 @@ void ProtocolGame::parseMessage(InputMessage& msg) | |||
|             case Proto::GameServerCreatureParty: | ||||
|                 parseCreatureShields(msg); | ||||
|                 break; | ||||
|             // case Proto::GameServerCreatureUnpass
 | ||||
| #if PROTOCOL>=870 | ||||
|             case Proto::GameServerCreatureUnpass: | ||||
|                 msg.getU32(); // creature id
 | ||||
|                 msg.getU8(); // unpassable boolean
 | ||||
|                 break; | ||||
| #endif | ||||
|             case Proto::GameServerEditText: | ||||
|                 parseEditText(msg); | ||||
|                 break; | ||||
|  | @ -184,8 +189,14 @@ void ProtocolGame::parseMessage(InputMessage& msg) | |||
|             case Proto::GameServerClearTarget: | ||||
|                 parsePlayerCancelAttack(msg); | ||||
|                 break; | ||||
|             //case Proto::GameServerSpellDelay:
 | ||||
|             //case Proto::GameServerSpellGroupDelay:
 | ||||
| #if PROTOCOL>=870 | ||||
|             case Proto::GameServerSpellDelay: | ||||
|             case Proto::GameServerSpellGroupDelay: | ||||
|                 msg.getU16(); // spell id
 | ||||
|                 msg.getU16(); // cooldown
 | ||||
|                 msg.getU8(); // unknown
 | ||||
|                 break; | ||||
| #endif | ||||
|             case Proto::GameServerTalk: | ||||
|                 parseCreatureSpeak(msg); | ||||
|                 break; | ||||
|  | @ -309,12 +320,13 @@ void ProtocolGame::parseLoginWait(InputMessage& msg) | |||
| void ProtocolGame::parsePing(InputMessage&) | ||||
| { | ||||
|     g_game.processPing(); | ||||
|     sendPingResponse(); | ||||
| } | ||||
| 
 | ||||
| void ProtocolGame::parseDeath(InputMessage& msg) | ||||
| { | ||||
|     int penality = 100; | ||||
| #if PROTOCOL==862 | ||||
| #if PROTOCOL>=862 | ||||
|     penality = msg.getU8(); | ||||
| #endif | ||||
|     g_game.processDeath(penality); | ||||
|  | @ -721,7 +733,11 @@ void ProtocolGame::parsePlayerStats(InputMessage& msg) | |||
|     double health = msg.getU16(); | ||||
|     double maxHealth = msg.getU16(); | ||||
|     double freeCapacity = msg.getU32() / 100.0; | ||||
| #if PROTOCOL >= 870 | ||||
|     double experience = msg.getU64(); | ||||
| #else | ||||
|     double experience = msg.getU32(); | ||||
| #endif | ||||
|     double level = msg.getU16(); | ||||
|     double levelPercent = msg.getU8(); | ||||
|     double mana = msg.getU16(); | ||||
|  | @ -917,6 +933,14 @@ void ProtocolGame::parseOpenOutfitWindow(InputMessage& msg) | |||
|         outfitList.push_back(std::make_tuple(outfitId, outfitName, outfitAddons)); | ||||
|     } | ||||
| 
 | ||||
| #if PROTOCOL>=870 | ||||
|     int mountCount = msg.getU8(); | ||||
|     for(int i=0;i<mountCount;++i) { | ||||
|         msg.getU16(); // mount type
 | ||||
|         msg.getString(); // mount name
 | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     g_game.processOpenOutfitWindow(currentOutfit, outfitList); | ||||
| } | ||||
| 
 | ||||
|  | @ -1062,6 +1086,9 @@ Outfit ProtocolGame::internalGetOutfit(InputMessage& msg) | |||
|         int legs = msg.getU8(); | ||||
|         int feet = msg.getU8(); | ||||
|         int addons = msg.getU8(); | ||||
| #if PROTOCOL>=870 | ||||
|         msg.getU16(); // mount
 | ||||
| #endif | ||||
| 
 | ||||
|         outfit.setId(id); | ||||
|         outfit.setHead(head); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Eduardo Bart
						Eduardo Bart