コード例 #1
0
ファイル: NWNXdmactions.cpp プロジェクト: BhaalM/nwnx2-linux
int CNWNXdmactions::FireAction(nwn_objid_t pDM, int nAction) {
	this->bPrevent= 0;
	this->nActionID = nAction;

	if (nAction < 0 || nAction >= NUM_ACTIONS || ActionsScripts[nAction] == NULL) {
		return 0;
	}
	Log(3, "o Fired action %d (%08lX). Calling '%s'\n", nAction, pDM, ActionsScripts[nAction]);
	this->InScript = 1;
	nwn_ExecuteScript(ActionsScripts[nAction], pDM);
	this->InScript = 0;


    this->nActionID = 0;
    this->oTarget1 = OBJECT_INVALID;
    this->oTarget2 = OBJECT_INVALID;
	this->nParam1 = 0;
	this->nParam2 = 0;
	this->sParam1[0] = 0;
	this->nCount = 0;
	this->nCurrent = 0;

	return this->bPrevent;
}
コード例 #2
0
ファイル: Hooks.cpp プロジェクト: NWNX/nwnx2-linux
static uint8_t Local_GetMeetsPrestigeClassRequirements()
{
    if (strncmp(GMPCR_pString->text, "SKILL", 5) == 0) {
        return 1;
    } else if (strncmp(GMPCR_pString->text, "SPECIALIST", 10) == 0) {
        int spec;
        if (C2DA__GetINTEntry((C2DA *)GMPCR_p2DA, GMPCR_row, GMPCR_p1, &spec)) {
            int i;
            for (i = 0; i < pCreatureStats->cs_classes_len; i++) {
                if (pCreatureStats->cs_classes[i].cl_class == CLASS_TYPE_WIZARD) {
                    if (pCreatureStats->cs_classes[i].cl_specialist == spec) {
                        return 2;
                    }
                    break;
                }
            }
            return 3;
        }
    } else if (strncmp(GMPCR_pString->text, "DIVSPELL", 8) == 0) {
        int lvl;
        if (C2DA__GetINTEntry((C2DA *)GMPCR_p2DA, GMPCR_row, GMPCR_p1, &lvl)) {
            int i;
            for (i = 0; i < pCreatureStats->cs_classes_len; i++) {
                if (pCreatureStats->cs_classes[i].cl_class == CLASS_TYPE_DRUID ||
                        pCreatureStats->cs_classes[i].cl_class == CLASS_TYPE_CLERIC ||
                        pCreatureStats->cs_classes[i].cl_class == CLASS_TYPE_PALADIN ||
                        pCreatureStats->cs_classes[i].cl_class == CLASS_TYPE_RANGER) {

                    int splslots = pCreatureStats->cs_classes[i].cl_spells_max[lvl];

                    if (splslots == 0)
                        splslots = pCreatureStats->cs_classes[i].cl_spells_mem[lvl].len;
                    if (splslots > 0) {
                        return 2;
                    }
                    break;
                }

            }
            return 3;
        }
    } else if (strncmp(GMPCR_pString->text, "RACENOT", 7) == 0) {
        int race;
        if (C2DA__GetINTEntry((C2DA *)GMPCR_p2DA, GMPCR_row, GMPCR_p1, &race)) {
            if (race == pCreatureStats->cs_race) {
                return 3;
            }
        }
        return 2;
    } else if (strncmp(GMPCR_pString->text, "SCRIPT", 6) == 0) {
        CExoString *script = (CExoString *) malloc(sizeof(CExoString));
        script->text = NULL;
        script->len = 0;
        if (script != NULL) {
            if (C2DA__GetCExoStringEntry((C2DA *)GMPCR_p2DA, GMPCR_row, GMPCR_p1, script)) {
                extend.ScriptResult = 0;
                nwn_ExecuteScript(script->text, pCreatureStats->cs_original->obj.obj_id);
                if (extend.ScriptResult) {
                    return 3;
                }
            }
            free(script);
        }
    }
    return 0;
}