mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
67 lines
1.4 KiB
Plaintext
67 lines
1.4 KiB
Plaintext
// senate cell
|
|
include library.utils;
|
|
|
|
const string JEDI_ROOM_PERMISSIONS_TABLE = "datatables/pvp/jedi_enclave_room_permissions.iff";
|
|
const string DATA_COLUMN_COMMUNITY_CELLS = "_community_cells";
|
|
|
|
trigger OnAboutToReceiveItem(obj_id srcContainer, obj_id transferer, obj_id item)
|
|
{
|
|
if(checkCellPermission(item, self, false))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
|
|
//
|
|
// check to see if @item has access permission for @cell
|
|
//
|
|
boolean checkCellPermission(obj_id item, obj_id cell, boolean silent)
|
|
{
|
|
if(!isIdValid(item))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(isGod(item))
|
|
{
|
|
sendSystemMessageTestingOnly(item, "god access granted to this area");
|
|
return true;
|
|
}
|
|
|
|
if(!isMob(item))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
obj_id enclave = getTopMostContainer(cell);
|
|
|
|
string alignment = "light";
|
|
string cellName = getCellName(cell);
|
|
string columnName = alignment + "_" + cellName;
|
|
|
|
if(isPlayer(item))
|
|
{
|
|
string[] commonsAreaCells = dataTableGetStringColumn(JEDI_ROOM_PERMISSIONS_TABLE, alignment + DATA_COLUMN_COMMUNITY_CELLS);
|
|
|
|
if(utils.getElementPositionInArray(commonsAreaCells, cellName) > -1)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
int[] allowedRanks = dataTableGetIntColumnNoDefaults(JEDI_ROOM_PERMISSIONS_TABLE, columnName);
|
|
|
|
int rank = getIntObjVar(item, "senator_rank");
|
|
|
|
if(utils.getElementPositionInArray(allowedRanks, rank) >= 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
} |