Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
- -- Received information
- --*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
- local function incomingInformationTypeSent(structure, senderID)
- local informationType = structure[1];
- local data = structure[2];
- if not CURRENT_QUERY_EXCHANGES[senderID] or not CURRENT_QUERY_EXCHANGES[senderID][informationType] then
- return; -- We didn't ask for theses information ...
- end
- log(("Received %s's %s info !"):format(senderID, informationType));
- CURRENT_QUERY_EXCHANGES[senderID][informationType] = nil;
- local decodedData = data;
- -- If the data is a string, we assume that it was compressed.
- if type(data) == "string" then
- decodedData = Utils.serial.safeDecompressCodedStructure(decodedData, {});
- end
- if informationType == registerInfoTypes.CHARACTERISTICS or informationType == registerInfoTypes.ABOUT
- or informationType == registerInfoTypes.MISC or informationType == registerInfoTypes.CHARACTER then
- saveInformation(senderID, informationType, decodedData);
- elseif informationType:sub(1, COMPANION_PREFIX:len()) == COMPANION_PREFIX then
- local v = informationType:sub(COMPANION_PREFIX:len() + 1, COMPANION_PREFIX:len() + 1);
- local profileID = informationType:sub(COMPANION_PREFIX:len() + 2);
- saveCompanionInformation(profileID, v, data)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement