#include "mn_h_constants" /* Ved activering af portal: Tjek for midlertidig rang Hvis ingen midlertidig, tjek for falske pas, og find range. Ved normal og heightened alert, virker kun for >= Staff Hvis alert er Active, virker kun for >= Ally Hvis alert er Invasion, virker kun for >= Friend Set variabel "mn_tempteleport" lokalt på oPC - enten 0 (inactive), 1 (local), 2 ( global ) eller 3 (both) Set variabel "mn_temptelerank" lokalt på oPC lig den angivne rang. Kald konversation */ void SetVariables(object oPC, int type, int rank) { SetLocalInt( oPC, "mn_tempteleport", type ); SetLocalInt( oPC, "mn_temptelerank", rank ); } void confinePC( object oPC, int crime ) { location telepoint = GetLocation (GetObjectByTag ("MN_TELEPRISON") ); AssignCommand( oPC, ClearAllActions() ); AssignCommand( oPC, ActionJumpToLocation( telepoint ) ); } void SetAlert( int alert ) { SetLocalInt( GetArea( OBJECT_SELF ), "alert_status", alert ); // gennemloeb og opdater alle alarmlamper SetCampaignInt( MN_HOUSE_DB, "alert_status", alert ); } void main() { int iResult = FALSE; object oPC = GetLastUsedBy(); int authenticRank = 0; int forgedRank = 0; object forgedPass; int alertStatus = GetLocalInt( GetArea( OBJECT_SELF ), "alert_status" ); if ( GetIsPC( oPC ) ) { object pass; pass = GetItemPossessedBy( oPC, "MN_I_PCACCESS" ); string cid = GetLocalString( oPC, "cid" ); string lid; int rank; int corrupted; if (pass == OBJECT_INVALID) { // No pass at all return; } // Loop to find the ranks to be used for the following comparison pass = GetFirstItemInInventory( oPC ); while ( pass != OBJECT_INVALID ) { if (GetTag( pass ) == "MN_I_PCACCESS" ) { lid = GetLocalString( pass, "tied_to" ); rank = GetLocalInt( pass, "rank" ); corrupted = GetLocalInt( pass, "corrupted" ); if ( !corrupted && lid == cid ) { if ( authenticRank < rank ) { authenticRank = rank; } } if ( corrupted && lid == cid ) { if (forgedRank < rank ) { forgedRank = rank; forgedPass = pass; } } } pass = GetNextItemInInventory( oPC ); } if ( authenticRank == 0 && forgedRank == 0 ) { // Shouldn't happen, but just to make sure return; } // Now, decide if portal is disabled for player int compareRank; switch ( alertStatus ) { case MN_ALERT_NORMAL: compareRank = (authenticRank > forgedRank ) ? authenticRank : forgedRank; SetVariables( oPC, 1, compareRank ); break; case MN_ALERT_HEIGHTENED: if (forgedRank > 0) { SetPlotFlag( forgedPass, FALSE ); DestroyObject( forgedPass ); SetAlert( MN_ALERT_ACTIVE ); confinePC( oPC, MN_CRIME_FALSEPASS ); return; } SetVariables( oPC, 1, authenticRank ); break; case MN_ALERT_ACTIVE: if (forgedRank > 0) { SetPlotFlag( forgedPass, FALSE ); DestroyObject( forgedPass ); confinePC( oPC, MN_CRIME_FALSEPASS ); return; } if ( authenticRank >= MN_RANK_ALLY ) { SetVariables( oPC, 1, authenticRank ); } else { SetVariables( oPC, 0, 0 ); } break; case MN_ALERT_INVASION: if (forgedRank > 0) { SetPlotFlag( forgedPass, FALSE ); DestroyObject( forgedPass ); SetAlert( MN_ALERT_ACTIVE ); confinePC( oPC, MN_CRIME_FALSEPASS ); return; } if ( authenticRank >= MN_RANK_FRIEND ) { SetVariables( oPC, 1, authenticRank ); } else { SetVariables( oPC, 0, 0 ); } break; } // Now start conversation with portal. object oTarget; oTarget = OBJECT_SELF; AssignCommand(oTarget, ActionStartConversation(oPC, "", TRUE, FALSE)); } }