Esempio n. 1
0
            /** Callback for the request to update rank of a player. Shows his
            *   rank and score.
            */
            virtual void callback()
            {
                auto done = m_done.lock();
                // Dialog deleted
                if (!done)
                    return;
                // I18N: In the network player dialog, indiciating a network
                // player has no ranking
                core::stringw result = _("%s has no ranking yet.", m_name);
                if (isSuccess())
                {
                    int rank = -1;
                    float score = 0.0f;
                    getXMLData()->get("rank", &rank);
                    getXMLData()->get("scores", &score);
                    if (rank > 0)
                    {
                        // I18N: In the network player dialog show rank and
                        // score of a player
                        result = _("%s is number %d in the rankings with a score of %f.",
                            m_name, rank, score);
                    }
                }
                *done = true;
                m_info->setText(result, false);

            }   // callback
Esempio n. 2
0
 virtual void callback()
 {
     uint32_t user_id = 0;
     getXMLData()->get("visitingid", &user_id);
     OnlineProfile *profile = ProfileManager::get()->getProfileByID(user_id);
     if (profile)
         profile->storeAchievements(getXMLData());
 }   // AchievementsRequest::callback
Esempio n. 3
0
 virtual void callback()
 {
     uint32_t user_id = 0;
     getXMLData()->get("visitingid", &user_id);
     OnlineProfile *profile = ProfileManager::get()->getProfileByID(user_id);
     if (profile)
         profile->storeFriends(getXMLData());
 }   // callback
Esempio n. 4
0
 void Profile::AchievementsRequest::callback()
 {
     uint32_t user_id(0);
     getXMLData()->get("visitingid", &user_id);
     if( ProfileManager::get()->getProfileByID(user_id) != NULL )
         ProfileManager::get()->getProfileByID(user_id)
                              ->achievementsCallback(getXMLData());
 }
Esempio n. 5
0
 void Profile::FriendsListRequest::callback()
 {
     uint32_t user_id(0);
     getXMLData()->get("visitingid", &user_id);
     if( ProfileManager::get()->getProfileByID(user_id) != NULL )
         ProfileManager::get()->getProfileByID(user_id)
                             ->friendsListCallback(getXMLData());
 }
