Example #1
0
        private bool Evaluate(string inp)
        {
            ScriptVariable outv = new ScriptVariable();
            outv.Type = Var_Types.ASSIGNABLE;

            Assignment(outv, inp);

            switch(outv.Type)
            {
                case Var_Types.ASSIGNABLE:
                    if (System.Convert.ToInt64(outv.Value, System.Globalization.CultureInfo.InvariantCulture) >= 1)
                        return true;
                    else
                        return false;
                case Var_Types.INT:
                    if (System.Convert.ToInt64(outv.Value, System.Globalization.CultureInfo.InvariantCulture) >= 1)
                        return true;
                    else
                        return false;
                case Var_Types.DOUBLE:
                    if (System.Convert.ToDouble(outv.Value, System.Globalization.CultureInfo.InvariantCulture) >= 1)
                        return true;
                    else
                        return false;
                default:
                    ScriptEngine.Script_Error("CANNOT PERFORM BOOLEAN EVALUATION ON TYPE OF " + outv.Type);
                    break;
            }

            return false;
        }
Example #2
0
        private void Script_TEST_DNS(string line)
        {
            string         svar = Get_String(ref line);
            ScriptVariable var  = Get_Var(svar);

            string addy = Get_String(ref line);

            bool success = Util.TestDNS(addy);

            if (success)
            {
                switch (var.Type)
                {
                case Var_Types.INT:
                    var.Value = 1L;
                    break;

                case Var_Types.DOUBLE:
                    var.Value = 1D;
                    break;

                case Var_Types.STRING:
                    var.Value = "1";
                    break;
                }
            }
            else
            {
                switch (var.Type)
                {
                case Var_Types.INT:
                    var.Value = 0L;
                    break;

                case Var_Types.DOUBLE:
                    var.Value = 0D;
                    break;

                case Var_Types.STRING:
                    var.Value = "0";
                    break;
                }
            }
        }
