Exemplo n.º 1
0
void Engine::_loadModScenarios() {
    addScenario(new GuanduScenario());
    addScenario(new CoupleScenario());
    addScenario(new FanchengScenario());
    addScenario(new ZombieScenario());
    addScenario(new ImpasseScenario());
}
Exemplo n.º 2
0
void Engine::addScenario(const QString &name){
    Scenario *scenario = ScenarioAdder::scenarios()[name];
    if(scenario)
        addScenario(scenario);
    else
        qWarning("Scenario %s cannot be loaded!", qPrintable(name));
}
Exemplo n.º 3
0
void Engine::addScenario(const QString &name){
    typedef Scenario * (*scenario_creator)();
    scenario_creator creator = GetSymbol<scenario_creator>(lib, name.toAscii());

    if(creator){
        addScenario(creator());
    }else
        qWarning("Scenario %s cannot be loaded!", qPrintable(name));
}
Exemplo n.º 4
0
Engine::Engine()
{
    Sanguosha = this;

    lua = CreateLuaState();
    DoLuaScript(lua, "lua/config.lua");

    QStringList package_names = GetConfigFromLuaState(lua, "package_names").toStringList();
    foreach(QString name, package_names)
        if(name != "ThreeKingdoms")
            addPackage(name);

    addPackage("ThreeKingdoms");

    QStringList scene_names = GetConfigFromLuaState(lua, "scene_names").toStringList();
    foreach(QString name, scene_names)
        addScenario(name);

    DoLuaScript(lua, "lua/sanguosha.lua");

    // available game modes
    modes["02p"] = tr("2 players");
    //modes["02pbb"] = tr("2 players (using blance beam)");
    modes["02_1v1"] = tr("2 players (KOF style)");
    modes["03p"] = tr("3 players");
    modes["03_3kingdoms"] = tr("3 players(3 kingdoms mode)");
    modes["04p"] = tr("4 players");
    modes["04_1v3"] = tr("4 players (Hulao Pass)");
    modes["05p"] = tr("5 players");
    modes["06p"] = tr("6 players");
    modes["06_3v3"] = tr("6 players (3v3)");
    modes["06pd"] = tr("6 players (2 renegades)");
    modes["07p"] = tr("7 players");
    modes["08p"] = tr("8 players");
    modes["08pd"] = tr("8 players (2 renegades)");
    modes["08pz"] = tr("8 players (0 renegade)");
    modes["09p"] = tr("9 players");
    modes["10pd"] = tr("10 players");
    modes["10p"] = tr("10 players (1 renegade)");
    modes["10pz"] = tr("10 players (0 renegade)");

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));



    foreach(QString ban, getBanPackages()){
        addBanPackage(ban);
    }
