Example #1
0
        private void listView_npc_data_DoubleClick(object sender, EventArgs e)
        {
            //double click on an npc in the list
            //normal - follow them
            //cntrl - attack them
            if (listView_npc_data.SelectedIndices.Count > 0)
            {
                //action to this item
                uint id = Util.GetUInt32(listView_npc_data.Items[listView_npc_data.SelectedIndices[0]].SubItems[2].Text);

                if (Globals.NPCLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI))
                {
                    try
                    {
                        NPCInfo npc = Util.GetNPC(id);

                        if (npc != null)
                        {
                            ServerPackets.ClickChar(id, Util.Float_Int32(npc.X), Util.Float_Int32(npc.Y), Util.Float_Int32(npc.Z), Globals.gamedata.Control, Globals.gamedata.Shift);
                        }
                    }
                    finally
                    {
                        Globals.NPCLock.ExitReadLock();
                    }
                }
            }
        }
Example #2
0
        private void button_attack_Click(object sender, EventArgs e)
        {
            switch (Globals.gamedata.my_char.CurrentTargetType)
            {
                case TargetType.ERROR:
                case TargetType.NONE:
                    break;
                case TargetType.SELF:
                    break;
                case TargetType.MYPET:
                    ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(Globals.gamedata.my_pet.X), Util.Float_Int32(Globals.gamedata.my_pet.Y), Util.Float_Int32(Globals.gamedata.my_pet.Z), false);
                    break;
                case TargetType.MYPET1:
                    ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(Globals.gamedata.my_pet1.X), Util.Float_Int32(Globals.gamedata.my_pet1.Y), Util.Float_Int32(Globals.gamedata.my_pet1.Z), false);
                    break;
                case TargetType.MYPET2:
                    ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(Globals.gamedata.my_pet2.X), Util.Float_Int32(Globals.gamedata.my_pet2.Y), Util.Float_Int32(Globals.gamedata.my_pet2.Z), false);
                    break;
                case TargetType.MYPET3:
                    ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(Globals.gamedata.my_pet3.X), Util.Float_Int32(Globals.gamedata.my_pet3.Y), Util.Float_Int32(Globals.gamedata.my_pet3.Z), false);
                    break;
                case TargetType.PLAYER:
                    Globals.PlayerLock.EnterReadLock();
                    try
                    {
                        CharInfo player = Util.GetChar(Globals.gamedata.my_char.TargetID);

                        if (player != null)
                        {
                            ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(player.X), Util.Float_Int32(player.Y), Util.Float_Int32(player.Z), false);
                        }
                    }
                    finally
                    {
                        Globals.PlayerLock.ExitReadLock();
                    }
                    break;
                case TargetType.NPC:
                    Globals.NPCLock.EnterReadLock();
                    try
                    {
                        NPCInfo npc = Util.GetNPC(Globals.gamedata.my_char.TargetID);

                        if (npc != null)
                        {
                            ServerPackets.Force_Attack(Globals.gamedata.my_char.TargetID, Util.Float_Int32(npc.X), Util.Float_Int32(npc.Y), Util.Float_Int32(npc.Z), false);
                        }
                    }
                    finally
                    {
                        Globals.NPCLock.ExitReadLock();
                    }
                    break;
            }
        }
Example #3
0
        private void UpdateNPCListInternal()
        {
            System.Collections.ArrayList dirty_items = new System.Collections.ArrayList();

            for (int i = 0; i < listView_npc_data.Items.Count; i++)
            {
                uint id = Util.GetUInt32(((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text);

                if (Globals.gamedata.nearby_npcs.ContainsKey(id))
                {
                    NPCInfo npc = Util.GetNPC(id);

                    npc.InList = true;

                    //update it
                    //((ListViewItem)listView_npc_data_items[i]).SubItems[0].Text = Util.GetNPCName(npc.NPCID);
                    //((ListViewItem)listView_npc_data_items[i]).SubItems[1].Text = npc.Title;
                    //((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text = npc.ID.ToString();
                    //((ListViewItem)listView_npc_data_items[i]).SubItems[3].Text = npc.NPCID.ToString();
                }
                else
                {
                    dirty_items.Add(i);
                }
            }

            //need to remove all dirty items now
            for (int i = dirty_items.Count - 1; i >= 0; i--)
            {
                listView_npc_data_items.RemoveAt((int)dirty_items[i]);
            }
            dirty_items.Clear();

            foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values)
            {
                if (!npc.InList)
                {
                    npc.InList = true;
                    if (npc.isInvisible != 1)
                    {
                        //add it
                        System.Windows.Forms.ListViewItem ObjListItem;
                        ObjListItem = new ListViewItem(Util.GetNPCName(npc.NPCID)); //Name
                        ObjListItem.SubItems.Add(npc.Title);                        //Title
                        ObjListItem.SubItems.Add(npc.ID.ToString());                //ObjID
                        ObjListItem.SubItems.Add(npc.NPCID.ToString());             //TypeID

                        listView_npc_data_items.Add(ObjListItem);
                    }
                }
            }
        }
Example #4
0
        private void listView_npc_data_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = "";

            if (listView_npc_data.SelectedIndices.Count > 0)
            {
                //action to this item
                uint    id  = Util.GetUInt32(listView_npc_data.Items[listView_npc_data.SelectedIndices[0]].SubItems[2].Text);
                NPCInfo npc = null;

                if (Globals.NPCLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI))
                {
                    try
                    {
                        npc = Util.GetNPC(id);
                    }
                    finally
                    {
                        Globals.NPCLock.ExitReadLock();
                    }
                }

                if (npc != null)
                {
                    text = npc.Name + Environment.NewLine +
                           npc.Title + Environment.NewLine +
                           (npc.isAttackable == 0x00 ? "Invincible" : "Attackable") + Environment.NewLine +
                           "Cast Speed: " + npc.MatkSpeed.ToString() + Environment.NewLine +
                           "Attack Speed: " + (npc.AttackSpeedMult * npc.PatkSpeed).ToString() + Environment.NewLine +
                           "Run Speed: " + (npc.RunSpeed * npc.MoveSpeedMult).ToString() + Environment.NewLine +
                           "R: " + Util.GetItemName(npc.RHand) + Environment.NewLine +
                           "LR: " + Util.GetItemName(npc.LRHand) + Environment.NewLine +
                           "L: " + Util.GetItemName(npc.LHand) + Environment.NewLine +
                           (npc.isAlikeDead == 0x00 ? "Alive" : "Dead") + Environment.NewLine +
                           /*(npc.isInvisible == 0x00 ? "Spawned" : "Summoned") + Environment.NewLine +*/
                           "Karma: " + npc.Karma.ToString() + Environment.NewLine +
                           "Abnormal Effects: " + npc.AbnormalEffects.ToString() + Environment.NewLine +
                           "X: " + npc.X.ToString() + Environment.NewLine +
                           "Y: " + npc.Y.ToString() + Environment.NewLine +
                           "Z: " + npc.Z.ToString() + Environment.NewLine +
                           "Dist: " + Util.Distance(Globals.gamedata.my_char.X, Globals.gamedata.my_char.Y, Globals.gamedata.my_char.Z, npc.X, npc.Y, npc.Z).ToString() + Environment.NewLine +
                           "Cur HP: " + npc.Cur_HP + Environment.NewLine +
                           "Max HP: " + npc.Max_HP + Environment.NewLine +
                           (npc.isInvisible == 0x00 ? "Visible" : "Invisible") + Environment.NewLine +
                           "Type ID: " + npc.NPCID + Environment.NewLine +
                           "Unique ID: " + npc.ID + Environment.NewLine +
                           "SummonedNameColor: " + npc.SummonedNameColor;
                }
            }

            toolTip1.SetToolTip(listView_npc_data, text);
        }
Example #5
0
        private bool CheckMobZ(uint mob)
        {
            Globals.NPCLock.EnterReadLock();
            Globals.PlayerLock.EnterReadLock();
            bool isgoodmob = false;

            try
            {
                NPCInfo npc = Util.GetNPC(mob);
                //Globals.l2net_home.Add_Text("z " + Math.Abs(Z - npc.Z), Globals.Green, TextType.BOT);
                if (npc != null)
                {
                    if (Math.Abs(Z - npc.Z) < Globals.PICKUP_Z_Diff)
                    {
                        isgoodmob = true;
                    }
                }
                else
                {
                    CharInfo player = Util.GetChar(mob);
                    if (player != null)
                    {
                        if (Math.Abs(Z - npc.Z) < Globals.PICKUP_Z_Diff)
                        {
                            isgoodmob = true;
                        }
                    }
                    else
                    {
                        //some kind of magical item? XD
                    }
                }
            }
            catch
            {
                //meh...
            }
            finally
            {
                Globals.NPCLock.ExitReadLock();
                Globals.PlayerLock.ExitReadLock();
            }

            return(isgoodmob);
        }
