mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-31 00:15:55 -04:00
Add JNI Methods for collectionSlotMaxValue & Warning
This commit is contained in:
@@ -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<int64>(slot->maxSlotValue);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
jobjectArray JNICALL ScriptMethodsCollectionNamespace::getAllCollectionSlotsInCollection(JNIEnv *env, jobject self, jstring collectionName)
|
||||
{
|
||||
UNREF(self);
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user