Exemplo n.º 5
0
Engine::Engine()
{
    Sanguosha = this;

    lua = CreateLuaState();
    DoLuaScript(lua, "lua/config.lua");

    QStringList package_names = GetConfigFromLuaState(lua, "package_names").toStringList();
    foreach(QString name, package_names)
        addPackage(name);

    QStringList scene_names = GetConfigFromLuaState(lua, "scene_names").toStringList();
    foreach(QString name, scene_names)
        addScenario(name);

    DoLuaScript(lua, "lua/sanguosha.lua");

    // available game modes
    modes["02p"] = tr("2 players");
    //modes["02pbb"] = tr("2 players (using blance beam)");
    modes["02_1v1"] = tr("2 players (KOF style)");
    modes["03p"] = tr("3 players");
    modes["04p"] = tr("4 players");
    modes["04_1v3"] = tr("4 players (Hulao Pass)");
    modes["05p"] = tr("5 players");
    modes["05_2v3"] = tr("5 players (Changban Slope)");
    modes["06p"] = tr("6 players");
    modes["06pd"] = tr("6 players (2 renegades)");
    modes["06_3v3"] = tr("6 players (3v3)");
    modes["07p"] = tr("7 players");
    modes["08p"] = tr("8 players");
    modes["08pd"] = tr("8 players (2 renegades)");
    modes["08pz"] = tr("8 players (0 renegade)");
    modes["09p"] = tr("9 players");
    modes["10pd"] = tr("10 players");
    modes["10p"] = tr("10 players (1 renegade)");
    modes["10pz"] = tr("10 players (0 renegade)");

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));

    foreach(QString ban, getBanPackages())
        addBanPackage(ban);

    foreach(const Skill *skill, skills.values()){
        Skill *mutable_skill = const_cast<Skill *>(skill);
        mutable_skill->initMediaSource();
    }
}
void PICWeeklySettings::addScenarioData(const QString& scenario, const QString& geography, const QString& sector, const QString& Rating, int shock)
{
    addSector(sector);
    addGeog(geography);
    for (int i = 0; i < m_ShocksModel->rowCount();++i){
        const QModelIndex currIdx = m_ShocksModel->index(i, 0);
        if(currIdx.data().toString().compare(scenario,Qt::CaseInsensitive)==0){
            int shockRow = 0;
            for (; shockRow < m_ShocksModel->rowCount(currIdx); ++shockRow) {
                if (m_ShocksModel->index(shockRow, 0, currIdx).data().toString().compare(sector, Qt::CaseInsensitive) == 0 || (sector.isEmpty() && m_ShocksModel->index(shockRow, 0, currIdx).data(Qt::UserRole).toBool())) {
                    if (m_ShocksModel->index(shockRow, 1, currIdx).data().toString().compare(geography, Qt::CaseInsensitive) == 0 || (geography.isEmpty() && m_ShocksModel->index(shockRow, 1, currIdx).data(Qt::UserRole).toBool()))
                        break;
                }
            }
            if (shockRow == m_ShocksModel->rowCount(currIdx)) {
                m_ShocksModel->insertRow(shockRow, currIdx);
                if (sector.isEmpty()){
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 0, currIdx), tr("Any"));
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 0, currIdx), true, Qt::UserRole);
                }
                else {
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 0, currIdx), sector);
                }
                if (geography.isEmpty()) {
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 1, currIdx), tr("Any"));
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 1, currIdx), true, Qt::UserRole);
                }
                else {
                    m_ShocksModel->setData(m_ShocksModel->index(shockRow, 1, currIdx), geography);
                }
            }
            const int shockCol = findRating(Rating);
            m_ShocksModel->setData(m_ShocksModel->index(shockRow, shockCol, currIdx), shock);
            return;
        }
    }
    addScenario(scenario);
    addScenarioData(scenario, geography, sector, Rating, shock);
}
Exemplo n.º 7
0
Engine::Engine()
{
    Sanguosha = this;

    QStringList package_names;
    package_names << "StandardCard"
                  << "StandardExCard"
                  << "Maneuvering"
                  << "SPCard"
                  << "YitianCard"
                  << "Nostalgia"
                  << "Joy"
                  << "Disaster"
                  << "JoyEquip"
                  << "DishaCard"
                  << "QHSEquip"
                  << "Hide"

                  << "Standard"
                  << "Wind"
                  << "Fire"
                  << "Thicket"
                  << "Mountain"
                  << "God"
                  << "SP"
                  << "YJCM"
                  << "YJCM2012"
                  << "Special3v3"
                  << "BGM"
                  << "Yitian"
                  << "Wisdom"
                  << "Huangjin"
                  << "Ghost"
                  << "QHS"
                  << "YJ1st"
                  << "TBdiy"
                  << "Yan"
                  << "ChangbanSlope"
                  << "Test" ;

    foreach(QString name, package_names)
        addPackage(name);

    QStringList scene_names;
    scene_names << "Guandu"
                << "Fancheng"
                << "Couple"
                << "Zombie"
                << "Impasse"
                << "Custom";

    for(int i=1; i<=21; i++){
        scene_names << QString("MiniScene_%1").arg(i, 2, 10, QChar('0'));
    }

    foreach(QString name, scene_names)
        addScenario(name);

    foreach(const Skill *skill, skills.values()){
        Skill *mutable_skill = const_cast<Skill *>(skill);
        mutable_skill->initMediaSource();
    }

    // available game modes
    modes["02p"] = tr("2 players");
    //modes["02pbb"] = tr("2 players (using blance beam)");
    modes["02_1v1"] = tr("2 players (KOF style)");
    modes["03p"] = tr("3 players");
    modes["04p"] = tr("4 players");
    modes["04_1v3"] = tr("4 players (Hulao Pass)");
    modes["05p"] = tr("5 players");
    modes["05_2v3"] = tr("5 players (Changban Slope)");
    modes["06p"] = tr("6 players");
    modes["06pd"] = tr("6 players (2 renegades)");
    modes["06_3v3"] = tr("6 players (3v3)");
    modes["07p"] = tr("7 players");
    modes["08p"] = tr("8 players");
    modes["08pd"] = tr("8 players (2 renegades)");
    modes["08pz"] = tr("8 players (0 renegade)");
    modes["08same"] = tr("8 players (same mode)");
    modes["09p"] = tr("9 players");
    modes["10pd"] = tr("10 players");
    modes["10p"] = tr("10 players (1 renegade)");
    modes["10pz"] = tr("10 players (0 renegade)");

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));

    QString error_msg;
    lua = createLuaState(false, error_msg);
    if(lua == NULL){
        QMessageBox::warning(NULL, tr("Lua script error"), error_msg);
        exit(1);
    }

    foreach(QString ban, getBanPackages()){
        addBanPackage(ban);
    }