Example #6
0
        static public void GetNPCLoc(uint id, ref int x, ref int y, ref int z)
        {
            Globals.NPCLock.EnterReadLock();
            try
            {
                NPCInfo npc = Util.GetNPC(id);

                if (npc != null)
                {
                    x = Util.Float_Int32(npc.X);
                    y = Util.Float_Int32(npc.Y);
                    z = Util.Float_Int32(npc.Z);
                }
            }
            finally
            {
                Globals.NPCLock.ExitReadLock();
            }

            return;
        }
Example #7
0
        private void BroadCastStautsUpdateNPC(NetPacket np)
        {
            //no need to update with data from ourselves or about ourselves
            if (np.SenderID == Globals.gamedata.my_char.ID || np.ID == Globals.gamedata.my_char.ID)
            {
            }
            else
            {
                Globals.NPCLock.EnterReadLock();
                try
                {
                    //no need to update people in our immediate party (we will get those updates from the server)
                    //...but
                    //any update we recieve directly from a player in our party is probably going to be more up to date than the packet we recieved from the server
                    //so for now... let's actually use the packet...

                    NPCInfo npc = Util.GetNPC(np.ID);

                    if (npc != null)
                    {
                        npc.Max_CP = np.MaxCP;
                        npc.Cur_CP = np.CurCP;
                        npc.Max_HP = np.MaxHP;
                        npc.Cur_HP = np.CurHP;
                        npc.Max_MP = np.MaxMP;
                        npc.Cur_MP = np.CurMP;
                    }
                }//unlock
                finally
                {
                    Globals.NPCLock.ExitReadLock();

                    if (np.ID == Globals.gamedata.my_char.TargetID)
                    {
                        AddInfo.Set_Target_HP();
                    }
                }
            }//end of else
        }
