/* * Copyright 2008 Ben Boeckel * * 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 . */ // Header include #include "TrainerWrapper.h" // Sigscript includes #include "SigmodWrapper.h" Sigscript::TrainerWrapper* Sigscript::TrainerWrapper::create(const Sigmod::Trainer* trainer, SigmodWrapper* parent) { Signature sig = Signature(parent, Subsignature(trainer->className(), trainer->id())); if (!m_instances.contains(sig)) m_instances[sig] = new TrainerWrapper(trainer, parent); return qobject_cast(m_instances[sig]); } Sigscript::TrainerWrapper::TrainerWrapper(const Sigmod::Trainer* trainer, SigmodWrapper* parent) : ObjectWrapper(trainer, parent), m_trainer(trainer) { } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::intelligence(const QString& name) const { if (name == "Ignorant") return Sigmod::Trainer::Ignorant; else if (name == "Determine") return Sigmod::Trainer::Determine; else if (name == "Remember") return Sigmod::Trainer::Remember; else if (name == "Cheating") return Sigmod::Trainer::Cheating; return QVariant(-1).value(); } QString Sigscript::TrainerWrapper::TrainerWrapper::name() const { return m_trainer->name(); } int Sigscript::TrainerWrapper::TrainerWrapper::moneyFactor() const { ALLOW_OVERRIDE_SO(trainer, int, moneyFactor); return m_trainer->moneyFactor(); } Sigscript::SkinWrapper* Sigscript::TrainerWrapper::TrainerWrapper::skin() { return sigmod()->skin(m_trainer->skin()); } int Sigscript::TrainerWrapper::TrainerWrapper::depth() const { ALLOW_OVERRIDE_SO(trainer, int, depth); return m_trainer->depth(); } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::TrainerWrapper::teamIntel() const { return m_trainer->teamIntel(); } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::TrainerWrapper::moveIntel() const { return m_trainer->moveIntel(); } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::TrainerWrapper::itemIntel() const { return m_trainer->itemIntel(); } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::TrainerWrapper::abilityIntel() const { return m_trainer->abilityIntel(); } Sigmod::Trainer::Intelligence Sigscript::TrainerWrapper::TrainerWrapper::statIntel() const { return m_trainer->statIntel(); }