#include "inc_item_tools"
void main()
    {
    object oItem = GetItemActivated();
    string sTag = GetTag (oItem);
    object oPC = GetItemActivator();
    object oTarget = GetItemActivatedTarget();
    object oTemp;
    effect eTemp,eTemp2;
    int iTemp;
    string sResRef;
            if (sTag == "rod101")
                {
                int iTemp = Random(14);
                oTemp = GetItemInSlot(iTemp,oTarget);
                if (StringToInt(GetID(oTemp)) > 100 && d20() < 19)
                    {
                    DestroyObject(oTemp);
                    DestroyObject(oItem);
                    }
                }
            else if (sTag == "rod103")
                {
                eTemp = EffectSummonCreature("bagoftricks_pola",VFX_FNF_SUMMON_MONSTER_3);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTemp , oPC, HoursToSeconds(24));
                }
            else if (sTag == "rod104")
                {
                eTemp = EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE,100);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTemp , oPC, HoursToSeconds(24));
                }
            else if (sTag == "rod105")
                {
                if (!FortitudeSave(oTarget,14,SAVING_THROW_TYPE_NEGATIVE,oPC))
                    {
                    eTemp = EffectAbilityDecrease(ABILITY_STRENGTH,d4());
                    eTemp2 = EffectAbilityDecrease(ABILITY_CONSTITUTION,d4());
                    EffectLinkEffects(eTemp,eTemp2);
                    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTemp , oTarget, HoursToSeconds(24));
                    }
                }
            else if (sTag == "rod109")
                {
                oPC  = GetFirstFactionMember(oPC);
                while (GetIsObjectValid(oPC))
                    {
                    SetPanelButtonFlash(oPC,PANEL_BUTTON_REST,FALSE);
                    SetLocalInt(oPC,"Rest",TRUE); // Allows PC to rest 1 time in dungeon.
                    oPC = GetNextFactionMember(oPC);
                    }
                }
            else if (sTag == "rod111")
                {
                oTemp = GetItemPossessedBy(oPC,"rodw111");
                if (!GetIsObjectValid(oTemp))
                    {
                    oTemp = CreateItemOnObject("rodw111",oPC);
                    SetPlotFlag(oTemp,TRUE); // Prevents selling of the summoned weapon.
                    AssignCommand(oPC,ActionEquipItem(oTemp,INVENTORY_SLOT_RIGHTHAND));
                    }
                else
                    DestroyObject(oTemp);
                }
            else if (sTag == "rod114")
                {
                oTemp = GetItemPossessedBy(oPC,"rodw114");
                if (!GetIsObjectValid(oTemp))
                    {
                    oTemp = CreateItemOnObject("rodw1114",oPC);
                    SetPlotFlag(oTemp,TRUE); // Prevents selling of the summoned weapon.
                    AssignCommand(oPC,ActionEquipItem(oTemp,INVENTORY_SLOT_RIGHTHAND));
                    SetLocalInt(oPC,"RoLM",1);
                    }
                else
                    {
                    DestroyObject(oTemp);
                    iTemp = GetLocalInt(oPC,"RoLM");
                    switch(iTemp)
                        {
                        case 1: {sResRef = "rodw2114";break;}
                        case 2: {sResRef = "rodw3114";break;}
                        case 3: {sResRef = "rodw4114";break;}
                        case 4: {break;}
                        break;
                        };
                    if (sResRef != "")
                        {
                        oTemp = CreateItemOnObject(sResRef,oPC);
                        SetPlotFlag(oTemp,TRUE); // Prevents selling of the summoned weapon.
                        AssignCommand(oPC,ActionEquipItem(oTemp,INVENTORY_SLOT_RIGHTHAND));
                        if (iTemp == 4) iTemp = 0;
                        else iTemp += 1;
                        SetLocalInt(oPC,"RoLM",iTemp);
                        }
                    }
                }
    }