Example #8
0
        private static void AnimateStuff()
        {
            bool  found = false;
            float vx, vy, vz;
            float vxx;
            float movespeed;
            float time;

            ////////////////////////////////Animate self
            try
            {
                if (Globals.gamedata.my_char.Moving == true)
                {
                    if (Globals.gamedata.OOG && ((System.TimeSpan)(System.DateTime.Now - Globals.gamedata.my_char.lastVerifyTime)).Milliseconds > 1000)
                    {
                        //send the verify pos packet
                        ServerPackets.Send_Verify();
                    }
                    if (Globals.gamedata.my_char.MoveTarget != 0)
                    {
                        found = false;
                        //need to set the dest
                        switch (Globals.gamedata.my_char.MoveTargetType)
                        {
                        case TargetType.ERROR:
                        case TargetType.NONE:
                            //shouldn't get this ever
                            //Globals.l2net_home.Add_OnlyDebug("MoveToPawn MoveTargetType invalid - char: " + Globals.gamedata.my_char.Name + ":" + Globals.gamedata.my_char.ID.ToString() + "--: " + Globals.gamedata.my_char.MoveTarget.ToString());
                            break;

                        case TargetType.SELF:
                            //shouldn't get this ever...
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_char.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_char.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_char.Z;
                            found = true;
                            break;

                        case TargetType.MYPET:
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_pet.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_pet.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_pet.Z;
                            found = true;
                            break;

                        case TargetType.MYPET1:
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_pet1.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_pet1.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_pet1.Z;
                            found = true;
                            break;

                        case TargetType.MYPET2:
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_pet2.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_pet2.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_pet2.Z;
                            found = true;
                            break;

                        case TargetType.MYPET3:
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_pet3.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_pet3.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_pet3.Z;
                            found = true;
                            break;

                        case TargetType.PLAYER:
                            CharInfo player_target = null;

                            Globals.PlayerLock.EnterReadLock();
                            try
                            {
                                player_target = Util.GetChar(Globals.gamedata.my_char.MoveTarget);
                            }
                            finally
                            {
                                Globals.PlayerLock.ExitReadLock();
                            }

                            if (player_target != null)
                            {
                                Globals.gamedata.my_char.Dest_X = player_target.X;
                                Globals.gamedata.my_char.Dest_Y = player_target.Y;
                                Globals.gamedata.my_char.Dest_Z = player_target.Z;
                                found = true;
                            }
                            break;

                        case TargetType.NPC:
                            NPCInfo npc_target = null;

                            Globals.NPCLock.EnterReadLock();
                            try
                            {
                                npc_target = Util.GetNPC(Globals.gamedata.my_char.MoveTarget);
                            }
                            finally
                            {
                                Globals.NPCLock.ExitReadLock();
                            }

                            if (npc_target != null)
                            {
                                Globals.gamedata.my_char.Dest_X = npc_target.X;
                                Globals.gamedata.my_char.Dest_Y = npc_target.Y;
                                Globals.gamedata.my_char.Dest_Z = npc_target.Z;
                                found = true;
                            }
                            break;

                        case TargetType.ITEM:
                            ItemInfo item_target = null;

                            Globals.ItemLock.EnterReadLock();
                            try
                            {
                                item_target = Util.GetItem(Globals.gamedata.my_char.MoveTarget);
                            }
                            finally
                            {
                                Globals.ItemLock.ExitReadLock();
                            }

                            if (item_target != null)
                            {
                                Globals.gamedata.my_char.Dest_X = item_target.X;
                                Globals.gamedata.my_char.Dest_Y = item_target.Y;
                                Globals.gamedata.my_char.Dest_Z = item_target.Z;
                                found = true;
                            }
                            break;
                        }

                        if (!found)
                        {
                            Globals.gamedata.my_char.Dest_X = Globals.gamedata.my_char.X;
                            Globals.gamedata.my_char.Dest_Y = Globals.gamedata.my_char.Y;
                            Globals.gamedata.my_char.Dest_Z = Globals.gamedata.my_char.Z;
                        }
                    }

                    //move me towards my target
                    vx = Globals.gamedata.my_char.Dest_X - Globals.gamedata.my_char.X;
                    vy = Globals.gamedata.my_char.Dest_Y - Globals.gamedata.my_char.Y;
                    vz = Globals.gamedata.my_char.Dest_Z - Globals.gamedata.my_char.Z;

                    //movespeed = ((float)my_char.RunSpeed)*ch.MoveSpeedMult;
                    movespeed = Globals.gamedata.my_char.RunSpeed * Globals.gamedata.my_char.MoveSpeedMult;

                    time = System.Convert.ToSingle(((System.TimeSpan)(System.DateTime.Now - Globals.gamedata.my_char.lastMoveTime)).Milliseconds) * Globals.INV_THOUSAND;

                    vxx = System.Convert.ToSingle(Math.Sqrt(vx * vx + vy * vy + vz * vz));
                    if (vxx != 0)
                    {
                        vxx = Util.Float_Cap((movespeed * time) / vxx);
                    }

                    vx *= vxx;
                    vy *= vxx;
                    vz *= vxx;

                    Globals.gamedata.my_char.X           += vx;
                    Globals.gamedata.my_char.Y           += vy;
                    Globals.gamedata.my_char.Z           += vz;
                    Globals.gamedata.my_char.lastMoveTime = System.DateTime.Now;

                    if ((Globals.gamedata.my_char.MoveTarget == 0) && (Math.Sqrt(Math.Pow(Globals.gamedata.my_char.X - Globals.gamedata.my_char.Dest_X, 2) + Math.Pow(Globals.gamedata.my_char.Y - Globals.gamedata.my_char.Dest_Y, 2) + Math.Pow(Globals.gamedata.my_char.Z - Globals.gamedata.my_char.Dest_Z, 2)) < Globals.THRESHOLD))
                    {
                        Globals.gamedata.my_char.Moving = false;
                    }
                }
            }
            catch
            {
                Globals.l2net_home.Add_Error("crash: Animate self");
            }

            ///////////////////////Animate Pet
            if (Globals.gamedata.my_pet.ID != 0)
            {
                try
                {
                    if (Globals.gamedata.my_pet.Moving == true)
                    {
                        if (Globals.gamedata.my_pet.MoveTarget != 0)
                        {
                            found = false;
                            //need to set the dest
                            switch (Globals.gamedata.my_pet.MoveTargetType)
                            {
                            case TargetType.ERROR:
                            case TargetType.NONE:
                                //shouldn't get this ever
                                //Globals.l2net_home.Add_OnlyDebug("MoveToPawn MoveTargetType invalid - pet: " + Globals.gamedata.my_pet.Name + ":" + Globals.gamedata.my_pet.ID.ToString() + "--: " + Globals.gamedata.my_pet.MoveTarget.ToString());
                                break;

                            case TargetType.SELF:
                                Globals.gamedata.my_pet.Dest_X = Globals.gamedata.my_char.X;
                                Globals.gamedata.my_pet.Dest_Y = Globals.gamedata.my_char.Y;
                                Globals.gamedata.my_pet.Dest_Z = Globals.gamedata.my_char.Z;
                                found = true;
                                break;

                            case TargetType.MYPET:
                                //shouldn't get this ever...
                                Globals.gamedata.my_pet.Dest_X = Globals.gamedata.my_pet.X;
                                Globals.gamedata.my_pet.Dest_Y = Globals.gamedata.my_pet.Y;
                                Globals.gamedata.my_pet.Dest_Z = Globals.gamedata.my_pet.Z;
                                found = true;
                                break;

                            case TargetType.MYPET1:
                                //shouldn't get this ever...
                                Globals.gamedata.my_pet1.Dest_X = Globals.gamedata.my_pet1.X;
                                Globals.gamedata.my_pet1.Dest_Y = Globals.gamedata.my_pet1.Y;
                                Globals.gamedata.my_pet1.Dest_Z = Globals.gamedata.my_pet1.Z;
                                found = true;
                                break;

                            case TargetType.MYPET2:
                                //shouldn't get this ever...
                                Globals.gamedata.my_pet2.Dest_X = Globals.gamedata.my_pet2.X;
                                Globals.gamedata.my_pet2.Dest_Y = Globals.gamedata.my_pet2.Y;
                                Globals.gamedata.my_pet2.Dest_Z = Globals.gamedata.my_pet2.Z;
                                found = true;
                                break;

                            case TargetType.MYPET3:
                                //shouldn't get this ever...
                                Globals.gamedata.my_pet3.Dest_X = Globals.gamedata.my_pet3.X;
                                Globals.gamedata.my_pet3.Dest_Y = Globals.gamedata.my_pet3.Y;
                                Globals.gamedata.my_pet3.Dest_Z = Globals.gamedata.my_pet3.Z;
                                found = true;
                                break;

                            case TargetType.PLAYER:
                                CharInfo player_target = null;

                                Globals.PlayerLock.EnterReadLock();
                                try
                                {
                                    player_target = Util.GetChar(Globals.gamedata.my_pet.MoveTarget);
                                }
                                finally
                                {
                                    Globals.PlayerLock.ExitReadLock();
                                }

                                if (player_target != null)
                                {
                                    Globals.gamedata.my_pet.Dest_X = player_target.X;
                                    Globals.gamedata.my_pet.Dest_Y = player_target.Y;
                                    Globals.gamedata.my_pet.Dest_Z = player_target.Z;
                                    found = true;
                                }
                                break;

                            case TargetType.NPC:
                                NPCInfo npc_target = null;

                                Globals.NPCLock.EnterReadLock();
                                try
                                {
                                    npc_target = Util.GetNPC(Globals.gamedata.my_pet.MoveTarget);
                                }
                                finally
                                {
                                    Globals.NPCLock.ExitReadLock();
                                }

                                if (npc_target != null)
                                {
                                    Globals.gamedata.my_pet.Dest_X = npc_target.X;
                                    Globals.gamedata.my_pet.Dest_Y = npc_target.Y;
                                    Globals.gamedata.my_pet.Dest_Z = npc_target.Z;
                                    found = true;
                                }
                                break;

                            case TargetType.ITEM:
                                ItemInfo item_target = null;

                                Globals.ItemLock.EnterReadLock();
                                try
                                {
                                    item_target = Util.GetItem(Globals.gamedata.my_pet.MoveTarget);
                                }
                                finally
                                {
                                    Globals.ItemLock.ExitReadLock();
                                }

                                if (item_target != null)
                                {
                                    Globals.gamedata.my_pet.Dest_X = item_target.X;
                                    Globals.gamedata.my_pet.Dest_Y = item_target.Y;
                                    Globals.gamedata.my_pet.Dest_Z = item_target.Z;
                                    found = true;
                                }
                                break;
                            }

                            if (!found)
                            {
                                Globals.gamedata.my_pet.Dest_X = Globals.gamedata.my_pet.X;
                                Globals.gamedata.my_pet.Dest_Y = Globals.gamedata.my_pet.Y;
                                Globals.gamedata.my_pet.Dest_Z = Globals.gamedata.my_pet.Z;
                            }
                        }

                        //move me towards my target
                        vx = Globals.gamedata.my_pet.Dest_X - Globals.gamedata.my_pet.X;
                        vy = Globals.gamedata.my_pet.Dest_Y - Globals.gamedata.my_pet.Y;
                        vz = Globals.gamedata.my_pet.Dest_Z - Globals.gamedata.my_pet.Z;

                        //movespeed = ((float)my_char.RunSpeed)*ch.MoveSpeedMult;
                        movespeed = Globals.gamedata.my_pet.RunSpeed * Globals.gamedata.my_pet.MoveSpeedMult;

                        time = System.Convert.ToSingle(((System.TimeSpan)(System.DateTime.Now - Globals.gamedata.my_pet.lastMoveTime)).Milliseconds) * Globals.INV_THOUSAND;

                        vxx = System.Convert.ToSingle(Math.Sqrt(vx * vx + vy * vy + vz * vz));
                        if (vxx != 0)
                        {
                            vxx = Util.Float_Cap((movespeed * time) / vxx);
                        }

                        vx *= vxx;
                        vy *= vxx;
                        vz *= vxx;

                        Globals.gamedata.my_pet.X           += vx;
                        Globals.gamedata.my_pet.Y           += vy;
                        Globals.gamedata.my_pet.Z           += vz;
                        Globals.gamedata.my_pet.lastMoveTime = System.DateTime.Now;

                        if ((Globals.gamedata.my_pet.MoveTarget == 0) && (Math.Sqrt(Math.Pow(Globals.gamedata.my_pet.X - Globals.gamedata.my_pet.Dest_X, 2) + Math.Pow(Globals.gamedata.my_pet.Y - Globals.gamedata.my_pet.Dest_Y, 2) + Math.Pow(Globals.gamedata.my_pet.Z - Globals.gamedata.my_pet.Dest_Z, 2)) < Globals.THRESHOLD))
                        {
                            Globals.gamedata.my_pet.Moving = false;
                        }
                    }
                }
                catch
                {
                    Globals.l2net_home.Add_Error("crash: Animate pet");
                }
            }

            ///////////////////////Animate other chars
            Globals.PlayerLock.EnterReadLock();
            try
            {
                foreach (CharInfo player in Globals.gamedata.nearby_chars.Values)
                {
                    if (player.Moving)
                    {
                        if (player.MoveTarget != 0)
                        {
                            found = false;
                            //need to set the dest
                            switch (player.MoveTargetType)
                            {
                            case TargetType.ERROR:
                            case TargetType.NONE:
                                //shouldn't get this ever...
                                //Globals.l2net_home.Add_OnlyDebug("MoveToPawn MoveTargetType invalid - pc: " + player.Name + ":" + player.ID.ToString() + "--: " + player.MoveTarget.ToString());
                                break;

                            case TargetType.SELF:
                                player.Dest_X = Globals.gamedata.my_char.X;
                                player.Dest_Y = Globals.gamedata.my_char.Y;
                                player.Dest_Z = Globals.gamedata.my_char.Z;
                                found         = true;
                                break;

                            case TargetType.MYPET:
                                player.Dest_X = Globals.gamedata.my_pet.X;
                                player.Dest_Y = Globals.gamedata.my_pet.Y;
                                player.Dest_Z = Globals.gamedata.my_pet.Z;
                                found         = true;
                                break;

                            case TargetType.MYPET1:
                                player.Dest_X = Globals.gamedata.my_pet1.X;
                                player.Dest_Y = Globals.gamedata.my_pet1.Y;
                                player.Dest_Z = Globals.gamedata.my_pet1.Z;
                                found         = true;
                                break;

                            case TargetType.MYPET2:
                                player.Dest_X = Globals.gamedata.my_pet2.X;
                                player.Dest_Y = Globals.gamedata.my_pet2.Y;
                                player.Dest_Z = Globals.gamedata.my_pet2.Z;
                                found         = true;
                                break;

                            case TargetType.MYPET3:
                                player.Dest_X = Globals.gamedata.my_pet3.X;
                                player.Dest_Y = Globals.gamedata.my_pet3.Y;
                                player.Dest_Z = Globals.gamedata.my_pet3.Z;
                                found         = true;
                                break;

                            case TargetType.PLAYER:
                                CharInfo player_target = null;

                                //no need to lock... we already have a writer lock
                                player_target = Util.GetChar(Globals.gamedata.my_char.MoveTarget);

                                if (player_target != null)
                                {
                                    player.Dest_X = player_target.X;
                                    player.Dest_Y = player_target.Y;
                                    player.Dest_Z = player_target.Z;
                                    found         = true;
                                }
                                break;

                            case TargetType.NPC:
                                NPCInfo npc_target = null;

                                Globals.NPCLock.EnterReadLock();
                                try
                                {
                                    npc_target = Util.GetNPC(player.MoveTarget);
                                }
                                finally
                                {
                                    Globals.NPCLock.ExitReadLock();
                                }

                                if (npc_target != null)
                                {
                                    player.Dest_X = npc_target.X;
                                    player.Dest_Y = npc_target.Y;
                                    player.Dest_Z = npc_target.Z;
                                    found         = true;
                                }
                                break;

                            case TargetType.ITEM:
                                ItemInfo item_target = null;

                                Globals.ItemLock.EnterReadLock();
                                try
                                {
                                    item_target = Util.GetItem(player.MoveTarget);
                                }    //unlock
                                finally
                                {
                                    Globals.ItemLock.ExitReadLock();
                                }

                                if (item_target != null)
                                {
                                    player.Dest_X = item_target.X;
                                    player.Dest_Y = item_target.Y;
                                    player.Dest_Z = item_target.Z;
                                    found         = true;
                                }
                                break;
                            }

                            if (!found)
                            {
                                player.Dest_X = player.X;
                                player.Dest_Y = player.Y;
                                player.Dest_Z = player.Z;
                            }
                        }

                        vx = player.Dest_X - player.X;
                        vy = player.Dest_Y - player.Y;
                        vz = player.Dest_Z - player.Z;

                        if (player.isRunning != 0)
                        {
                            movespeed = player.RunSpeed * player.MoveSpeedMult;
                        }
                        else
                        {
                            movespeed = player.WalkSpeed * player.MoveSpeedMult;
                        }

                        time = System.Convert.ToSingle(((System.TimeSpan)(System.DateTime.Now - player.lastMoveTime)).Milliseconds) * Globals.INV_THOUSAND;

                        vxx = System.Convert.ToSingle(Math.Sqrt(vx * vx + vy * vy + vz * vz));
                        if (vxx != 0)
                        {
                            vxx = Util.Float_Cap((movespeed * time) / vxx);
                        }

                        vx *= vxx;
                        vy *= vxx;
                        vz *= vxx;

                        player.X           += Util.Float_Int32(vx);
                        player.Y           += Util.Float_Int32(vy);
                        player.Z           += Util.Float_Int32(vz);
                        player.lastMoveTime = System.DateTime.Now;

                        if ((player.MoveTarget == 0) && (Math.Sqrt(Math.Pow(player.X - player.Dest_X, 2) + Math.Pow(player.Y - player.Dest_Y, 2) + Math.Pow(player.Z - player.Dest_Z, 2)) < Globals.THRESHOLD))
                        {
                            player.Moving = false;
                        }
                    }
                }
            }//unlock
            catch
            {
                Globals.l2net_home.Add_Error("crash: Animate other players");
            }
            finally
            {
                Globals.PlayerLock.ExitReadLock();
            }

            //animate npcs
            Globals.NPCLock.EnterReadLock();
            try
            {
                foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values)
                {
                    if (npc.Moving)
                    {
                        if (npc.MoveTarget != 0)
                        {
                            found = false;
                            //need to set the dest
                            switch (npc.MoveTargetType)
                            {
                            case TargetType.ERROR:
                            case TargetType.NONE:
                                //shouldn't get this ever...
                                //Globals.l2net_home.Add_OnlyDebug("MoveToPawn MoveTargetType invalid - npc: " + npc.Name + ":" + npc.ID.ToString() + "--: " + npc.MoveTarget.ToString());
                                break;

                            case TargetType.SELF:
                                npc.Dest_X = Globals.gamedata.my_char.X;
                                npc.Dest_Y = Globals.gamedata.my_char.Y;
                                npc.Dest_Z = Globals.gamedata.my_char.Z;
                                found      = true;
                                break;

                            case TargetType.MYPET:
                                npc.Dest_X = Globals.gamedata.my_pet.X;
                                npc.Dest_Y = Globals.gamedata.my_pet.Y;
                                npc.Dest_Z = Globals.gamedata.my_pet.Z;
                                found      = true;
                                break;

                            case TargetType.MYPET1:
                                npc.Dest_X = Globals.gamedata.my_pet1.X;
                                npc.Dest_Y = Globals.gamedata.my_pet1.Y;
                                npc.Dest_Z = Globals.gamedata.my_pet1.Z;
                                found      = true;
                                break;

                            case TargetType.MYPET2:
                                npc.Dest_X = Globals.gamedata.my_pet2.X;
                                npc.Dest_Y = Globals.gamedata.my_pet2.Y;
                                npc.Dest_Z = Globals.gamedata.my_pet2.Z;
                                found      = true;
                                break;

                            case TargetType.MYPET3:
                                npc.Dest_X = Globals.gamedata.my_pet3.X;
                                npc.Dest_Y = Globals.gamedata.my_pet3.Y;
                                npc.Dest_Z = Globals.gamedata.my_pet3.Z;
                                found      = true;
                                break;

                            case TargetType.PLAYER:
                                CharInfo player_target = null;

                                Globals.PlayerLock.EnterReadLock();
                                try
                                {
                                    player_target = Util.GetChar(npc.MoveTarget);
                                }
                                finally
                                {
                                    Globals.PlayerLock.ExitReadLock();
                                }

                                if (player_target != null)
                                {
                                    npc.Dest_X = player_target.X;
                                    npc.Dest_Y = player_target.Y;
                                    npc.Dest_Z = player_target.Z;
                                    found      = true;
                                }
                                break;

                            case TargetType.NPC:
                                NPCInfo npc_target = null;

                                //no need to lock... we already have a writer lock
                                npc_target = Util.GetNPC(npc.MoveTarget);

                                if (npc_target != null)
                                {
                                    npc.Dest_X = npc_target.X;
                                    npc.Dest_Y = npc_target.Y;
                                    npc.Dest_Z = npc_target.Z;
                                    found      = true;
                                }
                                break;

                            case TargetType.ITEM:
                                ItemInfo item_target = null;

                                Globals.ItemLock.EnterReadLock();
                                try
                                {
                                    item_target = Util.GetItem(npc.MoveTarget);
                                }
                                finally
                                {
                                    Globals.ItemLock.ExitReadLock();
                                }

                                if (item_target != null)
                                {
                                    npc.Dest_X = item_target.X;
                                    npc.Dest_Y = item_target.Y;
                                    npc.Dest_Z = item_target.Z;
                                    found      = true;
                                }
                                break;
                            }//end of switch

                            if (!found)
                            {
                                npc.Dest_X = npc.X;
                                npc.Dest_Y = npc.Y;
                                npc.Dest_Z = npc.Z;
                            }
                        }

                        vx = npc.Dest_X - npc.X;
                        vy = npc.Dest_Y - npc.Y;
                        vz = npc.Dest_Z - npc.Z;

                        if (npc.isRunning != 0)
                        {
                            movespeed = npc.RunSpeed * npc.MoveSpeedMult;
                        }
                        else
                        {
                            movespeed = npc.WalkSpeed * npc.MoveSpeedMult;
                        }

                        time = System.Convert.ToSingle(((System.TimeSpan)(System.DateTime.Now - npc.lastMoveTime)).Milliseconds) * Globals.INV_THOUSAND;

                        vxx = System.Convert.ToSingle(Math.Sqrt(vx * vx + vy * vy + vz * vz));
                        if (vxx != 0)
                        {
                            vxx = Util.Float_Cap((movespeed * time) / vxx);
                        }

                        vx *= vxx;
                        vy *= vxx;
                        vz *= vxx;

                        npc.X           += Util.Float_Int32(vx);
                        npc.Y           += Util.Float_Int32(vy);
                        npc.Z           += Util.Float_Int32(vz);
                        npc.lastMoveTime = System.DateTime.Now;

                        if ((npc.MoveTarget == 0) && (Math.Sqrt(Math.Pow(npc.X - npc.Dest_X, 2) + Math.Pow(npc.Y - npc.Dest_Y, 2) + Math.Pow(npc.Z - npc.Dest_Z, 2)) < Globals.THRESHOLD))
                        {
                            npc.Moving = false;
                        }
                    }
                }
            }//unlock
            catch
            {
                Globals.l2net_home.Add_Error("crash: Animate npcs");
            }
            finally
            {
                Globals.NPCLock.ExitReadLock();
            }
        }//end of AnimateStuff
