diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCollection.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCollection.cpp index 69c08716..080d7994 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCollection.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCollection.cpp @@ -43,6 +43,7 @@ namespace ScriptMethodsCollectionNamespace jobjectArray JNICALL getCollectionSlotCategoryInfo(JNIEnv *env, jobject self, jstring slotName); jobjectArray JNICALL getCollectionSlotPrereqInfo(JNIEnv *env, jobject self, jstring slotName); jstring JNICALL getCollectionSlotName(JNIEnv *env, jobject self, jint collectionSlotId); + jlong JNICALL getCollectionSlotMaxValue(JNIEnv *env, jobject self, jstring slotName); jobjectArray JNICALL getAllCollectionSlotsInCollection(JNIEnv *env, jobject self, jstring collectionName); jobjectArray JNICALL getAllCollectionSlotsInPage(JNIEnv *env, jobject self, jstring pageName); jobjectArray JNICALL getAllCollectionsInPage(JNIEnv *env, jobject self, jstring pageName); @@ -89,6 +90,7 @@ bool ScriptMethodsCollectionNamespace::install() JF("getCollectionSlotCategoryInfo", "(Ljava/lang/String;)[Ljava/lang/String;", getCollectionSlotCategoryInfo), JF("getCollectionSlotPrereqInfo", "(Ljava/lang/String;)[Ljava/lang/String;", getCollectionSlotPrereqInfo), JF("getCollectionSlotName", "(I)Ljava/lang/String;", getCollectionSlotName), + JF("getCollectionSlotMaxValue", "(Ljava/lang/String;)J", getCollectionSlotMaxValue), JF("getAllCollectionSlotsInCollection", "(Ljava/lang/String;)[Ljava/lang/String;", getAllCollectionSlotsInCollection), JF("getAllCollectionSlotsInPage", "(Ljava/lang/String;)[Ljava/lang/String;", getAllCollectionSlotsInPage), JF("getAllCollectionsInPage", "(Ljava/lang/String;)[Ljava/lang/String;", getAllCollectionsInPage), @@ -632,6 +634,23 @@ jstring JNICALL ScriptMethodsCollectionNamespace::getCollectionSlotName(JNIEnv * // ---------------------------------------------------------------------- +jlong JNICALL ScriptMethodsCollectionNamespace::getCollectionSlotMaxValue(JNIEnv *env, jobject self, jstring slotName) +{ + UNREF(self); + + JavaStringParam localSlotName(slotName); + std::string slotNameString; + JavaLibrary::convert(localSlotName, slotNameString); + + CollectionsDataTable::CollectionInfoSlot const * slot = CollectionsDataTable::getSlotByName(slotNameString); + if (!slot) + return -1; + + return static_cast(slot->maxSlotValue); +} + +// ---------------------------------------------------------------------- + jobjectArray JNICALL ScriptMethodsCollectionNamespace::getAllCollectionSlotsInCollection(JNIEnv *env, jobject self, jstring collectionName) { UNREF(self); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp index 7dda71ba..47c662cf 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp @@ -31,6 +31,7 @@ namespace ScriptMethodsSystemNamespace void JNICALL saveBytesOnClient(JNIEnv * env, jobject self, jlong jclient, jstring jfilename, jbyteArray bytes); void JNICALL launchClientWebBrowser(JNIEnv *env, jobject self, jlong player, jstring url); void JNICALL playCutScene(JNIEnv * env, jobject self, jlong jclient, jstring jfilename); + void JNICALL triggerServerWarning(JNIEnv * env, jobject self, jstring message); } @@ -49,6 +50,7 @@ const JNINativeMethod NATIVES[] = { JF("_saveBytesOnClient", "(JLjava/lang/String;[B)V", saveBytesOnClient), JF("_launchClientWebBrowser", "(JLjava/lang/String;)V", launchClientWebBrowser), JF("_playCutScene", "(JLjava/lang/String;)V", playCutScene), + JF("_triggerServerWarning", "(Ljava/lang/String;)V", triggerServerWarning), }; return JavaLibrary::registerNatives(NATIVES, sizeof(NATIVES)/sizeof(NATIVES[0])); @@ -234,5 +236,15 @@ void JNICALL ScriptMethodsSystemNamespace::playCutScene(JNIEnv * env, jobject se } } +// ---------------------------------------------------------------------- + +void JNICALL ScriptMethodsSystemNamespace::triggerServerWarning(JNIEnv * env, jobject self, jstring message) +{ + JavaStringParam localMessage(message); + std::string messageString; + JavaLibrary::convert(localMessage, messageString); + WARNING(true, (messageString.c_str())); +} + // ======================================================================