Esempio n. 6
0
static void readNSizResource(NSizResource* data, char** location) {
  char* curLoc;
  char* tagBegin;
  char* tagEnd;
  char* dictEnd;
  size_t strLen;
  size_t dummy;
  
  curLoc = *location;
  
  data->isVolume = FALSE;
  data->sha1Digest = NULL;
  data->blockChecksum2 = 0;
  data->bytes = 0;
  data->modifyDate = 0;
  data->partitionNumber = 0;
  data->version = 0;
  data->volumeSignature = 0;
  
  curLoc = strstr(curLoc, "<dict>");
  dictEnd = strstr(curLoc, "</dict>"); /* hope there's not a dict type in this resource data! */
  while(curLoc != NULL && curLoc < dictEnd) {
    curLoc = strstr(curLoc, "<key>");
    if(!curLoc)
      break;
    curLoc += sizeof("<key>") - 1;
    
    tagEnd = strstr(curLoc, "</key>");
    
    strLen = (size_t)(tagEnd - curLoc);
    tagBegin = curLoc;
    curLoc = tagEnd + sizeof("</key>") - 1;
    
    if(strncmp(tagBegin, "SHA-1-digest", strLen) == 0) {
      data->sha1Digest = getXMLData(&curLoc, &dummy, 0, 0);
      /*flipEndian(data->sha1Digest, 4);*/
    } else if(strncmp(tagBegin, "block-checksum-2", strLen) == 0) {
      data->blockChecksum2 = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "bytes", strLen) == 0) {
      data->bytes = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "date", strLen) == 0) {
      data->modifyDate = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "part-num", strLen) == 0) {
      data->partitionNumber = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "version", strLen) == 0) {
      data->version = getXMLInteger(&curLoc);
    } else if(strncmp(tagBegin, "volume-signature", strLen) == 0) {
      data->volumeSignature = getXMLInteger(&curLoc);
      data->isVolume = TRUE;
    }
  }
  
  curLoc = dictEnd + sizeof("</dict>") - 1;
  
  *location = curLoc;
}
Esempio n. 7
0
LUAMTA_FUNCTION(particle_emitter, GetXML)
{
	auto self = my->ToParticleEmitter(1);

	auto xml = gEnv->pSystem->CreateXmlNode();
	self->GetParticleEffect()->Serialize(xml, false, true);
	my->Push(xml->getXMLData()->GetString());

	return 1;
}
Esempio n. 8
0
static void readResourceData(ResourceData* data, char** location, char* xmlStart, FlipDataFunc flipData) {
  char* curLoc;
  char* tagBegin;
  char* tagEnd;
  char* dictEnd;
  size_t strLen;
  char* buffer;
  char* encodedStart;
  
  curLoc = *location;
  
  data->name = NULL;
  data->attributes = 0;
  data->id = 0;
  data->data = NULL;
  
  curLoc = strstr(curLoc, "<dict>");
  dictEnd = strstr(curLoc, "</dict>"); /* hope there's not a dict type in this resource data! */
  while(curLoc != NULL && curLoc < dictEnd) {
    curLoc = strstr(curLoc, "<key>");
    if(!curLoc)
      break;
    curLoc += sizeof("<key>") - 1;
    
    tagEnd = strstr(curLoc, "</key>");
    
    strLen = (size_t)(tagEnd - curLoc);
    tagBegin = curLoc;
    curLoc = tagEnd + sizeof("</key>") - 1;
    
    if(strncmp(tagBegin, "Attributes", strLen) == 0) {
      buffer = getXMLString(&curLoc);
      sscanf(buffer, "0x%x", &(data->attributes));
      free(buffer);
    } else if(strncmp(tagBegin, "Data", strLen) == 0) {
        encodedStart = 0;
      data->data = getXMLData(&curLoc, &(data->dataLength), &encodedStart, &data->dataXmlSize);
      data->dataXmlOffset = encodedStart - xmlStart;
      if(flipData) {
        (*flipData)(data->data, 0);
      }
    } else if(strncmp(tagBegin, "ID", strLen) == 0) {
      buffer = getXMLString(&curLoc);
      sscanf(buffer, "%d", &(data->id));
      free(buffer);
    } else if(strncmp(tagBegin, "Name", strLen) == 0) {
      data->name = getXMLString(&curLoc);
    }
  }
  
  curLoc = dictEnd + sizeof("</dict>") - 1;
  
  *location = curLoc;
}
Esempio n. 9
0
bool NOAAIon::updateIonSource(const QString& source)
{
    // We expect the applet to send the source in the following tokenization:
    // ionname:validate:place_name - Triggers validation of place
    // ionname:weather:place_name - Triggers receiving weather of place

    QStringList sourceAction = source.split(QLatin1Char('|'));

    // Guard: if the size of array is not 2 then we have bad data, return an error
    if (sourceAction.size() < 2) {
        setData(source, QStringLiteral("validate"), QStringLiteral("noaa|malformed"));
        return true;
    }

    if (sourceAction[1] == QLatin1String("validate") && sourceAction.size() > 2) {
        QStringList result = validate(sourceAction[2]);

        if (result.size() == 1) {
            setData(source, QStringLiteral("validate"), QStringLiteral("noaa|valid|single|").append(result.join(QLatin1Char('|'))));
            return true;
        }
        if (result.size() > 1) {
            setData(source, QStringLiteral("validate"), QStringLiteral("noaa|valid|multiple|").append(result.join(QLatin1Char('|'))));
            return true;
        }
        // result.size() == 0
        setData(source, QStringLiteral("validate"), QStringLiteral("noaa|invalid|single|").append(sourceAction[2]));
        return true;
    }

    if (sourceAction[1] == QLatin1String("weather") && sourceAction.size() > 2) {
        getXMLData(source);
        return true;
    }

    setData(source, QStringLiteral("validate"), QStringLiteral("noaa|malformed"));
    return true;
}
Esempio n. 10
0
int main()
{
	int status;
	char *xmlData;
	status = getChannels(URL);

	if(status != 0)
	{
		error("Unable to getchannel");
		return -1;
	}
	else
		printf("Channel successfully fetched.\n");

	xmlData = getXMLData("channels.xml");
	int i = 0;
	for(i = 0;sizeof(xmlData);i++)
	{
		printf("%c", xmlData[i]);
	}

	return 0; //all ok

}
Esempio n. 11
0
 // ------------------------------------------------------------------------
 void ServersManager::RefreshRequest::callback()
 {
     ServersManager::get()->refresh(isSuccess(), getXMLData());
 }   // callback