Example #9
0
        private void ListTargetInfo()
        {
            string cp        = "0/0";
            string hp        = "0/0";
            string mp        = "0/0";
            uint   target_id = Globals.gamedata.my_char.TargetID;

            switch (Globals.gamedata.my_char.CurrentTargetType)
            {
            case TargetType.SELF:
                hp = Globals.gamedata.my_char.Cur_HP.ToString() + "/" + Globals.gamedata.my_char.Max_HP.ToString();
                mp = Globals.gamedata.my_char.Cur_MP.ToString() + "/" + Globals.gamedata.my_char.Max_MP.ToString();
                cp = Globals.gamedata.my_char.Cur_CP.ToString() + "/" + Globals.gamedata.my_char.Max_CP.ToString();
                break;

            case TargetType.MYPET:
                hp = Globals.gamedata.my_pet.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet.Max_HP.ToString();
                mp = Globals.gamedata.my_pet.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet.Max_MP.ToString();
                cp = Globals.gamedata.my_pet.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet.Max_CP.ToString();
                break;

            case TargetType.MYPET1:
                hp = Globals.gamedata.my_pet1.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet1.Max_HP.ToString();
                mp = Globals.gamedata.my_pet1.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet1.Max_MP.ToString();
                cp = Globals.gamedata.my_pet1.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet1.Max_CP.ToString();
                break;

            case TargetType.MYPET2:
                hp = Globals.gamedata.my_pet2.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet2.Max_HP.ToString();
                mp = Globals.gamedata.my_pet2.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet2.Max_MP.ToString();
                cp = Globals.gamedata.my_pet2.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet2.Max_CP.ToString();
                break;

            case TargetType.MYPET3:
                hp = Globals.gamedata.my_pet3.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet3.Max_HP.ToString();
                mp = Globals.gamedata.my_pet3.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet3.Max_MP.ToString();
                cp = Globals.gamedata.my_pet3.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet3.Max_CP.ToString();
                break;

            case TargetType.PLAYER:
                Globals.PlayerLock.EnterReadLock();
                try
                {
                    CharInfo player = Util.GetChar(target_id);

                    if (player != null)
                    {
                        /*if (Globals.gamedata.Chron >= Chronicle.CT2_4 && Globals.gamedata.Official_Server)
                         * {
                         *  /*
                         *  hp = ("HP: " + player.Cur_HP / 100000).ToString() + "%";
                         *  mp = ("MP: " + player.Cur_MP / 100000).ToString() + "%";
                         *  cp = ("CP: " + player.Cur_CP / 100000).ToString() + "%";
                         *  hp = ("HP: " + (player.Cur_HP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture));
                         *  mp = ("CP: " + (player.Cur_MP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture));
                         *  cp = ("MP: " + (player.Cur_CP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture));
                         *
                         * }
                         * else
                         * {*/
                        hp = player.Cur_HP.ToString() + "/" + player.Max_HP.ToString();
                        mp = player.Cur_MP.ToString() + "/" + player.Max_MP.ToString();
                        cp = player.Cur_CP.ToString() + "/" + player.Max_CP.ToString();
                        //}
                    }
                }    //unlock
                finally
                {
                    Globals.PlayerLock.ExitReadLock();
                }
                break;

            case TargetType.NPC:
                Globals.NPCLock.EnterReadLock();
                try
                {
                    NPCInfo npc = Util.GetNPC(target_id);

                    if (npc != null)
                    {
                        hp = npc.Cur_HP.ToString() + "/" + npc.Max_HP.ToString();
                        mp = npc.Cur_MP.ToString() + "/" + npc.Max_MP.ToString();
                        cp = npc.Cur_CP.ToString() + "/" + npc.Max_CP.ToString();

                        label_targetinfo.Text = "Target Info: " + Environment.NewLine
                                                + "ID : " + npc.ID.ToString() + Environment.NewLine
                                                + "NPCID: " + npc.NPCID.ToString() + Environment.NewLine
                                                + "Attackable: " + npc.isAttackable.ToString() + Environment.NewLine
                                                + "X: " + npc.X.ToString() + Environment.NewLine
                                                + "Y: " + npc.Y.ToString() + Environment.NewLine
                                                + "Z: " + npc.Z.ToString() + Environment.NewLine
                                                + "Heading: " + npc.Heading.ToString() + Environment.NewLine
                                                + "MAtk Speed: " + npc.MatkSpeed.ToString() + Environment.NewLine
                                                + "PAtk Speed: " + npc.PatkSpeed.ToString() + Environment.NewLine
                                                + "Run Speed: " + npc.RunSpeed.ToString() + Environment.NewLine
                                                + "Walk Speed: " + npc.WalkSpeed.ToString() + Environment.NewLine
                                                + "Move Speed Mult: " + npc.MoveSpeedMult.ToString() + Environment.NewLine
                                                + "Atk Speed Mult: " + npc.AttackSpeedMult.ToString() + Environment.NewLine
                                                + "Collision Rad: " + npc.CollisionRadius.ToString() + Environment.NewLine
                                                + "Collision Height: " + npc.CollisionHeight.ToString() + Environment.NewLine
                                                + "RHand: " + npc.RHand.ToString() + Environment.NewLine
                                                + "LHand: " + npc.LHand.ToString() + Environment.NewLine
                                                + "LRHand: " + npc.LRHand.ToString() + Environment.NewLine
                                                + "NameShows: " + npc.NameShows.ToString() + Environment.NewLine
                                                + "IsRunning: " + npc.isRunning.ToString() + Environment.NewLine
                                                + "IsInCombat: " + npc.isInCombat.ToString() + Environment.NewLine
                                                + "IsAlikeDead: " + npc.isAlikeDead.ToString() + Environment.NewLine
                                                + "IsInvisible: " + npc.isInvisible.ToString() + Environment.NewLine
                                                + "IsSitting: " + npc.isSitting.ToString();
                    }
                }    //unlock
                finally
                {
                    Globals.NPCLock.ExitReadLock();
                }
                break;
            }
        }
