Crossfire Server, Trunk
CREMainWindow.cpp File Reference
#include <Qt>
#include <QtWidgets>
#include <CREMainWindow.h>
#include <CREResourcesWindow.h>
#include "CREMapInformationManager.h"
#include "CREExperienceWindow.h"
#include "QuestManager.h"
#include "MessageManager.h"
#include "CREReportDisplay.h"
#include "CREPixmap.h"
#include "CRESmoothFaceMaker.h"
#include "CREHPBarMaker.h"
#include "ResourcesManager.h"
#include "CRECombatSimulator.h"
#include "Quest.h"
#include "ScriptFileManager.h"
#include "FaceMakerDialog.h"
#include "EditMonstersDialog.h"
#include "global.h"
#include "sproto.h"
#include "image.h"
#include "assets.h"
#include "AssetsManager.h"
#include "CRESettings.h"
#include "LicenseManager.h"
+ Include dependency graph for CREMainWindow.cpp:

Go to the source code of this file.

Functions

static QString alchemyTable (const QString &skill, QStringList &noChance, QStringList &allIngredients)
 
static QString buildShopReport (const QString &title, const QStringList &types, const QList< CREMapInformation * > &maps, QStringList &items)
 
static QString monsterFight (archetype *monster, archetype *skill)
 
static int monsterFight (archetype *monster, archetype *skill, int level)
 
static int monsterFight (archetype *monster, archetype *skill, int level, int count)
 
static QString monsterTable (archetype *monster, QList< archetype * > skills)
 
void readDirectory (const QString &path, QHash< QString, QHash< QString, bool > > &states)
 
static QString reportSummon (const archetype *summon, const object *other, QString name)
 
static QString spellsTable (const QString &skill)
 

Variables

const DisplayMode displayModes []
 
const char * displayNames []
 
const char * displayTips []
 

Function Documentation

◆ alchemyTable()

static QString alchemyTable ( const QString &  skill,
QStringList &  noChance,
QStringList &  allIngredients 
)
static

◆ buildShopReport()

static QString buildShopReport ( const QString &  title,
const QStringList &  types,
const QList< CREMapInformation * > &  maps,
QStringList &  items 
)
static

Definition at line 1297 of file CREMainWindow.cpp.

References say::item, disinfect::map, maps, report::report(), and types.

Referenced by CREMainWindow::onReportShops().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monsterFight() [1/3]

static QString monsterFight ( archetype *  monster,
archetype *  skill 
)
static

Generate a report cell for player versus monster fight. Cell will contain the first level the player could defeat the monster. This level is determined via a kind of dichotomic search, trying levels and using the middle ground for next iteration.

Parameters
monstermonster being fighted.
skillwhat the player uses to fight the monster.
Returns
full HTML table line for the statistics.

Definition at line 1023 of file CREMainWindow.cpp.

References disinfect::count, delete_map(), has_been_loaded(), mapdef::in_memory, level, MAP_IN_MEMORY, say::max, Settings::max_level, monsterFight(), mapdef::reset_time, and settings.

+ Here is the call graph for this function:

◆ monsterFight() [2/3]

static int monsterFight ( archetype *  monster,
archetype *  skill,
int  level 
)
static

Simulates a fight between a player and a monster. Player is a dwarf, with low statistics, no equipment. A maximum of 50 rounds are fighted (can be changed by modifying 'limit').

Parameters
monsterevil guy being fighted.
skillwhat the player attacks the monster with.
levelwhat skill level to use.
Returns
1 if the player could kill the monster, 0 else.

Definition at line 892 of file CREMainWindow.cpp.

References spell_arrow::archetype, attack_ob(), pl::bed_x, pl::bed_y, delete_map(), do_some_living(), FABS, socket_struct::faces_sent, find_archetype(), fix_object(), FLAG_APPLIED, get_empty_map(), get_faces_count(), level, MAX_BUF, monster_do_living(), move_player(), pl::ob, object_create_arch(), object_free(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), altar_valkyrie::pl, pl::savebed_map, SET_FLAG, SK_TWO_HANDED_WEAPON, pl::socket, and test_map.

Referenced by monsterFight(), and monsterTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ monsterFight() [3/3]

static int monsterFight ( archetype *  monster,
archetype *  skill,
int  level,
int  count 
)
static

