clientbot/tools/DecodeImpulse.py

583 lines
29 KiB
Python
Raw Normal View History

2019-10-24 17:45:24 +00:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# module DecodeImpulse
#
# Copyright (C) 2019 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
#from tools import BitStream
from tools import getPowerOf2
from tools import CShardName
from tools import CCharacterSummary
from tools import CMainlandSummary
LOGGER='DecodeImpulse'
class DecodeImpulse():
def __init__(self):
'''
khanat-opennel-code/code/ryzom/client/src/net_manager.cpp # void initializeNetwork()
'''
self.msgXml = None
self.databaseXml = None
self.GenericMsgHeaderMngr = {}
self.initializeNetwork()
def updatePatcherPriorityBasedOnCharacters(self, world):
logging.getLogger(LOGGER).debug('Load character')
hasMainlandChar = False
for ele in world.CharacterSummaries:
if ele.Name == "":
continue
if not ele.InNewbieland:
hasMainlandChar = True
break
if hasMainlandChar:
logging.getLogger(LOGGER).debug('hasMainlandChar : True')
else:
logging.getLogger(LOGGER).debug('hasMainlandChar : False')
# requestDownloadThreadPriority(hasMainlandChar ? BGDownloader::ThreadPriority_Normal : BGDownloader::ThreadPriority_Low, false);
# khanat-opennel-code/code/ryzom/client/src/bg_downloader_access.cpp # void CBGDownloaderAccess::requestDownloadThreadPriority(BGDownloader::TThreadPriority newPriority, bool freezeUI)
#msgout = BitStream.BitStream()
logging.getLogger(LOGGER).debug("TODO")
def impulseDatabaseUpdatePlayer(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO:%s" % msgin)
def impulseUpdateInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseInitInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDatabaseUpdateBank(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDatabaseInitBank(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDatabaseResetBank(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseNoUserChar(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseUserChars(self, msgin, world):
'''
khanat-opennel-code/code/ryzom/client/src/net_manager.cpp # void impulseUserChars(NLMISC::CBitMemStream &impulse)
'''
world.ServerPeopleActive = msgin.readUint8('ServerPeopleActive')
world.ServerCareerActive = msgin.readUint8('ServerCareerActive')
# impulse.serialCont (CharacterSummaries);
world.CharacterSummaries = []
size = msgin.readUint32('CharacterSummaries:len')
logging.getLogger(LOGGER).debug(msgin.showAllData())
logging.getLogger(LOGGER).debug("size:%d" % size)
for _ in range(0, size):
tmp = CCharacterSummary.CCharacterSummary()
tmp.read(msgin)
world.CharacterSummaries.append(tmp)
# impulse.serialCont (shardNames);
size = msgin.readUint32('shardNames:len')
shardNames = []
for i in range(0, size):
shardNames.append(msgin.readString('shardNames_' + str(i)))
# CShardNames::getInstance().loadShardNames(shardNames);
# int(shardNames[i*3+0]) = SessionId / shardNames[i*3+1] = DisplayName / shardNames[i*3+2] = ShortName
for i in range(0, size // 3):
tmp = CShardName.CShardName(int(shardNames[i*3+0]), shardNames[i*3+1], shardNames[i*3+2])
world.CShardNames.append(tmp)
#_, shardNames = msgin.readCont('shardNames')
# readPrivileges(impulse);
world.UserPrivileges = msgin.readString('UserPrivileges')
world.FreeTrial = msgin.readBool('FreeTrial')
world.FreeTrial = False # We read and ignore this param :)
# impulse.serialCont(Mainlands);
self.Mainlands = []
size = msgin.readUint32('Mainlands:len')
for _ in range(0, size):
tmp = CMainlandSummary.CMainlandSummary()
tmp.read(msgin)
world.Mainlands.append(tmp)
self.updatePatcherPriorityBasedOnCharacters(world); # Load player config from server to client
def impulseUserChar(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseFarTP(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseServerReady(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCharNameValid(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseShardId(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseServerQuitOk(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseServerQuitAbort(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseMailNotification(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseForumNotification(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePermanentBan(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePermanentUnban(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseChat(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTell(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseFarTell(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseChat2(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDynString(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def inpulseDynStringInChatGroup(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTell2(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTP(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTPWithSeason(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCorrectPos(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCombatEngageFailed(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDynChatOpen(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDynChatClose(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseBeginCast(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamShareOpen(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamShareInvalid(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamShareClose(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamContactInit(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamContactCreate(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamContactStatus(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseTeamContactRemove(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseExchangeInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseExchangeCloseInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseMountAbort(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseWhere(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCounter(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePhraseSend(self, msgin, world):
# khanat-opennel-code/code/ryzom/client/src/net_manager.cpp:2283 void impulsePhraseSend(NLMISC::CBitMemStream &impulse)
dynId = msgin.readUint32('dynId')
logging.getLogger(LOGGER).debug("dynId:%d" % dynId)
StringId = msgin.readUint32('StringId')
logging.getLogger(LOGGER).debug("dynId:%d StringId:%s" % (dynId, StringId))
world.StringManager.receiveMessage(StringId, msgin.getNotRead())
def impulseStringResp(self, msgin, world):
# khanat-opennel-code/code/ryzom/client/src/net_manager.cpp:2295 void impulseStringResp(NLMISC::CBitMemStream &impulse)
StringId = msgin.readUint32('StringId')
strUtf8 = msgin.toBytes()
strUtf8 = msgin.readUtf8String('strUtf8')
logging.getLogger(LOGGER).debug("StringId:%d strUtf8:%s" % (StringId, strUtf8))
world.StringManager.receiveTemplate(StringId, strUtf8)
def impulseReloadCache(self, msgin, world):
world.timestamp = msgin.readUint32('timestamp')
logging.getLogger(LOGGER).debug("Reload Cache timestamp:%d" % world.timestamp)
logging.getLogger(LOGGER).debug("Message not read (%d) %s" % (msgin.needRead(), msgin.showLastData() ))
def impulseBotChatForceEnd(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseJournalInitCompletedMissions(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseJournalUpdateCompletedMissions(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseJournalAddCompass(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseJournalRemoveCompass(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildJoinProposal(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildAscensor(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildLeaveAscensor(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildAbortCreation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildOpenGuildWindow(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildOpenInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildCloseInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildUpdatePlayerTitle(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseGuildUseFemaleTitles(self, msgin, world):
world.UseFemaleTitles = msgin.readBool('UseFemaleTitles')
logging.getLogger(LOGGER).debug("UseFemaleTitles")
def impulseCloseTempInv(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseRemoteAdmin(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePhraseDownLoad(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePhraseConfirmBuy(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePhraseAckExecuteCyclic(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePhraseAckExecuteNext(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseItemInfoSet(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseItemInfoRefreshVersion(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePrereqInfoSet(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseItemOpenRoomInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseItemCloseRoomInventory(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDeathRespawnPoint(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDeathRespawn(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDuelInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDuelCancelInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePVPChallengeInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePVPChallengeCancelInvitation(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePVPFactionPushFactionWar(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePVPFactionPopFactionWar(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulsePVPFactionFactionWars(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseEncyclopediaUpdate(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseEncyclopediaInit(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseUserBars(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseUserPopup(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseEnterCrZoneProposal(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCloseEnterCrZoneProposal(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def cbImpulsionGatewayOpen(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def cbImpulsionGatewayMessage (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def cbImpulsionGatewayClose (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseOutpostChooseSide (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseOutpostDeclareWarAck (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCombatFlyingChaScore1Delta (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCombatFlyingTextItemSpecialEffectProc (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseCombatFlyingText (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseSetSeason (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDssDown (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseSetNpcIconDesc (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseServerEventForMissionAvailability (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseSetNpcIconTimer (self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseDatabaseInitPlayer(self, msgin, world):
logging.getLogger(LOGGER).debug("TODO")
def impulseSetConnectionAskName(self, msgin, world):
# _ = msgin.readUtf8String('Name')
_ = msgin.readUString('Name')
_ = msgin.readUint32('HomeSessionId')
2019-10-24 17:45:24 +00:00
def initializeNetwork(self):
self.GenericMsgHeaderMngr.setdefault('DB_UPD_PLR', self.impulseDatabaseUpdatePlayer)
self.GenericMsgHeaderMngr.setdefault('DB_INIT:PLR', self.impulseDatabaseInitPlayer)
self.GenericMsgHeaderMngr.setdefault("DB_UPD_INV", self.impulseUpdateInventory)
self.GenericMsgHeaderMngr.setdefault("DB_INIT:INV", self.impulseInitInventory)
self.GenericMsgHeaderMngr.setdefault("DB_GROUP:UPDATE_BANK", self.impulseDatabaseUpdateBank)
self.GenericMsgHeaderMngr.setdefault("DB_GROUP:INIT_BANK", self.impulseDatabaseInitBank)
self.GenericMsgHeaderMngr.setdefault("DB_GROUP:RESET_BANK", self.impulseDatabaseResetBank)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:NO_USER_CHAR", self.impulseNoUserChar)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:USER_CHARS", self.impulseUserChars)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:USER_CHAR", self.impulseUserChar)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:FAR_TP", self.impulseFarTP)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:READY", self.impulseServerReady)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:VALID_NAME", self.impulseCharNameValid)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:SHARD_ID", self.impulseShardId)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:SERVER_QUIT_OK", self.impulseServerQuitOk)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:SERVER_QUIT_ABORT", self.impulseServerQuitAbort)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:MAIL_AVAILABLE", self.impulseMailNotification)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:GUILD_MESSAGE_AVAILABLE", self.impulseForumNotification)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:PERMANENT_BAN", self.impulsePermanentBan)
self.GenericMsgHeaderMngr.setdefault("CONNECTION:UNBAN", self.impulsePermanentUnban)
self.GenericMsgHeaderMngr.setdefault("STRING:CHAT", self.impulseChat)
self.GenericMsgHeaderMngr.setdefault("STRING:TELL", self.impulseTell)
self.GenericMsgHeaderMngr.setdefault("STRING:FAR_TELL", self.impulseFarTell)
self.GenericMsgHeaderMngr.setdefault("STRING:CHAT2", self.impulseChat2)
self.GenericMsgHeaderMngr.setdefault("STRING:DYN_STRING", self.impulseDynString)
self.GenericMsgHeaderMngr.setdefault("STRING:DYN_STRING_GROUP", self.inpulseDynStringInChatGroup)
self.GenericMsgHeaderMngr.setdefault("STRING:TELL2", self.impulseTell2)
self.GenericMsgHeaderMngr.setdefault("TP:DEST", self.impulseTP)
self.GenericMsgHeaderMngr.setdefault("TP:DEST_WITH_SEASON", self.impulseTPWithSeason)
self.GenericMsgHeaderMngr.setdefault("TP:CORRECT", self.impulseCorrectPos)
self.GenericMsgHeaderMngr.setdefault("COMBAT:ENGAGE_FAILED", self.impulseCombatEngageFailed)
self.GenericMsgHeaderMngr.setdefault("BOTCHAT:DYNCHAT_OPEN", self.impulseDynChatOpen)
self.GenericMsgHeaderMngr.setdefault("BOTCHAT:DYNCHAT_CLOSE", self.impulseDynChatClose)
self.GenericMsgHeaderMngr.setdefault("CASTING:BEGIN", self.impulseBeginCast)
self.GenericMsgHeaderMngr.setdefault("TEAM:INVITATION", self.impulseTeamInvitation)
self.GenericMsgHeaderMngr.setdefault("TEAM:SHARE_OPEN", self.impulseTeamShareOpen)
self.GenericMsgHeaderMngr.setdefault("TEAM:SHARE_INVALID", self.impulseTeamShareInvalid)
self.GenericMsgHeaderMngr.setdefault("TEAM:SHARE_CLOSE", self.impulseTeamShareClose)
self.GenericMsgHeaderMngr.setdefault("TEAM:CONTACT_INIT", self.impulseTeamContactInit)
self.GenericMsgHeaderMngr.setdefault("TEAM:CONTACT_CREATE", self.impulseTeamContactCreate)
self.GenericMsgHeaderMngr.setdefault("TEAM:CONTACT_STATUS", self.impulseTeamContactStatus)
self.GenericMsgHeaderMngr.setdefault("TEAM:CONTACT_REMOVE", self.impulseTeamContactRemove)
self.GenericMsgHeaderMngr.setdefault("EXCHANGE:INVITATION", self.impulseExchangeInvitation)
self.GenericMsgHeaderMngr.setdefault("EXCHANGE:CLOSE_INVITATION", self.impulseExchangeCloseInvitation)
self.GenericMsgHeaderMngr.setdefault("ANIMALS:MOUNT_ABORT", self.impulseMountAbort)
self.GenericMsgHeaderMngr.setdefault("DEBUG:REPLY_WHERE", self.impulseWhere)
self.GenericMsgHeaderMngr.setdefault("DEBUG:COUNTER", self.impulseCounter)
self.GenericMsgHeaderMngr.setdefault("STRING_MANAGER:PHRASE_SEND", self.impulsePhraseSend)
self.GenericMsgHeaderMngr.setdefault("STRING_MANAGER:STRING_RESP", self.impulseStringResp)
self.GenericMsgHeaderMngr.setdefault("STRING_MANAGER:RELOAD_CACHE", self.impulseReloadCache)
self.GenericMsgHeaderMngr.setdefault("BOTCHAT:FORCE_END", self.impulseBotChatForceEnd)
self.GenericMsgHeaderMngr.setdefault("JOURNAL:INIT_COMPLETED_MISSIONS", self.impulseJournalInitCompletedMissions)
self.GenericMsgHeaderMngr.setdefault("JOURNAL:UPDATE_COMPLETED_MISSIONS", self.impulseJournalUpdateCompletedMissions)
self.GenericMsgHeaderMngr.setdefault("JOURNAL:ADD_COMPASS", self.impulseJournalAddCompass)
self.GenericMsgHeaderMngr.setdefault("JOURNAL:REMOVE_COMPASS", self.impulseJournalRemoveCompass)
self.GenericMsgHeaderMngr.setdefault("GUILD:JOIN_PROPOSAL", self.impulseGuildJoinProposal)
self.GenericMsgHeaderMngr.setdefault("GUILD:ASCENSOR", self.impulseGuildAscensor)
self.GenericMsgHeaderMngr.setdefault("GUILD:LEAVE_ASCENSOR", self.impulseGuildLeaveAscensor)
self.GenericMsgHeaderMngr.setdefault("GUILD:ABORT_CREATION", self.impulseGuildAbortCreation)
self.GenericMsgHeaderMngr.setdefault("GUILD:OPEN_GUILD_WINDOW", self.impulseGuildOpenGuildWindow)
self.GenericMsgHeaderMngr.setdefault("GUILD:OPEN_INVENTORY", self.impulseGuildOpenInventory)
self.GenericMsgHeaderMngr.setdefault("GUILD:CLOSE_INVENTORY", self.impulseGuildCloseInventory)
self.GenericMsgHeaderMngr.setdefault("GUILD:UPDATE_PLAYER_TITLE", self.impulseGuildUpdatePlayerTitle)
self.GenericMsgHeaderMngr.setdefault("GUILD:USE_FEMALE_TITLES", self.impulseGuildUseFemaleTitles)
self.GenericMsgHeaderMngr.setdefault("HARVEST:CLOSE_TEMP_INVENTORY", self.impulseCloseTempInv)
self.GenericMsgHeaderMngr.setdefault("COMMAND:REMOTE_ADMIN", self.impulseRemoteAdmin)
self.GenericMsgHeaderMngr.setdefault("PHRASE:DOWNLOAD", self.impulsePhraseDownLoad)
self.GenericMsgHeaderMngr.setdefault("PHRASE:CONFIRM_BUY", self.impulsePhraseConfirmBuy)
self.GenericMsgHeaderMngr.setdefault("PHRASE:EXEC_CYCLIC_ACK", self.impulsePhraseAckExecuteCyclic)
self.GenericMsgHeaderMngr.setdefault("PHRASE:EXEC_NEXT_ACK", self.impulsePhraseAckExecuteNext)
self.GenericMsgHeaderMngr.setdefault("ITEM_INFO:SET", self.impulseItemInfoSet)
self.GenericMsgHeaderMngr.setdefault("ITEM_INFO:REFRESH_VERSION", self.impulseItemInfoRefreshVersion)
self.GenericMsgHeaderMngr.setdefault("MISSION_PREREQ:SET", self.impulsePrereqInfoSet)
self.GenericMsgHeaderMngr.setdefault("ITEM:OPEN_ROOM_INVENTORY", self.impulseItemOpenRoomInventory)
self.GenericMsgHeaderMngr.setdefault("ITEM:CLOSE_ROOM_INVENTORY", self.impulseItemCloseRoomInventory)
self.GenericMsgHeaderMngr.setdefault("DEATH:RESPAWN_POINT", self.impulseDeathRespawnPoint)
self.GenericMsgHeaderMngr.setdefault("DEATH:RESPAWN", self.impulseDeathRespawn)
self.GenericMsgHeaderMngr.setdefault("DUEL:INVITATION", self.impulseDuelInvitation)
self.GenericMsgHeaderMngr.setdefault("DUEL:CANCEL_INVITATION", self.impulseDuelCancelInvitation)
self.GenericMsgHeaderMngr.setdefault("PVP_CHALLENGE:INVITATION", self.impulsePVPChallengeInvitation)
self.GenericMsgHeaderMngr.setdefault("PVP_CHALLENGE:CANCEL_INVITATION", self.impulsePVPChallengeCancelInvitation)
self.GenericMsgHeaderMngr.setdefault("PVP_FACTION:PUSH_FACTION_WAR", self.impulsePVPFactionPushFactionWar)
self.GenericMsgHeaderMngr.setdefault("PVP_FACTION:POP_FACTION_WAR", self.impulsePVPFactionPopFactionWar)
self.GenericMsgHeaderMngr.setdefault("PVP_FACTION:FACTION_WARS", self.impulsePVPFactionFactionWars)
self.GenericMsgHeaderMngr.setdefault("ENCYCLOPEDIA:UPDATE", self.impulseEncyclopediaUpdate)
self.GenericMsgHeaderMngr.setdefault("ENCYCLOPEDIA:INIT", self.impulseEncyclopediaInit)
self.GenericMsgHeaderMngr.setdefault("USER:BARS", self.impulseUserBars)
self.GenericMsgHeaderMngr.setdefault("USER:POPUP", self.impulseUserPopup)
self.GenericMsgHeaderMngr.setdefault("MISSION:ASK_ENTER_CRITICAL", self.impulseEnterCrZoneProposal)
self.GenericMsgHeaderMngr.setdefault("MISSION:CLOSE_ENTER_CRITICAL", self.impulseCloseEnterCrZoneProposal)
self.GenericMsgHeaderMngr.setdefault( "MODULE_GATEWAY:FEOPEN", self.cbImpulsionGatewayOpen)
self.GenericMsgHeaderMngr.setdefault( "MODULE_GATEWAY:GATEWAY_MSG", self.cbImpulsionGatewayMessage )
self.GenericMsgHeaderMngr.setdefault( "MODULE_GATEWAY:FECLOSE", self.cbImpulsionGatewayClose )
self.GenericMsgHeaderMngr.setdefault( "OUTPOST:CHOOSE_SIDE", self.impulseOutpostChooseSide )
self.GenericMsgHeaderMngr.setdefault( "OUTPOST:DECLARE_WAR_ACK", self.impulseOutpostDeclareWarAck )
self.GenericMsgHeaderMngr.setdefault( "COMBAT:FLYING_ChaScore1_DELTA", self.impulseCombatFlyingChaScore1Delta )
self.GenericMsgHeaderMngr.setdefault( "COMBAT:FLYING_TEXT_ISE", self.impulseCombatFlyingTextItemSpecialEffectProc )
self.GenericMsgHeaderMngr.setdefault( "COMBAT:FLYING_TEXT", self.impulseCombatFlyingText )
self.GenericMsgHeaderMngr.setdefault( "SEASON:SET", self.impulseSetSeason )
self.GenericMsgHeaderMngr.setdefault( "RING_MISSION:DSS_DOWN", self.impulseDssDown )
self.GenericMsgHeaderMngr.setdefault( "NPC_ICON:SET_DESC", self.impulseSetNpcIconDesc )
self.GenericMsgHeaderMngr.setdefault( "NPC_ICON:SVR_EVENT_MIS_AVL", self.impulseServerEventForMissionAvailability )
self.GenericMsgHeaderMngr.setdefault( "NPC_ICON:SET_TIMER", self.impulseSetNpcIconTimer )
# Send by client
self.GenericMsgHeaderMngr.setdefault( "CONNECTION:ASK_NAME", self.impulseSetConnectionAskName )
2019-10-24 17:45:24 +00:00
def sizeElement(self, keys = None):
head = self.msgXml
if not keys:
return len(head)
ret = len(head)
for key in keys.split(':'):
for ele in head:
if ele.attrib['name'] == key:
head = ele
ret = len(head)
break
return ret
def searchElement(self, keys):
ret = []
head = self.msgXml
logging.getLogger(LOGGER).debug(len(head))
for key in keys.split(':'):
#print(key)
id = 0
for ele in head:
if ele.attrib['name'] == key:
logging.getLogger(LOGGER).debug('%s => %d' % (key, id))
ret.append(id)
head = ele
break
id += 1
return ret
def execute(self, msgin, world):
'''
khanat-opennel-code/code/ryzom/client/src/net_manager.cpp:3746 void impulseCallBack(NLMISC::CBitMemStream &impulse, sint32 packet, void *arg)
khanat-opennel-code/code/ryzom/common/src/game_share/generic_xml_msg_mngr.cpp:121 void CGenericXmlMsgHeaderManager::execute(CBitMemStream &strm)
khanat-opennel-code/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h:431 CNode *select(NLMISC::CBitMemStream &strm)
uint32 index = 0;
uint NbBits;
strm.serialAndLog2(index, node->NbBits);
'''
logging.getLogger(LOGGER).debug("execute")
head = self.msgXml
listpath = []
while True:
nbBit = getPowerOf2.getPowerOf2(len(head))
id = msgin.readSerial(nbBit, name='MsgXML', typeName='Number', emulate=True)
logging.getLogger(LOGGER).debug("XML DECODE : %3d -> %s" % (nbBit, ':'.join(listpath)) )
2019-10-24 17:45:24 +00:00
ele = head[id]
name = ele.attrib['name']
listpath.append(name)
fullname = ':'.join(listpath)
id = msgin.readSerial(nbBit, name='MsgXML', typeName='XML <' + name + '>')
logging.getLogger(LOGGER).debug(fullname)
if fullname in self.GenericMsgHeaderMngr:
logging.getLogger(LOGGER).debug("Found : %s" % fullname)
self.GenericMsgHeaderMngr[fullname](msgin, world)
logging.getLogger(LOGGER).debug("MessageXML decoded: %s" % msgin.showAllData() )
return True
else:
#logging.getLogger(LOGGER).debug("Non trouve")
for ele in head:
if ele.attrib['name'] == name:
head = ele
break
if head != ele:
logging.getLogger(LOGGER).error("Impossible to found %s" % fullname )
logging.getLogger(LOGGER).debug("MessageXML decoded: %s" % msgin.showAllData() )
return False
# End While
logging.getLogger(LOGGER).debug("MessageXML decoded: %s" % msgin.showAllData() )
return False
def loadMsg(self, msgXml):
self.msgXml = msgXml
def loadDatabase(self, databaseXml):
self.databaseXml = databaseXml