Example #10
0
        static public void GetLoc(uint id, ref int x, ref int y, ref int z)
        {
            //is self?
            if (Globals.gamedata.my_char.ID == id)
            {
                x = Util.Float_Int32(Globals.gamedata.my_char.X);
                y = Util.Float_Int32(Globals.gamedata.my_char.Y);
                z = Util.Float_Int32(Globals.gamedata.my_char.Z);
                return;
            }

            //is my pet?
            if (Globals.gamedata.my_pet.ID == id)
            {
                x = Util.Float_Int32(Globals.gamedata.my_pet.X);
                y = Util.Float_Int32(Globals.gamedata.my_pet.Y);
                z = Util.Float_Int32(Globals.gamedata.my_pet.Z);
                return;
            }
            if (Globals.gamedata.my_pet1.ID == id)
            {
                x = Util.Float_Int32(Globals.gamedata.my_pet1.X);
                y = Util.Float_Int32(Globals.gamedata.my_pet1.Y);
                z = Util.Float_Int32(Globals.gamedata.my_pet1.Z);
                return;
            }
            if (Globals.gamedata.my_pet2.ID == id)
            {
                x = Util.Float_Int32(Globals.gamedata.my_pet2.X);
                y = Util.Float_Int32(Globals.gamedata.my_pet2.Y);
                z = Util.Float_Int32(Globals.gamedata.my_pet2.Z);
                return;
            }
            if (Globals.gamedata.my_pet3.ID == id)
            {
                x = Util.Float_Int32(Globals.gamedata.my_pet3.X);
                y = Util.Float_Int32(Globals.gamedata.my_pet3.Y);
                z = Util.Float_Int32(Globals.gamedata.my_pet3.Z);
                return;
            }

            //is in the list of chars?
            Globals.PlayerLock.EnterReadLock();
            try
            {
                CharInfo player = Util.GetChar(id);

                if (player != null)
                {
                    x = Util.Float_Int32(player.X);
                    y = Util.Float_Int32(player.Y);
                    z = Util.Float_Int32(player.Z);
                    return;
                }
            }
            finally
            {
                Globals.PlayerLock.ExitReadLock();
            }

            //is it a party member?
            Globals.PartyLock.EnterReadLock();
            try
            {
                PartyMember pmem = Util.GetCharParty(id);

                if (pmem != null)
                {
                    x = pmem.X;
                    y = pmem.Y;
                    z = pmem.Z;
                    return;
                }
            }
            finally
            {
                Globals.PartyLock.ExitReadLock();
            }

            Globals.NPCLock.EnterReadLock();
            try
            {
                NPCInfo npc = Util.GetNPC(id);

                if (npc != null)
                {
                    x = Util.Float_Int32(npc.X);
                    y = Util.Float_Int32(npc.Y);
                    z = Util.Float_Int32(npc.Z);
                    return;
                }
            }
            finally
            {
                Globals.NPCLock.ExitReadLock();
            }
        }