Example #3
0
        private void Script_GET_INVENTORY(string inp)
        {
            string sdest = Get_String(ref inp);
            ScriptVariable dest = Get_Var(sdest);

            if (dest.Type == Var_Types.ARRAYLIST)
            {
                ((System.Collections.ArrayList)dest.Value).Clear();
            }
            else if (dest.Type == Var_Types.SORTEDLIST)
            {
                ((System.Collections.SortedList)dest.Value).Clear();
            }
            else
            {
                ScriptEngine.Script_Error("INVLAID DESTINATION TYPE");
                return;
            }

            Globals.InventoryLock.EnterReadLock();
            try
            {
                foreach (InventoryInfo it in Globals.gamedata.inventory.Values)
                {
                    Script_ClassData cd = new Script_ClassData();
                    cd.Name = "INVENTORY";
                    cd._Variables.Add("ID", new ScriptVariable((long)it.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("NAME", new ScriptVariable(Util.GetItemName(it.ItemID), "NAME", Var_Types.STRING, Var_State.PUBLIC));

                    cd._Variables.Add("ITEM_ID", new ScriptVariable((long)it.ItemID, "ITEM_ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("COUNT", new ScriptVariable((long)it.Count, "COUNT", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("EQUIPPED", new ScriptVariable((long)it.isEquipped, "EQUIPPED", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("SLOT", new ScriptVariable((long)it.Slot, "SLOT", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("ENCHANT", new ScriptVariable((long)it.Enchant, "ENCHANT", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("AUG_ID", new ScriptVariable((long)it.AugID, "AUG_ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MANA", new ScriptVariable((long)it.Mana, "MANA", Var_Types.INT, Var_State.PUBLIC));                    
                    cd._Variables.Add("LEASE_TIME", new ScriptVariable((long)it.lease_time, "LEASE_TIME", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("ATTACK_ELEMENT", new ScriptVariable((long)it.attack_element, "ATTACK_ELEMENT", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("ATTACK_MAGNITUDE", new ScriptVariable((long)it.attack_magnitude, "ATTACK_MAGNITUDE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("FIRE_DEFENSE", new ScriptVariable((long)it.fire_defense, "FIRE_DEFENSE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("WATER_DEFENSE", new ScriptVariable((long)it.water_defense, "WATER_DEFENSE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("WIND_DEFENSE", new ScriptVariable((long)it.wind_defense, "WIND_DEFENSE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("EARTH_DEFENSE", new ScriptVariable((long)it.earth_defense, "EARTH_DEFENSE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("UNHOLY_DEFENSE", new ScriptVariable((long)it.unholy_defense, "UNHOLY_DEFENSE", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("HOLY_DEFENSE", new ScriptVariable((long)it.holy_defense, "HOLY_DEFENSE", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("ENCHANT_EFFECT_0", new ScriptVariable((long)it.enchant_effect_0, "ENCHANT_EFFECT_0", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("ENCHANT_EFFECT_1", new ScriptVariable((long)it.enchant_effect_1, "ENCHANT_EFFECT_1", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("ENCHANT_EFFECT_2", new ScriptVariable((long)it.enchant_effect_2, "ENCHANT_EFFECT_2", Var_Types.INT, Var_State.PUBLIC));

                    ScriptVariable sv = new ScriptVariable(cd, "INVENTORY", Var_Types.CLASS, Var_State.PUBLIC);

                    if (dest.Type == Var_Types.ARRAYLIST)
                    {
                        ((System.Collections.ArrayList)dest.Value).Add(sv);
                    }
                    else if (dest.Type == Var_Types.SORTEDLIST)
                    {
                        ((System.Collections.SortedList)dest.Value).Add(it.ID.ToString(), sv);
                    }
                }
            }
            finally
            {
                Globals.InventoryLock.ExitReadLock();
            }
        }
Example #4
0
 private void Add_Variable(ScriptVariable var, int h)
 {
     ((VariableList)Stack[h]).Add_Variable(var);
 }
Example #5
0
        public ScriptVariable Clone()
        {
            if (State == Var_State.STATIC)
            {
                return(this);
            }

            ScriptVariable sout = new ScriptVariable();

            sout.Name  = Name;
            sout.Type  = Type;
            sout.State = State;

            switch (Type)
            {
            case Var_Types.NULL:
                sout.Value = null;
                break;

            case Var_Types.INT:
                sout.Value = (long)Value;
                break;

            case Var_Types.DOUBLE:
                sout.Value = (double)Value;
                break;

            case Var_Types.STRING:
                sout.Value = (string)Value;
                break;

            case Var_Types.FILEWRITER:
                sout.Value = Value;
                break;

            case Var_Types.FILEREADER:
                sout.Value = Value;
                break;

            case Var_Types.ARRAYLIST:
                sout.Value = new ArrayList(((ArrayList)Value).Capacity);

                foreach (ScriptVariable nv in (ArrayList)Value)
                {
                    ((ArrayList)sout.Value).Add(nv.Clone());
                }
                break;

            case Var_Types.SORTEDLIST:
                sout.Value = new SortedList(((SortedList)Value).Capacity);

                foreach (DictionaryEntry dic in (SortedList)Value)
                {
                    ((SortedList)sout.Value).Add(dic.Key, ((ScriptVariable)dic.Value).Clone());
                }
                break;

            case Var_Types.STACK:
                sout.Value = new Stack(((Stack)Value).Count);

                foreach (ScriptVariable nv in (Stack)Value)
                {
                    ((Stack)sout.Value).Push(nv.Clone());
                }
                break;

            case Var_Types.QUEUE:
                sout.Value = new Queue(((Queue)Value).Count);

                foreach (ScriptVariable nv in (Queue)Value)
                {
                    ((Queue)sout.Value).Enqueue(nv.Clone());
                }
                break;

            case Var_Types.CLASS:
                sout.Value = new Script_ClassData();
                ((Script_ClassData)sout.Value).Name = ((Script_ClassData)Value).Name;

                foreach (ScriptVariable nv in ((Script_ClassData)Value)._Variables.Values)
                {
                    ((Script_ClassData)sout.Value)._Variables.Add(nv.Name, nv.Clone());
                }
                break;

            case Var_Types.BYTEBUFFER:
                sout.Value = new ByteBuffer((ByteBuffer)Value);
                break;

            case Var_Types.WINDOW:
                sout.Value = Value;
                break;

            case Var_Types.THREAD:
                sout.Value = Value;
                break;

            default:
                sout.Value = Value;
                break;
            }

            return(sout);
        }
Example #6
0
        private void BuildVarTree(TreeNode parent, ScriptVariable sv)
        {
#if! DEBUG
            try
            {
#endif
            TreeNode type;
            TreeNode value;
            TreeNode count;

            switch (sv.Type)
            {
                case Var_Types.NULL:
                    type = new TreeNode("Type : NULL");
                    value = new TreeNode("Value : NULL");

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.INT:
                    type = new TreeNode("Type : INT");
                    value = new TreeNode("Value : " + System.Convert.ToInt64(sv.Value).ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.DOUBLE:
                    type = new TreeNode("Type : DOUBLE");
                    value = new TreeNode("Value : " + System.Convert.ToDouble(sv.Value).ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.STRING:
                    type = new TreeNode("Type : STRING");
                    value = new TreeNode("Value : " + System.Convert.ToString(sv.Value));

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.FILEWRITER:
                    type = new TreeNode("Type : FILEWRITER");
                    value = new TreeNode("Value : " + ((System.IO.StreamWriter)sv.Value).ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.FILEREADER:
                    type = new TreeNode("Type : FILEREADER");
                    value = new TreeNode("Value : " + ((System.IO.StreamReader)sv.Value).ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.ARRAYLIST:
                    type = new TreeNode("Type : ARRAYLIST");
                    count = new TreeNode("Count : " + ((System.Collections.ArrayList)sv.Value).Count.ToString());
                    value = new TreeNode("Values");

                    foreach (ScriptVariable child_sv in ((System.Collections.ArrayList)sv.Value))
                    {
                        //TreeNode child_node = new TreeNode(child_sv.Name);
                        TreeNode child_node = new TreeNode("[" + ((System.Collections.ArrayList)sv.Value).IndexOf(child_sv).ToString() + "]");
                        child_node.Nodes.Add("Index : " + ((System.Collections.ArrayList)sv.Value).IndexOf(child_sv).ToString());
                        child_node.Nodes.Add("Name : " + child_sv.Name);

                        BuildVarTree(child_node, child_sv);

                        value.Nodes.Add(child_node);
                    }

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(count);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.SORTEDLIST:
                    type = new TreeNode("Type : SORTEDLIST");
                    count = new TreeNode("Count : " + ((System.Collections.SortedList)sv.Value).Count.ToString());
                    value = new TreeNode("Values");

                    try
                    {
                        foreach (string key in ((System.Collections.SortedList)sv.Value).Keys)
                        {
                            try
                            {
                                ScriptVariable child_sv = (ScriptVariable)(((System.Collections.SortedList)sv.Value)[key]);

                                //TreeNode child_node = new TreeNode(child_sv.Name);
                                TreeNode child_node = new TreeNode("[" + key + "]");
                                child_node.Nodes.Add("Key : " + key);
                                child_node.Nodes.Add("Name : " + child_sv.Name);

                                BuildVarTree(child_node, child_sv);

                                value.Nodes.Add(child_node);
                            }
                            catch
                            {
                                Globals.l2net_home.Add_Debug("error creating debug leaf for sortedlist - foreach inside " + key);
                            }
                        }
                    }
                    catch
                    {
                        Globals.l2net_home.Add_Debug("error creating debug leaf for sortedlist - foreach " + sv.Name);
                    }

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(count);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.STACK:
                    type = new TreeNode("Type : STACK");
                    count = new TreeNode("Count : " + ((System.Collections.Stack)sv.Value).Count.ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(count);
                    break;
                case Var_Types.QUEUE:
                    type = new TreeNode("Type : QUEUE");
                    count = new TreeNode("Count : " + ((System.Collections.Queue)sv.Value).Count.ToString());

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(count);
                    break;
                case Var_Types.CLASS:
                    type = new TreeNode("Type : CLASS - " + ((Script_ClassData)sv.Value).Name);
                    value = new TreeNode("Values");

                    foreach (ScriptVariable child_sv in ((Script_ClassData)sv.Value)._Variables.Values)
                    {
                        TreeNode child_node = new TreeNode(child_sv.Name);

                        BuildVarTree(child_node, child_sv);

                        value.Nodes.Add(child_node);
                    }

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.BYTEBUFFER:
                    type = new TreeNode("Type : BYTEBUFFER");
                    count = new TreeNode("Length - " + ((ByteBuffer)sv.Value).Length().ToString());
                    value = new TreeNode("Values");

                    for (int i = 0; i < ((ByteBuffer)sv.Value).Length(); i++)
                    {
                        TreeNode child_node = new TreeNode("0x" + i.ToString("X2") + " : " + "0x" + ((ByteBuffer)sv.Value).GetByte(i).ToString("X2") + " = '" + (char)((ByteBuffer)sv.Value).GetByte(i) + "'");
                        value.Nodes.Add(child_node);
                    }

                    parent.Nodes.Add(type);
                    parent.Nodes.Add(count);
                    parent.Nodes.Add(value);
                    break;
                case Var_Types.WINDOW:
                    type = new TreeNode("Type : WINDOW");

                    parent.Nodes.Add(type);
                    break;
                case Var_Types.THREAD:
                    type = new TreeNode("Type : THREAD");

                    TreeNode thread_info_node_id = new TreeNode("ID : " + ((ScriptThread)sv.Value).ID.ToString());
                    TreeNode thread_info_node_file = new TreeNode("File : " + ((ScriptThread)sv.Value).Current_File);
                    TreeNode thread_info_node_line = new TreeNode("Running Line : " + ((ScriptThread)sv.Value).Line_Pos.ToString());
                    TreeNode thread_info_node_stack = new TreeNode("Current Stack Depth : " + (((ScriptThread)sv.Value).StackHeight + 1).ToString());
                    TreeNode thread_info_node_func = new TreeNode("Function Call Depth : " + ((ScriptThread)sv.Value)._functioncalls.Count.ToString());
                    TreeNode thread_info_node_sub = new TreeNode("Sub Call Depth : " + ((ScriptThread)sv.Value)._subcalls.Count.ToString());
                    TreeNode thread_info_node_sleep = new TreeNode("Sleep Until : " + ((ScriptThread)sv.Value).Sleep_Until.ToLongTimeString());
                    parent.Nodes.Add(thread_info_node_id);
                    parent.Nodes.Add(thread_info_node_file);
                    parent.Nodes.Add(thread_info_node_line);
                    parent.Nodes.Add(thread_info_node_stack);
                    parent.Nodes.Add(thread_info_node_func);
                    parent.Nodes.Add(thread_info_node_sub);
                    parent.Nodes.Add(thread_info_node_sleep);
                    break;
            }
#if! DEBUG
            }
            catch
            {
                //broke our little tree... too bad
                Globals.l2net_home.Add_Debug("error creating debug leaf for var: " + sv.Name + " of type: " + sv.Type.ToString());
            }
#endif
        }
Example #7
0
        public static void UpdateBuff(ByteBuffer buff)
        {
            uint skill_id = buff.ReadUInt32();
            uint skill_level = buff.ReadUInt32(); // maybe it iwll fix it
            int skill_duration = buff.ReadInt32();

            Globals.MyBuffsListLock.EnterWriteLock();
            try
            {
                //need to see if the buff exists in our list...
                //if so, update the remaining time
                //otherwise, add the buff
                if (Globals.gamedata.mybuffs.ContainsKey(skill_id))
                {
                    CharBuff cb = (CharBuff)Globals.gamedata.mybuffs[skill_id];
                    cb.SkillLevel = skill_level;
                    if (skill_duration == -1)
                    {
                        //remove the buff
                        //Globals.gamedata.mybuffs.Remove(skill_id);


                        //toggle buff
                        cb.ExpiresTime = -1;
                        cb.EFFECT_TIME = -1;
                    }
                    else
                    {
                        cb.EFFECT_TIME = skill_duration;
                        cb.ExpiresTime = System.DateTime.Now.AddSeconds(skill_duration).Ticks;
                    }
                }
                else
                {
                    CharBuff cb = new CharBuff();
                    cb.ID = skill_id;
                    cb.SkillLevel = skill_level;
                    if (skill_duration == -1)
                    {
                        //toggle buff

                        cb.ExpiresTime = -1;
                        cb.EFFECT_TIME = -1;
                        Globals.gamedata.mybuffs.Add(cb.ID, cb);
                    }
                    else
                    {
                        cb.EFFECT_TIME = skill_duration;
                        cb.ExpiresTime = System.DateTime.Now.AddSeconds(skill_duration).Ticks;
                        Globals.gamedata.mybuffs.Add(cb.ID, cb);
                    }
                }
                if (Globals.gamedata.CurrentScriptState == ScriptState.Running)
                {
                    SortedList _mybuff = new SortedList();
                    if (Globals.gamedata.mybuffs.Count > 0)
                    {
                        foreach (CharBuff _buff in Globals.gamedata.mybuffs.Values)
                        {
                            Script_ClassData cd = new Script_ClassData();
                            cd.Name = "EFFECT";
                            cd._Variables.Add("ID", new ScriptVariable((long)_buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("LEVEL", new ScriptVariable((long)_buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("DURATION", new ScriptVariable((long)_buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)_buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(_buff.ID, _buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                            ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);
                            _mybuff.Add(_buff.ID.ToString(), sv);
                        }
                    }
                    ScriptEvent sc_ev = new ScriptEvent();
                    sc_ev.Type = EventType.CharEffect;
                    sc_ev.Variables.Add(new ScriptVariable(_mybuff, "EFFECTLIST", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    ScriptEngine.SendToEventQueue(sc_ev);
                }
            }
            finally
            {
                Globals.MyBuffsListLock.ExitWriteLock();
            }
        }
Example #8
0
        public static void PartySpelled(ByteBuffer buff)
        {

            /*
            	protected final void writeImpl()
	            {
		            writeC(0xf4);
		            writeD(_activeChar instanceof L2SummonInstance ? 2 : _activeChar instanceof L2PetInstance ? 1 : 0);
		            writeD(_activeChar.getObjectId());
		            writeD(_effects.size());
		            for (Effect temp : _effects)
		            {
			            writeD(temp._skillId);
			            writeH(temp._dat);
			            writeD(temp._duration / 1000);
		            }
		
	            }
            */

            uint update_type = buff.ReadUInt32();
            uint update_object = buff.ReadUInt32();
            int update_count = buff.ReadInt32();
            int skill_duration = 0;
            uint skill_id = 0;

            try
            {
                if (Globals.gamedata.PartyMembers.ContainsKey(update_object))
                {
                    PartyMember ph = null;
                    CharInfo ch;
                    Globals.PlayerLock.EnterReadLock();
                    try
                    {
                        ph = Util.GetCharParty(update_object);
                        ch = Util.GetChar(update_object);
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitReadLock();
                    }

                    Globals.PlayerLock.EnterWriteLock();
                    try
                    {
                        if (ph != null)
                        {
                            ph.my_buffs.Clear();

                            for (int i = 0; i < update_count; i++)
                            {
                                skill_id = buff.ReadUInt32();
                                buff.ReadInt16();
                                skill_duration = buff.ReadInt32();
                                Add_PartyBuff(update_object, skill_id, skill_duration, ph);
                            }

                            if (Globals.gamedata.CurrentScriptState == ScriptState.Running)
                            {

                                Script_ClassData cd = new Script_ClassData();
                                cd.Name = "PLAYER";
                                cd._Variables.Add("ID", new ScriptVariable((long)ph.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("NAME", new ScriptVariable(ph.Name, "NAME", Var_Types.STRING, Var_State.PUBLIC));

                                cd._Variables.Add("CLASS", new ScriptVariable((long)ph.Class, "CLASS", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("LEVEL", new ScriptVariable((long)ph.Level, "LEVEL", Var_Types.INT, Var_State.PUBLIC));

                                cd._Variables.Add("HP", new ScriptVariable((long)ph.Cur_HP, "HP", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("MAX_HP", new ScriptVariable((long)ph.Max_HP, "MAX_HP", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("MP", new ScriptVariable((long)ph.Cur_MP, "MP", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("MAX_MP", new ScriptVariable((long)ph.Max_MP, "MAX_MP", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("CP", new ScriptVariable((long)ph.Cur_CP, "CP", Var_Types.INT, Var_State.PUBLIC));
                                cd._Variables.Add("MAX_CP", new ScriptVariable((long)ph.Max_CP, "MAX_CP", Var_Types.INT, Var_State.PUBLIC));

                                try
                                {
                                    System.Collections.SortedList buffs = new System.Collections.SortedList();
                                    foreach (CharBuff _buff in ph.my_buffs.Values)
                                    {
                                        Script_ClassData ncd = new Script_ClassData();
                                        ncd.Name = "EFFECT";
                                        ncd._Variables.Add("ID", new ScriptVariable((long)_buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                        ncd._Variables.Add("LEVEL", new ScriptVariable((long)_buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                                        ncd._Variables.Add("DURATION", new ScriptVariable((long)_buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                                        ncd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(_buff.ID, _buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                                        ScriptVariable nsv = new ScriptVariable(ncd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                                        buffs.Add(_buff.ID.ToString(), nsv);
                                    }

                                    cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                                }
                                catch
                                {
                                    System.Collections.SortedList empty = new System.Collections.SortedList();
                                    cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)empty, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                                }


                                if (ch == null)
                                {
                                    cd._Variables.Add("X", new ScriptVariable((long)ph.X, "X", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("Y", new ScriptVariable((long)ph.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("Z", new ScriptVariable((long)ph.Z, "Z", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("TITLE", new ScriptVariable("", "TITLE", Var_Types.STRING, Var_State.PUBLIC));
                                    cd._Variables.Add("CLAN", new ScriptVariable(0L, "CLAN", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("ALLY", new ScriptVariable(0L, "ALLY", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("RACE", new ScriptVariable(0L, "RACE", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("SEX", new ScriptVariable(0L, "SEX", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("PVPFLAG", new ScriptVariable(0L, "PVPFLAG", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("KARMA", new ScriptVariable(0L, "KARMA", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("ATTACK_SPEED", new ScriptVariable(0L, "ATTACK_SPEED", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("CAST_SPEED", new ScriptVariable(0L, "CAST_SPEED", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("RUN_SPEED", new ScriptVariable(0L, "RUN_SPEED", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("TARGET_ID", new ScriptVariable(0L, "TARGET_ID", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("DEST_X", new ScriptVariable(0L, "DEST_X", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("DEST_Y", new ScriptVariable(0L, "DEST_Y", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("DEST_Z", new ScriptVariable(0L, "DEST_Z", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("LOOKS_DEAD", new ScriptVariable(0L, "LOOKS_DEAD", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("IN_COMBAT", new ScriptVariable(0L, "IN_COMBAT", Var_Types.INT, Var_State.PUBLIC));
                                    //cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)pl.my_buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                                }
                                else
                                {
                                    cd._Variables.Add("X", new ScriptVariable((long)ch.X, "X", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("Y", new ScriptVariable((long)ch.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("Z", new ScriptVariable((long)ch.Z, "Z", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("TITLE", new ScriptVariable(ch.Title, "TITLE", Var_Types.STRING, Var_State.PUBLIC));
                                    cd._Variables.Add("CLAN", new ScriptVariable((long)ch.ClanID, "CLAN", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("ALLY", new ScriptVariable((long)ch.AllyID, "ALLY", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("RACE", new ScriptVariable((long)ch.Race, "RACE", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("SEX", new ScriptVariable((long)ch.Sex, "SEX", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("PVPFLAG", new ScriptVariable((long)ch.PvPFlag, "PVPFLAG", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("KARMA", new ScriptVariable((long)ch.Karma, "KARMA", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("ATTACK_SPEED", new ScriptVariable((long)(ch.PatkSpeed * ch.AttackSpeedMult), "ATTACK_SPEED", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("CAST_SPEED", new ScriptVariable((long)ch.MatkSpeed, "CAST_SPEED", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("RUN_SPEED", new ScriptVariable((long)(ch.RunSpeed * ch.MoveSpeedMult), "RUN_SPEED", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("TARGET_ID", new ScriptVariable((long)ch.TargetID, "TARGET_ID", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("DEST_X", new ScriptVariable((long)ch.Dest_X, "DEST_X", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("DEST_Y", new ScriptVariable((long)ch.Dest_Y, "DEST_Y", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("DEST_Z", new ScriptVariable((long)ch.Dest_Z, "DEST_Z", Var_Types.INT, Var_State.PUBLIC));

                                    cd._Variables.Add("LOOKS_DEAD", new ScriptVariable((long)ch.isAlikeDead, "LOOKS_DEAD", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("IN_COMBAT", new ScriptVariable((long)ch.isInCombat, "IN_COMBAT", Var_Types.INT, Var_State.PUBLIC));
                                    //cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)pl.my_buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                                }

                                ScriptEvent sc_ev = new ScriptEvent();
                                sc_ev.Type = EventType.PartyEffect;
                                sc_ev.Variables.Add(new ScriptVariable(cd, "PARTYMEMBER", Var_Types.CLASS, Var_State.PUBLIC));
                                ScriptEngine.SendToEventQueue(sc_ev);
                            }
                        }
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitWriteLock();
                    }
                }
            }
            finally
            {
                
            }
        }
Example #9
0
        private void Script_GET_EFFECTS(string inp)
        {
                string sdest = Get_String(ref inp);
                string s_id = Get_String(ref inp);
                uint _id = Util.GetUInt32(s_id);

                ScriptVariable dest = Get_Var(sdest);

                if (dest.Type == Var_Types.SORTEDLIST)
                {
                    ((System.Collections.SortedList)dest.Value).Clear();
                }
                else
                {
                    ScriptEngine.Script_Error("Usage: GET_EFFECTS SORTEDLIST OBJECT_ID");
                    return;
                }

                Globals.PartyLock.EnterReadLock();
                try
                {
                    TargetType idType = Util.GetType(_id);
                    switch (idType)
                    {
                        case TargetType.NONE:
                        case TargetType.ERROR:
                        case TargetType.ITEM:
                        case TargetType.MYPET:
                        case TargetType.MYPET1:
                        case TargetType.MYPET2:
                        case TargetType.MYPET3:
                        case TargetType.NPC:
                            try
                            {
                                if (Globals.gamedata.nearby_npcs.ContainsKey(_id))
                                {
                                    NPCInfo npc = null;
                                    Globals.NPCLock.EnterReadLock();
                                    try
                                    {
                                        npc = Util.GetNPC(_id);
                                        foreach (CharBuff buff in npc.my_buffs.Values)
                                        {
                                            Script_ClassData cd = new Script_ClassData();
                                            cd.Name = "EFFECT";
                                            cd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                                            ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                                            if (dest.Type == Var_Types.SORTEDLIST)
                                            {
                                                // xxx - Think about this before implementing
                                                // ((System.Collections.SortedList)dest.Value).Add(skill_name, sv);
                                                ((System.Collections.SortedList)dest.Value).Add(buff.ID.ToString(), sv);
                                            }
                                        }

                                    }
                                    finally
                                    {
                                        Globals.NPCLock.ExitReadLock();
                                    }

                                }

                            }
                            finally
                            {

                            }
                            return;
                        case TargetType.PLAYER:
                            try
                            {
                                if (Globals.gamedata.PartyMembers.ContainsKey(_id))
                                {

                                    PartyMember ph = null;

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        ph = Util.GetCharParty(_id);

                                        foreach (CharBuff buff in ph.my_buffs.Values)
                                        {
                                            Script_ClassData cd = new Script_ClassData();
                                            cd.Name = "EFFECT";
                                            cd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                                            cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                                            ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                                            if (dest.Type == Var_Types.SORTEDLIST)
                                            {
                                                // xxx - Think about this before implementing
                                                // ((System.Collections.SortedList)dest.Value).Add(skill_name, sv);
                                                ((System.Collections.SortedList)dest.Value).Add(buff.ID.ToString(), sv);
                                            }
                                        }
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                }
                                else // not in pt 
                                {
                                         Globals.PlayerLock.EnterReadLock();
                                         try
                                            {
                                                 CharInfo pla = Util.GetChar(_id);
                                                  if (pla != null)
                                                       {


                                                           foreach (CharBuff buff in pla.my_buffs.Values)
                                                           {
                                                               Script_ClassData cd = new Script_ClassData();
                                                               cd.Name = "EFFECT";
                                                               cd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                                               cd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                                                               cd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                                                               cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                                                               cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                                                               ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                                                               if (dest.Type == Var_Types.SORTEDLIST)
                                                               {
                                                                   // xxx - Think about this before implementing
                                                                   // ((System.Collections.SortedList)dest.Value).Add(skill_name, sv);
                                                                   ((System.Collections.SortedList)dest.Value).Add(buff.ID.ToString(), sv);
                                                               }
                                                           }
                                                        }
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                             }
                                }
                            }
                            finally
                            {

                            }
                            return;
                        case TargetType.SELF:
                            Globals.MyBuffsListLock.EnterWriteLock();
                            try
                            {
                                foreach (CharBuff buff in Globals.gamedata.mybuffs.Values)
                                {
                                    Script_ClassData cd = new Script_ClassData();
                                    cd.Name = "EFFECT";
                                    cd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                                    cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                                    ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                                    if (dest.Type == Var_Types.SORTEDLIST)
                                    {
                                        // xxx - Think about this before implementing
                                        // ((System.Collections.SortedList)dest.Value).Add(skill_name, sv);
                                        ((System.Collections.SortedList)dest.Value).Add(buff.ID.ToString(), sv);
                                    }

                                }
                            }
                            finally
                            {
                                Globals.MyBuffsListLock.ExitWriteLock();
                            }

                            return;

                        default:
                            return;
                    }
                }

                finally
                {
                    Globals.PartyLock.ExitReadLock();
                }
        }
Example #10
0
        private void EvaluateUnary(ScriptVariable dest_ob, string op, string var1)
        {
            long dest_i = 0;
            double dest_d = 0;
            uint id = 0;
            Var_Types cast = Var_Types.NULL;

            switch (op)
            {
                case "VARIABLE_DEFINED":
                case "IS_DEFINED":
                case "[]":
                case "??":
                    if (VariableExists(var1.ToUpperInvariant()))
                    {
                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                        cast = Var_Types.INT;
                    }
                    else
                    {
                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                        cast = Var_Types.INT;
                    }
                    break;
                case "IS_LOCKED":
                    if (Locks.ContainsKey(var1.ToUpperInvariant()))
                    {
                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                        cast = Var_Types.INT;
                    }
                    else
                    {
                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                        cast = Var_Types.INT;
                    }
                    break;
                default:
                    ScriptVariable source1_ob = Get_Var(var1);

                    switch (op)
                    {
                        case "":
                            dest_ob = source1_ob;
                            return;
                        case "IS_READY":                              
                            switch(source1_ob.Type)
                            {
                                case Var_Types.INT:                                        
                                    id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);                                        
                                    break;
                                case Var_Types.STRING:
                                    id = Util.GetSkillID((string)System.Convert.ToString(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));                                        
                                    break;
                            }
                            if (Globals.gamedata.skills.ContainsKey(id))
                            {
                                UserSkill us = Util.GetSkill(id);

                                if (us.IsReady())
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                    cast = Var_Types.INT;
                                }
                                else
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                }
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }                    
                            break;
                        case "IS_ITEM_EQUIPPED":
                            bool item_found = false;
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);

                                if (Globals.gamedata.my_char.itm_Under == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_REar == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_LEar == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Neck == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_RFinger == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_LFinger == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Head == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_RHand == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_LHand == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Gloves == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Chest == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Legs == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Feet == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Back == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_LRHand == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Hair == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_Face == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_rbracelet == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_lbracelet == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman1 == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman2 == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman3 == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman4 == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman5 == test_id)
                                    item_found = true;
                                if (Globals.gamedata.my_char.itm_talisman6 == test_id)
                                    item_found = true;

                                if (item_found == true)
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                    cast = Var_Types.INT;
                                }
                                else
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                }
                                break;
                            }
                            break;
                        case "IS_AUG_EQUIPPED":
                            bool item_aug_found = false;
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                uint aug_one = 0;
                                uint aug_two = 0;
                                aug_one = Globals.gamedata.my_char.itm_Under / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Under % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_REar / 65536;
                                aug_two = Globals.gamedata.my_char.itm_REar % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_LEar / 65536;
                                aug_two = Globals.gamedata.my_char.itm_LEar % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Neck / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Neck % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_RFinger / 65536;
                                aug_two = Globals.gamedata.my_char.itm_RFinger % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_LFinger / 65536;
                                aug_two = Globals.gamedata.my_char.itm_LFinger % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Head / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Head % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_RHand / 65536;
                                aug_two = Globals.gamedata.my_char.itm_RHand % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_LHand / 65536;
                                aug_two = Globals.gamedata.my_char.itm_LHand % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Gloves / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Gloves % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Chest / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Chest % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Legs / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Legs % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Feet / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Feet % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Back / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Back % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_LRHand / 65536;
                                aug_two = Globals.gamedata.my_char.itm_LRHand % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Hair / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Hair % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_Face / 65536;
                                aug_two = Globals.gamedata.my_char.itm_Face % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_rbracelet / 65536;
                                aug_two = Globals.gamedata.my_char.itm_rbracelet % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_lbracelet / 65536;
                                aug_two = Globals.gamedata.my_char.itm_lbracelet % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman1 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman1 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman2 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman2 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman3 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman3 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman4 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman4 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman5 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman5 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;

                                aug_one = Globals.gamedata.my_char.itm_talisman6 / 65536;
                                aug_two = Globals.gamedata.my_char.itm_talisman6 % 65536;
                                if (aug_one == test_id)
                                    item_aug_found = true;
                                if (aug_two == test_id)
                                    item_aug_found = true;
    

                                if (item_aug_found == true)
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                    cast = Var_Types.INT;
                                }
                                else
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                }
                                break;
                            }
                            break;
                        case "IS_SHOP":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.NPC:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.PrivateStoreType > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.PrivateStoreType > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_SHOP was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_NOBLE":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.NPC:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.HeroIcon > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HeroIcon > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_NOBLE was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_HERO":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.NPC:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.HeroGlow > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HeroGlow > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_HERO  was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_DUELING":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:                                        
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.TeamCircle > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.TeamCircle > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(test_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (npc.TeamCircle > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_DUELING  was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_FAKEDEATH":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.isAlikeDead > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.isAlikeDead > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(test_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (npc.isAlikeDead > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_FAKEDEATH  was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_INVISIBLE":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC: 
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        // Check for Hide Buff
                                        if (Globals.gamedata.mybuffs.ContainsKey(922))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if ((player.Invisible > 0) && (player.HasEffect(AbnormalEffects.STEALTH)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_INVISIBLE was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_INCOMBAT":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET:
                                        if (Globals.gamedata.my_pet.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET1:
                                        if (Globals.gamedata.my_pet1.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET2:
                                        if (Globals.gamedata.my_pet2.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET3:
                                        if (Globals.gamedata.my_pet3.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;

                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(test_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (npc.isInCombat > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_INCOMBAT was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_SITTING":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET1:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET2:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.isSitting == 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.isSitting == 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(test_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (npc.isSitting > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_SITTING was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_WALKING":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET1:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET2:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET3:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.isRunning == 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.isRunning == 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(test_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (npc.isRunning > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_WALKING was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_FISHING":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.isFishing > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.isFishing > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_FISHING was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_DEMONSWORD":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.DemonSword > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.DemonSword > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_DEMONSWORD was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_TRANSFORMED":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.Transform_ID > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.Transform_ID > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_TRANSFORMED was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_AGATHON":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.Agathon_ID > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.Agathon_ID > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_AGATHION was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_FINDPARTY":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.FindParty > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.FindParty > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_FINDPARTY was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_USINGCUBIC":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.CubicCount > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.CubicCount > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_USINGCUBIC was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_FLAGGED":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.MYPET:
                                        if (Globals.gamedata.my_pet.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET1:
                                        if (Globals.gamedata.my_pet1.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET2:
                                        if (Globals.gamedata.my_pet2.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET3:
                                        if (Globals.gamedata.my_pet3.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.PvPFlag > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_FLAGGED was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_RED":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.NPC:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET:
                                        if (Globals.gamedata.my_pet.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET1:
                                        if (Globals.gamedata.my_pet1.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.MYPET2:
                                        if (Globals.gamedata.my_pet2.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }

                                        break;
                                    case TargetType.MYPET3:
                                        if (Globals.gamedata.my_pet3.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.Karma < 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_RED was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_PARTYMEMBER":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                    case TargetType.SELF:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if ((player.HasRelation(RelationStates.PARTY1)) ||
                                            (player.HasRelation(RelationStates.PARTY2)) ||
                                            (player.HasRelation(RelationStates.PARTY3)) ||
                                            (player.HasRelation(RelationStates.PARTY4)) ||
                                            (player.HasRelation(RelationStates.PARTYLEADER)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_PARTYMEMBER was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_PARTYLEADER":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                    case TargetType.SELF:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.PARTYLEADER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_PARTYLEADER");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_INPARTY":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                    case TargetType.SELF:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.HAS_PARTY))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_INPARTY");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_CLANMEMBER":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                     
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.ClanID > 0)
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                            
                                        if (player.HasRelation(RelationStates.CLAN_MEMBER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_CLANMEMBER");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_LEADER":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if ((Globals.gamedata.my_char.MyCharRelation(MyRelation.CROWN) || Globals.gamedata.my_char.MyCharRelation(MyRelation.FLAG)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.LEADER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_LEADER was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_CLANMATE":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                    case TargetType.SELF:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.CLAN_MATE) || (player.ClanID == Globals.gamedata.my_char.ClanID))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_CLANMATE was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_INSIEGE":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                    case TargetType.SELF:                                            
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.INSIEGE))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_INSIEGE was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_SIEGEATTACKER":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:                                                                                    
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.MyCharRelation(MyRelation.ATTACKER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.ATTACKER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_SIEGEATTACKER was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_SIEGEALLY":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(test_id);
                                switch (idType)
                                {
                                    case TargetType.NONE:
                                    case TargetType.ERROR:
                                    case TargetType.ITEM:
                                    case TargetType.MYPET:
                                    case TargetType.MYPET1:
                                    case TargetType.MYPET2:
                                    case TargetType.MYPET3:
                                    case TargetType.NPC:
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.my_char.MyCharRelation(MyRelation.DEFENDER))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(test_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();
                                        }
                                        if (player.HasRelation(RelationStates.ALLY))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IS_SIEGEALLY was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "IS_SIEGEENEMY":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:
                                        case TargetType.SELF:                                            
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasRelation(RelationStates.ENEMY))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_SIEGEENEMY was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_MUTUALWAR":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:
                                        case TargetType.SELF:                                            
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            // Globals.l2net_home.Add_Text("Script_Evaluate.cs -> Name: " + player.Name + " ID:" + player.ID + " Relation: " + player.Relation, Globals.Cyan, TextType.BOT);
                                            if (player.HasRelation(RelationStates.MUTUAL_WAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_MUTUALWAR was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ONESIDEDWAR":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:
                                        case TargetType.SELF:                                            
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasRelation(RelationStates.ONESIDED_WAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ONESIDEWAR was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ALLYMEMBER":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:                 
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.AllyID > 0)
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasRelation(RelationStates.ALLY_MEMBER))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ALLYMEMBER was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ALLYMMATE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:                 
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.AllyID > 0)
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasRelation(RelationStates.ALLY_MEMBER) && (player.AllyID == Globals.gamedata.my_char.AllyID))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ALLYMATE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_TWAR":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                        case TargetType.NPC:
                                        case TargetType.SELF:                                            
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasRelation(RelationStates.TERRITORY_WAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_TWAR was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_BLEEDING":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);
                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.BLEEDING))
                                                                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.BLEEDING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_BLEEDING was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_POISONED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            //dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            //cast = Var_Types.INT;
                                            //break;
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.POISON))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_POISONED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_REDCIRCLE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.REDCIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_REDCIRCLE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ICE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.ICE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ICE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_WIND":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.WIND))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_WIND was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_AFRAID":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FEAR) ||
                                                Globals.gamedata.my_pet.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FEAR) ||
                                                Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FEAR) ||
                                                Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FEAR) ||
                                                Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FEAR) ||
                                                Globals.gamedata.my_char.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.FEAR) ||
                                                player.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.FEAR) ||
                                                npc.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_AFRAID was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_STUNNED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_STUNNED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ASLEEP":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.SLEEP))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ASLEEP was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_MUTE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.MUTED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.MUTED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.MUTED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_MUTE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ROOTED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ROOTED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_PARALYZED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.HOLD_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_PARALYZED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_PETRIFIED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.PETRIFIED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_PETRIFIED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_BURNING":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.FLAME))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_BURNING was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_FLOATING_ROOT":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.FLOATING_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_FLOATING_ROOT was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_DANCE_STUNNED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.DANCE_STUNNED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_DANCE_STUNNED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_FIREROOT_STUN":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.FIREROOT_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_FIREROOT_STUN was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_STEALTH":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.STEALTH))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_STEALTH was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_IMPRISIONING_1":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.IMPRISIONING_1))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_IMPRISONING_1 was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_IMPRISIONING_2":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.IMPRISIONING_2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_IMPRISONING_2 was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_SOE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.MAGIC_CIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.MAGIC_CIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.MAGIC_CIRCLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_SOE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_ICE2":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.ICE2))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_ICE2 was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_EARTHQUAKE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.EARTHQUAKE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_EARTHQUAKE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_INVULNERABLE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.INVULNERABLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_INVULNERABLE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_REGEN_VITALITY":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.VITALITY))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.VITALITY))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.VITALITY))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_REGEN_VITALITY was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_REAL_TARGETED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.REAL_TARGET))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_REAL_TARGETED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_DEATH_MARKED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.DEATH_MARK))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_DEATH_MARKED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_TERRIFIED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.SKULL_FEAR))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_TERRIFIED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_CONFUSED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                            if (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET1:
                                            if (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();
                                            }
                                            if (player.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasEffect(AbnormalEffects.CONFUSED))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_CONFUSED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_INVINCIBLE":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.INVINCIBLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.INVINCIBLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.INVINCIBLE))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_INVINCIBLE was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_AIR_STUN":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.AIR_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.AIR_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.AIR_STUN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_AIR_STUN was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_AIR_ROOT":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.AIR_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.AIR_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.AIR_ROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_AIR_ROOT was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_STIGMAED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.STIGMA_SHILIEN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.STIGMA_SHILIEN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.STIGMA_SHILIEN))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_STIGMAED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_STAKATOROOT":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.STAKATOROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.STAKATOROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.STAKATOROOT))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_STAKATOROOT was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_FREEZING":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        case TargetType.MYPET:
                                        case TargetType.MYPET1:
                                        case TargetType.MYPET2:
                                        case TargetType.MYPET3:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.SELF:
                                            if (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.FREEZING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.FREEZING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.FREEZING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_FREEZING was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IS_DISABLED":
                                if (source1_ob.Type == Var_Types.INT)
                                {
                                    uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                    TargetType idType = Util.GetType(test_id);

                                    switch (idType)
                                    {
                                        case TargetType.NONE:
                                        case TargetType.ERROR:
                                        case TargetType.ITEM:
                                        //case TargetType.MYPET:
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                        case TargetType.MYPET:
                                                if ((Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FEAR)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.STUN)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.SLEEP)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.HOLD_1)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.PETRIFIED)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FLOATING_ROOT)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.DANCE_STUNNED)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.FIREROOT_STUN)) || 
                                                (Globals.gamedata.my_pet.HasEffect(AbnormalEffects.SKULL_FEAR)))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }          
                                            break;
                                        case TargetType.MYPET1:
                                            if ((Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FEAR)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.STUN)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.SLEEP)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.HOLD_1)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.PETRIFIED)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FLOATING_ROOT)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.DANCE_STUNNED)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.FIREROOT_STUN)) ||
                                            (Globals.gamedata.my_pet1.HasEffect(AbnormalEffects.SKULL_FEAR)))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET2:
                                            if ((Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FEAR)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.STUN)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.SLEEP)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.HOLD_1)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.PETRIFIED)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FLOATING_ROOT)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.DANCE_STUNNED)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.FIREROOT_STUN)) ||
                                            (Globals.gamedata.my_pet2.HasEffect(AbnormalEffects.SKULL_FEAR)))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.MYPET3:
                                            if ((Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FEAR)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.STUN)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.SLEEP)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.HOLD_1)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.PETRIFIED)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FLOATING_ROOT)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.DANCE_STUNNED)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.FIREROOT_STUN)) ||
                                            (Globals.gamedata.my_pet3.HasEffect(AbnormalEffects.SKULL_FEAR)))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.SELF:
                                            if ((Globals.gamedata.my_char.HasEffect(AbnormalEffects.FEAR)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.STUN)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.SLEEP)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.HOLD_1)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.PETRIFIED)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FLOATING_ROOT)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.DANCE_STUNNED)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.FIREROOT_STUN)) || 
                                                (Globals.gamedata.my_char.HasEffect(AbnormalEffects.SKULL_FEAR)) || 
                                                (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.AIR_STUN)) || 
                                                (Globals.gamedata.my_char.HasExtendedEffect(ExtendedEffects.FREEZING)))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.PLAYER:
                                            CharInfo player = null;
                                            Globals.PlayerLock.EnterReadLock();
                                            try
                                            {
                                                player = Util.GetChar(test_id);
                                            }
                                            finally
                                            {
                                                Globals.PlayerLock.ExitReadLock();

                                            }
                                            if (player.HasExtendedEffect(ExtendedEffects.FREEZING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        case TargetType.NPC:
                                            NPCInfo npc = null;
                                            Globals.NPCLock.EnterReadLock();
                                            try
                                            {
                                                npc = Util.GetNPC(test_id);
                                            }
                                            finally
                                            {
                                                Globals.NPCLock.ExitReadLock();
                                            }
                                            if (npc.HasExtendedEffect(ExtendedEffects.FREEZING))
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            else
                                            {
                                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                                cast = Var_Types.INT;
                                            }
                                            break;
                                        default:
                                            Globals.l2net_home.Add_Error("IS_DISABLED was not able to resolve the ID passed to it.");
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                            break;
                                    }
                                }
                            break;
                        case "IN_POLY":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                uint tmp_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                TargetType idType = Util.GetType(tmp_id);

                                switch (idType)
                                {
                                   // case TargetType.NONE:
                                   // case TargetType.ERROR:
                                      //  break;
                                    case TargetType.ITEM:
                                        ItemInfo tmp_item = null;
                                        Globals.ItemLock.EnterReadLock();
                                        try
                                        {
                                            tmp_item = Util.GetItem(tmp_id);
                                        }
                                        finally
                                        {
                                            Globals.ItemLock.ExitReadLock();
                                        }
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(tmp_item.X), Util.Float_Int32(tmp_item.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                    //GetItem
                                        break;
                                    case TargetType.MYPET:
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(Globals.gamedata.my_pet.X), Util.Float_Int32(Globals.gamedata.my_pet.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }

                                        break;
                                    case TargetType.MYPET1:
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(Globals.gamedata.my_pet1.X), Util.Float_Int32(Globals.gamedata.my_pet1.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }

                                        break;
                                    case TargetType.MYPET2:
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(Globals.gamedata.my_pet2.X), Util.Float_Int32(Globals.gamedata.my_pet2.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }

                                        break;
                                    case TargetType.MYPET3:
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(Globals.gamedata.my_pet3.X), Util.Float_Int32(Globals.gamedata.my_pet3.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }

                                        break;
                                    case TargetType.SELF:
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(Globals.gamedata.my_char.X), Util.Float_Int32(Globals.gamedata.my_char.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.PLAYER:
                                        CharInfo player = null;
                                        Globals.PlayerLock.EnterReadLock();
                                        try
                                        {
                                            player = Util.GetChar(tmp_id);
                                        }
                                        finally
                                        {
                                            Globals.PlayerLock.ExitReadLock();

                                        }
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(player.X), Util.Float_Int32(player.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    case TargetType.NPC:
                                        NPCInfo npc = null;
                                        Globals.NPCLock.EnterReadLock();
                                        try
                                        {
                                            npc = Util.GetNPC(tmp_id);
                                        }
                                        finally
                                        {
                                            Globals.NPCLock.ExitReadLock();
                                        }
                                        if (Globals.gamedata.Paths.IsPointInside(Util.Float_Int32(npc.X), Util.Float_Int32(npc.Y)))
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        else
                                        {
                                            dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                            cast = Var_Types.INT;
                                        }
                                        break;
                                    default:
                                        Globals.l2net_home.Add_Error("IN_POLY was not able to resolve the ID passed to it.");
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                        break;
                                }
                            }
                            break;
                        case "SQRT":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Sqrt(System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = System.Math.Sqrt(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "ABS":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Abs(System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Abs(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "SIN":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Sin(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Sin(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "SINH":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Sinh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Sinh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "ASIN":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Asin(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Asin(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "COS":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Cos(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Cos(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "COSH":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Cosh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Cosh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "ACOS":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Acos(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Acos(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "TAN":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Tan(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Tan(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "TANH":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Tanh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Tanh(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "ATAN":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = (long)System.Math.Atan(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.INT;
                            }
                            else if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_d = (double)System.Math.Atan(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                                cast = Var_Types.DOUBLE;
                            }
                            break;
                        case "~":
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = ~System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "IS_RUNNING":
                            bool found = false;
                            if (source1_ob.Type == Var_Types.STRING)
                            {
                                Process[] processlist = Process.GetProcesses();

                                foreach (Process theprocess in processlist)
                                {
                                    if (theprocess.ProcessName == source1_ob.Value.ToString())
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }

                            if (found)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            return;
                        case "IS_NOT_RUNNING":
                            found = false;
                            if (source1_ob.Type == Var_Types.STRING)
                            {
                                Process[] processlist = Process.GetProcesses();

                                foreach (Process theprocess in processlist)
                                {
                                    if (theprocess.ProcessName == source1_ob.Value.ToString())
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                            }

                            if (found)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "FILE_EXISTS":
                            found = false;
                            if (source1_ob.Type == Var_Types.STRING)
                            {
                                if (System.IO.File.Exists(source1_ob.Value.ToString()))
                                {
                                    found = true;
                                }
                            }

                            if (found)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?I":
                            //is the variable an integer
                            if (source1_ob.Type == Var_Types.INT)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?D":
                            //is the variable a double
                            if (source1_ob.Type == Var_Types.DOUBLE)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?$":
                            //is the variable a string
                            if (source1_ob.Type == Var_Types.STRING)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?S":
                            //is the variable a sortedlist
                            if (source1_ob.Type == Var_Types.SORTEDLIST)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?A":
                            //is the variable an arraylist
                            if (source1_ob.Type == Var_Types.ARRAYLIST)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?ST":
                            //is the variable a stack
                            if (source1_ob.Type == Var_Types.QUEUE)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?Q":
                            //is the variable a queue
                            if (source1_ob.Type == Var_Types.QUEUE)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?FR":
                            //is the variable a FILEREADER
                            if (source1_ob.Type == Var_Types.FILEREADER)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?FW":
                            //is the variable a FILEWRITER
                            if (source1_ob.Type == Var_Types.FILEWRITER)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?B":
                            //is the variable a BYTEBUFFER
                            if (source1_ob.Type == Var_Types.BYTEBUFFER)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?W":
                            //is the variable a window
                            if (source1_ob.Type == Var_Types.WINDOW)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        case "?C":
                            //is the variable a user defined class
                            if (source1_ob.Type == Var_Types.CLASS)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                            break;
                        default:
                            ScriptEngine.Script_Error("UNKNOWN MATH TYPE : " + op);
                            break;
                    }
                    break;
            }

            if(cast == Var_Types.NULL)
            {
                //we tried an operation that didn't succeed
                ScriptEngine.Script_Error("can't perform [" + op + "] on [" + var1 + "]");
            }

            switch (dest_ob.Type)
            {
                case Var_Types.INT:
                    switch(cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = dest_i;
                            break;
                        case Var_Types.DOUBLE:
                            try
                            {
                                dest_ob.Value = System.Convert.ToInt64(dest_d);
                            }
                            catch
                            {
                                //can't cast NaN to int
                                dest_ob.Value = long.MinValue;
                            }
                            break;
                    }
                    break;
                case Var_Types.DOUBLE:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = System.Convert.ToDouble(dest_i);
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = dest_d;
                            break;
                    }
                    break;
                case Var_Types.STRING:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = System.Convert.ToString(dest_i);
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = System.Convert.ToString(dest_d);
                            break;
                    }
                    break;
                case Var_Types.ASSIGNABLE:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = dest_i;
                            dest_ob.Type = Var_Types.INT;
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = dest_d;
                            dest_ob.Type = Var_Types.DOUBLE;
                            break;
                    }
                    break;
                default:
                    //script error
                    ScriptEngine.Script_Error("couldn't cast type " + cast.ToString() + " to type " + dest_ob.Type.ToString());
                    break;
            }
        }
Example #11
0
        private ScriptVariable ProcessData(System.Collections.Queue equation)
        {
            System.Collections.ArrayList tmpvars = new System.Collections.ArrayList();

            ScriptVariable outv = new ScriptVariable();
            outv.Type = Var_Types.ASSIGNABLE;

            ScriptVariable outi;

            System.Collections.Queue neweq = new System.Collections.Queue();

            //lets process all the paran bullshit first
            while (equation.Count > 0)
            {
                string token1 = equation.Dequeue().ToString();

                if (token1 == "(")
                {
                    int pcnt = 1;

                    System.Collections.Queue subeq = new System.Collections.Queue();

                    while (pcnt != 0)
                    {
                        string ntoken = equation.Dequeue().ToString();

                        if (ntoken == "(")
                        {
                            pcnt++;
                        }
                        if (ntoken == ")")
                        {
                            pcnt--;
                        }
                        if (pcnt != 0)
                        {
                            subeq.Enqueue(ntoken);
                        }
                    }

                    outi = new ScriptVariable();
                    outi.Type = Var_Types.ASSIGNABLE;
                    outi = ProcessData(subeq);

                    outi.Name = Globals.SCRIPT_OUT_VAR + Globals.Rando.Next(int.MaxValue);
                    while (VariableExists(outi.Name))
                    {
                        outi.Name = Globals.SCRIPT_OUT_VAR + Globals.Rando.Next(int.MaxValue);
                    }
                    tmpvars.Add(outi.Name);
                    Add_Variable(outi, StackHeight);

                    neweq.Enqueue(outi.Name);
                }
                else
                {
                    neweq.Enqueue(token1);
                }
            }

            //now we have a queue of pure tokens with no parans
            while (neweq.Count > 0)
            {
                string token1 = neweq.Dequeue().ToString();

                if (neweq.Count == 0)
                {
                    //we only had 1 parameter
                    outv = Get_Var(token1);
                }
                else
                {
                    outi = new ScriptVariable();
                    outi.Type = Var_Types.ASSIGNABLE;

                    string token2 = neweq.Dequeue().ToString();

                    if (isUnaryOp(token1.ToUpperInvariant()))
                    {
                        EvaluateUnary(outi, token1.ToUpperInvariant(), token2);
                    }
                    else if (isBinaryOp(token2.ToUpperInvariant()))
                    {
                        string token3 = neweq.Dequeue().ToString();

                        EvaluateBinary(outi, token2.ToUpperInvariant(), token1, token3);
                    }

                    //add our created value to the stack
                    outi.Name = Globals.SCRIPT_OUT_VAR + Globals.Rando.Next(int.MaxValue);
                    while (VariableExists(outi.Name))
                    {
                        outi.Name = Globals.SCRIPT_OUT_VAR + Globals.Rando.Next(int.MaxValue);
                    }
                    tmpvars.Add(outi.Name);
                    Add_Variable(outi, StackHeight);

                    //now we need to push this variable to the front of our queue via a temporary queue
                    System.Collections.Queue tmpeq = new System.Collections.Queue();
                    tmpeq.Enqueue(outi.Name);
                    while (neweq.Count > 0)
                    {
                        tmpeq.Enqueue(neweq.Dequeue());
                    }
                    neweq = tmpeq;
                }

            }

            //delete all our temporary variables
            foreach (string name in tmpvars)
            {
                Script_DELETE(name);
            }

            return outv;
        }
Example #12
0
        private void Function_Call(string s_file, string s_name, string s_var, string s_values, bool isClass = false, ScriptVariable s_class = null)
        {
            s_name = s_name.ToUpperInvariant();
            int call_line = Line_Pos;

            int dest_line = Get_Function_Line(s_name, s_file);
            if (dest_line == -1)
            {
                if (isClass)
                {
                    if (((Script_Class)ScriptEngine.Classes[((Script_ClassData)s_class.Value).Name]).ParentFile != "")
                    {
                        Function_Call(((Script_Class)ScriptEngine.Classes[((Script_ClassData)s_class.Value).Name]).ParentFile, s_name, s_var, s_values, isClass, s_class);
                        return;
                    }
                }
                else
                {
                    ScriptEngine.Script_Error("FUNCTION DOES NOT EXIST : " + s_name);
                    Globals.gamedata.CurrentScriptState = ScriptState.Error;
                    return;
                }
            }

            //lets grab the line of the function
            ScriptLine new_line = Get_Line(dest_line, s_file);
            string line_params = new_line.UnParsedParams;

            string st_count = Get_String(ref s_values);
            int s_count = Util.GetInt32(st_count);

            switch (new_line.Command)
            {
                case ScriptCommands.FUNCTION:
                    //public
                    break;
                case ScriptCommands.PUBLIC:
                    //public
                    break;
                case ScriptCommands.PRIVATE:
                    if (((ScriptThread)Threads[CurrentThread]).Current_File != s_file)
                    {
                        ScriptEngine.Script_Error("ILLEGAL PRIVATE FUNCTION CALL");
                        Line_Pos++;
                        return;
                    }
                    break;
                case ScriptCommands.PROTECTED:
                    if (((ScriptThread)Threads[CurrentThread]).Current_File != s_file)
                    {
                        ScriptEngine.Script_Error("ILLEGAL PROTECTED FUNCTION CALL");
                        Line_Pos++;
                        return;
                    }
                    break;
                default:
                    ScriptEngine.Script_Error("INVALID TYPED FUNCTION CALL");
                    Line_Pos++;
                    return;
            }

            string d_name = Get_String(ref line_params);
            string ds_count = Get_String(ref line_params);
            int d_count = Util.GetInt32(ds_count);

            string s_vname;
            string d_vname;

            Create_Level(StackHeight + 1);//lets clear out any variables that might be left over from the last function call

            //need to loop through all the variables passed and store in the named variables of the dest call
            for (int i = 0; i < d_count; i++)
            {
                if (i < s_count)
                {
                    //the source value is there, lets copy the contents to our new variable
                    s_vname = Get_String(ref s_values);//the source call
                    d_vname = Get_String(ref line_params);//the function def

                    ScriptVariable src_tmp = Get_Var(s_vname);

                    ScriptVariable dst_tmp = new ScriptVariable();
                    dst_tmp.Name = d_vname.ToUpperInvariant();
                    dst_tmp.Type = src_tmp.Type;
                    dst_tmp.Value = src_tmp.Value;
                    dst_tmp.State = src_tmp.State;

                    Add_Variable(dst_tmp, StackHeight + 1);
                }
                else
                {
                    //the source value is missing
                    //make it up?
                    d_vname = Get_String(ref line_params);//the function def

                    ScriptVariable dst_tmp = new ScriptVariable();
                    dst_tmp.Name = d_vname;
                    dst_tmp.Type = Var_Types.NULL;
                    dst_tmp.Value = 0L;
                    dst_tmp.State = Var_State.PUBLIC;

                    Add_Variable(dst_tmp, StackHeight + 1);
                }
            }

            if (isClass)
            {
                ScriptVariable src_tmp = new ScriptVariable();
                src_tmp.Name = "THIS";
                src_tmp.Type = Var_Types.CLASS;
                src_tmp.State = Var_State.PUBLIC;
                src_tmp.Value = s_class.Value;
                Add_Variable(src_tmp, StackHeight + 1);
            }

            //lets push our return line onto the stack
            Add_Return(s_name, call_line, ((ScriptThread)Threads[CurrentThread]).Current_File);

            //and now move us along
            StackHeight = StackHeight + 1;
            ((ScriptThread)Threads[CurrentThread]).Current_File = s_file;
            Line_Pos = dest_line + 1;//lets move to the function definition line + 1
        }
Example #13
0
 private void Add_Global(ScriptVariable var)
 {
     GlobalVariables.Add_Variable(var);
 }
Example #14
0
        private void Script_GET_ITEMS(string inp)
        {
            string sdest = Get_String(ref inp);
            ScriptVariable dest = Get_Var(sdest);

            if (dest.Type == Var_Types.ARRAYLIST)
            {
                ((System.Collections.ArrayList)dest.Value).Clear();
            }
            else if (dest.Type == Var_Types.SORTEDLIST)
            {
                ((System.Collections.SortedList)dest.Value).Clear();
            }
            else
            {
                ScriptEngine.Script_Error("INVLAID DESTINATION TYPE");
                return;
            }

            Globals.ItemLock.EnterReadLock();
            try
            {
                foreach (ItemInfo it in Globals.gamedata.nearby_items.Values)
                {
                    Script_ClassData cd = new Script_ClassData();
                    cd.Name = "ITEM";
                    cd._Variables.Add("ID", new ScriptVariable((long)it.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("X", new ScriptVariable((long)it.X, "X", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("Y", new ScriptVariable((long)it.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("Z", new ScriptVariable((long)it.Z, "Z", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("NAME", new ScriptVariable(Util.GetItemName(it.ItemID), "NAME", Var_Types.STRING, Var_State.PUBLIC));

                    cd._Variables.Add("ITEM_ID", new ScriptVariable((long)it.ItemID, "ITEM_ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("COUNT", new ScriptVariable((long)it.Count, "COUNT", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("DROPPED_BY", new ScriptVariable((long)it.DroppedBy, "DROPPED_BY", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("DROP_RADIUS", new ScriptVariable((long)it.DropRadius, "DROP_RADIUS", Var_Types.DOUBLE, Var_State.PUBLIC));
                    cd._Variables.Add("STACKABLE", new ScriptVariable((long)it.Stackable, "STACKABLE", Var_Types.INT, Var_State.PUBLIC));

                    ScriptVariable sv = new ScriptVariable(cd, "ITEM", Var_Types.CLASS, Var_State.PUBLIC);

                    if (dest.Type == Var_Types.ARRAYLIST)
                    {
                        ((System.Collections.ArrayList)dest.Value).Add(sv);
                    }
                    else if (dest.Type == Var_Types.SORTEDLIST)
                    {
                        ((System.Collections.SortedList)dest.Value).Add(it.ID.ToString(), sv);
                    }
                }
            }
            finally
            {
                Globals.ItemLock.ExitReadLock();
            }
        }
Example #15
0
        private void EvaluateBinary(ScriptVariable dest_ob, string op, string var1, string var2)
        {
            ScriptVariable source1_ob = Get_Var(var1);
            ScriptVariable source2_ob = Get_Var(var2);

            long dest_i = 0;
            double dest_d = 0;
            string dest_str = "";

            Var_Types cast = Var_Types.NULL;

            switch (op)
            {
                case "IS_RESISTED":
                        if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.STRING))
                        {
                            uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string command = (string)System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            command = command.ToUpperInvariant();

                            TargetType idType = Util.GetType(test_id);
                            switch (idType)
                            {
                                case TargetType.ERROR:
                                case TargetType.SELF:
                                case TargetType.ITEM:
                                case TargetType.NONE:
                                case TargetType.MYPET:
                                case TargetType.MYPET1:
                                case TargetType.MYPET2:
                                case TargetType.MYPET3:
                                    Globals.l2net_home.Add_Error("IS_RESISTED requires a target player or mob!");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                                case TargetType.NPC:
                                case TargetType.PLAYER:
                                    switch (command)
                                    {
                                        case "USE_SKILL":
                                            ServerPackets.Try_Use_Skill_Smart(test_id, false, false);
                                            break;
                                        case "USE_SKILL_FORCE":
                                            ServerPackets.Try_Use_Skill_Smart(test_id, true, false);
                                            break;
                                        case "USE_SKILL_SHIFT":
                                            ServerPackets.Try_Use_Skill_Smart(test_id, false, true);
                                            break;
                                        case "USE_SKILL_FORCE_SHIFT":
                                            ServerPackets.Try_Use_Skill_Smart(test_id, true, true);
                                            break;
                                        default:
                                            goto USE_SKILL_SMART_COMMAND_ERROR;
                                    }
                                    while (System.DateTime.Now.Ticks < Globals.gamedata.my_char.ExpiresTime)
                                    {   
                                        System.Threading.Thread.Sleep(1);
                                    }
                                    if (Globals.gamedata.my_char.Resisted > 0)
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                default:
                                    USE_SKILL_SMART_COMMAND_ERROR:
                                    Globals.l2net_home.Add_Error("IS_RESISTED was unable to resolve the ID passed to it.");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                            }
                        }
                        else
                        {                        
                            ScriptEngine.Script_Error("Usage: IF SKILL_ID IS_RESISTED (USE_SKILL|USE_SKILL_FORCE|USE_SKILL_SHIFT|USE_SKILL_FORCE_SHIFT)");
                        }
                    break;
                case "GROUP_HP":
                    if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.INT))
                    {
                        uint party_num = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint hp_thresh = (uint)System.Convert.ToUInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint needshp = 0;
                        uint hpp = 0;

                        // Self
                        hpp = (uint)(100 * (Globals.gamedata.my_char.Cur_HP / Globals.gamedata.my_char.Max_HP));
                        if (hpp < hp_thresh)
                        {
                            needshp++;
                        }

                        Globals.PartyLock.EnterReadLock();
                        try
                        {
                            foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                            {

                                hpp = (uint)(100 * (pl.Cur_HP / pl.Max_HP));

                                if (hpp < hp_thresh)
                                {
                                    needshp++;
                                }
                            }
                            if (needshp >= party_num)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                        }
                        finally
                        {
                            Globals.PartyLock.ExitReadLock();
                        }
                    }
                    else
                    {
                        ScriptEngine.Script_Error("Usage: IF NUM_PARTY GROUP_HP INT_PERCENT");
                    }
                    break;
                case "GROUP_MP":
                    if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.INT))
                    {
                        uint party_num = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint mp_thresh = (uint)System.Convert.ToUInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint needsmp = 0;
                        uint mpp = 0;

                        // Self
                        mpp = (uint)(100 * (Globals.gamedata.my_char.Cur_MP / Globals.gamedata.my_char.Max_MP));
                        if (mpp < mp_thresh)
                        {
                            needsmp++;
                        }

                        Globals.PartyLock.EnterReadLock();
                        try
                        {
                            foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                            {

                                mpp = (uint)(100 * (pl.Cur_MP / pl.Max_MP));

                                if (mpp < mp_thresh)
                                {
                                    needsmp++;
                                }

                                //if (mpp < mp_thresh)
                                //{
                                //    needsmp++;
                                //}
                            }
                            if (needsmp >= party_num)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                        }
                        finally
                        {
                            Globals.PartyLock.ExitReadLock();
                        }
                    }
                    else
                    {
                        ScriptEngine.Script_Error("Usage: IF NUM_PARTY GROUP_MP INT_PERCENT");
                    }
                    break;
                case "GROUP_CP":
                    if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.INT))
                    {
                        uint party_num = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint cp_thresh = (uint)System.Convert.ToUInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        uint needscp = 0;
                        uint cpp = 0;
                        // Self
                        cpp = (uint)(100 * (Globals.gamedata.my_char.Cur_CP / Globals.gamedata.my_char.Max_CP));
                        if (cpp < cp_thresh)
                        {
                            needscp++;
                        }
                        Globals.PartyLock.EnterReadLock();
                        try
                        {
                            foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                            {                                 

                                cpp = (uint)(100 * (pl.Cur_CP / pl.Max_CP));

                                if (cpp < cp_thresh)
                                {
                                    needscp++;
                                }

                                //if (cpp < cp_thresh)
                                //{
                                //    needscp++;
                                //}
                            }
                            if (needscp >= party_num)
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                            }
                            else
                            {
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                            }
                        }
                        finally
                        {
                            Globals.PartyLock.ExitReadLock();
                        }
                    }
                    else
                    {
                        ScriptEngine.Script_Error("Usage: IF NUM_PARTY GROUP_CP INT_PERCENT");
                    }
                    break; 
                case "IN_RANGE":
                    if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.INT))
                    {
                        uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);

                        TargetType idType = Util.GetType(test_id);

                        // Globals.l2net_home.Add_Text("idType = " + idType, Globals.Cyan, TextType.BOT);
                        switch (idType)
                        {
                            case TargetType.ITEM:
                            case TargetType.MYPET:
                            case TargetType.MYPET1:
                            case TargetType.MYPET2:
                            case TargetType.MYPET3:
                            case TargetType.NPC:
                            case TargetType.PLAYER:                                    
                                if (Util.Distance(test_id) <= System.Convert.ToUInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture))
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                    cast = Var_Types.INT;                                     
                                }
                                else
                                {
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;                                     
                                }
                                break;
                            case TargetType.SELF:
                                dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                cast = Var_Types.INT;
                                break;
                            case TargetType.NONE:
                            case TargetType.ERROR:
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                                return;
                            default:
                                Globals.l2net_home.Add_Error("IN_RANGE was not able to resolve the ID passed to it.");
                                dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                cast = Var_Types.INT;
                                break;
                        }
                    }
                    else
                    {
                        ScriptEngine.Script_Error("Usage: IF OBJECT_ID IN_RANGE DIST");
                    }
                    break;
                case "IS_CLAN":
                        if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.STRING))
                        {
                            uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string test_clan = (string)System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            Clan_Info ci = null;
                            TargetType idType = Util.GetType(test_id);
                            switch (idType)
                            {
                                case TargetType.NONE:
                                case TargetType.ERROR:
                                case TargetType.ITEM:
                                case TargetType.MYPET:
                                case TargetType.MYPET1:
                                case TargetType.MYPET2:
                                case TargetType.MYPET3:
                                case TargetType.NPC:
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                                case TargetType.SELF:
                                    
                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        ci = (Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID];
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                    if (ci.ClanName.ToUpperInvariant() == test_clan.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                case TargetType.PLAYER:
                                    CharInfo player = null;

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        player = Util.GetChar(test_id);
                                        ci = (Clan_Info)Globals.clanlist[player.ClanID];
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                    if (ci.ClanName.ToUpperInvariant() == test_clan.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                default:
                                    Globals.l2net_home.Add_Error("IS_CLAN was unable to resolve the ID passed to it.");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                            }
                        }
                        else
                        {
                            ScriptEngine.Script_Error("Usage: IF OBJECT_ID IS_CLAN CLAN_NAME");
                        }
                    break;
                case "IS_ALLY":
                        if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.STRING))
                        {
                            uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string test_ally = (string)System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            Clan_Info ci = null;
                            TargetType idType = Util.GetType(test_id);
                            switch (idType)
                            {
                                case TargetType.NONE:
                                case TargetType.ERROR:
                                case TargetType.ITEM:
                                case TargetType.MYPET:
                                case TargetType.MYPET1:
                                case TargetType.MYPET2:
                                case TargetType.MYPET3:
                                case TargetType.NPC:
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                                case TargetType.SELF:

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        ci = (Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID];
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                    if (ci.AllyName.ToUpperInvariant() == test_ally.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                case TargetType.PLAYER:
                                    CharInfo player = null;

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        player = Util.GetChar(test_id);
                                        ci = (Clan_Info)Globals.clanlist[player.ClanID];
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                    if (ci.AllyName.ToUpperInvariant() == test_ally.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                default:
                                    Globals.l2net_home.Add_Error("IS_ALLY was not able to resolve the ID passed to it.");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                            }
                        }
                        else
                        {
                            ScriptEngine.Script_Error("Usage: IF OBJECT_ID IS_ALLY ALLY_NAME");
                        }
                    break;
                case "IS_CLASS":
                        if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.STRING))
                        {
                            uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string test_class = (string)System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string class_name;

                            TargetType idType = Util.GetType(test_id);
                            switch (idType)
                            {
                                case TargetType.NONE:
                                case TargetType.ERROR:
                                case TargetType.ITEM:
                                case TargetType.MYPET:
                                case TargetType.MYPET1:
                                case TargetType.MYPET2:
                                case TargetType.MYPET3:
                                case TargetType.NPC:
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                                case TargetType.SELF:
                                    class_name = (string)System.Convert.ToString(Util.GetClass(Globals.gamedata.my_char.ActiveClass), System.Globalization.CultureInfo.InvariantCulture);

                                    if (class_name.ToUpperInvariant() == test_class.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                case TargetType.PLAYER:
                                    CharInfo player = null;

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        player = Util.GetChar(test_id);
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }
                                    
                                    class_name = (string)System.Convert.ToString(Util.GetClass(player.Class), System.Globalization.CultureInfo.InvariantCulture);

                                    if (class_name.ToUpperInvariant() == test_class.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                default:
                                    Globals.l2net_home.Add_Error("IS_CLASS was not able to resolve the ID passed to it.");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                            }
                        }
                        else
                        {
                            ScriptEngine.Script_Error("Usage: IF OBJECT_ID IS_CLASS CLASS_NAME");
                        }
                    break;
                case "IS_ROOTCLASS":
                        if ((source1_ob.Type == Var_Types.INT) && (source2_ob.Type == Var_Types.STRING))
                        {
                            uint test_id = (uint)System.Convert.ToUInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string test_class = (string)System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                            string class_name;

                            TargetType idType = Util.GetType(test_id);
                            switch (idType)
                            {
                                case TargetType.NONE:
                                case TargetType.ERROR:
                                case TargetType.ITEM:
                                case TargetType.MYPET:
                                case TargetType.NPC:
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                                case TargetType.SELF:
                                    class_name = (string)System.Convert.ToString(Util.GetClass(Globals.gamedata.my_char.Class), System.Globalization.CultureInfo.InvariantCulture);

                                    if (class_name.ToUpperInvariant() == test_class.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                case TargetType.PLAYER:
                                    CharInfo player = null;

                                    Globals.PlayerLock.EnterReadLock();
                                    try
                                    {
                                        player = Util.GetChar(test_id);
                                    }
                                    finally
                                    {
                                        Globals.PlayerLock.ExitReadLock();
                                    }

                                    class_name = (string)System.Convert.ToString(Util.GetClass(player.BaseClass), System.Globalization.CultureInfo.InvariantCulture);

                                    if (class_name.ToUpperInvariant() == test_class.ToUpperInvariant())
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("TRUE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    else
                                    {
                                        dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                        cast = Var_Types.INT;
                                    }
                                    break;
                                default:
                                    Globals.l2net_home.Add_Error("IS_ROOTCLASS was not able to resolve the ID passed to it.");
                                    dest_i = System.Convert.ToInt64(Get_Value("FALSE").Value);
                                    cast = Var_Types.INT;
                                    break;
                            }
                        }
                        else
                        {
                            ScriptEngine.Script_Error("Usage: IF OBJECT_ID IS_ROOTCLASS CLASS_NAME");
                        }
                    break;
                case "+":
                    if (source1_ob.Type == Var_Types.STRING)
                    {
                        dest_str = System.Convert.ToString(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) + System.Convert.ToString(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.STRING;
                    }
                    else if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) + System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) + System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "-":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) - System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) - System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "*":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) * System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) * System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "/":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) / System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) / System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "^":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = (long)System.Math.Pow(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = System.Math.Pow(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "%":
                    long tmp, tmp2;
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        tmp = System.Math.DivRem(System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture), out tmp2);
                        dest_i = tmp2;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        tmp = System.Math.DivRem(System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture), out tmp2);
                        dest_d = (double)tmp2;
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "LOG":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = (long)System.Math.Log(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_d = (double)System.Math.Log(System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture), System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture));
                        cast = Var_Types.DOUBLE;
                    }
                    break;
                case "||":
                case "OR":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        if (System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0 || System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0)
                            dest_i = 1;
                        else
                            dest_i = 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        if (System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0 || System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0)
                            dest_i = 1;
                        else
                            dest_i = 0;
                        cast = Var_Types.INT;
                    }
                    break;
                case "&&":
                case "AND":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        if (System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0 && System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0)
                            dest_i = 1;
                        else
                            dest_i = 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        if (System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0 && System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != 0)
                            dest_i = 1;
                        else
                            dest_i = 0;
                        cast = Var_Types.INT;
                    }
                    break;
                case "|":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) | System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    break;
                case "&":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) & System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    break;
                case "<<":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) << System.Convert.ToInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    break;
                case ">>":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt32(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) >> System.Convert.ToInt32(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    break;
                case "XOR":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ^ System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture);
                        cast = Var_Types.INT;
                    }
                    break;
                case "==":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) == System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 :  0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) == System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.STRING)
                    {
                        dest_i = System.String.Compare(source1_ob.Value.ToString(), source2_ob.Value.ToString()) == 0 ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else
                    {
                        if (source1_ob.Value == source2_ob.Value)
                        {
                            dest_i = 1;
                            cast = Var_Types.INT;
                        }
                        else
                        {
                            dest_i = 1;
                            cast = Var_Types.INT;
                        }
                    }
                    break;
                case "!=":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) != System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.STRING)
                    {
                        dest_i = System.String.Compare(source1_ob.Value.ToString(), source2_ob.Value.ToString()) != 0 ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else
                    {
                        if (source1_ob.Value != source2_ob.Value)
                        {
                            dest_i = 1;
                            cast = Var_Types.INT;
                        }
                        else
                        {
                            dest_i = 1;
                            cast = Var_Types.INT;
                        }
                    }
                    break;
                case "<":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) < System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) < System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    break;
                case "<=":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) <= System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) <= System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    break;
                case ">":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) > System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) > System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    break;
                case ">=":
                    if (source1_ob.Type == Var_Types.INT)
                    {
                        dest_i = System.Convert.ToInt64(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) >= System.Convert.ToInt64(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    else if (source1_ob.Type == Var_Types.DOUBLE)
                    {
                        dest_i = System.Convert.ToDouble(source1_ob.Value, System.Globalization.CultureInfo.InvariantCulture) >= System.Convert.ToDouble(source2_ob.Value, System.Globalization.CultureInfo.InvariantCulture) ? 1 : 0;
                        cast = Var_Types.INT;
                    }
                    break;
                default:
                    ScriptEngine.Script_Error("UNKNOWN MATH TYPE : " + op);
                    break;
            }

            if (cast == Var_Types.NULL)
            {
                //we tried an operation that didn't succeed
                ScriptEngine.Script_Error("invalid type: can't perform [" + source1_ob.Name + "] [" + op + "] [" + source2_ob.Name + "]");
            }


            switch (dest_ob.Type)
            {
                case Var_Types.INT:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = dest_i;
                            break;
                        case Var_Types.DOUBLE:
                            try
                            {
                                dest_ob.Value = System.Convert.ToInt64(dest_d);
                            }
                            catch
                            {
                                //cant cast NaN to int
                                dest_ob.Value = long.MinValue;
                            }
                            break;
                    }
                    break;
                case Var_Types.DOUBLE:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = System.Convert.ToDouble(dest_i);
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = dest_d;
                            break;
                    }
                    break;
                case Var_Types.STRING:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = System.Convert.ToString(dest_i);
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = System.Convert.ToString(dest_d);
                            break;
                        case Var_Types.STRING:
                            dest_ob.Value = dest_str;
                            break;
                    }
                    break;
                case Var_Types.ASSIGNABLE:
                    switch (cast)
                    {
                        case Var_Types.INT:
                            dest_ob.Value = dest_i;
                            dest_ob.Type = Var_Types.INT;
                            break;
                        case Var_Types.DOUBLE:
                            dest_ob.Value = dest_d;
                            dest_ob.Type = Var_Types.DOUBLE;
                            break;
                        case Var_Types.STRING:
                            dest_ob.Value = dest_str;
                            dest_ob.Type = Var_Types.STRING;
                            break;
                    }
                    break;
                default:
                    //script error
                    ScriptEngine.Script_Error("couldn't cast type " + cast.ToString() + " to type " + dest_ob.Type.ToString());
                    break;
            }
        }
Example #16
0
        private void Script_GET_SKILLS(string inp)
        {
                string sdest = Get_String(ref inp);
                ScriptVariable dest = Get_Var(sdest);

                if (dest.Type == Var_Types.ARRAYLIST)
                {
                    ((System.Collections.ArrayList)dest.Value).Clear();
                }
                else if (dest.Type == Var_Types.SORTEDLIST)
                {
                    ((System.Collections.SortedList)dest.Value).Clear();
                }
                else
                {
                    ScriptEngine.Script_Error("GET_SKILLS: INVLAID DESTINATION TYPE - SORTEDLIST OR ARRAYLIST ONLY");
                    return;
                }

                Globals.SkillListLock.EnterReadLock();
                try
                {
                    foreach (UserSkill us in Globals.gamedata.skills.Values)
                    {
                        Script_ClassData cd = new Script_ClassData();
                        cd.Name = "SKILL";
                        cd._Variables.Add("ID", new ScriptVariable((long)us.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("LEVEL", new ScriptVariable((long)us.Level, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("PASSIVE", new ScriptVariable((long)us.Passive, "PASSIVE", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(us.ID, us.Level), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                        cd._Variables.Add("REUSE", new ScriptVariable(Util.GetSkillReuse(us.ID), "REUSE", Var_Types.INT, Var_State.PUBLIC));

                        ScriptVariable sv = new ScriptVariable(cd, "SKILL", Var_Types.CLASS, Var_State.PUBLIC);

                        if (dest.Type == Var_Types.ARRAYLIST)
                        {
                            ((System.Collections.ArrayList)dest.Value).Add(sv);
                        }
                        else if (dest.Type == Var_Types.SORTEDLIST)
                        {
                            ((System.Collections.SortedList)dest.Value).Add(us.ID.ToString(), sv);
                        }
                    }
                }
                finally
                {
                    Globals.SkillListLock.ExitReadLock();
                }
        }
Example #17
0
        private void Assignment(ScriptVariable dest, string equation)
        {
            System.Collections.Queue parsed = new System.Collections.Queue();

            while (equation.Length > 0)
            {
                string token = ReadToken(ref equation);
                if (token.Length > 0)
                {
                    parsed.Enqueue(token);
                }
            }

            //now we have all our tokens in an array list...
            //time to evaluate
            ScriptVariable outv = ProcessData(parsed);

            switch (dest.Type)
            {
                case Var_Types.INT:
                    try
                    {
                        dest.Value = System.Convert.ToInt64(outv.Value, System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        dest.Value = 0;
                    }
                    break;
                case Var_Types.DOUBLE:
                    try
                    {
                        dest.Value = System.Convert.ToDouble(outv.Value, System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        dest.Value = 0D;
                    }
                    break;
                case Var_Types.STRING:
                    try
                    {
                        dest.Value = System.Convert.ToString(outv.Value, System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        dest.Value = "error in assingment casting from type of: " + outv.Type.ToString();
                    }
                    break;
                default:
                    dest.Value = outv.Value;
                    dest.Type = outv.Type;
                    break;
            }
        }
Example #18
0
        private void Script_GET_PARTY(string inp)
        {
            string sdest = Get_String(ref inp);
            ScriptVariable dest = Get_Var(sdest);

            if (dest.Type == Var_Types.ARRAYLIST)
            {
                ((System.Collections.ArrayList)dest.Value).Clear();
            }
            else if (dest.Type == Var_Types.SORTEDLIST)
            {
                ((System.Collections.SortedList)dest.Value).Clear();
            }
            else
            {
                ScriptEngine.Script_Error("INVLAID DESTINATION TYPE");
                return;
            }

            Globals.PartyLock.EnterReadLock();
            try
            {
                foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                {
                    CharInfo ch;

                    Globals.PlayerLock.EnterReadLock();
                    try
                    {
                        ch = Util.GetChar(pl.ID);
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitReadLock();
                    }

                    Script_ClassData cd = new Script_ClassData();
                    cd.Name = "PLAYER";
                    cd._Variables.Add("ID", new ScriptVariable((long)pl.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("NAME", new ScriptVariable(pl.Name, "NAME", Var_Types.STRING, Var_State.PUBLIC));

                    cd._Variables.Add("CLASS", new ScriptVariable((long)pl.Class, "CLASS", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("LEVEL", new ScriptVariable((long)pl.Level, "LEVEL", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("HP", new ScriptVariable((long)pl.Cur_HP, "HP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_HP", new ScriptVariable((long)pl.Max_HP, "MAX_HP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MP", new ScriptVariable((long)pl.Cur_MP, "MP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_MP", new ScriptVariable((long)pl.Max_MP, "MAX_MP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("CP", new ScriptVariable((long)pl.Cur_CP, "CP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_CP", new ScriptVariable((long)pl.Max_CP, "MAX_CP", Var_Types.INT, Var_State.PUBLIC));


                    cd._Variables.Add("PER_HP", new ScriptVariable(Math.Round((double)pl.Cur_HP / (double)pl.Max_HP * 100, 2), "PER_HP", Var_Types.DOUBLE, Var_State.PUBLIC));
                    cd._Variables.Add("PER_MP", new ScriptVariable(Math.Round((double)pl.Cur_MP / (double)pl.Max_MP * 100, 2), "PER_MP", Var_Types.DOUBLE, Var_State.PUBLIC));
                    cd._Variables.Add("PER_CP", new ScriptVariable(Math.Round((double)pl.Cur_CP / (double)pl.Max_CP * 100, 2), "PER_CP", Var_Types.DOUBLE, Var_State.PUBLIC));

                    try
                    {
                        System.Collections.SortedList buffs = new System.Collections.SortedList();
                        foreach (CharBuff buff in pl.my_buffs.Values)
                        {
                            Script_ClassData ncd = new Script_ClassData();
                            ncd.Name = "EFFECT";
                            ncd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                            ScriptVariable nsv = new ScriptVariable(ncd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                            buffs.Add(buff.ID.ToString(), nsv);
                        }

                        cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }
                    catch
                    {
                        System.Collections.SortedList empty = new System.Collections.SortedList();
                        cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)empty, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }


                    if (ch == null)
                    {
                        cd._Variables.Add("X", new ScriptVariable((long)pl.X, "X", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("Y", new ScriptVariable((long)pl.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("Z", new ScriptVariable((long)pl.Z, "Z", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("TITLE", new ScriptVariable("", "TITLE", Var_Types.STRING, Var_State.PUBLIC));
                        cd._Variables.Add("CLAN", new ScriptVariable(0L, "CLAN", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("ALLY", new ScriptVariable(0L, "ALLY", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("RACE", new ScriptVariable(0L, "RACE", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("SEX", new ScriptVariable(0L, "SEX", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("PVPFLAG", new ScriptVariable(0L, "PVPFLAG", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("KARMA", new ScriptVariable(0L, "KARMA", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("ATTACK_SPEED", new ScriptVariable(0L, "ATTACK_SPEED", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("CAST_SPEED", new ScriptVariable(0L, "CAST_SPEED", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("RUN_SPEED", new ScriptVariable(0L, "RUN_SPEED", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("TARGET_ID", new ScriptVariable(0L, "TARGET_ID", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("DEST_X", new ScriptVariable(0L, "DEST_X", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("DEST_Y", new ScriptVariable(0L, "DEST_Y", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("DEST_Z", new ScriptVariable(0L, "DEST_Z", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("LOOKS_DEAD", new ScriptVariable(0L, "LOOKS_DEAD", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("IN_COMBAT", new ScriptVariable(0L, "IN_COMBAT", Var_Types.INT, Var_State.PUBLIC));
                        //cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)pl.my_buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }
                    else
                    {
                        cd._Variables.Add("X", new ScriptVariable((long)ch.X, "X", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("Y", new ScriptVariable((long)ch.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("Z", new ScriptVariable((long)ch.Z, "Z", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("TITLE", new ScriptVariable(ch.Title, "TITLE", Var_Types.STRING, Var_State.PUBLIC));
                        cd._Variables.Add("CLAN", new ScriptVariable((long)ch.ClanID, "CLAN", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("ALLY", new ScriptVariable((long)ch.AllyID, "ALLY", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("RACE", new ScriptVariable((long)ch.Race, "RACE", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("SEX", new ScriptVariable((long)ch.Sex, "SEX", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("PVPFLAG", new ScriptVariable((long)ch.PvPFlag, "PVPFLAG", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("KARMA", new ScriptVariable((long)ch.Karma, "KARMA", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("ATTACK_SPEED", new ScriptVariable((long)(ch.PatkSpeed * ch.AttackSpeedMult), "ATTACK_SPEED", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("CAST_SPEED", new ScriptVariable((long)ch.MatkSpeed, "CAST_SPEED", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("RUN_SPEED", new ScriptVariable((long)(ch.RunSpeed * ch.MoveSpeedMult), "RUN_SPEED", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("TARGET_ID", new ScriptVariable((long)ch.TargetID, "TARGET_ID", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("DEST_X", new ScriptVariable((long)ch.Dest_X, "DEST_X", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("DEST_Y", new ScriptVariable((long)ch.Dest_Y, "DEST_Y", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("DEST_Z", new ScriptVariable((long)ch.Dest_Z, "DEST_Z", Var_Types.INT, Var_State.PUBLIC));

                        cd._Variables.Add("LOOKS_DEAD", new ScriptVariable((long)ch.isAlikeDead, "LOOKS_DEAD", Var_Types.INT, Var_State.PUBLIC));
                        cd._Variables.Add("IN_COMBAT", new ScriptVariable((long)ch.isInCombat, "IN_COMBAT", Var_Types.INT, Var_State.PUBLIC));
                        //cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)pl.my_buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }

                    ScriptVariable sv = new ScriptVariable(cd, "PLAYER", Var_Types.CLASS, Var_State.PUBLIC);

                    if (dest.Type == Var_Types.ARRAYLIST)
                    {
                        ((System.Collections.ArrayList)dest.Value).Add(sv);
                    }
                    else if (dest.Type == Var_Types.SORTEDLIST)
                    {
                        ((System.Collections.SortedList)dest.Value).Add(pl.ID.ToString(), sv);
                    }
                }
            }
            finally
            {
                Globals.PartyLock.ExitReadLock();
            }
        }
Example #19
0
 public void Add_Variable(ScriptVariable var)
 {
     this.Add(var.Name, var);
 }
Example #20
0
        public static void LoadBuffList(ByteBuffer buff)
        {
            int cnt = buff.ReadInt16();

            Globals.MyBuffsListLock.EnterWriteLock();
            try
            {
                //duration in seconds
                Globals.gamedata.mybuffs.Clear();

                for (int i = 0; i < cnt; i++)
                {
                    Add_Buff(buff);
                }

                if (Globals.gamedata.CurrentScriptState == ScriptState.Running)
                {
                    SortedList _mybuff = new SortedList();
                    if (Globals.gamedata.mybuffs.Count > 0)
                    {
                        foreach (CharBuff _buff in Globals.gamedata.mybuffs.Values)
                        {
                            Script_ClassData cd = new Script_ClassData();
                            cd.Name = "EFFECT";
                            cd._Variables.Add("ID", new ScriptVariable((long)_buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("LEVEL", new ScriptVariable((long)_buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("DURATION", new ScriptVariable((long)_buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("EFFECT_TIME", new ScriptVariable((long)_buff.EFFECT_TIME, "EFFECT_TIME", Var_Types.INT, Var_State.PUBLIC));
                            cd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(_buff.ID, _buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                            ScriptVariable sv = new ScriptVariable(cd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);
                            _mybuff.Add(_buff.ID.ToString(), sv);
                        }
                    }
                    ScriptEvent sc_ev = new ScriptEvent();
                    sc_ev.Type = EventType.CharEffect;
                    sc_ev.Variables.Add(new ScriptVariable(_mybuff, "EFFECTLIST", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    ScriptEngine.SendToEventQueue(sc_ev);
                }

            }
            finally
            {
                Globals.MyBuffsListLock.ExitWriteLock();
            }
        }
Example #21
0
        private static ScriptVariable Get_Var(string pname)
        {
            int cp = pname.IndexOf('.', 0);
            int sp = pname.IndexOf('#', 0);

            if (cp != -1 && sp != 0)
            {
                string sname = pname.Substring(0, cp);
                string dname;
                pname = pname.Remove(0, cp + 1);
                sname = Get_String(ref sname);

                ScriptVariable svar = Get_Var_Internal(sname, StackHeight);
                ScriptVariable ovar = new ScriptVariable(null, Globals.SCRIPT_OUT_VAR + svar.Name, svar.Type, svar.State);

                //now we have our variable and our .part
                do
                {
                    int _sp = pname.IndexOf(' ', 0);
                    int _dp = pname.IndexOf('.', 0);

                    if (_dp == -1)
                    {
                        cp = _sp;
                    }
                    else if (_sp == -1)
                    {
                        cp = _dp;
                    }
                    else if (_sp < _dp)
                    {
                        cp = _sp;
                    }
                    else
                    {
                        cp = _dp;
                    }
                    //cp = pname.IndexOf('.', 0);

                    if (cp == -1)
                    {
                        dname = pname.ToUpperInvariant();
                        pname = "";
                    }
                    else
                    {
                        dname = pname.Substring(0, cp).ToUpperInvariant();
                        pname = pname.Remove(0, cp + 1);
                    }

                    dname = Get_String(ref dname);

                    bool valid = false;

                    //this allows for class variables with the same name as builtin types (override sorta) ... think class with a .COUNT
                    if (svar.Type == Var_Types.CLASS)
                    {
                        if (((Script_ClassData)svar.Value)._Variables.ContainsKey(dname))
                        {
                            valid = true;
                            if (pname.Length == 0)
                            {
                                ovar = (ScriptVariable)(((Script_ClassData)svar.Value)._Variables[dname]);
                            }
                            else
                            {
                                svar = (ScriptVariable)(((Script_ClassData)svar.Value)._Variables[dname]);
                            }
                        }
                        /*foreach (ScriptVariable svc in ((Script_ClassData)svar.Value)._Variables)
                        {
                            if (svc.Name == dname)
                            {
                                valid = true;
                                if (pname.Length == 0)
                                {
                                    ovar = svc;
                                }
                                else
                                {
                                    svar = svc;
                                }
                                break;
                            }
                        }*/
                    }

                    if (!valid)
                    {
                        switch (dname)
                        {
                            case "TYPE":
                                switch (svar.Type)
                                {
                                    case Var_Types.NULL:
                                        ovar = Get_Value("NULL");
                                        break;
                                    case Var_Types.INT:
                                        ovar = Get_Value("INT");
                                        break;
                                    case Var_Types.DOUBLE:
                                        ovar = Get_Value("DOUBLE");
                                        break;
                                    case Var_Types.STRING:
                                        ovar = Get_Value("STRING");
                                        break;
                                    case Var_Types.FILEWRITER:
                                        ovar = Get_Value("FILEWRITER");
                                        break;
                                    case Var_Types.FILEREADER:
                                        ovar = Get_Value("FILEREADER");
                                        break;
                                    case Var_Types.ARRAYLIST:
                                        ovar = Get_Value("ARRAYLIST");
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        ovar = Get_Value("SORTEDLIST");
                                        break;
                                    case Var_Types.STACK:
                                        ovar = Get_Value("STACK");
                                        break;
                                    case Var_Types.QUEUE:
                                        ovar = Get_Value("QUEUE");
                                        break;
                                    case Var_Types.CLASS:
                                        ovar = Get_Value("CLASS");
                                        break;
                                    case Var_Types.BYTEBUFFER:
                                        ovar = Get_Value("BYTEBUFFER");
                                        break;
                                    case Var_Types.WINDOW:
                                        ovar = Get_Value("WINDOW");
                                        break;
                                    case Var_Types.THREAD:
                                        ovar = Get_Value("THREAD");
                                        break;
                                }
                                pname = "";
                                break;
                            case "CLASSNAME":
                                switch (svar.Type)
                                {
                                    case Var_Types.NULL:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "NULL";
                                        break;
                                    case Var_Types.INT:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "INT";
                                        break;
                                    case Var_Types.DOUBLE:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "DOUBLE";
                                        break;
                                    case Var_Types.STRING:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "STRING";
                                        break;
                                    case Var_Types.FILEWRITER:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "FILEWRITER";
                                        break;
                                    case Var_Types.FILEREADER:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "FILEREADER";
                                        break;
                                    case Var_Types.ARRAYLIST:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "ARRAYLIST";
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "SORTEDLIST";
                                        break;
                                    case Var_Types.STACK:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "STACK";
                                        break;
                                    case Var_Types.QUEUE:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "QUEUE";
                                        break;
                                    case Var_Types.CLASS:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = ((Script_ClassData)svar.Value).Name;
                                        break;
                                    case Var_Types.BYTEBUFFER:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "BYTEBUFFER";
                                        break;
                                    case Var_Types.WINDOW:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "WINDOW";
                                        break;
                                    case Var_Types.THREAD:
                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = "THREAD";
                                        break;
                                }
                                pname = "";
                                break;
                            case "LENGTH":
                            case "COUNT":
                                switch (svar.Type)
                                {
                                    case Var_Types.STRING:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(System.Convert.ToString(svar.Value).Length);
                                        break;
                                    case Var_Types.BYTEBUFFER:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).Length());
                                        break;
                                    case Var_Types.ARRAYLIST:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(((System.Collections.ArrayList)svar.Value).Count);
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(((System.Collections.SortedList)svar.Value).Count);
                                        break;
                                    case Var_Types.STACK:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(((System.Collections.Stack)svar.Value).Count);
                                        break;
                                    case Var_Types.QUEUE:
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = System.Convert.ToInt64(((System.Collections.Queue)svar.Value).Count);
                                        break;
                                }
                                pname = "";
                                break;
                            case "CLONE":
                                ovar = svar.Clone();
                                break;
                            case "GET_DEC":
                                ovar.Type = Var_Types.INT;
                                string outg = (int.Parse(svar.Value.ToString(), System.Globalization.NumberStyles.HexNumber)).ToString();
                                //Globals.l2net_home.Add_Text(outg, Globals.Green);
                                ovar.Value = outg;
                                break;
                            case "GET_HEX":
                                ovar.Type = Var_Types.STRING;
                                string dest_str_hex = "";

                                switch (svar.Type)
                                {
                                    case Var_Types.INT:
                                        ByteBuffer bb_i = new ByteBuffer(8);
                                        bb_i.WriteInt64(System.Convert.ToInt64(svar.Value));
                                        byte[] tmphex_i = bb_i.Get_ByteArray();

                                        for (int ii = 0; ii < tmphex_i.Length; ii++)
                                        {
                                            dest_str_hex += tmphex_i[ii].ToString("X2") + " ";
                                        }
                                        break;
                                    case Var_Types.DOUBLE:
                                        ByteBuffer bb_d = new ByteBuffer(8);
                                        bb_d.WriteDouble(System.Convert.ToDouble(svar.Value));
                                        byte[] tmphex_d = bb_d.Get_ByteArray();

                                        for (int ii = 0; ii < tmphex_d.Length; ii++)
                                        {
                                            dest_str_hex += tmphex_d[ii].ToString("X2") + " ";
                                        }
                                        break;
                                    case Var_Types.STRING:
                                        ByteBuffer bb_s = new ByteBuffer(System.Convert.ToString(svar.Value).Length * 2 + 2);
                                        bb_s.WriteString(System.Convert.ToString(svar.Value));
                                        byte[] tmphex_s = bb_s.Get_ByteArray();

                                        for (int ii = 0; ii < tmphex_s.Length; ii++)
                                        {
                                            dest_str_hex += tmphex_s[ii].ToString("X2") + " ";
                                        }
                                        break;
                                    case Var_Types.BYTEBUFFER:
                                        byte[] tmphex_bb = ((ByteBuffer)svar.Value).Get_ByteArray();

                                        for (int ii = 0; ii < tmphex_bb.Length; ii++)
                                        {
                                            dest_str_hex += tmphex_bb[ii].ToString("X2") + " ";
                                        }
                                        break;
                                }
                                ovar.Value = dest_str_hex;
                                pname = "";
                                break;
                            case "GET_HEX32":
                                ovar.Type = Var_Types.STRING;
                                string dest_str_hex32 = "";

                                switch (svar.Type)
                                {
                                    case Var_Types.INT:
                                        ByteBuffer bb_i = new ByteBuffer(4);
                                        bb_i.WriteInt32(System.Convert.ToInt32(svar.Value));
                                        byte[] tmphex_i = bb_i.Get_ByteArray();

                                        for (int ii = 0; ii < tmphex_i.Length; ii++)
                                        {
                                            dest_str_hex32 += tmphex_i[ii].ToString("X2") + " ";
                                        }
                                        break;
                                }
                                ovar.Value = dest_str_hex32;
                                pname = "";
                                break;
                            case "REVERSE":
                                if (svar.Type == Var_Types.ARRAYLIST)
                                {
                                    ((System.Collections.ArrayList)svar.Value).Reverse();
                                }
                                else if (svar.Type == Var_Types.STRING)
                                {
                                    if (string.IsNullOrEmpty(((string)svar.Value)))
                                    {
                                        //reverse of nothing is itself
                                    }
                                    else
                                    {
                                        System.Text.StringBuilder builder = new System.Text.StringBuilder(((string)svar.Value).Length);
                                        for (int i = ((string)svar.Value).Length - 1; i >= 0; i--)
                                        {
                                            builder.Append(((string)svar.Value)[i]);
                                        }
                                        svar.Value = builder.ToString();
                                    }
                                }
                                pname = "";
                                break;
                            case "CLEAR":
                                switch (svar.Type)
                                {
                                    case Var_Types.ARRAYLIST:
                                        ((System.Collections.ArrayList)svar.Value).Clear();
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        ((System.Collections.SortedList)svar.Value).Clear();
                                        break;
                                    case Var_Types.STACK:
                                        ((System.Collections.Stack)svar.Value).Clear();
                                        break;
                                    case Var_Types.QUEUE:
                                        ((System.Collections.Queue)svar.Value).Clear();
                                        break;
                                }
                                pname = "";
                                break;
                            case "TO_UPPER":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).ToUpper();
                                    //svar.State = Var_State.PUBLIC;
                                }
                                pname = "";
                                break;
                            case "TO_UPPER_INVARIANT":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).ToUpperInvariant();
                                    //svar.State = Var_State.PUBLIC;
                                }
                                pname = "";
                                break;
                            case "TO_LOWER":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).ToLower();
                                    //svar.State = Var_State.PUBLIC;
                                }
                                pname = "";
                                break;
                            case "TO_LOWER_INVARIANT":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).ToLowerInvariant();
                                    //svar.State = Var_State.PUBLIC;
                                }
                                pname = "";
                                break;
                            case "TRIM":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).Trim();
                                    //svar.State = Var_State.PUBLIC;
                                }
                                pname = "";
                                break;
                            case "LASTINDEXOF":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ovar.Type = Var_Types.INT;
                                    ovar.Value = System.Convert.ToString(svar.Value).LastIndexOf(v1.Value.ToString());
                                }
                                pname = "";
                                break;
                            case "INDEXOF":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ovar.Type = Var_Types.INT;
                                    ovar.Value = System.Convert.ToString(svar.Value).IndexOf(v1.Value.ToString());
                                }
                                pname = "";
                                break;
                            case "TRIMEND":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).TrimEnd(v1.Value.ToString().ToCharArray());
                                }
                                pname = "";
                                break;
                            case "TRIMSTART":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).TrimStart(v1.Value.ToString().ToCharArray());
                                }
                                pname = "";
                                break;
                            case "CONTAINS":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    if (svar.Value.ToString().Contains(v1.Value.ToString()))
                                    {
                                        ovar = Get_Value("TRUE");
                                    }
                                    else
                                    {
                                        ovar = Get_Value("FALSE");
                                    }
                                }
                                break;
                            case "SUBSTRING":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    string sv2 = Get_String(ref pname);
                                    ScriptVariable v2 = Get_Var(sv2);

                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).Substring(System.Convert.ToInt32(v1.Value), System.Convert.ToInt32(v2.Value));
                                }
                                break;
                            case "REPLACE":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    string sv2 = Get_String(ref pname);
                                    ScriptVariable v2 = Get_Var(sv2);

                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(svar.Value).Replace(v1.Value.ToString(), v2.Value.ToString());
                                }
                                break;
                            case "STARTSWITH":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    if (svar.Value.ToString().StartsWith(v1.Value.ToString()))
                                    {
                                        ovar = Get_Value("TRUE");
                                    }
                                    else
                                    {
                                        ovar = Get_Value("FALSE");
                                    }
                                }
                                break;
                            case "ENDSWITH":
                                if (svar.Type == Var_Types.STRING)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    if (svar.Value.ToString().EndsWith(v1.Value.ToString()))
                                    {
                                        ovar = Get_Value("TRUE");
                                    }
                                    else
                                    {
                                        ovar = Get_Value("FALSE");
                                    }
                                }
                                break;
                            case "FLUSH":
                                if (svar.Type == Var_Types.FILEWRITER)
                                {
                                    ((System.IO.StreamWriter)svar.Value).Flush();
                                }
                                break;
                            case "CLOSE":
                                if (svar.Type == Var_Types.FILEWRITER)
                                {
                                    ((System.IO.StreamWriter)svar.Value).Close();
                                }
                                else if (svar.Type == Var_Types.FILEREADER)
                                {
                                    ((System.IO.StreamReader)svar.Value).Close();
                                }
                                break;
                            case "WRITE":
                                if (svar.Type == Var_Types.FILEWRITER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ((System.IO.StreamWriter)svar.Value).WriteLine(
                                        System.Convert.ToString(v1.Value, System.Globalization.CultureInfo.InvariantCulture));
                                }
                                break;
                            case "READ":
                                if (svar.Type == Var_Types.FILEREADER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    switch (v1.Type)
                                    {
                                        case Var_Types.INT:
                                            v1.Value = System.Convert.ToInt64(((System.IO.StreamReader)svar.Value).ReadLine(), System.Globalization.CultureInfo.InvariantCulture);
                                            break;
                                        case Var_Types.DOUBLE:
                                            v1.Value = System.Convert.ToDouble(((System.IO.StreamReader)svar.Value).ReadLine(), System.Globalization.CultureInfo.InvariantCulture);
                                            break;
                                        case Var_Types.STRING:
                                            v1.Value = ((System.IO.StreamReader)svar.Value).ReadLine();
                                            break;
                                    }
                                }
                                break;
                            case "GET_KEY":
                                if (svar.Type == Var_Types.SORTEDLIST)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ovar.Type = Var_Types.STRING;
                                    ovar.Value = System.Convert.ToString(((System.Collections.SortedList)svar.Value).GetKey(System.Convert.ToInt32(v1.Value)));
                                }
                                break;
                            case "ADD":
                            case "PUSH":
                                switch (svar.Type)
                                {
                                    case Var_Types.ARRAYLIST:
                                        string sv1 = Get_String(ref pname);
                                        ScriptVariable v1 = Get_Var(sv1);

                                        ((System.Collections.ArrayList)svar.Value).Add(v1);
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        string sortedlist_sv1 = Get_String(ref pname);
                                        ScriptVariable sortedlist_v1 = Get_Var(sortedlist_sv1);
                                        string sortedlist_sv2 = Get_String(ref pname).ToUpperInvariant();
                                        //ScriptVariable v2 = Get_Var(sv2);//key is a string, don't need this

                                        if (((System.Collections.SortedList)svar.Value).ContainsKey(sortedlist_sv2))
                                        {
                                            ScriptEngine.Script_Error("key: " + sortedlist_sv2 + " already exists in: " + sortedlist_v1.Name);
                                        }
                                        else
                                        {
                                            ((System.Collections.SortedList)svar.Value).Add(sortedlist_sv2, sortedlist_v1);
                                        }
                                        break;
                                    case Var_Types.STACK:
                                        string stack_sv1 = Get_String(ref pname);
                                        ScriptVariable stack_v1 = Get_Var(stack_sv1);

                                        ((System.Collections.Stack)svar.Value).Push(stack_v1);
                                        break;
                                    case Var_Types.QUEUE:
                                        string queue_sv1 = Get_String(ref pname);
                                        ScriptVariable queue_v1 = Get_Var(queue_sv1);

                                        ((System.Collections.Queue)svar.Value).Enqueue(queue_v1);
                                        break;
                                }
                                pname = "";
                                break;
                            case "REMOVE":
                                switch (svar.Type)
                                {
                                    case Var_Types.ARRAYLIST:
                                        string arraylist_sv1 = Get_String(ref pname);

                                        ((System.Collections.ArrayList)svar.Value).RemoveAt(Util.GetInt32(arraylist_sv1));
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        string sortedlist_sv1 = Get_String(ref pname).ToUpperInvariant();

                                        ((System.Collections.SortedList)svar.Value).Remove(sortedlist_sv1);
                                        break;
                                    case Var_Types.STRING:
                                        string string_sv1 = Get_String(ref pname);
                                        ScriptVariable v1 = Get_Var(string_sv1);

                                        string string_sv2 = Get_String(ref pname);
                                        ScriptVariable v2 = Get_Var(string_sv2);

                                        ovar.Type = Var_Types.STRING;
                                        ovar.Value = System.Convert.ToString(svar.Value).Remove(System.Convert.ToInt32(v1.Value), System.Convert.ToInt32(v2.Value));
                                        break;
                                }
                                pname = "";
                                break;
                            case "REMOVEAT":
                                switch (svar.Type)
                                {
                                    case Var_Types.ARRAYLIST:
                                        string sv1 = Get_String(ref pname);

                                        ((System.Collections.ArrayList)svar.Value).RemoveAt(Util.GetInt32(sv1));
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        string sortedlist_sv1 = Get_String(ref pname);

                                        ((System.Collections.SortedList)svar.Value).RemoveAt(Util.GetInt32(sortedlist_sv1));
                                        break;
                                }
                                pname = "";
                                break;
                            case "CONTAINS_KEY":
                                if (svar.Type == Var_Types.SORTEDLIST)
                                {
                                    string sv1 = Get_String(ref pname).ToUpperInvariant();

                                    if (((System.Collections.SortedList)svar.Value).ContainsKey(sv1))
                                    {
                                        ovar = Get_Value("TRUE");
                                    }
                                    else
                                    {
                                        ovar = Get_Value("FALSE");
                                    }
                                }
                                break;
                                
                            case "EFFECT_TIME":
                                if (svar.Type == Var_Types.SORTEDLIST)
                                {
                                    string sv1 = Get_String(ref pname).ToUpperInvariant();

                                    if (((System.Collections.SortedList)svar.Value).ContainsKey(sv1))
                                    {

                                        //Looks crappy but it works
                                        long duration = System.Convert.ToInt64(((ScriptVariable)(((Script_ClassData)(((ScriptVariable)(((SortedList)svar.Value)[sv1])).Value))._Variables["DURATION"])).Value);
                                        duration = (duration - System.DateTime.Now.Ticks) / TimeSpan.TicksPerSecond;
                                        ovar.Type = Var_Types.INT;
                                        ovar.Value = duration;
                                    }
                                }
                                break;                                 
                            case "POP":
                                if (svar.Type == Var_Types.STACK)
                                {
                                    ScriptVariable v1 = (ScriptVariable)(((System.Collections.Stack)svar.Value).Pop());
                                    ovar.Type = v1.Type;
                                    ovar.Value = v1.Value;
                                }
                                if (svar.Type == Var_Types.QUEUE)
                                {
                                    ScriptVariable v1 = (ScriptVariable)(((System.Collections.Queue)svar.Value).Dequeue());
                                    ovar.Type = v1.Type;
                                    ovar.Value = v1.Value;
                                }
                                pname = "";
                                break;
                            case "PEEK":
                                if (svar.Type == Var_Types.STACK)
                                {
                                    ScriptVariable v1 = (ScriptVariable)(((System.Collections.Stack)svar.Value).Peek());
                                    ovar.Type = v1.Type;
                                    ovar.Value = v1.Value;
                                }
                                if (svar.Type == Var_Types.QUEUE)
                                {
                                    ScriptVariable v1 = (ScriptVariable)(((System.Collections.Queue)svar.Value).Peek());
                                    ovar.Type = v1.Type;
                                    ovar.Value = v1.Value;
                                }
                                pname = "";
                                break;
                            case "WRITE_UINT16":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    try
                                    {
                                        ((ByteBuffer)svar.Value).WriteUInt16(System.Convert.ToUInt16(v1.Value));
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("possible overflow writing " + v1.Name + " as UINT16");
                                    }
                                }
                                pname = "";
                                break;
                            case "WRITE_UINT32":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    try
                                    {
                                        ((ByteBuffer)svar.Value).WriteUInt32(System.Convert.ToUInt32(v1.Value));
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("possible overflow writing " + v1.Name + " as UINT32");
                                    }
                                }
                                pname = "";
                                break;
                            case "WRITE_UINT64":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ((ByteBuffer)svar.Value).WriteUInt64(System.Convert.ToUInt64(v1.Value));
                                }
                                pname = "";
                                break;
                            case "WRITE_INT16":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    try
                                    {
                                        ((ByteBuffer)svar.Value).WriteInt16(System.Convert.ToInt16(v1.Value));
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("possible overflow writing " + v1.Name + " as INT16");
                                    }
                                }
                                pname = "";
                                break;
                            case "WRITE_INT32":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    try
                                    {
                                        ((ByteBuffer)svar.Value).WriteInt32(System.Convert.ToInt32(v1.Value));
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("possible overflow writing " + v1.Name + " as INT32");
                                    }
                                }
                                pname = "";
                                break;
                            case "WRITE_INT64":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ((ByteBuffer)svar.Value).WriteInt64(System.Convert.ToInt64(v1.Value));
                                }
                                pname = "";
                                break;
                            case "WRITE_DOUBLE":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ((ByteBuffer)svar.Value).WriteDouble(System.Convert.ToDouble(v1.Value));
                                }
                                pname = "";
                                break;
                            case "WRITE_BYTE":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    try
                                    {
                                        ((ByteBuffer)svar.Value).WriteByte(System.Convert.ToByte(v1.Value));
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("possible overflow writing " + v1.Name + " as BYTE");
                                    }
                                }
                                pname = "";
                                break;
                            case "WRITE_STRING":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);

                                    ((ByteBuffer)svar.Value).WriteString(System.Convert.ToString(v1.Value));
                                }
                                pname = "";
                                break;
                            case "READ_UINT16":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadUInt16());
                                }
                                pname = "";
                                break;
                            case "READ_UINT32":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadUInt32());
                                }
                                pname = "";
                                break;
                            case "READ_UINT64":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadUInt64());
                                }
                                pname = "";
                                break;
                            case "READ_INT16":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadInt16());
                                }
                                pname = "";
                                break;
                            case "READ_INT32":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadInt32());
                                }
                                pname = "";
                                break;
                            case "READ_INT64":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadInt64());
                                }
                                pname = "";
                                break;
                            case "READ_DOUBLE":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.DOUBLE;
                                    v1.Value = System.Convert.ToDouble(((ByteBuffer)svar.Value).ReadDouble());
                                }
                                pname = "";
                                break;
                            case "READ_BYTE":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.INT;
                                    v1.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).ReadByte());
                                }
                                pname = "";
                                break;
                            case "READ_STRING":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    string sv1 = Get_String(ref pname);
                                    ScriptVariable v1 = Get_Var(sv1);
                                    v1.Type = Var_Types.STRING;
                                    v1.Value = System.Convert.ToString(((ByteBuffer)svar.Value).ReadString());
                                }
                                pname = "";
                                break;
                            case "INDEX":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    ovar.Type = Var_Types.INT;
                                    ovar.Value = System.Convert.ToInt64(((ByteBuffer)svar.Value).GetIndex());
                                }
                                pname = "";
                                break;
                            case "RESET_INDEX":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    ((ByteBuffer)svar.Value).ResetIndex();
                                }
                                pname = "";
                                break;
                            case "TRIM_TO_INDEX":
                                if (svar.Type == Var_Types.BYTEBUFFER)
                                {
                                    ((ByteBuffer)svar.Value).TrimToIndex();
                                }
                                pname = "";
                                break;
                            case "RUN_WINDOW":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Open_Window();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to open window " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "CLOSE_WINDOW":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Kill();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to close window " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "SET_FILENAME":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    string sv1 = Get_String(ref pname);
                                    string sv2 = Get_String(ref pname);

                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Set_FileName(sv1, sv2);
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to set filename for " + svar.Name + " with : " + sv1 + " :: " + sv2);
                                    }
                                }
                                pname = "";
                                break;
                            case "SET_NAME":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    string sv1 = Get_String(ref pname);

                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Set_WindowName(sv1);
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to set windowname for " + svar.Name + " with : " + sv1);
                                    }
                                }
                                pname = "";
                                break;
                            case "SET_HTML":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    string sv1 = Get_String(ref pname);

                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Set_HTML(sv1);
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to set html for " + svar.Name + " with : " + sv1);
                                    }
                                }
                                pname = "";
                                break;
                            case "REFRESH":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Refresh();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to refresh for " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "STANDARD_IN":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    string sv1 = Get_String(ref pname);

                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Send_StandardInput(sv1);
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to send to standard in for " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "WAIT_CLOSE":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Wait_Close();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to wait close " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "WAIT_IDLE":
                                if (svar.Type == Var_Types.WINDOW)
                                {
                                    try
                                    {
                                        ((ScriptWindow)svar.Value).Wait_Idle();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to wait idle " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "STOP":
                                if (svar.Type == Var_Types.THREAD)
                                {
                                    try
                                    {
                                        ((ScriptThread)svar.Value).Stop();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to stop thread " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "START":
                                if (svar.Type == Var_Types.THREAD)
                                {
                                    try
                                    {
                                        ((ScriptThread)svar.Value).Start();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to start thread " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            case "SEND_TO_STACK":
                                if (svar.Type == Var_Types.THREAD)
                                {
                                    try
                                    {
                                        ((ScriptThread)svar.Value).Start();
                                    }
                                    catch
                                    {
                                        ScriptEngine.Script_Error("failed to start thread " + svar.Name);
                                    }
                                }
                                pname = "";
                                break;
                            default:
                                //is it a class?
                                valid = false;
                                switch (svar.Type)
                                {
                                    case Var_Types.CLASS:
                                        //this isn't really needed since we already check if it is a class variable before we even get this far
                                        if (((Script_ClassData)svar.Value)._Variables.ContainsKey(dname))
                                        {
                                            valid = true;
                                            if (pname.Length == 0)
                                            {
                                                ovar = (ScriptVariable)(((Script_ClassData)svar.Value)._Variables[dname]);
                                            }
                                            else
                                            {
                                                svar = (ScriptVariable)(((Script_ClassData)svar.Value)._Variables[dname]);
                                            }
                                        }
                                        /*foreach (ScriptVariable svc in ((Script_ClassData)svar.Value)._Variables)
                                        {
                                            if (svc.Name == dname)
                                            {
                                                valid = true;
                                                if (pname.Length == 0)
                                                {
                                                    ovar = svc;
                                                }
                                                else
                                                {
                                                    svar = svc;
                                                }
                                                break;
                                            }
                                        }*/
                                        break;
                                    case Var_Types.ARRAYLIST:
                                        ScriptVariable sva = Get_Var(dname);
                                        switch (sva.Type)
                                        {
                                            case Var_Types.INT:
                                                valid = true;
                                                if (pname.Length == 0)
                                                {
                                                    ovar = (ScriptVariable)(((System.Collections.ArrayList)svar.Value)[System.Convert.ToInt32(sva.Value)]);
                                                }
                                                else
                                                {
                                                    svar = (ScriptVariable)(((System.Collections.ArrayList)svar.Value)[System.Convert.ToInt32(sva.Value)]);
                                                }
                                                break;
                                        }
                                        break;
                                    case Var_Types.SORTEDLIST:
                                        ScriptVariable svl = Get_Var(dname);
                                        switch (svl.Type)
                                        {
                                            case Var_Types.INT:
                                                valid = true;
                                                if (pname.Length == 0)
                                                {
                                                    ovar = (ScriptVariable)(((System.Collections.SortedList)svar.Value).GetByIndex(System.Convert.ToInt32(svl.Value)));
                                                }
                                                else
                                                {
                                                    svar = (ScriptVariable)(((System.Collections.SortedList)svar.Value).GetByIndex(System.Convert.ToInt32(svl.Value)));
                                                }
                                                break;
                                            case Var_Types.STRING:
                                                valid = true;
                                                if (pname.Length == 0)
                                                {
                                                    ovar = (ScriptVariable)(((System.Collections.SortedList)svar.Value)[System.Convert.ToString(svl.Value).ToUpperInvariant()]);
                                                }
                                                else
                                                {
                                                    svar = (ScriptVariable)(((System.Collections.SortedList)svar.Value)[System.Convert.ToString(svl.Value).ToUpperInvariant()]);
                                                }
                                                break;
                                        }
                                        break;
                                }

                                if (!valid)
                                {
                                    ScriptEngine.Script_Error(dname + " does not exist!");
                                    throw new Exception();
                                }
                                break;
                        }
                    } //end of if this wasn't a class variable to being with
                } while (pname.Length != 0);//.IndexOf(".", 0) != -1);

                return ovar;
            }
            else
            {
                return Get_Var_Internal(pname, StackHeight);
            }
        }
Example #22
0
		public void Add_Variable(ScriptVariable var)
		{
            this.Add(var.Name, var);
		}
Example #23
0
        public ScriptVariable Clone()
        {
            if (State == Var_State.STATIC)
            {
                return this;
            }

            ScriptVariable sout = new ScriptVariable();

            sout.Name = Name;
            sout.Type = Type;
            sout.State = State;

            switch (Type)
            {
                case Var_Types.NULL:
                    sout.Value = null;
                    break;
                case Var_Types.INT:
                    sout.Value = (long)Value;
                    break;
                case Var_Types.DOUBLE:
                    sout.Value = (double)Value;
                    break;
                case Var_Types.STRING:
                    sout.Value = (string)Value;
                    break;
                case Var_Types.FILEWRITER:
                    sout.Value = Value;
                    break;
                case Var_Types.FILEREADER:
                    sout.Value = Value;
                    break;
                case Var_Types.ARRAYLIST:
                    sout.Value = new System.Collections.ArrayList(((System.Collections.ArrayList)Value).Capacity);

                    foreach (ScriptVariable nv in ((System.Collections.ArrayList)Value))
                    {
                        ((System.Collections.ArrayList)sout.Value).Add(nv.Clone());
                    }
                    break;
                case Var_Types.SORTEDLIST:
                    sout.Value = new System.Collections.SortedList(((System.Collections.SortedList)Value).Capacity);

                    foreach (System.Collections.DictionaryEntry dic in ((System.Collections.SortedList)Value))
                    {
                        ((System.Collections.SortedList)sout.Value).Add(dic.Key, ((ScriptVariable)dic.Value).Clone());
                    }
                    break;
                case Var_Types.STACK:
                    sout.Value = new System.Collections.Stack(((System.Collections.Stack)Value).Count);

                    foreach (ScriptVariable nv in ((System.Collections.Stack)Value))
                    {
                        ((System.Collections.Stack)sout.Value).Push(nv.Clone());
                    }
                    break;
                case Var_Types.QUEUE:
                    sout.Value = new System.Collections.Queue(((System.Collections.Queue)Value).Count);

                    foreach (ScriptVariable nv in ((System.Collections.Queue)Value))
                    {
                        ((System.Collections.Queue)sout.Value).Enqueue(nv.Clone());
                    } 
                    break;
                case Var_Types.CLASS:
                    sout.Value = new Script_ClassData();
                    ((Script_ClassData)sout.Value).Name = ((Script_ClassData)Value).Name;

                    foreach (ScriptVariable nv in ((Script_ClassData)Value)._Variables.Values)
                    {
                        ((Script_ClassData)sout.Value)._Variables.Add(nv.Name, nv.Clone());
                    }
                    break;
                case Var_Types.BYTEBUFFER:
                    sout.Value = new ByteBuffer((ByteBuffer)Value);
                    break;
                case Var_Types.WINDOW:
                    sout.Value = Value;
                    break;
                case Var_Types.THREAD:
                    sout.Value = Value;
                    break;
                default:
                    sout.Value = Value;
                    break;
            }

            return sout;
        }
Example #24
0
        public void ReadFile(ScriptFile filein)
        {
            File = filein.Name;

            //gotta find the varbeing and varend and read in the middle
            bool cstarted = false;
            bool vstarted = false;
            bool cended   = false;

            string p1, p2, p3;

            for (int i = 0; i < filein._ScriptLines.Count; i++)
            {
                ScriptLine cmd = (ScriptLine)filein._ScriptLines[i];

                string line = cmd.UnParsedParams;

                switch (cmd.Command)
                {
                case ScriptCommands.INCLUDE:
                    if (!cstarted)
                    {
                        Globals.scriptthread.Script_INCLUDE(line);
                    }
                    break;

                case ScriptCommands.PUBLIC:
                    if (cstarted && vstarted)
                    {
                        //defining a variable
                        p1 = ScriptEngine.Get_String(ref line);
                        p2 = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                        p3 = ScriptEngine.Get_String(ref line);

                        ScriptVariable nv = ScriptEngine.Create_Variable(p1, p2, p3, Var_State.PUBLIC);

                        _Variables.Add(nv);
                    }
                    else if (cstarted)
                    {
                        //a function
                        p1 = ScriptEngine.Get_String(ref line);
                        Add_Function(p1, i, filein, Var_State.PUBLIC);
                    }
                    break;

                case ScriptCommands.PRIVATE:
                    if (cstarted && vstarted)
                    {
                        //defining a variable
                        p1 = ScriptEngine.Get_String(ref line);
                        p2 = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                        p3 = ScriptEngine.Get_String(ref line);

                        ScriptVariable nv = ScriptEngine.Create_Variable(p1, p2, p3, Var_State.PRIVATE);

                        _Variables.Add(nv);
                    }
                    else if (cstarted)
                    {
                        //a function
                        p1 = ScriptEngine.Get_String(ref line);
                        Add_Function(p1, i, filein, Var_State.PRIVATE);
                    }
                    break;

                case ScriptCommands.PROTECTED:
                    if (cstarted && vstarted)
                    {
                        //defining a variable
                        p1 = ScriptEngine.Get_String(ref line);
                        p2 = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                        p3 = ScriptEngine.Get_String(ref line);

                        ScriptVariable nv = ScriptEngine.Create_Variable(p1, p2, p3, Var_State.PROTECTED);

                        _Variables.Add(nv);
                    }
                    else if (cstarted)
                    {
                        //a function
                        p1 = ScriptEngine.Get_String(ref line);
                        Add_Function(p1, i, filein, Var_State.PROTECTED);
                    }
                    break;

                case ScriptCommands.STATIC:
                    if (cstarted && vstarted)
                    {
                        //defining a variable
                        p1 = ScriptEngine.Get_String(ref line);
                        p2 = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                        p3 = ScriptEngine.Get_String(ref line);

                        ScriptVariable nv = ScriptEngine.Create_Variable(p1, p2, p3, Var_State.STATIC);

                        _Variables.Add(nv);
                    }
                    else if (cstarted)
                    {
                        //a function
                        p1 = ScriptEngine.Get_String(ref line);
                        Add_Function(p1, i, filein, Var_State.STATIC);
                    }
                    break;

                case ScriptCommands.CLASS:
                    cstarted = true;
                    Name     = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                    p1       = ScriptEngine.Get_String(ref line).ToUpperInvariant();
                    if (p1 != "NULL" && p1.Length != 0)
                    {
                        //gotta find this class... and copy over it's stuff
                        if (ScriptEngine.Classes.ContainsKey(p1))
                        {
                            Script_Class sc = (Script_Class)ScriptEngine.Classes[p1];

                            foreach (ScriptVariable nv in sc._Variables)
                            {
                                _Variables.Add(nv.Clone());
                            }

                            ParentName = sc.Name;
                            ParentFile = sc.File;
                        }
                        else
                        {
                            ScriptEngine.Script_Error("CLASS [" + p1 + "] NOT LOADED PRIOR TO USAGE");
                        }
                    }
                    break;

                case ScriptCommands.END_CLASS:
                    cended   = true;
                    cstarted = false;
                    break;

                case ScriptCommands.VAR_START:
                    vstarted = true;
                    break;

                case ScriptCommands.VAR_END:
                    vstarted = false;
                    break;
                }

                if (cended)
                {
                    break;
                }
            }
        }
Example #25
0
        private void Script_GET_NPCS(string inp)
        {
            string sdest = Get_String(ref inp);
            ScriptVariable dest = Get_Var(sdest);

            if (dest.Type == Var_Types.ARRAYLIST)
            {
                ((System.Collections.ArrayList)dest.Value).Clear();
            }
            else if (dest.Type == Var_Types.SORTEDLIST)
            {
                ((System.Collections.SortedList)dest.Value).Clear();
            }
            else
            {
                ScriptEngine.Script_Error("INVLAID DESTINATION TYPE");
                return;
            }

            Globals.NPCLock.EnterReadLock();
            try
            {
                foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values)
                {
                    Script_ClassData cd = new Script_ClassData();
                    cd.Name = "NPC";
                    cd._Variables.Add("ID", new ScriptVariable((long)npc.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("X", new ScriptVariable((long)npc.X, "X", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("Y", new ScriptVariable((long)npc.Y, "Y", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("Z", new ScriptVariable((long)npc.Z, "Z", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("NAME", new ScriptVariable(Util.GetNPCName(npc.NPCID), "NAME", Var_Types.STRING, Var_State.PUBLIC));

                    cd._Variables.Add("NPC_ID", new ScriptVariable((long)npc.NPCID, "NPC_ID", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("TITLE", new ScriptVariable(npc.Title, "TITLE", Var_Types.STRING, Var_State.PUBLIC));
                    cd._Variables.Add("ATTACKABLE", new ScriptVariable((long)npc.isAttackable, "ATTACKABLE", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("LEVEL", new ScriptVariable((long)npc.Level, "LEVEL", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("HP", new ScriptVariable((long)npc.Cur_HP, "HP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_HP", new ScriptVariable((long)npc.Max_HP, "MAX_HP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MP", new ScriptVariable((long)npc.Cur_MP, "MP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_MP", new ScriptVariable((long)npc.Max_MP, "MAX_MP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("CP", new ScriptVariable((long)npc.Cur_CP, "CP", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("MAX_CP", new ScriptVariable((long)npc.Max_CP, "MAX_CP", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("PER_HP", new ScriptVariable(Math.Round((double)npc.Cur_HP / (double)npc.Max_HP * 100, 2), "PER_HP", Var_Types.DOUBLE, Var_State.PUBLIC));
                    cd._Variables.Add("PER_MP", new ScriptVariable(Math.Round((double)npc.Cur_MP / (double)npc.Max_MP * 100, 2), "PER_MP", Var_Types.DOUBLE, Var_State.PUBLIC));
                    cd._Variables.Add("PER_CP", new ScriptVariable(Math.Round((double)npc.Cur_CP / (double)npc.Max_CP * 100, 2), "PER_CP", Var_Types.DOUBLE, Var_State.PUBLIC));

                    cd._Variables.Add("KARMA", new ScriptVariable((long)npc.Karma, "KARMA", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("ATTACK_SPEED", new ScriptVariable((long)(npc.PatkSpeed * npc.AttackSpeedMult), "ATTACK_SPEED", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("CAST_SPEED", new ScriptVariable((long)npc.PatkSpeed, "CAST_SPEED", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("RUN_SPEED", new ScriptVariable((long)(npc.RunSpeed * npc.MoveSpeedMult), "RUN_SPEED", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("TARGET_ID", new ScriptVariable((long)npc.TargetID, "TARGET_ID", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("FOLLOW_TARGET_ID", new ScriptVariable((long)npc.MoveTarget, "FOLLOW_TARGET_ID", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("DEST_X", new ScriptVariable((long)npc.Dest_X, "DEST_X", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("DEST_Y", new ScriptVariable((long)npc.Dest_Y, "DEST_Y", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("DEST_Z", new ScriptVariable((long)npc.Dest_Z, "DEST_Z", Var_Types.INT, Var_State.PUBLIC));

                    cd._Variables.Add("LOOKS_DEAD", new ScriptVariable((long)npc.isAlikeDead, "LOOKS_DEAD", Var_Types.INT, Var_State.PUBLIC));
                    cd._Variables.Add("IN_COMBAT", new ScriptVariable((long)npc.isInCombat, "IN_COMBAT", Var_Types.INT, Var_State.PUBLIC));
                    try
                    {
                        System.Collections.SortedList buffs = new System.Collections.SortedList();
                        foreach (CharBuff buff in npc.my_buffs.Values)
                        {
                            Script_ClassData ncd = new Script_ClassData();
                            ncd.Name = "EFFECT";
                            ncd._Variables.Add("ID", new ScriptVariable((long)buff.ID, "ID", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("LEVEL", new ScriptVariable((long)buff.SkillLevel, "LEVEL", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("DURATION", new ScriptVariable((long)buff.ExpiresTime, "DURATION", Var_Types.INT, Var_State.PUBLIC));
                            ncd._Variables.Add("NAME", new ScriptVariable(Util.GetSkillName(buff.ID, buff.SkillLevel), "NAME", Var_Types.STRING, Var_State.PUBLIC));
                            ScriptVariable nsv = new ScriptVariable(ncd, "EFFECT", Var_Types.CLASS, Var_State.PUBLIC);

                            buffs.Add(buff.ID.ToString(), nsv);
                        }

                        cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)buffs, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }
                    catch
                    {
                        System.Collections.SortedList empty = new System.Collections.SortedList();
                        cd._Variables.Add("EFFECTS", new ScriptVariable((System.Collections.SortedList)empty, "EFFECTS", Var_Types.SORTEDLIST, Var_State.PUBLIC));
                    }


                    ScriptVariable sv = new ScriptVariable(cd, "NPC", Var_Types.CLASS, Var_State.PUBLIC);

                    if (dest.Type == Var_Types.ARRAYLIST)
                    {
                        ((System.Collections.ArrayList)dest.Value).Add(sv);
                    }
                    else if (dest.Type == Var_Types.SORTEDLIST)
                    {
                        ((System.Collections.SortedList)dest.Value).Add(npc.ID.ToString(), sv);
                    }
                }
            }
            finally
            {
                Globals.NPCLock.ExitReadLock();
            }
        }
Example #26
0
        private void BuildVarTree(TreeNode parent, ScriptVariable sv)
        {
#if !DEBUG
            try
            {
#endif
            TreeNode type;
            TreeNode value;
            TreeNode count;

            switch (sv.Type)
            {
            case Var_Types.NULL:
                type  = new TreeNode("Type : NULL");
                value = new TreeNode("Value : NULL");

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.INT:
                type  = new TreeNode("Type : INT");
                value = new TreeNode("Value : " + System.Convert.ToInt64(sv.Value).ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.DOUBLE:
                type  = new TreeNode("Type : DOUBLE");
                value = new TreeNode("Value : " + System.Convert.ToDouble(sv.Value).ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.STRING:
                type  = new TreeNode("Type : STRING");
                value = new TreeNode("Value : " + System.Convert.ToString(sv.Value));

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.FILEWRITER:
                type  = new TreeNode("Type : FILEWRITER");
                value = new TreeNode("Value : " + ((System.IO.StreamWriter)sv.Value).ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.FILEREADER:
                type  = new TreeNode("Type : FILEREADER");
                value = new TreeNode("Value : " + ((System.IO.StreamReader)sv.Value).ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.ARRAYLIST:
                type  = new TreeNode("Type : ARRAYLIST");
                count = new TreeNode("Count : " + ((System.Collections.ArrayList)sv.Value).Count.ToString());
                value = new TreeNode("Values");

                foreach (ScriptVariable child_sv in ((System.Collections.ArrayList)sv.Value))
                {
                    //TreeNode child_node = new TreeNode(child_sv.Name);
                    TreeNode child_node = new TreeNode("[" + ((System.Collections.ArrayList)sv.Value).IndexOf(child_sv).ToString() + "]");
                    child_node.Nodes.Add("Index : " + ((System.Collections.ArrayList)sv.Value).IndexOf(child_sv).ToString());
                    child_node.Nodes.Add("Name : " + child_sv.Name);

                    BuildVarTree(child_node, child_sv);

                    value.Nodes.Add(child_node);
                }

                parent.Nodes.Add(type);
                parent.Nodes.Add(count);
                parent.Nodes.Add(value);
                break;

            case Var_Types.SORTEDLIST:
                type  = new TreeNode("Type : SORTEDLIST");
                count = new TreeNode("Count : " + ((System.Collections.SortedList)sv.Value).Count.ToString());
                value = new TreeNode("Values");

                try
                {
                    foreach (string key in ((System.Collections.SortedList)sv.Value).Keys)
                    {
                        try
                        {
                            ScriptVariable child_sv = (ScriptVariable)(((System.Collections.SortedList)sv.Value)[key]);

                            //TreeNode child_node = new TreeNode(child_sv.Name);
                            TreeNode child_node = new TreeNode("[" + key + "]");
                            child_node.Nodes.Add("Key : " + key);
                            child_node.Nodes.Add("Name : " + child_sv.Name);

                            BuildVarTree(child_node, child_sv);

                            value.Nodes.Add(child_node);
                        }
                        catch
                        {
                            Globals.l2net_home.Add_Debug("error creating debug leaf for sortedlist - foreach inside " + key);
                        }
                    }
                }
                catch
                {
                    Globals.l2net_home.Add_Debug("error creating debug leaf for sortedlist - foreach " + sv.Name);
                }

                parent.Nodes.Add(type);
                parent.Nodes.Add(count);
                parent.Nodes.Add(value);
                break;

            case Var_Types.STACK:
                type  = new TreeNode("Type : STACK");
                count = new TreeNode("Count : " + ((System.Collections.Stack)sv.Value).Count.ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(count);
                break;

            case Var_Types.QUEUE:
                type  = new TreeNode("Type : QUEUE");
                count = new TreeNode("Count : " + ((System.Collections.Queue)sv.Value).Count.ToString());

                parent.Nodes.Add(type);
                parent.Nodes.Add(count);
                break;

            case Var_Types.CLASS:
                type  = new TreeNode("Type : CLASS - " + ((Script_ClassData)sv.Value).Name);
                value = new TreeNode("Values");

                foreach (ScriptVariable child_sv in ((Script_ClassData)sv.Value)._Variables.Values)
                {
                    TreeNode child_node = new TreeNode(child_sv.Name);

                    BuildVarTree(child_node, child_sv);

                    value.Nodes.Add(child_node);
                }

                parent.Nodes.Add(type);
                parent.Nodes.Add(value);
                break;

            case Var_Types.BYTEBUFFER:
                type  = new TreeNode("Type : BYTEBUFFER");
                count = new TreeNode("Length - " + ((ByteBuffer)sv.Value).Length().ToString());
                value = new TreeNode("Values");

                for (int i = 0; i < ((ByteBuffer)sv.Value).Length(); i++)
                {
                    TreeNode child_node = new TreeNode("0x" + i.ToString("X2") + " : " + "0x" + ((ByteBuffer)sv.Value).GetByte(i).ToString("X2") + " = '" + (char)((ByteBuffer)sv.Value).GetByte(i) + "'");
                    value.Nodes.Add(child_node);
                }

                parent.Nodes.Add(type);
                parent.Nodes.Add(count);
                parent.Nodes.Add(value);
                break;

            case Var_Types.WINDOW:
                type = new TreeNode("Type : WINDOW");

                parent.Nodes.Add(type);
                break;

            case Var_Types.THREAD:
                type = new TreeNode("Type : THREAD");

                TreeNode thread_info_node_id    = new TreeNode("ID : " + ((ScriptThread)sv.Value).ID.ToString());
                TreeNode thread_info_node_file  = new TreeNode("File : " + ((ScriptThread)sv.Value).Current_File);
                TreeNode thread_info_node_line  = new TreeNode("Running Line : " + ((ScriptThread)sv.Value).Line_Pos.ToString());
                TreeNode thread_info_node_stack = new TreeNode("Current Stack Depth : " + (((ScriptThread)sv.Value).StackHeight + 1).ToString());
                TreeNode thread_info_node_func  = new TreeNode("Function Call Depth : " + ((ScriptThread)sv.Value)._functioncalls.Count.ToString());
                TreeNode thread_info_node_sub   = new TreeNode("Sub Call Depth : " + ((ScriptThread)sv.Value)._subcalls.Count.ToString());
                TreeNode thread_info_node_sleep = new TreeNode("Sleep Until : " + ((ScriptThread)sv.Value).Sleep_Until.ToLongTimeString());
                parent.Nodes.Add(thread_info_node_id);
                parent.Nodes.Add(thread_info_node_file);
                parent.Nodes.Add(thread_info_node_line);
                parent.Nodes.Add(thread_info_node_stack);
                parent.Nodes.Add(thread_info_node_func);
                parent.Nodes.Add(thread_info_node_sub);
                parent.Nodes.Add(thread_info_node_sleep);
                break;
            }
#if !DEBUG
        }

        catch
        {
            //broke our little tree... too bad
            Globals.l2net_home.Add_Debug("error creating debug leaf for var: " + sv.Name + " of type: " + sv.Type.ToString());
        }
#endif
        }
Example #27
0
        public static ScriptVariable Create_Variable(string type, string name, string value, Var_State v)
        {
            type = type.ToUpperInvariant();
            name = name.ToUpperInvariant();

            ScriptVariable new_var = new ScriptVariable();
            new_var.Name = name;
            new_var.State = v;

            switch (type)
            {
                case "NULL":
                    new_var.Type = Var_Types.NULL;
                    break;
                case "INT":
                    new_var.Type = Var_Types.INT;
                    new_var.Value = Util.GetInt64(value);
                    break;
                case "DOUBLE":
                    new_var.Type = Var_Types.DOUBLE;
                    new_var.Value = Util.GetDouble(value);
                    break;
                case "STRING":
                    new_var.Type = Var_Types.STRING;
                    new_var.Value = System.Convert.ToString(value);
                    break;
                case "FILEWRITER":
                    if (Globals.AllowFiles)
                    {
                        //need to figure out how I want to let users write to files outside of the \Scripts\Files\ folder...

                        new_var.Type = Var_Types.FILEWRITER;
                        new_var.Value = new System.IO.StreamWriter(Globals.PATH + "\\Scripts\\Files\\" + System.Convert.ToString(value), false);
                    }
                    else
                    {
                        ScriptEngine.Script_Error("script tried to create file writer without permission");
                    }
                    break;
                case "FILEWRITER_APPEND"://really good idea by toydolls
                    if (Globals.AllowFiles)
                    {
                        new_var.Type = Var_Types.FILEWRITER;
                        new_var.Value = new System.IO.StreamWriter(Globals.PATH + "\\Scripts\\Files\\" + System.Convert.ToString(value), true);
                    }
                    else
                    {
                        ScriptEngine.Script_Error("script tried to create file writer - append without permission");
                    }
                    break;
                case "FILEREADER":
                    if (Globals.AllowFiles)
                    {
                        new_var.Type = Var_Types.FILEREADER;

                        if (System.IO.File.Exists(Globals.PATH + "\\Scripts\\Files\\" + System.Convert.ToString(value)))
                        {
                            new_var.Value = new System.IO.StreamReader(Globals.PATH + "\\Scripts\\Files\\" + System.Convert.ToString(value));
                        }
                        else
                        {
                            ScriptEngine.Script_Error("file [" + value + "] does not exist for reading");
                        }
                    }
                    else
                    {
                        ScriptEngine.Script_Error("script tried to create file reader without permission");
                    }
                    break;
                case "ARRAYLIST":
                    new_var.Type = Var_Types.ARRAYLIST;
                    new_var.Value = new System.Collections.ArrayList(Util.GetInt32(value));
                    break;
                case "SORTEDLIST":
                    new_var.Type = Var_Types.SORTEDLIST;
                    new_var.Value = new System.Collections.SortedList(Util.GetInt32(value));
                    break;
                case "STACK":
                    new_var.Type = Var_Types.STACK;
                    new_var.Value = new System.Collections.Stack();
                    break;
                case "QUEUE":
                    new_var.Type = Var_Types.QUEUE;
                    new_var.Value = new System.Collections.Queue();
                    break;
                case "BYTEBUFFER":
                    new_var.Type = Var_Types.BYTEBUFFER;
                    new_var.Value = new ByteBuffer(Util.GetInt32(value));
                    break;
                case "WINDOW":
                    new_var.Type = Var_Types.WINDOW;
                    new_var.Value = new ScriptWindow();
                    switch (value.ToUpperInvariant())
                    {
                        case "NULL":
                            ((ScriptWindow)new_var.Value).Set_Type(Win_Types.NULL);
                            break;
                        case "CMD":
                            ((ScriptWindow)new_var.Value).Set_Type(Win_Types.CMD);
                            break;
                        case "GUI":
                            ((ScriptWindow)new_var.Value).Set_Type(Win_Types.GUI);
                            break;
                        case "HTML":
                            ((ScriptWindow)new_var.Value).Set_Type(Win_Types.HTML);
                            break;
                        case "GDI":
                            ((ScriptWindow)new_var.Value).Set_Type(Win_Types.GDI);
                            break;
                    }
                    break;
                case "THREAD":
                    new_var.Type = Var_Types.THREAD;
                    new_var.Value = ScriptEngine.CreateThread(value);

                    ((ScriptThread)new_var.Value).Stop();

                    Threads.Add(((ScriptThread)new_var.Value).ID, ((ScriptThread)new_var.Value));
                    break;
                default:
                    //check if it is a user defined type:
                    if (ScriptEngine.Classes.ContainsKey(type))
                    {
                        //Script_Class sc = (Script_Class)ScriptEngine.Classes[type];
                        new_var.Type = Var_Types.CLASS;
                        new_var.Value = new Script_ClassData();
                        ((Script_ClassData)new_var.Value).Init(type);
                    }
                    else
                    {
                        ScriptEngine.Script_Error("INVALID VARIABLE TYPE");
                    }
                    break;
            }

            return new_var;
        }