void Creature::loadProperties(const Aurora::GFF3Struct &gff) { // Tag _tag = gff.getString("Tag", _tag); // Name Aurora::LocString firstName; gff.getLocString("FirstName", firstName); Aurora::LocString lastName; gff.getLocString("LastName", lastName); if (!firstName.empty()) { _name = firstName.getString(); if (!lastName.empty()) _name += " " + lastName.getString(); } // Description _description = gff.getString("Description", _description); // Portrait loadPortrait(gff); // Equipment loadEquipment(gff); // Appearance _appearance = gff.getUint("Appearance_Type", _appearance); // Static _static = gff.getBool("Static", _static); // Usable _usable = gff.getBool("Useable", _usable); // PC _isPC = gff.getBool("IsPC", _isPC); // Gender _gender = Gender(gff.getUint("Gender")); // Race _race = Race(gff.getSint("Race", _race)); _subRace = SubRace(gff.getSint("SubraceIndex", _subRace)); // Hit Points _currentHitPoints = gff.getSint("CurrentHitPoints", _maxHitPoints); _maxHitPoints = gff.getSint("MaxHitPoints", _currentHitPoints); _minOneHitPoint = gff.getBool("Min1HP", _minOneHitPoint); // Faction _faction = Faction(gff.getUint("FactionID")); // Scripts readScripts(gff); _conversation = gff.getString("Conversation", _conversation); }
void Functions::changeToStandardFaction(Aurora::NWScript::FunctionContext &ctx) { Object *object = ObjectContainer::toObject(ctx.getParams()[0].getObject()); int faction = ctx.getParams()[1].getInt(); if (!object) throw Common::Exception("Functions::changeToStandardFaction(): Invalid object"); object->setFaction(Faction(faction)); }
/*! * \brief Exemple de simulation avec 2 factions */ void World::test2factions(){ //Creation of two initial factions factions_.push_back(Faction(*this,"Red")); factions_.back().init(); factions_.back().set_motherland_symbol('R'); factions_.back().set_colony_symbol('r'); factions_.back().set_colony_color_name("red"); factions_.back().set_motherland_color_name("darkRed"); Faction& red = factions_.back(); factions_.push_back(Faction(*this, "Blue")); factions_.back().init(); factions_.back().set_motherland_symbol('B'); factions_.back().set_colony_symbol('b'); factions_.back().set_colony_color_name("blue"); factions_.back().set_motherland_color_name("darkBlue"); Faction& blue = factions_.back(); if (DEBUG) { cout << "Red on :\t (" << red.get_motherland_()->pos_x() << "," << red.get_motherland_()->pos_y() << ")" << endl; cout << "Blue on :\t (" << blue.get_motherland_()->pos_x() << "," << blue.get_motherland_()->pos_y() << ")" << endl; } }
/*! * \brief Exemple de simulation avec 4 factions */ void World::test4factions(){ //Creation of four initial factions test3factions(); factions_.push_back(Faction(*this, "Yellow")); factions_.back().init(); factions_.back().set_motherland_symbol('Y'); factions_.back().set_colony_symbol('y'); factions_.back().set_colony_color_name("yellow"); factions_.back().set_motherland_color_name("darkYellow"); Faction& yellow = factions_.back(); if (DEBUG) { cout << yellow.get_name() << " on :\t (" << yellow.get_motherland_()->pos_x() << "," << yellow.get_motherland_()->pos_y() << ")" << endl; } }
/*! * \brief Exemple de simulation avec 3 factions */ void World::test3factions(){ //Creation of three initial factions test2factions(); factions_.push_back(Faction(*this, "Green")); factions_.back().init(); factions_.back().set_motherland_symbol('G'); factions_.back().set_colony_symbol('g'); factions_.back().set_colony_color_name("green"); factions_.back().set_motherland_color_name("darkGreen"); Faction& green = factions_.back(); if (DEBUG) { cout << green.get_name() << " on :\t (" << green.get_motherland_()->pos_x() << "," << green.get_motherland_()->pos_y() << ")" << endl; } }