Example #11
0
		public static void Set_Target_HP()
		{
			string cp = "0/0";
			string hp = "0/0";
			string mp = "0/0";

            uint target_id = Globals.gamedata.my_char.TargetID;

            switch (Globals.gamedata.my_char.CurrentTargetType)
			{

				case TargetType.SELF:
                    hp = Globals.gamedata.my_char.Cur_HP.ToString() + "/" + Globals.gamedata.my_char.Max_HP.ToString();
                    mp = Globals.gamedata.my_char.Cur_MP.ToString() + "/" + Globals.gamedata.my_char.Max_MP.ToString();
                    cp = Globals.gamedata.my_char.Cur_CP.ToString() + "/" + Globals.gamedata.my_char.Max_CP.ToString();
                    break;
                case TargetType.MYPET:
                    hp = Globals.gamedata.my_pet.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet.Max_HP.ToString();
                    mp = Globals.gamedata.my_pet.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet.Max_MP.ToString();
                    cp = Globals.gamedata.my_pet.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet.Max_CP.ToString();
                    break;
                case TargetType.MYPET1:
                    hp = Globals.gamedata.my_pet1.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet1.Max_HP.ToString();
                    mp = Globals.gamedata.my_pet1.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet1.Max_MP.ToString();
                    cp = Globals.gamedata.my_pet1.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet1.Max_CP.ToString();
                    break;
                case TargetType.MYPET2:
                    hp = Globals.gamedata.my_pet2.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet2.Max_HP.ToString();
                    mp = Globals.gamedata.my_pet2.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet2.Max_MP.ToString();
                    cp = Globals.gamedata.my_pet2.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet2.Max_CP.ToString();
                    break;
                case TargetType.MYPET3:
                    hp = Globals.gamedata.my_pet3.Cur_HP.ToString() + "/" + Globals.gamedata.my_pet3.Max_HP.ToString();
                    mp = Globals.gamedata.my_pet3.Cur_MP.ToString() + "/" + Globals.gamedata.my_pet3.Max_MP.ToString();
                    cp = Globals.gamedata.my_pet3.Cur_CP.ToString() + "/" + Globals.gamedata.my_pet3.Max_CP.ToString();
                    break;
				case TargetType.PLAYER:
                    Globals.PlayerLock.EnterReadLock();
					try
					{
                        CharInfo player = Util.GetChar(target_id);

                        if (player != null)
                        {
                            /*if (Globals.gamedata.Chron >= Chronicle.CT2_4 && Globals.gamedata.Official_Server)
                            {
                                /*
                                hp = ("HP: " + player.Cur_HP / 100000).ToString() + "%";
                                mp = ("MP: " + player.Cur_MP / 100000).ToString() + "%";
                                cp = ("CP: " + player.Cur_CP / 100000).ToString() + "%";
                                hp = ("HP: " + (player.Cur_HP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture));
                                mp = ("CP: " + (player.Cur_MP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture));
                                cp = ("MP: " + (player.Cur_CP / 10000000).ToString("P", System.Globalization.CultureInfo.InvariantCulture)); 

                            }
                            else
                            {*/
                                hp = player.Cur_HP.ToString() + "/" + player.Max_HP.ToString();
                                mp = player.Cur_MP.ToString() + "/" + player.Max_MP.ToString();
                                cp = player.Cur_CP.ToString() + "/" + player.Max_CP.ToString();
                            //}
                        }
					}//unlock
					finally
					{
                        Globals.PlayerLock.ExitReadLock();
					}
					break;
				case TargetType.NPC:
                    Globals.NPCLock.EnterReadLock();
					try
					{
                        NPCInfo npc = Util.GetNPC(target_id);

                        if (npc != null)
                        {
                            hp = npc.Cur_HP.ToString() + "/" + npc.Max_HP.ToString();
                            mp = npc.Cur_MP.ToString() + "/" + npc.Max_MP.ToString();
                            cp = npc.Cur_CP.ToString() + "/" + npc.Max_CP.ToString();
                        }
					}//unlock
					finally
					{
                        Globals.NPCLock.ExitReadLock();
					}
					break;
			}

			Globals.l2net_home.Set_Target_CP(cp);
			Globals.l2net_home.Set_Target_HP(hp);
			Globals.l2net_home.Set_Target_MP(mp);
			//Globals.l2net_home.panel_target.Refresh();

            if (Globals.l2net_home.menuItem_cmd_overlay.Checked && Globals.overlaywindow != null)
			{
                Globals.overlaywindow.Set_Target_CP(cp);
                Globals.overlaywindow.Set_Target_HP(hp);
                Globals.overlaywindow.Set_Target_MP(mp);
				//L2NET.overlaywindow.Refresh();
			}
		}
