//::------------------------------------------------------------------------::// //:: Script: dk_handler ::// //:: Location: Standalone include file ::// //:: Description: Change these checks to match your items ResRefs ::// //:: Author: Darvin Kezar ::// //:: Created: 2002-12-16 ::// //::------------------------------------------------------------------------::// //::------------------------------------------------------------------------::// //:: Checks if the object is a plot item. ::// //::------------------------------------------------------------------------::// int GetIsPlot(object oObject) { string sRes = GetResRef(oObject); if(sRes == "elementalband" || sRes == "dragonsreward" || sRes == "dragoncall" || sRes == "it_impristone" || sRes == "kdbguildkey" || sRes == "choguildkey" || sRes == "kingsdiary" || sRes == "emotewand" || sRes == "ohstowerkey" || sRes == "cheat" || sRes == "wolfricchestkey" || sRes == "shame" || sRes == "yingyangcrystal" || sRes == "irdastone" || sRes == "lorddeimoskey" || sRes == "nasgarthstone" || sRes == "riftstone" || sRes == "crriftstone" || sRes == "clone_test_ring3" || sRes == "sarumroyalseal" || sRes == "sarumstone" || sRes == "pipes_peace" || sRes == "choparing" || sRes == "pathoflightring" || sRes == "playershandbook" || sRes == "cow_ring" || sRes == "haventowerkey" || sRes == "default" || sRes == "gsokey" || sRes == "tmfkey" || sRes == "tbnkey" || sRes == "yinyangarrow" || sRes == "yinyangavenger" || sRes == "yinyangbastard" || sRes == "yinyangbattlea" || sRes == "yinyangbodygua" || sRes == "yinyangbow" || sRes == "yinyangdivinea" || sRes == "yinyangdragonb" || sRes == "yinyangdruidst" || sRes == "yinyanggreatswo" || sRes == "yinyangguantlet" || sRes == "yinyangleathers" || sRes == "yinyangmace" || sRes == "yinyangmagetal" || sRes == "yinyangmask" || sRes == "yinyangmurderb" || sRes == "yinyangroguesc" || sRes == "yinyangshield" || sRes == "yinyangshroud" || sRes == "yinyangsickle" || sRes == "yinyangspellsh" || sRes == "swordofsinging" || sRes == "wings" || sRes == "armourwkd" || sRes == "dragonhelmwkd" || sRes == "wkdkey" || sRes == "it_guardstone") return TRUE; return FALSE; } //::------------------------------------------------------------------------::// //:: Checks if the object is an unique item. ::// //::------------------------------------------------------------------------::// int GetIsUnique(object oObject) { string sRes = GetResRef(oObject); if(sRes == "elementalband" || sRes == "dragonsreward" || sRes == "kdbguildkey" || sRes == "choguildkey" || sRes == "kingsdiary" || sRes == "banditlordshead" || sRes == "ohstowerkey" || sRes == "giantshead" || sRes == "statueofwater" || sRes == "statueofjade" || sRes == "statueofgold" || sRes == "statueofdeath" || sRes == "baltarhead" || sRes == "cugelhead" || sRes == "yingyangcrystal" || sRes == "dryadboots" || sRes == "dungeon_token" || sRes == "fairybottle" || sRes == "goblinhead" || sRes == "greenhead" || sRes == "palacekey" || sRes == "irdastone" || sRes == "kellshead" || sRes == "wolfricchestkey" || sRes == "lorddeimoskey" || sRes == "millersbaby" || sRes == "nasgarthstone" || sRes == "nurglehead" || sRes == "olinasball" || sRes == "riftstone" || sRes == "crriftstone" || sRes == "clone_test_ring3" || sRes == "sarumstone" || sRes == "warlordshead" || sRes == "pipes_peace" || sRes == "airgem" || sRes == "earthgem" || sRes == "firegem" || sRes == "watergem" || sRes == "choparing" || sRes == "pathoflightring" || sRes == "skullball" || sRes == "dragonorb" || sRes == "cow_ring" || sRes == "haventowerkey" || sRes == "gsokey" || sRes == "tmfkey" || sRes == "tbnkey" || sRes == "default" || sRes == "dragoncall") return TRUE; return FALSE; } //::------------------------------------------------------------------------::// //:: Checks if the object is an important item. ::// //::------------------------------------------------------------------------::// int GetIsImportant(object oObject) { string sRes = GetResRef(oObject); if(sRes == "default" || sRes == "playershandbook" || sRes == "" || sRes == "" || sRes == "" || sRes == "") return TRUE; return FALSE; } //::------------------------------------------------------------------------::// //:: Dont change these. ::// //::------------------------------------------------------------------------::// int GetIsUnAcquirable(object oObject) { if(GetIsPlot(oObject)) return FALSE; object oItem = GetFirstItemInInventory(oObject); while(GetIsObjectValid(oItem)) { if(GetIsPlot(oItem)) return FALSE; oItem = GetNextItemInInventory(oObject); } return TRUE; } int SlotMatch(object oObject, int iSlot, object oPlayer) { return (GetResRef(GetItemInSlot(iSlot,oPlayer)) == GetResRef(oObject)&& GetItemInSlot(iSlot,oPlayer) != oObject); } int AlreadyHave(object oObject, object oPlayer) { object oItem = GetFirstItemInInventory(oPlayer); while(GetIsObjectValid(oItem)) { if(GetResRef(oItem) == GetResRef(oObject) && oItem != oObject) return TRUE; oItem = GetNextItemInInventory(oPlayer); } if(SlotMatch(oObject,INVENTORY_SLOT_ARMS,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_ARROWS,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_BELT,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_BOLTS,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_BOOTS,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_BULLETS,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_CHEST,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_CLOAK,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_HEAD,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_LEFTHAND,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_LEFTRING,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_NECK,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_RIGHTHAND,oPlayer)|| SlotMatch(oObject,INVENTORY_SLOT_RIGHTRING,oPlayer)) return TRUE; return FALSE; } int GetIsAcquirable(object oObject, object oPlayer) { if(GetIsUnique(oObject)&&AlreadyHave(oObject, oPlayer)) return FALSE; object oItem = GetFirstItemInInventory(oObject); while(GetIsObjectValid(oItem)) { if(GetIsUnique(oItem)&&AlreadyHave(oItem, oPlayer)) return FALSE; oItem = GetNextItemInInventory(oObject); } return TRUE; } int GetIsDestroyable(object oObject) { if(GetIsImportant(oObject)) return FALSE; object oItem = GetFirstItemInInventory(oObject); while(GetIsObjectValid(oItem)) { if(GetIsImportant(oItem)) return FALSE; oItem = GetNextItemInInventory(oObject); } return TRUE; }