ChangeStatus() public static méthode

public static ChangeStatus ( int id, byte type, byte stand ) : byte[]
id int
type byte
stand byte
Résultat byte[]
Exemple #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Player Actions / Sit / Stand / Walk etc
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        void Doaction()
        {
            try
            {
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                List <int>   toall  = Character.Spawn;
                byte         type   = Reader.Byte();

                switch (type)
                {
                case 2:
                    if (Character.Transport.Right)
                    {
                        Send(toall, Packet.SetSpeed(Character.Transport.Horse.UniqueID, Character.Transport.Horse.Speed1, Character.Transport.Horse.Speed2));
                        Send(toall, Packet.ChangeStatus(Character.Transport.Horse.UniqueID, type, 0));
                    }
                    Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0));
                    break;

                case 3:
                    if (Character.Transport.Right)
                    {
                        Send(toall, Packet.SetSpeed(Character.Transport.Horse.UniqueID, Character.Transport.Horse.Speed1, Character.Transport.Horse.Speed2));
                        Send(toall, Packet.ChangeStatus(Character.Transport.Horse.UniqueID, type, 0));
                    }
                    Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0));
                    break;

                case 4:
                    if (!Character.Stall.Stallactive && !Character.Transport.Right && !Character.Position.Walking && !Character.State.Die)
                    {
                        StartSitTimer(1000);
                    }
                    else
                    {
                        //Needs Error Packet InStall
                    }
                    break;

                default:
                    Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0));
                    break;
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Exemple #2
0
 void Player_Sit_Callback(object e)
 {
     try
     {
         if (!Character.State.Sitting && !Character.Stall.Stallactive)
         {
             List <int> toall = Character.Spawn;
             Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, 4, 4));
             StartSitDownTimer();
             Character.State.Sitting = true;
         }
         else
         {
             List <int> toall = Character.Spawn;
             Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, 4, 0));
             StopSitDownTimer();
             Character.State.Sitting = false;
         }
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
        void Handle()
        {
            try
            {
                //Read packet information
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                byte         iSlot  = Reader.Byte();
                //Get global item information
                Global.slotItem uItemID = GetItem((uint)Character.Information.CharacterID, iSlot, 0);
                //Checks before continuing
                if (uItemID.ID != 0 || !Character.State.Die)
                {
                    //###########################################################################################
                    // Grabpets
                    //###########################################################################################
                    #region Pets (PET OBJECTS)

                    // Grabpets
                    #region Grabpets
                    if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.GRABPET)
                    {
                        //Check if we have pet active allready.
                        if (!Character.Grabpet.Active && Character.Action.MonsterID.Count == 0)
                        {
                            //If not active , add new pet object.
                            HandleGrabPet(iSlot, uItemID.ID);
                            //Need to change this to active effect on slot.
                            HandleUpdateSlotn(iSlot, uItemID, Reader.Int32());
                        }
                    }
                    #endregion
                    // Attackpets
                    #region Attackpets
                    else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.ATTACKPET)
                    {
                        //Check if we have pet active allready.
                        if (!Character.Attackpet.Active && Character.Action.MonsterID.Count == 0 || !Character.Attackpet.Active && Character.Action.MonsterID == null)
                        {
                            //If not active , add new pet object.
                            if (!Character.Attackpet.Active)
                            {
                                HandleUpdateSlotn(iSlot, uItemID, Reader.Int32());
                                HandleAttackPet(iSlot, uItemID.ID);
                                client.Send(Packet.Update2(iSlot));
                                client.Send(Packet.ChangeStatus(Character.Information.UniqueID, 5, 0));
                            }
                        }
                    }
                    #endregion
                    #endregion
                    // Horses (NOTE: Detail error messages per if statement (if level, summoned etc).
                    #region Horses
                    if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.TRANSPORT)
                    {
                        //Checks before we continue
                        if (!Character.Stall.Stallactive && !Character.Transport.Right && Character.Action.MonsterID.Count == 0 && !Character.State.Sitting && !Character.Information.Scroll)
                        {
                            //Check if level is high enough
                            if (this.Character.Information.Level >= Data.ItemBase[uItemID.ID].Level)
                            {
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                                HandleHorseScroll(uItemID.ID);
                            }
                            //Else
                            else
                            {
                                client.Send(Packet.IngameMessages(SERVER_PLAYER_UPTOHORSE, IngameMessages.UIIT_MSG_COSPETERR_CANT_PETSUM_HIGHLEVEL));
                            }
                        }
                    }
                    #endregion
                    // Special transport
                    #region Special transport
                    else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.ATTACKPET)
                    {
                    }
                    #endregion
                    // Job Transport
                    #region Job Transport
                    else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.JOBTRANSPORT)
                    {
                        //HandleJobTransport(uItemID.ID);
                    }
                    #endregion
                    //###########################################################################################
                    // Potions
                    //###########################################################################################
                    #region Potions
                    #region HP potion
                    if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HPSTATPOTION)
                    {
                        HandlePotion(1, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    else if (Data.ItemBase[uItemID.ID].Name.Contains("_HP_") && Data.ItemBase[uItemID.ID].Name.Contains("_SUPERSET_"))
                    {
                        HandlePotion(1, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region HP STAT Potions
                    else if (Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.HPSTATPOTION)
                    {
                    }
                    #endregion
                    #region MP potions
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MP_POTION && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.MPSTATPOTION)
                    {
                        HandlePotion(2, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    else if (Data.ItemBase[uItemID.ID].Name.Contains("_MP_") && Data.ItemBase[uItemID.ID].Name.Contains("_SUPERSET_"))
                    {
                        HandlePotion(1, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region HP STAT Potions
                    else if (Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MPSTATPOTION)
                    {
                    }
                    #endregion
                    #region Vigor potions

                    /*
                     *  else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.VIGOR_POTION)
                     *  {
                     *      HandlePotion(5, uItemID.ID);
                     *      HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                     *  }
                     */
                    else if (Data.ItemBase[uItemID.ID].Name.Contains("ITEM_ETC_ALL_"))
                    {
                        HandlePotion(5, uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #region Speed potions
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.SPEED_POTION)
                    {
                        if (Character.Speed.DefaultSpeed == Character.Speed.RunSpeed ||
                            Character.Speed.DefaultSpeed + Character.Speed.Updateded[20] != Character.Speed.RunSpeed && Character.Information.Berserking)
                        {
                            this.SpecialBuff(Data.ItemBase[uItemID.ID].SkillID);
                            HandleUpdateSlot(iSlot, uItemID, Reader.UInt16());
                        }
                    }
                    #endregion
                    #region Berserk Potion
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.BERSERKPOTION)
                    {
                        if (Character.Information.BerserkBar < 5)
                        {
                            if (Character.Information.Berserking == false)
                            {
                                this.Character.Information.BerserkBar = 5;
                                client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar));
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                            }
                        }
                    }
                    #endregion
                    #endregion
                    //###########################################################################################
                    // Tickets
                    //###########################################################################################
                    #region Tickets
                    //Forgotten world
                    #region Forgotten world
                    else if (Data.ItemBase[uItemID.ID].Ticket == Global.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD)
                    {
                        //Must add check if user location currently is forgotten world.
                        //Must add level check of portal.
                        ForgottenWorld(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    #endregion
                    //###########################################################################################
                    // Global chat
                    //###########################################################################################
                    #region Global Chat
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.GLOBALCHAT)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        byte   something = Reader.Byte();
                        string text      = Reader.Text3();
                        Reader.Close();
                        SendAll(Packet.ChatPacket(6, 0, text, Character.Information.Name));
                    }
                    #endregion
                    //###########################################################################################
                    // Stall decoration
                    //###########################################################################################
                    #region Stall decoration
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.STALLDECORATION)
                    {
                        StallDeco(uItemID.ID, iSlot);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Monster masks
                    //###########################################################################################
                    #region Monster masks
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MONSTERMASK)
                    {
                        //If character monster mask isnt enabled allready.
                        if (!Character.Transformed)
                        {
                            if (Character.Information.Level >= Data.ItemBase[uItemID.ID].Level)
                            {
                                //Load Mask
                                MonsterMasks(uItemID.ID, iSlot);
                                HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                            }
                            else
                            {
                                //Send msg level to low
                            }
                        }
                        else
                        {
                            //Send msg allready in use
                        }
                    }
                    #endregion
                    //###########################################################################################
                    // Return scrolls
                    //###########################################################################################
                    #region Return scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.RETURNSCROLL && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.REVERSESCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        if (Timer.Movement != null)
                        {
                            Timer.Movement.Dispose();
                            Character.Position.Walking = false;
                        }
                        HandleReturnScroll(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Reverse scrolls
                    //###########################################################################################
                    #region Reverse scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.REVERSESCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        if (Character.Position.Walking)
                        {
                            return;
                        }
                        //Read item id
                        int itemid = Reader.Int32();
                        //Our switch byte
                        byte type = Reader.Byte();
                        //locations for reverse
                        int locid = 0;
                        if (type == 7)
                        {
                            locid = Reader.Int32();
                        }
                        //Start our handle
                        HandleReverse(itemid, type, locid);
                        //Update slot
                        HandleUpdateSlot(iSlot, uItemID, itemid);
                    }
                    #endregion
                    //###########################################################################################
                    // Thief scrolls
                    //###########################################################################################
                    #region Thief scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.BANDITSCROLL)
                    {
                        if (Character.Information.Scroll)
                        {
                            return;
                        }
                        HandleThiefScroll(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Summon scrolls
                    //###########################################################################################
                    #region Summon scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.SUMMONSCROLL)
                    {
                        HandleSummon(Character.Information.Level);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Skin change scrolls
                    //###########################################################################################
                    #region Skin change scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.CHANGESKIN)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        int skinmodel = Reader.Int32();
                        HandleSkinScroll(skinmodel, uItemID.ID);
                    }
                    #endregion
                    //###########################################################################################
                    // Item change tool
                    //###########################################################################################
                    #region Skin change scrolls
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.ITEMCHANGETOOL)
                    {
                        int  itemid     = Reader.Int32();
                        byte targetslot = Reader.Byte();
                        //Make sure the item target is not equiped.
                        if (targetslot < 13)
                        {
                            return;
                        }
                        //Continue
                        HandleUpdateSlot(iSlot, uItemID, itemid);
                        HandleItemChange(uItemID.ID, iSlot, targetslot);
                    }
                    #endregion
                    //###########################################################################################
                    // Dungeon items
                    //###########################################################################################
                    #region Forgotten world
                    else if (Data.ItemBase[uItemID.ID].Ticket == Global.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD)
                    {
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                        ForgottenWorld(uItemID.ID);
                    }
                    #endregion
                    //###########################################################################################
                    // Inventory expansion
                    //###########################################################################################
                    #region Inventory expansion
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.INVENTORYEXPANSION)
                    {
                        HandleInventoryExp(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Warehouse expansion
                    //###########################################################################################
                    #region Warehouse expansion
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.WAREHOUSE)
                    {
                        HandleWareHouse(uItemID.ID);
                        HandleUpdateSlot(iSlot, uItemID, Reader.Int32());
                    }
                    #endregion
                    //###########################################################################################
                    // Guild related
                    //###########################################################################################
                    #region Guild Icon
                    else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.GUILD_ICON)
                    {
                        HandleRegisterIcon();
                    }
                    #endregion
                    //###########################################################################################
                    // Non coded types
                    //###########################################################################################
                    else
                    {
                        //Need to make message in progress or such
                        Console.WriteLine("Non Coded Item ID: " + Data.ItemBase[uItemID.ID].ID + " Name: " + Data.ItemBase[uItemID.ID].Name + "");
                    }
                }
                // Close our packet reader
                Reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Item usage error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Exemple #4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Normal Transport
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        bool HandleHorseScroll(int ItemID)
        {
            try
            {
                int model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName);
                if (model == 0)
                {
                    string extrapath = null;
                    if (this.Character.Information.Level >= 1 && this.Character.Information.Level <= 5)
                    {
                        extrapath = "_5";
                    }
                    else if (this.Character.Information.Level >= 6 && this.Character.Information.Level <= 10)
                    {
                        extrapath = "_10";
                    }
                    else if (this.Character.Information.Level >= 11 && this.Character.Information.Level <= 20)
                    {
                        extrapath = "_20";
                    }
                    else if (this.Character.Information.Level >= 21 && this.Character.Information.Level <= 30)
                    {
                        extrapath = "_30";
                    }
                    else if (this.Character.Information.Level >= 31 && this.Character.Information.Level <= 45)
                    {
                        extrapath = "_45";
                    }
                    else if (this.Character.Information.Level >= 46 && this.Character.Information.Level <= 60)
                    {
                        extrapath = "_60";
                    }
                    else if (this.Character.Information.Level >= 61 && this.Character.Information.Level <= 75)
                    {
                        extrapath = "_75";
                    }
                    else if (this.Character.Information.Level >= 76 && this.Character.Information.Level <= 90)
                    {
                        extrapath = "_90";
                    }
                    else if (this.Character.Information.Level >= 91 && this.Character.Information.Level <= 105)
                    {
                        extrapath = "_105";
                    }
                    else if (this.Character.Information.Level >= 106 && this.Character.Information.Level <= 120)
                    {
                        extrapath = "_120";
                    }
                    model = Global.objectdata.GetItem(Data.ItemBase[ItemID].ObjectName + extrapath);
                    if (model == 0)
                    {
                        return(true);
                    }
                }
                pet_obj o = new pet_obj();
                o.Model    = model;
                o.Ids      = new Global.ID(Global.ID.IDS.Object);
                o.UniqueID = o.Ids.GetUniqueID;
                o.x        = Character.Position.x;
                o.z        = Character.Position.z;
                o.y        = Character.Position.y;
                o.xSec     = Character.Position.xSec;
                o.ySec     = Character.Position.ySec;
                o.Hp       = Data.ObjectBase[model].HP;
                o.OwnerID  = this.Character.Information.UniqueID;
                o.Speed1   = Data.ObjectBase[model].Speed1;
                o.Speed2   = Data.ObjectBase[model].Speed2;
                this.Character.Transport.Right = true;

                List <int> S = o.SpawnMe();
                o.Information = true;
                client.Send(Packet.Pet_Information(o.UniqueID, o.Model, o.Hp, Character.Information.CharacterID, o));
                Send(Packet.SetSpeed(o.UniqueID, o.Speed1, o.Speed2)); //Global Speed Update
                Send(Packet.ChangeStatus(o.UniqueID, 3, 0));           // Global Status
                Send(S, Packet.Player_UpToHorse(this.Character.Information.UniqueID, true, o.UniqueID));

                Systems.HelperObject.Add(o);
                this.Character.Transport.Horse = o;
                return(false);
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
            return(false);
        }