Example #1
0
void AdamantShopPlugin::loadShops(const QStringList &currentLeagues) {
    _shops.clear();

    QStringList leagues = currentLeagues;

    // NOTE(rory): Load leagues
    auto list = shopsPath().entryInfoList({"*.shop"});
    for (QFileInfo info : list) {
        if (leagues.contains(info.baseName())) continue;
        leagues.append(info.baseName());
    }

    // NOTE(rory):
    for (const QString& league : leagues) {
        if (_shops.contains(league)) continue;
        bool disabled = !currentLeagues.contains(league);

        auto shop = loadShop(shopsPath().absoluteFilePath(QString("%1.shop").arg(league)));

        if (!shop)  {
            shop = new Shop(league);
            shop->setUnused();
        }
        shop->setDisabled(disabled);

        _shops.insert(shop->league(), shop);
        _viewer->addShop(shop);
    }
}
Example #2
0
void CWorld::LoadLOD()
{
	loadMob();	
	loadShop();
	loadSkill();
	loadSkillTree();
	loadArmorPreview();
	loadSSkill();
	loadAction();
	loadItemData();	
	loadSetItemData();
	loadAffinity();
	loadMakeItem();
	loadCatalog();
	loadEvent();
	loadNPCHelp();
	loadCombo();
	loadBigpet();
	loadRareOption();
	loadOption();
	loadTitleData();
	loadQuest();
	loadLacarette();
	loadZone();
	loadNotice();
	loadEntity();
	loadZoneData();
	loadTEventString();
	loadLevelUpGuide();
	loadChangeEquipment();
	LoadItemCollection();
	LoadItemCompose();
}
Example #3
0
//The primary conroller for the game. Using the progress value passed in,
//the function knows what the current stat of the game is. Currently, there
//is nothing after progress value = 3, and the game isn't saved after the fight
//ends, but this can be changed/expanded
void playGame(Hero* heroes, char* playerName, Boss* boss, int progress, int choice)
{

	//Added flavor 
	if(progress > 0)
	{
		printf("\nWelcome back %s.\n\n", playerName);
	}

	//holds what the last thing done was.
	int initialprogress = progress;

	Hero* chosenHeroes;
	Shop* s;
	//another check for how the data is laid out. This is so we can immediately print out
	//heroes if we have already selected heroes. 
	if(progress > 1)
	{
		chosenHeroes = heroes;
	}	
	
	switch(progress)
	{
		//initial player identification
		case 0:
			playerName = getPlayerName();
			choice = chooseSaveFile();
			saveFileData(choice, choiceToFile(choice-1), NULL, playerName, 1);
		//hero selection
		case 1:
			chosenHeroes = pickHeroes(heroes);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 2);
			free(heroes);
		//equip heroes with items 
		case 2:
			//shop
			s = loadShop();
			goShopping(chosenHeroes, s);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 3);
		//fight the boss (a boss? Maybe find some way to get more than one boss in there?)
		case 3: 
			boss = loadBoss();
			int result = fight(boss, chosenHeroes);
			result == 0 ? printf("You won! Congrats!\n") : printf("Oh no, you lost! Reload to try again.\n");
			//If you're in here, it's probably to delete this line first
			printf("\n\n**********CONGRATS! YOU MADE IT TO THE END OF 2050!*************\n\n");
			freeHeroesAndItems(chosenHeroes);
			freeBossTree(boss->root);
			free(boss);
			break;
		default:
			//What?
			printf("Something fatal happened with the progress value. Check gamestate.txt.\n");
			break;
	}
	

	//I don't actually remember why I did this, but it works. 
	//I think because if it's a save file, it's freed elsewhere?
	if(initialprogress == 0)
	{
		free(playerName);
	}
	return;
}
Example #4
0
void playGame(Hero* heroes, char* playerName, Boss* boss, int progress, int choice)
{

	//Added flavor 
	if(progress > 0)
	{
		printf("\nWelcome back %s.\n\n", playerName);
	}

	//holds what the last thing done was.
	int initialprogress = progress;

	Hero* chosenHeroes;
	Shop* s;
	//another check for how the data is laid out. This is so we can immediately print out
	//heroes if we have already selected heroes. 
	if(progress > 1)
	{
		chosenHeroes = heroes;
	}	
	
	switch(progress)
	{
		//initial player identification
		case 0:
			playerName = getPlayerName();
			choice = chooseSaveFile();
			saveFileData(choice, choiceToFile(choice-1), NULL, playerName, 1);
		//hero selection
		case 1:
			chosenHeroes = pickHeroes(heroes);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 2);
			free(heroes);
		//equip heroes with items 
		case 2:
			//shop
			s = loadShop();
			//Maybe?
			//testShop(s);
			goShopping(chosenHeroes, s);
			saveFileData(choice, choiceToFile(choice-1), chosenHeroes, playerName, 3);
		//fight the boss (a boss? Maybe find some way to get more than one boss in there?)
		case 3: 
			printHeroes(chosenHeroes, NUMCHOSENHEROES);
			freeHeroesAndItems(chosenHeroes);
			//fight	
			break;
		default:
			//What?
			printf("Something fatal happened with the progress value. Check gamestate.txt.\n");
			break;
	}
	
	printf("\n\n**********Until Next Homework!*************\n\n");

	//I don't actually remember why I did this, but it works. 
	//I think because if it's a save file, it's freed elsewhere?
	if(initialprogress == 0)
	{
		free(playerName);
	}
	return;
}