Exemplo n.º 8
0
Engine::Engine()
{
    Sanguosha = this;

    lib = new QLibrary(qApp->applicationFilePath(), this);
    if(!lib->load()){
        qWarning("Package can not be loaded \n Error string: %s", qPrintable(lib->errorString()));
        exit(1);
    }

    QStringList package_names;
    package_names << "Standard"
                  << "Wind"
                  << "Fire"
                  << "Thicket"
                  << "Mountain"
                  << "God"
                  << "SP"
                  << "YJCM"
                  << "BGM"
                  << "Yitian"
                  << "Wisdom"
                  << "Test"

                  << "StandardCard"
                  << "StandardExCard"
                  << "Maneuvering"
                  << "SPCard"
                  << "YitianCard"
                  << "Nostalgia"
                  << "Joy"
                  << "Disaster"
                  << "JoyEquip";

    foreach(QString name, package_names)
        addPackage(name);

    QStringList scene_names;
    scene_names << "GuanduScenario"
                << "FanchengScenario"
                << "CoupleScenario"
                << "ZombieScenario"
                << "ImpasseScenario"
                << "CustomScenario";

    for(int i=1; i<=20; i++){
        scene_names << QString("MiniScene_%1").arg(i, 2, 10, QChar('0'));
    }

    foreach(QString name, scene_names)
        addScenario(name);

    // available game modes
    modes["02p"] = tr("2 players");
    //modes["02pbb"] = tr("2 players (using blance beam)");
    modes["02_1v1"] = tr("2 players (KOF style)");
    modes["03p"] = tr("3 players");
    modes["04p"] = tr("4 players");
    modes["04_1v3"] = tr("4 players (Hulao Pass)");
    modes["05p"] = tr("5 players");
    modes["06p"] = tr("6 players");
    modes["06pd"] = tr("6 players (2 renegades)");
    modes["06_3v3"] = tr("6 players (3v3)");
    modes["07p"] = tr("7 players");
    modes["08p"] = tr("8 players");
    modes["08pd"] = tr("8 players (2 renegades)");
    modes["08same"] = tr("8 players (same mode)");
    modes["09p"] = tr("9 players");
    modes["10p"] = tr("10 players");

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));

    QString error_msg;
    lua = createLuaState(false, error_msg);
    if(lua == NULL){
        QMessageBox::warning(NULL, tr("Lua script error"), error_msg);
        exit(1);
    }

    foreach(QString ban, getBanPackages()){
        addBanPackage(ban);
    }
Exemplo n.º 9
0
Engine::Engine()
{
    Sanguosha = this;

    addPackage(NewStandard());
    addPackage(NewWind());
    addPackage(NewFire());
    addPackage(NewThicket());
    addPackage(NewMountain());
    addPackage(NewGod());
    addPackage(NewSP());
    addPackage(NewYJCM());
    addPackage(NewYitian());
    // addPackage(NewWisdom());
    addPackage(NewTest());

    addPackage(NewStandardCard());
    addPackage(NewStandardExCard());
    addPackage(NewManeuvering());
    addPackage(NewYitianCard());
    addPackage(NewNostalgia());
    addPackage(NewJoy());
    addPackage(NewDisaster());
    addPackage(NewJoyEquip());

    addScenario(NewGuanduScenario());
    addScenario(NewFanchengScenario());
    addScenario(NewCoupleScenario());
    addScenario(NewHongyanScenario());
    addScenario(NewZombieScenario());
    addScenario(NewLegendScenario());
    addScenario(NewImpasseScenario());

    // available game modes
    modes["02p"] = tr("2 players");
    //modes["02pbb"] = tr("2 players (using blance beam)");
    modes["02_1v1"] = tr("2 players (KOF style)");
    modes["03p"] = tr("3 players");
    modes["04p"] = tr("4 players");
    modes["04_1v3"] = tr("4 players (Hulao Pass)");
    modes["05p"] = tr("5 players");
    modes["06p"] = tr("6 players");
    modes["06pd"] = tr("6 players (2 renegades)");
    modes["06_3v3"] = tr("6 players (3v3)");
    modes["07p"] = tr("7 players");
    modes["08p"] = tr("8 players");
    modes["08pd"] = tr("8 players (2 renegades)");
    modes["08boss"] = tr("8 players (boss mode)");
    modes["08same"] = tr("8 players (same mode)");
    modes["09p"] = tr("9 players");
    modes["10p"] = tr("10 players");

    //challenge_mode_set = NULL;
    challenge_mode_set = new ChallengeModeSet(this);
    //addPackage(challenge_mode_set);

    translations.insert("bossmode", tr("Boss mode"));

    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(deleteLater()));

    QString error_msg;
    lua = createLuaState(false, error_msg);
    if(lua == NULL){
        QMessageBox::warning(NULL, tr("Lua script error"), error_msg);
        exit(1);
    }
}