Exemple #1
0
void ToHitStats::dump() const
{
	StringBuffer buffer;
	buffer.appendFormatted("Debugdump of ToHit of %s:\n", Owner->GetName(1));
	buffer.appendFormatted("TOTAL: %d\n", total);
	buffer.appendFormatted("Base: %2d\tGeneric: %d\tAbility: %d\n", base, genericBonus, abilityBonus);
	buffer.appendFormatted("Armor: %d\tShield: %d\n", armorBonus, shieldBonus);
	buffer.appendFormatted("Weapon: %d\tProficiency: %d\n\n", weaponBonus, proficiencyBonus);
	Log(DEBUG, "ToHit", buffer);
}
Exemple #2
0
void ArmorClass::dump() const
{
	StringBuffer buffer;
	buffer.appendFormatted("Debugdump of ArmorClass of %s:\n", Owner->GetName(1));
	buffer.appendFormatted("TOTAL: %d\n", total);
	buffer.appendFormatted("Natural: %d\tGeneric: %d\tDeflection: %d\n", natural, genericBonus, deflectionBonus);
	buffer.appendFormatted("Armor: %d\tShield: %d\n", armorBonus, shieldBonus);
	buffer.appendFormatted("Dexterity: %d\tWisdom: %d\n\n", dexterityBonus, wisdomBonus);
	Log(DEBUG, "ArmorClass", buffer);
}
Exemple #3
0
static void PrintPossibleFiles(StringBuffer& buffer, const char* ResRef, const TypeID *type)
{
	const std::vector<ResourceDesc>& types = PluginMgr::Get()->GetResourceDesc(type);
	for (size_t j = 0; j < types.size(); j++) {
		buffer.appendFormatted("%s.%s ", ResRef, types[j].GetExt());
	}
}
Exemple #4
0
void Door::dump() const
{
	StringBuffer buffer;
	buffer.appendFormatted( "Debugdump of Door %s:\n", GetScriptName() );
	buffer.appendFormatted( "Door Global ID: %d\n", GetGlobalID());
	buffer.appendFormatted( "Position: %d.%d\n", Pos.x, Pos.y);
	buffer.appendFormatted( "Door Open: %s\n", YESNO(IsOpen()));
	buffer.appendFormatted( "Door Locked: %s	Difficulty: %d\n", YESNO(Flags&DOOR_LOCKED), LockDifficulty);
	buffer.appendFormatted( "Door Trapped: %s	Difficulty: %d\n", YESNO(Trapped), TrapRemovalDiff);
	if (Trapped) {
		buffer.appendFormatted( "Trap Permanent: %s Detectable: %s\n", YESNO(Flags&DOOR_RESET), YESNO(Flags&DOOR_DETECTABLE) );
	}
	buffer.appendFormatted( "Secret door: %s (Found: %s)\n", YESNO(Flags&DOOR_SECRET),YESNO(Flags&DOOR_FOUND));
	const char *Key = GetKey();
	const char *name = "NONE";
	if (Scripts[0]) {
		name = Scripts[0]->GetName();
	}
	buffer.appendFormatted( "Script: %s, Key (%s) removed: %s, Dialog: %s\n", name, Key?Key:"NONE", YESNO(Flags&DOOR_KEY), Dialog );

	Log(DEBUG, "Door", buffer);
}
Exemple #5
0
bool ResourceManager::Exists(const char *ResRef, const TypeID *type, bool silent) const
{
	if (ResRef[0] == '\0')
		return false;
	// TODO: check various caches
	const std::vector<ResourceDesc> &types = PluginMgr::Get()->GetResourceDesc(type);
	for (size_t j = 0; j < types.size(); j++) {
		for (size_t i = 0; i < searchPath.size(); i++) {
			if (searchPath[i]->HasResource(ResRef, types[j])) {
				return true;
			}
		}
	}
	if (!silent) {
		StringBuffer buffer;
		buffer.appendFormatted("Couldn't find '%s'... ", ResRef);
		buffer.append("Tried ");
		PrintPossibleFiles(buffer, ResRef,type);
		Log(WARNING, "ResourceManager", buffer);
	}
	return false;
}
Exemple #6
0
Resource* ResourceManager::GetResource(const char* ResRef, const TypeID *type, bool silent, bool useCorrupt) const
{
	if (ResRef[0] == '\0')
		return NULL;
	if (!silent) {
		Log(MESSAGE, "ResourceManager", "Searching for '%s'...", ResRef);
	}
	const std::vector<ResourceDesc> &types = PluginMgr::Get()->GetResourceDesc(type);
	for (size_t j = 0; j < types.size(); j++) {
		for (size_t i = 0; i < searchPath.size(); i++) {
			DataStream *str = searchPath[i]->GetResource(ResRef, types[j]);
			if (!str && useCorrupt && core->UseCorruptedHack) {
				// don't look at other paths if requested
				core->UseCorruptedHack = false;
				return NULL;
			}
			core->UseCorruptedHack = false;
			if (str) {
				Resource *res = types[j].Create(str);
				if (res) {
					if (!silent) {
						Log(MESSAGE, "ResourceManager", "Found '%s.%s' in '%s'.",
							ResRef, types[j].GetExt(), searchPath[i]->GetDescription());
					}
					return res;
				}
			}
		}
	}
	if (!silent) {
		StringBuffer buffer;
		buffer.appendFormatted("Couldn't find '%s'... ", ResRef);
		buffer.append("Tried ");
		PrintPossibleFiles(buffer, ResRef,type);
		Log(WARNING, "ResourceManager", buffer);
	}
	return NULL;
}
Exemple #7
0
void InfoPoint::dump() const
{
	StringBuffer buffer;
	switch (Type) {
		case ST_TRIGGER:
			buffer.appendFormatted( "Debugdump of InfoPoint Region %s:\n", GetScriptName() );
			break;
		case ST_PROXIMITY:
			buffer.appendFormatted( "Debugdump of Trap Region %s:\n", GetScriptName() );
			break;
		case ST_TRAVEL:
			buffer.appendFormatted( "Debugdump of Travel Region %s:\n", GetScriptName() );
			break;
		default:
			buffer.appendFormatted( "Debugdump of Unsupported Region %s:\n", GetScriptName() );
			break;
	}
	buffer.appendFormatted( "Region Global ID: %d\n", GetGlobalID());
	buffer.appendFormatted( "Position: %d.%d\n", Pos.x, Pos.y);
	buffer.appendFormatted( "TalkPos: %d.%d\n", TalkPos.x, TalkPos.y);
	buffer.appendFormatted( "UsePoint: %d.%d  (on: %s)\n", UsePoint.x, UsePoint.y, YESNO(GetUsePoint()));
	switch(Type) {
	case ST_TRAVEL:
		buffer.appendFormatted( "Destination Area: %s Entrance: %s\n", Destination, EntranceName);
		break;
	case ST_PROXIMITY:
		buffer.appendFormatted( "TrapDetected: %d, Trapped: %s\n", TrapDetected, YESNO(Trapped));
		buffer.appendFormatted( "Trap detection: %d%%, Trap removal: %d%%\n", TrapDetectionDiff,
			TrapRemovalDiff );
		break;
	case ST_TRIGGER:
		buffer.appendFormatted ( "InfoString: %ls\n", OverheadText.c_str() );
		break;
	default:;
	}
	const char *name = "NONE";
	if (Scripts[0]) {
		name = Scripts[0]->GetName();
	}
	buffer.appendFormatted( "Script: %s, Key: %s, Dialog: %s\n", name, KeyResRef, Dialog );
	buffer.appendFormatted( "Deactivated: %s\n", YESNO(Flags&TRAP_DEACTIVATED));
	buffer.appendFormatted( "Active: %s\n", YESNO(InternalFlags&IF_ACTIVE));
	Log(DEBUG, "InfoPoint", buffer);
}