Esempio n. 12
0
void ResourceManager::on_bImportORPGM_clicked()
{
    QString fileLocation = QFileDialog::getOpenFileName(0, "File Location", QDir::homePath(), "Open RPG Maker Resources (*.orpgmresource)");
    if (!fileLocation.isEmpty())
    {
        XMLNode ResourceNode, TempNode, FilesNode, FileNode;
        XMLResults results;
        QString xmlData = getXMLData(fileLocation);
        QString resourceType;
        ResourceNode = XMLNode::parseString(xmlData.toUtf8().data(), "openrpgmaker-resource", &results);
        if (ResourceNode.isEmpty() == TRUE)
            QMessageBox::critical(0, "XML Error", QString("Error parsing resource file \"%1\"\nXML Error Message: %2").arg(fileLocation).arg(XMLNode::getError(results.error)));
        else
        {
            Loading *loading = new Loading("Importing Resources", this);
            loading->show();
            FilesNode = ResourceNode.getChildNode("files");
            for (int i = 0; i < FilesNode.nChildNode("file"); ++i)
            {
                QCoreApplication::processEvents();
                FileNode = FilesNode.getChildNode("file", i);
                XMLTools::extractResource(FileNode, ProjectData::getAbsoluteResourcePath(FileNode.getAttribute("location")));
            }
            for (int i = 1; i < ResourceNode.nChildNode(); ++i)
            {
                QCoreApplication::processEvents();
                TempNode = ResourceNode.getChildNode(i);
                resourceType = TempNode.getName();
                if (resourceType == "attribute")
                {
                    Attribute *data = new Attribute(TempNode);
                    ProjectData::addAttribute(data);
                    delete data;
                }
                else if (resourceType == "battleanimation")
                {
                    BattleAnimation *data = new BattleAnimation(TempNode);
                    ProjectData::addBattleAnimation(data);
                    delete data;
                }
                else if (resourceType == "character")
                {
                    Character *data = new Character(TempNode);
                    ProjectData::addCharacter(data);
                    delete data;
                }
                else if (resourceType == "charactersprite")
                {
                    CharacterSprite *data = new CharacterSprite(TempNode);
                    ProjectData::addCharacterSprite(data);
                    delete data;
                }
                else if (resourceType == "class")
                {
                    Class *data = new Class(TempNode);
                    ProjectData::addClass(data);
                    delete data;
                }
                else if (resourceType == "commonevent")
                {
                    CommonEvent *data = new CommonEvent(TempNode);
                    ProjectData::addCommonEvent(data);
                    delete data;
                }
                else if (resourceType == "condition")
                {
                    Condition *data = new Condition(TempNode);
                    ProjectData::addCondition(data);
                    delete data;
                }
                else if (resourceType == "font")
                {
                    Font *data = new Font(TempNode);
                    ProjectData::addFont(data);
                    delete data;
                }
                else if (resourceType == "globalanimation")
                {
                    GlobalAnimation *data = new GlobalAnimation(TempNode);
                    ProjectData::addGlobalAnimation(data);
                    delete data;
                }
                else if (resourceType == "item")
                {
                    Item *data = new Item(TempNode);
                    ProjectData::addItem(data);
                    delete data;
                }
                else if (resourceType == "mainmenulayout")
                {
                    MainMenuLayout *data = new MainMenuLayout(TempNode);
                    ProjectData::addMainMenuLayout(data);
                    delete data;
                }
                else if (resourceType == "monsteranimation")
                {
                    MonsterAnimation *data = new MonsterAnimation(TempNode);
                    ProjectData::addMonsterAnimation(data);
                    delete data;
                }
                else if (resourceType == "monster")
                {
                    Monster *data = new Monster(TempNode);
                    ProjectData::addMonster(data);
                    delete data;
                }
                else if (resourceType == "monstergroup")
                {
                    MonsterGroup *data = new MonsterGroup(TempNode);
                    ProjectData::addMonsterGroup(data);
                    delete data;
                }
                else if (resourceType == "popupmenulayout")
                {
                    PopupMenuLayout *data = new PopupMenuLayout(TempNode);
                    ProjectData::addPopupMenuLayout(data);
                    delete data;
                }
                else if (resourceType == "skill")
                {
                    Skill *data = new Skill(TempNode);
                    ProjectData::addSkill(data);
                    delete data;
                }
                else if (resourceType == "terrain")
                {
                    Terrain *data = new Terrain(TempNode);
                    ProjectData::addTerrain(data);
                    delete data;
                }
                else if (resourceType == "tileset")
                {
                    Tileset *data = new Tileset(TempNode);
                    ProjectData::addTileset(data);
                    delete data;
                }
                else if (resourceType == "vehicle")
                {
                    Vehicle *data = new Vehicle(TempNode);
                    ProjectData::addVehicle(data);
                    delete data;
                }
            }
            QCoreApplication::processEvents();
            buildResourceTree();
            loading->doneLoading();
        }
    }
}