Example #12
0
        public static long TARGET_INT(string req)
        {
            switch (Globals.gamedata.my_char.CurrentTargetType)
            {
            case TargetType.ERROR:
            case TargetType.NONE:
                break;

            case TargetType.SELF:
                switch (req)
                {
                case "KARMA":
                    return((long)Globals.gamedata.my_char.Karma);

                case "TARGETID":
                    return((long)Globals.gamedata.my_char.TargetID);

                case "ID":
                    return((long)Globals.gamedata.my_char.ID);

                case "TYPEID":
                    return((long)0);

                case "X":
                    return((long)Globals.gamedata.my_char.X);

                case "Y":
                    return((long)Globals.gamedata.my_char.Y);

                case "Z":
                    return((long)Globals.gamedata.my_char.Z);

                case "DESTX":
                    return((long)Globals.gamedata.my_char.Dest_X);

                case "DESTY":
                    return((long)Globals.gamedata.my_char.Dest_Y);

                case "DESTZ":
                    return((long)Globals.gamedata.my_char.Dest_Z);

                case "IS_MOVING":
                    return(Globals.gamedata.my_char.Moving ? 1L : 0L);

                case "MAX_HP":
                    return((long)Globals.gamedata.my_char.Max_HP);

                case "MAX_MP":
                    return((long)Globals.gamedata.my_char.Max_MP);

                case "MAX_CP":
                    return((long)Globals.gamedata.my_char.Max_CP);

                case "CUR_HP":
                    return((long)Globals.gamedata.my_char.Cur_HP);

                case "CUR_MP":
                    return((long)Globals.gamedata.my_char.Cur_MP);

                case "CUR_CP":
                    return((long)Globals.gamedata.my_char.Cur_CP);

                case "PER_HP":
                    return((long)(100.0 * (Globals.gamedata.my_char.Cur_HP / Globals.gamedata.my_char.Max_HP)));

                case "PER_MP":
                    return((long)(100.0 * (Globals.gamedata.my_char.Cur_MP / Globals.gamedata.my_char.Max_MP)));

                case "PER_CP":
                    return((long)(100.0 * (Globals.gamedata.my_char.Cur_CP / Globals.gamedata.my_char.Max_CP)));

                case "RUN_SPEED":
                    return((long)(Globals.gamedata.my_char.RunSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                case "WALK_SPEED":
                    return((long)(Globals.gamedata.my_char.WalkSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                case "ATTACK_SPEED":
                    return((long)Globals.gamedata.my_char.AttackSpeedMult);

                case "CAST_SPEED":
                    return((long)Globals.gamedata.my_char.MatkSpeed);

                case "EVAL":
                    return((long)Globals.gamedata.my_char.RecAmount);

                case "RUNNING":
                    return((long)Globals.gamedata.my_char.isRunning);

                case "SITTING":
                    return((long)Globals.gamedata.my_char.isSitting);

                case "LOOKS_DEAD":
                    return((long)Globals.gamedata.my_char.isAlikeDead);

                default:
                    ScriptEngine.Script_Error("invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.MYPET:
                switch (req)
                {
                case "KARMA":
                    return((long)Globals.gamedata.my_pet.Karma);

                case "TARGETID":
                    return((long)Globals.gamedata.my_pet.TargetID);

                case "ID":
                    return((long)Globals.gamedata.my_pet.ID);

                case "TYPEID":
                    return((long)Globals.gamedata.my_pet.NPCID);

                case "X":
                    return((long)Globals.gamedata.my_pet.X);

                case "Y":
                    return((long)Globals.gamedata.my_pet.Y);

                case "Z":
                    return((long)Globals.gamedata.my_pet.Z);

                case "DESTX":
                    return((long)Globals.gamedata.my_pet.Dest_X);

                case "DESTY":
                    return((long)Globals.gamedata.my_pet.Dest_Y);

                case "DESTZ":
                    return((long)Globals.gamedata.my_pet.Dest_Z);

                case "IS_MOVING":
                    return(Globals.gamedata.my_pet.Moving ? 1L : 0L);

                case "MAX_HP":
                    return((long)Globals.gamedata.my_pet.Max_HP);

                case "MAX_MP":
                    return((long)Globals.gamedata.my_pet.Max_MP);

                case "MAX_CP":
                    return((long)Globals.gamedata.my_pet.Max_CP);

                case "CUR_HP":
                    return((long)Globals.gamedata.my_pet.Cur_HP);

                case "CUR_MP":
                    return((long)Globals.gamedata.my_pet.Cur_MP);

                case "CUR_CP":
                    return((long)Globals.gamedata.my_pet.Cur_CP);

                case "PER_HP":
                    return((long)(100.0 * (Globals.gamedata.my_pet.Cur_HP / Globals.gamedata.my_pet.Max_HP)));

                case "PER_MP":
                    return((long)(100.0 * (Globals.gamedata.my_pet.Cur_MP / Globals.gamedata.my_pet.Max_MP)));

                case "PER_CP":
                    return((long)(100.0 * (Globals.gamedata.my_pet.Cur_CP / Globals.gamedata.my_pet.Max_CP)));

                case "RUN_SPEED":
                    return((long)(Globals.gamedata.my_pet.RunSpeed * Globals.gamedata.my_pet.MoveSpeedMult));

                case "WALK_SPEED":
                    return((long)(Globals.gamedata.my_pet.WalkSpeed * Globals.gamedata.my_pet.MoveSpeedMult));

                case "ATTACK_SPEED":
                    return((long)Globals.gamedata.my_pet.AttackSpeedMult);

                case "CAST_SPEED":
                    return((long)Globals.gamedata.my_pet.MatkSpeed);

                case "EVAL":
                    return((long)0);

                case "RUNNING":
                    return((long)Globals.gamedata.my_pet.isRunning);

                case "SITTING":
                    return((long)0);

                case "LOOKS_DEAD":
                    return((long)Globals.gamedata.my_pet.isAlikeDead);

                default:
                    ScriptEngine.Script_Error("invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.MYPET1:
                switch (req)
                {
                case "KARMA":
                    return((long)Globals.gamedata.my_pet1.Karma);

                case "TARGETID":
                    return((long)Globals.gamedata.my_pet1.TargetID);

                case "ID":
                    return((long)Globals.gamedata.my_pet1.ID);

                case "TYPEID":
                    return((long)Globals.gamedata.my_pet1.NPCID);

                case "X":
                    return((long)Globals.gamedata.my_pet1.X);

                case "Y":
                    return((long)Globals.gamedata.my_pet1.Y);

                case "Z":
                    return((long)Globals.gamedata.my_pet1.Z);

                case "DESTX":
                    return((long)Globals.gamedata.my_pet1.Dest_X);

                case "DESTY":
                    return((long)Globals.gamedata.my_pet1.Dest_Y);

                case "DESTZ":
                    return((long)Globals.gamedata.my_pet1.Dest_Z);

                case "IS_MOVING":
                    return(Globals.gamedata.my_pet1.Moving ? 1L : 0L);

                case "MAX_HP":
                    return((long)Globals.gamedata.my_pet1.Max_HP);

                case "MAX_MP":
                    return((long)Globals.gamedata.my_pet1.Max_MP);

                case "MAX_CP":
                    return((long)Globals.gamedata.my_pet1.Max_CP);

                case "CUR_HP":
                    return((long)Globals.gamedata.my_pet1.Cur_HP);

                case "CUR_MP":
                    return((long)Globals.gamedata.my_pet1.Cur_MP);

                case "CUR_CP":
                    return((long)Globals.gamedata.my_pet1.Cur_CP);

                case "PER_HP":
                    return((long)(100.0 * (Globals.gamedata.my_pet1.Cur_HP / Globals.gamedata.my_pet1.Max_HP)));

                case "PER_MP":
                    return((long)(100.0 * (Globals.gamedata.my_pet1.Cur_MP / Globals.gamedata.my_pet1.Max_MP)));

                case "PER_CP":
                    return((long)(100.0 * (Globals.gamedata.my_pet1.Cur_CP / Globals.gamedata.my_pet1.Max_CP)));

                case "RUN_SPEED":
                    return((long)(Globals.gamedata.my_pet1.RunSpeed * Globals.gamedata.my_pet1.MoveSpeedMult));

                case "WALK_SPEED":
                    return((long)(Globals.gamedata.my_pet1.WalkSpeed * Globals.gamedata.my_pet1.MoveSpeedMult));

                case "ATTACK_SPEED":
                    return((long)Globals.gamedata.my_pet1.AttackSpeedMult);

                case "CAST_SPEED":
                    return((long)Globals.gamedata.my_pet1.MatkSpeed);

                case "EVAL":
                    return((long)0);

                case "RUNNING":
                    return((long)Globals.gamedata.my_pet1.isRunning);

                case "SITTING":
                    return((long)0);

                case "LOOKS_DEAD":
                    return((long)Globals.gamedata.my_pet1.isAlikeDead);

                default:
                    ScriptEngine.Script_Error("invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.MYPET2:
                switch (req)
                {
                case "KARMA":
                    return((long)Globals.gamedata.my_pet2.Karma);

                case "TARGETID":
                    return((long)Globals.gamedata.my_pet2.TargetID);

                case "ID":
                    return((long)Globals.gamedata.my_pet2.ID);

                case "TYPEID":
                    return((long)Globals.gamedata.my_pet2.NPCID);

                case "X":
                    return((long)Globals.gamedata.my_pet2.X);

                case "Y":
                    return((long)Globals.gamedata.my_pet2.Y);

                case "Z":
                    return((long)Globals.gamedata.my_pet2.Z);

                case "DESTX":
                    return((long)Globals.gamedata.my_pet2.Dest_X);

                case "DESTY":
                    return((long)Globals.gamedata.my_pet2.Dest_Y);

                case "DESTZ":
                    return((long)Globals.gamedata.my_pet2.Dest_Z);

                case "IS_MOVING":
                    return(Globals.gamedata.my_pet2.Moving ? 1L : 0L);

                case "MAX_HP":
                    return((long)Globals.gamedata.my_pet2.Max_HP);

                case "MAX_MP":
                    return((long)Globals.gamedata.my_pet2.Max_MP);

                case "MAX_CP":
                    return((long)Globals.gamedata.my_pet2.Max_CP);

                case "CUR_HP":
                    return((long)Globals.gamedata.my_pet2.Cur_HP);

                case "CUR_MP":
                    return((long)Globals.gamedata.my_pet2.Cur_MP);

                case "CUR_CP":
                    return((long)Globals.gamedata.my_pet2.Cur_CP);

                case "PER_HP":
                    return((long)(100.0 * (Globals.gamedata.my_pet2.Cur_HP / Globals.gamedata.my_pet2.Max_HP)));

                case "PER_MP":
                    return((long)(100.0 * (Globals.gamedata.my_pet2.Cur_MP / Globals.gamedata.my_pet2.Max_MP)));

                case "PER_CP":
                    return((long)(100.0 * (Globals.gamedata.my_pet2.Cur_CP / Globals.gamedata.my_pet2.Max_CP)));

                case "RUN_SPEED":
                    return((long)(Globals.gamedata.my_pet2.RunSpeed * Globals.gamedata.my_pet2.MoveSpeedMult));

                case "WALK_SPEED":
                    return((long)(Globals.gamedata.my_pet2.WalkSpeed * Globals.gamedata.my_pet2.MoveSpeedMult));

                case "ATTACK_SPEED":
                    return((long)Globals.gamedata.my_pet2.AttackSpeedMult);

                case "CAST_SPEED":
                    return((long)Globals.gamedata.my_pet2.MatkSpeed);

                case "EVAL":
                    return((long)0);

                case "RUNNING":
                    return((long)Globals.gamedata.my_pet2.isRunning);

                case "SITTING":
                    return((long)0);

                case "LOOKS_DEAD":
                    return((long)Globals.gamedata.my_pet2.isAlikeDead);

                default:
                    ScriptEngine.Script_Error("invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.MYPET3:
                switch (req)
                {
                case "KARMA":
                    return((long)Globals.gamedata.my_pet3.Karma);

                case "TARGETID":
                    return((long)Globals.gamedata.my_pet3.TargetID);

                case "ID":
                    return((long)Globals.gamedata.my_pet3.ID);

                case "TYPEID":
                    return((long)Globals.gamedata.my_pet3.NPCID);

                case "X":
                    return((long)Globals.gamedata.my_pet3.X);

                case "Y":
                    return((long)Globals.gamedata.my_pet3.Y);

                case "Z":
                    return((long)Globals.gamedata.my_pet3.Z);

                case "DESTX":
                    return((long)Globals.gamedata.my_pet3.Dest_X);

                case "DESTY":
                    return((long)Globals.gamedata.my_pet3.Dest_Y);

                case "DESTZ":
                    return((long)Globals.gamedata.my_pet3.Dest_Z);

                case "IS_MOVING":
                    return(Globals.gamedata.my_pet3.Moving ? 1L : 0L);

                case "MAX_HP":
                    return((long)Globals.gamedata.my_pet3.Max_HP);

                case "MAX_MP":
                    return((long)Globals.gamedata.my_pet3.Max_MP);

                case "MAX_CP":
                    return((long)Globals.gamedata.my_pet3.Max_CP);

                case "CUR_HP":
                    return((long)Globals.gamedata.my_pet3.Cur_HP);

                case "CUR_MP":
                    return((long)Globals.gamedata.my_pet3.Cur_MP);

                case "CUR_CP":
                    return((long)Globals.gamedata.my_pet3.Cur_CP);

                case "PER_HP":
                    return((long)(100.0 * (Globals.gamedata.my_pet3.Cur_HP / Globals.gamedata.my_pet3.Max_HP)));

                case "PER_MP":
                    return((long)(100.0 * (Globals.gamedata.my_pet3.Cur_MP / Globals.gamedata.my_pet3.Max_MP)));

                case "PER_CP":
                    return((long)(100.0 * (Globals.gamedata.my_pet3.Cur_CP / Globals.gamedata.my_pet3.Max_CP)));

                case "RUN_SPEED":
                    return((long)(Globals.gamedata.my_pet3.RunSpeed * Globals.gamedata.my_pet3.MoveSpeedMult));

                case "WALK_SPEED":
                    return((long)(Globals.gamedata.my_pet3.WalkSpeed * Globals.gamedata.my_pet3.MoveSpeedMult));

                case "ATTACK_SPEED":
                    return((long)Globals.gamedata.my_pet3.AttackSpeedMult);

                case "CAST_SPEED":
                    return((long)Globals.gamedata.my_pet3.MatkSpeed);

                case "EVAL":
                    return((long)0);

                case "RUNNING":
                    return((long)Globals.gamedata.my_pet3.isRunning);

                case "SITTING":
                    return((long)0);

                case "LOOKS_DEAD":
                    return((long)Globals.gamedata.my_pet3.isAlikeDead);

                default:
                    ScriptEngine.Script_Error("invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.PLAYER:
                Globals.PlayerLock.EnterReadLock();
                try
                {
                    CharInfo player = Util.GetChar(Globals.gamedata.my_char.TargetID);

                    if (player != null)
                    {
                        switch (req)
                        {
                        case "KARMA":
                            return((long)player.Karma);

                        case "TARGETID":
                            return((long)player.TargetID);

                        case "ID":
                            return((long)player.ID);

                        case "TYPEID":
                            return((long)0);

                        case "X":
                            return((long)player.X);

                        case "Y":
                            return((long)player.Y);

                        case "Z":
                            return((long)player.Z);

                        case "DESTX":
                            return((long)player.Dest_X);

                        case "DESTY":
                            return((long)player.Dest_Y);

                        case "DESTZ":
                            return((long)player.Dest_Z);

                        case "IS_MOVING":
                            return(player.Moving ? 1L : 0L);

                        case "MAX_HP":
                            return((long)player.Max_HP);

                        case "MAX_MP":
                            return((long)player.Max_MP);

                        case "MAX_CP":
                            return((long)player.Max_CP);

                        case "CUR_HP":
                            return((long)player.Cur_HP);

                        case "CUR_MP":
                            return((long)player.Cur_MP);

                        case "CUR_CP":
                            return((long)player.Cur_CP);

                        case "PER_HP":
                            return((long)(100.0 * (player.Cur_HP / player.Max_HP)));

                        case "PER_MP":
                            return((long)(100.0 * (player.Cur_MP / player.Max_MP)));

                        case "PER_CP":
                            return((long)(100.0 * (player.Cur_CP / player.Max_CP)));

                        case "RUN_SPEED":
                            return((long)(player.RunSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                        case "WALK_SPEED":
                            return((long)(player.WalkSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                        case "ATTACK_SPEED":
                            return((long)player.AttackSpeedMult);

                        case "CAST_SPEED":
                            return((long)player.MatkSpeed);

                        case "EVAL":
                            return((long)player.RecAmount);

                        case "RUNNING":
                            return((long)player.isRunning);

                        case "SITTING":
                            return((long)player.isSitting);

                        case "LOOKS_DEAD":
                            return((long)player.isAlikeDead);

                        default:
                            ScriptEngine.Script_Error("invalid target data(player) request");
                            break;
                        }
                    }
                }    //unlock
                finally
                {
                    Globals.PlayerLock.ExitReadLock();
                }
                break;

            case TargetType.NPC:
                Globals.NPCLock.EnterReadLock();
                try
                {
                    NPCInfo npc = Util.GetNPC(Globals.gamedata.my_char.TargetID);

                    if (npc != null)
                    {
                        switch (req)
                        {
                        case "KARMA":
                            return((long)npc.Karma);

                        case "TARGETID":
                            return((long)npc.TargetID);

                        case "ID":
                            return((long)npc.ID);

                        case "TYPEID":
                            return((long)npc.NPCID);

                        case "X":
                            return((long)npc.X);

                        case "Y":
                            return((long)npc.Y);

                        case "Z":
                            return((long)npc.Z);

                        case "DESTX":
                            return((long)npc.Dest_X);

                        case "DESTY":
                            return((long)npc.Dest_Y);

                        case "DESTZ":
                            return((long)npc.Dest_Z);

                        case "IS_MOVING":
                            return(npc.Moving ? 1L : 0L);

                        case "MAX_HP":
                            return((long)npc.Max_HP);

                        case "MAX_MP":
                            return((long)npc.Max_MP);

                        case "MAX_CP":
                            return((long)npc.Max_CP);

                        case "CUR_HP":
                            return((long)npc.Cur_HP);

                        case "CUR_MP":
                            return((long)npc.Cur_MP);

                        case "CUR_CP":
                            return((long)npc.Cur_CP);

                        case "PER_HP":
                            return((long)(100.0 * (npc.Cur_HP / npc.Max_HP)));

                        case "PER_MP":
                            return((long)(100.0 * (npc.Cur_MP / npc.Max_MP)));

                        case "PER_CP":
                            return((long)(100.0 * (npc.Cur_CP / npc.Max_CP)));

                        case "RUN_SPEED":
                            return((long)(npc.RunSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                        case "WALK_SPEED":
                            return((long)(npc.WalkSpeed * Globals.gamedata.my_char.MoveSpeedMult));

                        case "ATTACK_SPEED":
                            return((long)npc.AttackSpeedMult);

                        case "CAST_SPEED":
                            return((long)npc.MatkSpeed);

                        case "SPOILED":
                            if (Globals.gamedata.my_char.TargetSpoiled)
                            {
                                return((long)(1));
                            }
                            else
                            {
                                return((long)(0));
                            }

                        case "RUNNING":
                            return((long)npc.isRunning);

                        case "SITTING":
                            return((long)npc.isSitting);

                        case "LOOKS_DEAD":
                            return((long)npc.isAlikeDead);

                        default:
                            ScriptEngine.Script_Error("invalid target data(npc) request");
                            break;
                        }
                    }
                }    //unlock
                finally
                {
                    Globals.NPCLock.ExitReadLock();
                }
                break;
            }


            return((long)0);
        }
Example #13
0
        public static string TARGET_STRING(string req)
        {
            switch (Globals.gamedata.my_char.CurrentTargetType)
            {
            case TargetType.ERROR:
            case TargetType.NONE:
                break;

            case TargetType.SELF:
                switch (req)
                {
                case "NAME":
                    return(Globals.gamedata.my_char.Name);

                case "TITLE":
                    return(Globals.gamedata.my_char.Title);

                case "CLAN":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName);

                case "ALLY":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName);

                default:
                    ScriptEngine.Script_Error("invalid invalid target data(self) request");
                    break;
                }
                break;

            case TargetType.MYPET:
                switch (req)
                {
                case "NAME":
                    return(Globals.gamedata.my_pet.Name);

                case "TITLE":
                    return(Globals.gamedata.my_pet.Title);

                case "CLAN":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName);

                case "ALLY":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName);

                default:
                    ScriptEngine.Script_Error("invalid invalid target data(my pet) request");
                    break;
                }
                break;

            case TargetType.MYPET1:
                switch (req)
                {
                case "NAME":
                    return(Globals.gamedata.my_pet1.Name);

                case "TITLE":
                    return(Globals.gamedata.my_pet1.Title);

                case "CLAN":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName);

                case "ALLY":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName);

                default:
                    ScriptEngine.Script_Error("invalid invalid target data(my pet) request");
                    break;
                }
                break;

            case TargetType.MYPET2:
                switch (req)
                {
                case "NAME":
                    return(Globals.gamedata.my_pet2.Name);

                case "TITLE":
                    return(Globals.gamedata.my_pet2.Title);

                case "CLAN":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName);

                case "ALLY":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName);

                default:
                    ScriptEngine.Script_Error("invalid invalid target data(my pet) request");
                    break;
                }
                break;

            case TargetType.MYPET3:
                switch (req)
                {
                case "NAME":
                    return(Globals.gamedata.my_pet3.Name);

                case "TITLE":
                    return(Globals.gamedata.my_pet3.Title);

                case "CLAN":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName);

                case "ALLY":
                    return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName);

                default:
                    ScriptEngine.Script_Error("invalid invalid target data(my pet) request");
                    break;
                }
                break;

            case TargetType.PLAYER:
                Globals.PlayerLock.EnterReadLock();
                try
                {
                    CharInfo player = Util.GetChar(Globals.gamedata.my_char.TargetID);

                    if (player != null)
                    {
                        switch (req)
                        {
                        case "NAME":
                            return(player.Name);

                        case "TITLE":
                            return(player.Title);

                        case "CLAN":
                            return(((Clan_Info)Globals.clanlist[player.ClanID]).ClanName);

                        case "ALLY":
                            return(((Clan_Info)Globals.clanlist[player.ClanID]).AllyName);

                        default:
                            ScriptEngine.Script_Error("invalid invalid target data(player) request");
                            break;
                        }
                    }
                }    //unlock
                finally
                {
                    Globals.PlayerLock.ExitReadLock();
                }
                break;

            case TargetType.NPC:
                Globals.NPCLock.EnterReadLock();
                try
                {
                    NPCInfo npc = Util.GetNPC(Globals.gamedata.my_char.TargetID);

                    if (npc != null)
                    {
                        switch (req)
                        {
                        case "NAME":
                            return(Util.GetNPCName(npc.NPCID));

                        case "TITLE":
                            return(npc.Title);

                        default:
                            ScriptEngine.Script_Error("invalid target data(npc) request");
                            break;
                        }
                    }
                }    //unlock
                finally
                {
                    Globals.NPCLock.ExitReadLock();
                }
                break;
            }

            return("");
        }