示例#1
0
void Functions::random(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = getRandom(0, ctx.getParams()[0].getInt() - 1);
}
示例#2
0
void Functions::intToFloat(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (float) ctx.getParams()[0].getInt();
}
示例#3
0
void Functions::vector(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn().setVector(ctx.getParams()[0].getFloat(),
	                          ctx.getParams()[1].getFloat(),
	                          ctx.getParams()[2].getFloat());
}
示例#4
0
void Functions::setGlobalNumber(Aurora::NWScript::FunctionContext &ctx) {
	Common::UString id = ctx.getParams()[0].getString();
	int value = ctx.getParams()[1].getInt();

	_game->getModule().setGlobalNumber(id, value);
}
示例#5
0
void Functions::actionSpeakString(Aurora::NWScript::FunctionContext &ctx) {
	NWN::Object *object = NWN::ObjectContainer::toObject(ctx.getCaller());

	if (object)
		object->speakString(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt());
}
示例#6
0
void Functions::printString(Aurora::NWScript::FunctionContext &ctx) {
	status("NWN2: %s", ctx.getParams()[0].getString().c_str());
}
示例#7
0
void Functions::objectToString(Aurora::NWScript::FunctionContext &ctx) {
	Aurora::NWScript::Object *object = ctx.getParams()[0].getObject();

	ctx.getReturn() = Common::UString::format("object<%s,%p)", formatTag(object).c_str(), (void *) object);
}
示例#8
0
void Functions::musicBackgroundGetNightTrack(Aurora::NWScript::FunctionContext &ctx) {
	Area *area = NWN2::ObjectContainer::toArea(getParamObject(ctx, 0));

	ctx.getReturn() = area ? (int32)area->getMusicNightTrack() : -1;
}
示例#9
0
void Functions::musicBackgroundChangeNight(Aurora::NWScript::FunctionContext &ctx) {
	Area *area = NWN2::ObjectContainer::toArea(getParamObject(ctx, 0));
	if (area)
		area->setMusicNightTrack(ctx.getParams()[1].getInt());
}
示例#10
0
void Functions::getTimeMinute(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = static_cast<int32>((EventMan.getTimestamp() / 1000) / 60);
}
示例#11
0
void Functions::getTimeMillisecond(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = static_cast<int32>(EventMan.getTimestamp());
}
示例#12
0
void Functions::writeTimestampedLogEntry(Aurora::NWScript::FunctionContext &ctx) {
	const Common::UString tstamp = Common::DateTime(Common::DateTime::kUTC).formatDateTimeISO('T', '-', ':');

	status("NWN2: %s: %s", tstamp.c_str(), ctx.getParams()[0].getString().c_str());
}
示例#13
0
void Functions::getIsOpen(Aurora::NWScript::FunctionContext &ctx) {
	Situated *situated = ObjectContainer::toSituated(getParamObject(ctx, 0));

	ctx.getReturn() = situated ? situated->isOpen() : 0;
}
示例#14
0
void Functions::setLocked(Aurora::NWScript::FunctionContext &ctx) {
	Situated *situated = ObjectContainer::toSituated(getParamObject(ctx, 0));
	if (situated)
		situated->setLocked(ctx.getParams()[1].getInt() != 0);
}
示例#15
0
void Functions::getStringByStrRef(Aurora::NWScript::FunctionContext &ctx) {
	const uint32 strRef = (uint32) ctx.getParams()[0].getInt();
	const Aurora::LanguageGender gender = (Aurora::LanguageGender) ctx.getParams()[1].getInt();

	ctx.getReturn() = TalkMan.getString(strRef, gender);
}
示例#16
0
void Functions::intToString(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = Common::composeString(ctx.getParams()[0].getInt());
}
示例#17
0
void Functions::printInteger(Aurora::NWScript::FunctionContext &ctx) {
	status("NWN2: %d", ctx.getParams()[0].getInt());
}
示例#18
0
void Functions::intToHexString(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = Common::UString::format("0x%08x", (uint32) ctx.getParams()[0].getInt());
}
示例#19
0
void Functions::printObject(Aurora::NWScript::FunctionContext &ctx) {
	Aurora::NWScript::Object *object = ctx.getParams()[0].getObject();

	status("NWN2: object<%s,%p)", formatTag(object).c_str(), (void *) object);
}
示例#20
0
void Functions::stringToInt(Aurora::NWScript::FunctionContext &ctx) {
	int32 i = 0;
	Common::parseString(ctx.getParams()[0].getString(), i);

	ctx.getReturn() = i;
}
示例#21
0
void Functions::getGlobalNumber(Aurora::NWScript::FunctionContext &ctx) {
	Common::UString id = ctx.getParams()[0].getString();

	ctx.getReturn() = _game->getModule().getGlobalNumber(id);
}
示例#22
0
void Functions::stringToFloat(Aurora::NWScript::FunctionContext &ctx) {
	float f = 0;
	Common::parseString(ctx.getParams()[0].getString(), f);

	ctx.getReturn() = f;
}
示例#23
0
void Functions::actionCloseDoor(Aurora::NWScript::FunctionContext &ctx) {
	Door *door = NWN::ObjectContainer::toDoor(getParamObject(ctx, 0));
	if (door)
		door->close(NWN::ObjectContainer::toObject(ctx.getCaller()));
}
示例#24
0
void Functions::getStringLength(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (int32) ctx.getParams()[0].getString().size();
}
示例#25
0
void Functions::d100(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = getRandom(1, 100, ctx.getParams()[0].getInt());
}
示例#26
0
void Functions::getStringLowerCase(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = ctx.getParams()[0].getString().toLower();
}
示例#27
0
void Functions::floatToInt(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (int32) ctx.getParams()[0].getFloat();
}
示例#28
0
void Functions::findSubString(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (int32) -1;

	unimplementedFunction(ctx);
}
示例#29
0
void Functions::vectorMagnitude(Aurora::NWScript::FunctionContext &ctx) {
	float x, y, z;
	ctx.getParams()[0].getVector(x, y, z);

	ctx.getReturn() = sqrtf(x*x + y*y + z*z);
}
示例#30
0
void Functions::sqrt(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = sqrtf(ctx.getParams()[0].getFloat());
}