Simulates a fight between a player and a monster. Player is a dwarf, with low statistics, no equipment. A maximum of 50 rounds are fighted per round.

Parameters
monsterevil guy being fighted.
skillwhat the player attacks the monster with.
levelwhat skill level to use.
counthow many fights to simulate.
Returns
how many fights, on count, the player could kill the monster.

Definition at line 1005 of file CREMainWindow.cpp.

References disinfect::count, and monsterFight().

+ Here is the call graph for this function:

◆ monsterTable()

static QString monsterTable ( archetype *  monster,
QList< archetype * >  skills 
)
static

Generate an HTML table line for a player versus monster fight statistics.

Parameters
monsterwhat is being attacked.
skillslist of skills to fight with.
Returns
HTML line for the monster and skills.

Definition at line 1083 of file CREMainWindow.cpp.

References spell_arrow::archetype, and monsterFight().

+ Here is the call graph for this function:

◆ readDirectory()

void readDirectory ( const QString &  path,
QHash< QString, QHash< QString, bool > > &  states 
)

Definition at line 1401 of file CREMainWindow.cpp.

References mad_mage_user::file, give::name, python_event::path, and quests.

Referenced by CREMainWindow::onReportQuests().

+ Here is the caller graph for this function:

◆ reportSummon()

static QString reportSummon ( const archetype *  summon,
const object *  other,
QString  name 
)
static

Definition at line 1180 of file CREMainWindow.cpp.

References curse_on_apply::ac, FABS, level, MIN, give::name, object_get_value(), report::report(), and sstring.

Referenced by CREMainWindow::onReportSummon().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spellsTable()

static QString spellsTable ( const QString &  skill)
static

Definition at line 827 of file CREMainWindow.cpp.

References spell_arrow::archetype, AssetsManager::archetypes(), AssetsCollection< T, Key >::each(), getManager(), level, levels, report::report(), and spell_arrow::spells.

Referenced by CREMainWindow::onReportSpells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ displayModes

◆ displayNames

const char* displayNames[]
Initial value:
= {
"Resources",
"Artifacts",
"Archetypes",
"Treasures",
"Animations",
"Formulae",
"Faces",
"Maps",
"Quests",
"NPC dialogs",
"Scripts",
"Random maps",
"Messages",
"Facesets",
nullptr,
}

Definition at line 202 of file CREMainWindow.cpp.

Referenced by CREMainWindow::createMenus().

◆ displayTips

const char* displayTips[]
Initial value:
= {
"List all defined elements, except the experience table.",
"List all defined artifacts.",
"List all defined archetypes.",
"List all defined treasure lists.",
"List all defined animations.",
"List all defined alchemy recipes.",
"List all defined faces.",
"List all maps, with their region.",
"List all defined quests.",
"List all NPC dialogs in files.",
"List all scripts references in maps.",
"List all random maps.",
"Display all general messages.",
"Display all facesets.",
nullptr,
}

Definition at line 220 of file CREMainWindow.cpp.

Referenced by CREMainWindow::createMenus().

DisplayMaps
@ DisplayMaps
Definition: CREResourcesWindow.h:28
DisplayQuests
@ DisplayQuests
Definition: CREResourcesWindow.h:29
DisplayAll
@ DisplayAll
Definition: CREResourcesWindow.h:21
DisplayAnimations
@ DisplayAnimations
Definition: CREResourcesWindow.h:23
DisplayScripts
@ DisplayScripts
Definition: CREResourcesWindow.h:31
DisplayTreasures
@ DisplayTreasures
Definition: CREResourcesWindow.h:24
DisplayGeneralMessages
@ DisplayGeneralMessages
Definition: CREResourcesWindow.h:33
DisplayArtifacts
@ DisplayArtifacts
Definition: CREResourcesWindow.h:26
DisplayMessage
@ DisplayMessage
Definition: CREResourcesWindow.h:30
DisplayArchetypes
@ DisplayArchetypes
Definition: CREResourcesWindow.h:22
DisplayFacesets
@ DisplayFacesets
Definition: CREResourcesWindow.h:34
DisplayFormulae
@ DisplayFormulae
Definition: CREResourcesWindow.h:25
DisplayRandomMaps
@ DisplayRandomMaps
Definition: CREResourcesWindow.h:32
DisplayFaces
@ DisplayFaces
Definition: CREResourcesWindow.h:27