talk funktion
This commit is contained in:
		
							parent
							
								
									4b8a0bab77
								
							
						
					
					
						commit
						f887d39d7e
					
				|  | @ -54,6 +54,7 @@ public: | |||
|     void sendTurnEast(); | ||||
|     void sendTurnSouth(); | ||||
|     void sendTurnWest(); | ||||
|     void sendTalk(int channelType, const std::string& message, int channelId = 0, const std::string& receiver = ""); | ||||
|     void sendAddVip(const std::string& name); | ||||
|     void sendRemoveVip(int id); | ||||
| 
 | ||||
|  |  | |||
|  | @ -158,6 +158,35 @@ void ProtocolGame::sendTurnWest() | |||
|     send(oMsg); | ||||
| } | ||||
| 
 | ||||
| void ProtocolGame::sendTalk(int channelType, const std::string& message, int channelId, const std::string& receiver) | ||||
| { | ||||
|     // Game.getProtocolGame():sendTalk(1, "lalala", 0, "ignore")
 | ||||
|     // TODO: MAKE SURE IT WAS AN USER EVENT AND NOT DIRECTLY FROM SCRIPT.
 | ||||
| 
 | ||||
|     if(message.length() > 255 && message.length() <= 0) | ||||
|         return; | ||||
| 
 | ||||
|     OutputMessage oMsg; | ||||
|     oMsg.addU8(Otc::ClientTalk); | ||||
| 
 | ||||
|     assert(channelType >= 0); | ||||
|     oMsg.addU8(channelType); | ||||
| 
 | ||||
|     switch(channelType) { | ||||
|     case Otc::SpeakPrivate: | ||||
|     case Otc::SpeakPrivateRed: | ||||
|         oMsg.addString(receiver); | ||||
|         break; | ||||
|     case Otc::SpeakChannelYellow: | ||||
|     case Otc::SpeakChannelRed: | ||||
|         oMsg.addU16(channelId); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     oMsg.addString(message); | ||||
|     send(oMsg); | ||||
| } | ||||
| 
 | ||||
| void ProtocolGame::sendAddVip(const std::string& name) | ||||
| { | ||||
|     OutputMessage oMsg; | ||||
|  |  | |||
|  | @ -49,6 +49,7 @@ void OTClient::registerLuaFunctions() | |||
|     g_lua.bindClassMemberFunction("cancelLogin", &ProtocolLogin::cancelLogin); | ||||
| 
 | ||||
|     g_lua.registerClass<ProtocolGame, Protocol>(); | ||||
|     g_lua.bindClassMemberFunction("sendTalk", &ProtocolGame::sendTalk); | ||||
| 
 | ||||
|     g_lua.registerClass<Thing>(); | ||||
|     g_lua.registerClass<Creature>(); | ||||
|  | @ -63,6 +64,7 @@ void OTClient::registerLuaFunctions() | |||
|     g_lua.bindClassStaticFunction<Game>("logout", std::bind(&Game::logout, &g_game, _1)); | ||||
|     g_lua.bindClassStaticFunction<Game>("cancelLogin", std::bind(&Game::cancelLogin, &g_game)); | ||||
|     g_lua.bindClassStaticFunction<Game>("isOnline", std::bind(&Game::isOnline, &g_game)); | ||||
|     g_lua.bindClassStaticFunction<Game>("getProtocolGame", std::bind(&Game::getProtocolGame, &g_game)); | ||||
| 
 | ||||
|     g_lua.registerClass<UIMap, UIWidget>(); | ||||
|     g_lua.bindClassStaticFunction<UIMap>("create", &UIWidget::create<UIMap>); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Henrique
						Henrique