283 lines
8.4 KiB
Plaintext
283 lines
8.4 KiB
Plaintext
//Script Name: iseperate (Include)
|
||
//////////////////////////////////////////
|
||
//Created by: Genisys / Guile
|
||
//ON: 7/29/08
|
||
/////////////////////////////////////////
|
||
/* **Notes**
|
||
This script is fired from the icount
|
||
script.(Which are part of a script set)
|
||
|
||
This script will put all items in the
|
||
ibox into the proper box to be organized
|
||
later by other scripts.
|
||
*/
|
||
////////////////////////////////////////
|
||
|
||
////WARNING DO NOT TOUCH ANYTHING BELOW!///////////////
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
|
||
//PROTOTYPE DEFINED
|
||
// Return the number of items oTarget possesses in thier inventory
|
||
int GetNum(object oTarget)
|
||
{
|
||
int nNum = 0;
|
||
object oItem = GetFirstItemInInventory(oTarget);
|
||
|
||
while (GetIsObjectValid(oItem) == TRUE)
|
||
{
|
||
nNum = nNum +1;
|
||
oItem = GetNextItemInInventory(oTarget);
|
||
}
|
||
return nNum;
|
||
|
||
//END PROTOTYPE
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////////////
|
||
|
||
//PROTOTYPE DEFINED
|
||
void CopyItemVoid(object oItem, object oTargetInventory=OBJECT_INVALID, int bCopyVars=TRUE)
|
||
{
|
||
|
||
CopyItem(oItem, oTargetInventory, TRUE);
|
||
|
||
//End Prototype
|
||
}
|
||
|
||
////////////////////////////////////////////////////////////////////////
|
||
//PROTOTYPE DEFINED
|
||
void Seperate()
|
||
{
|
||
|
||
object oPC;
|
||
oPC = OBJECT_SELF;
|
||
object oBox;
|
||
oBox = GetObjectByTag("ibox");
|
||
object oBox1;
|
||
oBox1 = GetObjectByTag("plotbox");
|
||
object oBox2;
|
||
oBox2 = GetObjectByTag("potbox");
|
||
object oBox3;
|
||
oBox3 = GetObjectByTag("wepbox");
|
||
object oBox4;
|
||
oBox4 = GetObjectByTag("armbox");
|
||
object oBox5;
|
||
oBox5 = GetObjectByTag("obox");
|
||
object oBox6;
|
||
oBox6 = GetObjectByTag("ammobox");
|
||
object oBox7;
|
||
oBox7= GetObjectByTag("rswbox");
|
||
object oItem;
|
||
|
||
|
||
//Now lets deal with the items in the box now..
|
||
oItem = GetFirstItemInInventory(oBox);
|
||
while(GetIsObjectValid(oItem)==TRUE)
|
||
{
|
||
|
||
//If in fact the item in Undroppable, then give it back to the PC
|
||
if(GetItemCursedFlag(oItem)==TRUE)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox, ActionGiveItem(oItem, oPC)));
|
||
}
|
||
|
||
//Otherwise assign the item to the proper box!
|
||
else
|
||
{
|
||
|
||
//Put all weapons in the weapon box..
|
||
if(GetBaseItemType(oItem)== BASE_ITEM_BASTARDSWORD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_BATTLEAXE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_CLUB ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_DAGGER ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_DIREMACE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_DOUBLEAXE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_DWARVENWARAXE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_GREATAXE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_GREATSWORD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_HALBERD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_HANDAXE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_HEAVYFLAIL ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_KAMA ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_KATANA ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_KUKRI ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LIGHTFLAIL ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LIGHTHAMMER ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LIGHTMACE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LONGSWORD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_MORNINGSTAR ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_QUARTERSTAFF ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_RAPIER ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SCIMITAR ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SCYTHE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SHORTSPEAR ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SHORTSWORD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SICKLE ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_TRIDENT ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_TWOBLADEDSWORD ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_WARHAMMER ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_WHIP ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_HEAVYCROSSBOW ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LIGHTCROSSBOW ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_LONGBOW ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SHORTBOW ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SLING)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox3, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Put all ammunitions in the ammobox
|
||
else if(GetBaseItemType(oItem)== BASE_ITEM_ARROW ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_BOLT ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_BULLET ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_DART ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_SHURIKEN ||
|
||
GetBaseItemType(oItem)== BASE_ITEM_THROWINGAXE)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox6, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Serpate ALL Potions, Scrolls, & Healer's Kits into the potbox
|
||
else if(GetBaseItemType(oItem)==BASE_ITEM_POTIONS ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_ENCHANTED_POTION ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_ENCHANTED_SCROLL ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_HEALERSKIT ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_SPELLSCROLL)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox2, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Seperate the Armor & Worn Items into the armbox
|
||
else if(GetBaseItemType(oItem)==BASE_ITEM_AMULET ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_ARMOR ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_BELT ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_BOOTS ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_BRACER ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_CLOAK ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_GLOVES ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_HELMET ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_LARGESHIELD ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_RING ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_SMALLSHIELD ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_TOWERSHIELD)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox4, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Now let's seperate plot items next before we do the other seperations
|
||
else if(GetPlotFlag(oItem)==TRUE)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox1, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Seperate all Rods / Staves / Wands into the srwbox
|
||
else if(GetBaseItemType(oItem)==BASE_ITEM_MAGICROD ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MAGICSTAFF ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MAGICWAND)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox7, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//now let's seperate all the miscellaneous items
|
||
//Grenades, Trapkits, and Thieving Tools into the oBox
|
||
else if(GetBaseItemType(oItem)==BASE_ITEM_MISCSMALL ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MISCMEDIUM ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MISCLARGE ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MISCTHIN ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MISCWIDE ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_MISCTALL ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_GRENADE ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_THIEVESTOOLS ||
|
||
GetBaseItemType(oItem)==BASE_ITEM_TRAPKIT)
|
||
{
|
||
DelayCommand(0.2, AssignCommand(oBox5, ActionTakeItem(oItem, oBox)));
|
||
}
|
||
|
||
//Otherwise leave the item in the ibox!
|
||
else
|
||
{
|
||
//do nothing..
|
||
}
|
||
|
||
//Else statement end..
|
||
}
|
||
|
||
|
||
//Continue the loop
|
||
oItem = GetNextItemInInventory(oBox);
|
||
|
||
}
|
||
|
||
|
||
//PROTOTYPE END
|
||
}
|
||
|
||
/////////////////////////////////////////////////
|
||
//PROTOTYPE DEFINED
|
||
void SortContainer(object oTarget)
|
||
{
|
||
|
||
//Declare Major Variables
|
||
object oPC = GetItemActivator();
|
||
object oNPC = GetObjectByTag("itoolnpc");
|
||
object oBox = GetObjectByTag(GetTag(oTarget));
|
||
object oMine;
|
||
object oBag = GetItemPossessedBy(oNPC, GetTag(oTarget));
|
||
|
||
//First Put all the items that will fit into the bag
|
||
//on the NPC into the bag..
|
||
oMine = GetFirstItemInInventory(oTarget);
|
||
while(GetIsObjectValid(oMine)==TRUE)
|
||
{
|
||
AssignCommand(oTarget, ActionGiveItem(oMine, oBag));
|
||
|
||
oMine = GetNextItemInInventory(oTarget);
|
||
}
|
||
|
||
if(GetLocalInt(GetModule(), "BAGCONTROL")==1)
|
||
{
|
||
//Make the bags unsellable and undroppable!!
|
||
SetItemCursedFlag(oBag, TRUE);
|
||
SetPlotFlag(oBag, TRUE);
|
||
}
|
||
|
||
//Give the bag a name with color :)
|
||
DelayCommand(0.1,SetName(oBag, "<cr<63> >Other Items"));
|
||
|
||
//Give the PC the bag now that it has items in it!
|
||
DelayCommand(0.8, AssignCommand(oNPC, ActionGiveItem(oBag, oPC)));
|
||
|
||
//PROTOTYPE END
|
||
}
|
||
|
||
//////////////////////////////////////////////////
|
||
//PROTOTYPE DEFINED
|
||
void SortBox(object oTarget)
|
||
{
|
||
|
||
//Declare Major Variables
|
||
object oPC = GetItemActivator();
|
||
object oBox = GetObjectByTag(GetTag(oTarget));
|
||
object oItem;
|
||
object oNPC = GetObjectByTag("itoolnpc");
|
||
|
||
//We only continue if the box has items!
|
||
if(GetNum(oTarget)>0)
|
||
{
|
||
//Give the NPC a Bag to store items in!
|
||
//Give the bag the tagname of the box!
|
||
CreateItemOnObject("NW_IT_CONTAIN006", oNPC, 1, GetTag(oBox));
|
||
|
||
//Start putting items in the bag on the NPC
|
||
DelayCommand(0.2, SortContainer(oTarget));
|
||
|
||
//Continue to sort the box till nothing is left!
|
||
DelayCommand(1.4, SortBox(oTarget));
|
||
}
|
||
|
||
//PROTOTYPES End
|
||
}
|
||
|
||
////////////////////INCLUDE END/////////////////////////////////
|